@jasonshimmy/vite-plugin-cer-app 0.3.0 → 0.4.0

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 (45) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/commits.txt +1 -1
  3. package/dist/plugin/build-ssr.d.ts.map +1 -1
  4. package/dist/plugin/build-ssr.js +18 -0
  5. package/dist/plugin/build-ssr.js.map +1 -1
  6. package/dist/plugin/dts-generator.js +1 -1
  7. package/dist/plugin/dts-generator.js.map +1 -1
  8. package/dist/plugin/index.d.ts.map +1 -1
  9. package/dist/plugin/index.js +9 -0
  10. package/dist/plugin/index.js.map +1 -1
  11. package/dist/plugin/transforms/auto-import.js +2 -2
  12. package/dist/plugin/transforms/auto-import.js.map +1 -1
  13. package/dist/runtime/composables/index.d.ts +1 -0
  14. package/dist/runtime/composables/index.d.ts.map +1 -1
  15. package/dist/runtime/composables/index.js +1 -0
  16. package/dist/runtime/composables/index.js.map +1 -1
  17. package/dist/runtime/composables/use-inject.d.ts +29 -0
  18. package/dist/runtime/composables/use-inject.d.ts.map +1 -0
  19. package/dist/runtime/composables/use-inject.js +48 -0
  20. package/dist/runtime/composables/use-inject.js.map +1 -0
  21. package/dist/runtime/entry-server-template.d.ts +1 -1
  22. package/dist/runtime/entry-server-template.d.ts.map +1 -1
  23. package/dist/runtime/entry-server-template.js +20 -0
  24. package/dist/runtime/entry-server-template.js.map +1 -1
  25. package/docs/composables.md +37 -0
  26. package/docs/plugins.md +23 -15
  27. package/docs/rendering-modes.md +1 -1
  28. package/docs/testing.md +3 -3
  29. package/e2e/kitchen-sink/app/pages/(auth)/protected.ts +1 -5
  30. package/e2e/kitchen-sink/cer-auto-imports.d.ts +1 -0
  31. package/package.json +1 -1
  32. package/src/__tests__/plugin/build-ssr.test.ts +10 -0
  33. package/src/__tests__/plugin/cer-app-plugin.test.ts +15 -0
  34. package/src/__tests__/plugin/dts-generator.test.ts +5 -0
  35. package/src/__tests__/plugin/entry-server-template.test.ts +24 -0
  36. package/src/__tests__/plugin/transforms/auto-import.test.ts +7 -0
  37. package/src/__tests__/runtime/use-inject-client.test.ts +67 -0
  38. package/src/__tests__/runtime/use-inject.test.ts +66 -0
  39. package/src/plugin/build-ssr.ts +18 -0
  40. package/src/plugin/dts-generator.ts +1 -1
  41. package/src/plugin/index.ts +9 -0
  42. package/src/plugin/transforms/auto-import.ts +2 -2
  43. package/src/runtime/composables/index.ts +1 -0
  44. package/src/runtime/composables/use-inject.ts +49 -0
  45. package/src/runtime/entry-server-template.ts +20 -0
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.0] - 2026-03-20
5
+
6
+ - feat: implement useInject composable for consistent value injection across SPA, SSR, and SSG fix: cer app hidden directory issue (f614e92)
7
+
4
8
  ## [v0.3.0] - 2026-03-20
5
9
 
6
10
  - feat: add default .gitignore templates for SPA, SSR, and SSG projects fix: remove unused streaming ssr option fix: generated .cer directory to get out of the way of the user (8656788)
package/commits.txt CHANGED
@@ -1 +1 @@
1
- - feat: add default .gitignore templates for SPA, SSR, and SSG projects fix: remove unused streaming ssr option fix: generated .cer directory to get out of the way of the user (8656788)
1
+ - feat: implement useInject composable for consistent value injection across SPA, SSR, and SSG fix: cer app hidden directory issue (f614e92)
@@ -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;AAGxD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAQpE;AAgMD;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,iBAAiB,EACzB,cAAc,GAAE,UAAe,GAC9B,OAAO,CAAC,IAAI,CAAC,CA8Ef"}
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;AAGxD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAQpE;AAkND;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,iBAAiB,EACzB,cAAc,GAAE,UAAe,GAC9B,OAAO,CAAC,IAAI,CAAC,CA8Ef"}
@@ -50,6 +50,23 @@ registerBuiltinComponents()
50
50
  // minimal set (<, >, & …) and re-escapes everything else.
51
51
  registerEntityMap(entitiesJson)
52
52
 
53
+ // Run plugins once at server startup so their provide() values are available
54
+ // to useInject() during every SSR/SSG render pass.
55
+ const _pluginProvides = new Map()
56
+ ;(globalThis).__cerPluginProvides = _pluginProvides
57
+ const _pluginsReady = (async () => {
58
+ const _bootstrapRouter = initRouter({ routes })
59
+ for (const plugin of plugins) {
60
+ if (plugin && typeof plugin.setup === 'function') {
61
+ await plugin.setup({
62
+ router: _bootstrapRouter,
63
+ provide: (key, value) => _pluginProvides.set(key, value),
64
+ config: {},
65
+ })
66
+ }
67
+ }
68
+ })()
69
+
53
70
  // Load the Vite-built client index.html (dist/client/index.html) so every SSR
54
71
  // response includes the client-side scripts needed for hydration and routing.
55
72
  // The server bundle lives at dist/server/server.js, so ../client resolves correctly.
