@zenithbuild/cli 0.7.2 → 0.7.4

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 (54) hide show
  1. package/README.md +14 -11
  2. package/dist/adapters/adapter-netlify.js +1 -0
  3. package/dist/adapters/adapter-node.js +8 -0
  4. package/dist/adapters/adapter-vercel.js +1 -0
  5. package/dist/build/compiler-runtime.d.ts +10 -9
  6. package/dist/build/compiler-runtime.js +51 -1
  7. package/dist/build/compiler-signal-expression.d.ts +1 -0
  8. package/dist/build/compiler-signal-expression.js +155 -0
  9. package/dist/build/expression-rewrites.d.ts +1 -6
  10. package/dist/build/expression-rewrites.js +61 -65
  11. package/dist/build/page-component-loop.d.ts +3 -13
  12. package/dist/build/page-component-loop.js +21 -46
  13. package/dist/build/page-ir-normalization.d.ts +0 -8
  14. package/dist/build/page-ir-normalization.js +13 -234
  15. package/dist/build/page-loop-state.d.ts +6 -9
  16. package/dist/build/page-loop-state.js +9 -8
  17. package/dist/build/page-loop.js +27 -22
  18. package/dist/build/scoped-identifier-rewrite.d.ts +37 -44
  19. package/dist/build/scoped-identifier-rewrite.js +28 -128
  20. package/dist/build/server-script.d.ts +2 -1
  21. package/dist/build/server-script.js +29 -3
  22. package/dist/build.js +5 -3
  23. package/dist/component-instance-ir.js +158 -52
  24. package/dist/dev-build-session.js +20 -6
  25. package/dist/dev-server.js +82 -39
  26. package/dist/framework-components/Image.zen +1 -1
  27. package/dist/images/materialization-plan.d.ts +1 -0
  28. package/dist/images/materialization-plan.js +6 -0
  29. package/dist/images/materialize.d.ts +5 -3
  30. package/dist/images/materialize.js +24 -109
  31. package/dist/images/router-manifest.d.ts +1 -0
  32. package/dist/images/router-manifest.js +49 -0
  33. package/dist/index.js +8 -2
  34. package/dist/manifest.js +3 -2
  35. package/dist/preview.d.ts +4 -3
  36. package/dist/preview.js +87 -53
  37. package/dist/request-body.d.ts +2 -0
  38. package/dist/request-body.js +13 -0
  39. package/dist/request-origin.d.ts +2 -0
  40. package/dist/request-origin.js +45 -0
  41. package/dist/route-check-support.d.ts +1 -0
  42. package/dist/route-check-support.js +4 -0
  43. package/dist/server-contract.d.ts +15 -0
  44. package/dist/server-contract.js +102 -32
  45. package/dist/server-error.d.ts +4 -0
  46. package/dist/server-error.js +34 -0
  47. package/dist/server-output.d.ts +2 -0
  48. package/dist/server-output.js +13 -0
  49. package/dist/server-runtime/node-server.js +33 -27
  50. package/dist/server-runtime/route-render.d.ts +3 -3
  51. package/dist/server-runtime/route-render.js +20 -31
  52. package/dist/server-script-composition.d.ts +11 -5
  53. package/dist/server-script-composition.js +25 -10
  54. package/package.json +6 -2
@@ -4,7 +4,7 @@ const DATA_EXPORT_RE = /\bexport\s+const\s+data\b/;
4
4
  const LEGACY_EXPORT_RE = /\bexport\s+const\s+(?:ssr_data|props|ssr)\b/;
5
5
  /**
6
6
  * @param {string} sourceFile
7
- * @param {'guard' | 'load'} kind
7
+ * @param {'guard' | 'load' | 'action'} kind
8
8
  * @returns {string[]}
9
9
  */
