@blinkk/root 1.0.0-alpha.5 → 1.0.0-alpha.7
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/cli.d.ts +1 -1
- package/dist/cli.js +129 -58
- package/dist/cli.js.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js.map +1 -1
- package/dist/render.d.ts +1 -1
- package/dist/{types-27ca8c1c.d.ts → types-2af24c42.d.ts} +5 -0
- package/package.json +1 -1
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -50,12 +50,15 @@ async function isDirectory(dirpath) {
|
|
|
50
50
|
throw err;
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
+
function fileExists(filepath) {
|
|
54
|
+
return fs.access(filepath).then(() => true).catch(() => false);
|
|
55
|
+
}
|
|
53
56
|
|
|
54
57
|
// src/render/vite-plugin-root.ts
|
|
55
58
|
var JSX_ELEMENTS_REGEX = /jsxs?\("(\w[\w-]+\w)"/g;
|
|
56
59
|
var HTML_ELEMENTS_REGEX = /<(\w[\w-]+\w)/g;
|
|
57
60
|
function pluginRoot(options) {
|
|
58
|
-
var _a;
|
|
61
|
+
var _a, _b;
|
|
59
62
|
const elementsVirtualId = "virtual:root-elements";
|
|
60
63
|
const resolvedElementsVirtualId = "\0" + elementsVirtualId;
|
|
61
64
|
const rootDir = (options == null ? void 0 : options.rootDir) || process.cwd();
|
|
@@ -71,6 +74,10 @@ function pluginRoot(options) {
|
|
|
71
74
|
}
|
|
72
75
|
elementsDirs.push(elementsDir);
|
|
73
76
|
});
|
|
77
|
+
const excludePatterns = ((_b = rootConfig.elements) == null ? void 0 : _b.exclude) || [];
|
|
78
|
+
const excludeElement = (moduleId) => {
|
|
79
|
+
return excludePatterns.some((pattern) => Boolean(moduleId.match(pattern)));
|
|
80
|
+
};
|
|
74
81
|
let elementMap;
|
|
75
82
|
async function updateElementMap() {
|
|
76
83
|
elementMap = {};
|
|
@@ -86,7 +93,9 @@ function pluginRoot(options) {
|
|
|
86
93
|
if (isJsFile(parts.base)) {
|
|
87
94
|
const fullPath = path2.join(dirPath, file);
|
|
88
95
|
const moduleId = fullPath.slice(rootDir.length);
|
|
89
|
-
|
|
96
|
+
if (!excludeElement(moduleId)) {
|
|
97
|
+
elementMap[parts.name] = moduleId;
|
|
98
|
+
}
|
|
90
99
|
}
|
|
91
100
|
});
|
|
92
101
|
})
|
|
@@ -389,32 +398,22 @@ async function dev(rootDir) {
|
|
|
389
398
|
}
|
|
390
399
|
|
|
391
400
|
// src/cli/commands/build.ts
|
|
392
|
-
import
|
|
401
|
+
import path5 from "node:path";
|
|
393
402
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
394
403
|
import fsExtra2 from "fs-extra";
|
|
395
404
|
import glob3 from "tiny-glob";
|
|
396
405
|
import { build as viteBuild } from "vite";
|
|
397
406
|
|
|
398
407
|
// src/render/asset-map/build-asset-map.ts
|
|
399
|
-
import path5 from "path";
|
|
400
408
|
var BuildAssetMap = class {
|
|
401
|
-
constructor(
|
|
402
|
-
this.manifest = manifest;
|
|
403
|
-
this.elementMap = options.elementMap;
|
|
409
|
+
constructor() {
|
|
404
410
|
this.moduleIdToAsset = /* @__PURE__ */ new Map();
|
|
405
|
-
Object.keys(this.manifest).forEach((manifestKey) => {
|
|
406
|
-
const moduleId = `/${manifestKey}`;
|
|
407
|
-
this.moduleIdToAsset.set(
|
|
408
|
-
moduleId,
|
|
409
|
-
new BuildAsset(this, moduleId, this.manifest[manifestKey])
|
|
410
|
-
);
|
|
411
|
-
});
|
|
412
411
|
}
|
|
413
412
|
async get(moduleId) {
|
|
414
413
|
return this.moduleIdToAsset.get(moduleId) || null;
|
|
415
414
|
}
|
|
416
|
-
|
|
417
|
-
|
|
415
|
+
add(asset) {
|
|
416
|
+
this.moduleIdToAsset.set(asset.moduleId, asset);
|
|
418
417
|
}
|
|
419
418
|
toJson() {
|
|
420
419
|
const result = {};
|
|
@@ -423,19 +422,46 @@ var BuildAssetMap = class {
|
|
|
423
422
|
}
|
|
424
423
|
return result;
|
|
425
424
|
}
|
|
425
|
+
static fromViteManifest(viteManifest, elementMap) {
|
|
426
|
+
const assetMap = new BuildAssetMap();
|
|
427
|
+
const elementModuleIds = /* @__PURE__ */ new Set();
|
|
428
|
+
Object.values(elementMap).forEach(
|
|
429
|
+
(moduleId) => elementModuleIds.add(moduleId)
|
|
430
|
+
);
|
|
431
|
+
Object.keys(viteManifest).forEach((manifestKey) => {
|
|
432
|
+
const moduleId = `/${manifestKey}`;
|
|
433
|
+
const manifestChunk = viteManifest[manifestKey];
|
|
434
|
+
const isElement = elementModuleIds.has(moduleId);
|
|
435
|
+
const assetData = {
|
|
436
|
+
moduleId,
|
|
437
|
+
assetUrl: `/${manifestChunk.file}`,
|
|
438
|
+
importedModules: (manifestChunk.imports || []).map(
|
|
439
|
+
(relPath) => `/${relPath}`
|
|
440
|
+
),
|
|
441
|
+
importedCss: (manifestChunk.css || []).map((relPath) => `/${relPath}`),
|
|
442
|
+
isElement
|
|
443
|
+
};
|
|
444
|
+
assetMap.add(new BuildAsset(assetMap, assetData));
|
|
445
|
+
});
|
|
446
|
+
return assetMap;
|
|
447
|
+
}
|
|
448
|
+
static fromRootManifest(rootManifest) {
|
|
449
|
+
const assetMap = new BuildAssetMap();
|
|
450
|
+
Object.keys(rootManifest).forEach((moduleId) => {
|
|
451
|
+
const assetData = rootManifest[moduleId];
|
|
452
|
+
assetMap.add(new BuildAsset(assetMap, assetData));
|
|
453
|
+
});
|
|
454
|
+
return assetMap;
|
|
455
|
+
}
|
|
426
456
|
};
|
|
427
457
|
var BuildAsset = class {
|
|
428
|
-
constructor(assetMap,
|
|
458
|
+
constructor(assetMap, assetData) {
|
|
429
459
|
this.assetMap = assetMap;
|
|
430
|
-
this.moduleId = moduleId;
|
|
431
|
-
this.
|
|
432
|
-
this.
|
|
433
|
-
this.
|
|
434
|
-
|
|
435
|
-
);
|
|
436
|
-
this.importedCss = (this.manifestData.css || []).map(
|
|
437
|
-
(relPath) => `/${relPath}`
|
|
438
|
-
);
|
|
460
|
+
this.moduleId = assetData.moduleId;
|
|
461
|
+
this.assetUrl = assetData.assetUrl;
|
|
462
|
+
this.importedModules = assetData.importedModules;
|
|
463
|
+
this.importedCss = assetData.importedCss;
|
|
464
|
+
this.isElement = assetData.isElement;
|
|
439
465
|
}
|
|
440
466
|
async getCssDeps() {
|
|
441
467
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -460,8 +486,7 @@ var BuildAsset = class {
|
|
|
460
486
|
return;
|
|
461
487
|
}
|
|
462
488
|
visited.add(asset.moduleId);
|
|
463
|
-
|
|
464
|
-
if ([".js", ".jsx", ".ts", ".tsx"].includes(parts.ext) && this.assetMap.isElement(asset.moduleId)) {
|
|
489
|
+
if (asset.isElement) {
|
|
465
490
|
urls.add(asset.assetUrl);
|
|
466
491
|
}
|
|
467
492
|
await Promise.all(
|
|
@@ -497,35 +522,36 @@ var BuildAsset = class {
|
|
|
497
522
|
moduleId: this.moduleId,
|
|
498
523
|
assetUrl: this.assetUrl,
|
|
499
524
|
importedModules: this.importedModules,
|
|
500
|
-
importedCss: this.importedCss
|
|
525
|
+
importedCss: this.importedCss,
|
|
526
|
+
isElement: this.isElement
|
|
501
527
|
};
|
|
502
528
|
}
|
|
503
529
|
};
|
|
504
530
|
|
|
505
531
|
// src/cli/commands/build.ts
|
|
506
|
-
var __dirname2 =
|
|
532
|
+
var __dirname2 = path5.dirname(fileURLToPath2(import.meta.url));
|
|
507
533
|
async function build(rootProjectDir) {
|
|
508
534
|
var _a;
|
|
509
535
|
console.log("\u{1F333} Root.js");
|
|
510
536
|
const rootDir = rootProjectDir || process.cwd();
|
|
511
537
|
const rootConfig = await loadRootConfig(rootDir);
|
|
512
|
-
const distDir =
|
|
538
|
+
const distDir = path5.join(rootDir, "dist");
|
|
513
539
|
await rmDir(distDir);
|
|
514
540
|
await makeDir(distDir);
|
|
515
541
|
const pages = [];
|
|
516
|
-
if (await isDirectory(
|
|
517
|
-
const pageFiles = await glob3(
|
|
542
|
+
if (await isDirectory(path5.join(rootDir, "routes"))) {
|
|
543
|
+
const pageFiles = await glob3(path5.join(rootDir, "routes/**/*"));
|
|
518
544
|
pageFiles.forEach((file) => {
|
|
519
|
-
const parts =
|
|
545
|
+
const parts = path5.parse(file);
|
|
520
546
|
if (!parts.name.startsWith("_") && isJsFile(parts.base)) {
|
|
521
547
|
pages.push(file);
|
|
522
548
|
}
|
|
523
549
|
});
|
|
524
550
|
}
|
|
525
|
-
const elementsDirs = [
|
|
551
|
+
const elementsDirs = [path5.join(rootDir, "elements")];
|
|
526
552
|
const elementsInclude = ((_a = rootConfig.elements) == null ? void 0 : _a.include) || [];
|
|
527
553
|
for (const dirPath of elementsInclude) {
|
|
528
|
-
const elementsDir =
|
|
554
|
+
const elementsDir = path5.resolve(rootDir, dirPath);
|
|
529
555
|
if (!elementsDir.startsWith(rootDir)) {
|
|
530
556
|
throw new Error(
|
|
531
557
|
`the elements dir (${dirPath}) should be relative to the project's root dir (${rootDir})`
|
|
@@ -539,9 +565,9 @@ async function build(rootProjectDir) {
|
|
|
539
565
|
if (await isDirectory(dirPath)) {
|
|
540
566
|
const elementFiles = await glob3("**/*", { cwd: dirPath });
|
|
541
567
|
elementFiles.forEach((file) => {
|
|
542
|
-
const parts =
|
|
568
|
+
const parts = path5.parse(file);
|
|
543
569
|
if (isJsFile(parts.base)) {
|
|
544
|
-
const fullPath =
|
|
570
|
+
const fullPath = path5.join(dirPath, file);
|
|
545
571
|
const moduleId = fullPath.slice(rootDir.length);
|
|
546
572
|
elements.push(fullPath);
|
|
547
573
|
elementMap[parts.name] = moduleId;
|
|
@@ -550,10 +576,10 @@ async function build(rootProjectDir) {
|
|
|
550
576
|
}
|
|
551
577
|
}
|
|
552
578
|
const bundleScripts = [];
|
|
553
|
-
if (await isDirectory(
|
|
554
|
-
const bundleFiles = await glob3(
|
|
579
|
+
if (await isDirectory(path5.join(rootDir, "bundles"))) {
|
|
580
|
+
const bundleFiles = await glob3(path5.join(rootDir, "bundles/*"));
|
|
555
581
|
bundleFiles.forEach((file) => {
|
|
556
|
-
const parts =
|
|
582
|
+
const parts = path5.parse(file);
|
|
557
583
|
if (isJsFile(parts.base)) {
|
|
558
584
|
bundleScripts.push(file);
|
|
559
585
|
}
|
|
@@ -576,14 +602,14 @@ async function build(rootProjectDir) {
|
|
|
576
602
|
publicDir: false,
|
|
577
603
|
build: {
|
|
578
604
|
rollupOptions: {
|
|
579
|
-
input: [
|
|
605
|
+
input: [path5.resolve(__dirname2, "./render.js")],
|
|
580
606
|
output: {
|
|
581
607
|
format: "esm",
|
|
582
608
|
chunkFileNames: "chunks/[name].[hash].js",
|
|
583
609
|
assetFileNames: "assets/[name].[hash][extname]"
|
|
584
610
|
}
|
|
585
611
|
},
|
|
586
|
-
outDir:
|
|
612
|
+
outDir: path5.join(distDir, "server"),
|
|
587
613
|
ssr: true,
|
|
588
614
|
ssrManifest: false,
|
|
589
615
|
cssCodeSplit: true,
|
|
@@ -609,7 +635,7 @@ async function build(rootProjectDir) {
|
|
|
609
635
|
assetFileNames: "assets/[name].[hash][extname]"
|
|
610
636
|
}
|
|
611
637
|
},
|
|
612
|
-
outDir:
|
|
638
|
+
outDir: path5.join(distDir, "client"),
|
|
613
639
|
ssr: false,
|
|
614
640
|
ssrManifest: false,
|
|
615
641
|
manifest: true,
|
|
@@ -620,24 +646,24 @@ async function build(rootProjectDir) {
|
|
|
620
646
|
reportCompressedSize: false
|
|
621
647
|
}
|
|
622
648
|
});
|
|
623
|
-
const
|
|
624
|
-
|
|
649
|
+
const viteManifest = await loadJson(
|
|
650
|
+
path5.join(distDir, "client/manifest.json")
|
|
625
651
|
);
|
|
626
|
-
const assetMap =
|
|
652
|
+
const assetMap = BuildAssetMap.fromViteManifest(viteManifest, elementMap);
|
|
627
653
|
writeFile(
|
|
628
|
-
|
|
654
|
+
path5.join(distDir, "client/root-manifest.json"),
|
|
629
655
|
JSON.stringify(assetMap.toJson(), null, 2)
|
|
630
656
|
);
|
|
631
|
-
const buildDir =
|
|
632
|
-
const publicDir =
|
|
633
|
-
if (fsExtra2.existsSync(
|
|
657
|
+
const buildDir = path5.join(distDir, "html");
|
|
658
|
+
const publicDir = path5.join(rootDir, "public");
|
|
659
|
+
if (fsExtra2.existsSync(path5.join(rootDir, "public"))) {
|
|
634
660
|
fsExtra2.copySync(publicDir, buildDir);
|
|
635
661
|
} else {
|
|
636
662
|
makeDir(buildDir);
|
|
637
663
|
}
|
|
638
|
-
copyDir(
|
|
639
|
-
copyDir(
|
|
640
|
-
const render = await import(
|
|
664
|
+
copyDir(path5.join(distDir, "client/assets"), path5.join(buildDir, "assets"));
|
|
665
|
+
copyDir(path5.join(distDir, "client/chunks"), path5.join(buildDir, "chunks"));
|
|
666
|
+
const render = await import(path5.join(distDir, "server/render.js"));
|
|
641
667
|
const renderer = new render.Renderer(rootConfig);
|
|
642
668
|
const sitemap = await renderer.getSitemap();
|
|
643
669
|
await Promise.all(
|
|
@@ -647,21 +673,66 @@ async function build(rootProjectDir) {
|
|
|
647
673
|
assetMap,
|
|
648
674
|
routeParams: params
|
|
649
675
|
});
|
|
650
|
-
let outPath =
|
|
676
|
+
let outPath = path5.join(distDir, `html${urlPath}`, "index.html");
|
|
651
677
|
if (outPath.endsWith("404/index.html")) {
|
|
652
678
|
outPath = outPath.replace("404/index.html", "404.html");
|
|
653
679
|
}
|
|
654
680
|
const html = await htmlMinify(data.html || "");
|
|
655
681
|
await writeFile(outPath, html);
|
|
656
|
-
const relPath = outPath.slice(
|
|
682
|
+
const relPath = outPath.slice(path5.dirname(distDir).length + 1);
|
|
657
683
|
console.log(`saved ${relPath}`);
|
|
658
684
|
})
|
|
659
685
|
);
|
|
660
686
|
}
|
|
661
687
|
|
|
662
688
|
// src/cli/commands/start.ts
|
|
663
|
-
|
|
664
|
-
|
|
689
|
+
import path6 from "node:path";
|
|
690
|
+
import { default as express2 } from "express";
|
|
691
|
+
async function start(rootProjectDir) {
|
|
692
|
+
console.log("\u{1F333} Root.js");
|
|
693
|
+
process.env.NODE_ENV = "production";
|
|
694
|
+
const rootDir = rootProjectDir || process.cwd();
|
|
695
|
+
const rootConfig = await loadRootConfig(rootDir);
|
|
696
|
+
const distDir = path6.join(rootDir, "dist");
|
|
697
|
+
const render = await import(path6.join(distDir, "server/render.js"));
|
|
698
|
+
const renderer = new render.Renderer(rootConfig);
|
|
699
|
+
const manifestPath = path6.join(distDir, "client/root-manifest.json");
|
|
700
|
+
if (!await fileExists(manifestPath)) {
|
|
701
|
+
throw new Error(
|
|
702
|
+
`could not find ${manifestPath}. run \`root build\` before \`root start\`.`
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
const rootManifest = await loadJson(manifestPath);
|
|
706
|
+
const assetMap = BuildAssetMap.fromRootManifest(rootManifest);
|
|
707
|
+
const app = express2();
|
|
708
|
+
const publicDir = path6.join(distDir, "html");
|
|
709
|
+
app.use(express2.static(publicDir));
|
|
710
|
+
app.use(async (req, res, next) => {
|
|
711
|
+
try {
|
|
712
|
+
const url = req.originalUrl;
|
|
713
|
+
const data = await renderer.render(url, {
|
|
714
|
+
assetMap
|
|
715
|
+
});
|
|
716
|
+
let html = data.html || "";
|
|
717
|
+
if (rootConfig.minifyHtml !== false) {
|
|
718
|
+
html = await htmlMinify(html);
|
|
719
|
+
}
|
|
720
|
+
res.status(200).set({ "Content-Type": "text/html" }).end(html);
|
|
721
|
+
} catch (e) {
|
|
722
|
+
try {
|
|
723
|
+
const { html } = await renderer.renderError(e);
|
|
724
|
+
res.status(500).set({ "Content-Type": "text/html" }).end(html);
|
|
725
|
+
} catch (e2) {
|
|
726
|
+
console.error("failed to render custom error");
|
|
727
|
+
console.error(e2);
|
|
728
|
+
next(e);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
const port = parseInt(process.env.PORT || "4007");
|
|
733
|
+
console.log(`
|
|
734
|
+
Started prod server: http://localhost:${port}`);
|
|
735
|
+
app.listen(port);
|
|
665
736
|
}
|
|
666
737
|
export {
|
|
667
738
|
build,
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/commands/dev.ts","../src/render/vite-plugin-root.ts","../src/core/fsutils.ts","../src/render/asset-map/dev-asset-map.ts","../src/cli/load-config.ts","../src/render/html-minify.ts","../src/cli/commands/build.ts","../src/render/asset-map/build-asset-map.ts","../src/cli/commands/start.ts"],"sourcesContent":["import path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport {default as express, Request, Response, NextFunction} from 'express';\nimport {createServer as createViteServer} from 'vite';\nimport {pluginRoot} from '../../render/vite-plugin-root.js';\nimport {DevServerAssetMap} from '../../render/asset-map/dev-asset-map.js';\nimport {loadRootConfig} from '../load-config.js';\nimport {htmlMinify} from '../../render/html-minify.js';\nimport {Renderer} from '../../render/render.js';\nimport {isDirectory, isJsFile} from '../../core/fsutils.js';\nimport glob from 'tiny-glob';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport async function createServer(options?: {rootDir?: string}) {\n const app = express();\n\n app.use(express.static('public'));\n const middlewares = await getMiddlewares({rootDir: options?.rootDir});\n middlewares.forEach((middleware) => app.use(middleware));\n\n const port = parseInt(process.env.PORT || '4007');\n console.log('🌳 Root.js');\n console.log();\n console.log(`Started dev server: http://localhost:${port}`);\n app.listen(port);\n}\n\nexport async function getMiddlewares(options?: {rootDir?: string}) {\n const rootDir = options?.rootDir || process.cwd();\n const rootConfig = await loadRootConfig(rootDir);\n const viteConfig = rootConfig.vite || {};\n const renderModulePath = path.resolve(__dirname, './render.js');\n\n const pages: string[] = [];\n if (await isDirectory(path.join(rootDir, 'routes'))) {\n const pageFiles = await glob(path.join(rootDir, 'routes/**/*'));\n pageFiles.forEach((file) => {\n const parts = path.parse(file);\n if (!parts.name.startsWith('_') && isJsFile(parts.base)) {\n pages.push(file);\n }\n });\n }\n\n const elements: string[] = [];\n if (await isDirectory(path.join(rootDir, 'elements'))) {\n const elementFiles = await glob(path.join(rootDir, 'elements/**/*'));\n elementFiles.forEach((file) => {\n const parts = path.parse(file);\n if (isJsFile(parts.base)) {\n elements.push(file);\n }\n });\n }\n\n const bundleScripts: string[] = [];\n if (await isDirectory(path.join(rootDir, 'bundles'))) {\n const bundleFiles = await glob(path.join(rootDir, 'bundles/*'));\n bundleFiles.forEach((file) => {\n const parts = path.parse(file);\n if (isJsFile(parts.base)) {\n bundleScripts.push(file);\n }\n });\n }\n\n const viteServer = await createViteServer({\n ...viteConfig,\n mode: 'development',\n server: {middlewareMode: true},\n appType: 'custom',\n optimizeDeps: {\n include: [...pages, ...elements, ...bundleScripts],\n },\n ssr: {\n noExternal: ['@blinkk/root'],\n },\n esbuild: {\n jsx: 'automatic',\n jsxImportSource: 'preact',\n },\n plugins: [...(viteConfig.plugins || []), pluginRoot({rootDir, rootConfig})],\n });\n\n const rootMiddleware = async (\n req: Request,\n res: Response,\n next: NextFunction\n ) => {\n const url = req.originalUrl;\n let renderer: Renderer | null = null;\n try {\n const render = await viteServer.ssrLoadModule(renderModulePath);\n renderer = new render.Renderer(rootConfig) as Renderer;\n // Create a dev asset map using Vite dev server's module graph.\n const assetMap = new DevServerAssetMap(viteServer.moduleGraph);\n const data = await renderer.render(url, {\n assetMap: assetMap,\n });\n // Inject the Vite HMR client.\n let html = await viteServer.transformIndexHtml(url, data.html || '');\n if (rootConfig.minifyHtml !== false) {\n html = await htmlMinify(html);\n }\n res.status(200).set({'Content-Type': 'text/html'}).end(html);\n } catch (e) {\n // If an error is caught, let Vite fix the stack trace so it maps back to\n // your actual source code.\n viteServer.ssrFixStacktrace(e);\n try {\n if (renderer) {\n const {html} = await renderer.renderError(e);\n res.status(500).set({'Content-Type': 'text/html'}).end(html);\n } else {\n next(e);\n }\n } catch (e2) {\n console.error('failed to render custom error');\n console.error(e2);\n next(e);\n }\n }\n };\n\n return [viteServer.middlewares, rootMiddleware];\n}\n\nexport async function dev(rootDir?: string) {\n process.env.NODE_ENV = 'development';\n try {\n await createServer({rootDir});\n } catch (err) {\n console.error('an error occurred');\n }\n}\n","import path from 'path';\nimport glob from 'tiny-glob';\nimport {RootConfig} from '../core/config';\nimport {isDirectory, isJsFile} from '../core/fsutils';\n\nconst JSX_ELEMENTS_REGEX = /jsxs?\\(\"(\\w[\\w-]+\\w)\"/g;\nconst HTML_ELEMENTS_REGEX = /<(\\w[\\w-]+\\w)/g;\n\nexport interface RootPluginOptions {\n rootDir: string;\n rootConfig: RootConfig;\n}\n\nexport function pluginRoot(options?: RootPluginOptions) {\n const elementsVirtualId = 'virtual:root-elements';\n const resolvedElementsVirtualId = '\\0' + elementsVirtualId;\n\n const rootDir = options?.rootDir || process.cwd();\n const rootConfig = options?.rootConfig || {};\n const elementsDirs = [path.join(rootDir, 'elements')];\n const includeDirs = rootConfig.elements?.include || [];\n includeDirs.forEach((dirPath) => {\n const elementsDir = path.resolve(rootDir, dirPath);\n if (!elementsDir.startsWith(rootDir)) {\n throw new Error(\n `the elements dir (${dirPath}) should be relative to the project's root dir (${rootDir})`\n );\n }\n elementsDirs.push(elementsDir);\n });\n\n let elementMap: Record<string, string>;\n async function updateElementMap() {\n elementMap = {};\n await Promise.all(\n elementsDirs.map(async (dirPath: string) => {\n const dirExists = await isDirectory(dirPath);\n if (!dirExists) {\n return;\n }\n const files = await glob('**/*', {cwd: dirPath});\n files.forEach((file) => {\n const parts = path.parse(file);\n if (isJsFile(parts.base)) {\n const fullPath = path.join(dirPath, file);\n const moduleId = fullPath.slice(rootDir.length);\n elementMap[parts.name] = moduleId;\n }\n });\n })\n );\n }\n\n async function getElementImport(tagname: string): Promise<string | null> {\n if (!elementMap) {\n await updateElementMap();\n }\n if (tagname in elementMap) {\n return elementMap[tagname];\n }\n return null;\n }\n\n function isCustomElement(id: string) {\n if (!isJsFile(id)) {\n return false;\n }\n return elementsDirs.some((elementsDir) => {\n return id.startsWith(elementsDir);\n });\n }\n\n return {\n name: 'vite-plugin-root',\n\n resolveId(id: string) {\n if (id === elementsVirtualId) {\n return resolvedElementsVirtualId;\n }\n return null;\n },\n\n async load(id: string) {\n if (id === resolvedElementsVirtualId) {\n await updateElementMap();\n return `export const elementsMap = ${JSON.stringify(elementMap)}`;\n }\n return null;\n },\n\n async transform(src: string, id: string): Promise<any> {\n if (isCustomElement(id)) {\n const idParts = path.parse(id);\n const deps = new Set<string>();\n const tagnames = [\n ...src.matchAll(JSX_ELEMENTS_REGEX),\n ...src.matchAll(HTML_ELEMENTS_REGEX),\n ];\n for (const match of tagnames) {\n const tagname = match[1];\n // All custom elements should contain a dash.\n if (!tagname.includes('-')) {\n continue;\n }\n // Avoid circular deps.\n if (tagname === idParts.name) {\n continue;\n }\n deps.add(tagname);\n }\n const importUrls: string[] = [];\n await Promise.all(\n Array.from(deps).map(async (tagname) => {\n const importUrl = await getElementImport(tagname);\n if (importUrl) {\n importUrls.push(importUrl);\n }\n })\n );\n if (importUrls.length > 0) {\n const importLines = importUrls\n .map((url) => `import '${url}';`)\n .join('\\n');\n const code = `${src}\n\n// autogenerated by root:\n${importLines}\n`;\n return {code};\n }\n return null;\n }\n return null;\n },\n };\n}\n","import {promises as fs} from 'node:fs';\nimport path from 'node:path';\nimport fsExtra from 'fs-extra';\n\nexport function isJsFile(filename: string) {\n return !!filename.match(/\\.(j|t)sx?$/);\n}\n\nexport async function writeFile(filepath: string, content: string) {\n const dirPath = path.dirname(filepath);\n await makeDir(dirPath);\n await fs.writeFile(filepath, content);\n}\n\nexport async function makeDir(dirpath: string) {\n try {\n await fs.access(dirpath);\n } catch (e) {\n await fs.mkdir(dirpath, {recursive: true});\n }\n}\n\nexport async function copyDir(srcdir: string, dstdir: string) {\n if (!fsExtra.existsSync(srcdir)) {\n return;\n }\n fsExtra.copySync(srcdir, dstdir, {recursive: true, overwrite: true});\n}\n\nexport async function rmDir(dirpath: string) {\n await fs.rm(dirpath, {recursive: true, force: true});\n}\n\nexport async function loadJson<T = unknown>(filepath: string): Promise<T> {\n const content = await fs.readFile(filepath, 'utf-8');\n return JSON.parse(content);\n}\n\nexport async function isDirectory(dirpath: string) {\n return fs\n .stat(dirpath)\n .then((fsStat) => {\n return fsStat.isDirectory();\n })\n .catch((err) => {\n if (err.code === 'ENOENT') {\n return false;\n }\n throw err;\n });\n}\n\nexport function fileExists(filepath: string): Promise<boolean> {\n return fs\n .access(filepath)\n .then(() => true)\n .catch(() => false);\n}\n","import path from 'node:path';\nimport {ModuleGraph, ModuleNode} from 'vite';\nimport {Asset, AssetMap} from './asset-map';\n\nexport class DevServerAssetMap implements AssetMap {\n private moduleGraph: ModuleGraph;\n\n constructor(moduleGraph: ModuleGraph) {\n this.moduleGraph = moduleGraph;\n }\n\n async get(moduleId: string): Promise<Asset | null> {\n const viteModule = await this.moduleGraph.getModuleByUrl(moduleId);\n if (!viteModule || !viteModule.id) {\n return null;\n }\n return new DevServerAsset(this, viteModule);\n }\n}\n\nexport class DevServerAsset implements Asset {\n moduleId: string;\n assetUrl: string;\n private assetMap: AssetMap;\n private viteModule: ModuleNode;\n\n constructor(assetMap: AssetMap, viteModule: ModuleNode) {\n this.assetMap = assetMap;\n this.viteModule = viteModule;\n this.moduleId = this.viteModule.id!;\n this.assetUrl = this.viteModule.url;\n }\n\n async getCssDeps(): Promise<string[]> {\n const visited = new Set<string>();\n const deps = new Set<string>();\n this.collectCss(this, deps, visited);\n return Array.from(deps);\n }\n\n async getJsDeps(): Promise<string[]> {\n const visited = new Set<string>();\n const deps = new Set<string>();\n this.collectJs(this, deps, visited);\n return Array.from(deps);\n }\n\n getImportedModules() {\n return this.viteModule.importedModules;\n }\n\n private collectJs(\n asset: DevServerAsset | null,\n urls: Set<string>,\n visited: Set<string>\n ) {\n if (!asset) {\n return;\n }\n if (!asset.moduleId) {\n return;\n }\n if (visited.has(asset.moduleId)) {\n return;\n }\n visited.add(asset.moduleId);\n const parts = path.parse(asset.assetUrl);\n if (\n ['.js', '.jsx', '.ts', '.tsx'].includes(parts.ext) &&\n asset.moduleId.includes('/elements/')\n ) {\n urls.add(asset.assetUrl);\n }\n asset.getImportedModules().forEach((viteModule) => {\n if (viteModule.id) {\n const importedAsset = new DevServerAsset(this.assetMap, viteModule);\n this.collectJs(importedAsset, urls, visited);\n }\n });\n }\n\n private collectCss(\n asset: DevServerAsset | null,\n urls: Set<string>,\n visited: Set<string>\n ) {\n if (!asset) {\n return;\n }\n if (!asset.assetUrl) {\n return;\n }\n if (visited.has(asset.assetUrl)) {\n return;\n }\n visited.add(asset.assetUrl);\n if (asset.moduleId.endsWith('.scss')) {\n const parts = path.parse(asset.assetUrl);\n if (!parts.name.startsWith('_')) {\n urls.add(asset.assetUrl);\n }\n }\n asset.getImportedModules().forEach((viteModule) => {\n if (viteModule.id) {\n const importedAsset = new DevServerAsset(this.assetMap, viteModule);\n this.collectCss(importedAsset, urls, visited);\n }\n });\n }\n}\n","import {bundleRequire} from 'bundle-require';\nimport JoyCon from 'joycon';\nimport {RootConfig} from '../core/config';\n\nexport async function loadRootConfig(rootDir: string): Promise<RootConfig> {\n const joycon = new JoyCon();\n const configPath = await joycon.resolve({\n cwd: rootDir,\n files: ['root.config.ts'],\n });\n if (configPath) {\n const configBundle = await bundleRequire({\n filepath: configPath,\n });\n return configBundle.mod.default || {};\n }\n return {};\n}\n","import {minify} from 'html-minifier-terser';\n\nexport async function htmlMinify(html: string): Promise<string> {\n const min = await minify(html, {\n collapseWhitespace: true,\n removeComments: true,\n preserveLineBreaks: true,\n });\n return min.trimStart();\n}\n","import path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport fsExtra from 'fs-extra';\nimport glob from 'tiny-glob';\nimport {build as viteBuild, Manifest, UserConfig} from 'vite';\nimport {pluginRoot} from '../../render/vite-plugin-root.js';\nimport {BuildAssetMap} from '../../render/asset-map/build-asset-map.js';\nimport {loadRootConfig} from '../load-config.js';\nimport {\n copyDir,\n isDirectory,\n isJsFile,\n loadJson,\n makeDir,\n rmDir,\n writeFile,\n} from '../../core/fsutils.js';\nimport {Renderer} from '../../render/render.js';\nimport {htmlMinify} from '../../render/html-minify.js';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport async function build(rootProjectDir?: string) {\n console.log('🌳 Root.js');\n\n const rootDir = rootProjectDir || process.cwd();\n const rootConfig = await loadRootConfig(rootDir);\n const distDir = path.join(rootDir, 'dist');\n await rmDir(distDir);\n await makeDir(distDir);\n\n const pages: string[] = [];\n if (await isDirectory(path.join(rootDir, 'routes'))) {\n const pageFiles = await glob(path.join(rootDir, 'routes/**/*'));\n pageFiles.forEach((file) => {\n const parts = path.parse(file);\n if (!parts.name.startsWith('_') && isJsFile(parts.base)) {\n pages.push(file);\n }\n });\n }\n\n const elementsDirs = [path.join(rootDir, 'elements')];\n const elementsInclude = rootConfig.elements?.include || [];\n for (const dirPath of elementsInclude) {\n const elementsDir = path.resolve(rootDir, dirPath);\n if (!elementsDir.startsWith(rootDir)) {\n throw new Error(\n `the elements dir (${dirPath}) should be relative to the project's root dir (${rootDir})`\n );\n }\n elementsDirs.push(elementsDir);\n }\n const elements: string[] = [];\n const elementMap: Record<string, string> = {};\n for (const dirPath of elementsDirs) {\n if (await isDirectory(dirPath)) {\n const elementFiles = await glob('**/*', {cwd: dirPath});\n elementFiles.forEach((file) => {\n const parts = path.parse(file);\n if (isJsFile(parts.base)) {\n const fullPath = path.join(dirPath, file);\n const moduleId = fullPath.slice(rootDir.length);\n elements.push(fullPath);\n elementMap[parts.name] = moduleId;\n }\n });\n }\n }\n\n const bundleScripts: string[] = [];\n if (await isDirectory(path.join(rootDir, 'bundles'))) {\n const bundleFiles = await glob(path.join(rootDir, 'bundles/*'));\n bundleFiles.forEach((file) => {\n const parts = path.parse(file);\n if (isJsFile(parts.base)) {\n bundleScripts.push(file);\n }\n });\n }\n\n const viteConfig = rootConfig.vite || {};\n const baseConfig: UserConfig = {\n ...viteConfig,\n root: rootDir,\n esbuild: {\n jsx: 'automatic',\n jsxImportSource: 'preact',\n treeShaking: true,\n },\n plugins: [...(viteConfig.plugins || []), pluginRoot({rootDir, rootConfig})],\n };\n\n // Bundle the render.js file with vite, which is pre-optimized for rendering\n // HTML routes.\n await viteBuild({\n ...baseConfig,\n mode: 'production',\n publicDir: false,\n build: {\n rollupOptions: {\n input: [path.resolve(__dirname, './render.js')],\n output: {\n format: 'esm',\n chunkFileNames: 'chunks/[name].[hash].js',\n assetFileNames: 'assets/[name].[hash][extname]',\n },\n },\n outDir: path.join(distDir, 'server'),\n ssr: true,\n ssrManifest: false,\n cssCodeSplit: true,\n target: 'esnext',\n minify: false,\n polyfillModulePreload: false,\n reportCompressedSize: false,\n },\n ssr: {\n noExternal: ['@blinkk/root'],\n },\n });\n\n // Pre-render any client scripts and CSS deps.\n await viteBuild({\n ...baseConfig,\n mode: 'production',\n publicDir: false,\n build: {\n rollupOptions: {\n input: [...pages, ...elements, ...bundleScripts],\n output: {\n format: 'esm',\n chunkFileNames: 'chunks/[name].[hash].js',\n assetFileNames: 'assets/[name].[hash][extname]',\n },\n },\n outDir: path.join(distDir, 'client'),\n ssr: false,\n ssrManifest: false,\n manifest: true,\n cssCodeSplit: true,\n target: 'esnext',\n minify: true,\n polyfillModulePreload: false,\n reportCompressedSize: false,\n },\n });\n\n const manifest = await loadJson<Manifest>(\n path.join(distDir, 'client/manifest.json')\n );\n\n // Use the output of the client build to generate an asset map, which is used\n // by the renderer for automatically injecting dependencies for a page.\n const assetMap = new BuildAssetMap(manifest, {elementMap});\n\n // Save the asset map to `dist/client` for use by the prod SSR server.\n writeFile(\n path.join(distDir, 'client/root-manifest.json'),\n JSON.stringify(assetMap.toJson(), null, 2)\n );\n\n // Write SSG output to `dist/html`.\n const buildDir = path.join(distDir, 'html');\n\n // Recursively copy files from `public` to `dist/html`.\n const publicDir = path.join(rootDir, 'public');\n if (fsExtra.existsSync(path.join(rootDir, 'public'))) {\n fsExtra.copySync(publicDir, buildDir);\n } else {\n makeDir(buildDir);\n }\n\n // Copy files from `dist/client/{assets,chunks}` to `dist/html`.\n copyDir(path.join(distDir, 'client/assets'), path.join(buildDir, 'assets'));\n copyDir(path.join(distDir, 'client/chunks'), path.join(buildDir, 'chunks'));\n\n // Render HTML pages.\n const render = await import(path.join(distDir, 'server/render.js'));\n const renderer = new render.Renderer(rootConfig) as Renderer;\n const sitemap = await renderer.getSitemap();\n\n await Promise.all(\n Object.keys(sitemap).map(async (urlPath) => {\n const {route, params} = sitemap[urlPath];\n const data = await renderer.renderRoute(route, {\n assetMap,\n routeParams: params,\n });\n\n // The renderer currently assumes that all paths serve HTML.\n // TODO(stevenle): support non-HTML routes using `routes/[name].[ext].ts`.\n let outPath = path.join(distDir, `html${urlPath}`, 'index.html');\n\n if (outPath.endsWith('404/index.html')) {\n outPath = outPath.replace('404/index.html', '404.html');\n }\n\n const html = await htmlMinify(data.html || '');\n await writeFile(outPath, html);\n\n const relPath = outPath.slice(path.dirname(distDir).length + 1);\n console.log(`saved ${relPath}`);\n })\n );\n}\n","import path from 'path';\nimport {Manifest, ManifestChunk} from 'vite';\nimport {Asset, AssetMap} from './asset-map';\n\ntype BuildAssetManifest = Record<\n string,\n {\n moduleId: string;\n assetUrl: string;\n importedModules: string[];\n importedCss: string[];\n }\n>;\n\nexport class BuildAssetMap implements AssetMap {\n private manifest: Manifest;\n private moduleIdToAsset: Map<string, BuildAsset>;\n private elementMap: Record<string, string>;\n\n constructor(\n manifest: Manifest,\n options: {elementMap: Record<string, string>}\n ) {\n this.manifest = manifest;\n this.elementMap = options.elementMap;\n this.moduleIdToAsset = new Map();\n Object.keys(this.manifest).forEach((manifestKey) => {\n const moduleId = `/${manifestKey}`;\n this.moduleIdToAsset.set(\n moduleId,\n new BuildAsset(this, moduleId, this.manifest[manifestKey])\n );\n });\n }\n\n async get(moduleId: string): Promise<Asset | null> {\n return this.moduleIdToAsset.get(moduleId) || null;\n }\n\n isElement(moduleId: string): boolean {\n return Object.values(this.elementMap).includes(moduleId);\n }\n\n toJson(): BuildAssetManifest {\n const result: BuildAssetManifest = {};\n for (const moduleId of this.moduleIdToAsset.keys()) {\n result[moduleId] = this.moduleIdToAsset.get(moduleId)!.toJson();\n }\n return result;\n }\n}\n\nexport class BuildAsset {\n moduleId: string;\n assetUrl: string;\n private assetMap: BuildAssetMap;\n private manifestData: ManifestChunk;\n private importedModules: string[];\n private importedCss: string[];\n\n constructor(\n assetMap: BuildAssetMap,\n moduleId: string,\n manifestData: ManifestChunk\n ) {\n this.assetMap = assetMap;\n this.moduleId = moduleId;\n this.manifestData = manifestData;\n this.assetUrl = `/${manifestData.file}`;\n this.importedModules = (this.manifestData.imports || []).map(\n (relPath) => `/${relPath}`\n );\n this.importedCss = (this.manifestData.css || []).map(\n (relPath) => `/${relPath}`\n );\n }\n\n async getCssDeps(): Promise<string[]> {\n const visited = new Set<string>();\n const deps = new Set<string>();\n await this.collectCss(this, deps, visited);\n return Array.from(deps);\n }\n\n async getJsDeps(): Promise<string[]> {\n const visited = new Set<string>();\n const deps = new Set<string>();\n await this.collectJs(this, deps, visited);\n return Array.from(deps);\n }\n\n private async collectJs(\n asset: BuildAsset | null,\n urls: Set<string>,\n visited: Set<string>\n ) {\n if (!asset) {\n return;\n }\n if (!asset.moduleId) {\n return;\n }\n if (visited.has(asset.moduleId)) {\n return;\n }\n visited.add(asset.moduleId);\n const parts = path.parse(asset.assetUrl);\n if (\n ['.js', '.jsx', '.ts', '.tsx'].includes(parts.ext) &&\n this.assetMap.isElement(asset.moduleId)\n ) {\n urls.add(asset.assetUrl);\n }\n await Promise.all(\n asset.importedModules.map(async (moduleId) => {\n const importedAsset = (await this.assetMap.get(moduleId)) as BuildAsset;\n this.collectJs(importedAsset, urls, visited);\n })\n );\n }\n\n private async collectCss(\n asset: BuildAsset | null,\n urls: Set<string>,\n visited: Set<string>\n ) {\n if (!asset) {\n return;\n }\n if (!asset.assetUrl) {\n return;\n }\n if (visited.has(asset.moduleId)) {\n return;\n }\n visited.add(asset.moduleId);\n if (asset.importedCss) {\n asset.importedCss.forEach((cssUrl) => urls.add(cssUrl));\n }\n await Promise.all(\n asset.importedModules.map(async (moduleId) => {\n const importedAsset = (await this.assetMap.get(moduleId)) as BuildAsset;\n this.collectCss(importedAsset, urls, visited);\n })\n );\n }\n\n toJson() {\n return {\n moduleId: this.moduleId,\n assetUrl: this.assetUrl,\n importedModules: this.importedModules,\n importedCss: this.importedCss,\n };\n }\n}\n","export async function start() {\n console.log('SSR production server is coming soon');\n}\n"],"mappings":";AAAA,OAAOA,WAAU;AACjB,SAAQ,qBAAoB;AAC5B,SAAQ,WAAW,eAA+C;AAClE,SAAQ,gBAAgB,wBAAuB;;;ACH/C,OAAOC,WAAU;AACjB,OAAO,UAAU;;;ACDjB,SAAQ,YAAY,UAAS;AAC7B,OAAO,UAAU;AACjB,OAAO,aAAa;AAEb,SAAS,SAAS,UAAkB;AACzC,SAAO,CAAC,CAAC,SAAS,MAAM,aAAa;AACvC;AAEA,eAAsB,UAAU,UAAkB,SAAiB;AACjE,QAAM,UAAU,KAAK,QAAQ,QAAQ;AACrC,QAAM,QAAQ,OAAO;AACrB,QAAM,GAAG,UAAU,UAAU,OAAO;AACtC;AAEA,eAAsB,QAAQ,SAAiB;AAC7C,MAAI;AACF,UAAM,GAAG,OAAO,OAAO;AAAA,EACzB,SAAS,GAAP;AACA,UAAM,GAAG,MAAM,SAAS,EAAC,WAAW,KAAI,CAAC;AAAA,EAC3C;AACF;AAEA,eAAsB,QAAQ,QAAgB,QAAgB;AAC5D,MAAI,CAAC,QAAQ,WAAW,MAAM,GAAG;AAC/B;AAAA,EACF;AACA,UAAQ,SAAS,QAAQ,QAAQ,EAAC,WAAW,MAAM,WAAW,KAAI,CAAC;AACrE;AAEA,eAAsB,MAAM,SAAiB;AAC3C,QAAM,GAAG,GAAG,SAAS,EAAC,WAAW,MAAM,OAAO,KAAI,CAAC;AACrD;AAEA,eAAsB,SAAsB,UAA8B;AACxE,QAAM,UAAU,MAAM,GAAG,SAAS,UAAU,OAAO;AACnD,SAAO,KAAK,MAAM,OAAO;AAC3B;AAEA,eAAsB,YA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","fsExtra"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/dev.ts","../src/render/vite-plugin-root.ts","../src/core/fsutils.ts","../src/render/asset-map/dev-asset-map.ts","../src/cli/load-config.ts","../src/render/html-minify.ts","../src/cli/commands/build.ts","../src/render/asset-map/build-asset-map.ts","../src/cli/commands/start.ts"],"sourcesContent":["import path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport {default as express, Request, Response, NextFunction} from 'express';\nimport {createServer as createViteServer} from 'vite';\nimport {pluginRoot} from '../../render/vite-plugin-root.js';\nimport {DevServerAssetMap} from '../../render/asset-map/dev-asset-map.js';\nimport {loadRootConfig} from '../load-config.js';\nimport {htmlMinify} from '../../render/html-minify.js';\nimport {Renderer} from '../../render/render.js';\nimport {isDirectory, isJsFile} from '../../core/fsutils.js';\nimport glob from 'tiny-glob';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport async function createServer(options?: {rootDir?: string}) {\n const app = express();\n\n app.use(express.static('public'));\n const middlewares = await getMiddlewares({rootDir: options?.rootDir});\n middlewares.forEach((middleware) => app.use(middleware));\n\n const port = parseInt(process.env.PORT || '4007');\n console.log('🌳 Root.js');\n console.log();\n console.log(`Started dev server: http://localhost:${port}`);\n app.listen(port);\n}\n\nexport async function getMiddlewares(options?: {rootDir?: string}) {\n const rootDir = options?.rootDir || process.cwd();\n const rootConfig = await loadRootConfig(rootDir);\n const viteConfig = rootConfig.vite || {};\n const renderModulePath = path.resolve(__dirname, './render.js');\n\n const pages: string[] = [];\n if (await isDirectory(path.join(rootDir, 'routes'))) {\n const pageFiles = await glob(path.join(rootDir, 'routes/**/*'));\n pageFiles.forEach((file) => {\n const parts = path.parse(file);\n if (!parts.name.startsWith('_') && isJsFile(parts.base)) {\n pages.push(file);\n }\n });\n }\n\n const elements: string[] = [];\n if (await isDirectory(path.join(rootDir, 'elements'))) {\n const elementFiles = await glob(path.join(rootDir, 'elements/**/*'));\n elementFiles.forEach((file) => {\n const parts = path.parse(file);\n if (isJsFile(parts.base)) {\n elements.push(file);\n }\n });\n }\n\n const bundleScripts: string[] = [];\n if (await isDirectory(path.join(rootDir, 'bundles'))) {\n const bundleFiles = await glob(path.join(rootDir, 'bundles/*'));\n bundleFiles.forEach((file) => {\n const parts = path.parse(file);\n if (isJsFile(parts.base)) {\n bundleScripts.push(file);\n }\n });\n }\n\n const viteServer = await createViteServer({\n ...viteConfig,\n mode: 'development',\n server: {middlewareMode: true},\n appType: 'custom',\n optimizeDeps: {\n include: [...pages, ...elements, ...bundleScripts],\n },\n ssr: {\n noExternal: ['@blinkk/root'],\n },\n esbuild: {\n jsx: 'automatic',\n jsxImportSource: 'preact',\n },\n plugins: [...(viteConfig.plugins || []), pluginRoot({rootDir, rootConfig})],\n });\n\n const rootMiddleware = async (\n req: Request,\n res: Response,\n next: NextFunction\n ) => {\n const url = req.originalUrl;\n let renderer: Renderer | null = null;\n try {\n const render = await viteServer.ssrLoadModule(renderModulePath);\n renderer = new render.Renderer(rootConfig) as Renderer;\n // Create a dev asset map using Vite dev server's module graph.\n const assetMap = new DevServerAssetMap(viteServer.moduleGraph);\n const data = await renderer.render(url, {\n assetMap: assetMap,\n });\n // Inject the Vite HMR client.\n let html = await viteServer.transformIndexHtml(url, data.html || '');\n if (rootConfig.minifyHtml !== false) {\n html = await htmlMinify(html);\n }\n res.status(200).set({'Content-Type': 'text/html'}).end(html);\n } catch (e) {\n // If an error is caught, let Vite fix the stack trace so it maps back to\n // your actual source code.\n viteServer.ssrFixStacktrace(e);\n try {\n if (renderer) {\n const {html} = await renderer.renderError(e);\n res.status(500).set({'Content-Type': 'text/html'}).end(html);\n } else {\n next(e);\n }\n } catch (e2) {\n console.error('failed to render custom error');\n console.error(e2);\n next(e);\n }\n }\n };\n\n return [viteServer.middlewares, rootMiddleware];\n}\n\nexport async function dev(rootDir?: string) {\n process.env.NODE_ENV = 'development';\n try {\n await createServer({rootDir});\n } catch (err) {\n console.error('an error occurred');\n }\n}\n","import path from 'path';\nimport glob from 'tiny-glob';\nimport {RootConfig} from '../core/config';\nimport {isDirectory, isJsFile} from '../core/fsutils';\n\nconst JSX_ELEMENTS_REGEX = /jsxs?\\(\"(\\w[\\w-]+\\w)\"/g;\nconst HTML_ELEMENTS_REGEX = /<(\\w[\\w-]+\\w)/g;\n\nexport interface RootPluginOptions {\n rootDir: string;\n rootConfig: RootConfig;\n}\n\nexport function pluginRoot(options?: RootPluginOptions) {\n const elementsVirtualId = 'virtual:root-elements';\n const resolvedElementsVirtualId = '\\0' + elementsVirtualId;\n\n const rootDir = options?.rootDir || process.cwd();\n const rootConfig = options?.rootConfig || {};\n const elementsDirs = [path.join(rootDir, 'elements')];\n const includeDirs = rootConfig.elements?.include || [];\n includeDirs.forEach((dirPath) => {\n const elementsDir = path.resolve(rootDir, dirPath);\n if (!elementsDir.startsWith(rootDir)) {\n throw new Error(\n `the elements dir (${dirPath}) should be relative to the project's root dir (${rootDir})`\n );\n }\n elementsDirs.push(elementsDir);\n });\n\n const excludePatterns = rootConfig.elements?.exclude || [];\n const excludeElement = (moduleId: string) => {\n return excludePatterns.some((pattern) => Boolean(moduleId.match(pattern)));\n };\n\n let elementMap: Record<string, string>;\n async function updateElementMap() {\n elementMap = {};\n await Promise.all(\n elementsDirs.map(async (dirPath: string) => {\n const dirExists = await isDirectory(dirPath);\n if (!dirExists) {\n return;\n }\n const files = await glob('**/*', {cwd: dirPath});\n files.forEach((file) => {\n const parts = path.parse(file);\n if (isJsFile(parts.base)) {\n const fullPath = path.join(dirPath, file);\n const moduleId = fullPath.slice(rootDir.length);\n if (!excludeElement(moduleId)) {\n elementMap[parts.name] = moduleId;\n }\n }\n });\n })\n );\n }\n\n async function getElementImport(tagname: string): Promise<string | null> {\n if (!elementMap) {\n await updateElementMap();\n }\n if (tagname in elementMap) {\n return elementMap[tagname];\n }\n return null;\n }\n\n function isCustomElement(id: string) {\n if (!isJsFile(id)) {\n return false;\n }\n return elementsDirs.some((elementsDir) => {\n return id.startsWith(elementsDir);\n });\n }\n\n return {\n name: 'vite-plugin-root',\n\n resolveId(id: string) {\n if (id === elementsVirtualId) {\n return resolvedElementsVirtualId;\n }\n return null;\n },\n\n async load(id: string) {\n if (id === resolvedElementsVirtualId) {\n await updateElementMap();\n return `export const elementsMap = ${JSON.stringify(elementMap)}`;\n }\n return null;\n },\n\n async transform(src: string, id: string): Promise<any> {\n if (isCustomElement(id)) {\n const idParts = path.parse(id);\n const deps = new Set<string>();\n const tagnames = [\n ...src.matchAll(JSX_ELEMENTS_REGEX),\n ...src.matchAll(HTML_ELEMENTS_REGEX),\n ];\n for (const match of tagnames) {\n const tagname = match[1];\n // All custom elements should contain a dash.\n if (!tagname.includes('-')) {\n continue;\n }\n // Avoid circular deps.\n if (tagname === idParts.name) {\n continue;\n }\n deps.add(tagname);\n }\n const importUrls: string[] = [];\n await Promise.all(\n Array.from(deps).map(async (tagname) => {\n const importUrl = await getElementImport(tagname);\n if (importUrl) {\n importUrls.push(importUrl);\n }\n })\n );\n if (importUrls.length > 0) {\n const importLines = importUrls\n .map((url) => `import '${url}';`)\n .join('\\n');\n const code = `${src}\n\n// autogenerated by root:\n${importLines}\n`;\n return {code};\n }\n return null;\n }\n return null;\n },\n };\n}\n","import {promises as fs} from 'node:fs';\nimport path from 'node:path';\nimport fsExtra from 'fs-extra';\n\nexport function isJsFile(filename: string) {\n return !!filename.match(/\\.(j|t)sx?$/);\n}\n\nexport async function writeFile(filepath: string, content: string) {\n const dirPath = path.dirname(filepath);\n await makeDir(dirPath);\n await fs.writeFile(filepath, content);\n}\n\nexport async function makeDir(dirpath: string) {\n try {\n await fs.access(dirpath);\n } catch (e) {\n await fs.mkdir(dirpath, {recursive: true});\n }\n}\n\nexport async function copyDir(srcdir: string, dstdir: string) {\n if (!fsExtra.existsSync(srcdir)) {\n return;\n }\n fsExtra.copySync(srcdir, dstdir, {recursive: true, overwrite: true});\n}\n\nexport async function rmDir(dirpath: string) {\n await fs.rm(dirpath, {recursive: true, force: true});\n}\n\nexport async function loadJson<T = unknown>(filepath: string): Promise<T> {\n const content = await fs.readFile(filepath, 'utf-8');\n return JSON.parse(content);\n}\n\nexport async function isDirectory(dirpath: string) {\n return fs\n .stat(dirpath)\n .then((fsStat) => {\n return fsStat.isDirectory();\n })\n .catch((err) => {\n if (err.code === 'ENOENT') {\n return false;\n }\n throw err;\n });\n}\n\nexport function fileExists(filepath: string): Promise<boolean> {\n return fs\n .access(filepath)\n .then(() => true)\n .catch(() => false);\n}\n","import path from 'node:path';\nimport {ModuleGraph, ModuleNode} from 'vite';\nimport {Asset, AssetMap} from './asset-map';\n\nexport class DevServerAssetMap implements AssetMap {\n private moduleGraph: ModuleGraph;\n\n constructor(moduleGraph: ModuleGraph) {\n this.moduleGraph = moduleGraph;\n }\n\n async get(moduleId: string): Promise<Asset | null> {\n const viteModule = await this.moduleGraph.getModuleByUrl(moduleId);\n if (!viteModule || !viteModule.id) {\n return null;\n }\n return new DevServerAsset(this, viteModule);\n }\n}\n\nexport class DevServerAsset implements Asset {\n moduleId: string;\n assetUrl: string;\n private assetMap: AssetMap;\n private viteModule: ModuleNode;\n\n constructor(assetMap: AssetMap, viteModule: ModuleNode) {\n this.assetMap = assetMap;\n this.viteModule = viteModule;\n this.moduleId = this.viteModule.id!;\n this.assetUrl = this.viteModule.url;\n }\n\n async getCssDeps(): Promise<string[]> {\n const visited = new Set<string>();\n const deps = new Set<string>();\n this.collectCss(this, deps, visited);\n return Array.from(deps);\n }\n\n async getJsDeps(): Promise<string[]> {\n const visited = new Set<string>();\n const deps = new Set<string>();\n this.collectJs(this, deps, visited);\n return Array.from(deps);\n }\n\n getImportedModules() {\n return this.viteModule.importedModules;\n }\n\n private collectJs(\n asset: DevServerAsset | null,\n urls: Set<string>,\n visited: Set<string>\n ) {\n if (!asset) {\n return;\n }\n if (!asset.moduleId) {\n return;\n }\n if (visited.has(asset.moduleId)) {\n return;\n }\n visited.add(asset.moduleId);\n const parts = path.parse(asset.assetUrl);\n if (\n ['.js', '.jsx', '.ts', '.tsx'].includes(parts.ext) &&\n asset.moduleId.includes('/elements/')\n ) {\n urls.add(asset.assetUrl);\n }\n asset.getImportedModules().forEach((viteModule) => {\n if (viteModule.id) {\n const importedAsset = new DevServerAsset(this.assetMap, viteModule);\n this.collectJs(importedAsset, urls, visited);\n }\n });\n }\n\n private collectCss(\n asset: DevServerAsset | null,\n urls: Set<string>,\n visited: Set<string>\n ) {\n if (!asset) {\n return;\n }\n if (!asset.assetUrl) {\n return;\n }\n if (visited.has(asset.assetUrl)) {\n return;\n }\n visited.add(asset.assetUrl);\n if (asset.moduleId.endsWith('.scss')) {\n const parts = path.parse(asset.assetUrl);\n if (!parts.name.startsWith('_')) {\n urls.add(asset.assetUrl);\n }\n }\n asset.getImportedModules().forEach((viteModule) => {\n if (viteModule.id) {\n const importedAsset = new DevServerAsset(this.assetMap, viteModule);\n this.collectCss(importedAsset, urls, visited);\n }\n });\n }\n}\n","import {bundleRequire} from 'bundle-require';\nimport JoyCon from 'joycon';\nimport {RootConfig} from '../core/config';\n\nexport async function loadRootConfig(rootDir: string): Promise<RootConfig> {\n const joycon = new JoyCon();\n const configPath = await joycon.resolve({\n cwd: rootDir,\n files: ['root.config.ts'],\n });\n if (configPath) {\n const configBundle = await bundleRequire({\n filepath: configPath,\n });\n return configBundle.mod.default || {};\n }\n return {};\n}\n","import {minify} from 'html-minifier-terser';\n\nexport async function htmlMinify(html: string): Promise<string> {\n const min = await minify(html, {\n collapseWhitespace: true,\n removeComments: true,\n preserveLineBreaks: true,\n });\n return min.trimStart();\n}\n","import path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport fsExtra from 'fs-extra';\nimport glob from 'tiny-glob';\nimport {build as viteBuild, Manifest, UserConfig} from 'vite';\nimport {pluginRoot} from '../../render/vite-plugin-root.js';\nimport {BuildAssetManifest, BuildAssetMap} from '../../render/asset-map/build-asset-map.js';\nimport {loadRootConfig} from '../load-config.js';\nimport {\n copyDir,\n isDirectory,\n isJsFile,\n loadJson,\n makeDir,\n rmDir,\n writeFile,\n} from '../../core/fsutils.js';\nimport {Renderer} from '../../render/render.js';\nimport {htmlMinify} from '../../render/html-minify.js';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport async function build(rootProjectDir?: string) {\n console.log('🌳 Root.js');\n\n const rootDir = rootProjectDir || process.cwd();\n const rootConfig = await loadRootConfig(rootDir);\n const distDir = path.join(rootDir, 'dist');\n await rmDir(distDir);\n await makeDir(distDir);\n\n const pages: string[] = [];\n if (await isDirectory(path.join(rootDir, 'routes'))) {\n const pageFiles = await glob(path.join(rootDir, 'routes/**/*'));\n pageFiles.forEach((file) => {\n const parts = path.parse(file);\n if (!parts.name.startsWith('_') && isJsFile(parts.base)) {\n pages.push(file);\n }\n });\n }\n\n const elementsDirs = [path.join(rootDir, 'elements')];\n const elementsInclude = rootConfig.elements?.include || [];\n for (const dirPath of elementsInclude) {\n const elementsDir = path.resolve(rootDir, dirPath);\n if (!elementsDir.startsWith(rootDir)) {\n throw new Error(\n `the elements dir (${dirPath}) should be relative to the project's root dir (${rootDir})`\n );\n }\n elementsDirs.push(elementsDir);\n }\n const elements: string[] = [];\n const elementMap: Record<string, string> = {};\n for (const dirPath of elementsDirs) {\n if (await isDirectory(dirPath)) {\n const elementFiles = await glob('**/*', {cwd: dirPath});\n elementFiles.forEach((file) => {\n const parts = path.parse(file);\n if (isJsFile(parts.base)) {\n const fullPath = path.join(dirPath, file);\n const moduleId = fullPath.slice(rootDir.length);\n elements.push(fullPath);\n elementMap[parts.name] = moduleId;\n }\n });\n }\n }\n\n const bundleScripts: string[] = [];\n if (await isDirectory(path.join(rootDir, 'bundles'))) {\n const bundleFiles = await glob(path.join(rootDir, 'bundles/*'));\n bundleFiles.forEach((file) => {\n const parts = path.parse(file);\n if (isJsFile(parts.base)) {\n bundleScripts.push(file);\n }\n });\n }\n\n const viteConfig = rootConfig.vite || {};\n const baseConfig: UserConfig = {\n ...viteConfig,\n root: rootDir,\n esbuild: {\n jsx: 'automatic',\n jsxImportSource: 'preact',\n treeShaking: true,\n },\n plugins: [...(viteConfig.plugins || []), pluginRoot({rootDir, rootConfig})],\n };\n\n // Bundle the render.js file with vite, which is pre-optimized for rendering\n // HTML routes.\n await viteBuild({\n ...baseConfig,\n mode: 'production',\n publicDir: false,\n build: {\n rollupOptions: {\n input: [path.resolve(__dirname, './render.js')],\n output: {\n format: 'esm',\n chunkFileNames: 'chunks/[name].[hash].js',\n assetFileNames: 'assets/[name].[hash][extname]',\n },\n },\n outDir: path.join(distDir, 'server'),\n ssr: true,\n ssrManifest: false,\n cssCodeSplit: true,\n target: 'esnext',\n minify: false,\n polyfillModulePreload: false,\n reportCompressedSize: false,\n },\n ssr: {\n noExternal: ['@blinkk/root'],\n },\n });\n\n // Pre-render any client scripts and CSS deps.\n await viteBuild({\n ...baseConfig,\n mode: 'production',\n publicDir: false,\n build: {\n rollupOptions: {\n input: [...pages, ...elements, ...bundleScripts],\n output: {\n format: 'esm',\n chunkFileNames: 'chunks/[name].[hash].js',\n assetFileNames: 'assets/[name].[hash][extname]',\n },\n },\n outDir: path.join(distDir, 'client'),\n ssr: false,\n ssrManifest: false,\n manifest: true,\n cssCodeSplit: true,\n target: 'esnext',\n minify: true,\n polyfillModulePreload: false,\n reportCompressedSize: false,\n },\n });\n\n const viteManifest = await loadJson<Manifest>(\n path.join(distDir, 'client/manifest.json')\n );\n\n // Use the output of the client build to generate an asset map, which is used\n // by the renderer for automatically injecting dependencies for a page.\n const assetMap = BuildAssetMap.fromViteManifest(viteManifest, elementMap);\n\n // Save the asset map to `dist/client` for use by the prod SSR server.\n writeFile(\n path.join(distDir, 'client/root-manifest.json'),\n JSON.stringify(assetMap.toJson(), null, 2)\n );\n\n // Write SSG output to `dist/html`.\n const buildDir = path.join(distDir, 'html');\n\n // Recursively copy files from `public` to `dist/html`.\n const publicDir = path.join(rootDir, 'public');\n if (fsExtra.existsSync(path.join(rootDir, 'public'))) {\n fsExtra.copySync(publicDir, buildDir);\n } else {\n makeDir(buildDir);\n }\n\n // Copy files from `dist/client/{assets,chunks}` to `dist/html`.\n copyDir(path.join(distDir, 'client/assets'), path.join(buildDir, 'assets'));\n copyDir(path.join(distDir, 'client/chunks'), path.join(buildDir, 'chunks'));\n\n // Render HTML pages.\n const render = await import(path.join(distDir, 'server/render.js'));\n const renderer = new render.Renderer(rootConfig) as Renderer;\n const sitemap = await renderer.getSitemap();\n\n await Promise.all(\n Object.keys(sitemap).map(async (urlPath) => {\n const {route, params} = sitemap[urlPath];\n const data = await renderer.renderRoute(route, {\n assetMap,\n routeParams: params,\n });\n\n // The renderer currently assumes that all paths serve HTML.\n // TODO(stevenle): support non-HTML routes using `routes/[name].[ext].ts`.\n let outPath = path.join(distDir, `html${urlPath}`, 'index.html');\n\n if (outPath.endsWith('404/index.html')) {\n outPath = outPath.replace('404/index.html', '404.html');\n }\n\n const html = await htmlMinify(data.html || '');\n await writeFile(outPath, html);\n\n const relPath = outPath.slice(path.dirname(distDir).length + 1);\n console.log(`saved ${relPath}`);\n })\n );\n}\n","import {Manifest} from 'vite';\nimport {Asset, AssetMap} from './asset-map';\n\nexport type BuildAssetManifest = Record<\n string,\n {\n moduleId: string;\n assetUrl: string;\n importedModules: string[];\n importedCss: string[];\n isElement: boolean;\n }\n>;\n\nexport class BuildAssetMap implements AssetMap {\n private moduleIdToAsset: Map<string, BuildAsset>;\n\n constructor() {\n this.moduleIdToAsset = new Map();\n }\n\n async get(moduleId: string): Promise<Asset | null> {\n return this.moduleIdToAsset.get(moduleId) || null;\n }\n\n private add(asset: BuildAsset) {\n this.moduleIdToAsset.set(asset.moduleId, asset);\n }\n\n toJson(): BuildAssetManifest {\n const result: BuildAssetManifest = {};\n for (const moduleId of this.moduleIdToAsset.keys()) {\n result[moduleId] = this.moduleIdToAsset.get(moduleId)!.toJson();\n }\n return result;\n }\n\n static fromViteManifest(\n viteManifest: Manifest,\n elementMap: Record<string, string>\n ) {\n const assetMap = new BuildAssetMap();\n\n const elementModuleIds = new Set();\n Object.values(elementMap).forEach((moduleId) =>\n elementModuleIds.add(moduleId)\n );\n\n Object.keys(viteManifest).forEach((manifestKey) => {\n const moduleId = `/${manifestKey}`;\n const manifestChunk = viteManifest[manifestKey];\n const isElement = elementModuleIds.has(moduleId);\n const assetData = {\n moduleId,\n assetUrl: `/${manifestChunk.file}`,\n importedModules: (manifestChunk.imports || []).map(\n (relPath) => `/${relPath}`\n ),\n importedCss: (manifestChunk.css || []).map((relPath) => `/${relPath}`),\n isElement: isElement,\n };\n assetMap.add(new BuildAsset(assetMap, assetData));\n });\n return assetMap;\n }\n\n static fromRootManifest(rootManifest: BuildAssetManifest) {\n const assetMap = new BuildAssetMap();\n Object.keys(rootManifest).forEach((moduleId) => {\n const assetData = rootManifest[moduleId];\n assetMap.add(new BuildAsset(assetMap, assetData));\n });\n return assetMap;\n }\n}\n\nexport class BuildAsset {\n moduleId: string;\n assetUrl: string;\n private assetMap: BuildAssetMap;\n private importedModules: string[];\n private importedCss: string[];\n isElement: boolean;\n\n constructor(\n assetMap: BuildAssetMap,\n assetData: {\n moduleId: string;\n assetUrl: string;\n importedModules: string[];\n importedCss: string[];\n isElement: boolean;\n }\n ) {\n this.assetMap = assetMap;\n this.moduleId = assetData.moduleId;\n this.assetUrl = assetData.assetUrl;\n this.importedModules = assetData.importedModules;\n this.importedCss = assetData.importedCss;\n this.isElement = assetData.isElement;\n }\n\n async getCssDeps(): Promise<string[]> {\n const visited = new Set<string>();\n const deps = new Set<string>();\n await this.collectCss(this, deps, visited);\n return Array.from(deps);\n }\n\n async getJsDeps(): Promise<string[]> {\n const visited = new Set<string>();\n const deps = new Set<string>();\n await this.collectJs(this, deps, visited);\n return Array.from(deps);\n }\n\n private async collectJs(\n asset: BuildAsset | null,\n urls: Set<string>,\n visited: Set<string>\n ) {\n if (!asset) {\n return;\n }\n if (!asset.moduleId) {\n return;\n }\n if (visited.has(asset.moduleId)) {\n return;\n }\n visited.add(asset.moduleId);\n if (asset.isElement) {\n urls.add(asset.assetUrl);\n }\n await Promise.all(\n asset.importedModules.map(async (moduleId) => {\n const importedAsset = (await this.assetMap.get(moduleId)) as BuildAsset;\n this.collectJs(importedAsset, urls, visited);\n })\n );\n }\n\n private async collectCss(\n asset: BuildAsset | null,\n urls: Set<string>,\n visited: Set<string>\n ) {\n if (!asset) {\n return;\n }\n if (!asset.assetUrl) {\n return;\n }\n if (visited.has(asset.moduleId)) {\n return;\n }\n visited.add(asset.moduleId);\n if (asset.importedCss) {\n asset.importedCss.forEach((cssUrl) => urls.add(cssUrl));\n }\n await Promise.all(\n asset.importedModules.map(async (moduleId) => {\n const importedAsset = (await this.assetMap.get(moduleId)) as BuildAsset;\n this.collectCss(importedAsset, urls, visited);\n })\n );\n }\n\n toJson() {\n return {\n moduleId: this.moduleId,\n assetUrl: this.assetUrl,\n importedModules: this.importedModules,\n importedCss: this.importedCss,\n isElement: this.isElement,\n };\n }\n}\n","import path from 'node:path';\nimport {default as express, Request, Response, NextFunction} from 'express';\nimport {loadRootConfig} from '../load-config';\nimport {Renderer} from '../../render/render.js';\nimport {fileExists, loadJson} from '../../core/fsutils';\nimport {\n BuildAssetManifest,\n BuildAssetMap,\n} from '../../render/asset-map/build-asset-map';\nimport {htmlMinify} from '../../render/html-minify';\n\nexport async function start(rootProjectDir?: string) {\n console.log('🌳 Root.js');\n process.env.NODE_ENV = 'production';\n\n const rootDir = rootProjectDir || process.cwd();\n const rootConfig = await loadRootConfig(rootDir);\n const distDir = path.join(rootDir, 'dist');\n\n const render = await import(path.join(distDir, 'server/render.js'));\n const renderer = new render.Renderer(rootConfig) as Renderer;\n\n const manifestPath = path.join(distDir, 'client/root-manifest.json');\n if (!(await fileExists(manifestPath))) {\n throw new Error(\n `could not find ${manifestPath}. run \\`root build\\` before \\`root start\\`.`\n );\n }\n const rootManifest = await loadJson<BuildAssetManifest>(manifestPath);\n const assetMap = BuildAssetMap.fromRootManifest(rootManifest);\n\n const app = express();\n\n const publicDir = path.join(distDir, 'html');\n app.use(express.static(publicDir));\n // TODO(stevenle): add middleware that checks for pre-built HTML in dist/.\n\n app.use(async (req: Request, res: Response, next: NextFunction) => {\n try {\n const url = req.originalUrl;\n const data = await renderer.render(url, {\n assetMap: assetMap,\n });\n let html = data.html || '';\n if (rootConfig.minifyHtml !== false) {\n html = await htmlMinify(html);\n }\n res.status(200).set({'Content-Type': 'text/html'}).end(html);\n } catch (e) {\n try {\n const {html} = await renderer.renderError(e);\n res.status(500).set({'Content-Type': 'text/html'}).end(html);\n } catch (e2) {\n console.error('failed to render custom error');\n console.error(e2);\n next(e);\n }\n }\n });\n\n const port = parseInt(process.env.PORT || '4007');\n console.log(`\\nStarted prod server: http://localhost:${port}`);\n app.listen(port);\n}\n"],"mappings":";AAAA,OAAOA,WAAU;AACjB,SAAQ,qBAAoB;AAC5B,SAAQ,WAAW,eAA+C;AAClE,SAAQ,gBAAgB,wBAAuB;;;ACH/C,OAAOC,WAAU;AACjB,OAAO,UAAU;;;ACDjB,SAAQ,YAAY,UAAS;AAC7B,OAAO,UAAU;AACjB,OAAO,aAAa;AAEb,SAAS,SAAS,UAAkB;AACzC,SAAO,CAAC,CAAC,SAAS,MAAM,aAAa;AACvC;AAEA,eAAsB,UAAU,UAAkB,SAAiB;AACjE,QAAM,UAAU,KAAK,QAAQ,QAAQ;AACrC,QAAM,QAAQ,OAAO;AACrB,QAAM,GAAG,UAAU,UAAU,OAAO;AACtC;AAEA,eAAsB,QAAQ,SAAiB;AAC7C,MAAI;AACF,UAAM,GAAG,OAAO,OAAO;AAAA,EACzB,SAAS,GAAP;AACA,UAAM,GAAG,MAAM,SAAS,EAAC,WAAW,KAAI,CAAC;AAAA,EAC3C;AACF;AAEA,eAAsB,QAAQ,QAAgB,QAAgB;AAC5D,MAAI,CAAC,QAAQ,WAAW,MAAM,GAAG;AAC/B;AAAA,EACF;AACA,UAAQ,SAAS,QAAQ,QAAQ,EAAC,WAAW,MAAM,WAAW,KAAI,CAAC;AACrE;AAEA,eAAsB,MAAM,SAAiB;AAC3C,QAA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IAAI;AAAA,MACR,kBAAkB;AAAA,IACpB;AAAA,EACF;AACA,QAAM,eAAe,MAAM,SAA6B,YAAY;AACpE,QAAM,WAAW,cAAc,iBAAiB,YAAY;AAE5D,QAAM,MAAMC,SAAQ;AAEpB,QAAM,YAAYD,MAAK,KAAK,SAAS,MAAM;AAC3C,MAAI,IAAIC,SAAQ,OAAO,SAAS,CAAC;AAGjC,MAAI,IAAI,OAAO,KAAc,KAAe,SAAuB;AACjE,QAAI;AACF,YAAM,MAAM,IAAI;AAChB,YAAM,OAAO,MAAM,SAAS,OAAO,KAAK;AAAA,QACtC;AAAA,MACF,CAAC;AACD,UAAI,OAAO,KAAK,QAAQ;AACxB,UAAI,WAAW,eAAe,OAAO;AACnC,eAAO,MAAM,WAAW,IAAI;AAAA,MAC9B;AACA,UAAI,OAAO,GAAG,EAAE,IAAI,EAAC,gBAAgB,YAAW,CAAC,EAAE,IAAI,IAAI;AAAA,IAC7D,SAAS,GAAP;AACA,UAAI;AACF,cAAM,EAAC,KAAI,IAAI,MAAM,SAAS,YAAY,CAAC;AAC3C,YAAI,OAAO,GAAG,EAAE,IAAI,EAAC,gBAAgB,YAAW,CAAC,EAAE,IAAI,IAAI;AAAA,MAC7D,SAAS,IAAP;AACA,gBAAQ,MAAM,+BAA+B;AAC7C,gBAAQ,MAAM,EAAE;AAChB,aAAK,CAAC;AAAA,MACR;AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,OAAO,SAAS,QAAQ,IAAI,QAAQ,MAAM;AAChD,UAAQ,IAAI;AAAA,wCAA2C,MAAM;AAC7D,MAAI,OAAO,IAAI;AACjB;","names":["path","path","path","path","glob","path","path","fileURLToPath","fsExtra","glob","__dirname","path","fileURLToPath","glob","fsExtra","path","express","path","express"]}
|
package/dist/core.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as preact from 'preact';
|
|
2
2
|
import { h, ComponentChildren } from 'preact';
|
|
3
|
-
export { b as GetStaticPaths, G as GetStaticProps, R as RootConfig, a as RootI18nConfig, d as defineConfig } from './types-
|
|
3
|
+
export { b as GetStaticPaths, G as GetStaticProps, R as RootConfig, a as RootI18nConfig, d as defineConfig } from './types-2af24c42.js';
|
|
4
4
|
import 'vite';
|
|
5
5
|
|
|
6
6
|
interface ErrorPageProps {
|
package/dist/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/config.ts"],"sourcesContent":["import {UserConfig as ViteUserConfig} from 'vite';\n\nexport interface RootConfig {\n /**\n * Configuration for auto-injecting custom element dependencies.\n */\n elements?: {\n /**\n * A list of directories to use to look for custom elements. The dir path\n * should be relative to the project dir, e.g. \"path/to/elements\" or\n * \"node_modules/my-package\".\n */\n include?: string[];\n };\n\n /**\n * Configuration options for localization and internationalization.\n */\n i18n?: RootI18nConfig;\n\n /**\n * Vite configuration.\n * @see {@link https://vitejs.dev/config/} for more information.\n */\n vite?: ViteUserConfig;\n\n /**\n * Whether to automatically minify HTML output.\n */\n minifyHtml?: boolean;\n\n /**\n * Whether to include a sitemap.xml file to the build output.\n */\n sitemap?: boolean;\n}\n\nexport interface RootI18nConfig {\n /**\n * Locales enabled for the site.\n */\n locales?: string[];\n\n /**\n * The default locale to use. Defaults is `en`.\n */\n defaultLocale?: string;\n\n /**\n * URL format for localized content. Default is `/{locale}/{path}`.\n */\n urlFormat?: string;\n}\n\nexport function defineConfig(config: RootConfig): RootConfig {\n return config;\n}\n"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/core/config.ts"],"sourcesContent":["import {UserConfig as ViteUserConfig} from 'vite';\n\nexport interface RootConfig {\n /**\n * Configuration for auto-injecting custom element dependencies.\n */\n elements?: {\n /**\n * A list of directories to use to look for custom elements. The dir path\n * should be relative to the project dir, e.g. \"path/to/elements\" or\n * \"node_modules/my-package\".\n */\n include?: string[];\n\n /**\n * A list of RegEx patterns to exclude. The string passed to the RegEx is\n * the file URL relative to the project root, e.g. \"/elements/foo/foo.ts\".\n */\n exclude?: RegExp[];\n };\n\n /**\n * Configuration options for localization and internationalization.\n */\n i18n?: RootI18nConfig;\n\n /**\n * Vite configuration.\n * @see {@link https://vitejs.dev/config/} for more information.\n */\n vite?: ViteUserConfig;\n\n /**\n * Whether to automatically minify HTML output.\n */\n minifyHtml?: boolean;\n\n /**\n * Whether to include a sitemap.xml file to the build output.\n */\n sitemap?: boolean;\n}\n\nexport interface RootI18nConfig {\n /**\n * Locales enabled for the site.\n */\n locales?: string[];\n\n /**\n * The default locale to use. Defaults is `en`.\n */\n defaultLocale?: string;\n\n /**\n * URL format for localized content. Default is `/{locale}/{path}`.\n */\n urlFormat?: string;\n}\n\nexport function defineConfig(config: RootConfig): RootConfig {\n return config;\n}\n"],"mappings":";;;;;;;;;;;;AA4DO,SAAS,aAAa,QAAgC;AAC3D,SAAO;AACT;","names":[]}
|
package/dist/render.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from 'preact';
|
|
2
|
-
import { b as GetStaticPaths, G as GetStaticProps, R as RootConfig } from './types-
|
|
2
|
+
import { b as GetStaticPaths, G as GetStaticProps, R as RootConfig } from './types-2af24c42.js';
|
|
3
3
|
import 'vite';
|
|
4
4
|
|
|
5
5
|
interface RouteModule {
|
|
@@ -11,6 +11,11 @@ interface RootConfig {
|
|
|
11
11
|
* "node_modules/my-package".
|
|
12
12
|
*/
|
|
13
13
|
include?: string[];
|
|
14
|
+
/**
|
|
15
|
+
* A list of RegEx patterns to exclude. The string passed to the RegEx is
|
|
16
|
+
* the file URL relative to the project root, e.g. "/elements/foo/foo.ts".
|
|
17
|
+
*/
|
|
18
|
+
exclude?: RegExp[];
|
|
14
19
|
};
|
|
15
20
|
/**
|
|
16
21
|
* Configuration options for localization and internationalization.
|