@barefootjs/erb 0.33.4 → 0.33.6
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/erb-adapter.d.ts +11 -0
- package/dist/adapter/erb-adapter.d.ts.map +1 -1
- package/dist/adapter/index.js +6 -2
- package/dist/conformance-pins.d.ts.map +1 -1
- package/dist/index.js +11 -4
- package/dist/render-divergences.d.ts.map +1 -1
- package/dist/vite.js +88 -65
- package/package.json +5 -5
- package/src/adapter/erb-adapter.ts +18 -1
- package/src/conformance-pins.ts +7 -0
- package/src/render-divergences.ts +4 -1
|
@@ -141,6 +141,17 @@ export declare class ErbAdapter extends BaseAdapter implements IRNodeEmitter<Erb
|
|
|
141
141
|
* nullish-attribute omission.
|
|
142
142
|
*/
|
|
143
143
|
private nullableOptionalProps;
|
|
144
|
+
/**
|
|
145
|
+
* Local alias -> declared/exported name for imported components (#2822,
|
|
146
|
+
* the SSR-side counterpart of #2777's client-JS registry-key fix). A
|
|
147
|
+
* child referenced under an import alias (`import { Foo as Bar }`,
|
|
148
|
+
* `<Bar/>`) must build its cross-template `render_child` call against
|
|
149
|
+
* the child's own declared name (`Foo`, what `foo.tsx` registers its ERB
|
|
150
|
+
* partial as) — never the caller-local binding. Built once per compile
|
|
151
|
+
* from `ir.metadata.imports` via the shared `buildImportAliasMap`
|
|
152
|
+
* (`@barefootjs/jsx`) and read by `toTemplateName`.
|
|
153
|
+
*/
|
|
154
|
+
private importAliases;
|
|
144
155
|
constructor(options?: ErbAdapterOptions);
|
|
145
156
|
generate(ir: ComponentIR, options?: AdapterGenerateOptions): AdapterOutput;
|
|
146
157
|
/**
|
|
@@ -1 +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,EA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C;IAmBxC;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,+BAA+B;IAuBvC;;;;;;;OAOG;IACH,OAAO,KAAK,OAAO,GAWlB;IAED;;;;OAIG;IACH,OAAO,KAAK,SAAS,GAQpB;IAED,sEAAsE;IACtE,OAAO,KAAK,OAAO,GAElB;IAED,OAAO,CAAC,uBAAuB;IAmF/B;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAI9B;uEACmE;IACnE,OAAO,CAAC,kBAAkB;IAI1B;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IAexB,iFAAiF;IACjF,OAAO,CAAC,2BAA2B;CAGpC;AAED,eAAO,MAAM,UAAU,YAAmB,CAAA"}
|
package/dist/adapter/index.js
CHANGED
|
@@ -187316,7 +187316,8 @@ import {
|
|
|
187316
187316
|
dangerousInnerHtmlDiagnostic,
|
|
187317
187317
|
resolveStaticLoopSource,
|
|
187318
187318
|
derivesScopeFromSlot,
|
|
187319
|
-
BindingScope
|
|
187319
|
+
BindingScope,
|
|
187320
|
+
buildImportAliasMap
|
|
187320
187321
|
} from "@barefootjs/jsx";
|
|
187321
187322
|
|
|
187322
187323
|
// src/adapter/boolean-result.ts
|
|
@@ -188354,6 +188355,7 @@ class ErbAdapter extends BaseAdapter {
|
|
|
188354
188355
|
localConstants = [];
|
|
188355
188356
|
scope = BindingScope.EMPTY;
|
|
188356
188357
|
nullableOptionalProps = new Set;
|
|
188358
|
+
importAliases = new Map;
|
|
188357
188359
|
constructor(options = {}) {
|
|
188358
188360
|
super();
|
|
188359
188361
|
this.options = {
|
|
@@ -188374,6 +188376,7 @@ class ErbAdapter extends BaseAdapter {
|
|
|
188374
188376
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
|
|
188375
188377
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
|
|
188376
188378
|
this.localConstants = ir.metadata.localConstants ?? [];
|
|
188379
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
|
|
188377
188380
|
this.scope = BindingScope.EMPTY;
|
|
188378
188381
|
this.errors = [];
|
|
188379
188382
|
this.childrenCaptureCounter = 0;
|
|
@@ -188901,7 +188904,8 @@ ${renderedChildren}` : renderedChildren;
|
|
|
188901
188904
|
}
|
|
188902
188905
|
childrenCaptureCounter = 0;
|
|
188903
188906
|
toTemplateName(componentName) {
|
|
188904
|
-
|
|
188907
|
+
const declaredName = this.importAliases.get(componentName) ?? componentName;
|
|
188908
|
+
return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
|
|
188905
188909
|
}
|
|
188906
188910
|
renderIfStatement(ifStmt) {
|
|
188907
188911
|
const condition = this.convertExpressionToRuby(ifStmt.condition);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conformance-pins.d.ts","sourceRoot":"","sources":["../src/conformance-pins.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"conformance-pins.d.ts","sourceRoot":"","sources":["../src/conformance-pins.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,eAAO,MAAM,eAAe,EAAE,eAsD7B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -187316,7 +187316,8 @@ import {
|
|
|
187316
187316
|
dangerousInnerHtmlDiagnostic,
|
|
187317
187317
|
resolveStaticLoopSource,
|
|
187318
187318
|
derivesScopeFromSlot,
|
|
187319
|
-
BindingScope
|
|
187319
|
+
BindingScope,
|
|
187320
|
+
buildImportAliasMap
|
|
187320
187321
|
} from "@barefootjs/jsx";
|
|
187321
187322
|
|
|
187322
187323
|
// src/adapter/boolean-result.ts
|
|
@@ -188354,6 +188355,7 @@ class ErbAdapter extends BaseAdapter {
|
|
|
188354
188355
|
localConstants = [];
|
|
188355
188356
|
scope = BindingScope.EMPTY;
|
|
188356
188357
|
nullableOptionalProps = new Set;
|
|
188358
|
+
importAliases = new Map;
|
|
188357
188359
|
constructor(options = {}) {
|
|
188358
188360
|
super();
|
|
188359
188361
|
this.options = {
|
|
@@ -188374,6 +188376,7 @@ class ErbAdapter extends BaseAdapter {
|
|
|
188374
188376
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
|
|
188375
188377
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
|
|
188376
188378
|
this.localConstants = ir.metadata.localConstants ?? [];
|
|
188379
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
|
|
188377
188380
|
this.scope = BindingScope.EMPTY;
|
|
188378
188381
|
this.errors = [];
|
|
188379
188382
|
this.childrenCaptureCounter = 0;
|
|
@@ -188901,7 +188904,8 @@ ${renderedChildren}` : renderedChildren;
|
|
|
188901
188904
|
}
|
|
188902
188905
|
childrenCaptureCounter = 0;
|
|
188903
188906
|
toTemplateName(componentName) {
|
|
188904
|
-
|
|
188907
|
+
const declaredName = this.importAliases.get(componentName) ?? componentName;
|
|
188908
|
+
return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
|
|
188905
188909
|
}
|
|
188906
188910
|
renderIfStatement(ifStmt) {
|
|
188907
188911
|
const condition = this.convertExpressionToRuby(ifStmt.condition);
|
|
@@ -189248,10 +189252,13 @@ var conformancePins = {
|
|
|
189248
189252
|
"date-method-uncatalogued": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2356" }],
|
|
189249
189253
|
"rich-prop-client-read": [{ code: "BF049", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2648" }],
|
|
189250
189254
|
"jsx-element-prop-ternary": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }],
|
|
189251
|
-
"jsx-element-prop-array": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }]
|
|
189255
|
+
"jsx-element-prop-array": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }],
|
|
189256
|
+
"namespace-import-primitive": [{ code: "BF013", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2771" }]
|
|
189252
189257
|
};
|
|
189253
189258
|
// src/render-divergences.ts
|
|
189254
|
-
var renderDivergences = {
|
|
189259
|
+
var renderDivergences = {
|
|
189260
|
+
"aliased-loop-source": "A `.map()` loop whose source is a local const alias of a signal getter (`const items__alias = items`) throws `undefined method 'length' for nil (NoMethodError)` on real Ruby ERB — the seeded loop data is keyed by the signal's real name (`items`), and the alias hop is never resolved when deciding what to seed under `items__alias`. This is the SSR-side twin of #2778 (fixed for the CSR client-JS template in the same PR that added this fixture) — that fix only touches client-JS emission, not SSR data-seeding. Tracked at https://github.com/piconic-ai/barefootjs/issues/2813; graduate by resolving the alias hop at SSR-seeding time using the same `resolveAliasOrigin`/`resolveGetterAliases` mechanism #2778 introduced, rather than a third alias-hop walker."
|
|
189261
|
+
};
|
|
189255
189262
|
export {
|
|
189256
189263
|
renderDivergences,
|
|
189257
189264
|
erbAdapter,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-divergences.d.ts","sourceRoot":"","sources":["../src/render-divergences.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAQxD,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"render-divergences.d.ts","sourceRoot":"","sources":["../src/render-divergences.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAQxD,eAAO,MAAM,iBAAiB,EAAE,iBAG/B,CAAA"}
|
package/dist/vite.js
CHANGED
|
@@ -8,7 +8,7 @@ import { devModuleUrl, loadManifest, resolveDevOrigin, resolveScriptAssets, toPo
|
|
|
8
8
|
import ts25 from "typescript";
|
|
9
9
|
|
|
10
10
|
// ../jsx/src/analyzer.ts
|
|
11
|
-
import
|
|
11
|
+
import ts10 from "typescript";
|
|
12
12
|
|
|
13
13
|
// ../jsx/src/expression-parser.ts
|
|
14
14
|
import ts from "typescript";
|
|
@@ -1941,7 +1941,7 @@ function identifierPath(callee) {
|
|
|
1941
1941
|
}
|
|
1942
1942
|
|
|
1943
1943
|
// ../jsx/src/prop-rewrite.ts
|
|
1944
|
-
import
|
|
1944
|
+
import ts7 from "typescript";
|
|
1945
1945
|
|
|
1946
1946
|
// ../jsx/src/ir-to-client-js/utils.ts
|
|
1947
1947
|
import ts3 from "typescript";
|
|
@@ -2091,19 +2091,61 @@ function resolveJsxChildrenProp(props) {
|
|
|
2091
2091
|
return [];
|
|
2092
2092
|
return prop.value.children ?? [];
|
|
2093
2093
|
}
|
|
2094
|
+
// ../jsx/src/ir-to-client-js/component-scope.ts
|
|
2095
|
+
function buildImportAliasMap(imports) {
|
|
2096
|
+
const aliases = new Map;
|
|
2097
|
+
for (const imp of imports) {
|
|
2098
|
+
if (imp.isTypeOnly)
|
|
2099
|
+
continue;
|
|
2100
|
+
for (const spec of imp.specifiers) {
|
|
2101
|
+
if (spec.isTypeOnly || spec.isDefault || spec.isNamespace || spec.alias === null)
|
|
2102
|
+
continue;
|
|
2103
|
+
aliases.set(spec.alias, spec.name);
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
return aliases;
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2094
2109
|
// ../jsx/src/ir-to-client-js/csr-substitute.ts
|
|
2110
|
+
import ts5 from "typescript";
|
|
2111
|
+
|
|
2112
|
+
// ../jsx/src/props-binding.ts
|
|
2095
2113
|
import ts4 from "typescript";
|
|
2114
|
+
function isIdentifierName(key) {
|
|
2115
|
+
if (key.length === 0)
|
|
2116
|
+
return false;
|
|
2117
|
+
for (let i = 0;i < key.length; ) {
|
|
2118
|
+
const cp = key.codePointAt(i);
|
|
2119
|
+
const ok = i === 0 ? ts4.isIdentifierStart(cp, ts4.ScriptTarget.Latest) : ts4.isIdentifierPart(cp, ts4.ScriptTarget.Latest);
|
|
2120
|
+
if (!ok)
|
|
2121
|
+
return false;
|
|
2122
|
+
i += cp > 65535 ? 2 : 1;
|
|
2123
|
+
}
|
|
2124
|
+
return true;
|
|
2125
|
+
}
|
|
2126
|
+
function propsDestructureBinding(p) {
|
|
2127
|
+
const callerKey = p.sourceName ?? p.name;
|
|
2128
|
+
const localName = p.name;
|
|
2129
|
+
const binding = callerKey === localName ? localName : `${isIdentifierName(callerKey) ? callerKey : JSON.stringify(callerKey)}: ${localName}`;
|
|
2130
|
+
return p.defaultValue ? `${binding} = ${p.defaultValue}` : binding;
|
|
2131
|
+
}
|
|
2132
|
+
var EMPTY_SET = new Set;
|
|
2133
|
+
|
|
2134
|
+
// ../jsx/src/ir-to-client-js/csr-substitute.ts
|
|
2096
2135
|
function extractFreeIdentifiersFromText(text) {
|
|
2097
2136
|
if (!text || text.trim().length === 0)
|
|
2098
2137
|
return new Set;
|
|
2099
|
-
const sf =
|
|
2138
|
+
const sf = ts5.createSourceFile("__free_ids__.ts", `(${text});`, ts5.ScriptTarget.Latest, true, ts5.ScriptKind.TS);
|
|
2100
2139
|
const stmt = sf.statements[0];
|
|
2101
|
-
if (!stmt || !
|
|
2140
|
+
if (!stmt || !ts5.isExpressionStatement(stmt))
|
|
2102
2141
|
return new Set;
|
|
2103
|
-
const expr =
|
|
2142
|
+
const expr = ts5.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
|
|
2104
2143
|
return extractFreeIdentifiersFromNode(expr);
|
|
2105
2144
|
}
|
|
2106
2145
|
|
|
2146
|
+
// ../jsx/src/ir-to-client-js/rewrite-props-object.ts
|
|
2147
|
+
import ts6 from "typescript";
|
|
2148
|
+
|
|
2107
2149
|
// ../jsx/src/adapters/child-scope.ts
|
|
2108
2150
|
function derivesScopeFromSlot(comp) {
|
|
2109
2151
|
return comp.slotId != null && comp.loopItemRoot !== true;
|
|
@@ -2230,27 +2272,6 @@ var SKELETON_PATH_FORCE_CLOSE_GROUPS = [
|
|
|
2230
2272
|
new Set(["li"])
|
|
2231
2273
|
];
|
|
2232
2274
|
|
|
2233
|
-
// ../jsx/src/props-binding.ts
|
|
2234
|
-
import ts6 from "typescript";
|
|
2235
|
-
function isIdentifierName(key) {
|
|
2236
|
-
if (key.length === 0)
|
|
2237
|
-
return false;
|
|
2238
|
-
for (let i = 0;i < key.length; ) {
|
|
2239
|
-
const cp = key.codePointAt(i);
|
|
2240
|
-
const ok = i === 0 ? ts6.isIdentifierStart(cp, ts6.ScriptTarget.Latest) : ts6.isIdentifierPart(cp, ts6.ScriptTarget.Latest);
|
|
2241
|
-
if (!ok)
|
|
2242
|
-
return false;
|
|
2243
|
-
i += cp > 65535 ? 2 : 1;
|
|
2244
|
-
}
|
|
2245
|
-
return true;
|
|
2246
|
-
}
|
|
2247
|
-
function propsDestructureBinding(p) {
|
|
2248
|
-
const callerKey = p.sourceName ?? p.name;
|
|
2249
|
-
const localName = p.name;
|
|
2250
|
-
const binding = callerKey === localName ? localName : `${isIdentifierName(callerKey) ? callerKey : JSON.stringify(callerKey)}: ${localName}`;
|
|
2251
|
-
return p.defaultValue ? `${binding} = ${p.defaultValue}` : binding;
|
|
2252
|
-
}
|
|
2253
|
-
|
|
2254
2275
|
// ../jsx/src/instrumentation.ts
|
|
2255
2276
|
var _counters = freshCounters();
|
|
2256
2277
|
function freshCounters() {
|
|
@@ -2264,20 +2285,21 @@ function freshCounters() {
|
|
|
2264
2285
|
}
|
|
2265
2286
|
|
|
2266
2287
|
// ../jsx/src/analyzer-context.ts
|
|
2267
|
-
import
|
|
2288
|
+
import ts9 from "typescript";
|
|
2268
2289
|
|
|
2269
2290
|
// ../jsx/src/strip-types.ts
|
|
2270
|
-
import
|
|
2291
|
+
import ts8 from "typescript";
|
|
2271
2292
|
|
|
2272
2293
|
// ../jsx/src/analyzer-context.ts
|
|
2273
|
-
var _typePrinter =
|
|
2274
|
-
var _blankTypeSourceFile =
|
|
2294
|
+
var _typePrinter = ts9.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
|
|
2295
|
+
var _blankTypeSourceFile = ts9.createSourceFile("__bf_types__.ts", "", ts9.ScriptTarget.Latest);
|
|
2275
2296
|
|
|
2276
2297
|
// ../jsx/src/errors.ts
|
|
2277
2298
|
var ErrorCodes = {
|
|
2278
2299
|
MISSING_USE_CLIENT: "BF001",
|
|
2279
2300
|
CLIENT_IMPORTING_SERVER: "BF003",
|
|
2280
2301
|
SIGNAL_OUTSIDE_COMPONENT: "BF011",
|
|
2302
|
+
PRIMITIVE_VIA_NAMESPACE_IMPORT: "BF013",
|
|
2281
2303
|
UNSUPPORTED_JSX_PATTERN: "BF021",
|
|
2282
2304
|
MISSING_KEY_IN_LIST: "BF023",
|
|
2283
2305
|
MISSING_KEY_IN_NESTED_LIST: "BF024",
|
|
@@ -2310,6 +2332,7 @@ var errorMessages = {
|
|
|
2310
2332
|
[ErrorCodes.MISSING_USE_CLIENT]: "'use client' directive required for components with createSignal or event handlers",
|
|
2311
2333
|
[ErrorCodes.CLIENT_IMPORTING_SERVER]: "Client component cannot import server component",
|
|
2312
2334
|
[ErrorCodes.SIGNAL_OUTSIDE_COMPONENT]: "Module-level reactive declaration (createSignal / createMemo) is not allowed. " + "The downstream codegen drops the declaration silently and every reference becomes a ReferenceError at SSR and at hydrate. " + "Move the declaration inside a component function so each mount gets its own state.",
|
|
2335
|
+
[ErrorCodes.PRIMITIVE_VIA_NAMESPACE_IMPORT]: "Reactive primitive called through a namespace import of '@barefootjs/client' (import * as ns) is not recognized; " + "the declaration is dropped and its references throw ReferenceError at hydrate. Import the primitive by name instead.",
|
|
2313
2336
|
[ErrorCodes.UNSUPPORTED_JSX_PATTERN]: "Unsupported JSX pattern",
|
|
2314
2337
|
[ErrorCodes.MISSING_KEY_IN_LIST]: "Missing key attribute in list rendering. Add a key prop for efficient updates",
|
|
2315
2338
|
[ErrorCodes.MISSING_KEY_IN_NESTED_LIST]: "Nested .map() loop requires key attribute for event delegation. Add a key prop to elements in the inner loop",
|
|
@@ -2501,46 +2524,46 @@ function extractFreeIdentifiersFromNode(node) {
|
|
|
2501
2524
|
const ids = new Set;
|
|
2502
2525
|
const boundNames = new Set;
|
|
2503
2526
|
function addBindingNames(name, out) {
|
|
2504
|
-
if (
|
|
2527
|
+
if (ts10.isIdentifier(name))
|
|
2505
2528
|
out.push(name.text);
|
|
2506
|
-
else if (
|
|
2529
|
+
else if (ts10.isObjectBindingPattern(name))
|
|
2507
2530
|
name.elements.forEach((e) => addBindingNames(e.name, out));
|
|
2508
|
-
else if (
|
|
2531
|
+
else if (ts10.isArrayBindingPattern(name))
|
|
2509
2532
|
name.elements.forEach((e) => {
|
|
2510
|
-
if (!
|
|
2533
|
+
if (!ts10.isOmittedExpression(e))
|
|
2511
2534
|
addBindingNames(e.name, out);
|
|
2512
2535
|
});
|
|
2513
2536
|
}
|
|
2514
2537
|
function visit(n) {
|
|
2515
|
-
if (
|
|
2538
|
+
if (ts10.isTypeNode(n))
|
|
2516
2539
|
return;
|
|
2517
|
-
if (
|
|
2540
|
+
if (ts10.isIdentifier(n)) {
|
|
2518
2541
|
const parent = n.parent;
|
|
2519
|
-
if (parent &&
|
|
2542
|
+
if (parent && ts10.isPropertyAccessExpression(parent) && parent.name === n)
|
|
2520
2543
|
return;
|
|
2521
|
-
if (parent &&
|
|
2544
|
+
if (parent && ts10.isPropertyAssignment(parent) && parent.name === n)
|
|
2522
2545
|
return;
|
|
2523
|
-
if (parent &&
|
|
2546
|
+
if (parent && ts10.isParameter(parent) && parent.name === n)
|
|
2524
2547
|
return;
|
|
2525
|
-
if (parent &&
|
|
2548
|
+
if (parent && ts10.isVariableDeclaration(parent) && parent.name === n)
|
|
2526
2549
|
return;
|
|
2527
2550
|
if (boundNames.has(n.text))
|
|
2528
2551
|
return;
|
|
2529
2552
|
ids.add(n.text);
|
|
2530
2553
|
return;
|
|
2531
2554
|
}
|
|
2532
|
-
if (
|
|
2555
|
+
if (ts10.isArrowFunction(n)) {
|
|
2533
2556
|
const params = [];
|
|
2534
2557
|
for (const p of n.parameters)
|
|
2535
2558
|
addBindingNames(p.name, params);
|
|
2536
2559
|
for (const name of params)
|
|
2537
2560
|
boundNames.add(name);
|
|
2538
|
-
|
|
2561
|
+
ts10.forEachChild(n, visit);
|
|
2539
2562
|
for (const name of params)
|
|
2540
2563
|
boundNames.delete(name);
|
|
2541
2564
|
return;
|
|
2542
2565
|
}
|
|
2543
|
-
|
|
2566
|
+
ts10.forEachChild(n, visit);
|
|
2544
2567
|
}
|
|
2545
2568
|
visit(node);
|
|
2546
2569
|
return ids;
|
|
@@ -2563,7 +2586,7 @@ var REACTIVE_PRIMITIVES = new Set([
|
|
|
2563
2586
|
]);
|
|
2564
2587
|
|
|
2565
2588
|
// ../jsx/src/jsx-to-ir.ts
|
|
2566
|
-
import
|
|
2589
|
+
import ts14 from "typescript";
|
|
2567
2590
|
|
|
2568
2591
|
// ../jsx/src/types.ts
|
|
2569
2592
|
var SCOPE_FORBIDDEN = {
|
|
@@ -2613,7 +2636,7 @@ function preambleAnalysisTemplateText(p) {
|
|
|
2613
2636
|
}
|
|
2614
2637
|
|
|
2615
2638
|
// ../jsx/src/module-exports.ts
|
|
2616
|
-
import
|
|
2639
|
+
import ts11 from "typescript";
|
|
2617
2640
|
function formatParamWithType(p) {
|
|
2618
2641
|
const rest = p.isRest ? "..." : "";
|
|
2619
2642
|
const optional = p.optional ? "?" : "";
|
|
@@ -2648,21 +2671,21 @@ function findAssignedNames(bodyText, candidates) {
|
|
|
2648
2671
|
const assigned = new Set;
|
|
2649
2672
|
if (candidates.size === 0)
|
|
2650
2673
|
return assigned;
|
|
2651
|
-
const sf =
|
|
2674
|
+
const sf = ts11.createSourceFile("bf-assignment-scan.tsx", bodyText, ts11.ScriptTarget.Latest, false, ts11.ScriptKind.TSX);
|
|
2652
2675
|
const record = (target) => {
|
|
2653
|
-
if (
|
|
2676
|
+
if (ts11.isIdentifier(target) && candidates.has(target.text)) {
|
|
2654
2677
|
assigned.add(target.text);
|
|
2655
2678
|
}
|
|
2656
2679
|
};
|
|
2657
2680
|
const visit = (node) => {
|
|
2658
|
-
if (
|
|
2681
|
+
if (ts11.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
|
|
2659
2682
|
record(node.left);
|
|
2660
|
-
} else if ((
|
|
2683
|
+
} else if ((ts11.isPrefixUnaryExpression(node) || ts11.isPostfixUnaryExpression(node)) && (node.operator === ts11.SyntaxKind.PlusPlusToken || node.operator === ts11.SyntaxKind.MinusMinusToken)) {
|
|
2661
2684
|
record(node.operand);
|
|
2662
2685
|
}
|
|
2663
|
-
|
|
2686
|
+
ts11.forEachChild(node, visit);
|
|
2664
2687
|
};
|
|
2665
|
-
|
|
2688
|
+
ts11.forEachChild(sf, visit);
|
|
2666
2689
|
return assigned;
|
|
2667
2690
|
}
|
|
2668
2691
|
function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNames) {
|
|
@@ -2685,14 +2708,14 @@ function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNam
|
|
|
2685
2708
|
return reachable;
|
|
2686
2709
|
}
|
|
2687
2710
|
function isAssignmentOperator(kind) {
|
|
2688
|
-
return kind >=
|
|
2711
|
+
return kind >= ts11.SyntaxKind.FirstAssignment && kind <= ts11.SyntaxKind.LastAssignment;
|
|
2689
2712
|
}
|
|
2690
2713
|
|
|
2691
2714
|
// ../jsx/src/reactivity-checker.ts
|
|
2692
|
-
import
|
|
2715
|
+
import ts12 from "typescript";
|
|
2693
2716
|
|
|
2694
2717
|
// ../jsx/src/free-refs.ts
|
|
2695
|
-
import
|
|
2718
|
+
import ts13 from "typescript";
|
|
2696
2719
|
var _bindingMapCache = new WeakMap;
|
|
2697
2720
|
|
|
2698
2721
|
// ../jsx/src/to-locale-date-lowering.ts
|
|
@@ -3140,16 +3163,16 @@ var KEYWORDS_AND_GLOBALS = new Set([
|
|
|
3140
3163
|
]);
|
|
3141
3164
|
|
|
3142
3165
|
// ../jsx/src/ir-to-client-js/walk-prop-accesses.ts
|
|
3143
|
-
import
|
|
3166
|
+
import ts15 from "typescript";
|
|
3144
3167
|
|
|
3145
3168
|
// ../jsx/src/ir-to-client-js/imports.ts
|
|
3146
|
-
import
|
|
3169
|
+
import ts17 from "typescript";
|
|
3147
3170
|
|
|
3148
3171
|
// ../jsx/src/value-references.ts
|
|
3149
|
-
import
|
|
3172
|
+
import ts16 from "typescript";
|
|
3150
3173
|
|
|
3151
3174
|
// ../jsx/src/relocate.ts
|
|
3152
|
-
import
|
|
3175
|
+
import ts18 from "typescript";
|
|
3153
3176
|
|
|
3154
3177
|
// ../jsx/src/lowering-registry.ts
|
|
3155
3178
|
var plugins = [];
|
|
@@ -3366,10 +3389,10 @@ function matchSearchParamsMethodCall(callee, args, localNames) {
|
|
|
3366
3389
|
}
|
|
3367
3390
|
|
|
3368
3391
|
// ../jsx/src/ir-to-client-js/prune-unused-prop-extractions.ts
|
|
3369
|
-
import
|
|
3392
|
+
import ts19 from "typescript";
|
|
3370
3393
|
|
|
3371
3394
|
// ../jsx/src/ir-to-client-js/control-flow/plan/lazy-preamble.ts
|
|
3372
|
-
import
|
|
3395
|
+
import ts20 from "typescript";
|
|
3373
3396
|
var NO_PREAMBLE = {
|
|
3374
3397
|
lazySafe: true,
|
|
3375
3398
|
facts: { declaredNames: new Set, freeNames: new Set }
|
|
@@ -3419,7 +3442,7 @@ var INERT_BINDING_GLOBALS = new Set([
|
|
|
3419
3442
|
]);
|
|
3420
3443
|
|
|
3421
3444
|
// ../jsx/src/ir-to-client-js/emit-reactive.ts
|
|
3422
|
-
import
|
|
3445
|
+
import ts21 from "typescript";
|
|
3423
3446
|
|
|
3424
3447
|
// ../jsx/src/ir-to-client-js/control-flow/stringify/event-delegation.ts
|
|
3425
3448
|
var NON_BUBBLING_EVENTS = new Set([
|
|
@@ -3433,9 +3456,6 @@ var NON_BUBBLING_EVENTS = new Set([
|
|
|
3433
3456
|
"pointerleave"
|
|
3434
3457
|
]);
|
|
3435
3458
|
|
|
3436
|
-
// ../jsx/src/ir-to-client-js/rewrite-props-object.ts
|
|
3437
|
-
import ts21 from "typescript";
|
|
3438
|
-
|
|
3439
3459
|
// ../jsx/src/ir-to-client-js/source-map.ts
|
|
3440
3460
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3441
3461
|
function encodeVLQ(value) {
|
|
@@ -6176,6 +6196,7 @@ class ErbAdapter extends BaseAdapter {
|
|
|
6176
6196
|
localConstants = [];
|
|
6177
6197
|
scope = BindingScope.EMPTY;
|
|
6178
6198
|
nullableOptionalProps = new Set;
|
|
6199
|
+
importAliases = new Map;
|
|
6179
6200
|
constructor(options = {}) {
|
|
6180
6201
|
super();
|
|
6181
6202
|
this.options = {
|
|
@@ -6196,6 +6217,7 @@ class ErbAdapter extends BaseAdapter {
|
|
|
6196
6217
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
|
|
6197
6218
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
|
|
6198
6219
|
this.localConstants = ir.metadata.localConstants ?? [];
|
|
6220
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
|
|
6199
6221
|
this.scope = BindingScope.EMPTY;
|
|
6200
6222
|
this.errors = [];
|
|
6201
6223
|
this.childrenCaptureCounter = 0;
|
|
@@ -6723,7 +6745,8 @@ ${renderedChildren}` : renderedChildren;
|
|
|
6723
6745
|
}
|
|
6724
6746
|
childrenCaptureCounter = 0;
|
|
6725
6747
|
toTemplateName(componentName) {
|
|
6726
|
-
|
|
6748
|
+
const declaredName = this.importAliases.get(componentName) ?? componentName;
|
|
6749
|
+
return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
|
|
6727
6750
|
}
|
|
6728
6751
|
renderIfStatement(ifStmt) {
|
|
6729
6752
|
const condition = this.convertExpressionToRuby(ifStmt.condition);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/erb",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.6",
|
|
4
4
|
"description": "ERB (Embedded Ruby) adapter for BarefootJS — compiles IR to .erb templates and ships the Ruby rendering backend; runs under any Rack app (Sinatra, Rails)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"directory": "packages/adapter-erb"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@barefootjs/shared": "0.33.
|
|
57
|
+
"@barefootjs/shared": "0.33.6"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@barefootjs/jsx": ">=0.2.0",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@barefootjs/adapter-tests": "0.1.0",
|
|
74
|
-
"@barefootjs/jsx": "0.33.
|
|
75
|
-
"@barefootjs/vite": "0.33.
|
|
76
|
-
"@barefootjs/client": "0.33.
|
|
74
|
+
"@barefootjs/jsx": "0.33.6",
|
|
75
|
+
"@barefootjs/vite": "0.33.6",
|
|
76
|
+
"@barefootjs/client": "0.33.6",
|
|
77
77
|
"typescript": "^5.0.0",
|
|
78
78
|
"vite": "^6.0.0"
|
|
79
79
|
}
|
|
@@ -96,6 +96,7 @@ import {
|
|
|
96
96
|
resolveStaticLoopSource,
|
|
97
97
|
derivesScopeFromSlot,
|
|
98
98
|
BindingScope,
|
|
99
|
+
buildImportAliasMap,
|
|
99
100
|
} from '@barefootjs/jsx'
|
|
100
101
|
import { isAriaBooleanAttr, isBooleanResultExpr, isExplicitStringCall } from './boolean-result.ts'
|
|
101
102
|
import type { ParsedExpr, LoweringMatcher, LoopBindingPathSegment, EscapeKind } from '@barefootjs/jsx'
|
|
@@ -259,6 +260,17 @@ export class ErbAdapter extends BaseAdapter implements IRNodeEmitter<ErbRenderCt
|
|
|
259
260
|
* nullish-attribute omission.
|
|
260
261
|
*/
|
|
261
262
|
private nullableOptionalProps: Set<string> = new Set()
|
|
263
|
+
/**
|
|
264
|
+
* Local alias -> declared/exported name for imported components (#2822,
|
|
265
|
+
* the SSR-side counterpart of #2777's client-JS registry-key fix). A
|
|
266
|
+
* child referenced under an import alias (`import { Foo as Bar }`,
|
|
267
|
+
* `<Bar/>`) must build its cross-template `render_child` call against
|
|
268
|
+
* the child's own declared name (`Foo`, what `foo.tsx` registers its ERB
|
|
269
|
+
* partial as) — never the caller-local binding. Built once per compile
|
|
270
|
+
* from `ir.metadata.imports` via the shared `buildImportAliasMap`
|
|
271
|
+
* (`@barefootjs/jsx`) and read by `toTemplateName`.
|
|
272
|
+
*/
|
|
273
|
+
private importAliases: Map<string, string> = new Map()
|
|
262
274
|
|
|
263
275
|
constructor(options: ErbAdapterOptions = {}) {
|
|
264
276
|
super()
|
|
@@ -288,6 +300,7 @@ export class ErbAdapter extends BaseAdapter implements IRNodeEmitter<ErbRenderCt
|
|
|
288
300
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata)
|
|
289
301
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata)
|
|
290
302
|
this.localConstants = ir.metadata.localConstants ?? []
|
|
303
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? [])
|
|
291
304
|
this.scope = BindingScope.EMPTY
|
|
292
305
|
this.errors = []
|
|
293
306
|
this.childrenCaptureCounter = 0
|
|
@@ -1323,8 +1336,12 @@ export class ErbAdapter extends BaseAdapter implements IRNodeEmitter<ErbRenderCt
|
|
|
1323
1336
|
private childrenCaptureCounter = 0
|
|
1324
1337
|
|
|
1325
1338
|
private toTemplateName(componentName: string): string {
|
|
1339
|
+
// Resolve an import alias (`import { Foo as Bar }`, `<Bar/>`) back to
|
|
1340
|
+
// the child's own declared name BEFORE snake-casing (#2822) — `Bar`
|
|
1341
|
+
// has no `foo.tsx`-registered partial; only `Foo` does.
|
|
1342
|
+
const declaredName = this.importAliases.get(componentName) ?? componentName
|
|
1326
1343
|
// Convert PascalCase to snake_case for ERB template naming
|
|
1327
|
-
return
|
|
1344
|
+
return declaredName
|
|
1328
1345
|
.replace(/([A-Z])/g, '_$1')
|
|
1329
1346
|
.toLowerCase()
|
|
1330
1347
|
.replace(/^_/, '')
|
package/src/conformance-pins.ts
CHANGED
|
@@ -56,4 +56,11 @@ export const conformancePins: ConformancePins = {
|
|
|
56
56
|
// `rich-prop-client-read` above.
|
|
57
57
|
'jsx-element-prop-ternary': [{ code: 'BF021', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2667' }],
|
|
58
58
|
'jsx-element-prop-array': [{ code: 'BF021', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2667' }],
|
|
59
|
+
// #2771: a reactive primitive invoked through a namespace import
|
|
60
|
+
// (`import * as bf from '@barefootjs/client'`, `bf.createSignal(...)`)
|
|
61
|
+
// that the analyzer's checker-less fast path cannot recognize refuses
|
|
62
|
+
// loudly (BF013) instead of silently dropping the declaration — fired
|
|
63
|
+
// in the shared analyzer pass ahead of any adapter's `adapter.generate()`,
|
|
64
|
+
// so all nine adapters (including Hono) pin this identically.
|
|
65
|
+
'namespace-import-primitive': [{ code: 'BF013', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2771' }],
|
|
59
66
|
}
|
|
@@ -15,4 +15,7 @@ import type { RenderDivergences } from '@barefootjs/jsx'
|
|
|
15
15
|
// at value position and the runtime evaluator's `object-literal` case
|
|
16
16
|
// now merges it, so the seed classifies `derived` and SSRs identically
|
|
17
17
|
// to Hono.
|
|
18
|
-
export const renderDivergences: RenderDivergences = {
|
|
18
|
+
export const renderDivergences: RenderDivergences = {
|
|
19
|
+
'aliased-loop-source':
|
|
20
|
+
'A `.map()` loop whose source is a local const alias of a signal getter (`const items__alias = items`) throws `undefined method \'length\' for nil (NoMethodError)` on real Ruby ERB — the seeded loop data is keyed by the signal\'s real name (`items`), and the alias hop is never resolved when deciding what to seed under `items__alias`. This is the SSR-side twin of #2778 (fixed for the CSR client-JS template in the same PR that added this fixture) — that fix only touches client-JS emission, not SSR data-seeding. Tracked at https://github.com/piconic-ai/barefootjs/issues/2813; graduate by resolving the alias hop at SSR-seeding time using the same `resolveAliasOrigin`/`resolveGetterAliases` mechanism #2778 introduced, rather than a third alias-hop walker.',
|
|
21
|
+
}
|