@barefootjs/go-template 0.16.0 → 0.17.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.
Files changed (73) hide show
  1. package/dist/adapter/analysis/component-tree.d.ts +23 -0
  2. package/dist/adapter/analysis/component-tree.d.ts.map +1 -0
  3. package/dist/adapter/emit-context.d.ts +53 -0
  4. package/dist/adapter/emit-context.d.ts.map +1 -0
  5. package/dist/adapter/expr/helper-inline.d.ts +31 -0
  6. package/dist/adapter/expr/helper-inline.d.ts.map +1 -0
  7. package/dist/adapter/expr/url-builder.d.ts +23 -0
  8. package/dist/adapter/expr/url-builder.d.ts.map +1 -0
  9. package/dist/adapter/go-template-adapter.d.ts +302 -1071
  10. package/dist/adapter/go-template-adapter.d.ts.map +1 -1
  11. package/dist/adapter/index.js +3116 -2692
  12. package/dist/adapter/lib/compile-state.d.ts +142 -0
  13. package/dist/adapter/lib/compile-state.d.ts.map +1 -0
  14. package/dist/adapter/lib/constants.d.ts +11 -0
  15. package/dist/adapter/lib/constants.d.ts.map +1 -0
  16. package/dist/adapter/lib/go-emit.d.ts +126 -0
  17. package/dist/adapter/lib/go-emit.d.ts.map +1 -0
  18. package/dist/adapter/lib/go-naming.d.ts +39 -0
  19. package/dist/adapter/lib/go-naming.d.ts.map +1 -0
  20. package/dist/adapter/lib/ir-scope.d.ts +13 -0
  21. package/dist/adapter/lib/ir-scope.d.ts.map +1 -0
  22. package/dist/adapter/lib/types.d.ts +165 -0
  23. package/dist/adapter/lib/types.d.ts.map +1 -0
  24. package/dist/adapter/memo/ctor-lowering.d.ts +39 -0
  25. package/dist/adapter/memo/ctor-lowering.d.ts.map +1 -0
  26. package/dist/adapter/memo/memo-compute.d.ts +173 -0
  27. package/dist/adapter/memo/memo-compute.d.ts.map +1 -0
  28. package/dist/adapter/memo/memo-type.d.ts +48 -0
  29. package/dist/adapter/memo/memo-type.d.ts.map +1 -0
  30. package/dist/adapter/memo/memo-value.d.ts +64 -0
  31. package/dist/adapter/memo/memo-value.d.ts.map +1 -0
  32. package/dist/adapter/memo/template-interp.d.ts +43 -0
  33. package/dist/adapter/memo/template-interp.d.ts.map +1 -0
  34. package/dist/adapter/props/prop-types.d.ts +31 -0
  35. package/dist/adapter/props/prop-types.d.ts.map +1 -0
  36. package/dist/adapter/spread/spread-codegen.d.ts +40 -0
  37. package/dist/adapter/spread/spread-codegen.d.ts.map +1 -0
  38. package/dist/adapter/type/type-codegen.d.ts +25 -0
  39. package/dist/adapter/type/type-codegen.d.ts.map +1 -0
  40. package/dist/adapter/value/parsed-literal-to-go.d.ts +17 -0
  41. package/dist/adapter/value/parsed-literal-to-go.d.ts.map +1 -0
  42. package/dist/adapter/value/value-lowering.d.ts +46 -0
  43. package/dist/adapter/value/value-lowering.d.ts.map +1 -0
  44. package/dist/build.js +3114 -2690
  45. package/dist/index.js +3116 -2692
  46. package/dist/test-render.d.ts.map +1 -1
  47. package/package.json +3 -3
  48. package/src/__tests__/derived-state-memo.test.ts +155 -84
  49. package/src/__tests__/go-template-adapter.test.ts +398 -54
  50. package/src/__tests__/lowering-plugin.test.ts +109 -0
  51. package/src/__tests__/query-href.test.ts +179 -0
  52. package/src/adapter/analysis/component-tree.ts +174 -0
  53. package/src/adapter/emit-context.ts +59 -0
  54. package/src/adapter/expr/helper-inline.ts +274 -0
  55. package/src/adapter/expr/url-builder.ts +123 -0
  56. package/src/adapter/go-template-adapter.ts +2189 -5320
  57. package/src/adapter/lib/compile-state.ts +181 -0
  58. package/src/adapter/lib/constants.ts +24 -0
  59. package/src/adapter/lib/go-emit.ts +309 -0
  60. package/src/adapter/lib/go-naming.ts +84 -0
  61. package/src/adapter/lib/ir-scope.ts +31 -0
  62. package/src/adapter/lib/types.ts +182 -0
  63. package/src/adapter/memo/ctor-lowering.ts +267 -0
  64. package/src/adapter/memo/memo-compute.ts +661 -0
  65. package/src/adapter/memo/memo-type.ts +93 -0
  66. package/src/adapter/memo/memo-value.ts +197 -0
  67. package/src/adapter/memo/template-interp.ts +246 -0
  68. package/src/adapter/props/prop-types.ts +84 -0
  69. package/src/adapter/spread/spread-codegen.ts +458 -0
  70. package/src/adapter/type/type-codegen.ts +95 -0
  71. package/src/adapter/value/parsed-literal-to-go.ts +94 -0
  72. package/src/adapter/value/value-lowering.ts +162 -0
  73. package/src/test-render.ts +48 -22
