@barefootjs/go-template 0.17.0 → 0.18.0
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/expr/url-builder.d.ts.map +1 -1
- package/dist/adapter/go-template-adapter.d.ts +144 -14
- package/dist/adapter/go-template-adapter.d.ts.map +1 -1
- package/dist/adapter/index.js +449 -118
- package/dist/adapter/lib/compile-state.d.ts +27 -1
- package/dist/adapter/lib/compile-state.d.ts.map +1 -1
- package/dist/adapter/lib/go-emit.d.ts +9 -0
- package/dist/adapter/lib/go-emit.d.ts.map +1 -1
- package/dist/adapter/lib/go-naming.d.ts +23 -0
- package/dist/adapter/lib/go-naming.d.ts.map +1 -1
- package/dist/adapter/memo/memo-compute.d.ts +54 -5
- package/dist/adapter/memo/memo-compute.d.ts.map +1 -1
- package/dist/adapter/memo/memo-type.d.ts +10 -0
- package/dist/adapter/memo/memo-type.d.ts.map +1 -1
- package/dist/adapter/type/type-codegen.d.ts +5 -1
- package/dist/adapter/type/type-codegen.d.ts.map +1 -1
- package/dist/adapter/value/parsed-literal-to-go.d.ts +13 -4
- package/dist/adapter/value/parsed-literal-to-go.d.ts.map +1 -1
- package/dist/build.js +449 -118
- package/dist/conformance-pins.d.ts +12 -0
- package/dist/conformance-pins.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +468 -118
- package/package.json +3 -3
- package/src/__tests__/go-template-adapter.test.ts +652 -129
- package/src/__tests__/lowering-plugin.test.ts +56 -0
- package/src/adapter/expr/url-builder.ts +14 -3
- package/src/adapter/go-template-adapter.ts +637 -140
- package/src/adapter/lib/compile-state.ts +31 -0
- package/src/adapter/lib/go-emit.ts +20 -0
- package/src/adapter/lib/go-naming.ts +29 -0
- package/src/adapter/memo/memo-compute.ts +228 -18
- package/src/adapter/memo/memo-type.ts +19 -0
- package/src/adapter/type/type-codegen.ts +22 -3
- package/src/adapter/value/parsed-literal-to-go.ts +82 -9
- package/src/conformance-pins.ts +135 -0
- package/src/index.ts +1 -0
- package/src/test-render.ts +46 -8
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* compiles), the render-recursion cursor stacks (`loopParamStack`,
|
|
10
10
|
* `filterExprDepth`, …), and constant config (`options`, `templatePrimitives`).
|
|
11
11
|
*/
|
|
12
|
-
import type { CompilerError, ContextConsumer, IRMetadata, IRNode, LoweringMatcher, MemoInfo, TypeDefinition, TypeInfo } from '@barefootjs/jsx';
|
|
12
|
+
import type { CompilerError, ContextConsumer, EnvSignalReader, IRMetadata, IRNode, LoweringMatcher, MemoInfo, SsrSeedPlan, TypeDefinition, TypeInfo } from '@barefootjs/jsx';
|
|
13
13
|
export declare class CompileState {
|
|
14
14
|
componentName: string;
|
|
15
15
|
errors: CompilerError[];
|
|
@@ -67,6 +67,32 @@ export declare class CompileState {
|
|
|
67
67
|
* imported under (handles `import { searchParams as sp }`).
|
|
68
68
|
*/
|
|
69
69
|
searchParamsLocals: Set<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Env-signal getter (local binding name, e.g. `searchParams` or an alias) →
|
|
72
|
+
* its registered {@link EnvSignalReader}, keyed by the RECEIVER signal's own
|
|
73
|
+
* `envReader` registration rather than a hardcoded key — so a memo body's
|
|
74
|
+
* `<local>().<method>(...)` resolves to whichever reader that particular
|
|
75
|
+
* local belongs to (open-closed for a future second env signal).
|
|
76
|
+
*/
|
|
77
|
+
envSignalReadersByLocal: Map<string, EnvSignalReader>;
|
|
78
|
+
/**
|
|
79
|
+
* The backend-neutral SSR seed plan (`computeSsrSeedPlan`, Package G) for
|
|
80
|
+
* the IR currently being compiled — single authority for which signal/memo
|
|
81
|
+
* getters are value-materializable at SSR time (`env-reader` steps are
|
|
82
|
+
* per-request readers; everything else is `derived`/`opaque`). Populated in
|
|
83
|
+
* `primeCompileState`; `envSignalReadersByLocal` and `searchParamsLocals`
|
|
84
|
+
* derive from it there, and the memo-analysis path in `memo-compute.ts`
|
|
85
|
+
* reads its `steps` directly instead of re-deriving from `metadata`.
|
|
86
|
+
*/
|
|
87
|
+
ssrSeedPlan: SsrSeedPlan;
|
|
88
|
+
/**
|
|
89
|
+
* Memo name → the hoisted Go local variable name the constructor assigned
|
|
90
|
+
* its SSR value to (populated by the sibling-memo hoisting pre-pass before
|
|
91
|
+
* the main memo-field loop runs). When a later filter-arm memo's free-var
|
|
92
|
+
* resolution finds an entry here, it reuses the local instead of
|
|
93
|
+
* recomputing the sibling's expression a second time.
|
|
94
|
+
*/
|
|
95
|
+
hoistedMemoLocals: Map<string, string>;
|
|
70
96
|
/**
|
|
71
97
|
* Call-lowering matchers active for this component (#2057), bound to its
|
|
72
98
|
* metadata at init via `prepareLoweringMatchers`. Each maps a recognised call
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-state.d.ts","sourceRoot":"","sources":["../../../src/adapter/lib/compile-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,UAAU,EACV,MAAM,EACN,eAAe,EACf,QAAQ,EACR,cAAc,EACd,QAAQ,EACT,MAAM,iBAAiB,CAAA;AAExB,qBAAa,YAAY;IAGvB,aAAa,EAAE,MAAM,CAAK;IAC1B,MAAM,EAAE,aAAa,EAAE,CAAK;IAE5B;;+CAE2C;IAC3C,uBAAuB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAY;IAEhD,kBAAkB,EAAE,MAAM,CAAI;IAE9B;;;OAGG;IACH,sBAAsB,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAK;IAErE,eAAe,EAAE,MAAM,GAAG,IAAI,CAAO;IAErC;;;;OAIG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAO;IAEnC;;;;;OAKG;IACH,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAY;IAEn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AK;IAExC;;;;OAIG;IACH,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAY;IAE1C;gBACY;IACZ,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAY;IAEvC;;4DAEwD;IACxD,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAY;IAIpD;sEACkE;IAClE,gBAAgB,EAAE,OAAO,CAAQ;IAEjC;sCACkC;IAClC,OAAO,EAAE,OAAO,CAAQ;IAExB,uFAAuF;IACvF,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAY;IAEvC,mFAAmF;IACnF,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAY;IAEjD;;;;OAIG;IACH,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAY;IAE/D;;;OAGG;IACH,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAY;IAEnD;yEACqE;IACrE,kBAAkB,UAAQ;CAC3B"}
|
|
@@ -79,6 +79,15 @@ export declare function emitPredicateEval(funcName: string, recv: string, predic
|
|
|
79
79
|
* the projection is outside the evaluator surface (→ caller pushes BF101).
|
|
80
80
|
*/
|
|
81
81
|
export declare function emitFlatMapEval(recv: string, body: ParsedExpr, param: string, emit: (e: ParsedExpr) => string): string | null;
|
|
82
|
+
/**
|
|
83
|
+
* Emit a value-producing `.map(cb)` via the evaluator (#2073): the projection
|
|
84
|
+
* body is serialized and evaluated per element by `bf_map_eval`, one result
|
|
85
|
+
* per element (no flatten — the JS `.map` contract). Composes through the
|
|
86
|
+
* array-method chain (`bf_join (bf_map_eval …) " "`). Returns null when the
|
|
87
|
+
* projection is outside the evaluator surface (→ caller pushes BF101). The
|
|
88
|
+
* JSX-returning `.map` is an IRLoop upstream and never reaches this emit.
|
|
89
|
+
*/
|
|
90
|
+
export declare function emitMapEval(recv: string, body: ParsedExpr, param: string, emit: (e: ParsedExpr) => string): string | null;
|
|
82
91
|
/**
|
|
83
92
|
* Make an equality comparison string-tolerant when exactly one side is a Go
|
|
84
93
|
* string literal: JS `sorted === 'asc'` is loosely false for `sorted = false`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"go-emit.d.ts","sourceRoot":"","sources":["../../../src/adapter/lib/go-emit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAKhF,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,cAAc,GAAG,MAAM,CAMlE;AAiBD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EAAE,EAChB,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAC9B,MAAM,GAAG,IAAI,CAWf;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,EAAE,EAChB,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,MAAM,GAAG,OAAO,EAC3B,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAC9B,MAAM,GAAG,IAAI,CAqBf;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAC/B,QA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AI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAC9B,MAAM,GAAG,IAAI,CAKf;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAO/E;AAID,eAAO,MAAM,sBAAsB,uGACmE,CAAA;AAOtG,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAIzE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAe7E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAUrE;AAED,+DAA+D;AAC/D,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAW/C"}
|
|
@@ -21,6 +21,29 @@ export declare const GO_KEYWORDS: Set<string>;
|
|
|
21
21
|
export declare function capitalize(s: string): string;
|
|
22
22
|
/** Capitalise a JSX prop / field name to its exported Go struct field name. */
|
|
23
23
|
export declare function capitalizeFieldName(name: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Resolve ANY source property key — identifier or not (`data-priority`,
|
|
26
|
+
* `aria-label`, a numeric key) — to a valid Go struct field name. Splits on
|
|
27
|
+
* runs of characters that are invalid in a Go identifier (underscores are
|
|
28
|
+
* VALID and preserved, so a snake_case key round-trips to the exact same
|
|
29
|
+
* name `capitalizeFieldName` alone has always produced — `foo_bar` →
|
|
30
|
+
* `Foo_bar`, never `FooBar`; renaming it would break both existing member
|
|
31
|
+
* emission and consumers' hand-written constructors against generated
|
|
32
|
+
* types) and PascalCases each segment through `capitalizeFieldName`, so a
|
|
33
|
+
* hyphenated key gets a real field instead of being silently dropped
|
|
34
|
+
* (`data-priority` → `DataPriority`). A result that would start with a
|
|
35
|
+
* digit (numeric key `0`) is prefixed with `Field` (`Field0`), and a key
|
|
36
|
+
* with no usable characters at all falls back to `Field` — both keep the
|
|
37
|
+
* emitted struct compiling (not expected from real TS property names, but
|
|
38
|
+
* keeps the function total).
|
|
39
|
+
*
|
|
40
|
+
* Single source of truth for the source-key → Go-name mapping: used for
|
|
41
|
+
* struct-field generation (#2087 Phase B — `structFieldsFor`), inline-map
|
|
42
|
+
* baking (`bakeInlineObjectAsGoMap`), and the `member()` dot-access
|
|
43
|
+
* emitter, so the baked side and the accessor side can never disagree
|
|
44
|
+
* (PR #2089 review).
|
|
45
|
+
*/
|
|
46
|
+
export declare function goFieldNameForKey(key: string): string;
|
|
24
47
|
/**
|
|
25
48
|
* Convert a slot ID (e.g., 's6') to a Go struct field suffix (e.g., 'Slot6').
|
|
26
49
|
* Keeps field names human-readable regardless of the internal slot ID format.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"go-naming.d.ts","sourceRoot":"","sources":["../../../src/adapter/lib/go-naming.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,2DAA2D;AAC3D,eAAO,MAAM,aAAa,QAA6B,CAAA;AAEvD,iHAAiH;AACjH,eAAO,MAAM,cAAc,aAIzB,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,aAKtB,CAAA;AAEF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAM5C;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOxD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAS1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAQtG"}
|
|
1
|
+
{"version":3,"file":"go-naming.d.ts","sourceRoot":"","sources":["../../../src/adapter/lib/go-naming.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,2DAA2D;AAC3D,eAAO,MAAM,aAAa,QAA6B,CAAA;AAEvD,iHAAiH;AACjH,eAAO,MAAM,cAAc,aAIzB,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,aAKtB,CAAA;AAEF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAM5C;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOxD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKrD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAS1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAQtG"}
|
|
@@ -10,6 +10,46 @@
|
|
|
10
10
|
import type { ParsedExpr, ParsedStatement, TypeInfo } from '@barefootjs/jsx';
|
|
11
11
|
import type { GoEmitContext } from '../emit-context.ts';
|
|
12
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[];
|
|
13
53
|
/**
|
|
14
54
|
* Compute a memo's SSR initial value as a Go expression — e.g.
|
|
15
55
|
* `() => count() * 2` → `in.Initial * 2`, `() => props.value * 10` →
|
|
@@ -49,7 +89,7 @@ export declare function memoInitialFromParsedBody(ctx: GoEmitContext, body: Pars
|
|
|
49
89
|
name: string;
|
|
50
90
|
type?: TypeInfo;
|
|
51
91
|
defaultValue?: string;
|
|
52
|
-
}[], propFallbackVars: ReadonlyMap<string, PropFallbackVar>): string | null;
|
|
92
|
+
}[], propFallbackVars: ReadonlyMap<string, PropFallbackVar>, currentMemoName: string, resolving?: ReadonlySet<string>): string | null;
|
|
53
93
|
/**
|
|
54
94
|
* Pattern-matching core of `computeMemoInitialValue`.
|
|
55
95
|
*
|
|
@@ -73,7 +113,16 @@ export declare function computeMemoInitialValueOrNull(ctx: GoEmitContext, memo:
|
|
|
73
113
|
name: string;
|
|
74
114
|
type?: TypeInfo;
|
|
75
115
|
defaultValue?: string;
|
|
76
|
-
}[], propFallbackVars?: ReadonlyMap<string, PropFallbackVar
|
|
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;
|
|
77
126
|
/**
|
|
78
127
|
* Resolve a signal/memo getter NAME to a Go value expression, for use as the
|
|
79
128
|
* condition operand of another memo's ternary. Handles a plain signal, a
|
|
@@ -89,7 +138,7 @@ export declare function resolveGetterValueAsGo(ctx: GoEmitContext, name: string,
|
|
|
89
138
|
name: string;
|
|
90
139
|
type?: TypeInfo;
|
|
91
140
|
defaultValue?: string;
|
|
92
|
-
}[], propFallbackVars: ReadonlyMap<string, PropFallbackVar>): string | null;
|
|
141
|
+
}[], propFallbackVars: ReadonlyMap<string, PropFallbackVar>, resolving?: ReadonlySet<string>): string | null;
|
|
93
142
|
/**
|
|
94
143
|
* Resolve a string-ternary memo whose condition is a literal comparison —
|
|
95
144
|
* `() => <operand> === 'lit' ? A : B` (or `!==`) — to a Go runtime conditional.
|
|
@@ -105,7 +154,7 @@ export declare function computeComparisonTernaryGo(ctx: GoEmitContext, parsed: P
|
|
|
105
154
|
name: string;
|
|
106
155
|
type?: TypeInfo;
|
|
107
156
|
defaultValue?: string;
|
|
108
|
-
}[], propFallbackVars: ReadonlyMap<string, PropFallbackVar>): string | null;
|
|
157
|
+
}[], propFallbackVars: ReadonlyMap<string, PropFallbackVar>, resolving?: ReadonlySet<string>): string | null;
|
|
109
158
|
/**
|
|
110
159
|
* Resolve the left operand of a string-ternary memo's comparison condition to a
|
|
111
160
|
* Go expression: a zero-arg getter call (a signal/prop-shadow memo), an inline
|
|
@@ -120,5 +169,5 @@ export declare function resolveComparisonOperandGo(ctx: GoEmitContext, node: Par
|
|
|
120
169
|
name: string;
|
|
121
170
|
type?: TypeInfo;
|
|
122
171
|
defaultValue?: string;
|
|
123
|
-
}[], propFallbackVars: ReadonlyMap<string, PropFallbackVar>): string | null;
|
|
172
|
+
}[], propFallbackVars: ReadonlyMap<string, PropFallbackVar>, resolving?: ReadonlySet<string>): string | null;
|
|
124
173
|
//# sourceMappingURL=memo-compute.d.ts.map
|
|
@@ -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;
|
|
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;AA4BtD;;;;;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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"}
|
|
@@ -7,6 +7,16 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { ParsedExpr, TypeInfo } from '@barefootjs/jsx';
|
|
9
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;
|
|
10
20
|
/**
|
|
11
21
|
* Heuristic: does this memo evaluate to a boolean? True when its computation is
|
|
12
22
|
* a comparison (`!==`/`===`/`!=`/`==`), a negation (`!x`), or a ternary whose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memo-type.d.ts","sourceRoot":"","sources":["../../../src/adapter/memo/memo-type.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
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"}
|
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
* Free functions over a {@link GoEmitContext}. They resolve a prop/signal/const's
|
|
5
5
|
* type (`TypeInfo`, a raw type string, or — as a last resort — an inferred shape
|
|
6
6
|
* from a literal value) into the Go type used for its struct field. They read
|
|
7
|
-
*
|
|
7
|
+
* `state.localStructFields` / `state.localTypeAliases` (an ACTUAL Go-backed
|
|
8
|
+
* local type — a generated struct or a string-union alias) rather than the
|
|
9
|
+
* broader `state.localTypeNames` (every type definition, including a tuple
|
|
10
|
+
* alias no struct was ever emitted for — #2087); `inferTypeFromValue` is fully
|
|
11
|
+
* pure.
|
|
8
12
|
*/
|
|
9
13
|
import type { TypeInfo } from '@barefootjs/jsx';
|
|
10
14
|
import type { GoEmitContext } from '../emit-context.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-codegen.d.ts","sourceRoot":"","sources":["../../../src/adapter/type/type-codegen.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"type-codegen.d.ts","sourceRoot":"","sources":["../../../src/adapter/type/type-codegen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;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,CAkDR;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAgB3E;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAWxD"}
|
|
@@ -3,13 +3,22 @@
|
|
|
3
3
|
* for baking a signal's inline initial value into the SSR data context.
|
|
4
4
|
*
|
|
5
5
|
* Covers scalar literals, a unary-minus number, arrays of those, and object
|
|
6
|
-
* literals baked against a concrete local struct
|
|
6
|
+
* literals baked against a concrete local struct — including, per #2087, a
|
|
7
|
+
* struct property whose OWN value is a nested array or object literal
|
|
8
|
+
* (`{ id, cells: ['a', 'b'] }`, `{ id, user: { name: 'Ada' } }`): the struct's
|
|
9
|
+
* declared property TYPE (looked up from `ctx.state.currentTypeDefinitions`)
|
|
10
|
+
* threads through so a typed nested array bakes via the normal array branch
|
|
11
|
+
* below, and a nested INLINE object (one with no named Go struct —
|
|
12
|
+
* `typeInfoToGo`'s `'object'` case always falls back to
|
|
13
|
+
* `map[string]interface{}`) bakes as a capitalized-key Go map literal instead
|
|
14
|
+
* — the same convention `test-render.ts`'s harness-prop baking already uses
|
|
15
|
+
* for object elements, since `html/template`'s map field access is an exact
|
|
16
|
+
* case-sensitive `MapIndex`.
|
|
7
17
|
*
|
|
8
18
|
* Contract is **null-means-defer**: returns null for anything not reproduced
|
|
9
19
|
* exactly — an object whose target type isn't a known struct, a key the struct
|
|
10
|
-
* doesn't declare,
|
|
11
|
-
*
|
|
12
|
-
* then keeps `nil`.
|
|
20
|
+
* doesn't declare, an empty array, an identifier/call, or a numeric literal
|
|
21
|
+
* missing its `raw` token. The caller then keeps `nil`.
|
|
13
22
|
*/
|
|
14
23
|
import type { ParsedExpr, TypeInfo } from '@barefootjs/jsx';
|
|
15
24
|
import type { GoEmitContext } from '../emit-context.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsed-literal-to-go.d.ts","sourceRoot":"","sources":["../../../src/adapter/value/parsed-literal-to-go.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"parsed-literal-to-go.d.ts","sourceRoot":"","sources":["../../../src/adapter/value/parsed-literal-to-go.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAkB,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAmDvD,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,UAAU,EAChB,QAAQ,CAAC,EAAE,QAAQ,GAClB,MAAM,GAAG,IAAI,CAsFf"}
|