html-bundle 6.0.20 → 6.0.21

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
@@ -19,6 +19,7 @@ const isCritical = process.argv.includes("--isCritical") || bundleConfig.isCriti
19
19
  const critters = new Critters({
20
20
  path: bundleConfig.build,
21
21
  logLevel: "silent",
22
+ ...bundleConfig.critical,
22
23
  });
23
24
  const isSecure = process.argv.includes("--secure") || bundleConfig.secure; // uses CSP for critical too
24
25
  const handlerFile = process.argv.includes("--handler")
package/dist/utils.mjs CHANGED
@@ -72,7 +72,11 @@ async function getBundleConfig() {
72
72
  esbuild: {},
73
73
  "html-minifier-terser": {},
74
74
  critical: {},
75
+ isCritical: false,
75
76
  deletePrev: true,
77
+ hmr: false,
78
+ secure: false,
79
+ handler: "",
76
80
  };
77
81
  try {
78
82
  const cfgPath = path.resolve(process.cwd(), "bundle.config.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-bundle",
3
- "version": "6.0.20",
3
+ "version": "6.0.21",
4
4
  "description": "A very simple bundler for HTML SFC",
5
5
  "bin": "./dist/bundle.mjs",
6
6
  "scripts": {
@@ -37,8 +37,8 @@
37
37
  "chokidar": "^3.5.3",
38
38
  "critters": "^0.0.20",
39
39
  "cssnano": "^6.0.2",
40
- "esbuild": "^0.19.10",
41
- "fastify": "^4.25.1",
40
+ "esbuild": "^0.19.11",
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",
package/src/bundle.mts CHANGED
@@ -33,6 +33,7 @@ const isCritical =
33
33
  const critters = new Critters({
34
34
  path: bundleConfig.build,
35
35
  logLevel: "silent",
36
+ ...bundleConfig.critical,
36
37
  });
37
38
  const isSecure = process.argv.includes("--secure") || bundleConfig.secure; // uses CSP for critical too
38
39
  const handlerFile = process.argv.includes("--handler")
package/src/utils.mts CHANGED
@@ -1,3 +1,6 @@
1
+ import type { Options as HTMLOptions } from "html-minifier-terser";
2
+ import type { Options } from "critters";
3
+ import type { BuildOptions } from "esbuild";
1
4
  import type { Node } from "@web/parse5-utils";
2
5
  import type { FastifyServerOptions } from "fastify";
3
6
  import { copyFile, mkdir, readFile } from "fs/promises";
@@ -86,15 +89,32 @@ export async function getPostCSSConfig() {
86
89
  }
87
90
  }
88
91
 
89
- async function getBundleConfig() {
92
+ export type Config = {
93
+ build: string;
94
+ src: string;
95
+ port: number;
96
+ secure: boolean;
97
+ esbuild?: BuildOptions;
98
+ "html-minifier-terser"?: HTMLOptions;
99
+ critical?: Options;
100
+ deletePrev?: boolean;
101
+ isCritical?: boolean;
102
+ hmr?: boolean;
103
+ handler?: string;
104
+ };
105
+ async function getBundleConfig(): Promise<Config> {
90
106
  const base = {
91
107
  build: "build",
92
108
  src: "src",
93
109
  port: 5000,
94
110
  esbuild: {},
95
111
  "html-minifier-terser": {},
96
- critical: {},
97
112
  deletePrev: true,
113
+ critical: {},
114
+ isCritical: false,
115
+ hmr: false,
116
+ secure: false,
117
+ handler: "",
98
118
  };
99
119
 
100
120
  try {