@vue/compiler-sfc 3.5.0-rc.1 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler-sfc.cjs.js +71 -78
- package/dist/compiler-sfc.esm-browser.js +1673 -1636
- package/package.json +6 -6
package/dist/compiler-sfc.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.5.
|
|
2
|
+
* @vue/compiler-sfc v3.5.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -10,8 +10,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
10
10
|
var compilerCore = require('@vue/compiler-core');
|
|
11
11
|
var CompilerDOM = require('@vue/compiler-dom');
|
|
12
12
|
var sourceMapJs = require('source-map-js');
|
|
13
|
-
var path$3 = require('path');
|
|
14
13
|
var shared = require('@vue/shared');
|
|
14
|
+
var path$3 = require('path');
|
|
15
15
|
var url = require('url');
|
|
16
16
|
var CompilerSSR = require('@vue/compiler-ssr');
|
|
17
17
|
var require$$2 = require('util');
|
|
@@ -23,79 +23,20 @@ var parser$1 = require('@babel/parser');
|
|
|
23
23
|
var process$1 = require('process');
|
|
24
24
|
|
|
25
25
|
function _interopNamespaceDefault(e) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
var n = Object.create(null);
|
|
27
|
+
if (e) {
|
|
28
|
+
for (var k in e) {
|
|
29
|
+
n[k] = e[k];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
n.default = e;
|
|
33
|
+
return Object.freeze(n);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
var CompilerDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(CompilerDOM);
|
|
37
37
|
var CompilerSSR__namespace = /*#__PURE__*/_interopNamespaceDefault(CompilerSSR);
|
|
38
38
|
var process__namespace = /*#__PURE__*/_interopNamespaceDefault(process$1);
|
|
39
39
|
|
|
40
|
-
const UNKNOWN_TYPE = "Unknown";
|
|
41
|
-
function resolveObjectKey(node, computed) {
|
|
42
|
-
switch (node.type) {
|
|
43
|
-
case "StringLiteral":
|
|
44
|
-
case "NumericLiteral":
|
|
45
|
-
return String(node.value);
|
|
46
|
-
case "Identifier":
|
|
47
|
-
if (!computed) return node.name;
|
|
48
|
-
}
|
|
49
|
-
return void 0;
|
|
50
|
-
}
|
|
51
|
-
function concatStrings(strs) {
|
|
52
|
-
return strs.filter((s) => !!s).join(", ");
|
|
53
|
-
}
|
|
54
|
-
function isLiteralNode(node) {
|
|
55
|
-
return node.type.endsWith("Literal");
|
|
56
|
-
}
|
|
57
|
-
function isCallOf(node, test) {
|
|
58
|
-
return !!(node && test && node.type === "CallExpression" && node.callee.type === "Identifier" && (typeof test === "string" ? node.callee.name === test : test(node.callee.name)));
|
|
59
|
-
}
|
|
60
|
-
function toRuntimeTypeString(types) {
|
|
61
|
-
return types.length > 1 ? `[${types.join(", ")}]` : types[0];
|
|
62
|
-
}
|
|
63
|
-
function getImportedName(specifier) {
|
|
64
|
-
if (specifier.type === "ImportSpecifier")
|
|
65
|
-
return specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
|
|
66
|
-
else if (specifier.type === "ImportNamespaceSpecifier") return "*";
|
|
67
|
-
return "default";
|
|
68
|
-
}
|
|
69
|
-
function getId(node) {
|
|
70
|
-
return node.type === "Identifier" ? node.name : node.type === "StringLiteral" ? node.value : null;
|
|
71
|
-
}
|
|
72
|
-
const identity = (str) => str;
|
|
73
|
-
const fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
|
|
74
|
-
const toLowerCase = (str) => str.toLowerCase();
|
|
75
|
-
function toFileNameLowerCase(x) {
|
|
76
|
-
return fileNameLowerCaseRegExp.test(x) ? x.replace(fileNameLowerCaseRegExp, toLowerCase) : x;
|
|
77
|
-
}
|
|
78
|
-
function createGetCanonicalFileName(useCaseSensitiveFileNames) {
|
|
79
|
-
return useCaseSensitiveFileNames ? identity : toFileNameLowerCase;
|
|
80
|
-
}
|
|
81
|
-
const normalize = (path$3.posix || path$3).normalize;
|
|
82
|
-
const windowsSlashRE = /\\/g;
|
|
83
|
-
function normalizePath(p) {
|
|
84
|
-
return normalize(p.replace(windowsSlashRE, "/"));
|
|
85
|
-
}
|
|
86
|
-
const joinPaths = (path$3.posix || path$3).join;
|
|
87
|
-
const propNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~\-]/;
|
|
88
|
-
function getEscapedPropName(key) {
|
|
89
|
-
return propNameEscapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
|
|
90
|
-
}
|
|
91
|
-
const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
|
|
92
|
-
function getEscapedCssVarName(key, doubleEscape) {
|
|
93
|
-
return key.replace(
|
|
94
|
-
cssVarNameEscapeSymbolsRE,
|
|
95
|
-
(s) => doubleEscape ? `\\\\${s}` : `\\${s}`
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
40
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
100
41
|
|
|
101
42
|
function getDefaultExportFromCjs (x) {
|
|
@@ -184,7 +125,7 @@ function genVarName(id, raw, isProd, isSSR = false) {
|
|
|
184
125
|
if (isProd) {
|
|
185
126
|
return hash$1(id + raw);
|
|
186
127
|
} else {
|
|
187
|
-
return `${id}-${getEscapedCssVarName(raw, isSSR)}`;
|
|
128
|
+
return `${id}-${shared.getEscapedCssVarName(raw, isSSR)}`;
|
|
188
129
|
}
|
|
189
130
|
}
|
|
190
131
|
function normalizeExpression(exp) {
|
|
@@ -1781,7 +1722,7 @@ function resolveTemplateUsedIdentifiers(sfc) {
|
|
|
1781
1722
|
} else if (prop.exp) {
|
|
1782
1723
|
extractIdentifiers(ids, prop.exp);
|
|
1783
1724
|
} else if (prop.name === "bind" && !prop.exp) {
|
|
1784
|
-
ids.add(prop.arg.content);
|
|
1725
|
+
ids.add(shared.camelize(prop.arg.content));
|
|
1785
1726
|
}
|
|
1786
1727
|
}
|
|
1787
1728
|
if (prop.type === 6 && prop.name === "ref" && ((_a = prop.value) == null ? void 0 : _a.content)) {
|
|
@@ -15553,6 +15494,58 @@ function preprocess(options, preprocessor) {
|
|
|
15553
15494
|
);
|
|
15554
15495
|
}
|
|
15555
15496
|
|
|
15497
|
+
const UNKNOWN_TYPE = "Unknown";
|
|
15498
|
+
function resolveObjectKey(node, computed) {
|
|
15499
|
+
switch (node.type) {
|
|
15500
|
+
case "StringLiteral":
|
|
15501
|
+
case "NumericLiteral":
|
|
15502
|
+
return String(node.value);
|
|
15503
|
+
case "Identifier":
|
|
15504
|
+
if (!computed) return node.name;
|
|
15505
|
+
}
|
|
15506
|
+
return void 0;
|
|
15507
|
+
}
|
|
15508
|
+
function concatStrings(strs) {
|
|
15509
|
+
return strs.filter((s) => !!s).join(", ");
|
|
15510
|
+
}
|
|
15511
|
+
function isLiteralNode(node) {
|
|
15512
|
+
return node.type.endsWith("Literal");
|
|
15513
|
+
}
|
|
15514
|
+
function isCallOf(node, test) {
|
|
15515
|
+
return !!(node && test && node.type === "CallExpression" && node.callee.type === "Identifier" && (typeof test === "string" ? node.callee.name === test : test(node.callee.name)));
|
|
15516
|
+
}
|
|
15517
|
+
function toRuntimeTypeString(types) {
|
|
15518
|
+
return types.length > 1 ? `[${types.join(", ")}]` : types[0];
|
|
15519
|
+
}
|
|
15520
|
+
function getImportedName(specifier) {
|
|
15521
|
+
if (specifier.type === "ImportSpecifier")
|
|
15522
|
+
return specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value;
|
|
15523
|
+
else if (specifier.type === "ImportNamespaceSpecifier") return "*";
|
|
15524
|
+
return "default";
|
|
15525
|
+
}
|
|
15526
|
+
function getId(node) {
|
|
15527
|
+
return node.type === "Identifier" ? node.name : node.type === "StringLiteral" ? node.value : null;
|
|
15528
|
+
}
|
|
15529
|
+
const identity = (str) => str;
|
|
15530
|
+
const fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
|
|
15531
|
+
const toLowerCase = (str) => str.toLowerCase();
|
|
15532
|
+
function toFileNameLowerCase(x) {
|
|
15533
|
+
return fileNameLowerCaseRegExp.test(x) ? x.replace(fileNameLowerCaseRegExp, toLowerCase) : x;
|
|
15534
|
+
}
|
|
15535
|
+
function createGetCanonicalFileName(useCaseSensitiveFileNames) {
|
|
15536
|
+
return useCaseSensitiveFileNames ? identity : toFileNameLowerCase;
|
|
15537
|
+
}
|
|
15538
|
+
const normalize = (path$3.posix || path$3).normalize;
|
|
15539
|
+
const windowsSlashRE = /\\/g;
|
|
15540
|
+
function normalizePath(p) {
|
|
15541
|
+
return normalize(p.replace(windowsSlashRE, "/"));
|
|
15542
|
+
}
|
|
15543
|
+
const joinPaths = (path$3.posix || path$3).join;
|
|
15544
|
+
const propNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~\-]/;
|
|
15545
|
+
function getEscapedPropName(key) {
|
|
15546
|
+
return propNameEscapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
|
|
15547
|
+
}
|
|
15548
|
+
|
|
15556
15549
|
function analyzeScriptBindings(ast) {
|
|
15557
15550
|
for (const node of ast) {
|
|
15558
15551
|
if (node.type === "ExportDefaultDeclaration" && node.declaration.type === "ObjectExpression") {
|
|
@@ -19514,7 +19507,7 @@ function genRuntimeProps(ctx) {
|
|
|
19514
19507
|
);
|
|
19515
19508
|
}
|
|
19516
19509
|
if (defaults.length) {
|
|
19517
|
-
propsDecls =
|
|
19510
|
+
propsDecls = `/*@__PURE__*/${ctx.helper(
|
|
19518
19511
|
`mergeDefaults`
|
|
19519
19512
|
)}(${propsDecls}, {
|
|
19520
19513
|
${defaults.join(",\n ")}
|
|
@@ -19526,7 +19519,7 @@ function genRuntimeProps(ctx) {
|
|
|
19526
19519
|
}
|
|
19527
19520
|
const modelsDecls = genModelProps(ctx);
|
|
19528
19521
|
if (propsDecls && modelsDecls) {
|
|
19529
|
-
return
|
|
19522
|
+
return `/*@__PURE__*/${ctx.helper(
|
|
19530
19523
|
"mergeModels"
|
|
19531
19524
|
)}(${propsDecls}, ${modelsDecls})`;
|
|
19532
19525
|
} else {
|
|
@@ -19550,7 +19543,7 @@ function extractRuntimeProps(ctx) {
|
|
|
19550
19543
|
${propStrings.join(",\n ")}
|
|
19551
19544
|
}`;
|
|
19552
19545
|
if (ctx.propsRuntimeDefaults && !hasStaticDefaults) {
|
|
19553
|
-
propsDecls =
|
|
19546
|
+
propsDecls = `/*@__PURE__*/${ctx.helper(
|
|
19554
19547
|
"mergeDefaults"
|
|
19555
19548
|
)}(${propsDecls}, ${ctx.getString(ctx.propsRuntimeDefaults)})`;
|
|
19556
19549
|
}
|
|
@@ -19894,7 +19887,7 @@ function genRuntimeEmits(ctx) {
|
|
|
19894
19887
|
}
|
|
19895
19888
|
if (ctx.hasDefineModelCall) {
|
|
19896
19889
|
let modelEmitsDecl = `[${Object.keys(ctx.modelDecls).map((n) => JSON.stringify(`update:${n}`)).join(", ")}]`;
|
|
19897
|
-
emitsDecl = emitsDecl ?
|
|
19890
|
+
emitsDecl = emitsDecl ? `/*@__PURE__*/${ctx.helper(
|
|
19898
19891
|
"mergeModels"
|
|
19899
19892
|
)}(${emitsDecl}, ${modelEmitsDecl})` : modelEmitsDecl;
|
|
19900
19893
|
}
|
|
@@ -20654,7 +20647,7 @@ return ${returned}
|
|
|
20654
20647
|
ctx.s.prependLeft(
|
|
20655
20648
|
startOffset,
|
|
20656
20649
|
`
|
|
20657
|
-
${genDefaultAs}
|
|
20650
|
+
${genDefaultAs} /*@__PURE__*/${ctx.helper(
|
|
20658
20651
|
`defineComponent`
|
|
20659
20652
|
)}({${def}${runtimeOptions}
|
|
20660
20653
|
${hasAwait ? `async ` : ``}setup(${args}) {
|
|
@@ -20666,7 +20659,7 @@ ${exposeCall}`
|
|
|
20666
20659
|
ctx.s.prependLeft(
|
|
20667
20660
|
startOffset,
|
|
20668
20661
|
`
|
|
20669
|
-
${genDefaultAs}
|
|
20662
|
+
${genDefaultAs} /*@__PURE__*/Object.assign(${defaultExport ? `${normalScriptDefaultVar}, ` : ""}${definedOptions ? `${definedOptions}, ` : ""}{${runtimeOptions}
|
|
20670
20663
|
${hasAwait ? `async ` : ``}setup(${args}) {
|
|
20671
20664
|
${exposeCall}`
|
|
20672
20665
|
);
|
|
@@ -20863,7 +20856,7 @@ function isStaticNode(node) {
|
|
|
20863
20856
|
return false;
|
|
20864
20857
|
}
|
|
20865
20858
|
|
|
20866
|
-
const version = "3.5.
|
|
20859
|
+
const version = "3.5.1";
|
|
20867
20860
|
const parseCache = parseCache$1;
|
|
20868
20861
|
const errorMessages = {
|
|
20869
20862
|
...CompilerDOM.errorMessages,
|