@zenithbuild/compiler 0.5.0-beta.2.3

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.
@@ -0,0 +1,32 @@
1
+ # Zenith Compiler JS Bridge Contract (V0)
2
+
3
+ Status: FROZEN (V0)
4
+
5
+ ## Identity
6
+
7
+ `@zenithbuild/compiler` is a deterministic Rust execution bridge.
8
+
9
+ ## Allowed Responsibilities
10
+
11
+ - Invoke the Rust compiler binary with deterministic arguments.
12
+ - Parse Rust compiler JSON stdout.
13
+ - Throw deterministic errors on non-zero exit or invalid JSON output.
14
+
15
+ ## Explicit Non-Responsibilities
16
+
17
+ - It does not parse AST.
18
+ - It does not transform IR.
19
+ - It does not contain compiler logic.
20
+ - It does not import other Zenith layers.
21
+
22
+ ## Explicit Prohibitions
23
+
24
+ - No `eval`.
25
+ - No browser globals.
26
+ - No dynamic imports.
27
+ - No bundler/runtime knowledge.
28
+ - No CLI orchestration logic.
29
+
30
+ ## Boundary
31
+
32
+ This package only invokes the Rust binary and returns parsed JSON.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zenith Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # @zenithbuild/compiler 🏗️
2
+
3
+ > **⚠️ Internal API:** This package is an internal implementation detail of the Zenith framework. It is not intended for public use and its API may break without warning. Please use `@zenithbuild/core` instead.
4
+
5
+
6
+ The Iron Heart of the Zenith framework. High-performance native compiler and build-time architect.
7
+
8
+ ## Overview
9
+
10
+ @zenithbuild/compiler owns everything related to structure, wiring, and validation. It is a coordinated companion to `@zenithbuild/core`.
11
+
12
+ ### Core Responsibilities
13
+ - **Parsing**: Native AST parsing of `.zen` files (Rust).
14
+ - **Transformation**: Lowering templates to optimized execution plans.
15
+ - **Dependency Management**: Compile-time resolution of imports and reactive graphs.
16
+ - **CSS Engine**: High-speed CSS compilation and Tailwind integration.
17
+ - **Bundle Generation**: Composing the thin client runtime for the browser.
18
+
19
+ ## Coordinated System
20
+
21
+ Zenith is built as a coordinated system. The compiler produces artifacts that the Core runtime consumes blindly.
22
+ - **No runtime decisions**: If it can be known at compile time, the compiler decides it.
23
+ - **Tight Coupling**: Versioned and released in lockstep with `@zenithbuild/core`.
24
+
25
+ ## Internal Structure
26
+
27
+ - `native/`: The Rust-powered core compiler.
28
+ - `src/parse/`: TypeScript wrappers for the native parser.
29
+ - `src/runtime/`: logic for generating the `bundle.js` target.
30
+
31
+ ## License
32
+
33
+ MIT
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ import { spawnSync } from 'node:child_process'
2
+ import path from 'node:path'
3
+ import { fileURLToPath } from 'node:url'
4
+
5
+ const __filename = fileURLToPath(import.meta.url)
6
+ const __dirname = path.dirname(__filename)
7
+
8
+ export function compile(entryPath, options = {}) {
9
+ const bin = path.resolve(__dirname, '../target/release/zenith-compiler')
10
+ const args = [entryPath]
11
+
12
+ const result = spawnSync(bin, args, {
13
+ encoding: 'utf8'
14
+ })
15
+
16
+ if (result.status !== 0) {
17
+ throw new Error(result.stderr || 'Compiler execution failed')
18
+ }
19
+
20
+ return JSON.parse(result.stdout)
21
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@zenithbuild/compiler",
3
+ "version": "0.5.0-beta.2.3",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "exports": {
7
+ ".": "./dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "COMPILER_JS_BRIDGE_CONTRACT.md",
12
+ "dist/**",
13
+ "target/release/zenith-compiler",
14
+ "LICENSE",
15
+ "README.md",
16
+ "package.json"
17
+ ],
18
+ "private": false,
19
+ "scripts": {
20
+ "build": "cargo build --release",
21
+ "prepublishOnly": "npm run build"
22
+ }
23
+ }
Binary file