@zenithbuild/compiler 1.0.13 → 1.0.15
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/dist/core/plugins/registry.js +0 -1
- package/dist/parseZenFile.js +0 -4
- package/dist/runtime/bundle-generator.js +3 -1
- package/dist/spa-build.js +0 -9
- package/dist/transform/classifyExpression.js +7 -2
- package/dist/transform/componentResolver.js +0 -6
- package/native/compiler-native/compiler-native.node +0 -0
- package/package.json +47 -47
|
@@ -74,7 +74,6 @@ export class PluginRegistry {
|
|
|
74
74
|
for (const plugin of this.plugins.values()) {
|
|
75
75
|
try {
|
|
76
76
|
await plugin.setup(ctx);
|
|
77
|
-
console.log(`[Zenith] Plugin "${plugin.name}" initialized`);
|
|
78
77
|
}
|
|
79
78
|
catch (error) {
|
|
80
79
|
const message = error instanceof Error ? error.message : String(error);
|
package/dist/parseZenFile.js
CHANGED
|
@@ -34,10 +34,6 @@ export function parseZenFile(filePath, sourceInput) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
if (native && native.parseTemplateNative && native.parseScriptNative && native.extractStylesNative) {
|
|
37
|
-
console.log(`[ZenithDebug] parseZenFile: filePath=${filePath}, sourceLen=${source.length}`);
|
|
38
|
-
if (filePath.endsWith('index.zen')) {
|
|
39
|
-
console.log(`[ZenithDebug] source snippet: ${source.substring(0, 500)}`);
|
|
40
|
-
}
|
|
41
37
|
try {
|
|
42
38
|
const template = native.parseTemplateNative(source, filePath);
|
|
43
39
|
const script = native.parseScriptNative(source);
|
|
@@ -46,7 +46,9 @@ export function generateBundleJS(pluginData) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
catch (e) {
|
|
49
|
-
|
|
49
|
+
if (process.env.ZENITH_DEBUG === 'true') {
|
|
50
|
+
console.warn('[Zenith] Could not load runtime from core, falling back to internal', e);
|
|
51
|
+
}
|
|
50
52
|
}
|
|
51
53
|
// Fallback to internal hydration_runtime.js from native compiler source
|
|
52
54
|
// Use the compiler's own location to find the file, not process.cwd()
|
package/dist/spa-build.js
CHANGED
|
@@ -820,12 +820,10 @@ export async function buildSPA(options) {
|
|
|
820
820
|
console.warn("[Zenith Build] No pages found in", pagesDir);
|
|
821
821
|
return;
|
|
822
822
|
}
|
|
823
|
-
console.log(`[Zenith Build] Found ${pageFiles.length} page(s)`);
|
|
824
823
|
// Compile all pages
|
|
825
824
|
const compiledPages = [];
|
|
826
825
|
const layoutStyles = [];
|
|
827
826
|
for (const pageFile of pageFiles) {
|
|
828
|
-
console.log(`[Zenith Build] Compiling: ${path.relative(pagesDir, pageFile)}`);
|
|
829
827
|
try {
|
|
830
828
|
const compiled = await compilePage(pageFile, pagesDir);
|
|
831
829
|
compiledPages.push(compiled);
|
|
@@ -849,18 +847,11 @@ export async function buildSPA(options) {
|
|
|
849
847
|
if (fs.existsSync(faviconPath)) {
|
|
850
848
|
fs.copyFileSync(faviconPath, path.join(outDir, "favicon.ico"));
|
|
851
849
|
}
|
|
852
|
-
console.log(`[Zenith Build] Successfully built ${compiledPages.length} page(s)`);
|
|
853
|
-
console.log(`[Zenith Build] Output: ${outDir}/index.html`);
|
|
854
850
|
// Log route manifest
|
|
855
|
-
console.log("\n[Zenith Build] Route Manifest:");
|
|
856
|
-
for (const page of compiledPages) {
|
|
857
|
-
console.log(` ${page.routePath.padEnd(25)} → ${path.relative(pagesDir, page.filePath)} (score: ${page.score})`);
|
|
858
|
-
}
|
|
859
851
|
}
|
|
860
852
|
/**
|
|
861
853
|
* Watch mode for development (future)
|
|
862
854
|
*/
|
|
863
855
|
export function watchSPA(_options) {
|
|
864
856
|
// TODO: Implement file watching
|
|
865
|
-
console.log("[Zenith Build] Watch mode not yet implemented");
|
|
866
857
|
}
|
|
@@ -76,8 +76,10 @@ function parseMapExpression(code) {
|
|
|
76
76
|
// Pattern: source.map((item, index) => body)
|
|
77
77
|
// Find .map(
|
|
78
78
|
const mapIndex = code.indexOf('.map(');
|
|
79
|
-
if (mapIndex === -1)
|
|
79
|
+
if (mapIndex === -1) {
|
|
80
|
+
// console.log('[Classify] No .map( found in:', code.slice(0, 50));
|
|
80
81
|
return null;
|
|
82
|
+
}
|
|
81
83
|
const source = code.slice(0, mapIndex).trim();
|
|
82
84
|
if (!source)
|
|
83
85
|
return null;
|
|
@@ -121,8 +123,11 @@ function parseMapExpression(code) {
|
|
|
121
123
|
body = body.slice(0, -1).trim();
|
|
122
124
|
}
|
|
123
125
|
// Check if body contains JSX
|
|
124
|
-
if (!containsJSX(body))
|
|
126
|
+
if (!containsJSX(body)) {
|
|
127
|
+
console.log('[Classify] Body does not contain JSX:', body.slice(0, 50));
|
|
125
128
|
return null;
|
|
129
|
+
}
|
|
130
|
+
console.log('[Classify] Successfully identified loop for source:', source);
|
|
126
131
|
return { source, itemVar, indexVar, body };
|
|
127
132
|
}
|
|
128
133
|
/**
|
|
@@ -12,10 +12,6 @@ import { resolveComponentsNative } from '../../native/compiler-native';
|
|
|
12
12
|
* Delegates to the Rust native compiler for performance and correctness.
|
|
13
13
|
*/
|
|
14
14
|
export function resolveComponentsInIR(ir, components) {
|
|
15
|
-
console.error(`[ZenithDebug] resolveComponentsInIR called with ${components.size} components`);
|
|
16
|
-
for (const [name, meta] of components) {
|
|
17
|
-
console.error(`[ZenithDebug] Component '${name}': script=${meta.script ? meta.script.length : 'null'} bytes`);
|
|
18
|
-
}
|
|
19
15
|
const irJson = JSON.stringify(ir);
|
|
20
16
|
// Convert Map to record for JSON serialization
|
|
21
17
|
const componentsRecord = {};
|
|
@@ -23,8 +19,6 @@ export function resolveComponentsInIR(ir, components) {
|
|
|
23
19
|
componentsRecord[key] = value;
|
|
24
20
|
}
|
|
25
21
|
const componentsJson = JSON.stringify(componentsRecord);
|
|
26
|
-
console.error(`[ZenithDebug] Calling resolveComponentsNative...`);
|
|
27
22
|
const resolvedJson = resolveComponentsNative(irJson, componentsJson);
|
|
28
|
-
console.error(`[ZenithDebug] resolveComponentsNative returned ${resolvedJson.length} bytes`);
|
|
29
23
|
return JSON.parse(resolvedJson);
|
|
30
24
|
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
2
|
+
"name": "@zenithbuild/compiler",
|
|
3
|
+
"version": "1.0.15",
|
|
4
|
+
"description": "The Iron Heart: Native Compiler for the Zenith Framework",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.js",
|
|
9
|
+
"./config": "./dist/core/config/index.js",
|
|
10
|
+
"./plugins": "./dist/core/plugins/index.js",
|
|
11
|
+
"./runtime": "./dist/runtime/index.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"native/compiler-native/index.js",
|
|
16
|
+
"native/compiler-native/index.d.ts",
|
|
17
|
+
"native/compiler-native/package.json",
|
|
18
|
+
"native/compiler-native/compiler-native.node"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc --skipLibCheck && cd native/compiler-native && bun run build",
|
|
25
|
+
"test": "bun test"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"esbuild": "^0.20.0",
|
|
29
|
+
"ws": "^8.16.0",
|
|
30
|
+
"rolldown": "latest",
|
|
31
|
+
"@zenithbuild/router": "^1.0.7",
|
|
32
|
+
"acorn": "^8.15.0",
|
|
33
|
+
"es-module-lexer": "^2.0.0",
|
|
34
|
+
"marked": "^17.0.1",
|
|
35
|
+
"parse5": "^8.0.0",
|
|
36
|
+
"picocolors": "^1.1.1",
|
|
37
|
+
"prompts": "^2.4.2",
|
|
38
|
+
"glob": "^10.3.10"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/node": "^20.11.0",
|
|
42
|
+
"@types/acorn": "^6.0.4",
|
|
43
|
+
"@types/marked": "^6.0.0",
|
|
44
|
+
"@types/parse5": "^7.0.0",
|
|
45
|
+
"@types/prompts": "^2.4.9",
|
|
46
|
+
"typescript": "^5.3.3",
|
|
47
|
+
"bun-types": "latest"
|
|
48
|
+
}
|
|
49
49
|
}
|