@zenithbuild/core 0.1.0 → 0.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.
Files changed (90) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +24 -40
  3. package/bin/zen-build.ts +2 -0
  4. package/bin/zen-dev.ts +2 -0
  5. package/bin/zen-preview.ts +2 -0
  6. package/bin/zenith.ts +2 -0
  7. package/cli/commands/add.ts +37 -0
  8. package/cli/commands/build.ts +37 -0
  9. package/cli/commands/create.ts +702 -0
  10. package/cli/commands/dev.ts +197 -0
  11. package/cli/commands/index.ts +112 -0
  12. package/cli/commands/preview.ts +62 -0
  13. package/cli/commands/remove.ts +33 -0
  14. package/cli/index.ts +10 -0
  15. package/cli/main.ts +101 -0
  16. package/cli/utils/branding.ts +153 -0
  17. package/cli/utils/logger.ts +40 -0
  18. package/cli/utils/plugin-manager.ts +114 -0
  19. package/cli/utils/project.ts +71 -0
  20. package/compiler/build-analyzer.ts +122 -0
  21. package/compiler/discovery/layouts.ts +61 -0
  22. package/compiler/index.ts +40 -24
  23. package/compiler/ir/types.ts +1 -0
  24. package/compiler/parse/parseScript.ts +29 -5
  25. package/compiler/parse/parseTemplate.ts +96 -58
  26. package/compiler/parse/scriptAnalysis.ts +77 -0
  27. package/compiler/runtime/dataExposure.ts +49 -31
  28. package/compiler/runtime/generateDOM.ts +18 -17
  29. package/compiler/runtime/generateHydrationBundle.ts +24 -5
  30. package/compiler/runtime/transformIR.ts +140 -49
  31. package/compiler/runtime/wrapExpressionWithLoop.ts +11 -11
  32. package/compiler/spa-build.ts +70 -153
  33. package/compiler/ssg-build.ts +412 -0
  34. package/compiler/transform/layoutProcessor.ts +132 -0
  35. package/compiler/transform/transformNode.ts +19 -19
  36. package/dist/cli.js +11648 -0
  37. package/dist/zen-build.js +11659 -0
  38. package/dist/zen-dev.js +11659 -0
  39. package/dist/zen-preview.js +11659 -0
  40. package/dist/zenith.js +11659 -0
  41. package/package.json +22 -2
  42. package/runtime/bundle-generator.ts +416 -0
  43. package/runtime/client-runtime.ts +532 -0
  44. package/.eslintignore +0 -15
  45. package/.gitattributes +0 -2
  46. package/.github/ISSUE_TEMPLATE/compiler-errors-for-invalid-state-declarations.md +0 -25
  47. package/.github/ISSUE_TEMPLATE/new_ticket.yaml +0 -34
  48. package/.github/pull_request_template.md +0 -15
  49. package/.github/workflows/discord-changelog.yml +0 -141
  50. package/.github/workflows/discord-notify.yml +0 -242
  51. package/.github/workflows/discord-version.yml +0 -195
  52. package/.prettierignore +0 -13
  53. package/.prettierrc +0 -21
  54. package/.zen.d.ts +0 -15
  55. package/app/components/Button.zen +0 -46
  56. package/app/components/Link.zen +0 -11
  57. package/app/favicon.ico +0 -0
  58. package/app/layouts/Main.zen +0 -59
  59. package/app/pages/about.zen +0 -23
  60. package/app/pages/blog/[id].zen +0 -53
  61. package/app/pages/blog/index.zen +0 -32
  62. package/app/pages/dynamic-dx.zen +0 -712
  63. package/app/pages/dynamic-primitives.zen +0 -453
  64. package/app/pages/index.zen +0 -154
  65. package/app/pages/navigation-demo.zen +0 -229
  66. package/app/pages/posts/[...slug].zen +0 -61
  67. package/app/pages/primitives-demo.zen +0 -273
  68. package/assets/logos/0E3B5DDD-605C-4839-BB2E-DFCA8ADC9604.PNG +0 -0
  69. package/assets/logos/760971E5-79A1-44F9-90B9-925DF30F4278.PNG +0 -0
  70. package/assets/logos/8A06ED80-9ED2-4689-BCBD-13B2E95EE8E4.JPG +0 -0
  71. package/assets/logos/C691FF58-ED13-4E8D-B6A3-02E835849340.PNG +0 -0
  72. package/assets/logos/C691FF58-ED13-4E8D-B6A3-02E835849340.svg +0 -601
  73. package/assets/logos/README.md +0 -54
  74. package/assets/logos/zen.icns +0 -0
  75. package/bun.lock +0 -39
  76. package/compiler/legacy/binding.ts +0 -254
  77. package/compiler/legacy/bindings.ts +0 -338
  78. package/compiler/legacy/component-process.ts +0 -1208
  79. package/compiler/legacy/component.ts +0 -301
  80. package/compiler/legacy/event.ts +0 -50
  81. package/compiler/legacy/expression.ts +0 -1149
  82. package/compiler/legacy/mutation.ts +0 -280
  83. package/compiler/legacy/parse.ts +0 -299
  84. package/compiler/legacy/split.ts +0 -608
  85. package/compiler/legacy/types.ts +0 -32
  86. package/docs/COMMENTS.md +0 -111
  87. package/docs/COMMITS.md +0 -36
  88. package/docs/CONTRIBUTING.md +0 -116
  89. package/docs/STYLEGUIDE.md +0 -62
  90. package/scripts/webhook-proxy.ts +0 -213
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Judah Sullivan
3
+ Copyright (c) 2026 Zenith Team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,55 +1,39 @@
1
+ # @zenithbuild/core ⚡
1
2
 
