@vue/compiler-core 3.2.5 → 3.2.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.
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { isString, hyphenate, extend, isObject, NO, isArray, makeMap, isSymbol, NOOP, EMPTY_OBJ, capitalize, camelize as camelize$1, PatchFlagNames, slotFlagsText, isOn, isReservedProp, toHandlerKey } from '@vue/shared';
|
|
2
2
|
export { generateCodeFrame } from '@vue/shared';
|
|
3
|
-
import { isReferenced } from '@babel/types';
|
|
4
|
-
import { walk as walk$1 } from 'estree-walker';
|
|
5
3
|
|
|
6
4
|
function defaultOnError(error) {
|
|
7
5
|
throw error;
|
|
@@ -2751,75 +2749,14 @@ function genCacheExpression(node, context) {
|
|
|
2751
2749
|
}
|
|
2752
2750
|
|
|
2753
2751
|
function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = Object.create(null)) {
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
walk$1(root, {
|
|
2758
|
-
enter(node, parent) {
|
|
2759
|
-
parent && parentStack.push(parent);
|
|
2760
|
-
if (parent &&
|
|
2761
|
-
parent.type.startsWith('TS') &&
|
|
2762
|
-
parent.type !== 'TSAsExpression' &&
|
|
2763
|
-
parent.type !== 'TSNonNullExpression' &&
|
|
2764
|
-
parent.type !== 'TSTypeAssertion') {
|
|
2765
|
-
return this.skip();
|
|
2766
|
-
}
|
|
2767
|
-
if (node.type === 'Identifier') {
|
|
2768
|
-
const isLocal = !!knownIds[node.name];
|
|
2769
|
-
const isRefed = isReferencedIdentifier(node, parent, parentStack);
|
|
2770
|
-
if (includeAll || (isRefed && !isLocal)) {
|
|
2771
|
-
onIdentifier(node, parent, parentStack, isRefed, isLocal);
|
|
2772
|
-
}
|
|
2773
|
-
}
|
|
2774
|
-
else if (node.type === 'ObjectProperty' &&
|
|
2775
|
-
parent.type === 'ObjectPattern') {
|
|
2776
|
-
node.inPattern = true;
|
|
2777
|
-
}
|
|
2778
|
-
else if (isFunctionType(node)) {
|
|
2779
|
-
// walk function expressions and add its arguments to known identifiers
|
|
2780
|
-
// so that we don't prefix them
|
|
2781
|
-
walkFunctionParams(node, id => markScopeIdentifier(node, id, knownIds));
|
|
2782
|
-
}
|
|
2783
|
-
else if (node.type === 'BlockStatement') {
|
|
2784
|
-
// #3445 record block-level local variables
|
|
2785
|
-
walkBlockDeclarations(node, id => markScopeIdentifier(node, id, knownIds));
|
|
2786
|
-
}
|
|
2787
|
-
},
|
|
2788
|
-
leave(node, parent) {
|
|
2789
|
-
parent && parentStack.pop();
|
|
2790
|
-
if (node !== rootExp && node.scopeIds) {
|
|
2791
|
-
for (const id of node.scopeIds) {
|
|
2792
|
-
knownIds[id]--;
|
|
2793
|
-
if (knownIds[id] === 0) {
|
|
2794
|
-
delete knownIds[id];
|
|
2795
|
-
}
|
|
2796
|
-
}
|
|
2797
|
-
}
|
|
2798
|
-
}
|
|
2799
|
-
});
|
|
2752
|
+
{
|
|
2753
|
+
return;
|
|
2754
|
+
}
|
|
2800
2755
|
}
|
|
2801
2756
|
function isReferencedIdentifier(id, parent, parentStack) {
|
|
2802
|
-
|
|
2803
|
-
return true;
|
|
2804
|
-
}
|
|
2805
|
-
// is a special keyword but parsed as identifier
|
|
2806
|
-
if (id.name === 'arguments') {
|
|
2757
|
+
{
|
|
2807
2758
|
return false;
|
|
2808
2759
|
}
|
|
2809
|
-
if (isReferenced(id, parent)) {
|
|
2810
|
-
return true;
|
|
2811
|
-
}
|
|
2812
|
-
// babel's isReferenced check returns false for ids being assigned to, so we
|
|
2813
|
-
// need to cover those cases here
|
|
2814
|
-
switch (parent.type) {
|
|
2815
|
-
case 'AssignmentExpression':
|
|
2816
|
-
case 'AssignmentPattern':
|
|
2817
|
-
return true;
|
|
2818
|
-
case 'ObjectPattern':
|
|
2819
|
-
case 'ArrayPattern':
|
|
2820
|
-
return isInDestructureAssignment(parent, parentStack);
|
|
2821
|
-
}
|
|
2822
|
-
return false;
|
|
2823
2760
|
}
|
|
2824
2761
|
function isInDestructureAssignment(parent, parentStack) {
|
|
2825
2762
|
if (parent &&
|
|
@@ -2900,19 +2837,6 @@ function extractIdentifiers(param, nodes = []) {
|
|
|
2900
2837
|
}
|
|
2901
2838
|
return nodes;
|
|
2902
2839
|
}
|
|
2903
|
-
function markScopeIdentifier(node, child, knownIds) {
|
|
2904
|
-
const { name } = child;
|
|
2905
|
-
if (node.scopeIds && node.scopeIds.has(name)) {
|
|
2906
|
-
return;
|
|
2907
|
-
}
|
|
2908
|
-
if (name in knownIds) {
|
|
2909
|
-
knownIds[name]++;
|
|
2910
|
-
}
|
|
2911
|
-
else {
|
|
2912
|
-
knownIds[name] = 1;
|
|
2913
|
-
}
|
|
2914
|
-
(node.scopeIds || (node.scopeIds = new Set())).add(name);
|
|
2915
|
-
}
|
|
2916
2840
|
const isFunctionType = (node) => {
|
|
2917
2841
|
return /Function(?:Expression|Declaration)$|Method$/.test(node.type);
|
|
2918
2842
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.6",
|
|
4
4
|
"description": "@vue/compiler-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/compiler-core.esm-bundler.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-core#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vue/shared": "3.2.
|
|
35
|
+
"@vue/shared": "3.2.6",
|
|
36
36
|
"@babel/parser": "^7.15.0",
|
|
37
37
|
"@babel/types": "^7.15.0",
|
|
38
38
|
"estree-walker": "^2.0.2",
|