@barefootjs/jsx 0.39.1 → 0.39.3
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/line-statement-text.d.ts +17 -0
- package/dist/adapters/line-statement-text.d.ts.map +1 -0
- package/dist/adapters/parsed-expr-emitter.d.ts +2 -2
- package/dist/adapters/parsed-expr-emitter.d.ts.map +1 -1
- package/dist/analyzer.d.ts +1 -0
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/augment-inherited-props.d.ts +20 -0
- package/dist/augment-inherited-props.d.ts.map +1 -1
- package/dist/html-types.d.ts +15 -0
- package/dist/html-types.d.ts.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1527 -1169
- package/dist/ir-to-client-js/collect-elements.d.ts.map +1 -1
- package/dist/ir-to-client-js/safe-html.d.ts +1 -1
- package/dist/ir-to-client-js/safe-html.d.ts.map +1 -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/literal-member-index.d.ts +6 -0
- package/dist/literal-member-index.d.ts.map +1 -0
- package/dist/nullable-signal-attr.d.ts +73 -0
- package/dist/nullable-signal-attr.d.ts.map +1 -0
- package/dist/scope/binding-scope.d.ts +11 -0
- package/dist/scope/binding-scope.d.ts.map +1 -1
- package/dist/scope/root-prop-alias.d.ts +43 -0
- package/dist/scope/root-prop-alias.d.ts.map +1 -0
- package/dist/signal-prop-name-collision.d.ts +20 -0
- package/dist/signal-prop-name-collision.d.ts.map +1 -0
- package/dist/ssr-defaults.d.ts.map +1 -1
- package/dist/ssr-seed-plan.d.ts +3 -2
- package/dist/ssr-seed-plan.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/__snapshots__/doc-examples.test.ts.snap +3 -3
- package/src/__tests__/attribute-fallback-wrap.test.ts +24 -0
- package/src/__tests__/binding-scope.test.ts +27 -0
- package/src/__tests__/client-template-escape-soundness.test.ts +17 -0
- package/src/__tests__/compiler-stress-1244.test.ts +10 -13
- package/src/__tests__/conditional-fallback-wrap.test.ts +20 -0
- package/src/__tests__/conditional-nested-loop-bindings.test.ts +41 -0
- package/src/__tests__/destructured-from-props-localconst-value.test.ts +3 -2
- package/src/__tests__/html-event-handler-names.test.ts +107 -0
- package/src/__tests__/line-statement-text.test.ts +25 -0
- package/src/__tests__/literal-member-index.test.ts +14 -0
- package/src/__tests__/lookup-literal-const.test.ts +46 -0
- package/src/__tests__/loop-param-accessor-key-member-safety.test.ts +66 -19
- package/src/__tests__/nullable-signal-attr.test.ts +124 -0
- package/src/__tests__/profile-binding-ids.test.ts +102 -0
- package/src/__tests__/root-prop-alias.test.ts +62 -0
- package/src/__tests__/signal-prop-name-collision.test.ts +171 -0
- package/src/__tests__/ssr-defaults.test.ts +6 -7
- package/src/__tests__/ssr-seed-plan.test.ts +23 -0
- package/src/__tests__/staged-ir/02-shadow-guards.test.ts +1 -1
- package/src/__tests__/staged-ir/08-relocate-unit.test.ts +6 -3
- package/src/adapters/line-statement-text.ts +24 -0
- package/src/adapters/parsed-expr-emitter.ts +3 -3
- package/src/analyzer.ts +60 -26
- package/src/augment-inherited-props.ts +49 -0
- package/src/html-types.ts +15 -0
- package/src/index.ts +14 -2
- package/src/ir-to-client-js/collect-elements.ts +15 -10
- package/src/ir-to-client-js/control-flow/plan/build-component-loop.ts +2 -2
- package/src/ir-to-client-js/safe-html.ts +19 -6
- package/src/ir-to-client-js/stringify/declaration-emit.ts +5 -5
- package/src/ir-to-client-js/utils.ts +88 -117
- package/src/jsx-to-ir.ts +21 -2
- package/src/literal-member-index.ts +12 -0
- package/src/nullable-signal-attr.ts +156 -0
- package/src/scope/binding-scope.ts +31 -1
- package/src/scope/root-prop-alias.ts +81 -0
- package/src/signal-prop-name-collision.ts +164 -0
- package/src/ssr-defaults.ts +3 -5
- package/src/ssr-seed-plan.ts +14 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version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BAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,eAAe,EACpB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EACrC,iBAAiB,UAAQ,GACxB,IAAI,CAqZN;AA+gBD,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,GAAG,EAAE,eAAe,EACpB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EACrC,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,SAAS,OAAO,aAAa,EAAE,gBAAgB,EAAE,GAAG,SAAS;AAChF;;;;GAIG;AACH,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC;AACnC;;;;GAIG;AACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GACxB,iBAAiB,CAenB;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,eAAe,EACpB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EACrC,SAAS,CAAC,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,SAAS,OAAO,aAAa,EAAE,gBAAgB,EAAE;AACrE;;;;;;;;GAQG;AACH,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC;AACnC;;;GAGG;AACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;AACzB;;;;;;;;;;;;;;GAcG;AACH,UAAU,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC;AAClD,uFAAuF;AACvF,WAAW,CAAC,EAAE,YAAY,GACzB,oBAAoB,EAAE,CAsFxB"}
|
|
@@ -149,7 +149,7 @@ export interface ChildSpliceContext {
|
|
|
149
149
|
* 6. otherwise → `escapedText`
|
|
150
150
|
*
|
|
151
151
|
* Arm 5 tests BOTH `node.expr` (the original source text, stable across
|
|
152
|
-
* builders) and the caller's resolved form (
|
|
152
|
+
* builders) and the caller's resolved form (with parentheses handled structurally): a
|
|
153
153
|
* destructured-and-renamed children (`const { children: kids } = props`)
|
|
154
154
|
* reads `kids` in the source and `(_p.children)` after substitution, and
|
|
155
155
|
* either alone misses one of the two shapes (#2786).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-html.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/safe-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"safe-html.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/safe-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,eAAe,EAAE,OAAO,MAAM,CAAA;CAAE,CAAA;AAO3E;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAE7C;AAQD,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAE1D;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAExE;AAOD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAErD;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAEnD;AAED;;;;GAIG;AACH,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,EAAE,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"jsx-to-ir.d.ts","sourceRoot":"","sources":["../src/jsx-to-ir.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACL,KAAK,MAAM,EAgCZ,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,KAAK,eAAe,EAA4F,MAAM,uBAAuB,CAAA;AAunCtJ,wBAAgB,OAAO,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAchE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ParsedExpr } from './expression-parser.ts';
|
|
2
|
+
/** Recover an index operand from a computed member's property key.
|
|
3
|
+
* Only canonical array indices become numbers: keys such as "01" must
|
|
4
|
+
* remain strings. Both `obj[0]` and `obj['0']` use the same JS key. */
|
|
5
|
+
export declare function literalMemberIndex(property: string): ParsedExpr;
|
|
6
|
+
//# sourceMappingURL=literal-member-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literal-member-index.d.ts","sourceRoot":"","sources":["../src/literal-member-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAExD;;uEAEuE;AACvE,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAM/D"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nullish-attribute omission for signal reads (#3304).
|
|
3
|
+
*
|
|
4
|
+
* Hono omits an attribute whose value is `undefined` or `null`
|
|
5
|
+
* (`title={s()}` with `s()` undefined renders no `title`). A DSL adapter
|
|
6
|
+
* emits `name="<value>"` unconditionally, so a nil value renders
|
|
7
|
+
* `title=""` unless the adapter guards the attribute on a nil check. Each
|
|
8
|
+
* DSL adapter already guards a bare reference to a no-default optional prop
|
|
9
|
+
* that way; this module is the one decision for the signal half, which
|
|
10
|
+
* every adapter consults instead of re-deriving it.
|
|
11
|
+
*
|
|
12
|
+
* Only the SSR value matters here — a signal's SSR value is its initial
|
|
13
|
+
* value — and the guard is presence-only: a non-nil value renders exactly
|
|
14
|
+
* as it did unguarded, so over-including a signal never changes output for
|
|
15
|
+
* a non-nil value.
|
|
16
|
+
*/
|
|
17
|
+
import type { ParsedExpr } from './expression-parser.ts';
|
|
18
|
+
import type { ComponentIR, MemoInfo, SignalInfo } from './types.ts';
|
|
19
|
+
/** `undefined` / `null` as a parsed initial value. */
|
|
20
|
+
export declare function isNullishLiteral(expr: ParsedExpr | undefined): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the signal's SSR value can be nullish. The witness is its type
|
|
23
|
+
* admitting `undefined`/`null` (a zero-arg `createSignal<T>()` is typed
|
|
24
|
+
* `T | undefined`, #3215), or, for an untyped signal, a literal `undefined` /
|
|
25
|
+
* `null` initial value.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isNullableSignal(signal: SignalInfo): boolean;
|
|
28
|
+
/** Getter names of the component's signals whose SSR value can be nullish. */
|
|
29
|
+
export declare function collectNullableSignalGetters(ir: ComponentIR): Set<string>;
|
|
30
|
+
/**
|
|
31
|
+
* The getter an attribute value reads when the whole value is a bare,
|
|
32
|
+
* zero-argument getter call (`s()`); `null` for any other shape. A member
|
|
33
|
+
* read, a ternary or a template literal around the call is not matched:
|
|
34
|
+
* the attribute's presence then depends on more than the signal.
|
|
35
|
+
*/
|
|
36
|
+
export declare function bareGetterCallName(parsed: ParsedExpr | undefined): string | null;
|
|
37
|
+
/**
|
|
38
|
+
* The signal getter whose nil check should guard this attribute, or `null`
|
|
39
|
+
* when the attribute is not a bare read of a nullable signal. `nullable` is
|
|
40
|
+
* the set `collectNullableSignalGetters` built for the component.
|
|
41
|
+
*/
|
|
42
|
+
export declare function nullableSignalAttrGetter(parsed: ParsedExpr | undefined, nullable: ReadonlySet<string>): string | null;
|
|
43
|
+
/**
|
|
44
|
+
* What `attrValueMayBeNullish` needs to know about the component: its
|
|
45
|
+
* nullable signal getters and its memos by name.
|
|
46
|
+
*/
|
|
47
|
+
export interface NullishAttrContext {
|
|
48
|
+
readonly nullableSignals: ReadonlySet<string>;
|
|
49
|
+
readonly memos: ReadonlyMap<string, MemoInfo>;
|
|
50
|
+
}
|
|
51
|
+
export declare function collectNullishAttrContext(ir: ComponentIR): NullishAttrContext;
|
|
52
|
+
/**
|
|
53
|
+
* Whether an attribute value's SSR value can be `undefined` / `null`, so a
|
|
54
|
+
* DSL adapter must guard the attribute on a nil check to omit it the way
|
|
55
|
+
* Hono does (#3322) — the derived-value half of the bare-signal guard
|
|
56
|
+
* (`nullableSignalAttrGetter`, #3304). Matches a value that reaches a
|
|
57
|
+
* nullish value through:
|
|
58
|
+
*
|
|
59
|
+
* - a read of a nullable signal or of a memo whose type or body can be
|
|
60
|
+
* nullish (`label()` with `label = createMemo(() => s())`);
|
|
61
|
+
* - an optional member read (`user()?.name`), or a member read of a value
|
|
62
|
+
* that can itself be nullish;
|
|
63
|
+
* - a ternary branch, or an `??` / `||` / `&&` operand the result can be;
|
|
64
|
+
* - a literal `undefined` / `null`.
|
|
65
|
+
*
|
|
66
|
+
* Like the bare-signal guard it is presence-only: a non-nil value renders
|
|
67
|
+
* exactly as unguarded, so over-including a value never changes output for
|
|
68
|
+
* a present value (`''`, `0` and `false` still render). `isShadowed` names
|
|
69
|
+
* a getter a loop binding hides at the attribute site, which is then not
|
|
70
|
+
* the signal / memo; a memo's own body is read in its declaration scope.
|
|
71
|
+
*/
|
|
72
|
+
export declare function attrValueMayBeNullish(parsed: ParsedExpr | undefined, ctx: NullishAttrContext, isShadowed?: (name: string) => boolean): boolean;
|
|
73
|
+
//# sourceMappingURL=nullable-signal-attr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nullable-signal-attr.d.ts","sourceRoot":"","sources":["../src/nullable-signal-attr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAY,MAAM,YAAY,CAAA;AAY7E,sDAAsD;AACtD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAItE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAG5D;AAED,8EAA8E;AAC9E,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGhF;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,GAC5B,MAAM,GAAG,IAAI,CAGf;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC7C,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;CAC9C;AAED,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,WAAW,GAAG,kBAAkB,CAK7E;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,GAAG,EAAE,kBAAkB,EACvB,UAAU,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAqB,GAClD,OAAO,CAsCT"}
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
export type ScopeBindingSource = 'item' | 'index' | 'destructure' | 'preamble' | 'param';
|
|
38
38
|
export interface ScopeBinding {
|
|
39
39
|
readonly source: ScopeBindingSource;
|
|
40
|
+
readonly stringValue?: boolean;
|
|
40
41
|
}
|
|
41
42
|
export interface ScopeFrame {
|
|
42
43
|
readonly kind: 'loop-row' | 'callback';
|
|
@@ -50,6 +51,7 @@ export interface ScopeFrame {
|
|
|
50
51
|
*/
|
|
51
52
|
export interface LoopBindingSource {
|
|
52
53
|
readonly param: string;
|
|
54
|
+
readonly itemType?: LoopValueType | null;
|
|
53
55
|
readonly index?: string | null;
|
|
54
56
|
readonly paramBindings?: readonly {
|
|
55
57
|
readonly name: string;
|
|
@@ -58,6 +60,10 @@ export interface LoopBindingSource {
|
|
|
58
60
|
readonly declaredNames: readonly string[];
|
|
59
61
|
} | null;
|
|
60
62
|
}
|
|
63
|
+
interface LoopValueType {
|
|
64
|
+
readonly primitive?: string;
|
|
65
|
+
readonly unionTypes?: readonly LoopValueType[];
|
|
66
|
+
}
|
|
61
67
|
/**
|
|
62
68
|
* A stack of `ScopeFrame`s, innermost frame at index 0 of the internal
|
|
63
69
|
* array (i.e. `frames[0]` is what `enterLoopRow`/`enterCallback` most
|
|
@@ -114,6 +120,10 @@ export declare class BindingScope {
|
|
|
114
120
|
enterCallback(params: readonly string[]): BindingScope;
|
|
115
121
|
/** Innermost-first membership check across every frame in the stack. */
|
|
116
122
|
isBound(name: string): boolean;
|
|
123
|
+
/** Resolve string typing at this position, respecting the nearest binding. */
|
|
124
|
+
isStringValueName(name: string, outer: (name: string) => boolean, componentProperty?: boolean): boolean;
|
|
125
|
+
/** Names this frame shadows in an enclosing callback/row frame. */
|
|
126
|
+
shadowedNames(): readonly string[];
|
|
117
127
|
/**
|
|
118
128
|
* Resolves `name` against the frame stack innermost-first. `depth 0`
|
|
119
129
|
* means the innermost (most recently entered) frame; `null` when `name`
|
|
@@ -176,4 +186,5 @@ export declare class BindingScope {
|
|
|
176
186
|
*/
|
|
177
187
|
asShadowPredicate(): (name: string) => boolean;
|
|
178
188
|
}
|
|
189
|
+
export {};
|
|
179
190
|
//# sourceMappingURL=binding-scope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binding-scope.d.ts","sourceRoot":"","sources":["../../src/scope/binding-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,UAAU,GAAG,OAAO,CAAA;AAExF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"binding-scope.d.ts","sourceRoot":"","sources":["../../src/scope/binding-scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,UAAU,GAAG,OAAO,CAAA;AAExF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAAA;IACtC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;CACrD;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IACxC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC7D,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAA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WAAW,CAAC,MAAM,CAAC,CAYrC;IAED;;;OAGG;IACH,iBAAiB,IAAI,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAE7C;CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ComponentIR } from '../types.ts';
|
|
2
|
+
import type { BindingScope } from './binding-scope.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Root-prop aliases for template engines that flatten `props.X` to the bare
|
|
5
|
+
* template variable `X` (#3314). A loop that binds the same name (`.map(value
|
|
6
|
+
* => …)`) shadows that variable for its whole body, so an explicit
|
|
7
|
+
* `props.value` inside the row read the ROW's `value` instead of the prop.
|
|
8
|
+
*
|
|
9
|
+
* The adapter assigns each shadowed prop to an alias just before the loop
|
|
10
|
+
* header — where the bare name still means the prop — and an explicit
|
|
11
|
+
* `props.X` read inside the row uses the alias. Only the template syntax
|
|
12
|
+
* of the assignment is per-adapter; which names need one, and their alias
|
|
13
|
+
* name, are decided here once.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The template variable each prop in `propNames` is aliased to: `__bf_root_<name>`,
|
|
17
|
+
* extended with `_` until it names nothing else the component turns into a
|
|
18
|
+
* template variable — a prop, a local const or function, a signal or memo,
|
|
19
|
+
* any loop binding, or another prop's alias. The `__bf_` namespace is
|
|
20
|
+
* reserved only by convention, so an alias must not overwrite a user prop
|
|
21
|
+
* spelled `__bf_root_value` nor be shadowed by a binding of that name.
|
|
22
|
+
* Computed once per component so the assignment before a loop and every
|
|
23
|
+
* `props.X` read inside it agree on the name.
|
|
24
|
+
*/
|
|
25
|
+
export declare function rootPropAliasNames(ir: ComponentIR, propNames: Iterable<string>): ReadonlyMap<string, string>;
|
|
26
|
+
/**
|
|
27
|
+
* Props the loop row newly shadows, with their aliases: names `row` binds
|
|
28
|
+
* that `outer` did not (an enclosing loop that already bound a name already
|
|
29
|
+
* aliased it, and a re-assignment here would capture that loop's row value)
|
|
30
|
+
* and that are component props (keys of `aliases`). In source order of
|
|
31
|
+
* `row`'s bindings.
|
|
32
|
+
*/
|
|
33
|
+
export declare function rootPropAliasesForLoop(outer: BindingScope, row: BindingScope, aliases: ReadonlyMap<string, string>): {
|
|
34
|
+
name: string;
|
|
35
|
+
alias: string;
|
|
36
|
+
}[];
|
|
37
|
+
/**
|
|
38
|
+
* The template variable an explicit `props.<name>` read resolves to at a
|
|
39
|
+
* position with `scope`: the alias (from `rootPropAliasNames`) while a loop
|
|
40
|
+
* binding shadows `name`, else `name` itself.
|
|
41
|
+
*/
|
|
42
|
+
export declare function rootPropReadName(name: string, scope: BindingScope, aliases: ReadonlyMap<string, string>): string;
|
|
43
|
+
//# sourceMappingURL=root-prop-alias.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root-prop-alias.d.ts","sourceRoot":"","sources":["../../src/scope/root-prop-alias.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD;;;;;;;;;;;GAWG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAmB5G;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAOnC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,MAAM,CAGR"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { AnalyzerContext } from './analyzer-context.ts';
|
|
3
|
+
/** Preserve a build-supplied Program's virtual files and resolution options
|
|
4
|
+
* when one root's source changes. Other SourceFiles remain untouched. */
|
|
5
|
+
export declare function programWithSeparatedSource(program: ts.Program, filePath: string, source: string): ts.Program;
|
|
6
|
+
/**
|
|
7
|
+
* A bare prop and a literal-seeded getter are different JS bindings, but
|
|
8
|
+
* scalar template backends flatten both to one variable. Give the local
|
|
9
|
+
* getter a hygienic name before building IR, so every backend (including
|
|
10
|
+
* the client emitter) receives one consistent binding identity.
|
|
11
|
+
*
|
|
12
|
+
* Source edits are AST/symbol-based and preserve untouched source bytes.
|
|
13
|
+
* Property keys, strings, and shadowing callback bindings never rename;
|
|
14
|
+
* shorthand values expand without changing their public keys. The rare
|
|
15
|
+
* collision-only path reuses the analyzer's checker when available. Its
|
|
16
|
+
* fallback binds the already-parsed SourceFile without parsing or loading
|
|
17
|
+
* dependencies: only lexical symbol identity is needed, not types.
|
|
18
|
+
*/
|
|
19
|
+
export declare function separateLiteralSignalPropBindings(ctx: AnalyzerContext, isNonReference: (id: ts.Identifier) => boolean): string | null;
|
|
20
|
+
//# sourceMappingURL=signal-prop-name-collision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal-prop-name-collision.d.ts","sourceRoot":"","sources":["../src/signal-prop-name-collision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAa5D;yEACyE;AACzE,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,EAAE,CAAC,OAAO,CAgD5G;AAYD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,eAAe,EACpB,cAAc,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,UAAU,KAAK,OAAO,GAC7C,MAAM,GAAG,IAAI,CAsEf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-defaults.d.ts","sourceRoot":"","sources":["../src/ssr-defaults.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAG5C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,KAAK,EAAE,OAAO,CAAA;IACd;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuBzB;AAkBD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"ssr-defaults.d.ts","sourceRoot":"","sources":["../src/ssr-defaults.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAG5C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,KAAK,EAAE,OAAO,CAAA;IACd;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuBzB;AAkBD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS,CAqQ/F"}
|
package/dist/ssr-seed-plan.d.ts
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Ordering / acyclicity guarantee: `steps` lists the component's signals
|
|
12
12
|
* first, then its memos, each group in declaration order (matching
|
|
13
|
-
* `IRMetadata.signals` / `IRMetadata.memos`)
|
|
13
|
+
* `IRMetadata.signals` / `IRMetadata.memos`), then canonical getter aliases.
|
|
14
|
+
* A binding's name only enters
|
|
14
15
|
* the scope set AFTER its own step is decided, so a `derived` step's `frees`
|
|
15
16
|
* can only name `baseScope` entries or EARLIER steps — self- and
|
|
16
17
|
* forward-references are rejected by construction, and a consumer emitting
|
|
@@ -33,7 +34,7 @@ import { type EnvSignalReader } from './adapters/env-signal.ts';
|
|
|
33
34
|
import { type ParsedExpr } from './expression-parser.ts';
|
|
34
35
|
import type { IRMetadata } from './types.ts';
|
|
35
36
|
/**
|
|
36
|
-
* One binding in
|
|
37
|
+
* One binding in dependency order (signals, memos, then getter aliases —
|
|
37
38
|
* matching `IRMetadata` order and the adapters' iteration).
|
|
38
39
|
*
|
|
39
40
|
* - `env-reader`: an env signal whose `envReader` key resolves in the shared
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-seed-plan.d.ts","sourceRoot":"","sources":["../src/ssr-seed-plan.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ssr-seed-plan.d.ts","sourceRoot":"","sources":["../src/ssr-seed-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAIH,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACnF,OAAO,EAML,KAAK,UAAU,EAChB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAG5C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GAC/G;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAAA;CAAE,CAAA;AAE/D,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,KAAK,EAAE,WAAW,EAAE,CAAA;CACrB;AAiGD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,UAAU,GAAG,WAAW,CAqFpE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/jsx",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.3",
|
|
4
4
|
"description": "JSX compiler for BarefootJS - transforms JSX to server HTML + client JS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"directory": "packages/jsx"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@barefootjs/shared": "0.39.
|
|
52
|
+
"@barefootjs/shared": "0.39.3"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@barefootjs/client": ">=0.2.0",
|
|
@@ -859,7 +859,7 @@ hydrate('StatementExample', { init: initStatementExample, template: (_p) => \`<d
|
|
|
859
859
|
export function StatementExample(_p, __bfKey) { return createComponent('StatementExample', _p, __bfKey) }"
|
|
860
860
|
`;
|
|
861
861
|
|
|
862
|
-
exports[`docs/core/reactivity/create-signal.md doc-examples
|
|
862
|
+
exports[`docs/core/reactivity/create-signal.md doc-examples L33 — (no label) 1`] = `
|
|
863
863
|
"import { createComponent, createEffect, createMemo, createSignal, hydrate, onCleanup, onMount, untrack } from '@barefootjs/client/runtime'
|
|
864
864
|
|
|
865
865
|
|
|
@@ -875,7 +875,7 @@ hydrate('StatementExample', { init: initStatementExample, template: (_p) => \`<d
|
|
|
875
875
|
export function StatementExample(_p, __bfKey) { return createComponent('StatementExample', _p, __bfKey) }"
|
|
876
876
|
`;
|
|
877
877
|
|
|
878
|
-
exports[`docs/core/reactivity/create-signal.md doc-examples
|
|
878
|
+
exports[`docs/core/reactivity/create-signal.md doc-examples L36 — ❌ Mutating the same array — no update 1`] = `
|
|
879
879
|
"import { createComponent, createEffect, createMemo, createSignal, hydrate, onCleanup, onMount, untrack } from '@barefootjs/client/runtime'
|
|
880
880
|
|
|
881
881
|
|
|
@@ -894,7 +894,7 @@ hydrate('StatementExample', { init: initStatementExample, template: (_p) => \`<d
|
|
|
894
894
|
export function StatementExample(_p, __bfKey) { return createComponent('StatementExample', _p, __bfKey) }"
|
|
895
895
|
`;
|
|
896
896
|
|
|
897
|
-
exports[`docs/core/reactivity/create-signal.md doc-examples
|
|
897
|
+
exports[`docs/core/reactivity/create-signal.md doc-examples L41 — ✅ New array — triggers update 1`] = `
|
|
898
898
|
"import { createComponent, createEffect, createMemo, createSignal, hydrate, onCleanup, onMount, untrack } from '@barefootjs/client/runtime'
|
|
899
899
|
|
|
900
900
|
|
|
@@ -216,4 +216,28 @@ describe('Solid-style wrap-by-default fallback for attributes (#940)', () => {
|
|
|
216
216
|
expect(clientJs).not.toContain('Reactive attributes')
|
|
217
217
|
expect(clientJs).not.toMatch(/setAttribute\(\s*['"]style['"]/)
|
|
218
218
|
})
|
|
219
|
+
|
|
220
|
+
test('a wrapped attribute on an element with no other dynamic content gets a slot (#3266)', () => {
|
|
221
|
+
// `v()` reads a store the analyzer can't see into (an untyped prop
|
|
222
|
+
// holding a class instance), so only the call shape marks
|
|
223
|
+
// `hidden={v().hide}` for wrapping. The <p> has no event, ref or
|
|
224
|
+
// dynamic child, so before #3266 it got no slot id: the wrapped effect
|
|
225
|
+
// had no element to address and `hidden` was never applied on the
|
|
226
|
+
// client, not even initially.
|
|
227
|
+
const source = `
|
|
228
|
+
'use client'
|
|
229
|
+
|
|
230
|
+
export function Card(props: any) {
|
|
231
|
+
const s = props.data.s
|
|
232
|
+
const v = () => s.get()
|
|
233
|
+
return <div><p className="h" hidden={v().hide}>x</p></div>
|
|
234
|
+
}
|
|
235
|
+
`
|
|
236
|
+
|
|
237
|
+
const clientJs = getClientJs(source, 'Card.tsx')
|
|
238
|
+
const slot = clientJs.match(/<p class="h" [^>]*bf="(s\d+)"/)?.[1]
|
|
239
|
+
expect(slot).toBeDefined()
|
|
240
|
+
expect(clientJs).toContain(`_${slot}.hidden = !!(__x)`)
|
|
241
|
+
expect(clientJs).toContain('const __x = v().hide')
|
|
242
|
+
})
|
|
219
243
|
})
|
|
@@ -198,3 +198,30 @@ describe('BindingScope', () => {
|
|
|
198
198
|
})
|
|
199
199
|
})
|
|
200
200
|
})
|
|
201
|
+
|
|
202
|
+
describe('scoped string value types', () => {
|
|
203
|
+
test('nested string rows retain outer types; numeric shadows and indexes do not inherit them', () => {
|
|
204
|
+
const outer = BindingScope.EMPTY.enterLoopRow({ param: 'item', itemType: { primitive: 'string' } })
|
|
205
|
+
const inner = outer.enterLoopRow({ param: 'choice', index: 'i', itemType: { primitive: 'string' } })
|
|
206
|
+
expect(inner.isStringValueName('item', () => false)).toBe(true)
|
|
207
|
+
expect(inner.isStringValueName('choice', () => false)).toBe(true)
|
|
208
|
+
expect(inner.isStringValueName('choice', () => false, true)).toBe(false)
|
|
209
|
+
expect(inner.isStringValueName('i', () => true)).toBe(false)
|
|
210
|
+
const shadow = inner.enterLoopRow({ param: 'item', itemType: { primitive: 'number' } })
|
|
211
|
+
expect(shadow.isStringValueName('item', () => true)).toBe(false)
|
|
212
|
+
expect(shadow.shadowedNames()).toEqual(['item'])
|
|
213
|
+
expect(inner.shadowedNames()).toEqual([])
|
|
214
|
+
expect(outer.isStringValueName('item', () => false)).toBe(true)
|
|
215
|
+
expect(inner.isStringValueName('title', () => true)).toBe(true)
|
|
216
|
+
})
|
|
217
|
+
test('a union of string literals is string-valued; mixed unions are not', () => {
|
|
218
|
+
const stringRow = BindingScope.EMPTY.enterLoopRow({ param: 'row', itemType: {
|
|
219
|
+
unionTypes: [{ primitive: 'string' }, { primitive: 'string' }],
|
|
220
|
+
} })
|
|
221
|
+
expect(stringRow.isStringValueName('row', () => false)).toBe(true)
|
|
222
|
+
const mixedRow = stringRow.enterLoopRow({ param: 'row', itemType: {
|
|
223
|
+
unionTypes: [{ primitive: 'string' }, { primitive: 'number' }],
|
|
224
|
+
} })
|
|
225
|
+
expect(mixedRow.isStringValueName('row', () => true)).toBe(false)
|
|
226
|
+
})
|
|
227
|
+
})
|
|
@@ -170,6 +170,23 @@ export function Box(props: { children?: any }) {
|
|
|
170
170
|
}`,
|
|
171
171
|
pin: (js) => expect(js).toContain('${markupOrEmpty((_p.children))}'),
|
|
172
172
|
},
|
|
173
|
+
{
|
|
174
|
+
id: 'children-nullish-empty-fallback',
|
|
175
|
+
source: `
|
|
176
|
+
export function Box(props: { children?: unknown }) {
|
|
177
|
+
const { children: kids } = props
|
|
178
|
+
return <div>{(kids) ?? ''}</div>
|
|
179
|
+
}`,
|
|
180
|
+
pin: (js) => expect(js).toContain('markupOrEmpty('),
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: 'children-nullish-text-fallback',
|
|
184
|
+
source: `
|
|
185
|
+
export function Box(props: { children?: unknown }) {
|
|
186
|
+
return <div>{props.children ?? '<b>text</b>'}</div>
|
|
187
|
+
}`,
|
|
188
|
+
pin: (js) => expect(js).toContain('escapeText('),
|
|
189
|
+
},
|
|
173
190
|
{
|
|
174
191
|
// The author-facing escape hatch, by name.
|
|
175
192
|
id: 'dangerously-set-inner-html',
|
|
@@ -617,18 +617,15 @@ describe('nested destructuring in loop param', () => {
|
|
|
617
617
|
// SyntaxError that takes down the whole compiled module at parse
|
|
618
618
|
// time, before any runtime code runs.
|
|
619
619
|
//
|
|
620
|
-
// The
|
|
621
|
-
// expression's TS AST,
|
|
622
|
-
// name matches a binding, and
|
|
623
|
-
//
|
|
624
|
-
// identifier-replacement regex skips string-literal contents, so the
|
|
625
|
-
// key stays as the literal `"color"` while the value-position
|
|
626
|
-
// `color` lowers to `__bfItem().color`.
|
|
620
|
+
// The binding rewrite (`rewriteIdentifierReferences`) walks the
|
|
621
|
+
// expression's TS AST and, for a `ShorthandPropertyAssignment` whose
|
|
622
|
+
// name matches a binding, emits the key and the rewritten value in
|
|
623
|
+
// one edit (`{ color: __bfItem().color }`, #3260).
|
|
627
624
|
//
|
|
628
625
|
// `style={{ color }}` is the most common surface (Tailwind-style
|
|
629
626
|
// dynamic colour bindings on per-item tables / lists) and is the
|
|
630
627
|
// shape this test pins.
|
|
631
|
-
test('shorthand property in object literal lowers via
|
|
628
|
+
test('shorthand property in object literal lowers via key expansion (CSR runtime path)', () => {
|
|
632
629
|
const src = `
|
|
633
630
|
'use client'
|
|
634
631
|
import { createSignal } from '@barefootjs/client'
|
|
@@ -650,14 +647,14 @@ describe('nested destructuring in loop param', () => {
|
|
|
650
647
|
// The invalid shorthand form `{ __bfItem().color }` is a SyntaxError;
|
|
651
648
|
// its presence in the emit means the module won't load at all.
|
|
652
649
|
expect(c.clientJs).not.toMatch(/\{\s*__bfItem\(\)\.color\s*\}/)
|
|
653
|
-
// The
|
|
654
|
-
//
|
|
655
|
-
expect(c.clientJs).toMatch(/\{\s*
|
|
650
|
+
// The shorthand expands to `key: value` in one edit; the AST rewrite
|
|
651
|
+
// leaves the key alone and rewrites only the value position (#3260).
|
|
652
|
+
expect(c.clientJs).toMatch(/\{\s*color:\s*__bfItem\(\)\.color\s*\}/)
|
|
656
653
|
})
|
|
657
654
|
|
|
658
655
|
test('shorthand property survives nested destructure (object-in-array)', () => {
|
|
659
656
|
// Nested: tuple element destructured as object. Same shorthand
|
|
660
|
-
// pitfall as the flat case above — the AST
|
|
657
|
+
// pitfall as the flat case above — the AST rewrite finds the
|
|
661
658
|
// shorthand even though the binding path is deeper
|
|
662
659
|
// (`__bfItem()[1].color`).
|
|
663
660
|
const src = `
|
|
@@ -679,7 +676,7 @@ describe('nested destructuring in loop param', () => {
|
|
|
679
676
|
expectNoFatalErrors(c)
|
|
680
677
|
|
|
681
678
|
expect(c.clientJs).not.toMatch(/\{\s*__bfItem\(\)\[1\]\.color\s*\}/)
|
|
682
|
-
expect(c.clientJs).toMatch(/\{\s*
|
|
679
|
+
expect(c.clientJs).toMatch(/\{\s*color:\s*__bfItem\(\)\[1\]\.color\s*\}/)
|
|
683
680
|
})
|
|
684
681
|
})
|
|
685
682
|
|
|
@@ -182,4 +182,24 @@ describe('Solid-style wrap-by-default fallback for conditionals (#941)', () => {
|
|
|
182
182
|
const insertCount = (clientJs.match(/\binsert\s*\(/g) ?? []).length
|
|
183
183
|
expect(insertCount).toBe(2)
|
|
184
184
|
})
|
|
185
|
+
|
|
186
|
+
test('unrecognised call in a branch\'s text wraps in the branch bindEvents (#3266)', () => {
|
|
187
|
+
// The same `{v().text}` gets a createEffect outside the conditional
|
|
188
|
+
// (#939's fallback for top-level text). Inside a branch, the text
|
|
189
|
+
// effects were gated on `reactive` alone, so the branch kept its
|
|
190
|
+
// mount-time text until the condition flipped (#3266).
|
|
191
|
+
const source = `
|
|
192
|
+
'use client'
|
|
193
|
+
|
|
194
|
+
export function Card(props: any) {
|
|
195
|
+
const s = props.data.s
|
|
196
|
+
const v = () => s.get()
|
|
197
|
+
return <div>{v().kind === 'a' ? <p className="a">{v().text}</p> : <p className="b">{v().text}</p>}</div>
|
|
198
|
+
}
|
|
199
|
+
`
|
|
200
|
+
|
|
201
|
+
const clientJs = getClientJs(source, 'Card.tsx')
|
|
202
|
+
const branchTextEffects = clientJs.match(/__disposers\.push\(createDisposableEffect\(\(\) => \{ __bfw_s\d+\('s\d+', escapeTextOrNode\(v\(\)\.text\)\) \}\)\)/g) ?? []
|
|
203
|
+
expect(branchTextEffects).toHaveLength(2)
|
|
204
|
+
})
|
|
185
205
|
})
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test'
|
|
2
|
+
import { compileJSX } from '../compiler'
|
|
3
|
+
import { TestAdapter } from '../adapters/test-adapter'
|
|
4
|
+
|
|
5
|
+
// The branch collector must retain each inner row's own binding scope,
|
|
6
|
+
// independently of whether either source array is reactive.
|
|
7
|
+
describe('nested conditional-branch loop binding collection (#3274)', () => {
|
|
8
|
+
for (const signalOuter of [false, true]) {
|
|
9
|
+
for (const signalInner of [false, true]) {
|
|
10
|
+
test(`outer signal=${signalOuter}, inner signal=${signalInner}`, () => {
|
|
11
|
+
const source = `
|
|
12
|
+
'use client'
|
|
13
|
+
import { createSignal } from '@barefootjs/client'
|
|
14
|
+
const GROUPS = ['a', 'b']
|
|
15
|
+
const CHOICES = ['1', '2']
|
|
16
|
+
export function BranchChoices() {
|
|
17
|
+
const [open] = createSignal(true)
|
|
18
|
+
const [picked] = createSignal('a1')
|
|
19
|
+
const [groups] = createSignal(GROUPS)
|
|
20
|
+
const [choices] = createSignal(CHOICES)
|
|
21
|
+
return <section>{open() ? <div>
|
|
22
|
+
{${signalOuter ? 'groups()' : 'GROUPS'}.map(group => <div key={group}>
|
|
23
|
+
{${signalInner ? 'choices()' : 'CHOICES'}.map(choice =>
|
|
24
|
+
<button key={choice} aria-checked={picked() === group + choice ? 'true' : 'false'}>
|
|
25
|
+
{picked() === group + choice ? 'on' : 'off'}
|
|
26
|
+
</button>)}
|
|
27
|
+
</div>)}
|
|
28
|
+
</div> : null}</section>
|
|
29
|
+
}
|
|
30
|
+
`
|
|
31
|
+
const result = compileJSX(source, 'BranchChoices.tsx', { adapter: new TestAdapter() })
|
|
32
|
+
expect(result.errors.filter(e => e.severity === 'error')).toEqual([])
|
|
33
|
+
const js = result.files.find(f => f.type === 'clientJs')!.content
|
|
34
|
+
expect(js).toContain('mapArray(() =>')
|
|
35
|
+
expect(js).toContain("setAttribute('aria-checked'")
|
|
36
|
+
expect(js).toContain("insert(__innerEl1_0, 's1', () => picked() === group() + choice()")
|
|
37
|
+
expect(js).toContain('group() + choice()')
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
})
|
|
@@ -77,8 +77,9 @@ describe('destructured-from-props-object → localConstants value rewrite', () =
|
|
|
77
77
|
const clientJs = result.files.find((f) => f.type === 'clientJs')
|
|
78
78
|
const content = clientJs?.content ?? ''
|
|
79
79
|
|
|
80
|
-
//
|
|
81
|
-
|
|
80
|
+
// The signal remains a local getter (now hygienically distinct from
|
|
81
|
+
// the bare prop), never a read/call of the caller's `_p.count`.
|
|
82
|
+
expect(content).toMatch(/const\s+doubled\s*=\s*bfSignal_count\(\)\s*\*\s*2/)
|
|
82
83
|
expect(content).not.toMatch(/const\s+doubled\s*=\s*_p\.count\(\)/)
|
|
83
84
|
})
|
|
84
85
|
|