html-bundle 6.0.21 → 6.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.mjs +6 -2
- package/dist/utils.mjs +1 -1
- package/package.json +3 -3
- package/src/bundle.mts +10 -2
package/dist/bundle.mjs
CHANGED
|
@@ -244,8 +244,9 @@ async function writeInlineScripts(file) {
|
|
|
244
244
|
const script = scripts[index];
|
|
245
245
|
const scriptTextNode = script.childNodes[0];
|
|
246
246
|
const isReferencedScript = script.attrs.find((a) => a.name === "src");
|
|
247
|
+
const type = script.attrs.find((a) => a.name === "type");
|
|
247
248
|
const scriptContent = scriptTextNode?.value;
|
|
248
|
-
if (!scriptContent || isReferencedScript)
|
|
249
|
+
if (!scriptContent || isReferencedScript || type?.value === "importmap")
|
|
249
250
|
continue;
|
|
250
251
|
const jsFile = file.replace(".html", `-bundle-${index}.tsx`);
|
|
251
252
|
inlineFiles.add(jsFile);
|
|
@@ -274,7 +275,10 @@ async function minifyHTML(file, buildFile) {
|
|
|
274
275
|
const script = scripts[index];
|
|
275
276
|
const scriptTextNode = script.childNodes[0];
|
|
276
277
|
const isReferencedScript = script.attrs.find((a) => a.name === "src");
|
|
277
|
-
|
|
278
|
+
const type = script.attrs.find((a) => a.name === "type");
|
|
279
|
+
if (!scriptTextNode?.value ||
|
|
280
|
+
isReferencedScript ||
|
|
281
|
+
type?.value === "importmap")
|
|
278
282
|
continue;
|
|
279
283
|
// Use bundled file
|
|
280
284
|
const buildInlineScript = buildFile.replace(".html", `-bundle-${index}.js`);
|
package/dist/utils.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "html-bundle",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.22",
|
|
4
4
|
"description": "A very simple bundler for HTML SFC",
|
|
5
5
|
"bin": "./dist/bundle.mjs",
|
|
6
6
|
"scripts": {
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"await-spawn": "^4.0.2",
|
|
37
37
|
"chokidar": "^3.5.3",
|
|
38
38
|
"critters": "^0.0.20",
|
|
39
|
-
"cssnano": "^6.0.
|
|
39
|
+
"cssnano": "^6.0.3",
|
|
40
40
|
"esbuild": "^0.19.11",
|
|
41
41
|
"fastify": "^4.25.2",
|
|
42
42
|
"glob": "^10.3.10",
|
|
43
43
|
"html-minifier-terser": "^7.2.0",
|
|
44
44
|
"hydro-js": "^1.5.14",
|
|
45
45
|
"parse5": "^7.1.2",
|
|
46
|
-
"postcss": "^8.4.
|
|
46
|
+
"postcss": "^8.4.33",
|
|
47
47
|
"postcss-load-config": "^5.0.2"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/src/bundle.mts
CHANGED
|
@@ -293,8 +293,10 @@ async function writeInlineScripts(file: string) {
|
|
|
293
293
|
const isReferencedScript = script.attrs.find(
|
|
294
294
|
(a: { name: string }) => a.name === "src"
|
|
295
295
|
);
|
|
296
|
+
const type = script.attrs.find((a: { name: string }) => a.name === "type");
|
|
296
297
|
const scriptContent = scriptTextNode?.value;
|
|
297
|
-
if (!scriptContent || isReferencedScript)
|
|
298
|
+
if (!scriptContent || isReferencedScript || type?.value === "importmap")
|
|
299
|
+
continue;
|
|
298
300
|
|
|
299
301
|
const jsFile = file.replace(".html", `-bundle-${index}.tsx`);
|
|
300
302
|
inlineFiles.add(jsFile);
|
|
@@ -327,7 +329,13 @@ async function minifyHTML(file: string, buildFile: string) {
|
|
|
327
329
|
const isReferencedScript = script.attrs.find(
|
|
328
330
|
(a: { name: string }) => a.name === "src"
|
|
329
331
|
);
|
|
330
|
-
|
|
332
|
+
const type = script.attrs.find((a: { name: string }) => a.name === "type");
|
|
333
|
+
if (
|
|
334
|
+
!scriptTextNode?.value ||
|
|
335
|
+
isReferencedScript ||
|
|
336
|
+
type?.value === "importmap"
|
|
337
|
+
)
|
|
338
|
+
continue;
|
|
331
339
|
|
|
332
340
|
// Use bundled file
|
|
333
341
|
const buildInlineScript = buildFile.replace(".html", `-bundle-${index}.js`);
|