@memoized-dom/compiler 0.0.4 → 0.0.5

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 (60) hide show
  1. package/README.md +51 -1
  2. package/dist/analysis/access-table.d.ts.map +1 -1
  3. package/dist/analysis/component-graph.d.ts.map +1 -1
  4. package/dist/analysis/instance.d.ts.map +1 -1
  5. package/dist/analysis/opaque-volatility.d.ts +7 -0
  6. package/dist/analysis/opaque-volatility.d.ts.map +1 -0
  7. package/dist/analysis.d.ts.map +1 -1
  8. package/dist/compile.d.ts +22 -0
  9. package/dist/compile.d.ts.map +1 -1
  10. package/dist/component-linker.d.ts +5 -1
  11. package/dist/component-linker.d.ts.map +1 -1
  12. package/dist/components/children.d.ts +2 -1
  13. package/dist/components/children.d.ts.map +1 -1
  14. package/dist/components/local-derived.d.ts.map +1 -1
  15. package/dist/components/render-callbacks.d.ts +2 -2
  16. package/dist/components/render-callbacks.d.ts.map +1 -1
  17. package/dist/context/ast.d.ts +8 -4
  18. package/dist/context/ast.d.ts.map +1 -1
  19. package/dist/context/model.d.ts +35 -6
  20. package/dist/context/model.d.ts.map +1 -1
  21. package/dist/diagnostics.d.ts +18 -0
  22. package/dist/diagnostics.d.ts.map +1 -0
  23. package/dist/effects.d.ts.map +1 -1
  24. package/dist/emission/component.d.ts.map +1 -1
  25. package/dist/emission/conditional-region.d.ts.map +1 -1
  26. package/dist/emission/list-region.d.ts +2 -1
  27. package/dist/emission/list-region.d.ts.map +1 -1
  28. package/dist/emission/route-region.d.ts +9 -0
  29. package/dist/emission/route-region.d.ts.map +1 -0
  30. package/dist/emission/scope.d.ts +1 -1
  31. package/dist/emission/scope.d.ts.map +1 -1
  32. package/dist/emit.d.ts.map +1 -1
  33. package/dist/handler-commits.d.ts.map +1 -1
  34. package/dist/handlers/analyze.d.ts.map +1 -1
  35. package/dist/identifiers.d.ts +2 -0
  36. package/dist/identifiers.d.ts.map +1 -1
  37. package/dist/index.d.ts +3 -2
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +1 -1
  40. package/dist/jsx/children.d.ts +2 -1
  41. package/dist/jsx/children.d.ts.map +1 -1
  42. package/dist/jsx/conditional-directives.d.ts +12 -0
  43. package/dist/jsx/conditional-directives.d.ts.map +1 -0
  44. package/dist/jsx/events.d.ts +0 -1
  45. package/dist/jsx/events.d.ts.map +1 -1
  46. package/dist/jsx-types.d.ts +39 -0
  47. package/dist/jsx-types.d.ts.map +1 -0
  48. package/dist/linker.d.ts +50 -5
  49. package/dist/linker.d.ts.map +1 -1
  50. package/dist/lists/calculated-sources.d.ts.map +1 -1
  51. package/dist/lists/map-site.d.ts +6 -4
  52. package/dist/lists/map-site.d.ts.map +1 -1
  53. package/dist/lists/source-shapes.d.ts.map +1 -1
  54. package/dist/lists.d.ts +1 -0
  55. package/dist/lists.d.ts.map +1 -1
  56. package/dist/plugin.d.ts +6 -9
  57. package/dist/plugin.d.ts.map +1 -1
  58. package/dist/router.d.ts +28 -0
  59. package/dist/router.d.ts.map +1 -0
  60. package/package.json +8 -2
@@ -7,13 +7,14 @@
7
7
  */
8
8
  import * as t from '@babel/types';
9
9
  import { type JsxChild } from '../components/children';
10
+ import { type MapCallExpression } from '../lists';
10
11
  export type JsxNode = t.JSXElement | t.JSXFragment;
