@memoized-dom/compiler 0.0.4 → 0.0.6
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 +106 -28
- package/dist/analysis/access-table.d.ts +1 -1
- package/dist/analysis/access-table.d.ts.map +1 -1
- package/dist/analysis/component-graph.d.ts +16 -1
- package/dist/analysis/component-graph.d.ts.map +1 -1
- package/dist/analysis/component-reads.d.ts +1 -1
- package/dist/analysis/component-reads.d.ts.map +1 -1
- package/dist/analysis/computed.d.ts +9 -5
- package/dist/analysis/computed.d.ts.map +1 -1
- package/dist/analysis/instance-control-flow.d.ts +1 -1
- package/dist/analysis/instance-control-flow.d.ts.map +1 -1
- package/dist/analysis/instance.d.ts +3 -4
- package/dist/analysis/instance.d.ts.map +1 -1
- package/dist/analysis/module-discovery.d.ts +27 -0
- package/dist/analysis/module-discovery.d.ts.map +1 -0
- package/dist/analysis/opaque-volatility.d.ts +7 -0
- package/dist/analysis/opaque-volatility.d.ts.map +1 -0
- package/dist/analysis/runtime-pattern.d.ts +3 -4
- package/dist/analysis/runtime-pattern.d.ts.map +1 -1
- package/dist/analysis/type-candidates.d.ts +15 -3
- package/dist/analysis/type-candidates.d.ts.map +1 -1
- package/dist/analysis.d.ts +7 -4
- package/dist/analysis.d.ts.map +1 -1
- package/dist/ast/builders.d.ts +108 -0
- package/dist/ast/builders.d.ts.map +1 -0
- package/dist/ast/compiler-types.d.ts +196 -0
- package/dist/ast/compiler-types.d.ts.map +1 -0
- package/dist/ast/factory.d.ts +139 -0
- package/dist/ast/factory.d.ts.map +1 -0
- package/dist/ast/index.d.ts +15 -0
- package/dist/ast/index.d.ts.map +1 -0
- package/dist/ast/mutate.d.ts +17 -0
- package/dist/ast/mutate.d.ts.map +1 -0
- package/dist/ast/normalize.d.ts +9 -0
- package/dist/ast/normalize.d.ts.map +1 -0
- package/dist/ast/parser.d.ts +72 -0
- package/dist/ast/parser.d.ts.map +1 -0
- package/dist/ast/printer.d.ts +23 -0
- package/dist/ast/printer.d.ts.map +1 -0
- package/dist/ast/scope.d.ts +44 -0
- package/dist/ast/scope.d.ts.map +1 -0
- package/dist/ast/strip-typescript.d.ts +9 -0
- package/dist/ast/strip-typescript.d.ts.map +1 -0
- package/dist/ast/transform.d.ts +21 -0
- package/dist/ast/transform.d.ts.map +1 -0
- package/dist/ast/tsrx/frontend.d.ts +8 -0
- package/dist/ast/tsrx/frontend.d.ts.map +1 -0
- package/dist/ast/tsrx/index.d.ts +5 -0
- package/dist/ast/tsrx/index.d.ts.map +1 -0
- package/dist/ast/tsrx/lower.d.ts +8 -0
- package/dist/ast/tsrx/lower.d.ts.map +1 -0
- package/dist/ast/tsrx/style.d.ts +8 -0
- package/dist/ast/tsrx/style.d.ts.map +1 -0
- package/dist/ast/tsrx/types.d.ts +50 -0
- package/dist/ast/tsrx/types.d.ts.map +1 -0
- package/dist/ast/types.d.ts +478 -0
- package/dist/ast/types.d.ts.map +1 -0
- package/dist/ast/walk.d.ts +22 -0
- package/dist/ast/walk.d.ts.map +1 -0
- package/dist/cells.d.ts +10 -0
- package/dist/cells.d.ts.map +1 -0
- package/dist/compile.d.ts +30 -14
- package/dist/compile.d.ts.map +1 -1
- package/dist/component-linker.d.ts +5 -1
- package/dist/component-linker.d.ts.map +1 -1
- package/dist/components/callback-props.d.ts +1 -1
- package/dist/components/callback-props.d.ts.map +1 -1
- package/dist/components/calls.d.ts +1 -1
- package/dist/components/calls.d.ts.map +1 -1
- package/dist/components/children.d.ts +5 -3
- package/dist/components/children.d.ts.map +1 -1
- package/dist/components/declarations.d.ts +10 -3
- package/dist/components/declarations.d.ts.map +1 -1
- package/dist/components/jsx-values.d.ts +2 -4
- package/dist/components/jsx-values.d.ts.map +1 -1
- package/dist/components/local-derived.d.ts +1 -1
- package/dist/components/local-derived.d.ts.map +1 -1
- package/dist/components/manifest.d.ts +2 -3
- package/dist/components/manifest.d.ts.map +1 -1
- package/dist/components/prop-effects.d.ts.map +1 -1
- package/dist/components/prop-linker.d.ts.map +1 -1
- package/dist/components/prop-origins.d.ts +2 -0
- package/dist/components/prop-origins.d.ts.map +1 -1
- package/dist/components/prop-projections.d.ts.map +1 -1
- package/dist/components/prop-shape.d.ts +11 -0
- package/dist/components/prop-shape.d.ts.map +1 -0
- package/dist/components/props.d.ts +9 -1
- package/dist/components/props.d.ts.map +1 -1
- package/dist/components/ref-props.d.ts.map +1 -1
- package/dist/components/render-callbacks.d.ts +9 -5
- package/dist/components/render-callbacks.d.ts.map +1 -1
- package/dist/components/render-functions.d.ts +1 -0
- package/dist/components/render-functions.d.ts.map +1 -1
- package/dist/components/render-prelude.d.ts +1 -1
- package/dist/components/render-prelude.d.ts.map +1 -1
- package/dist/components/return-plan.d.ts +13 -7
- package/dist/components/return-plan.d.ts.map +1 -1
- package/dist/conds.d.ts +6 -3
- package/dist/conds.d.ts.map +1 -1
- package/dist/context/ast.d.ts +18 -5
- package/dist/context/ast.d.ts.map +1 -1
- package/dist/context/model.d.ts +146 -13
- package/dist/context/model.d.ts.map +1 -1
- package/dist/data-sources.d.ts +78 -0
- package/dist/data-sources.d.ts.map +1 -0
- package/dist/diagnostics.d.ts +20 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/effects.d.ts +13 -5
- package/dist/effects.d.ts.map +1 -1
- package/dist/emission/component.d.ts +3 -3
- package/dist/emission/component.d.ts.map +1 -1
- package/dist/emission/conditional-region.d.ts +6 -5
- package/dist/emission/conditional-region.d.ts.map +1 -1
- package/dist/emission/dom-template.d.ts.map +1 -1
- package/dist/emission/list-region.d.ts +6 -4
- package/dist/emission/list-region.d.ts.map +1 -1
- package/dist/emission/node-emitter.d.ts +4 -3
- package/dist/emission/node-emitter.d.ts.map +1 -1
- package/dist/emission/render-callback.d.ts +4 -3
- package/dist/emission/render-callback.d.ts.map +1 -1
- package/dist/emission/route-region.d.ts +10 -0
- package/dist/emission/route-region.d.ts.map +1 -0
- package/dist/emission/scope.d.ts +14 -2
- package/dist/emission/scope.d.ts.map +1 -1
- package/dist/emit.d.ts +5 -4
- package/dist/emit.d.ts.map +1 -1
- package/dist/errors.d.ts +15 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/handler-commits.d.ts +6 -1
- package/dist/handler-commits.d.ts.map +1 -1
- package/dist/handler-origin.d.ts +1 -1
- package/dist/handler-origin.d.ts.map +1 -1
- package/dist/handlers/analyze.d.ts +1 -1
- package/dist/handlers/analyze.d.ts.map +1 -1
- package/dist/handlers/local-calls.d.ts +2 -2
- package/dist/handlers/local-calls.d.ts.map +1 -1
- package/dist/handlers.d.ts +6 -5
- package/dist/handlers.d.ts.map +1 -1
- package/dist/helper-summaries.d.ts +2 -3
- package/dist/helper-summaries.d.ts.map +1 -1
- package/dist/identifiers.d.ts +15 -8
- package/dist/identifiers.d.ts.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/jsx/attributes.d.ts +1 -1
- package/dist/jsx/attributes.d.ts.map +1 -1
- package/dist/jsx/children.d.ts +3 -2
- package/dist/jsx/children.d.ts.map +1 -1
- package/dist/jsx/conditional-directives.d.ts +21 -0
- package/dist/jsx/conditional-directives.d.ts.map +1 -0
- package/dist/jsx/dom-attributes.d.ts +1 -1
- package/dist/jsx/dom-attributes.d.ts.map +1 -1
- package/dist/jsx/dynamic-tags.d.ts +9 -15
- package/dist/jsx/dynamic-tags.d.ts.map +1 -1
- package/dist/jsx/events.d.ts +2 -3
- package/dist/jsx/events.d.ts.map +1 -1
- package/dist/jsx/refs.d.ts +5 -4
- package/dist/jsx/refs.d.ts.map +1 -1
- package/dist/jsx/svg.d.ts +2 -2
- package/dist/jsx/svg.d.ts.map +1 -1
- package/dist/jsx-types.d.ts +42 -0
- package/dist/jsx-types.d.ts.map +1 -0
- package/dist/lifecycle.d.ts +10 -5
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/linker.d.ts +56 -5
- package/dist/linker.d.ts.map +1 -1
- package/dist/lists/calculated-sources.d.ts +1 -1
- package/dist/lists/calculated-sources.d.ts.map +1 -1
- package/dist/lists/map-site.d.ts +16 -8
- package/dist/lists/map-site.d.ts.map +1 -1
- package/dist/lists/source-shapes.d.ts +12 -3
- package/dist/lists/source-shapes.d.ts.map +1 -1
- package/dist/lists/static-derived.d.ts +37 -0
- package/dist/lists/static-derived.d.ts.map +1 -0
- package/dist/lists/targeted-refresh.d.ts +9 -2
- package/dist/lists/targeted-refresh.d.ts.map +1 -1
- package/dist/lists.d.ts +1 -0
- package/dist/lists.d.ts.map +1 -1
- package/dist/module-control-flow.d.ts +7 -6
- package/dist/module-control-flow.d.ts.map +1 -1
- package/dist/mutation-analysis.d.ts +22 -8
- package/dist/mutation-analysis.d.ts.map +1 -1
- package/dist/plugin.d.ts +15 -14
- package/dist/plugin.d.ts.map +1 -1
- package/dist/router.d.ts +32 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/server-functions.d.ts +49 -0
- package/dist/server-functions.d.ts.map +1 -0
- package/package.json +34 -30
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* mutation-analysis.ts - shared provenance helpers for conservative writes.
|
|
3
3
|
*
|
|
4
|
-
* Tracks local aliases back to reactive roots using
|
|
4
|
+
* Tracks local aliases back to reactive roots using lexical binding identity.
|
|
5
5
|
* Consumers decide whether a resolved origin permits a precise write key or
|
|
6
6
|
* whether reassignment/destructuring requires a root-subtree fallback.
|
|
7
7
|
*/
|
|
8
|
-
import type
|
|
9
|
-
import * as t from '@babel/types';
|
|
8
|
+
import type * as t from './ast/compiler-types';
|
|
10
9
|
import { type StateKind } from './context';
|
|
11
10
|
export type ReactiveLocality = 'module' | 'instance' | 'row' | 'prop';
|
|
12
11
|
export interface ReactiveOrigin {
|
|
@@ -17,20 +16,35 @@ export interface ReactiveOrigin {
|
|
|
17
16
|
key: string | null;
|
|
18
17
|
stateKind?: StateKind;
|
|
19
18
|
}
|
|
20
|
-
type OriginFallback = (name: string, binding:
|
|
19
|
+
type OriginFallback = (name: string, binding: BindingLike | undefined) => ReactiveOrigin | null;
|
|
20
|
+
/** Minimal parser-neutral binding contract needed by alias analysis. */
|
|
21
|
+
export interface BindingLike {
|
|
22
|
+
identifier: object;
|
|
23
|
+
scope: ScopeLike;
|
|
24
|
+
}
|
|
25
|
+
/** Parser adapters and compiler ESTree scopes can satisfy this contract. */
|
|
26
|
+
export interface ScopeLike {
|
|
27
|
+
block: object;
|
|
28
|
+
isProgramScope?: boolean;
|
|
29
|
+
path?: {
|
|
30
|
+
isProgram(): boolean;
|
|
31
|
+
};
|
|
32
|
+
getBinding(name: string): BindingLike | undefined;
|
|
33
|
+
}
|
|
34
|
+
export declare function bindingScopeIsProgram(binding: BindingLike): boolean;
|
|
21
35
|
export declare class AliasTracker {
|
|
22
36
|
private readonly fallback;
|
|
23
37
|
private readonly origins;
|
|
24
38
|
constructor(fallback: OriginFallback);
|
|
25
|
-
trackDeclarator(scope:
|
|
39
|
+
trackDeclarator(scope: ScopeLike, declarator: t.VariableDeclarator): void;
|
|
26
40
|
/**
|
|
27
41
|
* Find reactive values mentioned inside an expression when its resulting
|
|
28
42
|
* provenance cannot be represented as one exact origin (for example a
|
|
29
43
|
* conditional alias or destructuring source).
|
|
30
44
|
*/
|
|
31
|
-
referencedOrigins(scope:
|
|
32
|
-
resolveName(scope:
|
|
33
|
-
resolveExpression(scope:
|
|
45
|
+
referencedOrigins(scope: ScopeLike, node: t.Node): ReactiveOrigin[];
|
|
46
|
+
resolveName(scope: ScopeLike, name: string): ReactiveOrigin | null;
|
|
47
|
+
resolveExpression(scope: ScopeLike, raw: t.Node): ReactiveOrigin | null;
|
|
34
48
|
}
|
|
35
49
|
export declare function moduleOrigin(name: string, stateKind: StateKind): ReactiveOrigin;
|
|
36
50
|
/** Append a helper-summary path to an argument's resolved reactive origin. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation-analysis.d.ts","sourceRoot":"","sources":["../src/mutation-analysis.ts"],"names":[],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M program transform.
|
|
3
3
|
*
|
|
4
4
|
* Coordinates the emission-spec passes; implementation is partitioned into:
|
|
5
5
|
* context.ts - shared binding and canonical identity facts
|
|
@@ -9,19 +9,20 @@
|
|
|
9
9
|
* emit.ts - DOM nodes and structural regions
|
|
10
10
|
* components/ and jsx/ - prop/slot contracts and authored JSX semantics
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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
|
-
import type
|
|
21
|
-
import { type MemoDomOptions } from './context';
|
|
17
|
+
import type * as t from './ast/compiler-types';
|
|
18
|
+
import { type InternalMemoDomOptions, type MemoDomOptions } from './context';
|
|
19
|
+
interface ProgramDiagnostic {
|
|
20
|
+
node: t.Program;
|
|
21
|
+
buildCodeFrameError(message: string, at?: t.Node): Error;
|
|
22
|
+
}
|
|
23
|
+
export interface ProgramTransformPath extends ProgramDiagnostic {
|
|
24
|
+
}
|
|
22
25
|
export type { MemoDomOptions };
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
visitor: Visitor;
|
|
26
|
-
};
|
|
26
|
+
/** Transform a plain ESTree program and leave the result in strict ESTree. */
|
|
27
|
+
export declare function transformEstreeProgram(programPath: ProgramTransformPath, opts?: InternalMemoDomOptions): void;
|
|
27
28
|
//# sourceMappingURL=plugin.d.ts.map
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,KAAK,CAAC,MAAM,sBAAsB,CAAC;AAQ/C,OAAO,EAIL,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AA4KnB,UAAU,iBAAiB;IACzB,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC;IAChB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC;CAC1D;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;CAAG;AAoDlE,YAAY,EAAE,cAAc,EAAE,CAAC;AA2H/B,8EAA8E;AAC9E,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,oBAAoB,EACjC,IAAI,GAAE,sBAA2B,GAChC,IAAI,CAGN"}
|
package/dist/router.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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 * as t from './ast/compiler-types';
|
|
9
|
+
import type { Ctx } from './context';
|
|
10
|
+
export interface CompilerRouteDefinition {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly moduleId: string;
|
|
13
|
+
readonly pattern: string;
|
|
14
|
+
readonly fullPattern: string;
|
|
15
|
+
readonly parentId?: string;
|
|
16
|
+
readonly line?: number;
|
|
17
|
+
readonly column?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface CompilerRouteElement extends CompilerRouteDefinition {
|
|
20
|
+
}
|
|
21
|
+
interface ProgramContainer {
|
|
22
|
+
node: t.Program;
|
|
23
|
+
buildCodeFrameError(message: string, at?: t.Node): Error;
|
|
24
|
+
}
|
|
25
|
+
export declare function validateCompilerRoutePattern(pattern: string): string;
|
|
26
|
+
export declare function collectCompilerRoutes(root: t.File | t.Program, moduleId: string): CompilerRouteDefinition[];
|
|
27
|
+
export declare function validateCompilerRouteGraph(definitions: readonly CompilerRouteDefinition[]): void;
|
|
28
|
+
/** Analyze, validate, and erase compiler-owned route properties. */
|
|
29
|
+
export declare function analyzeRouterJsx(ctx: Ctx, programPath: ProgramContainer): void;
|
|
30
|
+
export declare function routeManifestStatements(ctx: Ctx): t.Statement[];
|
|
31
|
+
export {};
|
|
32
|
+
//# 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,KAAK,CAAC,MAAM,sBAAsB,CAAC;AAQ/C,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;AAOxE,UAAU,gBAAgB;IACxB,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC;IAChB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC;CAC1D;AAqED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAmCpE;AAsGD,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,OAAO,EACxB,QAAQ,EAAE,MAAM,GACf,uBAAuB,EAAE,CAG3B;AAqBD,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,SAAS,uBAAuB,EAAE,GAC9C,IAAI,CAsBN;AAsQD,oEAAoE;AACpE,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,gBAAgB,GAC5B,IAAI,CA0GN;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,SAAS,EAAE,CAqC/D"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type EstreeFrontend } from './ast';
|
|
2
|
+
export type ServerFunctionMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
3
|
+
export type ServerFunctionQueryKind = 'string' | 'number' | 'boolean' | 'string[]' | 'number[]' | 'boolean[]';
|
|
4
|
+
export interface ServerFunctionParameter {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly optional: boolean;
|
|
7
|
+
/** Present only for GET query decoding; mutation bodies retain JSON types. */
|
|
8
|
+
readonly queryKind?: ServerFunctionQueryKind;
|
|
9
|
+
}
|
|
10
|
+
export interface ServerFunctionDefinition {
|
|
11
|
+
readonly exported: string;
|
|
12
|
+
readonly local: string;
|
|
13
|
+
readonly method: ServerFunctionMethod;
|
|
14
|
+
readonly path: string;
|
|
15
|
+
readonly parameters: readonly ServerFunctionParameter[];
|
|
16
|
+
}
|
|
17
|
+
export interface ServerFunctionModule {
|
|
18
|
+
readonly moduleId: string;
|
|
19
|
+
readonly moduleName: string;
|
|
20
|
+
readonly middlewareExport: boolean;
|
|
21
|
+
readonly functions: readonly ServerFunctionDefinition[];
|
|
22
|
+
}
|
|
23
|
+
export interface AnalyzeServerFunctionOptions {
|
|
24
|
+
readonly moduleId: string;
|
|
25
|
+
readonly functionsRoot?: string;
|
|
26
|
+
readonly frontend?: EstreeFrontend;
|
|
27
|
+
}
|
|
28
|
+
export declare function serverFunctionModuleName(moduleId: string, functionsRoot?: string): string;
|
|
29
|
+
export declare function analyzeServerFunctionModule(source: string, options: AnalyzeServerFunctionOptions): ServerFunctionModule;
|
|
30
|
+
export declare function generateServerFunctionClient(module: ServerFunctionModule, dataModule?: string): string;
|
|
31
|
+
export interface ServerFunctionDeclarationOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Resolves each analyzed module id to the specifier the generated file uses
|
|
34
|
+
* to type-import its real implementation. Type-only, so it erases at runtime
|
|
35
|
+
* and never pulls the server dependency graph into a client build.
|
|
36
|
+
*/
|
|
37
|
+
readonly resolveImplementation: (moduleId: string) => string;
|
|
38
|
+
readonly dataModule?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Emit the client-facing declaration barrel for the application's server
|
|
42
|
+
* functions. Signatures reference the real implementations through
|
|
43
|
+
* `Parameters`/`ReturnType`, so server builds keep their ordinary async
|
|
44
|
+
* TypeScript types while client imports see the colorless `ResolvedValue<T>`
|
|
45
|
+
* contract (readable as `T`, `$track`-able). Exported names must be unique
|
|
46
|
+
* across modules because the barrel is one flat module.
|
|
47
|
+
*/
|
|
48
|
+
export declare function generateServerFunctionDeclarations(modules: readonly ServerFunctionModule[], options: ServerFunctionDeclarationOptions): string;
|
|
49
|
+
//# sourceMappingURL=server-functions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-functions.d.ts","sourceRoot":"","sources":["../src/server-functions.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAIf,MAAM,MAAM,oBAAoB,GAC5B,KAAK,GACL,MAAM,GACN,KAAK,GACL,OAAO,GACP,QAAQ,CAAC;AAEb,MAAM,MAAM,uBAAuB,GAC/B,QAAQ,GAC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IG;IACH,QAAQ,CAAC,qBAAqB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,SAAS,oBAAoB,EAAE,EACxC,OAAO,EAAE,gCAAgC,GACxC,MAAM,CA8BR"}
|
package/package.json
CHANGED
|
@@ -1,30 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@memoized-dom/compiler",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Binding-aware TypeScript and JSX compiler for memoized-dom",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@memoized-dom/compiler",
|
|
3
|
+
"version": "0.0.6",
|
|
4
|
+
"description": "Binding-aware TypeScript and JSX compiler for memoized-dom",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=24.11.0"
|
|
8
|
+
},
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./jsx": {
|
|
20
|
+
"types": "./dist/jsx-types.d.ts"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "bun run ./scripts/clean.ts && rolldown -c rolldown.config.ts && tsc -p tsconfig.build.json"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@tsrx/core": "0.1.63",
|
|
28
|
+
"esrap": "^2.3.6",
|
|
29
|
+
"yuku-parser": "^0.9.3"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
}
|
|
34
|
+
}
|