fix: plugins: exports.preview with a final ";" was ignored
Massimo Melina committed
Dec 24, 2025 at 14:56 UTC
47574311bb0880faa693d97fe472c2a48f0fca13
1 file changed
+2
-2
src/plugins.ts
+2
-2
@@ -648,11 +648,11 @@ onProcessExit(() =>
648
export function parsePluginSource(id: string, source: string) {
649
const pl: InactivePlugin = { id }
650
pl.description = tryJson(/exports.description\s*=\s*(".*")/.exec(source)?.[1])
651
- pl.repo = tryJson(/exports.repo\s*=\s*(\S*)/.exec(source)?.[1])
651
+ pl.repo = tryJson(/exports.repo\s*=\s*([^\s;]+)/.exec(source)?.[1])
652
pl.version = Number(/exports.version\s*=\s*(\d*\.?\d+)/.exec(source)?.[1]) ?? undefined
653
pl.apiRequired = tryJson(/exports.apiRequired\s*=\s*([ \d.,[\]]+)/.exec(source)?.[1]) ?? undefined
654
pl.isTheme = tryJson(/exports.isTheme\s*=\s*(true|false|"light"|"dark")/.exec(source)?.[1]) ?? (id.endsWith('-theme') || undefined)
655
- pl.preview = tryJson(/exports.preview\s*=\s*(.+)/.exec(source)?.[1]) ?? undefined
655
+ pl.preview = tryJson(/exports.preview\s*=\s*("(?:[^"\\]|\\.)*"|\[[\s\S]*?\])/.exec(source)?.[1]) ?? undefined
656
pl.depend = tryJson(/exports.depend\s*=\s*(\[[\s\S]*?])/m.exec(source)?.[1])?.filter((x: any) =>
657
typeof x.repo === 'string' && x.version === undefined || typeof x.version === 'number'
658
|| console.warn("plugin dependency discarded", x) )