@jasonshimmy/vite-plugin-cer-app 0.1.4 → 0.1.6

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +5 -2
  3. package/commits.txt +1 -1
  4. package/dist/cli/create/index.js +1 -1
  5. package/dist/cli/create/index.js.map +1 -1
  6. package/dist/cli/create/templates/spa/app/app.ts.tpl +93 -0
  7. package/dist/cli/create/templates/spa/app/layouts/default.ts.tpl +15 -0
  8. package/dist/cli/create/templates/spa/app/pages/index.ts.tpl +8 -0
  9. package/dist/cli/create/templates/spa/cer.config.ts.tpl +6 -0
  10. package/dist/cli/create/templates/spa/index.html.tpl +12 -0
  11. package/dist/cli/create/templates/spa/package.json.tpl +18 -0
  12. package/dist/cli/create/templates/ssg/app/app.ts.tpl +97 -0
  13. package/dist/cli/create/templates/ssg/app/layouts/default.ts.tpl +15 -0
  14. package/dist/cli/create/templates/ssg/app/pages/index.ts.tpl +8 -0
  15. package/dist/cli/create/templates/ssg/cer.config.ts.tpl +13 -0
  16. package/dist/cli/create/templates/ssg/index.html.tpl +12 -0
  17. package/dist/cli/create/templates/ssg/package.json.tpl +19 -0
  18. package/dist/cli/create/templates/ssr/app/app.ts.tpl +97 -0
  19. package/dist/cli/create/templates/ssr/app/layouts/default.ts.tpl +15 -0
  20. package/dist/cli/create/templates/ssr/app/pages/index.ts.tpl +8 -0
  21. package/dist/cli/create/templates/ssr/cer.config.ts.tpl +10 -0
  22. package/dist/cli/create/templates/ssr/index.html.tpl +12 -0
  23. package/dist/cli/create/templates/ssr/package.json.tpl +18 -0
  24. package/dist/plugin/index.d.ts.map +1 -1
  25. package/dist/plugin/index.js +10 -6
  26. package/dist/plugin/index.js.map +1 -1
  27. package/docs/cli.md +10 -8
  28. package/docs/configuration.md +4 -2
  29. package/docs/getting-started.md +3 -4
  30. package/docs/head-management.md +3 -5
  31. package/e2e/kitchen-sink/app/app.ts +1 -2
  32. package/package.json +8 -8
  33. package/src/cli/create/index.ts +1 -1
  34. package/src/cli/create/templates/spa/app/app.ts.tpl +1 -2
  35. package/src/cli/create/templates/ssg/app/app.ts.tpl +1 -2
  36. package/src/cli/create/templates/ssr/app/app.ts.tpl +1 -2
  37. package/src/plugin/index.ts +10 -6
package/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # Changelog
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
+ ## [v0.1.6] - 2026-03-20
5
+
6
+ - fix: update CLI usage instructions to include --package flag for create-cer-app (457114d)
7
+
8
+ ## [v0.1.5] - 2026-03-20
9
+
10
+ - fix: use vite plugin for light dom jit css fix: update incorrect docs fix: fix the plugin config (c32cf6a)
11
+
4
12
  ## [v0.1.4] - 2026-03-20
5
13
 
6
14
  - fix: fixed many issues across the plugin fix: added e2e tests to ensure functionality works across build types fix:improve documentation (fb24d84)