10
10
  function adjacentModuleCandidates(sourceFile, kind) {
@@ -22,7 +22,7 @@ function adjacentModuleCandidates(sourceFile, kind) {
22
22
  }
23
23
  /**
24
24
  * @param {string} sourceFile
25
- * @param {'guard' | 'load'} kind
25
+ * @param {'guard' | 'load' | 'action'} kind
26
26
  * @returns {string | null}
27
27
  */
28
28
  function resolveAdjacentModule(sourceFile, kind) {
@@ -65,16 +65,18 @@ function classifyInlineServerSource(source) {
65
65
  /**
66
66
  * @param {{
67
67
  * sourceFile: string,
68
- * inlineServerScript?: { source: string, prerender: boolean, has_guard: boolean, has_load: boolean, source_path: string } | null,
68
+ * inlineServerScript?: { source: string, prerender: boolean, has_guard: boolean, has_load: boolean, has_action: boolean, source_path: string } | null,
69
69
  * adjacentGuardPath?: string | null,
70
- * adjacentLoadPath?: string | null
70
+ * adjacentLoadPath?: string | null,
71
+ * adjacentActionPath?: string | null
71
72
  * }} input
72
- * @returns {{ serverScript: { source: string, prerender: boolean, has_guard: boolean, has_load: boolean, source_path: string } | null, guardPath: string | null, loadPath: string | null }}
73
+ * @returns {{ serverScript: { source: string, prerender: boolean, has_guard: boolean, has_load: boolean, has_action: boolean, source_path: string } | null, guardPath: string | null, loadPath: string | null, actionPath: string | null }}
73
74
  */
74
- export function composeServerScriptEnvelope({ sourceFile, inlineServerScript = null, adjacentGuardPath = null, adjacentLoadPath = null }) {
75
+ export function composeServerScriptEnvelope({ sourceFile, inlineServerScript = null, adjacentGuardPath = null, adjacentLoadPath = null, adjacentActionPath = null }) {
75
76
  const inlineSource = String(inlineServerScript?.source || '').trim();
76
77
  const inlineHasGuard = inlineServerScript?.has_guard === true;
77
78
  const inlineHasLoad = inlineServerScript?.has_load === true;
79
+ const inlineHasAction = inlineServerScript?.has_action === true;
78
80
  const { hasData, hasLegacy } = classifyInlineServerSource(inlineSource);
79
81
  if (inlineHasGuard && adjacentGuardPath) {
80
82
  throw new Error(`Zenith server script contract violation:\n` +
@@ -88,6 +90,12 @@ export function composeServerScriptEnvelope({ sourceFile, inlineServerScript = n
88
90
  ` Reason: load is defined both inline and in an adjacent module\n` +
89
91
  ` Example: keep load in either <script server> or ${basename(adjacentLoadPath)}, not both`);
90
92
  }
93
+ if (inlineHasAction && adjacentActionPath) {
94
+ throw new Error(`Zenith server script contract violation:\n` +
95
+ ` File: ${sourceFile}\n` +
96
+ ` Reason: action is defined both inline and in an adjacent module\n` +
97
+ ` Example: keep action in either <script server> or ${basename(adjacentActionPath)}, not both`);
98
+ }
91
99
  if (adjacentLoadPath && (hasData || hasLegacy)) {
92
100
  throw new Error(`Zenith server script contract violation:\n` +
93
101
  ` File: ${sourceFile}\n` +
@@ -101,12 +109,16 @@ export function composeServerScriptEnvelope({ sourceFile, inlineServerScript = n
101
109
  if (adjacentLoadPath) {
102
110
  prologue.push(`export { load } from '${renderRelativeSpecifier(sourceFile, adjacentLoadPath)}';`);
103
111
  }
112
+ if (adjacentActionPath) {
113
+ prologue.push(`export { action } from '${renderRelativeSpecifier(sourceFile, adjacentActionPath)}';`);
114
+ }
104
115
  const mergedSource = [...prologue, inlineSource].filter(Boolean).join('\n');
105
116
  if (!mergedSource.trim()) {
106
117
  return {
107
118
  serverScript: null,
108
119
  guardPath: adjacentGuardPath,
109
- loadPath: adjacentLoadPath
120
+ loadPath: adjacentLoadPath,
121
+ actionPath: adjacentActionPath
110
122
  };
111
123
  }
112
124
  return {
@@ -115,19 +127,22 @@ export function composeServerScriptEnvelope({ sourceFile, inlineServerScript = n
115
127
  prerender: inlineServerScript?.prerender === true,
116
128
  has_guard: inlineHasGuard || Boolean(adjacentGuardPath),
117
129
  has_load: inlineHasLoad || Boolean(adjacentLoadPath),
130
+ has_action: inlineHasAction || Boolean(adjacentActionPath),
118
131
  source_path: sourceFile
119
132
  },
120
133
  guardPath: adjacentGuardPath,
121
- loadPath: adjacentLoadPath
134
+ loadPath: adjacentLoadPath,
135
+ actionPath: adjacentActionPath
122
136
  };
123
137
  }
124
138
  /**
125
139
  * @param {string} sourceFile
126
- * @returns {{ guardPath: string | null, loadPath: string | null }}
140
+ * @returns {{ guardPath: string | null, loadPath: string | null, actionPath: string | null }}
127
141
  */
128
142
  export function resolveAdjacentServerModules(sourceFile) {
129
143
  return {
130
144
  guardPath: resolveAdjacentModule(sourceFile, 'guard'),
131
- loadPath: resolveAdjacentModule(sourceFile, 'load')
145
+ loadPath: resolveAdjacentModule(sourceFile, 'load'),
146
+ actionPath: resolveAdjacentModule(sourceFile, 'action')
132
147
  };
133
148
  }
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@zenithbuild/cli",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Deterministic project orchestrator for Zenith framework",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
8
+ "bin": {
9
+ "zenith": "./dist/index.js"
10
+ },
8
11
  "exports": {
9
12
  ".": "./dist/index.js"
10
13
  },
@@ -35,7 +38,8 @@
35
38
  "prepublishOnly": "npm run build"
36
39
  },
37
40
  "dependencies": {
38
- "@zenithbuild/compiler": "0.7.2",
41
+ "@zenithbuild/compiler": "0.7.4",
42
+ "@zenithbuild/bundler": "0.7.4",
39
43
  "picocolors": "^1.1.1",
40
44
  "sharp": "^0.34.4"
41
45
  },