@barefootjs/go-template 0.18.7 → 0.19.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/adapter/emit-context.d.ts +11 -5
- package/dist/adapter/emit-context.d.ts.map +1 -1
- package/dist/adapter/go-template-adapter.d.ts +45 -6
- package/dist/adapter/go-template-adapter.d.ts.map +1 -1
- package/dist/adapter/index.js +326 -38
- package/dist/adapter/lib/compile-state.d.ts +32 -0
- package/dist/adapter/lib/compile-state.d.ts.map +1 -1
- package/dist/adapter/lib/types.d.ts +9 -0
- package/dist/adapter/lib/types.d.ts.map +1 -1
- package/dist/adapter/memo/memo-compute.d.ts +8 -0
- package/dist/adapter/memo/memo-compute.d.ts.map +1 -1
- package/dist/adapter/props/prop-types.d.ts +97 -0
- package/dist/adapter/props/prop-types.d.ts.map +1 -1
- package/dist/adapter/value/value-lowering.d.ts +9 -1
- package/dist/adapter/value/value-lowering.d.ts.map +1 -1
- package/dist/build.js +326 -38
- package/dist/index.js +326 -38
- package/package.json +3 -3
- package/src/__tests__/derived-state-memo.test.ts +10 -3
- package/src/__tests__/go-template-adapter.test.ts +282 -23
- package/src/adapter/emit-context.ts +14 -5
- package/src/adapter/go-template-adapter.ts +291 -50
- package/src/adapter/lib/compile-state.ts +36 -0
- package/src/adapter/lib/types.ts +9 -0
- package/src/adapter/memo/memo-compute.ts +123 -9
- package/src/adapter/props/prop-types.ts +310 -1
- package/src/adapter/value/value-lowering.ts +58 -5
- package/src/test-render.ts +18 -4
|
@@ -21,6 +21,7 @@ import type { PropFallbackVar } from '../lib/types.ts';
|
|
|
21
21
|
export declare function matchFilterArmMemo(ctx: GoEmitContext, body: ParsedExpr, signals: {
|
|
22
22
|
getter: string;
|
|
23
23
|
initialValue: string;
|
|
24
|
+
type?: TypeInfo;
|
|
24
25
|
}[], propsParams: {
|
|
25
26
|
name: string;
|
|
26
27
|
type?: TypeInfo;
|
|
@@ -45,6 +46,7 @@ export declare function filterArmEarlierSiblingRefs(ctx: GoEmitContext, memo: {
|
|
|
45
46
|
}, signals: {
|
|
46
47
|
getter: string;
|
|
47
48
|
initialValue: string;
|
|
49
|
+
type?: TypeInfo;
|
|
48
50
|
}[], propsParams: {
|
|
49
51
|
name: string;
|
|
50
52
|
type?: TypeInfo;
|
|
@@ -68,6 +70,7 @@ export declare function computeMemoInitialValue(ctx: GoEmitContext, memo: {
|
|
|
68
70
|
}, signals: {
|
|
69
71
|
getter: string;
|
|
70
72
|
initialValue: string;
|
|
73
|
+
type?: TypeInfo;
|
|
71
74
|
}[], propsParams: {
|
|
72
75
|
name: string;
|
|
73
76
|
type?: TypeInfo;
|
|
@@ -85,6 +88,7 @@ export declare function computeMemoInitialValue(ctx: GoEmitContext, memo: {
|
|
|
85
88
|
export declare function memoInitialFromParsedBody(ctx: GoEmitContext, body: ParsedExpr, signals: {
|
|
86
89
|
getter: string;
|
|
87
90
|
initialValue: string;
|
|
91
|
+
type?: TypeInfo;
|
|
88
92
|
}[], propsParams: {
|
|
89
93
|
name: string;
|
|
90
94
|
type?: TypeInfo;
|
|
@@ -109,6 +113,7 @@ export declare function computeMemoInitialValueOrNull(ctx: GoEmitContext, memo:
|
|
|
109
113
|
}, signals: {
|
|
110
114
|
getter: string;
|
|
111
115
|
initialValue: string;
|
|
116
|
+
type?: TypeInfo;
|
|
112
117
|
}[], propsParams: {
|
|
113
118
|
name: string;
|
|
114
119
|
type?: TypeInfo;
|
|
@@ -134,6 +139,7 @@ resolving?: ReadonlySet<string>): string | null;
|
|
|
134
139
|
export declare function resolveGetterValueAsGo(ctx: GoEmitContext, name: string, signals: {
|
|
135
140
|
getter: string;
|
|
136
141
|
initialValue: string;
|
|
142
|
+
type?: TypeInfo;
|
|
137
143
|
}[], propsParams: {
|
|
138
144
|
name: string;
|
|
139
145
|
type?: TypeInfo;
|
|
@@ -150,6 +156,7 @@ export declare function resolveGetterValueAsGo(ctx: GoEmitContext, name: string,
|
|
|
150
156
|
export declare function computeComparisonTernaryGo(ctx: GoEmitContext, parsed: ParsedExpr | undefined, signals: {
|
|
151
157
|
getter: string;
|
|
152
158
|
initialValue: string;
|
|
159
|
+
type?: TypeInfo;
|
|
153
160
|
}[], propsParams: {
|
|
154
161
|
name: string;
|
|
155
162
|
type?: TypeInfo;
|
|
@@ -165,6 +172,7 @@ export declare function computeComparisonTernaryGo(ctx: GoEmitContext, parsed: P
|
|
|
165
172
|
export declare function resolveComparisonOperandGo(ctx: GoEmitContext, node: ParsedExpr, signals: {
|
|
166
173
|
getter: string;
|
|
167
174
|
initialValue: string;
|
|
175
|
+
type?: TypeInfo;
|
|
168
176
|
}[], propsParams: {
|
|
169
177
|
name: string;
|
|
170
178
|
type?: TypeInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memo-compute.d.ts","sourceRoot":"","sources":["../../../src/adapter/memo/memo-compute.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAQ5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"memo-compute.d.ts","sourceRoot":"","sources":["../../../src/adapter/memo/memo-compute.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAQ5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AA2EtD;;;;;;;mBAOmB;AACnB,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,C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AO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,QAAQ,CAAA;CAAE,EAAE,EACpE,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,EACvE,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,EACtD,SAAS,GAAE,WAAW,CAAC,MAAM,CAAa,GACzC,MAAM,GAAG,IAAI,CAiBf"}
|
|
@@ -13,6 +13,103 @@ import type { GoEmitContext } from '../emit-context.ts';
|
|
|
13
13
|
* generic prop types (containing `interface{}`) are overridden.
|
|
14
14
|
*/
|
|
15
15
|
export declare function buildPropTypeOverrides(ctx: GoEmitContext, ir: ComponentIR): Map<string, string>;
|
|
16
|
+
/**
|
|
17
|
+
* Concrete scalar Go types eligible for the nullish (`??`) nillable flip in
|
|
18
|
+
* `resolvePropGoType`. Only these can round-trip through an `interface{}`
|
|
19
|
+
* field and back via a constructor type assertion / `bf.ToInt`-style
|
|
20
|
+
* coercion (see the fallback-var emission in `generateNewPropsFunction`).
|
|
21
|
+
*/
|
|
22
|
+
export declare const NULLISH_SCALAR_GO_TYPES: ReadonlySet<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Names of OPTIONAL props consumed nullish-sensitively — the left operand of
|
|
25
|
+
* a `??` anywhere in the component's parsed expression trees, or a signal's
|
|
26
|
+
* `props.X ?? <literal>` initial value (#2248).
|
|
27
|
+
*
|
|
28
|
+
* Why this matters: JS `??` falls back only on `null`/`undefined`, keeping
|
|
29
|
+
* `''`/`0`/`false`. A Go zero-valued scalar field cannot represent "absent",
|
|
30
|
+
* so a `??`-consumed optional scalar must lower to the adapter's established
|
|
31
|
+
* nillable representation (`interface{}`) for the distinction to exist at
|
|
32
|
+
* render time. `resolvePropGoType` applies that flip using this set.
|
|
33
|
+
*
|
|
34
|
+
* The IR walk is generic (any nested object/array is descended, so parsed
|
|
35
|
+
* trees inside expressions, conditions, attributes, and loops are all seen)
|
|
36
|
+
* and the match is shape-precise: `identifier` left (destructured props) or
|
|
37
|
+
* `<propsObject>.<name>` member left. KNOWN LIMITATION (same class as
|
|
38
|
+
* `collectToFixedPropNames`): an `identifier` left shadowed by a same-named
|
|
39
|
+
* loop/callback param is misattributed to the prop — the flip is then merely
|
|
40
|
+
* unnecessary, not incorrect.
|
|
41
|
+
*/
|
|
42
|
+
export declare function collectNullishConsumedPropNames(ctx: GoEmitContext, ir: ComponentIR): Set<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Names of OPTIONAL no-default props consumed as the BARE value of an
|
|
45
|
+
* omittable attribute (`rows={rows}` / `rows={props.rows}`) anywhere in the
|
|
46
|
+
* component's element tree.
|
|
47
|
+
*
|
|
48
|
+
* Why this matters: Hono omits an attribute whose value is `undefined`, and
|
|
49
|
+
* the adapter's `emitExpression` mirrors that with a `{{if ne .X nil}}` guard
|
|
50
|
+
* — which needs a nillable field to test. A concrete scalar field would
|
|
51
|
+
* render the zero value (`rows="0"`) instead of dropping the attribute, so
|
|
52
|
+
* these props take the same `interface{}` flip as `??` consumption
|
|
53
|
+
* (`resolvePropGoType`). The match mirrors `emitExpression`'s guard branch:
|
|
54
|
+
* bare identifiers / `<propsObject>.<name>` only, skipping `class`/`style`
|
|
55
|
+
* (own lowerings) and boolean/presence attrs (truthiness-tested, where a nil
|
|
56
|
+
* and a zero value already coincide). Same shadowing caveat as
|
|
57
|
+
* `collectNullishConsumedPropNames`: a same-named loop/callback param can
|
|
58
|
+
* misattribute, making the flip merely unnecessary, not incorrect.
|
|
59
|
+
*/
|
|
60
|
+
export declare function collectOmittableAttrConsumedPropNames(ctx: GoEmitContext, ir: ComponentIR): Set<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Names of OPTIONAL no-default props consumed as the BARE value of a
|
|
63
|
+
* TEXT-position expression (`{size}` / `{props.size}`) anywhere in the
|
|
64
|
+
* component's element tree.
|
|
65
|
+
*
|
|
66
|
+
* Why this matters (#2267): with no flip, an absent `size?: number` prop
|
|
67
|
+
* resolves to a concrete `int` field and `{{.Size}}` prints its zero value
|
|
68
|
+
* (`0`) instead of empty — the JS reference renders `undefined` as "".
|
|
69
|
+
* These props take the same `interface{}` flip as `??`/omittable-attribute
|
|
70
|
+
* consumption (`resolvePropGoType`); `renderExpression`'s emitter then
|
|
71
|
+
* routes the flipped field through `bf_string` (nil-safe stringify)
|
|
72
|
+
* instead of a bare `{{.X}}`, since `text/template` prints a nil
|
|
73
|
+
* `interface{}` as the literal `<no value>`, not "".
|
|
74
|
+
*
|
|
75
|
+
* Generic recursive walk (matching `type: 'expression'` ANYWHERE, like
|
|
76
|
+
* `collectNullishConsumedPropNames`) rather than only `element.children` —
|
|
77
|
+
* a fragment return (`<>{size}</>`) or a conditional branch's children
|
|
78
|
+
* would otherwise be missed. Same shadowing caveat as the sibling
|
|
79
|
+
* collectors: a same-named loop/callback param can misattribute, making
|
|
80
|
+
* the flip merely unnecessary, not incorrect.
|
|
81
|
+
*
|
|
82
|
+
* Filtered to `kind: 'primitive'` — unlike the `??`/omittable-attribute
|
|
83
|
+
* collectors (whose consumers, `bf_nullish` and the `{{if ne .X nil}}`
|
|
84
|
+
* guard, are nil-test-only and pass the underlying value through
|
|
85
|
+
* untouched), this collector's consumer (`renderExpression`'s `bf_string`
|
|
86
|
+
* wrap) RESTRINGIFIES the value via `fmt.Sprintf`. An optional prop
|
|
87
|
+
* carrying already-rendered markup (a JSX-element/children prop) also
|
|
88
|
+
* independently resolves to `interface{}` via `resolvePropGoType`'s
|
|
89
|
+
* struct-map branch — routing THAT through `bf_string` would strip its
|
|
90
|
+
* `template.HTML` safe-markup typing, so `text/template` re-escapes
|
|
91
|
+
* already-escaped HTML on print (observed as literal `<div>...`).
|
|
92
|
+
* Restricting to primitives keeps this collector disjoint from that flip.
|
|
93
|
+
*/
|
|
94
|
+
export declare function collectTextConsumedPropNames(ctx: GoEmitContext, ir: ComponentIR): Set<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Names of OPTIONAL no-default props whose PRESENCE is tested — `props.X
|
|
97
|
+
* !== undefined` / `!= undefined` (or the `===`/`==` negation) — anywhere in
|
|
98
|
+
* a memo's computation (#2260). This is the "controlled component" idiom's
|
|
99
|
+
* `isControlled` check (`createMemo(() => props.pressed !== undefined)`):
|
|
100
|
+
* distinguishing "caller passed a value" from "caller omitted the prop" is
|
|
101
|
+
* only expressible on the nillable `interface{}` representation (a
|
|
102
|
+
* concrete `bool` field can't tell `pressed={false}` from omitted `pressed`
|
|
103
|
+
* apart — both are the Go zero value `false`), so these props take the
|
|
104
|
+
* same `interface{}` flip as `??`/attribute/text consumption
|
|
105
|
+
* (`resolvePropGoType`). `memoInitialFromParsedBody`'s presence-check
|
|
106
|
+
* branch then lowers the comparison to `in.X != nil`.
|
|
107
|
+
*
|
|
108
|
+
* Scoped to `ir.metadata.memos[].parsed` (not the generic tree walk the
|
|
109
|
+
* sibling collectors use) — a presence check is a memo-computation shape,
|
|
110
|
+
* never a JSX child/attribute expression.
|
|
111
|
+
*/
|
|
112
|
+
export declare function collectPresenceCheckedPropNames(ctx: GoEmitContext, ir: ComponentIR): Set<string>;
|
|
16
113
|
/**
|
|
17
114
|
* Resolve a prop param's Go struct-field type using the SAME logic
|
|
18
115
|
* `generatePropsStruct` / `generateInputStruct` use: a `propTypeOverrides` entry
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../../../src/adapter/props/prop-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAsB,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../../../src/adapter/props/prop-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE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-39,8 +39,16 @@ export declare function objectLiteralToGoMap(ctx: GoEmitContext, expr: ParsedExp
|
|
|
39
39
|
* Get a signal's initial value as Go code — a literal, or a props reference
|
|
40
40
|
* (`in.<Field>`, or the hoisted fallback var when `props.X ?? N` has one).
|
|
41
41
|
* Unrecognized values default to `0`.
|
|
42
|
+
*
|
|
43
|
+
* `signalType`, when passed, drives the same nillable-prop type-assertion
|
|
44
|
+
* `convertInitialValue` applies (#2260) — a caller resolving a getter as the
|
|
45
|
+
* operand of a boolean condition/ternary branch (`resolveGetterValueAsGo`)
|
|
46
|
+
* needs a concrete-typed result, not a bare `interface{}` field reference,
|
|
47
|
+
* when the referenced prop was flipped to nillable. Omitted by call sites
|
|
48
|
+
* that splice the result into an `interface{}`-typed context (e.g. a
|
|
49
|
+
* `map[string]any{...}` env entry), where the bare reference is fine.
|
|
42
50
|
*/
|
|
43
51
|
export declare function getSignalInitialValueAsGo(ctx: GoEmitContext, initialValue: string, propsParams: {
|
|
44
52
|
name: string;
|
|
45
|
-
}[], propFallbackVars?: ReadonlyMap<string, PropFallbackVar
|
|
53
|
+
}[], propFallbackVars?: ReadonlyMap<string, PropFallbackVar>, signalType?: TypeInfo): string;
|
|
46
54
|
//# sourceMappingURL=value-lowering.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value-lowering.d.ts","sourceRoot":"","sources":["../../../src/adapter/value/value-lowering.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"value-lowering.d.ts","sourceRoot":"","sources":["../../../src/adapter/value/value-lowering.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UA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