@memoized-dom/compiler 0.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.
- package/README.md +28 -0
- package/dist/analysis/access-table.d.ts +5 -0
- package/dist/analysis/access-table.d.ts.map +1 -0
- package/dist/analysis/component-graph.d.ts +10 -0
- package/dist/analysis/component-graph.d.ts.map +1 -0
- package/dist/analysis/component-reads.d.ts +10 -0
- package/dist/analysis/component-reads.d.ts.map +1 -0
- package/dist/analysis/computed.d.ts +11 -0
- package/dist/analysis/computed.d.ts.map +1 -0
- package/dist/analysis/instance-control-flow.d.ts +9 -0
- package/dist/analysis/instance-control-flow.d.ts.map +1 -0
- package/dist/analysis/instance.d.ts +9 -0
- package/dist/analysis/instance.d.ts.map +1 -0
- package/dist/analysis/runtime-pattern.d.ts +9 -0
- package/dist/analysis/runtime-pattern.d.ts.map +1 -0
- package/dist/analysis/slot-paths.d.ts +11 -0
- package/dist/analysis/slot-paths.d.ts.map +1 -0
- package/dist/analysis/type-candidates.d.ts +14 -0
- package/dist/analysis/type-candidates.d.ts.map +1 -0
- package/dist/analysis.d.ts +52 -0
- package/dist/analysis.d.ts.map +1 -0
- package/dist/compile.d.ts +17 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/component-linker.d.ts +32 -0
- package/dist/component-linker.d.ts.map +1 -0
- package/dist/components/callback-props.d.ts +14 -0
- package/dist/components/callback-props.d.ts.map +1 -0
- package/dist/components/calls.d.ts +17 -0
- package/dist/components/calls.d.ts.map +1 -0
- package/dist/components/children.d.ts +43 -0
- package/dist/components/children.d.ts.map +1 -0
- package/dist/components/declarations.d.ts +16 -0
- package/dist/components/declarations.d.ts.map +1 -0
- package/dist/components/jsx-values.d.ts +7 -0
- package/dist/components/jsx-values.d.ts.map +1 -0
- package/dist/components/local-derived.d.ts +6 -0
- package/dist/components/local-derived.d.ts.map +1 -0
- package/dist/components/manifest.d.ts +31 -0
- package/dist/components/manifest.d.ts.map +1 -0
- package/dist/components/prop-effects.d.ts +11 -0
- package/dist/components/prop-effects.d.ts.map +1 -0
- package/dist/components/prop-linker.d.ts +8 -0
- package/dist/components/prop-linker.d.ts.map +1 -0
- package/dist/components/prop-origins.d.ts +17 -0
- package/dist/components/prop-origins.d.ts.map +1 -0
- package/dist/components/prop-projections.d.ts +5 -0
- package/dist/components/prop-projections.d.ts.map +1 -0
- package/dist/components/props.d.ts +73 -0
- package/dist/components/props.d.ts.map +1 -0
- package/dist/components/ref-props.d.ts +11 -0
- package/dist/components/ref-props.d.ts.map +1 -0
- package/dist/components/render-callbacks.d.ts +19 -0
- package/dist/components/render-callbacks.d.ts.map +1 -0
- package/dist/components/render-functions.d.ts +4 -0
- package/dist/components/render-functions.d.ts.map +1 -0
- package/dist/components/render-prelude.d.ts +13 -0
- package/dist/components/render-prelude.d.ts.map +1 -0
- package/dist/components/return-plan.d.ts +27 -0
- package/dist/components/return-plan.d.ts.map +1 -0
- package/dist/conds.d.ts +21 -0
- package/dist/conds.d.ts.map +1 -0
- package/dist/context/ast.d.ts +51 -0
- package/dist/context/ast.d.ts.map +1 -0
- package/dist/context/model.d.ts +309 -0
- package/dist/context/model.d.ts.map +1 -0
- package/dist/context.d.ts +9 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/effects.d.ts +26 -0
- package/dist/effects.d.ts.map +1 -0
- package/dist/emission/component.d.ts +12 -0
- package/dist/emission/component.d.ts.map +1 -0
- package/dist/emission/conditional-region.d.ts +13 -0
- package/dist/emission/conditional-region.d.ts.map +1 -0
- package/dist/emission/dom-template.d.ts +11 -0
- package/dist/emission/dom-template.d.ts.map +1 -0
- package/dist/emission/list-region.d.ts +10 -0
- package/dist/emission/list-region.d.ts.map +1 -0
- package/dist/emission/node-emitter.d.ts +8 -0
- package/dist/emission/node-emitter.d.ts.map +1 -0
- package/dist/emission/render-callback.d.ts +14 -0
- package/dist/emission/render-callback.d.ts.map +1 -0
- package/dist/emission/scope.d.ts +47 -0
- package/dist/emission/scope.d.ts.map +1 -0
- package/dist/emit.d.ts +29 -0
- package/dist/emit.d.ts.map +1 -0
- package/dist/handler-commits.d.ts +30 -0
- package/dist/handler-commits.d.ts.map +1 -0
- package/dist/handler-origin.d.ts +13 -0
- package/dist/handler-origin.d.ts.map +1 -0
- package/dist/handlers/analyze.d.ts +4 -0
- package/dist/handlers/analyze.d.ts.map +1 -0
- package/dist/handlers/local-calls.d.ts +11 -0
- package/dist/handlers/local-calls.d.ts.map +1 -0
- package/dist/handlers.d.ts +40 -0
- package/dist/handlers.d.ts.map +1 -0
- package/dist/helper-summaries.d.ts +12 -0
- package/dist/helper-summaries.d.ts.map +1 -0
- package/dist/identifiers.d.ts +29 -0
- package/dist/identifiers.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/jsx/attributes.d.ts +24 -0
- package/dist/jsx/attributes.d.ts.map +1 -0
- package/dist/jsx/children.d.ts +32 -0
- package/dist/jsx/children.d.ts.map +1 -0
- package/dist/jsx/dom-attributes.d.ts +13 -0
- package/dist/jsx/dom-attributes.d.ts.map +1 -0
- package/dist/jsx/dynamic-tags.d.ts +20 -0
- package/dist/jsx/dynamic-tags.d.ts.map +1 -0
- package/dist/jsx/events.d.ts +4 -0
- package/dist/jsx/events.d.ts.map +1 -0
- package/dist/jsx/refs.d.ts +15 -0
- package/dist/jsx/refs.d.ts.map +1 -0
- package/dist/jsx/svg.d.ts +11 -0
- package/dist/jsx/svg.d.ts.map +1 -0
- package/dist/lifecycle.d.ts +31 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/linker.d.ts +19 -0
- package/dist/linker.d.ts.map +1 -0
- package/dist/lists/calculated-sources.d.ts +8 -0
- package/dist/lists/calculated-sources.d.ts.map +1 -0
- package/dist/lists/map-site.d.ts +50 -0
- package/dist/lists/map-site.d.ts.map +1 -0
- package/dist/lists/source-shapes.d.ts +6 -0
- package/dist/lists/source-shapes.d.ts.map +1 -0
- package/dist/lists.d.ts +7 -0
- package/dist/lists.d.ts.map +1 -0
- package/dist/module-control-flow.d.ts +8 -0
- package/dist/module-control-flow.d.ts.map +1 -0
- package/dist/mutation-analysis.d.ts +42 -0
- package/dist/mutation-analysis.d.ts.map +1 -0
- package/dist/plugin.d.ts +27 -0
- package/dist/plugin.d.ts.map +1 -0
- package/package.json +30 -0
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Compiler
|
|
2
|
+
|
|
3
|
+
The top-level files are orchestration and whole-program passes:
|
|
4
|
+
|
|
5
|
+
| Path | Responsibility |
|
|
6
|
+
|---|---|
|
|
7
|
+
| `src/analysis.ts` | Analysis orchestration, JSX validation, and read attribution |
|
|
8
|
+
| `src/context.ts` | Stable facade for shared context types and AST utilities |
|
|
9
|
+
| `src/emit.ts` | Host JSX DOM emission and structural-region dispatch |
|
|
10
|
+
| `src/handlers.ts` | Handler resolution and callback instrumentation |
|
|
11
|
+
| `src/linker.ts` | Connected module-graph compilation |
|
|
12
|
+
| `src/module-control-flow.ts` | Pure module if/switch computed classification |
|
|
13
|
+
| `src/plugin.ts` | Babel pass ordering and final module rewrite |
|
|
14
|
+
|
|
15
|
+
Domain folders keep related implementation details discoverable:
|
|
16
|
+
|
|
17
|
+
| Folder | Responsibility |
|
|
18
|
+
|---|---|
|
|
19
|
+
| `src/analysis/` | Computeds, component paths, instance preludes, and access tables |
|
|
20
|
+
| `src/components/` | Prop contracts, content/ref slots, and linker manifests |
|
|
21
|
+
| `src/context/` | Compiler data model/context construction and raw AST helpers |
|
|
22
|
+
| `src/emission/` | Component factories, generated scopes, and list/conditional regions |
|
|
23
|
+
| `src/handlers/` | Mutation traversal and commit-routing analysis |
|
|
24
|
+
| `src/jsx/` | Ordered attributes, child classification, refs, and namespaces |
|
|
25
|
+
|
|
26
|
+
The top-level analysis, context, emitter, and handler modules intentionally
|
|
27
|
+
remain stable facades. Cross-domain callers use those facades; implementation
|
|
28
|
+
modules within a domain import their siblings directly.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access-table.d.ts","sourceRoot":"","sources":["../../src/analysis/access-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAqB,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAKzD,gEAAgE;AAChE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,SAAS,GAAG,IAAI,CAyF7D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Ctx } from '../context';
|
|
2
|
+
/** Resolve every static runtime path at which a component may be mounted. */
|
|
3
|
+
export declare function pathVariants(ctx: Ctx, name: string, visiting?: Set<string>): string[];
|
|
4
|
+
/** Runtime reader patterns for static, conditional, and listed components. */
|
|
5
|
+
export declare function componentPatterns(ctx: Ctx, name: string): string[];
|
|
6
|
+
/** Whether a listed component can use the allocation-free row ABI. */
|
|
7
|
+
export declare function isLightweightListedComponent(ctx: Ctx, name: string): boolean;
|
|
8
|
+
/** Intrinsic row shape used before graph linking marks a component listed. */
|
|
9
|
+
export declare function isListLightweightCandidate(ctx: Ctx, name: string): boolean;
|
|
10
|
+
//# sourceMappingURL=component-graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-graph.d.ts","sourceRoot":"","sources":["../../src/analysis/component-graph.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAItC,6EAA6E;AAC7E,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,GAAG,CAAC,MAAM,CAAa,GAChC,MAAM,EAAE,CAuDV;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAuClE;AAED,sEAAsE;AACtE,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,MAAM,GACX,OAAO,CAoBT;AAED,8EAA8E;AAC9E,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAgC1E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Ctx } from '../context';
|
|
2
|
+
/** Module dependencies read anywhere in an already-analyzed component tree. */
|
|
3
|
+
export declare function componentSubtreeReads(ctx: Ctx, componentName: string, visiting?: Set<string>): Set<string>;
|
|
4
|
+
/**
|
|
5
|
+
* Render-callback component trees live under callee-owned row identities, but
|
|
6
|
+
* their dependencies and refresh manager remain caller-owned. Fold those
|
|
7
|
+
* static dependencies into the caller access-table entry.
|
|
8
|
+
*/
|
|
9
|
+
export declare function foldRenderCallbackSubtreeReads(ctx: Ctx): void;
|
|
10
|
+
//# sourceMappingURL=component-reads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-reads.d.ts","sourceRoot":"","sources":["../../src/analysis/component-reads.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAGjD,+EAA+E;AAC/E,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,MAAM,EACrB,QAAQ,GAAE,GAAG,CAAC,MAAM,CAAa,GAChC,GAAG,CAAC,MAAM,CAAC,CA0Bb;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CA0C7D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NodePath } from '@babel/traverse';
|
|
2
|
+
import * as t from '@babel/types';
|
|
3
|
+
import { type ComputedAnalysis, type Ctx } from '../context';
|
|
4
|
+
/**
|
|
5
|
+
* Analyze a candidate module-level computed initializer. Detection is by
|
|
6
|
+
* reactive-state reference rather than by a whitelist of expression forms.
|
|
7
|
+
*/
|
|
8
|
+
export declare function analyzeComputed(ctx: Ctx, expr: t.Node): ComputedAnalysis;
|
|
9
|
+
/** Discover ordered module-level const derivations after module state exists. */
|
|
10
|
+
export declare function scanComputeds(ctx: Ctx, programPath: NodePath<t.Program>): void;
|
|
11
|
+
//# sourceMappingURL=computed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computed.d.ts","sourceRoot":"","sources":["../../src/analysis/computed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAKL,KAAK,gBAAgB,EACrB,KAAK,GAAG,EACT,MAAM,YAAY,CAAC;AAGpB;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,gBAAgB,CAqGxE;AAED,iFAAiF;AACjF,wBAAgB,aAAa,CAC3B,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAC/B,IAAI,CAgCN"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Ctx } from '../context';
|
|
2
|
+
/**
|
|
3
|
+
* Classify pure top-level if/switch calculations for reactive replay.
|
|
4
|
+
* Side-effectful control flow remains one-time authored setup.
|
|
5
|
+
*/
|
|
6
|
+
export declare function scanInstanceControlFlow(ctx: Ctx): void;
|
|
7
|
+
/** Resolve transitive sources and allocate selective invalidation reasons. */
|
|
8
|
+
export declare function finalizeInstancePreludes(ctx: Ctx): void;
|
|
9
|
+
//# sourceMappingURL=instance-control-flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance-control-flow.d.ts","sourceRoot":"","sources":["../../src/analysis/instance-control-flow.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAwJtC;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CA4HtD;AAED,8EAA8E;AAC9E,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAuEvD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Ctx } from '../context';
|
|
2
|
+
/** Collect mutable or store-like bindings owned by each component instance. */
|
|
3
|
+
export declare function scanInstanceState(ctx: Ctx): void;
|
|
4
|
+
/**
|
|
5
|
+
* Discover ordered component-local const derivations. These replay in the
|
|
6
|
+
* owning component update before guarded DOM setters.
|
|
7
|
+
*/
|
|
8
|
+
export declare function scanInstanceDerivations(ctx: Ctx): void;
|
|
9
|
+
//# sourceMappingURL=instance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/analysis/instance.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,GAAG,EACT,MAAM,YAAY,CAAC;AAMpB,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CA0BhD;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CA8LtD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as t from '@babel/types';
|
|
2
|
+
export type RuntimeBindingPattern = t.Identifier | t.ObjectPattern | t.ArrayPattern;
|
|
3
|
+
/**
|
|
4
|
+
* Clone an authored TypeScript binding pattern for generated JavaScript.
|
|
5
|
+
* Babel stores annotations on nested pattern nodes, so clear every supported
|
|
6
|
+
* binding shape rather than only the root.
|
|
7
|
+
*/
|
|
8
|
+
export declare function cloneRuntimeBindingPattern(pattern: RuntimeBindingPattern): RuntimeBindingPattern;
|
|
9
|
+
//# sourceMappingURL=runtime-pattern.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-pattern.d.ts","sourceRoot":"","sources":["../../src/analysis/runtime-pattern.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,MAAM,MAAM,qBAAqB,GAC7B,CAAC,CAAC,UAAU,GACZ,CAAC,CAAC,aAAa,GACf,CAAC,CAAC,YAAY,CAAC;AAEnB;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,qBAAqB,GAC7B,qBAAqB,CAcvB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Ctx } from '../context';
|
|
2
|
+
/**
|
|
3
|
+
* Add the runtime identity alternatives created by deferred render slots.
|
|
4
|
+
*
|
|
5
|
+
* The first mount deliberately retains the lexical path. Later live mounts
|
|
6
|
+
* insert `$slot[n]` immediately below the component that authored the slot.
|
|
7
|
+
* Expanding static access paths here keeps state routing precise without
|
|
8
|
+
* runtime JSX values or dynamic dependency registration.
|
|
9
|
+
*/
|
|
10
|
+
export declare function expandRenderSlotPaths(ctx: Ctx, paths: readonly string[]): string[];
|
|
11
|
+
//# sourceMappingURL=slot-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot-paths.d.ts","sourceRoot":"","sources":["../../src/analysis/slot-paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAOtC;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,MAAM,EAAE,CAqBV"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as t from '@babel/types';
|
|
2
|
+
/**
|
|
3
|
+
* Module state whose declared TypeScript type is a finite string-literal set.
|
|
4
|
+
* The annotation is the contract: an initializer alone cannot prove every
|
|
5
|
+
* value that later assignments or imported helper calls may produce.
|
|
6
|
+
*/
|
|
7
|
+
export declare function moduleStateStringCandidates(program: t.Program): Map<string, string[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Functions whose declared return type is a finite string-literal set.
|
|
10
|
+
* This is exported through linked function metadata so a caller can safely
|
|
11
|
+
* lower `const Tag = chooseTag(...); <Tag />` without seeing the helper body.
|
|
12
|
+
*/
|
|
13
|
+
export declare function moduleFunctionStringCandidates(program: t.Program): Map<string, string[]>;
|
|
14
|
+
//# sourceMappingURL=type-candidates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-candidates.d.ts","sourceRoot":"","sources":["../../src/analysis/type-candidates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AA8FlC;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,CAAC,CAAC,OAAO,GACjB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAyBvB;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,CAAC,CAAC,OAAO,GACjB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAwCvB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* analysis.ts — compiler pass 1: module analysis and access-table build.
|
|
3
|
+
*
|
|
4
|
+
* Runs at Program.enter, before any transform:
|
|
5
|
+
* 1. scan module-level reactive state (`let` vars, `const` store objects)
|
|
6
|
+
* 2. scan top-level functions: JSX-bearing ones are COMPONENTS, the rest
|
|
7
|
+
* are HELPERS (summarized for interprocedural read/write attribution)
|
|
8
|
+
* 3. per component: wire the composition graph (ALL parents), count host
|
|
9
|
+
* elements, validate every construct L1 does/doesn't support
|
|
10
|
+
* 4. collect reads per component — with list-row attribution and helper
|
|
11
|
+
* summaries folded in
|
|
12
|
+
*
|
|
13
|
+
* Specialized analysis lives under analysis/: computed state, instance
|
|
14
|
+
* derivations, control-flow replay, component paths, and access-table build.
|
|
15
|
+
*
|
|
16
|
+
* M5.3 fixes living here:
|
|
17
|
+
* - helpers are no longer mistaken for components (and vice versa)
|
|
18
|
+
* - multi-parent components route to every instance
|
|
19
|
+
* - row patterns expand repeated ancestors ('App/Tag[*]/items/Row[*]')
|
|
20
|
+
* - key={...} outside list rows and state-reading props on static
|
|
21
|
+
* children are compile errors (were silent miscompiles)
|
|
22
|
+
*/
|
|
23
|
+
import type { NodePath } from '@babel/traverse';
|
|
24
|
+
import * as t from '@babel/types';
|
|
25
|
+
import { type Ctx } from './context';
|
|
26
|
+
export { isLightweightListedComponent, isListLightweightCandidate, } from './analysis/component-graph';
|
|
27
|
+
export { buildAccessTable } from './analysis/access-table';
|
|
28
|
+
/**
|
|
29
|
+
* R13: analyze a candidate computed initializer — collect the state keys it
|
|
30
|
+
* reads and decide whether it is a legal derivation.
|
|
31
|
+
*
|
|
32
|
+
* Detection is BY REFERENCE (R13.1, replacing the PURE_METHODS whitelist):
|
|
33
|
+
* any expression that mentions an already-declared state variable is a
|
|
34
|
+
* derivation — arbitrary method calls, unknown/imported/global functions,
|
|
35
|
+
* `new`, tagged templates, and local-mutating callbacks are all fine. A
|
|
36
|
+
* derivation recomputes on every write to its sources and computedChanged
|
|
37
|
+
* gates what propagates downstream; keeping it a pure function of state is
|
|
38
|
+
* the author's responsibility (same contract as Vue computed / Svelte $:).
|
|
39
|
+
*
|
|
40
|
+
* Rejected syntax covers only what would corrupt the state model itself:
|
|
41
|
+
* - assignments / updates to non-locals (writes belong in handlers)
|
|
42
|
+
* - calls to module helpers KNOWN to write state (reuses the same write
|
|
43
|
+
* analysis handlers rely on — a precise negative, not a whitelist)
|
|
44
|
+
* - await / yield (derivations must be synchronous)
|
|
45
|
+
* Locals (nested function params, declarators) are collected conservatively
|
|
46
|
+
* (name-wide), so `reduce((acc, t) => { acc.push(t); return acc; }, [])`
|
|
47
|
+
* and `(s, t) => (s += t.n, s)` are fine. The walk never early-exits on
|
|
48
|
+
* impure: read collection continues so a state-touching impure const is
|
|
49
|
+
* always an ERROR, never a silent plain const.
|
|
50
|
+
*/
|
|
51
|
+
export declare function runAnalysis(ctx: Ctx, programPath: NodePath<t.Program>): void;
|
|
52
|
+
//# sourceMappingURL=analysis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../src/analysis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EASL,KAAK,GAAG,EACT,MAAM,WAAW,CAAC;AAsCnB,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAonC3D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,IAAI,CA6C5E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* compile.ts — compiler entry point.
|
|
3
|
+
*
|
|
4
|
+
* One function: component source (.tsx) in, compiled JavaScript out.
|
|
5
|
+
*
|
|
6
|
+
* Plugin pipeline:
|
|
7
|
+
* 1. @babel/plugin-syntax-jsx — parse JSX (no transform)
|
|
8
|
+
* 2. memoDomPlugin — the paradigm transform (R1–R6, L1)
|
|
9
|
+
* 3. @babel/plugin-transform-typescript — strip types from emitted code
|
|
10
|
+
*
|
|
11
|
+
* The transform is written against standard ESTree nodes via @babel/types so
|
|
12
|
+
* frontend #2 (oxc) can reuse the emission logic later.
|
|
13
|
+
*/
|
|
14
|
+
import { type MemoDomOptions } from './plugin';
|
|
15
|
+
export type { MemoDomOptions };
|
|
16
|
+
export declare function compile(source: string, opts?: MemoDomOptions): string;
|
|
17
|
+
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAsB,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAE9D,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,cAAmB,GAAG,MAAM,CAezE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* component-linker.ts - graph-level component placement and row-mode linking.
|
|
3
|
+
*
|
|
4
|
+
* Component factories are analyzed in their defining module but receive
|
|
5
|
+
* runtime ids from callers. This pass turns cross-module call edges into the
|
|
6
|
+
* concrete/wildcard paths used by defining-module access-table emission.
|
|
7
|
+
*/
|
|
8
|
+
import type { LinkedComponentPropSource, LinkedComponentRowUse } from './context';
|
|
9
|
+
import type { ComponentPropSourceRefs } from './components/prop-origins';
|
|
10
|
+
export interface ComponentGraphEdge {
|
|
11
|
+
target: string;
|
|
12
|
+
suffix: string;
|
|
13
|
+
mode: 'static' | 'row';
|
|
14
|
+
keyPath?: string[] | null;
|
|
15
|
+
sourceKey?: string;
|
|
16
|
+
sourceLocal?: boolean;
|
|
17
|
+
propSources?: ComponentPropSourceRefs;
|
|
18
|
+
}
|
|
19
|
+
export interface ComponentGraphNode {
|
|
20
|
+
key: string;
|
|
21
|
+
moduleId: string;
|
|
22
|
+
local: string;
|
|
23
|
+
edges: ComponentGraphEdge[];
|
|
24
|
+
}
|
|
25
|
+
export interface LinkedComponentGraph {
|
|
26
|
+
paths: Map<string, string[]>;
|
|
27
|
+
rows: Map<string, LinkedComponentRowUse[]>;
|
|
28
|
+
propSources: Map<string, Map<string, LinkedComponentPropSource>>;
|
|
29
|
+
}
|
|
30
|
+
/** Compute every declaration's caller-derived paths and keyed-row metadata. */
|
|
31
|
+
export declare function linkComponentGraph(declarations: readonly ComponentGraphNode[], rootId: string): LinkedComponentGraph;
|
|
32
|
+
//# sourceMappingURL=component-linker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-linker.d.ts","sourceRoot":"","sources":["../src/component-linker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,uBAAuB,EACxB,MAAM,2BAA2B,CAAC;AAGnC,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACvC;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,kBAAkB,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7B,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAC3C,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC,CAAC;CAClE;AAoBD,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,SAAS,kBAAkB,EAAE,EAC3C,MAAM,EAAE,MAAM,GACb,oBAAoB,CAiEtB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable scalar callback props.
|
|
3
|
+
*
|
|
4
|
+
* Inline callback expressions are factory values, not reactive values. Their
|
|
5
|
+
* closures observe the component's live bindings, so recreating them in every
|
|
6
|
+
* prop replay only causes identity churn and needless child invalidation.
|
|
7
|
+
*/
|
|
8
|
+
import * as t from '@babel/types';
|
|
9
|
+
import type { Ctx } from '../context';
|
|
10
|
+
import type { EmitScope } from '../emission/scope';
|
|
11
|
+
export declare function isInlineScalarCallback(value: t.Expression): value is t.ArrowFunctionExpression | t.FunctionExpression;
|
|
12
|
+
export declare function stabilizeInlineCallbackProp(ctx: Ctx, scope: EmitScope, value: t.ArrowFunctionExpression | t.FunctionExpression, hint?: string): t.Identifier;
|
|
13
|
+
export declare function stabilizeInlineCallbackStatement(ctx: Ctx, statements: t.Statement[], value: t.ArrowFunctionExpression | t.FunctionExpression, hint?: string): t.Identifier;
|
|
14
|
+
//# sourceMappingURL=callback-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callback-props.d.ts","sourceRoot":"","sources":["../../src/components/callback-props.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,CAAC,CAAC,UAAU,GAClB,KAAK,IAAI,CAAC,CAAC,uBAAuB,GAAG,CAAC,CAAC,kBAAkB,CAK3D;AAED,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,CAAC,CAAC,uBAAuB,GAAG,CAAC,CAAC,kBAAkB,EACvD,IAAI,SAAa,GAChB,CAAC,CAAC,UAAU,CAQd;AAED,wBAAgB,gCAAgC,CAC9C,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,CAAC,CAAC,SAAS,EAAE,EACzB,KAAK,EAAE,CAAC,CAAC,uBAAuB,GAAG,CAAC,CAAC,kBAAkB,EACvD,IAAI,SAAa,GAChB,CAAC,CAAC,UAAU,CAQd"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* components/calls.ts - named JSX props to component factory arguments.
|
|
3
|
+
*
|
|
4
|
+
* Call sites use names while component factories may use positional slots or
|
|
5
|
+
* one object envelope. These builders are shared by static and keyed-row
|
|
6
|
+
* component emission so prop order and spread projection cannot drift.
|
|
7
|
+
*/
|
|
8
|
+
import * as t from '@babel/types';
|
|
9
|
+
import type { Ctx } from '../context';
|
|
10
|
+
export interface ComponentPropEntry {
|
|
11
|
+
name: string;
|
|
12
|
+
value: t.Expression;
|
|
13
|
+
}
|
|
14
|
+
export declare function orderCallProps(ctx: Ctx, tag: string, entries: ComponentPropEntry[]): t.Expression[];
|
|
15
|
+
export declare function callPropsFromObject(ctx: Ctx, tag: string, object: t.Expression): t.Expression[];
|
|
16
|
+
export declare function buildSpreadComponentPropUpdate(ctx: Ctx, tag: string, ownerId: t.Expression, idSuffix: string, expression: t.ObjectExpression): t.Statement;
|
|
17
|
+
//# sourceMappingURL=calls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../../src/components/calls.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGtC,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC;CACrB;AAED,wBAAgB,cAAc,CAC5B,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,kBAAkB,EAAE,GAC5B,CAAC,CAAC,UAAU,EAAE,CAgDhB;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,CAAC,CAAC,UAAU,GACnB,CAAC,CAAC,UAAU,EAAE,CAYhB;AAED,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,CAAC,CAAC,UAAU,EACrB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,CAAC,CAAC,gBAAgB,GAC7B,CAAC,CAAC,SAAS,CAoBb"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* components/children.ts - compiler-owned content slots for component children.
|
|
3
|
+
*
|
|
4
|
+
* A slot defers child creation until the callee mounts it into a real host
|
|
5
|
+
* node. Its update closure remains attached to the lexical owner's update so
|
|
6
|
+
* ordinary state routing and guarded DOM writes keep their existing shape.
|
|
7
|
+
*/
|
|
8
|
+
import * as t from '@babel/types';
|
|
9
|
+
import { type Ctx } from '../context';
|
|
10
|
+
import { type EmitScope } from '../emission/scope';
|
|
11
|
+
export type EmitChildSlot = (scope: EmitScope, parentNode: t.Identifier, ownerId: t.Identifier) => void;
|
|
12
|
+
export type JsxChild = t.JSXElement['children'][number];
|
|
13
|
+
export interface ChildContentEmitters {
|
|
14
|
+
emitText(expression: t.Expression): string;
|
|
15
|
+
emitNode(node: t.JSXElement | t.JSXFragment): string;
|
|
16
|
+
emitList(call: t.CallExpression, parentVar: string): void;
|
|
17
|
+
emitCondition(expression: t.ConditionalExpression | t.LogicalExpression, parentVar: string): void;
|
|
18
|
+
isForwarded(expression: t.Expression): boolean;
|
|
19
|
+
emitForwarded(expression: t.Expression, parentVar: string): void;
|
|
20
|
+
fail(message: string): never;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* React-compatible JSX text normalization shared by host and slot content.
|
|
24
|
+
* Edge spaces are removed only when they come from source line breaks.
|
|
25
|
+
*/
|
|
26
|
+
export declare function normalizeJsxText(raw: string): string;
|
|
27
|
+
/** Does a component element contain authored, non-whitespace children? */
|
|
28
|
+
export declare function hasComponentChildren(children: readonly JsxChild[]): boolean;
|
|
29
|
+
/** Declared render-prop name referenced by one interpolation/forwarding site. */
|
|
30
|
+
export declare function renderPropReferenceName(ctx: Ctx, compName: string, expression: t.Expression): string | null;
|
|
31
|
+
/** Is this expression one of the component's compiler-owned mount slots? */
|
|
32
|
+
export declare function isRenderPropReference(ctx: Ctx, compName: string, expression: t.Expression): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Build a stable mount function and link its guarded update to `ownerScope`.
|
|
35
|
+
* Child entity/list/conditional counters are shared with the lexical owner so
|
|
36
|
+
* generated ids follow the same source-order analysis as direct JSX.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildChildrenSlot(ctx: Ctx, ownerScope: EmitScope, identityOwner: t.Expression, emit: EmitChildSlot): t.Identifier;
|
|
39
|
+
/** Mount one forwarded slot with a structural owner and track branch teardown. */
|
|
40
|
+
export declare function emitForwardedSlotMount(ctx: Ctx, scope: EmitScope, expression: t.Expression, parentVar: string, ownerId: t.Expression): void;
|
|
41
|
+
/** Emit lazy slot content into a callee-provided host in source order. */
|
|
42
|
+
export declare function emitChildrenIntoParent(scope: EmitScope, children: readonly JsxChild[], parentVar: string, emitters: ChildContentEmitters): void;
|
|
43
|
+
//# sourceMappingURL=children.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"children.d.ts","sourceRoot":"","sources":["../../src/components/children.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAc,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,mBAAmB,CAAC;AAS3B,MAAM,MAAM,aAAa,GAAG,CAC1B,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,CAAC,CAAC,UAAU,EACxB,OAAO,EAAE,CAAC,CAAC,UAAU,KAClB,IAAI,CAAC;AACV,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,UAAU,GAAG,MAAM,CAAC;IAC3C,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,WAAW,GAAG,MAAM,CAAC;IACrD,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1D,aAAa,CACX,UAAU,EAAE,CAAC,CAAC,qBAAqB,GAAG,CAAC,CAAC,iBAAiB,EACzD,SAAS,EAAE,MAAM,GAChB,IAAI,CAAC;IACR,WAAW,CAAC,UAAU,EAAE,CAAC,CAAC,UAAU,GAAG,OAAO,CAAC;IAC/C,aAAa,CAAC,UAAU,EAAE,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACjE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKpD;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,SAAS,QAAQ,EAAE,GAAG,OAAO,CAI3E;AAED,iFAAiF;AACjF,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,CAAC,CAAC,UAAU,GACvB,MAAM,GAAG,IAAI,CAwBf;AAED,4EAA4E;AAC5E,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,CAAC,CAAC,UAAU,GACvB,OAAO,CAMT;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,SAAS,EACrB,aAAa,EAAE,CAAC,CAAC,UAAU,EAC3B,IAAI,EAAE,aAAa,GAClB,CAAC,CAAC,UAAU,CAuOd;AAED,kFAAkF;AAClF,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,CAAC,CAAC,UAAU,EACxB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,CAAC,UAAU,GACpB,IAAI,CAwBN;AAED,0EAA0E;AAC1E,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,SAAS,QAAQ,EAAE,EAC7B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,oBAAoB,GAC7B,IAAI,CAyDN"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonicalize supported component declaration spellings.
|
|
3
|
+
*
|
|
4
|
+
* The rest of the compiler intentionally operates on one component shape:
|
|
5
|
+
* top-level function declarations. Normalizing uppercase const arrows and
|
|
6
|
+
* function expressions before analysis keeps component/linker/emitter logic
|
|
7
|
+
* unified instead of adding expression-path branches to every pass.
|
|
8
|
+
*/
|
|
9
|
+
import type { NodePath } from '@babel/traverse';
|
|
10
|
+
import * as t from '@babel/types';
|
|
11
|
+
/**
|
|
12
|
+
* Rewrite top-level uppercase const function values containing JSX into the
|
|
13
|
+
* canonical declaration shape consumed by all later passes.
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeComponentDeclarations(programPath: NodePath<t.Program>): void;
|
|
16
|
+
//# sourceMappingURL=declarations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarations.d.ts","sourceRoot":"","sources":["../../src/components/declarations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAuGlC;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAC/B,IAAI,CAuCN"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Ctx } from '../context';
|
|
2
|
+
/**
|
|
3
|
+
* Expand top-level component `const view = <JSX />` aliases at each render
|
|
4
|
+
* use. Aliases may chain and may hold JSX-bearing conditional expressions.
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizeComponentJsxValues(ctx: Ctx): void;
|
|
7
|
+
//# sourceMappingURL=jsx-values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-values.d.ts","sourceRoot":"","sources":["../../src/components/jsx-values.ts"],"names":[],"mappings":"AAQA,OAAO,EAAc,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AA+PlD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAoJ1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-derived.d.ts","sourceRoot":"","sources":["../../src/components/local-derived.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAQlC,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EAAE,GAChB,CAAC,CAAC,UAAU,CA4Bd"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* components/manifest.ts - component facts serialized by the module linker.
|
|
3
|
+
*
|
|
4
|
+
* This module owns AST-level component discovery and converts analyzed local
|
|
5
|
+
* composition/list sites into canonical graph edges. Graph traversal itself
|
|
6
|
+
* remains in component-linker.ts.
|
|
7
|
+
*/
|
|
8
|
+
import type { NodePath } from '@babel/traverse';
|
|
9
|
+
import * as t from '@babel/types';
|
|
10
|
+
import { type Ctx } from '../context';
|
|
11
|
+
import { type ComponentGraphNode } from '../component-linker';
|
|
12
|
+
export interface ComponentExportInfo {
|
|
13
|
+
key: string;
|
|
14
|
+
props: string[];
|
|
15
|
+
objectProps: boolean;
|
|
16
|
+
acceptsUnknownProps: boolean;
|
|
17
|
+
hasWholeDefault: boolean;
|
|
18
|
+
listLightweight: boolean;
|
|
19
|
+
delegatedEvents: boolean;
|
|
20
|
+
renderProps: string[];
|
|
21
|
+
renderCallbacks: string[];
|
|
22
|
+
refProps: string[];
|
|
23
|
+
subtreeReads: string[];
|
|
24
|
+
}
|
|
25
|
+
/** Discover enough component shape to bootstrap the first import-link pass. */
|
|
26
|
+
export declare function discoverComponentExports(programPath: NodePath<t.Program>, moduleId: string): Map<string, ComponentExportInfo>;
|
|
27
|
+
/** Export metadata after full binding-aware module analysis. */
|
|
28
|
+
export declare function analyzedComponentExport(ctx: Ctx, moduleId: string, local: string): ComponentExportInfo;
|
|
29
|
+
/** Convert analyzed local calls and list sites into graph placement edges. */
|
|
30
|
+
export declare function analyzedComponentDeclarations(moduleId: string, ctx: Ctx): ComponentGraphNode[];
|
|
31
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/components/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EAGL,KAAK,GAAG,EACT,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,qBAAqB,CAAC;AAS7B,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,+EAA+E;AAC/E,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,EAChC,QAAQ,EAAE,MAAM,GACf,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CA8BlC;AAED,gEAAgE;AAChE,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,mBAAmB,CAiBrB;AAMD,8EAA8E;AAC9E,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,GAAG,GACP,kBAAkB,EAAE,CA0EtB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps defining-module prop mutations to caller-resolved state boundaries.
|
|
3
|
+
*/
|
|
4
|
+
import type { Ctx, RowCtx } from '../context';
|
|
5
|
+
import { type ScopeWrites } from '../handler-commits';
|
|
6
|
+
import type { ReactiveOrigin } from '../mutation-analysis';
|
|
7
|
+
/**
|
|
8
|
+
* Applies one prop effect and returns whether the origin is a named prop.
|
|
9
|
+
*/
|
|
10
|
+
export declare function applyLinkedPropEffect(ctx: Ctx, component: string, rowCtx: RowCtx | undefined, origin: ReactiveOrigin, scope: ScopeWrites): boolean;
|
|
11
|
+
//# sourceMappingURL=prop-effects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop-effects.d.ts","sourceRoot":"","sources":["../../src/components/prop-effects.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAmC3D;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,WAAW,GACjB,OAAO,CAqBT"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Propagates canonical prop origins through the acyclic component graph.
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentGraphNode } from '../component-linker';
|
|
5
|
+
import type { LinkedComponentPropSource } from '../context';
|
|
6
|
+
/** Caller-resolved source boundaries for every named component prop. */
|
|
7
|
+
export declare function linkComponentPropSources(nodes: Map<string, ComponentGraphNode>, roots: string[]): Map<string, Map<string, LinkedComponentPropSource>>;
|
|
8
|
+
//# sourceMappingURL=prop-linker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop-linker.d.ts","sourceRoot":"","sources":["../../src/components/prop-linker.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACV,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAsDpB,wEAAwE;AACxE,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACtC,KAAK,EAAE,MAAM,EAAE,GACd,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC,CAyCrD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Ctx } from '../context';
|
|
2
|
+
export type ComponentPropSourceRef = {
|
|
3
|
+
type: 'state';
|
|
4
|
+
key: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'prop';
|
|
7
|
+
name: string;
|
|
8
|
+
path: string[];
|
|
9
|
+
} | {
|
|
10
|
+
type: 'root';
|
|
11
|
+
} | {
|
|
12
|
+
type: 'local';
|
|
13
|
+
};
|
|
14
|
+
export type ComponentPropSourceRefs = Record<string, ComponentPropSourceRef[]>;
|
|
15
|
+
/** Prop-source references grouped by component tag used inside one owner. */
|
|
16
|
+
export declare function collectComponentPropSources(ctx: Ctx, owner: string): Map<string, ComponentPropSourceRefs>;
|
|
17
|
+
//# sourceMappingURL=prop-origins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop-origins.d.ts","sourceRoot":"","sources":["../../src/components/prop-origins.ts"],"names":[],"mappings":"AAKA,OAAO,EAML,KAAK,GAAG,EACT,MAAM,YAAY,CAAC;AAOpB,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtB,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAC1C,MAAM,EACN,sBAAsB,EAAE,CACzB,CAAC;AA6JF,6EAA6E;AAC7E,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,MAAM,GACZ,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CA4CtC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Ctx } from '../context';
|
|
2
|
+
import { type ReactiveOrigin } from '../mutation-analysis';
|
|
3
|
+
/** Body-projected bindings whose values still represent component props. */
|
|
4
|
+
export declare function componentPropProjectionOrigins(ctx: Ctx, component: string): Map<string, ReactiveOrigin>;
|
|
5
|
+
//# sourceMappingURL=prop-projections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prop-projections.d.ts","sourceRoot":"","sources":["../../src/components/prop-projections.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,GAAG,EACT,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AA8I9B,4EAA4E;AAC5E,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,MAAM,GAChB,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAY7B"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* components/props.ts - component prop patterns and reactive replay builders.
|
|
3
|
+
*
|
|
4
|
+
* JSX always supplies named properties. This module normalizes supported
|
|
5
|
+
* function parameters into either positional slots or one object envelope,
|
|
6
|
+
* then emits assignments that replay defaults and destructuring after a prop
|
|
7
|
+
* box update. It contains no runtime or component-placement policy.
|
|
8
|
+
*/
|
|
9
|
+
import * as t from '@babel/types';
|
|
10
|
+
export type ComponentParam = Exclude<t.FunctionDeclaration['params'][number], t.TSParameterProperty>;
|
|
11
|
+
export interface ComponentPropsPlan {
|
|
12
|
+
mode: 'positional' | 'object';
|
|
13
|
+
/** JSX attribute names accepted by a closed declaration. */
|
|
14
|
+
names: string[];
|
|
15
|
+
/** Generic object bindings and object rest accept undeclared attributes. */
|
|
16
|
+
acceptsUnknown: boolean;
|
|
17
|
+
/** Source bindings introduced by the original parameter patterns. */
|
|
18
|
+
bindings: string[];
|
|
19
|
+
/** Original parameters retained by lightweight factories. */
|
|
20
|
+
params: ComponentParam[];
|
|
21
|
+
/** The sole object envelope has a whole-parameter default. */
|
|
22
|
+
hasWholeDefault: boolean;
|
|
23
|
+
/** Props consumed as compiler-owned mount slots rather than scalar values. */
|
|
24
|
+
renderProps: string[];
|
|
25
|
+
/** Props invoked by structural list sites as caller-owned row factories. */
|
|
26
|
+
renderCallbacks: string[];
|
|
27
|
+
/** Props consumed as DOM ref adapters and forwarded without reading a sink. */
|
|
28
|
+
refProps: string[];
|
|
29
|
+
}
|
|
30
|
+
export interface LocalDerivation {
|
|
31
|
+
/** Declaration converted from const to let by component emission. */
|
|
32
|
+
declaration: t.VariableDeclaration;
|
|
33
|
+
/** Binding or destructuring pattern refreshed during update. */
|
|
34
|
+
target: t.Identifier | t.ObjectPattern | t.ArrayPattern;
|
|
35
|
+
/** Reactive expression evaluated again in source order. */
|
|
36
|
+
source: t.Expression;
|
|
37
|
+
/** Every binding introduced by target. */
|
|
38
|
+
bindings: string[];
|
|
39
|
+
/** Transitive non-derived roots that can change this value. */
|
|
40
|
+
sources: string[];
|
|
41
|
+
}
|
|
42
|
+
export interface ControlFlowDerivation {
|
|
43
|
+
/** Pure authored control flow retained for initial factory evaluation. */
|
|
44
|
+
statement: t.IfStatement | t.SwitchStatement;
|
|
45
|
+
/** Mutable locals assigned by the control-flow calculation. */
|
|
46
|
+
bindings: string[];
|
|
47
|
+
/** Initializers restored before replay when the control flow is partial. */
|
|
48
|
+
resets: Array<{
|
|
49
|
+
binding: string;
|
|
50
|
+
source: t.Expression;
|
|
51
|
+
}>;
|
|
52
|
+
/** Transitive non-derived roots that can change the calculation. */
|
|
53
|
+
sources: string[];
|
|
54
|
+
}
|
|
55
|
+
/** Normalize a component's source parameters into its JSX call contract. */
|
|
56
|
+
export declare function analyzeComponentProps(params: t.FunctionDeclaration['params']): ComponentPropsPlan;
|
|
57
|
+
/** Initial locals for an entity factory whose inputs live in a props box. */
|
|
58
|
+
export declare function buildPropDeclaration(plan: ComponentPropsPlan, sources: t.Expression[]): t.VariableDeclaration | null;
|
|
59
|
+
/** Replay original parameter semantics from new slot values. */
|
|
60
|
+
export declare function buildPropReplay(plan: ComponentPropsPlan, sources: t.Expression[]): t.Statement[];
|
|
61
|
+
/** Assignment used by ordered body derivations such as `{ value } = props`. */
|
|
62
|
+
export declare function buildDerivationReplay(derivation: LocalDerivation): t.Statement;
|
|
63
|
+
/** All lexical bindings introduced by an identifier or destructuring pattern. */
|
|
64
|
+
export declare function bindingNames(node: t.LVal): string[];
|
|
65
|
+
/** Generic object parameter binding, or null for an object pattern. */
|
|
66
|
+
export declare function objectBindingName(plan: ComponentPropsPlan): string | null;
|
|
67
|
+
/** Local identifier bound from one top-level object property. */
|
|
68
|
+
export declare function localBindingForProp(plan: ComponentPropsPlan, name: string): string | null;
|
|
69
|
+
/** Declared prop name that introduced one local binding. */
|
|
70
|
+
export declare function propNameForBinding(plan: ComponentPropsPlan, binding: string): string | null;
|
|
71
|
+
/** Clone an authored parameter for emitted JavaScript factory syntax. */
|
|
72
|
+
export declare function runtimeParameter(param: ComponentParam): ComponentParam;
|
|
73
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/components/props.ts"],"names":[],"mappings":"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"}
|