@barefootjs/jsx 0.39.9 → 0.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/ambiguous-nil-arithmetic.d.ts +41 -0
- package/dist/adapters/ambiguous-nil-arithmetic.d.ts.map +1 -0
- package/dist/adapters/attr-plan.d.ts +1 -20
- 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/component-props.d.ts +22 -7
- package/dist/adapters/component-props.d.ts.map +1 -1
- package/dist/adapters/computed-const.d.ts +17 -0
- package/dist/adapters/computed-const.d.ts.map +1 -1
- package/dist/adapters/dsl-template-adapter.d.ts +95 -2
- package/dist/adapters/dsl-template-adapter.d.ts.map +1 -1
- package/dist/adapters/loop-plan.d.ts +41 -1
- package/dist/adapters/loop-plan.d.ts.map +1 -1
- package/dist/adapters/number-value.d.ts +43 -0
- package/dist/adapters/number-value.d.ts.map +1 -0
- package/dist/analyzer-context.d.ts +7 -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.map +1 -1
- package/dist/css-layer-prefixer.d.ts.map +1 -1
- package/dist/debug.d.ts.map +1 -1
- package/dist/expression-parser.d.ts.map +1 -1
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2102 -1344
- 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 +20 -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/plan/build-static-array-child-init.d.ts.map +1 -1
- package/dist/ir-to-client-js/plan/static-array-child-init.d.ts +7 -1
- package/dist/ir-to-client-js/plan/static-array-child-init.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.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 +9 -1
- package/dist/ir-to-client-js/utils.d.ts.map +1 -1
- package/dist/jsx-to-ir.d.ts.map +1 -1
- package/dist/module-exports.d.ts.map +1 -1
- package/dist/nullable-signal-attr.d.ts +29 -3
- package/dist/nullable-signal-attr.d.ts.map +1 -1
- package/dist/props-binding.d.ts +27 -3
- package/dist/props-binding.d.ts.map +1 -1
- package/dist/scope/binding-scope.d.ts +24 -1
- package/dist/scope/binding-scope.d.ts.map +1 -1
- package/dist/scope/root-prop-alias.d.ts +14 -1
- 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/template-parts.d.ts +1 -1
- package/dist/template-parts.d.ts.map +1 -1
- package/dist/types.d.ts +35 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/attr-plan.test.ts +1 -14
- package/src/__tests__/binding-scope-ratchet.test.ts +12 -2
- package/src/__tests__/boolean-carrier.test.ts +74 -0
- package/src/__tests__/client-template-escape-soundness.test.ts +17 -4
- package/src/__tests__/client-template-static-delimiters.test.ts +57 -0
- package/src/__tests__/component-props.test.ts +14 -0
- package/src/__tests__/computed-const.test.ts +85 -0
- package/src/__tests__/dsl-template-adapter.test.ts +70 -0
- package/src/__tests__/expression-parser.test.ts +24 -0
- package/src/__tests__/extract-function-params.test.ts +37 -0
- package/src/__tests__/issue-2960-multi-root-cond-same-tag.test.ts +18 -0
- package/src/__tests__/issue-3688-props-spread-child-csr.test.ts +142 -0
- package/src/__tests__/jsx-text-linebreak-whitespace.test.ts +11 -0
- package/src/__tests__/loop-plan.test.ts +66 -1
- package/src/__tests__/loop-row-prop-read.test.ts +111 -0
- package/src/__tests__/memo-body-expr.test.ts +137 -0
- package/src/__tests__/nullable-signal-attr.test.ts +97 -2
- package/src/__tests__/profile-binding-ids.test.ts +14 -0
- package/src/__tests__/root-prop-alias.test.ts +34 -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__/template-parts-literal-boundary.test.ts +41 -0
- package/src/adapters/ambiguous-nil-arithmetic.ts +94 -0
- package/src/adapters/attr-plan.ts +8 -56
- package/src/adapters/boolean-carrier.ts +76 -0
- package/src/adapters/component-props.ts +28 -8
- package/src/adapters/computed-const.ts +206 -7
- package/src/adapters/dsl-template-adapter.ts +183 -2
- package/src/adapters/loop-plan.ts +67 -2
- package/src/adapters/number-value.ts +95 -0
- package/src/analyzer-context.ts +8 -0
- package/src/analyzer.ts +187 -66
- package/src/augment-inherited-props.ts +5 -9
- package/src/css-layer-prefixer.ts +4 -5
- package/src/debug.ts +1 -0
- package/src/expression-parser.ts +4 -1
- package/src/index.ts +23 -5
- package/src/ir-to-client-js/collect-elements.ts +104 -46
- package/src/ir-to-client-js/compute-inlinability.ts +2 -2
- 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 +79 -4
- 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 +1 -0
- 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 +3 -2
- package/src/ir-to-client-js/control-flow/stringify/claim-plan.ts +27 -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 +122 -75
- package/src/ir-to-client-js/plan/build-static-array-child-init.ts +11 -1
- package/src/ir-to-client-js/plan/static-array-child-init.ts +7 -1
- 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 +6 -4
- package/src/ir-to-client-js/types.ts +23 -0
- package/src/ir-to-client-js/utils.ts +16 -2
- package/src/jsx-to-ir.ts +112 -55
- package/src/loop-destructure.ts +4 -1
- package/src/module-exports.ts +13 -21
- package/src/nullable-signal-attr.ts +134 -13
- package/src/props-binding.ts +54 -3
- package/src/rich-type-refusal.ts +3 -1
- package/src/scope/binding-scope.ts +35 -2
- package/src/scope/root-prop-alias.ts +17 -1
- 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/template-parts.ts +25 -3
- package/src/template-position-walk.ts +3 -1
- package/src/types.ts +32 -1
|
@@ -0,0 +1,41 @@
|
|
|
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. Asked at the emission site so the operand is
|
|
21
|
+
* classified in the scope it is read in (`isShadowed`). One error per
|
|
22
|
+
* operand text per compile.
|
|
23
|
+
*/
|
|
24
|
+
export declare function arithmeticCoercionOrRefuse(op: string, operand: ParsedExpr, other: ParsedExpr | undefined, ctx: NullishAttrContext, isShadowed: (name: string) => boolean, sink: AmbiguousNilArithmeticSink): ArithmeticCoercion;
|
|
25
|
+
/**
|
|
26
|
+
* Refuse (BF101) each arithmetic operand in a whole expression that a
|
|
27
|
+
* template adapter lowers without asking {@link arithmeticCoercionOrRefuse}
|
|
28
|
+
* per operator: a `.filter()` predicate, an expression the runtime evaluator
|
|
29
|
+
* runs, a condition lowered by its own renderer (`ambiguousNilArithmeticOperands`).
|
|
30
|
+
* `scope` is the scope the expression is read in.
|
|
31
|
+
*/
|
|
32
|
+
export declare function refuseAmbiguousNilArithmetic(expr: ParsedExpr, ctx: NullishAttrContext, scope: BindingScope, sink: AmbiguousNilArithmeticSink): void;
|
|
33
|
+
/**
|
|
34
|
+
* Refuse the ambiguous arithmetic in the component's memo bodies. A template
|
|
35
|
+
* adapter seeds every memo at SSR, and some seed a memo through a path that
|
|
36
|
+
* never reaches its operator emitter (a static seed after a speculative
|
|
37
|
+
* lowering, a constructor-time evaluation), so the bodies are checked as a
|
|
38
|
+
* whole, in the component scope they are declared in.
|
|
39
|
+
*/
|
|
40
|
+
export declare function refuseAmbiguousNilMemoArithmetic(memos: readonly MemoInfo[], ctx: NullishAttrContext, sink: AmbiguousNilArithmeticSink): void;
|
|
41
|
+
//# 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,EAIL,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,EAAE,aAAa,EAAE,CAAA;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC/B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,UAAU,GAAG,SAAS,EAC7B,GAAG,EAAE,kBAAkB,EACvB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,EACrC,IAAI,EAAE,0BAA0B,GAC/B,kBAAkB,CAKpB;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,kBAAkB,EACvB,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,0BAA0B,GAC/B,IAAI,CAIN;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,GAAG,EAAE,kBAAkB,EACvB,IAAI,EAAE,0BAA0B,GAC/B,IAAI,CAIN"}
|
|
@@ -10,27 +10,8 @@
|
|
|
10
10
|
* hash literal.
|
|
11
11
|
*/
|
|
12
12
|
import { type ParsedExpr } from '../expression-parser.ts';
|
|
13
|
-
import type { LoweringMatcher } from '../lowering-registry.ts';
|
|
14
13
|
import { type NullishAttrContext } from '../nullable-signal-attr.ts';
|
|
15
|
-
import type {
|
|
16
|
-
/**
|
|
17
|
-
* Whether an attribute value is a shape no template lowers: a JS object
|
|
18
|
-
* literal (`style={{…}}` aside, which the adapter lowers first) or a
|
|
19
|
-
* tagged template literal (`cn\`base ${tone()}\``). Returns the refusal, with
|
|
20
|
-
* the support gate's reason when it gives one, or `null` when the value
|
|
21
|
-
* goes on to {@link planAttrExpression}. The adapter reports BF101 in its own
|
|
22
|
-
* words. A value starting with neither shape is never parsed here.
|
|
23
|
-
*/
|
|
24
|
-
export declare function unsupportedAttrExpression(expr: string, loweringMatchers: readonly LoweringMatcher[]): {
|
|
25
|
-
reason: string | undefined;
|
|
26
|
-
} | null;
|
|
27
|
-
/**
|
|
28
|
-
* The BF101 for an attribute value {@link unsupportedAttrExpression}
|
|
29
|
-
* refuses, worded for one adapter (`adapterLabel`, e.g. `Mojo`) and its
|
|
30
|
-
* template language (`languageLabel`, e.g. `Embedded Perl`); `null` when the
|
|
31
|
-
* value goes on to {@link planAttrExpression}.
|
|
32
|
-
*/
|
|
33
|
-
export declare function unsupportedAttrExpressionError(expr: string, attrName: string, loweringMatchers: readonly LoweringMatcher[], componentName: string, adapterLabel: string, languageLabel: string): CompilerError | null;
|
|
14
|
+
import type { ConstantInfo, ExpressionAttr, SpreadAttr } from '../types.ts';
|
|
34
15
|
/**
|
|
35
16
|
* The emission of an `{expr}` attribute value.
|
|
36
17
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attr-plan.d.ts","sourceRoot":"","sources":["../../src/adapters/attr-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"attr-plan.d.ts","sourceRoot":"","sources":["../../src/adapters/attr-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAiC,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACxF,OAAO,EAAmD,KAAK,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACrH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAK3E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,OAAO,EAAE,yBAAyB,CAAA;CAAE,GACnE;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAA;AAEvC,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,8EAA8E;IAC9E,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,iFAAiF;IACjF,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC1C,0FAA0F;IAC1F,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC1C,cAAc,EAAE,kBAAkB,CAAA;IAClC,2DAA2D;IAC3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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"}
|
|
@@ -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","sour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AM,CAAA;CACnC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,SAAS,oBAAoB,EAAE,EACzC,QAAQ,EAAE,qBAAqB,GAC9B,2BAA2B,EAAE,CAW/B;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAA;IACX,gFAAgF;IAChF,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAAA;IAC/B,gFAAgF;IAChF,aAAa,EAAE,MAAM,EAAE,CAAA;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,SAAS,oBAAoB,EAAE,GAAG,qBAAqB,EAAE,GAAG,IAAI,CAuBlH;AAED,qDAAqD;AACrD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,SAAS,2BAA2B,EAAE,GAAG,OAAO,CAE/F;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAM3G"}
|
|
@@ -24,6 +24,23 @@ 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>;
|
|
27
44
|
/** Whether a loop row or callback binds `name` where the expression is read. */
|
|
28
45
|
isShadowed(name: string): boolean;
|
|
29
46
|
/** Whether the adapter binds the const `name` itself, so a read of it stays as written. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computed-const.d.ts","sourceRoot":"","sources":["../../src/adapters/computed-const.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAwE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAC/H,OAAO,KAAK,EAAgB,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"computed-const.d.ts","sourceRoot":"","sources":["../../src/adapters/computed-const.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAwE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAC/H,OAAO,KAAK,EAAgB,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAI3E,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,UAAU,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAA;IACnD,oFAAoF;IACpF,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC5B,oGAAoG;IACpG,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACrC,iFAAiF;IACjF,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAClC;;;;;OAKG;IACH,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,qFAAqF;IACrF,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACnC;;;;;;OAMG;IACH,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACnC,gFAAgF;IAChF,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IACjC,2FAA2F;IAC3F,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IACrC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;CAChC;AAED,uFAAuF;AACvF,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,UAAU,EACpB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,EACrC,cAAc,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAqB,GACtD,oBAAoB,CActB;AA8ED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,oBAAoB,GAAG,IAAI,GAAG,UAAU,CASnG;AA+ID;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,oBAAoB,GAAG,IAAI,GAAG,cAAc,CAQ/G"}
|
|
@@ -5,11 +5,13 @@
|
|
|
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';
|
|
10
|
-
import type { CompilerError, ComponentIR, IRIfStatement, IRMetadata } from '../types.ts';
|
|
11
|
+
import type { CompilerError, ComponentIR, ConstantInfo, IRIfStatement, IRLoop, IRMetadata, PreambleValueDeclaration } from '../types.ts';
|
|
11
12
|
import { type ComputedConstContext } from './computed-const.ts';
|
|
12
13
|
import { BaseAdapter, type AdapterGenerateOptions, type AdapterOutput } from './interface.ts';
|
|
14
|
+
import { type LoopPlan, type LoopPlanContext } from './loop-plan.ts';
|
|
13
15
|
/**
|
|
14
16
|
* How an adapter that renames reserved names spells a source identifier as
|
|
15
17
|
* a template variable, and the engine name its collision diagnostic uses.
|
|
@@ -20,6 +22,52 @@ export interface TemplateIdentifierSpelling {
|
|
|
20
22
|
/** The engine name in the diagnostic ("Jinja", "MiniJinja", …). */
|
|
21
23
|
label: string;
|
|
22
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* An adapter's spelling of a loop row's window ({@link DslTemplateAdapter.renderLoopRow}).
|
|
27
|
+
* Each hook runs under the row's scope.
|
|
28
|
+
*/
|
|
29
|
+
export interface LoopRowSpelling {
|
|
30
|
+
/** Runs first, before anything in the row renders: the adapter's own per-row bookkeeping. */
|
|
31
|
+
enter?(row: BindingScope, outside: BindingScope): void;
|
|
32
|
+
/** A `.map()` preamble declaration as a per-row local (#2447). */
|
|
33
|
+
preamble(declaration: PreambleValueDeclaration): string;
|
|
34
|
+
/** The whole-item-conditional `<!--bf-loop-i:KEY-->` anchor for the key expression `key`. */
|
|
35
|
+
keyAnchor(key: string): string;
|
|
36
|
+
}
|
|
37
|
+
/** A loop row rendered under its own scope. */
|
|
38
|
+
export interface LoopRow {
|
|
39
|
+
/** The scope outside the loop, current again once the row is rendered. */
|
|
40
|
+
outside: BindingScope;
|
|
41
|
+
/** `outside.enterLoopRow(loop)`: the scope the row rendered under. */
|
|
42
|
+
row: BindingScope;
|
|
43
|
+
/** The props the row's bindings newly shadow, each with its root alias (#3314). */
|
|
44
|
+
rootAliases: {
|
|
45
|
+
name: string;
|
|
46
|
+
alias: string;
|
|
47
|
+
}[];
|
|
48
|
+
/** One spelled local per preamble declaration, in source order. */
|
|
49
|
+
preamble: string[];
|
|
50
|
+
/** The children, after the key anchor of a whole-item-conditional body. */
|
|
51
|
+
body: string;
|
|
52
|
+
}
|
|
53
|
+
/** The parts of a {@link LoopPlanContext} each adapter spells. */
|
|
54
|
+
export type LoopPlanSpelling<Spelled> = Pick<LoopPlanContext<Spelled>, 'resolveLiteralConst' | 'callbackLowering' | 'spellStatic'>;
|
|
55
|
+
/**
|
|
56
|
+
* An adapter's wording of the refusals a {@link LoopPlan} decides
|
|
57
|
+
* ({@link DslTemplateAdapter.recordLoopPlanRefusals}).
|
|
58
|
+
*/
|
|
59
|
+
export interface LoopRefusalSpelling {
|
|
60
|
+
/** The BF104 message for a destructure pattern `param` that no template binds. */
|
|
61
|
+
destructureMessage(param: string): string;
|
|
62
|
+
/** The BF104 suggestion. */
|
|
63
|
+
destructureSuggestion: string;
|
|
64
|
+
/**
|
|
65
|
+
* BF101 for a source naming a const no template binds: the engine name
|
|
66
|
+
* the shared wording uses ("Jinja", "MiniJinja", …), or the adapter's own
|
|
67
|
+
* recording of it.
|
|
68
|
+
*/
|
|
69
|
+
unresolvableConst: string | ((constant: ConstantInfo) => void);
|
|
70
|
+
}
|
|
23
71
|
export declare abstract class DslTemplateAdapter extends BaseAdapter {
|
|
24
72
|
protected componentName: string;
|
|
25
73
|
/** Diagnostics collected while rendering, merged into `ir.errors` at the end. */
|
|
@@ -112,6 +160,12 @@ export declare abstract class DslTemplateAdapter extends BaseAdapter {
|
|
|
112
160
|
protected importAliases: Map<string, string>;
|
|
113
161
|
/** Numbers the children captures of a child component that has no slot id. */
|
|
114
162
|
protected childrenCaptureCounter: number;
|
|
163
|
+
/**
|
|
164
|
+
* True while a loop row's children render ({@link renderLoopRow}): a
|
|
165
|
+
* component inside takes the loop-child naming, and a child prop that
|
|
166
|
+
* needs a per-instance value has none to read.
|
|
167
|
+
*/
|
|
168
|
+
protected inLoop: boolean;
|
|
115
169
|
/** The adapter's name in the BF103 imported-loop-child diagnostic ("The Jinja adapter emits …"). */
|
|
116
170
|
protected abstract readonly loopChildDiagnosticName: string;
|
|
117
171
|
/**
|
|
@@ -129,6 +183,45 @@ export declare abstract class DslTemplateAdapter extends BaseAdapter {
|
|
|
129
183
|
protected resetAdapterState(_ir: ComponentIR): void;
|
|
130
184
|
/** `render()` under `scope`, the current scope restored afterwards. */
|
|
131
185
|
protected renderInScope<T>(scope: BindingScope, render: () => T): T;
|
|
186
|
+
/**
|
|
187
|
+
* The coercion an arithmetic operand's emitter spells
|
|
188
|
+
* (`arithmeticOperandCoercion`), refusing an operand whose nil the
|
|
189
|
+
* declared type cannot classify (`arithmeticCoercionOrRefuse`, #3700).
|
|
190
|
+
* `isShadowed` is the adapter's scope test at the emission site.
|
|
191
|
+
*/
|
|
192
|
+
protected arithmeticCoercion(op: string, operand: ParsedExpr, other: ParsedExpr | undefined, isShadowed: (name: string) => boolean): ArithmeticCoercion;
|
|
193
|
+
/**
|
|
194
|
+
* Refuse the ambiguous-nil arithmetic (#3700) in a whole expression the
|
|
195
|
+
* adapter lowers through its own renderer rather than per operator: a
|
|
196
|
+
* `.filter()` predicate, read in the current scope with the callback's
|
|
197
|
+
* own `params` (its parameter and block locals) entered as a callback
|
|
198
|
+
* frame.
|
|
199
|
+
*/
|
|
200
|
+
protected refuseAmbiguousNilArithmeticIn(expr: ParsedExpr, params: readonly string[]): void;
|
|
201
|
+
private ambiguousNilSink;
|
|
202
|
+
/** {@link planLoop} against the current scope and the component's constants. */
|
|
203
|
+
protected loopPlanFor<Spelled>(loop: IRLoop, spelling: LoopPlanSpelling<Spelled>): LoopPlan<Spelled>;
|
|
204
|
+
/**
|
|
205
|
+
* Record the refusals `plan` decided for `loop`, at the loop's location:
|
|
206
|
+
* BF104 for a destructure pattern no template binds, then BF101 for a
|
|
207
|
+
* source naming a computed const no template binds (#3473). The plan
|
|
208
|
+
* decides; the adapter only words them.
|
|
209
|
+
*/
|
|
210
|
+
protected recordLoopPlanRefusals(loop: IRLoop, plan: LoopPlan<unknown>, spelling: LoopRefusalSpelling): void;
|
|
211
|
+
/**
|
|
212
|
+
* A loop row's window (#3473): the row's scope entered around everything
|
|
213
|
+
* that evaluates per row (the preamble locals' initializers, the children,
|
|
214
|
+
* the whole-item-conditional key anchor) and the outer scope restored
|
|
215
|
+
* after. The children render under `inLoop`; the key anchor, after them,
|
|
216
|
+
* does not. The preamble converts first, so a later initializer sees an
|
|
217
|
+
* earlier local, as in the source block.
|
|
218
|
+
*
|
|
219
|
+
* What sits outside the window stays the adapter's: the loop header, the
|
|
220
|
+
* sort, and the filter predicate, which a filter callback's own frame
|
|
221
|
+
* scopes rather than the `.map()` row.
|
|
222
|
+
*/
|
|
223
|
+
protected renderLoopRow(loop: IRLoop, spelling: LoopRowSpelling): LoopRow;
|
|
224
|
+
private renderInLoop;
|
|
132
225
|
/** The root `if` statement of a component with conditional returns. */
|
|
133
226
|
protected abstract renderIfStatement(ifStmt: IRIfStatement): string;
|
|
134
227
|
/** The script registrations the template starts with. */
|
|
@@ -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;AAExD,OAAO,KAAK,
|
|
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;AAExD,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,MAAM,EACN,UAAU,EACV,wBAAwB,EACzB,MAAM,aAAa,CAAA;AAQpB,OAAO,EAAwB,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als the row binds for its index and its destructure bindings.
|
|
10
10
|
* {@link planLoop} makes those decisions once, against the scope outside the
|
|
11
|
-
* loop
|
|
11
|
+
* loop; {@link savedLoopBindings} decides, against the row's scope, which
|
|
12
|
+
* row bindings a backend without loop-scoped `set` saves and restores. The adapter keeps the spelling:
|
|
12
13
|
* the loop header, the row bindings, the diagnostics' wording, and the order
|
|
13
14
|
* it emits them in.
|
|
14
15
|
*/
|
|
@@ -122,6 +123,45 @@ export interface LoopSortSpelling {
|
|
|
122
123
|
* so the template stays valid.
|
|
123
124
|
*/
|
|
124
125
|
export declare function spellSortedSource(sort: SortPlan | null, recv: string, spelling: LoopSortSpelling): string;
|
|
126
|
+
/**
|
|
127
|
+
* The names a loop's for-header binds: the key and the value of an
|
|
128
|
+
* `entries` object iteration, the param of a `keys` / `values` one, and the
|
|
129
|
+
* item var of an array iteration when it is the param itself. A backend
|
|
130
|
+
* whose for-header scopes its targets to the loop passes these to
|
|
131
|
+
* {@link savedLoopBindings} as names it restores itself.
|
|
132
|
+
*/
|
|
133
|
+
export declare function loopHeaderTargets(loop: IRLoop, plan: Pick<LoopPlan<unknown>, 'itemVar'>): string[];
|
|
134
|
+
/** Where a loop row sits, for {@link savedLoopBindings}. */
|
|
135
|
+
export interface LoopRowScopes {
|
|
136
|
+
/** The scope outside the loop. */
|
|
137
|
+
outside: BindingScope;
|
|
138
|
+
/** `outside.enterLoopRow(loop)`. */
|
|
139
|
+
row: BindingScope;
|
|
140
|
+
/** The template-level names: signals, memos, props and constants. */
|
|
141
|
+
templateLevelNames: ReadonlySet<string>;
|
|
142
|
+
}
|
|
143
|
+
/** A row binding a loop saves before its header and restores after its end. */
|
|
144
|
+
export interface SavedLoopBinding {
|
|
145
|
+
name: string;
|
|
146
|
+
/** The template variable that holds the outer value across the loop. */
|
|
147
|
+
temporary: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* The row bindings a backend whose `set` is not loop-scoped (Pebble, Twig,
|
|
151
|
+
* Blade) saves before the loop and restores after it (#3386, #3391): each
|
|
152
|
+
* name the row binds that already means something outside it, an enclosing
|
|
153
|
+
* row's binding or a template-level name. JS scopes the callback's bindings
|
|
154
|
+
* to the row; without the restore the last row's value leaks past the loop.
|
|
155
|
+
* They come in the order a row binds them in a template: the for-header's
|
|
156
|
+
* item, the index local, each destructure local, each preamble local.
|
|
157
|
+
*
|
|
158
|
+
* `skip` names the bindings the backend restores itself: those its
|
|
159
|
+
* for-header scopes to the loop ({@link loopHeaderTargets}), or a root prop
|
|
160
|
+
* it restores through its alias. `temporary` spells the holder of the
|
|
161
|
+
* `ordinal`-th saved name; a holder that collides with a row binding or a
|
|
162
|
+
* template-level name gets `_` appended until it does not.
|
|
163
|
+
*/
|
|
164
|
+
export declare function savedLoopBindings(scopes: LoopRowScopes, skip: Iterable<string>, temporary: (name: string, ordinal: number) => string): SavedLoopBinding[];
|
|
125
165
|
/**
|
|
126
166
|
* The `.filter()` predicate a `.filter().map()` loop tests on each row: the
|
|
127
167
|
* predicate with the names it reads renamed for the row, or the refusal of a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop-plan.d.ts","sourceRoot":"","sources":["../../src/adapters/loop-plan.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"loop-plan.d.ts","sourceRoot":"","sources":["../../src/adapters/loop-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,UAAU,EAA0C,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAEtH,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,2BAA2B,CAAA;AAEjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAC/E,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAI5B,KAAK,QAAQ,EACd,MAAM,sBAAsB,CAAA;AAG7B,MAAM,WAAW,eAAe,CAAC,OA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MAAM,WAAW,kBAAkB;IACjC,2CAA2C;IAC3C,SAAS,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAAA;IAC9C,0DAA0D;IAC1D,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACjD,yFAAyF;IACzF,OAAO,EAAE,MAAM,CAAA;IACf,gCAAgC;IAChC,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;IAC/B,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,EAAE,GAAG,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAG9H;AA6BD,gDAAgD;AAChD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAkBhG"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which values are JS numbers, for backends whose own number
|
|
3
|
+
* stringification differs from JS's `Number::toString` (Perl prints
|
|
4
|
+
* `%.15g` and spells the infinities `Inf`), and whose equality operators
|
|
5
|
+
* need the operand's type.
|
|
6
|
+
*/
|
|
7
|
+
import type { ParsedExpr } from '../expression-parser.ts';
|
|
8
|
+
import type { SsrSeedPlan } from '../ssr-seed-plan.ts';
|
|
9
|
+
import type { ComponentIR } from '../types.ts';
|
|
10
|
+
/**
|
|
11
|
+
* Number-typed signals, memos, props and same-file local consts: a strict
|
|
12
|
+
* equality against one of them keeps Perl's numeric `==` / `!=`, where an
|
|
13
|
+
* operand of unknown type goes through the runtime's `strict_eq`
|
|
14
|
+
* (`emitPerlEquality`). `names` holds the bare spellings (a getter, a
|
|
15
|
+
* destructured prop, a const), `props` the caller-facing keys a
|
|
16
|
+
* `props.<key>` member reads. Whether a binding shadows a name is the
|
|
17
|
+
* caller's scope question.
|
|
18
|
+
*/
|
|
19
|
+
export declare function collectNumberValueNames(ir: Pick<ComponentIR, 'metadata'>): {
|
|
20
|
+
names: Set<string>;
|
|
21
|
+
props: Set<string>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Whether an expression yields a JS NUMBER: arithmetic
|
|
25
|
+
* ({@link isNumericArithmeticResult}), a read of a name `isNumberName`
|
|
26
|
+
* accepts — a zero-argument getter call, a `props.<key>` member, or a bare
|
|
27
|
+
* identifier — or a ternary with such a branch. Backends whose own number
|
|
28
|
+
* stringification differs from JS (Perl spells the infinities `Inf` and
|
|
29
|
+
* prints `%.15g`) route such a value through their `Number::toString`
|
|
30
|
+
* helper wherever JS stringifies it: an output position, or an operand of
|
|
31
|
+
* string concatenation (#3711). Whether a binding shadows the name is
|
|
32
|
+
* `isNumberName`'s scope question.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isNumberValuedExpr(expr: ParsedExpr | null | undefined, isStringName: (n: string, componentProperty?: boolean) => boolean, isNumberName: (n: string, componentProperty?: boolean) => boolean): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Signals and memos whose in-template seed (a `derived` step of the SSR seed
|
|
37
|
+
* plan) is a JS number by construction: arithmetic, or a read of a
|
|
38
|
+
* number-typed name or of an earlier such seed (an identity memo). Their
|
|
39
|
+
* declared type is often `unknown` (`createMemo(() => count() / 0)` infers
|
|
40
|
+
* none without a checker), so the seed's shape is the evidence (#3711).
|
|
41
|
+
*/
|
|
42
|
+
export declare function numberValuedSeedNames(plan: SsrSeedPlan, isStringName: (n: string, componentProperty?: boolean) => boolean, isNumberName: (n: string, componentProperty?: boolean) => boolean): Set<string>;
|
|
43
|
+
//# sourceMappingURL=number-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-value.d.ts","sourceRoot":"","sources":["../../src/adapters/number-value.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAY,MAAM,aAAa,CAAA;AAGxD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG;IAAE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAoBrH;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EACnC,YAAY,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,KAAK,OAAO,EACjE,YAAY,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,KAAK,OAAO,GAChE,OAAO,CAcT;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,WAAW,EACjB,YAAY,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,KAAK,OAAO,EACjE,YAAY,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,KAAK,OAAO,GAChE,GAAG,CAAC,MAAM,CAAC,CASb"}
|
|
@@ -145,6 +145,13 @@ export interface AnalyzerContext {
|
|
|
145
145
|
* extraction. Flushed into `signals` at the end of visitComponentBody.
|
|
146
146
|
*/
|
|
147
147
|
signalTupleRefs: Map<string, PendingSignalTuple>;
|
|
148
|
+
/**
|
|
149
|
+
* Writers of a signal seed's / memo body's client template text
|
|
150
|
+
* (`SignalInfo.templateInitialValue`, `MemoInfo.templateBodyExpr`), run
|
|
151
|
+
* once the whole component body is walked so the props bindings they read
|
|
152
|
+
* live are decided against every body binding (`templatePropReadParams`).
|
|
153
|
+
*/
|
|
154
|
+
templatePropReadWriters: Array<() => void>;
|
|
148
155
|
propsType: TypeInfo | null;
|
|
149
156
|
propsParams: ParamInfo[];
|
|
150
157
|
propsObjectName: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer-context.d.ts","sourceRoot":"","sources":["../src/analyzer-context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,aAAa,EACb,cAAc,EACd,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,KAAK,YAAY,EAAiD,MAAM,kBAAkB,CAAA;AACnG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAiBnE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,cAAc,CAAA;CACpB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAA;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,IAAI,EAAE,QAAQ,CAAA;IACd,GAAG,EAAE,cAAc,CAAA;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAC5C;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAA;IACxB,SAAS,EAAE,EAAE,CAAC,UAAU,GAAG,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AO,EAAE,EAAE,CAAC,WAAW,GAAG,QAAQ,GAAG,IAAI,CAWxF;AAMD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,EAAE,CAAC,IAAI,GACZ,IAAI,IAAI,EAAE,CAAC,mBAAmB,GAAG;IAAE,IAAI,EAAE,EAAE,CAAC,UAAU,CAAA;CAAE,CAO1D;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,EAAE,CAAC,IAAI,GACZ,IAAI,IAAI,EAAE,CAAC,mBAAmB,GAAG;IAClC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAA;IACnB,WAAW,EAAE,EAAE,CAAC,aAAa,CAAA;CAC9B,CAMA;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,aAAa,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EAC1C,KAAK,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GACrC,GAAG,CAAC,MAAM,CAAC,CAKb"}
|
package/dist/analyzer.d.ts
CHANGED
|
@@ -75,8 +75,42 @@ export declare function createProgramForFile(source: string, filePath: string, h
|
|
|
75
75
|
* implementation for every harness that compiles under relative names:
|
|
76
76
|
* the conformance harness (`packages/adapter-tests/src/harness-program.ts`)
|
|
77
77
|
* and the docs-example suite (`doc-examples.test.ts`).
|
|
78
|
+
*
|
|
79
|
+
* Every Program it builds draws on one process-wide `SourceFileCache` that
|
|
80
|
+
* is never evicted, so it suits a test process over a fixed corpus. Do not
|
|
81
|
+
* call it from a long-running watcher.
|
|
78
82
|
*/
|
|
79
83
|
export declare function createAnchoredProgram(source: string, filename: string, anchorDir: string): ts.Program | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Parsed SourceFiles shared by consecutive Programs, keyed by file name, the
|
|
86
|
+
* parse options the Program asks for, and the text. A file is parsed once per
|
|
87
|
+
* distinct text: a file that changed on disk (a rebuilt `@barefootjs/client`
|
|
88
|
+
* `dist`) is parsed again, never served stale, and the many different sources
|
|
89
|
+
* a harness compiles under one virtual name (`component.tsx`) each keep their
|
|
90
|
+
* own entry.
|
|
91
|
+
*
|
|
92
|
+
* A reused SourceFile also keeps its binding, so a Program built from cached
|
|
93
|
+
* files costs module resolution and checker setup, not a parse of
|
|
94
|
+
* `lib.*.d.ts` and every imported declaration (~430 ms → ~30 ms per Program
|
|
95
|
+
* in the conformance harness, #3666). Sharing SourceFiles between Programs
|
|
96
|
+
* with the same compiler options is how TypeScript's own DocumentRegistry
|
|
97
|
+
* serves language services. The Programs themselves are not shared: a
|
|
98
|
+
* checker assigns type ids in the order it is queried, so one reused across
|
|
99
|
+
* compiles could make a compile's output depend on what ran before it.
|
|
100
|
+
*
|
|
101
|
+
* Only for Programs built with the same compiler options: the cache does not
|
|
102
|
+
* key on them. Entries are never evicted, which suits a test process over a
|
|
103
|
+
* fixed corpus, not a long-running watcher.
|
|
104
|
+
*/
|
|
105
|
+
export declare class SourceFileCache {
|
|
106
|
+
private readonly files;
|
|
107
|
+
get(fileName: string, languageVersion: ts.ScriptTarget | ts.CreateSourceFileOptions, text: string, parse: SourceFileParse): ts.SourceFile;
|
|
108
|
+
}
|
|
109
|
+
/** How `SourceFileCache` parses a file; part of its key. */
|
|
110
|
+
export interface SourceFileParse {
|
|
111
|
+
scriptKind?: ts.ScriptKind;
|
|
112
|
+
setParentNodes: boolean;
|
|
113
|
+
}
|
|
80
114
|
export declare function analyzeComponent(source: string, filePath: string, targetComponentName?: string, program?: ts.Program, acceptsCallbackBody?: CallbackBodyAcceptor, programIsShared?: boolean): AnalyzerContext;
|
|
81
115
|
/**
|
|
82
116
|
* Strip JSX-transparent wrappers from an expression. Matches the
|
package/dist/analyzer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"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3F;AAmZD,eAAO,MAAM,wBAAwB,aAMnC,CAAA;AAqBF;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,MAAM,EAAE,CAUV;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,2DAA2D;IAC3D,oBAAoB,EAAE,MAAM,EAAE,CAAA;CAC/B;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAarF;AAkED,eAAO,MAAM,mBAAmB,aAG9B,CAAA;AAi5CF;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI,CA+EvE;AAybD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"augment-inherited-props.d.ts","sourceRoot":"","sources":["../src/augment-inherited-props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAA+
|
|
1
|
+
{"version":3,"file":"augment-inherited-props.d.ts","sourceRoot":"","sources":["../src/augment-inherited-props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAA+C,MAAM,YAAY,CAAA;AAGtG;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAA;IACjB,iEAAiE;IACjE,WAAW,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI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