@barefootjs/go-template 0.31.3 → 0.31.5

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.
@@ -56,7 +56,37 @@ export declare class GoTemplateAdapter extends BaseAdapter implements ParsedExpr
56
56
  * populated it, not correctness across passes.
57
57
  */
58
58
  private bakedStaticChildLoopCache;
59
- private loopParamStack;
59
+ /**
60
+ * The one threaded, immutable scope of "names bound by an enclosing loop
61
+ * callback" (#2482 Stage 3 — replaces this adapter's own order-sensitive
62
+ * loop-param stack). Entered via `enterLoopRow(loop)` in `renderLoop` /
63
+ * `renderUnrolledStaticElementLoop`, bracketing preamble conversion,
64
+ * children rendering, AND the key-anchor (`loopItemMarker`) conversion —
65
+ * mirrors the Stage 1a/1b `ctx.scope` precedent in `jsx-to-ir.ts` and the
66
+ * Stage 2 template-string-adapter migration. `IRLoop` already structurally
67
+ * satisfies `LoopBindingSource` (`param`/`index`/`paramBindings`/
68
+ * `preamble`), so most call sites pass the loop node straight through.
69
+ *
70
+ * ONE Go-specific wrinkle `BindingScope`'s generic 'item' semantics don't
71
+ * know about: a `.keys()`-shape loop's callback param is the RANGE INDEX,
72
+ * not the range value — Go's `{{range}}` dot context there is the
73
+ * (discarded) value, not the key, so the key must never win the
74
+ * depth-0-item "resolves to `.`" fast path `isCurrentLoopItem` grants a
75
+ * plain `.map()` param. `renderLoop` enters such a loop's scope with an
76
+ * overridden EMPTY `param`, mirroring the historical empty-string push
77
+ * onto the old stack for the same shape — the key name stays
78
+ * resolvable only through `loopVarRefCount`'s existing `$name` machinery,
79
+ * unchanged by this migration.
80
+ *
81
+ * Destructured-binding ACCESSOR TEXT (`id` → `$__bf_item0.Id`) is Go-
82
+ * specific rendering payload `ScopeBinding` has no field for (by design —
83
+ * `BindingScope` only carries EXISTENCE/kind, not per-adapter accessor
84
+ * strings), so `loopBindingStack` stays as the accessor source of truth,
85
+ * pushed/popped in lockstep with `scope` at the same points. `scope`
86
+ * subsumes its EXISTENCE role (shadow-guard / dot-vs-`$name` decisions)
87
+ * everywhere except the accessor lookup itself.
88
+ */
89
+ private scope;
60
90
  /**
61
91
  * Stack of `IRLoop.depth` values (innermost last), pushed/popped around
62
92
  * `renderChildren(loop.children)` in `renderLoop`. `renderAttributes`
@@ -673,11 +703,23 @@ export declare class GoTemplateAdapter extends BaseAdapter implements ParsedExpr
673
703
  * unproven (numbers, `props.X`, calls it doesn't know) returns false.
674
704
  */
675
705
  private isStringExpr;
706
+ /**
707
+ * True when `name` is bound as the CURRENT (innermost) loop row's own
708
+ * plain `.map()` item param — i.e. it resolves to Go template's dot
709
+ * context (`.`), not a `$name` range variable or a root field. `depth 0`
710
+ * is `scope`'s innermost frame; `source === 'item'` excludes a
711
+ * destructured binding (source `'destructure'`, resolved through
712
+ * `loopBindingStack` instead — see `scope`'s field docstring) and a
713
+ * `.keys()`-shape loop's key param (never bound as `'item'` at all —
714
+ * `renderLoop` enters that shape's scope with an overridden empty param).
715
+ */
716
+ private isCurrentLoopItem;
676
717
  /**
677
718
  * True when `name` is a loop value variable from an enclosing (not the
678
- * current) loop — i.e. it sits on `loopParamStack` below the top. Such a
679
- * reference resolves to the Go range variable `$name`, not the inner dot or
680
- * the root data.
719
+ * current) loop — i.e. it's bound in `scope` as an OUTER frame's own
720
+ * plain item param (`depth > 0`, source `'item'`). Such a reference
721
+ * resolves to the Go range variable `$name`, not the inner dot or the
722
+ * root data.
681
723
  */
682
724
  private isOuterLoopParam;