@@ -0,0 +1,173 @@
1
+ /**
2
+ * Memo initial-value computation — lower a memo's computation to its SSR initial
3
+ * value as a Go expression.
4
+ *
5
+ * Free functions over a {@link GoEmitContext}. `computeMemoInitialValue` is the
6
+ * typed-field entry (zero-value defaulting); `computeMemoInitialValueOrNull` is
7
+ * the pattern-matching core dispatching over template-literal, parsed-body,
8
+ * comparison-ternary, block-body and object memo shapes.
9
+ */
10
+ import type { ParsedExpr, ParsedStatement, TypeInfo } from '@barefootjs/jsx';
11
+ import type { GoEmitContext } from '../emit-context.ts';
12
+ import type { PropFallbackVar } from '../lib/types.ts';
13
+ /** A `() => props.X.filter((p) => <predicate>)` match: the array prop name,
14
+ * the predicate serialized to the runtime evaluator's ParsedExpr JSON, the
15
+ * arrow's param name, and the free variable names its predicate captures.
16
+ * Null when `body` isn't this shape, `propName` doesn't resolve to a known
17
+ * prop, or the predicate isn't representable (`serializeParsedExpr` refusal).
18
+ * Shared by the SSR-value emitter ({@link memoInitialFromParsedBody}) and the
19
+ * constructor's sibling-memo hoisting pre-pass so both walk the shape
20
+ * identically. */
21
+ export declare function matchFilterArmMemo(ctx: GoEmitContext, body: ParsedExpr, signals: {
22
+ getter: string;
23
+ initialValue: string;
24
+ }[], propsParams: {
25
+ name: string;
26
+ type?: TypeInfo;
27
+ defaultValue?: string;
28
+ }[]): {
29
+ propName: string;
30
+ predJSON: string;
31
+ paramName: string;
32
+ freeVars: string[];
33
+ } | null;
34
+ /**
35
+ * Names of EARLIER sibling memos (per `ctx.state.currentMemos` declaration
36
+ * order) that a filter-arm memo's predicate free variables resolve to — the
37
+ * constructor generator hoists these into a shared local so the sibling's
38
+ * expression isn't emitted twice (once for its own field, once inlined in
39
+ * this memo's `bf.FilterEval` env map, #2075/#2077 review finding 3). Empty
40
+ * when `memo` isn't a filter-arm memo or references nothing hoistable.
41
+ */
42
+ export declare function filterArmEarlierSiblingRefs(ctx: GoEmitContext, memo: {
43
+ name: string;
44
+ parsed?: ParsedExpr;
45
+ }, signals: {
46
+ getter: string;
47
+ initialValue: string;
48
+ }[], propsParams: {
49
+ name: string;
50
+ type?: TypeInfo;
51
+ defaultValue?: string;
52
+ }[]): string[];
53
+ /**
54
+ * Compute a memo's SSR initial value as a Go expression — e.g.
55
+ * `() => count() * 2` → `in.Initial * 2`, `() => props.value * 10` →
56
+ * `in.Value * 10`. Unresolved computations default to the memo's Go zero value.
57
+ *
58
+ * @param propFallbackVars when a hoisted fallback var exists for a referenced
59
+ * prop, it is substituted for `in.FieldName` so the memo inherits the
60
+ * signal-time `??` fallback
61
+ * @param goType Go type of the memo field, used to pick the zero-value fallback
62
+ */
63
+ export declare function computeMemoInitialValue(ctx: GoEmitContext, memo: {
64
+ name: string;
65
+ computation: string;
66
+ deps: string[];
67
+ parsed?: ParsedExpr;
68
+ }, signals: {
69
+ getter: string;
70
+ initialValue: string;
71
+ }[], propsParams: {
72
+ name: string;
73
+ type?: TypeInfo;
74
+ defaultValue?: string;
75
+ }[], propFallbackVars?: ReadonlyMap<string, PropFallbackVar>, goType?: string): string;
76
+ /**
77
+ * Structural matcher for the common expression-bodied memo shapes, driven by
78
+ * the analyzer-attached `MemoInfo.parsed` (the memo arrow's body): `getter() ===
79
+ * 'lit'`, `props.X ?? false`, `cond() ? A : B`, `<getter()|props.X|var> <*+-/>
80
+ * <int>`, and bare `getter()` / `props.X` / `var`.
81
+ *
82
+ * @returns the Go SSR value, or null when the body is none of these (the caller
83
+ * then falls through to comparison-ternary / block-body / object-memo handling)
84
+ */
85
+ export declare function memoInitialFromParsedBody(ctx: GoEmitContext, body: ParsedExpr, signals: {
86
+ getter: string;
87
+ initialValue: string;
88
+ }[], propsParams: {
89
+ name: string;
90
+ type?: TypeInfo;
91
+ defaultValue?: string;
92
+ }[], propFallbackVars: ReadonlyMap<string, PropFallbackVar>, currentMemoName: string, resolving?: ReadonlySet<string>): string | null;
93
+ /**
94
+ * Pattern-matching core of `computeMemoInitialValue`.
95
+ *
96
+ * @returns the memo's SSR initial value as a Go expression, or `null` when no
97
+ * pattern applies. Callers with a typed field to fill use the
98
+ * zero-value-defaulting wrapper above; callers that can OMIT the field (a
99
+ * child-instance prop init, where Go's zero values then apply with the right
100
+ * type) use this directly.
101
+ */
102
+ export declare function computeMemoInitialValueOrNull(ctx: GoEmitContext, memo: {
103
+ name: string;
104
+ computation: string;
105
+ deps: string[];
106
+ parsed?: ParsedExpr;
107
+ parsedBlock?: ParsedStatement[];
108
+ parsedBlockComplete?: boolean;
109
+ }, signals: {
110
+ getter: string;
111
+ initialValue: string;
112
+ }[], propsParams: {
113
+ name: string;
114
+ type?: TypeInfo;
115
+ defaultValue?: string;
116
+ }[], propFallbackVars?: ReadonlyMap<string, PropFallbackVar>,
117
+ /**
118
+ * Memo names currently being resolved on this call stack — guards against
119
+ * unbounded recursion when memos reference each other (mutually, or a
120
+ * self-reference). Callers that start a fresh top-level computation seed
121
+ * this with `memo.name`; recursive calls extend it with the sibling memo
122
+ * about to be entered. A candidate already in the set resolves to `null`
123
+ * (the shape's usual "unsupported" fallback) instead of recursing.
124
+ */
125
+ resolving?: ReadonlySet<string>): string | null;
126
+ /**
127
+ * Resolve a signal/memo getter NAME to a Go value expression, for use as the
128
+ * condition operand of another memo's ternary. Handles a plain signal, a
129
+ * prop-shadow memo `() => props.X ?? 'lit'` (→ a nil/empty-tolerant field
130
+ * read), else recurses.
131
+ *
132
+ * @returns the Go expression, or null when the shape isn't representable
133
+ */
134
+ export declare function resolveGetterValueAsGo(ctx: GoEmitContext, name: string, signals: {
135
+ getter: string;
136
+ initialValue: string;
137
+ }[], propsParams: {
138
+ name: string;
139
+ type?: TypeInfo;
140
+ defaultValue?: string;
141
+ }[], propFallbackVars: ReadonlyMap<string, PropFallbackVar>, resolving?: ReadonlySet<string>): string | null;
142
+ /**
143
+ * Resolve a string-ternary memo whose condition is a literal comparison —
144
+ * `() => <operand> === 'lit' ? A : B` (or `!==`) — to a Go runtime conditional.
145
+ * Branches must be string literals/module-string-consts; the operand resolves
146
+ * via `resolveComparisonOperandGo`.
147
+ *
148
+ * @returns the Go conditional, or null when the shape isn't supported
149
+ */
150
+ export declare function computeComparisonTernaryGo(ctx: GoEmitContext, parsed: ParsedExpr | undefined, signals: {
151
+ getter: string;
152
+ initialValue: string;
153
+ }[], propsParams: {
154
+ name: string;
155
+ type?: TypeInfo;
156
+ defaultValue?: string;
157
+ }[], propFallbackVars: ReadonlyMap<string, PropFallbackVar>, resolving?: ReadonlySet<string>): string | null;
158
+ /**
159
+ * Resolve the left operand of a string-ternary memo's comparison condition to a
160
+ * Go expression: a zero-arg getter call (a signal/prop-shadow memo), an inline
161
+ * `props.X ?? 'def'` (folds the default), or a bare `props.X`.
162
+ *
163
+ * @returns the Go expression, or null for anything else
164
+ */
165
+ export declare function resolveComparisonOperandGo(ctx: GoEmitContext, node: ParsedExpr, signals: {
166
+ getter: string;
167
+ initialValue: string;
168
+ }[], propsParams: {
169
+ name: string;
170
+ type?: TypeInfo;
171
+ defaultValue?: string;
172
+ }[], propFallbackVars: ReadonlyMap<string, PropFallbackVar>, resolving?: ReadonlySet<string>): string | null;
173
+ //# sourceMappingURL=memo-compute.d.ts.map
@@ -0,0 +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,C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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"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Memo type inference predicates.
3
+ *
4
+ * Pure free functions over a {@link GoEmitContext} that classify a memo's
5
+ * computation so `inferMemoType` can pick the right Go field type (and thus the
6
+ * right SSR zero value).
7
+ */
8
+ import type { ParsedExpr, TypeInfo } from '@barefootjs/jsx';
9
+ import type { GoEmitContext } from '../emit-context.ts';
10
+ /**
11
+ * True when a memo's body is a `.filter(<arrow>)` callback-method call
12
+ * (#2075) — a LIST-valued derived memo (the blog PostList `visible` shape:
13
+ * `createMemo(() => props.items.filter((p) => …))`), not a scalar. Exported
14
+ * so both `isBooleanMemo` (guard below) and `inferMemoType`'s field-type
15
+ * decision (go-template-adapter.ts) share the one recognition point.
16
+ */
17
+ export declare function isListFilterMemo(memo: {
18
+ parsed?: ParsedExpr;
19
+ }): boolean;
20
+ /**
21
+ * Heuristic: does this memo evaluate to a boolean? True when its computation is
22
+ * a comparison (`!==`/`===`/`!=`/`==`), a negation (`!x`), or a ternary whose
23
+ * branches are all boolean signals/props. Used to pick `bool` (zero value
24
+ * `false`) over the int `0` default for the SSR initial value.
25
+ */
26
+ export declare function isBooleanMemo(ctx: GoEmitContext, memo: {
27
+ computation: string;
28
+ deps: string[];
29
+ parsed?: ParsedExpr;
30
+ }, signals: {
31
+ getter: string;
32
+ initialValue: string;
33
+ type: TypeInfo;
34
+ }[], propsParamMap: Map<string, {
35
+ name: string;
36
+ type: TypeInfo;
37
+ defaultValue?: string;
38
+ }>): boolean;
39
+ /**
40
+ * Does this memo's body resolve to a ternary whose BOTH branches are
41
+ * string-valued — e.g. `() => orientation() === 'vertical' ? 'flex-col' :
42
+ * 'flex'`? Such a memo is a string, not a bool, even though its condition
43
+ * contains `===`. Since #2040 a block-bodied memo can also carry `parsed` (a
44
+ * value `if` / early-return folds to a ternary), so this now applies to those
45
+ * too — the inferred field type follows the folded shape, not the syntax.
46
+ */
47
+ export declare function isStringTernaryMemo(ctx: GoEmitContext, parsed: ParsedExpr | undefined): boolean;
48
+ //# sourceMappingURL=memo-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memo-type.d.ts","sourceRoot":"","sources":["../../../src/adapter/memo/memo-type.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGvD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAE,GAAG,OAAO,CAIvE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,UAAU,CAAA;CAAE,EAClE,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,EAAE,EACnE,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAClF,OAAO,CAmCT;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAS/F"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Memo value computation for block-body / object-returning memos.
3
+ *
4
+ * Free functions over a {@link GoEmitContext}:
5
+ * - `resolveBlockBodyMemoModuleConst` recognises a guard-and-return-module-
6
+ * const memo and reports the constant, reading `state.localConstants`.
7
+ * - `computeObjectMemoInitialValue` lowers a `searchParams()`-derived
8
+ * object-returning memo to a Go `map[string]interface{}` literal, reading
9
+ * the analyzer-carried `parsedBlock` and `state.searchParamsLocals` and
10
+ * delegating value lowering to `lowerCtorExpr`.
11
+ */
12
+ import type { ParsedExpr, ParsedStatement, TypeInfo } from '@barefootjs/jsx';
13
+ import type { GoEmitContext } from '../emit-context.ts';
14
+ type GuardConstResult = {
15
+ constName: string;
16
+ constValue: string | undefined;
17
+ constType: TypeInfo | undefined;
18
+ constParsed: ParsedExpr | undefined;
19
+ };
20
+ /**
21
+ * Recognise a block-body memo whose SSR path returns a module-const array when
22
+ * the guard signal starts falsy:
23
+ * `() => { const k = getter(); if (!k) return MODULE_CONST; … }`
24
+ *
25
+ * Primary path: the block is normalized to a single expression upstream (#2040,
26
+ * `foldBlockToExpr` in the analyzer), so this reads the folded `MemoInfo.parsed`
27
+ * conditional `!getter() ? MODULE_CONST : <derived>`. When the guard signal's
28
+ * initial value is falsy, `!guard` is `true`, so the `consequent` is the const
29
+ * rendered at SSR.
30
+ *
31
+ * Fallback path: a block the fold REFUSES (e.g. an impure local binding that
32
+ * isn't used exactly once per path sits alongside the guard) leaves
33
+ * `MemoInfo.parsed` unset, but the guard prefix is still present in the tolerant
34
+ * `MemoInfo.parsedBlock`. Scan that prefix so the SSR const bake matches `main`
35
+ * exactly — the bake depends only on the guard, not on the unfoldable tail.
36
+ *
37
+ * @returns the constant's name, value, inferred type and parsed tree, or null
38
+ */
39
+ export declare function resolveBlockBodyMemoModuleConst(ctx: GoEmitContext, memo: {
40
+ parsed?: ParsedExpr;
41
+ parsedBlock?: ParsedStatement[];
42
+ }, signals: {
43
+ getter: string;
44
+ initialValue: string;
45
+ }[]): GuardConstResult | null;
46
+ /**
47
+ * Compute the SSR value of an object-returning block-body memo derived from
48
+ * `searchParams()`:
49
+ * () => { const sp = searchParams(); return { sort: asSortKey(sp.get('sort')),
50
+ * tag: sp.get('tag') ?? '' } }
51
+ * Emits a Go `map[string]interface{}{ "Sort": …, "Tag": … }` whose values are
52
+ * lowered from the request query (see `lowerCtorExpr`). Keys are capitalized to
53
+ * match the template's `.Params.<Field>` map access.
54
+ *
55
+ * @returns the Go map literal, or null for any shape the lowerer can't
56
+ * represent (→ nil-map fallback)
57
+ */
58
+ export declare function computeObjectMemoInitialValue(ctx: GoEmitContext, memo: {
59
+ parsed?: ParsedExpr;
60
+ parsedBlock?: ParsedStatement[];
61
+ parsedBlockComplete?: boolean;
62
+ }): string | null;
63
+ export {};
64
+ //# sourceMappingURL=memo-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memo-value.d.ts","sourceRoot":"","sources":["../../../src/adapter/memo/memo-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAKvD,KAAK,gBAAgB,GAAG;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,SAAS,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC/B,WAAW,EAAE,UAAU,GAAG,SAAS,CAAA;CACpC,CAAA;AAkBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,+BAA+B,CAC7C,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAC;IAAC,WAAW,CAAC,EAAE,eAAe,EAAE,CAAA;CAAE,EAC9D,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,EAAE,GAClD,gBAAgB,GAAG,IAAI,CAKzB;AAsED;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAC;IAAC,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;IAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5F,MAAM,GAAG,IAAI,CAwCf"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Template-literal memo lowering.
3
+ *
4
+ * Free functions over a {@link GoEmitContext} that compute the SSR initial
5
+ * value of a template-literal memo (`() => `${a} ${props.x ?? ''} grid``) as a
6
+ * Go `string` expression. Each quasi becomes a Go string literal; each
7
+ * interpolation resolves to a module string const, a `Record`-index access, or
8
+ * a `props.<name>` field read. Sets `state.usesFmt` when a `Record`-index
9
+ * interpolation emits `fmt.Sprint`.
10
+ */
11
+ import ts from 'typescript';
12
+ import type { ParsedExpr, ParsedStatement, TypeInfo } from '@barefootjs/jsx';
13
+ import type { GoEmitContext } from '../emit-context.ts';
14
+ /**
15
+ * Compute the SSR initial value of a template-literal memo as a Go `string`
16
+ * expression, e.g. `() => `${a} ${props.className ?? ''} grid``.
17
+ *
18
+ * Each quasi becomes a Go string literal; each interpolation is resolved:
19
+ * - an identifier naming a module string const → its inlined literal (covers
20
+ * pure-string and `[...].join(' ')` consts);
21
+ * - `props.<name> ?? '<fallback>'` or bare `props.<name>` → `in.<Field>` when
22
+ * `<name>` is a known string-typed prop param (the `?? ''` fallback maps to
23
+ * Go's zero value for an unset string field).
24
+ *
25
+ * @returns the `"a" + in.Field + " grid..."` concatenation, or null when the
26
+ * computation isn't a single template literal or any interpolation isn't
27
+ * representable
28
+ */
29
+ export declare function computeTemplateLiteralMemoInitialValue(ctx: GoEmitContext, memo: {
30
+ parsed?: ParsedExpr;
31
+ parsedBlock?: ParsedStatement[];
32
+ parsedBlockComplete?: boolean;
33
+ }, propsParams: {
34
+ name: string;
35
+ type?: TypeInfo;
36
+ defaultValue?: string;
37
+ }[]): string | null;
38
+ /**
39
+ * If `node` is a `<propsObjectName>.<name>` access, return `<name>`, else
40
+ * null. Used to recognize props-object reads inside memo interpolations.
41
+ */
42
+ export declare function propsAccessName(ctx: GoEmitContext, node: ts.Expression): string | null;
43
+ //# sourceMappingURL=template-interp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-interp.d.ts","sourceRoot":"","sources":["../../../src/adapter/memo/template-interp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAIvD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sCAAsC,CACpD,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,UAAU,CAAC;IAAC,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;IAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAAE,EAC7F,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,GACtE,MAAM,GAAG,IAAI,CAsDf;AAgJD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,GAAG,MAAM,GAAG,IAAI,CAKtF"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Prop-type resolution: decide each prop's Go struct-field type.
3
+ *
4
+ * Free functions over a {@link GoEmitContext}, shared by the Input/Props struct
5
+ * generators and the nillable-field set so they can't drift.
6
+ */
7
+ import type { ComponentIR, IRMetadata } from '@barefootjs/jsx';
8
+ import type { GoEmitContext } from '../emit-context.ts';
9
+ /**
10
+ * Build a map from prop name to a better Go type inferred from signals. When a
11
+ * signal is initialized from a prop (`createSignal(props.initial ?? 0)`), the
12
+ * signal's type annotation may be more specific than the prop's `TypeInfo`. Only
13
+ * generic prop types (containing `interface{}`) are overridden.
14
+ */
15
+ export declare function buildPropTypeOverrides(ctx: GoEmitContext, ir: ComponentIR): Map<string, string>;
16
+ /**
17
+ * Resolve a prop param's Go struct-field type using the SAME logic
18
+ * `generatePropsStruct` / `generateInputStruct` use: a `propTypeOverrides` entry
19
+ * wins, otherwise `typeInfoToGo(param.type, param.defaultValue)`. Factored out so
20
+ * the nillable-field set (`collectNillablePropNames`) can't drift from the
21
+ * emitted field types.
22
+ */
23
+ export declare function resolvePropGoType(ctx: GoEmitContext, param: IRMetadata['propsParams'][number], propTypeOverrides: Map<string, string>): string;
24
+ /**
25
+ * Build the set of prop NAMES whose resolved Go field type is exactly
26
+ * `interface{}` (nillable, for Hono-style attribute omission). Uses the same
27
+ * `propTypeOverrides` + `resolvePropGoType` pipeline as the struct generators.
28
+ * Concrete (`string`/`int`/`bool`/`[]T`/struct) types are excluded.
29
+ */
30
+ export declare function collectNillablePropNames(ctx: GoEmitContext, ir: ComponentIR): Set<string>;
31
+ //# sourceMappingURL=prop-types.d.ts.map
@@ -0,0 +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,EAAE,MAAM,iBAAiB,CAAA;AAE9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGvD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAoB/F;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,EACxC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACrC,MAAM,CAeR;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CASzF"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Spread-bag codegen: lower JSX `{...spread}` attributes to Go.
3
+ *
4
+ * Free functions over a {@link GoEmitContext}. Two entry points:
5
+ * - `collectSpreadSlots` walks the IR (stopping at loop bodies) to gather the
6
+ * `SpreadSlotInfo` entries plumbed onto the Input/Props structs.
7
+ * - `buildSpreadInitializer` builds the Go expression for a spread bag's
8
+ * initial value placed inside `NewXxxProps`: signal-getter object literals,
9
+ * destructured / SolidJS-style / rest props, and conditional inline-object
10
+ * spreads.
11
+ */
12
+ import type { ComponentIR, IRNode, ParsedExpr } from '@barefootjs/jsx';
13
+ import type { GoEmitContext } from '../emit-context.ts';
14
+ import type { SpreadSlotInfo } from '../lib/types.ts';
15
+ /**
16
+ * Walk the IR (elements, fragments, conditionals, providers, async, components)
17
+ * but stop at loop bodies. Each `'spread'` attr value with a `slotId` becomes
18
+ * one `SpreadSlotInfo` entry.
19
+ */
20
+ export declare function collectSpreadSlots(ctx: GoEmitContext, node: IRNode): SpreadSlotInfo[];
21
+ /**
22
+ * Build a Go expression for a JSX spread bag's initial value, placed inside
23
+ * `NewXxxProps`'s return literal.
24
+ *
25
+ * Supported shapes:
26
+ * - Signal-getter call (`attrs()`): emit the signal's object literal as a Go
27
+ * `map[string]any{...}`.
28
+ * - Bare identifier matching a destructured `propsParam`: emit `in.<Field>`.
29
+ * - Bare identifier matching `propsObjectName` (SolidJS-style `props`):
30
+ * enumerate `propsParams` into an inline `map[string]any{...}` (each Input
31
+ * field becomes a bag key).
32
+ * - Bare identifier matching `restPropsName` (destructured rest): emit
33
+ * `in.<Field>` against the `map[string]any` Input field added for
34
+ * `input-bag` slots; the caller populates the open-ended rest values.
35
+ *
36
+ * @returns `null` for unsupported shapes so the caller can raise a narrowed
37
+ * BF101 with the offending expression.
38
+ */
39
+ export declare function buildSpreadInitializer(ctx: GoEmitContext, spreadExpr: string, ir: ComponentIR, parsed?: ParsedExpr): string | null;
40
+ //# sourceMappingURL=spread-codegen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spread-codegen.d.ts","sourceRoot":"","sources":["../../../src/adapter/spread/spread-codegen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EAQN,UAAU,EACX,MAAM,iBAAiB,CAAA;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAGrD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,EAAE,CAIrF;AAuID;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,aAAa,EAClB,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,WAAW,EACf,MAAM,CAAC,EAAE,UAAU,GAClB,MAAM,GAAG,IAAI,CA0Ef"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Type codegen: render TypeScript types as Go type strings.
3
+ *
4
+ * Free functions over a {@link GoEmitContext}. They resolve a prop/signal/const's
5
+ * type (`TypeInfo`, a raw type string, or — as a last resort — an inferred shape
6
+ * from a literal value) into the Go type used for its struct field. They read
7
+ * only `state.localTypeNames`; `inferTypeFromValue` is fully pure.
8
+ */
9
+ import type { TypeInfo } from '@barefootjs/jsx';
10
+ import type { GoEmitContext } from '../emit-context.ts';
11
+ /**
12
+ * Convert a `TypeInfo` to a Go type string.
13
+ *
14
+ * @param defaultValue used to infer the type when `typeInfo.kind` is `unknown`
15
+ * @returns the Go type, falling back to `interface{}` when unresolvable
16
+ */
17
+ export declare function typeInfoToGo(ctx: GoEmitContext, typeInfo: TypeInfo, defaultValue?: string): string;
18
+ /**
19
+ * Convert a raw TypeScript type string to a Go type string. Handles primitives,
20
+ * `T[]` / `Array<T>` arrays, and known local types; else `interface{}`.
21
+ */
22
+ export declare function tsTypeStringToGo(ctx: GoEmitContext, tsType: string): string;
23
+ /** Infer a Go type from a JS value literal; `interface{}` when unrecognized. */
24
+ export declare function inferTypeFromValue(value: string): string;
25
+ //# sourceMappingURL=type-codegen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-codegen.d.ts","sourceRoot":"","sources":["../../../src/adapter/type/type-codegen.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,aAAa,EAClB,QAAQ,EAAE,QAAQ,EAClB,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAsCR;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAa3E;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAWxD"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Lower a structured literal `ParsedExpr` (carried on the IR) to a Go literal,
3
+ * for baking a signal's inline initial value into the SSR data context.
4
+ *
5
+ * Covers scalar literals, a unary-minus number, arrays of those, and object
6
+ * literals baked against a concrete local struct.
7
+ *
8
+ * Contract is **null-means-defer**: returns null for anything not reproduced
9
+ * exactly — an object whose target type isn't a known struct, a key the struct
10
+ * doesn't declare, a nested object/array property value, an empty array, an
11
+ * identifier/call, or a numeric literal missing its `raw` token. The caller
12
+ * then keeps `nil`.
13
+ */
14
+ import type { ParsedExpr, TypeInfo } from '@barefootjs/jsx';
15
+ import type { GoEmitContext } from '../emit-context.ts';
16
+ export declare function parsedLiteralToGo(ctx: GoEmitContext, expr: ParsedExpr, typeInfo?: TypeInfo): string | null;
17
+ //# sourceMappingURL=parsed-literal-to-go.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsed-literal-to-go.d.ts","sourceRoot":"","sources":["../../../src/adapter/value/parsed-literal-to-go.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGvD,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,UAAU,EAChB,QAAQ,CAAC,EAAE,QAAQ,GAClB,MAAM,GAAG,IAAI,CAsEf"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Value lowering: convert a JS signal/const initial value into a Go literal for
3
+ * the SSR data context — scalars, prop references, and fully-literal
4
+ * arrays/objects — falling back to `nil`/`0` for anything not reducible to a
5
+ * literal. Pure free functions over a {@link GoEmitContext}.
6
+ */
7
+ import type { ParsedExpr, TypeInfo } from '@barefootjs/jsx';
8
+ import type { GoEmitContext } from '../emit-context.ts';
9
+ import type { PropFallbackVar } from '../lib/types.ts';
10
+ /**
11
+ * Lower a signal/const initial value to its Go SSR literal: a prop reference
12
+ * becomes `in.<Field>`, a non-literal falls back to the type's zero value.
13
+ */
14
+ export declare function convertInitialValue(ctx: GoEmitContext, value: string, typeInfo: TypeInfo, propsParams?: {
15
+ name: string;
16
+ }[], preParsed?: ParsedExpr): string;
17
+ /**
18
+ * Lower a fully-literal value — from the analyzer's carried `ParsedExpr` tree —
19
+ * to a Go literal typed as `typeInfo`:
20
+ *
21
+ * `["x", "y"]` (string[]) → `[]string{"x", "y"}`
22
+ * `["x", "y"]` (unknown[]) → `[]interface{}{"x", "y"}`
23
+ * `[{ id: "a" }]` (Item[]) → `[]Item{Item{ID: "a"}}`
24
+ *
25
+ * Returns null (caller keeps `nil`) for a non-literal, or a shape that can't be
26
+ * expressed in the target type (e.g. an object in a `[]interface{}`, unreachable
27
+ * via the template's struct-field access).
28
+ */
29
+ export declare function jsLiteralToGo(ctx: GoEmitContext, typeInfo: TypeInfo, preParsed?: ParsedExpr): string | null;
30
+ /**
31
+ * Bake a flat object literal (`{ align: 'start' }`) into a Go
32
+ * `map[string]interface{}` keyed by SOURCE property names, so it round-trips
33
+ * through `bf_json` like `JSON.stringify` (only the supplied keys, no zero-filled
34
+ * struct fields). Used for an inline object passed to a child's optional object
35
+ * prop. Returns null for a non-object / shorthand / nested / empty object.
36
+ */
37
+ export declare function objectLiteralToGoMap(ctx: GoEmitContext, expr: ParsedExpr): string | null;
38
+ /**
39
+ * Get a signal's initial value as Go code — a literal, or a props reference
40
+ * (`in.<Field>`, or the hoisted fallback var when `props.X ?? N` has one).
41
+ * Unrecognized values default to `0`.
42
+ */
43
+ export declare function getSignalInitialValueAsGo(ctx: GoEmitContext, initialValue: string, propsParams: {
44
+ name: string;
45
+ }[], propFallbackVars?: ReadonlyMap<string, PropFallbackVar>): string;
46
+ //# sourceMappingURL=value-lowering.d.ts.map
@@ -0,0 +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;AAOtD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,QAAQ,EAClB,WAAW,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EAChC,SAAS,CAAC,EAAE,UAAU,GACrB,MAAM,CAgDR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,aAAa,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,CAAC,EAAE,UAAU,GACrB,MAAM,GAAG,IAAI,CAMf;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAWxF;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,aAAa,EAClB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EAC/B,gBAAgB,GAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAA4B,GAChF,MAAM,CA8BR"}