@jasonshimmy/vite-plugin-cer-app 0.4.0 → 0.4.1
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/create/index.js +1 -1
- package/dist/cli/create/templates/spa/index.html.tpl +1 -1
- package/dist/cli/create/templates/ssg/index.html.tpl +1 -1
- package/dist/cli/create/templates/ssr/index.html.tpl +1 -1
- package/dist/plugin/generated-dir.d.ts +1 -1
- package/dist/plugin/generated-dir.js +2 -2
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +15 -3
- package/dist/plugin/index.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 +10 -10
- package/e2e/cypress/e2e/interactive.cy.ts +15 -0
- package/package.json +1 -1
- package/src/__tests__/plugin/cer-app-plugin.test.ts +42 -4
- package/src/__tests__/plugin/generated-dir.test.ts +2 -2
- package/src/cli/create/index.ts +1 -1
- package/src/cli/create/templates/spa/index.html.tpl +1 -1
- package/src/cli/create/templates/ssg/index.html.tpl +1 -1
- package/src/cli/create/templates/ssr/index.html.tpl +1 -1
- package/src/plugin/generated-dir.ts +2 -2
- package/src/plugin/index.ts +16 -3
- package/src/runtime/app-template.ts +10 -10
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.4.1] - 2026-03-21
|
|
5
|
+
|
|
6
|
+
- fix: update app entry point to use virtual module path /@cer/app.ts across templates and tests (139abaf)
|
|
7
|
+
|
|
4
8
|
## [v0.4.0] - 2026-03-20
|
|
5
9
|
|
|
6
10
|
- feat: implement useInject composable for consistent value injection across SPA, SSR, and SSG fix: cer app hidden directory issue (f614e92)
|
package/commits.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
-
|
|
1
|
+
- fix: update app entry point to use virtual module path /@cer/app.ts across templates and tests (139abaf)
|
package/dist/cli/create/index.js
CHANGED
|
@@ -179,7 +179,7 @@ async function generateInlineTemplate(targetDir, projectName, mode) {
|
|
|
179
179
|
// .gitignore
|
|
180
180
|
await writeFile(join(targetDir, '.gitignore'), `# Dependencies\nnode_modules/\n\n# Build output\ndist/\n\n# CER App generated directory\n.cer/\n\n# Environment variables\n.env.local\n.env.*.local\n\n# Editor\n.vscode/\n.idea/\n*.suo\n*.sw?\n\n# OS\n.DS_Store\nThumbs.db\n\n# Logs\n*.log\n`, 'utf-8');
|
|
181
181
|
// index.html
|
|
182
|
-
await writeFile(join(targetDir, 'index.html'), `<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>${projectName}</title>\n </head>\n <body>\n <cer-layout-view></cer-layout-view>\n <script type="module" src="
|
|
182
|
+
await writeFile(join(targetDir, 'index.html'), `<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>${projectName}</title>\n </head>\n <body>\n <cer-layout-view></cer-layout-view>\n <script type="module" src="/@cer/app.ts"></script>\n </body>\n</html>\n`, 'utf-8');
|
|
183
183
|
}
|
|
184
184
|
main().catch((err) => {
|
|
185
185
|
console.error('[create-cer-app] Fatal error:', err);
|
|
@@ -13,7 +13,7 @@ export declare function getGeneratedDir(root: string): string;
|
|
|
13
13
|
export declare function resolveHtmlEntry(config: ResolvedCerConfig): string;
|
|
14
14
|
/**
|
|
15
15
|
* Generates the content for the default `.cer/index.html`.
|
|
16
|
-
* Always points to the
|
|
16
|
+
* Always points to the virtual `/@cer/app.ts` entry.
|
|
17
17
|
*/
|
|
18
18
|
export declare function generateDefaultHtml(): string;
|
|
19
19
|
/**
|
|
@@ -22,7 +22,7 @@ export function resolveHtmlEntry(config) {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Generates the content for the default `.cer/index.html`.
|
|
25
|
-
* Always points to the
|
|
25
|
+
* Always points to the virtual `/@cer/app.ts` entry.
|
|
26
26
|
*/
|
|
27
27
|
export function generateDefaultHtml() {
|
|
28
28
|
return `<!DOCTYPE html>
|
|
@@ -34,7 +34,7 @@ export function generateDefaultHtml() {
|
|
|
34
34
|
</head>
|
|
35
35
|
<body>
|
|
36
36
|
<cer-layout-view></cer-layout-view>
|
|
37
|
-
<script type="module" src="
|
|
37
|
+
<script type="module" src="/@cer/app.ts"></script>
|
|
38
38
|
</body>
|
|
39
39
|
</html>
|
|
40
40
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AA+CxD;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,YAAY,EAAE,IAAI,GAAE,MAAsB,GAAG,iBAAiB,CA4CvG;AAqFD;;;GAGG;AACH,wBAAgB,MAAM,CAAC,UAAU,GAAE,YAAiB,GAAG,MAAM,EAAE,CAsM9D"}
|
package/dist/plugin/index.js
CHANGED
|
@@ -33,9 +33,12 @@ const VIRTUAL_IDS = {
|
|
|
33
33
|
};
|
|
34
34
|
// Resolved virtual module IDs (prefixed with \0)
|
|
35
35
|
const RESOLVED_IDS = Object.fromEntries(Object.entries(VIRTUAL_IDS).map(([k, v]) => [k, `\0${v}`]));
|
|
36
|
-
// The
|
|
37
|
-
//
|
|
38
|
-
|
|
36
|
+
// The app entry is served via a virtual module at /@cer/app.ts.
|
|
37
|
+
// Using /@ avoids Vite's dot-directory fs security restriction that blocks /.cer/
|
|
38
|
+
// from being served through the transform middleware. The physical .cer/app.ts
|
|
39
|
+
// is still written to disk for IDE/TypeScript support, but the browser fetches
|
|
40
|
+
// /@cer/app.ts which resolves to this virtual module.
|
|
41
|
+
const APP_ENTRY_URL = '/@cer/app.ts';
|
|
39
42
|
const RESOLVED_APP_ENTRY = '\0cer-app-entry';
|
|
40
43
|
/**
|
|
41
44
|
* Fills in default values for all config fields and resolves absolute paths.
|
|
@@ -192,6 +195,15 @@ export function cerApp(userConfig = {}) {
|
|
|
192
195
|
configResolved(resolvedConfig) {
|
|
193
196
|
// Re-resolve with the final root
|
|
194
197
|
config = resolveConfig(userConfig, resolvedConfig.root);
|
|
198
|
+
// Write .cer/ immediately after config is resolved so the physical
|
|
199
|
+
// app.ts exists for IDE/TypeScript support before any Vite hooks fire.
|
|
200
|
+
writeGeneratedDir(config);
|
|
201
|
+
},
|
|
202
|
+
transformIndexHtml(html) {
|
|
203
|
+
// Rewrite any existing /.cer/app.ts src reference (older projects or
|
|
204
|
+
// the scaffold template) to /@cer/app.ts so Vite's transform middleware
|
|
205
|
+
// processes it. Vite blocks /.* paths from the transform pipeline.
|
|
206
|
+
return html.replace(/src=["']\/\.cer\/app\.ts["']/g, 'src="/@cer/app.ts"');
|
|
195
207
|
},
|
|
196
208
|
resolveId(id) {
|
|
197
209
|
if (id === APP_ENTRY_URL)
|
package/dist/plugin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EA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,sDAAsD;YACtD,iBAAiB,CAAC,MAAM,CAAC,CAAA;YACzB,mEAAmE;YACnE,iBAAiB,GAAG,MAAM,qBAAqB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;YACtE,MAAM,kBAAkB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAA;YAC/E,kBAAkB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;YAC9C,gCAAgC;YAChC,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;gBACrD,MAAM,IAAI,GAAG,MAAM,qBAAqB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;gBAC5D,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;oBAClB,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;gBACnC,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAA;IAED,yDAAyD;IACzD,wEAAwE;IACxE,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC,CAAA;IAChD,MAAM,EAAE,GAAG,EAAE,GAAG,cAAc,CAAC,GAAG,CAAA;IAClC,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,GAAG,cAAc,CAAC,MAAM,CAAA;IACxD,MAAM,UAAU,GAAG,SAAS,CAAC;QAC3B,OAAO;QACP,GAAG,UAAU;QACb,GAAG,EAAE;YACH,GAAG;YACH,GAAG,EAAE,UAAU;SAChB;KACF,CAAC,CAAA;IAEF,OAAO,CAAC,YAAY,EAAE,GAAG,UAAU,CAAC,CAAA;AACtC,CAAC"}
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* automatically receive the latest bootstrap code on plugin update.
|
|
6
6
|
* This file is gitignored and should never be edited directly.
|
|
7
7
|
*/
|
|
8
|
-
export declare const APP_ENTRY_TEMPLATE = "// AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app \u2014 do not edit.\n// Regenerated automatically on every dev server start and build.\n\nimport '@jasonshimmy/custom-elements-runtime/css'\nimport 'virtual:cer-jit-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 provide,\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'\n\nregisterBuiltinComponents()\nenableJITCSS()\n\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\nconst isNavigating = ref(false)\nconst currentError = ref(null)\n\nconst resetError = ()
|
|
8
|
+
export declare const APP_ENTRY_TEMPLATE = "// AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app \u2014 do not edit.\n// Regenerated automatically on every dev server start and build.\n\nimport '@jasonshimmy/custom-elements-runtime/css'\nimport 'virtual:cer-jit-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 provide,\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'\n\nregisterBuiltinComponents()\nenableJITCSS()\n\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\nconst isNavigating = ref(false)\nconst currentError = ref(null)\n\nconst resetError = () => {\n currentError.value = null\n void router.replace(router.getCurrent().path)\n}\n;(globalThis).resetError = resetError\n\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 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\n// Collect plugin-provided values so cer-layout-view can forward them into\n// the component context tree via the real provide() hook (which inject() walks).\n// Declared BEFORE component('cer-layout-view') to avoid a temporal dead zone\n// ReferenceError: customElements.define() upgrades existing DOM elements\n// synchronously, calling the render function immediately.\nconst _pluginProvides = new Map()\n// Expose plugin provides globally so page components can read them synchronously\n// regardless of render order.\n;(globalThis).__cerPluginProvides = _pluginProvides\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\ncomponent('cer-layout-view', () => {\n // Forward plugin-provided values into the component context so inject() in\n // any descendant component can resolve them by walking up the DOM tree.\n for (const [key, value] of _pluginProvides) {\n provide(key, value)\n }\n\n const current = ref(router.getCurrent())\n let unsub\n\n useOnConnected(() => {\n unsub = router.subscribe((s) => { current.value = s })\n })\n useOnDisconnected(() => { unsub?.(); unsub = undefined })\n\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 if (isNavigating.value && hasLoading && loadingTag) {\n return { tag: loadingTag, props: {}, children: [] }\n }\n\n const matched = router.matchRoute(current.value.path)\n const routeMeta = matched?.route?.meta\n const layoutName = routeMeta?.layout ?? 'default'\n const layoutTag = layouts[layoutName]\n const routerView = { tag: 'router-view', props: {}, children: [] }\n\n if (layoutTag) return { tag: layoutTag, props: {}, children: [routerView] }\n return routerView\n})\n\nfor (const plugin of plugins) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({\n router,\n provide: (key, value) => { _pluginProvides.set(key, value) },\n config: {},\n })\n }\n}\n\n// \u2500\u2500\u2500 Pre-load initial route \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\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// Download the current page's route chunk AFTER plugins run so that\n// cer-layout-view's first render (which calls provide()) completes before\n// page components are defined and their renders are scheduled. This ensures\n// inject() in child components can find values stored by provide().\n\nif (typeof window !== 'undefined') {\n const _initMatch = router.matchRoute(window.location.pathname)\n if (_initMatch?.route?.load) {\n try { await _initMatch.route.load() } catch { /* non-fatal */ }\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 // Use the original (unwrapped) replace so isNavigating stays false during\n // the initial paint \u2014 the loading component must not flash over pre-rendered content.\n await _replace(window.location.pathname + window.location.search + window.location.hash)\n // Clear SSR loader data after initial navigation so subsequent client-side\n // navigations don't accidentally reuse stale server data.\n delete (globalThis).__CER_DATA__\n}\n\nexport { router }\n";
|
|
9
9
|
//# 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;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"app-template.d.ts","sourceRoot":"","sources":["../../src/runtime/app-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,+oNAsJ9B,CAAA"}
|
|
@@ -37,11 +37,11 @@ const router = initRouter({ routes })
|
|
|
37
37
|
const isNavigating = ref(false)
|
|
38
38
|
const currentError = ref(null)
|
|
39
39
|
|
|
40
|
-
const resetError = ()
|
|
40
|
+
const resetError = () => {
|
|
41
41
|
currentError.value = null
|
|
42
42
|
void router.replace(router.getCurrent().path)
|
|
43
43
|
}
|
|
44
|
-
;(globalThis
|
|
44
|
+
;(globalThis).resetError = resetError
|
|
45
45
|
|
|
46
46
|
const _push = router.push.bind(router)
|
|
47
47
|
const _replace = router.replace.bind(router)
|
|
@@ -77,10 +77,10 @@ router.replace = async (path) => {
|
|
|
77
77
|
// Declared BEFORE component('cer-layout-view') to avoid a temporal dead zone
|
|
78
78
|
// ReferenceError: customElements.define() upgrades existing DOM elements
|
|
79
79
|
// synchronously, calling the render function immediately.
|
|
80
|
-
const _pluginProvides = new Map
|
|
80
|
+
const _pluginProvides = new Map()
|
|
81
81
|
// Expose plugin provides globally so page components can read them synchronously
|
|
82
82
|
// regardless of render order.
|
|
83
|
-
;(globalThis
|
|
83
|
+
;(globalThis).__cerPluginProvides = _pluginProvides
|
|
84
84
|
|
|
85
85
|
// ─── <cer-layout-view> ───────────────────────────────────────────────────────
|
|
86
86
|
|
|
@@ -92,10 +92,10 @@ component('cer-layout-view', () => {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
const current = ref(router.getCurrent())
|
|
95
|
-
let unsub
|
|
95
|
+
let unsub
|
|
96
96
|
|
|
97
97
|
useOnConnected(() => {
|
|
98
|
-
unsub = router.subscribe((s
|
|
98
|
+
unsub = router.subscribe((s) => { current.value = s })
|
|
99
99
|
})
|
|
100
100
|
useOnDisconnected(() => { unsub?.(); unsub = undefined })
|
|
101
101
|
|
|
@@ -111,9 +111,9 @@ component('cer-layout-view', () => {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
const matched = router.matchRoute(current.value.path)
|
|
114
|
-
const routeMeta = matched?.route?.meta
|
|
114
|
+
const routeMeta = matched?.route?.meta
|
|
115
115
|
const layoutName = routeMeta?.layout ?? 'default'
|
|
116
|
-
const layoutTag =
|
|
116
|
+
const layoutTag = layouts[layoutName]
|
|
117
117
|
const routerView = { tag: 'router-view', props: {}, children: [] }
|
|
118
118
|
|
|
119
119
|
if (layoutTag) return { tag: layoutTag, props: {}, children: [routerView] }
|
|
@@ -124,7 +124,7 @@ for (const plugin of plugins) {
|
|
|
124
124
|
if (plugin && typeof plugin.setup === 'function') {
|
|
125
125
|
await plugin.setup({
|
|
126
126
|
router,
|
|
127
|
-
provide: (key
|
|
127
|
+
provide: (key, value) => { _pluginProvides.set(key, value) },
|
|
128
128
|
config: {},
|
|
129
129
|
})
|
|
130
130
|
}
|
|
@@ -151,7 +151,7 @@ if (typeof window !== 'undefined') {
|
|
|
151
151
|
await _replace(window.location.pathname + window.location.search + window.location.hash)
|
|
152
152
|
// Clear SSR loader data after initial navigation so subsequent client-side
|
|
153
153
|
// navigations don't accidentally reuse stale server data.
|
|
154
|
-
delete (globalThis
|
|
154
|
+
delete (globalThis).__CER_DATA__
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
export { router }
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* All tests run in every build mode (SPA, SSR, SSG).
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
const mode = Cypress.env('mode') as 'spa' | 'ssr' | 'ssg'
|
|
7
|
+
|
|
6
8
|
describe('Counter interactivity', () => {
|
|
7
9
|
beforeEach(() => {
|
|
8
10
|
cy.visit('/counter')
|
|
@@ -120,3 +122,16 @@ describe('Auth middleware', () => {
|
|
|
120
122
|
cy.get('cer-layout-view').shadow().find('[data-cy=plugin-greeting]').should('contain', 'Hello from ks-setup plugin!')
|
|
121
123
|
})
|
|
122
124
|
})
|
|
125
|
+
|
|
126
|
+
if (mode !== 'spa') {
|
|
127
|
+
describe('Plugin provide/inject — server-side rendering', () => {
|
|
128
|
+
it('plugin greeting is present in the initial server HTML', () => {
|
|
129
|
+
// Auth middleware is client-side only, so the server renders /protected
|
|
130
|
+
// unconditionally. This verifies useInject() reads from __cerPluginProvides
|
|
131
|
+
// during the SSR render pass (before any client JS runs).
|
|
132
|
+
cy.request('/protected').then((resp) => {
|
|
133
|
+
expect(resp.body).to.include('Hello from ks-setup plugin!')
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
}
|
package/package.json
CHANGED
|
@@ -47,6 +47,7 @@ type TestPlugin = {
|
|
|
47
47
|
resolveId: (id: string) => string | undefined
|
|
48
48
|
load: (id: string) => Promise<string | null>
|
|
49
49
|
transform: (code: string, id: string) => unknown
|
|
50
|
+
transformIndexHtml: (html: string) => string
|
|
50
51
|
buildStart: () => Promise<void>
|
|
51
52
|
configureServer: (server: unknown) => Promise<void>
|
|
52
53
|
}
|
|
@@ -143,10 +144,16 @@ describe('cerApp plugin — resolveId hook', () => {
|
|
|
143
144
|
expect(plugin.resolveId('virtual:cer-error')).toBe('\0virtual:cer-error')
|
|
144
145
|
})
|
|
145
146
|
|
|
146
|
-
it('resolves
|
|
147
|
+
it('resolves /@cer/app.ts to \\0cer-app-entry (virtual module)', () => {
|
|
147
148
|
const plugin = getCerPlugin()
|
|
148
149
|
plugin.config({ root: '/project' }, { command: 'serve', mode: 'development' })
|
|
149
|
-
expect(plugin.resolveId('
|
|
150
|
+
expect(plugin.resolveId('/@cer/app.ts')).toBe('\0cer-app-entry')
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
it('does not resolve /.cer/app.ts (old URL, rewritten by transformIndexHtml)', () => {
|
|
154
|
+
const plugin = getCerPlugin()
|
|
155
|
+
plugin.config({ root: '/project' }, { command: 'serve', mode: 'development' })
|
|
156
|
+
expect(plugin.resolveId('/.cer/app.ts')).toBeUndefined()
|
|
150
157
|
})
|
|
151
158
|
|
|
152
159
|
it('returns undefined for unknown ids', () => {
|
|
@@ -286,6 +293,35 @@ describe('cerApp plugin — transform hook', () => {
|
|
|
286
293
|
})
|
|
287
294
|
})
|
|
288
295
|
|
|
296
|
+
describe('cerApp plugin — transformIndexHtml hook', () => {
|
|
297
|
+
it('rewrites /.cer/app.ts src to /@cer/app.ts', () => {
|
|
298
|
+
const plugin = getCerPlugin()
|
|
299
|
+
plugin.config({ root: '/project' }, { command: 'serve', mode: 'development' })
|
|
300
|
+
const input = '<script type="module" src="/.cer/app.ts"></script>'
|
|
301
|
+
const output = plugin.transformIndexHtml(input)
|
|
302
|
+
expect(output).toContain('src="/@cer/app.ts"')
|
|
303
|
+
expect(output).not.toContain('src="/.cer/app.ts"')
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
it('leaves html unchanged when /.cer/app.ts is not present', () => {
|
|
307
|
+
const plugin = getCerPlugin()
|
|
308
|
+
plugin.config({ root: '/project' }, { command: 'serve', mode: 'development' })
|
|
309
|
+
const input = '<script type="module" src="/@cer/app.ts"></script>'
|
|
310
|
+
expect(plugin.transformIndexHtml(input)).toBe(input)
|
|
311
|
+
})
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
describe('cerApp plugin — configResolved hook', () => {
|
|
315
|
+
it('calls writeGeneratedDir during configResolved', async () => {
|
|
316
|
+
const { writeGeneratedDir } = await import('../../plugin/generated-dir.js')
|
|
317
|
+
vi.mocked(writeGeneratedDir).mockClear()
|
|
318
|
+
const plugin = getCerPlugin()
|
|
319
|
+
plugin.config({ root: '/project' }, { command: 'serve', mode: 'development' })
|
|
320
|
+
plugin.configResolved(FAKE_RESOLVED)
|
|
321
|
+
expect(writeGeneratedDir).toHaveBeenCalledTimes(1)
|
|
322
|
+
})
|
|
323
|
+
})
|
|
324
|
+
|
|
289
325
|
describe('cerApp plugin — buildStart hook', () => {
|
|
290
326
|
it('calls writeGeneratedDir on build start', async () => {
|
|
291
327
|
const { writeGeneratedDir } = await import('../../plugin/generated-dir.js')
|
|
@@ -294,7 +330,8 @@ describe('cerApp plugin — buildStart hook', () => {
|
|
|
294
330
|
plugin.config({ root: '/project' }, { command: 'build', mode: 'production' })
|
|
295
331
|
plugin.configResolved(FAKE_RESOLVED)
|
|
296
332
|
await plugin.buildStart()
|
|
297
|
-
|
|
333
|
+
// writeGeneratedDir is called once in configResolved and once in buildStart
|
|
334
|
+
expect(writeGeneratedDir).toHaveBeenCalledTimes(2)
|
|
298
335
|
})
|
|
299
336
|
|
|
300
337
|
it('calls scanComposableExports on build start', async () => {
|
|
@@ -342,7 +379,8 @@ describe('cerApp plugin — configureServer hook', () => {
|
|
|
342
379
|
middlewares: { use: vi.fn() },
|
|
343
380
|
}
|
|
344
381
|
await plugin.configureServer(mockServer)
|
|
345
|
-
|
|
382
|
+
// configResolved calls it once, configureServer calls it again
|
|
383
|
+
expect(writeGeneratedDir).toHaveBeenCalledTimes(2)
|
|
346
384
|
})
|
|
347
385
|
|
|
348
386
|
it('calls scanComposableExports on server configure', async () => {
|
|
@@ -61,9 +61,9 @@ describe('resolveHtmlEntry', () => {
|
|
|
61
61
|
})
|
|
62
62
|
|
|
63
63
|
describe('generateDefaultHtml', () => {
|
|
64
|
-
it('always references
|
|
64
|
+
it('always references /@cer/app.ts', () => {
|
|
65
65
|
const html = generateDefaultHtml()
|
|
66
|
-
expect(html).toContain('
|
|
66
|
+
expect(html).toContain('/@cer/app.ts')
|
|
67
67
|
expect(html).not.toContain('/app/app.ts')
|
|
68
68
|
})
|
|
69
69
|
|
package/src/cli/create/index.ts
CHANGED
|
@@ -243,7 +243,7 @@ async function generateInlineTemplate(
|
|
|
243
243
|
// index.html
|
|
244
244
|
await writeFile(
|
|
245
245
|
join(targetDir, 'index.html'),
|
|
246
|
-
`<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>${projectName}</title>\n </head>\n <body>\n <cer-layout-view></cer-layout-view>\n <script type="module" src="
|
|
246
|
+
`<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>${projectName}</title>\n </head>\n <body>\n <cer-layout-view></cer-layout-view>\n <script type="module" src="/@cer/app.ts"></script>\n </body>\n</html>\n`,
|
|
247
247
|
'utf-8',
|
|
248
248
|
)
|
|
249
249
|
}
|
|
@@ -26,7 +26,7 @@ export function resolveHtmlEntry(config: ResolvedCerConfig): string {
|
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Generates the content for the default `.cer/index.html`.
|
|
29
|
-
* Always points to the
|
|
29
|
+
* Always points to the virtual `/@cer/app.ts` entry.
|
|
30
30
|
*/
|
|
31
31
|
export function generateDefaultHtml(): string {
|
|
32
32
|
return `<!DOCTYPE html>
|
|
@@ -38,7 +38,7 @@ export function generateDefaultHtml(): string {
|
|
|
38
38
|
</head>
|
|
39
39
|
<body>
|
|
40
40
|
<cer-layout-view></cer-layout-view>
|
|
41
|
-
<script type="module" src="
|
|
41
|
+
<script type="module" src="/@cer/app.ts"></script>
|
|
42
42
|
</body>
|
|
43
43
|
</html>
|
|
44
44
|
`
|
package/src/plugin/index.ts
CHANGED
|
@@ -41,9 +41,12 @@ const RESOLVED_IDS = Object.fromEntries(
|
|
|
41
41
|
Object.entries(VIRTUAL_IDS).map(([k, v]) => [k, `\0${v}`]),
|
|
42
42
|
) as Record<keyof typeof VIRTUAL_IDS, string>
|
|
43
43
|
|
|
44
|
-
// The
|
|
45
|
-
//
|
|
46
|
-
|
|
44
|
+
// The app entry is served via a virtual module at /@cer/app.ts.
|
|
45
|
+
// Using /@ avoids Vite's dot-directory fs security restriction that blocks /.cer/
|
|
46
|
+
// from being served through the transform middleware. The physical .cer/app.ts
|
|
47
|
+
// is still written to disk for IDE/TypeScript support, but the browser fetches
|
|
48
|
+
// /@cer/app.ts which resolves to this virtual module.
|
|
49
|
+
const APP_ENTRY_URL = '/@cer/app.ts'
|
|
47
50
|
const RESOLVED_APP_ENTRY = '\0cer-app-entry'
|
|
48
51
|
|
|
49
52
|
/**
|
|
@@ -217,6 +220,16 @@ export function cerApp(userConfig: CerAppConfig = {}): Plugin[] {
|
|
|
217
220
|
configResolved(resolvedConfig) {
|
|
218
221
|
// Re-resolve with the final root
|
|
219
222
|
config = resolveConfig(userConfig, resolvedConfig.root)
|
|
223
|
+
// Write .cer/ immediately after config is resolved so the physical
|
|
224
|
+
// app.ts exists for IDE/TypeScript support before any Vite hooks fire.
|
|
225
|
+
writeGeneratedDir(config)
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
transformIndexHtml(html: string) {
|
|
229
|
+
// Rewrite any existing /.cer/app.ts src reference (older projects or
|
|
230
|
+
// the scaffold template) to /@cer/app.ts so Vite's transform middleware
|
|
231
|
+
// processes it. Vite blocks /.* paths from the transform pipeline.
|
|
232
|
+
return html.replace(/src=["']\/\.cer\/app\.ts["']/g, 'src="/@cer/app.ts"')
|
|
220
233
|
},
|
|
221
234
|
|
|
222
235
|
resolveId(id: string) {
|
|
@@ -37,11 +37,11 @@ const router = initRouter({ routes })
|
|
|
37
37
|
const isNavigating = ref(false)
|
|
38
38
|
const currentError = ref(null)
|
|
39
39
|
|
|
40
|
-
const resetError = ()
|
|
40
|
+
const resetError = () => {
|
|
41
41
|
currentError.value = null
|
|
42
42
|
void router.replace(router.getCurrent().path)
|
|
43
43
|
}
|
|
44
|
-
;(globalThis
|
|
44
|
+
;(globalThis).resetError = resetError
|
|
45
45
|
|
|
46
46
|
const _push = router.push.bind(router)
|
|
47
47
|
const _replace = router.replace.bind(router)
|
|
@@ -77,10 +77,10 @@ router.replace = async (path) => {
|
|
|
77
77
|
// Declared BEFORE component('cer-layout-view') to avoid a temporal dead zone
|
|
78
78
|
// ReferenceError: customElements.define() upgrades existing DOM elements
|
|
79
79
|
// synchronously, calling the render function immediately.
|
|
80
|
-
const _pluginProvides = new Map
|
|
80
|
+
const _pluginProvides = new Map()
|
|
81
81
|
// Expose plugin provides globally so page components can read them synchronously
|
|
82
82
|
// regardless of render order.
|
|
83
|
-
;(globalThis
|
|
83
|
+
;(globalThis).__cerPluginProvides = _pluginProvides
|
|
84
84
|
|
|
85
85
|
// ─── <cer-layout-view> ───────────────────────────────────────────────────────
|
|
86
86
|
|
|
@@ -92,10 +92,10 @@ component('cer-layout-view', () => {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
const current = ref(router.getCurrent())
|
|
95
|
-
let unsub
|
|
95
|
+
let unsub
|
|
96
96
|
|
|
97
97
|
useOnConnected(() => {
|
|
98
|
-
unsub = router.subscribe((s
|
|
98
|
+
unsub = router.subscribe((s) => { current.value = s })
|
|
99
99
|
})
|
|
100
100
|
useOnDisconnected(() => { unsub?.(); unsub = undefined })
|
|
101
101
|
|
|
@@ -111,9 +111,9 @@ component('cer-layout-view', () => {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
const matched = router.matchRoute(current.value.path)
|
|
114
|
-
const routeMeta = matched?.route?.meta
|
|
114
|
+
const routeMeta = matched?.route?.meta
|
|
115
115
|
const layoutName = routeMeta?.layout ?? 'default'
|
|
116
|
-
const layoutTag =
|
|
116
|
+
const layoutTag = layouts[layoutName]
|
|
117
117
|
const routerView = { tag: 'router-view', props: {}, children: [] }
|
|
118
118
|
|
|
119
119
|
if (layoutTag) return { tag: layoutTag, props: {}, children: [routerView] }
|
|
@@ -124,7 +124,7 @@ for (const plugin of plugins) {
|
|
|
124
124
|
if (plugin && typeof plugin.setup === 'function') {
|
|
125
125
|
await plugin.setup({
|
|
126
126
|
router,
|
|
127
|
-
provide: (key
|
|
127
|
+
provide: (key, value) => { _pluginProvides.set(key, value) },
|
|
128
128
|
config: {},
|
|
129
129
|
})
|
|
130
130
|
}
|
|
@@ -151,7 +151,7 @@ if (typeof window !== 'undefined') {
|
|
|
151
151
|
await _replace(window.location.pathname + window.location.search + window.location.hash)
|
|
152
152
|
// Clear SSR loader data after initial navigation so subsequent client-side
|
|
153
153
|
// navigations don't accidentally reuse stale server data.
|
|
154
|
-
delete (globalThis
|
|
154
|
+
delete (globalThis).__CER_DATA__
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
export { router }
|