@immense/vue-pom-generator 1.0.103 → 1.0.105
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/RELEASE_NOTES.md +32 -11
- package/class-generation/index.ts +20 -17
- package/dist/index.cjs +198 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +199 -14
- package/dist/index.mjs.map +1 -1
- package/dist/transform.d.ts.map +1 -1
- package/dist/utils.d.ts +41 -6
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,25 +1,46 @@
|
|
|
1
|
-
v1.0.103
|
|
2
|
-
|
|
3
1
|
Highlights
|
|
4
2
|
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
- Slot-scope callbacks passed as slot props (e.g. cancel handed to a #popup-footer slot) are no
|
|
4
|
+
longer stringified into data-testid values — no more multi-line function source leaking into test
|
|
5
|
+
ids.
|
|
6
|
+
- Elements whose click handler references (rather than calls) a slot-scope callback now fall
|
|
7
|
+
through to the static testid path, producing clean ids like MonitorConfigureDialog-Save-immybutton.
|
|
8
|
+
- Degenerate fallback key chains (v.key ?? v.data?.id ?? … ?? v) are detected via AST and rejected
|
|
9
|
+
when their terminal variable is proven a callback, so generated clickSaveByKey(key) accessors are no
|
|
10
|
+
longer keyed by unguessable function source.
|
|
11
|
+
- Hand-written meaningful chains, chains over non-identifier operands, and per-iteration row-data
|
|
12
|
+
handlers (@click="remove(item)") are unaffected.
|
|
13
|
+
- Adds an integration test reproducing the exact scoped-slot shape plus unit tests for the new
|
|
14
|
+
chain-detection helper.
|
|
8
15
|
|
|
9
16
|
Changes
|
|
10
17
|
|
|
11
18
|
Fixes
|
|
12
19
|
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
-
|
|
20
|
+
- Stop stringifying slot-scope callbacks into keyed test ids; affected elements emit static test
|
|
21
|
+
ids matching their static-text siblings ([e2106e2])
|
|
22
|
+
- Snapshot, at the slot <template> node before click instrumentation rewrites descendants, which
|
|
23
|
+
slot-scope variables are used as bare callback click handlers anywhere in slot content — closing the
|
|
24
|
+
gap where a sibling handler (e.g. save) inherited the degenerate chain ([2811f91])
|
|
25
|
+
- Add getDegenerateSlotScopeFallbackKeyVariable to recognize degenerate chains (every operand a
|
|
26
|
+
member chain rooted at the terminal bare identifier), including renamed destructured props like {
|
|
27
|
+
cancel: cancelAction } ([2811f91])
|
|
28
|
+
|
|
29
|
+
Tests
|
|
30
|
+
|
|
31
|
+
- Integration test in tests/transform.test.ts: button-rendering child in a scoped slot with a
|
|
32
|
+
sibling callback handler and dynamic text — asserts a static testid containing no ??, function, or
|
|
33
|
+
callback source
|
|
34
|
+
- Unit tests in tests/utils.test.ts for getDegenerateSlotScopeFallbackKeyVariable: degenerate
|
|
35
|
+
chains (including renames) detected; meaningful chains, mixed operands, non-chains, and nullish
|
|
36
|
+
input rejected
|
|
16
37
|
|
|
17
38
|
Pull Requests Included
|
|
18
39
|
|
|
19
|
-
- ]8;id=md-
|
|
40
|
+
- ]8;id=md-ec38as;https://github.com/immense/vue-pom-generator/pull/68#68]8;;]8;; — fix: stop stringifying slot-scope callbacks into keyed test ids (@dkattan)]8;;
|
|
20
41
|
|
|
21
42
|
Testing
|
|
22
43
|
|
|
23
|
-
|
|
24
|
-
|
|
44
|
+
Full suite: 439 passed (437 before, +2 new tests plus helpers) covering the regression shape and the
|
|
45
|
+
new helper.
|
|
25
46
|
|
|
@@ -2553,12 +2553,20 @@ function prepareViewObjectModelClass(
|
|
|
2553
2553
|
const members: TypeScriptClassMember[] = [];
|
|
2554
2554
|
if (isView && (componentRefsForInstances.size > 0 || attachmentsForThisClass.length > 0 || widgetInstances.length > 0)) {
|
|
2555
2555
|
members.push(...getComponentInstances(directComponentInstances, projectedComponentInstances, attachmentsForThisClass, widgetInstances));
|
|
2556
|
-
members.push(getConstructor(directComponentInstances, attachmentsForThisClass, widgetInstances, { testIdAttribute }));
|
|
2557
2556
|
}
|
|
2558
2557
|
if (!isView && (componentRefsForInstances.size > 0 || attachmentsForThisClass.length > 0)) {
|
|
2559
2558
|
members.push(...getComponentInstances(directComponentInstances, projectedComponentInstances, attachmentsForThisClass));
|
|
2560
|
-
members.push(getConstructor(directComponentInstances, attachmentsForThisClass, [], { testIdAttribute }));
|
|
2561
2559
|
}
|
|
2560
|
+
// Every generated POM can be nested and therefore must accept the locator
|
|
2561
|
+
// passed by its parent's semantic component-instance accessor. Leaf POMs have
|
|
2562
|
+
// no child declarations, but omitting their constructor makes them inherit
|
|
2563
|
+
// BasePage's (page, BasePageOptions) signature and rejects (page, Locator).
|
|
2564
|
+
members.push(getConstructor(
|
|
2565
|
+
directComponentInstances,
|
|
2566
|
+
attachmentsForThisClass,
|
|
2567
|
+
isView ? widgetInstances : [],
|
|
2568
|
+
{ testIdAttribute },
|
|
2569
|
+
));
|
|
2562
2570
|
|
|
2563
2571
|
members.push(
|
|
2564
2572
|
...getAttachmentPassthroughMethods(componentName, dependencies, attachmentsForThisClass, reservedAttachmentPassthroughNames),
|
|
@@ -2618,15 +2626,12 @@ function generateViewObjectModelContent(
|
|
|
2618
2626
|
const basePageImport = path.relative(fromAbs, toAbs).replace(/\\/g, "/");
|
|
2619
2627
|
const basePageImportNoExt = stripExtension(basePageImport).replace(/\\/g, "/");
|
|
2620
2628
|
const basePageImportSpecifier = basePageImportNoExt.startsWith(".") ? basePageImportNoExt : `./${basePageImportNoExt}`;
|
|
2621
|
-
//
|
|
2629
|
+
// Every generated POM constructor takes Playwright's full `Page` (not the narrowed `PwPage`)
|
|
2630
|
+
// and an optional root locator so any POM, including a leaf, can be nested safely:
|
|
2622
2631
|
// `BasePage` widens `page` to the full `Page` for subclasses, so generated POMs construct
|
|
2623
2632
|
// each other with `new Child(this.page)` where `this.page` is `Page`. Importing the
|
|
2624
2633
|
// standard `Page` from `@playwright/test` keeps the narrowed types internal to the vendored
|
|
2625
2634
|
// runtime — they never surface in generated output.
|
|
2626
|
-
const needsPlaywrightPageImport = prepared.isView
|
|
2627
|
-
|| prepared.attachmentsForThisClass.length > 0
|
|
2628
|
-
|| prepared.componentRefsForInstances.size > 0
|
|
2629
|
-
|| prepared.widgetInstances.length > 0;
|
|
2630
2635
|
const customPomImportSpecifiersByClass = options.customPomImportSpecifiersByClass ?? {};
|
|
2631
2636
|
|
|
2632
2637
|
const customImports = Array.from(
|
|
@@ -2692,16 +2697,14 @@ function generateViewObjectModelContent(
|
|
|
2692
2697
|
|
|
2693
2698
|
const prefixText = `${buildFilePrefix({ eslintDisableSortImports: true })}${doc}\n`;
|
|
2694
2699
|
return renderSourceFile(`${prepared.className}.ts`, (sourceFile) => {
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
});
|
|
2704
|
-
}
|
|
2700
|
+
addNamedImport(sourceFile, {
|
|
2701
|
+
moduleSpecifier: "@playwright/test",
|
|
2702
|
+
isTypeOnly: true,
|
|
2703
|
+
namedImports: [
|
|
2704
|
+
{ name: "Locator", alias: "PwLocator" },
|
|
2705
|
+
{ name: "Page", alias: "PwPage" },
|
|
2706
|
+
],
|
|
2707
|
+
});
|
|
2705
2708
|
|
|
2706
2709
|
addNamedImport(sourceFile, {
|
|
2707
2710
|
moduleSpecifier: basePageImportSpecifier,
|
package/dist/index.cjs
CHANGED
|
@@ -1395,6 +1395,145 @@ function findTemplateSlotScopeExpression(node) {
|
|
|
1395
1395
|
function buildSlotScopeFallbackKeyExpression(identifier) {
|
|
1396
1396
|
return `${identifier}.key ?? ${identifier}.data?.id ?? ${identifier}.id ?? ${identifier}.value ?? ${identifier}.url ?? ${identifier}`;
|
|
1397
1397
|
}
|
|
1398
|
+
function getDegenerateSlotScopeFallbackKeyVariable(expression) {
|
|
1399
|
+
if (!expression) {
|
|
1400
|
+
return null;
|
|
1401
|
+
}
|
|
1402
|
+
const trimmed = expression.trim();
|
|
1403
|
+
if (!trimmed) {
|
|
1404
|
+
return null;
|
|
1405
|
+
}
|
|
1406
|
+
const parts = splitNullishCoalescingExpression(trimmed);
|
|
1407
|
+
if (parts.length < 2) {
|
|
1408
|
+
return null;
|
|
1409
|
+
}
|
|
1410
|
+
const variableName = parts[parts.length - 1].trim();
|
|
1411
|
+
if (!variableName) {
|
|
1412
|
+
return null;
|
|
1413
|
+
}
|
|
1414
|
+
let terminalIsIdentifier;
|
|
1415
|
+
try {
|
|
1416
|
+
terminalIsIdentifier = types.isIdentifier(parser.parseExpression(variableName, { plugins: ["typescript"] }));
|
|
1417
|
+
} catch {
|
|
1418
|
+
terminalIsIdentifier = false;
|
|
1419
|
+
}
|
|
1420
|
+
if (!terminalIsIdentifier) {
|
|
1421
|
+
return null;
|
|
1422
|
+
}
|
|
1423
|
+
const toMemberChainBase = (node) => {
|
|
1424
|
+
let current = node;
|
|
1425
|
+
while (types.isMemberExpression(current) || types.isOptionalMemberExpression(current)) {
|
|
1426
|
+
current = current.object;
|
|
1427
|
+
}
|
|
1428
|
+
return current;
|
|
1429
|
+
};
|
|
1430
|
+
const allMembersOfVariable = parts.slice(0, -1).every((part) => {
|
|
1431
|
+
try {
|
|
1432
|
+
const memberAst = parser.parseExpression(part, { plugins: ["typescript"] });
|
|
1433
|
+
const base = toMemberChainBase(memberAst);
|
|
1434
|
+
return types.isIdentifier(base) && base.name === variableName;
|
|
1435
|
+
} catch {
|
|
1436
|
+
return false;
|
|
1437
|
+
}
|
|
1438
|
+
});
|
|
1439
|
+
return allMembersOfVariable ? variableName : null;
|
|
1440
|
+
}
|
|
1441
|
+
function getSlotScopeVariablesUsedAsBareCallbackHandlers(templateNode) {
|
|
1442
|
+
const scopeExpression = findTemplateSlotScopeExpression(templateNode);
|
|
1443
|
+
if (!scopeExpression) {
|
|
1444
|
+
return [];
|
|
1445
|
+
}
|
|
1446
|
+
const scopeVariables = new Set(tryExtractSlotScopeVariableNames(scopeExpression));
|
|
1447
|
+
if (scopeVariables.size === 0) {
|
|
1448
|
+
return [];
|
|
1449
|
+
}
|
|
1450
|
+
const used = /* @__PURE__ */ new Set();
|
|
1451
|
+
const collectScopeBindings = (node) => {
|
|
1452
|
+
const names = [];
|
|
1453
|
+
const slotScope = findTemplateSlotScopeExpression(node);
|
|
1454
|
+
if (slotScope) {
|
|
1455
|
+
names.push(...tryExtractSlotScopeVariableNames(slotScope));
|
|
1456
|
+
}
|
|
1457
|
+
const vFor = node.props.find(
|
|
1458
|
+
(prop) => prop.type === compilerCore.NodeTypes.DIRECTIVE && prop.name === "for"
|
|
1459
|
+
);
|
|
1460
|
+
if (vFor?.exp) {
|
|
1461
|
+
const forSource = getVueExpressionSource(vFor.exp, "content", "compiled");
|
|
1462
|
+
if (forSource) {
|
|
1463
|
+
const aliasMatch = /^\s*([\s\S]+?)\s+(?:in|of)\s+[\s\S]+$/.exec(forSource);
|
|
1464
|
+
const aliasSource = aliasMatch?.[1];
|
|
1465
|
+
if (aliasSource) {
|
|
1466
|
+
try {
|
|
1467
|
+
const aliasAst = parser.parseExpression(aliasSource, { plugins: ["typescript"] });
|
|
1468
|
+
if (types.isSequenceExpression(aliasAst)) {
|
|
1469
|
+
for (const part of aliasAst.expressions) {
|
|
1470
|
+
names.push(...collectBindingPatternNames(part));
|
|
1471
|
+
}
|
|
1472
|
+
} else {
|
|
1473
|
+
names.push(...collectBindingPatternNames(aliasAst));
|
|
1474
|
+
}
|
|
1475
|
+
} catch {
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
return names;
|
|
1481
|
+
};
|
|
1482
|
+
const visit = (current, shadowed) => {
|
|
1483
|
+
if (!current || typeof current !== "object" || !("type" in current)) {
|
|
1484
|
+
return;
|
|
1485
|
+
}
|
|
1486
|
+
if (current.type === compilerCore.NodeTypes.ELEMENT) {
|
|
1487
|
+
const element = current;
|
|
1488
|
+
const isSlotTemplate = element.tag === "template" && findTemplateSlotScopeExpression(element) !== null;
|
|
1489
|
+
const isForElement = element.props.some(
|
|
1490
|
+
(prop) => prop.type === compilerCore.NodeTypes.DIRECTIVE && prop.name === "for"
|
|
1491
|
+
);
|
|
1492
|
+
if (!isSlotTemplate && !isForElement) {
|
|
1493
|
+
const handlerName = tryGetBareCallbackClickHandlerName(element);
|
|
1494
|
+
if (handlerName && !shadowed.has(handlerName) && scopeVariables.has(handlerName)) {
|
|
1495
|
+
used.add(handlerName);
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
const introduced = collectScopeBindings(element);
|
|
1499
|
+
if (introduced.length > 0) {
|
|
1500
|
+
const innerShadowed = new Set(shadowed);
|
|
1501
|
+
for (const name of introduced) {
|
|
1502
|
+
innerShadowed.add(name);
|
|
1503
|
+
}
|
|
1504
|
+
for (const child of element.children ?? []) {
|
|
1505
|
+
visit(child, innerShadowed);
|
|
1506
|
+
}
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
for (const child of element.children ?? []) {
|
|
1510
|
+
visit(child, shadowed);
|
|
1511
|
+
}
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1514
|
+
if (current.type === compilerCore.NodeTypes.ROOT) {
|
|
1515
|
+
for (const child of current.children ?? []) {
|
|
1516
|
+
visit(child, shadowed);
|
|
1517
|
+
}
|
|
1518
|
+
return;
|
|
1519
|
+
}
|
|
1520
|
+
if (current.type === compilerCore.NodeTypes.IF) {
|
|
1521
|
+
for (const branch of current.branches ?? []) {
|
|
1522
|
+
visit(branch, shadowed);
|
|
1523
|
+
}
|
|
1524
|
+
return;
|
|
1525
|
+
}
|
|
1526
|
+
if (current.type === compilerCore.NodeTypes.IF_BRANCH || current.type === compilerCore.NodeTypes.FOR) {
|
|
1527
|
+
for (const child of current.children ?? []) {
|
|
1528
|
+
visit(child, shadowed);
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
};
|
|
1532
|
+
for (const child of templateNode.children ?? []) {
|
|
1533
|
+
visit(child, /* @__PURE__ */ new Set());
|
|
1534
|
+
}
|
|
1535
|
+
return [...used];
|
|
1536
|
+
}
|
|
1398
1537
|
function tryGetBindingIdentifierName(node) {
|
|
1399
1538
|
if (!node) {
|
|
1400
1539
|
return null;
|
|
@@ -1551,6 +1690,39 @@ function tryGetTemplateSlotScopeKeyInfo(expression) {
|
|
|
1551
1690
|
const candidateExpression = bindingNode ? tryGetSlotScopeKeyCandidate(bindingNode)?.expression ?? null : null;
|
|
1552
1691
|
return candidateExpression ? toResolvedKeyInfo(candidateExpression) : null;
|
|
1553
1692
|
}
|
|
1693
|
+
function collectBindingPatternNames(node) {
|
|
1694
|
+
if (!node) {
|
|
1695
|
+
return [];
|
|
1696
|
+
}
|
|
1697
|
+
if (types.isIdentifier(node)) {
|
|
1698
|
+
return [node.name];
|
|
1699
|
+
}
|
|
1700
|
+
if (types.isAssignmentPattern(node)) {
|
|
1701
|
+
return collectBindingPatternNames(node.left);
|
|
1702
|
+
}
|
|
1703
|
+
if (types.isRestElement(node)) {
|
|
1704
|
+
return collectBindingPatternNames(node.argument);
|
|
1705
|
+
}
|
|
1706
|
+
if (types.isObjectPattern(node)) {
|
|
1707
|
+
const names = [];
|
|
1708
|
+
for (const property of node.properties) {
|
|
1709
|
+
if (types.isRestElement(property)) {
|
|
1710
|
+
names.push(...collectBindingPatternNames(property.argument));
|
|
1711
|
+
} else if (types.isObjectProperty(property)) {
|
|
1712
|
+
names.push(...collectBindingPatternNames(property.value));
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
return names;
|
|
1716
|
+
}
|
|
1717
|
+
if (types.isArrayPattern(node)) {
|
|
1718
|
+
const names = [];
|
|
1719
|
+
for (const element of node.elements) {
|
|
1720
|
+
names.push(...collectBindingPatternNames(element));
|
|
1721
|
+
}
|
|
1722
|
+
return names;
|
|
1723
|
+
}
|
|
1724
|
+
return [];
|
|
1725
|
+
}
|
|
1554
1726
|
function tryExtractSlotScopeVariableNames(expression) {
|
|
1555
1727
|
const bindingNode = tryGetTemplateSlotScopeBindingNode(expression);
|
|
1556
1728
|
if (!bindingNode) {
|
|
@@ -6946,12 +7118,16 @@ Fix: give direct and slot-projected instances distinct accessible names or seman
|
|
|
6946
7118
|
const members = [];
|
|
6947
7119
|
if (isView && (componentRefsForInstances.size > 0 || attachmentsForThisClass.length > 0 || widgetInstances.length > 0)) {
|
|
6948
7120
|
members.push(...getComponentInstances(directComponentInstances, projectedComponentInstances, attachmentsForThisClass, widgetInstances));
|
|
6949
|
-
members.push(getConstructor(directComponentInstances, attachmentsForThisClass, widgetInstances, { testIdAttribute }));
|
|
6950
7121
|
}
|
|
6951
7122
|
if (!isView && (componentRefsForInstances.size > 0 || attachmentsForThisClass.length > 0)) {
|
|
6952
7123
|
members.push(...getComponentInstances(directComponentInstances, projectedComponentInstances, attachmentsForThisClass));
|
|
6953
|
-
members.push(getConstructor(directComponentInstances, attachmentsForThisClass, [], { testIdAttribute }));
|
|
6954
7124
|
}
|
|
7125
|
+
members.push(getConstructor(
|
|
7126
|
+
directComponentInstances,
|
|
7127
|
+
attachmentsForThisClass,
|
|
7128
|
+
isView ? widgetInstances : [],
|
|
7129
|
+
{ testIdAttribute }
|
|
7130
|
+
));
|
|
6955
7131
|
members.push(
|
|
6956
7132
|
...getAttachmentPassthroughMethods(componentName, dependencies, attachmentsForThisClass, reservedAttachmentPassthroughNames)
|
|
6957
7133
|
);
|
|
@@ -6996,7 +7172,6 @@ function generateViewObjectModelContent(componentName, dependencies, componentHi
|
|
|
6996
7172
|
const basePageImport = path.relative(fromAbs, toAbs).replace(/\\/g, "/");
|
|
6997
7173
|
const basePageImportNoExt = stripExtension(basePageImport).replace(/\\/g, "/");
|
|
6998
7174
|
const basePageImportSpecifier = basePageImportNoExt.startsWith(".") ? basePageImportNoExt : `./${basePageImportNoExt}`;
|
|
6999
|
-
const needsPlaywrightPageImport = prepared.isView || prepared.attachmentsForThisClass.length > 0 || prepared.componentRefsForInstances.size > 0 || prepared.widgetInstances.length > 0;
|
|
7000
7175
|
const customPomImportSpecifiersByClass = options.customPomImportSpecifiersByClass ?? {};
|
|
7001
7176
|
const customImports = Array.from(
|
|
7002
7177
|
/* @__PURE__ */ new Set([
|
|
@@ -7048,16 +7223,14 @@ function generateViewObjectModelContent(componentName, dependencies, componentHi
|
|
|
7048
7223
|
const prefixText = `${buildFilePrefix({ eslintDisableSortImports: true })}${doc}
|
|
7049
7224
|
`;
|
|
7050
7225
|
return renderSourceFile(`${prepared.className}.ts`, (sourceFile) => {
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
});
|
|
7060
|
-
}
|
|
7226
|
+
addNamedImport(sourceFile, {
|
|
7227
|
+
moduleSpecifier: "@playwright/test",
|
|
7228
|
+
isTypeOnly: true,
|
|
7229
|
+
namedImports: [
|
|
7230
|
+
{ name: "Locator", alias: "PwLocator" },
|
|
7231
|
+
{ name: "Page", alias: "PwPage" }
|
|
7232
|
+
]
|
|
7233
|
+
});
|
|
7061
7234
|
addNamedImport(sourceFile, {
|
|
7062
7235
|
moduleSpecifier: basePageImportSpecifier,
|
|
7063
7236
|
namedImports: ["BasePage", "Fluent"]
|
|
@@ -9130,6 +9303,7 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
|
|
|
9130
9303
|
const conditionalMergeGroupByIfBranch = /* @__PURE__ */ new WeakMap();
|
|
9131
9304
|
const componentInstanceNameOwnerByName = /* @__PURE__ */ new Map();
|
|
9132
9305
|
let conditionalMergeGroupCounter = 0;
|
|
9306
|
+
const slotScopeCallbackVariablesByTemplate = /* @__PURE__ */ new WeakMap();
|
|
9133
9307
|
const getElementLocationKey = (element) => {
|
|
9134
9308
|
const startOffset = element.loc?.start.offset;
|
|
9135
9309
|
const endOffset = element.loc?.end.offset;
|
|
@@ -9206,6 +9380,12 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
|
|
|
9206
9380
|
}
|
|
9207
9381
|
const element = node;
|
|
9208
9382
|
const parentIsRoot = context?.parent?.type === compilerCore.NodeTypes.ROOT;
|
|
9383
|
+
if (element.tag === "template" && !slotScopeCallbackVariablesByTemplate.has(element)) {
|
|
9384
|
+
const callbackVariables = getSlotScopeVariablesUsedAsBareCallbackHandlers(element);
|
|
9385
|
+
if (callbackVariables.length > 0) {
|
|
9386
|
+
slotScopeCallbackVariablesByTemplate.set(element, new Set(callbackVariables));
|
|
9387
|
+
}
|
|
9388
|
+
}
|
|
9209
9389
|
const grandParent = context.grandParent;
|
|
9210
9390
|
const parentElement = !parentIsRoot && context?.parent?.type === compilerCore.NodeTypes.ELEMENT ? context.parent : !parentIsRoot && grandParent?.type === compilerCore.NodeTypes.ELEMENT ? grandParent : null;
|
|
9211
9391
|
hierarchyMap.set(element, parentElement);
|
|
@@ -9371,6 +9551,11 @@ File: ${context.filename ?? "unknown"}:${loc.line}:${loc.column}`
|
|
|
9371
9551
|
if (isSlotScopeCallbackClickHandler(element, hierarchyMap)) {
|
|
9372
9552
|
return null;
|
|
9373
9553
|
}
|
|
9554
|
+
const slotTemplateNode = getContainedInSlotTemplateNode(element, hierarchyMap);
|
|
9555
|
+
const degenerateKeyVariable = getDegenerateSlotScopeFallbackKeyVariable(slotKeyInfo.rawExpression);
|
|
9556
|
+
if (degenerateKeyVariable && slotTemplateNode && slotScopeCallbackVariablesByTemplate.get(slotTemplateNode)?.has(degenerateKeyVariable)) {
|
|
9557
|
+
return null;
|
|
9558
|
+
}
|
|
9374
9559
|
return slotKeyInfo;
|
|
9375
9560
|
}
|
|
9376
9561
|
if (crossFileKeyRegistry) {
|