683
725
  /**
@@ -927,10 +969,12 @@ export declare class GoTemplateAdapter extends BaseAdapter implements ParsedExpr
927
969
  private convertExpressionToGo;
928
970
  /**
929
971
  * Whether `name` at the CURRENT emission position is bound by an enclosing
930
- * loop callback — its item param (`loopParamStack` top), an outer loop's
931
- * range variable, a hoisted loop var, or a destructured binding name
932
- * (`loopBindingStack`, which is the ONLY place destructured callbacks
933
- * record their names; they push `''` onto `loopParamStack`). Shared by the
972
+ * loop callback — its item param, an outer loop's range variable, a
973
+ * destructured binding name, an index var, or a preamble local. `scope`
974
+ * (`BindingScope`, #2482 Stage 3) covers all of those EXCEPT a
975
+ * `.keys()`-shape loop's own key param (never bound in `scope` at all
976
+ * see `scope`'s field docstring), which stays reachable only through
977
+ * `loopVarRefCount` — so both are still consulted. Shared by the
934
978
  * string-keyed fast paths (#2236, #2242 Copilot review) that resolve raw
935
979
  * `jsExpr` text before `identifier()`'s own guards can see it. Mirrors the
936
980
  * checks in `resolveModuleStringConst` / `resolveModuleNumericConst`.
@@ -1 +1 @@
1
- {"version":3,"file":"go-template-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/go-template-adapter.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAIpE,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EAEN,WAAW,EACX,UAAU,EACV,MAAM,EAKN,aAAa,EAEb,UAAU,EACV,qBAAqB,EAGrB,SAAS,EACT,YAAY,EACZ,aAAa,EACb,UAAU,EACV,OAAO,EAEP,yBAAyB,EAE1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,UAAU,EA+BhB,MAAM,iBAAiB,CAAA;AA8BxB,OAAO,KAAK,EACV,WAAW,EAOX,wBAAwB,EACzB,MAAM,gBAAgB,CAAA;AAyBvB,YAAY,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAuC9D,qBAAa,iBAAkB,SAAQ,WAAY,YAAW,iBAAiB,EAAE,aAAa,CAAC,WAAW,CAAC;IACzG,IAAI,SAAgB;IACpB,SAAS,SAAU;IAInB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAA0B;IAMhE,OAAO,CAAC,eAAe,CAAI;IAC3B,OAAO,CAAC,qBAAq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AEvC;IAED,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,OAAO,CAAC,kBAAkB;CAmB3B;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAA"}
1
+ {"version":3,"file":"go-template-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/go-template-adapter.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAIpE,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EAEN,WAAW,EACX,UAAU,EACV,MAAM,EAKN,aAAa,EAEb,UAAU,EACV,qBAAqB,EAGrB,SAAS,EACT,YAAY,EACZ,aAAa,EACb,UAAU,EACV,OAAO,EAEP,yBAAyB,EAG1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,UAAU,EAgChB,MAAM,iBAAiB,CAAA;AA8BxB,OAAO,KAAK,EACV,WAAW,EAOX,wBAAwB,EACzB,MAAM,gBAAgB,CAAA;AAyBvB,YAAY,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAuC9D,qBAAa,iBAAkB,SAAQ,WAAY,YAAW,iBAAiB,EAAE,aAAa,CAAC,WAAW,CAAC;IACzG,IAAI,SAAgB;IACpB,SAAS,SAAU;IAInB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAA0B;IAMhE,OAAO,CAAC,eAAe,CAAI;IAC3B,OAAO,CAAC,qBAAqB,CAAQ;IAErC;;;;;;;;;OASG;IACH,kBAAkB,EAAE,yBAAyB,CAG1C;IAEH;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAGtC;IAEH,OAAO,CAAC,OAAO,CAAoC;IAEnD,kIAAkI;IAClI,OAA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AmB3B;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAA"}
@@ -26,7 +26,8 @@ import {
26
26
  dangerousInnerHtmlMetacharViolation,
27
27
  dangerousInnerHtmlDiagnostic,
28
28
  collectLoopBoundNames as collectLoopBoundNames2,
29
- evaluateStaticLiteral as evaluateStaticLiteral3
29
+ evaluateStaticLiteral as evaluateStaticLiteral3,
30
+ BindingScope
30
31
  } from "@barefootjs/jsx";
31
32
  import { findInterpolationEnd } from "@barefootjs/jsx/scanner";
32
33
  import { BF_REGION, escapeHtml } from "@barefootjs/shared";
@@ -2856,7 +2857,7 @@ class GoTemplateAdapter extends BaseAdapter {
2856
2857
  }
2857
2858
  inLoop = false;
2858
2859
  bakedStaticChildLoopCache = new Map;
2859
- loopParamStack = [];
2860
+ scope = BindingScope.EMPTY;
2860
2861
  loopKeyDepthStack = [];
2861
2862
  loopScalarItemStack = [];
2862
2863
  loopWrapperStack = [];
@@ -2914,6 +2915,7 @@ class GoTemplateAdapter extends BaseAdapter {
2914
2915
  this.state.referencedDerivedConsts = new Set;
2915
2916
  this.state.templateVarCounter = 0;
2916
2917
  this.state.pendingChildrenDefines = [];
2918
+ this.scope = BindingScope.EMPTY;
2917
2919
  this.primeCompileState(ir);
2918
2920
  this.state.stringValueNames = collectStringValueNames(ir);
2919
2921
  this.recordDerivedFieldDeps(ir, new Set((ir.metadata.propsParams ?? []).map((p) => p.name)));
@@ -4794,8 +4796,7 @@ ${goFields.join(`
4794
4796
  const inlinedNum = this.resolveModuleNumericConst(name);
4795
4797
  if (inlinedNum !== null)
4796
4798
  return inlinedNum;
4797
- const currentLoopParam = this.loopParamStack[this.loopParamStack.length - 1];
4798
- if (currentLoopParam && name === currentLoopParam)
4799
+ if (this.isCurrentLoopItem(name))
4799
4800
  return ".";
4800
4801
  if (this.isOuterLoopParam(name))
4801
4802
  return `$${name}`;
@@ -4862,16 +4863,16 @@ ${goFields.join(`
4862
4863
  }
4863
4864
  return false;
4864
4865
  }
4866
+ isCurrentLoopItem(name) {
4867
+ const hit = this.scope.lookup(name);
4868
+ return hit !== null && hit.depth === 0 && hit.binding.source === "item";
4869
+ }
4865
4870
  isOuterLoopParam(name) {
4866
- const top = this.loopParamStack.length - 1;
4867
- for (let i = 0;i < top; i++) {
4868
- if (this.loopParamStack[i] === name)
4869
- return true;
4870
- }
4871
- return false;
4871
+ const hit = this.scope.lookup(name);
4872
+ return hit !== null && hit.depth > 0 && hit.binding.source === "item";
4872
4873
  }
4873
4874
  rootFieldRef(name) {
4874
- const prefix = this.loopParamStack.length > 0 ? "$." : ".";
4875
+ const prefix = this.inLoop ? "$." : ".";
4875
4876
  return `${prefix}${capitalizeFieldName(name)}`;
4876
4877
  }
4877
4878
  searchParamsFieldRef(name) {
@@ -4881,9 +4882,8 @@ ${goFields.join(`
4881
4882
  return collectModuleStringConstsShared(constants);
4882
4883
  }
4883
4884
  resolveModuleStringConst(name) {
4884
- if (this.loopParamStack.length > 0 && this.loopParamStack[this.loopParamStack.length - 1] === name) {
4885
+ if (this.isCurrentLoopItem(name))
4885
4886
  return null;
4886
- }
4887
4887
  if (this.loopVarRefCount.has(name))
4888
4888
  return null;
4889
4889
  if (this.isOuterLoopParam(name))
@@ -4894,9 +4894,8 @@ ${goFields.join(`
4894
4894
  return `"${escapeGoString(value)}"`;
4895
4895
  }
4896
4896
  resolveModuleNumericConst(name) {
4897
- if (this.loopParamStack.length > 0 && this.loopParamStack[this.loopParamStack.length - 1] === name) {
4897
+ if (this.isCurrentLoopItem(name))
4898
4898
  return null;
4899
- }
4900
4899
  if (this.loopVarRefCount.has(name))
4901
4900
  return null;
4902
4901
  if (this.isOuterLoopParam(name))
@@ -4951,7 +4950,7 @@ ${goFields.join(`
4951
4950
  if (property === "length" && object.kind === "call" && object.callee.kind === "identifier" && object.args.length === 0) {
4952
4951
  const slice = this.state.memoBackedLoopSlice.get(object.callee.name);
4953
4952
  if (slice) {
4954
- const prefix = this.loopParamStack.length > 0 ? "$." : ".";
4953
+ const prefix = this.inLoop ? "$." : ".";
4955
4954
  return `len ${prefix}${slice}`;
4956
4955
  }
4957
4956
  }
@@ -4976,8 +4975,7 @@ ${goFields.join(`
4976
4975
  if (staticValue !== null)
4977
4976
  return staticValue;
4978
4977
  }
4979
- const currentLoopParam = this.loopParamStack[this.loopParamStack.length - 1];
4980
- if (object.kind === "identifier" && currentLoopParam && object.name === currentLoopParam) {
4978
+ if (object.kind === "identifier" && this.isCurrentLoopItem(object.name)) {
4981
4979
  return `.${goFieldNameForKey(property)}`;
4982
4980
  }
4983
4981
  const obj = emit(object);
@@ -5739,7 +5737,7 @@ ${goFields.join(`
5739
5737
  return this.renderParsedExpr(parsed);
5740
5738
  }
5741
5739
  isLoopShadowedName(name) {
5742
- return this.loopParamStack.length > 0 && this.loopParamStack[this.loopParamStack.length - 1] === name || this.loopVarRefCount.has(name) || this.isOuterLoopParam(name) || this.loopBindingStack.some((bindings) => bindings.has(name));
5740
+ return this.scope.isBound(name) || this.loopVarRefCount.has(name);
5743
5741
  }
5744
5742
  loopRowChildPropOverrides(comp) {
5745
5743
  const childShape = this.childComponentShapes.get(comp.name);
@@ -5954,8 +5952,7 @@ ${goFields.join(`
5954
5952
  const inlined = this.resolveModuleStringConst(expr.name);
5955
5953
  if (inlined !== null)
5956
5954
  return plain(inlined);
5957
- const currentLoopParam = this.loopParamStack[this.loopParamStack.length - 1];
5958
- if (currentLoopParam && expr.name === currentLoopParam) {
5955
+ if (this.isCurrentLoopItem(expr.name)) {
5959
5956
  return plain(".");
5960
5957
  }
5961
5958
  if (this.isOuterLoopParam(expr.name)) {
@@ -6012,11 +6009,8 @@ ${goFields.join(`
6012
6009
  if (expr.object.kind === "identifier" && this.state.propsObjectName && expr.object.name === this.state.propsObjectName) {
6013
6010
  return plain(this.rootFieldRef(expr.property));
6014
6011
  }
6015
- {
6016
- const currentLoopParam = this.loopParamStack[this.loopParamStack.length - 1];
6017
- if (expr.object.kind === "identifier" && currentLoopParam && expr.object.name === currentLoopParam) {
6018
- return plain(`.${capitalizeFieldName(expr.property)}`);
6019
- }
6012
+ if (expr.object.kind === "identifier" && this.isCurrentLoopItem(expr.object.name)) {
6013
+ return plain(`.${capitalizeFieldName(expr.property)}`);
6020
6014
  }
6021
6015
  const obj = this.renderConditionExpr(expr.object);
6022
6016
  if (expr.property === "length") {
@@ -6194,12 +6188,12 @@ ${goFields.join(`
6194
6188
  });
6195
6189
  }
6196
6190
  const bakedChildLoop = loop.childComponent ? this.getBakedStaticChildLoop(loop.markerId, loop.childComponent, loop.arrayParsed, loop.param, loop.key ?? undefined) : null;
6197
- const bakedElementLoop = loop.childComponent ? null : analyzeBakeableStaticElementLoop(loop, this.state.localConstants, { isNameShadowed: (name) => this.state.staticLoopSourceBoundNames.has(name) });
6191
+ const bakedElementLoop = loop.childComponent ? null : analyzeBakeableStaticElementLoop(loop, this.state.localConstants, { isNameShadowed: this.scope.asShadowPredicate() });
6198
6192
  if (bakedElementLoop) {
6199
6193
  return this.renderUnrolledStaticElementLoop(loop, bakedElementLoop.items);
6200
6194
  }
6201
6195
  const arrayName = loop.array.trim();
6202
- if (bakedChildLoop === null && /^[A-Za-z_$][\w$]*$/.test(arrayName)) {
6196
+ if (bakedChildLoop === null && /^[A-Za-z_$][\w$]*$/.test(arrayName) && !this.scope.isBound(arrayName)) {
6203
6197
  const arrayConst = this.state.localConstants.find((c) => c.name === arrayName);
6204
6198
  if (arrayConst && !arrayConst.isModule && arrayConst.parsed && !this.isStringExpr(arrayConst.parsed, new Set)) {
6205
6199
  this.state.errors.push({
@@ -6227,6 +6221,9 @@ ${goFields.join(`
6227
6221
  }
6228
6222
  const wasInLoopOuter = this.inLoop;
6229
6223
  this.inLoop = true;
6224
+ const scopeLoop = loop.iterationShape === "keys" ? { ...loop, param: "" } : loop;
6225
+ const prevScope = this.scope;
6226
+ this.scope = prevScope.enterLoopRow(scopeLoop);
6230
6227
  const addedLoopVars = [];
6231
6228
  for (const d of loop.preamble?.declarations ?? []) {
6232
6229
  this.loopVarRefCount.set(d.name, (this.loopVarRefCount.get(d.name) ?? 0) + 1);
@@ -6238,17 +6235,14 @@ ${goFields.join(`
6238
6235
  this.loopBindingStack.push(built.bindings);
6239
6236
  this.loopRestExcludeStack.push(built.restExcludes);
6240
6237
  pushedBindingMap = true;
6241
- this.loopParamStack.push("");
6242
6238
  if (rangeIndex !== "_") {
6243
6239
  this.loopVarRefCount.set(rangeIndex, (this.loopVarRefCount.get(rangeIndex) ?? 0) + 1);
6244
6240
  addedLoopVars.push(rangeIndex);
6245
6241
  }
6246
6242
  } else if (loop.iterationShape === "keys") {
6247
- this.loopParamStack.push("");
6248
6243
  this.loopVarRefCount.set(param, (this.loopVarRefCount.get(param) ?? 0) + 1);
6249
6244
  addedLoopVars.push(param);
6250
6245
  } else {
6251
- this.loopParamStack.push(param);
6252
6246
  if (rangeIndex !== "_") {
6253
6247
  this.loopVarRefCount.set(rangeIndex, (this.loopVarRefCount.get(rangeIndex) ?? 0) + 1);
6254
6248
  addedLoopVars.push(rangeIndex);
@@ -6270,7 +6264,7 @@ ${goFields.join(`
6270
6264
  else
6271
6265
  this.loopVarRefCount.set(v, rc);
6272
6266
  }
6273
- this.loopParamStack.pop();
6267
+ this.scope = prevScope;
6274
6268
  if (pushedBindingMap) {
6275
6269
  this.loopBindingStack.pop();
6276
6270
  this.loopRestExcludeStack.pop();
@@ -6302,7 +6296,8 @@ ${goFields.join(`
6302
6296
  this.loopWrapperStack.push(false);
6303
6297
  this.loopKeyDepthStack.push(loop.depth);
6304
6298
  this.loopScalarItemStack.push(this.scalarLiteralLoopGoType(loop.arrayParsed, loop.itemType) !== null);
6305
- this.loopParamStack.push(loop.param);
6299
+ const prevScope = this.scope;
6300
+ this.scope = prevScope.enterLoopRow(loop);
6306
6301
  let body = "";
6307
6302
  for (const item of items) {
6308
6303
  this.staticLoopItemStack.push({ param: loop.param, item });
@@ -6322,7 +6317,7 @@ ${goFields.join(`
6322
6317
  break;
6323
6318
  }
6324
6319
  }
6325
- this.loopParamStack.pop();
6320
+ this.scope = prevScope;
6326
6321
  this.loopScalarItemStack.pop();
6327
6322
  this.loopKeyDepthStack.pop();
6328
6323
  this.loopWrapperStack.pop();
@@ -6491,8 +6486,7 @@ ${children}`;
6491
6486
  }
6492
6487
  if (this.inLoop) {
6493
6488
  const trimmed = value.expr.trim();
6494
- const currentLoopParam = this.loopParamStack[this.loopParamStack.length - 1];
6495
- if (currentLoopParam && trimmed === currentLoopParam) {
6489
+ if (this.isCurrentLoopItem(trimmed)) {
6496
6490
  return `{{bf_spread_attrs (bf_js_keys .)}}`;
6497
6491
  }
6498
6492
  const restInfo = this.lookupRestExclude(trimmed);
@@ -6,8 +6,12 @@
6
6
  *
7
7
  * NOT included (deliberately): cross-compile child-shape registries
8
8
  * (`childComponentShapes`, `childContextConsumers`, populated before a parent
9
- * compiles), the render-recursion cursor stacks (`loopParamStack`,
10
- * `filterExprDepth`, …), and constant config (`options`, `templatePrimitives`).
9
+ * compiles), the render-recursion cursor state (`scope: BindingScope`,
10
+ * `loopBindingStack`, `filterExprDepth`, …), and constant config (`options`,
11
+ * `templatePrimitives`). #2482 Stage 4: `scope` replaced the old mutable
12
+ * stack this comment used to name here (see the field's own docstring on
13
+ * `GoTemplateAdapter` for the full migration story) — this file never held
14
+ * that stack itself, only described where it lived.
11
15
  */
