@barefootjs/xslate 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.
@@ -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
@@ -188262,6 +188263,7 @@ class XslateAdapter extends BaseAdapter {
188262
188263
  localConstants = [];
188263
188264
  scope = BindingScope.EMPTY;
188264
188265
  nullableOptionalProps = new Set;
188266
+ importAliases = new Map;
188265
188267
  constructor(options = {}) {
188266
188268
  super();
188267
188269
  this.options = {
@@ -188282,6 +188284,7 @@ class XslateAdapter extends BaseAdapter {
188282
188284
  this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
188283
188285
  this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
188284
188286
  this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
188287
+ this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
188285
188288
  this.errors = [];
188286
188289
  this.childrenCaptureCounter = 0;
188287
188290
  if (!options?.siblingTemplatesRegistered) {
@@ -188749,7 +188752,8 @@ ${childrenUnderLoop}` : childrenUnderLoop;
188749
188752
  childrenCaptureCounter = 0;
188750
188753
  presenceVarCounter = 0;
188751
188754
  toTemplateName(componentName) {
188752
- return componentName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
188755
+ const declaredName = this.importAliases.get(componentName) ?? componentName;
188756
+ return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
188753
188757
  }
188754
188758
  renderIfStatement(ifStmt) {
188755
188759
  const condition = this.convertExpressionToKolon(ifStmt.condition);
@@ -117,6 +117,19 @@ export declare class XslateAdapter extends BaseAdapter implements IRNodeEmitter<
117
117
  * defaulted, rest, and concrete-primitive props.
118
118
  */
119
119
  private nullableOptionalProps;
120
+ /**
121
+ * Local alias -> declared/exported name for imported components (#2822,
122
+ * the SSR-side counterpart of #2777's client-JS registry-key fix). A
123
+ * child referenced under an import alias (`import { Foo as Bar }`,
124
+ * `<Bar/>`) must build its cross-template call against the child's own
125
+ * declared name (`Foo`, what `foo.tsx` registers its Kolon partial as) —
126
+ * never the caller-local binding. Xslate's unresolved-reference case
127
+ * silently drops the child rather than raising, so this was the worst
128
+ * variant of the bug class. Built once per compile from
129
+ * `ir.metadata.imports` via the shared `buildImportAliasMap`
130
+ * (`@barefootjs/jsx`) and read by `toTemplateName`.
131
+ */
132
+ private importAliases;
120
133
  constructor(options?: XslateAdapterOptions);
121
134
  generate(ir: ComponentIR, options?: AdapterGenerateOptions): AdapterOutput;
122
135
  private generateScriptRegistrations;
@@ -1 +1 @@
1
- {"version":3,"file":"xslate-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/xslate-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;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,EAG1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAClB,KAAK,UAAU,EAiChB,MAAM,iBAAiB,CAAA;AAMxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAyBrD,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AA2C1D,qBAAa,aAAc,SAAQ,WAAY,YAAW,aAAa,CAAC,eAA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;IA6EhC;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAI/B;oEACgE;IAChE,OAAO,CAAC,kBAAkB;IAI1B;;;;;OAKG;IACH;;;;;OAKG;IACH;;;;;OAKG;IACH;;;;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;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,2BAA2B;IAQnC,OAAO,CAAC,yBAAyB;IASjC,OAAO,CAAC,gBAAgB;IAcxB,iFAAiF;IACjF,OAAO,CAAC,4BAA4B;CAGrC;AAED,eAAO,MAAM,aAAa,eAAsB,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
@@ -188262,6 +188263,7 @@ class XslateAdapter extends BaseAdapter {
188262
188263
  localConstants = [];
188263
188264
  scope = BindingScope.EMPTY;
188264
188265
  nullableOptionalProps = new Set;
188266
+ importAliases = new Map;
188265
188267
  constructor(options = {}) {
188266
188268
  super();
188267
188269
  this.options = {
@@ -188282,6 +188284,7 @@ class XslateAdapter extends BaseAdapter {
188282
188284
  this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
188283
188285
  this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
188284
188286
  this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
188287
+ this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
188285
188288
  this.errors = [];
188286
188289
  this.childrenCaptureCounter = 0;
188287
188290
  if (!options?.siblingTemplatesRegistered) {
@@ -188749,7 +188752,8 @@ ${childrenUnderLoop}` : childrenUnderLoop;
188749
188752
  childrenCaptureCounter = 0;
188750
188753
  presenceVarCounter = 0;
188751
188754
  toTemplateName(componentName) {
188752
- return componentName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
188755
+ const declaredName = this.importAliases.get(componentName) ?? componentName;
188756
+ return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
188753
188757
  }
188754
188758
  renderIfStatement(ifStmt) {
188755
188759
  const condition = this.convertExpressionToKolon(ifStmt.condition);
@@ -189163,10 +189167,13 @@ var conformancePins = {
189163
189167
  "date-method-uncatalogued": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2356" }],
189164
189168
  "rich-prop-client-read": [{ code: "BF049", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2648" }],
189165
189169
  "jsx-element-prop-ternary": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }],
189166
- "jsx-element-prop-array": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }]
189170
+ "jsx-element-prop-array": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }],
189171
+ "namespace-import-primitive": [{ code: "BF013", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2771" }]
189167
189172
  };
189168
189173
  // src/render-divergences.ts
189169
- var renderDivergences = {};
189174
+ var renderDivergences = {
189175
+ "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 Text::Xslate — 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."
189176
+ };
189170
189177
  export {
189171
189178
  xslateAdapter,
189172
189179
  renderDivergences,
@@ -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;AAexD,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;AAexD,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";
@@ -1941,7 +1941,7 @@ function identifierPath(callee) {
1941
1941
  }
1942
1942
 
1943
1943
  // ../jsx/src/prop-rewrite.ts
1944
- import ts5 from "typescript";
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 = ts4.createSourceFile("__free_ids__.ts", `(${text});`, ts4.ScriptTarget.Latest, true, ts4.ScriptKind.TS);
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 || !ts4.isExpressionStatement(stmt))
2140
+ if (!stmt || !ts5.isExpressionStatement(stmt))
2102
2141
  return new Set;
2103
- const expr = ts4.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
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 ts8 from "typescript";
2288
+ import ts9 from "typescript";
2268
2289
 
2269
2290
  // ../jsx/src/strip-types.ts
2270
- import ts7 from "typescript";
2291
+ import ts8 from "typescript";
2271
2292
 
2272
2293
  // ../jsx/src/analyzer-context.ts
2273
- var _typePrinter = ts8.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
2274
- var _blankTypeSourceFile = ts8.createSourceFile("__bf_types__.ts", "", ts8.ScriptTarget.Latest);
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 (ts9.isIdentifier(name))
2527
+ if (ts10.isIdentifier(name))
2505
2528
  out.push(name.text);
2506
- else if (ts9.isObjectBindingPattern(name))
2529
+ else if (ts10.isObjectBindingPattern(name))
2507
2530
  name.elements.forEach((e) => addBindingNames(e.name, out));
2508
- else if (ts9.isArrayBindingPattern(name))
2531
+ else if (ts10.isArrayBindingPattern(name))
2509
2532
  name.elements.forEach((e) => {
2510
- if (!ts9.isOmittedExpression(e))
2533
+ if (!ts10.isOmittedExpression(e))
2511
2534
  addBindingNames(e.name, out);
2512
2535
  });
2513
2536
  }
2514
2537
  function visit(n) {
2515
- if (ts9.isTypeNode(n))
2538
+ if (ts10.isTypeNode(n))
2516
2539
  return;
2517
- if (ts9.isIdentifier(n)) {
2540
+ if (ts10.isIdentifier(n)) {
2518
2541
  const parent = n.parent;
2519
- if (parent && ts9.isPropertyAccessExpression(parent) && parent.name === n)
2542
+ if (parent && ts10.isPropertyAccessExpression(parent) && parent.name === n)
2520
2543
  return;
2521
- if (parent && ts9.isPropertyAssignment(parent) && parent.name === n)
2544
+ if (parent && ts10.isPropertyAssignment(parent) && parent.name === n)
2522
2545
  return;
2523
- if (parent && ts9.isParameter(parent) && parent.name === n)
2546
+ if (parent && ts10.isParameter(parent) && parent.name === n)
2524
2547
  return;
2525
- if (parent && ts9.isVariableDeclaration(parent) && parent.name === n)
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 (ts9.isArrowFunction(n)) {
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
- ts9.forEachChild(n, visit);
2561
+ ts10.forEachChild(n, visit);
2539
2562
  for (const name of params)
2540
2563
  boundNames.delete(name);
2541
2564
  return;
2542
2565
  }
2543
- ts9.forEachChild(n, visit);
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 ts13 from "typescript";
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 ts10 from "typescript";
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 = ts10.createSourceFile("bf-assignment-scan.tsx", bodyText, ts10.ScriptTarget.Latest, false, ts10.ScriptKind.TSX);
2674
+ const sf = ts11.createSourceFile("bf-assignment-scan.tsx", bodyText, ts11.ScriptTarget.Latest, false, ts11.ScriptKind.TSX);
2652
2675
  const record = (target) => {
2653
- if (ts10.isIdentifier(target) && candidates.has(target.text)) {
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 (ts10.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
2681
+ if (ts11.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
2659
2682
  record(node.left);
2660
- } else if ((ts10.isPrefixUnaryExpression(node) || ts10.isPostfixUnaryExpression(node)) && (node.operator === ts10.SyntaxKind.PlusPlusToken || node.operator === ts10.SyntaxKind.MinusMinusToken)) {
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
- ts10.forEachChild(node, visit);
2686
+ ts11.forEachChild(node, visit);
2664
2687
  };
2665
- ts10.forEachChild(sf, visit);
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 >= ts10.SyntaxKind.FirstAssignment && kind <= ts10.SyntaxKind.LastAssignment;
2711
+ return kind >= ts11.SyntaxKind.FirstAssignment && kind <= ts11.SyntaxKind.LastAssignment;
2689
2712
  }
2690
2713
 
2691
2714
  // ../jsx/src/reactivity-checker.ts
2692
- import ts11 from "typescript";
2715
+ import ts12 from "typescript";
2693
2716
 
2694
2717
  // ../jsx/src/free-refs.ts
2695
- import ts12 from "typescript";
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 ts14 from "typescript";
3166
+ import ts15 from "typescript";
3144
3167
 
3145
3168
  // ../jsx/src/ir-to-client-js/imports.ts
3146
- import ts16 from "typescript";
3169
+ import ts17 from "typescript";
3147
3170
 
3148
3171
  // ../jsx/src/value-references.ts
3149
- import ts15 from "typescript";
3172
+ import ts16 from "typescript";
3150
3173
 
3151
3174
  // ../jsx/src/relocate.ts
3152
- import ts17 from "typescript";
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 ts18 from "typescript";
3392
+ import ts19 from "typescript";
3370
3393
 
3371
3394
  // ../jsx/src/ir-to-client-js/control-flow/plan/lazy-preamble.ts
3372
- import ts19 from "typescript";
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 ts20 from "typescript";
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) {
@@ -6171,6 +6191,7 @@ class XslateAdapter extends BaseAdapter {
6171
6191
  localConstants = [];
6172
6192
  scope = BindingScope.EMPTY;
6173
6193
  nullableOptionalProps = new Set;
6194
+ importAliases = new Map;
6174
6195
  constructor(options = {}) {
6175
6196
  super();
6176
6197
  this.options = {
@@ -6191,6 +6212,7 @@ class XslateAdapter extends BaseAdapter {
6191
6212
  this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants);
6192
6213
  this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
6193
6214
  this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
6215
+ this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
6194
6216
  this.errors = [];
6195
6217
  this.childrenCaptureCounter = 0;
6196
6218
  if (!options?.siblingTemplatesRegistered) {
@@ -6658,7 +6680,8 @@ ${childrenUnderLoop}` : childrenUnderLoop;
6658
6680
  childrenCaptureCounter = 0;
6659
6681
  presenceVarCounter = 0;
6660
6682
  toTemplateName(componentName) {
6661
- return componentName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
6683
+ const declaredName = this.importAliases.get(componentName) ?? componentName;
6684
+ return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
6662
6685
  }
6663
6686
  renderIfStatement(ifStmt) {
6664
6687
  const condition = this.convertExpressionToKolon(ifStmt.condition);
@@ -1,5 +1,5 @@
1
1
  package BarefootJS::Backend::Xslate;
2
- our $VERSION = "0.33.2";
2
+ our $VERSION = "0.33.4";
3
3
  use strict;
4
4
  use warnings;
5
5
  use utf8;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/xslate",
3
- "version": "0.33.3",
3
+ "version": "0.33.6",
4
4
  "description": "Text::Xslate (Kolon) adapter for BarefootJS — compiles IR to .tx templates and ships the Xslate rendering backend; runs under any PSGI/Plack app",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -55,7 +55,7 @@
55
55
  "directory": "packages/adapter-xslate"
56
56
  },
57
57
  "dependencies": {
58
- "@barefootjs/shared": "0.33.3"
58
+ "@barefootjs/shared": "0.33.6"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@barefootjs/jsx": ">=0.2.0",
@@ -72,9 +72,9 @@
72
72
  },
73
73
  "devDependencies": {
74
74
  "@barefootjs/adapter-tests": "0.1.0",
75
- "@barefootjs/jsx": "0.33.3",
76
- "@barefootjs/vite": "0.33.3",
77
- "@barefootjs/client": "0.33.3",
75
+ "@barefootjs/jsx": "0.33.6",
76
+ "@barefootjs/vite": "0.33.6",
77
+ "@barefootjs/client": "0.33.6",
78
78
  "typescript": "^5.0.0",
79
79
  "vite": "^6.0.0"
80
80
  }
@@ -81,6 +81,7 @@ import {
81
81
  resolveStaticLoopSource,
82
82
  derivesScopeFromSlot,
83
83
  BindingScope,
84
+ buildImportAliasMap,
84
85
  } from '@barefootjs/jsx'
85
86
  import { isAriaBooleanAttr, isBooleanResultExpr } from './boolean-result.ts'
86
87
  import ts from 'typescript'
@@ -258,6 +259,20 @@ export class XslateAdapter extends BaseAdapter implements IRNodeEmitter<XslateRe
258
259
  */
259
260
  private nullableOptionalProps: Set<string> = new Set()
260
261
 
262
+ /**
263
+ * Local alias -> declared/exported name for imported components (#2822,
264
+ * the SSR-side counterpart of #2777's client-JS registry-key fix). A
265
+ * child referenced under an import alias (`import { Foo as Bar }`,
266
+ * `<Bar/>`) must build its cross-template call against the child's own
267
+ * declared name (`Foo`, what `foo.tsx` registers its Kolon partial as) —
268
+ * never the caller-local binding. Xslate's unresolved-reference case
269
+ * silently drops the child rather than raising, so this was the worst
270
+ * variant of the bug class. Built once per compile from
271
+ * `ir.metadata.imports` via the shared `buildImportAliasMap`
272
+ * (`@barefootjs/jsx`) and read by `toTemplateName`.
273
+ */
274
+ private importAliases: Map<string, string> = new Map()
275
+
261
276
  constructor(options: XslateAdapterOptions = {}) {
262
277
  super()
263
278
  this.options = {
@@ -287,6 +302,7 @@ export class XslateAdapter extends BaseAdapter implements IRNodeEmitter<XslateRe
287
302
  this.moduleStringConsts = collectModuleStringConsts(ir.metadata.localConstants)
288
303
  this._searchParamsLocals = searchParamsLocalNames(ir.metadata)
289
304
  this._loweringMatchers = prepareLoweringMatchers(ir.metadata)
305
+ this.importAliases = buildImportAliasMap(ir.metadata.imports ?? [])
290
306
  this.errors = []
291
307
  this.childrenCaptureCounter = 0
292
308
 
@@ -1229,8 +1245,14 @@ export class XslateAdapter extends BaseAdapter implements IRNodeEmitter<XslateRe
1229
1245
  private presenceVarCounter = 0
1230
1246
 
1231
1247
  private toTemplateName(componentName: string): string {
1248
+ // Resolve an import alias (`import { Foo as Bar }`, `<Bar/>`) back to
1249
+ // the child's own declared name BEFORE snake-casing (#2822) — `Bar`
1250
+ // has no `foo.tsx`-registered partial; only `Foo` does. Xslate's
1251
+ // unresolved-reference case silently drops the child rather than
1252
+ // raising, so this mismatch was the worst variant of the bug class.
1253
+ const declaredName = this.importAliases.get(componentName) ?? componentName
1232
1254
  // Convert PascalCase to snake_case for template naming.
1233
- return componentName
1255
+ return declaredName
1234
1256
  .replace(/([A-Z])/g, '_$1')
1235
1257
  .toLowerCase()
1236
1258
  .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
  }
@@ -22,4 +22,7 @@ import type { RenderDivergences } from '@barefootjs/jsx'
22
22
  // the real name off that capture — the same in-template recompute the other
23
23
  // six template-stash backends already had. Keep the file even when the set
24
24
  // is empty — the next divergence lands here, not in a re-created file.
25
- export const renderDivergences: RenderDivergences = {}
25
+ export const renderDivergences: RenderDivergences = {
26
+ 'aliased-loop-source':
27
+ 'A `.map()` loop whose source is a local const alias of a signal getter (`const items__alias = items`) SSRs an empty `<ul>` on real Text::Xslate — 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.',
28
+ }