@zenithbuild/core 0.6.2 → 1.0.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.
Files changed (87) hide show
  1. package/README.md +20 -19
  2. package/cli/commands/add.ts +2 -2
  3. package/cli/commands/build.ts +2 -3
  4. package/cli/commands/dev.ts +182 -103
  5. package/cli/commands/index.ts +1 -1
  6. package/cli/commands/preview.ts +1 -1
  7. package/cli/commands/remove.ts +2 -2
  8. package/cli/index.ts +1 -1
  9. package/cli/main.ts +1 -1
  10. package/cli/utils/logger.ts +1 -1
  11. package/cli/utils/plugin-manager.ts +1 -1
  12. package/cli/utils/project.ts +4 -4
  13. package/core/components/ErrorPage.zen +218 -0
  14. package/core/components/index.ts +15 -0
  15. package/core/config.ts +1 -0
  16. package/core/index.ts +29 -0
  17. package/dist/compiler-native-frej59m4.node +0 -0
  18. package/dist/core/compiler-native-frej59m4.node +0 -0
  19. package/dist/core/index.js +6293 -0
  20. package/dist/runtime/lifecycle/index.js +1 -0
  21. package/dist/runtime/reactivity/index.js +1 -0
  22. package/dist/zen-build.js +7465 -19128
  23. package/dist/zen-dev.js +7465 -19128
  24. package/dist/zen-preview.js +7465 -19128
  25. package/dist/zenith.js +7465 -19128
  26. package/package.json +21 -22
  27. package/cli/utils/content.ts +0 -112
  28. package/compiler/README.md +0 -380
  29. package/compiler/build-analyzer.ts +0 -122
  30. package/compiler/css/index.ts +0 -317
  31. package/compiler/discovery/componentDiscovery.ts +0 -178
  32. package/compiler/discovery/layouts.ts +0 -70
  33. package/compiler/errors/compilerError.ts +0 -56
  34. package/compiler/finalize/finalizeOutput.ts +0 -192
  35. package/compiler/finalize/generateFinalBundle.ts +0 -82
  36. package/compiler/index.ts +0 -83
  37. package/compiler/ir/types.ts +0 -174
  38. package/compiler/output/types.ts +0 -34
  39. package/compiler/parse/detectMapExpressions.ts +0 -102
  40. package/compiler/parse/importTypes.ts +0 -78
  41. package/compiler/parse/parseImports.ts +0 -309
  42. package/compiler/parse/parseScript.ts +0 -46
  43. package/compiler/parse/parseTemplate.ts +0 -599
  44. package/compiler/parse/parseZenFile.ts +0 -66
  45. package/compiler/parse/scriptAnalysis.ts +0 -91
  46. package/compiler/parse/trackLoopContext.ts +0 -82
  47. package/compiler/runtime/dataExposure.ts +0 -317
  48. package/compiler/runtime/generateDOM.ts +0 -246
  49. package/compiler/runtime/generateHydrationBundle.ts +0 -407
  50. package/compiler/runtime/hydration.ts +0 -309
  51. package/compiler/runtime/navigation.ts +0 -432
  52. package/compiler/runtime/thinRuntime.ts +0 -160
  53. package/compiler/runtime/transformIR.ts +0 -370
  54. package/compiler/runtime/wrapExpression.ts +0 -95
  55. package/compiler/runtime/wrapExpressionWithLoop.ts +0 -83
  56. package/compiler/spa-build.ts +0 -917
  57. package/compiler/ssg-build.ts +0 -422
  58. package/compiler/test/validate-test.ts +0 -104
  59. package/compiler/transform/classifyExpression.ts +0 -444
  60. package/compiler/transform/componentResolver.ts +0 -312
  61. package/compiler/transform/componentScriptTransformer.ts +0 -303
  62. package/compiler/transform/expressionTransformer.ts +0 -385
  63. package/compiler/transform/fragmentLowering.ts +0 -634
  64. package/compiler/transform/generateBindings.ts +0 -47
  65. package/compiler/transform/generateHTML.ts +0 -28
  66. package/compiler/transform/layoutProcessor.ts +0 -132
  67. package/compiler/transform/slotResolver.ts +0 -292
  68. package/compiler/transform/transformNode.ts +0 -126
  69. package/compiler/transform/transformTemplate.ts +0 -38
  70. package/compiler/validate/invariants.ts +0 -292
  71. package/compiler/validate/validateExpressions.ts +0 -168
  72. package/core/config/index.ts +0 -16
  73. package/core/config/loader.ts +0 -69
  74. package/core/config/types.ts +0 -89
  75. package/core/plugins/index.ts +0 -7
  76. package/core/plugins/registry.ts +0 -81
  77. package/dist/cli.js +0 -11665
  78. package/router/manifest.ts +0 -314
  79. package/router/navigation/ZenLink.zen +0 -231
  80. package/router/navigation/index.ts +0 -78
  81. package/router/navigation/zen-link.ts +0 -584
  82. package/router/runtime.ts +0 -458
  83. package/router/types.ts +0 -168
  84. package/runtime/build.ts +0 -17
  85. package/runtime/bundle-generator.ts +0 -1247
  86. package/runtime/client-runtime.ts +0 -549
  87. package/runtime/serve.ts +0 -93
