@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.
Files changed (135) hide show
  1. package/README.md +28 -0
  2. package/dist/analysis/access-table.d.ts +5 -0
  3. package/dist/analysis/access-table.d.ts.map +1 -0
  4. package/dist/analysis/component-graph.d.ts +10 -0
  5. package/dist/analysis/component-graph.d.ts.map +1 -0
  6. package/dist/analysis/component-reads.d.ts +10 -0
  7. package/dist/analysis/component-reads.d.ts.map +1 -0
  8. package/dist/analysis/computed.d.ts +11 -0
  9. package/dist/analysis/computed.d.ts.map +1 -0
  10. package/dist/analysis/instance-control-flow.d.ts +9 -0
  11. package/dist/analysis/instance-control-flow.d.ts.map +1 -0
  12. package/dist/analysis/instance.d.ts +9 -0
  13. package/dist/analysis/instance.d.ts.map +1 -0
  14. package/dist/analysis/runtime-pattern.d.ts +9 -0
  15. package/dist/analysis/runtime-pattern.d.ts.map +1 -0
  16. package/dist/analysis/slot-paths.d.ts +11 -0
  17. package/dist/analysis/slot-paths.d.ts.map +1 -0
  18. package/dist/analysis/type-candidates.d.ts +14 -0
  19. package/dist/analysis/type-candidates.d.ts.map +1 -0
  20. package/dist/analysis.d.ts +52 -0
  21. package/dist/analysis.d.ts.map +1 -0
  22. package/dist/compile.d.ts +17 -0
  23. package/dist/compile.d.ts.map +1 -0
  24. package/dist/component-linker.d.ts +32 -0
  25. package/dist/component-linker.d.ts.map +1 -0
  26. package/dist/components/callback-props.d.ts +14 -0
  27. package/dist/components/callback-props.d.ts.map +1 -0
  28. package/dist/components/calls.d.ts +17 -0
  29. package/dist/components/calls.d.ts.map +1 -0
  30. package/dist/components/children.d.ts +43 -0
  31. package/dist/components/children.d.ts.map +1 -0
  32. package/dist/components/declarations.d.ts +16 -0
  33. package/dist/components/declarations.d.ts.map +1 -0
  34. package/dist/components/jsx-values.d.ts +7 -0
  35. package/dist/components/jsx-values.d.ts.map +1 -0
  36. package/dist/components/local-derived.d.ts +6 -0
  37. package/dist/components/local-derived.d.ts.map +1 -0
  38. package/dist/components/manifest.d.ts +31 -0
  39. package/dist/components/manifest.d.ts.map +1 -0
  40. package/dist/components/prop-effects.d.ts +11 -0
  41. package/dist/components/prop-effects.d.ts.map +1 -0
  42. package/dist/components/prop-linker.d.ts +8 -0
  43. package/dist/components/prop-linker.d.ts.map +1 -0
  44. package/dist/components/prop-origins.d.ts +17 -0
  45. package/dist/components/prop-origins.d.ts.map +1 -0
  46. package/dist/components/prop-projections.d.ts +5 -0
  47. package/dist/components/prop-projections.d.ts.map +1 -0
  48. package/dist/components/props.d.ts +73 -0
  49. package/dist/components/props.d.ts.map +1 -0
  50. package/dist/components/ref-props.d.ts +11 -0
  51. package/dist/components/ref-props.d.ts.map +1 -0
  52. package/dist/components/render-callbacks.d.ts +19 -0
  53. package/dist/components/render-callbacks.d.ts.map +1 -0
  54. package/dist/components/render-functions.d.ts +4 -0
  55. package/dist/components/render-functions.d.ts.map +1 -0
  56. package/dist/components/render-prelude.d.ts +13 -0
  57. package/dist/components/render-prelude.d.ts.map +1 -0
  58. package/dist/components/return-plan.d.ts +27 -0
  59. package/dist/components/return-plan.d.ts.map +1 -0
  60. package/dist/conds.d.ts +21 -0
  61. package/dist/conds.d.ts.map +1 -0
  62. package/dist/context/ast.d.ts +51 -0
  63. package/dist/context/ast.d.ts.map +1 -0
  64. package/dist/context/model.d.ts +309 -0
  65. package/dist/context/model.d.ts.map +1 -0
  66. package/dist/context.d.ts +9 -0
  67. package/dist/context.d.ts.map +1 -0
  68. package/dist/effects.d.ts +26 -0
  69. package/dist/effects.d.ts.map +1 -0
  70. package/dist/emission/component.d.ts +12 -0
  71. package/dist/emission/component.d.ts.map +1 -0
  72. package/dist/emission/conditional-region.d.ts +13 -0
  73. package/dist/emission/conditional-region.d.ts.map +1 -0
  74. package/dist/emission/dom-template.d.ts +11 -0
  75. package/dist/emission/dom-template.d.ts.map +1 -0
  76. package/dist/emission/list-region.d.ts +10 -0
  77. package/dist/emission/list-region.d.ts.map +1 -0
  78. package/dist/emission/node-emitter.d.ts +8 -0
  79. package/dist/emission/node-emitter.d.ts.map +1 -0
  80. package/dist/emission/render-callback.d.ts +14 -0
  81. package/dist/emission/render-callback.d.ts.map +1 -0
  82. package/dist/emission/scope.d.ts +47 -0
  83. package/dist/emission/scope.d.ts.map +1 -0
  84. package/dist/emit.d.ts +29 -0
  85. package/dist/emit.d.ts.map +1 -0
  86. package/dist/handler-commits.d.ts +30 -0
  87. package/dist/handler-commits.d.ts.map +1 -0
  88. package/dist/handler-origin.d.ts +13 -0
  89. package/dist/handler-origin.d.ts.map +1 -0
  90. package/dist/handlers/analyze.d.ts +4 -0
  91. package/dist/handlers/analyze.d.ts.map +1 -0
  92. package/dist/handlers/local-calls.d.ts +11 -0
  93. package/dist/handlers/local-calls.d.ts.map +1 -0
  94. package/dist/handlers.d.ts +40 -0
  95. package/dist/handlers.d.ts.map +1 -0
  96. package/dist/helper-summaries.d.ts +12 -0
  97. package/dist/helper-summaries.d.ts.map +1 -0
  98. package/dist/identifiers.d.ts +29 -0
  99. package/dist/identifiers.d.ts.map +1 -0
  100. package/dist/index.d.ts +4 -0
  101. package/dist/index.d.ts.map +1 -0
  102. package/dist/index.js +1 -0
  103. package/dist/jsx/attributes.d.ts +24 -0
  104. package/dist/jsx/attributes.d.ts.map +1 -0
  105. package/dist/jsx/children.d.ts +32 -0
  106. package/dist/jsx/children.d.ts.map +1 -0
  107. package/dist/jsx/dom-attributes.d.ts +13 -0
  108. package/dist/jsx/dom-attributes.d.ts.map +1 -0
  109. package/dist/jsx/dynamic-tags.d.ts +20 -0
  110. package/dist/jsx/dynamic-tags.d.ts.map +1 -0
  111. package/dist/jsx/events.d.ts +4 -0
  112. package/dist/jsx/events.d.ts.map +1 -0
  113. package/dist/jsx/refs.d.ts +15 -0
  114. package/dist/jsx/refs.d.ts.map +1 -0
  115. package/dist/jsx/svg.d.ts +11 -0
  116. package/dist/jsx/svg.d.ts.map +1 -0
  117. package/dist/lifecycle.d.ts +31 -0
  118. package/dist/lifecycle.d.ts.map +1 -0
  119. package/dist/linker.d.ts +19 -0
  120. package/dist/linker.d.ts.map +1 -0
  121. package/dist/lists/calculated-sources.d.ts +8 -0
  122. package/dist/lists/calculated-sources.d.ts.map +1 -0
  123. package/dist/lists/map-site.d.ts +50 -0
  124. package/dist/lists/map-site.d.ts.map +1 -0
  125. package/dist/lists/source-shapes.d.ts +6 -0
  126. package/dist/lists/source-shapes.d.ts.map +1 -0
  127. package/dist/lists.d.ts +7 -0
  128. package/dist/lists.d.ts.map +1 -0
  129. package/dist/module-control-flow.d.ts +8 -0
  130. package/dist/module-control-flow.d.ts.map +1 -0
  131. package/dist/mutation-analysis.d.ts +42 -0
  132. package/dist/mutation-analysis.d.ts.map +1 -0
  133. package/dist/plugin.d.ts +27 -0
  134. package/dist/plugin.d.ts.map +1 -0
  135. package/package.json +30 -0
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Finite dynamic JSX tag lowering.
3
+ *
4
+ * Known string/component candidates become ordinary JSX branches selected by
5
+ * the authored binding value. Existing conditional regions then own identity,
6
+ * updates, and teardown without a runtime virtual-node representation.
7
+ */
8
+ import type { NodePath } from '@babel/traverse';
9
+ import * as t from '@babel/types';
10
+ import { type Ctx } from '../context';
11
+ /**
12
+ * Install finite linked component candidates before ordinary import
13
+ * validation and generated-identifier allocation.
14
+ */
15
+ export declare function installLinkedDynamicComponentImports(ctx: Ctx, programPath: NodePath<t.Program>): void;
16
+ /** Discover local component registries/helper returns before tag lowering. */
17
+ export declare function scanLocalDynamicComponentCandidates(ctx: Ctx, programPath: NodePath<t.Program>): void;
18
+ /** Lower dynamic identifier/member JSX names before component validation. */
19
+ export declare function normalizeDynamicTags(ctx: Ctx): void;
20
+ //# sourceMappingURL=dynamic-tags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-tags.d.ts","sourceRoot":"","sources":["../../src/jsx/dynamic-tags.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAKL,KAAK,GAAG,EACT,MAAM,YAAY,CAAC;AA0BpB;;;GAGG;AACH,wBAAgB,oCAAoC,CAClD,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAC/B,IAAI,CAyEN;AA2LD,8EAA8E;AAC9E,wBAAgB,mCAAmC,CACjD,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAC/B,IAAI,CA2CN;AAmND,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAkHnD"}
@@ -0,0 +1,4 @@
1
+ /** Shared host-event shape facts used by analysis, linking, and emission. */
2
+ import * as t from '@babel/types';
3
+ export declare function hasHostJsxEvent(body: t.BlockStatement): boolean;
4
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/jsx/events.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,wBAAgB,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,cAAc,GAAG,OAAO,CAc/D"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * jsx/refs.ts - compile DOM ref values and mount them with structural cleanup.
3
+ *
4
+ * Assignable source expressions are sinks, not reads. They become ordinary
5
+ * callback adapters so forwarding needs no public ref wrapper or special key.
6
+ */
7
+ import type { NodePath } from '@babel/traverse';
8
+ import * as t from '@babel/types';
9
+ import type { Ctx } from '../context';
10
+ import type { EmitScope } from '../emission/scope';
11
+ /** Compile one source ref into callback/array values understood by mountRef. */
12
+ export declare function compileRefValue(ctx: Ctx, componentPath: NodePath<t.FunctionDeclaration>, componentName: string, expression: t.Expression): t.Expression;
13
+ /** Emit one mount operation and attach its disposer to this scope's policy. */
14
+ export declare function emitRefMount(ctx: Ctx, scope: EmitScope, node: t.Expression, ownerId: t.Expression, value: t.Expression): void;
15
+ //# sourceMappingURL=refs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../src/jsx/refs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,gFAAgF;AAChF,wBAAgB,eAAe,CAC7B,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,EAC9C,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,CAAC,CAAC,UAAU,GACvB,CAAC,CAAC,UAAU,CA8Bd;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,CAAC,CAAC,UAAU,EAClB,OAAO,EAAE,CAAC,CAAC,UAAU,EACrB,KAAK,EAAE,CAAC,CAAC,UAAU,GAClB,IAAI,CAyBN"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * jsx/svg.ts - compile-time DOM namespace selection for authored JSX tags.
3
+ *
4
+ * Parent context is authoritative. SVG-only roots are also recognized so an
5
+ * imported icon component can return `<path>` without receiving a runtime
6
+ * namespace argument through the component ABI.
7
+ */
8
+ import * as t from '@babel/types';
9
+ export declare function isSvgElement(tag: string, parentIsSvg: boolean): boolean;
10
+ export declare function createElementExpression(tag: string, svg: boolean): t.CallExpression;
11
+ //# sourceMappingURL=svg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg.d.ts","sourceRoot":"","sources":["../../src/jsx/svg.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAgElC,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAEvE;AAED,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,OAAO,GACX,CAAC,CAAC,cAAc,CAgBlB"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * lifecycle.ts - explicit cleanup lowering and factory callback ownership.
3
+ *
4
+ * Source `cleanup(disposer)` is restricted to direct component-factory
5
+ * execution and lowered with the generated entity id. Callback analysis is
6
+ * deliberately API-agnostic: any function passed from factory setup receives
7
+ * its own normal-exit invalidation when it writes reactive state.
8
+ */
9
+ import type { NodePath } from '@babel/traverse';
10
+ import * as t from '@babel/types';
11
+ import { type Ctx, type RowCtx } from './context';
12
+ /**
13
+ * Lower direct cleanup registrations and instrument callbacks retained by
14
+ * setup calls. Callback liveness is automatic; cancellation remains explicit.
15
+ */
16
+ export declare function transformComponentLifecycle(ctx: Ctx, compPath: NodePath<t.FunctionDeclaration>, compName: string, factoryId: string, rowCtx?: RowCtx): void;
17
+ /**
18
+ * Instrument callbacks retained by module initialization. They have no
19
+ * component owner, so writes route through canonical access-table keys.
20
+ */
21
+ export declare function transformProgramCallbacks(ctx: Ctx, programPath: NodePath<t.Program>): void;
22
+ /**
23
+ * Async module helpers own their normal-completion commit because callers
24
+ * cannot represent writes that occur after the returned promise suspends.
25
+ * Event call sites may additionally commit the summary immediately to expose
26
+ * synchronous pre-await writes.
27
+ */
28
+ export declare function transformSharedAsyncHelpers(ctx: Ctx): void;
29
+ /** Reject cleanup syntax outside a component instead of leaving a runtime trap. */
30
+ export declare function rejectUnownedCleanup(programPath: NodePath<t.Program>): void;
31
+ //# sourceMappingURL=lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAc,KAAK,GAAG,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AA0H9D;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,EACzC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,IAAI,CA4DN;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAC/B,IAAI,CA8BN;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAI1D;AAED,mFAAmF;AACnF,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,IAAI,CAa3E"}
@@ -0,0 +1,19 @@
1
+ import { type MemoDomOptions } from './context';
2
+ export interface CompileModulesOptions extends Omit<MemoDomOptions, 'moduleId' | 'linkedImports' | 'linkedComponentPaths' | 'linkedComponentRows' | 'linkedComponentPropSources' | 'linkedComponentRenderProps'> {
3
+ /**
4
+ * Bundler-style import aliases. Prefixes match on a segment boundary, so
5
+ * `{ '@': './src' }` resolves both `@/state` and `@/features/todos`.
6
+ */
7
+ aliases?: Readonly<Record<string, string>>;
8
+ /**
9
+ * Optional host resolver. Return a module id present in `modules`, or
10
+ * undefined to continue with aliases and normal relative resolution.
11
+ */
12
+ resolveImport?: (specifier: string, importer: string) => string | undefined;
13
+ }
14
+ /**
15
+ * Compile a connected set of TS/TSX modules with canonical cross-file state
16
+ * keys. Record keys are source module ids; returned keys are preserved.
17
+ */
18
+ export declare function compileModules(modules: Readonly<Record<string, string>>, options?: CompileModulesOptions): Record<string, string>;
19
+ //# sourceMappingURL=linker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linker.d.ts","sourceRoot":"","sources":["../src/linker.ts"],"names":[],"mappings":"AA+BA,OAAO,EASL,KAAK,cAAc,EAGpB,MAAM,WAAW,CAAC;AAMnB,MAAM,WAAW,qBACf,SAAQ,IAAI,CACV,cAAc,EACZ,UAAU,GACV,eAAe,GACf,sBAAsB,GACtB,qBAAqB,GACrB,4BAA4B,GAC5B,4BAA4B,CAC/B;IACD;;;OAGG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC7E;AAwsBD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACzC,OAAO,GAAE,qBAA0B,GAClC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAwIxB"}
@@ -0,0 +1,8 @@
1
+ import type { Ctx } from '../context';
2
+ /**
3
+ * Hoist calculated roots of structural `.map()` calls into generated const
4
+ * derivations consumed by the existing R14/R7 pipeline. Method behavior and
5
+ * return values remain ordinary author-owned JavaScript contracts.
6
+ */
7
+ export declare function normalizeCalculatedListSources(ctx: Ctx): void;
8
+ //# sourceMappingURL=calculated-sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculated-sources.d.ts","sourceRoot":"","sources":["../../src/lists/calculated-sources.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AA2CtC;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CA2D7D"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * R7 list-site analysis. Emission remains separate from this source-shape
3
+ * validation and deterministic identity planning.
4
+ */
5
+ import type { NodePath } from '@babel/traverse';
6
+ import * as t from '@babel/types';
7
+ import { type RuntimeBindingPattern } from '../analysis/runtime-pattern';
8
+ import { type Ctx } from '../context';
9
+ type ParentRow = Pick<MapSite, 'itemParam' | 'sourceKey' | 'sourceLocal'>;
10
+ export interface MapSite {
11
+ /** Reactive source key (e.g. 'items' or 'store.todos'). */
12
+ sourceKey: string;
13
+ /** Ordered source expression, cloned into the reconcile calls. */
14
+ sourceExpr: t.Expression;
15
+ /** Instance roots invalidate their owner directly, not an access table. */
16
+ sourceLocal: boolean;
17
+ /** Runtime callback target, including supported destructuring patterns. */
18
+ itemPattern: RuntimeBindingPattern;
19
+ /** Representative item binding used by row mutation analysis. */
20
+ itemParam: string;
21
+ /** Optional callback index param name. */
22
+ indexParam: string | null;
23
+ /** Key expression if key={...} was given, else null. */
24
+ keyExpr: t.Expression | null;
25
+ /** Row JSX element, absent for a delegated render callback. */
26
+ jsx: t.JSXElement | null;
27
+ /** Component/host JSX or a caller-owned delegated row factory. */
28
+ form: 'component' | 'inline' | 'callback';
29
+ /** Component name when form === 'component'. */
30
+ rowComp: string | null;
31
+ /** Callback prop invoked when form === 'callback'. */
32
+ renderCallback: t.Expression | null;
33
+ /** Owning component name. */
34
+ owner: string;
35
+ /** Source key or source key plus a source-order occurrence suffix. */
36
+ suffix: string;
37
+ /** Unique site key '<owner>/<suffix>'. */
38
+ prefix: string;
39
+ }
40
+ /** Is this expression a `.map(...)` call? */
41
+ export declare function matchMapCall(expr: t.Node): t.CallExpression | null;
42
+ /** Does a subtree contain JSX? */
43
+ export declare function containsJsx(path: NodePath): boolean;
44
+ /**
45
+ * Validate and describe a map site. Analysis and emission walk sites in the
46
+ * same source order so their deterministic suffixes remain identical.
47
+ */
48
+ export declare function analyzeMapSite(ctx: Ctx, call: t.CallExpression, errorAt: Pick<NodePath, 'buildCodeFrameError'>, ownerName: string, usedPrefixes: Map<string, number>, parentRow?: ParentRow): MapSite;
49
+ export {};
50
+ //# sourceMappingURL=map-site.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map-site.d.ts","sourceRoot":"","sources":["../../src/lists/map-site.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAIL,KAAK,GAAG,EACT,MAAM,YAAY,CAAC;AAIpB,KAAK,SAAS,GAAG,IAAI,CACnB,OAAO,EACP,WAAW,GAAG,WAAW,GAAG,aAAa,CAC1C,CAAC;AAEF,MAAM,WAAW,OAAO;IACtB,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC;IACzB,2EAA2E;IAC3E,WAAW,EAAE,OAAO,CAAC;IACrB,2EAA2E;IAC3E,WAAW,EAAE,qBAAqB,CAAC;IACnC,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,wDAAwD;IACxD,OAAO,EAAE,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC;IAC7B,+DAA+D;IAC/D,GAAG,EAAE,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC;IACzB,kEAAkE;IAClE,IAAI,EAAE,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;IAC1C,gDAAgD;IAChD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,sDAAsD;IACtD,cAAc,EAAE,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC;IACpC,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;CAChB;AAuBD,6CAA6C;AAC7C,wBAAgB,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,cAAc,GAAG,IAAI,CAQlE;AAED,kCAAkC;AAClC,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAWnD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,CAAC,CAAC,cAAc,EACtB,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,qBAAqB,CAAC,EAC9C,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAgCT"}
@@ -0,0 +1,6 @@
1
+ import * as t from '@babel/types';
2
+ /** Remove transparent TypeScript wrappers around a collection expression. */
3
+ export declare function transparentListExpression(expression: t.Expression): t.Expression;
4
+ /** A literal primitive list has stable value identity and no mutable source. */
5
+ export declare function isStaticPrimitiveList(expression: t.Expression): boolean;
6
+ //# sourceMappingURL=source-shapes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-shapes.d.ts","sourceRoot":"","sources":["../../src/lists/source-shapes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,6EAA6E;AAC7E,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,CAAC,CAAC,UAAU,GACvB,CAAC,CAAC,UAAU,CAUd;AAED,gFAAgF;AAChF,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,CAAC,CAAC,UAAU,GACvB,OAAO,CAeT"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Public list-analysis facade. Implementation details live under lists/ so
3
+ * callers share one stable import path without concentrating analysis here.
4
+ */
5
+ export { analyzeMapSite, containsJsx, matchMapCall, } from './lists/map-site';
6
+ export type { MapSite } from './lists/map-site';
7
+ //# sourceMappingURL=lists.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lists.d.ts","sourceRoot":"","sources":["../src/lists.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,cAAc,EACd,WAAW,EACX,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Pure exhaustive module-level if/switch derivations.
3
+ */
4
+ import type { NodePath } from '@babel/traverse';
5
+ import * as t from '@babel/types';
6
+ import { type ComputedAnalysis, type Ctx } from './context';
7
+ export declare function scanModuleControlFlow(ctx: Ctx, programPath: NodePath<t.Program>, analyze: (ctx: Ctx, expression: t.Node) => ComputedAnalysis): void;
8
+ //# sourceMappingURL=module-control-flow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-control-flow.d.ts","sourceRoot":"","sources":["../src/module-control-flow.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,GAAG,EACT,MAAM,WAAW,CAAC;AA6GnB,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,EAChC,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC,IAAI,KAAK,gBAAgB,GAC1D,IAAI,CA6FN"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * mutation-analysis.ts - shared provenance helpers for conservative writes.
3
+ *
4
+ * Tracks local aliases back to reactive roots using Babel binding identity.
5
+ * Consumers decide whether a resolved origin permits a precise write key or
6
+ * whether reassignment/destructuring requires a root-subtree fallback.
7
+ */
8
+ import type { Binding, Scope } from '@babel/traverse';
9
+ import * as t from '@babel/types';
10
+ import { type StateKind } from './context';
11
+ export type ReactiveLocality = 'module' | 'instance' | 'row' | 'prop';
12
+ export interface ReactiveOrigin {
13
+ locality: ReactiveLocality;
14
+ /** Original binding name, before any aliases. */
15
+ root: string;
16
+ /** Static path rooted at `root`, or null after a dynamic member access. */
17
+ key: string | null;
18
+ stateKind?: StateKind;
19
+ }
20
+ type OriginFallback = (name: string, binding: Binding | undefined) => ReactiveOrigin | null;
21
+ export declare class AliasTracker {
22
+ private readonly fallback;
23
+ private readonly origins;
24
+ constructor(fallback: OriginFallback);
25
+ trackDeclarator(scope: Scope, declarator: t.VariableDeclarator): void;
26
+ /**
27
+ * Find reactive values mentioned inside an expression when its resulting
28
+ * provenance cannot be represented as one exact origin (for example a
29
+ * conditional alias or destructuring source).
30
+ */
31
+ referencedOrigins(scope: Scope, node: t.Node): ReactiveOrigin[];
32
+ resolveName(scope: Scope, name: string): ReactiveOrigin | null;
33
+ resolveExpression(scope: Scope, raw: t.Node): ReactiveOrigin | null;
34
+ }
35
+ export declare function moduleOrigin(name: string, stateKind: StateKind): ReactiveOrigin;
36
+ /** Append a helper-summary path to an argument's resolved reactive origin. */
37
+ export declare function extendOrigin(origin: ReactiveOrigin, relativePath: readonly string[]): ReactiveOrigin;
38
+ export declare function staticAssignedKeys(target: ReactiveOrigin, sources: readonly (t.Expression | t.SpreadElement | t.JSXNamespacedName | t.ArgumentPlaceholder)[]): string[] | null;
39
+ export declare function callArgumentExpressions(args: readonly (t.Expression | t.SpreadElement | t.JSXNamespacedName | t.ArgumentPlaceholder)[]): t.Expression[];
40
+ export declare function memberName(node: t.MemberExpression): string | null;
41
+ export {};
42
+ //# sourceMappingURL=mutation-analysis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation-analysis.d.ts","sourceRoot":"","sources":["../src/mutation-analysis.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC;AAEtE,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,KAAK,cAAc,GAAG,CACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,GAAG,SAAS,KACzB,cAAc,GAAG,IAAI,CAAC;AAE3B,qBAAa,YAAY;IAGX,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAFrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+C;gBAE1C,QAAQ,EAAE,cAAc;IAErD,eAAe,CACb,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,CAAC,CAAC,kBAAkB,GAC/B,IAAI;IAaP;;;;OAIG;IACH,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,cAAc,EAAE;IA8B/D,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAS9D,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,GAAG,cAAc,GAAG,IAAI;CAoBpE;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,SAAS,GACnB,cAAc,CAOhB;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAC1B,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,SAAS,MAAM,EAAE,GAC9B,cAAc,CAMhB;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC,mBAAmB,CAAC,EAAE,GACjG,MAAM,EAAE,GAAG,IAAI,CAoBjB;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC,mBAAmB,CAAC,EAAE,GAC9F,CAAC,CAAC,UAAU,EAAE,CAOhB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,gBAAgB,GAAG,MAAM,GAAG,IAAI,CAIlE"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * plugin.ts — the memo-dom Babel plugin (compiler frontend #1), thin shell.
3
+ *
4
+ * Coordinates the emission-spec passes; implementation is partitioned into:
5
+ * context.ts - shared binding and canonical identity facts
6
+ * analysis.ts - module/component/read analysis and access table
7
+ * handlers.ts - per-scope effects and commit emission
8
+ * emission/component.ts - source components to runtime factories
9
+ * emit.ts - DOM nodes and structural regions
10
+ * components/ and jsx/ - prop/slot contracts and authored JSX semantics
11
+ *
12
+ * L1 limitations (clear compile errors by design):
13
+ * - components must be top-level `function` declarations (no arrows)
14
+ * - direct JSX returns plus R27 structural tail-return control flow
15
+ * - spread attributes preserve overrides through general DOM patching
16
+ * - children slots mount once at a direct host insertion point
17
+ * - conditional JSX uses anchored R8/R27 regions
18
+ * - no nested lists or component calls inside inline rows
19
+ */
20
+ import type { Visitor } from '@babel/traverse';
21
+ import { type MemoDomOptions } from './context';
22
+ export type { MemoDomOptions };
23
+ export default function memoDomPlugin(_api: unknown, opts?: MemoDomOptions): {
24
+ name: string;
25
+ visitor: Visitor;
26
+ };
27
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AA2JnB,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,IAAI,EAAE,OAAO,EACb,IAAI,GAAE,cAAmB,GACxB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAoEpC"}
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@memoized-dom/compiler",
3
+ "version": "0.0.1",
4
+ "description": "Binding-aware TypeScript and JSX compiler for memoized-dom",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ }
16
+ },
17
+ "scripts": {
18
+ "build": "bun run ./scripts/clean.ts && esbuild ./src/index.ts --bundle --outfile=./dist/index.js --platform=node --format=esm --target=node20 --packages=external --minify && tsc -p tsconfig.build.json"
19
+ },
20
+ "dependencies": {
21
+ "@babel/core": "^8.0.1",
22
+ "@babel/plugin-syntax-jsx": "^8.0.1",
23
+ "@babel/plugin-transform-typescript": "^8.0.1",
24
+ "@babel/traverse": "^8.0.4",
25
+ "@babel/types": "^8.0.4"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ }
30
+ }