@vue/compiler-sfc 2.7.6 → 2.7.9
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 +56 -26
- package/package.json +2 -3
package/dist/compiler-sfc.js
CHANGED
|
@@ -3796,7 +3796,7 @@ function defineReactive(obj, key, val, customSetter, shallow, mock) {
|
|
|
3796
3796
|
// #7981: for accessor properties without setter
|
|
3797
3797
|
return;
|
|
3798
3798
|
}
|
|
3799
|
-
else if (isRef(value) && !isRef(newVal)) {
|
|
3799
|
+
else if (!shallow && isRef(value) && !isRef(newVal)) {
|
|
3800
3800
|
value.value = newVal;
|
|
3801
3801
|
return;
|
|
3802
3802
|
}
|
|
@@ -4610,12 +4610,12 @@ function proxyNormalSlot(slots, key) {
|
|
|
4610
4610
|
return () => slots[key];
|
|
4611
4611
|
}
|
|
4612
4612
|
|
|
4613
|
-
function
|
|
4613
|
+
function syncSetupProxy(to, from, prev, instance, type) {
|
|
4614
4614
|
let changed = false;
|
|
4615
4615
|
for (const key in from) {
|
|
4616
4616
|
if (!(key in to)) {
|
|
4617
4617
|
changed = true;
|
|
4618
|
-
defineProxyAttr(to, key, instance);
|
|
4618
|
+
defineProxyAttr(to, key, instance, type);
|
|
4619
4619
|
}
|
|
4620
4620
|
else if (from[key] !== prev[key]) {
|
|
4621
4621
|
changed = true;
|
|
@@ -4629,12 +4629,12 @@ function syncSetupAttrs(to, from, prev, instance) {
|
|
|
4629
4629
|
}
|
|
4630
4630
|
return changed;
|
|
4631
4631
|
}
|
|
4632
|
-
function defineProxyAttr(proxy, key, instance) {
|
|
4632
|
+
function defineProxyAttr(proxy, key, instance, type) {
|
|
4633
4633
|
Object.defineProperty(proxy, key, {
|
|
4634
4634
|
enumerable: true,
|
|
4635
4635
|
configurable: true,
|
|
4636
4636
|
get() {
|
|
4637
|
-
return instance
|
|
4637
|
+
return instance[type][key];
|
|
4638
4638
|
}
|
|
4639
4639
|
});
|
|
4640
4640
|
}
|
|
@@ -4714,12 +4714,19 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
|
|
|
4714
4714
|
if (vm._attrsProxy) {
|
|
4715
4715
|
// force update if attrs are accessed and has changed since it may be
|
|
4716
4716
|
// passed to a child component.
|
|
4717
|
-
if (
|
|
4717
|
+
if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
|
|
4718
4718
|
needsForceUpdate = true;
|
|
4719
4719
|
}
|
|
4720
4720
|
}
|
|
4721
4721
|
vm.$attrs = attrs;
|
|
4722
|
-
|
|
4722
|
+
// update listeners
|
|
4723
|
+
listeners = listeners || emptyObject;
|
|
4724
|
+
const prevListeners = vm.$options._parentListeners;
|
|
4725
|
+
if (vm._listenersProxy) {
|
|
4726
|
+
syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
|
|
4727
|
+
}
|
|
4728
|
+
vm.$listeners = vm.$options._parentListeners = listeners;
|
|
4729
|
+
updateComponentListeners(vm, listeners, prevListeners);
|
|
4723
4730
|
// update props
|
|
4724
4731
|
if (propsData && vm.$options.props) {
|
|
4725
4732
|
toggleObserving(false);
|
|
@@ -4734,11 +4741,6 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
|
|
|
4734
4741
|
// keep a copy of raw propsData
|
|
4735
4742
|
vm.$options.propsData = propsData;
|
|
4736
4743
|
}
|
|
4737
|
-
// update listeners
|
|
4738
|
-
listeners = listeners || emptyObject;
|
|
4739
|
-
const oldListeners = vm.$options._parentListeners;
|
|
4740
|
-
vm.$options._parentListeners = listeners;
|
|
4741
|
-
updateComponentListeners(vm, listeners, oldListeners);
|
|
4742
4744
|
// resolve slots + force update if has children
|
|
4743
4745
|
if (needsForceUpdate) {
|
|
4744
4746
|
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
|
@@ -8179,7 +8181,13 @@ function rewriteDefault(input, as, parserPlugins) {
|
|
|
8179
8181
|
}).program.body;
|
|
8180
8182
|
ast.forEach(node => {
|
|
8181
8183
|
if (node.type === 'ExportDefaultDeclaration') {
|
|
8182
|
-
|
|
8184
|
+
if (node.declaration.type === 'ClassDeclaration') {
|
|
8185
|
+
s.overwrite(node.start, node.declaration.id.start, `class `);
|
|
8186
|
+
s.append(`\nconst ${as} = ${node.declaration.id.name}`);
|
|
8187
|
+
}
|
|
8188
|
+
else {
|
|
8189
|
+
s.overwrite(node.start, node.declaration.start, `const ${as} = `);
|
|
8190
|
+
}
|
|
8183
8191
|
}
|
|
8184
8192
|
if (node.type === 'ExportNamedDeclaration') {
|
|
8185
8193
|
for (const specifier of node.specifiers) {
|
|
@@ -9701,9 +9709,14 @@ function urlToRequire(url, transformAssetUrlsOption = {}) {
|
|
|
9701
9709
|
// does not apply to absolute urls or urls that start with `@`
|
|
9702
9710
|
// since they are aliases
|
|
9703
9711
|
if (firstChar === '.' || firstChar === '~') {
|
|
9712
|
+
// Allow for full hostnames provided in options.base
|
|
9713
|
+
const base = parseUriParts(transformAssetUrlsOption.base);
|
|
9714
|
+
const protocol = base.protocol || '';
|
|
9715
|
+
const host = base.host ? protocol + '//' + base.host : '';
|
|
9716
|
+
const basePath = base.path || '/';
|
|
9704
9717
|
// when packaged in the browser, path will be using the posix-
|
|
9705
9718
|
// only version provided by rollup-plugin-node-builtins.
|
|
9706
|
-
return `"${(path__default["default"].posix || path__default["default"]).join(
|
|
9719
|
+
return `"${host}${(path__default["default"].posix || path__default["default"]).join(basePath, uriParts.path + (uriParts.hash || ''))}"`;
|
|
9707
9720
|
}
|
|
9708
9721
|
}
|
|
9709
9722
|
if (transformAssetUrlsOption.includeAbsolute ||
|
|
@@ -9735,7 +9748,7 @@ function parseUriParts(urlString) {
|
|
|
9735
9748
|
// @see https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost
|
|
9736
9749
|
if ('string' === typeof urlString) {
|
|
9737
9750
|
// check is an uri
|
|
9738
|
-
return url.parse(urlString); // take apart the uri
|
|
9751
|
+
return url.parse(urlString, false, true); // take apart the uri
|
|
9739
9752
|
}
|
|
9740
9753
|
}
|
|
9741
9754
|
return returnValue;
|
|
@@ -11998,17 +12011,15 @@ function genElement(el, state) {
|
|
|
11998
12011
|
}
|
|
11999
12012
|
else {
|
|
12000
12013
|
let data;
|
|
12001
|
-
|
|
12014
|
+
const maybeComponent = state.maybeComponent(el);
|
|
12015
|
+
if (!el.plain || (el.pre && maybeComponent)) {
|
|
12002
12016
|
data = genData(el, state);
|
|
12003
12017
|
}
|
|
12004
12018
|
let tag;
|
|
12005
12019
|
// check if this is a component in <script setup>
|
|
12006
12020
|
const bindings = state.options.bindings;
|
|
12007
|
-
if (bindings && bindings.__isScriptSetup !== false) {
|
|
12008
|
-
tag =
|
|
12009
|
-
checkBindingType(bindings, el.tag) ||
|
|
12010
|
-
checkBindingType(bindings, camelize(el.tag)) ||
|
|
12011
|
-
checkBindingType(bindings, capitalize(camelize(el.tag)));
|
|
12021
|
+
if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
|
|
12022
|
+
tag = checkBindingType(bindings, el.tag);
|
|
12012
12023
|
}
|
|
12013
12024
|
if (!tag)
|
|
12014
12025
|
tag = `'${el.tag}'`;
|
|
@@ -12025,9 +12036,29 @@ function genElement(el, state) {
|
|
|
12025
12036
|
}
|
|
12026
12037
|
}
|
|
12027
12038
|
function checkBindingType(bindings, key) {
|
|
12028
|
-
const
|
|
12029
|
-
|
|
12030
|
-
|
|
12039
|
+
const camelName = camelize(key);
|
|
12040
|
+
const PascalName = capitalize(camelName);
|
|
12041
|
+
const checkType = (type) => {
|
|
12042
|
+
if (bindings[key] === type) {
|
|
12043
|
+
return key;
|
|
12044
|
+
}
|
|
12045
|
+
if (bindings[camelName] === type) {
|
|
12046
|
+
return camelName;
|
|
12047
|
+
}
|
|
12048
|
+
if (bindings[PascalName] === type) {
|
|
12049
|
+
return PascalName;
|
|
12050
|
+
}
|
|
12051
|
+
};
|
|
12052
|
+
const fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
|
|
12053
|
+
checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
|
|
12054
|
+
if (fromConst) {
|
|
12055
|
+
return fromConst;
|
|
12056
|
+
}
|
|
12057
|
+
const fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
|
|
12058
|
+
checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
|
|
12059
|
+
checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
|
|
12060
|
+
if (fromMaybeRef) {
|
|
12061
|
+
return fromMaybeRef;
|
|
12031
12062
|
}
|
|
12032
12063
|
}
|
|
12033
12064
|
// hoist static sub-trees out
|
|
@@ -13245,8 +13276,7 @@ function actuallyCompile(options) {
|
|
|
13245
13276
|
};
|
|
13246
13277
|
}
|
|
13247
13278
|
else {
|
|
13248
|
-
//
|
|
13249
|
-
// version of Buble that applies ES2015 transforms + stripping `with` usage
|
|
13279
|
+
// stripping `with` usage
|
|
13250
13280
|
let code = `var __render__ = ${prefixIdentifiers(`function render(${isFunctional ? `_c,_vm` : ``}){${render}\n}`, isFunctional, isTS, transpileOptions, bindings)}\n` +
|
|
13251
13281
|
`var __staticRenderFns__ = [${staticRenderFns.map(code => prefixIdentifiers(`function (${isFunctional ? `_c,_vm` : ``}){${code}\n}`, isFunctional, isTS, transpileOptions, bindings))}]` +
|
|
13252
13282
|
`\n`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-sfc",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.9",
|
|
4
4
|
"description": "compiler-sfc for Vue 2",
|
|
5
5
|
"main": "dist/compiler-sfc.js",
|
|
6
6
|
"types": "dist/compiler-sfc.d.ts",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"postcss-selector-parser": "^6.0.10",
|
|
30
30
|
"pug": "^3.0.2",
|
|
31
31
|
"sass": "^1.52.3",
|
|
32
|
-
"stylus": "^0.58.1"
|
|
33
|
-
"vue-template-es2015-compiler": "^1.9.1"
|
|
32
|
+
"stylus": "^0.58.1"
|
|
34
33
|
}
|
|
35
34
|
}
|