html-bundle 5.4.18 → 6.0.0-beta

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/esm/bundle.js DELETED
@@ -1,636 +0,0 @@
1
- #!/usr/bin/env node
2
- import fs from "fs";
3
- import { performance } from "perf_hooks";
4
- import Event from "events";
5
- import glob from "glob";
6
- import path from "path";
7
- import Fastify from "fastify";
8
- import fastifyStatic from "fastify-static";
9
- import postcss from "postcss";
10
- import postcssrc from "postcss-load-config";
11
- import cssnano from "cssnano";
12
- import esbuild from "esbuild";
13
- import critical from "critical";
14
- import { minify } from "html-minifier-terser";
15
- import { watch } from "chokidar";
16
- import { serialize, parse, parseFragment } from "parse5";
17
- import {
18
- createScript,
19
- getTagName,
20
- appendChild,
21
- findElement,
22
- findElements,
23
- } from "@web/parse5-utils";
24
- // CLI and options
25
- const isCritical = process.argv.includes("--critical");
26
- const isHMR = process.argv.includes("--hmr");
27
- const isCSP = process.argv.includes("--csp");
28
- const isSecure = process.argv.includes("--secure");
29
- const isServeOnly = process.argv.includes("--serveOnly");
30
- let fastify;
31
- if (isServeOnly) {
32
- createDefaultServer();
33
- fastify.listen(5000);
34
- console.log(`💻 Sever listening on port 5000.`);
35
- } else {
36
- process.env.NODE_ENV = isHMR ? "development" : "production";
37
- let { plugins, options, file } = createPostCSSConfig();
38
- let CSSprocessor = postcss(plugins);
39
- // Performance Observer and file watcher
40
- const globHTML = new Event.EventEmitter();
41
- const taskEmitter = new Event.EventEmitter();
42
- const start = performance.now();
43
- let expectedTasks = 0; // This will be increased in globHandlers
44
- let finishedTasks = 0; // Current status
45
- taskEmitter.on("done", () => {
46
- finishedTasks++;
47
- if (finishedTasks === expectedTasks) {
48
- console.log(
49
- `🚀 Build finished in ${(performance.now() - start).toFixed(2)}ms ✨`
50
- );
51
- if (isHMR) {
52
- if (file) {
53
- const postCSSWatcher = watch(file);
54
- postCSSWatcher.on("change", () => {
55
- console.log("⚡ modified postcss.config – CSS will rebuild now.");
56
- const newConfig = createPostCSSConfig();
57
- plugins = newConfig.plugins;
58
- options = newConfig.options;
59
- CSSprocessor = postcss(plugins);
60
- glob(`${SOURCE_FOLDER}/**/*.css`, {}, (err, files) => {
61
- errorHandler(err);
62
- expectedTasks += files.length;
63
- for (const filename of files) {
64
- const [buildFilename, buildPathDir] = getBuildNames(filename);
65
- fs.mkdirSync(buildPathDir, { recursive: true });
66
- minifyCSS(filename, buildFilename);
67
- }
68
- });
69
- });
70
- }
71
- console.log(`⌛ Waiting for file changes ...`);
72
- const watcher = watch(SOURCE_FOLDER);
73
- // The add watcher will add all the files initially - do not rebuild them
74
- let initialAdd = 0;
75
- let hasJSTS = false;
76
- watcher.on("add", (filename) => {
77
- // Return if it was added by the build system itself
78
- if (/-bundle-\d+\.(j|t)sx?$/.test(filename)) {
79
- return;
80
- }
81
- filename = String.raw`${filename}`.replace(/\\/g, "/");
82
- if (filename.endsWith(".html") || filename.endsWith(".css")) {
83
- initialAdd++;
84
- } else if (hasJSTS === false && /\.(j|t)sx?$/.test(filename)) {
85
- hasJSTS = true;
86
- initialAdd++;
87
- }
88
- if (initialAdd <= expectedTasks) return;
89
- const [buildFilename, buildPathDir] = getBuildNames(filename);
90
- fs.mkdir(buildPathDir, { recursive: true }, (err) => {
91
- errorHandler(err);
92
- rebuild(filename);
93
- console.log(`⚡ added ${buildFilename}`);
94
- });
95
- });
96
- watcher.on("change", (filename) => {
97
- // Return if it was changed by the build system itself
98
- if (/-bundle-\d+\.(j|t)sx?$/.test(filename)) {
99
- return;
100
- }
101
- filename = String.raw`${filename}`.replace(/\\/g, "/");
102
- rebuild(filename);
103
- const [buildFilename] = getBuildNames(filename);
104
- console.log(`⚡ modified ${buildFilename}`);
105
- });
106
- watcher.on("unlink", (filename) => {
107
- // Return if it was deleted by the build system itself
108
- if (/-bundle-\d+\.(j|t)sx?$/.test(filename)) {
109
- return;
110
- }
111
- filename = String.raw`${filename}`.replace(/\\/g, "/");
112
- JSTSFiles.delete(filename);
113
- const [buildFilename, buildPathDir] = getBuildNames(filename);
114
- fs.rm(tsMaybeX2JS(buildFilename), (err) => {
115
- errorHandler(err);
116
- console.log(`⚡ deleted ${buildFilename}`);
117
- const length = fs.readdirSync(buildPathDir).length;
118
- if (!length) fs.rmdir(buildPathDir, errorHandler);
119
- });
120
- });
121
- }
122
- }
123
- });
124
- // Basic configuration
125
- const SOURCE_FOLDER = "src";
126
- const BUILD_FOLDER = "build";
127
- const TEMPLATE_LITERAL_MINIFIER = /\n\s+/g;
128
- const CONNECTIONS = []; // HMR
129
- let htmlTasks = 0;
130
- let serverSentEvents;
131
- if (isHMR) {
132
- fastify = Fastify(
133
- isSecure
134
- ? {
135
- http2: true,
136
- https: {
137
- key: fs.readFileSync(
138
- path.join(process.cwd(), "localhost-key.pem")
139
- ),
140
- cert: fs.readFileSync(path.join(process.cwd(), "localhost.pem")),
141
- },
142
- }
143
- : void 0
144
- );
145
- fastify.setNotFoundHandler((_req, reply) => {
146
- const file = fs.readFileSync(
147
- path.join(process.cwd(), BUILD_FOLDER, "/index.html"),
148
- {
149
- encoding: "utf-8",
150
- }
151
- );
152
- reply.header("Content-Type", "text/html; charset=UTF-8");
153
- return reply.send(addHMRCode(file, "build/index.html"));
154
- });
155
- fastify.register(fastifyStatic, {
156
- root: path.join(process.cwd(), BUILD_FOLDER),
157
- });
158
- fastify.get("/events", (_req, reply) => {
159
- reply.raw.setHeader("Content-Type", "text/event-stream");
160
- reply.raw.setHeader("Cache-Control", "no-cache");
161
- !isSecure && reply.raw.setHeader("Connection", "keep-alive");
162
- CONNECTIONS.push(reply.raw);
163
- serverSentEvents = (data) =>
164
- CONNECTIONS.forEach((rep) => {
165
- rep.write(`data: ${JSON.stringify(data)}\n\n`);
166
- });
167
- });
168
- }
169
- // THE BUNDLE CODE
170
- // Glob all files and transform the code
171
- glob(`${SOURCE_FOLDER}/**/*.html`, {}, (err, files) => {
172
- errorHandler(err);
173
- expectedTasks += files.length;
174
- htmlTasks += files.length;
175
- if (isHMR) {
176
- createHMRHandlers(files);
177
- fastify.listen(5000);
178
- console.log(`💻 Sever listening on port 5000.`);
179
- }
180
- });
181
- glob(`${SOURCE_FOLDER}/**/*.css`, {}, (err, files) => {
182
- errorHandler(err);
183
- expectedTasks += files.length;
184
- for (const filename of files) {
185
- const [buildFilename, buildPathDir] = getBuildNames(filename);
186
- fs.mkdirSync(buildPathDir, { recursive: true });
187
- minifyCSS(filename, buildFilename);
188
- }
189
- });
190
- const JSTSFiles = new Set();
191
- glob(`${SOURCE_FOLDER}/**/!(*.d).{ts,js,tsx,jsx}`, {}, (err, files) => {
192
- errorHandler(err);
193
- if (files.length) {
194
- expectedTasks += 1;
195
- } else {
196
- globHTML.emit("getReady");
197
- }
198
- files.forEach((file) => JSTSFiles.add(file));
199
- minifyTSJS().catch(errorHandler);
200
- });
201
- globHTML.on("getReady", () => {
202
- if (expectedTasks - htmlTasks === finishedTasks) {
203
- // After CSS and JS because critical needs file built css files and inline script might reference js files.
204
- glob(`${SOURCE_FOLDER}/**/*.html`, {}, async (err, files) => {
205
- errorHandler(err);
206
- await createGlobalJS(files);
207
- files.forEach((filename) => {
208
- const [buildFilename, buildPathDir] = getBuildNames(filename);
209
- fs.mkdirSync(buildPathDir, { recursive: true });
210
- minifyHTML(filename, buildFilename);
211
- });
212
- });
213
- }
214
- });
215
- function createGlobalJS(files) {
216
- const scriptFilenames = [];
217
- files.forEach((filename) => {
218
- const fileText = fs.readFileSync(filename, { encoding: "utf-8" });
219
- let DOM;
220
- if (fileText.includes("<!DOCTYPE html>") || fileText.includes("<html")) {
221
- DOM = parse(fileText);
222
- } else {
223
- DOM = parseFragment(fileText);
224
- }
225
- const scripts = findElements(DOM, (e) => getTagName(e) === "script");
226
- scripts.forEach((script, index) => {
227
- const scriptTextNode = script.childNodes[0];
228
- const isReferencedScript = script.attrs.find((a) => a.name === "src");
229
- //@ts-ignore
230
- const scriptContent = scriptTextNode?.value;
231
- if (!scriptContent || isReferencedScript) return;
232
- const jsFilename = filename.replace(".html", `-bundle-${index}.js`);
233
- scriptFilenames.push(jsFilename);
234
- fs.writeFileSync(jsFilename, scriptContent);
235
- });
236
- });
237
- scriptFilenames.forEach((file) => JSTSFiles.add(file));
238
- return minifyTSJS(true)
239
- .catch(console.error)
240
- .finally(() =>
241
- scriptFilenames.forEach((file) => {
242
- JSTSFiles.delete(file);
243
- try {
244
- fs.rmSync(file);
245
- } catch {}
246
- })
247
- );
248
- }
249
- function minifyTSJS(isInline = false, file) {
250
- return esbuild
251
- .build({
252
- entryPoints: Array.from(JSTSFiles),
253
- charset: "utf8",
254
- format: "esm",
255
- incremental: isHMR,
256
- sourcemap: isHMR,
257
- splitting: true,
258
- define: {
259
- "process.env.NODE_ENV": isHMR ? '"development"' : '"production"',
260
- },
261
- loader: { ".js": "jsx", ".ts": "tsx" },
262
- bundle: true,
263
- minify: true,
264
- outdir: BUILD_FOLDER,
265
- outbase: SOURCE_FOLDER,
266
- })
267
- .then(() => {
268
- if (!isInline) {
269
- taskEmitter.emit("done");
270
- globHTML.emit("getReady");
271
- if (serverSentEvents) {
272
- const changedFile = tsMaybeX2JS(file);
273
- const [buildFilename] = getBuildNames(changedFile);
274
- const js = fs.readFileSync(buildFilename, { encoding: "utf8" });
275
- serverSentEvents({
276
- js,
277
- filename: buildFilename.split(`${BUILD_FOLDER}/`).pop(),
278
- });
279
- }
280
- }
281
- });
282
- }
283
- function minifyCSS(filename, buildFilename) {
284
- const fileText = fs.readFileSync(filename, { encoding: "utf-8" });
285
- return CSSprocessor.process(fileText, {
286
- ...options,
287
- from: filename,
288
- to: buildFilename,
289
- })
290
- .then((result) => {
291
- fs.writeFileSync(buildFilename, result.css);
292
- taskEmitter.emit("done");
293
- globHTML.emit("getReady");
294
- if (serverSentEvents) {
295
- serverSentEvents({
296
- css: result.css,
297
- filename: buildFilename.split(`${BUILD_FOLDER}/`).pop(),
298
- });
299
- }
300
- })
301
- .catch((err) => {
302
- console.error(err);
303
- });
304
- }
305
- async function minifyHTML(filename, buildFilename) {
306
- let fileText = fs.readFileSync(filename, { encoding: "utf-8" });
307
- let DOM;
308
- if (fileText.includes("<!DOCTYPE html>") || fileText.includes("<html")) {
309
- DOM = parse(fileText);
310
- } else {
311
- DOM = parseFragment(fileText);
312
- }
313
- // Minify Code
314
- const scripts = findElements(DOM, (e) => getTagName(e) === "script");
315
- scripts.forEach((script, index) => {
316
- const scriptTextNode = script.childNodes[0];
317
- const isReferencedScript = script.attrs.find((a) => a.name === "src");
318
- //@ts-ignore
319
- if (!scriptTextNode?.value || isReferencedScript) return;
320
- // Use bundled file and remove it from fs
321
- const bundledFilename = buildFilename.replace(
322
- ".html",
323
- `-bundle-${index}.js`
324
- );
325
- try {
326
- const scriptContent = fs.readFileSync(bundledFilename, {
327
- encoding: "utf-8",
328
- });
329
- fs.rmSync(bundledFilename);
330
- // Replace src with bundled code
331
- //@ts-ignore
332
- scriptTextNode.value = scriptContent.replace(
333
- TEMPLATE_LITERAL_MINIFIER,
334
- " "
335
- );
336
- } catch {}
337
- });
338
- // Minify Inline Style
339
- const styles = findElements(DOM, (e) => getTagName(e) === "style");
340
- for (const style of styles) {
341
- const node = style.childNodes[0];
342
- //@ts-ignore
343
- const styleContent = node?.value;
344
- if (!styleContent) continue;
345
- const { css } = await CSSprocessor.process(styleContent, {
346
- ...options,
347
- from: undefined,
348
- });
349
- //@ts-ignore
350
- node.value = css;
351
- }
352
- fileText = serialize(DOM);
353
- // Minify HTML
354
- fileText = await minify(fileText, {
355
- collapseWhitespace: true,
356
- removeComments: true,
357
- });
358
- if (isCritical) {
359
- const buildFilenameArr = buildFilename.split("/");
360
- const fileWithBase = buildFilenameArr.pop();
361
- const buildDir = buildFilenameArr.join("/");
362
- // critical is generating the files on the fs
363
- return critical
364
- .generate({
365
- base: buildDir,
366
- html: fileText,
367
- target: fileWithBase,
368
- inline: !isCSP,
369
- extract: true,
370
- rebase: () => {},
371
- })
372
- .then(({ html }) => {
373
- taskEmitter.emit("done");
374
- if (serverSentEvents) {
375
- serverSentEvents({
376
- html: addHMRCode(html, buildFilename),
377
- filename: buildFilename,
378
- });
379
- }
380
- })
381
- .catch((err) => {
382
- console.error(err);
383
- });
384
- } else {
385
- fs.writeFileSync(buildFilename, fileText);
386
- taskEmitter.emit("done");
387
- if (serverSentEvents) {
388
- serverSentEvents({
389
- html: addHMRCode(fileText, buildFilename),
390
- filename: buildFilename,
391
- });
392
- }
393
- }
394
- }
395
- // Helper functions from here
396
- function createPostCSSConfig() {
397
- try {
398
- return postcssrc.sync({});
399
- } catch {
400
- return { plugins: [cssnano], options: {}, file: "" };
401
- }
402
- }
403
- function getBuildNames(filename) {
404
- const buildFilename = filename.replace(
405
- `${SOURCE_FOLDER}/`,
406
- `${BUILD_FOLDER}/`
407
- );
408
- const buildFilenameArr = buildFilename.split("/");
409
- buildFilenameArr.pop();
410
- const buildPathDir = buildFilenameArr.join("/");
411
- return [buildFilename, buildPathDir];
412
- }
413
- async function rebuild(filename) {
414
- const [buildFilename] = getBuildNames(filename);
415
- if (/\.(j|t)sx?$/.test(filename)) {
416
- JSTSFiles.add(filename);
417
- } else if (filename.endsWith(".css")) {
418
- await minifyCSS(filename, buildFilename);
419
- }
420
- glob(`${SOURCE_FOLDER}/**/*.html`, {}, async (err, files) => {
421
- errorHandler(err);
422
- await createGlobalJS(files);
423
- if (filename.endsWith(".html")) {
424
- minifyHTML(filename, buildFilename);
425
- } else if (
426
- /\.(j|t)sx?$/.test(filename) ||
427
- (filename.endsWith(".css") && isCritical)
428
- ) {
429
- for (const htmlFilename of files) {
430
- const [htmlBuildFilename] = getBuildNames(htmlFilename);
431
- await minifyHTML(htmlFilename, htmlBuildFilename);
432
- }
433
- if (/\.(j|t)sx?$/.test(filename) && serverSentEvents) {
434
- const jsFile = tsMaybeX2JS(buildFilename);
435
- try {
436
- // Do not try to send empty files
437
- serverSentEvents({
438
- js: fs.readFileSync(jsFile, { encoding: "utf-8" }),
439
- filename: jsFile.split(`${BUILD_FOLDER}/`).pop(),
440
- });
441
- } catch {}
442
- }
443
- }
444
- });
445
- }
446
- const getHMRCode = (
447
- filename,
448
- id
449
- ) => `import { render, html, setShouldSetReactivity, $$, setGlobalSchedule, setInsertDiffing } from "https://unpkg.com/hydro-js/dist/library.js";
450
-
451
- if (!window.eventsource${id}) {
452
- setGlobalSchedule(false);
453
- setShouldSetReactivity(false);
454
-
455
- window.eventsource${id} = new EventSource("/events");
456
- window.eventsource${id}.addEventListener("message", ({ data }) => {
457
- const dataObj = JSON.parse(data);
458
-
459
- if ("html" in dataObj && "${filename}" === dataObj.filename) {
460
- setInsertDiffing(true);
461
-
462
- let newHTML;
463
- let isBody;
464
-
465
- if (dataObj.html.startsWith('<!DOCTYPE html>') || dataObj.html.startsWith('<html')) {
466
- newHTML = html\`\${dataObj.html}\`;
467
- } else {
468
- newHTML = html\`<body>\${dataObj.html}</body>\`
469
- isBody = true
470
- }
471
-
472
- if (isBody) {
473
- const hmrID = "${id}";
474
- const hmrElems = Array.from(newHTML.childNodes);
475
- const hmrWheres = Array.from($$(\`[data-hmr="\${hmrID}"]\`))
476
- // Render new Elements in old Elements, also remove rest old Elements and add add new elements after the last old one
477
- hmrWheres.forEach((where, index) => {
478
- if (index < hmrElems.length) {
479
- render(hmrElems[index], where);
480
- } else {
481
- where.remove();
482
- }
483
- });
484
- for (let rest = hmrWheres.length; rest < hmrElems.length; rest++) {
485
- if (hmrWheres.length) {
486
- const template = document.createElement('template');
487
- hmrElems[hmrWheres.length - 1].after(template);
488
- render(hmrElems[rest], template);
489
- template.remove();
490
- } else {
491
- render(hmrElems[rest])
492
- }
493
- }
494
- } else {
495
- const oldElementCount = document.body.querySelectorAll('*').length;
496
- render(newHTML, document.documentElement);
497
- const newElementCount = document.body.querySelectorAll('*').length;
498
-
499
- // Looks like JS did not reload? Last resort - hard refresh
500
- if (newElementCount < 5 && Math.abs(newElementCount - oldElementCount) > 10) {
501
- location.reload()
502
- }
503
- }
504
- setInsertDiffing(false);
505
- if (dataObj.filename === 'build/index.html') {
506
- dispatchEvent(new Event("popstate"));
507
- }
508
- } else if ("css" in dataObj) {
509
- window.onceEveryXTime(100, window.updateCSS, [updateAttr]);
510
- } else if ("js" in dataObj) {
511
- window.onceEveryXTime(100, window.updateJS, [updateAttr]);
512
- }
513
-
514
- function updateAttr (attr, forceUpdate = false) {
515
- return (elem) => {
516
- const attrValue = elem[attr].replace(/\\?v=.*/, "");
517
- if (forceUpdate || attrValue.endsWith(dataObj.filename)) {
518
- elem[attr] = \`\${attrValue}?v=\${Math.random().toFixed(4)}\`;
519
- } else if (elem.localName === 'script' && !elem.src && new RegExp(\`["']\${dataObj.filename}["']\`).test(elem.textContent)) {
520
- elem.setAttribute('data-inline', String(Math.random().toFixed(4)).slice(2));
521
- }
522
- }
523
- };
524
- });
525
-
526
- if (!window.updateCSS) {
527
- window.updateCSS = function updateCSS(updateAttr) {
528
- $$('link').forEach(updateAttr("href"));
529
- window.fnToLastCalled.set(window.updateCSS, performance.now())
530
- }
531
- }
532
- if (!window.updateJS) {
533
- window.updateJS = function updateJS(updateAttr) {
534
- window.fnToLastCalled.set(window.updateJS, performance.now());
535
- const copy = html\`\${document.documentElement.outerHTML}\`;
536
- copy.querySelectorAll('script').forEach(updateAttr("src"));
537
- render(copy, document.documentElement);
538
- }
539
- }
540
- if (!window.fnToLastCalled) {
541
- window.fnToLastCalled = new Map();
542
- }
543
- if (!window.onceEveryXTime) {
544
- window.onceEveryXTime = function (time, fn, params) {
545
- if (!window.fnToLastCalled.has(fn) || performance.now() - window.fnToLastCalled.get(fn) > time) {
546
- fn(...params)
547
- }
548
- }
549
- }
550
- }`;
551
- function randomText() {
552
- return Math.random().toString(32).slice(2);
553
- }
554
- const htmlIdMap = new Map();
555
- function addHMRCode(html, filename) {
556
- if (!htmlIdMap.has(filename)) {
557
- htmlIdMap.set(filename, randomText());
558
- }
559
- const script = createScript(
560
- { type: "module" },
561
- getHMRCode(filename, htmlIdMap.get(filename))
562
- );
563
- let ast;
564
- if (html.includes("<!DOCTYPE html>") || html.includes("<html")) {
565
- ast = parse(html);
566
- const headNode = findElement(ast, (e) => getTagName(e) === "head");
567
- appendChild(headNode, script);
568
- } else {
569
- ast = parseFragment(html);
570
- appendChild(ast, script);
571
- ast.childNodes.forEach((node) =>
572
- //@ts-ignore
573
- node.attrs?.push({ name: "data-hmr", value: htmlIdMap.get(filename) })
574
- );
575
- }
576
- // Burst CSS cache
577
- findElements(ast, (e) => getTagName(e) === "link").forEach((link) => {
578
- const href = link.attrs.find((attr) => attr.name === "href");
579
- const rel = link.attrs.find((attr) => attr.name === "rel");
580
- if (rel.value === "stylesheet") {
581
- href.value += `?v=${Math.random().toFixed(4)}`;
582
- }
583
- });
584
- return serialize(ast);
585
- }
586
- function createHMRHandlers(files) {
587
- files.forEach((filename) => {
588
- const newFilename = "/" + filename.replace(/src\//, "");
589
- const filePath = newFilename.split("/");
590
- const endName = filePath.pop();
591
- if (endName.endsWith("index.html")) {
592
- //@ts-ignore
593
- fastify.get(filePath.join("/") + "/", HMRHandler);
594
- }
595
- //@ts-ignore
596
- fastify.get(newFilename, HMRHandler);
597
- });
598
- }
599
- function HMRHandler(request, reply) {
600
- let filename = request.url;
601
- if (filename.endsWith("/")) {
602
- filename += "index.html";
603
- }
604
- filename = BUILD_FOLDER + filename;
605
- const file = fs.readFileSync(filename, {
606
- encoding: "utf-8",
607
- });
608
- reply.header("Content-Type", "text/html; charset=UTF-8");
609
- return reply.send(addHMRCode(file, filename));
610
- }
611
- function errorHandler(err) {
612
- if (err) {
613
- console.error(err);
614
- process.exit(1);
615
- }
616
- }
617
- function tsMaybeX2JS(filename) {
618
- return filename.replace(".ts", ".js").replace(".jsx", ".js");
619
- }
620
- }
621
- function createDefaultServer(BUILD_FOLDER = "build") {
622
- fastify = Fastify(
623
- isSecure
624
- ? {
625
- http2: true,
626
- https: {
627
- key: fs.readFileSync(path.join(process.cwd(), "localhost-key.pem")),
628
- cert: fs.readFileSync(path.join(process.cwd(), "localhost.pem")),
629
- },
630
- }
631
- : void 0
632
- );
633
- fastify.register(fastifyStatic, {
634
- root: path.join(process.cwd(), BUILD_FOLDER),
635
- });
636
- }