Skip to content

Commit 04eb49f

Browse files
committed
refactor(catalog): read script tag refs like the other capture groups
1 parent f7260ba commit 04eb49f

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

‎scripts/catalog-payload-assets.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,7 @@ const isScriptFile = (ref: string) => isFileReference(ref) && /\.m?js$/i.test(pa
374374

375375
/** Project script files a `<script src>` loads; their bytes are read later, so missing ones stay. */
376376
function localScriptTagRefs(html: string): Set<string> {
377-
return new Set(
378-
[...html.matchAll(SCRIPT_WITH_SRC)].flatMap(([, , , ref]) =>
379-
ref && isScriptFile(ref) ? [ref] : [],
380-
),
381-
);
377+
return new Set([...html.matchAll(SCRIPT_WITH_SRC)].map((m) => m[3] ?? "").filter(isScriptFile));
382378
}
383379

384380
/** The docs host's CSP runs inline scripts but refuses a `data:` script, so a project script file

0 commit comments

Comments
 (0)