@zenithbuild/bundler 0.7.2 → 0.7.4

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/README.md CHANGED
@@ -1,143 +1,31 @@
1
- # Zenith Bundler
1
+ # @zenithbuild/bundler
2
2
 
3
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
4
 
5
-
6
- Zero-Cost Abstraction Bundler for the Zenith Framework.
5
+ Internal bundler package that consumes compiler artifacts and emits page assets, router runtime assets, and packaged server output for the CLI.
7
6
 
8
7
  ## Canonical Docs
9
8
 
10
- - Bundler contract: `../zenith-docs/documentation/contracts/bundler-contract.md`
11
- - Script boundary contract: `../zenith-docs/documentation/contracts/script-boundary.md`
9
+ - Bundler contract: `../../docs/documentation/contracts/bundler-contract.md`
10
+ - Script boundary contract: `../../docs/documentation/contracts/script-boundary.md`
12
11
 
13
12
  ## Overview
14
13
 
15
- The Zenith Bundler provides capability-based runtime chunking, CSS pruning, and deferred hydration for optimal production builds. Instead of shipping a monolithic runtime, it selectively includes only the capabilities used by each page.
16
-
17
- ## Architecture
18
-
19
- ```
20
- Compiler (ZenIR) → Manifest → Bundler → Optimized Output
21
- ```
22
-
23
- ### Runtime Slices
24
-
25
- | Slice | Size | When Included |
26
- |-------|------|---------------|
27
- | **Core** | ~2KB | Always required |
28
- | **Reactivity** | ~8KB | If `{value}` expressions or state used |
29
- | **Hydration** | ~5KB | If page is interactive |
30
-
31
- ## Installation
32
-
33
- ```bash
34
- # Rust crate
35
- cargo add zenith-bundler
36
-
37
- # TypeScript package
38
- bun add @zenithbuild/bundler
39
- ```
40
-
41
- ## Usage
42
-
43
- ### Rust
44
-
45
- ```rust
46
- use zenith_bundler::{bundle, analyze_manifest, ZenManifest};
47
-
48
- let manifest = ZenManifest::new("src/pages/index.zen".to_string());
49
- let analysis = analyze_manifest(&manifest);
50
-
51
- println!("Required slices: {:?}", analysis.required_slices);
52
- println!("Is static: {}", analysis.is_static);
53
- ```
54
-
55
- ### TypeScript
14
+ This package is consumed by the Zenith CLI. Its contract is internal and centered on deterministic asset emission, not a stable public JS API.
56
15
 
57
- ```typescript
58
- import { bundle, generateRuntime } from '@zenithbuild/bundler'
16
+ Current responsibilities:
59
17
 
60
- // Full production bundle
61
- const result = bundle(manifest, {
62
- minifyJs: true,
63
- minifyCss: true,
64
- basePath: '/assets/'
65
- })
66
-
67
- // Dev server (HMR)
68
- const { code, slices } = generateRuntime(manifest, true)
69
- ```
70
-
71
- ## API
72
-
73
- ### `bundle(manifest, options?)`
74
-
75
- Generates complete HTML/JS/CSS output.
76
-
77
- **Options:**
78
- - `minifyJs` - Minify JavaScript (default: true)
79
- - `minifyCss` - Minify CSS (default: true)
80
- - `inlineCriticalCss` - Inline critical CSS (default: true)
81
- - `sourceMaps` - Generate source maps (default: false)
82
- - `devMode` - Skip optimizations (default: false)
83
- - `basePath` - Asset base path (default: "/")
84
- - `lazyLoad` - Lazy load non-critical chunks (default: true)
85
- - `maxChunkSize` - Max chunk size in bytes (default: 50000)
86
-
87
- ### `generateRuntime(manifest, devMode?)`
88
-
89
- Generates only the runtime code (for HMR/dev server).
90
-
91
- ### `analyzeManifest(manifest)`
92
-
93
- Analyzes a manifest and returns required slices.
94
-
95
- ## Bundle Size Budgets
96
-
97
- | Page Type | Budget |
98
- |-----------|--------|
99
- | Static | < 5KB |
100
- | Interactive | < 20KB |
101
- | Complex | < 50KB |
102
-
103
- Run size gate: `bun run js/scripts/size-gate.ts`
18
+ - lowering compiler envelopes into deterministic HTML/JS/CSS assets
19
+ - emitting router/runtime support only when required by the manifest
20
+ - packaging server-capable artifacts consumed later by adapters
21
+ - preserving compiler-owned semantics instead of reinterpreting them downstream
104
22
 
