html-bundle 6.1.3 → 6.1.4

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
@@ -39,11 +39,6 @@ if (bundleConfig.deletePrev) {
39
39
  await rm(bundleConfig.build, { force: true, recursive: true });
40
40
  }
41
41
  async function build(files, firstRun = true) {
42
- if (isHMR && firstRun) {
43
- fastify = await createDefaultServer(isSecure);
44
- await fastify.listen({ port: bundleConfig.port, host: "::" });
45
- console.log(`💻 Server listening on http${isSecure ? "s" : ""}://localhost:${bundleConfig.port}. and is shared in the local network.`);
46
- }
47
42
  for (const file of files) {
48
43
  await createDir(file);
49
44
  if (!SUPPORTED_FILES.test(file)) {
@@ -84,6 +79,9 @@ async function build(files, firstRun = true) {
84
79
  }
85
80
  console.log(`🚀 Build finished in ${(performance.now() - timer).toFixed(2)}ms ✨`);
86
81
  if (isHMR && firstRun) {
82
+ fastify = await createDefaultServer(isSecure);
83
+ await fastify.listen({ port: bundleConfig.port, host: "::" });
84
+ console.log(`💻 Server listening on http${isSecure ? "s" : ""}://localhost:${bundleConfig.port} and is shared in the local network.`);
87
85
  console.log(`⌛ Waiting for file changes ...`);
88
86
  if (postcssFile) {
89
87
  const postCSSWatcher = watch(postcssFile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-bundle",
3
- "version": "6.1.3",
3
+ "version": "6.1.4",
4
4
  "description": "A very simple bundler for HTML SFC",
5
5
  "bin": "./dist/bundle.mjs",
6
6
  "types": "./src/config.d.ts",
@@ -37,8 +37,8 @@
37
37
  "await-spawn": "^4.0.2",
38
38
  "chokidar": "^3.6.0",
39
39
  "critters": "^0.0.24",
40
- "cssnano": "^7.0.4",
41
- "esbuild": "^0.23.0",
40
+ "cssnano": "^7.0.5",
41
+ "esbuild": "^0.23.1",
42
42
  "fastify": "^4.28.1",
43
43
  "glob": "^11.0.0",
44
44
  "html-minifier-terser": "^7.2.0",
package/src/bundle.mts CHANGED
@@ -56,16 +56,6 @@ if (bundleConfig.deletePrev) {
56
56
  }
57
57
 
58
58
  async function build(files: string[], firstRun = true) {
59
- if (isHMR && firstRun) {
60
- fastify = await createDefaultServer(isSecure);
61
- await fastify.listen({ port: bundleConfig.port, host: "::" });
62
- console.log(
63
- `💻 Server listening on http${isSecure ? "s" : ""}://localhost:${
64
- bundleConfig.port
65
- }. and is shared in the local network.`
66
- );
67
- }
68
-
69
59
  for (const file of files) {
70
60
  await createDir(file);
71
61
 
@@ -106,6 +96,14 @@ async function build(files: string[], firstRun = true) {
106
96
  );
107
97
 
108
98
  if (isHMR && firstRun) {
99
+ fastify = await createDefaultServer(isSecure);
100
+ await fastify.listen({ port: bundleConfig.port, host: "::" });
101
+ console.log(
102
+ `💻 Server listening on http${isSecure ? "s" : ""}://localhost:${
103
+ bundleConfig.port
104
+ } and is shared in the local network.`
105
+ );
106
+
109
107
  console.log(`⌛ Waiting for file changes ...`);
110
108
 
111
109
  if (postcssFile) {