@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.
- package/dist/adapter/analysis/static-child-loop-bake.d.ts +61 -0
- package/dist/adapter/analysis/static-child-loop-bake.d.ts.map +1 -0
- package/dist/adapter/analysis/static-element-loop-bake.d.ts +83 -0
- package/dist/adapter/analysis/static-element-loop-bake.d.ts.map +1 -0
- package/dist/adapter/go-template-adapter.d.ts +116 -2
- package/dist/adapter/go-template-adapter.d.ts.map +1 -1
- package/dist/adapter/index.js +339 -32
- package/dist/adapter/lib/compile-state.d.ts +8 -0
- package/dist/adapter/lib/compile-state.d.ts.map +1 -1
- package/dist/adapter/props/prop-classes.d.ts +28 -9
- package/dist/adapter/props/prop-classes.d.ts.map +1 -1
- package/dist/build.js +339 -32
- package/dist/conformance-pins.d.ts.map +1 -1
- package/dist/index.js +341 -41
- package/dist/render-divergences.d.ts.map +1 -1
- package/dist/test-render.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/go-template-adapter.test.ts +707 -3
- package/src/adapter/analysis/static-child-loop-bake.ts +119 -0
- package/src/adapter/analysis/static-element-loop-bake.ts +211 -0
- package/src/adapter/go-template-adapter.ts +435 -25
- package/src/adapter/lib/compile-state.ts +9 -0
- package/src/adapter/props/prop-classes.ts +34 -9
- package/src/conformance-pins.ts +30 -31
- package/src/render-divergences.ts +12 -0
- package/src/test-render.ts +109 -6
|
@@ -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
|
|
9
|
+
import { type ComponentIR } from '@barefootjs/jsx';
|
|
10
10
|
/**
|
|
11
|
-
* String-typed signals
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
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,
|
|
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"}
|