html-bundle 6.1.2 → 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/LICENSE +2 -2
- package/dist/bundle.mjs +9 -11
- package/package.json +13 -13
- package/src/bundle.mts +16 -16
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2020 Fabian
|
|
3
|
+
Copyright (c) 2020 Fabian Klingenberg
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/dist/bundle.mjs
CHANGED
|
@@ -39,18 +39,13 @@ 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)) {
|
|
50
45
|
if (handlerFile) {
|
|
51
|
-
|
|
52
|
-
if (String(stdout))
|
|
46
|
+
execFilePromise("node", [handlerFile, file]).then(({ stdout }) => {
|
|
53
47
|
console.log("📋 Logging Handler: ", String(stdout));
|
|
48
|
+
});
|
|
54
49
|
}
|
|
55
50
|
else {
|
|
56
51
|
if ((await lstat(file)).isDirectory())
|
|
@@ -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);
|
|
@@ -160,18 +158,18 @@ async function build(files, firstRun = true) {
|
|
|
160
158
|
}
|
|
161
159
|
else if (!file.endsWith(".css")) {
|
|
162
160
|
if (handlerFile) {
|
|
163
|
-
|
|
164
|
-
if (String(stdout))
|
|
161
|
+
execFilePromise("node", [handlerFile, file]).then(({ stdout }) => {
|
|
165
162
|
console.log("📋 Logging Handler: ", String(stdout));
|
|
163
|
+
});
|
|
166
164
|
}
|
|
167
165
|
else {
|
|
168
166
|
await fileCopy(file);
|
|
169
167
|
}
|
|
170
168
|
}
|
|
171
169
|
else if (handlerFile) {
|
|
172
|
-
|
|
173
|
-
if (String(stdout))
|
|
170
|
+
execFilePromise("node", [handlerFile, file]).then(({ stdout }) => {
|
|
174
171
|
console.log("📋 Logging Handler: ", String(stdout));
|
|
172
|
+
});
|
|
175
173
|
}
|
|
176
174
|
serverSentEvents?.({ file, html });
|
|
177
175
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "html-bundle",
|
|
3
|
-
"version": "6.1.
|
|
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",
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
"esbuild",
|
|
17
17
|
"hydro-js"
|
|
18
18
|
],
|
|
19
|
-
"author": "Fabian
|
|
19
|
+
"author": "Fabian Klingenberg <klingenberg.fabian@gmx.de> (https://klingenberg.netlify.app/)",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@types/cssnano": "^5.
|
|
22
|
+
"@types/cssnano": "^5.1.0",
|
|
23
23
|
"@types/glob": "^8.1.0",
|
|
24
24
|
"@types/html-minifier-terser": "^7.0.2",
|
|
25
25
|
"@types/parse5": "^7.0.0",
|
|
26
26
|
"@types/postcss-load-config": "^3.0.1",
|
|
27
|
-
"typescript": "^5.
|
|
27
|
+
"typescript": "^5.5.4"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
@@ -32,19 +32,19 @@
|
|
|
32
32
|
},
|
|
33
33
|
"bugs": "https://github.com/Krutsch/html-bundle/issues",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@fastify/static": "^7.0.
|
|
35
|
+
"@fastify/static": "^7.0.4",
|
|
36
36
|
"@web/parse5-utils": "^2.1.0",
|
|
37
37
|
"await-spawn": "^4.0.2",
|
|
38
38
|
"chokidar": "^3.6.0",
|
|
39
|
-
"critters": "^0.0.
|
|
40
|
-
"cssnano": "^
|
|
41
|
-
"esbuild": "^0.
|
|
42
|
-
"fastify": "^4.
|
|
43
|
-
"glob": "^
|
|
39
|
+
"critters": "^0.0.24",
|
|
40
|
+
"cssnano": "^7.0.5",
|
|
41
|
+
"esbuild": "^0.23.1",
|
|
42
|
+
"fastify": "^4.28.1",
|
|
43
|
+
"glob": "^11.0.0",
|
|
44
44
|
"html-minifier-terser": "^7.2.0",
|
|
45
|
-
"hydro-js": "^1.5.
|
|
45
|
+
"hydro-js": "^1.5.19",
|
|
46
46
|
"parse5": "^7.1.2",
|
|
47
|
-
"postcss": "^8.4.
|
|
48
|
-
"postcss-load-config": "^
|
|
47
|
+
"postcss": "^8.4.41",
|
|
48
|
+
"postcss-load-config": "^6.0.1"
|
|
49
49
|
}
|
|
50
50
|
}
|
package/src/bundle.mts
CHANGED
|
@@ -56,23 +56,14 @@ 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
|
|
|
72
62
|
if (!SUPPORTED_FILES.test(file)) {
|
|
73
63
|
if (handlerFile) {
|
|
74
|
-
|
|
75
|
-
|
|
64
|
+
execFilePromise("node", [handlerFile, file]).then(({ stdout }) => {
|
|
65
|
+
console.log("📋 Logging Handler: ", String(stdout));
|
|
66
|
+
});
|
|
76
67
|
} else {
|
|
77
68
|
if ((await lstat(file)).isDirectory()) continue;
|
|
78
69
|
await fileCopy(file);
|
|
@@ -105,6 +96,14 @@ async function build(files: string[], firstRun = true) {
|
|
|
105
96
|
);
|
|
106
97
|
|
|
107
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
|
+
|
|
108
107
|
console.log(`⌛ Waiting for file changes ...`);
|
|
109
108
|
|
|
110
109
|
if (postcssFile) {
|
|
@@ -198,15 +197,16 @@ async function build(files: string[], firstRun = true) {
|
|
|
198
197
|
await minifyCode();
|
|
199
198
|
} else if (!file.endsWith(".css")) {
|
|
200
199
|
if (handlerFile) {
|
|
201
|
-
|
|
202
|
-
if (String(stdout))
|
|
200
|
+
execFilePromise("node", [handlerFile, file]).then(({ stdout }) => {
|
|
203
201
|
console.log("📋 Logging Handler: ", String(stdout));
|
|
202
|
+
});
|
|
204
203
|
} else {
|
|
205
204
|
await fileCopy(file);
|
|
206
205
|
}
|
|
207
206
|
} else if (handlerFile) {
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
execFilePromise("node", [handlerFile, file]).then(({ stdout }) => {
|
|
208
|
+
console.log("📋 Logging Handler: ", String(stdout));
|
|
209
|
+
});
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
serverSentEvents?.({ file, html });
|