@@ -119,6 +136,7 @@ function _mergeWithClientTemplate(ssrHtml, clientTemplate) {
119
136
  // synchronously right before renderToStringWithJITCSS — guaranteeing that
120
137
  // concurrent renders (SSG concurrency > 1) never race on a shared global.
121
138
  const _prepareRequest = async (req) => {
139
+ await _pluginsReady
122
140
  const router = initRouter({ routes, initialUrl: req.url ?? '/' })
123
141
  const current = router.getCurrent()
124
142
  const { route, params } = router.matchRoute(current.path)
@@ -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,UAAU,EAAE,MAAM,SAAS,CAAA;AAEhD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEvE;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAyB;IAC1D,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;IACpD,IAAI,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAA;IAC3C,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC,CAAA;IACrE,IAAI,UAAU,CAAC,YAAY,CAAC;QAAE,OAAO,YAAY,CAAA;IACjD,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsLR,C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,CAAC,EAAU;oBACb,IAAI,EAAE,KAAK,qBAAqB;wBAAE,OAAO,eAAe,CAAA;gBAC1D,CAAC;aACF;SACF;QACD,KAAK,EAAE;YACL,GAAG,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,EAAE,kCAAkC,CAAC;SACzF;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"}
@@ -69,7 +69,7 @@ const RUNTIME_GLOBALS = [
69
69
  'useTeleport',
70
70
  ];
71
71
  const DIRECTIVE_GLOBALS = ['when', 'each', 'match', 'anchorBlock'];
72
- const FRAMEWORK_GLOBALS = ['useHead', 'usePageData'];
72
+ const FRAMEWORK_GLOBALS = ['useHead', 'usePageData', 'useInject'];
73
73
  /**
74
74
  * Scans a composables directory and returns a map of export name → file path.
75
75
  * Uses a simple regex to find exported identifiers.
@@ -1 +1 @@
1
- {"version":3,"file":"dts-generator.js","sourceRoot":"","sources":["../../src/plugin/dts-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;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,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAsCxD;;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,CAyL9D"}
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;AA4CxD;;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,CA4L9D"}
@@ -5,6 +5,7 @@ import { autoImportTransform } from './transforms/auto-import.js';
5
5
  import { scanComposableExports, writeAutoImportDts, writeTsconfigPaths } from './dts-generator.js';
6
6
  import { configureCerDevServer } from './dev-server.js';
7
7
  import { writeGeneratedDir, getGeneratedDir } from './generated-dir.js';
8
+ import { APP_ENTRY_TEMPLATE } from '../runtime/app-template.js';
8
9
  import { generateRoutesCode } from './virtual/routes.js';
9
10
  import { generateLayoutsCode } from './virtual/layouts.js';
10
11
  import { generateComponentsCode } from './virtual/components.js';
@@ -32,6 +33,10 @@ const VIRTUAL_IDS = {
32
33
  };
33
34
  // Resolved virtual module IDs (prefixed with \0)
34
35
  const RESOLVED_IDS = Object.fromEntries(Object.entries(VIRTUAL_IDS).map(([k, v]) => [k, `\0${v}`]));
36
+ // The generated app entry is served as a virtual module so Vite doesn't need
37
+ // to find it on disk (Vite's fs security policy blocks paths starting with `/.`).
38
+ const APP_ENTRY_URL = '/.cer/app.ts';
39
+ const RESOLVED_APP_ENTRY = '\0cer-app-entry';
35
40
  /**
36
41
  * Fills in default values for all config fields and resolves absolute paths.
37
42
  */
@@ -189,11 +194,15 @@ export function cerApp(userConfig = {}) {
189
194
  config = resolveConfig(userConfig, resolvedConfig.root);
190
195
  },
191
196
  resolveId(id) {
197
+ if (id === APP_ENTRY_URL)
198
+ return RESOLVED_APP_ENTRY;
192
199
  if (Object.values(VIRTUAL_IDS).includes(id)) {
193
200
  return `\0${id}`;
194
201
  }
195
202
  },
196
203
  async load(id) {
204
+ if (id === RESOLVED_APP_ENTRY)
205
+ return APP_ENTRY_TEMPLATE;
197
206
  const allResolved = Object.values(RESOLVED_IDS);
198
207
  if (!allResolved.includes(id))
199
208
  return null;
@@ -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;AACrC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAIlD,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,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACvE,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,0BAA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AAa,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;YACnD,CAAC;YACD,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"}
@@ -2,8 +2,8 @@ import MagicString from 'magic-string';
2
2
  import { normalize } from 'pathe';
3
3
  const RUNTIME_IMPORTS = `import { component, html, css, ref, computed, watch, watchEffect, useProps, useEmit, useOnConnected, useOnDisconnected, useOnAttributeChanged, useOnError, useStyle, useDesignTokens, useGlobalStyle, useExpose, useSlots, provide, inject, createComposable, nextTick, defineModel, getCurrentComponentContext, isReactiveState, unsafeHTML, decodeEntities, useTeleport } from '@jasonshimmy/custom-elements-runtime';`;
4
4
  const DIRECTIVE_IMPORTS = `import { when, each, match, anchorBlock } from '@jasonshimmy/custom-elements-runtime/directives';`;
5
- const FRAMEWORK_IMPORTS = `import { useHead, usePageData } from '@jasonshimmy/vite-plugin-cer-app/composables';`;
6
- const FRAMEWORK_IDENTIFIERS = ['useHead', 'usePageData'];
5
+ const FRAMEWORK_IMPORTS = `import { useHead, usePageData, useInject } from '@jasonshimmy/vite-plugin-cer-app/composables';`;
6
+ const FRAMEWORK_IDENTIFIERS = ['useHead', 'usePageData', 'useInject'];
7
7
  const RUNTIME_IDENTIFIERS = [
8
8
  'component',
9
9
  'html',
@@ -1 +1 @@
1
- {"version":3,"file":"auto-import.js","sourceRoot":"","sources":["../../../src/plugin/transforms/auto-import.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQjC,MAAM,eAAe,GAAG,0ZAA0Z,CAAA;AAElb,MAAM,iBAAiB,GAAG,mGAAmG,CAAA;AAE7H,MAAM,iBAAiB,GAAG,sFAAsF,CAAA;AAEhH,MAAM,qBAAqB,GAAG,CAAC,SAAS,EAAE,aAAa,CAAC,CAAA;AAExD,MAAM,mBAAmB,GAAG;IAC1B,WAAW;IACX,MAAM;IACN,KAAK;IACL,KAAK;IACL,UAAU;IACV,OAAO;IACP,aAAa;IACb,UAAU;IACV,SAAS;IACT,gBAAgB;IAChB,mBAAmB;IACnB,uBAAuB;IACvB,YAAY;IACZ,UAAU;IACV,iBAAiB;IACjB,gBAAgB;IAChB,WAAW;IACX,UAAU;IACV,SAAS;IACT,QAAQ;IACR,kBAAkB;IAClB,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AAC;AAED;;;GAGG;AACH,SAAS,uBAAuB,CAAC,IAAY;IAC3C,sDAAsD;IACtD,IAAI,IAAI,CAAC,QAAQ,CAAC,wDAAwD,CAAC;QACvE,IAAI,CAAC,QAAQ,CAAC,wDAAwD,CAAC,EAAE,CAAC;QAC5E,OAAO,KAAK,CAAA;IACd,CAAC;IAED,0DAA0D;IAC1D,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE;QACvC,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACzC,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"auto-import.js","sourceRoot":"","sources":["../../../src/plugin/transforms/auto-import.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQjC,MAAM,eAAe,GAAG,0ZAA0Z,CAAA;AAElb,MAAM,iBAAiB,GAAG,mGAAmG,CAAA;AAE7H,MAAM,iBAAiB,GAAG,iGAAiG,CAAA;AAE3H,MAAM,qBAAqB,GAAG,CAAC,SAAS,EAAE,aAAa,EAAE,WAAW,CAAC,CAAA;AAErE,MAAM,mBAAmB,GAAG;IAC1B,WAAW;IACX,MAAM;IACN,KAAK;IACL,KAAK;IACL,UAAU;IACV,OAAO;IACP,aAAa;IACb,UAAU;IACV,SAAS;IACT,gBAAgB;IAChB,mBAAmB;IACnB,uBAAuB;IACvB,YAAY;IACZ,UAAU;IACV,iBAAiB;IACjB,gBAAgB;IAChB,WAAW;IACX,UAAU;IACV,SAAS;IACT,QAAQ;IACR,kBAAkB;IAClB,UAAU;IACV,aAAa;IACb,4BAA4B;IAC5B,iBAAiB;IACjB,YAAY;IACZ,gBAAgB;IAChB,aAAa;CACd,CAAA;AAED,MAAM,qBAAqB,GAAG,CAAC,M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,CAAC,QAAQ,CAAC,wDAAwD,CAAC,EAAE,CAAC;QAC5E,OAAO,KAAK,CAAA;IACd,CAAC;IAED,0DAA0D;IAC1D,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE;QACvC,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACzC,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export { useHead, beginHeadCollection, endHeadCollection, serializeHeadTags } from './use-head.js';
2
2
  export type { HeadInput } from './use-head.js';
3
3
  export { usePageData } from './use-page-data.js';
4
+ export { useInject } from './use-inject.js';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAClG,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAClG,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA"}
@@ -1,3 +1,4 @@
1
1
  export { useHead, beginHeadCollection, endHeadCollection, serializeHeadTags } from './use-head.js';
2
2
  export { usePageData } from './use-page-data.js';
3
+ export { useInject } from './use-inject.js';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAElG,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAElG,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * useInject — reads a value provided by a plugin via plugin.setup()'s provide().
3
+ *
4
+ * Works consistently across all rendering modes:
5
+ *
6
+ * - **SPA/Client**: Uses inject() from the component context tree (established
7
+ * by cer-layout-view calling provide() for each plugin-provided value).
8
+ *
9
+ * - **SSR/SSG**: Reads from globalThis.__cerPluginProvides, populated when the
10
+ * server entry runs plugin.setup() before rendering.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * // In a plugin (app/plugins/my-plugin.ts):
15
+ * export default {
16
+ * name: 'my-plugin',
17
+ * setup({ provide }) {
18
+ * provide('my-service', { greet: () => 'hello' })
19
+ * }
20
+ * }
21
+ *
22
+ * // In a component:
23
+ * component('my-page', () => {
24
+ * const service = useInject<{ greet(): string }>('my-service')
25
+ * })
26
+ * ```
27
+ */
28
+ export declare function useInject<T = unknown>(key: string, defaultValue?: T): T | undefined;
29
+ //# sourceMappingURL=use-inject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-inject.d.ts","sourceRoot":"","sources":["../../../src/runtime/composables/use-inject.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,SAAS,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAgBnF"}
@@ -0,0 +1,48 @@
1
+ import { inject } from '@jasonshimmy/custom-elements-runtime';
2
+ const _g = globalThis;
3
+ const _PROVIDES_KEY = '__cerPluginProvides';
4
+ /**
5
+ * useInject — reads a value provided by a plugin via plugin.setup()'s provide().
6
+ *
7
+ * Works consistently across all rendering modes:
8
+ *
9
+ * - **SPA/Client**: Uses inject() from the component context tree (established
10
+ * by cer-layout-view calling provide() for each plugin-provided value).
11
+ *
12
+ * - **SSR/SSG**: Reads from globalThis.__cerPluginProvides, populated when the
13
+ * server entry runs plugin.setup() before rendering.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * // In a plugin (app/plugins/my-plugin.ts):
18
+ * export default {
19
+ * name: 'my-plugin',
20
+ * setup({ provide }) {
21
+ * provide('my-service', { greet: () => 'hello' })
22
+ * }
23
+ * }
24
+ *
25
+ * // In a component:
26
+ * component('my-page', () => {
27
+ * const service = useInject<{ greet(): string }>('my-service')
28
+ * })
29
+ * ```
30
+ */
31
+ export function useInject(key, defaultValue) {
32
+ // Server-side (SSR/SSG): read from the global plugin provides map.
33
+ // __cerPluginProvides is populated by the server entry before the render pass.
34
+ if (typeof document === 'undefined') {
35
+ const pluginProvides = _g[_PROVIDES_KEY];
36
+ const value = pluginProvides?.get(key);
37
+ return value !== undefined ? value : defaultValue;
38
+ }
39
+ // Client-side: inject() walks the component context tree established by
40
+ // cer-layout-view's provide() calls. Falls back to __cerPluginProvides for
41
+ // reads before cer-layout-view mounts (e.g. during plugin-registered components).
42
+ const value = inject(key);
43
+ if (value !== undefined)
44
+ return value;
45
+ const pluginProvides = _g[_PROVIDES_KEY];
46
+ return pluginProvides?.get(key) ?? defaultValue;
47
+ }
48
+ //# sourceMappingURL=use-inject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-inject.js","sourceRoot":"","sources":["../../../src/runtime/composables/use-inject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAA;AAE7D,MAAM,EAAE,GAAG,UAAqC,CAAA;AAChD,MAAM,aAAa,GAAG,qBAAqB,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,SAAS,CAAc,GAAW,EAAE,YAAgB;IAClE,mEAAmE;IACnE,+EAA+E;IAC/E,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpC,MAAM,cAAc,GAAG,EAAE,CAAC,aAAa,CAA0C,CAAA;QACjF,MAAM,KAAK,GAAG,cAAc,EAAE,GAAG,CAAC,GAAG,CAAC,CAAA;QACtC,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAE,KAAW,CAAC,CAAC,CAAC,YAAY,CAAA;IAC1D,CAAC;IAED,wEAAwE;IACxE,2EAA2E;IAC3E,kFAAkF;IAClF,MAAM,KAAK,GAAG,MAAM,CAAI,GAAG,CAAC,CAAA;IAC5B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAA;IACrC,MAAM,cAAc,GAAG,EAAE,CAAC,aAAa,CAA0C,CAAA;IACjF,OAAQ,cAAc,EAAE,GAAG,CAAC,GAAG,CAAmB,IAAI,YAAY,CAAA;AACpE,CAAC"}
@@ -5,5 +5,5 @@
5
5
  * wires up the routing, and exports a handler compatible with
6
6
  * Express/Fastify/Node http.
7
7
  */
8
- export declare const ENTRY_SERVER_TEMPLATE = "// Server-side entry \u2014 AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app\nimport { readFileSync, existsSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { AsyncLocalStorage } from 'node:async_hooks'\nimport 'virtual:cer-components'\nimport routes from 'virtual:cer-routes'\nimport layouts from 'virtual:cer-layouts'\nimport plugins from 'virtual:cer-plugins'\nimport apiRoutes from 'virtual:cer-server-api'\nimport { registerBuiltinComponents } from '@jasonshimmy/custom-elements-runtime'\nimport { registerEntityMap, DSD_POLYFILL_SCRIPT } from '@jasonshimmy/custom-elements-runtime/ssr'\nimport entitiesJson from '@jasonshimmy/custom-elements-runtime/entities.json'\nimport { initRouter } from '@jasonshimmy/custom-elements-runtime/router'\nimport { createSSRHandler } from '@jasonshimmy/custom-elements-runtime/ssr-middleware'\n\nregisterBuiltinComponents()\n\n// Pre-load the full HTML entity map so named entities like &mdash; decode\n// correctly during SSR. Without this the bundled runtime falls back to a\n// minimal set (&lt;, &gt;, &amp; \u2026) and re-escapes everything else.\nregisterEntityMap(entitiesJson)\n\n// Async-local storage for request-scoped SSR loader data.\n// Using AsyncLocalStorage ensures concurrent SSR renders (e.g. SSG with\n// concurrency > 1) never see each other's data \u2014 each request's async chain\n// carries its own store value, so usePageData() is always race-condition-free.\nconst _cerDataStore = new AsyncLocalStorage()\n// Expose the store so the usePageData() composable can read it server-side.\n;(globalThis).__CER_DATA_STORE__ = _cerDataStore\n\n// Load the Vite-built client index.html (dist/client/index.html) so every SSR\n// response includes the client-side scripts needed for hydration and routing.\n// The server bundle lives at dist/server/server.js, so ../client resolves correctly.\nconst _clientTemplatePath = join(dirname(fileURLToPath(import.meta.url)), '../client/index.html')\nconst _clientTemplate = existsSync(_clientTemplatePath)\n ? readFileSync(_clientTemplatePath, 'utf-8')\n : null\n\n// Merge the SSR handler's full HTML document with the Vite client shell so the\n// final page contains both pre-rendered DSD content and the client bundle scripts.\nfunction _mergeWithClientTemplate(ssrHtml, clientTemplate) {\n const headTag = '<head>', headCloseTag = '</head>'\n const bodyTag = '<body>', bodyCloseTag = '</body>'\n const headStart = ssrHtml.indexOf(headTag)\n const headEnd = ssrHtml.indexOf(headCloseTag)\n const bodyStart = ssrHtml.indexOf(bodyTag)\n const bodyEnd = ssrHtml.lastIndexOf(bodyCloseTag)\n const ssrHead = headStart >= 0 && headEnd > headStart\n ? ssrHtml.slice(headStart + headTag.length, headEnd).trim() : ''\n const ssrBody = bodyStart >= 0 && bodyEnd > bodyStart\n ? ssrHtml.slice(bodyStart + bodyTag.length, bodyEnd).trim() : ssrHtml\n // Hoist only top-level <style id=...> elements (cer-ssr-jit, cer-ssr-global)\n // from the SSR body into the document <head>. Plain <style> blocks without\n // an id attribute belong to shadow DOM templates and must stay in place \u2014\n // hoisting them to <head> breaks shadow DOM style encapsulation (document\n // styles do not pierce shadow roots), which is the root cause of FOUC.\n const headParts = ssrHead ? [ssrHead] : []\n let ssrBodyContent = ssrBody\n let pos = 0\n while (pos < ssrBodyContent.length) {\n const styleOpen = ssrBodyContent.indexOf('<style id=', pos)\n if (styleOpen < 0) break\n const styleClose = ssrBodyContent.indexOf('</style>', styleOpen)\n if (styleClose < 0) break\n headParts.push(ssrBodyContent.slice(styleOpen, styleClose + 8))\n ssrBodyContent = ssrBodyContent.slice(0, styleOpen) + ssrBodyContent.slice(styleClose + 8)\n pos = styleOpen\n }\n ssrBodyContent = ssrBodyContent.trim()\n // Inject the pre-rendered layout+page as light DOM of the app mount element\n // so it is visible before JS boots, then the client router takes over.\n let merged = clientTemplate\n if (merged.includes('<cer-layout-view></cer-layout-view>')) {\n merged = merged.replace('<cer-layout-view></cer-layout-view>',\n '<cer-layout-view>' + ssrBodyContent + '</cer-layout-view>')\n } else if (merged.includes('<div id=\"app\"></div>')) {\n merged = merged.replace('<div id=\"app\"></div>',\n '<div id=\"app\">' + ssrBodyContent + '</div>')\n }\n const headAdditions = headParts.filter(Boolean).join('\\n')\n if (headAdditions) {\n // If SSR provides a <title>, replace the client template's <title> so the\n // SSR title wins (client template title is the fallback default).\n if (headAdditions.includes('<title>')) {\n merged = merged.replace(/<title>[^<]*<\\/title>/, '')\n }\n merged = merged.replace('</head>', headAdditions + '\\n</head>')\n }\n return merged\n}\n\n/**\n * Per-request VNode factory \u2014 initializes a fresh router at the request URL,\n * resolves the active layout from the matched route's meta, pre-loads the\n * matched page component (bypassing the async router-view so DSD renders\n * synchronously), calls the route's data loader (if any), and injects the\n * serialized result into the document head as window.__CER_DATA__ for\n * client-side hydration.\n *\n * createStreamingSSRHandler threads the router through each component's SSR\n * context so concurrent renders never share state.\n */\nconst vnodeFactory = async (req) => {\n const router = initRouter({ routes, initialUrl: req.url ?? '/' })\n const current = router.getCurrent()\n const { route, params } = router.matchRoute(current.path)\n const layoutName = route?.meta?.layout ?? 'default'\n const layoutTag = layouts[layoutName]\n\n // Pre-load the page module so we can embed the component tag directly.\n // This avoids the async router-view (which injects content via script tags\n // and breaks Declarative Shadow DOM on initial parse).\n let pageVnode = { tag: 'div', props: {}, children: [] }\n let head\n if (route?.load) {\n try {\n const mod = await route.load()\n const pageTag = mod.default\n if (pageTag) {\n pageVnode = { tag: pageTag, props: { attrs: { ...params } }, children: [] }\n }\n if (typeof mod.loader === 'function') {\n const query = current.query ?? {}\n const data = await mod.loader({ params, query, req })\n if (data !== undefined && data !== null) {\n // Make data available to usePageData() during the SSR render pass.\n // enterWith() scopes the value to the current async context so\n // concurrent renders (SSG concurrency > 1) never share data.\n _cerDataStore.enterWith(data)\n head = `<script>window.__CER_DATA__ = ${JSON.stringify(data)}</script>`\n }\n }\n } catch {\n // Non-fatal: loader errors fall back to an empty page; client will refetch.\n }\n }\n\n const vnode = layoutTag\n ? { tag: layoutTag, props: {}, children: [pageVnode] }\n : pageVnode\n\n return { vnode, router, head }\n}\n\n// Capture the raw SSR handler and wrap it to merge the response with the\n// Vite client template before sending \u2014 this injects the JS/CSS asset bundles\n// so the browser can hydrate and enable client-side routing.\nconst _rawHandler = createSSRHandler(vnodeFactory, {\n render: { dsd: true, dsdPolyfill: false },\n})\n\n/**\n * The main request handler.\n * Compatible with Express, Fastify, and Node's raw http.createServer.\n *\n * Each request is run inside a fresh _cerDataStore.run() context so that\n * concurrent renders (e.g. SSG with concurrency > 1) get isolated stores.\n * vnodeFactory calls _cerDataStore.enterWith(loaderData) from within this\n * context, making the data visible to usePageData() during SSR rendering\n * without any global-state races.\n */\nexport const handler = async (req, res) => {\n if (!_clientTemplate) {\n // No client template \u2014 run handler normally, then inject DSD polyfill.\n let _html = ''\n await _cerDataStore.run(null, async () => {\n await _rawHandler(req, { setHeader: () => {}, end: (body) => { _html = body } })\n })\n // Inject DSD polyfill at end of <body>, outside any custom element light DOM.\n const _final = _html.includes('</body>')\n ? _html.replace('</body>', DSD_POLYFILL_SCRIPT + '</body>')\n : _html + DSD_POLYFILL_SCRIPT\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n return res.end(_final)\n }\n let _capturedHtml = ''\n // Wrap _rawHandler in an isolated async-local-storage context so that\n // vnodeFactory's enterWith() call is scoped to this request only.\n await _cerDataStore.run(null, async () => {\n // Omit write() to force the non-streaming collect-then-end code path.\n await _rawHandler(req, { setHeader: () => {}, end: (body) => { _capturedHtml = body } })\n })\n let _merged = _mergeWithClientTemplate(_capturedHtml, _clientTemplate)\n // Inject DSD polyfill at end of <body>, outside <cer-layout-view> light DOM.\n _merged = _merged.includes('</body>')\n ? _merged.replace('</body>', DSD_POLYFILL_SCRIPT + '</body>')\n : _merged + DSD_POLYFILL_SCRIPT\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n res.end(_merged)\n}\n\nexport { apiRoutes, plugins, layouts, routes }\nexport default handler\n";
8
+ export declare const ENTRY_SERVER_TEMPLATE = "// Server-side entry \u2014 AUTO-GENERATED by @jasonshimmy/vite-plugin-cer-app\nimport { readFileSync, existsSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { AsyncLocalStorage } from 'node:async_hooks'\nimport 'virtual:cer-components'\nimport routes from 'virtual:cer-routes'\nimport layouts from 'virtual:cer-layouts'\nimport plugins from 'virtual:cer-plugins'\nimport apiRoutes from 'virtual:cer-server-api'\nimport { registerBuiltinComponents } from '@jasonshimmy/custom-elements-runtime'\nimport { registerEntityMap, DSD_POLYFILL_SCRIPT } from '@jasonshimmy/custom-elements-runtime/ssr'\nimport entitiesJson from '@jasonshimmy/custom-elements-runtime/entities.json'\nimport { initRouter } from '@jasonshimmy/custom-elements-runtime/router'\nimport { createSSRHandler } from '@jasonshimmy/custom-elements-runtime/ssr-middleware'\n\nregisterBuiltinComponents()\n\n// Pre-load the full HTML entity map so named entities like &mdash; decode\n// correctly during SSR. Without this the bundled runtime falls back to a\n// minimal set (&lt;, &gt;, &amp; \u2026) and re-escapes everything else.\nregisterEntityMap(entitiesJson)\n\n// Run plugins once at server startup so their provide() values are available\n// to useInject() during every SSR render pass. Stored on globalThis so all\n// dynamically-imported page chunks share the same reference (same pattern as\n// __CER_HEAD_COLLECTOR__ and __CER_DATA_STORE__).\nconst _pluginProvides = new Map()\n;(globalThis).__cerPluginProvides = _pluginProvides\nconst _pluginsReady = (async () => {\n const _bootstrapRouter = initRouter({ routes })\n for (const plugin of plugins) {\n if (plugin && typeof plugin.setup === 'function') {\n await plugin.setup({\n router: _bootstrapRouter,\n provide: (key, value) => _pluginProvides.set(key, value),\n config: {},\n })\n }\n }\n})()\n\n// Async-local storage for request-scoped SSR loader data.\n// Using AsyncLocalStorage ensures concurrent SSR renders (e.g. SSG with\n// concurrency > 1) never see each other's data \u2014 each request's async chain\n// carries its own store value, so usePageData() is always race-condition-free.\nconst _cerDataStore = new AsyncLocalStorage()\n// Expose the store so the usePageData() composable can read it server-side.\n;(globalThis).__CER_DATA_STORE__ = _cerDataStore\n\n// Load the Vite-built client index.html (dist/client/index.html) so every SSR\n// response includes the client-side scripts needed for hydration and routing.\n// The server bundle lives at dist/server/server.js, so ../client resolves correctly.\nconst _clientTemplatePath = join(dirname(fileURLToPath(import.meta.url)), '../client/index.html')\nconst _clientTemplate = existsSync(_clientTemplatePath)\n ? readFileSync(_clientTemplatePath, 'utf-8')\n : null\n\n// Merge the SSR handler's full HTML document with the Vite client shell so the\n// final page contains both pre-rendered DSD content and the client bundle scripts.\nfunction _mergeWithClientTemplate(ssrHtml, clientTemplate) {\n const headTag = '<head>', headCloseTag = '</head>'\n const bodyTag = '<body>', bodyCloseTag = '</body>'\n const headStart = ssrHtml.indexOf(headTag)\n const headEnd = ssrHtml.indexOf(headCloseTag)\n const bodyStart = ssrHtml.indexOf(bodyTag)\n const bodyEnd = ssrHtml.lastIndexOf(bodyCloseTag)\n const ssrHead = headStart >= 0 && headEnd > headStart\n ? ssrHtml.slice(headStart + headTag.length, headEnd).trim() : ''\n const ssrBody = bodyStart >= 0 && bodyEnd > bodyStart\n ? ssrHtml.slice(bodyStart + bodyTag.length, bodyEnd).trim() : ssrHtml\n // Hoist only top-level <style id=...> elements (cer-ssr-jit, cer-ssr-global)\n // from the SSR body into the document <head>. Plain <style> blocks without\n // an id attribute belong to shadow DOM templates and must stay in place \u2014\n // hoisting them to <head> breaks shadow DOM style encapsulation (document\n // styles do not pierce shadow roots), which is the root cause of FOUC.\n const headParts = ssrHead ? [ssrHead] : []\n let ssrBodyContent = ssrBody\n let pos = 0\n while (pos < ssrBodyContent.length) {\n const styleOpen = ssrBodyContent.indexOf('<style id=', pos)\n if (styleOpen < 0) break\n const styleClose = ssrBodyContent.indexOf('</style>', styleOpen)\n if (styleClose < 0) break\n headParts.push(ssrBodyContent.slice(styleOpen, styleClose + 8))\n ssrBodyContent = ssrBodyContent.slice(0, styleOpen) + ssrBodyContent.slice(styleClose + 8)\n pos = styleOpen\n }\n ssrBodyContent = ssrBodyContent.trim()\n // Inject the pre-rendered layout+page as light DOM of the app mount element\n // so it is visible before JS boots, then the client router takes over.\n let merged = clientTemplate\n if (merged.includes('<cer-layout-view></cer-layout-view>')) {\n merged = merged.replace('<cer-layout-view></cer-layout-view>',\n '<cer-layout-view>' + ssrBodyContent + '</cer-layout-view>')\n } else if (merged.includes('<div id=\"app\"></div>')) {\n merged = merged.replace('<div id=\"app\"></div>',\n '<div id=\"app\">' + ssrBodyContent + '</div>')\n }\n const headAdditions = headParts.filter(Boolean).join('\\n')\n if (headAdditions) {\n // If SSR provides a <title>, replace the client template's <title> so the\n // SSR title wins (client template title is the fallback default).\n if (headAdditions.includes('<title>')) {\n merged = merged.replace(/<title>[^<]*<\\/title>/, '')\n }\n merged = merged.replace('</head>', headAdditions + '\\n</head>')\n }\n return merged\n}\n\n/**\n * Per-request VNode factory \u2014 initializes a fresh router at the request URL,\n * resolves the active layout from the matched route's meta, pre-loads the\n * matched page component (bypassing the async router-view so DSD renders\n * synchronously), calls the route's data loader (if any), and injects the\n * serialized result into the document head as window.__CER_DATA__ for\n * client-side hydration.\n *\n * createStreamingSSRHandler threads the router through each component's SSR\n * context so concurrent renders never share state.\n */\nconst vnodeFactory = async (req) => {\n await _pluginsReady\n const router = initRouter({ routes, initialUrl: req.url ?? '/' })\n const current = router.getCurrent()\n const { route, params } = router.matchRoute(current.path)\n const layoutName = route?.meta?.layout ?? 'default'\n const layoutTag = layouts[layoutName]\n\n // Pre-load the page module so we can embed the component tag directly.\n // This avoids the async router-view (which injects content via script tags\n // and breaks Declarative Shadow DOM on initial parse).\n let pageVnode = { tag: 'div', props: {}, children: [] }\n let head\n if (route?.load) {\n try {\n const mod = await route.load()\n const pageTag = mod.default\n if (pageTag) {\n pageVnode = { tag: pageTag, props: { attrs: { ...params } }, children: [] }\n }\n if (typeof mod.loader === 'function') {\n const query = current.query ?? {}\n const data = await mod.loader({ params, query, req })\n if (data !== undefined && data !== null) {\n // Make data available to usePageData() during the SSR render pass.\n // enterWith() scopes the value to the current async context so\n // concurrent renders (SSG concurrency > 1) never share data.\n _cerDataStore.enterWith(data)\n head = `<script>window.__CER_DATA__ = ${JSON.stringify(data)}</script>`\n }\n }\n } catch {\n // Non-fatal: loader errors fall back to an empty page; client will refetch.\n }\n }\n\n const vnode = layoutTag\n ? { tag: layoutTag, props: {}, children: [pageVnode] }\n : pageVnode\n\n return { vnode, router, head }\n}\n\n// Capture the raw SSR handler and wrap it to merge the response with the\n// Vite client template before sending \u2014 this injects the JS/CSS asset bundles\n// so the browser can hydrate and enable client-side routing.\nconst _rawHandler = createSSRHandler(vnodeFactory, {\n render: { dsd: true, dsdPolyfill: false },\n})\n\n/**\n * The main request handler.\n * Compatible with Express, Fastify, and Node's raw http.createServer.\n *\n * Each request is run inside a fresh _cerDataStore.run() context so that\n * concurrent renders (e.g. SSG with concurrency > 1) get isolated stores.\n * vnodeFactory calls _cerDataStore.enterWith(loaderData) from within this\n * context, making the data visible to usePageData() during SSR rendering\n * without any global-state races.\n */\nexport const handler = async (req, res) => {\n if (!_clientTemplate) {\n // No client template \u2014 run handler normally, then inject DSD polyfill.\n let _html = ''\n await _cerDataStore.run(null, async () => {\n await _rawHandler(req, { setHeader: () => {}, end: (body) => { _html = body } })\n })\n // Inject DSD polyfill at end of <body>, outside any custom element light DOM.\n const _final = _html.includes('</body>')\n ? _html.replace('</body>', DSD_POLYFILL_SCRIPT + '</body>')\n : _html + DSD_POLYFILL_SCRIPT\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n return res.end(_final)\n }\n let _capturedHtml = ''\n // Wrap _rawHandler in an isolated async-local-storage context so that\n // vnodeFactory's enterWith() call is scoped to this request only.\n await _cerDataStore.run(null, async () => {\n // Omit write() to force the non-streaming collect-then-end code path.\n await _rawHandler(req, { setHeader: () => {}, end: (body) => { _capturedHtml = body } })\n })\n let _merged = _mergeWithClientTemplate(_capturedHtml, _clientTemplate)\n // Inject DSD polyfill at end of <body>, outside <cer-layout-view> light DOM.\n _merged = _merged.includes('</body>')\n ? _merged.replace('</body>', DSD_POLYFILL_SCRIPT + '</body>')\n : _merged + DSD_POLYFILL_SCRIPT\n res.setHeader('Content-Type', 'text/html; charset=utf-8')\n res.end(_merged)\n}\n\nexport { apiRoutes, plugins, layouts, routes }\nexport default handler\n";
9
9
  //# sourceMappingURL=entry-server-template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entry-server-template.d.ts","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,2qSAkMjC,CAAA"}
1
+ {"version":3,"file":"entry-server-template.d.ts","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,m6TAsNjC,CAAA"}
@@ -28,6 +28,25 @@ registerBuiltinComponents()
28
28
  // minimal set (&lt;, &gt;, &amp; …) and re-escapes everything else.
29
29
  registerEntityMap(entitiesJson)
30
30
 
31
+ // Run plugins once at server startup so their provide() values are available
32
+ // to useInject() during every SSR render pass. Stored on globalThis so all
33
+ // dynamically-imported page chunks share the same reference (same pattern as
34
+ // __CER_HEAD_COLLECTOR__ and __CER_DATA_STORE__).
35
+ const _pluginProvides = new Map()
36
+ ;(globalThis).__cerPluginProvides = _pluginProvides
37
+ const _pluginsReady = (async () => {
38
+ const _bootstrapRouter = initRouter({ routes })
39
+ for (const plugin of plugins) {
40
+ if (plugin && typeof plugin.setup === 'function') {
41
+ await plugin.setup({
42
+ router: _bootstrapRouter,
43
+ provide: (key, value) => _pluginProvides.set(key, value),
44
+ config: {},
45
+ })
46
+ }
47
+ }
48
+ })()
49
+
31
50
  // Async-local storage for request-scoped SSR loader data.
32
51
  // Using AsyncLocalStorage ensures concurrent SSR renders (e.g. SSG with
33
52
  // concurrency > 1) never see each other's data — each request's async chain
@@ -109,6 +128,7 @@ function _mergeWithClientTemplate(ssrHtml, clientTemplate) {
109
128
  * context so concurrent renders never share state.
110
129
  */
111
130
  const vnodeFactory = async (req) => {
131
+ await _pluginsReady
112
132
  const router = initRouter({ routes, initialUrl: req.url ?? '/' })
113
133
  const current = router.getCurrent()
114
134
  const { route, params } = router.matchRoute(current.path)
@@ -1 +1 @@
1
- {"version":3,"file":"entry-server-template.js","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkMpC,CAAA"}
1
+ {"version":3,"file":"entry-server-template.js","sourceRoot":"","sources":["../../src/runtime/entry-server-template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsNpC,CAAA"}
@@ -104,3 +104,40 @@ export function useSession() { return session }
104
104
  ```
105
105
 
106
106
  Use `useOnConnected` or lazy initialization inside the function body for side effects.
107
+
108
+ ---
109
+
110
+ ## Built-in framework composables
111
+
112
+ These composables are provided by the framework and auto-imported alongside the runtime. They do **not** live in `app/composables/` — they are injected from `@jasonshimmy/vite-plugin-cer-app/composables`.
113
+
114
+ ### `useHead(input)`
115
+
116
+ Sets document head tags (`<title>`, `<meta>`, `<link>`, etc.). Works in SPA, SSR, and SSG modes. See [head-management.md](./head-management.md).
117
+
118
+ ### `usePageData<T>()`
119
+
120
+ Returns the serialized loader data for the current page, hydrated from `window.__CER_DATA__` on the client or from the per-request `AsyncLocalStorage` context during SSR/SSG. See [data-loading.md](./data-loading.md).
121
+
122
+ ### `useInject<T>(key, defaultValue?)`
123
+
124
+ Reads a value provided by a plugin via `app.provide(key, value)`. Works consistently in all rendering modes:
125
+
126
+ - **SPA / client** — resolves via `inject()` from the component context tree.
127
+ - **SSR / SSG** — reads from `globalThis.__cerPluginProvides`, populated by the server entry before the first render.
128
+
129
+ ```ts
130
+ // app/pages/dashboard.ts
131
+ component('page-dashboard', () => {
132
+ const store = useInject<Store>('store')
133
+ return html`<p>Count: ${store?.state.count ?? 0}</p>`
134
+ })
135
+ ```
136
+
137
+ If you need it outside auto-imported directories, import explicitly:
138
+
139
+ ```ts
140
+ import { useInject } from '@jasonshimmy/vite-plugin-cer-app/composables'
141
+ ```
142
+
143
+ > **Note:** Prefer `useInject` over the raw `inject()` primitive whenever reading plugin-provided values. Raw `inject()` works in SPA mode but returns `undefined` in SSR and SSG because the server renders components without `<cer-layout-view>`'s provide context.
package/docs/plugins.md CHANGED
@@ -31,9 +31,9 @@ interface AppPlugin {
31
31
  }
32
32
 
33
33
  interface AppContext {
34
- provide(key: string, value: unknown): void
34
+ provide(key: PropertyKey, value: unknown): void
35
35
  router: Router
36
- config: ResolvedCerConfig
36
+ config: CerAppConfig
37
37
  }
38
38
  ```
39
39
 
@@ -75,8 +75,8 @@ export default {
75
75
  ```ts
76
76
  // app/pages/index.ts
77
77
  component('page-index', () => {
78
- const store = inject('store')
79
- const count = computed(() => store.state.count)
78
+ const store = useInject<Store>('store')
79
+ const count = computed(() => store?.state.count ?? 0)
80
80
 
81
81
  return html`<p>Count: ${count}</p>`
82
82
  })
@@ -120,20 +120,14 @@ export default {
120
120
 
121
121
  ---
122
122
 
123
- ## SSG and `inject()`
123
+ ## Reading provided values with `useInject`
124
124
 
125
- In SSG mode there is a timing subtlety: the router loads a page chunk and renders it before `<cer-layout-view>` has called `provide()`. This means `inject()` may return `undefined` on the first render in SSGeven though the plugin ran and called `app.provide()` correctly.
126
-
127
- To write pages that work correctly in **all three modes** (SPA, SSR, SSG), use `globalThis.__cerPluginProvides` as a synchronous fallback when `inject()` returns `undefined`:
125
+ To read values provided by a plugin, use `useInject` instead of the raw `inject()` from the runtime. `useInject` works correctly in **all three modes**SPA, SSR, and SSG:
128
126
 
129
127
  ```ts
130
128
  // app/pages/dashboard.ts
131
129
  component('page-dashboard', () => {
132
- // inject() resolves correctly in SPA and SSR modes.
133
- // In SSG the page chunk may render before cer-layout-view calls provide(),
134
- // so fall back to the global map that app/app.ts populates before any render.
135
- const pluginProvides = (globalThis as any).__cerPluginProvides as Map<string, unknown> | undefined
136
- const store = inject<Store>('store') ?? pluginProvides?.get('store') as Store | undefined
130
+ const store = useInject<Store>('store')
137
131
 
138
132
  if (!store) return html`<p>Loading…</p>`
139
133
 
@@ -141,7 +135,21 @@ component('page-dashboard', () => {
141
135
  })
142
136
  ```
143
137
 
144
- The `__cerPluginProvides` map is written by the bootstrapped `app/app.ts` before any route is rendered, so it is always available as a synchronous fallback regardless of render order.
138
+ `useInject` is auto-imported in `app/pages/`, `app/layouts/`, and `app/components/` no explicit import needed.
139
+
140
+ **Why not raw `inject()`?** In SSR and SSG modes the server renders the component tree directly, without `<cer-layout-view>` establishing the Vue-style provide context. `useInject` bridges this gap:
141
+
142
+ | Mode | How the value is resolved |
143
+ |------|--------------------------|
144
+ | SPA / client | `inject()` walks the component tree (provided by `<cer-layout-view>`) |
145
+ | SSR (dev & prod) | reads from `globalThis.__cerPluginProvides` (set by the server entry at startup) |
146
+ | SSG | same as SSR |
147
+
148
+ If you need `useInject` outside of auto-imported directories, import it explicitly:
149
+
150
+ ```ts
151
+ import { useInject } from '@jasonshimmy/vite-plugin-cer-app/composables'
152
+ ```
145
153
 
146
154
  ---
147
155
 
@@ -154,7 +162,7 @@ import plugins from 'virtual:cer-plugins'
154
162
  // plugins is an array of AppPlugin objects in load order
155
163
  ```
156
164
 
157
- In `app/app.ts`, plugins are executed sequentially before the router initializes:
165
+ In `.cer/app.ts` (the auto-generated framework entry), plugins are executed sequentially before the router initializes:
158
166
 
159
167
  ```ts
160
168
  for (const plugin of plugins) {
@@ -83,7 +83,7 @@ dist/
83
83
 
84
84
  ```ts
85
85
  export const handler: (req, res) => void // main request handler
86
- export { apiRoutes, middleware, plugins, layouts, routes }
86
+ export { apiRoutes, plugins, layouts }
87
87
  export default handler
88
88
  ```
89
89
 
package/docs/testing.md CHANGED
@@ -223,12 +223,12 @@ Use in a page:
223
223
  ```ts
224
224
  // app/pages/index.ts
225
225
  component('page-index', () => {
226
- const greeting = inject('greeting')
226
+ const greeting = useInject<string>('greeting')
227
227
  return html`<p>${greeting}</p>`
228
228
  })
229
229
  ```
230
230
 
231
- **Expected:** Page shows the injected string.
231
+ **Expected:** Page shows the injected string in all three modes (SPA, SSR, SSG). `useInject` is auto-imported — no explicit import needed.
232
232
 
233
233
  ---
234
234
 
@@ -428,7 +428,7 @@ cat dist/items/1/index.html # should contain "Item 1"
428
428
 
429
429
  ## 14. Run the automated test suite
430
430
 
431
- The framework ships with 211 unit and integration tests:
431
+ The framework ships with unit and integration tests. Run them with:
432
432
 
433
433
  ```sh
434
434
  cd /path/to/@jasonshimmy/vite-plugin-cer-app
@@ -1,9 +1,5 @@
1
1
  component('page-protected', () => {
2
- // inject() works for SSR and client-side navigations; fall back to the
3
- // globalThis store for SSG where router-view loads the chunk before
4
- // cer-layout-view has had a chance to call provide().
5
- const appProvides = (globalThis as any).__cerPluginProvides as Map<string, unknown> | undefined
6
- const greeting = inject<string>('ks-greeting') ?? appProvides?.get('ks-greeting') as string | undefined ?? 'No greeting'
2
+ const greeting = useInject<string>('ks-greeting', 'No greeting')
7
3
 
8
4
  return html`
9
5
  <div>
@@ -40,6 +40,7 @@ declare global {
40
40
 
41
41
  const useHead: typeof import('@jasonshimmy/vite-plugin-cer-app/composables')['useHead']
42
42
  const usePageData: typeof import('@jasonshimmy/vite-plugin-cer-app/composables')['usePageData']
43
+ const useInject: typeof import('@jasonshimmy/vite-plugin-cer-app/composables')['useInject']
43
44
 
44
45
  const useKsCounter: typeof import('./app/composables/useKsCounter')['useKsCounter']
45
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jasonshimmy/vite-plugin-cer-app",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Nuxt-style meta-framework for @jasonshimmy/custom-elements-runtime",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -133,6 +133,16 @@ describe('build-ssr generateServerEntryCode (template content)', () => {
133
133
  it('sets Content-Type header on response', () => {
134
134
  expect(src).toContain('text/html; charset=utf-8')
135
135
  })
136
+
137
+ it('template initializes plugins and sets globalThis.__cerPluginProvides', () => {
138
+ expect(src).toContain('__cerPluginProvides')
139
+ expect(src).toContain('_pluginProvides')
140
+ expect(src).toContain('_pluginsReady')
141
+ })
142
+
143
+ it('template awaits _pluginsReady before handling each request', () => {
144
+ expect(src).toContain('await _pluginsReady')
145
+ })
136
146
  })
137
147
 
138
148
  describe('buildSSR', () => {
@@ -37,6 +37,7 @@ vi.mock('../../plugin/virtual/error.js', () => ({ generateErrorCode: vi.fn().moc
37
37
  vi.mock('../../plugin/transforms/auto-import.js', () => ({ autoImportTransform: vi.fn().mockReturnValue(null) }))
38
38
 
39
39
  import { cerApp } from '../../plugin/index.js'
40
+ import { APP_ENTRY_TEMPLATE } from '../../runtime/app-template.js'
40
41
 
41
42
 
42
43
  type TestPlugin = {
@@ -142,6 +143,12 @@ describe('cerApp plugin — resolveId hook', () => {
142
143
  expect(plugin.resolveId('virtual:cer-error')).toBe('\0virtual:cer-error')
143
144
  })
144
145
 
146
+ it('resolves /.cer/app.ts to \\0cer-app-entry (virtual, bypasses fs security)', () => {
147
+ const plugin = getCerPlugin()
148
+ plugin.config({ root: '/project' }, { command: 'serve', mode: 'development' })
149
+ expect(plugin.resolveId('/.cer/app.ts')).toBe('\0cer-app-entry')
150
+ })
151
+
145
152
  it('returns undefined for unknown ids', () => {
146
153
  const plugin = getCerPlugin()
147
154
  plugin.config({ root: '/project' }, { command: 'serve', mode: 'development' })
@@ -150,6 +157,14 @@ describe('cerApp plugin — resolveId hook', () => {
150
157
  })
151
158
 
152
159
  describe('cerApp plugin — load hook', () => {
160
+ it('loads \\0cer-app-entry with APP_ENTRY_TEMPLATE content', async () => {
161
+ const plugin = getCerPlugin()
162
+ plugin.config({ root: '/project' }, { command: 'serve', mode: 'development' })
163
+ plugin.configResolved(FAKE_RESOLVED)
164
+ const result = await plugin.load('\0cer-app-entry')
165
+ expect(result).toBe(APP_ENTRY_TEMPLATE)
166
+ })
167
+
153
168
  it('returns null for unknown resolved ids', async () => {
154
169
  const plugin = getCerPlugin()
155
170
  plugin.config({ root: '/project' }, { command: 'serve', mode: 'development' })
@@ -163,6 +163,11 @@ describe('generateAutoImportDts', () => {
163
163
  expect(dts).toContain("const usePageData: typeof import('@jasonshimmy/vite-plugin-cer-app/composables')['usePageData']")
164
164
  })
165
165
 
166
+ it('declares useInject as a framework global', async () => {
167
+ const dts = await generateAutoImportDts(ROOT, COMPOSABLES_DIR)
168
+ expect(dts).toContain("const useInject: typeof import('@jasonshimmy/vite-plugin-cer-app/composables')['useInject']")
169
+ })
170
+
166
171
  it('declares when directive as a global', async () => {
167
172
  const dts = await generateAutoImportDts(ROOT, COMPOSABLES_DIR)
168
173
  expect(dts).toContain("const when: typeof import('@jasonshimmy/custom-elements-runtime/directives')['when']")
@@ -0,0 +1,24 @@
1
+ import { describe, it, expect } from 'vitest'
2
+ import { readFileSync } from 'node:fs'
3
+ import { resolve } from 'pathe'
4
+
5
+ const src = readFileSync(
6
+ resolve(import.meta.dirname, '../../runtime/entry-server-template.ts'),
7
+ 'utf-8',
8
+ )
9
+
10
+ describe('entry-server-template (ENTRY_SERVER_TEMPLATE content)', () => {
11
+ it('template imports plugins from virtual:cer-plugins', () => {
12
+ expect(src).toContain('virtual:cer-plugins')
13
+ })
14
+
15
+ it('template initializes plugins and sets globalThis.__cerPluginProvides', () => {
16
+ expect(src).toContain('__cerPluginProvides')
17
+ expect(src).toContain('_pluginProvides')
18
+ expect(src).toContain('_pluginsReady')
19
+ })
20
+
21
+ it('template awaits _pluginsReady before handling each request', () => {
22
+ expect(src).toContain('await _pluginsReady')
23
+ })
24
+ })
@@ -221,6 +221,13 @@ describe('autoImportTransform — framework composable injection', () => {
221
221
  expect(count).toBe(1)
222
222
  })
223
223
 
224
+ it('injects useInject import when useInject is used', () => {
225
+ const code = "component('page-about', () => { const svc = useInject('my-service'); return html`<div></div>` })"
226
+ const result = autoImportTransform(code, '/project/app/pages/about.ts', opts)!
227
+ expect(result).toContain(`from ${FRAMEWORK_PKG}`)
228
+ expect(result).toContain('useInject')
229
+ })
230
+
224
231
  it('injects usePageData for root-level convention files (loading.ts, error.ts)', () => {
225
232
  const code = "component('page-loading', () => { const d = usePageData(); return html`<div></div>` })"
226
233
  const result = autoImportTransform(code, '/project/app/loading.ts', opts)!
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @vitest-environment happy-dom
3
+ *
4
+ * Tests for useInject — client-side path.
5
+ *
6
+ * Runs in happy-dom so `document` is defined, putting useInject() on the
7
+ * client branch. inject() from the runtime is mocked since it requires a
8
+ * live component context that doesn't exist in unit tests.
9
+ */
10
+ import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest'
11
+
12
+ vi.mock('@jasonshimmy/custom-elements-runtime', () => ({
13
+ inject: vi.fn(),
14
+ }))
15
+
16
+ import { inject } from '@jasonshimmy/custom-elements-runtime'
17
+ import { useInject } from '../../runtime/composables/use-inject.js'
18
+
19
+ const _g = globalThis as Record<string, unknown>
20
+
21
+ describe('useInject — client-side', () => {
22
+ beforeEach(() => {
23
+ delete _g['__cerPluginProvides']
24
+ vi.mocked(inject).mockReturnValue(undefined)
25
+ })
26
+
27
+ afterEach(() => {
28
+ delete _g['__cerPluginProvides']
29
+ })
30
+
31
+ it('returns the value from inject() when the component context has it', () => {
32
+ vi.mocked(inject).mockReturnValue('injected-value')
33
+ expect(useInject('my-key')).toBe('injected-value')
34
+ })
35
+
36
+ it('falls back to __cerPluginProvides when inject() returns undefined', () => {
37
+ _g['__cerPluginProvides'] = new Map([['my-key', 'plugin-provided']])
38
+ expect(useInject('my-key')).toBe('plugin-provided')
39
+ })
40
+
41
+ it('inject() result takes priority over __cerPluginProvides', () => {
42
+ vi.mocked(inject).mockReturnValue('inject-wins')
43
+ _g['__cerPluginProvides'] = new Map([['my-key', 'global-value']])
44
+ expect(useInject('my-key')).toBe('inject-wins')
45
+ })
46
+
47
+ it('returns defaultValue when inject() and provides both miss', () => {
48
+ expect(useInject('missing', 'default')).toBe('default')
49
+ })
50
+
51
+ it('returns undefined when inject() and provides both miss with no defaultValue', () => {
52
+ expect(useInject('missing')).toBeUndefined()
53
+ })
54
+
55
+ it('returns defaultValue when inject() returns undefined and key is absent from provides', () => {
56
+ _g['__cerPluginProvides'] = new Map()
57
+ expect(useInject('missing', 42)).toBe(42)
58
+ })
59
+
60
+ it('is generic and preserves the typed shape from inject()', () => {
61
+ interface Service { call(): string }
62
+ const svc: Service = { call: () => 'ok' }
63
+ vi.mocked(inject).mockReturnValue(svc)
64
+ const result = useInject<Service>('svc')
65
+ expect(result?.call()).toBe('ok')
66
+ })
67
+ })
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Tests for useInject — server-side (SSR/SSG) path.
3
+ *
4
+ * This file runs in the default 'node' environment where `document` is
5
+ * undefined, so useInject() always takes the SSR branch: reading from
6
+ * globalThis.__cerPluginProvides.
7
+ */
8
+ import { describe, it, expect, beforeEach, afterEach } from 'vitest'
9
+ import { useInject } from '../../runtime/composables/use-inject.js'
10
+
11
+ const _g = globalThis as Record<string, unknown>
12
+
13
+ describe('useInject — server-side (SSR/SSG)', () => {
14
+ beforeEach(() => {
15
+ delete _g['__cerPluginProvides']
16
+ })
17
+
18
+ afterEach(() => {
19
+ delete _g['__cerPluginProvides']
20
+ })
21
+
22
+ it('returns value from __cerPluginProvides when key is present', () => {
23
+ _g['__cerPluginProvides'] = new Map([['my-service', { greet: () => 'hello' }]])
24
+ const result = useInject<{ greet(): string }>('my-service')
25
+ expect(typeof result?.greet).toBe('function')
26
+ expect(result?.greet()).toBe('hello')
27
+ })
28
+
29
+ it('returns defaultValue when key is absent from the provides map', () => {
30
+ _g['__cerPluginProvides'] = new Map()
31
+ expect(useInject('missing', 'fallback')).toBe('fallback')
32
+ })
33
+
34
+ it('returns undefined when key is absent and no defaultValue is given', () => {
35
+ _g['__cerPluginProvides'] = new Map()
36
+ expect(useInject('missing')).toBeUndefined()
37
+ })
38
+
39
+ it('returns undefined when __cerPluginProvides is not set at all', () => {
40
+ expect(useInject('my-service')).toBeUndefined()
41
+ })
42
+
43
+ it('returns defaultValue when __cerPluginProvides is not set and defaultValue is given', () => {
44
+ expect(useInject('my-service', 'default')).toBe('default')
45
+ })
46
+
47
+ it('is generic and preserves the typed shape', () => {
48
+ interface Store { count: number }
49
+ const store: Store = { count: 42 }
50
+ _g['__cerPluginProvides'] = new Map([['store', store]])
51
+ const result = useInject<Store>('store')
52
+ expect(result?.count).toBe(42)
53
+ })
54
+
55
+ it('is safe to call multiple times — does not consume the value', () => {
56
+ _g['__cerPluginProvides'] = new Map([['key', 'value']])
57
+ expect(useInject('key')).toBe('value')
58
+ expect(useInject('key')).toBe('value')
59
+ })
60
+
61
+ it('supports multiple keys independently', () => {
62
+ _g['__cerPluginProvides'] = new Map([['a', 1], ['b', 2]])
63
+ expect(useInject('a')).toBe(1)
64
+ expect(useInject('b')).toBe(2)
65
+ })
66
+ })
@@ -50,6 +50,23 @@ registerBuiltinComponents()
50
50
  // minimal set (&lt;, &gt;, &amp; …) and re-escapes everything else.
51
51
  registerEntityMap(entitiesJson)
52
52
 
53
+ // Run plugins once at server startup so their provide() values are available
54
+ // to useInject() during every SSR/SSG render pass.
55
+ const _pluginProvides = new Map()
56
+ ;(globalThis).__cerPluginProvides = _pluginProvides
57
+ const _pluginsReady = (async () => {
58
+ const _bootstrapRouter = initRouter({ routes })
59
+ for (const plugin of plugins) {
60
+ if (plugin && typeof plugin.setup === 'function') {
61
+ await plugin.setup({
62
+ router: _bootstrapRouter,
63
+ provide: (key, value) => _pluginProvides.set(key, value),
64
+ config: {},
65
+ })
66
+ }
67
+ }
68
+ })()
69
+
53
70
  // Load the Vite-built client index.html (dist/client/index.html) so every SSR
54
71
  // response includes the client-side scripts needed for hydration and routing.
55
72
  // The server bundle lives at dist/server/server.js, so ../client resolves correctly.
@@ -119,6 +136,7 @@ function _mergeWithClientTemplate(ssrHtml, clientTemplate) {
119
136
  // synchronously right before renderToStringWithJITCSS — guaranteeing that
120
137
  // concurrent renders (SSG concurrency > 1) never race on a shared global.
121
138
  const _prepareRequest = async (req) => {
139
+ await _pluginsReady
122
140
  const router = initRouter({ routes, initialUrl: req.url ?? '/' })
123
141
  const current = router.getCurrent()
124
142
  const { route, params } = router.matchRoute(current.path)
@@ -76,7 +76,7 @@ const RUNTIME_GLOBALS = [
76
76
 
77
77
  const DIRECTIVE_GLOBALS = ['when', 'each', 'match', 'anchorBlock']
78
78
 
79
- const FRAMEWORK_GLOBALS = ['useHead', 'usePageData']
79
+ const FRAMEWORK_GLOBALS = ['useHead', 'usePageData', 'useInject']
80
80
 
81
81
  /**
82
82
  * Scans a composables directory and returns a map of export name → file path.
@@ -8,6 +8,7 @@ import { autoImportTransform } from './transforms/auto-import.js'
8
8
  import { scanComposableExports, writeAutoImportDts, writeTsconfigPaths } from './dts-generator.js'
9
9
  import { configureCerDevServer } from './dev-server.js'
10
10
  import { writeGeneratedDir, getGeneratedDir } from './generated-dir.js'
11
+ import { APP_ENTRY_TEMPLATE } from '../runtime/app-template.js'
11
12
  import { generateRoutesCode } from './virtual/routes.js'
12
13
  import { generateLayoutsCode } from './virtual/layouts.js'
13
14
  import { generateComponentsCode } from './virtual/components.js'
@@ -40,6 +41,11 @@ const RESOLVED_IDS = Object.fromEntries(
40
41
  Object.entries(VIRTUAL_IDS).map(([k, v]) => [k, `\0${v}`]),
41
42
  ) as Record<keyof typeof VIRTUAL_IDS, string>
42
43
 
44
+ // The generated app entry is served as a virtual module so Vite doesn't need
45
+ // to find it on disk (Vite's fs security policy blocks paths starting with `/.`).
46
+ const APP_ENTRY_URL = '/.cer/app.ts'
47
+ const RESOLVED_APP_ENTRY = '\0cer-app-entry'
48
+
43
49
  /**
44
50
  * Fills in default values for all config fields and resolves absolute paths.
45
51
  */
@@ -214,12 +220,15 @@ export function cerApp(userConfig: CerAppConfig = {}): Plugin[] {
214
220
  },
215
221
 
216
222
  resolveId(id: string) {
223
+ if (id === APP_ENTRY_URL) return RESOLVED_APP_ENTRY
217
224
  if ((Object.values(VIRTUAL_IDS) as string[]).includes(id)) {
218
225
  return `\0${id}`
219
226
  }
220
227
  },
221
228
 
222
229
  async load(id: string) {
230
+ if (id === RESOLVED_APP_ENTRY) return APP_ENTRY_TEMPLATE
231
+
223
232
  const allResolved = Object.values(RESOLVED_IDS) as string[]
224
233
  if (!allResolved.includes(id)) return null
225
234
 
@@ -11,9 +11,9 @@ const RUNTIME_IMPORTS = `import { component, html, css, ref, computed, watch, wa
11
11
 
12
12
  const DIRECTIVE_IMPORTS = `import { when, each, match, anchorBlock } from '@jasonshimmy/custom-elements-runtime/directives';`
13
13
 
14
- const FRAMEWORK_IMPORTS = `import { useHead, usePageData } from '@jasonshimmy/vite-plugin-cer-app/composables';`
14
+ const FRAMEWORK_IMPORTS = `import { useHead, usePageData, useInject } from '@jasonshimmy/vite-plugin-cer-app/composables';`
15
15
 
16
- const FRAMEWORK_IDENTIFIERS = ['useHead', 'usePageData']
16
+ const FRAMEWORK_IDENTIFIERS = ['useHead', 'usePageData', 'useInject']
17
17
 
18
18
  const RUNTIME_IDENTIFIERS = [
19
19
  'component',
@@ -1,3 +1,4 @@
1
1
  export { useHead, beginHeadCollection, endHeadCollection, serializeHeadTags } from './use-head.js'
2
2
  export type { HeadInput } from './use-head.js'
3
3
  export { usePageData } from './use-page-data.js'
4
+ export { useInject } from './use-inject.js'
@@ -0,0 +1,49 @@
1
+ import { inject } from '@jasonshimmy/custom-elements-runtime'
2
+
3
+ const _g = globalThis as Record<string, unknown>
4
+ const _PROVIDES_KEY = '__cerPluginProvides'
5
+
6
+ /**
7
+ * useInject — reads a value provided by a plugin via plugin.setup()'s provide().
8
+ *
9
+ * Works consistently across all rendering modes:
10
+ *
11
+ * - **SPA/Client**: Uses inject() from the component context tree (established
12
+ * by cer-layout-view calling provide() for each plugin-provided value).
13
+ *
14
+ * - **SSR/SSG**: Reads from globalThis.__cerPluginProvides, populated when the
15
+ * server entry runs plugin.setup() before rendering.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * // In a plugin (app/plugins/my-plugin.ts):
20
+ * export default {
21
+ * name: 'my-plugin',
22
+ * setup({ provide }) {
23
+ * provide('my-service', { greet: () => 'hello' })
24
+ * }
25
+ * }
26
+ *
27
+ * // In a component:
28
+ * component('my-page', () => {
29
+ * const service = useInject<{ greet(): string }>('my-service')
30
+ * })
31
+ * ```
32
+ */
33
+ export function useInject<T = unknown>(key: string, defaultValue?: T): T | undefined {
34
+ // Server-side (SSR/SSG): read from the global plugin provides map.
35
+ // __cerPluginProvides is populated by the server entry before the render pass.
36
+ if (typeof document === 'undefined') {
37
+ const pluginProvides = _g[_PROVIDES_KEY] as Map<PropertyKey, unknown> | undefined
38
+ const value = pluginProvides?.get(key)
39
+ return value !== undefined ? (value as T) : defaultValue
40
+ }
41
+
42
+ // Client-side: inject() walks the component context tree established by
43
+ // cer-layout-view's provide() calls. Falls back to __cerPluginProvides for
44
+ // reads before cer-layout-view mounts (e.g. during plugin-registered components).
45
+ const value = inject<T>(key)
46
+ if (value !== undefined) return value
47
+ const pluginProvides = _g[_PROVIDES_KEY] as Map<PropertyKey, unknown> | undefined
48
+ return (pluginProvides?.get(key) as T | undefined) ?? defaultValue
49
+ }
@@ -28,6 +28,25 @@ registerBuiltinComponents()
28
28
  // minimal set (&lt;, &gt;, &amp; …) and re-escapes everything else.
29
29
  registerEntityMap(entitiesJson)
30
30
 
31
+ // Run plugins once at server startup so their provide() values are available
32
+ // to useInject() during every SSR render pass. Stored on globalThis so all
33
+ // dynamically-imported page chunks share the same reference (same pattern as
34
+ // __CER_HEAD_COLLECTOR__ and __CER_DATA_STORE__).
35
+ const _pluginProvides = new Map()
36
+ ;(globalThis).__cerPluginProvides = _pluginProvides
37
+ const _pluginsReady = (async () => {
38
+ const _bootstrapRouter = initRouter({ routes })
39
+ for (const plugin of plugins) {
40
+ if (plugin && typeof plugin.setup === 'function') {
41
+ await plugin.setup({
42
+ router: _bootstrapRouter,
43
+ provide: (key, value) => _pluginProvides.set(key, value),
44
+ config: {},
45
+ })
46
+ }
47
+ }
48
+ })()
49
+
31
50
  // Async-local storage for request-scoped SSR loader data.
32
51
  // Using AsyncLocalStorage ensures concurrent SSR renders (e.g. SSG with
33
52
  // concurrency > 1) never see each other's data — each request's async chain
@@ -109,6 +128,7 @@ function _mergeWithClientTemplate(ssrHtml, clientTemplate) {
109
128
  * context so concurrent renders never share state.
110
129
  */
111
130
  const vnodeFactory = async (req) => {
131
+ await _pluginsReady
112
132
  const router = initRouter({ routes, initialUrl: req.url ?? '/' })
113
133
  const current = router.getCurrent()
114
134
  const { route, params } = router.matchRoute(current.path)