2
- # Zenith Framework
3
+ The heart of the Zenith framework. High-performance reactive runtime, compiler, and build primitives.
3
4
 
4
- ---
5
+ ## Overview
5
6
 
6
- ## README.md
7
+ Zenith is a modern reactive web framework designed for maximum performance and developer experience. The core package contains the essential building blocks:
8
+ - **Compiler**: Transforms `.zen` files into optimized JavaScript.
9
+ - **Runtime**: A lightweight, efficient reactive system for the browser.
10
+ - **Router**: Lightweight client-side routing.
11
+ - **Build Primitives**: Tools for dev servers and production builds.
7
12
 
8
- ### What is Zenith?
13
+ ## Key Components
9
14
 
10
- Zenith is an **HTML-first, web-native framework** focused on predictable rendering, persistent navigation state, and minimal JavaScript by default.
15
+ ### 1. Compiler (`/compiler`)
16
+ The Zenith compiler handles parsing and transforming Single File Components (`.zen`). It leverages `parse5` for robust HTML parsing and generates highly optimized render functions.
11
17
 
12
- Zenith treats HTML as the source of truth. Behavior is inferred through static analysis rather than developer flags like `use client` or `client-only`.
18
+ ### 2. Runtime (`/runtime`)
19
+ Our runtime is designed to be minimal. It manages the reactive cycle, efficient DOM updates, and lifecycle management (like `zenOnMount`).
13
20
 
14
- The framework is currently **under active construction**. Core goals and constraints are intentionally defined early to avoid runtime complexity and hydration pitfalls seen in existing frameworks.
21
+ ### 3. Server (`/bin/zen-dev`, `/bin/zen-build`)
22
+ Low-level binaries for orchestrating development and production environments.
15
23
 
16
- ### Core Principles (Locked In)
24
+ ## Architecture
17
25
 
18
- * HTML-first authoring
19
- * `.zenith` file format
20
- * Optional `<script>` and `<style>` blocks
21
- * No required `<template>` wrapper
22
- * Automatic client/runtime detection
23
- * Navigation lifecycle as a first-class primitive
24
- * Persistent layouts across navigation
25
- * VDOM used intentionally (not everywhere)
26
+ Zenith follows a "Compiler-First" philosophy. We shift as much work as possible to build time, keeping the client-side bundle lean and fast.
26
27
 
27
- ### What Zenith Is (Currently)
28
+ ## Usage (Internal)
28
29
 