12
16
  import type { CompilerError, ContextConsumer, EnvSignalReader, IRMetadata, IRNode, LoweringMatcher, MemoInfo, SsrSeedPlan, TypeDefinition, TypeInfo } from '@barefootjs/jsx';
13
17
  export declare class CompileState {
@@ -1 +1 @@
1
- {"version":3,"file":"compile-state.d.ts","sourceRoot":"","sources":["../../../src/adapter/lib/compile-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,eAAe,EACf,UAAU,EACV,MAAM,EACN,eAAe,EACf,QAAQ,EACR,WAAW,EACX,cAAc,EACd,QAAQ,EACT,MAAM,iBAAiB,CAAA;AAExB,qBAAa,YAAY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EAAE,MAAM,CAAC,CAAY;IAElD;;;;;;OAMG;IACH,gBAAgB,EAAE,eAAe,EAAE,CAAK;IAExC;;;;OAIG;IACH,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAY;IAE1C;;;;;;;OAOG;IACH,wBAAwB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAY;IAEjD;;;;;OAKG;IACH,8BAA8B,EAAE,GAAG,CAAC,MAAM,CAAC,CAAY;IAEvD;;;;;;OAMG;IACH,qBAAqB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAY;IAE9C;;;;;;OAMG;IACH,wBAAwB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAY;IAEjD;;;;;OAKG;IACH,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAY;IAEzC;gBACY;IACZ,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAY;IAEvC;;4DAEwD;IACxD,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAY;IAIpD;sEACkE;IAClE,gBAAgB,EAAE,OAAO,CAAQ;IAEjC;sCACkC;IAClC,OAAO,EAAE,OAAO,CAAQ;IAExB,uFAAuF;IACvF,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAY;IAEvC,mFAAmF;IACnF,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAY;IAEjD;;;;OAIG;IACH,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAY;IAE/D;;;OAGG;IACH,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAY;IAEnD;yEACqE;IACrE,kBAAkB,UAAQ;CAC3B"}
package/dist/index.js CHANGED
@@ -26,7 +26,8 @@ import {
26
26
  dangerousInnerHtmlMetacharViolation,
27
27
  dangerousInnerHtmlDiagnostic,
28
28
  collectLoopBoundNames as collectLoopBoundNames2,
29
- evaluateStaticLiteral as evaluateStaticLiteral3
29
+ evaluateStaticLiteral as evaluateStaticLiteral3,
30
+ BindingScope
30
31
  } from "@barefootjs/jsx";
31
32
  import { findInterpolationEnd } from "@barefootjs/jsx/scanner";
32
33
  import { BF_REGION, escapeHtml } from "@barefootjs/shared";
@@ -2856,7 +2857,7 @@ class GoTemplateAdapter extends BaseAdapter {
2856
2857
  }
2857
2858
  inLoop = false;
2858
2859
  bakedStaticChildLoopCache = new Map;
2859
- loopParamStack = [];
2860
+ scope = BindingScope.EMPTY;
2860
2861
  loopKeyDepthStack = [];
2861
2862
  loopScalarItemStack = [];
2862
2863
  loopWrapperStack = [];
@@ -2914,6 +2915,7 @@ class GoTemplateAdapter extends BaseAdapter {
2914
2915
  this.state.referencedDerivedConsts = new Set;
2915
2916
  this.state.templateVarCounter = 0;
2916
2917
  this.state.pendingChildrenDefines = [];
2918
+ this.scope = BindingScope.EMPTY;
2917
2919
  this.primeCompileState(ir);
2918
2920
  this.state.stringValueNames = collectStringValueNames(ir);
2919
2921
  this.recordDerivedFieldDeps(ir, new Set((ir.metadata.propsParams ?? []).map((p) => p.name)));
@@ -4794,8 +4796,7 @@ ${goFields.join(`
4794
4796
  const inlinedNum = this.resolveModuleNumericConst(name);
4795
4797
  if (inlinedNum !== null)
4796
4798
  return inlinedNum;
4797
- const currentLoopParam = this.loopParamStack[this.loopParamStack.length - 1];
4798
- if (currentLoopParam && name === currentLoopParam)
4799
+ if (this.isCurrentLoopItem(name))
4799
4800
  return ".";
4800
4801
  if (this.isOuterLoopParam(name))
4801
4802
  return `$${name}`;
@@ -4862,16 +4863,16 @@ ${goFields.join(`
4862
4863
  }
4863
4864
  return false;
4864
4865
  }
4866
+ isCurrentLoopItem(name) {
4867
+ const hit = this.scope.lookup(name);
4868
+ return hit !== null && hit.depth === 0 && hit.binding.source === "item";
4869
+ }
4865
4870
  isOuterLoopParam(name) {
4866
- const top = this.loopParamStack.length - 1;
4867
- for (let i = 0;i < top; i++) {
4868
- if (this.loopParamStack[i] === name)
4869
- return true;
4870
- }
4871
- return false;
4871
+ const hit = this.scope.lookup(name);
4872
+ return hit !== null && hit.depth > 0 && hit.binding.source === "item";
4872
4873
  }
4873
4874
  rootFieldRef(name) {
4874
- const prefix = this.loopParamStack.length > 0 ? "$." : ".";
4875
+ const prefix = this.inLoop ? "$." : ".";
4875
4876
  return `${prefix}${capitalizeFieldName(name)}`;
4876
4877
  }
4877
4878
  searchParamsFieldRef(name) {
@@ -4881,9 +4882,8 @@ ${goFields.join(`
4881
4882
  return collectModuleStringConstsShared(constants);
4882
4883
  }
4883
4884
  resolveModuleStringConst(name) {
4884
- if (this.loopParamStack.length > 0 && this.loopParamStack[this.loopParamStack.length - 1] === name) {
4885
+ if (this.isCurrentLoopItem(name))
4885
4886
  return null;
4886
- }
4887
4887
  if (this.loopVarRefCount.has(name))
4888
4888
  return null;
4889
4889
  if (this.isOuterLoopParam(name))
@@ -4894,9 +4894,8 @@ ${goFields.join(`
4894
4894
  return `"${escapeGoString(value)}"`;
4895
4895
  }
4896
4896
  resolveModuleNumericConst(name) {
4897
- if (this.loopParamStack.length > 0 && this.loopParamStack[this.loopParamStack.length - 1] === name) {
4897
+ if (this.isCurrentLoopItem(name))
4898
4898
  return null;
4899
- }
4900
4899
  if (this.loopVarRefCount.has(name))
4901
4900
  return null;
4902
4901
  if (this.isOuterLoopParam(name))
@@ -4951,7 +4950,7 @@ ${goFields.join(`
4951
4950
  if (property === "length" && object.kind === "call" && object.callee.kind === "identifier" && object.args.length === 0) {
4952
4951
  const slice = this.state.memoBackedLoopSlice.get(object.callee.name);
4953
4952
  if (slice) {
4954
- const prefix = this.loopParamStack.length > 0 ? "$." : ".";
4953
+ const prefix = this.inLoop ? "$." : ".";
4955
4954
  return `len ${prefix}${slice}`;
4956
4955
  }
4957
4956
  }
@@ -4976,8 +4975,7 @@ ${goFields.join(`
4976
4975
  if (staticValue !== null)
4977
4976
  return staticValue;
4978
4977
  }
4979
- const currentLoopParam = this.loopParamStack[this.loopParamStack.length - 1];
4980
- if (object.kind === "identifier" && currentLoopParam && object.name === currentLoopParam) {
4978
+ if (object.kind === "identifier" && this.isCurrentLoopItem(object.name)) {
4981
4979
  return `.${goFieldNameForKey(property)}`;
4982
4980
  }
4983
4981
  const obj = emit(object);
@@ -5739,7 +5737,7 @@ ${goFields.join(`
5739
5737
  return this.renderParsedExpr(parsed);
5740
5738
  }
5741
5739
  isLoopShadowedName(name) {
5742
- return this.loopParamStack.length > 0 && this.loopParamStack[this.loopParamStack.length - 1] === name || this.loopVarRefCount.has(name) || this.isOuterLoopParam(name) || this.loopBindingStack.some((bindings) => bindings.has(name));
5740
+ return this.scope.isBound(name) || this.loopVarRefCount.has(name);
5743
5741
  }
5744
5742
  loopRowChildPropOverrides(comp) {
5745
5743
  const childShape = this.childComponentShapes.get(comp.name);
@@ -5954,8 +5952,7 @@ ${goFields.join(`
5954
5952
  const inlined = this.resolveModuleStringConst(expr.name);
5955
5953
  if (inlined !== null)
5956
5954
  return plain(inlined);
5957
- const currentLoopParam = this.loopParamStack[this.loopParamStack.length - 1];
5958
- if (currentLoopParam && expr.name === currentLoopParam) {
5955
+ if (this.isCurrentLoopItem(expr.name)) {
5959
5956
  return plain(".");
5960
5957
  }
5961
5958
  if (this.isOuterLoopParam(expr.name)) {
@@ -6012,11 +6009,8 @@ ${goFields.join(`
6012
6009
  if (expr.object.kind === "identifier" && this.state.propsObjectName && expr.object.name === this.state.propsObjectName) {
6013
6010
  return plain(this.rootFieldRef(expr.property));
6014
6011
  }
6015
- {
6016
- const currentLoopParam = this.loopParamStack[this.loopParamStack.length - 1];
6017
- if (expr.object.kind === "identifier" && currentLoopParam && expr.object.name === currentLoopParam) {
6018
- return plain(`.${capitalizeFieldName(expr.property)}`);
6019
- }
6012
+ if (expr.object.kind === "identifier" && this.isCurrentLoopItem(expr.object.name)) {
6013
+ return plain(`.${capitalizeFieldName(expr.property)}`);
6020
6014
  }
6021
6015
  const obj = this.renderConditionExpr(expr.object);
6022
6016
  if (expr.property === "length") {
@@ -6194,12 +6188,12 @@ ${goFields.join(`
6194
6188
  });
6195
6189
  }
6196
6190
  const bakedChildLoop = loop.childComponent ? this.getBakedStaticChildLoop(loop.markerId, loop.childComponent, loop.arrayParsed, loop.param, loop.key ?? undefined) : null;
6197
- const bakedElementLoop = loop.childComponent ? null : analyzeBakeableStaticElementLoop(loop, this.state.localConstants, { isNameShadowed: (name) => this.state.staticLoopSourceBoundNames.has(name) });
6191
+ const bakedElementLoop = loop.childComponent ? null : analyzeBakeableStaticElementLoop(loop, this.state.localConstants, { isNameShadowed: this.scope.asShadowPredicate() });
6198
6192
  if (bakedElementLoop) {
6199
6193
  return this.renderUnrolledStaticElementLoop(loop, bakedElementLoop.items);
6200
6194
  }
6201
6195
  const arrayName = loop.array.trim();
6202
- if (bakedChildLoop === null && /^[A-Za-z_$][\w$]*$/.test(arrayName)) {
6196
+ if (bakedChildLoop === null && /^[A-Za-z_$][\w$]*$/.test(arrayName) && !this.scope.isBound(arrayName)) {
6203
6197
  const arrayConst = this.state.localConstants.find((c) => c.name === arrayName);
6204
6198
  if (arrayConst && !arrayConst.isModule && arrayConst.parsed && !this.isStringExpr(arrayConst.parsed, new Set)) {
6205
6199
  this.state.errors.push({
@@ -6227,6 +6221,9 @@ ${goFields.join(`
6227
6221
  }
6228
6222
  const wasInLoopOuter = this.inLoop;
6229
6223
  this.inLoop = true;
6224
+ const scopeLoop = loop.iterationShape === "keys" ? { ...loop, param: "" } : loop;
6225
+ const prevScope = this.scope;
6226
+ this.scope = prevScope.enterLoopRow(scopeLoop);
6230
6227
  const addedLoopVars = [];
6231
6228
  for (const d of loop.preamble?.declarations ?? []) {
6232
6229
  this.loopVarRefCount.set(d.name, (this.loopVarRefCount.get(d.name) ?? 0) + 1);
@@ -6238,17 +6235,14 @@ ${goFields.join(`
6238
6235
  this.loopBindingStack.push(built.bindings);
6239
6236
  this.loopRestExcludeStack.push(built.restExcludes);
6240
6237
  pushedBindingMap = true;
6241
- this.loopParamStack.push("");
6242
6238
  if (rangeIndex !== "_") {
6243
6239
  this.loopVarRefCount.set(rangeIndex, (this.loopVarRefCount.get(rangeIndex) ?? 0) + 1);
6244
6240
  addedLoopVars.push(rangeIndex);
6245
6241
  }
6246
6242
  } else if (loop.iterationShape === "keys") {
6247
- this.loopParamStack.push("");
6248
6243
  this.loopVarRefCount.set(param, (this.loopVarRefCount.get(param) ?? 0) + 1);
6249
6244
  addedLoopVars.push(param);
6250
6245
  } else {
6251
- this.loopParamStack.push(param);
6252
6246
  if (rangeIndex !== "_") {
6253
6247
  this.loopVarRefCount.set(rangeIndex, (this.loopVarRefCount.get(rangeIndex) ?? 0) + 1);
6254
6248
  addedLoopVars.push(rangeIndex);
@@ -6270,7 +6264,7 @@ ${goFields.join(`
6270
6264
  else
6271
6265
  this.loopVarRefCount.set(v, rc);
6272
6266
  }
6273
- this.loopParamStack.pop();
6267
+ this.scope = prevScope;
6274
6268
  if (pushedBindingMap) {
6275
6269
  this.loopBindingStack.pop();
6276
6270
  this.loopRestExcludeStack.pop();
@@ -6302,7 +6296,8 @@ ${goFields.join(`
6302
6296
  this.loopWrapperStack.push(false);
6303
6297
  this.loopKeyDepthStack.push(loop.depth);
6304
6298
  this.loopScalarItemStack.push(this.scalarLiteralLoopGoType(loop.arrayParsed, loop.itemType) !== null);
6305
- this.loopParamStack.push(loop.param);
6299
+ const prevScope = this.scope;
6300
+ this.scope = prevScope.enterLoopRow(loop);
6306
6301
  let body = "";
6307
6302
  for (const item of items) {
6308
6303
  this.staticLoopItemStack.push({ param: loop.param, item });
@@ -6322,7 +6317,7 @@ ${goFields.join(`
6322
6317
  break;
6323
6318
  }
6324
6319
  }
6325
- this.loopParamStack.pop();
6320
+ this.scope = prevScope;
6326
6321
  this.loopScalarItemStack.pop();
6327
6322
  this.loopKeyDepthStack.pop();
6328
6323
  this.loopWrapperStack.pop();
@@ -6491,8 +6486,7 @@ ${children}`;
6491
6486
  }
6492
6487
  if (this.inLoop) {
6493
6488
  const trimmed = value.expr.trim();
6494
- const currentLoopParam = this.loopParamStack[this.loopParamStack.length - 1];
6495
- if (currentLoopParam && trimmed === currentLoopParam) {
6489
+ if (this.isCurrentLoopItem(trimmed)) {
6496
6490
  return `{{bf_spread_attrs (bf_js_keys .)}}`;
6497
6491
  }
6498
6492
  const restInfo = this.lookupRestExclude(trimmed);