11
12
  export type DirectChildOperation = {
12
13
  type: 'node';
13
14
  variable: string;
14
15
  } | {
15
16
  type: 'list';
16
- expression: t.CallExpression;
17
+ expression: MapCallExpression;
17
18
  } | {
18
19
  type: 'condition';
19
20
  expression: t.ConditionalExpression | t.LogicalExpression;
@@ -1 +1 @@
1
- {"version":3,"file":"children.d.ts","sourceRoot":"","sources":["../../src/jsx/children.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,OAAO,EAEL,KAAK,QAAQ,EACd,MAAM,wBAAwB,CAAC;AAGhC,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,UA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AAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,iBAAiB,CAAA;CAAE,GAC/C;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,CAAC,CAAC,qBAAqB,GAAG,CAAC,CAAC,iBAAiB,CAAC;CAC3D,GACD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,CAAC,CAAC,UAAU,CAAA;CAAE,CAAC;AAE/C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,UAAU,GAAG,MAAM,CAAC;IAC3C,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IAChC,WAAW,CAAC,UAAU,EAAE,CAAC,CAAC,UAAU,GAAG,OAAO,CAAC;IAC/C,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;CAC9B;AAED,wEAAwE;AACxE,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,SAAS,QAAQ,EAAE,EAC7B,QAAQ,EAAE,mBAAmB,GAC5B,oBAAoB,EAAE,CAqDxB"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Normalize compiler-owned `if`, `else-if`, and `else` JSX directives.
3
+ *
4
+ * Sibling chains become the ordinary JSX-bearing conditional expressions that
5
+ * the structural-region pipeline already understands. Formatting whitespace
6
+ * and JSX comments do not interrupt a chain.
7
+ */
8
+ import type { NodePath } from '@babel/traverse';
9
+ import * as t from '@babel/types';
10
+ /** Lower conditional JSX directives before route and reactivity analysis. */
11
+ export declare function normalizeConditionalJsxDirectives(programPath: NodePath<t.Program>): void;
12
+ //# sourceMappingURL=conditional-directives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditional-directives.d.ts","sourceRoot":"","sources":["../../src/jsx/conditional-directives.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AA2KlC,6EAA6E;AAC7E,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAC/B,IAAI,CA8CN"}
@@ -1,5 +1,4 @@
1
1
  /** Shared host-event shape facts used by analysis, linking, and emission. */
2
2
  import * as t from '@babel/types';
3
3
  export declare function hostJsxEventNames(body: t.Node): string[];
4
- export declare function hasHostJsxEvent(body: t.Node): boolean;
5
4
  //# sourceMappingURL=events.d.ts.map
@@ -1 +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,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,MAAM,EAAE,CAiBxD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,OAAO,CAErD"}
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,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,MAAM,EAAE,CAiBxD"}
@@ -0,0 +1,39 @@
1
+ export {};
2
+ declare global {
3
+ /**
4
+ * Register synchronous teardown owned by the current compiled component.
5
+ * The compiler supplies the component identity in generated output.
6
+ */
7
+ function cleanup(disposer: () => void): () => void;
8
+ /**
9
+ * Run a compiler-tracked side effect after DOM updates. At component scope,
10
+ * teardown follows the owner; at module scope the effect is a singleton.
11
+ */
12
+ function effect(callback: () => void | (() => void)): void;
13
+ /** Minimal global JSX declarations for compiler-authored source. */
14
+ namespace JSX {
15
+ type RouteValue = `/${string}`;
16
+ interface RouteToDestination {
17
+ path: RouteValue;
18
+ params?: Record<string, string | number | boolean | bigint>;
19
+ query?: Record<string, string | number | boolean | bigint | null | undefined | readonly (string | number | boolean | bigint | null | undefined)[]>;
20
+ hash?: string;
21
+ replace?: boolean;
22
+ }
23
+ interface ElementChildrenAttribute {
24
+ children: unknown;
25
+ }
26
+ interface IntrinsicAttributes {
27
+ key?: unknown;
28
+ if?: boolean;
29
+ 'else-if'?: boolean;
30
+ else?: true;
31
+ route?: RouteValue;
32
+ 'route-to'?: RouteValue | RouteToDestination;
33
+ }
34
+ interface IntrinsicElements {
35
+ [name: string]: any;
36
+ }
37
+ }
38
+ }
39
+ //# sourceMappingURL=jsx-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-types.d.ts","sourceRoot":"","sources":["../src/jsx-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,OAAO,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAEnD;;;OAGG;IACH,SAAS,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;IAE3D,oEAAoE;IACpE,UAAU,GAAG,CAAC;QACZ,KAAK,UAAU,GAAG,IAAI,MAAM,EAAE,CAAC;QAE/B,UAAU,kBAAkB;YAC1B,IAAI,EAAE,UAAU,CAAC;YACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;YAC5D,KAAK,CAAC,EAAE,MAAM,CACZ,MAAM,EACJ,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,GACN,IAAI,GACJ,SAAS,GACT,SAAS,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,CACrE,CAAC;YACF,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,OAAO,CAAC,EAAE,OAAO,CAAC;SACnB;QAED,UAAU,wBAAwB;YAChC,QAAQ,EAAE,OAAO,CAAC;SACnB;QAED,UAAU,mBAAmB;YAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;YACd,EAAE,CAAC,EAAE,OAAO,CAAC;YACb,SAAS,CAAC,EAAE,OAAO,CAAC;YACpB,IAAI,CAAC,EAAE,IAAI,CAAC;YACZ,KAAK,CAAC,EAAE,UAAU,CAAC;YACnB,UAAU,CAAC,EAAE,UAAU,GAAG,kBAAkB,CAAC;SAC9C;QAED,UAAU,iBAAiB;YACzB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;SACrB;KACF;CACF"}
package/dist/linker.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { type MemoDomOptions } from './context';
1
+ import { type CompilerSourceMap } from './compile';
2
+ import { type MemoDomOptions, type ParameterWrite, type StateKind } from './context';
2
3
  export interface CompileModulesOptions extends Omit<MemoDomOptions, 'moduleId' | 'linkedImports' | 'linkedComponentPaths' | 'linkedComponentRows' | 'linkedComponentPropSources' | 'linkedComponentRenderProps'> {
3
4
  /**
4
5
  * Bundler-style import aliases. Prefixes match on a segment boundary, so
@@ -10,10 +11,54 @@ export interface CompileModulesOptions extends Omit<MemoDomOptions, 'moduleId' |
10
11
  * undefined to continue with aliases and normal relative resolution.
11
12
  */
12
13
  resolveImport?: (specifier: string, importer: string) => string | undefined;
14
+ /**
15
+ * Preserve imported state/component identity but replace imported function
16
+ * summaries with an unbounded effect. This is an evaluation ablation for
17
+ * measuring the contribution of cross-module effect-summary propagation.
18
+ * Defaults to true.
19
+ */
20
+ linkFunctionSummaries?: boolean;
21
+ }
22
+ export interface CompiledComponentExport {
23
+ exported: string;
24
+ local: string;
25
+ listLightweight: boolean;
26
+ }
27
+ export interface CompiledStateExport {
28
+ exported: string;
29
+ kind: StateKind;
30
+ key: string;
31
+ }
32
+ export interface CompiledFunctionExport {
33
+ exported: string;
34
+ reads: string[];
35
+ writes: string[];
36
+ boundedWrites: string[];
37
+ parameterWrites: ParameterWrite[];
38
+ unbounded: boolean;
39
+ }
40
+ export interface CompiledModuleMetadata {
41
+ componentExports: CompiledComponentExport[];
42
+ /** Canonical state identities exposed for evaluation and tooling. */
43
+ stateExports: CompiledStateExport[];
44
+ /** Fixed-point function summaries exposed for evaluation and tooling. */
45
+ functionExports: CompiledFunctionExport[];
46
+ /** Canonical read key -> statically selected runtime entity patterns. */
47
+ readers: Record<string, string[]>;
48
+ }
49
+ export interface CompiledApplicationRoot {
50
+ key: string;
51
+ moduleId: string;
52
+ mountModuleId: string;
53
+ local: string;
54
+ rootId: string;
55
+ }
56
+ export interface CompiledModules {
57
+ output: Record<string, string>;
58
+ maps: Record<string, CompilerSourceMap>;
59
+ metadata: Record<string, CompiledModuleMetadata>;
60
+ applicationRoot?: CompiledApplicationRoot;
13
61
  }
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
- */
62
+ export declare function compileModulesDetailed(modules: Readonly<Record<string, string>>, options?: CompileModulesOptions): CompiledModules;
18
63
  export declare function compileModules(modules: Readonly<Record<string, string>>, options?: CompileModulesOptions): Record<string, string>;
19
64
  //# sourceMappingURL=linker.d.ts.map
@@ -1 +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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","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"}
1
+ {"version":3,"file":"calculated-sources.d.ts","sourceRoot":"","sources":["../../src/lists/calculated-sources.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,GAAG,EAAqB,MAAM,YAAY,CAAC;AA4CzD;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAoE7D"}
@@ -5,13 +5,15 @@
5
5
  import type { NodePath } from '@babel/traverse';
6
6
  import * as t from '@babel/types';
7
7
  import { type RuntimeBindingPattern } from '../analysis/runtime-pattern';
8
- import { type Ctx } from '../context';
8
+ import { type Ctx, type MapCallExpression } from '../context';
9
9
  type ParentRow = Pick<MapSite, 'itemParam' | 'sourceKey' | 'sourceLocal'>;
10
10
  export interface MapSite {
11
11
  /** Reactive source key (e.g. 'items' or 'store.todos'). */
12
12
  sourceKey: string;
13
13
  /** Ordered source expression, cloned into the reconcile calls. */
14
14
  sourceExpr: t.Expression;
15
+ /** Optional-chain maps render no rows while their source is nullish. */
16
+ optional: boolean;
15
17
  /** Instance roots invalidate their owner directly, not an access table. */
16
18
  sourceLocal: boolean;
17
19
  /** Runtime callback target, including supported destructuring patterns. */
@@ -37,14 +39,14 @@ export interface MapSite {
37
39
  /** Unique site key '<owner>/<suffix>'. */
38
40
  prefix: string;
39
41
  }
40
- /** Is this expression a `.map(...)` call? */
41
- export declare function matchMapCall(expr: t.Node): t.CallExpression | null;
42
+ /** Is this expression a `.map(...)` call, including optional chains? */
43
+ export declare function matchMapCall(expr: t.Node): MapCallExpression | null;
42
44
  /** Does a subtree contain JSX? */
43
45
  export declare function containsJsx(path: NodePath): boolean;
44
46
  /**
45
47
  * Validate and describe a map site. Analysis and emission walk sites in the
46
48
  * same source order so their deterministic suffixes remain identical.
47
49
  */
48
- export declare function analyzeMapSite(ctx: Ctx, call: t.CallExpression, errorAt: Pick<NodePath, 'buildCodeFrameError'>, ownerName: string, usedPrefixes: Map<string, number>, parentRow?: ParentRow): MapSite;
50
+ export declare function analyzeMapSite(ctx: Ctx, call: MapCallExpression, errorAt: Pick<NodePath, 'buildCodeFrameError'>, ownerName: string, usedPrefixes: Map<string, number>, parentRow?: ParentRow): MapSite;
49
51
  export {};
50
52
  //# sourceMappingURL=map-site.d.ts.map
@@ -1 +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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E,SAAS,GACpB,OAAO,CAmCT"}
@@ -1 +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"}
1
+ {"version":3,"file":"source-shapes.d.ts","sourceRoot":"","sources":["../../src/lists/source-shapes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAGlC,6EAA6E;AAC7E,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,CAAC,CAAC,UAAU,GACvB,CAAC,CAAC,UAAU,CAEd;AAED,gFAAgF;AAChF,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,CAAC,CAAC,UAAU,GACvB,OAAO,CAeT"}
package/dist/lists.d.ts CHANGED
@@ -4,4 +4,5 @@
4
4
  */
5
5
  export { analyzeMapSite, containsJsx, matchMapCall, } from './lists/map-site';
6
6
  export type { MapSite } from './lists/map-site';
7
+ export type { MapCallExpression } from './context';
7
8
  //# sourceMappingURL=lists.d.ts.map
@@ -1 +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"}
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;AAChD,YAAY,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC"}
package/dist/plugin.d.ts CHANGED
@@ -9,18 +9,15 @@
9
9
  * emit.ts - DOM nodes and structural regions
10
10
  * components/ and jsx/ - prop/slot contracts and authored JSX semantics
11
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
12
+ * Source-shape constraints use clear compile errors by design. Top-level
13
+ * function declarations and synchronous uppercase const function expressions
14
+ * are components; JSX return control flow, repeated render slots, and nested
15
+ * row composition are normalized before the core analysis/emission passes.
19
16
  */
20
17
  import type { Visitor } from '@babel/traverse';
21
- import { type MemoDomOptions } from './context';
18
+ import { type InternalMemoDomOptions, type MemoDomOptions } from './context';
22
19
  export type { MemoDomOptions };
23
- export default function memoDomPlugin(_api: unknown, opts?: MemoDomOptions): {
20
+ export default function memoDomPlugin(_api: unknown, opts?: InternalMemoDomOptions): {
24
21
  name: string;
25
22
  visitor: Visitor;
26
23
  };
@@ -1 +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"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAIL,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AAgKnB,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,IAAI,EAAE,OAAO,EACb,IAAI,GAAE,sBAA2B,GAChC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CA2GpC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Compiler-owned JSX routing analysis.
3
+ *
4
+ * `route` and `route-to` are universal compiler properties. They are removed
5
+ * before ordinary JSX prop analysis, leaving no DOM attributes or component
6
+ * props behind.
7
+ */
8
+ import type { NodePath } from '@babel/traverse';
9
+ import * as t from '@babel/types';
10
+ import type { Ctx } from './context';
11
+ export interface CompilerRouteDefinition {
12
+ readonly id: string;
13
+ readonly moduleId: string;
14
+ readonly pattern: string;
15
+ readonly fullPattern: string;
16
+ readonly parentId?: string;
17
+ readonly line?: number;
18
+ readonly column?: number;
19
+ }
20
+ export interface CompilerRouteElement extends CompilerRouteDefinition {
21
+ }
22
+ export declare function validateCompilerRoutePattern(pattern: string): string;
23
+ export declare function collectCompilerRoutes(file: t.File, moduleId: string): CompilerRouteDefinition[];
24
+ export declare function validateCompilerRouteGraph(definitions: readonly CompilerRouteDefinition[]): void;
25
+ /** Analyze, validate, and erase compiler-owned route properties. */
26
+ export declare function analyzeRouterJsx(ctx: Ctx, programPath: NodePath<t.Program>): void;
27
+ export declare function routeManifestStatements(ctx: Ctx): t.Statement[];
28
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAMrC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAqB,SAAQ,uBAAuB;CAAG;AA6CxE,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAmCpE;AAiGD,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,CAAC,CAAC,IAAI,EACZ,QAAQ,EAAE,MAAM,GACf,uBAAuB,EAAE,CAE3B;AAqBD,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,SAAS,uBAAuB,EAAE,GAC9C,IAAI,CAsBN;AAsQD,oEAAoE;AACpE,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAC/B,IAAI,CA+FN;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,SAAS,EAAE,CAqC/D"}
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@memoized-dom/compiler",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Binding-aware TypeScript and JSX compiler for memoized-dom",
5
5
  "type": "module",
6
+ "engines": {
7
+ "node": ">=24.11.0"
8
+ },
6
9
  "sideEffects": false,
7
10
  "files": [
8
11
  "dist"
@@ -12,10 +15,13 @@
12
15
  "types": "./dist/index.d.ts",
13
16
  "import": "./dist/index.js",
14
17
  "default": "./dist/index.js"
18
+ },
19
+ "./jsx": {
20
+ "types": "./dist/jsx-types.d.ts"
15
21
  }
16
22
  },
17
23
  "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"
24
+ "build": "bun run ./scripts/clean.ts && esbuild ./src/index.ts --bundle --outfile=./dist/index.js --platform=node --format=esm --target=node24 --packages=external --minify && tsc -p tsconfig.build.json"
19
25
  },
20
26
  "dependencies": {
21
27
  "@babel/core": "^8.0.1",