29
- * A compiler that transforms `.zenith` files into optimized runtime modules
30
- * A navigation-aware runtime with lifecycle hooks
31
- * A layout + document ownership system
32
-
33
- ### What Zenith Is Not (Yet)
34
-
35
- * A finished production framework
36
- * A replacement for all React/Vue use-cases
37
- * An SSR platform (planned, not finalized)
38
-
39
- ### High-Level Architecture
30
+ This package is typically consumed by the Zenith CLI and other ecosystem tools.
40
31
 
32
+ ```typescript
33
+ import { compile } from '@zenithbuild/core/compiler';
34
+ // ... compile logic
41
35
  ```
42
- .zenith files
43
-
44
- Compiler (parse → analyze → compose → generate)
45
-
46
- Runtime (navigation + rendering)
47
-
48
- DOM
49
- ```
50
-
51
- ### Status
52
36
 
53
- Zenith is in the **foundation phase**. APIs may change rapidly.
37
+ ## License
54
38
 
55
- ### [Contributing](./docs/CONTRIBUTING.md)
39
+ MIT
@@ -0,0 +1,2 @@
1
+ import { runCLI } from '../cli/main'
2
+ runCLI({ defaultCommand: 'build' })
package/bin/zen-dev.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { runCLI } from '../cli/main'
2
+ runCLI({ defaultCommand: 'dev' })
@@ -0,0 +1,2 @@
1
+ import { runCLI } from '../cli/main'
2
+ runCLI({ defaultCommand: 'preview' })
package/bin/zenith.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { runCLI } from '../cli/main'
2
+ runCLI()
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @zenith/cli - Add Command
3
+ *
4
+ * Registers a plugin in the project
5
+ */
6
+
7
+ import { requireProject } from '../utils/project'
8
+ import { addPlugin, hasPlugin } from '../utils/plugin-manager'
9
+ import * as logger from '../utils/logger'
10
+
11
+ export interface AddOptions {
12
+ options?: Record<string, unknown>
13
+ }
14
+
15
+ export async function add(pluginName: string, options: AddOptions = {}): Promise<void> {
16
+ requireProject()
17
+
18
+ logger.header('Add Plugin')
19
+
20
+ if (!pluginName) {
21
+ logger.error('Plugin name required. Usage: zenith add <plugin>')
22
+ process.exit(1)
23
+ }
24
+
25
+ if (hasPlugin(pluginName)) {
26
+ logger.warn(`Plugin "${pluginName}" is already registered`)
27
+ return
28
+ }
29
+
30
+ const success = addPlugin(pluginName, options.options)
31
+
32
+ if (success) {
33
+ logger.info(`Plugin "${pluginName}" has been registered.`)
34
+ logger.info('Note: You may need to install the package manually:')
35
+ logger.log(` bun add @zenith/plugin-${pluginName}`)
36
+ }
37
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @zenith/cli - Build Command
3
+ *
4
+ * Builds the application for production using SSG.
5
+ */
6
+
7
+ import path from 'path'
8
+ import { requireProject } from '../utils/project'
9
+ import * as logger from '../utils/logger'
10
+ import { buildSSG } from '../../compiler/ssg-build'
11
+
12
+ export interface BuildOptions {
13
+ outDir?: string
14
+ }
15
+
16
+ export async function build(options: BuildOptions = {}): Promise<void> {
17
+ const project = requireProject()
18
+ const outDir = options.outDir || project.distDir
19
+
20
+ logger.header('Zenith Build')
21
+ logger.log(`Source: ${project.pagesDir}`)
22
+ logger.log(`Output: ${outDir}`)
23
+
24
+ try {
25
+ buildSSG({
26
+ pagesDir: project.pagesDir,
27
+ outDir: outDir,
28
+ baseDir: project.root
29
+ })
30
+ logger.success('Build complete!')
31
+
32
+ } catch (err: unknown) {
33
+ const message = err instanceof Error ? err.message : String(err)
34
+ logger.error(`Build failed: ${message}`)
35
+ process.exit(1)
36
+ }
37
+ }