@barefootjs/hono 0.33.1 → 0.33.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/hono-adapter.d.ts +0 -2
- package/dist/adapter/hono-adapter.d.ts.map +1 -1
- package/dist/adapter/index.js +5 -9
- package/dist/index.js +5 -9
- package/dist/vite.js +32 -29
- package/package.json +2 -2
- package/src/adapter/hono-adapter.ts +28 -14
|
@@ -57,8 +57,6 @@ export declare class HonoAdapter extends JsxAdapter implements IRNodeEmitter<Hon
|
|
|
57
57
|
* components.
|
|
58
58
|
*/
|
|
59
59
|
private rewriteRelativeImport?;
|
|
60
|
-
/** Stack of loop keys for generating data-key / data-key-1 attributes on loop items */
|
|
61
|
-
private loopKeyStack;
|
|
62
60
|
/**
|
|
63
61
|
* Per-call `AdapterGenerateOptions.scriptAssets`, stashed for the
|
|
64
62
|
* duration of one `generate()` call (same lifecycle as
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hono-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/hono-adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,MAAM,EAIX,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAElB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,UAAU,EAQX,MAAM,iBAAiB,CAAA;AAExB;;;;;GAKG;AACH,KAAK,aAAa,GAAG;IACnB,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAGD,MAAM,WAAW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HANGED
|
@@ -30,7 +30,6 @@ class HonoAdapter extends JsxAdapter {
|
|
|
30
30
|
hasClientInteractivity = false;
|
|
31
31
|
currentComponentHasProps = false;
|
|
32
32
|
rewriteRelativeImport;
|
|
33
|
-
loopKeyStack = [];
|
|
34
33
|
scriptAssets;
|
|
35
34
|
preloadAssets;
|
|
36
35
|
constructor(options = {}) {
|
|
@@ -354,13 +353,12 @@ export default ${this.componentName}` : "";
|
|
|
354
353
|
if (this.currentComponentHasProps) {
|
|
355
354
|
hydrationAttrs += ` {...(!__bfChild && __bfPropsJson ? { "${BF_PROPS}": __bfPropsJson } : {})}`;
|
|
356
355
|
}
|
|
357
|
-
hydrationAttrs += ' {...(__dataKey !== undefined ? { "data-key": __dataKey } : {})}';
|
|
358
356
|
}
|
|
359
|
-
if (
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
hydrationAttrs += `
|
|
357
|
+
if (element.keyAttr) {
|
|
358
|
+
if (element.keyAttr.value !== undefined) {
|
|
359
|
+
hydrationAttrs += ` ${element.keyAttr.name}={String(${element.keyAttr.value})}`;
|
|
360
|
+
} else {
|
|
361
|
+
hydrationAttrs += ` {...(__dataKey !== undefined ? { "${element.keyAttr.name}": __dataKey } : {})}`;
|
|
364
362
|
}
|
|
365
363
|
}
|
|
366
364
|
if (element.slotId) {
|
|
@@ -460,9 +458,7 @@ export default ${this.componentName}` : "";
|
|
|
460
458
|
const paramAnnotation = loop.paramType ? `: ${loop.paramType}` : "";
|
|
461
459
|
const indexAnnotation = loop.indexType ? `: ${loop.indexType}` : "";
|
|
462
460
|
const indexParam = loop.index ? `, ${loop.index}${indexAnnotation}` : "";
|
|
463
|
-
this.loopKeyStack.push({ key: loop.key, param: loop.param });
|
|
464
461
|
const children = this.renderChildrenInLoop(loop.children);
|
|
465
|
-
this.loopKeyStack.pop();
|
|
466
462
|
let mapExpr;
|
|
467
463
|
const preamble = loop.preamble?.ssrText;
|
|
468
464
|
let safeChildren = children.startsWith("{") ? `<>${children}</>` : children;
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,6 @@ class HonoAdapter extends JsxAdapter {
|
|
|
30
30
|
hasClientInteractivity = false;
|
|
31
31
|
currentComponentHasProps = false;
|
|
32
32
|
rewriteRelativeImport;
|
|
33
|
-
loopKeyStack = [];
|
|
34
33
|
scriptAssets;
|
|
35
34
|
preloadAssets;
|
|
36
35
|
constructor(options = {}) {
|
|
@@ -354,13 +353,12 @@ export default ${this.componentName}` : "";
|
|
|
354
353
|
if (this.currentComponentHasProps) {
|
|
355
354
|
hydrationAttrs += ` {...(!__bfChild && __bfPropsJson ? { "${BF_PROPS}": __bfPropsJson } : {})}`;
|
|
356
355
|
}
|
|
357
|
-
hydrationAttrs += ' {...(__dataKey !== undefined ? { "data-key": __dataKey } : {})}';
|
|
358
356
|
}
|
|
359
|
-
if (
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
hydrationAttrs += `
|
|
357
|
+
if (element.keyAttr) {
|
|
358
|
+
if (element.keyAttr.value !== undefined) {
|
|
359
|
+
hydrationAttrs += ` ${element.keyAttr.name}={String(${element.keyAttr.value})}`;
|
|
360
|
+
} else {
|
|
361
|
+
hydrationAttrs += ` {...(__dataKey !== undefined ? { "${element.keyAttr.name}": __dataKey } : {})}`;
|
|
364
362
|
}
|
|
365
363
|
}
|
|
366
364
|
if (element.slotId) {
|
|
@@ -460,9 +458,7 @@ export default ${this.componentName}` : "";
|
|
|
460
458
|
const paramAnnotation = loop.paramType ? `: ${loop.paramType}` : "";
|
|
461
459
|
const indexAnnotation = loop.indexType ? `: ${loop.indexType}` : "";
|
|
462
460
|
const indexParam = loop.index ? `, ${loop.index}${indexAnnotation}` : "";
|
|
463
|
-
this.loopKeyStack.push({ key: loop.key, param: loop.param });
|
|
464
461
|
const children = this.renderChildrenInLoop(loop.children);
|
|
465
|
-
this.loopKeyStack.pop();
|
|
466
462
|
let mapExpr;
|
|
467
463
|
const preamble = loop.preamble?.ssrText;
|
|
468
464
|
let safeChildren = children.startsWith("{") ? `<>${children}</>` : children;
|
package/dist/vite.js
CHANGED
|
@@ -5,7 +5,7 @@ import { barefoot as coreBarefoot } from "@barefootjs/vite";
|
|
|
5
5
|
import { devModuleUrl, loadManifest, resolveDevOrigin, resolveScriptAssets, toPosixRelative } from "@barefootjs/vite";
|
|
6
6
|
|
|
7
7
|
// ../jsx/src/compiler.ts
|
|
8
|
-
import
|
|
8
|
+
import ts25 from "typescript";
|
|
9
9
|
|
|
10
10
|
// ../jsx/src/analyzer.ts
|
|
11
11
|
import ts9 from "typescript";
|
|
@@ -1148,6 +1148,10 @@ var EMPTY_BOUND = new Set;
|
|
|
1148
1148
|
var constInitializerCache = new WeakMap;
|
|
1149
1149
|
var functionInfoExprCache = new WeakMap;
|
|
1150
1150
|
|
|
1151
|
+
// ../jsx/src/ir-to-client-js/prop-handling.ts
|
|
1152
|
+
var _localConstantValuesCache = new WeakMap;
|
|
1153
|
+
var _restSpreadNamesCache = new WeakMap;
|
|
1154
|
+
|
|
1151
1155
|
// ../jsx/src/ir-to-client-js/control-flow/stringify/template-parse.ts
|
|
1152
1156
|
var SVG_ROOT_TAGS = new Set([
|
|
1153
1157
|
"svg",
|
|
@@ -1269,11 +1273,14 @@ var KEYWORDS_AND_GLOBALS = new Set([
|
|
|
1269
1273
|
// ../jsx/src/ir-to-client-js/walk-prop-accesses.ts
|
|
1270
1274
|
import ts14 from "typescript";
|
|
1271
1275
|
|
|
1276
|
+
// ../jsx/src/ir-to-client-js/imports.ts
|
|
1277
|
+
import ts16 from "typescript";
|
|
1278
|
+
|
|
1272
1279
|
// ../jsx/src/value-references.ts
|
|
1273
1280
|
import ts15 from "typescript";
|
|
1274
1281
|
|
|
1275
1282
|
// ../jsx/src/relocate.ts
|
|
1276
|
-
import
|
|
1283
|
+
import ts17 from "typescript";
|
|
1277
1284
|
|
|
1278
1285
|
// ../jsx/src/lowering-registry.ts
|
|
1279
1286
|
var plugins = [];
|
|
@@ -1452,10 +1459,10 @@ function formatDateLocalNames(metadata) {
|
|
|
1452
1459
|
}
|
|
1453
1460
|
|
|
1454
1461
|
// ../jsx/src/ir-to-client-js/prune-unused-prop-extractions.ts
|
|
1455
|
-
import
|
|
1462
|
+
import ts18 from "typescript";
|
|
1456
1463
|
|
|
1457
1464
|
// ../jsx/src/ir-to-client-js/control-flow/plan/lazy-preamble.ts
|
|
1458
|
-
import
|
|
1465
|
+
import ts19 from "typescript";
|
|
1459
1466
|
var NO_PREAMBLE = {
|
|
1460
1467
|
lazySafe: true,
|
|
1461
1468
|
facts: { declaredNames: new Set, freeNames: new Set }
|
|
@@ -1505,7 +1512,7 @@ var INERT_BINDING_GLOBALS = new Set([
|
|
|
1505
1512
|
]);
|
|
1506
1513
|
|
|
1507
1514
|
// ../jsx/src/ir-to-client-js/emit-reactive.ts
|
|
1508
|
-
import
|
|
1515
|
+
import ts20 from "typescript";
|
|
1509
1516
|
|
|
1510
1517
|
// ../jsx/src/ir-to-client-js/control-flow/stringify/event-delegation.ts
|
|
1511
1518
|
var NON_BUBBLING_EVENTS = new Set([
|
|
@@ -1520,7 +1527,7 @@ var NON_BUBBLING_EVENTS = new Set([
|
|
|
1520
1527
|
]);
|
|
1521
1528
|
|
|
1522
1529
|
// ../jsx/src/ir-to-client-js/rewrite-props-object.ts
|
|
1523
|
-
import
|
|
1530
|
+
import ts21 from "typescript";
|
|
1524
1531
|
|
|
1525
1532
|
// ../jsx/src/ir-to-client-js/source-map.ts
|
|
1526
1533
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -1611,20 +1618,20 @@ class SourceMapGenerator {
|
|
|
1611
1618
|
}
|
|
1612
1619
|
|
|
1613
1620
|
// ../jsx/src/preprocess-inline-jsx-callbacks.ts
|
|
1614
|
-
import
|
|
1621
|
+
import ts22 from "typescript";
|
|
1615
1622
|
|
|
1616
1623
|
// ../jsx/src/ssr-defaults.ts
|
|
1617
|
-
import
|
|
1624
|
+
import ts23 from "typescript";
|
|
1618
1625
|
var UNRESOLVED = Symbol("unresolved");
|
|
1619
1626
|
var NO_RETURN = Symbol("no-return");
|
|
1620
1627
|
|
|
1621
1628
|
// ../jsx/src/augment-inherited-props.ts
|
|
1622
|
-
import
|
|
1629
|
+
import ts24 from "typescript";
|
|
1623
1630
|
|
|
1624
1631
|
// ../jsx/src/rich-type-refusal.ts
|
|
1625
1632
|
var EMPTY_BINDINGS2 = new Map;
|
|
1626
1633
|
// ../jsx/src/shared-program.ts
|
|
1627
|
-
import
|
|
1634
|
+
import ts26 from "typescript";
|
|
1628
1635
|
// ../jsx/src/adapters/interface.ts
|
|
1629
1636
|
class BaseAdapter {
|
|
1630
1637
|
renderChildren(children) {
|
|
@@ -1906,7 +1913,7 @@ class JsxAdapter extends BaseAdapter {
|
|
|
1906
1913
|
}
|
|
1907
1914
|
|
|
1908
1915
|
// ../jsx/src/adapters/template-imports.ts
|
|
1909
|
-
import
|
|
1916
|
+
import ts27 from "typescript";
|
|
1910
1917
|
var CLIENT_PACKAGE_SOURCES = new Set([
|
|
1911
1918
|
"@barefootjs/client",
|
|
1912
1919
|
"@barefootjs/client/runtime"
|
|
@@ -1956,18 +1963,18 @@ function specKey(s) {
|
|
|
1956
1963
|
function rewriteDynamicImportsInSource(sourceText, rewriteRelative) {
|
|
1957
1964
|
if (!sourceText.includes("import"))
|
|
1958
1965
|
return sourceText;
|
|
1959
|
-
const sf =
|
|
1966
|
+
const sf = ts27.createSourceFile("bf-template-fragment.tsx", sourceText, ts27.ScriptTarget.Latest, false, ts27.ScriptKind.TSX);
|
|
1960
1967
|
const edits = [];
|
|
1961
1968
|
const visit = (node) => {
|
|
1962
|
-
if (
|
|
1969
|
+
if (ts27.isCallExpression(node) && node.expression.kind === ts27.SyntaxKind.ImportKeyword && node.arguments.length > 0 && ts27.isStringLiteralLike(node.arguments[0])) {
|
|
1963
1970
|
collect(node.arguments[0]);
|
|
1964
1971
|
}
|
|
1965
|
-
if (
|
|
1972
|
+
if (ts27.isImportTypeNode(node) && ts27.isLiteralTypeNode(node.argument)) {
|
|
1966
1973
|
const literal = node.argument.literal;
|
|
1967
|
-
if (
|
|
1974
|
+
if (ts27.isStringLiteralLike(literal))
|
|
1968
1975
|
collect(literal);
|
|
1969
1976
|
}
|
|
1970
|
-
|
|
1977
|
+
ts27.forEachChild(node, visit);
|
|
1971
1978
|
};
|
|
1972
1979
|
const collect = (literal) => {
|
|
1973
1980
|
const specifier = literal.text;
|
|
@@ -1982,7 +1989,7 @@ function rewriteDynamicImportsInSource(sourceText, rewriteRelative) {
|
|
|
1982
1989
|
text: `'${next}'`
|
|
1983
1990
|
});
|
|
1984
1991
|
};
|
|
1985
|
-
|
|
1992
|
+
ts27.forEachChild(sf, visit);
|
|
1986
1993
|
if (edits.length === 0)
|
|
1987
1994
|
return sourceText;
|
|
1988
1995
|
let out = sourceText;
|
|
@@ -2392,11 +2399,11 @@ function emitAttrValue(value, emitter, name) {
|
|
|
2392
2399
|
}
|
|
2393
2400
|
}
|
|
2394
2401
|
// ../jsx/src/combine-client-js.ts
|
|
2395
|
-
import ts27 from "typescript";
|
|
2396
|
-
// ../jsx/src/debug.ts
|
|
2397
2402
|
import ts28 from "typescript";
|
|
2398
|
-
// ../jsx/src/
|
|
2403
|
+
// ../jsx/src/debug.ts
|
|
2399
2404
|
import ts29 from "typescript";
|
|
2405
|
+
// ../jsx/src/profiler.ts
|
|
2406
|
+
import ts30 from "typescript";
|
|
2400
2407
|
|
|
2401
2408
|
// ../jsx/src/index.ts
|
|
2402
2409
|
registerBuiltinLoweringPlugins();
|
|
@@ -2422,7 +2429,6 @@ class HonoAdapter extends JsxAdapter {
|
|
|
2422
2429
|
hasClientInteractivity = false;
|
|
2423
2430
|
currentComponentHasProps = false;
|
|
2424
2431
|
rewriteRelativeImport;
|
|
2425
|
-
loopKeyStack = [];
|
|
2426
2432
|
scriptAssets;
|
|
2427
2433
|
preloadAssets;
|
|
2428
2434
|
constructor(options = {}) {
|
|
@@ -2746,13 +2752,12 @@ export default ${this.componentName}` : "";
|
|
|
2746
2752
|
if (this.currentComponentHasProps) {
|
|
2747
2753
|
hydrationAttrs += ` {...(!__bfChild && __bfPropsJson ? { "${BF_PROPS}": __bfPropsJson } : {})}`;
|
|
2748
2754
|
}
|
|
2749
|
-
hydrationAttrs += ' {...(__dataKey !== undefined ? { "data-key": __dataKey } : {})}';
|
|
2750
2755
|
}
|
|
2751
|
-
if (
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
hydrationAttrs += `
|
|
2756
|
+
if (element.keyAttr) {
|
|
2757
|
+
if (element.keyAttr.value !== undefined) {
|
|
2758
|
+
hydrationAttrs += ` ${element.keyAttr.name}={String(${element.keyAttr.value})}`;
|
|
2759
|
+
} else {
|
|
2760
|
+
hydrationAttrs += ` {...(__dataKey !== undefined ? { "${element.keyAttr.name}": __dataKey } : {})}`;
|
|
2756
2761
|
}
|
|
2757
2762
|
}
|
|
2758
2763
|
if (element.slotId) {
|
|
@@ -2852,9 +2857,7 @@ export default ${this.componentName}` : "";
|
|
|
2852
2857
|
const paramAnnotation = loop.paramType ? `: ${loop.paramType}` : "";
|
|
2853
2858
|
const indexAnnotation = loop.indexType ? `: ${loop.indexType}` : "";
|
|
2854
2859
|
const indexParam = loop.index ? `, ${loop.index}${indexAnnotation}` : "";
|
|
2855
|
-
this.loopKeyStack.push({ key: loop.key, param: loop.param });
|
|
2856
2860
|
const children = this.renderChildrenInLoop(loop.children);
|
|
2857
|
-
this.loopKeyStack.pop();
|
|
2858
2861
|
let mapExpr;
|
|
2859
2862
|
const preamble = loop.preamble?.ssrText;
|
|
2860
2863
|
let safeChildren = children.startsWith("{") ? `<>${children}</>` : children;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/hono",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.3",
|
|
4
4
|
"description": "Hono integration for BarefootJS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
124
|
"@barefootjs/adapter-tests": "0.1.0",
|
|
125
|
-
"@barefootjs/vite": "0.33.
|
|
125
|
+
"@barefootjs/vite": "0.33.3",
|
|
126
126
|
"@types/jsdom": "^27.0.0",
|
|
127
127
|
"hono": "^4.6.0",
|
|
128
128
|
"jsdom": "^27.3.0",
|
|
@@ -138,8 +138,6 @@ export class HonoAdapter extends JsxAdapter implements IRNodeEmitter<HonoRenderC
|
|
|
138
138
|
* components.
|
|
139
139
|
*/
|
|
140
140
|
private rewriteRelativeImport?: (importPath: string) => string
|
|
141
|
-
/** Stack of loop keys for generating data-key / data-key-1 attributes on loop items */
|
|
142
|
-
private loopKeyStack: Array<{ key: string | null; param: string }> = []
|
|
143
141
|
/**
|
|
144
142
|
* Per-call `AdapterGenerateOptions.scriptAssets`, stashed for the
|
|
145
143
|
* duration of one `generate()` call (same lifecycle as
|
|
@@ -759,15 +757,32 @@ export class HonoAdapter extends JsxAdapter implements IRNodeEmitter<HonoRenderC
|
|
|
759
757
|
if (this.currentComponentHasProps) {
|
|
760
758
|
hydrationAttrs += ` {...(!__bfChild && __bfPropsJson ? { "${BF_PROPS}": __bfPropsJson } : {})}`
|
|
761
759
|
}
|
|
762
|
-
// Add data-key for list reconciliation (only on root elements with scope)
|
|
763
|
-
hydrationAttrs += ' {...(__dataKey !== undefined ? { "data-key": __dataKey } : {})}'
|
|
764
760
|
}
|
|
765
|
-
//
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
761
|
+
// #2753: `element.keyAttr` is the ONE IR-resolved decision for this
|
|
762
|
+
// row's key attribute — name AND value already worked out once in
|
|
763
|
+
// `jsx-to-ir.ts`, replacing this adapter's own `loopKeyStack` (a mutated
|
|
764
|
+
// stack of "how deep am I" the client runtime had no matching concept
|
|
765
|
+
// of at all) and the separate `carriesDataKey` boolean.
|
|
766
|
+
if (element.keyAttr) {
|
|
767
|
+
if (element.keyAttr.value !== undefined) {
|
|
768
|
+
// Mechanism 1: this element is directly a `.map()` row root compiled
|
|
769
|
+
// inline here — the key is a concrete expression, spliced verbatim
|
|
770
|
+
// exactly like `loopKeyStack`'s old `${loop.key}` did (it is already
|
|
771
|
+
// valid TS source text, lifted straight from the JSX `key={}` attr).
|
|
772
|
+
hydrationAttrs += ` ${element.keyAttr.name}={String(${element.keyAttr.value})}`
|
|
773
|
+
} else {
|
|
774
|
+
// Mechanism 2: this element is one of THIS component's own render
|
|
775
|
+
// roots, relaying a key its OWN caller supplies at runtime (when
|
|
776
|
+
// this component is itself invoked as a caller's keyed loop row) —
|
|
777
|
+
// `__dataKey` is destructured from `__allProps` at the top of every
|
|
778
|
+
// component for exactly this. Fragment-root scope (#2732): the other
|
|
779
|
+
// four hydration markers live on the wrapping `<!--bf-scope:...-->`
|
|
780
|
+
// comment (`wrapWithScopeComment` below) since `needsScope` is false
|
|
781
|
+
// for every child of a fragment root — but `data-key` still needs to
|
|
782
|
+
// land on an element, because the client runtime's `mapArray` adopt
|
|
783
|
+
// loop reads it as a DOM attribute (`primaryEl.dataset.key`,
|
|
784
|
+
// map-array.ts), not out of the comment.
|
|
785
|
+
hydrationAttrs += ` {...(__dataKey !== undefined ? { "${element.keyAttr.name}": __dataKey } : {})}`
|
|
771
786
|
}
|
|
772
787
|
}
|
|
773
788
|
if (element.slotId) {
|
|
@@ -986,14 +1001,13 @@ export class HonoAdapter extends JsxAdapter implements IRNodeEmitter<HonoRenderC
|
|
|
986
1001
|
const paramAnnotation = loop.paramType ? `: ${loop.paramType}` : ''
|
|
987
1002
|
const indexAnnotation = loop.indexType ? `: ${loop.indexType}` : ''
|
|
988
1003
|
const indexParam = loop.index ? `, ${loop.index}${indexAnnotation}` : ''
|
|
989
|
-
// Push loop key info for data-key attribute generation on loop items
|
|
990
|
-
this.loopKeyStack.push({ key: loop.key, param: loop.param })
|
|
991
1004
|
// Render children with isLoopItemRoot so a DIRECT component member gets
|
|
992
1005
|
// its own randomized scope id (matching `IRComponent.loopItemRoot`,
|
|
993
1006
|
// #2444) rather than deriving from parent scope + slot like an
|
|
994
|
-
// ordinarily-slotted child.
|
|
1007
|
+
// ordinarily-slotted child. The row's own `data-key`/`data-key-N`
|
|
1008
|
+
// attribute is no longer tracked here at all — `jsx-to-ir.ts` already
|
|
1009
|
+
// resolved it onto the row-root element's `keyAttr` (#2753).
|
|
995
1010
|
const children = this.renderChildrenInLoop(loop.children)
|
|
996
|
-
this.loopKeyStack.pop()
|
|
997
1011
|
|
|
998
1012
|
let mapExpr: string
|
|
999
1013
|
// Raw TSX preamble text (types + JSX intact) for the JSX-runtime output
|