html-bundle 6.0.5 → 6.0.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { performance } from "perf_hooks";
3
- import { readFile, rm, writeFile, readdir } from "fs/promises";
3
+ import { readFile, rm, writeFile, readdir, lstat } from "fs/promises";
4
4
  import { execFile } from "child_process";
5
5
  import { promisify } from "util";
6
6
  import glob from "glob";
@@ -52,6 +52,8 @@ async function build(err, files, firstRun = true) {
52
52
  console.log("📋 Logging Handler: ", String(stdout));
53
53
  }
54
54
  else {
55
+ if ((await lstat(file)).isDirectory())
56
+ continue;
55
57
  await fileCopy(file);
56
58
  }
57
59
  }
package/dist/utils.mjs CHANGED
@@ -207,7 +207,8 @@ function getHMRCode(file, id, src) {
207
207
  for (const key of elem.getAttributeNames()) {
208
208
  clone.setAttribute(key, elem.getAttribute(key));
209
209
  }
210
- clone.setAttribute(attr, elem.getAttribute(attr) + "?v=" + String(Math.random().toFixed(4)).slice(2));
210
+ const attrVal = elem.getAttribute(attr);
211
+ if (attrVal) clone.setAttribute(attr, attrVal + "?v=" + String(Math.random().toFixed(4)).slice(2));
211
212
  render(clone, elem, false);
212
213
  }
213
214
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-bundle",
3
- "version": "6.0.5",
3
+ "version": "6.0.8",
4
4
  "description": "A very simple bundler for HTML SFC",
5
5
  "bin": "./dist/bundle.mjs",
6
6
  "scripts": {
@@ -18,12 +18,12 @@
18
18
  "author": "Fabian Krutsch <f.krutsch@gmx.de> (https://krutsch.netlify.app/)",
19
19
  "license": "MIT",
20
20
  "devDependencies": {
21
- "@types/cssnano": "^4.0.1",
21
+ "@types/cssnano": "^5.0.0",
22
22
  "@types/glob": "^7.2.0",
23
23
  "@types/html-minifier-terser": "^6.1.0",
24
24
  "@types/parse5": "^6.0.3",
25
25
  "@types/postcss-load-config": "^3.0.1",
26
- "typescript": "^4.5.4"
26
+ "typescript": "^4.6.3"
27
27
  },
28
28
  "repository": {
29
29
  "type": "git",
@@ -33,17 +33,17 @@
33
33
  "dependencies": {
34
34
  "@web/parse5-utils": "^1.3.0",
35
35
  "await-spawn": "^4.0.2",
36
- "chokidar": "^3.5.2",
36
+ "chokidar": "^3.5.3",
37
37
  "critical": "^4.0.1",
38
- "cssnano": "^5.0.14",
39
- "esbuild": "^0.14.9",
40
- "fastify": "^3.25.3",
41
- "fastify-static": "^4.5.0",
42
- "glob": "^7.2.0",
38
+ "cssnano": "^5.1.7",
39
+ "esbuild": "^0.14.36",
40
+ "fastify": "^3.28.0",
41
+ "fastify-static": "^4.6.1",
42
+ "glob": "^8.0.1",
43
43
  "html-minifier-terser": "^6.1.0",
44
- "hydro-js": "^1.5.3",
44
+ "hydro-js": "^1.5.10",
45
45
  "parse5": "^6.0.1",
46
- "postcss": "^8.4.5",
47
- "postcss-load-config": "^3.1.0"
46
+ "postcss": "^8.4.12",
47
+ "postcss-load-config": "^3.1.4"
48
48
  }
49
49
  }
package/src/bundle.mts CHANGED
@@ -3,7 +3,7 @@
3
3
  import type { TextNode } from "parse5";
4
4
  import type { AcceptedPlugin } from "postcss";
5
5
  import { performance } from "perf_hooks";
6
- import { readFile, rm, writeFile, readdir } from "fs/promises";
6
+ import { readFile, rm, writeFile, readdir, lstat } from "fs/promises";
7
7
  import { execFile } from "child_process";
8
8
  import { promisify } from "util";
9
9
  import glob from "glob";
@@ -71,6 +71,7 @@ async function build(err: any, files: string[], firstRun = true) {
71
71
  const { stdout } = await execFilePromise("node", [handlerFile, file]);
72
72
  if (String(stdout)) console.log("📋 Logging Handler: ", String(stdout));
73
73
  } else {
74
+ if ((await lstat(file)).isDirectory()) continue;
74
75
  await fileCopy(file);
75
76
  }
76
77
  } else {
package/src/utils.mts CHANGED
@@ -243,7 +243,8 @@ function getHMRCode(file: string, id: string, src: string) {
243
243
  for (const key of elem.getAttributeNames()) {
244
244
  clone.setAttribute(key, elem.getAttribute(key));
245
245
  }
246
- clone.setAttribute(attr, elem.getAttribute(attr) + "?v=" + String(Math.random().toFixed(4)).slice(2));
246
+ const attrVal = elem.getAttribute(attr);
247
+ if (attrVal) clone.setAttribute(attr, attrVal + "?v=" + String(Math.random().toFixed(4)).slice(2));
247
248
  render(clone, elem, false);
248
249
  }
249
250
  });