@barefootjs/erb 0.17.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/analysis/component-tree.d.ts +24 -0
- package/dist/adapter/analysis/component-tree.d.ts.map +1 -0
- package/dist/adapter/boolean-result.d.ts +66 -0
- package/dist/adapter/boolean-result.d.ts.map +1 -0
- package/dist/adapter/emit-context.d.ts +107 -0
- package/dist/adapter/emit-context.d.ts.map +1 -0
- package/dist/adapter/erb-adapter.d.ts +374 -0
- package/dist/adapter/erb-adapter.d.ts.map +1 -0
- package/dist/adapter/expr/array-method.d.ts +87 -0
- package/dist/adapter/expr/array-method.d.ts.map +1 -0
- package/dist/adapter/expr/emitters.d.ts +102 -0
- package/dist/adapter/expr/emitters.d.ts.map +1 -0
- package/dist/adapter/expr/operand.d.ts +34 -0
- package/dist/adapter/expr/operand.d.ts.map +1 -0
- package/dist/adapter/index.d.ts +6 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/index.js +189154 -0
- package/dist/adapter/lib/constants.d.ts +25 -0
- package/dist/adapter/lib/constants.d.ts.map +1 -0
- package/dist/adapter/lib/ir-scope.d.ts +27 -0
- package/dist/adapter/lib/ir-scope.d.ts.map +1 -0
- package/dist/adapter/lib/ruby-naming.d.ts +65 -0
- package/dist/adapter/lib/ruby-naming.d.ts.map +1 -0
- package/dist/adapter/lib/types.d.ts +28 -0
- package/dist/adapter/lib/types.d.ts.map +1 -0
- package/dist/adapter/memo/seed.d.ts +35 -0
- package/dist/adapter/memo/seed.d.ts.map +1 -0
- package/dist/adapter/props/prop-classes.d.ts +50 -0
- package/dist/adapter/props/prop-classes.d.ts.map +1 -0
- package/dist/adapter/spread/spread-codegen.d.ts +63 -0
- package/dist/adapter/spread/spread-codegen.d.ts.map +1 -0
- package/dist/adapter/value/parsed-literal.d.ts +21 -0
- package/dist/adapter/value/parsed-literal.d.ts.map +1 -0
- package/dist/build.d.ts +28 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +189174 -0
- package/dist/conformance-pins.d.ts +13 -0
- package/dist/conformance-pins.d.ts.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +189172 -0
- package/lib/barefoot_js/backend/erb.rb +123 -0
- package/lib/barefoot_js/dev_reload.rb +159 -0
- package/lib/barefoot_js/evaluator.rb +714 -0
- package/lib/barefoot_js/search_params.rb +63 -0
- package/lib/barefoot_js.rb +1155 -0
- package/package.json +67 -0
- package/src/__tests__/erb-adapter.test.ts +298 -0
- package/src/adapter/analysis/component-tree.ts +122 -0
- package/src/adapter/boolean-result.ts +157 -0
- package/src/adapter/emit-context.ts +119 -0
- package/src/adapter/erb-adapter.ts +1768 -0
- package/src/adapter/expr/array-method.ts +424 -0
- package/src/adapter/expr/emitters.ts +629 -0
- package/src/adapter/expr/operand.ts +55 -0
- package/src/adapter/index.ts +6 -0
- package/src/adapter/lib/constants.ts +37 -0
- package/src/adapter/lib/ir-scope.ts +51 -0
- package/src/adapter/lib/ruby-naming.ts +127 -0
- package/src/adapter/lib/types.ts +31 -0
- package/src/adapter/memo/seed.ts +75 -0
- package/src/adapter/props/prop-classes.ts +89 -0
- package/src/adapter/spread/spread-codegen.ts +176 -0
- package/src/adapter/value/parsed-literal.ts +29 -0
- package/src/build.ts +37 -0
- package/src/conformance-pins.ts +100 -0
- package/src/index.ts +9 -0
- package/src/test-render.ts +668 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component-tree analysis for the ERB template adapter.
|
|
3
|
+
*
|
|
4
|
+
* Ported from the Mojolicious adapter's `analysis/component-tree.ts` (issue
|
|
5
|
+
* #2018 track D lineage). Pure functions over the IR — they read no adapter
|
|
6
|
+
* instance state. `collectImportedLoopChildComponentErrors` returns its
|
|
7
|
+
* diagnostics instead of pushing onto the adapter's error list, so the
|
|
8
|
+
* adapter stays the sole owner of `errors`.
|
|
9
|
+
*/
|
|
10
|
+
import type { ComponentIR, CompilerError } from '@barefootjs/jsx';
|
|
11
|
+
/**
|
|
12
|
+
* Whether the component needs the client runtime — it owns reactive state
|
|
13
|
+
* (signals / effects / onMount) or the analyzer flagged it as needing init.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hasClientInteractivity(ir: ComponentIR): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Build a `BF103` diagnostic for every component reference inside a loop body
|
|
18
|
+
* whose name is imported from a relative-path module. Mirror of the Go /
|
|
19
|
+
* Mojo adapters' check — the ERB adapter has the same cross-template-
|
|
20
|
+
* registration constraint at request time. Returns the diagnostics so the
|
|
21
|
+
* caller pushes them onto its own error list.
|
|
22
|
+
*/
|
|
23
|
+
export declare function collectImportedLoopChildComponentErrors(ir: ComponentIR, componentName: string): CompilerError[];
|
|
24
|
+
//# sourceMappingURL=component-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-tree.d.ts","sourceRoot":"","sources":["../../../src/adapter/analysis/component-tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,WAAW,EAUX,aAAa,EACd,MAAM,iBAAiB,CAAA;AAExB;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAO/D;AAED;;;;;;GAMG;AACH,wBAAgB,uCAAuC,CACrD,EAAE,EAAE,WAAW,EACf,aAAa,EAAE,MAAM,GACpB,aAAa,EAAE,CA0EjB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural classifier for JS expressions whose result is a boolean
|
|
3
|
+
* value (or unambiguously stringifies to "true"/"false" in JS).
|
|
4
|
+
*
|
|
5
|
+
* Used by the ERB adapter's `emitExpression` to decide whether to
|
|
6
|
+
* route a reactive attribute binding through the `bf.bool_str` Ruby
|
|
7
|
+
* runtime helper (mirrors the Mojo/Xslate adapters' `bool_str` use).
|
|
8
|
+
* Ruby has no bare-comparison-to-string coercion either: `(count > 0)`
|
|
9
|
+
* evaluates to `true`/`false` objects, which `to_s` would render as
|
|
10
|
+
* the literal strings `"true"`/`"false"` — that part already matches
|
|
11
|
+
* JS `String(boolean)`. The wrapper still exists for parity with the
|
|
12
|
+
* Perl/Kolon family and for the cases below where the source
|
|
13
|
+
* expression is *opaque* (a bare call) but the attribute name
|
|
14
|
+
* witnesses a boolean value.
|
|
15
|
+
*
|
|
16
|
+
* The classifier walks a `ParsedExpr` produced by
|
|
17
|
+
* `@barefootjs/jsx::parseExpression` — same AST the filter / loop
|
|
18
|
+
* lowerings already use — so detection is structural rather than
|
|
19
|
+
* regex-text-matching. Wrapped expression text is left to the
|
|
20
|
+
* caller's existing `convertExpressionToRuby` pipeline; this module
|
|
21
|
+
* only decides whether to wrap.
|
|
22
|
+
*
|
|
23
|
+
* Detected shapes:
|
|
24
|
+
* - `binary` with a comparison operator (`<`, `>`, `<=`, `>=`,
|
|
25
|
+
* `==`, `===`, `!=`, `!==`)
|
|
26
|
+
* - `unary` with logical `!`
|
|
27
|
+
* - `literal` with `literalType: 'boolean'`
|
|
28
|
+
* - `logical` (`&&` / `||` / `??`) when both sides are themselves
|
|
29
|
+
* boolean-result (catches `x > 0 && y < 10`; intentionally does
|
|
30
|
+
* NOT catch `x() || 'fallback'` whose right side stringifies as
|
|
31
|
+
* a regular value)
|
|
32
|
+
* - `conditional` (`?:`) when both branches are themselves
|
|
33
|
+
* boolean-result
|
|
34
|
+
*
|
|
35
|
+
* Anything else returns `false` — including bare identifiers
|
|
36
|
+
* (`accepted`) and call expressions (`accepted()`) whose return type
|
|
37
|
+
* the adapter has no way to infer from source text alone. Those
|
|
38
|
+
* carry their own (Ruby-coerced) value through unchanged, which
|
|
39
|
+
* stays correct for non-boolean shapes.
|
|
40
|
+
*/
|
|
41
|
+
export declare function isBooleanResultExpr(expr: string): boolean;
|
|
42
|
+
export declare function isAriaBooleanAttr(name: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* True when `expr` is (structurally) a top-level `String(...)` call — the
|
|
45
|
+
* one JS shape that has ALREADY fully stringified its argument per JS
|
|
46
|
+
* `String(boolean)` semantics before the attribute emitter's `bool_str`
|
|
47
|
+
* wrap decision runs. `convertExpressionToRuby` lowers `String(x)` through
|
|
48
|
+
* the `ERB_TEMPLATE_PRIMITIVES` registry to `bf.string(x)`, which for a
|
|
49
|
+
* real Ruby `true`/`false` already returns the JS-correct `"true"` /
|
|
50
|
+
* `"false"` text (`Context#string`'s `TrueClass`/`FalseClass` branch).
|
|
51
|
+
* Piping that STRING through `bf.bool_str` again is a bug, not a harmless
|
|
52
|
+
* no-op: Ruby has no falsy-string (only `nil`/`false` are falsy), so
|
|
53
|
+
* `bf.bool_str("false")` unconditionally returns `"true"` — every
|
|
54
|
+
* `aria-checked={String(props.checked ?? false)}`-shaped binding would
|
|
55
|
+
* render `"true"` regardless of the underlying value. Perl doesn't share
|
|
56
|
+
* this bug (`"0"` — what `JSON::PP::false` stringifies to — IS Perl-falsy),
|
|
57
|
+
* which is why the Mojo/Xslate emitters don't need this guard; ERB's
|
|
58
|
+
* truthiness model requires it. Detected structurally off the parsed
|
|
59
|
+
* expression (not a text scan), so a user-defined helper merely NAMED
|
|
60
|
+
* `String` elsewhere can't false-positive: the aria-attr / boolean-result
|
|
61
|
+
* detectors already need real parse trees, and a bespoke `String` lookalike
|
|
62
|
+
* would need to be a genuinely zero-ambiguity call-to-`String` shape to
|
|
63
|
+
* match here in the first place.
|
|
64
|
+
*/
|
|
65
|
+
export declare function isExplicitStringCall(expr: string): boolean;
|
|
66
|
+
//# sourceMappingURL=boolean-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean-result.d.ts","sourceRoot":"","sources":["../../src/adapter/boolean-result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAwCH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIzD;AA2CD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAI1D"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The contract the extracted expression-emitter modules depend on instead of
|
|
3
|
+
* the concrete `ErbAdapter`.
|
|
4
|
+
*
|
|
5
|
+
* The ERB adapter's top-level expression lowering is mutually recursive with
|
|
6
|
+
* the adapter's own const/record resolution and its filter-predicate emitter,
|
|
7
|
+
* so the extracted `ErbTopLevelEmitter` still needs to call back into shared
|
|
8
|
+
* per-compile state and recursive entry points. `ErbEmitContext` is that
|
|
9
|
+
* seam: the emitter takes an `ErbEmitContext` built by the adapter's private
|
|
10
|
+
* `emitCtx` getter (the adapter does NOT `implements` this interface, so the
|
|
11
|
+
* wrapped members stay private and off its exported public type — matching
|
|
12
|
+
* the Mojo/Go adapters' `emitCtx`). The emitter depends on this narrow
|
|
13
|
+
* interface rather than the full adapter class, so the coupling is explicit
|
|
14
|
+
* and it's unit-testable against a stub.
|
|
15
|
+
*
|
|
16
|
+
* Keep this surface minimal: add a member only when an extracted module
|
|
17
|
+
* genuinely needs it, so the seam documents the real cross-module coupling
|
|
18
|
+
* rather than re-exposing the whole adapter.
|
|
19
|
+
*/
|
|
20
|
+
import type { ParsedExpr, CompilerError, IRMetadata } from '@barefootjs/jsx';
|
|
21
|
+
export interface ErbEmitContext {
|
|
22
|
+
/**
|
|
23
|
+
* Local binding names the request-scoped `searchParams()` env signal
|
|
24
|
+
* is imported under. Non-empty enables the env-signal method-call lowering.
|
|
25
|
+
*/
|
|
26
|
+
readonly _searchParamsLocals: Set<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Inline a module-scope pure string-literal const by name as the resolved
|
|
29
|
+
* literal value, or null when the name is not such a const.
|
|
30
|
+
*/
|
|
31
|
+
resolveModuleStringConst(name: string): string | null;
|
|
32
|
+
/** Resolve a literal const (`const totalPages = 5`) to its Ruby value, or null. */
|
|
33
|
+
resolveLiteralConst(name: string): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Resolve a static property access on a module object-literal const
|
|
36
|
+
* (`variantClasses.ghost`) to its Ruby value at compile time, or null.
|
|
37
|
+
*/
|
|
38
|
+
resolveStaticRecordLiteral(objectName: string, key: string): string | null;
|
|
39
|
+
/**
|
|
40
|
+
* Whether `name` currently names a bare Ruby local bound by an enclosing
|
|
41
|
+
* loop/block (`todos().map(todo => ...)` → `|todo|`) — as opposed to a
|
|
42
|
+
* prop / signal / memo / module const, which always resolves through the
|
|
43
|
+
* `v[:name]` vars Hash. This is the ERB-specific branch point the Mojo/
|
|
44
|
+
* Kolon adapters don't need: Perl's `$name` sigil resolves a lexical
|
|
45
|
+
* loop var and a stash var identically, but ERB's two-locals variable
|
|
46
|
+
* model (`bf`, `v`) requires the identifier emitter to choose between a
|
|
47
|
+
* bare Ruby local and a `v[:name]` hash lookup.
|
|
48
|
+
*/
|
|
49
|
+
isLoopBoundName(name: string): boolean;
|
|
50
|
+
/** Whether a getter/prop name resolves to a string-typed SSR value. */
|
|
51
|
+
_isStringValueName(name: string): boolean;
|
|
52
|
+
/** Record a BF101 unsupported-expression diagnostic. */
|
|
53
|
+
_recordExprBF101(message: string, reason?: string): void;
|
|
54
|
+
/** Lower a filter/predicate body to its Ruby form, bound to `param`. */
|
|
55
|
+
_renderRubyFilterExprPublic(expr: ParsedExpr, param: string): string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The contract the extracted object-literal / conditional-spread lowering
|
|
59
|
+
* (`spread/spread-codegen.ts`) depends on. The spread lowering recurses into
|
|
60
|
+
* the core expression lowering and records its own BF101 diagnostics, so it
|
|
61
|
+
* needs the recursive entry point plus the per-compile bookkeeping the
|
|
62
|
+
* adapter owns. Declared separately from `ErbEmitContext` so each extracted
|
|
63
|
+
* module's real coupling is documented precisely.
|
|
64
|
+
*/
|
|
65
|
+
export interface ErbSpreadContext {
|
|
66
|
+
/** Component name, for diagnostic source locations. */
|
|
67
|
+
readonly componentName: string;
|
|
68
|
+
/** Per-compile diagnostic list the spread lowering appends to. */
|
|
69
|
+
readonly errors: CompilerError[];
|
|
70
|
+
/** Local-constant metadata, for resolving `Record[key]` spread values. */
|
|
71
|
+
readonly localConstants: IRMetadata['localConstants'];
|
|
72
|
+
/** Prop params, for classifying a bare-identifier index as a prop. */
|
|
73
|
+
readonly propsParams: {
|
|
74
|
+
name: string;
|
|
75
|
+
}[];
|
|
76
|
+
/**
|
|
77
|
+
* Lower a JS expression to its Ruby form (the core recursive entry).
|
|
78
|
+
*
|
|
79
|
+
* When the IR already carries a structured `ParsedExpr` tree, pass it as
|
|
80
|
+
* `preParsed` so the converter threads it straight through instead of
|
|
81
|
+
* re-parsing `expr` — mirrors go-template's
|
|
82
|
+
* `convertExpressionToGo(jsExpr, out?, preParsed?)`. With `preParsed` set,
|
|
83
|
+
* `expr` is unused for parsing (the converter derives any diagnostic text
|
|
84
|
+
* from the tree), so callers may pass `''`.
|
|
85
|
+
*/
|
|
86
|
+
convertExpressionToRuby(expr: string, preParsed?: ParsedExpr): string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The contract the extracted in-template memo / context seeding
|
|
90
|
+
* (`memo/seed.ts`) depends on. The seed lowering recurses into the core
|
|
91
|
+
* expression lowering to compute a derived signal/memo value or a context
|
|
92
|
+
* default; that recursive entry is its only adapter coupling.
|
|
93
|
+
*/
|
|
94
|
+
export interface ErbMemoContext {
|
|
95
|
+
/**
|
|
96
|
+
* Lower a JS expression to its Ruby form (the core recursive entry).
|
|
97
|
+
*
|
|
98
|
+
* When the IR already carries a structured `ParsedExpr` tree, pass it as
|
|
99
|
+
* `preParsed` so the converter threads it straight through instead of
|
|
100
|
+
* re-parsing `expr` — mirrors go-template's
|
|
101
|
+
* `convertExpressionToGo(jsExpr, out?, preParsed?)`. With `preParsed` set,
|
|
102
|
+
* `expr` is unused for parsing (the converter derives any diagnostic text
|
|
103
|
+
* from the tree), so callers may pass `''`.
|
|
104
|
+
*/
|
|
105
|
+
convertExpressionToRuby(expr: string, preParsed?: ParsedExpr): string;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=emit-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-context.d.ts","sourceRoot":"","sources":["../../src/adapter/emit-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5E,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAEzC;;;OAGG;IACH,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IAErD,mFAAmF;IACnF,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IAEhD;;;OAGG;IACH,0BAA0B,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IAE1E;;;;;;;;;OASG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IAEtC,uEAAuE;IACvE,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IAEzC,wDAAwD;IACxD,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAExD,wEAAwE;IACxE,2BAA2B,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CACrE;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAE9B,kEAAkE;IAClE,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,CAAA;IAEhC,0EAA0E;IAC1E,QAAQ,CAAC,cAAc,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAA;IAErD,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAExC;;;;;;;;;OASG;IACH,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,CAAA;CACtE;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;;OASG;IACH,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,CAAA;CACtE"}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BarefootJS ERB (Embedded Ruby) Template Adapter
|
|
3
|
+
*
|
|
4
|
+
* Generates ERB template files (.erb) from BarefootJS IR. Ported from the
|
|
5
|
+
* Mojolicious EP adapter (`@barefootjs/mojolicious`) — EP (Embedded Perl)
|
|
6
|
+
* maps 1:1 onto ERB (Embedded Ruby) for control flow and hydration-marker
|
|
7
|
+
* shape; the substantive divergences are:
|
|
8
|
+
*
|
|
9
|
+
* - **Variable model.** Templates receive exactly two locals: `bf`
|
|
10
|
+
* (runtime) and `v` (vars Hash, symbol keys). Every prop / signal /
|
|
11
|
+
* memo / module-constant reference lowers to `v[:name]` — never a bare
|
|
12
|
+
* Ruby local. Perl's uniform `$name` sigil doesn't need this split
|
|
13
|
+
* (a lexical `my $name` and a stash `$name` render identically); Ruby's
|
|
14
|
+
* bare-identifier ambiguity (reserved words, leading-uppercase =
|
|
15
|
+
* constant) is why props/signals/consts move to a Hash instead.
|
|
16
|
+
* Loop/block params are the one case that stays a bare Ruby local
|
|
17
|
+
* (`lib/ruby-naming.ts::rubyLocal`).
|
|
18
|
+
* - **Escaping.** Mojo's `<%= %>` auto-escapes; stdlib ERB does not — every
|
|
19
|
+
* text/attribute-value interpolation that was a plain mojo `<%= %>`
|
|
20
|
+
* becomes ERB `<%= bf.h(...) %>`. Every *raw* mojo `<%== %>` (runtime
|
|
21
|
+
* helper output, already HTML) becomes a plain ERB `<%= %>` (no `bf.h`
|
|
22
|
+
* — the plan's blanket EP→ERB mapping rule, applied mechanically
|
|
23
|
+
* everywhere so there's exactly one place to audit for escaping bugs).
|
|
24
|
+
* - **Ruby truthiness.** Ruby's falsy set is only `nil`/`false` — JS's is
|
|
25
|
+
* `false, 0, NaN, "", null/undefined`. Every JS conditional TEST (`if`,
|
|
26
|
+
* `&&`, `||`, `!`, `?:`) wraps in `bf.truthy?(...)`; ERB conditionals
|
|
27
|
+
* wrap the same way. See `expr/emitters.ts`'s file docstring for the
|
|
28
|
+
* `&&`/`||` operand-returning rewrite this forces.
|
|
29
|
+
* - **Content capture.** Mojo's `begin %>…<% end` block-capture (for
|
|
30
|
+
* forwarded JSX children / async fallback) has no ERB syntax analog;
|
|
31
|
+
* ERB captures by slicing the shared output buffer around the nested
|
|
32
|
+
* render (see `renderComponent` / `renderAsync`).
|
|
33
|
+
*
|
|
34
|
+
* See `expr/emitters.ts`, `expr/operand.ts`, and `lib/ruby-naming.ts` for
|
|
35
|
+
* the rest of the Perl→Ruby emission-contract detail.
|
|
36
|
+
*/
|
|
37
|
+
import type { ComponentIR, IRNode, IRElement, IRText, IRExpression, IRConditional, IRLoop, IRComponent, IRFragment, IRSlot, IRIfStatement, IRProvider, IRAsync, TemplatePrimitiveRegistry } from '@barefootjs/jsx';
|
|
38
|
+
import { BaseAdapter, type AdapterOutput, type AdapterGenerateOptions, type IRNodeEmitter, type EmitIRNode } from '@barefootjs/jsx';
|
|
39
|
+
import type { ErbRenderCtx } from './lib/types.ts';
|
|
40
|
+
export type { ErbAdapterOptions } from './lib/types.ts';
|
|
41
|
+
import type { ErbAdapterOptions } from './lib/types.ts';
|
|
42
|
+
export declare class ErbAdapter extends BaseAdapter implements IRNodeEmitter<ErbRenderCtx> {
|
|
43
|
+
name: string;
|
|
44
|
+
extension: string;
|
|
45
|
+
templatesPerComponent: boolean;
|
|
46
|
+
importMapInjection: 'html-snippet';
|
|
47
|
+
/**
|
|
48
|
+
* Identifier-path callees the ERB runtime can render in template scope.
|
|
49
|
+
* The relocate pass consults this map to mark matching calls as
|
|
50
|
+
* template-safe so the surrounding expression stays inlinable; the SSR
|
|
51
|
+
* template emitter substitutes the JS call with the registered Ruby
|
|
52
|
+
* helper invocation.
|
|
53
|
+
*/
|
|
54
|
+
templatePrimitives: TemplatePrimitiveRegistry;
|
|
55
|
+
private componentName;
|
|
56
|
+
/** The component's root scope element(s) — each carries `data-key` for a
|
|
57
|
+
* keyed loop item (set by the child renderer from the JSX `key` prop). A
|
|
58
|
+
* plain element root is a single node; an `if-statement` (early-return)
|
|
59
|
+
* root contributes the top element of every branch, since any one of
|
|
60
|
+
* them can be the rendered root at runtime. */
|
|
61
|
+
private rootScopeNodes;
|
|
62
|
+
private options;
|
|
63
|
+
private errors;
|
|
64
|
+
private inLoop;
|
|
65
|
+
/**
|
|
66
|
+
* SolidJS-style props identifier (`function(props: P)`) and the
|
|
67
|
+
* analyzer-extracted prop names. Stashed at `generate()` entry so the
|
|
68
|
+
* per-attribute `emitSpread` callback can build a propsObject spread bag
|
|
69
|
+
* as an inline Ruby Hash literal without re-walking the IR.
|
|
70
|
+
*/
|
|
71
|
+
private propsObjectName;
|
|
72
|
+
private propsParams;
|
|
73
|
+
private booleanTypedProps;
|
|
74
|
+
/**
|
|
75
|
+
* Names that resolve to a real SSR template var (via `v[:name]`) — prop
|
|
76
|
+
* param, signal getter, or memo. A `<Ctx.Provider value>` member
|
|
77
|
+
* referencing a name NOT in this set is a client-only function (a local
|
|
78
|
+
* handler const, or a signal setter) with no SSR value: it would read an
|
|
79
|
+
* un-seeded vars-Hash key, so it's lowered to `nil` instead.
|
|
80
|
+
*/
|
|
81
|
+
private providerDataNames;
|
|
82
|
+
/**
|
|
83
|
+
* Names (signal getters + props) whose value is a string. Ruby's `==`
|
|
84
|
+
* doesn't drive equality-operator selection the way Perl's `eq`/`ne`
|
|
85
|
+
* split does (see `props/prop-classes.ts`), but this set still gates
|
|
86
|
+
* index-access Hash-vs-Array lowering (`expr/operand.ts`).
|
|
87
|
+
*/
|
|
88
|
+
private stringValueNames;
|
|
89
|
+
/**
|
|
90
|
+
* Local binding names the request-scoped `searchParams()` env signal is
|
|
91
|
+
* imported under (handles `import { searchParams as sp }`). When
|
|
92
|
+
* non-empty the emitter lowers a `<binding>().get(k)` call to a real
|
|
93
|
+
* method call on the reserved `v[:search_params]` reader instead of the
|
|
94
|
+
* generic Hash lookup. Set at `generate()` entry from `ir.metadata.imports`;
|
|
95
|
+
* read by the top-level ParsedExpr emitter.
|
|
96
|
+
*/
|
|
97
|
+
private _searchParamsLocals;
|
|
98
|
+
/**
|
|
99
|
+
* Call-lowering matchers active for this component. Bound at
|
|
100
|
+
* `generate()` entry via `prepareLoweringMatchers` and read by the
|
|
101
|
+
* top-level emitter. Covers both userland plugins and the compiler's
|
|
102
|
+
* built-in plugins (e.g. `queryHref` → `bf.query`) — one uniform path,
|
|
103
|
+
* no per-API branch.
|
|
104
|
+
*/
|
|
105
|
+
private _loweringMatchers;
|
|
106
|
+
/**
|
|
107
|
+
* Module-scope pure string-literal constants (`const X = 'literal'` at
|
|
108
|
+
* file top-level), keyed by name → resolved literal value. Populated at
|
|
109
|
+
* `generate()` entry from `ir.metadata.localConstants`. When an
|
|
110
|
+
* identifier in an expression resolves to one of these, the adapter
|
|
111
|
+
* inlines the literal instead of emitting `v[:X]` against a vars-Hash key
|
|
112
|
+
* that is never seeded (a module const isn't a prop, signal, or local —
|
|
113
|
+
* the value would render empty).
|
|
114
|
+
*/
|
|
115
|
+
private moduleStringConsts;
|
|
116
|
+
/**
|
|
117
|
+
* Full local-constant metadata from the entry IR, kept so spread
|
|
118
|
+
* lowering can resolve a bare-identifier spread (`{...sizeAttrs}`) to
|
|
119
|
+
* its initializer text and a `Record[propKey]` spread value to the
|
|
120
|
+
* module-const object literal it indexes. Populated at `generate()`
|
|
121
|
+
* entry alongside `moduleStringConsts`.
|
|
122
|
+
*/
|
|
123
|
+
private localConstants;
|
|
124
|
+
/**
|
|
125
|
+
* Names currently bound by an enclosing loop body — the block-param
|
|
126
|
+
* locals `renderLoop` introduces (item, index, per-binding destructure
|
|
127
|
+
* fields) — ref-counted so nested loops compose. This is load-bearing
|
|
128
|
+
* for TWO things in the ERB adapter (more than the Mojo original, which
|
|
129
|
+
* only used it to guard const-inlining): it also decides the
|
|
130
|
+
* fundamental `v[:name]` vs bare-Ruby-local rendering choice in
|
|
131
|
+
* `ErbTopLevelEmitter.identifier` — see `emit-context.ts`'s
|
|
132
|
+
* `isLoopBoundName` docstring for why ERB's two-locals model needs this
|
|
133
|
+
* where Perl's uniform `$name` sigil does not.
|
|
134
|
+
*/
|
|
135
|
+
private loopBoundNames;
|
|
136
|
+
/**
|
|
137
|
+
* Prop names whose value is `nil` in the template body when the caller
|
|
138
|
+
* omits them — so a bare-reference attribute should be dropped rather
|
|
139
|
+
* than rendered as `attr=""`. See `props/prop-classes.ts`'s
|
|
140
|
+
* `collectNullableOptionalProps` for the exact population criterion.
|
|
141
|
+
* Used by `elementAttrEmitter.emitExpression` to guard such an attribute
|
|
142
|
+
* with a Ruby nil-check (`<textarea>` omits `rows`), matching Hono's
|
|
143
|
+
* nullish-attribute omission.
|
|
144
|
+
*/
|
|
145
|
+
private nullableOptionalProps;
|
|
146
|
+
constructor(options?: ErbAdapterOptions);
|
|
147
|
+
generate(ir: ComponentIR, options?: AdapterGenerateOptions): AdapterOutput;
|
|
148
|
+
/**
|
|
149
|
+
* Whether `expr` is a bare reference to a boolean-TYPED prop
|
|
150
|
+
* (`props.isActive` / destructured `isActive`) — used to route the
|
|
151
|
+
* binding through `bool_str` even though the expression itself is
|
|
152
|
+
* structurally opaque.
|
|
153
|
+
*/
|
|
154
|
+
isBooleanTypedPropRef(expr: string): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Whether an attribute-value expression should route through
|
|
157
|
+
* `bf.bool_str` (single source of truth for all three attribute-emission
|
|
158
|
+
* call sites that make this decision). Three witnesses (any one
|
|
159
|
+
* suffices): the JS source structurally evaluates to a boolean
|
|
160
|
+
* (`isBooleanResultExpr`), the attribute name is one of the ARIA
|
|
161
|
+
* true/false(/mixed) names (`isAriaBooleanAttr` — the expression itself
|
|
162
|
+
* may be opaque, e.g. `accepted()`), or the expression is a bare
|
|
163
|
+
* reference to a boolean-TYPED prop (`isBooleanTypedPropRef`).
|
|
164
|
+
*
|
|
165
|
+
* EXCEPT when the expression is already a top-level `String(...)` call
|
|
166
|
+
* (`isExplicitStringCall`): `convertExpressionToRuby` lowers that to
|
|
167
|
+
* `bf.string(...)`, which for a real boolean already returns the
|
|
168
|
+
* JS-correct `"true"`/`"false"` text — wrapping that STRING in
|
|
169
|
+
* `bf.bool_str` again is a bug (Ruby has no falsy-string, so
|
|
170
|
+
* `bf.bool_str("false")` always returns `"true"`), not a harmless
|
|
171
|
+
* no-op. See `isExplicitStringCall`'s docstring for the full
|
|
172
|
+
* Perl-vs-Ruby truthiness contrast.
|
|
173
|
+
*/
|
|
174
|
+
private shouldWrapBoolStr;
|
|
175
|
+
/**
|
|
176
|
+
* Parse `cond ? value : undefined` (or `: null`), returning the
|
|
177
|
+
* condition/consequent source spans, else `null`. Used for the
|
|
178
|
+
* attribute-omission rule; mirrors the Mojo/Xslate adapters.
|
|
179
|
+
*/
|
|
180
|
+
parseUndefinedAlternateTernary(expr: string): {
|
|
181
|
+
condition: string;
|
|
182
|
+
consequent: string;
|
|
183
|
+
} | null;
|
|
184
|
+
/**
|
|
185
|
+
* Inline a const (any scope) whose initializer is a pure numeric or
|
|
186
|
+
* quoted string literal (`const totalPages = 5`) — function-scope
|
|
187
|
+
* consts never reach the per-render vars Hash, so a bare `v[:totalPages]`
|
|
188
|
+
* would read nil.
|
|
189
|
+
*/
|
|
190
|
+
private resolveLiteralConst;
|
|
191
|
+
private resolveStaticRecordLiteral;
|
|
192
|
+
private resolveModuleStringConst;
|
|
193
|
+
/** Whether `name` currently names a loop-bound Ruby local. See
|
|
194
|
+
* `ErbEmitContext.isLoopBoundName`'s docstring. */
|
|
195
|
+
private isLoopBoundName;
|
|
196
|
+
private generateScriptRegistrations;
|
|
197
|
+
/**
|
|
198
|
+
* Public entry point for node rendering. Delegates to the shared
|
|
199
|
+
* `IRNodeEmitter` dispatcher; per-kind logic lives in the
|
|
200
|
+
* `IRNodeEmitter` methods below.
|
|
201
|
+
*/
|
|
202
|
+
renderNode(node: IRNode): string;
|
|
203
|
+
emitElement(node: IRElement, _ctx: ErbRenderCtx, _emit: EmitIRNode<ErbRenderCtx>): string;
|
|
204
|
+
emitText(node: IRText): string;
|
|
205
|
+
emitExpression(node: IRExpression): string;
|
|
206
|
+
emitConditional(node: IRConditional, _ctx: ErbRenderCtx, _emit: EmitIRNode<ErbRenderCtx>): string;
|
|
207
|
+
emitLoop(node: IRLoop, _ctx: ErbRenderCtx, _emit: EmitIRNode<ErbRenderCtx>): string;
|
|
208
|
+
emitComponent(node: IRComponent, _ctx: ErbRenderCtx, _emit: EmitIRNode<ErbRenderCtx>): string;
|
|
209
|
+
emitFragment(node: IRFragment, _ctx: ErbRenderCtx, _emit: EmitIRNode<ErbRenderCtx>): string;
|
|
210
|
+
emitSlot(node: IRSlot): string;
|
|
211
|
+
emitIfStatement(node: IRIfStatement, _ctx: ErbRenderCtx, _emit: EmitIRNode<ErbRenderCtx>): string;
|
|
212
|
+
emitProvider(node: IRProvider, _ctx: ErbRenderCtx, _emit: EmitIRNode<ErbRenderCtx>): string;
|
|
213
|
+
/** Lower a `<Ctx.Provider value>` value prop to a Ruby expression. */
|
|
214
|
+
private providerValueRuby;
|
|
215
|
+
/**
|
|
216
|
+
* Lower an object-literal provider value (`value={{ open: () => props.open
|
|
217
|
+
* ?? false, onOpenChange: … }}`) to a Ruby Hash. The SSR lowering is a
|
|
218
|
+
* per-member snapshot of what a consumer would READ during the same
|
|
219
|
+
* render:
|
|
220
|
+
*
|
|
221
|
+
* - zero-param expression-body arrows are getters — lower the body (the
|
|
222
|
+
* value is fixed for the render, so the call-time indirection drops out)
|
|
223
|
+
* - `on[A-Z]`-named members and function-shaped values are client-only
|
|
224
|
+
* behavior SSR never invokes — lower to `nil`
|
|
225
|
+
* - anything else lowers through the normal expression pipeline (so an
|
|
226
|
+
* unsupported getter body still refuses loudly with BF101)
|
|
227
|
+
*
|
|
228
|
+
* Keys keep their JS names verbatim (as symbol keys) so a consumer-side
|
|
229
|
+
* `ctx.open` access maps onto the same key. Returns `null` when the
|
|
230
|
+
* expression is not a plain object literal (spread / computed key) — the
|
|
231
|
+
* caller falls back to the whole-expression path, which refuses those
|
|
232
|
+
* shapes with BF101.
|
|
233
|
+
*/
|
|
234
|
+
private providerObjectLiteralRuby;
|
|
235
|
+
/**
|
|
236
|
+
* True when `src` is a bare identifier that doesn't resolve to a
|
|
237
|
+
* prop/signal/memo or an SSR-inlinable module string const — i.e. a
|
|
238
|
+
* client-only function reference in a context value (a local handler
|
|
239
|
+
* const like `scrollPrev`, or a signal setter like `setCanScrollPrev`).
|
|
240
|
+
* See `providerDataNames`. Module-scope string consts (`carouselClasses`)
|
|
241
|
+
* ARE SSR-resolvable via `moduleStringConsts`, so they're excluded here.
|
|
242
|
+
*/
|
|
243
|
+
private isClientOnlyContextIdentifier;
|
|
244
|
+
emitAsync(node: IRAsync, _ctx: ErbRenderCtx, _emit: EmitIRNode<ErbRenderCtx>): string;
|
|
245
|
+
renderElement(element: IRElement): string;
|
|
246
|
+
renderExpression(expr: IRExpression): string;
|
|
247
|
+
/**
|
|
248
|
+
* True when `expr` is a structural read of the `children` prop: a bare
|
|
249
|
+
* `children` identifier, `props.children` / `<propsObjectName>.children`,
|
|
250
|
+
* or either of those on the left of a `?? fallback`. Prefers the IR's
|
|
251
|
+
* already-parsed `expr.parsed` tree (attached once during IR construction)
|
|
252
|
+
* and falls back to parsing `expr.expr` only when that's absent — never a
|
|
253
|
+
* regex/string scan of the source text.
|
|
254
|
+
*/
|
|
255
|
+
private isChildrenValueExpr;
|
|
256
|
+
private isChildrenReferenceParsedExpr;
|
|
257
|
+
renderConditional(cond: IRConditional): string;
|
|
258
|
+
private renderNodeOrNull;
|
|
259
|
+
/**
|
|
260
|
+
* Add bf-c attribute to the first HTML element in a branch. If no element
|
|
261
|
+
* found, wrap with comment markers. Operates on already-emitted ERB
|
|
262
|
+
* template TEXT (not JS/TS source), matching the Mojo/Go adapters'
|
|
263
|
+
* identical marker-injection precedent.
|
|
264
|
+
*/
|
|
265
|
+
private addCondMarkerToFirstElement;
|
|
266
|
+
renderLoop(loop: IRLoop): string;
|
|
267
|
+
/**
|
|
268
|
+
* AttrValue lowering for component invocation props (ERB / Ruby Hash
|
|
269
|
+
* literal form). Routed through the shared dispatcher so a new AttrValue
|
|
270
|
+
* kind becomes a TS compile error here.
|
|
271
|
+
*
|
|
272
|
+
* `jsx-children` returns empty — children are captured via the ERB
|
|
273
|
+
* output-buffer slice below, not threaded through the `render_child`
|
|
274
|
+
* props Hash.
|
|
275
|
+
*/
|
|
276
|
+
private readonly componentPropEmitter;
|
|
277
|
+
renderComponent(comp: IRComponent): string;
|
|
278
|
+
private childrenCaptureCounter;
|
|
279
|
+
private toTemplateName;
|
|
280
|
+
private renderIfStatement;
|
|
281
|
+
private renderFragment;
|
|
282
|
+
private renderSlot;
|
|
283
|
+
renderAsync(node: IRAsync): string;
|
|
284
|
+
/**
|
|
285
|
+
* AttrValue lowering for intrinsic-element attributes (ERB template).
|
|
286
|
+
* Routed through the shared dispatcher.
|
|
287
|
+
*/
|
|
288
|
+
private readonly elementAttrEmitter;
|
|
289
|
+
/**
|
|
290
|
+
* Uniquifies the `presenceOrUndefined` temp binding (`__bf_puN`) so two
|
|
291
|
+
* presence-folded attrs in one template don't collide.
|
|
292
|
+
*/
|
|
293
|
+
private presenceVarCounter;
|
|
294
|
+
/**
|
|
295
|
+
* Lower a `style={{ … }}` object literal to a CSS string with dynamic
|
|
296
|
+
* values interpolated as ERB tags, e.g. `{ backgroundColor: color,
|
|
297
|
+
* padding: '8px' }` → `background-color:<%= bf.h(v[:color]) %>;padding:8px`.
|
|
298
|
+
* Returns null when the shape is unsupported or any value can't be
|
|
299
|
+
* lowered (caller then falls through to the BF101 refusal).
|
|
300
|
+
*/
|
|
301
|
+
private tryLowerStyleObject;
|
|
302
|
+
/** HTML-attribute escape for static text inlined into a `"..."` attribute. */
|
|
303
|
+
private escapeAttrText;
|
|
304
|
+
private renderAttributes;
|
|
305
|
+
renderScopeMarker(_instanceIdExpr: string): string;
|
|
306
|
+
renderSlotMarker(slotId: string): string;
|
|
307
|
+
renderCondMarker(condId: string): string;
|
|
308
|
+
/**
|
|
309
|
+
* Convert a ParsedExpr AST to Ruby expression string for filter
|
|
310
|
+
* predicates. Wraps the shared ParsedExpr dispatcher with an
|
|
311
|
+
* `ErbFilterEmitter` carrying the predicate's loop param and any
|
|
312
|
+
* block-body local var aliases.
|
|
313
|
+
*/
|
|
314
|
+
private renderRubyFilterExpr;
|
|
315
|
+
private convertTemplateLiteralPartsToRuby;
|
|
316
|
+
/**
|
|
317
|
+
* Translate `${EXPR}` interpolations in a static template-part string
|
|
318
|
+
* into Ruby variable references and concatenate them with the
|
|
319
|
+
* surrounding literal text. Used by `convertTemplateLiteralPartsToRuby`
|
|
320
|
+
* when a `string` part still carries unresolved interpolations (e.g.
|
|
321
|
+
* `${className}` from a destructured prop the IR analyzer couldn't
|
|
322
|
+
* inline statically).
|
|
323
|
+
*/
|
|
324
|
+
private substituteJsInterpolationsToRuby;
|
|
325
|
+
/**
|
|
326
|
+
* Refuse JS expression shapes that have no idiomatic ERB template
|
|
327
|
+
* representation. Currently catches:
|
|
328
|
+
*
|
|
329
|
+
* - Object literals (`style={{ background: bg(), color: fg() }}`):
|
|
330
|
+
* the regex pipeline strips signal calls but leaves the surrounding
|
|
331
|
+
* `{ k: v, ... }` syntax intact, producing invalid Ruby inside
|
|
332
|
+
* `<%= ... %>`.
|
|
333
|
+
* - Tagged-template-literal call expressions
|
|
334
|
+
* (`className={cn\`base \${tone()}\`}`): regex translation
|
|
335
|
+
* produces malformed Ruby with no callable target.
|
|
336
|
+
*
|
|
337
|
+
* Records `BF101` with the same shape the Go/Mojo adapters emit, so
|
|
338
|
+
* cross-adapter diagnostics stay consistent. Returns `true` when the
|
|
339
|
+
* shape was rejected (caller should drop the attribute / skip the emit).
|
|
340
|
+
*/
|
|
341
|
+
private refuseUnsupportedAttrExpression;
|
|
342
|
+
/**
|
|
343
|
+
* Build the EmitContext seam the top-level `ParsedExpr` emitter depends on.
|
|
344
|
+
* Built as a private object (the adapter does NOT `implements ErbEmitContext`)
|
|
345
|
+
* so the wrapped bookkeeping — `_searchParamsLocals`, the const/record
|
|
346
|
+
* resolvers, the loop-bound-name predicate, BF101 recording, the
|
|
347
|
+
* filter-predicate entry — stays private and off the exported adapter's
|
|
348
|
+
* public type, matching the Mojo/Go adapters' `emitCtx`.
|
|
349
|
+
*/
|
|
350
|
+
private get emitCtx();
|
|
351
|
+
/**
|
|
352
|
+
* Build the narrow context the extracted spread lowering depends on.
|
|
353
|
+
* Passing a purpose-built object (rather than `this`) keeps the
|
|
354
|
+
* adapter's bookkeeping members private.
|
|
355
|
+
*/
|
|
356
|
+
private get spreadCtx();
|
|
357
|
+
/** Build the narrow context the extracted memo seeding depends on. */
|
|
358
|
+
private get memoCtx();
|
|
359
|
+
private convertExpressionToRuby;
|
|
360
|
+
/**
|
|
361
|
+
* Render a full ParsedExpr tree to Ruby for top-level (non-filter)
|
|
362
|
+
* expressions where identifiers are signals / vars-Hash entries.
|
|
363
|
+
* Delegates to the shared ParsedExpr dispatcher with `ErbTopLevelEmitter`.
|
|
364
|
+
*/
|
|
365
|
+
private renderParsedExprToRuby;
|
|
366
|
+
/** Whether `name` (a signal getter or prop) holds a string value — gates
|
|
367
|
+
* index-access Hash-vs-Array lowering (see `expr/operand.ts`). */
|
|
368
|
+
private _isStringValueName;
|
|
369
|
+
private _recordExprBF101;
|
|
370
|
+
/** Internal hook for higher-order: predicate body re-uses the filter emitter. */
|
|
371
|
+
private _renderRubyFilterExprPublic;
|
|
372
|
+
}
|
|
373
|
+
export declare const erbAdapter: ErbAdapter;
|
|
374
|
+
//# sourceMappingURL=erb-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erb-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/erb-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EACV,WAAW,EAEX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,aAAa,EACb,UAAU,EACV,OAAO,EAMP,yBAAyB,EAC1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAClB,KAAK,UAAU,EAyBhB,MAAM,iBAAiB,CAAA;AAKxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAmClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAoBvD,qBAAa,UAAW,SAAQ,WAAY,YAAW,aAAa,CAAC,YAAY,CAAC;IAChF,IAAI,SAAQ;IACZ,SAAS,SAAS;IAClB,qBAAqB,UAAO;IAI5B,kBAAkB,EAAG,cAAc,CAAS;IAE5C;;;;;;OAMG;IACH,kBAAkB,EAAE,yBAAyB,CAAyB;IAEtE,OAAO,CAAC,aAAa,CAAa;IAClC;;;;oDAIgD;IA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