@zenithbuild/core 1.2.15 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/zenith.js +25 -0
- package/cli/commands/dev.ts +8 -37
- package/package.json +5 -8
package/bin/zenith.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { createZenithBundler } = require('@zenithbuild/bundler');
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
const command = args[0];
|
|
7
|
+
const root = process.cwd();
|
|
8
|
+
|
|
9
|
+
(async () => {
|
|
10
|
+
const bundler = createZenithBundler();
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
if (command === 'dev') {
|
|
14
|
+
await bundler.dev({ root });
|
|
15
|
+
} else if (command === 'build') {
|
|
16
|
+
await bundler.build({ root });
|
|
17
|
+
} else {
|
|
18
|
+
console.log("Usage: zenith [dev|build]");
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
} catch (e) {
|
|
22
|
+
console.error(e);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
})();
|
package/cli/commands/dev.ts
CHANGED
|
@@ -25,10 +25,8 @@ import { requireProject } from '../utils/project'
|
|
|
25
25
|
import * as logger from '../utils/logger'
|
|
26
26
|
import * as brand from '../utils/branding'
|
|
27
27
|
import {
|
|
28
|
-
|
|
28
|
+
compile,
|
|
29
29
|
discoverComponents,
|
|
30
|
-
discoverLayouts,
|
|
31
|
-
processLayout,
|
|
32
30
|
generateBundleJS,
|
|
33
31
|
loadZenithConfig,
|
|
34
32
|
PluginRegistry,
|
|
@@ -160,8 +158,8 @@ export async function dev(options: DevOptions = {}): Promise<void> {
|
|
|
160
158
|
const componentsDir = path.join(pagesDir, '../components')
|
|
161
159
|
const layoutsDir = path.join(pagesDir, '../layouts')
|
|
162
160
|
|
|
163
|
-
// Discover layouts
|
|
164
|
-
const layouts = discoverLayouts(layoutsDir)
|
|
161
|
+
// Discover layouts removed in Phase A1
|
|
162
|
+
// const layouts = discoverLayouts(layoutsDir)
|
|
165
163
|
|
|
166
164
|
// Discover components for resolution logic
|
|
167
165
|
// We need layouts to be available as components too (e.g. <DefaultLayout>)
|
|
@@ -189,20 +187,15 @@ export async function dev(options: DevOptions = {}): Promise<void> {
|
|
|
189
187
|
// If the page doesn't explicitly use the layout, we might wrap it?
|
|
190
188
|
// But if users use <DefaultLayout>, that's handled by component resolution.
|
|
191
189
|
|
|
190
|
+
// Legacy layout wrapping removed in Phase A1
|
|
191
|
+
/*
|
|
192
192
|
let layoutToUse = layouts.get('DefaultLayout')
|
|
193
193
|
if (layoutToUse && !source.includes('<DefaultLayout')) {
|
|
194
|
-
// only wrap if not already used?
|
|
195
|
-
// actually processLayout is usually for "implicit" layout application
|
|
196
|
-
// If the user manually wraps, processLayout might double wrap?
|
|
197
|
-
// Let's assume processLayout logic is correct for now or minimal.
|
|
198
|
-
// processLayout(source, layoutToUse) checks if it should wrap.
|
|
199
194
|
processedSource = processLayout(source, layoutToUse)
|
|
200
|
-
} else if (layoutToUse) {
|
|
201
|
-
// If it IS used explicitly, we treat it as a component.
|
|
202
|
-
// We don't wrap it.
|
|
203
195
|
}
|
|
196
|
+
*/
|
|
204
197
|
|
|
205
|
-
const result = await
|
|
198
|
+
const result = await compile(processedSource, pagePath, {
|
|
206
199
|
components: componentsMap
|
|
207
200
|
})
|
|
208
201
|
if (!result.finalized) throw new Error('Compilation failed')
|
|
@@ -237,28 +230,6 @@ export async function dev(options: DevOptions = {}): Promise<void> {
|
|
|
237
230
|
|
|
238
231
|
let jsWithoutImports = jsLines.join('\n')
|
|
239
232
|
|
|
240
|
-
// PATCH: Fix unquoted keys with dashes (Rust codegen bug in jsx_lowerer)
|
|
241
|
-
// e.g. stroke-width: "1.5" -> "stroke-width": "1.5"
|
|
242
|
-
// We only apply this to the JS portions (Script and Expressions)
|
|
243
|
-
// to avoid corrupting the Styles section.
|
|
244
|
-
const stylesMarker = '// 6. Styles injection'
|
|
245
|
-
const parts = jsWithoutImports.split(stylesMarker)
|
|
246
|
-
|
|
247
|
-
if (parts.length > 1) {
|
|
248
|
-
// Apply patch only to the JS part
|
|
249
|
-
parts[0] = parts[0]!.replace(
|
|
250
|
-
/(^|[{,])\s*([a-zA-Z][a-zA-Z0-9-]*-[a-zA-Z0-9-]*)\s*:/gm,
|
|
251
|
-
'$1"$2":'
|
|
252
|
-
)
|
|
253
|
-
jsWithoutImports = parts.join(stylesMarker)
|
|
254
|
-
} else {
|
|
255
|
-
// Fallback if marker not found
|
|
256
|
-
jsWithoutImports = jsWithoutImports.replace(
|
|
257
|
-
/(^|[{,])\s*([a-zA-Z][a-zA-Z0-9-]*-[a-zA-Z0-9-]*)\s*:/gm,
|
|
258
|
-
'$1"$2":'
|
|
259
|
-
)
|
|
260
|
-
}
|
|
261
|
-
|
|
262
233
|
// Combine: structured imports first, then cleaned script body
|
|
263
234
|
const fullScript = (result.finalized.npmImports || '') + '\n\n' + jsWithoutImports
|
|
264
235
|
|
|
@@ -312,7 +283,7 @@ export async function dev(options: DevOptions = {}): Promise<void> {
|
|
|
312
283
|
}
|
|
313
284
|
|
|
314
285
|
if (!html.trimStart().toLowerCase().startsWith('<!doctype')) {
|
|
315
|
-
html = `<!DOCTYPE html>\n
|
|
286
|
+
html = `<!DOCTYPE html>\n${html}`;
|
|
316
287
|
}
|
|
317
288
|
|
|
318
289
|
return html;
|
package/package.json
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenithbuild/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Core library for the Zenith framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./core/index.ts",
|
|
8
8
|
"bin": {
|
|
9
|
-
"zenith": "./
|
|
10
|
-
"zenith-dev": "./dist/zen-dev.js",
|
|
11
|
-
"zen-dev": "./dist/zen-dev.js",
|
|
12
|
-
"zen-build": "./dist/zen-build.js",
|
|
13
|
-
"zen-preview": "./dist/zen-preview.js"
|
|
9
|
+
"zenith": "./bin/zenith.js"
|
|
14
10
|
},
|
|
15
11
|
"files": [
|
|
16
12
|
"bin",
|
|
@@ -64,8 +60,9 @@
|
|
|
64
60
|
"typescript": "^5.9.3"
|
|
65
61
|
},
|
|
66
62
|
"dependencies": {
|
|
67
|
-
"@zenithbuild/compiler": "^1.0
|
|
68
|
-
"@zenithbuild/
|
|
63
|
+
"@zenithbuild/compiler": "^1.3.0",
|
|
64
|
+
"@zenithbuild/bundler": "^1.3.0",
|
|
65
|
+
"@zenithbuild/router": "^1.3.0",
|
|
69
66
|
"picocolors": "^1.1.1"
|
|
70
67
|
}
|
|
71
68
|
}
|