@vue/compiler-sfc 3.3.1 → 3.3.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/compiler-sfc.cjs.js +171 -109
- package/dist/compiler-sfc.d.ts +5 -1
- package/dist/compiler-sfc.esm-browser.js +403 -341
- package/package.json +6 -6
|
@@ -146,7 +146,7 @@ function normalizeStyle(value) {
|
|
|
146
146
|
}
|
|
147
147
|
const listDelimiterRE = /;(?![^(]*\))/g;
|
|
148
148
|
const propertyDelimiterRE = /:([^]+)/;
|
|
149
|
-
const styleCommentRE =
|
|
149
|
+
const styleCommentRE = /\/\*[^]*?\*\//g;
|
|
150
150
|
function parseStringStyle(cssText) {
|
|
151
151
|
const ret = {};
|
|
152
152
|
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
|
@@ -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) {
|
|
@@ -26662,7 +26963,8 @@ function processExp(exp, dir) {
|
|
|
26662
26963
|
} else if (dir === "for") {
|
|
26663
26964
|
const inMatch = exp.match(forAliasRE);
|
|
26664
26965
|
if (inMatch) {
|
|
26665
|
-
|
|
26966
|
+
let [, LHS, RHS] = inMatch;
|
|
26967
|
+
LHS = LHS.trim().replace(/^\(|\)$/g, "");
|
|
26666
26968
|
return processExp(`(${LHS})=>{}`) + processExp(RHS);
|
|
26667
26969
|
}
|
|
26668
26970
|
}
|
|
@@ -26991,254 +27293,6 @@ function hmrShouldReload(prevImports, next) {
|
|
|
26991
27293
|
return false;
|
|
26992
27294
|
}
|
|
26993
27295
|
|
|
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;
|
|
27067
|
-
}
|
|
27068
|
-
|
|
27069
|
-
resolvedPath = path + '/' + resolvedPath;
|
|
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) || '.';
|
|
27082
|
-
}
|
|
27083
|
-
// path.normalize(path)
|
|
27084
|
-
// posix version
|
|
27085
|
-
function normalize$1(path) {
|
|
27086
|
-
var isPathAbsolute = isAbsolute$1(path),
|
|
27087
|
-
trailingSlash = substr(path, -1) === '/';
|
|
27088
|
-
|
|
27089
|
-
// Normalize the path
|
|
27090
|
-
path = normalizeArray(filter(path.split('/'), function(p) {
|
|
27091
|
-
return !!p;
|
|
27092
|
-
}), !isPathAbsolute).join('/');
|
|
27093
|
-
|
|
27094
|
-
if (!path && !isPathAbsolute) {
|
|
27095
|
-
path = '.';
|
|
27096
|
-
}
|
|
27097
|
-
if (path && trailingSlash) {
|
|
27098
|
-
path += '/';
|
|
27099
|
-
}
|
|
27100
|
-
|
|
27101
|
-
return (isPathAbsolute ? '/' : '') + path;
|
|
27102
|
-
}
|
|
27103
|
-
// posix version
|
|
27104
|
-
function isAbsolute$1(path) {
|
|
27105
|
-
return path.charAt(0) === '/';
|
|
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');
|
|
27114
|
-
}
|
|
27115
|
-
return p;
|
|
27116
|
-
}).join('/'));
|
|
27117
|
-
}
|
|
27118
|
-
|
|
27119
|
-
|
|
27120
|
-
// path.relative(from, to)
|
|
27121
|
-
// posix version
|
|
27122
|
-
function relative$1(from, to) {
|
|
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;
|
|
27150
|
-
}
|
|
27151
|
-
}
|
|
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;
|
|
27182
|
-
}
|
|
27183
|
-
|
|
27184
|
-
function basename(path, ext) {
|
|
27185
|
-
var f = splitPath(path)[2];
|
|
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);
|
|
27189
|
-
}
|
|
27190
|
-
return f;
|
|
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]);
|
|
27214
|
-
}
|
|
27215
|
-
return res;
|
|
27216
|
-
}
|
|
27217
|
-
|
|
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
27296
|
var global$1 = (typeof global !== "undefined" ? global :
|
|
27243
27297
|
typeof self !== "undefined" ? self :
|
|
27244
27298
|
typeof window !== "undefined" ? window : {});
|
|
@@ -47217,54 +47271,6 @@ function warn(msg) {
|
|
|
47217
47271
|
);
|
|
47218
47272
|
}
|
|
47219
47273
|
|
|
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
47274
|
function analyzeScriptBindings(ast) {
|
|
47269
47275
|
for (const node of ast) {
|
|
47270
47276
|
if (node.type === "ExportDefaultDeclaration" && node.declaration.type === "ObjectExpression") {
|
|
@@ -47590,7 +47596,7 @@ ${generateCodeFrame(
|
|
|
47590
47596
|
);
|
|
47591
47597
|
}
|
|
47592
47598
|
}
|
|
47593
|
-
function resolveParserPlugins(lang, userPlugins) {
|
|
47599
|
+
function resolveParserPlugins(lang, userPlugins, dts = false) {
|
|
47594
47600
|
const plugins = [];
|
|
47595
47601
|
if (lang === "jsx" || lang === "tsx") {
|
|
47596
47602
|
plugins.push("jsx");
|
|
@@ -47598,7 +47604,7 @@ function resolveParserPlugins(lang, userPlugins) {
|
|
|
47598
47604
|
userPlugins = userPlugins.filter((p) => p !== "jsx");
|
|
47599
47605
|
}
|
|
47600
47606
|
if (lang === "ts" || lang === "tsx") {
|
|
47601
|
-
plugins.push("typescript");
|
|
47607
|
+
plugins.push(["typescript", { dts }]);
|
|
47602
47608
|
if (!plugins.includes("decorators")) {
|
|
47603
47609
|
plugins.push("decorators-legacy");
|
|
47604
47610
|
}
|
|
@@ -47813,11 +47819,26 @@ function resolveInterfaceMembers(ctx, node, scope) {
|
|
|
47813
47819
|
const base = typeElementsToMap(ctx, node.body.body, node._ownerScope);
|
|
47814
47820
|
if (node.extends) {
|
|
47815
47821
|
for (const ext of node.extends) {
|
|
47816
|
-
|
|
47817
|
-
|
|
47818
|
-
|
|
47819
|
-
|
|
47822
|
+
if (ext.leadingComments && ext.leadingComments.some((c) => c.value.includes("@vue-ignore"))) {
|
|
47823
|
+
continue;
|
|
47824
|
+
}
|
|
47825
|
+
try {
|
|
47826
|
+
const { props } = resolveTypeElements(ctx, ext, scope);
|
|
47827
|
+
for (const key in props) {
|
|
47828
|
+
if (!hasOwn(base.props, key)) {
|
|
47829
|
+
base.props[key] = props[key];
|
|
47830
|
+
}
|
|
47820
47831
|
}
|
|
47832
|
+
} catch (e) {
|
|
47833
|
+
ctx.error(
|
|
47834
|
+
`Failed to resolve extends base type.
|
|
47835
|
+
If this previously worked in 3.2, you can instruct the compiler to ignore this extend by adding /* @vue-ignore */ before it, for example:
|
|
47836
|
+
|
|
47837
|
+
interface Props extends /* @vue-ignore */ Base {}
|
|
47838
|
+
|
|
47839
|
+
Note: both in 3.2 or with the ignore, the properties in the base type are treated as fallthrough attrs at runtime.`,
|
|
47840
|
+
ext
|
|
47841
|
+
);
|
|
47821
47842
|
}
|
|
47822
47843
|
}
|
|
47823
47844
|
}
|
|
@@ -48082,7 +48103,7 @@ function qualifiedNameToPath(node) {
|
|
|
48082
48103
|
}
|
|
48083
48104
|
function resolveGlobalScope(ctx) {
|
|
48084
48105
|
if (ctx.options.globalTypeFiles) {
|
|
48085
|
-
const fs = ctx
|
|
48106
|
+
const fs = resolveFS(ctx);
|
|
48086
48107
|
if (!fs) {
|
|
48087
48108
|
throw new Error("[vue/compiler-sfc] globalTypeFiles requires fs access.");
|
|
48088
48109
|
}
|
|
@@ -48095,15 +48116,38 @@ let ts;
|
|
|
48095
48116
|
function registerTS(_ts) {
|
|
48096
48117
|
ts = _ts;
|
|
48097
48118
|
}
|
|
48119
|
+
function resolveFS(ctx) {
|
|
48120
|
+
if (ctx.fs) {
|
|
48121
|
+
return ctx.fs;
|
|
48122
|
+
}
|
|
48123
|
+
const fs = ctx.options.fs || ts.sys;
|
|
48124
|
+
if (!fs) {
|
|
48125
|
+
return;
|
|
48126
|
+
}
|
|
48127
|
+
return ctx.fs = {
|
|
48128
|
+
fileExists(file) {
|
|
48129
|
+
if (file.endsWith(".vue.ts")) {
|
|
48130
|
+
file = file.replace(/\.ts$/, "");
|
|
48131
|
+
}
|
|
48132
|
+
return fs.fileExists(file);
|
|
48133
|
+
},
|
|
48134
|
+
readFile(file) {
|
|
48135
|
+
if (file.endsWith(".vue.ts")) {
|
|
48136
|
+
file = file.replace(/\.ts$/, "");
|
|
48137
|
+
}
|
|
48138
|
+
return fs.readFile(file);
|
|
48139
|
+
}
|
|
48140
|
+
};
|
|
48141
|
+
}
|
|
48098
48142
|
function resolveTypeFromImport(ctx, node, name, scope) {
|
|
48099
48143
|
const { source, imported } = scope.imports[name];
|
|
48100
48144
|
const sourceScope = importSourceToScope(ctx, node, scope, source);
|
|
48101
48145
|
return resolveTypeReference(ctx, node, sourceScope, imported, true);
|
|
48102
48146
|
}
|
|
48103
48147
|
function importSourceToScope(ctx, node, scope, source) {
|
|
48104
|
-
const fs = ctx
|
|
48148
|
+
const fs = resolveFS(ctx);
|
|
48105
48149
|
if (!fs) {
|
|
48106
|
-
ctx.error(
|
|
48150
|
+
return ctx.error(
|
|
48107
48151
|
`No fs option provided to \`compileScript\` in non-Node environment. File system access is required for resolving imported types.`,
|
|
48108
48152
|
node,
|
|
48109
48153
|
scope
|
|
@@ -48147,6 +48191,7 @@ function importSourceToScope(ctx, node, scope, source) {
|
|
|
48147
48191
|
}
|
|
48148
48192
|
}
|
|
48149
48193
|
function resolveExt(filename, fs) {
|
|
48194
|
+
filename = filename.replace(/\.js$/, "");
|
|
48150
48195
|
const tryResolve = (filename2) => {
|
|
48151
48196
|
if (fs.fileExists(filename2))
|
|
48152
48197
|
return filename2;
|
|
@@ -48172,7 +48217,7 @@ function fileToScope(ctx, filename, asGlobal = false) {
|
|
|
48172
48217
|
if (cached) {
|
|
48173
48218
|
return cached;
|
|
48174
48219
|
}
|
|
48175
|
-
const fs = ctx
|
|
48220
|
+
const fs = resolveFS(ctx);
|
|
48176
48221
|
const source = fs.readFile(filename) || "";
|
|
48177
48222
|
const body = parseFile(filename, source, ctx.options.babelParserPlugins);
|
|
48178
48223
|
const scope = new TypeScope(filename, source, 0, recordImports(body));
|
|
@@ -48184,7 +48229,11 @@ function parseFile(filename, content, parserPlugins) {
|
|
|
48184
48229
|
const ext = extname(filename);
|
|
48185
48230
|
if (ext === ".ts" || ext === ".tsx") {
|
|
48186
48231
|
return parse_1$1(content, {
|
|
48187
|
-
plugins: resolveParserPlugins(
|
|
48232
|
+
plugins: resolveParserPlugins(
|
|
48233
|
+
ext.slice(1),
|
|
48234
|
+
parserPlugins,
|
|
48235
|
+
filename.endsWith(".d.ts")
|
|
48236
|
+
),
|
|
48188
48237
|
sourceType: "module"
|
|
48189
48238
|
}).program.body;
|
|
48190
48239
|
} else if (ext === ".vue") {
|
|
@@ -48699,6 +48748,20 @@ function resolveReturnType(ctx, arg, scope) {
|
|
|
48699
48748
|
return resolved.returnType;
|
|
48700
48749
|
}
|
|
48701
48750
|
}
|
|
48751
|
+
function resolveUnionType(ctx, node, scope) {
|
|
48752
|
+
if (node.type === "TSTypeReference") {
|
|
48753
|
+
const resolved = resolveTypeReference(ctx, node, scope);
|
|
48754
|
+
if (resolved)
|
|
48755
|
+
node = resolved;
|
|
48756
|
+
}
|
|
48757
|
+
let types;
|
|
48758
|
+
if (node.type === "TSUnionType") {
|
|
48759
|
+
types = node.types.flatMap((node2) => resolveUnionType(ctx, node2, scope));
|
|
48760
|
+
} else {
|
|
48761
|
+
types = [node];
|
|
48762
|
+
}
|
|
48763
|
+
return types;
|
|
48764
|
+
}
|
|
48702
48765
|
|
|
48703
48766
|
const DEFINE_MODEL = "defineModel";
|
|
48704
48767
|
function processDefineModel(ctx, node, declId) {
|
|
@@ -48867,9 +48930,10 @@ function genRuntimeProps(ctx) {
|
|
|
48867
48930
|
const defaults = [];
|
|
48868
48931
|
for (const key in ctx.propsDestructuredBindings) {
|
|
48869
48932
|
const d = genDestructuredDefaultValue(ctx, key);
|
|
48933
|
+
const finalKey = getEscapedKey(key);
|
|
48870
48934
|
if (d)
|
|
48871
48935
|
defaults.push(
|
|
48872
|
-
`${
|
|
48936
|
+
`${finalKey}: ${d.valueString}${d.needSkipFactory ? `, __skip_${finalKey}: true` : ``}`
|
|
48873
48937
|
);
|
|
48874
48938
|
}
|
|
48875
48939
|
if (defaults.length) {
|
|
@@ -48958,8 +49022,9 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
|
|
|
48958
49022
|
}
|
|
48959
49023
|
}
|
|
48960
49024
|
}
|
|
49025
|
+
const finalKey = getEscapedKey(key);
|
|
48961
49026
|
if (!ctx.options.isProd) {
|
|
48962
|
-
return `${
|
|
49027
|
+
return `${finalKey}: { ${concatStrings([
|
|
48963
49028
|
`type: ${toRuntimeTypeString(type)}`,
|
|
48964
49029
|
`required: ${required}`,
|
|
48965
49030
|
skipCheck && "skipCheck: true",
|
|
@@ -48968,12 +49033,12 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
|
|
|
48968
49033
|
} else if (type.some(
|
|
48969
49034
|
(el) => el === "Boolean" || (!hasStaticDefaults || defaultString) && el === "Function"
|
|
48970
49035
|
)) {
|
|
48971
|
-
return `${
|
|
49036
|
+
return `${finalKey}: { ${concatStrings([
|
|
48972
49037
|
`type: ${toRuntimeTypeString(type)}`,
|
|
48973
49038
|
defaultString
|
|
48974
49039
|
])} }`;
|
|
48975
49040
|
} else {
|
|
48976
|
-
return `${
|
|
49041
|
+
return `${finalKey}: ${defaultString ? `{ ${defaultString} }` : `{}`}`;
|
|
48977
49042
|
}
|
|
48978
49043
|
}
|
|
48979
49044
|
function hasStaticWithDefaults(ctx) {
|
|
@@ -48987,7 +49052,7 @@ function genDestructuredDefaultValue(ctx, key, inferredType) {
|
|
|
48987
49052
|
if (defaultVal) {
|
|
48988
49053
|
const value = ctx.getString(defaultVal);
|
|
48989
49054
|
const unwrapped = unwrapTSNode(defaultVal);
|
|
48990
|
-
if (inferredType && inferredType.length && !inferredType.includes(
|
|
49055
|
+
if (inferredType && inferredType.length && !inferredType.includes("null")) {
|
|
48991
49056
|
const valueType = inferValueType(unwrapped);
|
|
48992
49057
|
if (valueType && !inferredType.includes(valueType)) {
|
|
48993
49058
|
ctx.error(
|
|
@@ -49024,6 +49089,7 @@ function inferValueType(node) {
|
|
|
49024
49089
|
|
|
49025
49090
|
function processPropsDestructure(ctx, declId) {
|
|
49026
49091
|
if (!ctx.options.propsDestructure && !ctx.options.reactivityTransform) {
|
|
49092
|
+
ctx.propsIdentifier = ctx.getString(declId);
|
|
49027
49093
|
return;
|
|
49028
49094
|
}
|
|
49029
49095
|
warnOnce$4(
|
|
@@ -49255,7 +49321,7 @@ function extractRuntimeEmits(ctx) {
|
|
|
49255
49321
|
const emits = /* @__PURE__ */ new Set();
|
|
49256
49322
|
const node = ctx.emitsTypeDecl;
|
|
49257
49323
|
if (node.type === "TSFunctionType") {
|
|
49258
|
-
extractEventNames(node.parameters[0], emits);
|
|
49324
|
+
extractEventNames(ctx, node.parameters[0], emits);
|
|
49259
49325
|
return emits;
|
|
49260
49326
|
}
|
|
49261
49327
|
const { props, calls } = resolveTypeElements(ctx, node);
|
|
@@ -49272,22 +49338,18 @@ function extractRuntimeEmits(ctx) {
|
|
|
49272
49338
|
);
|
|
49273
49339
|
}
|
|
49274
49340
|
for (const call of calls) {
|
|
49275
|
-
extractEventNames(call.parameters[0], emits);
|
|
49341
|
+
extractEventNames(ctx, call.parameters[0], emits);
|
|
49276
49342
|
}
|
|
49277
49343
|
}
|
|
49278
49344
|
return emits;
|
|
49279
49345
|
}
|
|
49280
|
-
function extractEventNames(eventName, emits) {
|
|
49346
|
+
function extractEventNames(ctx, eventName, emits) {
|
|
49281
49347
|
if (eventName.type === "Identifier" && eventName.typeAnnotation && eventName.typeAnnotation.type === "TSTypeAnnotation") {
|
|
49282
|
-
const
|
|
49283
|
-
|
|
49284
|
-
if (
|
|
49285
|
-
|
|
49286
|
-
|
|
49287
|
-
} else if (typeNode.type === "TSUnionType") {
|
|
49288
|
-
for (const t of typeNode.types) {
|
|
49289
|
-
if (t.type === "TSLiteralType" && t.literal.type !== "UnaryExpression" && t.literal.type !== "TemplateLiteral") {
|
|
49290
|
-
emits.add(String(t.literal.value));
|
|
49348
|
+
const types = resolveUnionType(ctx, eventName.typeAnnotation.typeAnnotation);
|
|
49349
|
+
for (const type of types) {
|
|
49350
|
+
if (type.type === "TSLiteralType") {
|
|
49351
|
+
if (type.literal.type !== "UnaryExpression" && type.literal.type !== "TemplateLiteral") {
|
|
49352
|
+
emits.add(String(type.literal.value));
|
|
49291
49353
|
}
|
|
49292
49354
|
}
|
|
49293
49355
|
}
|
|
@@ -50204,6 +50266,7 @@ function canNeverBeRef(node, userReactiveImport) {
|
|
|
50204
50266
|
}
|
|
50205
50267
|
}
|
|
50206
50268
|
function isStaticNode(node) {
|
|
50269
|
+
node = unwrapTSNode(node);
|
|
50207
50270
|
switch (node.type) {
|
|
50208
50271
|
case "UnaryExpression":
|
|
50209
50272
|
return isStaticNode(node.argument);
|
|
@@ -50217,19 +50280,18 @@ function isStaticNode(node) {
|
|
|
50217
50280
|
case "TemplateLiteral":
|
|
50218
50281
|
return node.expressions.every((expr) => isStaticNode(expr));
|
|
50219
50282
|
case "ParenthesizedExpression":
|
|
50220
|
-
case "TSNonNullExpression":
|
|
50221
|
-
case "TSAsExpression":
|
|
50222
|
-
case "TSTypeAssertion":
|
|
50223
50283
|
return isStaticNode(node.expression);
|
|
50224
|
-
|
|
50225
|
-
|
|
50226
|
-
|
|
50227
|
-
|
|
50228
|
-
|
|
50284
|
+
case "StringLiteral":
|
|
50285
|
+
case "NumericLiteral":
|
|
50286
|
+
case "BooleanLiteral":
|
|
50287
|
+
case "NullLiteral":
|
|
50288
|
+
case "BigIntLiteral":
|
|
50289
|
+
return true;
|
|
50229
50290
|
}
|
|
50291
|
+
return false;
|
|
50230
50292
|
}
|
|
50231
50293
|
|
|
50232
|
-
const version = "3.3.
|
|
50294
|
+
const version = "3.3.3";
|
|
50233
50295
|
const walk = walk$1;
|
|
50234
50296
|
|
|
50235
50297
|
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 };
|