@barefootjs/go-template 0.18.5 → 0.18.7

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.
@@ -6,16 +6,35 @@
6
6
  * decide `+` string-concat vs numeric addition (#2168 string-concat-plus). Pure
7
7
  * function over `ir.metadata`; no adapter instance state.
8
8
  */
9
- import type { ComponentIR } from '@barefootjs/jsx';
9
+ import { type ComponentIR } from '@barefootjs/jsx';
10
10
  /**
11
- * String-typed signals and props. A signal is string-typed when its inferred
12
- * type is `string` (or, defensively, when its initial value is a bare string
13
- * literal); a prop when its annotated type is `string`. Drives `isStringName`
14
- * for `isStringConcatBinary` the shared helper (`@barefootjs/jsx`) that
15
- * decides whether a JS `+` is string concatenation rather than numeric
16
- * addition (Go's `html/template` has no native `+` at all; `binary()` always
17
- * emits a runtime call, `bf_add` for addition or `bf_concat_str` for
18
- * concatenation see `go-template-adapter.ts`'s `binary()`).
11
+ * String-typed signals, props, and same-file local consts (#2212, ported
12
+ * here for #2236). A signal is string-typed when its inferred type is
13
+ * `string` (or, defensively, when its initial value is a bare string
14
+ * literal); a prop when its annotated type is `string`; a local const the
15
+ * same way. Drives `isStringName` for `isStringConcatBinary` the shared
16
+ * helper (`@barefootjs/jsx`) that decides whether a JS `+` is string
17
+ * concatenation rather than numeric addition (Go's `html/template` has no
18
+ * native `+` at all; `binary()` always emits a runtime call, `bf_add` for
19
+ * addition or `bf_concat_str` for concatenation — see
20
+ * `go-template-adapter.ts`'s `binary()`). Local consts matter for exactly
21
+ * the shadowing shape this exclusion exists for: with a loop-bound `label`
22
+ * subtracted, an outer `{label + suffix}` (where `suffix = '!'`) must
23
+ * still classify as string concat via its OTHER operand, or it would fall
24
+ * back to `bf_add` and render `0`.
25
+ *
26
+ * Excludes any name bound as a `.map()`/`.filter()` loop callback's item or
27
+ * index parameter ANYWHERE in the component (#2212, ported here for #2236):
28
+ * this lookup is a flat, scope-blind `Set<string>` with no notion of a loop
29
+ * param shadowing an outer string-typed binding of the same name
30
+ * (`values.map((label) => 1 + label)` inside a component that also has a
31
+ * string `label` prop) — left unguarded, that shadowed `label` would be
32
+ * misdetected as string-typed and `1 + label` would silently lower to
33
+ * `bf_concat_str` instead of staying numeric `bf_add`. Subtracting loop-bound
34
+ * names is coarse (it also suppresses a genuinely non-shadowed same-named
35
+ * string elsewhere in the component) but safe: the suppressed case just
36
+ * falls back to today's numeric `bf_add` — the same, already-accepted
37
+ * residual as an unresolvable operand — never silently-wrong output.
19
38
  */
20
39
  export declare function collectStringValueNames(ir: ComponentIR): Set<string>;
21
40
  //# sourceMappingURL=prop-classes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prop-classes.d.ts","sourceRoot":"","sources":["../../../src/adapter/props/prop-classes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAY,MAAM,iBAAiB,CAAA;AAc5D;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAWpE"}
1
+ {"version":3,"file":"prop-classes.d.ts","sourceRoot":"","sources":["../../../src/adapter/props/prop-classes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAyB,KAAK,WAAW,EAAiB,MAAM,iBAAiB,CAAA;AAcxF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAiBpE"}