@vue/compiler-sfc 2.7.0-beta.7 → 2.7.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.js +22 -16
- package/package.json +1 -1
package/dist/compiler-sfc.js
CHANGED
|
@@ -329,7 +329,7 @@ function hasChanged(x, y) {
|
|
|
329
329
|
return x === 0 && 1 / x !== 1 / y;
|
|
330
330
|
}
|
|
331
331
|
else {
|
|
332
|
-
return x === x
|
|
332
|
+
return x === x || y === y;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
|
|
@@ -5319,7 +5319,7 @@ function defineReactive(obj, key, val, customSetter, shallow) {
|
|
|
5319
5319
|
}
|
|
5320
5320
|
}
|
|
5321
5321
|
}
|
|
5322
|
-
return isRef(value) ? value.value : value;
|
|
5322
|
+
return isRef(value) && !shallow ? value.value : value;
|
|
5323
5323
|
},
|
|
5324
5324
|
set: function reactiveSetter(newVal) {
|
|
5325
5325
|
const value = getter ? getter.call(obj) : val;
|
|
@@ -8264,8 +8264,12 @@ function compileScript(sfc, options = { id: '' }) {
|
|
|
8264
8264
|
}
|
|
8265
8265
|
if (options.babelParserPlugins)
|
|
8266
8266
|
plugins.push(...options.babelParserPlugins);
|
|
8267
|
-
if (isTS)
|
|
8268
|
-
plugins.push('typescript'
|
|
8267
|
+
if (isTS) {
|
|
8268
|
+
plugins.push('typescript');
|
|
8269
|
+
if (!plugins.includes('decorators')) {
|
|
8270
|
+
plugins.push('decorators-legacy');
|
|
8271
|
+
}
|
|
8272
|
+
}
|
|
8269
8273
|
if (!scriptSetup) {
|
|
8270
8274
|
if (!script) {
|
|
8271
8275
|
throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
|
|
@@ -8356,18 +8360,14 @@ function compileScript(sfc, options = { id: '' }) {
|
|
|
8356
8360
|
function error(msg, node, end = node.end + startOffset) {
|
|
8357
8361
|
throw new Error(`[@vue/compiler-sfc] ${msg}\n\n${filename}\n${generateCodeFrame(source, node.start + startOffset, end)}`);
|
|
8358
8362
|
}
|
|
8359
|
-
function registerUserImport(source, local, imported, isType, isFromSetup
|
|
8363
|
+
function registerUserImport(source, local, imported, isType, isFromSetup) {
|
|
8360
8364
|
if (source === 'vue' && imported) {
|
|
8361
8365
|
userImportAlias[imported] = local;
|
|
8362
8366
|
}
|
|
8363
8367
|
// template usage check is only needed in non-inline mode, so we can skip
|
|
8364
8368
|
// the work if inlineTemplate is true.
|
|
8365
|
-
let isUsedInTemplate =
|
|
8366
|
-
if (
|
|
8367
|
-
isTS &&
|
|
8368
|
-
sfc.template &&
|
|
8369
|
-
!sfc.template.src &&
|
|
8370
|
-
!sfc.template.lang) {
|
|
8369
|
+
let isUsedInTemplate = true;
|
|
8370
|
+
if (isTS && sfc.template && !sfc.template.src && !sfc.template.lang) {
|
|
8371
8371
|
isUsedInTemplate = isImportUsed(local, sfc);
|
|
8372
8372
|
}
|
|
8373
8373
|
userImports[local] = {
|
|
@@ -8618,7 +8618,7 @@ function compileScript(sfc, options = { id: '' }) {
|
|
|
8618
8618
|
specifier.imported.name;
|
|
8619
8619
|
registerUserImport(node.source.value, specifier.local.name, imported, node.importKind === 'type' ||
|
|
8620
8620
|
(specifier.type === 'ImportSpecifier' &&
|
|
8621
|
-
specifier.importKind === 'type'), false
|
|
8621
|
+
specifier.importKind === 'type'), false);
|
|
8622
8622
|
}
|
|
8623
8623
|
}
|
|
8624
8624
|
else if (node.type === 'ExportDefaultDeclaration') {
|
|
@@ -8787,7 +8787,7 @@ function compileScript(sfc, options = { id: '' }) {
|
|
|
8787
8787
|
else {
|
|
8788
8788
|
registerUserImport(source, local, imported, node.importKind === 'type' ||
|
|
8789
8789
|
(specifier.type === 'ImportSpecifier' &&
|
|
8790
|
-
specifier.importKind === 'type'), true
|
|
8790
|
+
specifier.importKind === 'type'), true);
|
|
8791
8791
|
}
|
|
8792
8792
|
}
|
|
8793
8793
|
if (node.specifiers.length && removed === node.specifiers.length) {
|
|
@@ -9522,7 +9522,11 @@ function resolveTemplateUsageCheckString(sfc) {
|
|
|
9522
9522
|
for (let i = 0; i < attrs.length; i++) {
|
|
9523
9523
|
const { name, value } = attrs[i];
|
|
9524
9524
|
if (dirRE.test(name)) {
|
|
9525
|
-
const baseName =
|
|
9525
|
+
const baseName = onRE.test(name)
|
|
9526
|
+
? 'on'
|
|
9527
|
+
: bindRE.test(name)
|
|
9528
|
+
? 'bind'
|
|
9529
|
+
: name.replace(dirRE, '');
|
|
9526
9530
|
if (!isBuiltInDir$1(baseName)) {
|
|
9527
9531
|
code += `,v${capitalize(camelize(baseName))}`;
|
|
9528
9532
|
}
|
|
@@ -9548,6 +9552,9 @@ function processExp(exp, dir) {
|
|
|
9548
9552
|
if (dir === 'slot') {
|
|
9549
9553
|
exp = `(${exp})=>{}`;
|
|
9550
9554
|
}
|
|
9555
|
+
else if (dir === 'on') {
|
|
9556
|
+
exp = `()=>{${exp}}`;
|
|
9557
|
+
}
|
|
9551
9558
|
else if (dir === 'for') {
|
|
9552
9559
|
const inMatch = exp.match(forAliasRE);
|
|
9553
9560
|
if (inMatch) {
|
|
@@ -9691,7 +9698,6 @@ function urlToRequire(url, transformAssetUrlsOption = {}) {
|
|
|
9691
9698
|
// only version provided by rollup-plugin-node-builtins.
|
|
9692
9699
|
return `"${(path__default["default"].posix || path__default["default"]).join(transformAssetUrlsOption.base, uriParts.path + (uriParts.hash || ''))}"`;
|
|
9693
9700
|
}
|
|
9694
|
-
return returnValue;
|
|
9695
9701
|
}
|
|
9696
9702
|
if (transformAssetUrlsOption.includeAbsolute ||
|
|
9697
9703
|
firstChar === '.' ||
|
|
@@ -9804,7 +9810,7 @@ function transform(node, transformAssetUrlsOptions) {
|
|
|
9804
9810
|
return;
|
|
9805
9811
|
}
|
|
9806
9812
|
const imageCandidates = value
|
|
9807
|
-
.
|
|
9813
|
+
.slice(1, -1)
|
|
9808
9814
|
.split(',')
|
|
9809
9815
|
.map(s => {
|
|
9810
9816
|
// The attribute value arrives here with all whitespace, except
|