Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit 5ea89a9

Browse files
committed
Make tests pass on GitHub actions. Node 10 doesn't support matchAll?
1 parent eeebbe2 commit 5ea89a9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/core/create_manifest_data.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ import { Page, PageComponent, ServerRoute, ManifestData } from '../interfaces';
55
import { posixify, reserved_words } from '../utils';
66

77
export function template_has_preload(content: string) {
8-
const matches = content.matchAll(/<script.*?context="module".*?>([^]*?)<\/script>/g);
9-
for (const source of matches) {
10-
const source_minus_comments = tippex.erase(source[1]);
8+
const regex = /<script.*?context="module".*?>([^]*?)<\/script>/g;
9+
let m;
10+
while ((m = regex.exec(content)) !== null) {
11+
// This is necessary to avoid infinite loops with zero-width matches
12+
if (m.index === regex.lastIndex) {
13+
regex.lastIndex++;
14+
}
15+
16+
const source_minus_comments = tippex.erase(m[1]);
1117
if (/export\s+.*?preload/.test(source_minus_comments)) {
1218
return true;
1319
}

0 commit comments

Comments
 (0)