@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
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ParsedExpr } from '../expression-parser.ts';
|
|
2
|
+
import { type ArithmeticCoercion, type NullishAttrContext } from '../nullable-signal-attr.ts';
|
|
3
|
+
import { BindingScope } from '../scope/binding-scope.ts';
|
|
4
|
+
import type { CompilerError, MemoInfo } from '../types.ts';
|
|
5
|
+
/**
|
|
6
|
+
* Where a template adapter records the refusal of an arithmetic operand
|
|
7
|
+
* whose nil the declared type cannot classify (#3700).
|
|
8
|
+
*/
|
|
9
|
+
export interface AmbiguousNilArithmeticSink {
|
|
10
|
+
readonly errors: CompilerError[];
|
|
11
|
+
readonly componentName: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The shared arithmetic-operand decision for a template adapter's emission
|
|
15
|
+
* site: the coercion the adapter spells (`arithmeticOperandCoercion`), after
|
|
16
|
+
* refusing (BF101) an operand that reads a number prop declared both
|
|
17
|
+
* optional and nullable (`n?: number | null`, `arithmeticOperandNilIsAmbiguous`).
|
|
18
|
+
* JS reads that prop as `undefined` when omitted (`NaN` in arithmetic) and
|
|
19
|
+
* as `0` when `null`; the engine holds both as one nil, so any spelling
|
|
20
|
+
* renders one of them wrong. Under a comparison the same holds for a string
|
|
21
|
+
* or boolean prop declared `?: string | null` / `?: boolean | null` (#3824
|
|
22
|
+
* step 3). Asked at the emission site so the operand is classified in the
|
|
23
|
+
* scope it is read in (`isShadowed`). One error per operand text per compile.
|
|
24
|
+
*/
|
|
25
|
+
export declare function arithmeticCoercionOrRefuse(op: string, operand: ParsedExpr, other: ParsedExpr | undefined, ctx: NullishAttrContext, isShadowed: (name: string) => boolean, sink: AmbiguousNilArithmeticSink): ArithmeticCoercion;
|
|
26
|
+
/**
|
|
27
|
+
* Refuse (BF101) each arithmetic operand in a whole expression that a
|
|
28
|
+
* template adapter lowers without asking {@link arithmeticCoercionOrRefuse}
|
|
29
|
+
* per operator: a `.filter()` predicate, an expression the runtime evaluator
|
|
30
|
+
* runs, a condition lowered by its own renderer (`ambiguousNilArithmeticOperands`).
|
|
31
|
+
* `scope` is the scope the expression is read in.
|
|
32
|
+
*/
|
|
33
|
+
export declare function refuseAmbiguousNilArithmetic(expr: ParsedExpr, ctx: NullishAttrContext, scope: BindingScope, sink: AmbiguousNilArithmeticSink): void;
|
|
34
|
+
/**
|
|
35
|
+
* Refuse the ambiguous arithmetic in the component's memo bodies. A template
|
|
36
|
+
* adapter seeds every memo at SSR, and some seed a memo through a path that
|
|
37
|
+
* never reaches its operator emitter (a static seed after a speculative
|
|
38
|
+
* lowering, a constructor-time evaluation), so the bodies are checked as a
|
|
39
|
+
* whole, in the component scope they are declared in.
|
|
40
|
+
*/
|
|
41
|
+
export declare function refuseAmbiguousNilMemoArithmetic(memos: readonly MemoInfo[], ctx: NullishAttrContext, sink: AmbiguousNilArithmeticSink): void;
|
|
42
|
+
//# sourceMappingURL=ambiguous-nil-arithmetic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ambiguous-nil-arithmetic.d.ts","sourceRoot":"","sources":["../../src/adapters/ambiguous-nil-arithmetic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACvE,OAAO,EAKL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE1D;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,MAAM,E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;AAED,qFAAqF;AACrF,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,GAAG,yBAAyB,GAAG,IAAI,CAc7F;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,KAAK,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;CAAE,CAAA;AAEhE,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,WAAW,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC5C,cAAc,EAAE,SAAS,YAAY,EAAE,CAAA;IACvC,mDAAmD;IACnD,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;CAC/B;AAED,sCAAsC;AACtC,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,iBAAiB,GAAG,cAAc,CASxF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which values may hold a JS boolean that the backend received as data, for
|
|
3
|
+
* backends whose own stringification of such a value differs from JS's
|
|
4
|
+
* `String(boolean)`: Perl decodes a JSON `false` to an object that prints
|
|
5
|
+
* `0` (and `true` prints `1`). Unlike `collectBooleanValueNames`, the value
|
|
6
|
+
* need not be a boolean every time — an optional prop, a `boolean | string`
|
|
7
|
+
* union or a `??` fallback may also be absent or another type — so the
|
|
8
|
+
* backend routes it through its JS `String` helper, which prints every value
|
|
9
|
+
* kind as JS does, rather than through `bool_str`.
|
|
10
|
+
*/
|
|
11
|
+
import type { ParsedExpr } from '../expression-parser.ts';
|
|
12
|
+
import type { IRMetadata } from '../types.ts';
|
|
13
|
+
/**
|
|
14
|
+
* Signals, memos and props whose declared type admits a boolean, optional or
|
|
15
|
+
* not, plus signals seeded with a boolean literal and no declared type.
|
|
16
|
+
* `names` holds the bare spellings (a getter, a memo, a destructured prop),
|
|
17
|
+
* `props` the caller-facing keys a `props.<key>` member reads. Whether a
|
|
18
|
+
* binding shadows a name is the caller's scope question.
|
|
19
|
+
*/
|
|
20
|
+
export declare function collectBooleanCarrierNames(metadata: Pick<IRMetadata, 'signals' | 'memos' | 'propsParams' | 'propsObjectName'>): {
|
|
21
|
+
names: Set<string>;
|
|
22
|
+
props: Set<string>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Whether `expr` may evaluate to the value of a name `isCarrierName`
|
|
26
|
+
* accepts — a zero-argument getter call, a `props.<key>` member or a bare
|
|
27
|
+
* identifier — read directly, as an operand of `??` / `||` / `&&` (JS
|
|
28
|
+
* returns an operand, not a coerced boolean), or as a ternary branch.
|
|
29
|
+
*/
|
|
30
|
+
export declare function mayYieldBooleanCarrier(expr: ParsedExpr | null | undefined, isCarrierName: (name: string, componentProperty?: boolean) => boolean): boolean;
|
|
31
|
+
//# sourceMappingURL=boolean-carrier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean-carrier.d.ts","sourceRoot":"","sources":["../../src/adapters/boolean-carrier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,aAAa,CAAA;AASvD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,GAAG,aAAa,GAAG,iBAAiB,CAAC,GAClF;IAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAkB5C;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EACnC,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,KAAK,OAAO,GACpE,OAAO,CAgBT"}
|
|
@@ -39,6 +39,8 @@
|
|
|
39
39
|
*/
|
|
40
40
|
import { type ParsedExpr } from '../expression-parser.ts';
|
|
41
41
|
import type { IRMetadata } from '../types.ts';
|
|
42
|
+
import { type NativeSafeTable, type PrimitivePlan } from './primitive-plan.ts';
|
|
43
|
+
import { type ScopedOperandTyping } from './operand-typing.ts';
|
|
42
44
|
/**
|
|
43
45
|
* Whether `node` evaluates to a JS boolean: structurally, or, when the
|
|
44
46
|
* caller passes `isBooleanName`, through a leaf declared `boolean` — a
|
|
@@ -49,17 +51,29 @@ import type { IRMetadata } from '../types.ts';
|
|
|
49
51
|
*/
|
|
50
52
|
export declare function isBooleanResultParsed(node: ParsedExpr, isBooleanName?: (name: string, componentProperty?: boolean) => boolean): boolean;
|
|
51
53
|
/**
|
|
52
|
-
* Rewrites the boolean-result
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* `
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
54
|
+
* Rewrites the boolean-result values a mixed expression can evaluate to, so
|
|
55
|
+
* a taken boolean carries JS `String(boolean)` instead of Perl's `0` / `''`
|
|
56
|
+
* / `1`. The whole value isn't boolean-shaped, so `bool_str` can't wrap it.
|
|
57
|
+
*
|
|
58
|
+
* - A ternary branch (`yes() ? false : s()`, #3349): a literal `true` /
|
|
59
|
+
* `false` becomes the string literal `'true'` / `'false'`, any other
|
|
60
|
+
* boolean-result branch `b` becomes `b ? 'true' : 'false'`.
|
|
61
|
+
* - An operand JS `&&` / `||` / `??` returns (`n > 0 && 'y'`): the left
|
|
62
|
+
* operand is returned only when it decides the result, so its rewritten
|
|
63
|
+
* form `l'` (the operand stringified, a nested chain or a ternary
|
|
64
|
+
* rewritten likewise) is what the expression yields then, while the
|
|
65
|
+
* original operand stays the test: `l && r` becomes `l ? r : l'` and
|
|
66
|
+
* `l || r` becomes `l ? l' : r`. `l ?? r` becomes `l' ?? r`, since the
|
|
67
|
+
* rewrite keeps nullishness. A boolean-result `l` gives `b ? r :
|
|
68
|
+
* 'false'` and `b ? 'true' : r`. The right operand is rewritten as a
|
|
69
|
+
* branch.
|
|
70
|
+
*
|
|
71
|
+
* The existing lowering then renders the rewritten tree unchanged. Nested
|
|
72
|
+
* values are rewritten recursively; a tree with nothing to rewrite is
|
|
73
|
+
* returned as is (the same object). Only an output position may take the
|
|
74
|
+
* rewrite: a `'false'` string is truthy.
|
|
61
75
|
*/
|
|
62
|
-
export declare function
|
|
76
|
+
export declare function stringifyBooleanBranches(node: ParsedExpr): ParsedExpr;
|
|
63
77
|
/**
|
|
64
78
|
* Names whose value is always a JS boolean, for {@link isBooleanResultParsed}'s
|
|
65
79
|
* `isBooleanName` (#3443):
|
|
@@ -89,6 +103,14 @@ export declare function collectBooleanValueNames(metadata: Pick<IRMetadata, 'sig
|
|
|
89
103
|
* unparseable expression is not boolean-result.
|
|
90
104
|
*/
|
|
91
105
|
export declare function isBooleanResultExpr(expr: string): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* The ToBoolean plan (`planTest`, #3824) of a test whose `ParsedExpr` the IR
|
|
108
|
+
* does not carry: a template literal's ternary part, which holds only its
|
|
109
|
+
* condition text. It reads the same tree {@link isBooleanResultExpr} always
|
|
110
|
+
* parsed for such a test. A test the IR carries a tree for is planned with
|
|
111
|
+
* `planTest` on that tree.
|
|
112
|
+
*/
|
|
113
|
+
export declare function planTestOfSource(expr: string, typing: ScopedOperandTyping, target: NativeSafeTable): PrimitivePlan | null;
|
|
92
114
|
/**
|
|
93
115
|
* True when `expr`'s top-level shape is an explicit one-argument JS
|
|
94
116
|
* `String(x)` call (the `EVAL_BUILTIN_IDENTS` builtin the compiler
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean-result.d.ts","sourceRoot":"","sources":["../../src/adapters/boolean-result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"boolean-result.d.ts","sourceRoot":"","sources":["../../src/adapters/boolean-result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,aAAa,CAAA;AACvD,OAAO,EAA0B,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACtG,OAAO,EAAiC,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAE7F;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,UAAU,EAChB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,KAAK,OAAO,GACrE,OAAO,CAKT;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAqBrE;AAaD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,GAAG,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,CAAC,GACrG;IAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAqD5C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIzD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,eAAe,GAAG,aAAa,GAAG,IAAI,CAGzH;AAOD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAS1D;AA0CD,2DAA2D;AAC3D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static text in a template engine whose tags open with a brace — Jinja,
|
|
3
|
+
* MiniJinja, Twig and Pebble (`{{`, `{%`, `{#`), Go `html/template` (`{{`)
|
|
4
|
+
* — must never put a tag opener into the template: JSX text such as
|
|
5
|
+
* `{{ 1 }}` decodes to `{{ 1 }}`, which Hono prints as
|
|
6
|
+
* written but such an engine compiles as a tag, and so prints `1` or fails
|
|
7
|
+
* to parse.
|
|
8
|
+
*
|
|
9
|
+
* Every `{` that is followed by one of `followers` (the characters that turn
|
|
10
|
+
* a `{` into a tag opener on this engine) is emitted through `literal`
|
|
11
|
+
* instead — an output expression for the brace itself (`{{ '{' }}`,
|
|
12
|
+
* `{{"{"}}`). So is a `{` that ends the text: the text cannot know what the
|
|
13
|
+
* adapter writes after it, and a following output tag (`{{ x }}`) would turn
|
|
14
|
+
* that brace into part of a longer opener. The expression renders the same
|
|
15
|
+
* character either way.
|
|
16
|
+
*/
|
|
17
|
+
export declare function escapeBraceDelimiters(text: string, followers: string, literal: string): string;
|
|
18
|
+
//# sourceMappingURL=brace-delimiter-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brace-delimiter-text.d.ts","sourceRoot":"","sources":["../../src/adapters/brace-delimiter-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAQ9F"}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* support gate refuses it (`unboundCallbackParamRead`), because no DSL
|
|
16
16
|
* runtime binds those.
|
|
17
17
|
*/
|
|
18
|
+
import type { ScopedOperandTyping } from './operand-typing.ts';
|
|
18
19
|
import { type ParsedExpr, type SortComparator } from '../expression-parser.ts';
|
|
19
20
|
type Arrow = Extract<ParsedExpr, {
|
|
20
21
|
kind: 'arrow';
|
|
@@ -48,8 +49,37 @@ export interface CallbackEvalPlan {
|
|
|
48
49
|
kind: 'eval';
|
|
49
50
|
helper: CallbackEvalHelper;
|
|
50
51
|
operands: CallbackEvalOperand[];
|
|
51
|
-
captured:
|
|
52
|
+
captured: CallbackCapture[];
|
|
52
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* A free name of an evaluator body and the expression whose SSR value the
|
|
56
|
+
* env binds it to: the name itself, or, for a lifted `props.X` read (see
|
|
57
|
+
* {@link evalBody}), that read.
|
|
58
|
+
*/
|
|
59
|
+
export interface CallbackCapture {
|
|
60
|
+
name: string;
|
|
61
|
+
value: ParsedExpr;
|
|
62
|
+
}
|
|
63
|
+
/** A callback body the runtime evaluator can run: its JSON and its env. */
|
|
64
|
+
export interface EvalBody {
|
|
65
|
+
json: string;
|
|
66
|
+
captured: CallbackCapture[];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Serialize a callback body for the runtime evaluator, with the captures its
|
|
70
|
+
* env needs; `null` when the body is outside the evaluator surface. `bound`
|
|
71
|
+
* are the callback's own params. `propsObject` is the component's props
|
|
72
|
+
* object identifier (`BindingScope.propsObject` / `propsObjectIdentifier`):
|
|
73
|
+
* `props`, or the props parameter's own name (`function C(p)`).
|
|
74
|
+
*
|
|
75
|
+
* A template has no props object: the props are its top-level variables,
|
|
76
|
+
* and the adapters spell `props.X` as the variable `X`. So each `props.X` the
|
|
77
|
+
* body reads, where no param binds `props`, becomes a fresh env name bound to
|
|
78
|
+
* the read itself, which the adapter spells as it spells `props.X` anywhere
|
|
79
|
+
* else. Capturing `props` whole would bind it to an undefined template
|
|
80
|
+
* variable, and the predicate would read every `props.X` as `undefined`.
|
|
81
|
+
*/
|
|
82
|
+
export declare function evalBody(body: ParsedExpr, bound: ReadonlySet<string>, propsObject: string, typing?: ScopedOperandTyping): EvalBody | null;
|
|
53
83
|
/**
|
|
54
84
|
* A lowered `.sort` / `.toSorted` comparator: the evaluator call, the
|
|
55
85
|
* structured `{keys: …}` descriptor for a comparator the evaluator cannot
|
|
@@ -89,21 +119,24 @@ export interface CallbackLoweringOptions {
|
|
|
89
119
|
*/
|
|
90
120
|
nativePredicate?: boolean;
|
|
91
121
|
}
|
|
92
|
-
/**
|
|
93
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Lower `<recv>.<method>(arrow, ...restArgs)`. `propsObject`: the
|
|
124
|
+
* component's props object identifier (see {@link evalBody}).
|
|
125
|
+
*/
|
|
126
|
+
export declare function lowerCallbackMethod(method: string, arrow: Arrow, restArgs: readonly ParsedExpr[], options: CallbackLoweringOptions, propsObject: string): CallbackPlan;
|
|
94
127
|
/**
|
|
95
128
|
* Lower a `.sort` / `.toSorted` comparator: the evaluator first, then the
|
|
96
129
|
* structured `{keys: …}` descriptor, otherwise BF101. A loop source's sort
|
|
97
130
|
* (`planLoop`) and `.sort(cmp)` at an expression position decide the same.
|
|
98
131
|
*/
|
|
99
|
-
export declare function lowerSortComparator(method: 'sort' | 'toSorted', arrow: Arrow, adapterName: string): SortPlan;
|
|
132
|
+
export declare function lowerSortComparator(method: 'sort' | 'toSorted', arrow: Arrow, adapterName: string, propsObject: string): SortPlan;
|
|
100
133
|
/**
|
|
101
134
|
* The evaluator plan for a sort comparator, or `null` when the body is
|
|
102
135
|
* outside the evaluator surface (a `localeCompare` comparator) or the arrow
|
|
103
136
|
* has fewer than the two params a comparator needs. The loop-source sort
|
|
104
137
|
* shares this with `.sort(cmp)` at an expression position.
|
|
105
138
|
*/
|
|
106
|
-
export declare function sortEvalPlan(body: ParsedExpr, params: readonly string[]): CallbackEvalPlan | null;
|
|
139
|
+
export declare function sortEvalPlan(body: ParsedExpr, params: readonly string[], propsObject: string): CallbackEvalPlan | null;
|
|
107
140
|
/** The BF101 for a comparator neither the evaluator nor the descriptor can model. */
|
|
108
141
|
export declare function sortRefusal(method: string, adapterName: string): {
|
|
109
142
|
kind: 'refuse';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback-method.d.ts","sourceRoot":"","sources":["../../src/adapters/callback-method.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"callback-method.d.ts","sourceRoot":"","sources":["../../src/adapters/callback-method.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAOL,KAAK,UAAU,EACf,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAA;AAEhC,KAAK,KAAK,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAA;AAEnD,mDAAmD;AACnD,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,OAAO,GACP,MAAM,GACN,MAAM,GACN,WAAW,GACX,UAAU,GACV,eAAe,CAAA;AAYnB,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,eAAe,CAE3E;AAED,oFAAoF;AACpF,MAAM,MAAM,kBAAkB,GAC1B,WAAW,GACX,aAAa,GACb,aAAa,GACb,YAAY,GACZ,WAAW,GACX,WAAW,GACX,iBAAiB,GACjB,eAAe,GACf,UAAU,CAAA;AAEd,uEAAuE;AACvE,MAAM,MAAM,mBAAmB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AAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAKlH"}
|
|
@@ -76,6 +76,13 @@ export interface ComponentPropsOptions {
|
|
|
76
76
|
propsObjectName: string | null;
|
|
77
77
|
/** The analyzer-extracted props params, which `{...props}` enumerates. */
|
|
78
78
|
propsParams: ReadonlyArray<ComponentPropsParam>;
|
|
79
|
+
/**
|
|
80
|
+
* Whether the backend's runtime records which keys each component's
|
|
81
|
+
* caller passed, so a template can ask it whether a param was passed
|
|
82
|
+
* rather than whether it is nil (the DSL runtimes' `passed(name,
|
|
83
|
+
* fallback)`). See {@link propsSpreadParam}.
|
|
84
|
+
*/
|
|
85
|
+
callerKeys?: boolean;
|
|
79
86
|
}
|
|
80
87
|
/** What a call has set before a `{...props}` spread, as far as the compiler can see. */
|
|
81
88
|
export interface EarlierComponentProps {
|
|
@@ -96,13 +103,19 @@ export interface EarlierComponentProps {
|
|
|
96
103
|
* - `'present'`: carried only when the caller passed it, so an absent param
|
|
97
104
|
* leaves the earlier value alone.
|
|
98
105
|
*
|
|
99
|
-
* A template
|
|
100
|
-
* `null` one as the same nil, so "passed"
|
|
101
|
-
* caller that passes `
|
|
102
|
-
*
|
|
106
|
+
* A template engine reads an absent prop and an explicit `undefined` or
|
|
107
|
+
* `null` one as the same nil, so "passed" can't be spelled "not nil": a
|
|
108
|
+
* caller that passes `null` must still override the earlier value, as JS
|
|
109
|
+
* does. With `callerKeys`, the runtime answers "passed" from the keys the
|
|
110
|
+
* caller actually handed over, and every optional param is `'present'`:
|
|
111
|
+
* an `'entry'` would hand the child the key even when the caller left it
|
|
112
|
+
* out, and the child would then read it as passed (a nil overriding its
|
|
113
|
+
* own earlier prop in a further `{...props}`). Without `callerKeys` (Go,
|
|
114
|
+
* whose Input struct can't tell the two nils apart), "passed" is "not
|
|
115
|
+
* nil", and an explicit nil keeps the earlier value (limitation
|
|
103
116
|
* `props-spread-explicit-null-override`).
|
|
104
117
|
*/
|
|
105
|
-
export declare function propsSpreadParam(param: ComponentPropsParam, earlier: EarlierComponentProps): 'entry' | 'present';
|
|
118
|
+
export declare function propsSpreadParam(param: ComponentPropsParam, earlier: EarlierComponentProps, callerKeys?: boolean): 'entry' | 'present';
|
|
106
119
|
/** The key an entry sets in the props hash. */
|
|
107
120
|
export declare function componentPropKey(entry: ComponentPropEntry): string;
|
|
108
121
|
/**
|
|
@@ -126,8 +139,10 @@ export interface ComponentPropSpelling {
|
|
|
126
139
|
spread(value: SpreadAttr): string;
|
|
127
140
|
/**
|
|
128
141
|
* The expression a `present-param` segment folds in like a spread: a
|
|
129
|
-
* one-key hash `{ name: <param> }` when the
|
|
130
|
-
* hash when it is
|
|
142
|
+
* one-key hash `{ name: <param> }` when the caller passed the param, an
|
|
143
|
+
* empty hash when it did not. "Passed" is the runtime's
|
|
144
|
+
* `passed('<name>', <param is not nil>)`: the caller's keys when the
|
|
145
|
+
* runtime recorded them, the nil test otherwise.
|
|
131
146
|
*/
|
|
132
147
|
presentParam(name: string): string;
|
|
133
148
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-props.d.ts","sourceRoot":"","sources":["../../src/adapters/component-props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAG7E,mCAAmC;AACnC,MAAM,MAAM,kBAAkB;AAC5B,gFAAgF;AAC9E;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE;AACnD,wFAAwF;GACtF;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE;AAC1D,8FAA8F;GAC5F;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA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AE/F;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAM3G"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* shadow the name are respected.
|
|
16
16
|
*/
|
|
17
17
|
import { type ParsedExpr } from '../expression-parser.ts';
|
|
18
|
-
import type { ExpressionAttr, IRMetadata } from '../types.ts';
|
|
18
|
+
import type { ExpressionAttr, IRMetadata, ParamInfo } from '../types.ts';
|
|
19
19
|
export interface ComputedConstContext {
|
|
20
20
|
constants: IRMetadata['localConstants'] | undefined;
|
|
21
21
|
/** Signal getters and memo names: the zero-arg calls a template reads as values. */
|
|
@@ -24,6 +24,28 @@ export interface ComputedConstContext {
|
|
|
24
24
|
contextConsumers: ReadonlySet<string>;
|
|
25
25
|
/** Consts a props destructure binds, which the adapter binds as props params. */
|
|
26
26
|
propsBindings: ReadonlySet<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Component-scope names that hold a prop as passed, with the prop's
|
|
29
|
+
* caller-facing key: a destructured signature param (`{ children: kids }`
|
|
30
|
+
* → `kids` → `children`) or a props destructure const. Empty when the
|
|
31
|
+
* props object identifier names something else.
|
|
32
|
+
*/
|
|
33
|
+
propReads: ReadonlyMap<string, string>;
|
|
34
|
+
/** Component-scope local functions, which shadow a module const of the same name. */
|
|
35
|
+
localFunctions: ReadonlySet<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Names the component scope lexically binds (the props object, destructured
|
|
38
|
+
* and rest props, its consts, local functions, signals, memos), which
|
|
39
|
+
* shadow a module binding of the same name. A module const's initializer
|
|
40
|
+
* never reads one of them. A prop reachable only through the props object
|
|
41
|
+
* (`function C(props: { label: string })`) binds no name.
|
|
42
|
+
*/
|
|
43
|
+
componentNames: ReadonlySet<string>;
|
|
44
|
+
/** The component's props params and props object name, which type an index read (`keyedValue`). */
|
|
45
|
+
props: {
|
|
46
|
+
params: readonly ParamInfo[];
|
|
47
|
+
objectName: string | null;
|
|
48
|
+
};
|
|
27
49
|
/** Whether a loop row or callback binds `name` where the expression is read. */
|
|
28
50
|
isShadowed(name: string): boolean;
|
|
29
51
|
/** Whether the adapter binds the const `name` itself, so a read of it stays as written. */
|
|
@@ -37,6 +59,11 @@ export interface ComputedConstContext {
|
|
|
37
59
|
}
|
|
38
60
|
/** The {@link ComputedConstContext} fields that come from the component's metadata. */
|
|
39
61
|
export declare function computedConstContext(metadata: IRMetadata, isShadowed: (name: string) => boolean, isAdapterBound?: (name: string) => boolean): ComputedConstContext;
|
|
62
|
+
/**
|
|
63
|
+
* {@link ComputedConstContext.componentNames}. Not `componentBindings`, which
|
|
64
|
+
* also lists every typed prop of a props object as a `prop` binding.
|
|
65
|
+
*/
|
|
66
|
+
export declare function componentScopeNames(metadata: Pick<IRMetadata, 'propsObjectName' | 'propsParams' | 'restPropsName' | 'localConstants' | 'localFunctions' | 'signals' | 'memos'>): Set<string>;
|
|
40
67
|
/**
|
|
41
68
|
* `expr` with each read of a computed const replaced by its initializer,
|
|
42
69
|
* repeated so a const read inside an initializer is replaced too.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computed-const.d.ts","sourceRoot":"","sources":["../../src/adapters/computed-const.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"computed-const.d.ts","sourceRoot":"","sources":["../../src/adapters/computed-const.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAuF,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAC9I,OAAO,KAAK,EAAgB,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAItF,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,UAAU,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAA;IACnD,oFAAoF;IACpF,OAAO,EAAE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;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,oBAAoB,GAAG,IAAI,GAAG,cAAc,CAQ/G"}
|
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
* template language; how one compile begins and ends lives here once.
|
|
6
6
|
*/
|
|
7
7
|
import { type LoweringMatcher } from '../lowering-registry.ts';
|
|
8
|
-
import {
|
|
8
|
+
import type { ParsedExpr } from '../expression-parser.ts';
|
|
9
|
+
import { type ArithmeticCoercion, type NullishAttrContext } from '../nullable-signal-attr.ts';
|
|
9
10
|
import { BindingScope } from '../scope/binding-scope.ts';
|
|
11
|
+
import { type DeclaredValueTypes } from './loop-row-type.ts';
|
|
12
|
+
import { type OperandTyping, type ScopedOperandTyping } from './operand-typing.ts';
|
|
10
13
|
import type { CompilerError, ComponentIR, ConstantInfo, IRIfStatement, IRLoop, IRMetadata, PreambleValueDeclaration } from '../types.ts';
|
|
11
14
|
import { type ComputedConstContext } from './computed-const.ts';
|
|
12
15
|
import { BaseAdapter, type AdapterGenerateOptions, type AdapterOutput } from './interface.ts';
|
|
@@ -93,6 +96,14 @@ export declare abstract class DslTemplateAdapter extends BaseAdapter {
|
|
|
93
96
|
protected booleanTypedProps: Set<string>;
|
|
94
97
|
/** Names (signal getters + props) whose value is a string (`stringValueNamesFor`). */
|
|
95
98
|
protected stringValueNames: Set<string>;
|
|
99
|
+
/** The declared types a loop row's type is read from (`loopRowType`, #3762). */
|
|
100
|
+
protected declaredTypes: DeclaredValueTypes | null;
|
|
101
|
+
/**
|
|
102
|
+
* The component's operand typing (`collectOperandTyping`), which the
|
|
103
|
+
* emitters' primitive plans read through the scope at the emission site
|
|
104
|
+
* (`operandTypingAt`, #3824).
|
|
105
|
+
*/
|
|
106
|
+
protected operandTyping: OperandTyping;
|
|
96
107
|
/**
|
|
97
108
|
* Module-scope pure-string consts (`const x = 'literal'`), keyed by name →
|
|
98
109
|
* unescaped value. A className template literal that references such a
|
|
@@ -180,8 +191,35 @@ export declare abstract class DslTemplateAdapter extends BaseAdapter {
|
|
|
180
191
|
* above and before any diagnostic or rendering.
|
|
181
192
|
*/
|
|
182
193
|
protected resetAdapterState(_ir: ComponentIR): void;
|
|
194
|
+
/**
|
|
195
|
+
* Whether `name` (a signal getter, prop, local constant or loop binding)
|
|
196
|
+
* holds a string value at `scope`, which picks the template's string
|
|
197
|
+
* concatenation for a JS `+` (`isStringConcatBinary`). A loop row or
|
|
198
|
+
* callback binding of the same name shadows the outer typing; a row field
|
|
199
|
+
* read (`path`: `row.id`) takes the row type's declared field type.
|
|
200
|
+
* `componentProperty`: read as `props.<name>`.
|
|
201
|
+
*/
|
|
202
|
+
protected isStringValueNameAt(name: string, componentProperty?: boolean, path?: readonly string[], scope?: BindingScope): boolean;
|
|
203
|
+
/** The component's operand typing at `scope` (the emission site's, by default). */
|
|
204
|
+
protected operandTypingAt(scope?: BindingScope): ScopedOperandTyping;
|
|
183
205
|
/** `render()` under `scope`, the current scope restored afterwards. */
|
|
184
206
|
protected renderInScope<T>(scope: BindingScope, render: () => T): T;
|
|
207
|
+
/**
|
|
208
|
+
* The coercion an arithmetic operand's emitter spells
|
|
209
|
+
* (`arithmeticOperandCoercion`), refusing an operand whose nil the
|
|
210
|
+
* declared type cannot classify (`arithmeticCoercionOrRefuse`, #3700).
|
|
211
|
+
* `isShadowed` is the adapter's scope test at the emission site.
|
|
212
|
+
*/
|
|
213
|
+
protected arithmeticCoercion(op: string, operand: ParsedExpr, other: ParsedExpr | undefined, isShadowed: (name: string) => boolean): ArithmeticCoercion;
|
|
214
|
+
/**
|
|
215
|
+
* Refuse the ambiguous-nil arithmetic (#3700) in a whole expression the
|
|
216
|
+
* adapter lowers through its own renderer rather than per operator: a
|
|
217
|
+
* `.filter()` predicate, read in the current scope with the callback's
|
|
218
|
+
* own `params` (its parameter and block locals) entered as a callback
|
|
219
|
+
* frame.
|
|
220
|
+
*/
|
|
221
|
+
protected refuseAmbiguousNilArithmeticIn(expr: ParsedExpr, params: readonly string[]): void;
|
|
222
|
+
private ambiguousNilSink;
|
|
185
223
|
/** {@link planLoop} against the current scope and the component's constants. */
|
|
186
224
|
protected loopPlanFor<Spelled>(loop: IRLoop, spelling: LoopPlanSpelling<Spelled>): LoopPlan<Spelled>;
|
|
187
225
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dsl-template-adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/dsl-template-adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACvF,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"dsl-template-adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/dsl-template-adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAmC,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAC7F,OAAO,EAA8C,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAE9H,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,MAAM,EACN,UAAU,EACV,wBAAwB,EACzB,MAAM,aAAa,CAAA;AASpB,OAAO,EAAwB,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAErF,OAAO,EAAE,WAAW,EAAE,KAAK,sBAAsB,EAAE,KAAK,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,eAAe,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAAA;IAE3D,QAAQ,CAAC,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,aAAa,CA4BzE;IAED,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,oBAAoB;CAmB7B"}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Every name a `.map()`/`.filter()` loop callback binds as its item or
|
|
3
3
|
* index parameter, anywhere in a component's IR tree (#2212 review
|
|
4
|
-
* finding).
|
|
4
|
+
* finding).
|
|
5
|
+
*
|
|
6
|
+
* The string-typing use described below is retired: every template adapter
|
|
7
|
+
* now resolves a name's string typing at the read through the shared
|
|
8
|
+
* `BindingScope` (#3762), and no longer subtracts this set. The remaining
|
|
9
|
+
* callers use it as a whole-component "may be shadowed somewhere" set
|
|
10
|
+
* (root prop aliases, Go's static loop sources, Xslate's memo seeds).
|
|
11
|
+
*
|
|
12
|
+
* Original rationale: `isStringTypedOperand`'s identifier arm resolves a bare
|
|
5
13
|
* identifier against `collectStringValueNames`'s flat, scope-BLIND
|
|
6
14
|
* `Set<string>` — so a loop callback whose param happens to reuse a
|
|
7
15
|
* string prop's name (`items.map((name) => ... 1 + name ...)`, where the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop-bound-names.d.ts","sourceRoot":"","sources":["../../src/adapters/loop-bound-names.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"loop-bound-names.d.ts","sourceRoot":"","sources":["../../src/adapters/loop-bound-names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAU,MAAM,aAAa,CAAA;AAEtD,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAmElE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The declared element type of the array a loop ranges over, read from the
|
|
3
|
+
* component's IR: a prop (`props.rows`, a destructured `rows`), a signal or
|
|
4
|
+
* memo getter (`items()`), a row field of an enclosing loop (`r.tags`), an
|
|
5
|
+
* index into one of those, and a `filter` / `slice` / `sort` chain over them.
|
|
6
|
+
* A template adapter enters a loop row with it as
|
|
7
|
+
* `LoopBindingSource.rowType`, so the row's bindings resolve their field types
|
|
8
|
+
* at the read (`row.id`, a destructured `id`) through the shared
|
|
9
|
+
* `BindingScope` (#3762). The IR's `itemType` carries scalar evidence only.
|
|
10
|
+
*/
|
|
11
|
+
import type { ParsedExpr } from '../expression-parser.ts';
|
|
12
|
+
import type { ComponentIR, TypeInfo } from '../types.ts';
|
|
13
|
+
import { type BindingScope, type LoopValueType, type NamedTypeFields } from '../scope/binding-scope.ts';
|
|
14
|
+
/** What a component declares about the types of the values it reads. */
|
|
15
|
+
export interface DeclaredValueTypes {
|
|
16
|
+
readonly propsParams: readonly {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly type: TypeInfo;
|
|
19
|
+
readonly declaredType?: TypeInfo;
|
|
20
|
+
readonly isRest?: boolean;
|
|
21
|
+
}[];
|
|
22
|
+
readonly signals: readonly {
|
|
23
|
+
readonly getter: string;
|
|
24
|
+
readonly type: TypeInfo;
|
|
25
|
+
}[];
|
|
26
|
+
readonly memos: readonly {
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly type: TypeInfo;
|
|
29
|
+
}[];
|
|
30
|
+
/** The identifier the component reads its props object as (`props`); null for a destructured signature. */
|
|
31
|
+
readonly propsObjectName: string | null;
|
|
32
|
+
readonly namedFields: NamedTypeFields;
|
|
33
|
+
}
|
|
34
|
+
/** {@link DeclaredValueTypes} of a component. */
|
|
35
|
+
export declare function declaredValueTypes(ir: ComponentIR): DeclaredValueTypes;
|
|
36
|
+
/** The element type of the array `loop` ranges over; null when it is not declared. */
|
|
37
|
+
export declare function loopRowType(types: DeclaredValueTypes, loop: {
|
|
38
|
+
readonly arrayParsed?: ParsedExpr;
|
|
39
|
+
readonly iterationShape?: string;
|
|
40
|
+
readonly objectIteration?: unknown;
|
|
41
|
+
}, scope: BindingScope): LoopValueType | null;
|
|
42
|
+
/**
|
|
43
|
+
* The type of `receiver.concat(...args)`: an array whose element type is the
|
|
44
|
+
* union of the receiver's element type and each argument's (an array
|
|
45
|
+
* argument's elements, or the argument itself). A field read on a row of it
|
|
46
|
+
* is then a definite string only when it is one in every member
|
|
47
|
+
* (`loopValueTypeAt`), so an `any[]` argument or a field one member lacks
|
|
48
|
+
* types nothing (#3762 review). An argument of unknown type leaves the
|
|
49
|
+
* result with no element type.
|
|
50
|
+
*/
|
|
51
|
+
export declare function concatType<T extends LoopValueType>(receiver: T | null, args: readonly (T | null)[]): T | null;
|
|
52
|
+
//# sourceMappingURL=loop-row-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-row-type.d.ts","sourceRoot":"","sources":["../../src/adapters/loop-row-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAA;AAUlC,wEAAwE;AACxE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,WAAW,EAAE,SAAS;QAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;QACrB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;QACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAA;QAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAC1B,EAAE,CAAA;IACH,QAAQ,CAAC,OAAO,EAAE,SAA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