@zenithbuild/cli 0.4.5 → 0.4.6
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/zen-build.js +325 -212
- package/dist/zen-dev.js +325 -212
- package/dist/zen-preview.js +325 -212
- package/dist/zenith.js +325 -212
- package/package.json +2 -2
- package/src/commands/dev.ts +7 -2
package/dist/zen-preview.js
CHANGED
|
@@ -4,7 +4,6 @@ var __create = Object.create;
|
|
|
4
4
|
var __getProtoOf = Object.getPrototypeOf;
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
8
|
var __toESM = (mod, isNodeMode, target) => {
|
|
10
9
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
@@ -17,31 +16,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
17
16
|
});
|
|
18
17
|
return to;
|
|
19
18
|
};
|
|
20
|
-
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
21
|
-
var __toCommonJS = (from) => {
|
|
22
|
-
var entry = __moduleCache.get(from), desc;
|
|
23
|
-
if (entry)
|
|
24
|
-
return entry;
|
|
25
|
-
entry = __defProp({}, "__esModule", { value: true });
|
|
26
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
27
|
-
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
28
|
-
get: () => from[key],
|
|
29
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
30
|
-
}));
|
|
31
|
-
__moduleCache.set(from, entry);
|
|
32
|
-
return entry;
|
|
33
|
-
};
|
|
34
19
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
35
|
-
var __export = (target, all) => {
|
|
36
|
-
for (var name in all)
|
|
37
|
-
__defProp(target, name, {
|
|
38
|
-
get: all[name],
|
|
39
|
-
enumerable: true,
|
|
40
|
-
configurable: true,
|
|
41
|
-
set: (newValue) => all[name] = () => newValue
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
45
20
|
var __require = import.meta.require;
|
|
46
21
|
|
|
47
22
|
// node_modules/picocolors/picocolors.js
|
|
@@ -114,21 +89,21 @@ var require_picocolors = __commonJS((exports, module) => {
|
|
|
114
89
|
module.exports.createColors = createColors;
|
|
115
90
|
});
|
|
116
91
|
|
|
117
|
-
//
|
|
92
|
+
// ../zenith-compiler/native/compiler-native/compiler-native.node
|
|
118
93
|
var require_compiler_native = __commonJS((exports, module) => {
|
|
119
|
-
module.exports = __require("./compiler-native-
|
|
94
|
+
module.exports = __require("./compiler-native-694q7spj.node");
|
|
120
95
|
});
|
|
121
96
|
|
|
122
|
-
//
|
|
97
|
+
// ../zenith-compiler/native/compiler-native/index.js
|
|
123
98
|
var require_compiler_native2 = __commonJS((exports, module) => {
|
|
124
|
-
var __dirname = "/Users/judahsullivan/Personal/zenith/zenith-
|
|
99
|
+
var __dirname = "/Users/judahsullivan/Personal/zenith/zenith-compiler/native/compiler-native";
|
|
125
100
|
var { join } = __require("path");
|
|
126
101
|
var { statSync } = __require("fs");
|
|
127
102
|
var nativeBinding;
|
|
128
103
|
var nodePath = join(__dirname, "compiler-native.node");
|
|
129
104
|
var mtime = statSync(nodePath).mtimeMs;
|
|
130
105
|
try {
|
|
131
|
-
delete __require.cache[__require.resolve("/Users/judahsullivan/Personal/zenith/zenith-
|
|
106
|
+
delete __require.cache[__require.resolve("/Users/judahsullivan/Personal/zenith/zenith-compiler/native/compiler-native/compiler-native.node")];
|
|
132
107
|
nativeBinding = require_compiler_native();
|
|
133
108
|
} catch (e) {
|
|
134
109
|
console.error("[Zenith Native] Failed to load native binding:", e.message);
|
|
@@ -137,74 +112,6 @@ var require_compiler_native2 = __commonJS((exports, module) => {
|
|
|
137
112
|
module.exports = nativeBinding;
|
|
138
113
|
});
|
|
139
114
|
|
|
140
|
-
// node_modules/@zenithbuild/compiler/dist/discovery/componentDiscovery.js
|
|
141
|
-
var exports_componentDiscovery = {};
|
|
142
|
-
__export(exports_componentDiscovery, {
|
|
143
|
-
isComponentTag: () => isComponentTag,
|
|
144
|
-
getComponent: () => getComponent,
|
|
145
|
-
discoverComponents: () => discoverComponents
|
|
146
|
-
});
|
|
147
|
-
function discoverComponents(baseDir) {
|
|
148
|
-
if (native7 && native7.discoverComponentsNative) {
|
|
149
|
-
try {
|
|
150
|
-
const raw = native7.discoverComponentsNative(baseDir);
|
|
151
|
-
const components = new Map;
|
|
152
|
-
for (const [name, metadata] of Object.entries(raw)) {
|
|
153
|
-
components.set(name, metadata);
|
|
154
|
-
}
|
|
155
|
-
return components;
|
|
156
|
-
} catch (error4) {
|
|
157
|
-
console.warn(`[Zenith Native] Discovery failed for ${baseDir}: ${error4.message}`);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return new Map;
|
|
161
|
-
}
|
|
162
|
-
function isComponentTag(tagName) {
|
|
163
|
-
if (native7 && native7.isComponentTagNative) {
|
|
164
|
-
return native7.isComponentTagNative(tagName);
|
|
165
|
-
}
|
|
166
|
-
return tagName.length > 0 && tagName[0] === tagName[0]?.toUpperCase();
|
|
167
|
-
}
|
|
168
|
-
function getComponent(components, name) {
|
|
169
|
-
return components.get(name);
|
|
170
|
-
}
|
|
171
|
-
var native7;
|
|
172
|
-
var init_componentDiscovery = __esm(() => {
|
|
173
|
-
try {
|
|
174
|
-
try {
|
|
175
|
-
native7 = require_compiler_native2();
|
|
176
|
-
} catch {
|
|
177
|
-
native7 = require_compiler_native2();
|
|
178
|
-
}
|
|
179
|
-
} catch (e2) {}
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
// node_modules/@zenithbuild/compiler/dist/transform/componentResolver.js
|
|
183
|
-
var exports_componentResolver = {};
|
|
184
|
-
__export(exports_componentResolver, {
|
|
185
|
-
resolveComponentsInIR: () => resolveComponentsInIR
|
|
186
|
-
});
|
|
187
|
-
function resolveComponentsInIR(ir, components) {
|
|
188
|
-
console.error(`[ZenithDebug] resolveComponentsInIR called with ${components.size} components`);
|
|
189
|
-
for (const [name, meta] of components) {
|
|
190
|
-
console.error(`[ZenithDebug] Component '${name}': script=${meta.script ? meta.script.length : "null"} bytes`);
|
|
191
|
-
}
|
|
192
|
-
const irJson = JSON.stringify(ir);
|
|
193
|
-
const componentsRecord = {};
|
|
194
|
-
for (const [key, value] of components) {
|
|
195
|
-
componentsRecord[key] = value;
|
|
196
|
-
}
|
|
197
|
-
const componentsJson = JSON.stringify(componentsRecord);
|
|
198
|
-
console.error(`[ZenithDebug] Calling resolveComponentsNative...`);
|
|
199
|
-
const resolvedJson = import_compiler_native.resolveComponentsNative(irJson, componentsJson);
|
|
200
|
-
console.error(`[ZenithDebug] resolveComponentsNative returned ${resolvedJson.length} bytes`);
|
|
201
|
-
return JSON.parse(resolvedJson);
|
|
202
|
-
}
|
|
203
|
-
var import_compiler_native;
|
|
204
|
-
var init_componentResolver = __esm(() => {
|
|
205
|
-
import_compiler_native = __toESM(require_compiler_native2(), 1);
|
|
206
|
-
});
|
|
207
|
-
|
|
208
115
|
// src/main.ts
|
|
209
116
|
import process2 from "process";
|
|
210
117
|
|
|
@@ -416,7 +323,7 @@ function showServerPanel(options) {
|
|
|
416
323
|
`);
|
|
417
324
|
}
|
|
418
325
|
|
|
419
|
-
//
|
|
326
|
+
// ../zenith-compiler/dist/transform/transformTemplate.js
|
|
420
327
|
function transformTemplate(ir) {
|
|
421
328
|
let native;
|
|
422
329
|
try {
|
|
@@ -438,7 +345,7 @@ function transformTemplate(ir) {
|
|
|
438
345
|
throw new Error("[Zenith Native] Transformation bridge unavailable");
|
|
439
346
|
}
|
|
440
347
|
|
|
441
|
-
//
|
|
348
|
+
// ../zenith-compiler/dist/finalize/finalizeOutput.js
|
|
442
349
|
var native;
|
|
443
350
|
try {
|
|
444
351
|
try {
|
|
@@ -486,7 +393,7 @@ ${errorMessage}`);
|
|
|
486
393
|
return output;
|
|
487
394
|
}
|
|
488
395
|
|
|
489
|
-
//
|
|
396
|
+
// ../zenith-compiler/dist/errors/compilerError.js
|
|
490
397
|
class CompilerError extends Error {
|
|
491
398
|
file;
|
|
492
399
|
line;
|
|
@@ -528,7 +435,7 @@ class InvariantError extends CompilerError {
|
|
|
528
435
|
}
|
|
529
436
|
}
|
|
530
437
|
|
|
531
|
-
//
|
|
438
|
+
// ../zenith-compiler/dist/validate/invariants.js
|
|
532
439
|
var native2;
|
|
533
440
|
try {
|
|
534
441
|
try {
|
|
@@ -558,7 +465,7 @@ function validateIr(ir) {
|
|
|
558
465
|
}
|
|
559
466
|
}
|
|
560
467
|
|
|
561
|
-
//
|
|
468
|
+
// ../zenith-compiler/dist/parseZenFile.js
|
|
562
469
|
import { readFileSync } from "fs";
|
|
563
470
|
var native3;
|
|
564
471
|
try {
|
|
@@ -580,6 +487,10 @@ function parseZenFile(filePath, sourceInput) {
|
|
|
580
487
|
}
|
|
581
488
|
}
|
|
582
489
|
if (native3 && native3.parseTemplateNative && native3.parseScriptNative && native3.extractStylesNative) {
|
|
490
|
+
console.log(`[ZenithDebug] parseZenFile: filePath=${filePath}, sourceLen=${source.length}`);
|
|
491
|
+
if (filePath.endsWith("index.zen")) {
|
|
492
|
+
console.log(`[ZenithDebug] source snippet: ${source.substring(0, 500)}`);
|
|
493
|
+
}
|
|
583
494
|
try {
|
|
584
495
|
const template = native3.parseTemplateNative(source, filePath);
|
|
585
496
|
const script = native3.parseScriptNative(source);
|
|
@@ -599,7 +510,7 @@ function parseZenFile(filePath, sourceInput) {
|
|
|
599
510
|
throw new Error(`[Zenith Native] Parser bridge unavailable - cannot compile ${filePath}`);
|
|
600
511
|
}
|
|
601
512
|
|
|
602
|
-
//
|
|
513
|
+
// ../zenith-compiler/dist/discovery/componentDiscovery.js
|
|
603
514
|
var native4;
|
|
604
515
|
try {
|
|
605
516
|
try {
|
|
@@ -608,10 +519,53 @@ try {
|
|
|
608
519
|
native4 = require_compiler_native2();
|
|
609
520
|
}
|
|
610
521
|
} catch (e) {}
|
|
522
|
+
function discoverComponents(baseDir) {
|
|
523
|
+
if (native4 && native4.discoverComponentsNative) {
|
|
524
|
+
try {
|
|
525
|
+
const raw = native4.discoverComponentsNative(baseDir);
|
|
526
|
+
const components = new Map;
|
|
527
|
+
for (const [name, metadata] of Object.entries(raw)) {
|
|
528
|
+
components.set(name, metadata);
|
|
529
|
+
}
|
|
530
|
+
return components;
|
|
531
|
+
} catch (error3) {
|
|
532
|
+
console.warn(`[Zenith Native] Discovery failed for ${baseDir}: ${error3.message}`);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
return new Map;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// ../zenith-compiler/dist/transform/componentResolver.js
|
|
539
|
+
var import_compiler_native = __toESM(require_compiler_native2(), 1);
|
|
540
|
+
function resolveComponentsInIR(ir, components) {
|
|
541
|
+
console.error(`[ZenithDebug] resolveComponentsInIR called with ${components.size} components`);
|
|
542
|
+
for (const [name, meta] of components) {
|
|
543
|
+
console.error(`[ZenithDebug] Component '${name}': script=${meta.script ? meta.script.length : "null"} bytes`);
|
|
544
|
+
}
|
|
545
|
+
const irJson = JSON.stringify(ir);
|
|
546
|
+
const componentsRecord = {};
|
|
547
|
+
for (const [key, value] of components) {
|
|
548
|
+
componentsRecord[key] = value;
|
|
549
|
+
}
|
|
550
|
+
const componentsJson = JSON.stringify(componentsRecord);
|
|
551
|
+
console.error(`[ZenithDebug] Calling resolveComponentsNative...`);
|
|
552
|
+
const resolvedJson = import_compiler_native.resolveComponentsNative(irJson, componentsJson);
|
|
553
|
+
console.error(`[ZenithDebug] resolveComponentsNative returned ${resolvedJson.length} bytes`);
|
|
554
|
+
return JSON.parse(resolvedJson);
|
|
555
|
+
}
|
|
556
|
+
// ../zenith-compiler/dist/discovery/layouts.js
|
|
557
|
+
var native5;
|
|
558
|
+
try {
|
|
559
|
+
try {
|
|
560
|
+
native5 = require_compiler_native2();
|
|
561
|
+
} catch {
|
|
562
|
+
native5 = require_compiler_native2();
|
|
563
|
+
}
|
|
564
|
+
} catch (e) {}
|
|
611
565
|
function discoverLayouts(layoutsDir) {
|
|
612
|
-
if (
|
|
566
|
+
if (native5 && native5.discoverLayoutsNative) {
|
|
613
567
|
try {
|
|
614
|
-
const raw =
|
|
568
|
+
const raw = native5.discoverLayoutsNative(layoutsDir);
|
|
615
569
|
const layouts = new Map;
|
|
616
570
|
for (const [name, metadata] of Object.entries(raw)) {
|
|
617
571
|
const meta = metadata;
|
|
@@ -632,17 +586,17 @@ function discoverLayouts(layoutsDir) {
|
|
|
632
586
|
}
|
|
633
587
|
return new Map;
|
|
634
588
|
}
|
|
635
|
-
//
|
|
636
|
-
var
|
|
589
|
+
// ../zenith-compiler/dist/transform/layoutProcessor.js
|
|
590
|
+
var native6;
|
|
637
591
|
try {
|
|
638
592
|
try {
|
|
639
|
-
|
|
593
|
+
native6 = require_compiler_native2();
|
|
640
594
|
} catch {
|
|
641
|
-
|
|
595
|
+
native6 = require_compiler_native2();
|
|
642
596
|
}
|
|
643
597
|
} catch (e) {}
|
|
644
598
|
function processLayout(source, layout, props = {}) {
|
|
645
|
-
if (
|
|
599
|
+
if (native6 && native6.processLayoutNative) {
|
|
646
600
|
try {
|
|
647
601
|
const layoutForNative = {
|
|
648
602
|
name: layout.name,
|
|
@@ -650,18 +604,18 @@ function processLayout(source, layout, props = {}) {
|
|
|
650
604
|
scripts: layout.scripts,
|
|
651
605
|
styles: layout.styles
|
|
652
606
|
};
|
|
653
|
-
return
|
|
607
|
+
return native6.processLayoutNative(source, JSON.stringify(layoutForNative), JSON.stringify(props));
|
|
654
608
|
} catch (error3) {
|
|
655
609
|
console.warn(`[Zenith Native] Layout processing failed: ${error3.message}`);
|
|
656
610
|
}
|
|
657
611
|
}
|
|
658
612
|
return source;
|
|
659
613
|
}
|
|
660
|
-
// node_modules/rolldown/dist/shared/binding-C-UNREnT.mjs
|
|
614
|
+
// ../zenith-compiler/node_modules/rolldown/dist/shared/binding-C-UNREnT.mjs
|
|
661
615
|
import { createRequire } from "module";
|
|
662
616
|
var __create2 = Object.create;
|
|
663
617
|
var __defProp2 = Object.defineProperty;
|
|
664
|
-
var
|
|
618
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
665
619
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
666
620
|
var __getProtoOf2 = Object.getPrototypeOf;
|
|
667
621
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
@@ -673,7 +627,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
673
627
|
if (!__hasOwnProp2.call(to, key) && key !== except) {
|
|
674
628
|
__defProp2(to, key, {
|
|
675
629
|
get: ((k) => from[k]).bind(null, key),
|
|
676
|
-
enumerable: !(desc =
|
|
630
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
677
631
|
});
|
|
678
632
|
}
|
|
679
633
|
}
|
|
@@ -1289,7 +1243,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin((exports, module) => {
|
|
|
1289
1243
|
module.exports.startAsyncRuntime = nativeBinding.startAsyncRuntime;
|
|
1290
1244
|
});
|
|
1291
1245
|
|
|
1292
|
-
// node_modules/rolldown/dist/shared/logs-NH298mHo.mjs
|
|
1246
|
+
// ../zenith-compiler/node_modules/rolldown/dist/shared/logs-NH298mHo.mjs
|
|
1293
1247
|
function spaces(index) {
|
|
1294
1248
|
let result = "";
|
|
1295
1249
|
while (index--)
|
|
@@ -1456,7 +1410,7 @@ function augmentCodeLocation(properties, pos, source, id) {
|
|
|
1456
1410
|
}
|
|
1457
1411
|
}
|
|
1458
1412
|
|
|
1459
|
-
// node_modules/rolldown/dist/shared/normalize-string-or-regex-Dq50a7l9.mjs
|
|
1413
|
+
// ../zenith-compiler/node_modules/rolldown/dist/shared/normalize-string-or-regex-Dq50a7l9.mjs
|
|
1460
1414
|
var import_binding = /* @__PURE__ */ __toESM2(require_binding(), 1);
|
|
1461
1415
|
var BuiltinPlugin = class {
|
|
1462
1416
|
enforce;
|
|
@@ -1494,7 +1448,7 @@ function isReadonlyArray(input) {
|
|
|
1494
1448
|
return Array.isArray(input);
|
|
1495
1449
|
}
|
|
1496
1450
|
|
|
1497
|
-
// node_modules/rolldown/dist/shared/misc-CCZIsXVO.mjs
|
|
1451
|
+
// ../zenith-compiler/node_modules/rolldown/dist/shared/misc-CCZIsXVO.mjs
|
|
1498
1452
|
function arraify(value) {
|
|
1499
1453
|
return Array.isArray(value) ? value : [value];
|
|
1500
1454
|
}
|
|
@@ -1513,7 +1467,7 @@ function unsupported(info3) {
|
|
|
1513
1467
|
}
|
|
1514
1468
|
function noop(..._args) {}
|
|
1515
1469
|
|
|
1516
|
-
// node_modules/rolldown/dist/shared/parse-ast-index-B6LAhWD8.mjs
|
|
1470
|
+
// ../zenith-compiler/node_modules/rolldown/dist/shared/parse-ast-index-B6LAhWD8.mjs
|
|
1517
1471
|
function wrap$1(result) {
|
|
1518
1472
|
let program, module, comments, errors;
|
|
1519
1473
|
return {
|
|
@@ -1601,10 +1555,10 @@ function parseAst(sourceText, options, filename) {
|
|
|
1601
1555
|
}), filename, sourceText);
|
|
1602
1556
|
}
|
|
1603
1557
|
|
|
1604
|
-
// node_modules/rolldown/dist/shared/bindingify-input-options-Cb-01HR1.mjs
|
|
1558
|
+
// ../zenith-compiler/node_modules/rolldown/dist/shared/bindingify-input-options-Cb-01HR1.mjs
|
|
1605
1559
|
import path2 from "path";
|
|
1606
1560
|
|
|
1607
|
-
// node_modules/@rolldown/pluginutils/dist/filter/composable-filters.js
|
|
1561
|
+
// ../zenith-compiler/node_modules/@rolldown/pluginutils/dist/filter/composable-filters.js
|
|
1608
1562
|
class And {
|
|
1609
1563
|
kind;
|
|
1610
1564
|
args;
|
|
@@ -1695,7 +1649,7 @@ function include(expr) {
|
|
|
1695
1649
|
function exclude(expr) {
|
|
1696
1650
|
return new Exclude(expr);
|
|
1697
1651
|
}
|
|
1698
|
-
// node_modules/rolldown/dist/shared/bindingify-input-options-Cb-01HR1.mjs
|
|
1652
|
+
// ../zenith-compiler/node_modules/rolldown/dist/shared/bindingify-input-options-Cb-01HR1.mjs
|
|
1699
1653
|
import fsp from "fs/promises";
|
|
1700
1654
|
var version = "1.0.0-rc.1";
|
|
1701
1655
|
var VERSION = version;
|
|
@@ -3917,7 +3871,7 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
|
|
|
3917
3871
|
};
|
|
3918
3872
|
}
|
|
3919
3873
|
|
|
3920
|
-
// node_modules/rolldown/dist/shared/rolldown-build-KB1YaNe-.mjs
|
|
3874
|
+
// ../zenith-compiler/node_modules/rolldown/dist/shared/rolldown-build-KB1YaNe-.mjs
|
|
3921
3875
|
import { Worker } from "worker_threads";
|
|
3922
3876
|
import path3 from "path";
|
|
3923
3877
|
import { styleText } from "util";
|
|
@@ -6043,7 +5997,7 @@ var RolldownBuild = class RolldownBuild2 {
|
|
|
6043
5997
|
}
|
|
6044
5998
|
};
|
|
6045
5999
|
|
|
6046
|
-
// node_modules/rolldown/dist/shared/watch-B2WRkpw2.mjs
|
|
6000
|
+
// ../zenith-compiler/node_modules/rolldown/dist/shared/watch-B2WRkpw2.mjs
|
|
6047
6001
|
var signals = [];
|
|
6048
6002
|
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
6049
6003
|
if (process.platform !== "win32")
|
|
@@ -6231,13 +6185,13 @@ function onExit(...args2) {
|
|
|
6231
6185
|
}
|
|
6232
6186
|
var import_binding5 = /* @__PURE__ */ __toESM2(require_binding());
|
|
6233
6187
|
|
|
6234
|
-
// node_modules/rolldown/dist/shared/rolldown-CIC_OHw3.mjs
|
|
6188
|
+
// ../zenith-compiler/node_modules/rolldown/dist/shared/rolldown-CIC_OHw3.mjs
|
|
6235
6189
|
var rolldown = async (input) => {
|
|
6236
6190
|
validateOption("input", input);
|
|
6237
6191
|
return new RolldownBuild(await PluginDriver.callOptionsHook(input));
|
|
6238
6192
|
};
|
|
6239
6193
|
|
|
6240
|
-
// node_modules/rolldown/dist/index.mjs
|
|
6194
|
+
// ../zenith-compiler/node_modules/rolldown/dist/index.mjs
|
|
6241
6195
|
import { isMainThread } from "worker_threads";
|
|
6242
6196
|
var import_binding6 = /* @__PURE__ */ __toESM2(require_binding(), 1);
|
|
6243
6197
|
if (isMainThread) {
|
|
@@ -6248,7 +6202,7 @@ if (isMainThread) {
|
|
|
6248
6202
|
}
|
|
6249
6203
|
var BindingMagicString = import_binding6.BindingMagicString;
|
|
6250
6204
|
|
|
6251
|
-
//
|
|
6205
|
+
// ../zenith-compiler/dist/bundler.js
|
|
6252
6206
|
async function bundlePageScript(plan) {
|
|
6253
6207
|
const VIRTUAL_ENTRY = "\x00zenith:entry";
|
|
6254
6208
|
const virtualModules = new Map;
|
|
@@ -6292,21 +6246,21 @@ async function bundlePageScript(plan) {
|
|
|
6292
6246
|
}
|
|
6293
6247
|
return output[0].code;
|
|
6294
6248
|
}
|
|
6295
|
-
//
|
|
6249
|
+
// ../zenith-compiler/dist/ssg-build.js
|
|
6296
6250
|
import fs5 from "fs";
|
|
6297
6251
|
import path8 from "path";
|
|
6298
6252
|
|
|
6299
|
-
// node_modules/@zenithbuild/router/src/manifest.ts
|
|
6253
|
+
// ../zenith-compiler/node_modules/@zenithbuild/router/src/manifest.ts
|
|
6300
6254
|
import fs2 from "fs";
|
|
6301
6255
|
import path4 from "path";
|
|
6302
6256
|
|
|
6303
|
-
// node_modules/@zenithbuild/router/index.js
|
|
6257
|
+
// ../zenith-compiler/node_modules/@zenithbuild/router/index.js
|
|
6304
6258
|
import { createRequire as createRequire2 } from "module";
|
|
6305
6259
|
var require2 = createRequire2(import.meta.url);
|
|
6306
|
-
var
|
|
6307
|
-
var { generateRouteManifestNative, renderRouteNative, resolveRouteNative, generateRuntimeRouterNative, SegmentType, routerBridge } =
|
|
6260
|
+
var native7 = require2("./zenith-router.node");
|
|
6261
|
+
var { generateRouteManifestNative, renderRouteNative, resolveRouteNative, generateRuntimeRouterNative, SegmentType, routerBridge } = native7;
|
|
6308
6262
|
|
|
6309
|
-
// node_modules/@zenithbuild/router/src/manifest.ts
|
|
6263
|
+
// ../zenith-compiler/node_modules/@zenithbuild/router/src/manifest.ts
|
|
6310
6264
|
var SEGMENT_SCORES = {
|
|
6311
6265
|
[SegmentType.Static]: 10,
|
|
6312
6266
|
[SegmentType.Dynamic]: 5,
|
|
@@ -6435,7 +6389,7 @@ function generateRouteDefinition(filePath, pagesDir) {
|
|
|
6435
6389
|
};
|
|
6436
6390
|
}
|
|
6437
6391
|
|
|
6438
|
-
//
|
|
6392
|
+
// ../zenith-compiler/dist/build-analyzer.js
|
|
6439
6393
|
function analyzePageSource(source) {
|
|
6440
6394
|
const scriptMatch = source.match(/<script[^>]*>([\s\S]*?)<\/script>/i);
|
|
6441
6395
|
const scriptContent = scriptMatch?.[1] || "";
|
|
@@ -6493,24 +6447,42 @@ function getBuildOutputType(analysis) {
|
|
|
6493
6447
|
return "static";
|
|
6494
6448
|
}
|
|
6495
6449
|
|
|
6496
|
-
//
|
|
6450
|
+
// ../zenith-compiler/dist/runtime/bundle-generator.js
|
|
6497
6451
|
import { readFileSync as readFileSync2, existsSync } from "fs";
|
|
6498
6452
|
import path5 from "path";
|
|
6499
6453
|
function generateBundleJS(pluginData) {
|
|
6500
6454
|
const serializedData = pluginData ? JSON.stringify(pluginData).replace(/<\/script/g, "<\\/script") : "{}";
|
|
6501
6455
|
const rootDir = process.cwd();
|
|
6502
|
-
|
|
6456
|
+
let coreRuntimePath = path5.join(rootDir, "../zenith-core/dist/runtime");
|
|
6457
|
+
if (!existsSync(coreRuntimePath)) {
|
|
6458
|
+
coreRuntimePath = path5.join(rootDir, "../zenith-core/core");
|
|
6459
|
+
}
|
|
6503
6460
|
let reactivityJS = "";
|
|
6504
6461
|
let lifecycleJS = "";
|
|
6505
6462
|
try {
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
if (existsSync(lifecycleFile))
|
|
6511
|
-
|
|
6463
|
+
let reactivityFile = path5.join(coreRuntimePath, "reactivity/index.js");
|
|
6464
|
+
if (!existsSync(reactivityFile))
|
|
6465
|
+
reactivityFile = path5.join(coreRuntimePath, "reactivity/index.ts");
|
|
6466
|
+
let lifecycleFile = path5.join(coreRuntimePath, "lifecycle/index.js");
|
|
6467
|
+
if (!existsSync(lifecycleFile))
|
|
6468
|
+
lifecycleFile = path5.join(coreRuntimePath, "lifecycle/index.ts");
|
|
6469
|
+
if (existsSync(reactivityFile) && reactivityFile.endsWith(".js")) {
|
|
6470
|
+
reactivityJS = transformExportsToGlobal(readFileSync2(reactivityFile, "utf-8"));
|
|
6471
|
+
}
|
|
6472
|
+
if (existsSync(lifecycleFile) && lifecycleFile.endsWith(".js")) {
|
|
6473
|
+
lifecycleJS = transformExportsToGlobal(readFileSync2(lifecycleFile, "utf-8"));
|
|
6474
|
+
}
|
|
6512
6475
|
} catch (e2) {
|
|
6513
|
-
console.warn("[Zenith] Could not load runtime from core
|
|
6476
|
+
console.warn("[Zenith] Could not load runtime from core, falling back to internal", e2);
|
|
6477
|
+
}
|
|
6478
|
+
if (!reactivityJS || !lifecycleJS) {
|
|
6479
|
+
const compilerRoot = path5.resolve(path5.dirname(import.meta.url.replace("file://", "")), "../../..");
|
|
6480
|
+
const nativeRuntimePath = path5.join(compilerRoot, "native/compiler-native/src/hydration_runtime.js");
|
|
6481
|
+
if (existsSync(nativeRuntimePath)) {
|
|
6482
|
+
const nativeJS = readFileSync2(nativeRuntimePath, "utf-8");
|
|
6483
|
+
reactivityJS = nativeJS;
|
|
6484
|
+
lifecycleJS = " ";
|
|
6485
|
+
}
|
|
6514
6486
|
}
|
|
6515
6487
|
return `/*!
|
|
6516
6488
|
* Zenith Runtime v1.0.1
|
|
@@ -6532,6 +6504,73 @@ ${lifecycleJS ? ` // ============================================
|
|
|
6532
6504
|
// ============================================
|
|
6533
6505
|
${lifecycleJS}` : ` // Fallback: Lifecycle not found`}
|
|
6534
6506
|
|
|
6507
|
+
// ----------------------------------------------------------------------
|
|
6508
|
+
// COMPAT: Expose internal exports as globals
|
|
6509
|
+
// ----------------------------------------------------------------------
|
|
6510
|
+
// The code above was stripped of "export { ... }" but assigned to internal variables.
|
|
6511
|
+
// We need to map them back to global scope if they weren't attached by the code itself.
|
|
6512
|
+
|
|
6513
|
+
// Reactivity primitives map (internal name -> global alias)
|
|
6514
|
+
// Based on zenith-core/core/reactivity/index.ts re-exports:
|
|
6515
|
+
// export { zenSignal, zenState, ... }
|
|
6516
|
+
|
|
6517
|
+
// Since we stripped exports, we rely on the fact that the bundled code
|
|
6518
|
+
// defines variables like "var zenSignal = ..." or "function zenSignal...".
|
|
6519
|
+
// Note: Minified code variables might be renamed (e.g., "var P=...").
|
|
6520
|
+
// Ideally, @zenithbuild/core should export an IIFE build for this purpose.
|
|
6521
|
+
// For now, we assume the code above already does "global.zenSignal = ..."
|
|
6522
|
+
// OR we rely on the Aliases section below to do the mapping if the names match.
|
|
6523
|
+
|
|
6524
|
+
// ============================================
|
|
6525
|
+
// Lifecycle Hooks (Required for hydration)
|
|
6526
|
+
// ============================================
|
|
6527
|
+
// These functions are required by the runtime - define them if not injected from core
|
|
6528
|
+
|
|
6529
|
+
const mountCallbacks = [];
|
|
6530
|
+
const unmountCallbacks = [];
|
|
6531
|
+
let isMounted = false;
|
|
6532
|
+
|
|
6533
|
+
function zenOnMount(fn) {
|
|
6534
|
+
if (isMounted) {
|
|
6535
|
+
// Already mounted, run immediately
|
|
6536
|
+
const cleanup = fn();
|
|
6537
|
+
if (typeof cleanup === 'function') {
|
|
6538
|
+
unmountCallbacks.push(cleanup);
|
|
6539
|
+
}
|
|
6540
|
+
} else {
|
|
6541
|
+
mountCallbacks.push(fn);
|
|
6542
|
+
}
|
|
6543
|
+
}
|
|
6544
|
+
|
|
6545
|
+
function zenOnUnmount(fn) {
|
|
6546
|
+
unmountCallbacks.push(fn);
|
|
6547
|
+
}
|
|
6548
|
+
|
|
6549
|
+
// Called by hydration when page mounts
|
|
6550
|
+
function triggerMount() {
|
|
6551
|
+
isMounted = true;
|
|
6552
|
+
for (let i = 0; i < mountCallbacks.length; i++) {
|
|
6553
|
+
try {
|
|
6554
|
+
const cleanup = mountCallbacks[i]();
|
|
6555
|
+
if (typeof cleanup === 'function') {
|
|
6556
|
+
unmountCallbacks.push(cleanup);
|
|
6557
|
+
}
|
|
6558
|
+
} catch(e) {
|
|
6559
|
+
console.error('[Zenith] Mount callback error:', e);
|
|
6560
|
+
}
|
|
6561
|
+
}
|
|
6562
|
+
mountCallbacks.length = 0;
|
|
6563
|
+
}
|
|
6564
|
+
|
|
6565
|
+
// Called by router when page unmounts
|
|
6566
|
+
function triggerUnmount() {
|
|
6567
|
+
isMounted = false;
|
|
6568
|
+
for (let i = 0; i < unmountCallbacks.length; i++) {
|
|
6569
|
+
try { unmountCallbacks[i](); } catch(e) { console.error('[Zenith] Unmount error:', e); }
|
|
6570
|
+
}
|
|
6571
|
+
unmountCallbacks.length = 0;
|
|
6572
|
+
}
|
|
6573
|
+
|
|
6535
6574
|
// ============================================
|
|
6536
6575
|
// Component Instance System
|
|
6537
6576
|
// ============================================
|
|
@@ -6567,27 +6606,27 @@ ${lifecycleJS ? ` // ============================================
|
|
|
6567
6606
|
|
|
6568
6607
|
// Reactivity (uses global primitives but tracks for cleanup)
|
|
6569
6608
|
signal: function(initial) {
|
|
6570
|
-
return zenSignal(initial);
|
|
6609
|
+
return global.zenSignal(initial);
|
|
6571
6610
|
},
|
|
6572
6611
|
state: function(initial) {
|
|
6573
|
-
return zenState(initial);
|
|
6612
|
+
return global.zenState(initial);
|
|
6574
6613
|
},
|
|
6575
6614
|
ref: function(initial) {
|
|
6576
|
-
return zenRef(initial);
|
|
6615
|
+
return global.zenRef(initial);
|
|
6577
6616
|
},
|
|
6578
6617
|
effect: function(fn) {
|
|
6579
|
-
const cleanup = zenEffect(fn);
|
|
6618
|
+
const cleanup = global.zenEffect(fn);
|
|
6580
6619
|
instanceEffects.push(cleanup);
|
|
6581
6620
|
return cleanup;
|
|
6582
6621
|
},
|
|
6583
6622
|
memo: function(fn) {
|
|
6584
|
-
return zenMemo(fn);
|
|
6623
|
+
return global.zenMemo(fn);
|
|
6585
6624
|
},
|
|
6586
6625
|
batch: function(fn) {
|
|
6587
|
-
zenBatch(fn);
|
|
6626
|
+
global.zenBatch(fn);
|
|
6588
6627
|
},
|
|
6589
6628
|
untrack: function(fn) {
|
|
6590
|
-
return zenUntrack(fn);
|
|
6629
|
+
return global.zenUntrack(fn);
|
|
6591
6630
|
},
|
|
6592
6631
|
|
|
6593
6632
|
// Lifecycle execution
|
|
@@ -6848,41 +6887,59 @@ ${lifecycleJS ? ` // ============================================
|
|
|
6848
6887
|
/**
|
|
6849
6888
|
* Hydrate static HTML with dynamic expressions
|
|
6850
6889
|
*/
|
|
6890
|
+
/**
|
|
6891
|
+
* Hydrate static HTML with dynamic expressions (Comment-based)
|
|
6892
|
+
*/
|
|
6851
6893
|
function zenithHydrate(pageState, container) {
|
|
6852
6894
|
try {
|
|
6853
6895
|
container = container || document;
|
|
6854
6896
|
|
|
6855
|
-
//
|
|
6856
|
-
const
|
|
6857
|
-
|
|
6897
|
+
// Walker to find comment nodes efficiently
|
|
6898
|
+
const walker = document.createTreeWalker(
|
|
6899
|
+
container,
|
|
6900
|
+
NodeFilter.SHOW_COMMENT,
|
|
6901
|
+
null,
|
|
6902
|
+
false
|
|
6903
|
+
);
|
|
6858
6904
|
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6905
|
+
const exprLocationMap = new Map();
|
|
6906
|
+
let node;
|
|
6907
|
+
|
|
6908
|
+
while(node = walker.nextNode()) {
|
|
6909
|
+
const content = node.nodeValue || '';
|
|
6910
|
+
if (content.startsWith('zen:expr_')) {
|
|
6911
|
+
const exprId = content.replace('zen:expr_', '');
|
|
6912
|
+
exprLocationMap.set(node, exprId);
|
|
6913
|
+
}
|
|
6914
|
+
}
|
|
6915
|
+
|
|
6916
|
+
// Process expressions
|
|
6917
|
+
for (const [commentNode, exprId] of exprLocationMap) {
|
|
6918
|
+
updateNode(commentNode, exprId, pageState);
|
|
6919
|
+
}
|
|
6869
6920
|
|
|
6870
|
-
// Wire up event handlers
|
|
6921
|
+
// Wire up event handlers (still attribute based, usually safe)
|
|
6871
6922
|
const eventTypes = ['click', 'change', 'input', 'submit', 'focus', 'blur', 'keyup', 'keydown'];
|
|
6872
6923
|
eventTypes.forEach(eventType => {
|
|
6873
6924
|
const elements = container.querySelectorAll('[data-zen-' + eventType + ']');
|
|
6874
6925
|
elements.forEach(el => {
|
|
6875
6926
|
const handlerName = el.getAttribute('data-zen-' + eventType);
|
|
6876
|
-
|
|
6927
|
+
// Check global scope (window) or expression registry
|
|
6928
|
+
if (handlerName) {
|
|
6877
6929
|
el.addEventListener(eventType, function(e) {
|
|
6878
|
-
|
|
6879
|
-
|
|
6930
|
+
// Resolve handler at runtime to allow for late definition
|
|
6931
|
+
const handler = global[handlerName] || getExpression(handlerName);
|
|
6932
|
+
if (typeof handler === 'function') {
|
|
6933
|
+
handler(e, el);
|
|
6934
|
+
} else {
|
|
6935
|
+
console.warn('[Zenith] Handler not found:', handlerName);
|
|
6936
|
+
}
|
|
6880
6937
|
});
|
|
6881
6938
|
}
|
|
6882
6939
|
});
|
|
6883
6940
|
});
|
|
6884
6941
|
|
|
6885
|
-
// Trigger mount
|
|
6942
|
+
// Trigger mount
|
|
6886
6943
|
if (container === document || container.id === 'app' || container.tagName === 'BODY') {
|
|
6887
6944
|
triggerMount();
|
|
6888
6945
|
}
|
|
@@ -6890,6 +6947,45 @@ ${lifecycleJS ? ` // ============================================
|
|
|
6890
6947
|
renderErrorPage(e, { activity: 'zenithHydrate' });
|
|
6891
6948
|
}
|
|
6892
6949
|
}
|
|
6950
|
+
|
|
6951
|
+
// Update logic for comment placeholders
|
|
6952
|
+
function updateNode(placeholder, exprId, pageState) {
|
|
6953
|
+
const expr = getExpression(exprId);
|
|
6954
|
+
if (!expr) return;
|
|
6955
|
+
|
|
6956
|
+
// Store reference to current nodes for cleanup
|
|
6957
|
+
let currentNodes = [];
|
|
6958
|
+
|
|
6959
|
+
zenEffect(function() {
|
|
6960
|
+
try {
|
|
6961
|
+
const result = expr(pageState);
|
|
6962
|
+
|
|
6963
|
+
// Cleanup old nodes
|
|
6964
|
+
currentNodes.forEach(n => n.remove());
|
|
6965
|
+
currentNodes = [];
|
|
6966
|
+
|
|
6967
|
+
if (result == null || result === false) {
|
|
6968
|
+
// Render nothing
|
|
6969
|
+
} else if (result instanceof Node) {
|
|
6970
|
+
placeholder.parentNode.insertBefore(result, placeholder);
|
|
6971
|
+
currentNodes.push(result);
|
|
6972
|
+
} else if (Array.isArray(result)) {
|
|
6973
|
+
result.flat(Infinity).forEach(item => {
|
|
6974
|
+
const n = item instanceof Node ? item : document.createTextNode(String(item));
|
|
6975
|
+
placeholder.parentNode.insertBefore(n, placeholder);
|
|
6976
|
+
currentNodes.push(n);
|
|
6977
|
+
});
|
|
6978
|
+
} else {
|
|
6979
|
+
// Primitive
|
|
6980
|
+
const n = document.createTextNode(String(result));
|
|
6981
|
+
placeholder.parentNode.insertBefore(n, placeholder);
|
|
6982
|
+
currentNodes.push(n);
|
|
6983
|
+
}
|
|
6984
|
+
} catch (e) {
|
|
6985
|
+
renderErrorPage(e, { expressionId: exprId });
|
|
6986
|
+
}
|
|
6987
|
+
});
|
|
6988
|
+
}
|
|
6893
6989
|
|
|
6894
6990
|
// ============================================
|
|
6895
6991
|
// zenith:content - Content Engine
|
|
@@ -7273,15 +7369,15 @@ ${lifecycleJS ? ` // ============================================
|
|
|
7273
7369
|
// Export to window.__zenith
|
|
7274
7370
|
// ============================================
|
|
7275
7371
|
|
|
7276
|
-
global.__zenith = {
|
|
7277
|
-
// Reactivity primitives
|
|
7278
|
-
signal: zenSignal,
|
|
7279
|
-
state: zenState,
|
|
7280
|
-
effect: zenEffect,
|
|
7281
|
-
memo: zenMemo,
|
|
7282
|
-
ref: zenRef,
|
|
7283
|
-
batch: zenBatch,
|
|
7284
|
-
untrack: zenUntrack,
|
|
7372
|
+
global.__zenith = Object.assign(global.__zenith || {}, {
|
|
7373
|
+
// Reactivity primitives (from hydration_runtime.js via global)
|
|
7374
|
+
signal: global.zenSignal,
|
|
7375
|
+
state: global.zenState,
|
|
7376
|
+
effect: global.zenEffect,
|
|
7377
|
+
memo: global.zenMemo,
|
|
7378
|
+
ref: global.zenRef,
|
|
7379
|
+
batch: global.zenBatch,
|
|
7380
|
+
untrack: global.zenUntrack,
|
|
7285
7381
|
// zenith:content
|
|
7286
7382
|
defineSchema: defineSchema,
|
|
7287
7383
|
zenCollection: zenCollection,
|
|
@@ -7306,36 +7402,31 @@ ${lifecycleJS ? ` // ============================================
|
|
|
7306
7402
|
createInstance: createComponentInstance,
|
|
7307
7403
|
defineComponent: defineComponent,
|
|
7308
7404
|
instantiate: instantiateComponent
|
|
7309
|
-
};
|
|
7405
|
+
});
|
|
7310
7406
|
|
|
7311
|
-
//
|
|
7312
|
-
global.
|
|
7313
|
-
global.zenState = zenState;
|
|
7314
|
-
global.zenEffect = zenEffect;
|
|
7315
|
-
global.zenMemo = zenMemo;
|
|
7316
|
-
global.zenRef = zenRef;
|
|
7317
|
-
global.zenBatch = zenBatch;
|
|
7318
|
-
global.zenUntrack = zenUntrack;
|
|
7319
|
-
global.zenOnMount = zenOnMount;
|
|
7320
|
-
global.zenOnUnmount = zenOnUnmount;
|
|
7321
|
-
global.zenithHydrate = zenithHydrate;
|
|
7407
|
+
// NOTE: zen* primitives (zenSignal, zenState, zenEffect, etc.) are already
|
|
7408
|
+
// assigned to global by hydration_runtime.js IIFE - no need to reassign here.
|
|
7322
7409
|
|
|
7323
|
-
// Clean aliases
|
|
7324
|
-
global.signal = zenSignal;
|
|
7325
|
-
global.state = zenState;
|
|
7326
|
-
global.effect = zenEffect;
|
|
7327
|
-
global.memo = zenMemo;
|
|
7328
|
-
global.ref = zenRef;
|
|
7329
|
-
global.batch = zenBatch;
|
|
7330
|
-
global.untrack = zenUntrack;
|
|
7331
|
-
global.onMount = zenOnMount;
|
|
7332
|
-
global.onUnmount = zenOnUnmount;
|
|
7410
|
+
// Clean aliases (point to already-assigned globals)
|
|
7411
|
+
global.signal = global.zenSignal;
|
|
7412
|
+
global.state = global.zenState;
|
|
7413
|
+
global.effect = global.zenEffect;
|
|
7414
|
+
global.memo = global.zenMemo;
|
|
7415
|
+
global.ref = global.zenRef;
|
|
7416
|
+
global.batch = global.zenBatch;
|
|
7417
|
+
global.untrack = global.zenUntrack;
|
|
7418
|
+
global.onMount = global.zenOnMount;
|
|
7419
|
+
global.onUnmount = global.zenOnUnmount;
|
|
7333
7420
|
|
|
7334
7421
|
// useZenOrder hook exports
|
|
7335
7422
|
global.createZenOrder = createZenOrder;
|
|
7336
7423
|
global.processRawSections = processRawSections;
|
|
7337
7424
|
global.slugify = slugify;
|
|
7338
7425
|
|
|
7426
|
+
// zenith:content exports
|
|
7427
|
+
global.zenCollection = zenCollection;
|
|
7428
|
+
global.ZenCollection = ZenCollection;
|
|
7429
|
+
|
|
7339
7430
|
// ============================================
|
|
7340
7431
|
// SPA Router Runtime
|
|
7341
7432
|
// ============================================
|
|
@@ -7719,8 +7810,26 @@ ${lifecycleJS ? ` // ============================================
|
|
|
7719
7810
|
})(typeof window !== 'undefined' ? window : this);
|
|
7720
7811
|
`;
|
|
7721
7812
|
}
|
|
7813
|
+
function transformExportsToGlobal(code2) {
|
|
7814
|
+
const exportPattern = /export\s*\{\s*([^}]+)\s*\};?/g;
|
|
7815
|
+
return code2.replace(exportPattern, (match, content) => {
|
|
7816
|
+
const parts = content.split(",");
|
|
7817
|
+
const assignments = parts.map((part) => {
|
|
7818
|
+
const trimmed = part.trim();
|
|
7819
|
+
if (!trimmed)
|
|
7820
|
+
return "";
|
|
7821
|
+
const asMatch = trimmed.match(/^(\S+)\s+as\s+(\S+)$/);
|
|
7822
|
+
if (asMatch) {
|
|
7823
|
+
return `global.${asMatch[2]} = ${asMatch[1]};`;
|
|
7824
|
+
}
|
|
7825
|
+
return `global.${trimmed} = ${trimmed};`;
|
|
7826
|
+
});
|
|
7827
|
+
return assignments.join(`
|
|
7828
|
+
`);
|
|
7829
|
+
});
|
|
7830
|
+
}
|
|
7722
7831
|
|
|
7723
|
-
//
|
|
7832
|
+
// ../zenith-compiler/dist/css/index.js
|
|
7724
7833
|
import { spawn, spawnSync } from "child_process";
|
|
7725
7834
|
import path6 from "path";
|
|
7726
7835
|
import fs3 from "fs";
|
|
@@ -7865,7 +7974,7 @@ function resolveGlobalsCss(projectRoot) {
|
|
|
7865
7974
|
return null;
|
|
7866
7975
|
}
|
|
7867
7976
|
|
|
7868
|
-
//
|
|
7977
|
+
// ../zenith-compiler/dist/core/config/loader.js
|
|
7869
7978
|
import fs4 from "fs";
|
|
7870
7979
|
import path7 from "path";
|
|
7871
7980
|
async function loadZenithConfig(projectRoot) {
|
|
@@ -7899,7 +8008,7 @@ async function loadZenithConfig(projectRoot) {
|
|
|
7899
8008
|
}
|
|
7900
8009
|
}
|
|
7901
8010
|
|
|
7902
|
-
//
|
|
8011
|
+
// ../zenith-compiler/dist/core/plugins/registry.js
|
|
7903
8012
|
var pluginDataStore = {};
|
|
7904
8013
|
function getPluginDataByNamespace(namespace) {
|
|
7905
8014
|
return pluginDataStore[namespace] || [];
|
|
@@ -7950,7 +8059,7 @@ function createPluginContext(projectRoot) {
|
|
|
7950
8059
|
};
|
|
7951
8060
|
}
|
|
7952
8061
|
|
|
7953
|
-
//
|
|
8062
|
+
// ../zenith-compiler/dist/core/plugins/bridge.js
|
|
7954
8063
|
var hookRegistry = new Map;
|
|
7955
8064
|
function registerHook(hook, handler) {
|
|
7956
8065
|
if (!hookRegistry.has(hook)) {
|
|
@@ -7999,7 +8108,7 @@ function createBridgeAPI() {
|
|
|
7999
8108
|
};
|
|
8000
8109
|
}
|
|
8001
8110
|
|
|
8002
|
-
//
|
|
8111
|
+
// ../zenith-compiler/dist/ssg-build.js
|
|
8003
8112
|
async function compilePage(pagePath, pagesDir, baseDir = process.cwd()) {
|
|
8004
8113
|
const source = fs5.readFileSync(pagePath, "utf-8");
|
|
8005
8114
|
const analysis = analyzePageSource(source);
|
|
@@ -8289,14 +8398,16 @@ async function buildSSG(options) {
|
|
|
8289
8398
|
console.log(` ${page.routePath.padEnd(20)} \u2192 ${page.outputDir}/index.html (${type})`);
|
|
8290
8399
|
}
|
|
8291
8400
|
}
|
|
8292
|
-
//
|
|
8401
|
+
// ../zenith-compiler/dist/index.js
|
|
8293
8402
|
async function compileZenSource(source, filePath, options) {
|
|
8294
8403
|
let ir = parseZenFile(filePath, source);
|
|
8295
|
-
if (options?.componentsDir) {
|
|
8296
|
-
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
|
|
8404
|
+
if (options?.components || options?.componentsDir) {
|
|
8405
|
+
let components = options.components || new Map;
|
|
8406
|
+
if (options.componentsDir) {
|
|
8407
|
+
const discovered = discoverComponents(options.componentsDir);
|
|
8408
|
+
components = new Map([...components, ...discovered]);
|
|
8409
|
+
}
|
|
8410
|
+
ir = resolveComponentsInIR(ir, components);
|
|
8300
8411
|
}
|
|
8301
8412
|
validateIr(ir);
|
|
8302
8413
|
const compiled = transformTemplate(ir);
|
|
@@ -8549,7 +8660,7 @@ ${html}`;
|
|
|
8549
8660
|
const compileTime = Math.round(compileEnd - compileStart);
|
|
8550
8661
|
const renderTime = Math.round(renderEnd - renderStart);
|
|
8551
8662
|
route("GET", pathname, 200, totalTime, compileTime, renderTime);
|
|
8552
|
-
return new Response(html, { headers: { "Content-Type": "text/html" } });
|
|
8663
|
+
return new Response(html, { headers: { "Content-Type": "text/html; charset=utf-8" } });
|
|
8553
8664
|
}
|
|
8554
8665
|
}
|
|
8555
8666
|
route("GET", pathname, 404, Math.round(performance.now() - startTime), 0, 0);
|
|
@@ -8587,8 +8698,10 @@ function findPageForRoute(route2, pagesDir) {
|
|
|
8587
8698
|
if (fs6.existsSync(singleDynamicPath))
|
|
8588
8699
|
return singleDynamicPath;
|
|
8589
8700
|
const catchAllPath = path9.join(baseDir, "[...slug].zen");
|
|
8590
|
-
if (fs6.existsSync(catchAllPath))
|
|
8701
|
+
if (fs6.existsSync(catchAllPath)) {
|
|
8702
|
+
console.log(`[ZenithDev] MATCH! Found ${catchAllPath}`);
|
|
8591
8703
|
return catchAllPath;
|
|
8704
|
+
}
|
|
8592
8705
|
}
|
|
8593
8706
|
const rootCatchAll = path9.join(pagesDir, "[...slug].zen");
|
|
8594
8707
|
if (fs6.existsSync(rootCatchAll))
|