@barefootjs/jinja 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.
@@ -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
@@ -188302,6 +188303,7 @@ class JinjaAdapter extends BaseAdapter {
188302
188303
  localConstants = [];
188303
188304
  scope = BindingScope.EMPTY;
188304
188305
  nullableOptionalProps = new Set;
188306
+ importAliases = new Map;
188305
188307
  constructor(options = {}) {
188306
188308
  super();
188307
188309
  this.options = {
@@ -188322,6 +188324,7 @@ class JinjaAdapter extends BaseAdapter {
188322
188324
  this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
188323
188325
  this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
188324
188326
  this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
188327
+ this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
188325
188328
  this.errors = [];
188326
188329
  this.childrenCaptureCounter = 0;
188327
188330
  if (!options?.siblingTemplatesRegistered) {
@@ -188799,7 +188802,8 @@ ${childrenUnderLoop}` : childrenUnderLoop;
188799
188802
  childrenCaptureCounter = 0;
188800
188803
  presenceVarCounter = 0;
188801
188804
  toTemplateName(componentName) {
188802
- return componentName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
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);
@@ -182,6 +182,17 @@ export declare class JinjaAdapter extends BaseAdapter implements IRNodeEmitter<J
182
182
  * concrete-primitive props.
183
183
  */
184
184
  private nullableOptionalProps;
185
+ /**
186
+ * Local alias -> declared/exported name for imported components (#2822,
187
+ * the SSR-side counterpart of #2777's client-JS registry-key fix). A
188
+ * child referenced under an import alias (`import { Foo as Bar }`,
189
+ * `<Bar/>`) must build its cross-template `render_child` call against
190
+ * the child's own declared name (`Foo`, what `foo.tsx` registers its
191
+ * Jinja partial as) — never the caller-local binding. Built once per
192
+ * compile from `ir.metadata.imports` via the shared `buildImportAliasMap`
193
+ * (`@barefootjs/jsx`) and read by `toTemplateName`.
194
+ */
195
+ private importAliases;
185
196
  constructor(options?: JinjaAdapterOptions);
186
197
  generate(ir: ComponentIR, options?: AdapterGenerateOptions): AdapterOutput;
187
198
  private generateScriptRegistrations;
@@ -1 +1 @@
1
- {"version":3,"file":"jinja-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/jinja-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,aAAa,EACb,UAAU,EACV,OAAO,EAKP,yBAAyB,EAE1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAClB,KAAK,UAAU,EAiChB,MAAM,iBAAiB,CAAA;AAKxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AA8BpD,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEzD,qBAAa,YAAa,SAAQ,WAAY,YAA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AO,CAAC,+BAA+B;IAuBvC;;;;;;;OAOG;IACH,OAAO,KAAK,OAAO,GASlB;IAED;;;;;OAKG;IACH,OAAO,KAAK,SAAS,GASpB;IAED,sEAAsE;IACtE,OAAO,KAAK,OAAO,GAKlB;IAED,OAAO,CAAC,wBAAwB;IA6EhC;;;;;OAKG;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,YAAY,cAAqB,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,eAsD7B,CAAA"}
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,eA6D7B,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
@@ -188302,6 +188303,7 @@ class JinjaAdapter extends BaseAdapter {
188302
188303
  localConstants = [];
188303
188304
  scope = BindingScope.EMPTY;
188304
188305
  nullableOptionalProps = new Set;
188306
+ importAliases = new Map;
188305
188307
  constructor(options = {}) {
188306
188308
  super();
188307
188309
  this.options = {
@@ -188322,6 +188324,7 @@ class JinjaAdapter extends BaseAdapter {
188322
188324
  this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
188323
188325
  this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
188324
188326
  this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
188327
+ this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
188325
188328
  this.errors = [];
188326
188329
  this.childrenCaptureCounter = 0;
188327
188330
  if (!options?.siblingTemplatesRegistered) {
@@ -188799,7 +188802,8 @@ ${childrenUnderLoop}` : childrenUnderLoop;
188799
188802
  childrenCaptureCounter = 0;
188800
188803
  presenceVarCounter = 0;
188801
188804
  toTemplateName(componentName) {
188802
- return componentName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
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>` on real Jinja2 — 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
  jinjaAdapter,
@@ -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,iBAAsB,CAAA"}
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 ts9 from "typescript";
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 ts5 from "typescript";
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 = ts4.createSourceFile("__free_ids__.ts", `(${text});`, ts4.ScriptTarget.Latest, true, ts4.ScriptKind.TS);
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 || !ts4.isExpressionStatement(stmt))
2192
+ if (!stmt || !ts5.isExpressionStatement(stmt))
2154
2193
  return new Set;
2155
- const expr = ts4.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
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 ts8 from "typescript";
2340
+ import ts9 from "typescript";
2320
2341
 
2321
2342
  // ../jsx/src/strip-types.ts
2322
- import ts7 from "typescript";
2343
+ import ts8 from "typescript";
2323
2344
 
2324
2345
  // ../jsx/src/analyzer-context.ts
2325
- var _typePrinter = ts8.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
2326
- var _blankTypeSourceFile = ts8.createSourceFile("__bf_types__.ts", "", ts8.ScriptTarget.Latest);
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 (ts9.isIdentifier(name))
2579
+ if (ts10.isIdentifier(name))
2557
2580
  out.push(name.text);
2558
- else if (ts9.isObjectBindingPattern(name))
2581
+ else if (ts10.isObjectBindingPattern(name))
2559
2582
  name.elements.forEach((e) => addBindingNames(e.name, out));
2560
- else if (ts9.isArrayBindingPattern(name))
2583
+ else if (ts10.isArrayBindingPattern(name))
2561
2584
  name.elements.forEach((e) => {
2562
- if (!ts9.isOmittedExpression(e))
2585
+ if (!ts10.isOmittedExpression(e))
2563
2586
  addBindingNames(e.name, out);
2564
2587
  });
2565
2588
  }
2566
2589
  function visit(n) {
2567
- if (ts9.isTypeNode(n))
2590
+ if (ts10.isTypeNode(n))
2568
2591
  return;
2569
- if (ts9.isIdentifier(n)) {
2592
+ if (ts10.isIdentifier(n)) {
2570
2593
  const parent = n.parent;
2571
- if (parent && ts9.isPropertyAccessExpression(parent) && parent.name === n)
2594
+ if (parent && ts10.isPropertyAccessExpression(parent) && parent.name === n)
2572
2595
  return;
2573
- if (parent && ts9.isPropertyAssignment(parent) && parent.name === n)
2596
+ if (parent && ts10.isPropertyAssignment(parent) && parent.name === n)
2574
2597
  return;
2575
- if (parent && ts9.isParameter(parent) && parent.name === n)
2598
+ if (parent && ts10.isParameter(parent) && parent.name === n)
2576
2599
  return;
2577
- if (parent && ts9.isVariableDeclaration(parent) && parent.name === n)
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 (ts9.isArrowFunction(n)) {
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
- ts9.forEachChild(n, visit);
2613
+ ts10.forEachChild(n, visit);
2591
2614
  for (const name of params)
2592
2615
  boundNames.delete(name);
2593
2616
  return;
2594
2617
  }
2595
- ts9.forEachChild(n, visit);
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 ts13 from "typescript";
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 ts10 from "typescript";
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 = ts10.createSourceFile("bf-assignment-scan.tsx", bodyText, ts10.ScriptTarget.Latest, false, ts10.ScriptKind.TSX);
2726
+ const sf = ts11.createSourceFile("bf-assignment-scan.tsx", bodyText, ts11.ScriptTarget.Latest, false, ts11.ScriptKind.TSX);
2704
2727
  const record = (target) => {
2705
- if (ts10.isIdentifier(target) && candidates.has(target.text)) {
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 (ts10.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
2733
+ if (ts11.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
2711
2734
  record(node.left);
2712
- } else if ((ts10.isPrefixUnaryExpression(node) || ts10.isPostfixUnaryExpression(node)) && (node.operator === ts10.SyntaxKind.PlusPlusToken || node.operator === ts10.SyntaxKind.MinusMinusToken)) {
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
- ts10.forEachChild(node, visit);
2738
+ ts11.forEachChild(node, visit);
2716
2739
  };
2717
- ts10.forEachChild(sf, visit);
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 >= ts10.SyntaxKind.FirstAssignment && kind <= ts10.SyntaxKind.LastAssignment;
2763
+ return kind >= ts11.SyntaxKind.FirstAssignment && kind <= ts11.SyntaxKind.LastAssignment;
2741
2764
  }
2742
2765
 
2743
2766
  // ../jsx/src/reactivity-checker.ts
2744
- import ts11 from "typescript";
2767
+ import ts12 from "typescript";
2745
2768
 
2746
2769
  // ../jsx/src/free-refs.ts
2747
- import ts12 from "typescript";
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 ts14 from "typescript";
3218
+ import ts15 from "typescript";
3196
3219
 
3197
3220
  // ../jsx/src/ir-to-client-js/imports.ts
3198
- import ts16 from "typescript";
3221
+ import ts17 from "typescript";
3199
3222
 
3200
3223
  // ../jsx/src/value-references.ts
3201
- import ts15 from "typescript";
3224
+ import ts16 from "typescript";
3202
3225
 
3203
3226
  // ../jsx/src/relocate.ts
3204
- import ts17 from "typescript";
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 ts18 from "typescript";
3444
+ import ts19 from "typescript";
3422
3445
 
3423
3446
  // ../jsx/src/ir-to-client-js/control-flow/plan/lazy-preamble.ts
3424
- import ts19 from "typescript";
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 ts20 from "typescript";
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) {
@@ -6177,6 +6197,7 @@ class JinjaAdapter extends BaseAdapter {
6177
6197
  localConstants = [];
6178
6198
  scope = BindingScope.EMPTY;
6179
6199
  nullableOptionalProps = new Set;
6200
+ importAliases = new Map;
6180
6201
  constructor(options = {}) {
6181
6202
  super();
6182
6203
  this.options = {
@@ -6197,6 +6218,7 @@ class JinjaAdapter extends BaseAdapter {
6197
6218
  this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
6198
6219
  this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
6199
6220
  this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
6221
+ this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
6200
6222
  this.errors = [];
6201
6223
  this.childrenCaptureCounter = 0;
6202
6224
  if (!options?.siblingTemplatesRegistered) {
@@ -6674,7 +6696,8 @@ ${childrenUnderLoop}` : childrenUnderLoop;
6674
6696
  childrenCaptureCounter = 0;
6675
6697
  presenceVarCounter = 0;
6676
6698
  toTemplateName(componentName) {
6677
- return componentName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
6699
+ const declaredName = this.importAliases.get(componentName) ?? componentName;
6700
+ return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
6678
6701
  }
6679
6702
  renderIfStatement(ifStmt) {
6680
6703
  const condition = this.convertConditionToJinja(ifStmt.condition);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/jinja",
3
- "version": "0.33.4",
3
+ "version": "0.33.6",
4
4
  "description": "Jinja2 adapter for BarefootJS — compiles IR to .jinja templates and ships the Python BarefootJS rendering runtime; runs under any Python web framework (Flask, etc.)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -53,7 +53,7 @@
53
53
  "directory": "packages/adapter-jinja"
54
54
  },
55
55
  "dependencies": {
56
- "@barefootjs/shared": "0.33.4"
56
+ "@barefootjs/shared": "0.33.6"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@barefootjs/jsx": ">=0.2.0",
@@ -70,9 +70,9 @@
70
70
  },
71
71
  "devDependencies": {
72
72
  "@barefootjs/adapter-tests": "0.1.0",
73
- "@barefootjs/jsx": "0.33.4",
74
- "@barefootjs/vite": "0.33.4",
75
- "@barefootjs/client": "0.33.4",
73
+ "@barefootjs/jsx": "0.33.6",
74
+ "@barefootjs/vite": "0.33.6",
75
+ "@barefootjs/client": "0.33.6",
76
76
  "typescript": "^5.0.0",
77
77
  "vite": "^6.0.0"
78
78
  }
@@ -148,6 +148,7 @@ import {
148
148
  resolveStaticLoopSource,
149
149
  derivesScopeFromSlot,
150
150
  BindingScope,
151
+ buildImportAliasMap,
151
152
  } from '@barefootjs/jsx'
152
153
  import { isAriaBooleanAttr, isBooleanResultExpr, isExplicitStringCall } from './boolean-result.ts'
153
154
  import type { ParsedExpr, LoweringMatcher } from '@barefootjs/jsx'
@@ -285,6 +286,18 @@ export class JinjaAdapter extends BaseAdapter implements IRNodeEmitter<JinjaRend
285
286
  */
286
287
  private nullableOptionalProps: Set<string> = new Set()
287
288
 
289
+ /**
290
+ * Local alias -> declared/exported name for imported components (#2822,
291
+ * the SSR-side counterpart of #2777's client-JS registry-key fix). A
292
+ * child referenced under an import alias (`import { Foo as Bar }`,
293
+ * `<Bar/>`) must build its cross-template `render_child` call against
294
+ * the child's own declared name (`Foo`, what `foo.tsx` registers its
295
+ * Jinja partial as) — never the caller-local binding. Built once per
296
+ * compile from `ir.metadata.imports` via the shared `buildImportAliasMap`
297
+ * (`@barefootjs/jsx`) and read by `toTemplateName`.
298
+ */
299
+ private importAliases: Map<string, string> = new Map()
300
+
288
301
  constructor(options: JinjaAdapterOptions = {}) {
289
302
  super()
290
303
  this.options = {
@@ -313,6 +326,7 @@ export class JinjaAdapter extends BaseAdapter implements IRNodeEmitter<JinjaRend
313
326
  this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants)
314
327
  this._searchParamsLocals = searchParamsLocalNames(ir.metadata)
315
328
  this._loweringMatchers = prepareLoweringMatchers(ir.metadata)
329
+ this.importAliases = buildImportAliasMap(ir.metadata.imports ?? [])
316
330
  this.errors = []
317
331
  this.childrenCaptureCounter = 0
318
332
 
@@ -1256,8 +1270,12 @@ export class JinjaAdapter extends BaseAdapter implements IRNodeEmitter<JinjaRend
1256
1270
  private presenceVarCounter = 0
1257
1271
 
1258
1272
  private toTemplateName(componentName: string): string {
1273
+ // Resolve an import alias (`import { Foo as Bar }`, `<Bar/>`) back to
1274
+ // the child's own declared name BEFORE snake-casing (#2822) — `Bar`
1275
+ // has no `foo.tsx`-registered partial; only `Foo` does.
1276
+ const declaredName = this.importAliases.get(componentName) ?? componentName
1259
1277
  // Convert PascalCase to snake_case for template naming.
1260
- return componentName
1278
+ return declaredName
1261
1279
  .replace(/([A-Z])/g, '_$1')
1262
1280
  .toLowerCase()
1263
1281
  .replace(/^_/, '')
@@ -63,4 +63,11 @@ export const conformancePins: ConformancePins = {
63
63
  // `rich-prop-client-read` above.
64
64
  'jsx-element-prop-ternary': [{ code: 'BF021', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2667' }],
65
65
  'jsx-element-prop-array': [{ code: 'BF021', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2667' }],
66
+ // #2771: a reactive primitive invoked through a namespace import
67
+ // (`import * as bf from '@barefootjs/client'`, `bf.createSignal(...)`)
68
+ // that the analyzer's checker-less fast path cannot recognize refuses
69
+ // loudly (BF013) instead of silently dropping the declaration — fired
70
+ // in the shared analyzer pass ahead of any adapter's `adapter.generate()`,
71
+ // so all nine adapters (including Hono) pin this identically.
72
+ 'namespace-import-primitive': [{ code: 'BF013', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2771' }],
66
73
  }
@@ -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`) SSRs an empty `<ul>` on real Jinja2 — 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
+ }