@vue/compiler-core 3.4.0-beta.3 → 3.4.0-rc.1
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.
|
@@ -1516,12 +1516,23 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
|
|
|
1516
1516
|
} else if (node.type === "ObjectProperty" && parent.type === "ObjectPattern") {
|
|
1517
1517
|
node.inPattern = true;
|
|
1518
1518
|
} else if (isFunctionType(node)) {
|
|
1519
|
-
|
|
1519
|
+
if (node.scopeIds) {
|
|
1520
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
1521
|
+
} else {
|
|
1522
|
+
walkFunctionParams(
|
|
1523
|
+
node,
|
|
1524
|
+
(id) => markScopeIdentifier(node, id, knownIds)
|
|
1525
|
+
);
|
|
1526
|
+
}
|
|
1520
1527
|
} else if (node.type === "BlockStatement") {
|
|
1521
|
-
|
|
1522
|
-
node,
|
|
1523
|
-
|
|
1524
|
-
|
|
1528
|
+
if (node.scopeIds) {
|
|
1529
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
1530
|
+
} else {
|
|
1531
|
+
walkBlockDeclarations(
|
|
1532
|
+
node,
|
|
1533
|
+
(id) => markScopeIdentifier(node, id, knownIds)
|
|
1534
|
+
);
|
|
1535
|
+
}
|
|
1525
1536
|
}
|
|
1526
1537
|
},
|
|
1527
1538
|
leave(node, parent) {
|
|
@@ -1640,16 +1651,19 @@ function extractIdentifiers(param, nodes = []) {
|
|
|
1640
1651
|
}
|
|
1641
1652
|
return nodes;
|
|
1642
1653
|
}
|
|
1643
|
-
function
|
|
1644
|
-
const { name } = child;
|
|
1645
|
-
if (node.scopeIds && node.scopeIds.has(name)) {
|
|
1646
|
-
return;
|
|
1647
|
-
}
|
|
1654
|
+
function markKnownIds(name, knownIds) {
|
|
1648
1655
|
if (name in knownIds) {
|
|
1649
1656
|
knownIds[name]++;
|
|
1650
1657
|
} else {
|
|
1651
1658
|
knownIds[name] = 1;
|
|
1652
1659
|
}
|
|
1660
|
+
}
|
|
1661
|
+
function markScopeIdentifier(node, child, knownIds) {
|
|
1662
|
+
const { name } = child;
|
|
1663
|
+
if (node.scopeIds && node.scopeIds.has(name)) {
|
|
1664
|
+
return;
|
|
1665
|
+
}
|
|
1666
|
+
markKnownIds(name, knownIds);
|
|
1653
1667
|
(node.scopeIds || (node.scopeIds = /* @__PURE__ */ new Set())).add(name);
|
|
1654
1668
|
}
|
|
1655
1669
|
const isFunctionType = (node) => {
|
|
@@ -1854,7 +1868,7 @@ const isMemberExpressionNode = (path, context) => {
|
|
|
1854
1868
|
plugins: context.expressionPlugins
|
|
1855
1869
|
});
|
|
1856
1870
|
ret = unwrapTSNode(ret);
|
|
1857
|
-
return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier";
|
|
1871
|
+
return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier" && ret.name !== "undefined";
|
|
1858
1872
|
} catch (e) {
|
|
1859
1873
|
return false;
|
|
1860
1874
|
}
|
|
@@ -2139,12 +2153,6 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2139
2153
|
loc: getLoc(start - 1, end),
|
|
2140
2154
|
codegenNode: void 0
|
|
2141
2155
|
};
|
|
2142
|
-
if (tokenizer.inSFCRoot) {
|
|
2143
|
-
currentOpenTag.innerLoc = getLoc(
|
|
2144
|
-
end + fastForward(end) + 1,
|
|
2145
|
-
end
|
|
2146
|
-
);
|
|
2147
|
-
}
|
|
2148
2156
|
},
|
|
2149
2157
|
onopentagend(end) {
|
|
2150
2158
|
endOpenTag(end);
|
|
@@ -2472,6 +2480,9 @@ function getSlice(start, end) {
|
|
|
2472
2480
|
return currentInput.slice(start, end);
|
|
2473
2481
|
}
|
|
2474
2482
|
function endOpenTag(end) {
|
|
2483
|
+
if (tokenizer.inSFCRoot) {
|
|
2484
|
+
currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
|
|
2485
|
+
}
|
|
2475
2486
|
addNode(currentOpenTag);
|
|
2476
2487
|
const { tag, ns } = currentOpenTag;
|
|
2477
2488
|
if (ns === 0 && currentOptions.isPreTag(tag)) {
|
|
@@ -2505,7 +2516,7 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2505
2516
|
if (isImplied) {
|
|
2506
2517
|
setLocEnd(el.loc, backTrack(end, 60));
|
|
2507
2518
|
} else {
|
|
2508
|
-
setLocEnd(el.loc, end +
|
|
2519
|
+
setLocEnd(el.loc, end + 1);
|
|
2509
2520
|
}
|
|
2510
2521
|
if (tokenizer.inSFCRoot) {
|
|
2511
2522
|
if (el.children.length) {
|
|
@@ -2600,13 +2611,6 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2600
2611
|
}
|
|
2601
2612
|
}
|
|
2602
2613
|
}
|
|
2603
|
-
function fastForward(start, c) {
|
|
2604
|
-
let offset = 0;
|
|
2605
|
-
while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
|
|
2606
|
-
offset++;
|
|
2607
|
-
}
|
|
2608
|
-
return offset;
|
|
2609
|
-
}
|
|
2610
2614
|
function backTrack(index, c) {
|
|
2611
2615
|
let i = index;
|
|
2612
2616
|
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
|
@@ -1512,12 +1512,23 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
|
|
|
1512
1512
|
} else if (node.type === "ObjectProperty" && parent.type === "ObjectPattern") {
|
|
1513
1513
|
node.inPattern = true;
|
|
1514
1514
|
} else if (isFunctionType(node)) {
|
|
1515
|
-
|
|
1515
|
+
if (node.scopeIds) {
|
|
1516
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
1517
|
+
} else {
|
|
1518
|
+
walkFunctionParams(
|
|
1519
|
+
node,
|
|
1520
|
+
(id) => markScopeIdentifier(node, id, knownIds)
|
|
1521
|
+
);
|
|
1522
|
+
}
|
|
1516
1523
|
} else if (node.type === "BlockStatement") {
|
|
1517
|
-
|
|
1518
|
-
node,
|
|
1519
|
-
|
|
1520
|
-
|
|
1524
|
+
if (node.scopeIds) {
|
|
1525
|
+
node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
|
|
1526
|
+
} else {
|
|
1527
|
+
walkBlockDeclarations(
|
|
1528
|
+
node,
|
|
1529
|
+
(id) => markScopeIdentifier(node, id, knownIds)
|
|
1530
|
+
);
|
|
1531
|
+
}
|
|
1521
1532
|
}
|
|
1522
1533
|
},
|
|
1523
1534
|
leave(node, parent) {
|
|
@@ -1636,16 +1647,19 @@ function extractIdentifiers(param, nodes = []) {
|
|
|
1636
1647
|
}
|
|
1637
1648
|
return nodes;
|
|
1638
1649
|
}
|
|
1639
|
-
function
|
|
1640
|
-
const { name } = child;
|
|
1641
|
-
if (node.scopeIds && node.scopeIds.has(name)) {
|
|
1642
|
-
return;
|
|
1643
|
-
}
|
|
1650
|
+
function markKnownIds(name, knownIds) {
|
|
1644
1651
|
if (name in knownIds) {
|
|
1645
1652
|
knownIds[name]++;
|
|
1646
1653
|
} else {
|
|
1647
1654
|
knownIds[name] = 1;
|
|
1648
1655
|
}
|
|
1656
|
+
}
|
|
1657
|
+
function markScopeIdentifier(node, child, knownIds) {
|
|
1658
|
+
const { name } = child;
|
|
1659
|
+
if (node.scopeIds && node.scopeIds.has(name)) {
|
|
1660
|
+
return;
|
|
1661
|
+
}
|
|
1662
|
+
markKnownIds(name, knownIds);
|
|
1649
1663
|
(node.scopeIds || (node.scopeIds = /* @__PURE__ */ new Set())).add(name);
|
|
1650
1664
|
}
|
|
1651
1665
|
const isFunctionType = (node) => {
|
|
@@ -1850,7 +1864,7 @@ const isMemberExpressionNode = (path, context) => {
|
|
|
1850
1864
|
plugins: context.expressionPlugins
|
|
1851
1865
|
});
|
|
1852
1866
|
ret = unwrapTSNode(ret);
|
|
1853
|
-
return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier";
|
|
1867
|
+
return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier" && ret.name !== "undefined";
|
|
1854
1868
|
} catch (e) {
|
|
1855
1869
|
return false;
|
|
1856
1870
|
}
|
|
@@ -2135,12 +2149,6 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2135
2149
|
loc: getLoc(start - 1, end),
|
|
2136
2150
|
codegenNode: void 0
|
|
2137
2151
|
};
|
|
2138
|
-
if (tokenizer.inSFCRoot) {
|
|
2139
|
-
currentOpenTag.innerLoc = getLoc(
|
|
2140
|
-
end + fastForward(end) + 1,
|
|
2141
|
-
end
|
|
2142
|
-
);
|
|
2143
|
-
}
|
|
2144
2152
|
},
|
|
2145
2153
|
onopentagend(end) {
|
|
2146
2154
|
endOpenTag(end);
|
|
@@ -2468,6 +2476,9 @@ function getSlice(start, end) {
|
|
|
2468
2476
|
return currentInput.slice(start, end);
|
|
2469
2477
|
}
|
|
2470
2478
|
function endOpenTag(end) {
|
|
2479
|
+
if (tokenizer.inSFCRoot) {
|
|
2480
|
+
currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
|
|
2481
|
+
}
|
|
2471
2482
|
addNode(currentOpenTag);
|
|
2472
2483
|
const { tag, ns } = currentOpenTag;
|
|
2473
2484
|
if (ns === 0 && currentOptions.isPreTag(tag)) {
|
|
@@ -2501,7 +2512,7 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2501
2512
|
if (isImplied) {
|
|
2502
2513
|
setLocEnd(el.loc, backTrack(end, 60));
|
|
2503
2514
|
} else {
|
|
2504
|
-
setLocEnd(el.loc, end +
|
|
2515
|
+
setLocEnd(el.loc, end + 1);
|
|
2505
2516
|
}
|
|
2506
2517
|
if (tokenizer.inSFCRoot) {
|
|
2507
2518
|
if (el.children.length) {
|
|
@@ -2566,13 +2577,6 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2566
2577
|
}
|
|
2567
2578
|
}
|
|
2568
2579
|
}
|
|
2569
|
-
function fastForward(start, c) {
|
|
2570
|
-
let offset = 0;
|
|
2571
|
-
while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
|
|
2572
|
-
offset++;
|
|
2573
|
-
}
|
|
2574
|
-
return offset;
|
|
2575
|
-
}
|
|
2576
2580
|
function backTrack(index, c) {
|
|
2577
2581
|
let i = index;
|
|
2578
2582
|
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
|
@@ -1914,12 +1914,6 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
1914
1914
|
loc: getLoc(start - 1, end),
|
|
1915
1915
|
codegenNode: void 0
|
|
1916
1916
|
};
|
|
1917
|
-
if (tokenizer.inSFCRoot) {
|
|
1918
|
-
currentOpenTag.innerLoc = getLoc(
|
|
1919
|
-
end + fastForward(end) + 1,
|
|
1920
|
-
end
|
|
1921
|
-
);
|
|
1922
|
-
}
|
|
1923
1917
|
},
|
|
1924
1918
|
onopentagend(end) {
|
|
1925
1919
|
endOpenTag(end);
|
|
@@ -2244,6 +2238,9 @@ function getSlice(start, end) {
|
|
|
2244
2238
|
return currentInput.slice(start, end);
|
|
2245
2239
|
}
|
|
2246
2240
|
function endOpenTag(end) {
|
|
2241
|
+
if (tokenizer.inSFCRoot) {
|
|
2242
|
+
currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
|
|
2243
|
+
}
|
|
2247
2244
|
addNode(currentOpenTag);
|
|
2248
2245
|
const { tag, ns } = currentOpenTag;
|
|
2249
2246
|
if (ns === 0 && currentOptions.isPreTag(tag)) {
|
|
@@ -2284,7 +2281,7 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2284
2281
|
if (isImplied) {
|
|
2285
2282
|
setLocEnd(el.loc, backTrack(end, 60));
|
|
2286
2283
|
} else {
|
|
2287
|
-
setLocEnd(el.loc, end +
|
|
2284
|
+
setLocEnd(el.loc, end + 1);
|
|
2288
2285
|
}
|
|
2289
2286
|
if (tokenizer.inSFCRoot) {
|
|
2290
2287
|
if (el.children.length) {
|
|
@@ -2379,13 +2376,6 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2379
2376
|
}
|
|
2380
2377
|
}
|
|
2381
2378
|
}
|
|
2382
|
-
function fastForward(start, c) {
|
|
2383
|
-
let offset = 0;
|
|
2384
|
-
while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
|
|
2385
|
-
offset++;
|
|
2386
|
-
}
|
|
2387
|
-
return offset;
|
|
2388
|
-
}
|
|
2389
2379
|
function backTrack(index, c) {
|
|
2390
2380
|
let i = index;
|
|
2391
2381
|
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.4.0-
|
|
3
|
+
"version": "3.4.0-rc.1",
|
|
4
4
|
"description": "@vue/compiler-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/compiler-core.esm-bundler.js",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@babel/parser": "^7.23.
|
|
35
|
+
"@babel/parser": "^7.23.6",
|
|
36
36
|
"entities": "^4.5.0",
|
|
37
37
|
"estree-walker": "^2.0.2",
|
|
38
38
|
"source-map-js": "^1.0.2",
|
|
39
|
-
"@vue/shared": "3.4.0-
|
|
39
|
+
"@vue/shared": "3.4.0-rc.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@babel/types": "^7.23.
|
|
42
|
+
"@babel/types": "^7.23.6"
|
|
43
43
|
}
|
|
44
44
|
}
|