@vue/compiler-sfc 2.7.0 → 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 +16 -13
- 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;
|
|
@@ -8360,18 +8360,14 @@ function compileScript(sfc, options = { id: '' }) {
|
|
|
8360
8360
|
function error(msg, node, end = node.end + startOffset) {
|
|
8361
8361
|
throw new Error(`[@vue/compiler-sfc] ${msg}\n\n${filename}\n${generateCodeFrame(source, node.start + startOffset, end)}`);
|
|
8362
8362
|
}
|
|
8363
|
-
function registerUserImport(source, local, imported, isType, isFromSetup
|
|
8363
|
+
function registerUserImport(source, local, imported, isType, isFromSetup) {
|
|
8364
8364
|
if (source === 'vue' && imported) {
|
|
8365
8365
|
userImportAlias[imported] = local;
|
|
8366
8366
|
}
|
|
8367
8367
|
// template usage check is only needed in non-inline mode, so we can skip
|
|
8368
8368
|
// the work if inlineTemplate is true.
|
|
8369
|
-
let isUsedInTemplate =
|
|
8370
|
-
if (
|
|
8371
|
-
isTS &&
|
|
8372
|
-
sfc.template &&
|
|
8373
|
-
!sfc.template.src &&
|
|
8374
|
-
!sfc.template.lang) {
|
|
8369
|
+
let isUsedInTemplate = true;
|
|
8370
|
+
if (isTS && sfc.template && !sfc.template.src && !sfc.template.lang) {
|
|
8375
8371
|
isUsedInTemplate = isImportUsed(local, sfc);
|
|
8376
8372
|
}
|
|
8377
8373
|
userImports[local] = {
|
|
@@ -8622,7 +8618,7 @@ function compileScript(sfc, options = { id: '' }) {
|
|
|
8622
8618
|
specifier.imported.name;
|
|
8623
8619
|
registerUserImport(node.source.value, specifier.local.name, imported, node.importKind === 'type' ||
|
|
8624
8620
|
(specifier.type === 'ImportSpecifier' &&
|
|
8625
|
-
specifier.importKind === 'type'), false
|
|
8621
|
+
specifier.importKind === 'type'), false);
|
|
8626
8622
|
}
|
|
8627
8623
|
}
|
|
8628
8624
|
else if (node.type === 'ExportDefaultDeclaration') {
|
|
@@ -8791,7 +8787,7 @@ function compileScript(sfc, options = { id: '' }) {
|
|
|
8791
8787
|
else {
|
|
8792
8788
|
registerUserImport(source, local, imported, node.importKind === 'type' ||
|
|
8793
8789
|
(specifier.type === 'ImportSpecifier' &&
|
|
8794
|
-
specifier.importKind === 'type'), true
|
|
8790
|
+
specifier.importKind === 'type'), true);
|
|
8795
8791
|
}
|
|
8796
8792
|
}
|
|
8797
8793
|
if (node.specifiers.length && removed === node.specifiers.length) {
|
|
@@ -9526,7 +9522,11 @@ function resolveTemplateUsageCheckString(sfc) {
|
|
|
9526
9522
|
for (let i = 0; i < attrs.length; i++) {
|
|
9527
9523
|
const { name, value } = attrs[i];
|
|
9528
9524
|
if (dirRE.test(name)) {
|
|
9529
|
-
const baseName =
|
|
9525
|
+
const baseName = onRE.test(name)
|
|
9526
|
+
? 'on'
|
|
9527
|
+
: bindRE.test(name)
|
|
9528
|
+
? 'bind'
|
|
9529
|
+
: name.replace(dirRE, '');
|
|
9530
9530
|
if (!isBuiltInDir$1(baseName)) {
|
|
9531
9531
|
code += `,v${capitalize(camelize(baseName))}`;
|
|
9532
9532
|
}
|
|
@@ -9552,6 +9552,9 @@ function processExp(exp, dir) {
|
|
|
9552
9552
|
if (dir === 'slot') {
|
|
9553
9553
|
exp = `(${exp})=>{}`;
|
|
9554
9554
|
}
|
|
9555
|
+
else if (dir === 'on') {
|
|
9556
|
+
exp = `()=>{${exp}}`;
|
|
9557
|
+
}
|
|
9555
9558
|
else if (dir === 'for') {
|
|
9556
9559
|
const inMatch = exp.match(forAliasRE);
|
|
9557
9560
|
if (inMatch) {
|
|
@@ -9807,7 +9810,7 @@ function transform(node, transformAssetUrlsOptions) {
|
|
|
9807
9810
|
return;
|
|
9808
9811
|
}
|
|
9809
9812
|
const imageCandidates = value
|
|
9810
|
-
.
|
|
9813
|
+
.slice(1, -1)
|
|
9811
9814
|
.split(',')
|
|
9812
9815
|
.map(s => {
|
|
9813
9816
|
// The attribute value arrives here with all whitespace, except
|