Skip to content

Commit 258df3d

Browse files
committed
k
1 parent b8ef773 commit 258df3d

21 files changed

Lines changed: 91 additions & 27 deletions

File tree

fix.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
3+
find . \( \
4+
-name node_modules \
5+
-o -name .git \
6+
-o -name coverage \
7+
-o -name noprettier \
8+
-o -name .opencode \
9+
\) -prune -o -type f -name "*.html" -print0 | \
10+
xargs -0 grep -El '<script[[:space:]]+src="/dist/[^"]+\.bundle\.js"></script>' | node fix.ts
11+
12+
13+
14+
find . \( \
15+
-name node_modules \
16+
-o -name .git \
17+
-o -name coverage \
18+
-o -name noprettier \
19+
-o -name .opencode \
20+
\) -prune -o -type f -name "*.html" -print0 | \
21+
xargs -0 grep -El '<link[[:space:]]+rel="stylesheet"[[:space:]]+href="/dist/[^"]+\.bundle\.css"[[:space:]]*/?>' | node fix.ts

fix.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
import { readFileSync, writeFileSync } from 'node:fs';
3+
import { createInterface } from 'node:readline';
4+
5+
const rl = createInterface({
6+
input: process.stdin,
7+
terminal: false,
8+
});
9+
10+
rl.on('line', (line) => {
11+
const filePath = line.trim();
12+
if (!filePath) return;
13+
14+
try {
15+
let content = readFileSync(filePath, 'utf8');
16+
let changed = false;
17+
18+
// Replace JS
19+
content = content.replace(/\/dist\/([^"]+)\.bundle\.js/g, (match, name) => {
20+
if (name.endsWith('.entry')) {
21+
return match;
22+
}
23+
changed = true;
24+
return `/dist/${name}.entry.bundle.js`;
25+
});
26+
27+
// Replace CSS
28+
content = content.replace(/\/dist\/([^"]+)\.bundle\.css/g, (match, name) => {
29+
if (name.endsWith('.entry')) {
30+
return match;
31+
}
32+
changed = true;
33+
return `/dist/${name}.entry.bundle.css`;
34+
});
35+
36+
if (changed) {
37+
writeFileSync(filePath, content);
38+
console.log(`Updated: ${filePath}`);
39+
}
40+
} catch (err) {
41+
console.error(`Error processing ${filePath}:`, err);
42+
}
43+
});

pages/bash/xx/lib/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
<div id="easing"></div>
3030

3131
<pre></pre>
32-
<script src="/dist/range.test.bundle.js"></script>
32+
<script src="/dist/range.test.entry.bundle.js"></script>
3333
</body>
3434
</html>

pages/databases/firebase/firebase.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
<script src="/public/preprocessed.js?cjs-firebase.html"></script>
2222
<!-- despite get parameter preprocessed.js will be browser cached anyway even when loading more than one. Even when mixing techniques -> CJS | ESM -->
23-
<script src="/dist/firebase.core.bundle.js"></script>
24-
<script src="/dist/firebase.bundle.js"></script>
23+
<script src="/dist/firebase.core.entry.bundle.js"></script>
24+
<script src="/dist/firebase.entry.bundle.js"></script>
2525
<script type="module" src="/js/github.js"></script>
2626
</body>
2727
</html>

pages/humanjson/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@
4848
</div>
4949
</div>
5050
<script type="module" src="/js/github.js"></script>
51-
<script src="/dist/humanjson.bundle.js"></script>
51+
<script src="/dist/humanjson.entry.bundle.js"></script>
5252
</body>
5353
</html>

pages/js/line/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,6 @@
116116
<script src="/pages/js/line/dependencies/uint8-to-b64.js"></script>
117117
<script src="/pages/js/line/dependencies/protobuf.min.js"></script>
118118

119-
<script src="/dist/line.bundle.js"></script>
119+
<script src="/dist/line.entry.bundle.js"></script>
120120
</body>
121121
</html>

pages/js/popper/popover-react/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/>
99

1010
<title>Popover React - UI Component</title>
11-
<link rel="stylesheet" href="/dist/popper.bundle.css" />
11+
<link rel="stylesheet" href="/dist/popper.entry.bundle.css" />
1212
</head>
1313
<body class="layout bg" toc>
1414
<div class="body">
@@ -100,6 +100,6 @@ <h2>Simple example</h2>
100100
<br />
101101

102102
<script type="module" src="/js/github.js"></script>
103-
<script src="/dist/popper.bundle.js"></script>
103+
<script src="/dist/popper.entry.bundle.js"></script>
104104
</body>
105105
</html>

pages/js/sound.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
<script src="/public/preprocessed.js?sound.html"></script>
5555
<!-- despite get parameter preprocessed.js will be browser cached anyway even when loading more than one. Even when mixing techniques -> CJS | ESM -->
56-
<script src="/dist/sound.bundle.js"></script>
56+
<script src="/dist/sound.entry.bundle.js"></script>
5757
<script type="module" src="/js/github.js"></script>
5858
</body>
5959
</html>

pages/js/visibilityState/focus.react.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ <h2>react focus</h2>
2424
</div>
2525
</div>
2626
<script type="module" src="/js/github.js"></script>
27-
<script src="/dist/visiblestate.focus.bundle.js"></script>
27+
<script src="/dist/visiblestate.focus.entry.bundle.js"></script>
2828
</body>
2929
</html>

pages/js/visibilityState/visible.react.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ <h2>vanilla</h2>
2323
</div>
2424
</div>
2525
<script type="module" src="/js/github.js"></script>
26-
<script src="/dist/visiblestate.visible.bundle.js"></script>
26+
<script src="/dist/visiblestate.visible.entry.bundle.js"></script>
2727
</body>
2828
</html>

0 commit comments

Comments
 (0)