@barefootjs/rust 0.33.3 → 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/index.js +6 -2
- package/dist/adapter/minijinja-adapter.d.ts +11 -0
- package/dist/adapter/minijinja-adapter.d.ts.map +1 -1
- 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/minijinja-adapter.ts +19 -1
- package/src/conformance-pins.ts +7 -0
- package/src/render-divergences.ts +4 -1
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
|
|
@@ -188303,6 +188304,7 @@ class MinijinjaAdapter extends BaseAdapter {
|
|
|
188303
188304
|
localConstants = [];
|
|
188304
188305
|
scope = BindingScope.EMPTY;
|
|
188305
188306
|
nullableOptionalProps = new Set;
|
|
188307
|
+
importAliases = new Map;
|
|
188306
188308
|
constructor(options = {}) {
|
|
188307
188309
|
super();
|
|
188308
188310
|
this.options = {
|
|
@@ -188323,6 +188325,7 @@ class MinijinjaAdapter extends BaseAdapter {
|
|
|
188323
188325
|
this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
|
|
188324
188326
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
|
|
188325
188327
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
|
|
188328
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
|
|
188326
188329
|
this.errors = [];
|
|
188327
188330
|
this.childrenCaptureCounter = 0;
|
|
188328
188331
|
if (!options?.siblingTemplatesRegistered) {
|
|
@@ -188799,7 +188802,8 @@ ${childrenUnderLoop}` : childrenUnderLoop;
|
|
|
188799
188802
|
childrenCaptureCounter = 0;
|
|
188800
188803
|
presenceVarCounter = 0;
|
|
188801
188804
|
toTemplateName(componentName) {
|
|
188802
|
-
|
|
188805
|
+
const declaredName = this.importAliases.get(componentName) ?? componentName;
|
|
188806
|
+
return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
|
|
188803
188807
|
}
|
|
188804
188808
|
renderIfStatement(ifStmt) {
|
|
188805
188809
|
const condition = this.convertConditionToJinja(ifStmt.condition);
|
|
@@ -207,6 +207,17 @@ export declare class MinijinjaAdapter extends BaseAdapter implements IRNodeEmitt
|
|
|
207
207
|
* concrete-primitive props.
|
|
208
208
|
*/
|
|
209
209
|
private nullableOptionalProps;
|
|
210
|
+
/**
|
|
211
|
+
* Local alias -> declared/exported name for imported components (#2822,
|
|
212
|
+
* the SSR-side counterpart of #2777's client-JS registry-key fix). A
|
|
213
|
+
* child referenced under an import alias (`import { Foo as Bar }`,
|
|
214
|
+
* `<Bar/>`) must build its cross-template call against the child's own
|
|
215
|
+
* declared name (`Foo`, what `foo.tsx` registers its minijinja partial
|
|
216
|
+
* as) — never the caller-local binding. Built once per compile from
|
|
217
|
+
* `ir.metadata.imports` via the shared `buildImportAliasMap`
|
|
218
|
+
* (`@barefootjs/jsx`) and read by `toTemplateName`.
|
|
219
|
+
*/
|
|
220
|
+
private importAliases;
|
|
210
221
|
constructor(options?: MinijinjaAdapterOptions);
|
|
211
222
|
generate(ir: ComponentIR, options?: AdapterGenerateOptions): AdapterOutput;
|
|
212
223
|
private generateScriptRegistrations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minijinja-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/minijinja-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;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AKG;IACH,OAAO,CAAC,uBAAuB;IAK/B;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IAOzB;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAI/B;;gFAE4E;IAC5E,OAAO,CAAC,kBAAkB;IAI1B;;;;OAIG;IACH,8BAA8B,CAC5B,IAAI,EAAE,MAAM,GACX;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAgBlD;IAED,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAW3C;IAED,8EAA8E;IAC9E,OAAO,CAAC,eAAe;IAIvB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,aAAa;IAKrB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,2BAA2B;IAQnC,OAAO,CAAC,yBAAyB;IAUjC,OAAO,CAAC,gBAAgB;IAcxB,iFAAiF;IACjF,OAAO,CAAC,4BAA4B;CAGrC;AAED,eAAO,MAAM,gBAAgB,kBAAyB,CAAA"}
|
|
@@ -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,eA8D7B,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
|
|
@@ -188303,6 +188304,7 @@ class MinijinjaAdapter extends BaseAdapter {
|
|
|
188303
188304
|
localConstants = [];
|
|
188304
188305
|
scope = BindingScope.EMPTY;
|
|
188305
188306
|
nullableOptionalProps = new Set;
|
|
188307
|
+
importAliases = new Map;
|
|
188306
188308
|
constructor(options = {}) {
|
|
188307
188309
|
super();
|
|
188308
188310
|
this.options = {
|
|
@@ -188323,6 +188325,7 @@ class MinijinjaAdapter extends BaseAdapter {
|
|
|
188323
188325
|
this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
|
|
188324
188326
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
|
|
188325
188327
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
|
|
188328
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
|
|
188326
188329
|
this.errors = [];
|
|
188327
188330
|
this.childrenCaptureCounter = 0;
|
|
188328
188331
|
if (!options?.siblingTemplatesRegistered) {
|
|
@@ -188799,7 +188802,8 @@ ${childrenUnderLoop}` : childrenUnderLoop;
|
|
|
188799
188802
|
childrenCaptureCounter = 0;
|
|
188800
188803
|
presenceVarCounter = 0;
|
|
188801
188804
|
toTemplateName(componentName) {
|
|
188802
|
-
|
|
188805
|
+
const declaredName = this.importAliases.get(componentName) ?? componentName;
|
|
188806
|
+
return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
|
|
188803
188807
|
}
|
|
188804
188808
|
renderIfStatement(ifStmt) {
|
|
188805
188809
|
const condition = this.convertConditionToJinja(ifStmt.condition);
|
|
@@ -189230,10 +189234,13 @@ var conformancePins = {
|
|
|
189230
189234
|
"date-method-uncatalogued": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2356" }],
|
|
189231
189235
|
"rich-prop-client-read": [{ code: "BF049", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2648" }],
|
|
189232
189236
|
"jsx-element-prop-ternary": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }],
|
|
189233
|
-
"jsx-element-prop-array": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }]
|
|
189237
|
+
"jsx-element-prop-array": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }],
|
|
189238
|
+
"namespace-import-primitive": [{ code: "BF013", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2771" }]
|
|
189234
189239
|
};
|
|
189235
189240
|
// src/render-divergences.ts
|
|
189236
|
-
var renderDivergences = {
|
|
189241
|
+
var renderDivergences = {
|
|
189242
|
+
"aliased-loop-source": "A `.map()` loop whose source is a local const alias of a signal getter (`const items__alias = items`) SSRs an empty `<ul>` through real minijinja — 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."
|
|
189243
|
+
};
|
|
189237
189244
|
export {
|
|
189238
189245
|
renderDivergences,
|
|
189239
189246
|
minijinjaAdapter,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-divergences.d.ts","sourceRoot":"","sources":["../src/render-divergences.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;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;;;;;;;;;GASG;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";
|
|
@@ -1993,7 +1993,7 @@ function identifierPath(callee) {
|
|
|
1993
1993
|
}
|
|
1994
1994
|
|
|
1995
1995
|
// ../jsx/src/prop-rewrite.ts
|
|
1996
|
-
import
|
|
1996
|
+
import ts7 from "typescript";
|
|
1997
1997
|
|
|
1998
1998
|
// ../jsx/src/ir-to-client-js/utils.ts
|
|
1999
1999
|
import ts3 from "typescript";
|
|
@@ -2143,19 +2143,61 @@ function resolveJsxChildrenProp(props) {
|
|
|
2143
2143
|
return [];
|
|
2144
2144
|
return prop.value.children ?? [];
|
|
2145
2145
|
}
|
|
2146
|
+
// ../jsx/src/ir-to-client-js/component-scope.ts
|
|
2147
|
+
function buildImportAliasMap(imports) {
|
|
2148
|
+
const aliases = new Map;
|
|
2149
|
+
for (const imp of imports) {
|
|
2150
|
+
if (imp.isTypeOnly)
|
|
2151
|
+
continue;
|
|
2152
|
+
for (const spec of imp.specifiers) {
|
|
2153
|
+
if (spec.isTypeOnly || spec.isDefault || spec.isNamespace || spec.alias === null)
|
|
2154
|
+
continue;
|
|
2155
|
+
aliases.set(spec.alias, spec.name);
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
return aliases;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2146
2161
|
// ../jsx/src/ir-to-client-js/csr-substitute.ts
|
|
2162
|
+
import ts5 from "typescript";
|
|
2163
|
+
|
|
2164
|
+
// ../jsx/src/props-binding.ts
|
|
2147
2165
|
import ts4 from "typescript";
|
|
2166
|
+
function isIdentifierName(key) {
|
|
2167
|
+
if (key.length === 0)
|
|
2168
|
+
return false;
|
|
2169
|
+
for (let i = 0;i < key.length; ) {
|
|
2170
|
+
const cp = key.codePointAt(i);
|
|
2171
|
+
const ok = i === 0 ? ts4.isIdentifierStart(cp, ts4.ScriptTarget.Latest) : ts4.isIdentifierPart(cp, ts4.ScriptTarget.Latest);
|
|
2172
|
+
if (!ok)
|
|
2173
|
+
return false;
|
|
2174
|
+
i += cp > 65535 ? 2 : 1;
|
|
2175
|
+
}
|
|
2176
|
+
return true;
|
|
2177
|
+
}
|
|
2178
|
+
function propsDestructureBinding(p) {
|
|
2179
|
+
const callerKey = p.sourceName ?? p.name;
|
|
2180
|
+
const localName = p.name;
|
|
2181
|
+
const binding = callerKey === localName ? localName : `${isIdentifierName(callerKey) ? callerKey : JSON.stringify(callerKey)}: ${localName}`;
|
|
2182
|
+
return p.defaultValue ? `${binding} = ${p.defaultValue}` : binding;
|
|
2183
|
+
}
|
|
2184
|
+
var EMPTY_SET = new Set;
|
|
2185
|
+
|
|
2186
|
+
// ../jsx/src/ir-to-client-js/csr-substitute.ts
|
|
2148
2187
|
function extractFreeIdentifiersFromText(text) {
|
|
2149
2188
|
if (!text || text.trim().length === 0)
|
|
2150
2189
|
return new Set;
|
|
2151
|
-
const sf =
|
|
2190
|
+
const sf = ts5.createSourceFile("__free_ids__.ts", `(${text});`, ts5.ScriptTarget.Latest, true, ts5.ScriptKind.TS);
|
|
2152
2191
|
const stmt = sf.statements[0];
|
|
2153
|
-
if (!stmt || !
|
|
2192
|
+
if (!stmt || !ts5.isExpressionStatement(stmt))
|
|
2154
2193
|
return new Set;
|
|
2155
|
-
const expr =
|
|
2194
|
+
const expr = ts5.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
|
|
2156
2195
|
return extractFreeIdentifiersFromNode(expr);
|
|
2157
2196
|
}
|
|
2158
2197
|
|
|
2198
|
+
// ../jsx/src/ir-to-client-js/rewrite-props-object.ts
|
|
2199
|
+
import ts6 from "typescript";
|
|
2200
|
+
|
|
2159
2201
|
// ../jsx/src/adapters/child-scope.ts
|
|
2160
2202
|
function derivesScopeFromSlot(comp) {
|
|
2161
2203
|
return comp.slotId != null && comp.loopItemRoot !== true;
|
|
@@ -2282,27 +2324,6 @@ var SKELETON_PATH_FORCE_CLOSE_GROUPS = [
|
|
|
2282
2324
|
new Set(["li"])
|
|
2283
2325
|
];
|
|
2284
2326
|
|
|
2285
|
-
// ../jsx/src/props-binding.ts
|
|
2286
|
-
import ts6 from "typescript";
|
|
2287
|
-
function isIdentifierName(key) {
|
|
2288
|
-
if (key.length === 0)
|
|
2289
|
-
return false;
|
|
2290
|
-
for (let i = 0;i < key.length; ) {
|
|
2291
|
-
const cp = key.codePointAt(i);
|
|
2292
|
-
const ok = i === 0 ? ts6.isIdentifierStart(cp, ts6.ScriptTarget.Latest) : ts6.isIdentifierPart(cp, ts6.ScriptTarget.Latest);
|
|
2293
|
-
if (!ok)
|
|
2294
|
-
return false;
|
|
2295
|
-
i += cp > 65535 ? 2 : 1;
|
|
2296
|
-
}
|
|
2297
|
-
return true;
|
|
2298
|
-
}
|
|
2299
|
-
function propsDestructureBinding(p) {
|
|
2300
|
-
const callerKey = p.sourceName ?? p.name;
|
|
2301
|
-
const localName = p.name;
|
|
2302
|
-
const binding = callerKey === localName ? localName : `${isIdentifierName(callerKey) ? callerKey : JSON.stringify(callerKey)}: ${localName}`;
|
|
2303
|
-
return p.defaultValue ? `${binding} = ${p.defaultValue}` : binding;
|
|
2304
|
-
}
|
|
2305
|
-
|
|
2306
2327
|
// ../jsx/src/instrumentation.ts
|
|
2307
2328
|
var _counters = freshCounters();
|
|
2308
2329
|
function freshCounters() {
|
|
@@ -2316,20 +2337,21 @@ function freshCounters() {
|
|
|
2316
2337
|
}
|
|
2317
2338
|
|
|
2318
2339
|
// ../jsx/src/analyzer-context.ts
|
|
2319
|
-
import
|
|
2340
|
+
import ts9 from "typescript";
|
|
2320
2341
|
|
|
2321
2342
|
// ../jsx/src/strip-types.ts
|
|
2322
|
-
import
|
|
2343
|
+
import ts8 from "typescript";
|
|
2323
2344
|
|
|
2324
2345
|
// ../jsx/src/analyzer-context.ts
|
|
2325
|
-
var _typePrinter =
|
|
2326
|
-
var _blankTypeSourceFile =
|
|
2346
|
+
var _typePrinter = ts9.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
|
|
2347
|
+
var _blankTypeSourceFile = ts9.createSourceFile("__bf_types__.ts", "", ts9.ScriptTarget.Latest);
|
|
2327
2348
|
|
|
2328
2349
|
// ../jsx/src/errors.ts
|
|
2329
2350
|
var ErrorCodes = {
|
|
2330
2351
|
MISSING_USE_CLIENT: "BF001",
|
|
2331
2352
|
CLIENT_IMPORTING_SERVER: "BF003",
|
|
2332
2353
|
SIGNAL_OUTSIDE_COMPONENT: "BF011",
|
|
2354
|
+
PRIMITIVE_VIA_NAMESPACE_IMPORT: "BF013",
|
|
2333
2355
|
UNSUPPORTED_JSX_PATTERN: "BF021",
|
|
2334
2356
|
MISSING_KEY_IN_LIST: "BF023",
|
|
2335
2357
|
MISSING_KEY_IN_NESTED_LIST: "BF024",
|
|
@@ -2362,6 +2384,7 @@ var errorMessages = {
|
|
|
2362
2384
|
[ErrorCodes.MISSING_USE_CLIENT]: "'use client' directive required for components with createSignal or event handlers",
|
|
2363
2385
|
[ErrorCodes.CLIENT_IMPORTING_SERVER]: "Client component cannot import server component",
|
|
2364
2386
|
[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.",
|
|
2387
|
+
[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.",
|
|
2365
2388
|
[ErrorCodes.UNSUPPORTED_JSX_PATTERN]: "Unsupported JSX pattern",
|
|
2366
2389
|
[ErrorCodes.MISSING_KEY_IN_LIST]: "Missing key attribute in list rendering. Add a key prop for efficient updates",
|
|
2367
2390
|
[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",
|
|
@@ -2553,46 +2576,46 @@ function extractFreeIdentifiersFromNode(node) {
|
|
|
2553
2576
|
const ids = new Set;
|
|
2554
2577
|
const boundNames = new Set;
|
|
2555
2578
|
function addBindingNames(name, out) {
|
|
2556
|
-
if (
|
|
2579
|
+
if (ts10.isIdentifier(name))
|
|
2557
2580
|
out.push(name.text);
|
|
2558
|
-
else if (
|
|
2581
|
+
else if (ts10.isObjectBindingPattern(name))
|
|
2559
2582
|
name.elements.forEach((e) => addBindingNames(e.name, out));
|
|
2560
|
-
else if (
|
|
2583
|
+
else if (ts10.isArrayBindingPattern(name))
|
|
2561
2584
|
name.elements.forEach((e) => {
|
|
2562
|
-
if (!
|
|
2585
|
+
if (!ts10.isOmittedExpression(e))
|
|
2563
2586
|
addBindingNames(e.name, out);
|
|
2564
2587
|
});
|
|
2565
2588
|
}
|
|
2566
2589
|
function visit(n) {
|
|
2567
|
-
if (
|
|
2590
|
+
if (ts10.isTypeNode(n))
|
|
2568
2591
|
return;
|
|
2569
|
-
if (
|
|
2592
|
+
if (ts10.isIdentifier(n)) {
|
|
2570
2593
|
const parent = n.parent;
|
|
2571
|
-
if (parent &&
|
|
2594
|
+
if (parent && ts10.isPropertyAccessExpression(parent) && parent.name === n)
|
|
2572
2595
|
return;
|
|
2573
|
-
if (parent &&
|
|
2596
|
+
if (parent && ts10.isPropertyAssignment(parent) && parent.name === n)
|
|
2574
2597
|
return;
|
|
2575
|
-
if (parent &&
|
|
2598
|
+
if (parent && ts10.isParameter(parent) && parent.name === n)
|
|
2576
2599
|
return;
|
|
2577
|
-
if (parent &&
|
|
2600
|
+
if (parent && ts10.isVariableDeclaration(parent) && parent.name === n)
|
|
2578
2601
|
return;
|
|
2579
2602
|
if (boundNames.has(n.text))
|
|
2580
2603
|
return;
|
|
2581
2604
|
ids.add(n.text);
|
|
2582
2605
|
return;
|
|
2583
2606
|
}
|
|
2584
|
-
if (
|
|
2607
|
+
if (ts10.isArrowFunction(n)) {
|
|
2585
2608
|
const params = [];
|
|
2586
2609
|
for (const p of n.parameters)
|
|
2587
2610
|
addBindingNames(p.name, params);
|
|
2588
2611
|
for (const name of params)
|
|
2589
2612
|
boundNames.add(name);
|
|
2590
|
-
|
|
2613
|
+
ts10.forEachChild(n, visit);
|
|
2591
2614
|
for (const name of params)
|
|
2592
2615
|
boundNames.delete(name);
|
|
2593
2616
|
return;
|
|
2594
2617
|
}
|
|
2595
|
-
|
|
2618
|
+
ts10.forEachChild(n, visit);
|
|
2596
2619
|
}
|
|
2597
2620
|
visit(node);
|
|
2598
2621
|
return ids;
|
|
@@ -2615,7 +2638,7 @@ var REACTIVE_PRIMITIVES = new Set([
|
|
|
2615
2638
|
]);
|
|
2616
2639
|
|
|
2617
2640
|
// ../jsx/src/jsx-to-ir.ts
|
|
2618
|
-
import
|
|
2641
|
+
import ts14 from "typescript";
|
|
2619
2642
|
|
|
2620
2643
|
// ../jsx/src/types.ts
|
|
2621
2644
|
var SCOPE_FORBIDDEN = {
|
|
@@ -2665,7 +2688,7 @@ function preambleAnalysisTemplateText(p) {
|
|
|
2665
2688
|
}
|
|
2666
2689
|
|
|
2667
2690
|
// ../jsx/src/module-exports.ts
|
|
2668
|
-
import
|
|
2691
|
+
import ts11 from "typescript";
|
|
2669
2692
|
function formatParamWithType(p) {
|
|
2670
2693
|
const rest = p.isRest ? "..." : "";
|
|
2671
2694
|
const optional = p.optional ? "?" : "";
|
|
@@ -2700,21 +2723,21 @@ function findAssignedNames(bodyText, candidates) {
|
|
|
2700
2723
|
const assigned = new Set;
|
|
2701
2724
|
if (candidates.size === 0)
|
|
2702
2725
|
return assigned;
|
|
2703
|
-
const sf =
|
|
2726
|
+
const sf = ts11.createSourceFile("bf-assignment-scan.tsx", bodyText, ts11.ScriptTarget.Latest, false, ts11.ScriptKind.TSX);
|
|
2704
2727
|
const record = (target) => {
|
|
2705
|
-
if (
|
|
2728
|
+
if (ts11.isIdentifier(target) && candidates.has(target.text)) {
|
|
2706
2729
|
assigned.add(target.text);
|
|
2707
2730
|
}
|
|
2708
2731
|
};
|
|
2709
2732
|
const visit = (node) => {
|
|
2710
|
-
if (
|
|
2733
|
+
if (ts11.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
|
|
2711
2734
|
record(node.left);
|
|
2712
|
-
} else if ((
|
|
2735
|
+
} else if ((ts11.isPrefixUnaryExpression(node) || ts11.isPostfixUnaryExpression(node)) && (node.operator === ts11.SyntaxKind.PlusPlusToken || node.operator === ts11.SyntaxKind.MinusMinusToken)) {
|
|
2713
2736
|
record(node.operand);
|
|
2714
2737
|
}
|
|
2715
|
-
|
|
2738
|
+
ts11.forEachChild(node, visit);
|
|
2716
2739
|
};
|
|
2717
|
-
|
|
2740
|
+
ts11.forEachChild(sf, visit);
|
|
2718
2741
|
return assigned;
|
|
2719
2742
|
}
|
|
2720
2743
|
function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNames) {
|
|
@@ -2737,14 +2760,14 @@ function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNam
|
|
|
2737
2760
|
return reachable;
|
|
2738
2761
|
}
|
|
2739
2762
|
function isAssignmentOperator(kind) {
|
|
2740
|
-
return kind >=
|
|
2763
|
+
return kind >= ts11.SyntaxKind.FirstAssignment && kind <= ts11.SyntaxKind.LastAssignment;
|
|
2741
2764
|
}
|
|
2742
2765
|
|
|
2743
2766
|
// ../jsx/src/reactivity-checker.ts
|
|
2744
|
-
import
|
|
2767
|
+
import ts12 from "typescript";
|
|
2745
2768
|
|
|
2746
2769
|
// ../jsx/src/free-refs.ts
|
|
2747
|
-
import
|
|
2770
|
+
import ts13 from "typescript";
|
|
2748
2771
|
var _bindingMapCache = new WeakMap;
|
|
2749
2772
|
|
|
2750
2773
|
// ../jsx/src/to-locale-date-lowering.ts
|
|
@@ -3192,16 +3215,16 @@ var KEYWORDS_AND_GLOBALS = new Set([
|
|
|
3192
3215
|
]);
|
|
3193
3216
|
|
|
3194
3217
|
// ../jsx/src/ir-to-client-js/walk-prop-accesses.ts
|
|
3195
|
-
import
|
|
3218
|
+
import ts15 from "typescript";
|
|
3196
3219
|
|
|
3197
3220
|
// ../jsx/src/ir-to-client-js/imports.ts
|
|
3198
|
-
import
|
|
3221
|
+
import ts17 from "typescript";
|
|
3199
3222
|
|
|
3200
3223
|
// ../jsx/src/value-references.ts
|
|
3201
|
-
import
|
|
3224
|
+
import ts16 from "typescript";
|
|
3202
3225
|
|
|
3203
3226
|
// ../jsx/src/relocate.ts
|
|
3204
|
-
import
|
|
3227
|
+
import ts18 from "typescript";
|
|
3205
3228
|
|
|
3206
3229
|
// ../jsx/src/lowering-registry.ts
|
|
3207
3230
|
var plugins = [];
|
|
@@ -3418,10 +3441,10 @@ function matchSearchParamsMethodCall(callee, args, localNames) {
|
|
|
3418
3441
|
}
|
|
3419
3442
|
|
|
3420
3443
|
// ../jsx/src/ir-to-client-js/prune-unused-prop-extractions.ts
|
|
3421
|
-
import
|
|
3444
|
+
import ts19 from "typescript";
|
|
3422
3445
|
|
|
3423
3446
|
// ../jsx/src/ir-to-client-js/control-flow/plan/lazy-preamble.ts
|
|
3424
|
-
import
|
|
3447
|
+
import ts20 from "typescript";
|
|
3425
3448
|
var NO_PREAMBLE = {
|
|
3426
3449
|
lazySafe: true,
|
|
3427
3450
|
facts: { declaredNames: new Set, freeNames: new Set }
|
|
@@ -3471,7 +3494,7 @@ var INERT_BINDING_GLOBALS = new Set([
|
|
|
3471
3494
|
]);
|
|
3472
3495
|
|
|
3473
3496
|
// ../jsx/src/ir-to-client-js/emit-reactive.ts
|
|
3474
|
-
import
|
|
3497
|
+
import ts21 from "typescript";
|
|
3475
3498
|
|
|
3476
3499
|
// ../jsx/src/ir-to-client-js/control-flow/stringify/event-delegation.ts
|
|
3477
3500
|
var NON_BUBBLING_EVENTS = new Set([
|
|
@@ -3485,9 +3508,6 @@ var NON_BUBBLING_EVENTS = new Set([
|
|
|
3485
3508
|
"pointerleave"
|
|
3486
3509
|
]);
|
|
3487
3510
|
|
|
3488
|
-
// ../jsx/src/ir-to-client-js/rewrite-props-object.ts
|
|
3489
|
-
import ts21 from "typescript";
|
|
3490
|
-
|
|
3491
3511
|
// ../jsx/src/ir-to-client-js/source-map.ts
|
|
3492
3512
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3493
3513
|
function encodeVLQ(value) {
|
|
@@ -6159,6 +6179,7 @@ class MinijinjaAdapter extends BaseAdapter {
|
|
|
6159
6179
|
localConstants = [];
|
|
6160
6180
|
scope = BindingScope.EMPTY;
|
|
6161
6181
|
nullableOptionalProps = new Set;
|
|
6182
|
+
importAliases = new Map;
|
|
6162
6183
|
constructor(options = {}) {
|
|
6163
6184
|
super();
|
|
6164
6185
|
this.options = {
|
|
@@ -6179,6 +6200,7 @@ class MinijinjaAdapter extends BaseAdapter {
|
|
|
6179
6200
|
this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
|
|
6180
6201
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
|
|
6181
6202
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
|
|
6203
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
|
|
6182
6204
|
this.errors = [];
|
|
6183
6205
|
this.childrenCaptureCounter = 0;
|
|
6184
6206
|
if (!options?.siblingTemplatesRegistered) {
|
|
@@ -6655,7 +6677,8 @@ ${childrenUnderLoop}` : childrenUnderLoop;
|
|
|
6655
6677
|
childrenCaptureCounter = 0;
|
|
6656
6678
|
presenceVarCounter = 0;
|
|
6657
6679
|
toTemplateName(componentName) {
|
|
6658
|
-
|
|
6680
|
+
const declaredName = this.importAliases.get(componentName) ?? componentName;
|
|
6681
|
+
return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
|
|
6659
6682
|
}
|
|
6660
6683
|
renderIfStatement(ifStmt) {
|
|
6661
6684
|
const condition = this.convertConditionToJinja(ifStmt.condition);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/rust",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.6",
|
|
4
4
|
"description": "minijinja (Rust) adapter for BarefootJS — compiles IR to .j2 templates and ships a Rust rendering runtime (packages/adapter-rust/runtime/); runs under any Rust web framework (axum, etc.)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"directory": "packages/adapter-rust"
|
|
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
|
}
|
|
@@ -173,6 +173,7 @@ import {
|
|
|
173
173
|
resolveStaticLoopSource,
|
|
174
174
|
derivesScopeFromSlot,
|
|
175
175
|
BindingScope,
|
|
176
|
+
buildImportAliasMap,
|
|
176
177
|
} from '@barefootjs/jsx'
|
|
177
178
|
import { isAriaBooleanAttr, isBooleanResultExpr, isExplicitStringCall } from './boolean-result.ts'
|
|
178
179
|
import type { ParsedExpr, LoweringMatcher, LoopBindingPathSegment } from '@barefootjs/jsx'
|
|
@@ -333,6 +334,18 @@ export class MinijinjaAdapter extends BaseAdapter implements IRNodeEmitter<Jinja
|
|
|
333
334
|
*/
|
|
334
335
|
private nullableOptionalProps: Set<string> = new Set()
|
|
335
336
|
|
|
337
|
+
/**
|
|
338
|
+
* Local alias -> declared/exported name for imported components (#2822,
|
|
339
|
+
* the SSR-side counterpart of #2777's client-JS registry-key fix). A
|
|
340
|
+
* child referenced under an import alias (`import { Foo as Bar }`,
|
|
341
|
+
* `<Bar/>`) must build its cross-template call against the child's own
|
|
342
|
+
* declared name (`Foo`, what `foo.tsx` registers its minijinja partial
|
|
343
|
+
* as) — never the caller-local binding. Built once per compile from
|
|
344
|
+
* `ir.metadata.imports` via the shared `buildImportAliasMap`
|
|
345
|
+
* (`@barefootjs/jsx`) and read by `toTemplateName`.
|
|
346
|
+
*/
|
|
347
|
+
private importAliases: Map<string, string> = new Map()
|
|
348
|
+
|
|
336
349
|
constructor(options: MinijinjaAdapterOptions = {}) {
|
|
337
350
|
super()
|
|
338
351
|
this.options = {
|
|
@@ -361,6 +374,7 @@ export class MinijinjaAdapter extends BaseAdapter implements IRNodeEmitter<Jinja
|
|
|
361
374
|
this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants)
|
|
362
375
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata)
|
|
363
376
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata)
|
|
377
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? [])
|
|
364
378
|
this.errors = []
|
|
365
379
|
this.childrenCaptureCounter = 0
|
|
366
380
|
|
|
@@ -1308,8 +1322,12 @@ export class MinijinjaAdapter extends BaseAdapter implements IRNodeEmitter<Jinja
|
|
|
1308
1322
|
private presenceVarCounter = 0
|
|
1309
1323
|
|
|
1310
1324
|
private toTemplateName(componentName: string): string {
|
|
1325
|
+
// Resolve an import alias (`import { Foo as Bar }`, `<Bar/>`) back to
|
|
1326
|
+
// the child's own declared name BEFORE snake-casing (#2822) — `Bar`
|
|
1327
|
+
// has no `foo.tsx`-registered partial; only `Foo` does.
|
|
1328
|
+
const declaredName = this.importAliases.get(componentName) ?? componentName
|
|
1311
1329
|
// Convert PascalCase to snake_case for template naming.
|
|
1312
|
-
return
|
|
1330
|
+
return declaredName
|
|
1313
1331
|
.replace(/([A-Z])/g, '_$1')
|
|
1314
1332
|
.toLowerCase()
|
|
1315
1333
|
.replace(/^_/, '')
|
package/src/conformance-pins.ts
CHANGED
|
@@ -64,4 +64,11 @@ export const conformancePins: ConformancePins = {
|
|
|
64
64
|
// `rich-prop-client-read` above.
|
|
65
65
|
'jsx-element-prop-ternary': [{ code: 'BF021', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2667' }],
|
|
66
66
|
'jsx-element-prop-array': [{ code: 'BF021', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2667' }],
|
|
67
|
+
// #2771: a reactive primitive invoked through a namespace import
|
|
68
|
+
// (`import * as bf from '@barefootjs/client'`, `bf.createSignal(...)`)
|
|
69
|
+
// that the analyzer's checker-less fast path cannot recognize refuses
|
|
70
|
+
// loudly (BF013) instead of silently dropping the declaration — fired
|
|
71
|
+
// in the shared analyzer pass ahead of any adapter's `adapter.generate()`,
|
|
72
|
+
// so all nine adapters (including Hono) pin this identically.
|
|
73
|
+
'namespace-import-primitive': [{ code: 'BF013', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2771' }],
|
|
67
74
|
}
|
|
@@ -17,4 +17,7 @@ import type { RenderDivergences } from '@barefootjs/jsx'
|
|
|
17
17
|
// at value position and the runtime evaluator's `object-literal` case
|
|
18
18
|
// now merges it, so the seed classifies `derived` and SSRs identically
|
|
19
19
|
// to Hono.
|
|
20
|
-
export const renderDivergences: RenderDivergences = {
|
|
20
|
+
export const renderDivergences: RenderDivergences = {
|
|
21
|
+
'aliased-loop-source':
|
|
22
|
+
'A `.map()` loop whose source is a local const alias of a signal getter (`const items__alias = items`) SSRs an empty `<ul>` through real minijinja — 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.',
|
|
23
|
+
}
|