105
23
  ## Testing
106
24
 
107
25
  ```bash
108
- # Rust tests
109
26
  cargo test
110
-
111
- # TypeScript tests
112
- cd js && bun test
113
-
114
- # Size gate
115
- cd js && bun run scripts/size-gate.ts
116
- ```
117
-
118
- ## Project Structure
119
-
120
- ```
121
- zenith-bundler/
122
- ├── src/
123
- │ ├── lib.rs # Main exports
124
- │ ├── analysis.rs # Manifest analysis
125
- │ ├── chunking/ # Chunk computation
126
- │ ├── codegen/ # Runtime generation
127
- │ ├── css/ # CSS optimization
128
- │ └── manifest/ # Types & capabilities
129
- ├── tests/
130
- │ └── integration.rs # Integration tests
131
- └── js/
132
- ├── src/
133
- │ ├── index.ts # TypeScript API
134
- │ ├── types.ts # TypeScript types
135
- │ └── index.test.ts
136
- └── scripts/
137
- └── size-gate.ts # Bundle size CI gate
138
27
  ```
139
28
 
140
29
  ## License
141
30
 
142
31
  MIT
143
- # zenith-bundler
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenithbuild/bundler",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "scripts": {
5
5
  "build": "rm -rf dist && cargo build --release && tsc -p tsconfig.meta.json && node ../../scripts/stage-bundler-platform-package.mjs",
6
6
  "contract:deps": "node dependency_contract.spec.js",
@@ -36,14 +36,14 @@
36
36
  },
37
37
  "homepage": "https://github.com/zenithbuild/framework#readme",
38
38
  "dependencies": {
39
- "@zenithbuild/router": "0.7.2",
40
- "@zenithbuild/runtime": "0.7.2"
39
+ "@zenithbuild/router": "0.7.4",
40
+ "@zenithbuild/runtime": "0.7.4"
41
41
  },
42
42
  "optionalDependencies": {
43
- "@zenithbuild/bundler-darwin-arm64": "0.7.2",
44
- "@zenithbuild/bundler-darwin-x64": "0.7.2",
45
- "@zenithbuild/bundler-linux-x64": "0.7.2",
46
- "@zenithbuild/bundler-win32-x64": "0.7.2"
43
+ "@zenithbuild/bundler-darwin-arm64": "0.7.4",
44
+ "@zenithbuild/bundler-darwin-x64": "0.7.4",
45
+ "@zenithbuild/bundler-linux-x64": "0.7.4",
46
+ "@zenithbuild/bundler-win32-x64": "0.7.4"
47
47
  },
48
48
  "type": "module",
49
49
  "private": false
@@ -28,13 +28,15 @@ async function main() {
28
28
  const coreImport = typeof parsed.coreImport === 'string' && parsed.coreImport.length > 0
29
29
  ? parsed.coreImport
30
30
  : '/assets/core.placeholder.js';
31
+ const routeCheck = parsed.routeCheck === true;
31
32
 
32
33
  const runtimeSource = normalizeNewlines(runtimeModuleSource());
33
34
  const routerSource = normalizeNewlines(
34
35
  renderRouterModule({
35
36
  manifestJson,
36
37
  runtimeImport,
37
- coreImport
38
+ coreImport,
39
+ routeCheck
38
40
  })
39
41
  );
40
42