@vue/compiler-sfc 3.3.1 → 3.3.2
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/compiler-sfc.cjs.js +105 -82
- package/dist/compiler-sfc.esm-browser.js +377 -350
- package/package.json +6 -6
package/dist/compiler-sfc.cjs.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var CompilerDOM = require('@vue/compiler-dom');
|
|
6
6
|
var sourceMapJs = require('source-map-js');
|
|
7
|
+
var path$3 = require('path');
|
|
7
8
|
var parser$2 = require('@babel/parser');
|
|
8
9
|
var shared = require('@vue/shared');
|
|
9
|
-
var path$3 = require('path');
|
|
10
10
|
var compilerCore = require('@vue/compiler-core');
|
|
11
11
|
var url = require('url');
|
|
12
12
|
var CompilerSSR = require('@vue/compiler-ssr');
|
|
@@ -18,19 +18,80 @@ var reactivityTransform = require('@vue/reactivity-transform');
|
|
|
18
18
|
var MagicString = require('magic-string');
|
|
19
19
|
|
|
20
20
|
function _interopNamespaceDefault(e) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
var n = Object.create(null);
|
|
22
|
+
if (e) {
|
|
23
|
+
for (var k in e) {
|
|
24
|
+
n[k] = e[k];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
n.default = e;
|
|
28
|
+
return Object.freeze(n);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
var CompilerDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(CompilerDOM);
|
|
32
32
|
var CompilerSSR__namespace = /*#__PURE__*/_interopNamespaceDefault(CompilerSSR);
|
|
33
33
|
|
|
34
|
+
const UNKNOWN_TYPE = "Unknown";
|
|
35
|
+
function resolveObjectKey(node, computed) {
|
|
36
|
+
switch (node.type) {
|
|
37
|
+
case "StringLiteral":
|
|
38
|
+
case "NumericLiteral":
|
|
39
|
+
return String(node.value);
|
|
40
|
+
case "Identifier":
|
|
41
|
+
if (!computed)
|
|
42
|
+
return node.name;
|
|
43
|
+
}
|
|
44
|
+
return void 0;
|
|
45
|
+
}
|
|
46
|
+
function concatStrings(strs) {
|
|
47
|
+
return strs.filter((s) => !!s).join(", ");
|
|
48
|
+
}
|
|
49
|
+
function isLiteralNode(node) {
|
|
50
|
+
return node.type.endsWith("Literal");
|
|
51
|
+
}
|
|
52
|
+
function unwrapTSNode(node) {
|
|
53
|
+
if (CompilerDOM.TS_NODE_TYPES.includes(node.type)) {
|
|
54
|
+
return unwrapTSNode(node.expression);
|
|
55
|
+
} else {
|
|
56
|
+
return node;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function isCallOf(node, test) {
|
|
60
|
+
return !!(node && test && node.type === "CallExpression" && node.callee.type === "Identifier" && (typeof test === "string" ? node.callee.name === test : test(node.callee.name)));
|
|
61
|
+
}
|
|
62
|
+
function toRuntimeTypeString(types) {
|
|
63
|
+
return types.length > 1 ? `[${types.join(", ")}]` : types[0];
|
|
64
|
+
}
|
|
65
|
+
function getImportedName(specifier) {
|
|
66
|
+
if (specifier.type === "ImportSpecifier")
|
|
67
|
+
return specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
|
|
68
|
+
else if (specifier.type === "ImportNamespaceSpecifier")
|
|
69
|
+
return "*";
|
|
70
|
+
return "default";
|
|
71
|
+
}
|
|
72
|
+
function getId(node) {
|
|
73
|
+
return node.type === "Identifier" ? node.name : node.type === "StringLiteral" ? node.value : null;
|
|
74
|
+
}
|
|
75
|
+
const identity = (str) => str;
|
|
76
|
+
const fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
|
|
77
|
+
const toLowerCase = (str) => str.toLowerCase();
|
|
78
|
+
function toFileNameLowerCase(x) {
|
|
79
|
+
return fileNameLowerCaseRegExp.test(x) ? x.replace(fileNameLowerCaseRegExp, toLowerCase) : x;
|
|
80
|
+
}
|
|
81
|
+
function createGetCanonicalFileName(useCaseSensitiveFileNames) {
|
|
82
|
+
return useCaseSensitiveFileNames ? identity : toFileNameLowerCase;
|
|
83
|
+
}
|
|
84
|
+
const normalize = (path$3.posix || path$3).normalize;
|
|
85
|
+
const windowsSlashRE = /\\/g;
|
|
86
|
+
function normalizePath(p) {
|
|
87
|
+
return normalize(p.replace(windowsSlashRE, "/"));
|
|
88
|
+
}
|
|
89
|
+
const joinPaths = (path$3.posix || path$3).join;
|
|
90
|
+
const escapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
|
|
91
|
+
function getEscapedKey(key) {
|
|
92
|
+
return escapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
|
|
93
|
+
}
|
|
94
|
+
|
|
34
95
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
35
96
|
|
|
36
97
|
function getDefaultExportFromCjs (x) {
|
|
@@ -119,10 +180,7 @@ function genVarName(id, raw, isProd) {
|
|
|
119
180
|
if (isProd) {
|
|
120
181
|
return hash$1(id + raw);
|
|
121
182
|
} else {
|
|
122
|
-
return `${id}-${raw.replace(
|
|
123
|
-
/[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g,
|
|
124
|
-
(s) => `\\${s}`
|
|
125
|
-
)}`;
|
|
183
|
+
return `${id}-${raw.replace(escapeSymbolsRE, (s) => `\\${s}`)}`;
|
|
126
184
|
}
|
|
127
185
|
}
|
|
128
186
|
function normalizeExpression(exp) {
|
|
@@ -15484,63 +15542,6 @@ function preprocess(options, preprocessor) {
|
|
|
15484
15542
|
);
|
|
15485
15543
|
}
|
|
15486
15544
|
|
|
15487
|
-
const UNKNOWN_TYPE = "Unknown";
|
|
15488
|
-
function resolveObjectKey(node, computed) {
|
|
15489
|
-
switch (node.type) {
|
|
15490
|
-
case "StringLiteral":
|
|
15491
|
-
case "NumericLiteral":
|
|
15492
|
-
return String(node.value);
|
|
15493
|
-
case "Identifier":
|
|
15494
|
-
if (!computed)
|
|
15495
|
-
return node.name;
|
|
15496
|
-
}
|
|
15497
|
-
return void 0;
|
|
15498
|
-
}
|
|
15499
|
-
function concatStrings(strs) {
|
|
15500
|
-
return strs.filter((s) => !!s).join(", ");
|
|
15501
|
-
}
|
|
15502
|
-
function isLiteralNode(node) {
|
|
15503
|
-
return node.type.endsWith("Literal");
|
|
15504
|
-
}
|
|
15505
|
-
function unwrapTSNode(node) {
|
|
15506
|
-
if (CompilerDOM.TS_NODE_TYPES.includes(node.type)) {
|
|
15507
|
-
return unwrapTSNode(node.expression);
|
|
15508
|
-
} else {
|
|
15509
|
-
return node;
|
|
15510
|
-
}
|
|
15511
|
-
}
|
|
15512
|
-
function isCallOf(node, test) {
|
|
15513
|
-
return !!(node && test && node.type === "CallExpression" && node.callee.type === "Identifier" && (typeof test === "string" ? node.callee.name === test : test(node.callee.name)));
|
|
15514
|
-
}
|
|
15515
|
-
function toRuntimeTypeString(types) {
|
|
15516
|
-
return types.length > 1 ? `[${types.join(", ")}]` : types[0];
|
|
15517
|
-
}
|
|
15518
|
-
function getImportedName(specifier) {
|
|
15519
|
-
if (specifier.type === "ImportSpecifier")
|
|
15520
|
-
return specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
|
|
15521
|
-
else if (specifier.type === "ImportNamespaceSpecifier")
|
|
15522
|
-
return "*";
|
|
15523
|
-
return "default";
|
|
15524
|
-
}
|
|
15525
|
-
function getId(node) {
|
|
15526
|
-
return node.type === "Identifier" ? node.name : node.type === "StringLiteral" ? node.value : null;
|
|
15527
|
-
}
|
|
15528
|
-
const identity = (str) => str;
|
|
15529
|
-
const fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
|
|
15530
|
-
const toLowerCase = (str) => str.toLowerCase();
|
|
15531
|
-
function toFileNameLowerCase(x) {
|
|
15532
|
-
return fileNameLowerCaseRegExp.test(x) ? x.replace(fileNameLowerCaseRegExp, toLowerCase) : x;
|
|
15533
|
-
}
|
|
15534
|
-
function createGetCanonicalFileName(useCaseSensitiveFileNames) {
|
|
15535
|
-
return useCaseSensitiveFileNames ? identity : toFileNameLowerCase;
|
|
15536
|
-
}
|
|
15537
|
-
const normalize = (path$3.posix || path$3).normalize;
|
|
15538
|
-
const windowsSlashRE = /\\/g;
|
|
15539
|
-
function normalizePath(p) {
|
|
15540
|
-
return normalize(p.replace(windowsSlashRE, "/"));
|
|
15541
|
-
}
|
|
15542
|
-
const joinPaths = (path$3.posix || path$3).join;
|
|
15543
|
-
|
|
15544
15545
|
function analyzeScriptBindings(ast) {
|
|
15545
15546
|
for (const node of ast) {
|
|
15546
15547
|
if (node.type === "ExportDefaultDeclaration" && node.declaration.type === "ObjectExpression") {
|
|
@@ -15848,7 +15849,7 @@ ${shared.generateCodeFrame(
|
|
|
15848
15849
|
);
|
|
15849
15850
|
}
|
|
15850
15851
|
}
|
|
15851
|
-
function resolveParserPlugins(lang, userPlugins) {
|
|
15852
|
+
function resolveParserPlugins(lang, userPlugins, dts = false) {
|
|
15852
15853
|
const plugins = [];
|
|
15853
15854
|
if (lang === "jsx" || lang === "tsx") {
|
|
15854
15855
|
plugins.push("jsx");
|
|
@@ -15856,7 +15857,7 @@ function resolveParserPlugins(lang, userPlugins) {
|
|
|
15856
15857
|
userPlugins = userPlugins.filter((p) => p !== "jsx");
|
|
15857
15858
|
}
|
|
15858
15859
|
if (lang === "ts" || lang === "tsx") {
|
|
15859
|
-
plugins.push("typescript");
|
|
15860
|
+
plugins.push(["typescript", { dts }]);
|
|
15860
15861
|
if (!plugins.includes("decorators")) {
|
|
15861
15862
|
plugins.push("decorators-legacy");
|
|
15862
15863
|
}
|
|
@@ -18065,11 +18066,26 @@ function resolveInterfaceMembers(ctx, node, scope) {
|
|
|
18065
18066
|
const base = typeElementsToMap(ctx, node.body.body, node._ownerScope);
|
|
18066
18067
|
if (node.extends) {
|
|
18067
18068
|
for (const ext of node.extends) {
|
|
18068
|
-
|
|
18069
|
-
|
|
18070
|
-
|
|
18071
|
-
|
|
18069
|
+
if (ext.leadingComments && ext.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
|
|
18070
|
+
continue;
|
|
18071
|
+
}
|
|
18072
|
+
try {
|
|
18073
|
+
const { props } = resolveTypeElements(ctx, ext, scope);
|
|
18074
|
+
for (const key in props) {
|
|
18075
|
+
if (!shared.hasOwn(base.props, key)) {
|
|
18076
|
+
base.props[key] = props[key];
|
|
18077
|
+
}
|
|
18072
18078
|
}
|
|
18079
|
+
} catch (e) {
|
|
18080
|
+
ctx.error(
|
|
18081
|
+
`Failed to resolve extends base type.
|
|
18082
|
+
If this previously worked in 3.2, you can instruct the compiler to ignore this extend by adding /* @vue-ignore */ before it, for example:
|
|
18083
|
+
|
|
18084
|
+
interface Props extends /* @vue-ignore */ Base {}
|
|
18085
|
+
|
|
18086
|
+
Note: both in 3.2 or with the ignore, the properties in the base type are treated as fallthrough attrs at runtime.`,
|
|
18087
|
+
ext
|
|
18088
|
+
);
|
|
18073
18089
|
}
|
|
18074
18090
|
}
|
|
18075
18091
|
}
|
|
@@ -18502,7 +18518,11 @@ function parseFile(filename, content, parserPlugins) {
|
|
|
18502
18518
|
const ext = path$3.extname(filename);
|
|
18503
18519
|
if (ext === ".ts" || ext === ".tsx") {
|
|
18504
18520
|
return parser$2.parse(content, {
|
|
18505
|
-
plugins: resolveParserPlugins(
|
|
18521
|
+
plugins: resolveParserPlugins(
|
|
18522
|
+
ext.slice(1),
|
|
18523
|
+
parserPlugins,
|
|
18524
|
+
filename.endsWith(".d.ts")
|
|
18525
|
+
),
|
|
18506
18526
|
sourceType: "module"
|
|
18507
18527
|
}).program.body;
|
|
18508
18528
|
} else if (ext === ".vue") {
|
|
@@ -19185,9 +19205,10 @@ function genRuntimeProps(ctx) {
|
|
|
19185
19205
|
const defaults = [];
|
|
19186
19206
|
for (const key in ctx.propsDestructuredBindings) {
|
|
19187
19207
|
const d = genDestructuredDefaultValue(ctx, key);
|
|
19208
|
+
const finalKey = getEscapedKey(key);
|
|
19188
19209
|
if (d)
|
|
19189
19210
|
defaults.push(
|
|
19190
|
-
`${
|
|
19211
|
+
`${finalKey}: ${d.valueString}${d.needSkipFactory ? `, __skip_${finalKey}: true` : ``}`
|
|
19191
19212
|
);
|
|
19192
19213
|
}
|
|
19193
19214
|
if (defaults.length) {
|
|
@@ -19276,8 +19297,9 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
|
|
|
19276
19297
|
}
|
|
19277
19298
|
}
|
|
19278
19299
|
}
|
|
19300
|
+
const finalKey = getEscapedKey(key);
|
|
19279
19301
|
if (!ctx.options.isProd) {
|
|
19280
|
-
return `${
|
|
19302
|
+
return `${finalKey}: { ${concatStrings([
|
|
19281
19303
|
`type: ${toRuntimeTypeString(type)}`,
|
|
19282
19304
|
`required: ${required}`,
|
|
19283
19305
|
skipCheck && "skipCheck: true",
|
|
@@ -19286,12 +19308,12 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
|
|
|
19286
19308
|
} else if (type.some(
|
|
19287
19309
|
(el) => el === "Boolean" || (!hasStaticDefaults || defaultString) && el === "Function"
|
|
19288
19310
|
)) {
|
|
19289
|
-
return `${
|
|
19311
|
+
return `${finalKey}: { ${concatStrings([
|
|
19290
19312
|
`type: ${toRuntimeTypeString(type)}`,
|
|
19291
19313
|
defaultString
|
|
19292
19314
|
])} }`;
|
|
19293
19315
|
} else {
|
|
19294
|
-
return `${
|
|
19316
|
+
return `${finalKey}: ${defaultString ? `{ ${defaultString} }` : `{}`}`;
|
|
19295
19317
|
}
|
|
19296
19318
|
}
|
|
19297
19319
|
function hasStaticWithDefaults(ctx) {
|
|
@@ -19342,6 +19364,7 @@ function inferValueType(node) {
|
|
|
19342
19364
|
|
|
19343
19365
|
function processPropsDestructure(ctx, declId) {
|
|
19344
19366
|
if (!ctx.options.propsDestructure && !ctx.options.reactivityTransform) {
|
|
19367
|
+
ctx.propsIdentifier = ctx.getString(declId);
|
|
19345
19368
|
return;
|
|
19346
19369
|
}
|
|
19347
19370
|
warnOnce(
|
|
@@ -20533,7 +20556,7 @@ function isStaticNode(node) {
|
|
|
20533
20556
|
}
|
|
20534
20557
|
}
|
|
20535
20558
|
|
|
20536
|
-
const version = "3.3.
|
|
20559
|
+
const version = "3.3.2";
|
|
20537
20560
|
const walk = estreeWalker.walk;
|
|
20538
20561
|
|
|
20539
20562
|
exports.babelParse = parser$2.parse;
|
|
@@ -21148,6 +21148,7 @@ const TS_NODE_TYPES = [
|
|
|
21148
21148
|
];
|
|
21149
21149
|
|
|
21150
21150
|
const isLiteralWhitelisted = /* @__PURE__ */ makeMap("true,false,null,this");
|
|
21151
|
+
const constantBailRE = /\w\s*\(|\.[^\d]/;
|
|
21151
21152
|
const transformExpression = (node, context) => {
|
|
21152
21153
|
if (node.type === 5) {
|
|
21153
21154
|
node.content = processExpression(
|
|
@@ -21237,7 +21238,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
21237
21238
|
return `_ctx.${raw}`;
|
|
21238
21239
|
};
|
|
21239
21240
|
const rawExp = node.content;
|
|
21240
|
-
const bailConstant =
|
|
21241
|
+
const bailConstant = constantBailRE.test(rawExp);
|
|
21241
21242
|
if (isSimpleIdentifier(rawExp)) {
|
|
21242
21243
|
const isScopeVarReference = context.identifiers[rawExp];
|
|
21243
21244
|
const isAllowedGlobal = isGloballyWhitelisted(rawExp);
|
|
@@ -26199,7 +26200,10 @@ function evaluateConstant(exp) {
|
|
|
26199
26200
|
const ignoreSideEffectTags = (node, context) => {
|
|
26200
26201
|
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
|
|
26201
26202
|
context.onError(
|
|
26202
|
-
createDOMCompilerError(
|
|
26203
|
+
createDOMCompilerError(
|
|
26204
|
+
63,
|
|
26205
|
+
node.loc
|
|
26206
|
+
)
|
|
26203
26207
|
);
|
|
26204
26208
|
context.removeNode();
|
|
26205
26209
|
}
|
|
@@ -26392,6 +26396,306 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
|
26392
26396
|
warnDeprecation: warnDeprecation
|
|
26393
26397
|
});
|
|
26394
26398
|
|
|
26399
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
26400
|
+
//
|
|
26401
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
26402
|
+
// copy of this software and associated documentation files (the
|
|
26403
|
+
// "Software"), to deal in the Software without restriction, including
|
|
26404
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
26405
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
26406
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
26407
|
+
// following conditions:
|
|
26408
|
+
//
|
|
26409
|
+
// The above copyright notice and this permission notice shall be included
|
|
26410
|
+
// in all copies or substantial portions of the Software.
|
|
26411
|
+
//
|
|
26412
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
26413
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26414
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
26415
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
26416
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
26417
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
26418
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26419
|
+
|
|
26420
|
+
// resolves . and .. elements in a path array with directory names there
|
|
26421
|
+
// must be no slashes, empty elements, or device names (c:\) in the array
|
|
26422
|
+
// (so also no leading and trailing slashes - it does not distinguish
|
|
26423
|
+
// relative and absolute paths)
|
|
26424
|
+
function normalizeArray(parts, allowAboveRoot) {
|
|
26425
|
+
// if the path tries to go above the root, `up` ends up > 0
|
|
26426
|
+
var up = 0;
|
|
26427
|
+
for (var i = parts.length - 1; i >= 0; i--) {
|
|
26428
|
+
var last = parts[i];
|
|
26429
|
+
if (last === '.') {
|
|
26430
|
+
parts.splice(i, 1);
|
|
26431
|
+
} else if (last === '..') {
|
|
26432
|
+
parts.splice(i, 1);
|
|
26433
|
+
up++;
|
|
26434
|
+
} else if (up) {
|
|
26435
|
+
parts.splice(i, 1);
|
|
26436
|
+
up--;
|
|
26437
|
+
}
|
|
26438
|
+
}
|
|
26439
|
+
|
|
26440
|
+
// if the path is allowed to go above the root, restore leading ..s
|
|
26441
|
+
if (allowAboveRoot) {
|
|
26442
|
+
for (; up--; up) {
|
|
26443
|
+
parts.unshift('..');
|
|
26444
|
+
}
|
|
26445
|
+
}
|
|
26446
|
+
|
|
26447
|
+
return parts;
|
|
26448
|
+
}
|
|
26449
|
+
|
|
26450
|
+
// Split a filename into [root, dir, basename, ext], unix version
|
|
26451
|
+
// 'root' is just a slash, or nothing.
|
|
26452
|
+
var splitPathRe =
|
|
26453
|
+
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
|
26454
|
+
var splitPath = function(filename) {
|
|
26455
|
+
return splitPathRe.exec(filename).slice(1);
|
|
26456
|
+
};
|
|
26457
|
+
|
|
26458
|
+
// path.resolve([from ...], to)
|
|
26459
|
+
// posix version
|
|
26460
|
+
function resolve$2() {
|
|
26461
|
+
var resolvedPath = '',
|
|
26462
|
+
resolvedAbsolute = false;
|
|
26463
|
+
|
|
26464
|
+
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
26465
|
+
var path = (i >= 0) ? arguments[i] : '/';
|
|
26466
|
+
|
|
26467
|
+
// Skip empty and invalid entries
|
|
26468
|
+
if (typeof path !== 'string') {
|
|
26469
|
+
throw new TypeError('Arguments to path.resolve must be strings');
|
|
26470
|
+
} else if (!path) {
|
|
26471
|
+
continue;
|
|
26472
|
+
}
|
|
26473
|
+
|
|
26474
|
+
resolvedPath = path + '/' + resolvedPath;
|
|
26475
|
+
resolvedAbsolute = path.charAt(0) === '/';
|
|
26476
|
+
}
|
|
26477
|
+
|
|
26478
|
+
// At this point the path should be resolved to a full absolute path, but
|
|
26479
|
+
// handle relative paths to be safe (might happen when process.cwd() fails)
|
|
26480
|
+
|
|
26481
|
+
// Normalize the path
|
|
26482
|
+
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
|
|
26483
|
+
return !!p;
|
|
26484
|
+
}), !resolvedAbsolute).join('/');
|
|
26485
|
+
|
|
26486
|
+
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
|
|
26487
|
+
}
|
|
26488
|
+
// path.normalize(path)
|
|
26489
|
+
// posix version
|
|
26490
|
+
function normalize$1(path) {
|
|
26491
|
+
var isPathAbsolute = isAbsolute$1(path),
|
|
26492
|
+
trailingSlash = substr(path, -1) === '/';
|
|
26493
|
+
|
|
26494
|
+
// Normalize the path
|
|
26495
|
+
path = normalizeArray(filter(path.split('/'), function(p) {
|
|
26496
|
+
return !!p;
|
|
26497
|
+
}), !isPathAbsolute).join('/');
|
|
26498
|
+
|
|
26499
|
+
if (!path && !isPathAbsolute) {
|
|
26500
|
+
path = '.';
|
|
26501
|
+
}
|
|
26502
|
+
if (path && trailingSlash) {
|
|
26503
|
+
path += '/';
|
|
26504
|
+
}
|
|
26505
|
+
|
|
26506
|
+
return (isPathAbsolute ? '/' : '') + path;
|
|
26507
|
+
}
|
|
26508
|
+
// posix version
|
|
26509
|
+
function isAbsolute$1(path) {
|
|
26510
|
+
return path.charAt(0) === '/';
|
|
26511
|
+
}
|
|
26512
|
+
|
|
26513
|
+
// posix version
|
|
26514
|
+
function join$1() {
|
|
26515
|
+
var paths = Array.prototype.slice.call(arguments, 0);
|
|
26516
|
+
return normalize$1(filter(paths, function(p, index) {
|
|
26517
|
+
if (typeof p !== 'string') {
|
|
26518
|
+
throw new TypeError('Arguments to path.join must be strings');
|
|
26519
|
+
}
|
|
26520
|
+
return p;
|
|
26521
|
+
}).join('/'));
|
|
26522
|
+
}
|
|
26523
|
+
|
|
26524
|
+
|
|
26525
|
+
// path.relative(from, to)
|
|
26526
|
+
// posix version
|
|
26527
|
+
function relative$1(from, to) {
|
|
26528
|
+
from = resolve$2(from).substr(1);
|
|
26529
|
+
to = resolve$2(to).substr(1);
|
|
26530
|
+
|
|
26531
|
+
function trim(arr) {
|
|
26532
|
+
var start = 0;
|
|
26533
|
+
for (; start < arr.length; start++) {
|
|
26534
|
+
if (arr[start] !== '') break;
|
|
26535
|
+
}
|
|
26536
|
+
|
|
26537
|
+
var end = arr.length - 1;
|
|
26538
|
+
for (; end >= 0; end--) {
|
|
26539
|
+
if (arr[end] !== '') break;
|
|
26540
|
+
}
|
|
26541
|
+
|
|
26542
|
+
if (start > end) return [];
|
|
26543
|
+
return arr.slice(start, end - start + 1);
|
|
26544
|
+
}
|
|
26545
|
+
|
|
26546
|
+
var fromParts = trim(from.split('/'));
|
|
26547
|
+
var toParts = trim(to.split('/'));
|
|
26548
|
+
|
|
26549
|
+
var length = Math.min(fromParts.length, toParts.length);
|
|
26550
|
+
var samePartsLength = length;
|
|
26551
|
+
for (var i = 0; i < length; i++) {
|
|
26552
|
+
if (fromParts[i] !== toParts[i]) {
|
|
26553
|
+
samePartsLength = i;
|
|
26554
|
+
break;
|
|
26555
|
+
}
|
|
26556
|
+
}
|
|
26557
|
+
|
|
26558
|
+
var outputParts = [];
|
|
26559
|
+
for (var i = samePartsLength; i < fromParts.length; i++) {
|
|
26560
|
+
outputParts.push('..');
|
|
26561
|
+
}
|
|
26562
|
+
|
|
26563
|
+
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
|
26564
|
+
|
|
26565
|
+
return outputParts.join('/');
|
|
26566
|
+
}
|
|
26567
|
+
|
|
26568
|
+
var sep$1 = '/';
|
|
26569
|
+
var delimiter$1 = ':';
|
|
26570
|
+
|
|
26571
|
+
function dirname$2(path) {
|
|
26572
|
+
var result = splitPath(path),
|
|
26573
|
+
root = result[0],
|
|
26574
|
+
dir = result[1];
|
|
26575
|
+
|
|
26576
|
+
if (!root && !dir) {
|
|
26577
|
+
// No dirname whatsoever
|
|
26578
|
+
return '.';
|
|
26579
|
+
}
|
|
26580
|
+
|
|
26581
|
+
if (dir) {
|
|
26582
|
+
// It has a dirname, strip trailing slash
|
|
26583
|
+
dir = dir.substr(0, dir.length - 1);
|
|
26584
|
+
}
|
|
26585
|
+
|
|
26586
|
+
return root + dir;
|
|
26587
|
+
}
|
|
26588
|
+
|
|
26589
|
+
function basename(path, ext) {
|
|
26590
|
+
var f = splitPath(path)[2];
|
|
26591
|
+
// TODO: make this comparison case-insensitive on windows?
|
|
26592
|
+
if (ext && f.substr(-1 * ext.length) === ext) {
|
|
26593
|
+
f = f.substr(0, f.length - ext.length);
|
|
26594
|
+
}
|
|
26595
|
+
return f;
|
|
26596
|
+
}
|
|
26597
|
+
|
|
26598
|
+
|
|
26599
|
+
function extname(path) {
|
|
26600
|
+
return splitPath(path)[3];
|
|
26601
|
+
}
|
|
26602
|
+
var path = {
|
|
26603
|
+
extname: extname,
|
|
26604
|
+
basename: basename,
|
|
26605
|
+
dirname: dirname$2,
|
|
26606
|
+
sep: sep$1,
|
|
26607
|
+
delimiter: delimiter$1,
|
|
26608
|
+
relative: relative$1,
|
|
26609
|
+
join: join$1,
|
|
26610
|
+
isAbsolute: isAbsolute$1,
|
|
26611
|
+
normalize: normalize$1,
|
|
26612
|
+
resolve: resolve$2
|
|
26613
|
+
};
|
|
26614
|
+
function filter (xs, f) {
|
|
26615
|
+
if (xs.filter) return xs.filter(f);
|
|
26616
|
+
var res = [];
|
|
26617
|
+
for (var i = 0; i < xs.length; i++) {
|
|
26618
|
+
if (f(xs[i], i, xs)) res.push(xs[i]);
|
|
26619
|
+
}
|
|
26620
|
+
return res;
|
|
26621
|
+
}
|
|
26622
|
+
|
|
26623
|
+
// String.prototype.substr - negative index don't work in IE8
|
|
26624
|
+
var substr = 'ab'.substr(-1) === 'b' ?
|
|
26625
|
+
function (str, start, len) { return str.substr(start, len) } :
|
|
26626
|
+
function (str, start, len) {
|
|
26627
|
+
if (start < 0) start = str.length + start;
|
|
26628
|
+
return str.substr(start, len);
|
|
26629
|
+
}
|
|
26630
|
+
;
|
|
26631
|
+
|
|
26632
|
+
var _polyfillNode_path = /*#__PURE__*/Object.freeze({
|
|
26633
|
+
__proto__: null,
|
|
26634
|
+
basename: basename,
|
|
26635
|
+
default: path,
|
|
26636
|
+
delimiter: delimiter$1,
|
|
26637
|
+
dirname: dirname$2,
|
|
26638
|
+
extname: extname,
|
|
26639
|
+
isAbsolute: isAbsolute$1,
|
|
26640
|
+
join: join$1,
|
|
26641
|
+
normalize: normalize$1,
|
|
26642
|
+
relative: relative$1,
|
|
26643
|
+
resolve: resolve$2,
|
|
26644
|
+
sep: sep$1
|
|
26645
|
+
});
|
|
26646
|
+
|
|
26647
|
+
const UNKNOWN_TYPE = "Unknown";
|
|
26648
|
+
function resolveObjectKey(node, computed) {
|
|
26649
|
+
switch (node.type) {
|
|
26650
|
+
case "StringLiteral":
|
|
26651
|
+
case "NumericLiteral":
|
|
26652
|
+
return String(node.value);
|
|
26653
|
+
case "Identifier":
|
|
26654
|
+
if (!computed)
|
|
26655
|
+
return node.name;
|
|
26656
|
+
}
|
|
26657
|
+
return void 0;
|
|
26658
|
+
}
|
|
26659
|
+
function concatStrings(strs) {
|
|
26660
|
+
return strs.filter((s) => !!s).join(", ");
|
|
26661
|
+
}
|
|
26662
|
+
function isLiteralNode(node) {
|
|
26663
|
+
return node.type.endsWith("Literal");
|
|
26664
|
+
}
|
|
26665
|
+
function unwrapTSNode(node) {
|
|
26666
|
+
if (TS_NODE_TYPES.includes(node.type)) {
|
|
26667
|
+
return unwrapTSNode(node.expression);
|
|
26668
|
+
} else {
|
|
26669
|
+
return node;
|
|
26670
|
+
}
|
|
26671
|
+
}
|
|
26672
|
+
function isCallOf(node, test) {
|
|
26673
|
+
return !!(node && test && node.type === "CallExpression" && node.callee.type === "Identifier" && (typeof test === "string" ? node.callee.name === test : test(node.callee.name)));
|
|
26674
|
+
}
|
|
26675
|
+
function toRuntimeTypeString(types) {
|
|
26676
|
+
return types.length > 1 ? `[${types.join(", ")}]` : types[0];
|
|
26677
|
+
}
|
|
26678
|
+
function getImportedName(specifier) {
|
|
26679
|
+
if (specifier.type === "ImportSpecifier")
|
|
26680
|
+
return specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
|
|
26681
|
+
else if (specifier.type === "ImportNamespaceSpecifier")
|
|
26682
|
+
return "*";
|
|
26683
|
+
return "default";
|
|
26684
|
+
}
|
|
26685
|
+
function getId(node) {
|
|
26686
|
+
return node.type === "Identifier" ? node.name : node.type === "StringLiteral" ? node.value : null;
|
|
26687
|
+
}
|
|
26688
|
+
const normalize = (path.posix || path).normalize;
|
|
26689
|
+
const windowsSlashRE = /\\/g;
|
|
26690
|
+
function normalizePath(p) {
|
|
26691
|
+
return normalize(p.replace(windowsSlashRE, "/"));
|
|
26692
|
+
}
|
|
26693
|
+
const joinPaths = (path.posix || path).join;
|
|
26694
|
+
const escapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
|
|
26695
|
+
function getEscapedKey(key) {
|
|
26696
|
+
return escapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
|
|
26697
|
+
}
|
|
26698
|
+
|
|
26395
26699
|
function pad$1 (hash, len) {
|
|
26396
26700
|
while (hash.length < len) {
|
|
26397
26701
|
hash = '0' + hash;
|
|
@@ -26474,10 +26778,7 @@ function genVarName(id, raw, isProd) {
|
|
|
26474
26778
|
if (isProd) {
|
|
26475
26779
|
return hash(id + raw);
|
|
26476
26780
|
} else {
|
|
26477
|
-
return `${id}-${raw.replace(
|
|
26478
|
-
/[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g,
|
|
26479
|
-
(s) => `\\${s}`
|
|
26480
|
-
)}`;
|
|
26781
|
+
return `${id}-${raw.replace(escapeSymbolsRE, (s) => `\\${s}`)}`;
|
|
26481
26782
|
}
|
|
26482
26783
|
}
|
|
26483
26784
|
function normalizeExpression(exp) {
|
|
@@ -26942,303 +27243,55 @@ function generateSourceMap(filename, source, generated, sourceRoot, lineOffset)
|
|
|
26942
27243
|
column: i
|
|
26943
27244
|
},
|
|
26944
27245
|
generated: {
|
|
26945
|
-
line: generatedLine,
|
|
26946
|
-
column: i
|
|
26947
|
-
}
|
|
26948
|
-
});
|
|
26949
|
-
}
|
|
26950
|
-
}
|
|
26951
|
-
}
|
|
26952
|
-
});
|
|
26953
|
-
return JSON.parse(map.toString());
|
|
26954
|
-
}
|
|
26955
|
-
function padContent(content, block, pad) {
|
|
26956
|
-
content = content.slice(0, block.loc.start.offset);
|
|
26957
|
-
if (pad === "space") {
|
|
26958
|
-
return content.replace(replaceRE, " ");
|
|
26959
|
-
} else {
|
|
26960
|
-
const offset = content.split(splitRE).length;
|
|
26961
|
-
const padChar = block.type === "script" && !block.lang ? "//\n" : "\n";
|
|
26962
|
-
return Array(offset).join(padChar);
|
|
26963
|
-
}
|
|
26964
|
-
}
|
|
26965
|
-
function hasSrc(node) {
|
|
26966
|
-
return node.props.some((p) => {
|
|
26967
|
-
if (p.type !== 6) {
|
|
26968
|
-
return false;
|
|
26969
|
-
}
|
|
26970
|
-
return p.name === "src";
|
|
26971
|
-
});
|
|
26972
|
-
}
|
|
26973
|
-
function isEmpty(node) {
|
|
26974
|
-
for (let i = 0; i < node.children.length; i++) {
|
|
26975
|
-
const child = node.children[i];
|
|
26976
|
-
if (child.type !== 2 || child.content.trim() !== "") {
|
|
26977
|
-
return false;
|
|
26978
|
-
}
|
|
26979
|
-
}
|
|
26980
|
-
return true;
|
|
26981
|
-
}
|
|
26982
|
-
function hmrShouldReload(prevImports, next) {
|
|
26983
|
-
if (!next.scriptSetup || next.scriptSetup.lang !== "ts" && next.scriptSetup.lang !== "tsx") {
|
|
26984
|
-
return false;
|
|
26985
|
-
}
|
|
26986
|
-
for (const key in prevImports) {
|
|
26987
|
-
if (!prevImports[key].isUsedInTemplate && isImportUsed(key, next)) {
|
|
26988
|
-
return true;
|
|
26989
|
-
}
|
|
26990
|
-
}
|
|
26991
|
-
return false;
|
|
26992
|
-
}
|
|
26993
|
-
|
|
26994
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
|
26995
|
-
//
|
|
26996
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
26997
|
-
// copy of this software and associated documentation files (the
|
|
26998
|
-
// "Software"), to deal in the Software without restriction, including
|
|
26999
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
|
27000
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
27001
|
-
// persons to whom the Software is furnished to do so, subject to the
|
|
27002
|
-
// following conditions:
|
|
27003
|
-
//
|
|
27004
|
-
// The above copyright notice and this permission notice shall be included
|
|
27005
|
-
// in all copies or substantial portions of the Software.
|
|
27006
|
-
//
|
|
27007
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
27008
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
27009
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
27010
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
27011
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
27012
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
27013
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27014
|
-
|
|
27015
|
-
// resolves . and .. elements in a path array with directory names there
|
|
27016
|
-
// must be no slashes, empty elements, or device names (c:\) in the array
|
|
27017
|
-
// (so also no leading and trailing slashes - it does not distinguish
|
|
27018
|
-
// relative and absolute paths)
|
|
27019
|
-
function normalizeArray(parts, allowAboveRoot) {
|
|
27020
|
-
// if the path tries to go above the root, `up` ends up > 0
|
|
27021
|
-
var up = 0;
|
|
27022
|
-
for (var i = parts.length - 1; i >= 0; i--) {
|
|
27023
|
-
var last = parts[i];
|
|
27024
|
-
if (last === '.') {
|
|
27025
|
-
parts.splice(i, 1);
|
|
27026
|
-
} else if (last === '..') {
|
|
27027
|
-
parts.splice(i, 1);
|
|
27028
|
-
up++;
|
|
27029
|
-
} else if (up) {
|
|
27030
|
-
parts.splice(i, 1);
|
|
27031
|
-
up--;
|
|
27032
|
-
}
|
|
27033
|
-
}
|
|
27034
|
-
|
|
27035
|
-
// if the path is allowed to go above the root, restore leading ..s
|
|
27036
|
-
if (allowAboveRoot) {
|
|
27037
|
-
for (; up--; up) {
|
|
27038
|
-
parts.unshift('..');
|
|
27039
|
-
}
|
|
27040
|
-
}
|
|
27041
|
-
|
|
27042
|
-
return parts;
|
|
27043
|
-
}
|
|
27044
|
-
|
|
27045
|
-
// Split a filename into [root, dir, basename, ext], unix version
|
|
27046
|
-
// 'root' is just a slash, or nothing.
|
|
27047
|
-
var splitPathRe =
|
|
27048
|
-
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
|
27049
|
-
var splitPath = function(filename) {
|
|
27050
|
-
return splitPathRe.exec(filename).slice(1);
|
|
27051
|
-
};
|
|
27052
|
-
|
|
27053
|
-
// path.resolve([from ...], to)
|
|
27054
|
-
// posix version
|
|
27055
|
-
function resolve$2() {
|
|
27056
|
-
var resolvedPath = '',
|
|
27057
|
-
resolvedAbsolute = false;
|
|
27058
|
-
|
|
27059
|
-
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
27060
|
-
var path = (i >= 0) ? arguments[i] : '/';
|
|
27061
|
-
|
|
27062
|
-
// Skip empty and invalid entries
|
|
27063
|
-
if (typeof path !== 'string') {
|
|
27064
|
-
throw new TypeError('Arguments to path.resolve must be strings');
|
|
27065
|
-
} else if (!path) {
|
|
27066
|
-
continue;
|
|
27246
|
+
line: generatedLine,
|
|
27247
|
+
column: i
|
|
27248
|
+
}
|
|
27249
|
+
});
|
|
27250
|
+
}
|
|
27251
|
+
}
|
|
27067
27252
|
}
|
|
27068
|
-
|
|
27069
|
-
|
|
27070
|
-
resolvedAbsolute = path.charAt(0) === '/';
|
|
27071
|
-
}
|
|
27072
|
-
|
|
27073
|
-
// At this point the path should be resolved to a full absolute path, but
|
|
27074
|
-
// handle relative paths to be safe (might happen when process.cwd() fails)
|
|
27075
|
-
|
|
27076
|
-
// Normalize the path
|
|
27077
|
-
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
|
|
27078
|
-
return !!p;
|
|
27079
|
-
}), !resolvedAbsolute).join('/');
|
|
27080
|
-
|
|
27081
|
-
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
|
|
27253
|
+
});
|
|
27254
|
+
return JSON.parse(map.toString());
|
|
27082
27255
|
}
|
|
27083
|
-
|
|
27084
|
-
|
|
27085
|
-
|
|
27086
|
-
|
|
27087
|
-
|
|
27088
|
-
|
|
27089
|
-
|
|
27090
|
-
|
|
27091
|
-
return !!p;
|
|
27092
|
-
}), !isPathAbsolute).join('/');
|
|
27093
|
-
|
|
27094
|
-
if (!path && !isPathAbsolute) {
|
|
27095
|
-
path = '.';
|
|
27096
|
-
}
|
|
27097
|
-
if (path && trailingSlash) {
|
|
27098
|
-
path += '/';
|
|
27256
|
+
function padContent(content, block, pad) {
|
|
27257
|
+
content = content.slice(0, block.loc.start.offset);
|
|
27258
|
+
if (pad === "space") {
|
|
27259
|
+
return content.replace(replaceRE, " ");
|
|
27260
|
+
} else {
|
|
27261
|
+
const offset = content.split(splitRE).length;
|
|
27262
|
+
const padChar = block.type === "script" && !block.lang ? "//\n" : "\n";
|
|
27263
|
+
return Array(offset).join(padChar);
|
|
27099
27264
|
}
|
|
27100
|
-
|
|
27101
|
-
return (isPathAbsolute ? '/' : '') + path;
|
|
27102
27265
|
}
|
|
27103
|
-
|
|
27104
|
-
|
|
27105
|
-
|
|
27106
|
-
|
|
27107
|
-
|
|
27108
|
-
// posix version
|
|
27109
|
-
function join$1() {
|
|
27110
|
-
var paths = Array.prototype.slice.call(arguments, 0);
|
|
27111
|
-
return normalize$1(filter(paths, function(p, index) {
|
|
27112
|
-
if (typeof p !== 'string') {
|
|
27113
|
-
throw new TypeError('Arguments to path.join must be strings');
|
|
27266
|
+
function hasSrc(node) {
|
|
27267
|
+
return node.props.some((p) => {
|
|
27268
|
+
if (p.type !== 6) {
|
|
27269
|
+
return false;
|
|
27114
27270
|
}
|
|
27115
|
-
return p;
|
|
27116
|
-
})
|
|
27271
|
+
return p.name === "src";
|
|
27272
|
+
});
|
|
27117
27273
|
}
|
|
27118
|
-
|
|
27119
|
-
|
|
27120
|
-
|
|
27121
|
-
|
|
27122
|
-
|
|
27123
|
-
from = resolve$2(from).substr(1);
|
|
27124
|
-
to = resolve$2(to).substr(1);
|
|
27125
|
-
|
|
27126
|
-
function trim(arr) {
|
|
27127
|
-
var start = 0;
|
|
27128
|
-
for (; start < arr.length; start++) {
|
|
27129
|
-
if (arr[start] !== '') break;
|
|
27130
|
-
}
|
|
27131
|
-
|
|
27132
|
-
var end = arr.length - 1;
|
|
27133
|
-
for (; end >= 0; end--) {
|
|
27134
|
-
if (arr[end] !== '') break;
|
|
27135
|
-
}
|
|
27136
|
-
|
|
27137
|
-
if (start > end) return [];
|
|
27138
|
-
return arr.slice(start, end - start + 1);
|
|
27139
|
-
}
|
|
27140
|
-
|
|
27141
|
-
var fromParts = trim(from.split('/'));
|
|
27142
|
-
var toParts = trim(to.split('/'));
|
|
27143
|
-
|
|
27144
|
-
var length = Math.min(fromParts.length, toParts.length);
|
|
27145
|
-
var samePartsLength = length;
|
|
27146
|
-
for (var i = 0; i < length; i++) {
|
|
27147
|
-
if (fromParts[i] !== toParts[i]) {
|
|
27148
|
-
samePartsLength = i;
|
|
27149
|
-
break;
|
|
27274
|
+
function isEmpty(node) {
|
|
27275
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
27276
|
+
const child = node.children[i];
|
|
27277
|
+
if (child.type !== 2 || child.content.trim() !== "") {
|
|
27278
|
+
return false;
|
|
27150
27279
|
}
|
|
27151
27280
|
}
|
|
27152
|
-
|
|
27153
|
-
var outputParts = [];
|
|
27154
|
-
for (var i = samePartsLength; i < fromParts.length; i++) {
|
|
27155
|
-
outputParts.push('..');
|
|
27156
|
-
}
|
|
27157
|
-
|
|
27158
|
-
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
|
27159
|
-
|
|
27160
|
-
return outputParts.join('/');
|
|
27161
|
-
}
|
|
27162
|
-
|
|
27163
|
-
var sep$1 = '/';
|
|
27164
|
-
var delimiter$1 = ':';
|
|
27165
|
-
|
|
27166
|
-
function dirname$2(path) {
|
|
27167
|
-
var result = splitPath(path),
|
|
27168
|
-
root = result[0],
|
|
27169
|
-
dir = result[1];
|
|
27170
|
-
|
|
27171
|
-
if (!root && !dir) {
|
|
27172
|
-
// No dirname whatsoever
|
|
27173
|
-
return '.';
|
|
27174
|
-
}
|
|
27175
|
-
|
|
27176
|
-
if (dir) {
|
|
27177
|
-
// It has a dirname, strip trailing slash
|
|
27178
|
-
dir = dir.substr(0, dir.length - 1);
|
|
27179
|
-
}
|
|
27180
|
-
|
|
27181
|
-
return root + dir;
|
|
27281
|
+
return true;
|
|
27182
27282
|
}
|
|
27183
|
-
|
|
27184
|
-
|
|
27185
|
-
|
|
27186
|
-
// TODO: make this comparison case-insensitive on windows?
|
|
27187
|
-
if (ext && f.substr(-1 * ext.length) === ext) {
|
|
27188
|
-
f = f.substr(0, f.length - ext.length);
|
|
27283
|
+
function hmrShouldReload(prevImports, next) {
|
|
27284
|
+
if (!next.scriptSetup || next.scriptSetup.lang !== "ts" && next.scriptSetup.lang !== "tsx") {
|
|
27285
|
+
return false;
|
|
27189
27286
|
}
|
|
27190
|
-
|
|
27191
|
-
|
|
27192
|
-
|
|
27193
|
-
|
|
27194
|
-
function extname(path) {
|
|
27195
|
-
return splitPath(path)[3];
|
|
27196
|
-
}
|
|
27197
|
-
var path = {
|
|
27198
|
-
extname: extname,
|
|
27199
|
-
basename: basename,
|
|
27200
|
-
dirname: dirname$2,
|
|
27201
|
-
sep: sep$1,
|
|
27202
|
-
delimiter: delimiter$1,
|
|
27203
|
-
relative: relative$1,
|
|
27204
|
-
join: join$1,
|
|
27205
|
-
isAbsolute: isAbsolute$1,
|
|
27206
|
-
normalize: normalize$1,
|
|
27207
|
-
resolve: resolve$2
|
|
27208
|
-
};
|
|
27209
|
-
function filter (xs, f) {
|
|
27210
|
-
if (xs.filter) return xs.filter(f);
|
|
27211
|
-
var res = [];
|
|
27212
|
-
for (var i = 0; i < xs.length; i++) {
|
|
27213
|
-
if (f(xs[i], i, xs)) res.push(xs[i]);
|
|
27287
|
+
for (const key in prevImports) {
|
|
27288
|
+
if (!prevImports[key].isUsedInTemplate && isImportUsed(key, next)) {
|
|
27289
|
+
return true;
|
|
27214
27290
|
}
|
|
27215
|
-
|
|
27291
|
+
}
|
|
27292
|
+
return false;
|
|
27216
27293
|
}
|
|
27217
27294
|
|
|
27218
|
-
// String.prototype.substr - negative index don't work in IE8
|
|
27219
|
-
var substr = 'ab'.substr(-1) === 'b' ?
|
|
27220
|
-
function (str, start, len) { return str.substr(start, len) } :
|
|
27221
|
-
function (str, start, len) {
|
|
27222
|
-
if (start < 0) start = str.length + start;
|
|
27223
|
-
return str.substr(start, len);
|
|
27224
|
-
}
|
|
27225
|
-
;
|
|
27226
|
-
|
|
27227
|
-
var _polyfillNode_path = /*#__PURE__*/Object.freeze({
|
|
27228
|
-
__proto__: null,
|
|
27229
|
-
basename: basename,
|
|
27230
|
-
default: path,
|
|
27231
|
-
delimiter: delimiter$1,
|
|
27232
|
-
dirname: dirname$2,
|
|
27233
|
-
extname: extname,
|
|
27234
|
-
isAbsolute: isAbsolute$1,
|
|
27235
|
-
join: join$1,
|
|
27236
|
-
normalize: normalize$1,
|
|
27237
|
-
relative: relative$1,
|
|
27238
|
-
resolve: resolve$2,
|
|
27239
|
-
sep: sep$1
|
|
27240
|
-
});
|
|
27241
|
-
|
|
27242
27295
|
var global$1 = (typeof global !== "undefined" ? global :
|
|
27243
27296
|
typeof self !== "undefined" ? self :
|
|
27244
27297
|
typeof window !== "undefined" ? window : {});
|
|
@@ -47217,54 +47270,6 @@ function warn(msg) {
|
|
|
47217
47270
|
);
|
|
47218
47271
|
}
|
|
47219
47272
|
|
|
47220
|
-
const UNKNOWN_TYPE = "Unknown";
|
|
47221
|
-
function resolveObjectKey(node, computed) {
|
|
47222
|
-
switch (node.type) {
|
|
47223
|
-
case "StringLiteral":
|
|
47224
|
-
case "NumericLiteral":
|
|
47225
|
-
return String(node.value);
|
|
47226
|
-
case "Identifier":
|
|
47227
|
-
if (!computed)
|
|
47228
|
-
return node.name;
|
|
47229
|
-
}
|
|
47230
|
-
return void 0;
|
|
47231
|
-
}
|
|
47232
|
-
function concatStrings(strs) {
|
|
47233
|
-
return strs.filter((s) => !!s).join(", ");
|
|
47234
|
-
}
|
|
47235
|
-
function isLiteralNode(node) {
|
|
47236
|
-
return node.type.endsWith("Literal");
|
|
47237
|
-
}
|
|
47238
|
-
function unwrapTSNode(node) {
|
|
47239
|
-
if (TS_NODE_TYPES.includes(node.type)) {
|
|
47240
|
-
return unwrapTSNode(node.expression);
|
|
47241
|
-
} else {
|
|
47242
|
-
return node;
|
|
47243
|
-
}
|
|
47244
|
-
}
|
|
47245
|
-
function isCallOf(node, test) {
|
|
47246
|
-
return !!(node && test && node.type === "CallExpression" && node.callee.type === "Identifier" && (typeof test === "string" ? node.callee.name === test : test(node.callee.name)));
|
|
47247
|
-
}
|
|
47248
|
-
function toRuntimeTypeString(types) {
|
|
47249
|
-
return types.length > 1 ? `[${types.join(", ")}]` : types[0];
|
|
47250
|
-
}
|
|
47251
|
-
function getImportedName(specifier) {
|
|
47252
|
-
if (specifier.type === "ImportSpecifier")
|
|
47253
|
-
return specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
|
|
47254
|
-
else if (specifier.type === "ImportNamespaceSpecifier")
|
|
47255
|
-
return "*";
|
|
47256
|
-
return "default";
|
|
47257
|
-
}
|
|
47258
|
-
function getId(node) {
|
|
47259
|
-
return node.type === "Identifier" ? node.name : node.type === "StringLiteral" ? node.value : null;
|
|
47260
|
-
}
|
|
47261
|
-
const normalize = (path.posix || path).normalize;
|
|
47262
|
-
const windowsSlashRE = /\\/g;
|
|
47263
|
-
function normalizePath(p) {
|
|
47264
|
-
return normalize(p.replace(windowsSlashRE, "/"));
|
|
47265
|
-
}
|
|
47266
|
-
const joinPaths = (path.posix || path).join;
|
|
47267
|
-
|
|
47268
47273
|
function analyzeScriptBindings(ast) {
|
|
47269
47274
|
for (const node of ast) {
|
|
47270
47275
|
if (node.type === "ExportDefaultDeclaration" && node.declaration.type === "ObjectExpression") {
|
|
@@ -47590,7 +47595,7 @@ ${generateCodeFrame(
|
|
|
47590
47595
|
);
|
|
47591
47596
|
}
|
|
47592
47597
|
}
|
|
47593
|
-
function resolveParserPlugins(lang, userPlugins) {
|
|
47598
|
+
function resolveParserPlugins(lang, userPlugins, dts = false) {
|
|
47594
47599
|
const plugins = [];
|
|
47595
47600
|
if (lang === "jsx" || lang === "tsx") {
|
|
47596
47601
|
plugins.push("jsx");
|
|
@@ -47598,7 +47603,7 @@ function resolveParserPlugins(lang, userPlugins) {
|
|
|
47598
47603
|
userPlugins = userPlugins.filter((p) => p !== "jsx");
|
|
47599
47604
|
}
|
|
47600
47605
|
if (lang === "ts" || lang === "tsx") {
|
|
47601
|
-
plugins.push("typescript");
|
|
47606
|
+
plugins.push(["typescript", { dts }]);
|
|
47602
47607
|
if (!plugins.includes("decorators")) {
|
|
47603
47608
|
plugins.push("decorators-legacy");
|
|
47604
47609
|
}
|
|
@@ -47813,11 +47818,26 @@ function resolveInterfaceMembers(ctx, node, scope) {
|
|
|
47813
47818
|
const base = typeElementsToMap(ctx, node.body.body, node._ownerScope);
|
|
47814
47819
|
if (node.extends) {
|
|
47815
47820
|
for (const ext of node.extends) {
|
|
47816
|
-
|
|
47817
|
-
|
|
47818
|
-
|
|
47819
|
-
|
|
47821
|
+
if (ext.leadingComments && ext.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
|
|
47822
|
+
continue;
|
|
47823
|
+
}
|
|
47824
|
+
try {
|
|
47825
|
+
const { props } = resolveTypeElements(ctx, ext, scope);
|
|
47826
|
+
for (const key in props) {
|
|
47827
|
+
if (!hasOwn(base.props, key)) {
|
|
47828
|
+
base.props[key] = props[key];
|
|
47829
|
+
}
|
|
47820
47830
|
}
|
|
47831
|
+
} catch (e) {
|
|
47832
|
+
ctx.error(
|
|
47833
|
+
`Failed to resolve extends base type.
|
|
47834
|
+
If this previously worked in 3.2, you can instruct the compiler to ignore this extend by adding /* @vue-ignore */ before it, for example:
|
|
47835
|
+
|
|
47836
|
+
interface Props extends /* @vue-ignore */ Base {}
|
|
47837
|
+
|
|
47838
|
+
Note: both in 3.2 or with the ignore, the properties in the base type are treated as fallthrough attrs at runtime.`,
|
|
47839
|
+
ext
|
|
47840
|
+
);
|
|
47821
47841
|
}
|
|
47822
47842
|
}
|
|
47823
47843
|
}
|
|
@@ -48184,7 +48204,11 @@ function parseFile(filename, content, parserPlugins) {
|
|
|
48184
48204
|
const ext = extname(filename);
|
|
48185
48205
|
if (ext === ".ts" || ext === ".tsx") {
|
|
48186
48206
|
return parse_1$1(content, {
|
|
48187
|
-
plugins: resolveParserPlugins(
|
|
48207
|
+
plugins: resolveParserPlugins(
|
|
48208
|
+
ext.slice(1),
|
|
48209
|
+
parserPlugins,
|
|
48210
|
+
filename.endsWith(".d.ts")
|
|
48211
|
+
),
|
|
48188
48212
|
sourceType: "module"
|
|
48189
48213
|
}).program.body;
|
|
48190
48214
|
} else if (ext === ".vue") {
|
|
@@ -48867,9 +48891,10 @@ function genRuntimeProps(ctx) {
|
|
|
48867
48891
|
const defaults = [];
|
|
48868
48892
|
for (const key in ctx.propsDestructuredBindings) {
|
|
48869
48893
|
const d = genDestructuredDefaultValue(ctx, key);
|
|
48894
|
+
const finalKey = getEscapedKey(key);
|
|
48870
48895
|
if (d)
|
|
48871
48896
|
defaults.push(
|
|
48872
|
-
`${
|
|
48897
|
+
`${finalKey}: ${d.valueString}${d.needSkipFactory ? `, __skip_${finalKey}: true` : ``}`
|
|
48873
48898
|
);
|
|
48874
48899
|
}
|
|
48875
48900
|
if (defaults.length) {
|
|
@@ -48958,8 +48983,9 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
|
|
|
48958
48983
|
}
|
|
48959
48984
|
}
|
|
48960
48985
|
}
|
|
48986
|
+
const finalKey = getEscapedKey(key);
|
|
48961
48987
|
if (!ctx.options.isProd) {
|
|
48962
|
-
return `${
|
|
48988
|
+
return `${finalKey}: { ${concatStrings([
|
|
48963
48989
|
`type: ${toRuntimeTypeString(type)}`,
|
|
48964
48990
|
`required: ${required}`,
|
|
48965
48991
|
skipCheck && "skipCheck: true",
|
|
@@ -48968,12 +48994,12 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
|
|
|
48968
48994
|
} else if (type.some(
|
|
48969
48995
|
(el) => el === "Boolean" || (!hasStaticDefaults || defaultString) && el === "Function"
|
|
48970
48996
|
)) {
|
|
48971
|
-
return `${
|
|
48997
|
+
return `${finalKey}: { ${concatStrings([
|
|
48972
48998
|
`type: ${toRuntimeTypeString(type)}`,
|
|
48973
48999
|
defaultString
|
|
48974
49000
|
])} }`;
|
|
48975
49001
|
} else {
|
|
48976
|
-
return `${
|
|
49002
|
+
return `${finalKey}: ${defaultString ? `{ ${defaultString} }` : `{}`}`;
|
|
48977
49003
|
}
|
|
48978
49004
|
}
|
|
48979
49005
|
function hasStaticWithDefaults(ctx) {
|
|
@@ -49024,6 +49050,7 @@ function inferValueType(node) {
|
|
|
49024
49050
|
|
|
49025
49051
|
function processPropsDestructure(ctx, declId) {
|
|
49026
49052
|
if (!ctx.options.propsDestructure && !ctx.options.reactivityTransform) {
|
|
49053
|
+
ctx.propsIdentifier = ctx.getString(declId);
|
|
49027
49054
|
return;
|
|
49028
49055
|
}
|
|
49029
49056
|
warnOnce$4(
|
|
@@ -50229,7 +50256,7 @@ function isStaticNode(node) {
|
|
|
50229
50256
|
}
|
|
50230
50257
|
}
|
|
50231
50258
|
|
|
50232
|
-
const version = "3.3.
|
|
50259
|
+
const version = "3.3.2";
|
|
50233
50260
|
const walk = walk$1;
|
|
50234
50261
|
|
|
50235
50262
|
export { MagicString, parse_1$1 as babelParse, compileScript, compileStyle, compileStyleAsync, compileTemplate, extractIdentifiers, generateCodeFrame, inferRuntimeType, invalidateTypeCache, isInDestructureAssignment, isStaticProperty, parse$7 as parse, parseCache, registerTS, resolveTypeElements, rewriteDefault, rewriteDefaultAST, shouldTransform as shouldTransformRef, transform as transformRef, transformAST as transformRefAST, version, walk, walkIdentifiers };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-sfc",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "@vue/compiler-sfc",
|
|
5
5
|
"main": "dist/compiler-sfc.cjs.js",
|
|
6
6
|
"module": "dist/compiler-sfc.esm-browser.js",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/parser": "^7.20.15",
|
|
36
|
-
"@vue/compiler-core": "3.3.
|
|
37
|
-
"@vue/compiler-dom": "3.3.
|
|
38
|
-
"@vue/compiler-ssr": "3.3.
|
|
39
|
-
"@vue/reactivity-transform": "3.3.
|
|
40
|
-
"@vue/shared": "3.3.
|
|
36
|
+
"@vue/compiler-core": "3.3.2",
|
|
37
|
+
"@vue/compiler-dom": "3.3.2",
|
|
38
|
+
"@vue/compiler-ssr": "3.3.2",
|
|
39
|
+
"@vue/reactivity-transform": "3.3.2",
|
|
40
|
+
"@vue/shared": "3.3.2",
|
|
41
41
|
"estree-walker": "^2.0.2",
|
|
42
42
|
"magic-string": "^0.30.0",
|
|
43
43
|
"postcss": "^8.1.10",
|