@@ -0,0 +1,218 @@
1
+ <script setup="ts">
2
+ // ErrorPage.zen
3
+ // A high-fidelity, magazine-style error page for Zenith developers.
4
+
5
+ import { zenOnMount, zenSignal } from 'zenith:runtime';
6
+ import gsap from 'gsap';
7
+
8
+ interface ErrorProps {
9
+ file: string;
10
+ line: number;
11
+ column: number;
12
+ message: string;
13
+ errorType: string;
14
+ code: string;
15
+ guarantee?: string;
16
+ context?: string;
17
+ hints?: string[];
18
+ stack?: string;
19
+ isProd?: boolean;
20
+ }
21
+
22
+ const {
23
+ file,
24
+ line,
25
+ column,
26
+ message,
27
+ errorType,
28
+ code,
29
+ guarantee,
30
+ context,
31
+ hints = [],
32
+ stack,
33
+ isProd = false
34
+ } = zenProps<ErrorProps>();
35
+
36
+ const showAdvanced = zenSignal(false);
37
+ const errorRef = zenRef<HTMLElement>();
38
+
39
+ zenOnMount(() => {
40
+ const ctx = gsap.context(() => {
41
+ // Fade in main container
42
+ gsap.from('.error-hero', {
43
+ opacity: 0,
44
+ y: 30,
45
+ duration: 0.8,
46
+ ease: 'expo.out'
47
+ });
48
+
49
+ // Stagger in details
50
+ gsap.from(['.error-meta', '.error-message', '.error-hints > div'], {
51
+ opacity: 0,
52
+ x: -20,
53
+ stagger: 0.1,
54
+ duration: 0.6,
55
+ delay: 0.4,
56
+ ease: 'power2.out'
57
+ });
58
+
59
+ // Fade in code/context
60
+ gsap.from('.error-context', {
61
+ opacity: 0,
62
+ scale: 0.98,
63
+ duration: 1,
64
+ delay: 0.6,
65
+ ease: 'expo.out'
66
+ });
67
+ }, errorRef.current);
68
+
69
+ return () => ctx.revert();
70
+ });
71
+
72
+ const toggleAdvanced = () => showAdvanced(!showAdvanced());
73
+
74
+ </script>
75
+
76
+ <div class="error-page-container min-h-screen bg-background text-foreground font-body overflow-hidden selection:bg-red-500/30" ref={errorRef}>
77
+ <!-- Sticky Header -->
78
+ <header class="p-6 md:p-10 flex justify-between items-center border-b border-border/50">
79
+ <div class="flex items-center gap-3">
80
+ <div class="w-2 h-2 rounded-full bg-red-500 animate-pulse"></div>
81
+ <span class="text-[10px] font-bold uppercase tracking-[0.2em] text-muted-foreground">Zenith Developer Environment</span>
82
+ </div>
83
+ <a href="/documentation" class="text-[10px] font-bold uppercase tracking-widest hover:text-red-500 transition-colors">Documentation</a>
84
+ </header>
85
+
86
+ <main class="max-w-[1400px] mx-auto px-8 md:px-16 py-16 md:py-24 grid grid-cols-1 lg:grid-cols-[1.2fr_0.8fr] gap-16 md:gap-24">
87
+
88
+ <!-- Left Column: Primary Error Info -->
89
+ <section class="space-y-12">
90
+ <div class="error-hero space-y-6">
91
+ <div class="inline-block px-3 py-1 bg-red-500/10 border border-red-500/20 rounded-full">
92
+ <span class="text-[10px] font-black uppercase text-red-500 tracking-tighter">{code}</span>
93
+ </div>
94
+ <h1 class="text-5xl md:text-7xl font-black tracking-tight leading-[0.9] uppercase">
95
+ Something <br/> <span class="text-red-500">Went Wrong</span>
96
+ </h1>
97
+ </div>
98
+
99
+ <div class="error-meta flex flex-wrap gap-8 py-8 border-y border-border/30">
100
+ <div class="space-y-1">
101
+ <span class="text-[9px] uppercase font-bold text-muted-foreground tracking-widest">Location</span>
102
+ <p class="text-sm font-mono truncate max-w-[300px]">{file}:{line}:{column}</p>
103
+ </div>
104
+ <div class="space-y-1">
105
+ <span class="text-[9px] uppercase font-bold text-muted-foreground tracking-widest">Type</span>
106
+ <p class="text-sm font-mono">{errorType}</p>
107
+ </div>
108
+ </div>
109
+
110
+ <div class="error-message space-y-4">
111
+ <p class="text-2xl md:text-3xl font-medium leading-tight text-foreground/90">
112
+ {message}
113
+ </p>
114
+ {guarantee && (
115
+ <div class="p-6 bg-secondary/50 rounded-2xl border border-border/50">
116
+ <span class="text-[9px] uppercase font-black text-primary tracking-widest block mb-2">Zenith Guarantee</span>
117
+ <p class="text-sm italic opacity-80">{guarantee}</p>
118
+ </div>
119
+ )}
120
+ </div>
121
+
122
+ {hints.length > 0 && (
123
+ <div class="error-hints space-y-4 pt-10">
124
+ <h3 class="text-xs font-black uppercase tracking-[0.2em] text-muted-foreground mb-6">Suggestions</h3>
125
+ {hints.map(hint => (
126
+ <div key={hint} class="flex gap-4 items-start p-4 hover:bg-secondary/30 transition-colors rounded-xl border border-transparent hover:border-border/50">
127
+ <span class="text-red-500 mt-1">→</span>
128
+ <p class="text-sm">{hint}</p>
129
+ </div>
130
+ ))}
131
+ </div>
132
+ )}
133
+ </section>
134
+
135
+ <!-- Right Column: Context & Visuals -->
136
+ <section class="error-context space-y-8">
137
+ <div class="relative group">
138
+ <div class="absolute -inset-1 bg-gradient-to-tr from-red-500/20 to-transparent blur-2xl opacity-50"></div>
139
+ <div class="relative bg-zinc-950 rounded-3xl border border-white/10 overflow-hidden shadow-2xl">
140
+ <div class="flex items-center justify-between px-6 py-4 border-b border-white/5 bg-zinc-900/50">
141
+ <span class="text-[10px] font-bold uppercase tracking-widest text-zinc-500">Contextual Snippet</span>
142
+ <div class="flex gap-1.5">
143
+ <div class="w-2.5 h-2.5 rounded-full bg-white/10"></div>
144
+ <div class="w-2.5 h-2.5 rounded-full bg-white/10"></div>
145
+ <div class="w-2.5 h-2.5 rounded-full bg-white/10"></div>
146
+ </div>
147
+ </div>
148
+ <div class="p-8 font-mono text-sm leading-relaxed overflow-x-auto text-zinc-300">
149
+ {context ? (
150
+ <pre><code>{context}</code></pre>
151
+ ) : (
152
+ <div class="py-12 text-center opacity-30 select-none">
153
+ <p class="text-[10px] uppercase tracking-widest">No code snippet available</p>
154
+ </div>
155
+ )}
156
+ </div>
157
+ </div>
158
+ </div>
159
+
160
+ <!-- Advanced Section -->
161
+ {!isProd && (
162
+ <div class="pt-8">
163
+ <button
164
+ onClick={toggleAdvanced}
165
+ class="flex items-center gap-2 text-[10px] font-black uppercase tracking-widest text-muted-foreground hover:text-foreground transition-colors group"
166
+ >
167
+ {showAdvanced() ? 'Collapse Details' : 'View Stack Trace'}
168
+ <span class={`transition-transform duration-300 ${showAdvanced() ? 'rotate-180' : ''}`}>↓</span>
169
+ </button>
170
+
171
+ {showAdvanced() && (
172
+ <div class="mt-8 space-y-6 animate-in fade-in slide-in-from-top-4 duration-500">
173
+ {stack && (
174
+ <div class="p-6 bg-zinc-950 rounded-2xl border border-white/5 overflow-x-auto">
175
+ <span class="text-[9px] uppercase font-bold text-zinc-500 tracking-widest block mb-4">Runtime Stack</span>
176
+ <pre class="text-[11px] font-mono text-zinc-500 leading-tight"><code>{stack}</code></pre>
177
+ </div>
178
+ )}
179
+ </div>
180
+ )}
181
+ </div>
182
+ )}
183
+ </section>
184
+ </main>
185
+
186
+ <!-- Footer Decoration -->
187
+ <div class="fixed bottom-0 left-0 w-full h-[30vh] pointer-events-none opacity-[0.03] select-none flex items-end justify-center overflow-hidden">
188
+ <span class="text-[25vw] font-black tracking-tighter leading-none translate-y-1/4 uppercase">ZENITH</span>
189
+ </div>
190
+ </div>
191
+
192
+ <style>
193
+ .error-page-container {
194
+ --primary: #ef4444; /* red-500 */
195
+ }
196
+
197
+ @keyframes pulse {
198
+ 0%, 100% { opacity: 1; }
199
+ 50% { opacity: 0.4; }
200
+ }
201
+
202
+ .animate-pulse {
203
+ animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
204
+ }
205
+
206
+ /* Custom scrollbar for context box */
207
+ .error-context ::-webkit-scrollbar {
208
+ height: 4px;
209
+ width: 4px;
210
+ }
211
+ .error-context ::-webkit-scrollbar-track {
212
+ background: transparent;
213
+ }
214
+ .error-context ::-webkit-scrollbar-thumb {
215
+ background: rgba(255, 255, 255, 0.1);
216
+ border-radius: 10px;
217
+ }
218
+ </style>
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Core Components
3
+ *
4
+ * Reusable components provided by zenith-core.
5
+ */
6
+
7
+ // Export path constants for component resolution
8
+ export const CORE_COMPONENTS = {
9
+ ErrorPage: '@zenithbuild/core/components/ErrorPage.zen'
10
+ } as const;
11
+
12
+ // Component path resolver
13
+ export function getCoreComponentPath(componentName: keyof typeof CORE_COMPONENTS): string {
14
+ return CORE_COMPONENTS[componentName];
15
+ }
package/core/config.ts ADDED
@@ -0,0 +1 @@
1
+ export * from '@zenithbuild/compiler/config';
package/core/index.ts CHANGED
@@ -133,3 +133,32 @@ export {
133
133
  resetUnmountState
134
134
  } from './lifecycle'
135
135
 
136
+ // ============================================
137
+ // Build-time Modules (Proxied from @zenithbuild/compiler)
138
+ // ============================================
139
+
140
+ export {
141
+ loadZenithConfig
142
+ } from '@zenithbuild/compiler/config'
143
+
144
+ export {
145
+ PluginRegistry,
146
+ createPluginContext,
147
+ getPluginDataByNamespace,
148
+ createBridgeAPI,
149
+ runPluginHooks,
150
+ collectHookReturns,
151
+ buildRuntimeEnvelope,
152
+ clearHooks
153
+ } from '@zenithbuild/compiler'
154
+
155
+ export type { HookContext } from '@zenithbuild/compiler'
156
+
157
+ // ============================================
158
+ // Core Components
159
+ // ============================================
160
+
161
+ export {
162
+ CORE_COMPONENTS,
163
+ getCoreComponentPath
164
+ } from './components'