@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.
- package/README.md +14 -11
- package/dist/adapters/adapter-netlify.js +1 -0
- package/dist/adapters/adapter-node.js +8 -0
- package/dist/adapters/adapter-vercel.js +1 -0
- package/dist/build/compiler-runtime.d.ts +10 -9
- package/dist/build/compiler-runtime.js +51 -1
- package/dist/build/compiler-signal-expression.d.ts +1 -0
- package/dist/build/compiler-signal-expression.js +155 -0
- package/dist/build/expression-rewrites.d.ts +1 -6
- package/dist/build/expression-rewrites.js +61 -65
- package/dist/build/page-component-loop.d.ts +3 -13
- package/dist/build/page-component-loop.js +21 -46
- package/dist/build/page-ir-normalization.d.ts +0 -8
- package/dist/build/page-ir-normalization.js +13 -234
- package/dist/build/page-loop-state.d.ts +6 -9
- package/dist/build/page-loop-state.js +9 -8
- package/dist/build/page-loop.js +27 -22
- package/dist/build/scoped-identifier-rewrite.d.ts +37 -44
- package/dist/build/scoped-identifier-rewrite.js +28 -128
- package/dist/build/server-script.d.ts +2 -1
- package/dist/build/server-script.js +29 -3
- package/dist/build.js +5 -3
- package/dist/component-instance-ir.js +158 -52
- package/dist/dev-build-session.js +20 -6
- package/dist/dev-server.js +82 -39
- package/dist/framework-components/Image.zen +1 -1
- package/dist/images/materialization-plan.d.ts +1 -0
- package/dist/images/materialization-plan.js +6 -0
- package/dist/images/materialize.d.ts +5 -3
- package/dist/images/materialize.js +24 -109
- package/dist/images/router-manifest.d.ts +1 -0
- package/dist/images/router-manifest.js +49 -0
- package/dist/index.js +8 -2
- package/dist/manifest.js +3 -2
- package/dist/preview.d.ts +4 -3
- package/dist/preview.js +87 -53
- package/dist/request-body.d.ts +2 -0
- package/dist/request-body.js +13 -0
- package/dist/request-origin.d.ts +2 -0
- package/dist/request-origin.js +45 -0
- package/dist/route-check-support.d.ts +1 -0
- package/dist/route-check-support.js +4 -0
- package/dist/server-contract.d.ts +15 -0
- package/dist/server-contract.js +102 -32
- package/dist/server-error.d.ts +4 -0
- package/dist/server-error.js +34 -0
- package/dist/server-output.d.ts +2 -0
- package/dist/server-output.js +13 -0
- package/dist/server-runtime/node-server.js +33 -27
- package/dist/server-runtime/route-render.d.ts +3 -3
- package/dist/server-runtime/route-render.js +20 -31
- package/dist/server-script-composition.d.ts +11 -5
- package/dist/server-script-composition.js +25 -10
- 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.
|
|
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.
|
|
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
|
},
|