@jasonshimmy/vite-plugin-cer-app 0.1.1 → 0.1.2
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/CHANGELOG.md +4 -0
- package/commits.txt +1 -1
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +2 -0
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/preview.d.ts.map +1 -1
- package/dist/cli/commands/preview.js +21 -2
- package/dist/cli/commands/preview.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/plugin/build-ssg.d.ts.map +1 -1
- package/dist/plugin/build-ssg.js +10 -21
- package/dist/plugin/build-ssg.js.map +1 -1
- package/dist/plugin/build-ssr.d.ts.map +1 -1
- package/dist/plugin/build-ssr.js +150 -27
- package/dist/plugin/build-ssr.js.map +1 -1
- package/dist/plugin/virtual/routes.d.ts.map +1 -1
- package/dist/plugin/virtual/routes.js +11 -1
- package/dist/plugin/virtual/routes.js.map +1 -1
- package/dist/runtime/app-template.d.ts +1 -1
- package/dist/runtime/app-template.d.ts.map +1 -1
- package/dist/runtime/app-template.js +6 -0
- package/dist/runtime/app-template.js.map +1 -1
- package/dist/runtime/composables/use-page-data.d.ts +15 -6
- package/dist/runtime/composables/use-page-data.d.ts.map +1 -1
- package/dist/runtime/composables/use-page-data.js +30 -9
- package/dist/runtime/composables/use-page-data.js.map +1 -1
- package/dist/runtime/entry-server-template.d.ts +1 -1
- package/dist/runtime/entry-server-template.d.ts.map +1 -1
- package/dist/runtime/entry-server-template.js +137 -16
- package/dist/runtime/entry-server-template.js.map +1 -1
- package/docs/data-loading.md +7 -6
- package/docs/getting-started.md +1 -1
- package/docs/rendering-modes.md +1 -1
- package/docs/server-api.md +9 -0
- package/package.json +1 -1
- package/src/__tests__/index.test.ts +21 -0
- package/src/__tests__/plugin/build-ssg.test.ts +265 -0
- package/src/__tests__/plugin/build-ssr.test.ts +180 -0
- package/src/__tests__/plugin/cer-app-plugin.test.ts +409 -0
- package/src/__tests__/plugin/dts-generator.test.ts +246 -0
- package/src/__tests__/plugin/resolve-config.test.ts +158 -0
- package/src/__tests__/plugin/virtual/error.test.ts +71 -0
- package/src/__tests__/plugin/virtual/loading.test.ts +72 -0
- package/src/__tests__/plugin/virtual/server-middleware.test.ts +102 -0
- package/src/__tests__/runtime/use-page-data.test.ts +81 -5
- package/src/__tests__/types/config.test.ts +23 -0
- package/src/cli/commands/generate.ts +2 -0
- package/src/cli/commands/preview.ts +21 -2
- package/src/cli/index.ts +1 -1
- package/src/plugin/build-ssg.ts +9 -22
- package/src/plugin/build-ssr.ts +149 -27
- package/src/plugin/virtual/routes.ts +12 -1
- package/src/runtime/app-template.ts +6 -0
- package/src/runtime/composables/use-page-data.ts +31 -9
- package/src/runtime/entry-server-template.ts +137 -16
- package/tsconfig.build.json +1 -1
- package/dist/__tests__/plugin/path-utils.test.d.ts +0 -2
- package/dist/__tests__/plugin/path-utils.test.d.ts.map +0 -1
- package/dist/__tests__/plugin/path-utils.test.js +0 -305
- package/dist/__tests__/plugin/path-utils.test.js.map +0 -1
- package/dist/__tests__/plugin/scanner.test.d.ts +0 -2
- package/dist/__tests__/plugin/scanner.test.d.ts.map +0 -1
- package/dist/__tests__/plugin/scanner.test.js +0 -143
- package/dist/__tests__/plugin/scanner.test.js.map +0 -1
- package/dist/__tests__/plugin/transforms/auto-import.test.d.ts +0 -2
- package/dist/__tests__/plugin/transforms/auto-import.test.d.ts.map +0 -1
- package/dist/__tests__/plugin/transforms/auto-import.test.js +0 -151
- package/dist/__tests__/plugin/transforms/auto-import.test.js.map +0 -1
- package/dist/__tests__/plugin/transforms/head-inject.test.d.ts +0 -2
- package/dist/__tests__/plugin/transforms/head-inject.test.d.ts.map +0 -1
- package/dist/__tests__/plugin/transforms/head-inject.test.js +0 -151
- package/dist/__tests__/plugin/transforms/head-inject.test.js.map +0 -1
- package/dist/__tests__/plugin/virtual/components.test.d.ts +0 -2
- package/dist/__tests__/plugin/virtual/components.test.d.ts.map +0 -1
- package/dist/__tests__/plugin/virtual/components.test.js +0 -47
- package/dist/__tests__/plugin/virtual/components.test.js.map +0 -1
- package/dist/__tests__/plugin/virtual/composables.test.d.ts +0 -2
- package/dist/__tests__/plugin/virtual/composables.test.d.ts.map +0 -1
- package/dist/__tests__/plugin/virtual/composables.test.js +0 -48
- package/dist/__tests__/plugin/virtual/composables.test.js.map +0 -1
- package/dist/__tests__/plugin/virtual/layouts.test.d.ts +0 -2
- package/dist/__tests__/plugin/virtual/layouts.test.d.ts.map +0 -1
- package/dist/__tests__/plugin/virtual/layouts.test.js +0 -59
- package/dist/__tests__/plugin/virtual/layouts.test.js.map +0 -1
- package/dist/__tests__/plugin/virtual/middleware.test.d.ts +0 -2
- package/dist/__tests__/plugin/virtual/middleware.test.d.ts.map +0 -1
- package/dist/__tests__/plugin/virtual/middleware.test.js +0 -58
- package/dist/__tests__/plugin/virtual/middleware.test.js.map +0 -1
- package/dist/__tests__/plugin/virtual/plugins.test.d.ts +0 -2
- package/dist/__tests__/plugin/virtual/plugins.test.d.ts.map +0 -1
- package/dist/__tests__/plugin/virtual/plugins.test.js +0 -73
- package/dist/__tests__/plugin/virtual/plugins.test.js.map +0 -1
- package/dist/__tests__/plugin/virtual/routes.test.d.ts +0 -2
- package/dist/__tests__/plugin/virtual/routes.test.d.ts.map +0 -1
- package/dist/__tests__/plugin/virtual/routes.test.js +0 -167
- package/dist/__tests__/plugin/virtual/routes.test.js.map +0 -1
- package/dist/__tests__/plugin/virtual/server-api.test.d.ts +0 -2
- package/dist/__tests__/plugin/virtual/server-api.test.d.ts.map +0 -1
- package/dist/__tests__/plugin/virtual/server-api.test.js +0 -72
- package/dist/__tests__/plugin/virtual/server-api.test.js.map +0 -1
- package/dist/__tests__/runtime/use-head.test.d.ts +0 -2
- package/dist/__tests__/runtime/use-head.test.d.ts.map +0 -1
- package/dist/__tests__/runtime/use-head.test.js +0 -202
- package/dist/__tests__/runtime/use-head.test.js.map +0 -1
- package/dist/__tests__/runtime/use-page-data.test.d.ts +0 -2
- package/dist/__tests__/runtime/use-page-data.test.d.ts.map +0 -1
- package/dist/__tests__/runtime/use-page-data.test.js +0 -41
- package/dist/__tests__/runtime/use-page-data.test.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
|
+
## [v0.1.2] - 2026-03-19
|
|
5
|
+
|
|
6
|
+
- fix(build): fix SSR and SSG build modes (23d5363)
|
|
7
|
+
|
|
4
8
|
## [v0.1.1] - 2026-03-18
|
|
5
9
|
|
|
6
10
|
- fix: rename vite-plugin-cer-app usage to @jasonshimmy/vite-plugin-cer-app (60c4bdf)
|
package/commits.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
- fix:
|
|
1
|
+
- fix(build): fix SSR and SSG build modes (23d5363)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAsDnC;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAsDnC;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAwBzC"}
|
|
@@ -67,6 +67,8 @@ export function generateCommand() {
|
|
|
67
67
|
plugins: cerApp(userConfig),
|
|
68
68
|
};
|
|
69
69
|
await buildSSG(config, viteUserConfig);
|
|
70
|
+
// Force exit: the SSG path-enumeration Vite server may keep alive Node timers.
|
|
71
|
+
process.exit(0);
|
|
70
72
|
});
|
|
71
73
|
}
|
|
72
74
|
//# sourceMappingURL=generate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/cli/commands/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAG9C,KAAK,UAAU,aAAa,CAAC,IAAY;IACvC,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC,CAAA;IACjD,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC,CAAA;IAEnD,MAAM,QAAQ,GAAG,UAAU,CAAC,UAAU,CAAC;QACrC,CAAC,CAAC,UAAU;QACZ,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC;YACxB,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,IAAI,CAAA;IAEV,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAA;IAExB,IAAI,CAAC;QACH,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAA;QACtC,MAAM,KAAK,CAAC;YACV,KAAK,EAAE;gBACL,GAAG,EAAE;oBACH,KAAK,EAAE,QAAQ;oBACf,OAAO,EAAE,CAAC,IAAI,CAAC;oBACf,QAAQ,EAAE,YAAY;iBACvB;gBACD,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,6BAA6B,CAAC;gBACpD,KAAK,EAAE,IAAI;gBACX,aAAa,EAAE,EAAE,QAAQ,EAAE,CAAC,E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AE,OAAO,EAAE,EAAE;QACxB,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAClC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,CAAA;QAE5C,iBAAiB;QACjB,UAAU,CAAC,IAAI,GAAG,KAAK,CAAA;QAEvB,MAAM,MAAM,GAAG,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;QAE9C,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;QAElD,MAAM,cAAc,GAAG;YACrB,IAAI;YACJ,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC;SAC5B,CAAA;QAED,MAAM,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;QACtC,+EAA+E;QAC/E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAoFnC,wBAAgB,cAAc,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAoFnC,wBAAgB,cAAc,IAAI,OAAO,CAwJxC"}
|
|
@@ -86,9 +86,13 @@ export function previewCommand() {
|
|
|
86
86
|
const port = parseInt(options.port, 10);
|
|
87
87
|
const distDir = join(root, 'dist');
|
|
88
88
|
const serverBundle = join(distDir, 'server/server.js');
|
|
89
|
-
// Check if SSR server bundle exists
|
|
89
|
+
// Check if SSR server bundle exists.
|
|
90
|
+
// An SSG build also produces a server bundle, but previewing SSG means serving
|
|
91
|
+
// the pre-rendered static HTML — detect the SSG manifest to avoid switching to
|
|
92
|
+
// live SSR mode for SSG builds.
|
|
90
93
|
const hasServerBundle = existsSync(serverBundle);
|
|
91
|
-
const
|
|
94
|
+
const hasSsgManifest = existsSync(join(distDir, 'ssg-manifest.json'));
|
|
95
|
+
const useSSR = options.ssr || (hasServerBundle && !hasSsgManifest);
|
|
92
96
|
if (useSSR && hasServerBundle) {
|
|
93
97
|
console.log('[cer-app] Starting SSR preview server...');
|
|
94
98
|
// Load the server bundle
|
|
@@ -174,6 +178,21 @@ export function previewCommand() {
|
|
|
174
178
|
process.exit(1);
|
|
175
179
|
}
|
|
176
180
|
const server = createHttpServer((req, res) => {
|
|
181
|
+
const urlPath = (req.url ?? '/').split('?')[0];
|
|
182
|
+
// SSG builds put assets in dist/client/ while HTML lives in dist/.
|
|
183
|
+
// For requests with a non-HTML file extension, check dist/client/ first
|
|
184
|
+
// so the static server finds the Vite-built JS/CSS bundles.
|
|
185
|
+
const clientDist = join(distDir, 'client');
|
|
186
|
+
const ext = extname(urlPath).toLowerCase();
|
|
187
|
+
if (ext && ext !== '.html' && existsSync(clientDist)) {
|
|
188
|
+
const assetPath = join(clientDist, urlPath);
|
|
189
|
+
if (existsSync(assetPath) && !statSync(assetPath).isDirectory()) {
|
|
190
|
+
res.setHeader('Content-Type', getMimeType(assetPath));
|
|
191
|
+
res.setHeader('Cache-Control', 'no-cache');
|
|
192
|
+
createReadStream(assetPath).pipe(res);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
177
196
|
const served = serveStaticFile(req, res, distDir);
|
|
178
197
|
if (!served) {
|
|
179
198
|
res.statusCode = 404;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../../src/cli/commands/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAA6C,MAAM,WAAW,CAAA;AACvG,OAAO,EAAE,gBAAgB,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OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;IAC7C,CAAC,CAAC,CAAA;AACN,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -13,5 +13,5 @@ program.addCommand(devCommand());
|
|
|
13
13
|
program.addCommand(buildCommand());
|
|
14
14
|
program.addCommand(previewCommand());
|
|
15
15
|
program.addCommand(generateCommand());
|
|
16
|
-
program.
|
|
16
|
+
await program.parseAsync(process.argv);
|
|
17
17
|
//# sourceMappingURL=index.js.map
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAE7B,OAAO;KACJ,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,wEAAwE,CAAC;KACrF,OAAO,CAAC,OAAO,CAAC,CAAA;AAEnB,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,CAAA;AAChC,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAA;AAClC,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,CAAA;AACpC,OAAO,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAA;AAErC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAE7B,OAAO;KACJ,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,wEAAwE,CAAC;KACrF,OAAO,CAAC,OAAO,CAAC,CAAA;AAEnB,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,CAAA;AAChC,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAA;AAClC,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,CAAA;AACpC,OAAO,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAA;AAErC,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-ssg.d.ts","sourceRoot":"","sources":["../../src/plugin/build-ssg.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"build-ssg.d.ts","sourceRoot":"","sources":["../../src/plugin/build-ssg.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAmKxD;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,iBAAiB,EACzB,cAAc,GAAE,UAAe,GAC9B,OAAO,CAAC,IAAI,CAAC,CAmEf"}
|
package/dist/plugin/build-ssg.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writeFile, mkdir
|
|
1
|
+
import { writeFile, mkdir } from 'node:fs/promises';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import { join } from 'pathe';
|
|
4
4
|
import { createServer } from 'vite';
|
|
@@ -80,11 +80,11 @@ let _serverMod = null;
|
|
|
80
80
|
/**
|
|
81
81
|
* Renders a single path using the SSR server bundle and returns the HTML.
|
|
82
82
|
*
|
|
83
|
-
* The server bundle
|
|
84
|
-
*
|
|
85
|
-
*
|
|
83
|
+
* The server bundle's handler already merges the SSR output with
|
|
84
|
+
* dist/client/index.html internally (via the _mergeWithClientTemplate helper
|
|
85
|
+
* it embeds at build time), so this function simply captures the response.
|
|
86
86
|
*/
|
|
87
|
-
async function renderPath(path, serverBundlePath
|
|
87
|
+
async function renderPath(path, serverBundlePath) {
|
|
88
88
|
// Load server bundle once
|
|
89
89
|
if (!_serverMod) {
|
|
90
90
|
try {
|
|
@@ -102,27 +102,17 @@ async function renderPath(path, serverBundlePath, clientDistDir) {
|
|
|
102
102
|
console.warn(`[cer-app] No handler function found in server bundle for path: ${path}`);
|
|
103
103
|
return '';
|
|
104
104
|
}
|
|
105
|
-
// Mock req/res for the Express-style handler
|
|
105
|
+
// Mock req/res for the Express-style handler.
|
|
106
|
+
// The handler internally merges with dist/client/index.html, so we just
|
|
107
|
+
// capture whatever it ends with.
|
|
106
108
|
const mockReq = { url: path, headers: {} };
|
|
107
|
-
|
|
109
|
+
return new Promise((resolve, reject) => {
|
|
108
110
|
const mockRes = {
|
|
109
111
|
setHeader: () => { },
|
|
110
|
-
// Intentionally omit write() so the handler uses the non-streaming code path
|
|
111
112
|
end: (body) => resolve(body),
|
|
112
113
|
};
|
|
113
114
|
handlerFn(mockReq, mockRes).catch(reject);
|
|
114
115
|
});
|
|
115
|
-
// Read the client index.html template and inject the server-rendered body
|
|
116
|
-
const templatePath = join(clientDistDir, 'index.html');
|
|
117
|
-
if (!existsSync(templatePath))
|
|
118
|
-
return html;
|
|
119
|
-
const template = await readFile(templatePath, 'utf-8');
|
|
120
|
-
// The handler already emits a full document; just return it as-is
|
|
121
|
-
// If it only emits a fragment we fall back to injecting into the template
|
|
122
|
-
if (html.trimStart().startsWith('<!DOCTYPE') || html.trimStart().startsWith('<html')) {
|
|
123
|
-
return html;
|
|
124
|
-
}
|
|
125
|
-
return template.replace('<div id="app"></div>', `<div id="app">${html}</div>`);
|
|
126
116
|
}
|
|
127
117
|
/**
|
|
128
118
|
* Writes the rendered HTML to the output directory.
|
|
@@ -152,7 +142,6 @@ async function writeRenderedPath(path, html, distDir) {
|
|
|
152
142
|
*/
|
|
153
143
|
export async function buildSSG(config, viteUserConfig = {}) {
|
|
154
144
|
const distDir = join(config.root, 'dist');
|
|
155
|
-
const clientDistDir = join(distDir, 'client');
|
|
156
145
|
const serverDistDir = join(distDir, 'server');
|
|
157
146
|
const serverBundlePath = join(serverDistDir, 'server.js');
|
|
158
147
|
console.log('[cer-app] Starting SSG build...');
|
|
@@ -177,7 +166,7 @@ export async function buildSSG(config, viteUserConfig = {}) {
|
|
|
177
166
|
const chunk = paths.slice(i, i + concurrency);
|
|
178
167
|
const results = await Promise.allSettled(chunk.map(async (path) => {
|
|
179
168
|
console.log(`[cer-app] Generating: ${path}`);
|
|
180
|
-
const html = await renderPath(path, serverBundlePath
|
|
169
|
+
const html = await renderPath(path, serverBundlePath);
|
|
181
170
|
await writeRenderedPath(path, html, distDir);
|
|
182
171
|
return path;
|
|
183
172
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-ssg.js","sourceRoot":"","sources":["../../src/plugin/build-ssg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"build-ssg.js","sourceRoot":"","sources":["../../src/plugin/build-ssg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,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I,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;IAEzE,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;IAC5C,OAAO,CAAC,GAAG,CAAC,eAAe,cAAc,CAAC,MAAM,WAAW,CAAC,CAAA;IAC5D,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,MAAM,mBAAmB,YAAY,eAAe,CAAC,CAAA;IAChF,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,eAAe,YAAY,EAAE,CAAC,CAAA;AAC5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-ssr.d.ts","sourceRoot":"","sources":["../../src/plugin/build-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAG7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"build-ssr.d.ts","sourceRoot":"","sources":["../../src/plugin/build-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAG7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AA+LxD;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,iBAAiB,EACzB,cAAc,GAAE,UAAe,GAC9B,OAAO,CAAC,IAAI,CAAC,CAiEf"}
|
package/dist/plugin/build-ssr.js
CHANGED
|
@@ -1,66 +1,190 @@
|
|
|
1
1
|
import { build } from 'vite';
|
|
2
2
|
import { join, resolve } from 'pathe';
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
|
+
/**
|
|
5
|
+
* Resolves the client build entry point for an SSR/SSG build.
|
|
6
|
+
*
|
|
7
|
+
* Priority order:
|
|
8
|
+
* 1. `index.html` at the project root — preferred because Vite writes a
|
|
9
|
+
* processed `index.html` to `dist/client/` with correct asset references,
|
|
10
|
+
* which `renderPath` then uses as the shell template for SSG pages.
|
|
11
|
+
* 2. `app/entry-client.ts` — fallback for projects that handle HTML injection
|
|
12
|
+
* themselves (e.g. a custom Express server).
|
|
13
|
+
* 3. `app/app.ts` — last resort (same bundle, no DSD hydration preamble).
|
|
14
|
+
*/
|
|
15
|
+
function resolveClientEntry(config) {
|
|
16
|
+
const indexHtml = resolve(config.root, 'index.html');
|
|
17
|
+
if (existsSync(indexHtml))
|
|
18
|
+
return indexHtml;
|
|
19
|
+
const entryClient = resolve(config.srcDir, 'entry-client.ts');
|
|
20
|
+
if (existsSync(entryClient))
|
|
21
|
+
return entryClient;
|
|
22
|
+
return resolve(config.srcDir, 'app.ts');
|
|
23
|
+
}
|
|
4
24
|
/**
|
|
5
25
|
* The server entry template that wires all virtual modules together and
|
|
6
26
|
* exports a request handler for Node.js (Express-compatible).
|
|
7
27
|
*/
|
|
8
|
-
function generateServerEntryCode(
|
|
28
|
+
function generateServerEntryCode() {
|
|
9
29
|
return `// AUTO-GENERATED server entry by @jasonshimmy/vite-plugin-cer-app
|
|
30
|
+
import { readFileSync, existsSync } from 'node:fs'
|
|
31
|
+
import { dirname, join } from 'node:path'
|
|
32
|
+
import { fileURLToPath } from 'node:url'
|
|
10
33
|
import 'virtual:cer-components'
|
|
11
34
|
import routes from 'virtual:cer-routes'
|
|
12
35
|
import layouts from 'virtual:cer-layouts'
|
|
13
36
|
import plugins from 'virtual:cer-plugins'
|
|
14
37
|
import apiRoutes from 'virtual:cer-server-api'
|
|
15
|
-
import {
|
|
38
|
+
import { registerBuiltinComponents } from '@jasonshimmy/custom-elements-runtime'
|
|
39
|
+
import { registerEntityMap, renderToStringWithJITCSSDSD, DSD_POLYFILL_SCRIPT } from '@jasonshimmy/custom-elements-runtime/ssr'
|
|
40
|
+
import entitiesJson from '@jasonshimmy/custom-elements-runtime/entities.json'
|
|
16
41
|
import { initRouter } from '@jasonshimmy/custom-elements-runtime/router'
|
|
17
|
-
import { createStreamingSSRHandler } from '@jasonshimmy/custom-elements-runtime/ssr-middleware'
|
|
18
42
|
|
|
19
43
|
registerBuiltinComponents()
|
|
20
44
|
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
|
|
45
|
+
// Pre-load the full HTML entity map so named entities like — decode
|
|
46
|
+
// correctly during SSR. Without this the bundled runtime falls back to a
|
|
47
|
+
// minimal set (<, >, & …) and re-escapes everything else.
|
|
48
|
+
registerEntityMap(entitiesJson)
|
|
49
|
+
|
|
50
|
+
// Load the Vite-built client index.html (dist/client/index.html) so every SSR
|
|
51
|
+
// response includes the client-side scripts needed for hydration and routing.
|
|
52
|
+
// The server bundle lives at dist/server/server.js, so ../client resolves correctly.
|
|
53
|
+
const _clientTemplatePath = join(dirname(fileURLToPath(import.meta.url)), '../client/index.html')
|
|
54
|
+
const _clientTemplate = existsSync(_clientTemplatePath)
|
|
55
|
+
? readFileSync(_clientTemplatePath, 'utf-8')
|
|
56
|
+
: null
|
|
57
|
+
|
|
58
|
+
// Merge the SSR rendered body with the Vite client shell so the final page
|
|
59
|
+
// contains both pre-rendered DSD content and the client bundle scripts.
|
|
60
|
+
function _mergeWithClientTemplate(ssrHtml, clientTemplate) {
|
|
61
|
+
const headTag = '<head>', headCloseTag = '</head>'
|
|
62
|
+
const bodyTag = '<body>', bodyCloseTag = '</body>'
|
|
63
|
+
const headStart = ssrHtml.indexOf(headTag)
|
|
64
|
+
const headEnd = ssrHtml.indexOf(headCloseTag)
|
|
65
|
+
const bodyStart = ssrHtml.indexOf(bodyTag)
|
|
66
|
+
const bodyEnd = ssrHtml.lastIndexOf(bodyCloseTag)
|
|
67
|
+
const ssrHead = headStart >= 0 && headEnd > headStart
|
|
68
|
+
? ssrHtml.slice(headStart + headTag.length, headEnd).trim() : ''
|
|
69
|
+
const ssrBody = bodyStart >= 0 && bodyEnd > bodyStart
|
|
70
|
+
? ssrHtml.slice(bodyStart + bodyTag.length, bodyEnd).trim() : ssrHtml
|
|
71
|
+
// Hoist <style> elements from the SSR body into the document <head> so
|
|
72
|
+
// JIT CSS rules are applied before the layout paints.
|
|
73
|
+
const headParts = ssrHead ? [ssrHead] : []
|
|
74
|
+
let ssrBodyContent = ssrBody
|
|
75
|
+
let pos = 0
|
|
76
|
+
while (pos < ssrBodyContent.length) {
|
|
77
|
+
const styleOpen = ssrBodyContent.indexOf('<style', pos)
|
|
78
|
+
if (styleOpen < 0) break
|
|
79
|
+
const styleClose = ssrBodyContent.indexOf('</style>', styleOpen)
|
|
80
|
+
if (styleClose < 0) break
|
|
81
|
+
headParts.push(ssrBodyContent.slice(styleOpen, styleClose + 8))
|
|
82
|
+
ssrBodyContent = ssrBodyContent.slice(0, styleOpen) + ssrBodyContent.slice(styleClose + 8)
|
|
83
|
+
pos = styleOpen
|
|
84
|
+
}
|
|
85
|
+
ssrBodyContent = ssrBodyContent.trim()
|
|
86
|
+
// Inject the pre-rendered layout+page as light DOM of the app mount element
|
|
87
|
+
// so it is visible before JS boots, then the client router takes over.
|
|
88
|
+
let merged = clientTemplate
|
|
89
|
+
if (merged.includes('<cer-layout-view></cer-layout-view>')) {
|
|
90
|
+
merged = merged.replace('<cer-layout-view></cer-layout-view>',
|
|
91
|
+
'<cer-layout-view>' + ssrBodyContent + '</cer-layout-view>')
|
|
92
|
+
} else if (merged.includes('<div id="app"></div>')) {
|
|
93
|
+
merged = merged.replace('<div id="app"></div>',
|
|
94
|
+
'<div id="app">' + ssrBodyContent + '</div>')
|
|
95
|
+
}
|
|
96
|
+
const headAdditions = headParts.filter(Boolean).join('\\n')
|
|
97
|
+
if (headAdditions) merged = merged.replace('</head>', headAdditions + '\\n</head>')
|
|
98
|
+
return merged
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Per-request async setup: initialize a fresh router, resolve the matched
|
|
102
|
+
// route and layout, pre-load the page module, and call the data loader.
|
|
103
|
+
// Returns the vnode tree, router, head additions, and the raw loader data.
|
|
25
104
|
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
|
|
105
|
+
// loaderData is returned (not set on globalThis) so the handler can assign it
|
|
106
|
+
// synchronously right before renderToStringWithJITCSS — guaranteeing that
|
|
107
|
+
// concurrent renders (SSG concurrency > 1) never race on a shared global.
|
|
108
|
+
const _prepareRequest = async (req) => {
|
|
29
109
|
const router = initRouter({ routes, initialUrl: req.url ?? '/' })
|
|
30
110
|
const current = router.getCurrent()
|
|
31
111
|
const { route, params } = router.matchRoute(current.path)
|
|
32
112
|
const layoutName = route?.meta?.layout ?? 'default'
|
|
33
113
|
const layoutTag = layouts[layoutName]
|
|
34
|
-
const inner = html\`<router-view></router-view>\`
|
|
35
|
-
const vnode = layoutTag
|
|
36
|
-
? { tag: layoutTag, props: {}, children: [inner] }
|
|
37
|
-
: inner
|
|
38
114
|
|
|
39
|
-
//
|
|
115
|
+
// Pre-load the page module so we can embed the component tag directly.
|
|
116
|
+
// This avoids the async router-view (which injects content via script tags
|
|
117
|
+
// and breaks Declarative Shadow DOM on initial parse).
|
|
118
|
+
let pageVnode = { tag: 'div', props: {}, children: [] }
|
|
40
119
|
let head
|
|
120
|
+
let loaderData = null
|
|
41
121
|
if (route?.load) {
|
|
42
122
|
try {
|
|
43
123
|
const mod = await route.load()
|
|
124
|
+
const pageTag = mod.default
|
|
125
|
+
if (pageTag) {
|
|
126
|
+
pageVnode = { tag: pageTag, props: { attrs: { ...params } }, children: [] }
|
|
127
|
+
}
|
|
44
128
|
if (typeof mod.loader === 'function') {
|
|
45
129
|
const query = current.query ?? {}
|
|
46
130
|
const data = await mod.loader({ params, query, req })
|
|
47
131
|
if (data !== undefined && data !== null) {
|
|
132
|
+
loaderData = data
|
|
48
133
|
head = \`<script>window.__CER_DATA__ = \${JSON.stringify(data)}</script>\`
|
|
49
134
|
}
|
|
50
135
|
}
|
|
51
136
|
} catch {
|
|
52
|
-
//
|
|
137
|
+
// Non-fatal: loader errors fall back to an empty page; client will refetch.
|
|
53
138
|
}
|
|
54
139
|
}
|
|
55
140
|
|
|
56
|
-
|
|
141
|
+
const vnode = layoutTag
|
|
142
|
+
? { tag: layoutTag, props: {}, children: [pageVnode] }
|
|
143
|
+
: pageVnode
|
|
144
|
+
|
|
145
|
+
return { vnode, router, head, loaderData }
|
|
57
146
|
}
|
|
58
147
|
|
|
59
|
-
export const handler =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
148
|
+
export const handler = async (req, res) => {
|
|
149
|
+
const { vnode, router, head, loaderData } = await _prepareRequest(req)
|
|
150
|
+
|
|
151
|
+
// Set loader data on globalThis synchronously before the render so
|
|
152
|
+
// usePageData() can read it. Because renderToStringWithJITCSSDSD is entirely
|
|
153
|
+
// synchronous and JavaScript is single-threaded, no concurrent request can
|
|
154
|
+
// overwrite __CER_DATA__ between this assignment and the read inside setup().
|
|
155
|
+
if (loaderData !== null) {
|
|
156
|
+
;(globalThis).__CER_DATA__ = loaderData
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// dsdPolyfill: false — we inject the polyfill manually after merging so it
|
|
160
|
+
// lands at the end of <body>, not inside <cer-layout-view> light DOM where
|
|
161
|
+
// scripts may not execute.
|
|
162
|
+
const { htmlWithStyles } = renderToStringWithJITCSSDSD(vnode, {
|
|
163
|
+
dsdPolyfill: false,
|
|
164
|
+
router,
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
// Clear immediately after the synchronous render so the value never leaks
|
|
168
|
+
// to the next request on this same server process.
|
|
169
|
+
delete (globalThis).__CER_DATA__
|
|
170
|
+
|
|
171
|
+
// Wrap the rendered body in a full HTML document and inject the head additions
|
|
172
|
+
// (loader data script, useHead() tags, JIT styles). No polyfill in body yet.
|
|
173
|
+
const ssrHtml = \`<!DOCTYPE html><html><head>\${head ?? ''}</head><body>\${htmlWithStyles}</body></html>\`
|
|
174
|
+
|
|
175
|
+
let finalHtml = _clientTemplate
|
|
176
|
+
? _mergeWithClientTemplate(ssrHtml, _clientTemplate)
|
|
177
|
+
: ssrHtml
|
|
178
|
+
|
|
179
|
+
// Inject DSD polyfill at end of <body>, outside <cer-layout-view>, so the
|
|
180
|
+
// browser runs it after parsing the declarative shadow roots.
|
|
181
|
+
finalHtml = finalHtml.includes('</body>')
|
|
182
|
+
? finalHtml.replace('</body>', DSD_POLYFILL_SCRIPT + '</body>')
|
|
183
|
+
: finalHtml + DSD_POLYFILL_SCRIPT
|
|
184
|
+
|
|
185
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8')
|
|
186
|
+
res.end(finalHtml)
|
|
187
|
+
}
|
|
64
188
|
|
|
65
189
|
export { apiRoutes, plugins, layouts }
|
|
66
190
|
export default handler
|
|
@@ -75,10 +199,9 @@ export default handler
|
|
|
75
199
|
export async function buildSSR(config, viteUserConfig = {}) {
|
|
76
200
|
const clientOutDir = join(config.root, 'dist/client');
|
|
77
201
|
const serverOutDir = join(config.root, 'dist/server');
|
|
78
|
-
//
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
: resolve(config.srcDir, 'app.ts');
|
|
202
|
+
// Resolve the client entry — index.html is preferred so Vite writes a
|
|
203
|
+
// processed index.html to dist/client/ for use as the SSG shell template.
|
|
204
|
+
const clientEntry = resolveClientEntry(config);
|
|
82
205
|
// Build the client bundle
|
|
83
206
|
console.log('[cer-app] Building client bundle...');
|
|
84
207
|
await build({
|
|
@@ -94,7 +217,7 @@ export async function buildSSR(config, viteUserConfig = {}) {
|
|
|
94
217
|
},
|
|
95
218
|
});
|
|
96
219
|
// Generate server entry source inline via a virtual plugin
|
|
97
|
-
const serverEntryCode = generateServerEntryCode(
|
|
220
|
+
const serverEntryCode = generateServerEntryCode();
|
|
98
221
|
const VIRTUAL_SERVER_ENTRY = 'virtual:cer-server-entry';
|
|
99
222
|
const RESOLVED_SERVER_ENTRY = '\0virtual:cer-server-entry';
|
|
100
223
|
// Build the server (SSR) bundle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-ssr.js","sourceRoot":"","sources":["../../src/plugin/build-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAmB,MAAM,MAAM,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAGpC
|
|
1
|
+
{"version":3,"file":"build-ssr.js","sourceRoot":"","sources":["../../src/plugin/build-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAmB,MAAM,MAAM,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAGpC;;;;;;;;;;GAUG;AACH,SAAS,kBAAkB,CAAC,MAAyB;IACnD,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;IACpD,IAAI,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAA;IAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAC7D,IAAI,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,WAAW,CAAA;IAC/C,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;AACzC,CAAC;AAED;;;GAGG;AACH,SAAS,uBAAuB;IAC9B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkKR,CAAA;AACD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,C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AG,cAAc,CAAC,KAAK;YACvB,MAAM,EAAE,YAAY;YACpB,GAAG,EAAE,IAAI;YACT,aAAa,EAAE;gBACb,KAAK,EAAE,oBAAoB;gBAC3B,MAAM,EAAE;oBACN,cAAc,EAAE,WAAW;iBAC5B;aACF;SACF;QACD,GAAG,EAAE;YACH,UAAU,EAAE,CAAC,sCAAsC,CAAC;SACrD;KACF,CAAC,CAAA;IAEF,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;IAC5C,OAAO,CAAC,GAAG,CAAC,aAAa,YAAY,EAAE,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,aAAa,YAAY,EAAE,CAAC,CAAA;AAC1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/plugin/virtual/routes.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/plugin/virtual/routes.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA0G1E"}
|
|
@@ -56,7 +56,7 @@ export async function generateRoutesCode(pagesDir) {
|
|
|
56
56
|
if (files.length === 0) {
|
|
57
57
|
return `// AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app\nconst routes = []\nexport default routes\n`;
|
|
58
58
|
}
|
|
59
|
-
const
|
|
59
|
+
const rawEntries = files.map((f) => {
|
|
60
60
|
const entry = buildRouteEntry(f, pagesDir);
|
|
61
61
|
// 404.ts convention: treat as catch-all not-found route
|
|
62
62
|
if (basename(f) === '404.ts') {
|
|
@@ -64,6 +64,16 @@ export async function generateRoutesCode(pagesDir) {
|
|
|
64
64
|
}
|
|
65
65
|
return entry;
|
|
66
66
|
});
|
|
67
|
+
// Deduplicate by routePath — keep the first occurrence after sorting to
|
|
68
|
+
// avoid "Duplicate route path detected" warnings (e.g. when both 404.ts
|
|
69
|
+
// and [...all].ts resolve to the same /:all* catch-all route).
|
|
70
|
+
const seen = new Set();
|
|
71
|
+
const entries = rawEntries.filter((e) => {
|
|
72
|
+
if (seen.has(e.routePath))
|
|
73
|
+
return false;
|
|
74
|
+
seen.add(e.routePath);
|
|
75
|
+
return true;
|
|
76
|
+
});
|
|
67
77
|
const sorted = sortRoutes(entries);
|
|
68
78
|
// Read each file's source once to extract static metadata (middleware + layout)
|
|
69
79
|
// without eagerly importing the module.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/plugin/virtual/routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE9D;;;;;;;GAOG;AACH,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAA;IAC3D,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAA;IACrB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;IACtB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC9C,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAA;IACrB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAA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,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IAClC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACf,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAA;IACnC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEd,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* runs plugins, and registers the framework-level <cer-layout-view> component
|
|
7
7
|
* that handles layout selection, loading indicators, and error pages.
|
|
8
8
|
*/
|
|
9
|
-
export declare const APP_TEMPLATE = "import '@jasonshimmy/custom-elements-runtime/css'\nimport 'virtual:cer-components'\nimport routes from 'virtual:cer-routes'\nimport layouts from 'virtual:cer-layouts'\nimport plugins from 'virtual:cer-plugins'\nimport { hasLoading, loadingTag } from 'virtual:cer-loading'\nimport { hasError, errorTag } from 'virtual:cer-error'\nimport {\n component,\n ref,\n useOnConnected,\n useOnDisconnected,\n registerBuiltinComponents,\n} from '@jasonshimmy/custom-elements-runtime'\nimport { initRouter } from '@jasonshimmy/custom-elements-runtime/router'\nimport { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'\nimport { createDOMJITCSS } from '@jasonshimmy/custom-elements-runtime/dom-jit-css'\n\nregisterBuiltinComponents()\n\n// Enable JIT CSS globally for all Shadow DOM components.\nenableJITCSS()\n\n// initRouter registers router-view/router-link, creates the router, and sets it as active.\nconst router = initRouter({ routes })\n\n// \u2500\u2500\u2500 Navigation state \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n// isNavigating becomes true while a lazy route chunk is loading.\nconst isNavigating = ref(false)\n\n// currentError holds the last uncaught navigation or render error.\nconst currentError = ref(null)\n\n// Expose resetError globally so page-error components can call it.\n;(globalThis as any).resetError = () => {\n currentError.value = null\n router.replace(router.getCurrent().path)\n}\n\n// Wrap push/replace to track navigation pending state.\nconst _push = router.push.bind(router)\nconst _replace = router.replace.bind(router)\n\nrouter.push = async (path) => {\n isNavigating.value = true\n currentError.value = null\n try {\n await _push(path)\n } catch (err) {\n currentError.value = err instanceof Error ? err.message : String(err)\n } finally {\n isNavigating.value = false\n }\n}\n\nrouter.replace = async (path) => {\n isNavigating.value = true\n currentError.value = null\n try {\n await _replace(path)\n } catch (err) {\n currentError.value = err instanceof Error ? err.message : String(err)\n } finally {\n isNavigating.value = false\n }\n}\n\n// \u2500\u2500\u2500 <cer-layout-view> \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n//\n// Wraps <router-view> in the layout appropriate for the current route.\n// Falls back to rendering <router-view> directly when no matching layout\n// exists. Also renders loading / error pages when those states are active.\n//\n// Layout stays mounted across navigations that share the same layout \u2014 the\n// vdom diff preserves the outer element when its tag name doesn't change.\n\ncomponent('cer-layout-view', () => {\n const current = ref(router.getCurrent())\n let unsub: (() => void) | undefined\n\n useOnConnected(() => {\n unsub = router.subscribe((s: typeof current.value) => {\n current.value = s\n })\n })\n\n useOnDisconnected(() => {\n unsub?.()\n unsub = undefined\n })\n\n // Error state \u2014 show page-error if available, otherwise plain text.\n if (currentError.value !== null) {\n if (hasError && errorTag) {\n return { tag: errorTag, props: { attrs: { error: String(currentError.value) } }, children: [] }\n }\n return { tag: 'div', props: { attrs: { style: 'padding:2rem;font-family:monospace' } }, children: [String(currentError.value)] }\n }\n\n // Loading state \u2014 show page-loading while a route chunk is fetching.\n if (isNavigating.value && hasLoading && loadingTag) {\n return { tag: loadingTag, props: {}, children: [] }\n }\n\n // Normal state \u2014 wrap router-view in the active layout (if any).\n const matched = router.matchRoute(current.value.path)\n const layoutName = (matched?.route as any)?.meta?.layout ?? 'default'\n const layoutTag = (layouts as Record<string, string>)[layoutName]\n const routerView = { tag: 'router-view', props: {}, children: [] }\n\n if (layoutTag) {\n return { tag: layoutTag, props: {}, children: [routerView] }\n }\n return routerView\n})\n\n// \u2500\u2500\u2500 Plugins \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nfor (const plugin of plugins) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({ router, provide: (key, value) => { (globalThis as any)[key] = value }, config: {} })\n }\n}\n\n// \u2500\u2500\u2500 Initial navigation \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nif (typeof window !== 'undefined') {\n await router.replace(window.location.pathname + window.location.search + window.location.hash)\n createDOMJITCSS().mount()\n}\n\nexport { router }\n";
|
|
9
|
+
export declare const APP_TEMPLATE = "import '@jasonshimmy/custom-elements-runtime/css'\nimport 'virtual:cer-components'\nimport routes from 'virtual:cer-routes'\nimport layouts from 'virtual:cer-layouts'\nimport plugins from 'virtual:cer-plugins'\nimport { hasLoading, loadingTag } from 'virtual:cer-loading'\nimport { hasError, errorTag } from 'virtual:cer-error'\nimport {\n component,\n ref,\n useOnConnected,\n useOnDisconnected,\n registerBuiltinComponents,\n} from '@jasonshimmy/custom-elements-runtime'\nimport { initRouter } from '@jasonshimmy/custom-elements-runtime/router'\nimport { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'\nimport { createDOMJITCSS } from '@jasonshimmy/custom-elements-runtime/dom-jit-css'\n\nregisterBuiltinComponents()\n\n// Enable JIT CSS globally for all Shadow DOM components.\nenableJITCSS()\n\n// initRouter registers router-view/router-link, creates the router, and sets it as active.\nconst router = initRouter({ routes })\n\n// \u2500\u2500\u2500 Navigation state \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n// isNavigating becomes true while a lazy route chunk is loading.\nconst isNavigating = ref(false)\n\n// currentError holds the last uncaught navigation or render error.\nconst currentError = ref(null)\n\n// Expose resetError globally so page-error components can call it.\n;(globalThis as any).resetError = () => {\n currentError.value = null\n router.replace(router.getCurrent().path)\n}\n\n// Wrap push/replace to track navigation pending state.\nconst _push = router.push.bind(router)\nconst _replace = router.replace.bind(router)\n\nrouter.push = async (path) => {\n isNavigating.value = true\n currentError.value = null\n try {\n await _push(path)\n } catch (err) {\n currentError.value = err instanceof Error ? err.message : String(err)\n } finally {\n isNavigating.value = false\n }\n}\n\nrouter.replace = async (path) => {\n isNavigating.value = true\n currentError.value = null\n try {\n await _replace(path)\n } catch (err) {\n currentError.value = err instanceof Error ? err.message : String(err)\n } finally {\n isNavigating.value = false\n }\n}\n\n// \u2500\u2500\u2500 <cer-layout-view> \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n//\n// Wraps <router-view> in the layout appropriate for the current route.\n// Falls back to rendering <router-view> directly when no matching layout\n// exists. Also renders loading / error pages when those states are active.\n//\n// Layout stays mounted across navigations that share the same layout \u2014 the\n// vdom diff preserves the outer element when its tag name doesn't change.\n\ncomponent('cer-layout-view', () => {\n const current = ref(router.getCurrent())\n let unsub: (() => void) | undefined\n\n useOnConnected(() => {\n unsub = router.subscribe((s: typeof current.value) => {\n current.value = s\n })\n })\n\n useOnDisconnected(() => {\n unsub?.()\n unsub = undefined\n })\n\n // Error state \u2014 show page-error if available, otherwise plain text.\n if (currentError.value !== null) {\n if (hasError && errorTag) {\n return { tag: errorTag, props: { attrs: { error: String(currentError.value) } }, children: [] }\n }\n return { tag: 'div', props: { attrs: { style: 'padding:2rem;font-family:monospace' } }, children: [String(currentError.value)] }\n }\n\n // Loading state \u2014 show page-loading while a route chunk is fetching.\n if (isNavigating.value && hasLoading && loadingTag) {\n return { tag: loadingTag, props: {}, children: [] }\n }\n\n // Normal state \u2014 wrap router-view in the active layout (if any).\n const matched = router.matchRoute(current.value.path)\n const layoutName = (matched?.route as any)?.meta?.layout ?? 'default'\n const layoutTag = (layouts as Record<string, string>)[layoutName]\n const routerView = { tag: 'router-view', props: {}, children: [] }\n\n if (layoutTag) {\n return { tag: layoutTag, props: {}, children: [routerView] }\n }\n return routerView\n})\n\n// \u2500\u2500\u2500 Plugins \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nfor (const plugin of plugins) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({ router, provide: (key, value) => { (globalThis as any)[key] = value }, config: {} })\n }\n}\n\n// \u2500\u2500\u2500 Initial navigation \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nif (typeof window !== 'undefined') {\n await router.replace(window.location.pathname + window.location.search + window.location.hash)\n // Clear SSR loader data after the initial navigation so that subsequent\n // client-side navigations don't accidentally reuse it. We wait until after\n // router.replace() so both the pre-rendered element (upgraded during\n // component registration) and the new element from router.replace() can\n // both call usePageData() and receive the hydration data.\n delete (globalThis as any).__CER_DATA__\n createDOMJITCSS().mount()\n}\n\nexport { router }\n";
|
|
10
10
|
//# sourceMappingURL=app-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-template.d.ts","sourceRoot":"","sources":["../../src/runtime/app-template.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"app-template.d.ts","sourceRoot":"","sources":["../../src/runtime/app-template.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,4iMA2IxB,CAAA"}
|
|
@@ -135,6 +135,12 @@ for (const plugin of plugins) {
|
|
|
135
135
|
|
|
136
136
|
if (typeof window !== 'undefined') {
|
|
137
137
|
await router.replace(window.location.pathname + window.location.search + window.location.hash)
|
|
138
|
+
// Clear SSR loader data after the initial navigation so that subsequent
|
|
139
|
+
// client-side navigations don't accidentally reuse it. We wait until after
|
|
140
|
+
// router.replace() so both the pre-rendered element (upgraded during
|
|
141
|
+
// component registration) and the new element from router.replace() can
|
|
142
|
+
// both call usePageData() and receive the hydration data.
|
|
143
|
+
delete (globalThis as any).__CER_DATA__
|
|
138
144
|
createDOMJITCSS().mount()
|
|
139
145
|
}
|
|
140
146
|
|