@zenithbuild/compiler 1.3.2 → 1.3.9

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 (73) hide show
  1. package/dist/build-analyzer.d.ts +44 -0
  2. package/dist/build-analyzer.js +87 -0
  3. package/dist/bundler.d.ts +31 -0
  4. package/dist/bundler.js +92 -0
  5. package/dist/core/config/index.d.ts +11 -0
  6. package/dist/core/config/index.js +10 -0
  7. package/dist/core/config/loader.d.ts +17 -0
  8. package/dist/core/config/loader.js +60 -0
  9. package/dist/core/config/types.d.ts +98 -0
  10. package/dist/core/config/types.js +32 -0
  11. package/dist/core/index.d.ts +7 -0
  12. package/dist/core/index.js +6 -0
  13. package/dist/core/plugins/bridge.d.ts +116 -0
  14. package/dist/core/plugins/bridge.js +121 -0
  15. package/dist/core/plugins/index.d.ts +6 -0
  16. package/dist/core/plugins/index.js +6 -0
  17. package/dist/core/plugins/registry.d.ts +67 -0
  18. package/dist/core/plugins/registry.js +112 -0
  19. package/dist/css/index.d.ts +73 -0
  20. package/dist/css/index.js +246 -0
  21. package/dist/discovery/componentDiscovery.d.ts +41 -0
  22. package/dist/discovery/componentDiscovery.js +66 -0
  23. package/dist/discovery/layouts.d.ts +14 -0
  24. package/dist/discovery/layouts.js +36 -0
  25. package/dist/errors/compilerError.d.ts +31 -0
  26. package/dist/errors/compilerError.js +51 -0
  27. package/dist/finalize/generateFinalBundle.d.ts +24 -0
  28. package/dist/finalize/generateFinalBundle.js +68 -0
  29. package/dist/index.d.ts +34 -0
  30. package/dist/index.js +44 -0
  31. package/dist/ir/types.d.ts +206 -0
  32. package/dist/ir/types.js +8 -0
  33. package/dist/output/types.d.ts +39 -0
  34. package/dist/output/types.js +6 -0
  35. package/dist/parseZenFile.d.ts +17 -0
  36. package/dist/parseZenFile.js +52 -0
  37. package/dist/runtime/build.d.ts +6 -0
  38. package/dist/runtime/build.js +13 -0
  39. package/dist/runtime/bundle-generator.d.ts +27 -0
  40. package/dist/runtime/bundle-generator.js +1438 -0
  41. package/dist/runtime/client-runtime.d.ts +41 -0
  42. package/dist/runtime/client-runtime.js +397 -0
  43. package/dist/runtime/hydration.d.ts +53 -0
  44. package/dist/runtime/hydration.js +271 -0
  45. package/dist/runtime/navigation.d.ts +58 -0
  46. package/dist/runtime/navigation.js +372 -0
  47. package/dist/runtime/serve.d.ts +13 -0
  48. package/dist/runtime/serve.js +76 -0
  49. package/dist/runtime/thinRuntime.d.ts +23 -0
  50. package/dist/runtime/thinRuntime.js +158 -0
  51. package/dist/spa-build.d.ts +26 -0
  52. package/dist/spa-build.js +849 -0
  53. package/dist/ssg-build.d.ts +31 -0
  54. package/dist/ssg-build.js +429 -0
  55. package/dist/test/bundler-contract.test.d.ts +1 -0
  56. package/dist/test/bundler-contract.test.js +137 -0
  57. package/dist/test/compiler-entry.test.d.ts +1 -0
  58. package/dist/test/compiler-entry.test.js +28 -0
  59. package/dist/test/error-native-bridge.test.d.ts +1 -0
  60. package/dist/test/error-native-bridge.test.js +31 -0
  61. package/dist/test/error-serialization.test.d.ts +1 -0
  62. package/dist/test/error-serialization.test.js +38 -0
  63. package/dist/test/phase5-boundary.test.d.ts +1 -0
  64. package/dist/test/phase5-boundary.test.js +51 -0
  65. package/dist/transform/layoutProcessor.d.ts +26 -0
  66. package/dist/transform/layoutProcessor.js +34 -0
  67. package/dist/validate/invariants.d.ts +23 -0
  68. package/dist/validate/invariants.js +55 -0
  69. package/native/compiler-native/compiler-native.node +0 -0
  70. package/native/compiler-native/index.d.ts +2 -46
  71. package/native/compiler-native/index.js +1 -16
  72. package/native/compiler-native/package.json +1 -1
  73. package/package.json +15 -5
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Zenith File Parser (Native Bridge)
3
+ *
4
+ * Delegates all Zenith compilation to the Rust native "syscall" bridge.
5
+ * Zero fallbacks. Zero runtime abstraction.
6
+ */
7
+ import { readFileSync } from 'fs';
8
+ let native;
9
+ try {
10
+ native = require('../native/compiler-native');
11
+ }
12
+ catch (e) {
13
+ // If not in standard node_modules, check build output
14
+ try {
15
+ native = require('../native/compiler-native/index.js');
16
+ }
17
+ catch {
18
+ // FATAL: The native bridge is a requirement, not an enhancement.
19
+ console.error('\n\x1b[31m[Zenith Critical] Native bridge unavailable.\x1b[0m');
20
+ console.error('The Zenith compiler requires the Rust-based native bridge to function.');
21
+ console.error('Please run "bun run build:native" in the zenith-compiler directory.\n');
22
+ process.exit(1);
23
+ }
24
+ }
25
+ /**
26
+ * Perform a Zenith "Syscall" to the native compiler
27
+ */
28
+ export function parseZenFile(filePath, sourceInput, options = {}) {
29
+ const source = sourceInput ?? readFileSync(filePath, 'utf-8');
30
+ // Default to full mode unless specified (e.g. for metadata extraction during discovery)
31
+ const mode = options.mode ?? 'full';
32
+ const useCache = options.useCache ?? (process.env.ZENITH_CACHE !== '0');
33
+ if (!native.parseFullZenNative) {
34
+ throw new Error('[Zenith Critical] Broken native bridge: parseFullZenNative symbol missing. Rebuild required.');
35
+ }
36
+ try {
37
+ // Pass options as JSON string to avoid napi-rs undefined handling issues
38
+ const nativeOptions = {
39
+ mode: mode,
40
+ useCache: useCache,
41
+ components: options.components ?? null,
42
+ layout: options.layout ?? null,
43
+ props: options.props ?? null,
44
+ };
45
+ const result = native.parseFullZenNative(source, filePath, JSON.stringify(nativeOptions));
46
+ return result;
47
+ }
48
+ catch (error) {
49
+ // Native panic or unhandled error
50
+ throw new Error(`[Zenith Native Fatal] ${error.message}\nFile: ${filePath}`);
51
+ }
52
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Zenith App Build Script
3
+ *
4
+ * Builds all pages into a single SPA with file-based routing.
5
+ */
6
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Zenith App Build Script
3
+ *
4
+ * Builds all pages into a single SPA with file-based routing.
5
+ */
6
+ import { buildSPA } from "../spa-build";
7
+ import path from "path";
8
+ const appDir = path.resolve(import.meta.dir, "..", "app");
9
+ buildSPA({
10
+ pagesDir: path.join(appDir, "pages"),
11
+ outDir: path.join(appDir, "dist"),
12
+ baseDir: appDir
13
+ });
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Zenith Bundle Generator
3
+ *
4
+ * Generates the shared client runtime bundle that gets served as:
5
+ * - /assets/bundle.js in production
6
+ * - /runtime.js in development
7
+ *
8
+ * This is a cacheable, versioned file that contains:
9
+ * - Reactivity primitives (zenSignal, zenState, zenEffect, etc.)
10
+ * - Lifecycle hooks (zenOnMount, zenOnUnmount)
11
+ * - Hydration functions (zenithHydrate)
12
+ * - Event binding utilities
13
+ */
14
+ /**
15
+ * Generate the complete client runtime bundle
16
+ * This is served as an external JS file, not inlined
17
+ */
18
+ export declare function generateBundleJS(pluginData?: Record<string, any>): string;
19
+ /**
20
+ * Generate a minified version of the bundle
21
+ * For production builds
22
+ */
23
+ export declare function generateMinifiedBundleJS(): string;
24
+ /**
25
+ * Get bundle version for cache busting
26
+ */
27
+ export declare function getBundleVersion(): string;