package/README.md CHANGED
@@ -58,17 +58,20 @@ export default defineConfig({
58
58
  The fastest path is scaffolding a new project:
59
59
 
60
60
  ```sh
61
- npx create-cer-app my-app
61
+ npx --package @jasonshimmy/vite-plugin-cer-app create-cer-app my-app
62
62
  # → choose spa / ssr / ssg
63
63
  cd my-app
64
64
  npm install
65
65
  npm run dev
66
66
  ```
67
67
 
68
- Or install the CLI globally:
68
+ > **Note:** The `--package` flag is required because `create-cer-app` is bundled inside `@jasonshimmy/vite-plugin-cer-app` rather than published as a standalone package.
69
+
70
+ Or install the CLI globally to skip the flag entirely:
69
71
 
70
72
  ```sh
71
73
  npm install -g @jasonshimmy/vite-plugin-cer-app
74
+ create-cer-app my-app
72
75
  cer-app dev
73
76
  ```
74
77
 
package/commits.txt CHANGED
@@ -1 +1 @@
1
- - fix: fixed many issues across the plugin fix: added e2e tests to ensure functionality works across build types fix:improve documentation (fb24d84)
1
+ - fix: update CLI usage instructions to include --package flag for create-cer-app (457114d)
@@ -169,7 +169,7 @@ async function generateInlineTemplate(targetDir, projectName, mode) {
169
169
  // cer.config.ts
170
170
  await writeFile(join(targetDir, 'cer.config.ts'), `import { defineConfig } from '@jasonshimmy/vite-plugin-cer-app'\n\nexport default defineConfig({\n mode: '${mode}',\n autoImports: { components: true, composables: true, directives: true, runtime: true },\n})\n`, 'utf-8');
171
171
  // app/app.ts
172
- await writeFile(join(targetDir, 'app/app.ts'), `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 { component, ref, provide, useOnConnected, useOnDisconnected, registerBuiltinComponents } 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()\nenableJITCSS()\n\nconst router = initRouter({ routes })\n\nconst isNavigating = ref(false)\nconst currentError = ref(null)\n;(globalThis as any).resetError = () => { currentError.value = null; router.replace(router.getCurrent().path) }\nconst _push = router.push.bind(router)\nconst _replace = router.replace.bind(router)\nrouter.push = async (path) => { isNavigating.value = true; currentError.value = null; try { await _push(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false } }\nrouter.replace = async (path) => { isNavigating.value = true; currentError.value = null; try { await _replace(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false } }\n\nconst _pluginProvides = new Map()\n;(globalThis as any).__cerPluginProvides = _pluginProvides\n\ncomponent('cer-layout-view', () => {\n for (const [key, value] of _pluginProvides) { provide(key, value) }\n const current = ref(router.getCurrent())\n let unsub: (() => void) | undefined\n useOnConnected(() => { unsub = router.subscribe((s: typeof current.value) => { current.value = s }) })\n useOnDisconnected(() => { unsub?.(); unsub = undefined })\n if (currentError.value !== null) {\n if (hasError && errorTag) return { tag: errorTag, props: { attrs: { error: String(currentError.value) } }, children: [] }\n return { tag: 'div', props: { attrs: { style: 'padding:2rem;font-family:monospace' } }, children: [String(currentError.value)] }\n }\n if (isNavigating.value && hasLoading && loadingTag) return { tag: loadingTag, props: {}, children: [] }\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 return layoutTag ? { tag: layoutTag, props: {}, children: [routerView] } : routerView\n})\n\nfor (const plugin of plugins ?? []) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({ router, provide: (key: string, value: unknown) => { _pluginProvides.set(key, value) }, config: {} })\n }\n}\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\nif (typeof window !== 'undefined') {\n await _replace(window.location.pathname + window.location.search + window.location.hash)\n delete (globalThis as any).__CER_DATA__\n createDOMJITCSS().mount()\n}\n\nexport { router }\n`, 'utf-8');
172
+ await writeFile(join(targetDir, 'app/app.ts'), `import '@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 { component, ref, provide, useOnConnected, useOnDisconnected, registerBuiltinComponents } 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\nconst isNavigating = ref(false)\nconst currentError = ref(null)\n;(globalThis as any).resetError = () => { currentError.value = null; router.replace(router.getCurrent().path) }\nconst _push = router.push.bind(router)\nconst _replace = router.replace.bind(router)\nrouter.push = async (path) => { isNavigating.value = true; currentError.value = null; try { await _push(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false } }\nrouter.replace = async (path) => { isNavigating.value = true; currentError.value = null; try { await _replace(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false } }\n\nconst _pluginProvides = new Map()\n;(globalThis as any).__cerPluginProvides = _pluginProvides\n\ncomponent('cer-layout-view', () => {\n for (const [key, value] of _pluginProvides) { provide(key, value) }\n const current = ref(router.getCurrent())\n let unsub: (() => void) | undefined\n useOnConnected(() => { unsub = router.subscribe((s: typeof current.value) => { current.value = s }) })\n useOnDisconnected(() => { unsub?.(); unsub = undefined })\n if (currentError.value !== null) {\n if (hasError && errorTag) return { tag: errorTag, props: { attrs: { error: String(currentError.value) } }, children: [] }\n return { tag: 'div', props: { attrs: { style: 'padding:2rem;font-family:monospace' } }, children: [String(currentError.value)] }\n }\n if (isNavigating.value && hasLoading && loadingTag) return { tag: loadingTag, props: {}, children: [] }\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 return layoutTag ? { tag: layoutTag, props: {}, children: [routerView] } : routerView\n})\n\nfor (const plugin of plugins ?? []) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({ router, provide: (key: string, value: unknown) => { _pluginProvides.set(key, value) }, config: {} })\n }\n}\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\nif (typeof window !== 'undefined') {\n await _replace(window.location.pathname + window.location.search + window.location.hash)\n delete (globalThis as any).__CER_DATA__\n}\n\nexport { router }\n`, 'utf-8');
173
173
  // app/pages/index.ts
174
174
  await writeFile(join(targetDir, 'app/pages/index.ts'), `component('page-index', () => {\n return html\`\n <div>\n <h1>Welcome to ${projectName}</h1>\n <p>Edit <code>app/pages/index.ts</code> to get started.</p>\n </div>\n \`\n})\n`, 'utf-8');
175
175
  // app/layouts/default.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/create/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAIrC;;GAEG;AACH,SAAS,MAAM,CAAC,QAAgB,EAAE,YAAqB;IACrD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;QAC5E,MAAM,eAAe,GAAG,YAAY;YAClC,CAAC,CAAC,GAAG,QAAQ,KAAK,YAAY,KAAK;YACnC,CAAC,CAAC,GAAG,QAAQ,IAAI,CAAA;QAEnB,EAAE,CAAC,QAAQ,CAAC,eAAe,EA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AC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
@@ -0,0 +1,93 @@
1
+ import '@jasonshimmy/custom-elements-runtime/css'
2
+ import 'virtual:cer-jit-css'
3
+ import 'virtual:cer-components'
4
+ import routes from 'virtual:cer-routes'
5
+ import layouts from 'virtual:cer-layouts'
6
+ import plugins from 'virtual:cer-plugins'
7
+ import { hasLoading, loadingTag } from 'virtual:cer-loading'
8
+ import { hasError, errorTag } from 'virtual:cer-error'
9
+ import {
10
+ component,
11
+ ref,
12
+ provide,
13
+ useOnConnected,
14
+ useOnDisconnected,
15
+ registerBuiltinComponents,
16
+ } from '@jasonshimmy/custom-elements-runtime'
17
+ import { initRouter } from '@jasonshimmy/custom-elements-runtime/router'
18
+ import { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'
19
+
20
+ registerBuiltinComponents()
21
+ enableJITCSS()
22
+
23
+ const router = initRouter({ routes })
24
+
25
+ const isNavigating = ref(false)
26
+ const currentError = ref(null)
27
+ ;(globalThis as any).resetError = () => {
28
+ currentError.value = null
29
+ router.replace(router.getCurrent().path)
30
+ }
31
+
32
+ const _push = router.push.bind(router)
33
+ const _replace = router.replace.bind(router)
34
+ router.push = async (path) => {
35
+ isNavigating.value = true
36
+ currentError.value = null
37
+ try { await _push(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false }
38
+ }
39
+ router.replace = async (path) => {
40
+ isNavigating.value = true
41
+ currentError.value = null
42
+ try { await _replace(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false }
43
+ }
44
+
45
+ const _pluginProvides = new Map<string, unknown>()
46
+ ;(globalThis as any).__cerPluginProvides = _pluginProvides
47
+
48
+ component('cer-layout-view', () => {
49
+ for (const [key, value] of _pluginProvides) {
50
+ provide(key, value)
51
+ }
52
+
53
+ const current = ref(router.getCurrent())
54
+ let unsub: (() => void) | undefined
55
+ useOnConnected(() => { unsub = router.subscribe((s: typeof current.value) => { current.value = s }) })
56
+ useOnDisconnected(() => { unsub?.(); unsub = undefined })
57
+
58
+ if (currentError.value !== null) {
59
+ if (hasError && errorTag) return { tag: errorTag, props: { attrs: { error: String(currentError.value) } }, children: [] }
60
+ return { tag: 'div', props: { attrs: { style: 'padding:2rem;font-family:monospace' } }, children: String(currentError.value) }
61
+ }
62
+ if (isNavigating.value && hasLoading && loadingTag) return { tag: loadingTag, props: {}, children: [] }
63
+
64
+ const matched = router.matchRoute(current.value.path)
65
+ const layoutName = (matched?.route as any)?.meta?.layout ?? 'default'
66
+ const layoutTag = (layouts as Record<string, string>)[layoutName]
67
+ const routerView = { tag: 'router-view', props: {}, children: [] }
68
+ return layoutTag ? { tag: layoutTag, props: {}, children: [routerView] } : routerView
69
+ })
70
+
71
+ for (const plugin of plugins) {
72
+ if (plugin && typeof plugin.setup === 'function') {
73
+ await plugin.setup({ router, provide: (key: string, value: unknown) => { _pluginProvides.set(key, value) }, config: {} })
74
+ }
75
+ }
76
+
77
+ // Pre-load the current page's route chunk AFTER plugins run so that
78
+ // cer-layout-view's first render (which calls provide()) completes before
79
+ // page components are defined. This ensures inject() in child components
80
+ // can find values stored by provide().
81
+ if (typeof window !== 'undefined') {
82
+ const _initMatch = router.matchRoute(window.location.pathname)
83
+ if (_initMatch?.route?.load) {
84
+ try { await _initMatch.route.load() } catch { /* non-fatal */ }
85
+ }
86
+ }
87
+
88
+ if (typeof window !== 'undefined') {
89
+ // Use the original (unwrapped) replace so isNavigating stays false on first paint.
90
+ await _replace(window.location.pathname + window.location.search + window.location.hash)
91
+ }
92
+
93
+ export { router }
@@ -0,0 +1,15 @@
1
+ component('layout-default', () => {
2
+ return html`
3
+ <header>
4
+ <nav>
5
+ <router-link to="/">Home</router-link>
6
+ </nav>
7
+ </header>
8
+ <main>
9
+ <slot></slot>
10
+ </main>
11
+ <footer>
12
+ <p>Built with CER App</p>
13
+ </footer>
14
+ `
15
+ })
@@ -0,0 +1,8 @@
1
+ component('page-index', () => {
2
+ return html`
3
+ <div>
4
+ <h1>Welcome to {{projectName}}</h1>
5
+ <p>Edit <code>app/pages/index.ts</code> to get started.</p>
6
+ </div>
7
+ `
8
+ })
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from '@jasonshimmy/vite-plugin-cer-app'
2
+
3
+ export default defineConfig({
4
+ mode: 'spa',
5
+ autoImports: { components: true, composables: true, directives: true, runtime: true },
6
+ })
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>{{projectName}}</title>
7
+ </head>
8
+ <body>
9
+ <cer-layout-view></cer-layout-view>
10
+ <script type="module" src="/app/app.ts"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "cer-app dev",
7
+ "build": "cer-app build",
8
+ "preview": "cer-app preview"
9
+ },
10
+ "dependencies": {
11
+ "@jasonshimmy/custom-elements-runtime": "^3.1.1"
12
+ },
13
+ "devDependencies": {
14
+ "vite": "^5.0.0",
15
+ "@jasonshimmy/vite-plugin-cer-app": "^0.1.0",
16
+ "typescript": "^5.4.0"
17
+ }
18
+ }
@@ -0,0 +1,97 @@
1
+ import '@jasonshimmy/custom-elements-runtime/css'
2
+ import 'virtual:cer-jit-css'
3
+ import 'virtual:cer-components'
4
+ import routes from 'virtual:cer-routes'
5
+ import layouts from 'virtual:cer-layouts'
6
+ import plugins from 'virtual:cer-plugins'
7
+ import { hasLoading, loadingTag } from 'virtual:cer-loading'
8
+ import { hasError, errorTag } from 'virtual:cer-error'
9
+ import {
10
+ component,
11
+ ref,
12
+ provide,
13
+ useOnConnected,
14
+ useOnDisconnected,
15
+ registerBuiltinComponents,
16
+ } from '@jasonshimmy/custom-elements-runtime'
17
+ import { initRouter } from '@jasonshimmy/custom-elements-runtime/router'
18
+ import { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'
19
+
20
+ registerBuiltinComponents()
21
+ enableJITCSS()
22
+
23
+ const router = initRouter({ routes })
24
+
25
+ const isNavigating = ref(false)
26
+ const currentError = ref(null)
27
+ ;(globalThis as any).resetError = () => {
28
+ currentError.value = null
29
+ router.replace(router.getCurrent().path)
30
+ }
31
+
32
+ const _push = router.push.bind(router)
33
+ const _replace = router.replace.bind(router)
34
+ router.push = async (path) => {
35
+ isNavigating.value = true
36
+ currentError.value = null
37
+ try { await _push(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false }
38
+ }
39
+ router.replace = async (path) => {
40
+ isNavigating.value = true
41
+ currentError.value = null
42
+ try { await _replace(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false }
43
+ }
44
+
45
+ const _pluginProvides = new Map<string, unknown>()
46
+ ;(globalThis as any).__cerPluginProvides = _pluginProvides
47
+
48
+ component('cer-layout-view', () => {
49
+ for (const [key, value] of _pluginProvides) {
50
+ provide(key, value)
51
+ }
52
+
53
+ const current = ref(router.getCurrent())
54
+ let unsub: (() => void) | undefined
55
+ useOnConnected(() => { unsub = router.subscribe((s: typeof current.value) => { current.value = s }) })
56
+ useOnDisconnected(() => { unsub?.(); unsub = undefined })
57
+
58
+ if (currentError.value !== null) {
59
+ if (hasError && errorTag) return { tag: errorTag, props: { attrs: { error: String(currentError.value) } }, children: [] }
60
+ return { tag: 'div', props: { attrs: { style: 'padding:2rem;font-family:monospace' } }, children: String(currentError.value) }
61
+ }
62
+ if (isNavigating.value && hasLoading && loadingTag) return { tag: loadingTag, props: {}, children: [] }
63
+
64
+ const matched = router.matchRoute(current.value.path)
65
+ const layoutName = (matched?.route as any)?.meta?.layout ?? 'default'
66
+ const layoutTag = (layouts as Record<string, string>)[layoutName]
67
+ const routerView = { tag: 'router-view', props: {}, children: [] }
68
+ return layoutTag ? { tag: layoutTag, props: {}, children: [routerView] } : routerView
69
+ })
70
+
71
+ for (const plugin of plugins) {
72
+ if (plugin && typeof plugin.setup === 'function') {
73
+ await plugin.setup({ router, provide: (key: string, value: unknown) => { _pluginProvides.set(key, value) }, config: {} })
74
+ }
75
+ }
76
+
77
+ // Pre-load the current page's route chunk AFTER plugins run so that
78
+ // cer-layout-view's first render (which calls provide()) completes before
79
+ // page components are defined. This ensures inject() in child components
80
+ // can find values stored by provide().
81
+ if (typeof window !== 'undefined') {
82
+ const _initMatch = router.matchRoute(window.location.pathname)
83
+ if (_initMatch?.route?.load) {
84
+ try { await _initMatch.route.load() } catch { /* non-fatal */ }
85
+ }
86
+ }
87
+
88
+ if (typeof window !== 'undefined') {
89
+ // Use the original (unwrapped) replace so isNavigating stays false on first
90
+ // paint — the loading component must not flash over pre-rendered SSG content.
91
+ await _replace(window.location.pathname + window.location.search + window.location.hash)
92
+ // Clear SSR hydration data after initial navigation so subsequent navigations
93
+ // don't accidentally reuse it.
94
+ delete (globalThis as any).__CER_DATA__
95
+ }
96
+
97
+ export { router }
@@ -0,0 +1,15 @@
1
+ component('layout-default', () => {
2
+ return html`
3
+ <header>
4
+ <nav>
5
+ <router-link to="/">Home</router-link>
6
+ </nav>
7
+ </header>
8
+ <main>
9
+ <slot></slot>
10
+ </main>
11
+ <footer>
12
+ <p>Built with CER App</p>
13
+ </footer>
14
+ `
15
+ })
@@ -0,0 +1,8 @@
1
+ component('page-index', () => {
2
+ return html`
3
+ <div>
4
+ <h1>Welcome to {{projectName}}</h1>
5
+ <p>Edit <code>app/pages/index.ts</code> to get started.</p>
6
+ </div>
7
+ `
8
+ })
@@ -0,0 +1,13 @@
1
+ import { defineConfig } from '@jasonshimmy/vite-plugin-cer-app'
2
+
3
+ export default defineConfig({
4
+ mode: 'ssg',
5
+ ssg: {
6
+ routes: 'auto',
7
+ concurrency: 4,
8
+ },
9
+ ssr: {
10
+ dsd: true,
11
+ },
12
+ autoImports: { components: true, composables: true, directives: true, runtime: true },
13
+ })
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>{{projectName}}</title>
7
+ </head>
8
+ <body>
9
+ <cer-layout-view></cer-layout-view>
10
+ <script type="module" src="/app/app.ts"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "cer-app dev",
7
+ "build": "cer-app build",
8
+ "generate": "cer-app generate",
9
+ "preview": "cer-app preview"
10
+ },
11
+ "dependencies": {
12
+ "@jasonshimmy/custom-elements-runtime": "^3.1.1"
13
+ },
14
+ "devDependencies": {
15
+ "vite": "^5.0.0",
16
+ "@jasonshimmy/vite-plugin-cer-app": "^0.1.0",
17
+ "typescript": "^5.4.0"
18
+ }
19
+ }
@@ -0,0 +1,97 @@
1
+ import '@jasonshimmy/custom-elements-runtime/css'
2
+ import 'virtual:cer-jit-css'
3
+ import 'virtual:cer-components'
4
+ import routes from 'virtual:cer-routes'
5
+ import layouts from 'virtual:cer-layouts'
6
+ import plugins from 'virtual:cer-plugins'
7
+ import { hasLoading, loadingTag } from 'virtual:cer-loading'
8
+ import { hasError, errorTag } from 'virtual:cer-error'
9
+ import {
10
+ component,
11
+ ref,
12
+ provide,
13
+ useOnConnected,
14
+ useOnDisconnected,
15
+ registerBuiltinComponents,
16
+ } from '@jasonshimmy/custom-elements-runtime'
17
+ import { initRouter } from '@jasonshimmy/custom-elements-runtime/router'
18
+ import { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'
19
+
20
+ registerBuiltinComponents()
21
+ enableJITCSS()
22
+
23
+ const router = initRouter({ routes })
24
+
25
+ const isNavigating = ref(false)
26
+ const currentError = ref(null)
27
+ ;(globalThis as any).resetError = () => {
28
+ currentError.value = null
29
+ router.replace(router.getCurrent().path)
30
+ }
31
+
32
+ const _push = router.push.bind(router)
33
+ const _replace = router.replace.bind(router)
34
+ router.push = async (path) => {
35
+ isNavigating.value = true
36
+ currentError.value = null
37
+ try { await _push(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false }
38
+ }
39
+ router.replace = async (path) => {
40
+ isNavigating.value = true
41
+ currentError.value = null
42
+ try { await _replace(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false }
43
+ }
44
+
45
+ const _pluginProvides = new Map<string, unknown>()
46
+ ;(globalThis as any).__cerPluginProvides = _pluginProvides
47
+
48
+ component('cer-layout-view', () => {
49
+ for (const [key, value] of _pluginProvides) {
50
+ provide(key, value)
51
+ }
52
+
53
+ const current = ref(router.getCurrent())
54
+ let unsub: (() => void) | undefined
55
+ useOnConnected(() => { unsub = router.subscribe((s: typeof current.value) => { current.value = s }) })
56
+ useOnDisconnected(() => { unsub?.(); unsub = undefined })
57
+
58
+ if (currentError.value !== null) {
59
+ if (hasError && errorTag) return { tag: errorTag, props: { attrs: { error: String(currentError.value) } }, children: [] }
60
+ return { tag: 'div', props: { attrs: { style: 'padding:2rem;font-family:monospace' } }, children: String(currentError.value) }
61
+ }
62
+ if (isNavigating.value && hasLoading && loadingTag) return { tag: loadingTag, props: {}, children: [] }
63
+
64
+ const matched = router.matchRoute(current.value.path)
65
+ const layoutName = (matched?.route as any)?.meta?.layout ?? 'default'
66
+ const layoutTag = (layouts as Record<string, string>)[layoutName]
67
+ const routerView = { tag: 'router-view', props: {}, children: [] }
68
+ return layoutTag ? { tag: layoutTag, props: {}, children: [routerView] } : routerView
69
+ })
70
+
71
+ for (const plugin of plugins) {
72
+ if (plugin && typeof plugin.setup === 'function') {
73
+ await plugin.setup({ router, provide: (key: string, value: unknown) => { _pluginProvides.set(key, value) }, config: {} })
74
+ }
75
+ }
76
+
77
+ // Pre-load the current page's route chunk AFTER plugins run so that
78
+ // cer-layout-view's first render (which calls provide()) completes before
79
+ // page components are defined. This ensures inject() in child components
80
+ // can find values stored by provide().
81
+ if (typeof window !== 'undefined') {
82
+ const _initMatch = router.matchRoute(window.location.pathname)
83
+ if (_initMatch?.route?.load) {
84
+ try { await _initMatch.route.load() } catch { /* non-fatal */ }
85
+ }
86
+ }
87
+
88
+ if (typeof window !== 'undefined') {
89
+ // Use the original (unwrapped) replace so isNavigating stays false on first
90
+ // paint — the loading component must not flash over pre-rendered SSR content.
91
+ await _replace(window.location.pathname + window.location.search + window.location.hash)
92
+ // Clear SSR hydration data after initial navigation so subsequent navigations
93
+ // don't accidentally reuse it.
94
+ delete (globalThis as any).__CER_DATA__
95
+ }
96
+
97
+ export { router }
@@ -0,0 +1,15 @@
1
+ component('layout-default', () => {
2
+ return html`
3
+ <header>
4
+ <nav>
5
+ <router-link to="/">Home</router-link>
6
+ </nav>
7
+ </header>
8
+ <main>
9
+ <slot></slot>
10
+ </main>
11
+ <footer>
12
+ <p>Built with CER App</p>
13
+ </footer>
14
+ `
15
+ })
@@ -0,0 +1,8 @@
1
+ component('page-index', () => {
2
+ return html`
3
+ <div>
4
+ <h1>Welcome to {{projectName}}</h1>
5
+ <p>Edit <code>app/pages/index.ts</code> to get started.</p>
6
+ </div>
7
+ `
8
+ })
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from '@jasonshimmy/vite-plugin-cer-app'
2
+
3
+ export default defineConfig({
4
+ mode: 'ssr',
5
+ ssr: {
6
+ dsd: true,
7
+ streaming: true,
8
+ },
9
+ autoImports: { components: true, composables: true, directives: true, runtime: true },
10
+ })
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>{{projectName}}</title>
7
+ </head>
8
+ <body>
9
+ <cer-layout-view></cer-layout-view>
10
+ <script type="module" src="/app/app.ts"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "cer-app dev",
7
+ "build": "cer-app build",
8
+ "preview": "cer-app preview --ssr"
9
+ },
10
+ "dependencies": {
11
+ "@jasonshimmy/custom-elements-runtime": "^3.1.1"
12
+ },
13
+ "devDependencies": {
14
+ "vite": "^5.0.0",
15
+ "@jasonshimmy/vite-plugin-cer-app": "^0.1.0",
16
+ "typescript": "^5.4.0"
17
+ }
18
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAA6B,MAAM,MAAM,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAqCxD;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,YAAY,EAAE,IAAI,GAAE,MAAsB,GAAG,iBAAiB,CA6CvG;AAqFD;;;GAGG;AACH,wBAAgB,MAAM,CAAC,UAAU,GAAE,YAAiB,GAAG,MAAM,EAAE,CAwJ9D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAA6B,MAAM,MAAM,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAqCxD;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,YAAY,EAAE,IAAI,GAAE,MAAsB,GAAG,iBAAiB,CA6CvG;AAqFD;;;GAGG;AACH,wBAAgB,MAAM,CAAC,UAAU,GAAE,YAAiB,GAAG,MAAM,EAAE,CA4J9D"}
@@ -285,13 +285,17 @@ export function cerApp(userConfig = {}) {
285
285
  },
286
286
  };
287
287
  // Include cerPlugin from the runtime for JIT CSS support
288
+ // Resolve config eagerly so cerPlugin can use the final resolved values
289
+ const resolvedForJit = resolveConfig(userConfig);
290
+ const { dsd } = resolvedForJit.ssr;
291
+ const { content, ...jitOptions } = resolvedForJit.jitCss;
288
292
  const jitPlugins = cerPlugin({
289
- content: userConfig.jitCss?.content ?? [
290
- `${userConfig.srcDir ?? 'app'}/pages/**/*.ts`,
291
- `${userConfig.srcDir ?? 'app'}/components/**/*.ts`,
292
- `${userConfig.srcDir ?? 'app'}/layouts/**/*.ts`,
293
- ],
294
- ssr: userConfig.ssr?.dsd ? { dsd: true } : undefined,
293
+ content,
294
+ ...jitOptions,
295
+ ssr: {
296
+ dsd,
297
+ jit: jitOptions,
298
+ },
295
299
  });
296
300
  return [cerAppPlugin, ...jitPlugins];
297
301
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAIrC,OAAO,EAAE,SAAS,EAAE,MAAM,kDAAkD,CAAA;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAClG,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,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,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"}
package/docs/cli.md CHANGED
@@ -148,9 +148,11 @@ dist/
148
148
 
149
149
  Scaffolds a new project from a template.
150
150
 
151
- ```sh
152
- create-cer-app [project-name] [options]
153
- ```
151
+ > **Note:** Because the scaffolder is bundled inside `@jasonshimmy/vite-plugin-cer-app` rather than published as a standalone `create-cer-app` package, you must use the `--package` flag with `npx`:
152
+ >
153
+ > ```sh
154
+ > npx --package @jasonshimmy/vite-plugin-cer-app create-cer-app [project-name] [options]
155
+ > ```
154
156
 
155
157
  | Argument / Option | Description |
156
158
  |---|---|
@@ -161,10 +163,10 @@ create-cer-app [project-name] [options]
161
163
  **Examples:**
162
164
 
163
165
  ```sh
164
- create-cer-app # interactive prompts
165
- create-cer-app my-app # prompts for mode
166
- create-cer-app my-app --mode ssr # no prompts
167
- create-cer-app my-blog --mode ssg --dir ./sites/blog
166
+ npx --package @jasonshimmy/vite-plugin-cer-app create-cer-app # interactive prompts
167
+ npx --package @jasonshimmy/vite-plugin-cer-app create-cer-app my-app # prompts for mode
168
+ npx --package @jasonshimmy/vite-plugin-cer-app create-cer-app my-app --mode ssr # no prompts
169
+ npx --package @jasonshimmy/vite-plugin-cer-app create-cer-app my-blog --mode ssg --dir ./sites/blog
168
170
  ```
169
171
 
170
172
  **Scaffolded files (all modes):**
@@ -231,5 +233,5 @@ npm run preview
231
233
  ```sh
232
234
  npx cer-app dev
233
235
  npx cer-app build
234
- npx create-cer-app my-app
236
+ npx --package @jasonshimmy/vite-plugin-cer-app create-cer-app my-app
235
237
  ```
@@ -217,8 +217,10 @@ When `runtime: true`, the following are injected if used and not already importe
217
217
  ```ts
218
218
  import { component, html, css, ref, computed, watch, watchEffect,
219
219
  useProps, useEmit, useOnConnected, useOnDisconnected,
220
- useOnAttributeChanged, useOnError, useStyle, useExpose,
221
- useSlots, provide, inject, createComposable, nextTick
220
+ useOnAttributeChanged, useOnError, useStyle, useDesignTokens,
221
+ useGlobalStyle, useExpose, useSlots, provide, inject,
222
+ createComposable, nextTick, defineModel, getCurrentComponentContext,
223
+ isReactiveState, unsafeHTML, decodeEntities, useTeleport
222
224
  } from '@jasonshimmy/custom-elements-runtime'
223
225
  ```
224
226
 
@@ -11,7 +11,7 @@
11
11
  ## Option A — Scaffold with `create-cer-app` (recommended)
12
12
 
13
13
  ```sh
14
- npx create-cer-app my-app
14
+ npx --package @jasonshimmy/vite-plugin-cer-app create-cer-app my-app
15
15
  ```
16
16
 
17
17
  The interactive prompt asks for a project name and rendering mode:
@@ -39,7 +39,7 @@ Project created! To get started:
39
39
  You can also skip the prompts with flags:
40
40
 
41
41
  ```sh
42
- npx create-cer-app my-app --mode ssr
42
+ npx --package @jasonshimmy/vite-plugin-cer-app create-cer-app my-app --mode ssr
43
43
  ```
44
44
 
45
45
  ---
@@ -140,6 +140,7 @@ The framework generates this file when you scaffold a new project. It bootstraps
140
140
  ```ts
141
141
  // app/app.ts
142
142
  import '@jasonshimmy/custom-elements-runtime/css'
143
+ import 'virtual:cer-jit-css'
143
144
  import 'virtual:cer-components'
144
145
  import routes from 'virtual:cer-routes'
145
146
  import layouts from 'virtual:cer-layouts'
@@ -153,7 +154,6 @@ import {
153
154
  } from '@jasonshimmy/custom-elements-runtime'
154
155
  import { initRouter } from '@jasonshimmy/custom-elements-runtime/router'
155
156
  import { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'
156
- import { createDOMJITCSS } from '@jasonshimmy/custom-elements-runtime/dom-jit-css'
157
157
 
158
158
  registerBuiltinComponents()
159
159
  enableJITCSS()
@@ -226,7 +226,6 @@ if (typeof window !== 'undefined') {
226
226
  if (typeof window !== 'undefined') {
227
227
  await _replace(window.location.pathname + window.location.search + window.location.hash)
228
228
  delete (globalThis as any).__CER_DATA__
229
- createDOMJITCSS().mount()
230
229
  }
231
230
 
232
231
  export { router }
@@ -9,21 +9,19 @@ The `useHead()` composable manages `<title>`, `<meta>`, `<link>`, `<script>`, an
9
9
 
10
10
  ## Import
11
11
 
12
- `useHead` is **not** auto-imported. You must explicitly import it in every file that uses it:
12
+ `useHead` is auto-imported in files inside `app/pages/`, `app/layouts/`, `app/components/`, and root convention files (e.g. `app/loading.ts`). No import statement is needed in those locations.
13
+
14
+ If you use `useHead` outside those directories, import it explicitly:
13
15
 
14
16
  ```ts
15
17
  import { useHead } from '@jasonshimmy/vite-plugin-cer-app/composables'
16
18
  ```
17
19
 
18
- Unlike `component`, `html`, `ref`, and other runtime APIs (which are injected automatically when `autoImports.runtime` is enabled), `useHead` comes from the framework package and requires an explicit import statement.
19
-
20
20
  ---
21
21
 
22
22
  ## Basic usage
23
23
 
24
24
  ```ts
25
- import { useHead } from '@jasonshimmy/vite-plugin-cer-app/composables'
26
-
27
25
  component('page-about', () => {
28
26
  useHead({
29
27
  title: 'About Us',
@@ -1,4 +1,5 @@
1
1
  import '@jasonshimmy/custom-elements-runtime/css'
2
+ import 'virtual:cer-jit-css'
2
3
  import 'virtual:cer-components'
3
4
  import routes from 'virtual:cer-routes'
4
5
  import layouts from 'virtual:cer-layouts'
@@ -15,7 +16,6 @@ import {
15
16
  } from '@jasonshimmy/custom-elements-runtime'
16
17
  import { initRouter } from '@jasonshimmy/custom-elements-runtime/router'
17
18
  import { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'
18
- import { createDOMJITCSS } from '@jasonshimmy/custom-elements-runtime/dom-jit-css'
19
19
 
20
20
  registerBuiltinComponents()
21
21
  enableJITCSS()
@@ -136,7 +136,6 @@ if (typeof window !== 'undefined') {
136
136
  // Clear SSR loader data after initial navigation so subsequent client-side
137
137
  // navigations don't accidentally reuse stale server data.
138
138
  delete (globalThis as any).__CER_DATA__
139
- createDOMJITCSS().mount()
140
139
  }
141
140
 
142
141
  export { router }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jasonshimmy/vite-plugin-cer-app",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Nuxt-style meta-framework for @jasonshimmy/custom-elements-runtime",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -44,7 +44,7 @@
44
44
  "create-cer-app": "./dist/cli/create/index.js"
45
45
  },
46
46
  "scripts": {
47
- "build": "tsc -p tsconfig.build.json",
47
+ "build": "tsc -p tsconfig.build.json && cp -r src/cli/create/templates dist/cli/create/templates",
48
48
  "dev": "tsc -p tsconfig.build.json --watch",
49
49
  "test": "vitest run",
50
50
  "test:watch": "vitest",
@@ -71,19 +71,19 @@
71
71
  },
72
72
  "dependencies": {
73
73
  "commander": "^14.0.3",
74
- "fast-glob": "^3.3.2",
75
- "magic-string": "^0.30.10",
74
+ "fast-glob": "^3.3.3",
75
+ "magic-string": "^0.30.21",
76
76
  "pathe": "^2.0.3"
77
77
  },
78
78
  "devDependencies": {
79
- "@jasonshimmy/custom-elements-runtime": "^3.1.3",
79
+ "@jasonshimmy/custom-elements-runtime": "^3.2.0",
80
80
  "@types/node": "^25.5.0",
81
81
  "@vitest/coverage-v8": "^4.1.0",
82
82
  "cypress": "^15.12.0",
83
83
  "happy-dom": "^20.8.4",
84
- "start-server-and-test": "^2.0.0",
85
- "typescript": "^5.4.0",
86
- "vite": "^8.0.0",
84
+ "start-server-and-test": "^2.1.5",
85
+ "typescript": "^5.9.3",
86
+ "vite": "^8.0.1",
87
87
  "vitest": "^4.1.0"
88
88
  },
89
89
  "publishConfig": {
@@ -218,7 +218,7 @@ async function generateInlineTemplate(
218
218
  // app/app.ts
219
219
  await writeFile(
220
220
  join(targetDir, 'app/app.ts'),
221
- `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 { component, ref, provide, useOnConnected, useOnDisconnected, registerBuiltinComponents } 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()\nenableJITCSS()\n\nconst router = initRouter({ routes })\n\nconst isNavigating = ref(false)\nconst currentError = ref(null)\n;(globalThis as any).resetError = () => { currentError.value = null; router.replace(router.getCurrent().path) }\nconst _push = router.push.bind(router)\nconst _replace = router.replace.bind(router)\nrouter.push = async (path) => { isNavigating.value = true; currentError.value = null; try { await _push(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false } }\nrouter.replace = async (path) => { isNavigating.value = true; currentError.value = null; try { await _replace(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false } }\n\nconst _pluginProvides = new Map()\n;(globalThis as any).__cerPluginProvides = _pluginProvides\n\ncomponent('cer-layout-view', () => {\n for (const [key, value] of _pluginProvides) { provide(key, value) }\n const current = ref(router.getCurrent())\n let unsub: (() => void) | undefined\n useOnConnected(() => { unsub = router.subscribe((s: typeof current.value) => { current.value = s }) })\n useOnDisconnected(() => { unsub?.(); unsub = undefined })\n if (currentError.value !== null) {\n if (hasError && errorTag) return { tag: errorTag, props: { attrs: { error: String(currentError.value) } }, children: [] }\n return { tag: 'div', props: { attrs: { style: 'padding:2rem;font-family:monospace' } }, children: [String(currentError.value)] }\n }\n if (isNavigating.value && hasLoading && loadingTag) return { tag: loadingTag, props: {}, children: [] }\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 return layoutTag ? { tag: layoutTag, props: {}, children: [routerView] } : routerView\n})\n\nfor (const plugin of plugins ?? []) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({ router, provide: (key: string, value: unknown) => { _pluginProvides.set(key, value) }, config: {} })\n }\n}\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\nif (typeof window !== 'undefined') {\n await _replace(window.location.pathname + window.location.search + window.location.hash)\n delete (globalThis as any).__CER_DATA__\n createDOMJITCSS().mount()\n}\n\nexport { router }\n`,
221
+ `import '@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 { component, ref, provide, useOnConnected, useOnDisconnected, registerBuiltinComponents } 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\nconst isNavigating = ref(false)\nconst currentError = ref(null)\n;(globalThis as any).resetError = () => { currentError.value = null; router.replace(router.getCurrent().path) }\nconst _push = router.push.bind(router)\nconst _replace = router.replace.bind(router)\nrouter.push = async (path) => { isNavigating.value = true; currentError.value = null; try { await _push(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false } }\nrouter.replace = async (path) => { isNavigating.value = true; currentError.value = null; try { await _replace(path) } catch (err) { currentError.value = err instanceof Error ? err.message : String(err) } finally { isNavigating.value = false } }\n\nconst _pluginProvides = new Map()\n;(globalThis as any).__cerPluginProvides = _pluginProvides\n\ncomponent('cer-layout-view', () => {\n for (const [key, value] of _pluginProvides) { provide(key, value) }\n const current = ref(router.getCurrent())\n let unsub: (() => void) | undefined\n useOnConnected(() => { unsub = router.subscribe((s: typeof current.value) => { current.value = s }) })\n useOnDisconnected(() => { unsub?.(); unsub = undefined })\n if (currentError.value !== null) {\n if (hasError && errorTag) return { tag: errorTag, props: { attrs: { error: String(currentError.value) } }, children: [] }\n return { tag: 'div', props: { attrs: { style: 'padding:2rem;font-family:monospace' } }, children: [String(currentError.value)] }\n }\n if (isNavigating.value && hasLoading && loadingTag) return { tag: loadingTag, props: {}, children: [] }\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 return layoutTag ? { tag: layoutTag, props: {}, children: [routerView] } : routerView\n})\n\nfor (const plugin of plugins ?? []) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({ router, provide: (key: string, value: unknown) => { _pluginProvides.set(key, value) }, config: {} })\n }\n}\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\nif (typeof window !== 'undefined') {\n await _replace(window.location.pathname + window.location.search + window.location.hash)\n delete (globalThis as any).__CER_DATA__\n}\n\nexport { router }\n`,
222
222
  'utf-8',
223
223
  )
224
224
 
@@ -1,4 +1,5 @@
1
1
  import '@jasonshimmy/custom-elements-runtime/css'
2
+ import 'virtual:cer-jit-css'
2
3
  import 'virtual:cer-components'
3
4
  import routes from 'virtual:cer-routes'
4
5
  import layouts from 'virtual:cer-layouts'
@@ -15,7 +16,6 @@ import {
15
16
  } from '@jasonshimmy/custom-elements-runtime'
16
17
  import { initRouter } from '@jasonshimmy/custom-elements-runtime/router'
17
18
  import { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'
18
- import { createDOMJITCSS } from '@jasonshimmy/custom-elements-runtime/dom-jit-css'
19
19
 
20
20
  registerBuiltinComponents()
21
21
  enableJITCSS()
@@ -88,7 +88,6 @@ if (typeof window !== 'undefined') {
88
88
  if (typeof window !== 'undefined') {
89
89
  // Use the original (unwrapped) replace so isNavigating stays false on first paint.
90
90
  await _replace(window.location.pathname + window.location.search + window.location.hash)
91
- createDOMJITCSS().mount()
92
91
  }
93
92
 
94
93
  export { router }
@@ -1,4 +1,5 @@
1
1
  import '@jasonshimmy/custom-elements-runtime/css'
2
+ import 'virtual:cer-jit-css'
2
3
  import 'virtual:cer-components'
3
4
  import routes from 'virtual:cer-routes'
4
5
  import layouts from 'virtual:cer-layouts'
@@ -15,7 +16,6 @@ import {
15
16
  } from '@jasonshimmy/custom-elements-runtime'
16
17
  import { initRouter } from '@jasonshimmy/custom-elements-runtime/router'
17
18
  import { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'
18
- import { createDOMJITCSS } from '@jasonshimmy/custom-elements-runtime/dom-jit-css'
19
19
 
20
20
  registerBuiltinComponents()
21
21
  enableJITCSS()
@@ -92,7 +92,6 @@ if (typeof window !== 'undefined') {
92
92
  // Clear SSR hydration data after initial navigation so subsequent navigations
93
93
  // don't accidentally reuse it.
94
94
  delete (globalThis as any).__CER_DATA__
95
- createDOMJITCSS().mount()
96
95
  }
97
96
 
98
97
  export { router }
@@ -1,4 +1,5 @@
1
1
  import '@jasonshimmy/custom-elements-runtime/css'
2
+ import 'virtual:cer-jit-css'
2
3
  import 'virtual:cer-components'
3
4
  import routes from 'virtual:cer-routes'
4
5
  import layouts from 'virtual:cer-layouts'
@@ -15,7 +16,6 @@ import {
15
16
  } from '@jasonshimmy/custom-elements-runtime'
16
17
  import { initRouter } from '@jasonshimmy/custom-elements-runtime/router'
17
18
  import { enableJITCSS } from '@jasonshimmy/custom-elements-runtime/jit-css'
18
- import { createDOMJITCSS } from '@jasonshimmy/custom-elements-runtime/dom-jit-css'
19
19
 
20
20
  registerBuiltinComponents()
21
21
  enableJITCSS()
@@ -92,7 +92,6 @@ if (typeof window !== 'undefined') {
92
92
  // Clear SSR hydration data after initial navigation so subsequent navigations
93
93
  // don't accidentally reuse it.
94
94
  delete (globalThis as any).__CER_DATA__
95
- createDOMJITCSS().mount()
96
95
  }
97
96
 
98
97
  export { router }
@@ -317,13 +317,17 @@ export function cerApp(userConfig: CerAppConfig = {}): Plugin[] {
317
317
  }
318
318
 
319
319
  // Include cerPlugin from the runtime for JIT CSS support
320
+ // Resolve config eagerly so cerPlugin can use the final resolved values
321
+ const resolvedForJit = resolveConfig(userConfig)
322
+ const { dsd } = resolvedForJit.ssr
323
+ const { content, ...jitOptions } = resolvedForJit.jitCss
320
324
  const jitPlugins = cerPlugin({
321
- content: userConfig.jitCss?.content ?? [
322
- `${userConfig.srcDir ?? 'app'}/pages/**/*.ts`,
323
- `${userConfig.srcDir ?? 'app'}/components/**/*.ts`,
324
- `${userConfig.srcDir ?? 'app'}/layouts/**/*.ts`,
325
- ],
326
- ssr: userConfig.ssr?.dsd ? { dsd: true } : undefined,
325
+ content,
326
+ ...jitOptions,
327
+ ssr: {
328
+ dsd,
329
+ jit: jitOptions,
330
+ },
327
331
  })
328
332
 
329
333
  return [cerAppPlugin, ...jitPlugins]