@kudzujs/core 0.8.20 → 0.8.22
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/MIGRATION_ROADMAP.md +13 -0
- package/PERFORMANCE.md +48 -0
- package/README.md +1 -1
- package/RELEASES.md +71 -0
- package/docs/next-architecture/README.md +2 -2
- package/docs/next-architecture/compiler-current-architecture.md +19 -17
- package/docs/next-architecture/goal-a-compiler-foundation.md +15 -18
- package/docs/next-architecture/versioning.md +2 -2
- package/framework/README.md +8 -4
- package/framework/build.mjs +90 -401
- package/framework/compiler/descriptor-session.mjs +11 -2
- package/framework/compiler/effect-analysis.mjs +89 -0
- package/framework/compiler/ir/module-ir.mjs +7 -1
- package/framework/compiler/list-runtime-codegen.mjs +95 -0
- package/framework/compiler/param-codegen.mjs +72 -0
- package/framework/compiler/route-capability-planner.mjs +35 -0
- package/framework/compiler/runtime-codegen.mjs +146 -0
- package/framework/compiler/worker-compiler.mjs +12 -6
- package/framework/core.d.ts +41 -24
- package/framework/core.mjs +2 -1
- package/package.json +1 -1
package/MIGRATION_ROADMAP.md
CHANGED
|
@@ -223,6 +223,19 @@ This queue orders the next investigations by general migration value. Start only
|
|
|
223
223
|
- Previous transformer-wide keyed value, condition, event, nested-list, effect, and rendered-list AST side tables were removed. AST remains private only inside immediate source-local validation and lowering.
|
|
224
224
|
- `core.mjs` remains authoritative for final list IDs, key paths, route descriptors, complete HTML, DOM identity, and exact state/effect/ref release; accepted syntax and browser output are unchanged.
|
|
225
225
|
|
|
226
|
+
### Completed In 0.8.21
|
|
227
|
+
|
|
228
|
+
- Every supported effect finalizes into JSON-safe EffectIR with setup HandlerIR, cleanup, ordered signal/DerivedIR dependencies, component/keyed ownership, source provenance, and Worker edges.
|
|
229
|
+
- Effect dependency/resource analysis and Worker rewriting return explicit results; transformer-wide effect AST side tables and build-wide mutable Worker references were removed.
|
|
230
|
+
- Existing route/layout/conditional/keyed lifetime allocation, stale-write invalidation, cleanup order, accepted syntax, and browser output remain unchanged.
|
|
231
|
+
|
|
232
|
+
### Completed In 0.8.22
|
|
233
|
+
|
|
234
|
+
- The existing rendered route plan is RouteIR v1, with route-local numeric state slots beside unchanged browser IDs and readable state names; it is not duplicated in ModuleIR.
|
|
235
|
+
- The existing pure capability projection is CapabilityIR v1 and every runtime/list codegen consumer rejects unsupported versions.
|
|
236
|
+
- List, parameter, core, effect, binding, native, and navigation source generation moved out of `build.mjs` behind focused fail-closed generators; `build.mjs` decreased by 267 lines and coordinates stage outputs.
|
|
237
|
+
- Complete-site and representative deploy artifacts remain byte-identical to `v0.8.21`; only additive RouteIR version/slot metadata changes build plans.
|
|
238
|
+
|
|
226
239
|
## Cross-Cutting Performance Gates
|
|
227
240
|
|
|
228
241
|
Every migration feature must preserve:
|
package/PERFORMANCE.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# Performance Records
|
|
2
2
|
|
|
3
|
+
## 0.8.22 Versioned Compiler Foundation
|
|
4
|
+
|
|
5
|
+
Measured UTC 2026-08-09 on Apple M3, 8 logical CPUs, 8 GiB RAM, macOS 26.5.2 / Darwin 25.5.0, Node 25.6.1, and npm 11.18.0. Baseline tag `v0.8.21` at `ff38092` and the current `0.8.22` compiler candidate used the same local volume and identical installed dependencies.
|
|
6
|
+
|
|
7
|
+
The candidate implementation patch over `v0.8.21` had SHA-256 `e1d89c97dd8dfb60d41ae9c14ac64dfbb50466e024f80076f430ae9e725fb28f`, produced by:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
git diff --binary v0.8.21 -- framework/build.mjs framework/compiler/list-runtime-codegen.mjs framework/compiler/param-codegen.mjs framework/compiler/route-capability-planner.mjs framework/compiler/runtime-codegen.mjs framework/core.mjs framework/core.d.ts | shasum -a 256
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Both targets received one warm-up followed by seven clean `worker-effects` production builds in alternating round-robin order. Cleanup remained outside timing. Both medians were exactly 250.1 ms; the distributions overlap and establish no material change.
|
|
14
|
+
|
|
15
|
+
| Target | Build median | Worker raw / gzip | Window raw / gzip |
|
|
16
|
+
|---|---:|---:|---:|
|
|
17
|
+
| 0.8.21 baseline | 250.1 ms | 907 B / 475 B | 12,148 B / 5,427 B |
|
|
18
|
+
| 0.8.22 candidate | 250.1 ms | 907 B / 475 B | 12,148 B / 5,427 B |
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
0.8.21: [249.7,252.0,250.1,251.2,250.0,254.8,249.1]
|
|
22
|
+
0.8.22: [250.1,247.3,255.1,249.3,253.1,250.3,248.7]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Before release-content updates, the complete 135-page site and the `bindings`, `keyed-row-hooks`, `effect-dependencies`, `worker-effects`, `runtime-params`, and `navigation` deploy trees had identical file lists and bytes. Their build plans were equivalent after removing the intentional additive RouteIR `version` and state `slot` fields. Every measured Worker/window artifact name, raw byte count, and gzip byte count was identical. `build.mjs` decreased from 3,999 to 3,732 lines; this source-organization metric is not a runtime performance claim.
|
|
26
|
+
|
|
27
|
+
## 0.8.21 Explicit Effect Ownership
|
|
28
|
+
|
|
29
|
+
Measured UTC 2026-08-09 on Apple M3, 8 logical CPUs, 8 GiB RAM, macOS 26.5.2 / Darwin 25.5.0, Node 25.6.1, and npm 11.18.0. Baseline tag `v0.8.20` at `7fb6e37` and the current `0.8.21` compiler candidate used the same local volume and identical installed dependencies.
|
|
30
|
+
|
|
31
|
+
The candidate implementation patch over `v0.8.20` had SHA-256 `ac0b1921bbbfb72f45d9b53338bec96bf9ab3d1680446148dfd8548b871bcbe4`, produced by:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
git diff --binary v0.8.20 -- framework/build.mjs framework/compiler/descriptor-session.mjs framework/compiler/effect-analysis.mjs framework/compiler/ir/module-ir.mjs framework/compiler/worker-compiler.mjs framework/core.d.ts | shasum -a 256
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Both targets received one warm-up followed by seven clean `worker-effects` production builds in alternating round-robin order. Cleanup remained outside timing. The distributions overlap; the 1.02% lower candidate median does not establish a material change.
|
|
38
|
+
|
|
39
|
+
| Target | Build median | Worker raw / gzip | Window raw / gzip |
|
|
40
|
+
|---|---:|---:|---:|
|
|
41
|
+
| 0.8.20 baseline | 255.6 ms | 907 B / 475 B | 12,148 B / 5,427 B |
|
|
42
|
+
| 0.8.21 candidate | 253.0 ms | 907 B / 475 B | 12,148 B / 5,427 B |
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
0.8.20: [253.2,263.4,276.5,255.6,251.3,252.1,266.1]
|
|
46
|
+
0.8.21: [253.7,249.7,260.4,253.0,251.1,250.1,265.7]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The complete site `dist` and the `effect-dependencies`, `keyed-effects`, and `worker-effects` fixture output trees had identical file lists and bytes before release-content updates. The Worker graph and every window graph file were byte-identical, including the content-hashed Worker name. This measurement covers compiler clean-build startup and generated artifact size; lifecycle behavior remains covered by the complete effect, Worker, conditional, keyed, and navigation integration tests.
|
|
50
|
+
|
|
3
51
|
## 0.8.20 Explicit Keyed Ownership
|
|
4
52
|
|
|
5
53
|
Measured UTC 2026-08-09 on Apple M3, 8 logical CPUs, 8 GiB RAM, macOS 26.5.2 / Darwin 25.5.0, Node 25.6.1, and npm 11.18.0. Baseline `0.8.19` commit `c516173` and the current `0.8.20` compiler candidate used the same local volume and identical installed dependencies.
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Kudzu compiles ordinary React-shaped TypeScript and TSX into complete static HTM
|
|
|
14
14
|
|
|
15
15
|
> Experimental `0.8.x`: the compiler API and supported TSX surface may change.
|
|
16
16
|
|
|
17
|
-
**Latest release: 0.8.
|
|
17
|
+
**Latest release: 0.8.22 - Versioned compiler foundation.** Existing rendered route plans and capability manifests are now RouteIR v1 and CapabilityIR v1, with route-local state slots, stable runtime IDs, and readable names. Runtime generators consume those contracts while `build.mjs` coordinates their emission. Read the [release notes](./RELEASES.md#0822---versioned-compiler-foundation), open the [release page](https://github.com/kudzujs/kudzu/releases/tag/v0.8.22), or follow the [architecture packet](./docs/next-architecture/README.md).
|
|
18
18
|
|
|
19
19
|
- [Documentation](https://kudzujs.cloud/docs)
|
|
20
20
|
- [Installation guide](https://kudzujs.cloud/docs#install)
|
package/RELEASES.md
CHANGED
|
@@ -1,5 +1,76 @@
|
|
|
1
1
|
# Kudzu Releases
|
|
2
2
|
|
|
3
|
+
## 0.8.22 - Versioned compiler foundation
|
|
4
|
+
|
|
5
|
+
Kudzu 0.8.22 completes Goal A: source-local ModuleIR seams accompany the existing rendered route plan as RouteIR v1, while CapabilityIR v1 selects shared runtime families and branches for focused artifact generators.
|
|
6
|
+
|
|
7
|
+
### Changed in 0.8.22
|
|
8
|
+
|
|
9
|
+
- The existing `renderPage().plan` is RouteIR v1 rather than a duplicated route representation.
|
|
10
|
+
- Route states add a deterministic route-local numeric `slot`; existing string `id` values remain authoritative browser/DOM identities and `name` remains readable development metadata.
|
|
11
|
+
- The existing pure capability manifest is CapabilityIR v1. Route and capability consumers reject unsupported versions.
|
|
12
|
+
- List, parameter, core, effect, binding, native, and navigation runtime generation moved from `build.mjs` into focused generator modules with narrow inputs and no filesystem ownership.
|
|
13
|
+
- Required authored-runtime source anchors fail closed instead of silently retaining stale branches.
|
|
14
|
+
- `build.mjs` decreased from 3,999 to 3,732 lines and now coordinates generator results and artifact emission rather than containing those feature semantics.
|
|
15
|
+
|
|
16
|
+
### Goal A boundary
|
|
17
|
+
|
|
18
|
+
- ModuleIR slots identify source-local compiler records; RouteIR state slots identify positions in one rendered plan; browser IDs continue to own DOM/runtime behavior. The namespaces are deliberately independent.
|
|
19
|
+
- `core.mjs` remains authoritative for complete HTML, route/layout IDs, conditions, keyed paths, effect lifetimes, and exact cleanup.
|
|
20
|
+
- CapabilityIR selects shared runtime families and branches; RouteIR and ModuleIR references retain route entries, handlers, and Workers. Static pages remain complete documents with zero JavaScript.
|
|
21
|
+
- Goal B optimization remains deferred; `0.8.22` is its recorded baseline if explicitly started later.
|
|
22
|
+
- No accepted syntax, public API behavior, runtime capability, VDOM, hydration, component rerender, or retained browser component tree was added.
|
|
23
|
+
|
|
24
|
+
### Validation
|
|
25
|
+
|
|
26
|
+
- The complete suite passes 170/170 tests, including RouteIR JSON round-trip and slots, CapabilityIR JSON round-trip/version rejection, fail-closed generator contracts, list/parameter/navigation generation, lifecycle cleanup, and development restoration by readable state name.
|
|
27
|
+
- `npm run check`, focused Node 22 compiler tests, and a Node 22 complete-site build pass.
|
|
28
|
+
- The complete site plus six representative binding, list, effect, Worker, runtime-parameter, and navigation deploy trees are byte-identical to `v0.8.21`; normalized RouteIR meaning is identical in all seven comparisons.
|
|
29
|
+
- Worker and window graph files remain byte-identical. Seven interleaved clean builds measured equal 250.1 ms medians; raw arrays and provenance are recorded in `PERFORMANCE.md`.
|
|
30
|
+
- Release-blocking architecture audits drove full IR schema validation, accurate reachability ownership, and fail-closed source contracts before publication.
|
|
31
|
+
- `create-kudzu` remains 0.1.101 because its unchanged template already accepts `@kudzujs/core@^0.8.15`.
|
|
32
|
+
|
|
33
|
+
### Upgrade
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install @kudzujs/core@^0.8.22
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 0.8.21 - Explicit effect ownership
|
|
40
|
+
|
|
41
|
+
Kudzu 0.8.21 completes the next Goal A source-analysis seam: every supported effect now registers deterministic JSON-safe setup, cleanup, dependency, ownership, source, and Worker-edge data before existing build-time rendering allocates concrete lifecycle IDs.
|
|
42
|
+
|
|
43
|
+
### Changed in 0.8.21
|
|
44
|
+
|
|
45
|
+
- EffectIR links setup to finalized HandlerIR and records cleanup, ordered signal and DerivedIR dependencies, subscriptions, dependency state snapshots, and keyed-item fields.
|
|
46
|
+
- Component and keyed ownership retain lexical component provenance and KeyedBlockIR slots, including specialized imported rows.
|
|
47
|
+
- Relative TypeScript Worker rewriting returns functional callback and edge results; rendered Worker emission derives only from EffectIR rather than a build-wide mutable reference array.
|
|
48
|
+
- Transformed effect calls consume the registered EffectIR dependency and ownership record before final setup HandlerIR slot resolution.
|
|
49
|
+
- Effect dependency classification and cleanup-owned browser resource validation moved to `compiler/effect-analysis.mjs`; transformer-wide component and keyed effect AST side tables were removed.
|
|
50
|
+
- Mixed direct and derived dependencies create DerivedIR only for derived expressions while preserving authored dependency order.
|
|
51
|
+
|
|
52
|
+
### Goal A boundary
|
|
53
|
+
|
|
54
|
+
- `core.mjs` and the existing route plan remain authoritative for concrete route/layout/conditional/keyed effect IDs, mounting, stale-write invalidation, and cleanup order; ModuleIR does not duplicate RouteIR.
|
|
55
|
+
- EffectIR owns source-analysis facts and Worker graph edges. Route-specific effect codegen continues to consume rendered descriptors without rediscovering TSX semantics.
|
|
56
|
+
- No accepted syntax, public API, browser capability, VDOM, hydration, component rerender, or retained browser component tree was added.
|
|
57
|
+
- Goal A continues with the `0.8.22` RouteIR, CapabilityIR, numeric-slot, and final architecture/output audit.
|
|
58
|
+
|
|
59
|
+
### Validation
|
|
60
|
+
|
|
61
|
+
- The complete suite passes 170/170 tests, including EffectIR JSON round-trip, mixed dependencies, imported keyed provenance, Worker rendered exclusion and `about:blank` replacement, conditional/navigation ownership, stale-write isolation, and cleanup.
|
|
62
|
+
- `npm run check`, focused Node 22 compiler tests, and a Node 22 complete-site build pass.
|
|
63
|
+
- Before release-content updates, the complete 135-page site plus `effect-dependencies`, `keyed-effects`, and `worker-effects` output trees were byte-identical to `v0.8.20`.
|
|
64
|
+
- Worker and window graph files remain byte-identical. Seven interleaved clean builds measured a 253.0 ms candidate median against 255.6 ms for `v0.8.20`; raw arrays and provenance are recorded in `PERFORMANCE.md`.
|
|
65
|
+
- A release-blocking architecture audit found no implementation or runtime-correctness blockers.
|
|
66
|
+
- `create-kudzu` remains 0.1.101 because its unchanged template already accepts `@kudzujs/core@^0.8.15`.
|
|
67
|
+
|
|
68
|
+
### Upgrade
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm install @kudzujs/core@^0.8.21
|
|
72
|
+
```
|
|
73
|
+
|
|
3
74
|
## 0.8.20 - Explicit keyed ownership
|
|
4
75
|
|
|
5
76
|
Kudzu 0.8.20 completes the next Goal A source-analysis boundary: keyed collection sites now finalize into deterministic JSON-safe ownership records before the existing build-time renderer allocates DOM identity and lifecycle state.
|
|
@@ -6,8 +6,8 @@ The top-level [`GOAL_A.md`](../../GOAL_A.md) and [`GOAL_B.md`](../../GOAL_B.md)
|
|
|
6
6
|
|
|
7
7
|
| Goal | Decision | Start condition |
|
|
8
8
|
|---|---|---|
|
|
9
|
-
| A: compiler foundation | `0.8.
|
|
10
|
-
| B: optimization benchmarks | Deferred |
|
|
9
|
+
| A: compiler foundation | Complete in `0.8.22` | RouteIR v1, CapabilityIR v1, source IR seams, generator boundaries, and output baseline recorded. |
|
|
10
|
+
| B: optimization benchmarks | Deferred | Start only by explicit decision from the recorded `0.8.22` baseline. |
|
|
11
11
|
| C: state/resource model | Research only | Reduced fixtures expose a limitation |
|
|
12
12
|
| D: routing compatibility | Current behavior preserved | Revisit only with migration evidence and invariant review |
|
|
13
13
|
|
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
# Current Compiler Architecture
|
|
2
2
|
|
|
3
|
-
This maps the completed `0.8.
|
|
3
|
+
This maps the completed `0.8.22` Goal A compiler foundation. File and function names are the stable references; line numbers are intentionally omitted because later work may still move code.
|
|
4
4
|
|
|
5
5
|
## Responsibility Map
|
|
6
6
|
|
|
7
7
|
| Responsibility | Current owner | Current contract |
|
|
8
8
|
|---|---|---|
|
|
9
9
|
| CLI entry | [`bin/kudzu.mjs`](../../bin/kudzu.mjs) | Dispatches build and development commands. |
|
|
10
|
-
| Build orchestration | [`framework/build.mjs`](../../framework/build.mjs), `build()` |
|
|
10
|
+
| Build orchestration | [`framework/build.mjs`](../../framework/build.mjs), `build()` | Coordinates config, discovery, source compilation, RouteIR rendering, CapabilityIR projection, generator invocation, artifact emission, and `afterBuild`. |
|
|
11
11
|
| Reachability/import resolution | `framework/build.mjs`, `reachableSourceFiles()`, `resolveSourceImport()` | Starts from page entries, follows relative runtime imports/re-exports and validated Worker references, and excludes unreachable migration source. |
|
|
12
12
|
| Ordered normalization | [`framework/compiler/normalization-pipeline.mjs`](../../framework/compiler/normalization-pipeline.mjs), `applyNormalizationPasses()`; `framework/build.mjs`, `normalizeCompilerSource()` | Applies migration/resource passes in order and repairs TypeScript parent pointers after every pass. Imported source uses the same pipeline. |
|
|
13
13
|
| Focused normalization passes | [`framework/compiler/`](../../framework/compiler/) | React, Router, browser signals, animation-frame refs, custom-hook timers, Zustand, and render control each validate and lower a narrow source shape. |
|
|
14
14
|
| Shared AST/scope helpers | [`framework/compiler/ast-helpers.mjs`](../../framework/compiler/ast-helpers.mjs) | Binding, scope, reference, effect-return, and source-location analysis. |
|
|
15
15
|
| Pure collection language | [`framework/compiler/collection-analysis.mjs`](../../framework/compiler/collection-analysis.mjs) | Analyzes collection roots/selectors and serializes the allowed pure expression language used by lists and derived dependencies. |
|
|
16
|
-
| Main semantic analysis | `framework/build.mjs`, `createKudzuTransformer()` | Produces transformed source plus explicit component, handler, binding, derived, and
|
|
16
|
+
| Main semantic analysis | `framework/build.mjs`, `createKudzuTransformer()` | Produces transformed source plus explicit component, handler, binding, derived, keyed, and effect ownership results. |
|
|
17
17
|
| Component ownership analysis | [`framework/compiler/analysis/component-analysis.mjs`](../../framework/compiler/analysis/component-analysis.mjs) | Retains ordered JSON-safe owner and specialization records for state, setters, props, refs, IDs, direct signal links, and source provenance; AST identity remains private to its source-local session. |
|
|
18
|
-
| Per-source descriptor registration | [`framework/compiler/descriptor-session.mjs`](../../framework/compiler/descriptor-session.mjs), `createSemanticArtifact()`, `createDescriptorSession()` | Keeps AST descriptors private during analysis, then finalizes deterministic JSON-safe HandlerIR, BindingIR, DerivedIR, KeyedBlockIR, imports, and client roots into ModuleIR. |
|
|
18
|
+
| Per-source descriptor registration | [`framework/compiler/descriptor-session.mjs`](../../framework/compiler/descriptor-session.mjs), `createSemanticArtifact()`, `createDescriptorSession()` | Keeps AST descriptors private during analysis, then finalizes deterministic JSON-safe HandlerIR, BindingIR, DerivedIR, KeyedBlockIR, EffectIR, imports, and client roots into ModuleIR. |
|
|
19
19
|
| Command IR and codegen | [`framework/compiler/optimize/command-specialization.mjs`](../../framework/compiler/optimize/command-specialization.mjs), [`framework/compiler/ir/module-ir.mjs`](../../framework/compiler/ir/module-ir.mjs), [`framework/compiler/codegen/command-codegen.mjs`](../../framework/compiler/codegen/command-codegen.mjs) | Supported command handlers specialize to JSON-safe ModuleIR, then emit the existing `__kBehavior` AST without changing route plans. |
|
|
20
20
|
| Build module generation | `framework/build.mjs`, `compile()` | Runs TypeScript with the Kudzu transformer, writes build-executable modules to `.kudzu`, rejects surviving React/Router runtime references, and generates handler source when descriptors exist. |
|
|
21
21
|
| Handler/evaluator lowering | [`framework/compiler/handler-lowering.mjs`](../../framework/compiler/handler-lowering.mjs) | Completes source-local callback/binding/list AST rewriting and diagnostics before the JSON-safe IR boundary. |
|
|
22
22
|
| Handler module codegen | [`framework/compiler/handler-codegen.mjs`](../../framework/compiler/handler-codegen.mjs) | Renders finalized ordered imports and concatenates generated module-export source without TypeScript AST or semantic discovery. |
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
23
|
+
| Effect analysis | [`framework/compiler/effect-analysis.mjs`](../../framework/compiler/effect-analysis.mjs) | Classifies ordered signal, derived, and keyed-item dependencies and validates cleanup-owned browser resources before EffectIR registration. |
|
|
24
|
+
| Worker graph | [`framework/compiler/worker-compiler.mjs`](../../framework/compiler/worker-compiler.mjs) | Returns functional Worker rewrite results and JSON-safe EffectIR edges, validates relative graphs, emits content-hashed ESM, and resolves placeholders only for rendered effects. |
|
|
25
|
+
| Build-time JSX execution | [`framework/core.mjs`](../../framework/core.mjs), `renderPage()` | Executes compiled pages/layouts, allocates deterministic route/layout ownership IDs, emits complete HTML, and returns RouteIR v1 plus capability facts. |
|
|
26
|
+
| Route capability projection | [`framework/compiler/route-capability-planner.mjs`](../../framework/compiler/route-capability-planner.mjs), `planRouteCapabilities()` | Validates RouteIR v1 and purely folds rendered plans and route facts into CapabilityIR v1. |
|
|
26
27
|
| Effect entry generation | [`framework/compiler/effect-codegen.mjs`](../../framework/compiler/effect-codegen.mjs) | Generates ordinary, dependency, owned, and navigable effect entries from rendered descriptors. |
|
|
27
|
-
| Runtime
|
|
28
|
+
| Runtime generation | [`framework/compiler/runtime-codegen.mjs`](../../framework/compiler/runtime-codegen.mjs), [`framework/compiler/list-runtime-codegen.mjs`](../../framework/compiler/list-runtime-codegen.mjs), [`framework/compiler/param-codegen.mjs`](../../framework/compiler/param-codegen.mjs) | Consumes versioned contracts, specializes authored capability sources with fail-closed anchors, and returns source/define results without filesystem ownership. |
|
|
29
|
+
| Artifact emission | `framework/build.mjs` | Selects required files from CapabilityIR and writes or bundles generated sources with esbuild. |
|
|
28
30
|
| Browser capabilities | [`framework/*.js`](../../framework/) | Small optional modules for commands, bindings, lists, effects, native handlers, serialization, parameters, and navigation; no component runtime. |
|
|
29
31
|
| Opt-in navigation | [`framework/navigation-runtime.js`](../../framework/navigation-runtime.js) plus `framework/build.mjs` navigation configuration/emission | Fetches and validates complete same-origin documents, replaces only the marked route range, manages route/layout disposal, history, focus, finite prefetch retention, and native fallback. |
|
|
30
32
|
| Development serving | [`framework/dev-server.mjs`](../../framework/dev-server.mjs) and [`framework/dev-state.js`](../../framework/dev-state.js) | Rebuild/watch/SSE and response-only short-lived state restoration; never changes production `dist/`. |
|
|
@@ -43,11 +45,11 @@ src/pages entries + config
|
|
|
43
45
|
-> generated handler/effect/binding/list-evaluator modules
|
|
44
46
|
-> import page modules and execute renderPage()
|
|
45
47
|
-> complete HTML
|
|
46
|
-
->
|
|
48
|
+
-> RouteIR v1
|
|
47
49
|
-> referenced handler URLs and route facts
|
|
48
50
|
-> remove unrendered handlers/effects/Workers
|
|
49
|
-
|
|
50
|
-
->
|
|
51
|
+
-> planRouteCapabilities(RouteIR records, route facts)
|
|
52
|
+
-> CapabilityIR v1
|
|
51
53
|
-> specialize and emit only selected runtime/capability ESM
|
|
52
54
|
-> write route index.html, CSS/assets, Worker graphs, rewrites, and .kudzu/kudzu-plan.json
|
|
53
55
|
-> optional afterBuild()
|
|
@@ -55,15 +57,15 @@ src/pages entries + config
|
|
|
55
57
|
|
|
56
58
|
The browser consumes static HTML first. State seeds and descriptors in that HTML connect only to emitted command, binding, list, native-handler, effect, parameter, or navigation modules. Browser execution patches owned DOM directly; it does not invoke component functions or reconstruct a component tree.
|
|
57
59
|
|
|
58
|
-
##
|
|
60
|
+
## Residual Coupling
|
|
59
61
|
|
|
60
62
|
- `createKudzuTransformer()` combines discovery, validation, specialization, descriptor registration, and transformed-source emission.
|
|
61
|
-
-
|
|
62
|
-
- `build()`
|
|
63
|
-
- Runtime
|
|
64
|
-
-
|
|
63
|
+
- Transient component rewrite indexes remain source-local AST indexes; handler, binding, derived, keyed, effect, and component ownership now have explicit JSON-safe source results.
|
|
64
|
+
- `build()` still owns explicit artifact selection and filesystem writes after generator results are produced.
|
|
65
|
+
- Runtime generators intentionally specialize readable authored sources through exact anchors; every required anchor fails closed, but a future generator format may remove this transitional dependency.
|
|
66
|
+
- The main transformer remains the largest source-analysis unit even though its durable outputs are explicit JSON-safe records.
|
|
65
67
|
|
|
66
|
-
Goal A
|
|
68
|
+
These are future simplification opportunities, not incomplete Goal A contracts. Goal A changed no source support, browser output semantics, or browser architecture.
|
|
67
69
|
|
|
68
70
|
## Continuation Checklist
|
|
69
71
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Status
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Goal A is complete in `0.8.22`. ModuleIR source seams, RouteIR v1, CapabilityIR v1, focused runtime generators, and the architecture/output baseline preserve accepted React-shaped syntax, diagnostics, complete HTML, emitted capability behavior, and current public APIs.
|
|
6
6
|
|
|
7
7
|
## Target Boundaries
|
|
8
8
|
|
|
@@ -49,7 +49,7 @@ Existing representations are promoted rather than copied:
|
|
|
49
49
|
| `HandlerIR` | Plain command data or a stable generated-module export reference. |
|
|
50
50
|
| `BindingIR` | Promote existing binding descriptors. |
|
|
51
51
|
| `DerivedIR` | Reuse the existing tagged Collection Expression IR. |
|
|
52
|
-
| `EffectIR` |
|
|
52
|
+
| `EffectIR` | Records setup HandlerIR, cleanup, ordered signal/DerivedIR dependencies and subscriptions, component/keyed ownership, source provenance, and Worker edges. |
|
|
53
53
|
| `KeyedBlockIR` | Promote the existing list descriptor after ownership analysis is explicit. |
|
|
54
54
|
| `CapabilityIR` | Reuse the current pure route capability manifest. |
|
|
55
55
|
|
|
@@ -77,7 +77,7 @@ Analysis produces plain data:
|
|
|
77
77
|
}
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
The
|
|
80
|
+
The completed source result contains deterministic command, component, HandlerIR, BindingIR, DerivedIR, KeyedBlockIR, and EffectIR records. Source-local AST analysis is consumed during lowering and does not cross this boundary. Final route/layout/conditional/keyed IDs and lifetime allocation remain authoritative in `core.mjs`; no component tree or duplicate route plan exists.
|
|
81
81
|
|
|
82
82
|
Source codegen lowers that data through the existing build ABI:
|
|
83
83
|
|
|
@@ -89,15 +89,15 @@ __kBehavior([["add", count, 1]])
|
|
|
89
89
|
|
|
90
90
|
### Source Result
|
|
91
91
|
|
|
92
|
-
One source-local result owns transformed source plus the sparse ModuleIR, generated handler/effect/binding/list evaluator source, client imports,
|
|
92
|
+
One source-local result owns transformed source plus the sparse ModuleIR, generated handler/effect/binding/list evaluator source, client imports, and explicit pass metadata. Worker ownership is recorded as EffectIR edges; AST-bearing data is consumed inside analysis/lowering and does not become IR or cross-build state.
|
|
93
93
|
|
|
94
94
|
### Route Result
|
|
95
95
|
|
|
96
|
-
`renderPage()` remains the build-time authority for complete HTML and ownership IDs. Its
|
|
96
|
+
`renderPage()` remains the build-time authority for complete HTML and ownership IDs. Its existing plan is RouteIR v1, the behavioral source for states, events, effects, bindings, conditions, lists, parameters, and search parameters. Each state has a route-local numeric `slot`, its unchanged browser/DOM `id`, and readable `name` metadata used by development restoration. RouteIR slots are not ModuleIR signal slots or persistent browser identities. Route-level facts such as navigability and dependency-runtime selection accompany rather than mutate the plan.
|
|
97
97
|
|
|
98
98
|
### Artifact Plan
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
CapabilityIR v1 determines shared runtime families and optional branches. Rendered RouteIR descriptors and ModuleIR references independently retain route entries, handler modules, and Worker reachability. Runtime, list, parameter, effect, and handler generators consume those explicit results; they do not rediscover TSX semantics or inspect application AST.
|
|
101
101
|
|
|
102
102
|
## Generator Strategy
|
|
103
103
|
|
|
@@ -117,22 +117,19 @@ No generator may analyze TSX, invent runtime component abstractions, or broaden
|
|
|
117
117
|
|
|
118
118
|
- One patch, one boundary, with no migration feature mixed in.
|
|
119
119
|
- Extract only code whose callers and outputs are understood.
|
|
120
|
-
- Replace AST side tables only when an explicit
|
|
120
|
+
- Replace AST side tables only when an explicit feature result can preserve ownership and source diagnostics.
|
|
121
121
|
- Keep `build()` as orchestration; do not replace it with a service container or plugin framework.
|
|
122
122
|
- Preserve current runtime files until their corresponding generator has artifact parity.
|
|
123
123
|
- Treat deterministic byte changes as review items even when tests pass.
|
|
124
124
|
|
|
125
|
-
## Acceptance
|
|
126
|
-
|
|
127
|
-
-
|
|
128
|
-
- Source normalization, semantic analysis,
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
- Unreachable handlers, effects, package helpers, and Workers remain absent.
|
|
134
|
-
- Diagnostics retain source file and location.
|
|
135
|
-
- [`performance-gates.md`](./performance-gates.md) passes for every patch.
|
|
125
|
+
## Acceptance Record
|
|
126
|
+
|
|
127
|
+
- `build.mjs` decreased from 3,999 to 3,732 lines and coordinates focused generators rather than containing list, parameter, core, effect, binding, native, or navigation source generation.
|
|
128
|
+
- Source normalization, semantic analysis, RouteIR rendering, CapabilityIR projection, generation, and writing have explicit ownership without a broad context object.
|
|
129
|
+
- RouteIR and CapabilityIR reject unsupported versions; required runtime source anchors fail closed.
|
|
130
|
+
- Static routes retain complete HTML and zero JavaScript; deploy output across the complete site and representative binding, list, effect, Worker, parameter, and navigation fixtures is byte-identical to `v0.8.21`.
|
|
131
|
+
- Interactive and navigation routes preserve capability selection, ownership, stale-write, and cleanup behavior; unreachable handlers, effects, package helpers, and Workers remain absent.
|
|
132
|
+
- Diagnostics retain source file and location, and [`performance-gates.md`](./performance-gates.md) records no build or artifact-size regression.
|
|
136
133
|
|
|
137
134
|
## Non-Goals
|
|
138
135
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Planned Version Sequence
|
|
2
2
|
|
|
3
|
-
This is an execution sequence, not release history. `0.8.16` through `0.8.
|
|
3
|
+
This is an execution sequence, not release history. `0.8.16` through `0.8.22` are completed scopes represented by package/release records.
|
|
4
4
|
|
|
5
5
|
Keep each patch behavior-preserving and independently reviewable. If a boundary proves inseparable, revise this plan before combining releases; do not silently broaden a patch.
|
|
6
6
|
|
|
@@ -16,7 +16,7 @@ Keep each patch behavior-preserving and independently reviewable. If a boundary
|
|
|
16
16
|
|
|
17
17
|
## Sequence Rules
|
|
18
18
|
|
|
19
|
-
-
|
|
19
|
+
- Goal A is complete. Goal B optimization remains deferred until explicitly started from the recorded `0.8.22` baseline.
|
|
20
20
|
- Keep Goal C research out of these patches and publish no store/resource API.
|
|
21
21
|
- Keep Goal D behavior unchanged: complete HTML, native default, opt-in groups, no islands.
|
|
22
22
|
- A planned patch may ship under a different actual version only if this table and release-facing documentation are updated before release.
|
package/framework/README.md
CHANGED
|
@@ -36,17 +36,21 @@ Reduced Zustand migration stores lower to one ordinary layout-lifetime state slo
|
|
|
36
36
|
- `compiler/animation-frame-pass.mjs`: effect-owned animation-frame ref validation and plain mutable effect-scope lowering.
|
|
37
37
|
- `compiler/browser-signal-passes.mjs`: static media-query external-store and navigator capability-condition normalization.
|
|
38
38
|
- `compiler/collection-analysis.mjs`: pure collection expression IR, selector pipeline, alias, and imported-transform analysis.
|
|
39
|
-
- `compiler/descriptor-session.mjs`: private source-local descriptor registration and deterministic JSON-safe HandlerIR, BindingIR, DerivedIR, KeyedBlockIR, import, and client-root finalization.
|
|
39
|
+
- `compiler/descriptor-session.mjs`: private source-local descriptor registration and deterministic JSON-safe HandlerIR, BindingIR, DerivedIR, KeyedBlockIR, EffectIR, import, and client-root finalization.
|
|
40
|
+
- `compiler/effect-analysis.mjs`: ordered effect dependency classification and cleanup-owned browser resource validation before EffectIR registration.
|
|
40
41
|
- `compiler/normalization-pipeline.mjs`: ordered source normalization with parent-pointer repair after every compiler pass.
|
|
42
|
+
- `compiler/param-codegen.mjs`: runtime pathname and search-parameter entry generation from rendered route descriptors.
|
|
41
43
|
- `compiler/react-migration-pass.mjs`: React import, memo, callback, `forwardRef`, and `useId` migration validation and lowering.
|
|
42
44
|
- `compiler/custom-hook-timer-pass.mjs`: private custom-hook timeout-ref validation and compiler-owned timer-state lowering.
|
|
43
45
|
- `compiler/effect-codegen.mjs`: route-specific ordinary, owned, and navigable effect entry generation.
|
|
44
|
-
- `compiler/optimize/command-specialization.mjs`, `compiler/ir/module-ir.mjs`, and `compiler/codegen/command-codegen.mjs`: JSON-safe command and
|
|
46
|
+
- `compiler/optimize/command-specialization.mjs`, `compiler/ir/module-ir.mjs`, and `compiler/codegen/command-codegen.mjs`: JSON-safe command, keyed, and effect ownership registration, sparse per-source ModuleIR, and source-analysis-free existing behavior-call generation.
|
|
45
47
|
- `compiler/handler-lowering.mjs`: source-local native/effect callback, reducer, Context, Zustand, reactive-binding, and list-evaluator AST lowering before IR finalization.
|
|
46
48
|
- `compiler/handler-codegen.mjs`: AST-free ordered import rendering and finalized handler/binding export-source assembly.
|
|
47
49
|
- `compiler/render-control-pass.mjs`: render-function early-return and exhaustive adjacent-assignment normalization.
|
|
48
50
|
- `compiler/router-pass.mjs`: React Router import validation and native Link, pathname parameter, search parameter, and imperative navigation lowering.
|
|
49
|
-
- `compiler/route-capability-planner.mjs`: pure
|
|
51
|
+
- `compiler/route-capability-planner.mjs`: RouteIR v1 validation and pure CapabilityIR v1 projection into runtime and artifact requirements.
|
|
52
|
+
- `compiler/runtime-codegen.mjs`: fail-closed core, effect, binding, native, and navigation runtime generation from CapabilityIR.
|
|
53
|
+
- `compiler/list-runtime-codegen.mjs`: fail-closed keyed-list runtime generation from CapabilityIR list/effect sections.
|
|
50
54
|
- `compiler/worker-compiler.mjs`: relative TypeScript Worker candidate validation, effect rewriting, graph validation, and content-hashed ESM emission.
|
|
51
55
|
- `compiler/zustand-pass.mjs`: reduced Zustand store analysis, diagnostics, and migration normalization.
|
|
52
56
|
- `dev-server.mjs`: development HTTP server, source watching, rebuild serialization, SSE reloads, runtime-route fallback serving, and response-only state restoration injection.
|
|
@@ -64,7 +68,7 @@ Reduced Zustand migration stores lower to one ordinary layout-lifetime state slo
|
|
|
64
68
|
- `dev-state.js`: dev-only, short-lived logical-state snapshot validation and restoration.
|
|
65
69
|
- `*.d.ts`: public TypeScript and JSX declarations.
|
|
66
70
|
|
|
67
|
-
Compiler ownership follows
|
|
71
|
+
Compiler ownership follows explicit stages. `build.mjs` coordinates project discovery, source compilation, RouteIR rendering, CapabilityIR planning, generator calls, and artifact emission. `compiler/normalization-pipeline.mjs` owns pass order and parent repair. The main transformer analyzes normalized source while `compiler/descriptor-session.mjs` owns one per-source semantic artifact containing HandlerIR, BindingIR, DerivedIR, KeyedBlockIR, EffectIR, and client imports. `core.mjs` emits complete HTML and RouteIR v1: route-local state `slot` is an internal array reference, `id` remains the browser/DOM identity, and `name` remains readable development metadata. `compiler/route-capability-planner.mjs` validates those plans and projects CapabilityIR v1. Focused codegen modules consume IR/descriptors and return route-specific source without source analysis or filesystem ownership. The completed architecture record lives in `docs/next-architecture`; it adds no runtime or accepted syntax by itself.
|
|
68
72
|
|
|
69
73
|
New syntax support belongs in an existing pass or a focused new pass only when a reduced migration fixture proves it. Passes must preserve source-located diagnostics, avoid module-global analysis state, and expose metadata through return values rather than AST-identity side channels. Build orchestration stays in `build.mjs`; feature-specific graph validation or code generation moves under `compiler/` when it has a stable input/output boundary.
|
|
70
74
|
|