@barefootjs/jsx 0.40.0 → 0.40.2
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/dist/adapters/ambiguous-nil-arithmetic.d.ts +42 -0
- package/dist/adapters/ambiguous-nil-arithmetic.d.ts.map +1 -0
- package/dist/adapters/attr-plan.d.ts.map +1 -1
- package/dist/adapters/boolean-carrier.d.ts +31 -0
- package/dist/adapters/boolean-carrier.d.ts.map +1 -0
- package/dist/adapters/boolean-result.d.ts +32 -10
- package/dist/adapters/boolean-result.d.ts.map +1 -1
- package/dist/adapters/brace-delimiter-text.d.ts +18 -0
- package/dist/adapters/brace-delimiter-text.d.ts.map +1 -0
- package/dist/adapters/callback-method.d.ts +38 -5
- package/dist/adapters/callback-method.d.ts.map +1 -1
- package/dist/adapters/component-props.d.ts +22 -7
- package/dist/adapters/component-props.d.ts.map +1 -1
- package/dist/adapters/computed-const.d.ts +28 -1
- package/dist/adapters/computed-const.d.ts.map +1 -1
- package/dist/adapters/dsl-template-adapter.d.ts +39 -1
- package/dist/adapters/dsl-template-adapter.d.ts.map +1 -1
- package/dist/adapters/loop-bound-names.d.ts +9 -1
- package/dist/adapters/loop-bound-names.d.ts.map +1 -1
- package/dist/adapters/loop-row-type.d.ts +52 -0
- package/dist/adapters/loop-row-type.d.ts.map +1 -0
- package/dist/adapters/nil-reading.d.ts +68 -0
- package/dist/adapters/nil-reading.d.ts.map +1 -0
- package/dist/adapters/non-primitive-equality.d.ts +33 -0
- package/dist/adapters/non-primitive-equality.d.ts.map +1 -0
- package/dist/adapters/number-value.d.ts +45 -0
- package/dist/adapters/number-value.d.ts.map +1 -0
- package/dist/adapters/operand-typing.d.ts +126 -0
- package/dist/adapters/operand-typing.d.ts.map +1 -0
- package/dist/adapters/parsed-expr-emitter.d.ts +70 -12
- package/dist/adapters/parsed-expr-emitter.d.ts.map +1 -1
- package/dist/adapters/primitive-plan.d.ts +291 -0
- package/dist/adapters/primitive-plan.d.ts.map +1 -0
- package/dist/analyzer-context.d.ts +11 -0
- package/dist/analyzer-context.d.ts.map +1 -1
- package/dist/analyzer.d.ts +34 -0
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/augment-inherited-props.d.ts +63 -8
- package/dist/augment-inherited-props.d.ts.map +1 -1
- package/dist/compiler.d.ts.map +1 -1
- package/dist/event-handler-name.d.ts +12 -0
- package/dist/event-handler-name.d.ts.map +1 -1
- package/dist/expression-parser.d.ts +8 -0
- package/dist/expression-parser.d.ts.map +1 -1
- package/dist/index.d.ts +24 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5671 -2586
- package/dist/ir-to-client-js/build-references.d.ts.map +1 -1
- package/dist/ir-to-client-js/child-props-object.d.ts +64 -0
- package/dist/ir-to-client-js/child-props-object.d.ts.map +1 -0
- package/dist/ir-to-client-js/collect-elements.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-component-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-inner-loop.d.ts +29 -0
- package/dist/ir-to-client-js/control-flow/plan/build-inner-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-lazy-row.d.ts +2 -0
- package/dist/ir-to-client-js/control-flow/plan/build-lazy-row.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-loop-child-arm.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-reactive-effects.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/inner-loop.d.ts +5 -4
- package/dist/ir-to-client-js/control-flow/plan/inner-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/loop-child-arm.d.ts +2 -0
- package/dist/ir-to-client-js/control-flow/plan/loop-child-arm.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/loop.d.ts +15 -0
- package/dist/ir-to-client-js/control-flow/plan/loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/reactive-effects.d.ts +2 -0
- package/dist/ir-to-client-js/control-flow/plan/reactive-effects.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/shared.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/claim-plan.d.ts +22 -0
- package/dist/ir-to-client-js/control-flow/stringify/claim-plan.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/component-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/event-listener.d.ts +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/event-listener.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/lazy-row.d.ts.map +1 -1
- package/dist/ir-to-client-js/html-template.d.ts +3 -2
- package/dist/ir-to-client-js/html-template.d.ts.map +1 -1
- package/dist/ir-to-client-js/imports.d.ts +2 -2
- package/dist/ir-to-client-js/imports.d.ts.map +1 -1
- package/dist/ir-to-client-js/index.d.ts +2 -6
- package/dist/ir-to-client-js/index.d.ts.map +1 -1
- package/dist/ir-to-client-js/plan/build-static-array-child-init.d.ts.map +1 -1
- package/dist/ir-to-client-js/plan/static-array-child-init.d.ts +37 -19
- package/dist/ir-to-client-js/plan/static-array-child-init.d.ts.map +1 -1
- package/dist/ir-to-client-js/prop-handling.d.ts.map +1 -1
- package/dist/ir-to-client-js/reactivity.d.ts.map +1 -1
- package/dist/ir-to-client-js/safe-html.d.ts +9 -3
- package/dist/ir-to-client-js/safe-html.d.ts.map +1 -1
- package/dist/ir-to-client-js/stringify/static-array-child-init.d.ts +3 -2
- package/dist/ir-to-client-js/stringify/static-array-child-init.d.ts.map +1 -1
- package/dist/ir-to-client-js/types.d.ts +30 -0
- package/dist/ir-to-client-js/types.d.ts.map +1 -1
- package/dist/ir-to-client-js/utils.d.ts +8 -0
- package/dist/ir-to-client-js/utils.d.ts.map +1 -1
- package/dist/jsx-to-ir.d.ts +1 -0
- package/dist/jsx-to-ir.d.ts.map +1 -1
- package/dist/nullable-signal-attr.d.ts +95 -10
- package/dist/nullable-signal-attr.d.ts.map +1 -1
- package/dist/prop-rewrite.d.ts +7 -0
- package/dist/prop-rewrite.d.ts.map +1 -1
- package/dist/props-binding.d.ts +27 -3
- package/dist/props-binding.d.ts.map +1 -1
- package/dist/props-object-whole-read.d.ts +15 -0
- package/dist/props-object-whole-read.d.ts.map +1 -0
- package/dist/rich-type-refusal.d.ts.map +1 -1
- package/dist/scope/binding-scope.d.ts +100 -4
- package/dist/scope/binding-scope.d.ts.map +1 -1
- package/dist/scope/lexical-scope-walk.d.ts +3 -2
- package/dist/scope/lexical-scope-walk.d.ts.map +1 -1
- package/dist/scope/root-prop-alias.d.ts +16 -0
- package/dist/scope/root-prop-alias.d.ts.map +1 -1
- package/dist/signal-prop-name-collision.d.ts.map +1 -1
- package/dist/ssr-defaults.d.ts +4 -2
- package/dist/ssr-defaults.d.ts.map +1 -1
- package/dist/ssr-seed-plan.d.ts +14 -0
- package/dist/ssr-seed-plan.d.ts.map +1 -1
- package/dist/strip-types.d.ts +13 -0
- package/dist/strip-types.d.ts.map +1 -1
- package/dist/template-parts.d.ts.map +1 -1
- package/dist/template-position-walk.d.ts +21 -3
- package/dist/template-position-walk.d.ts.map +1 -1
- package/dist/types.d.ts +120 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/__snapshots__/doc-examples.test.ts.snap +3 -3
- package/src/__tests__/binding-scope-ratchet.test.ts +12 -2
- package/src/__tests__/binding-scope.test.ts +89 -1
- package/src/__tests__/body-destructure-props-object-alias.test.ts +123 -0
- package/src/__tests__/boolean-carrier.test.ts +74 -0
- package/src/__tests__/boolean-result.test.ts +22 -5
- package/src/__tests__/brace-delimiter-text.test.ts +26 -0
- package/src/__tests__/callback-method.test.ts +62 -2
- package/src/__tests__/child-components-in-map.test.ts +1 -1
- package/src/__tests__/component-props.test.ts +14 -0
- package/src/__tests__/computed-const.test.ts +188 -0
- package/src/__tests__/emit-to-string-call.test.ts +2 -1
- package/src/__tests__/expression-parser.test.ts +24 -0
- package/src/__tests__/hydration-payload-analysis.test.ts +166 -0
- package/src/__tests__/issue-2724-prop-alias-loop-not-static.test.ts +7 -7
- package/src/__tests__/issue-2754-rest-spread-needs-slot.test.ts +5 -2
- package/src/__tests__/issue-2798-static-nested-loop-bindings.test.ts +1 -1
- package/src/__tests__/issue-2835-props-type-member-name-collision.test.ts +4 -4
- package/src/__tests__/issue-3044-nested-prop-object-array-not-static.test.ts +1 -1
- package/src/__tests__/issue-3688-props-spread-child-csr.test.ts +143 -0
- package/src/__tests__/issue-3713-props-spread-loop-row.test.ts +65 -0
- package/src/__tests__/lookup-literal-const.test.ts +9 -3
- package/src/__tests__/loop-index-reactivity.test.ts +2 -2
- package/src/__tests__/loop-param-accessor-key-member-safety.test.ts +1 -1
- package/src/__tests__/loop-plan.test.ts +1 -1
- package/src/__tests__/loop-row-const-initializer-shadow.test.ts +146 -0
- package/src/__tests__/loop-row-prop-read.test.ts +111 -0
- package/src/__tests__/loop-row-type.test.ts +64 -0
- package/src/__tests__/lowering-value-position.test.ts +4 -0
- package/src/__tests__/memo-body-expr.test.ts +137 -0
- package/src/__tests__/module-const-destructure-default.test.ts +156 -0
- package/src/__tests__/nested-loop-index-param.test.ts +1 -1
- package/src/__tests__/nested-loop-reactive-attrs.test.ts +2 -2
- package/src/__tests__/nested-row-shadowing.test.ts +2 -2
- package/src/__tests__/nil-reading.test.ts +77 -0
- package/src/__tests__/nullable-signal-attr.test.ts +231 -2
- package/src/__tests__/primitive-plan.test.ts +416 -0
- package/src/__tests__/profile-binding-ids.test.ts +14 -0
- package/src/__tests__/profile-loop-binding-ids.test.ts +2 -2
- package/src/__tests__/profile-nested-binding-ids.test.ts +2 -2
- package/src/__tests__/props-object-whole-read.test.ts +40 -0
- package/src/__tests__/reactive-attrs-in-map.test.ts +1 -1
- package/src/__tests__/reactive-factory-inlining.test.ts +4 -1
- package/src/__tests__/rest-binding-gaps.test.ts +192 -0
- package/src/__tests__/root-prop-alias.test.ts +79 -1
- package/src/__tests__/signal-prop-name-collision.test.ts +102 -2
- package/src/__tests__/source-file-cache.test.ts +105 -0
- package/src/__tests__/ssr-seed-plan.test.ts +43 -0
- package/src/__tests__/static-loop-csr-materialize.test.ts +2 -2
- package/src/__tests__/static-record-literal-array.test.ts +171 -0
- package/src/__tests__/string-concat-identifier.test.ts +40 -1
- package/src/__tests__/template-parts-literal-boundary.test.ts +19 -0
- package/src/adapters/ambiguous-nil-arithmetic.ts +103 -0
- package/src/adapters/attr-plan.ts +6 -2
- package/src/adapters/boolean-carrier.ts +76 -0
- package/src/adapters/boolean-result.ts +72 -66
- package/src/adapters/brace-delimiter-text.ts +25 -0
- package/src/adapters/callback-method.ts +151 -27
- package/src/adapters/component-props.ts +28 -8
- package/src/adapters/computed-const.ts +443 -10
- package/src/adapters/dsl-template-adapter.ts +79 -2
- package/src/adapters/loop-bound-names.ts +9 -1
- package/src/adapters/loop-plan.ts +1 -1
- package/src/adapters/loop-row-type.ts +139 -0
- package/src/adapters/nil-reading.ts +297 -0
- package/src/adapters/non-primitive-equality.ts +92 -0
- package/src/adapters/number-value.ts +108 -0
- package/src/adapters/operand-typing.ts +522 -0
- package/src/adapters/parsed-expr-emitter.ts +154 -19
- package/src/adapters/primitive-plan.ts +696 -0
- package/src/analyzer-context.ts +14 -0
- package/src/analyzer.ts +692 -85
- package/src/augment-inherited-props.ts +108 -10
- package/src/compiler.ts +17 -0
- package/src/event-handler-name.ts +15 -0
- package/src/expression-parser.ts +74 -2
- package/src/index.ts +45 -9
- package/src/ir-to-client-js/build-references.ts +69 -0
- package/src/ir-to-client-js/child-props-object.ts +106 -0
- package/src/ir-to-client-js/collect-elements.ts +100 -67
- package/src/ir-to-client-js/compute-inlinability.ts +1 -1
- package/src/ir-to-client-js/control-flow/plan/build-component-loop.ts +15 -1
- package/src/ir-to-client-js/control-flow/plan/build-inner-loop.ts +85 -5
- package/src/ir-to-client-js/control-flow/plan/build-lazy-row.ts +3 -0
- package/src/ir-to-client-js/control-flow/plan/build-loop-child-arm.ts +30 -28
- package/src/ir-to-client-js/control-flow/plan/build-reactive-effects.ts +1 -0
- package/src/ir-to-client-js/control-flow/plan/inner-loop.ts +5 -4
- package/src/ir-to-client-js/control-flow/plan/loop-child-arm.ts +2 -0
- package/src/ir-to-client-js/control-flow/plan/loop.ts +12 -0
- package/src/ir-to-client-js/control-flow/plan/reactive-effects.ts +2 -0
- package/src/ir-to-client-js/control-flow/shared.ts +23 -24
- package/src/ir-to-client-js/control-flow/stringify/claim-plan.ts +29 -0
- package/src/ir-to-client-js/control-flow/stringify/component-loop.ts +8 -2
- package/src/ir-to-client-js/control-flow/stringify/event-listener.ts +8 -1
- package/src/ir-to-client-js/control-flow/stringify/inner-loop.ts +8 -7
- package/src/ir-to-client-js/control-flow/stringify/lazy-row.ts +8 -7
- package/src/ir-to-client-js/control-flow/stringify/loop-child-arm.ts +4 -4
- package/src/ir-to-client-js/control-flow/stringify/loop.ts +3 -3
- package/src/ir-to-client-js/control-flow/stringify/reactive-effects.ts +6 -6
- package/src/ir-to-client-js/emit-reactive.ts +1 -1
- package/src/ir-to-client-js/html-template.ts +95 -38
- package/src/ir-to-client-js/imports.ts +1 -1
- package/src/ir-to-client-js/index.ts +53 -11
- package/src/ir-to-client-js/plan/build-static-array-child-init.ts +42 -15
- package/src/ir-to-client-js/plan/static-array-child-init.ts +34 -19
- package/src/ir-to-client-js/prop-handling.ts +22 -3
- package/src/ir-to-client-js/reactivity.ts +14 -0
- package/src/ir-to-client-js/safe-html.ts +11 -4
- package/src/ir-to-client-js/stringify/static-array-child-init.ts +30 -12
- package/src/ir-to-client-js/types.ts +23 -0
- package/src/ir-to-client-js/utils.ts +15 -1
- package/src/jsx-to-ir.ts +510 -58
- package/src/nullable-signal-attr.ts +366 -28
- package/src/prop-rewrite.ts +30 -6
- package/src/props-binding.ts +54 -3
- package/src/props-object-whole-read.ts +87 -0
- package/src/rich-type-refusal.ts +2 -1
- package/src/scope/binding-scope.ts +203 -11
- package/src/scope/lexical-scope-walk.ts +4 -3
- package/src/scope/root-prop-alias.ts +23 -0
- package/src/signal-prop-name-collision.ts +113 -22
- package/src/ssr-defaults.ts +10 -4
- package/src/ssr-seed-plan.ts +82 -17
- package/src/strip-types.ts +31 -3
- package/src/template-parts.ts +21 -1
- package/src/template-position-walk.ts +57 -28
- package/src/types.ts +117 -0
package/dist/props-binding.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConstantInfo, ParamInfo, PropUsage, SignalPropSeed } from './types.ts';
|
|
1
|
+
import type { ConstantInfo, FunctionInfo, MemoInfo, ParamInfo, PropUsage, SignalInfo, SignalPropSeed } from './types.ts';
|
|
2
2
|
import type { ParsedExpr } from './expression-parser.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Authoritative IdentifierName classification for a destructure-pattern
|
|
@@ -65,8 +65,8 @@ export declare function isPropsAliasConst(c: Pick<ConstantInfo, 'name' | 'parsed
|
|
|
65
65
|
* binding into a live prop read: the init body's alias rewrite
|
|
66
66
|
* (`resolveBodyPropAliases`) and parameter rewrite
|
|
67
67
|
* (`rewriteDestructuredPropReads`), the reactive attribute rewrite
|
|
68
|
-
* (`rewriteDestructuredPropsInExpr`), and the template's prop
|
|
69
|
-
* (`
|
|
68
|
+
* (`rewriteDestructuredPropsInExpr`), and the template's prop read set
|
|
69
|
+
* (`templatePropReadParams`, #3579).
|
|
70
70
|
*/
|
|
71
71
|
export declare function keepsDeclaredValue(b: {
|
|
72
72
|
declarationKind?: ConstantInfo['declarationKind'];
|
|
@@ -103,6 +103,30 @@ export declare function writesAnyBinding(b: {
|
|
|
103
103
|
* renamed binding classified there would lose its default.
|
|
104
104
|
*/
|
|
105
105
|
export declare function isRenamedBodyPropParam(c: Pick<ConstantInfo, 'name' | 'propsDestructure' | 'declarationKind' | 'mutatedAfterDeclaration' | 'reassigned'>, propsParams: readonly ParamInfo[]): boolean;
|
|
106
|
+
/** The component bindings {@link templatePropReadParams} reads. */
|
|
107
|
+
export interface TemplatePropReadBindings {
|
|
108
|
+
propsObjectName: string | null;
|
|
109
|
+
propsParams: readonly ParamInfo[];
|
|
110
|
+
signals: readonly Pick<SignalInfo, 'getter' | 'setter'>[];
|
|
111
|
+
memos: readonly Pick<MemoInfo, 'name'>[];
|
|
112
|
+
localFunctions: readonly Pick<FunctionInfo, 'name'>[];
|
|
113
|
+
localConstants: readonly ConstantInfo[];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The props bindings a client `template:` reads as their live prop
|
|
117
|
+
* (`livePropReadExpr`, default included). The one set the Phase-1 markup
|
|
118
|
+
* rewrite and a signal seed's or memo body's template text share, so a
|
|
119
|
+
* binding read through a memo takes the same default as one read in markup.
|
|
120
|
+
*
|
|
121
|
+
* In a destructured-parameter component that is every parameter. In a
|
|
122
|
+
* `(props)`-arg component a bare name is a prop only where the body binds it
|
|
123
|
+
* as one, so the set is exactly the body bindings that hold their prop
|
|
124
|
+
* ({@link holdsProp}) and that no other component binding (a signal, memo,
|
|
125
|
+
* local function or other local) shares a name with. A typed prop the body
|
|
126
|
+
* does not bind is not in scope as a bare name: a bare `value` there is a
|
|
127
|
+
* local function, a module binding or a global, never `_p.value`.
|
|
128
|
+
*/
|
|
129
|
+
export declare function templatePropReadParams(b: TemplatePropReadBindings): ParamInfo[];
|
|
106
130
|
/**
|
|
107
131
|
* How a parsed signal initializer reads a prop: a member chain rooted at the
|
|
108
132
|
* props object (`props.<name>`, `props.row.count`, `props.items[0]`) or a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props-binding.d.ts","sourceRoot":"","sources":["../src/props-binding.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"props-binding.d.ts","sourceRoot":"","sources":["../src/props-binding.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,E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AAkB;IACjC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvD,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC,GAAG,IAAI,GACnC,CAAC,GAAG,IAAI,CAUV;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvD,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,OAAO,GAAG,IAAI,CAMzB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a component observes its props object as a whole: any read of the
|
|
3
|
+
* props parameter other than a member read with a known key (`props.x`,
|
|
4
|
+
* `props['x']`). A whole read — `{...props}` on an element or a component,
|
|
5
|
+
* `Object.keys(props)`, `props[key]`, passing `props` to a function,
|
|
6
|
+
* `const { a, ...rest } = props` — can see a key the props type does not
|
|
7
|
+
* declare, so a caller's undeclared prop is not dead there.
|
|
8
|
+
*
|
|
9
|
+
* Syntactic, over the component's TS AST: a nested function, catch clause or
|
|
10
|
+
* block that rebinds the name shadows it, and a type position is not a read.
|
|
11
|
+
* A shadow this misses only makes the answer `true` more often.
|
|
12
|
+
*/
|
|
13
|
+
import ts from 'typescript';
|
|
14
|
+
export declare function observesWholePropsObject(fn: ts.FunctionDeclaration | ts.ArrowFunction | ts.FunctionExpression, name: string): boolean;
|
|
15
|
+
//# sourceMappingURL=props-object-whole-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props-object-whole-read.d.ts","sourceRoot":"","sources":["../src/props-object-whole-read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,wBAAgB,wBAAwB,CACtC,EAAE,EAAE,EAAE,CAAC,mBAAmB,GAAG,EAAE,CAAC,aAAa,GAAG,EAAE,CAAC,kBAAkB,EACrE,IAAI,EAAE,MAAM,GACX,OAAO,CAaT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-type-refusal.d.ts","sourceRoot":"","sources":["../src/rich-type-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,aAAa,EACb,cAAc,EAKf,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"rich-type-refusal.d.ts","sourceRoot":"","sources":["../src/rich-type-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,aAAa,EACb,cAAc,EAKf,MAAM,YAAY,CAAA;AAkBnB;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAQ1G;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAe1I"}
|
|
@@ -28,6 +28,23 @@
|
|
|
28
28
|
* row's item/index/destructure/preamble names) even though both end up
|
|
29
29
|
* "just names you can't resolve against component-level state."
|
|
30
30
|
*/
|
|
31
|
+
/**
|
|
32
|
+
* The identifier a template reads as the component's props object when the
|
|
33
|
+
* component does not name one itself: `props.X` is the component's prop `X`
|
|
34
|
+
* while no binding shadows `props` (#3693). A component that takes its props
|
|
35
|
+
* as one object names it with its parameter (`function C(p)`), and
|
|
36
|
+
* {@link BindingScope.forComponent} makes that name the props object instead.
|
|
37
|
+
*/
|
|
38
|
+
export declare const PROPS_OBJECT_IDENTIFIER = "props";
|
|
39
|
+
/**
|
|
40
|
+
* The identifier that names the props object of a component whose props
|
|
41
|
+
* parameter is `propsObjectName` (`IRMetadata.propsObjectName`): that name
|
|
42
|
+
* (`function C(p)` → `p`), or {@link PROPS_OBJECT_IDENTIFIER} when the
|
|
43
|
+
* component destructures its props (`null`). The single answer to "which
|
|
44
|
+
* identifier is the component's props object"; {@link BindingScope.propsObject}
|
|
45
|
+
* carries it.
|
|
46
|
+
*/
|
|
47
|
+
export declare function propsObjectIdentifier(propsObjectName: string | null | undefined): string;
|
|
31
48
|
/**
|
|
32
49
|
* How a name inside a `ScopeFrame` came to be bound — the row shapes
|
|
33
50
|
* (`'item'`/`'index'`/`'destructure'`/`'preamble'`) for `'loop-row'` frames,
|
|
@@ -81,9 +98,27 @@ export interface LoopBindingSource {
|
|
|
81
98
|
}
|
|
82
99
|
/** Structural pick of `TypeInfo` (`packages/jsx/src/types.ts`). */
|
|
83
100
|
export interface LoopValueType {
|
|
101
|
+
/** `TypeInfo.kind`; `'unknown'` for `any`, `unknown` and unresolved types. */
|
|
102
|
+
readonly kind?: string;
|
|
84
103
|
readonly primitive?: string;
|
|
85
104
|
readonly unionTypes?: readonly LoopValueType[];
|
|
105
|
+
/** A named type's name (`Row`), resolved through {@link NamedTypeFields}. */
|
|
106
|
+
readonly raw?: string;
|
|
107
|
+
readonly properties?: readonly LoopValueField[];
|
|
108
|
+
readonly elementType?: LoopValueType;
|
|
109
|
+
}
|
|
110
|
+
/** Structural pick of `PropertyInfo` (`packages/jsx/src/types.ts`). */
|
|
111
|
+
export interface LoopValueField {
|
|
112
|
+
readonly name: string;
|
|
113
|
+
readonly type: LoopValueType;
|
|
114
|
+
/** `name?:` — the field may be absent, so its value may be `undefined`. */
|
|
115
|
+
readonly optional?: boolean;
|
|
86
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* The fields of a named type (`type Row = { … }`, an interface), by name;
|
|
119
|
+
* undefined when the component's file does not define it as an object type.
|
|
120
|
+
*/
|
|
121
|
+
export type NamedTypeFields = (name: string) => readonly LoopValueField[] | undefined;
|
|
87
122
|
/** Structural copy of `LoopBindingPathSegment` (`packages/jsx/src/types.ts`). */
|
|
88
123
|
export type RowPathSegment = {
|
|
89
124
|
readonly kind: 'field';
|
|
@@ -93,6 +128,34 @@ export type RowPathSegment = {
|
|
|
93
128
|
readonly kind: 'index';
|
|
94
129
|
readonly index: number;
|
|
95
130
|
};
|
|
131
|
+
/**
|
|
132
|
+
* The type at `segments` below `type`, through object types, named types
|
|
133
|
+
* (`namedFields`) and array elements; null when a step is not known.
|
|
134
|
+
*
|
|
135
|
+
* A union resolves the path in each member and is the union of the results,
|
|
136
|
+
* null when any member has no such path. A field is therefore definitely a
|
|
137
|
+
* string only when it is one in every member: the element type of a
|
|
138
|
+
* `concat` (`loopRowType`) is the union of its receiver's and arguments'
|
|
139
|
+
* element types, so `Row` and a same-shaped `Other` both read `id: string`,
|
|
140
|
+
* while an `any` member or an omitted field reads nothing (#3762 review).
|
|
141
|
+
*/
|
|
142
|
+
export declare function loopValueTypeAt(type: LoopValueType, segments: readonly RowPathSegment[], namedFields?: NamedTypeFields): LoopValueType | null;
|
|
143
|
+
/**
|
|
144
|
+
* The element type of an array type, or of a union whose every member is an
|
|
145
|
+
* array (a `concat` of arrays, a field read across `concat` rows): the union
|
|
146
|
+
* of their element types. Undefined for anything else. Every reader of an
|
|
147
|
+
* element type goes through this, so a union of arrays reads like an array
|
|
148
|
+
* (#3762 review).
|
|
149
|
+
*/
|
|
150
|
+
export declare function arrayElementType<T extends LoopValueType>(type: T | null | undefined): T | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* The union of `members`, normalised: one member, or members that are all
|
|
153
|
+
* structurally the same type, is that member itself, so `Row[] ∪ Row[]`
|
|
154
|
+
* keeps the plain `Row[]` shape.
|
|
155
|
+
*/
|
|
156
|
+
export declare function unionOfLoopValueTypes<T extends LoopValueType>(members: readonly T[]): T;
|
|
157
|
+
/** Whether two types have the same structure: kind, name, primitive, fields, elements and members. */
|
|
158
|
+
export declare function isSameLoopValueShape(a: LoopValueType | undefined, b: LoopValueType | undefined): boolean;
|
|
96
159
|
/**
|
|
97
160
|
* A stack of `ScopeFrame`s, innermost frame at index 0 of the internal
|
|
98
161
|
* array (i.e. `frames[0]` is what `enterLoopRow`/`enterCallback` most
|
|
@@ -102,8 +165,22 @@ export type RowPathSegment = {
|
|
|
102
165
|
*/
|
|
103
166
|
export declare class BindingScope {
|
|
104
167
|
private readonly frames;
|
|
168
|
+
readonly propsObject: string;
|
|
105
169
|
static readonly EMPTY: BindingScope;
|
|
170
|
+
/**
|
|
171
|
+
* `propsObject`: the identifier that names the component's props object
|
|
172
|
+
* in this scope's component ({@link forComponent}). Every child scope
|
|
173
|
+
* keeps it.
|
|
174
|
+
*/
|
|
106
175
|
private constructor();
|
|
176
|
+
/**
|
|
177
|
+
* The empty scope of a component whose props object parameter is
|
|
178
|
+
* `propsObjectName` (`IRMetadata.propsObjectName`, decided in Phase 1):
|
|
179
|
+
* `function C(p)` reads its props as `p.X`, so `p` is the props object.
|
|
180
|
+
* A component that destructures its props (`null`) keeps
|
|
181
|
+
* {@link PROPS_OBJECT_IDENTIFIER}.
|
|
182
|
+
*/
|
|
183
|
+
static forComponent(propsObjectName: string | null): BindingScope;
|
|
107
184
|
/**
|
|
108
185
|
* Child scope with a new `'loop-row'` frame for one loop's per-item
|
|
109
186
|
* bindings. Parent (`this`) is not mutated; the returned scope is a
|
|
@@ -134,8 +211,8 @@ export declare class BindingScope {
|
|
|
134
211
|
* `adapters/loop-bound-names.ts`'s `collectLoopBoundNames` adds BOTH
|
|
135
212
|
* `node.param` AND every `paramBindings[i].name` unconditionally
|
|
136
213
|
* (never skipping `param` in the destructured case) — a deliberately
|
|
137
|
-
* coarser, over-inclusive collection
|
|
138
|
-
*
|
|
214
|
+
* coarser, over-inclusive collection for whole-component "may be
|
|
215
|
+
* shadowed somewhere" checks (safe to over-exclude there). This method
|
|
139
216
|
* follows the precise `jsx-to-ir.ts` `ctx.loopParams` semantics, since
|
|
140
217
|
* that is the mechanism actually doing scope-shadowed name RESOLUTION
|
|
141
218
|
* (the behavior `BindingScope` replaces), not coarse exclusion.
|
|
@@ -159,8 +236,27 @@ export declare class BindingScope {
|
|
|
159
236
|
enterAliases(aliasToOriginal: ReadonlyMap<string, string>): BindingScope;
|
|
160
237
|
/** Innermost-first membership check across every frame in the stack. */
|
|
161
238
|
isBound(name: string): boolean;
|
|
162
|
-
/**
|
|
163
|
-
|
|
239
|
+
/**
|
|
240
|
+
* Whether a binding here shadows the component's props object
|
|
241
|
+
* ({@link propsObject}): a `.map((props) => …)` row, a
|
|
242
|
+
* destructured `({ props })` field, a preamble local or a callback param.
|
|
243
|
+
* `props.X` then reads that binding's member, not the component's prop
|
|
244
|
+
* `X` (#3693).
|
|
245
|
+
*/
|
|
246
|
+
shadowsPropsObject(): boolean;
|
|
247
|
+
/**
|
|
248
|
+
* Resolve string typing at this position, respecting the nearest binding.
|
|
249
|
+
* `componentProperty`: `name` is read as the literal `props.<name>`. That is
|
|
250
|
+
* the component's prop only when `props` is this component's props object
|
|
251
|
+
* and no binding shadows it; while a binding named `props` is in scope, it
|
|
252
|
+
* is that binding's member. `path`: the read is the member chain
|
|
253
|
+
* `name.<path…>` (`row.id`). A loop row binding resolves the chain against
|
|
254
|
+
* its row type (`LoopBindingSource.rowType`), through `namedFields` for a
|
|
255
|
+
* named type; an outer name has typing for itself only.
|
|
256
|
+
*/
|
|
257
|
+
isStringValueName(name: string, outer: (name: string) => boolean, componentProperty?: boolean, path?: readonly string[], namedFields?: NamedTypeFields): boolean;
|
|
258
|
+
/** Whether any frame is a loop row: the position sits inside a `.map()` row body. */
|
|
259
|
+
insideLoopRow(): boolean;
|
|
164
260
|
/** The names the innermost frame binds, in binding order. */
|
|
165
261
|
innermostNames(): readonly string[];
|
|
166
262
|
/** Names this frame shadows in an enclosing callback/row frame. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding-scope.d.ts","sourceRoot":"","sources":["../../src/scope/binding-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,UAAU,GAAG,OAAO,CAAA;AAExF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE;QAAE,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAA;KAAE,CAAA;CAClG;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAAA;IACtC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;CACrD;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IACxC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,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iC;IAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,eAAe,IAAI,WAAW,CAAC,MAAM,CAAC,CAYrC;IAED;;;OAGG;IACH,iBAAiB,IAAI,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAE7C;CACF"}
|
|
@@ -20,7 +20,8 @@ import ts from 'typescript';
|
|
|
20
20
|
/**
|
|
21
21
|
* Depth-first walk that maintains the binding stack described above and
|
|
22
22
|
* reports every identifier along with whether a binding within `root`
|
|
23
|
-
* currently shadows it.
|
|
23
|
+
* currently shadows it. `isShadowed` answers the same question for any
|
|
24
|
+
* other name at that identifier's position.
|
|
24
25
|
*/
|
|
25
|
-
export declare function walkWithScope(root: ts.Node, visit: (ident: ts.Identifier, parent: ts.Node | undefined, shadowed: boolean) => void): void;
|
|
26
|
+
export declare function walkWithScope(root: ts.Node, visit: (ident: ts.Identifier, parent: ts.Node | undefined, shadowed: boolean, isShadowed: (name: string) => boolean) => void): void;
|
|
26
27
|
//# sourceMappingURL=lexical-scope-walk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexical-scope-walk.d.ts","sourceRoot":"","sources":["../../src/scope/lexical-scope-walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAA;AAyH3B
|
|
1
|
+
{"version":3,"file":"lexical-scope-walk.d.ts","sourceRoot":"","sources":["../../src/scope/lexical-scope-walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAA;AAyH3B;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,KAAK,IAAI,GAC3H,IAAI,CAkBN"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ParsedExpr } from '../expression-parser.ts';
|
|
1
2
|
import type { ComponentIR } from '../types.ts';
|
|
2
3
|
import type { BindingScope } from './binding-scope.ts';
|
|
3
4
|
/**
|
|
@@ -40,4 +41,19 @@ export declare function rootPropAliasesForLoop(outer: BindingScope, row: Binding
|
|
|
40
41
|
* binding shadows `name`, else `name` itself.
|
|
41
42
|
*/
|
|
42
43
|
export declare function rootPropReadName(name: string, scope: BindingScope, aliases: ReadonlyMap<string, string>): string;
|
|
44
|
+
/**
|
|
45
|
+
* Whether `expr` reads the component's props object at a position where
|
|
46
|
+
* `isBound` answers which names a binding shadows: the bare identifier
|
|
47
|
+
* `propsObject` that no binding shadows (#3693). `propsObject` is the
|
|
48
|
+
* component's props object identifier, `BindingScope.propsObject`: the
|
|
49
|
+
* props parameter's own name (`function C(p)` reads `p.X`), or `props` for
|
|
50
|
+
* a component that destructures its props. A `.map((props) => …)` row, a
|
|
51
|
+
* destructured `({ props })` field, a preamble local or a callback param of
|
|
52
|
+
* that name is that binding instead, so `props.X` reads its member rather
|
|
53
|
+
* than flattening to the component's prop `X`. Template emitters flatten a
|
|
54
|
+
* props-object member read only when this holds; `isBound` is the
|
|
55
|
+
* adapter's current `BindingScope` (`scope.isBound`), or, in a filter
|
|
56
|
+
* predicate, the predicate's own params plus the enclosing scope.
|
|
57
|
+
*/
|
|
58
|
+
export declare function isRootPropsObject(expr: ParsedExpr, isBound: (name: string) => boolean, propsObject: string): boolean;
|
|
43
59
|
//# sourceMappingURL=root-prop-alias.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-prop-alias.d.ts","sourceRoot":"","sources":["../../src/scope/root-prop-alias.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C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MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAOnC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,MAAM,CAGR;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,EAClC,WAAW,EAAE,MAAM,GAClB,OAAO,CAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal-prop-name-collision.d.ts","sourceRoot":"","sources":["../src/signal-prop-name-collision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAc5D;yEACyE;AACzE,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,EAAE,CAAC,OAAO,CAgD5G;
|
|
1
|
+
{"version":3,"file":"signal-prop-name-collision.d.ts","sourceRoot":"","sources":["../src/signal-prop-name-collision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAc5D;yEACyE;AACzE,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,EAAE,CAAC,OAAO,CAgD5G;AAkHD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,eAAe,EACpB,cAAc,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,UAAU,KAAK,OAAO,GAC7C,MAAM,GAAG,IAAI,CAmFf"}
|
package/dist/ssr-defaults.d.ts
CHANGED
|
@@ -114,8 +114,10 @@ export declare function localConstValuesByName(metadata: Pick<IRMetadata, 'local
|
|
|
114
114
|
*
|
|
115
115
|
* Also the analyzer's test for which same-named signal/memo keeps sharing
|
|
116
116
|
* the prop's template variable (`separateSignalPropBindings`): a binding
|
|
117
|
-
* this answers `false` for is renamed before IR is built, so
|
|
118
|
-
*
|
|
117
|
+
* this answers `false` for is renamed before IR is built, and so is one it
|
|
118
|
+
* answers `true` for when the component also reads the raw prop elsewhere.
|
|
119
|
+
* A renamed binding no longer matches here, so the two callers cannot
|
|
120
|
+
* disagree about which collisions stay collapsed.
|
|
119
121
|
*/
|
|
120
122
|
export declare function referencesOwnProp(expr: string | undefined, propsObjectName: string, name: string, localConsts: ReadonlyMap<string, string>): boolean;
|
|
121
123
|
//# sourceMappingURL=ssr-defaults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-defaults.d.ts","sourceRoot":"","sources":["../src/ssr-defaults.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAG5C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,KAAK,EAAE,OAAO,CAAA;IACd;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuBzB;
|
|
1
|
+
{"version":3,"file":"ssr-defaults.d.ts","sourceRoot":"","sources":["../src/ssr-defaults.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAG5C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,KAAK,EAAE,OAAO,CAAA;IACd;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuBzB;AA4DD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS,CAoP/F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAOhH;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,eAAe,EAAE,MAAM,EACvB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACvC,OAAO,CAIT"}
|
package/dist/ssr-seed-plan.d.ts
CHANGED
|
@@ -89,6 +89,20 @@ export interface SsrSeedPlan {
|
|
|
89
89
|
baseScope: string[];
|
|
90
90
|
steps: SsrSeedStep[];
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Whether `p`'s destructure default is computed when the prop is absent: a
|
|
94
|
+
* default that is neither a function nor literal data
|
|
95
|
+
* ({@link isLiteralData}). A default reading an earlier prop
|
|
96
|
+
* (`ParamInfo.defaultParts`, `{ a, b = a }`) is one, and so is one that
|
|
97
|
+
* calls or reads anything else (`{ b = ['y', ''].filter((x) => x !== '') }`,
|
|
98
|
+
* `{ n = 'abc'.length }`, `{ m = DEFAULT }`). A callback inside the default
|
|
99
|
+
* does not make it a function default.
|
|
100
|
+
*
|
|
101
|
+
* Every backend applies such a default when it renders (the SSR seed plan's
|
|
102
|
+
* prop steps, Go's props constructor) instead of a value fixed at compile
|
|
103
|
+
* time, which only literal data has.
|
|
104
|
+
*/
|
|
105
|
+
export declare function hasComputedDefault(p: ParamInfo): boolean;
|
|
92
106
|
/**
|
|
93
107
|
* `params` with every prop placed after the props its destructure default
|
|
94
108
|
* reads (`ParamInfo.defaultParts`). `propsParams` follows the props TYPE's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-seed-plan.d.ts","sourceRoot":"","sources":["../src/ssr-seed-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAIH,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACnF,OAAO,EAML,KAAK,UAAU,EAChB,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"ssr-seed-plan.d.ts","sourceRoot":"","sources":["../src/ssr-seed-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAIH,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACnF,OAAO,EAML,KAAK,UAAU,EAChB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAGvD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,GAC7D;IACE,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAA;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,UAAU,CAAA;IAClB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAA;CAClB,GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,CAAA;AAExE,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,KAAK,EAAE,WAAW,EAAE,CAAA;CACrB;AAuHD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,SAAS,GAAG,OAAO,CAGxD;AA0ED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,EAAE,CAe5E;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,UAAU,GAAG,WAAW,CAuFpE"}
|
package/dist/strip-types.d.ts
CHANGED
|
@@ -13,7 +13,20 @@ import ts from 'typescript';
|
|
|
13
13
|
export interface ExcludeRange {
|
|
14
14
|
start: number;
|
|
15
15
|
end: number;
|
|
16
|
+
/**
|
|
17
|
+
* Text that stands in for the range instead of dropping it: a read the
|
|
18
|
+
* analyzer respells (`addSourceReplacement`). Applied only when the whole
|
|
19
|
+
* range lies inside the node being reconstructed; a node inside the range
|
|
20
|
+
* (`rest` of `rest.id`) keeps its own text.
|
|
21
|
+
*/
|
|
22
|
+
replacement?: string;
|
|
16
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Insert `range` (with its `replacement`) into the sorted, merged `ranges`.
|
|
26
|
+
* The span must not overlap a range already there; one that does is not
|
|
27
|
+
* added, and false is returned.
|
|
28
|
+
*/
|
|
29
|
+
export declare function addSourceReplacement(ranges: ExcludeRange[], range: Required<ExcludeRange>): boolean;
|
|
17
30
|
/**
|
|
18
31
|
* Walk the entire SourceFile once and return all type-only text ranges,
|
|
19
32
|
* sorted and merged. Store the result on AnalyzerContext so every
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strip-types.d.ts","sourceRoot":"","sources":["../src/strip-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"strip-types.d.ts","sourceRoot":"","sources":["../src/strip-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,OAAO,CAMnG;AAOD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,YAAY,EAAE,CAK9E;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,MAAM,EAAE,YAAY,EAAE,GACrB,MAAM,CAkCR;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,MAAM,EAAE,YAAY,EAAE,EACtB,OAAO,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7C,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CA+B5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-parts.d.ts","sourceRoot":"","sources":["../src/template-parts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,EACjD,IAAI,CAAC,EAAE,wBAAwB,GAC9B,MAAM,CAOR;
|
|
1
|
+
{"version":3,"file":"template-parts.d.ts","sourceRoot":"","sources":["../src/template-parts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,EACjD,IAAI,CAAC,EAAE,wBAAwB,GAC9B,MAAM,CAOR;AAsBD,8EAA8E;AAC9E,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,IAAI,CAAC,EAAE,wBAAwB,GAC9B,MAAM,CAgBR"}
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* (expression, spread, and structured template parts), loop arrays, and the
|
|
10
10
|
* children of elements, components, fragments, providers, async boundaries,
|
|
11
11
|
* loops (including child components, nested components, and `flatMap` /
|
|
12
|
-
* preamble JSX segments) and conditional branches
|
|
12
|
+
* preamble JSX segments) and conditional branches, and a loop preamble's
|
|
13
|
+
* value-declaration initializers (`const same = a === b` in a `.map()` body),
|
|
14
|
+
* which a template adapter evaluates at SSR as a per-row local.
|
|
13
15
|
*
|
|
14
16
|
* A `/* @client *\/`-marked position (`clientOnly`) is skipped: the whole read
|
|
15
17
|
* is deferred to the client, where real JS evaluates it.
|
|
@@ -25,6 +27,7 @@
|
|
|
25
27
|
*/
|
|
26
28
|
import type { ExpressionAttr, IRConditional, IRIfStatement, IRNode, SourceLocation } from './types.ts';
|
|
27
29
|
import type { ParsedExpr } from './expression-parser.ts';
|
|
30
|
+
import type { BindingScope } from './scope/binding-scope.ts';
|
|
28
31
|
/**
|
|
29
32
|
* How the template uses the value at a position:
|
|
30
33
|
*
|
|
@@ -40,8 +43,12 @@ import type { ParsedExpr } from './expression-parser.ts';
|
|
|
40
43
|
* text parsed on demand here; every adapter lowers them from that raw text,
|
|
41
44
|
* so nothing attached to the IR can stand in for them.
|
|
42
45
|
* - `loop-array` — a loop's array expression.
|
|
46
|
+
* - `preamble-init` — the initializer of a loop preamble's value declaration
|
|
47
|
+
* (`MapCallbackPreamble.declarations`), bound as a per-row local. The read
|
|
48
|
+
* of that local is a bare name elsewhere in the row, so the initializer is
|
|
49
|
+
* the only position that shows what the template computes.
|
|
43
50
|
*/
|
|
44
|
-
export type TemplatePositionRole = 'text' | 'condition' | 'element-attr' | 'prop' | 'spread' | 'template-part' | 'loop-array';
|
|
51
|
+
export type TemplatePositionRole = 'text' | 'condition' | 'element-attr' | 'prop' | 'spread' | 'template-part' | 'loop-array' | 'preamble-init';
|
|
45
52
|
/**
|
|
46
53
|
* The IR slot a position's `expr` lives in, for a pass that rewrites the
|
|
47
54
|
* position in place (the action-accessor seed). Only the two roles such a
|
|
@@ -63,6 +70,17 @@ export interface TemplatePosition {
|
|
|
63
70
|
/** The attribute or prop name, when the position is an attribute / prop value. */
|
|
64
71
|
attrName?: string;
|
|
65
72
|
host?: TemplatePositionHost;
|
|
73
|
+
/**
|
|
74
|
+
* The scope the position is read in, when the walk was given the
|
|
75
|
+
* component's scope: each loop's children are read in its row
|
|
76
|
+
* (`BindingScope.enterLoopRow`), its array outside it. The innermost
|
|
77
|
+
* scope wins: an outer wrapper never replaces a row's.
|
|
78
|
+
*/
|
|
79
|
+
scope?: BindingScope;
|
|
66
80
|
}
|
|
67
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Visit every template-lowered position under `root`. With `scope` (the
|
|
83
|
+
* component's), each position also carries the scope it is read in.
|
|
84
|
+
*/
|
|
85
|
+
export declare function walkTemplatePositions(root: IRNode, visit: (position: TemplatePosition) => void, scope?: BindingScope): void;
|
|
68
86
|
//# sourceMappingURL=template-position-walk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-position-walk.d.ts","sourceRoot":"","sources":["../src/template-position-walk.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"template-position-walk.d.ts","sourceRoot":"","sources":["../src/template-position-walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAEV,cAAc,EACd,aAAa,EACb,aAAa,EAEb,MAAM,EAEN,cAAc,EACf,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAE5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,WAAW,GACX,cAAc,GACd,MAAM,GACN,QAAQ,GACR,eAAe,GACf,YAAY,GACZ,eAAe,CAAA;AAEnB;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,aAAa,GAAG,aAAa,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,CAAA;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,UAAU,CAAA;IAChB,GAAG,EAAE,cAAc,CAAA;IACnB,IAAI,EAAE,oBAAoB,CAAA;IAC1B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,oBAAoB,CAAA;IAC3B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,YAAY,CAAA;CACrB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,EAAE,KAAK,CAAC,EAAE,YAAY,GAAG,IAAI,CAE3H"}
|