@vue/compat 3.2.9 → 3.2.13
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/vue.cjs.js +438 -292
- package/dist/vue.cjs.prod.js +332 -258
- package/dist/vue.esm-browser.js +247 -200
- package/dist/vue.esm-browser.prod.js +1 -1
- package/dist/vue.esm-bundler.js +249 -200
- package/dist/vue.global.js +250 -207
- package/dist/vue.global.prod.js +1 -1
- package/dist/vue.runtime.esm-browser.js +204 -175
- package/dist/vue.runtime.esm-browser.prod.js +1 -1
- package/dist/vue.runtime.esm-bundler.js +206 -175
- package/dist/vue.runtime.global.js +207 -182
- package/dist/vue.runtime.global.prod.js +1 -1
- package/package.json +2 -2
package/dist/vue.cjs.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var types = require('@babel/types');
|
|
6
|
-
var estreeWalker = require('estree-walker');
|
|
7
3
|
var parser = require('@babel/parser');
|
|
4
|
+
var estreeWalker = require('estree-walker');
|
|
8
5
|
var sourceMap = require('source-map');
|
|
9
6
|
|
|
10
7
|
/**
|
|
@@ -1636,7 +1633,8 @@ class ComputedRefImpl {
|
|
|
1636
1633
|
function computed(getterOrOptions, debugOptions) {
|
|
1637
1634
|
let getter;
|
|
1638
1635
|
let setter;
|
|
1639
|
-
|
|
1636
|
+
const onlyGetter = isFunction(getterOrOptions);
|
|
1637
|
+
if (onlyGetter) {
|
|
1640
1638
|
getter = getterOrOptions;
|
|
1641
1639
|
setter = () => {
|
|
1642
1640
|
console.warn('Write operation failed: computed value is readonly');
|
|
@@ -1647,7 +1645,7 @@ function computed(getterOrOptions, debugOptions) {
|
|
|
1647
1645
|
getter = getterOrOptions.get;
|
|
1648
1646
|
setter = getterOrOptions.set;
|
|
1649
1647
|
}
|
|
1650
|
-
const cRef = new ComputedRefImpl(getter, setter,
|
|
1648
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter);
|
|
1651
1649
|
if (debugOptions) {
|
|
1652
1650
|
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1653
1651
|
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
@@ -1682,41 +1680,33 @@ function registerHMR(instance) {
|
|
|
1682
1680
|
const id = instance.type.__hmrId;
|
|
1683
1681
|
let record = map.get(id);
|
|
1684
1682
|
if (!record) {
|
|
1685
|
-
createRecord(id
|
|
1683
|
+
createRecord(id);
|
|
1686
1684
|
record = map.get(id);
|
|
1687
1685
|
}
|
|
1688
|
-
record.
|
|
1686
|
+
record.add(instance);
|
|
1689
1687
|
}
|
|
1690
1688
|
function unregisterHMR(instance) {
|
|
1691
|
-
map.get(instance.type.__hmrId).
|
|
1689
|
+
map.get(instance.type.__hmrId).delete(instance);
|
|
1692
1690
|
}
|
|
1693
|
-
function createRecord(id
|
|
1694
|
-
if (!component) {
|
|
1695
|
-
warn$1(`HMR API usage is out of date.\n` +
|
|
1696
|
-
`Please upgrade vue-loader/vite/rollup-plugin-vue or other relevant ` +
|
|
1697
|
-
`dependency that handles Vue SFC compilation.`);
|
|
1698
|
-
component = {};
|
|
1699
|
-
}
|
|
1691
|
+
function createRecord(id) {
|
|
1700
1692
|
if (map.has(id)) {
|
|
1701
1693
|
return false;
|
|
1702
1694
|
}
|
|
1703
|
-
map.set(id,
|
|
1704
|
-
component: isClassComponent(component) ? component.__vccOpts : component,
|
|
1705
|
-
instances: new Set()
|
|
1706
|
-
});
|
|
1695
|
+
map.set(id, new Set());
|
|
1707
1696
|
return true;
|
|
1708
1697
|
}
|
|
1698
|
+
function normalizeClassComponent(component) {
|
|
1699
|
+
return isClassComponent(component) ? component.__vccOpts : component;
|
|
1700
|
+
}
|
|
1709
1701
|
function rerender(id, newRender) {
|
|
1710
1702
|
const record = map.get(id);
|
|
1711
|
-
if (!record)
|
|
1703
|
+
if (!record) {
|
|
1712
1704
|
return;
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
// Array.from creates a snapshot which avoids the set being mutated during
|
|
1716
|
-
// updates
|
|
1717
|
-
Array.from(record.instances).forEach(instance => {
|
|
1705
|
+
}
|
|
1706
|
+
[...record].forEach(instance => {
|
|
1718
1707
|
if (newRender) {
|
|
1719
1708
|
instance.render = newRender;
|
|
1709
|
+
normalizeClassComponent(instance.type).render = newRender;
|
|
1720
1710
|
}
|
|
1721
1711
|
instance.renderCache = [];
|
|
1722
1712
|
// this flag forces child components with slot content to update
|
|
@@ -1729,34 +1719,31 @@ function reload(id, newComp) {
|
|
|
1729
1719
|
const record = map.get(id);
|
|
1730
1720
|
if (!record)
|
|
1731
1721
|
return;
|
|
1732
|
-
|
|
1733
|
-
// updates
|
|
1734
|
-
const
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
});
|
|
1751
|
-
}
|
|
1752
|
-
Array.from(instances).forEach(instance => {
|
|
1753
|
-
// invalidate options resolution cache
|
|
1722
|
+
newComp = normalizeClassComponent(newComp);
|
|
1723
|
+
// create a snapshot which avoids the set being mutated during updates
|
|
1724
|
+
const instances = [...record];
|
|
1725
|
+
for (const instance of instances) {
|
|
1726
|
+
const oldComp = normalizeClassComponent(instance.type);
|
|
1727
|
+
if (!hmrDirtyComponents.has(oldComp)) {
|
|
1728
|
+
// 1. Update existing comp definition to match new one
|
|
1729
|
+
extend(oldComp, newComp);
|
|
1730
|
+
for (const key in oldComp) {
|
|
1731
|
+
if (key !== '__file' && !(key in newComp)) {
|
|
1732
|
+
delete oldComp[key];
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
// 2. mark definition dirty. This forces the renderer to replace the
|
|
1736
|
+
// component on patch.
|
|
1737
|
+
hmrDirtyComponents.add(oldComp);
|
|
1738
|
+
}
|
|
1739
|
+
// 3. invalidate options resolution cache
|
|
1754
1740
|
instance.appContext.optionsCache.delete(instance.type);
|
|
1741
|
+
// 4. actually update
|
|
1755
1742
|
if (instance.ceReload) {
|
|
1756
1743
|
// custom element
|
|
1757
|
-
hmrDirtyComponents.add(
|
|
1744
|
+
hmrDirtyComponents.add(oldComp);
|
|
1758
1745
|
instance.ceReload(newComp.styles);
|
|
1759
|
-
hmrDirtyComponents.delete(
|
|
1746
|
+
hmrDirtyComponents.delete(oldComp);
|
|
1760
1747
|
}
|
|
1761
1748
|
else if (instance.parent) {
|
|
1762
1749
|
// 4. Force the parent instance to re-render. This will cause all updated
|
|
@@ -1781,6 +1768,12 @@ function reload(id, newComp) {
|
|
|
1781
1768
|
else {
|
|
1782
1769
|
console.warn('[HMR] Root or manually mounted instance modified. Full reload required.');
|
|
1783
1770
|
}
|
|
1771
|
+
}
|
|
1772
|
+
// 5. make sure to cleanup dirty hmr components after update
|
|
1773
|
+
queuePostFlushCb(() => {
|
|
1774
|
+
for (const instance of instances) {
|
|
1775
|
+
hmrDirtyComponents.delete(normalizeClassComponent(instance.type));
|
|
1776
|
+
}
|
|
1784
1777
|
});
|
|
1785
1778
|
}
|
|
1786
1779
|
function tryWrap(fn) {
|
|
@@ -2107,7 +2100,7 @@ const deprecationData = {
|
|
|
2107
2100
|
["PRIVATE_APIS" /* PRIVATE_APIS */]: {
|
|
2108
2101
|
message: name => `"${name}" is a Vue 2 private API that no longer exists in Vue 3. ` +
|
|
2109
2102
|
`If you are seeing this warning only due to a dependency, you can ` +
|
|
2110
|
-
`suppress this warning via { PRIVATE_APIS: '
|
|
2103
|
+
`suppress this warning via { PRIVATE_APIS: 'suppress-warning' }.`
|
|
2111
2104
|
}
|
|
2112
2105
|
};
|
|
2113
2106
|
const instanceWarned = Object.create(null);
|
|
@@ -2594,12 +2587,12 @@ function markAttrsAccessed() {
|
|
|
2594
2587
|
function renderComponentRoot(instance) {
|
|
2595
2588
|
const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
|
|
2596
2589
|
let result;
|
|
2590
|
+
let fallthroughAttrs;
|
|
2597
2591
|
const prev = setCurrentRenderingInstance(instance);
|
|
2598
2592
|
{
|
|
2599
2593
|
accessedAttrs = false;
|
|
2600
2594
|
}
|
|
2601
2595
|
try {
|
|
2602
|
-
let fallthroughAttrs;
|
|
2603
2596
|
if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
|
|
2604
2597
|
// withProxy is a proxy with a different `has` trap only for
|
|
2605
2598
|
// runtime-compiled render functions using `with` block.
|
|
@@ -2630,108 +2623,105 @@ function renderComponentRoot(instance) {
|
|
|
2630
2623
|
? attrs
|
|
2631
2624
|
: getFunctionalFallthrough(attrs);
|
|
2632
2625
|
}
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2626
|
+
}
|
|
2627
|
+
catch (err) {
|
|
2628
|
+
blockStack.length = 0;
|
|
2629
|
+
handleError(err, instance, 1 /* RENDER_FUNCTION */);
|
|
2630
|
+
result = createVNode(Comment);
|
|
2631
|
+
}
|
|
2632
|
+
// attr merging
|
|
2633
|
+
// in dev mode, comments are preserved, and it's possible for a template
|
|
2634
|
+
// to have comments along side the root element which makes it a fragment
|
|
2635
|
+
let root = result;
|
|
2636
|
+
let setRoot = undefined;
|
|
2637
|
+
if (result.patchFlag > 0 &&
|
|
2638
|
+
result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
2639
|
+
[root, setRoot] = getChildRoot(result);
|
|
2640
|
+
}
|
|
2641
|
+
if (fallthroughAttrs && inheritAttrs !== false) {
|
|
2642
|
+
const keys = Object.keys(fallthroughAttrs);
|
|
2643
|
+
const { shapeFlag } = root;
|
|
2644
|
+
if (keys.length) {
|
|
2645
|
+
if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
|
|
2646
|
+
if (propsOptions && keys.some(isModelListener)) {
|
|
2647
|
+
// If a v-model listener (onUpdate:xxx) has a corresponding declared
|
|
2648
|
+
// prop, it indicates this component expects to handle v-model and
|
|
2649
|
+
// it should not fallthrough.
|
|
2650
|
+
// related: #1543, #1643, #1989
|
|
2651
|
+
fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
|
|
2652
|
+
}
|
|
2653
|
+
root = cloneVNode(root, fallthroughAttrs);
|
|
2654
|
+
}
|
|
2655
|
+
else if (!accessedAttrs && root.type !== Comment) {
|
|
2656
|
+
const allAttrs = Object.keys(attrs);
|
|
2657
|
+
const eventAttrs = [];
|
|
2658
|
+
const extraAttrs = [];
|
|
2659
|
+
for (let i = 0, l = allAttrs.length; i < l; i++) {
|
|
2660
|
+
const key = allAttrs[i];
|
|
2661
|
+
if (isOn(key)) {
|
|
2662
|
+
// ignore v-model handlers when they fail to fallthrough
|
|
2663
|
+
if (!isModelListener(key)) {
|
|
2664
|
+
// remove `on`, lowercase first letter to reflect event casing
|
|
2665
|
+
// accurately
|
|
2666
|
+
eventAttrs.push(key[2].toLowerCase() + key.slice(3));
|
|
2674
2667
|
}
|
|
2675
2668
|
}
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
`${extraAttrs.join(', ')}) ` +
|
|
2679
|
-
`were passed to component but could not be automatically inherited ` +
|
|
2680
|
-
`because component renders fragment or text root nodes.`);
|
|
2681
|
-
}
|
|
2682
|
-
if (eventAttrs.length) {
|
|
2683
|
-
warn$1(`Extraneous non-emits event listeners (` +
|
|
2684
|
-
`${eventAttrs.join(', ')}) ` +
|
|
2685
|
-
`were passed to component but could not be automatically inherited ` +
|
|
2686
|
-
`because component renders fragment or text root nodes. ` +
|
|
2687
|
-
`If the listener is intended to be a component custom event listener only, ` +
|
|
2688
|
-
`declare it using the "emits" option.`);
|
|
2669
|
+
else {
|
|
2670
|
+
extraAttrs.push(key);
|
|
2689
2671
|
}
|
|
2690
2672
|
}
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2673
|
+
if (extraAttrs.length) {
|
|
2674
|
+
warn$1(`Extraneous non-props attributes (` +
|
|
2675
|
+
`${extraAttrs.join(', ')}) ` +
|
|
2676
|
+
`were passed to component but could not be automatically inherited ` +
|
|
2677
|
+
`because component renders fragment or text root nodes.`);
|
|
2678
|
+
}
|
|
2679
|
+
if (eventAttrs.length) {
|
|
2680
|
+
warn$1(`Extraneous non-emits event listeners (` +
|
|
2681
|
+
`${eventAttrs.join(', ')}) ` +
|
|
2682
|
+
`were passed to component but could not be automatically inherited ` +
|
|
2683
|
+
`because component renders fragment or text root nodes. ` +
|
|
2684
|
+
`If the listener is intended to be a component custom event listener only, ` +
|
|
2685
|
+
`declare it using the "emits" option.`);
|
|
2701
2686
|
}
|
|
2702
|
-
root = cloneVNode(root, {
|
|
2703
|
-
class: cls,
|
|
2704
|
-
style: style
|
|
2705
|
-
});
|
|
2706
|
-
}
|
|
2707
|
-
}
|
|
2708
|
-
// inherit directives
|
|
2709
|
-
if (vnode.dirs) {
|
|
2710
|
-
if (true && !isElementRoot(root)) {
|
|
2711
|
-
warn$1(`Runtime directive used on component with non-element root node. ` +
|
|
2712
|
-
`The directives will not function as intended.`);
|
|
2713
2687
|
}
|
|
2714
|
-
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
2715
2688
|
}
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2689
|
+
}
|
|
2690
|
+
if (isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
|
|
2691
|
+
vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
|
|
2692
|
+
root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
|
|
2693
|
+
const { class: cls, style } = vnode.props || {};
|
|
2694
|
+
if (cls || style) {
|
|
2695
|
+
if (inheritAttrs === false) {
|
|
2696
|
+
warnDeprecation("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance, getComponentName(instance.type));
|
|
2721
2697
|
}
|
|
2722
|
-
root
|
|
2698
|
+
root = cloneVNode(root, {
|
|
2699
|
+
class: cls,
|
|
2700
|
+
style: style
|
|
2701
|
+
});
|
|
2723
2702
|
}
|
|
2724
|
-
|
|
2725
|
-
|
|
2703
|
+
}
|
|
2704
|
+
// inherit directives
|
|
2705
|
+
if (vnode.dirs) {
|
|
2706
|
+
if (!isElementRoot(root)) {
|
|
2707
|
+
warn$1(`Runtime directive used on component with non-element root node. ` +
|
|
2708
|
+
`The directives will not function as intended.`);
|
|
2726
2709
|
}
|
|
2727
|
-
|
|
2728
|
-
|
|
2710
|
+
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
2711
|
+
}
|
|
2712
|
+
// inherit transition data
|
|
2713
|
+
if (vnode.transition) {
|
|
2714
|
+
if (!isElementRoot(root)) {
|
|
2715
|
+
warn$1(`Component inside <Transition> renders non-element root node ` +
|
|
2716
|
+
`that cannot be animated.`);
|
|
2729
2717
|
}
|
|
2718
|
+
root.transition = vnode.transition;
|
|
2730
2719
|
}
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2720
|
+
if (setRoot) {
|
|
2721
|
+
setRoot(root);
|
|
2722
|
+
}
|
|
2723
|
+
else {
|
|
2724
|
+
result = root;
|
|
2735
2725
|
}
|
|
2736
2726
|
setCurrentRenderingInstance(prev);
|
|
2737
2727
|
return result;
|
|
@@ -3266,8 +3256,8 @@ function normalizeSuspenseChildren(vnode) {
|
|
|
3266
3256
|
function normalizeSuspenseSlot(s) {
|
|
3267
3257
|
let block;
|
|
3268
3258
|
if (isFunction(s)) {
|
|
3269
|
-
const
|
|
3270
|
-
if (
|
|
3259
|
+
const trackBlock = isBlockTreeEnabled && s._c;
|
|
3260
|
+
if (trackBlock) {
|
|
3271
3261
|
// disableTracking: false
|
|
3272
3262
|
// allow block tracking for compiled slots
|
|
3273
3263
|
// (see ./componentRenderContext.ts)
|
|
@@ -3275,7 +3265,7 @@ function normalizeSuspenseSlot(s) {
|
|
|
3275
3265
|
openBlock();
|
|
3276
3266
|
}
|
|
3277
3267
|
s = s();
|
|
3278
|
-
if (
|
|
3268
|
+
if (trackBlock) {
|
|
3279
3269
|
s._d = true;
|
|
3280
3270
|
block = currentBlock;
|
|
3281
3271
|
closeBlock();
|
|
@@ -5431,7 +5421,7 @@ function createCompatVue(createApp, createSingletonApp) {
|
|
|
5431
5421
|
return vm;
|
|
5432
5422
|
}
|
|
5433
5423
|
}
|
|
5434
|
-
Vue.version = "3.2.
|
|
5424
|
+
Vue.version = "3.2.13";
|
|
5435
5425
|
Vue.config = singletonApp.config;
|
|
5436
5426
|
Vue.use = (p, ...options) => {
|
|
5437
5427
|
if (p && isFunction(p.install)) {
|
|
@@ -5962,7 +5952,7 @@ function createAppAPI(render, hydrate) {
|
|
|
5962
5952
|
app._instance = vnode.component;
|
|
5963
5953
|
devtoolsInitApp(app, version);
|
|
5964
5954
|
}
|
|
5965
|
-
return vnode.component.proxy;
|
|
5955
|
+
return getExposeProxy(vnode.component) || vnode.component.proxy;
|
|
5966
5956
|
}
|
|
5967
5957
|
else {
|
|
5968
5958
|
warn$1(`App has already been mounted.\n` +
|
|
@@ -6171,14 +6161,14 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6171
6161
|
for (const key in props) {
|
|
6172
6162
|
if ((forcePatchValue && key.endsWith('value')) ||
|
|
6173
6163
|
(isOn(key) && !isReservedProp(key))) {
|
|
6174
|
-
patchProp(el, key, null, props[key]);
|
|
6164
|
+
patchProp(el, key, null, props[key], false, undefined, parentComponent);
|
|
6175
6165
|
}
|
|
6176
6166
|
}
|
|
6177
6167
|
}
|
|
6178
6168
|
else if (props.onClick) {
|
|
6179
6169
|
// Fast path for click listeners (which is most often) to avoid
|
|
6180
6170
|
// iterating through props.
|
|
6181
|
-
patchProp(el, 'onClick', null, props.onClick);
|
|
6171
|
+
patchProp(el, 'onClick', null, props.onClick, false, undefined, parentComponent);
|
|
6182
6172
|
}
|
|
6183
6173
|
}
|
|
6184
6174
|
// vnode / directive hooks
|
|
@@ -8079,7 +8069,11 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
8079
8069
|
return Component;
|
|
8080
8070
|
}
|
|
8081
8071
|
if (warnMissing && !res) {
|
|
8082
|
-
|
|
8072
|
+
const extra = type === COMPONENTS
|
|
8073
|
+
? `\nIf this is a native custom element, make sure to exclude it from ` +
|
|
8074
|
+
`component resolution via compilerOptions.isCustomElement.`
|
|
8075
|
+
: ``;
|
|
8076
|
+
warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
|
8083
8077
|
}
|
|
8084
8078
|
return res;
|
|
8085
8079
|
}
|
|
@@ -9521,17 +9515,19 @@ function exposePropsOnRenderContext(instance) {
|
|
|
9521
9515
|
function exposeSetupStateOnRenderContext(instance) {
|
|
9522
9516
|
const { ctx, setupState } = instance;
|
|
9523
9517
|
Object.keys(toRaw(setupState)).forEach(key => {
|
|
9524
|
-
if (!setupState.__isScriptSetup
|
|
9525
|
-
|
|
9526
|
-
`
|
|
9527
|
-
|
|
9518
|
+
if (!setupState.__isScriptSetup) {
|
|
9519
|
+
if (key[0] === '$' || key[0] === '_') {
|
|
9520
|
+
warn$1(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
|
|
9521
|
+
`which are reserved prefixes for Vue internals.`);
|
|
9522
|
+
return;
|
|
9523
|
+
}
|
|
9524
|
+
Object.defineProperty(ctx, key, {
|
|
9525
|
+
enumerable: true,
|
|
9526
|
+
configurable: true,
|
|
9527
|
+
get: () => setupState[key],
|
|
9528
|
+
set: NOOP
|
|
9529
|
+
});
|
|
9528
9530
|
}
|
|
9529
|
-
Object.defineProperty(ctx, key, {
|
|
9530
|
-
enumerable: true,
|
|
9531
|
-
configurable: true,
|
|
9532
|
-
get: () => setupState[key],
|
|
9533
|
-
set: NOOP
|
|
9534
|
-
});
|
|
9535
9531
|
});
|
|
9536
9532
|
}
|
|
9537
9533
|
|
|
@@ -10304,11 +10300,18 @@ function flushJobs(seen) {
|
|
|
10304
10300
|
// 2. If a component is unmounted during a parent component's update,
|
|
10305
10301
|
// its update can be skipped.
|
|
10306
10302
|
queue.sort((a, b) => getId(a) - getId(b));
|
|
10303
|
+
// conditional usage of checkRecursiveUpdate must be determined out of
|
|
10304
|
+
// try ... catch block since Rollup by default de-optimizes treeshaking
|
|
10305
|
+
// inside try-catch. This can leave all warning code unshaked. Although
|
|
10306
|
+
// they would get eventually shaken by a minifier like terser, some minifiers
|
|
10307
|
+
// would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
|
|
10308
|
+
const check = (job) => checkRecursiveUpdates(seen, job)
|
|
10309
|
+
;
|
|
10307
10310
|
try {
|
|
10308
10311
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
10309
10312
|
const job = queue[flushIndex];
|
|
10310
10313
|
if (job && job.active !== false) {
|
|
10311
|
-
if (true &&
|
|
10314
|
+
if (true && check(job)) {
|
|
10312
10315
|
continue;
|
|
10313
10316
|
}
|
|
10314
10317
|
// console.log(`running:`, job.id)
|
|
@@ -10602,7 +10605,7 @@ function createPathGetter(ctx, path) {
|
|
|
10602
10605
|
return cur;
|
|
10603
10606
|
};
|
|
10604
10607
|
}
|
|
10605
|
-
function traverse(value, seen
|
|
10608
|
+
function traverse(value, seen) {
|
|
10606
10609
|
if (!isObject(value) || value["__v_skip" /* SKIP */]) {
|
|
10607
10610
|
return value;
|
|
10608
10611
|
}
|
|
@@ -11018,7 +11021,7 @@ function isMemoSame(cached, memo) {
|
|
|
11018
11021
|
}
|
|
11019
11022
|
|
|
11020
11023
|
// Core API ------------------------------------------------------------------
|
|
11021
|
-
const version = "3.2.
|
|
11024
|
+
const version = "3.2.13";
|
|
11022
11025
|
const _ssrUtils = {
|
|
11023
11026
|
createComponentInstance,
|
|
11024
11027
|
setupComponent,
|
|
@@ -11155,19 +11158,13 @@ function patchClass(el, value, isSVG) {
|
|
|
11155
11158
|
|
|
11156
11159
|
function patchStyle(el, prev, next) {
|
|
11157
11160
|
const style = el.style;
|
|
11161
|
+
const currentDisplay = style.display;
|
|
11158
11162
|
if (!next) {
|
|
11159
11163
|
el.removeAttribute('style');
|
|
11160
11164
|
}
|
|
11161
11165
|
else if (isString(next)) {
|
|
11162
11166
|
if (prev !== next) {
|
|
11163
|
-
const current = style.display;
|
|
11164
11167
|
style.cssText = next;
|
|
11165
|
-
// indicates that the `display` of the element is controlled by `v-show`,
|
|
11166
|
-
// so we always keep the current `display` value regardless of the `style` value,
|
|
11167
|
-
// thus handing over control to `v-show`.
|
|
11168
|
-
if ('_vod' in el) {
|
|
11169
|
-
style.display = current;
|
|
11170
|
-
}
|
|
11171
11168
|
}
|
|
11172
11169
|
}
|
|
11173
11170
|
else {
|
|
@@ -11182,6 +11179,12 @@ function patchStyle(el, prev, next) {
|
|
|
11182
11179
|
}
|
|
11183
11180
|
}
|
|
11184
11181
|
}
|
|
11182
|
+
// indicates that the `display` of the element is controlled by `v-show`,
|
|
11183
|
+
// so we always keep the current `display` value regardless of the `style` value,
|
|
11184
|
+
// thus handing over control to `v-show`.
|
|
11185
|
+
if ('_vod' in el) {
|
|
11186
|
+
style.display = currentDisplay;
|
|
11187
|
+
}
|
|
11185
11188
|
}
|
|
11186
11189
|
const importantRE = /\s*!important$/;
|
|
11187
11190
|
function setStyle(style, name, val) {
|
|
@@ -11552,6 +11555,7 @@ class VueElement extends BaseClass {
|
|
|
11552
11555
|
this._instance = null;
|
|
11553
11556
|
this._connected = false;
|
|
11554
11557
|
this._resolved = false;
|
|
11558
|
+
this._numberProps = null;
|
|
11555
11559
|
if (this.shadowRoot && hydrate) {
|
|
11556
11560
|
hydrate(this._createVNode(), this.shadowRoot);
|
|
11557
11561
|
}
|
|
@@ -11567,18 +11571,17 @@ class VueElement extends BaseClass {
|
|
|
11567
11571
|
this._setAttr(this.attributes[i].name);
|
|
11568
11572
|
}
|
|
11569
11573
|
// watch future attr changes
|
|
11570
|
-
|
|
11574
|
+
new MutationObserver(mutations => {
|
|
11571
11575
|
for (const m of mutations) {
|
|
11572
11576
|
this._setAttr(m.attributeName);
|
|
11573
11577
|
}
|
|
11574
|
-
});
|
|
11575
|
-
observer.observe(this, { attributes: true });
|
|
11578
|
+
}).observe(this, { attributes: true });
|
|
11576
11579
|
}
|
|
11577
11580
|
connectedCallback() {
|
|
11578
11581
|
this._connected = true;
|
|
11579
11582
|
if (!this._instance) {
|
|
11580
11583
|
this._resolveDef();
|
|
11581
|
-
|
|
11584
|
+
this._update();
|
|
11582
11585
|
}
|
|
11583
11586
|
}
|
|
11584
11587
|
disconnectedCallback() {
|
|
@@ -11599,15 +11602,31 @@ class VueElement extends BaseClass {
|
|
|
11599
11602
|
}
|
|
11600
11603
|
const resolve = (def) => {
|
|
11601
11604
|
this._resolved = true;
|
|
11605
|
+
const { props, styles } = def;
|
|
11606
|
+
const hasOptions = !isArray(props);
|
|
11607
|
+
const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
|
|
11608
|
+
// cast Number-type props set before resolve
|
|
11609
|
+
let numberProps;
|
|
11610
|
+
if (hasOptions) {
|
|
11611
|
+
for (const key in this._props) {
|
|
11612
|
+
const opt = props[key];
|
|
11613
|
+
if (opt === Number || (opt && opt.type === Number)) {
|
|
11614
|
+
this._props[key] = toNumber(this._props[key]);
|
|
11615
|
+
(numberProps || (numberProps = Object.create(null)))[key] = true;
|
|
11616
|
+
}
|
|
11617
|
+
}
|
|
11618
|
+
}
|
|
11619
|
+
if (numberProps) {
|
|
11620
|
+
this._numberProps = numberProps;
|
|
11621
|
+
this._update();
|
|
11622
|
+
}
|
|
11602
11623
|
// check if there are props set pre-upgrade or connect
|
|
11603
11624
|
for (const key of Object.keys(this)) {
|
|
11604
11625
|
if (key[0] !== '_') {
|
|
11605
11626
|
this._setProp(key, this[key]);
|
|
11606
11627
|
}
|
|
11607
11628
|
}
|
|
11608
|
-
const { props, styles } = def;
|
|
11609
11629
|
// defining getter/setters on prototype
|
|
11610
|
-
const rawKeys = props ? (isArray(props) ? props : Object.keys(props)) : [];
|
|
11611
11630
|
for (const key of rawKeys.map(camelize)) {
|
|
11612
11631
|
Object.defineProperty(this, key, {
|
|
11613
11632
|
get() {
|
|
@@ -11629,7 +11648,11 @@ class VueElement extends BaseClass {
|
|
|
11629
11648
|
}
|
|
11630
11649
|
}
|
|
11631
11650
|
_setAttr(key) {
|
|
11632
|
-
|
|
11651
|
+
let value = this.getAttribute(key);
|
|
11652
|
+
if (this._numberProps && this._numberProps[key]) {
|
|
11653
|
+
value = toNumber(value);
|
|
11654
|
+
}
|
|
11655
|
+
this._setProp(camelize(key), value, false);
|
|
11633
11656
|
}
|
|
11634
11657
|
/**
|
|
11635
11658
|
* @internal
|
|
@@ -11644,7 +11667,7 @@ class VueElement extends BaseClass {
|
|
|
11644
11667
|
if (val !== this._props[key]) {
|
|
11645
11668
|
this._props[key] = val;
|
|
11646
11669
|
if (this._instance) {
|
|
11647
|
-
|
|
11670
|
+
this._update();
|
|
11648
11671
|
}
|
|
11649
11672
|
// reflect
|
|
11650
11673
|
if (shouldReflect) {
|
|
@@ -11660,6 +11683,9 @@ class VueElement extends BaseClass {
|
|
|
11660
11683
|
}
|
|
11661
11684
|
}
|
|
11662
11685
|
}
|
|
11686
|
+
_update() {
|
|
11687
|
+
render(this._createVNode(), this.shadowRoot);
|
|
11688
|
+
}
|
|
11663
11689
|
_createVNode() {
|
|
11664
11690
|
const vnode = createVNode(this._def, extend({}, this._props));
|
|
11665
11691
|
if (!this._instance) {
|
|
@@ -11680,7 +11706,7 @@ class VueElement extends BaseClass {
|
|
|
11680
11706
|
if (!this._def.__asyncLoader) {
|
|
11681
11707
|
// reload
|
|
11682
11708
|
this._instance = null;
|
|
11683
|
-
|
|
11709
|
+
this._update();
|
|
11684
11710
|
}
|
|
11685
11711
|
};
|
|
11686
11712
|
}
|
|
@@ -12955,7 +12981,7 @@ const errorMessages = {
|
|
|
12955
12981
|
// transform errors
|
|
12956
12982
|
[28 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
|
|
12957
12983
|
[29 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
|
|
12958
|
-
[30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if.`,
|
|
12984
|
+
[30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
|
|
12959
12985
|
[31 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
|
|
12960
12986
|
[32 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
|
|
12961
12987
|
[33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
|
|
@@ -13225,84 +13251,27 @@ function isCoreComponent(tag) {
|
|
|
13225
13251
|
const nonIdentifierRE = /^\d|[^\$\w]/;
|
|
13226
13252
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
13227
13253
|
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
13228
|
-
const
|
|
13229
|
-
|
|
13230
|
-
|
|
13231
|
-
|
|
13232
|
-
|
|
13233
|
-
|
|
13234
|
-
|
|
13235
|
-
|
|
13236
|
-
|
|
13237
|
-
|
|
13238
|
-
|
|
13239
|
-
let state = 0 /* inMemberExp */;
|
|
13240
|
-
let stateStack = [];
|
|
13241
|
-
let currentOpenBracketCount = 0;
|
|
13242
|
-
let currentOpenParensCount = 0;
|
|
13243
|
-
let currentStringType = null;
|
|
13244
|
-
for (let i = 0; i < path.length; i++) {
|
|
13245
|
-
const char = path.charAt(i);
|
|
13246
|
-
switch (state) {
|
|
13247
|
-
case 0 /* inMemberExp */:
|
|
13248
|
-
if (char === '[') {
|
|
13249
|
-
stateStack.push(state);
|
|
13250
|
-
state = 1 /* inBrackets */;
|
|
13251
|
-
currentOpenBracketCount++;
|
|
13252
|
-
}
|
|
13253
|
-
else if (char === '(') {
|
|
13254
|
-
stateStack.push(state);
|
|
13255
|
-
state = 2 /* inParens */;
|
|
13256
|
-
currentOpenParensCount++;
|
|
13257
|
-
}
|
|
13258
|
-
else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
|
|
13259
|
-
return false;
|
|
13260
|
-
}
|
|
13261
|
-
break;
|
|
13262
|
-
case 1 /* inBrackets */:
|
|
13263
|
-
if (char === `'` || char === `"` || char === '`') {
|
|
13264
|
-
stateStack.push(state);
|
|
13265
|
-
state = 3 /* inString */;
|
|
13266
|
-
currentStringType = char;
|
|
13267
|
-
}
|
|
13268
|
-
else if (char === `[`) {
|
|
13269
|
-
currentOpenBracketCount++;
|
|
13270
|
-
}
|
|
13271
|
-
else if (char === `]`) {
|
|
13272
|
-
if (!--currentOpenBracketCount) {
|
|
13273
|
-
state = stateStack.pop();
|
|
13274
|
-
}
|
|
13275
|
-
}
|
|
13276
|
-
break;
|
|
13277
|
-
case 2 /* inParens */:
|
|
13278
|
-
if (char === `'` || char === `"` || char === '`') {
|
|
13279
|
-
stateStack.push(state);
|
|
13280
|
-
state = 3 /* inString */;
|
|
13281
|
-
currentStringType = char;
|
|
13282
|
-
}
|
|
13283
|
-
else if (char === `(`) {
|
|
13284
|
-
currentOpenParensCount++;
|
|
13285
|
-
}
|
|
13286
|
-
else if (char === `)`) {
|
|
13287
|
-
// if the exp ends as a call then it should not be considered valid
|
|
13288
|
-
if (i === path.length - 1) {
|
|
13289
|
-
return false;
|
|
13290
|
-
}
|
|
13291
|
-
if (!--currentOpenParensCount) {
|
|
13292
|
-
state = stateStack.pop();
|
|
13293
|
-
}
|
|
13294
|
-
}
|
|
13295
|
-
break;
|
|
13296
|
-
case 3 /* inString */:
|
|
13297
|
-
if (char === currentStringType) {
|
|
13298
|
-
state = stateStack.pop();
|
|
13299
|
-
currentStringType = null;
|
|
13300
|
-
}
|
|
13301
|
-
break;
|
|
13254
|
+
const isMemberExpressionNode = (path, context) => {
|
|
13255
|
+
path = path.trim();
|
|
13256
|
+
if (!validFirstIdentCharRE.test(path[0])) {
|
|
13257
|
+
return false;
|
|
13258
|
+
}
|
|
13259
|
+
try {
|
|
13260
|
+
let ret = parser.parseExpression(path, {
|
|
13261
|
+
plugins: [...context.expressionPlugins, ...babelParserDefaultPlugins]
|
|
13262
|
+
});
|
|
13263
|
+
if (ret.type === 'TSAsExpression' || ret.type === 'TSTypeAssertion') {
|
|
13264
|
+
ret = ret.expression;
|
|
13302
13265
|
}
|
|
13266
|
+
return (ret.type === 'MemberExpression' ||
|
|
13267
|
+
ret.type === 'OptionalMemberExpression' ||
|
|
13268
|
+
ret.type === 'Identifier');
|
|
13269
|
+
}
|
|
13270
|
+
catch (e) {
|
|
13271
|
+
return false;
|
|
13303
13272
|
}
|
|
13304
|
-
return !currentOpenBracketCount && !currentOpenParensCount;
|
|
13305
13273
|
};
|
|
13274
|
+
const isMemberExpression = isMemberExpressionNode;
|
|
13306
13275
|
function getInnerRange(loc, offset, length) {
|
|
13307
13276
|
const source = loc.source.substr(offset, length);
|
|
13308
13277
|
const newLoc = {
|
|
@@ -14149,6 +14118,13 @@ function parseAttributes(context, type) {
|
|
|
14149
14118
|
emitError(context, 3 /* END_TAG_WITH_ATTRIBUTES */);
|
|
14150
14119
|
}
|
|
14151
14120
|
const attr = parseAttribute(context, attributeNames);
|
|
14121
|
+
// Trim whitespace between class
|
|
14122
|
+
// https://github.com/vuejs/vue-next/issues/4251
|
|
14123
|
+
if (attr.type === 6 /* ATTRIBUTE */ &&
|
|
14124
|
+
attr.value &&
|
|
14125
|
+
attr.name === 'class') {
|
|
14126
|
+
attr.value.content = attr.value.content.replace(/\s+/g, ' ').trim();
|
|
14127
|
+
}
|
|
14152
14128
|
if (type === 0 /* Start */) {
|
|
14153
14129
|
props.push(attr);
|
|
14154
14130
|
}
|
|
@@ -14211,8 +14187,11 @@ function parseAttribute(context, nameSet) {
|
|
|
14211
14187
|
isStatic = false;
|
|
14212
14188
|
if (!content.endsWith(']')) {
|
|
14213
14189
|
emitError(context, 27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
|
|
14190
|
+
content = content.substr(1);
|
|
14191
|
+
}
|
|
14192
|
+
else {
|
|
14193
|
+
content = content.substr(1, content.length - 2);
|
|
14214
14194
|
}
|
|
14215
|
-
content = content.substr(1, content.length - 2);
|
|
14216
14195
|
}
|
|
14217
14196
|
else if (isSlot) {
|
|
14218
14197
|
// #1241 special case for v-slot: vuetify relies extensively on slot
|
|
@@ -14482,7 +14461,7 @@ function walk$1(node, context, doNotHoistNode = false) {
|
|
|
14482
14461
|
// This is only a concern for pre-stringification (via transformHoist by
|
|
14483
14462
|
// @vue/compiler-dom), but doing it here allows us to perform only one full
|
|
14484
14463
|
// walk of the AST and allow `stringifyStatic` to stop walking as soon as its
|
|
14485
|
-
//
|
|
14464
|
+
// stringification threshold is met.
|
|
14486
14465
|
let canStringify = true;
|
|
14487
14466
|
const { children } = node;
|
|
14488
14467
|
const originalCount = children.length;
|
|
@@ -14728,7 +14707,7 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
14728
14707
|
else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
|
|
14729
14708
|
// some helper calls can be hoisted,
|
|
14730
14709
|
// such as the `normalizeProps` generated by the compiler for pre-normalize class,
|
|
14731
|
-
// in this case we need to respect the
|
|
14710
|
+
// in this case we need to respect the ConstantType of the helper's argments
|
|
14732
14711
|
valueType = getConstantTypeOfHelperCall(value, context);
|
|
14733
14712
|
}
|
|
14734
14713
|
else {
|
|
@@ -15379,22 +15358,22 @@ function genHoists(hoists, context) {
|
|
|
15379
15358
|
const { push, newline, helper, scopeId, mode } = context;
|
|
15380
15359
|
const genScopeId = scopeId != null && mode !== 'function';
|
|
15381
15360
|
newline();
|
|
15382
|
-
//
|
|
15383
|
-
// get the proper scopeId as well.
|
|
15361
|
+
// generate inlined withScopeId helper
|
|
15384
15362
|
if (genScopeId) {
|
|
15385
|
-
push(
|
|
15363
|
+
push(`const _withScopeId = n => (${helper(PUSH_SCOPE_ID)}("${scopeId}"),n=n(),${helper(POP_SCOPE_ID)}(),n)`);
|
|
15386
15364
|
newline();
|
|
15387
15365
|
}
|
|
15388
|
-
hoists.
|
|
15366
|
+
for (let i = 0; i < hoists.length; i++) {
|
|
15367
|
+
const exp = hoists[i];
|
|
15389
15368
|
if (exp) {
|
|
15390
|
-
|
|
15369
|
+
const needScopeIdWrapper = genScopeId && exp.type === 13 /* VNODE_CALL */;
|
|
15370
|
+
push(`const _hoisted_${i + 1} = ${needScopeIdWrapper ? `${PURE_ANNOTATION} _withScopeId(() => ` : ``}`);
|
|
15391
15371
|
genNode(exp, context);
|
|
15372
|
+
if (needScopeIdWrapper) {
|
|
15373
|
+
push(`)`);
|
|
15374
|
+
}
|
|
15392
15375
|
newline();
|
|
15393
15376
|
}
|
|
15394
|
-
});
|
|
15395
|
-
if (genScopeId) {
|
|
15396
|
-
push(`${helper(POP_SCOPE_ID)}()`);
|
|
15397
|
-
newline();
|
|
15398
15377
|
}
|
|
15399
15378
|
context.pure = false;
|
|
15400
15379
|
}
|
|
@@ -15883,7 +15862,7 @@ function isReferencedIdentifier(id, parent, parentStack) {
|
|
|
15883
15862
|
if (id.name === 'arguments') {
|
|
15884
15863
|
return false;
|
|
15885
15864
|
}
|
|
15886
|
-
if (
|
|
15865
|
+
if (isReferenced(id, parent)) {
|
|
15887
15866
|
return true;
|
|
15888
15867
|
}
|
|
15889
15868
|
// babel's isReferenced check returns false for ids being assigned to, so we
|
|
@@ -15996,7 +15975,159 @@ const isFunctionType = (node) => {
|
|
|
15996
15975
|
const isStaticProperty = (node) => node &&
|
|
15997
15976
|
(node.type === 'ObjectProperty' || node.type === 'ObjectMethod') &&
|
|
15998
15977
|
!node.computed;
|
|
15999
|
-
const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node;
|
|
15978
|
+
const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node;
|
|
15979
|
+
/**
|
|
15980
|
+
* Copied from https://github.com/babel/babel/blob/main/packages/babel-types/src/validators/isReferenced.ts
|
|
15981
|
+
* To avoid runtime dependency on @babel/types (which includes process references)
|
|
15982
|
+
* This file should not change very often in babel but we may need to keep it
|
|
15983
|
+
* up-to-date from time to time.
|
|
15984
|
+
*
|
|
15985
|
+
* https://github.com/babel/babel/blob/main/LICENSE
|
|
15986
|
+
*
|
|
15987
|
+
*/
|
|
15988
|
+
function isReferenced(node, parent, grandparent) {
|
|
15989
|
+
switch (parent.type) {
|
|
15990
|
+
// yes: PARENT[NODE]
|
|
15991
|
+
// yes: NODE.child
|
|
15992
|
+
// no: parent.NODE
|
|
15993
|
+
case 'MemberExpression':
|
|
15994
|
+
case 'OptionalMemberExpression':
|
|
15995
|
+
if (parent.property === node) {
|
|
15996
|
+
return !!parent.computed;
|
|
15997
|
+
}
|
|
15998
|
+
return parent.object === node;
|
|
15999
|
+
case 'JSXMemberExpression':
|
|
16000
|
+
return parent.object === node;
|
|
16001
|
+
// no: let NODE = init;
|
|
16002
|
+
// yes: let id = NODE;
|
|
16003
|
+
case 'VariableDeclarator':
|
|
16004
|
+
return parent.init === node;
|
|
16005
|
+
// yes: () => NODE
|
|
16006
|
+
// no: (NODE) => {}
|
|
16007
|
+
case 'ArrowFunctionExpression':
|
|
16008
|
+
return parent.body === node;
|
|
16009
|
+
// no: class { #NODE; }
|
|
16010
|
+
// no: class { get #NODE() {} }
|
|
16011
|
+
// no: class { #NODE() {} }
|
|
16012
|
+
// no: class { fn() { return this.#NODE; } }
|
|
16013
|
+
case 'PrivateName':
|
|
16014
|
+
return false;
|
|
16015
|
+
// no: class { NODE() {} }
|
|
16016
|
+
// yes: class { [NODE]() {} }
|
|
16017
|
+
// no: class { foo(NODE) {} }
|
|
16018
|
+
case 'ClassMethod':
|
|
16019
|
+
case 'ClassPrivateMethod':
|
|
16020
|
+
case 'ObjectMethod':
|
|
16021
|
+
if (parent.key === node) {
|
|
16022
|
+
return !!parent.computed;
|
|
16023
|
+
}
|
|
16024
|
+
return false;
|
|
16025
|
+
// yes: { [NODE]: "" }
|
|
16026
|
+
// no: { NODE: "" }
|
|
16027
|
+
// depends: { NODE }
|
|
16028
|
+
// depends: { key: NODE }
|
|
16029
|
+
case 'ObjectProperty':
|
|
16030
|
+
if (parent.key === node) {
|
|
16031
|
+
return !!parent.computed;
|
|
16032
|
+
}
|
|
16033
|
+
// parent.value === node
|
|
16034
|
+
return !grandparent || grandparent.type !== 'ObjectPattern';
|
|
16035
|
+
// no: class { NODE = value; }
|
|
16036
|
+
// yes: class { [NODE] = value; }
|
|
16037
|
+
// yes: class { key = NODE; }
|
|
16038
|
+
case 'ClassProperty':
|
|
16039
|
+
if (parent.key === node) {
|
|
16040
|
+
return !!parent.computed;
|
|
16041
|
+
}
|
|
16042
|
+
return true;
|
|
16043
|
+
case 'ClassPrivateProperty':
|
|
16044
|
+
return parent.key !== node;
|
|
16045
|
+
// no: class NODE {}
|
|
16046
|
+
// yes: class Foo extends NODE {}
|
|
16047
|
+
case 'ClassDeclaration':
|
|
16048
|
+
case 'ClassExpression':
|
|
16049
|
+
return parent.superClass === node;
|
|
16050
|
+
// yes: left = NODE;
|
|
16051
|
+
// no: NODE = right;
|
|
16052
|
+
case 'AssignmentExpression':
|
|
16053
|
+
return parent.right === node;
|
|
16054
|
+
// no: [NODE = foo] = [];
|
|
16055
|
+
// yes: [foo = NODE] = [];
|
|
16056
|
+
case 'AssignmentPattern':
|
|
16057
|
+
return parent.right === node;
|
|
16058
|
+
// no: NODE: for (;;) {}
|
|
16059
|
+
case 'LabeledStatement':
|
|
16060
|
+
return false;
|
|
16061
|
+
// no: try {} catch (NODE) {}
|
|
16062
|
+
case 'CatchClause':
|
|
16063
|
+
return false;
|
|
16064
|
+
// no: function foo(...NODE) {}
|
|
16065
|
+
case 'RestElement':
|
|
16066
|
+
return false;
|
|
16067
|
+
case 'BreakStatement':
|
|
16068
|
+
case 'ContinueStatement':
|
|
16069
|
+
return false;
|
|
16070
|
+
// no: function NODE() {}
|
|
16071
|
+
// no: function foo(NODE) {}
|
|
16072
|
+
case 'FunctionDeclaration':
|
|
16073
|
+
case 'FunctionExpression':
|
|
16074
|
+
return false;
|
|
16075
|
+
// no: export NODE from "foo";
|
|
16076
|
+
// no: export * as NODE from "foo";
|
|
16077
|
+
case 'ExportNamespaceSpecifier':
|
|
16078
|
+
case 'ExportDefaultSpecifier':
|
|
16079
|
+
return false;
|
|
16080
|
+
// no: export { foo as NODE };
|
|
16081
|
+
// yes: export { NODE as foo };
|
|
16082
|
+
// no: export { NODE as foo } from "foo";
|
|
16083
|
+
case 'ExportSpecifier':
|
|
16084
|
+
// @ts-expect-error
|
|
16085
|
+
if (grandparent === null || grandparent === void 0 ? void 0 : grandparent.source) {
|
|
16086
|
+
return false;
|
|
16087
|
+
}
|
|
16088
|
+
return parent.local === node;
|
|
16089
|
+
// no: import NODE from "foo";
|
|
16090
|
+
// no: import * as NODE from "foo";
|
|
16091
|
+
// no: import { NODE as foo } from "foo";
|
|
16092
|
+
// no: import { foo as NODE } from "foo";
|
|
16093
|
+
// no: import NODE from "bar";
|
|
16094
|
+
case 'ImportDefaultSpecifier':
|
|
16095
|
+
case 'ImportNamespaceSpecifier':
|
|
16096
|
+
case 'ImportSpecifier':
|
|
16097
|
+
return false;
|
|
16098
|
+
// no: import "foo" assert { NODE: "json" }
|
|
16099
|
+
case 'ImportAttribute':
|
|
16100
|
+
return false;
|
|
16101
|
+
// no: <div NODE="foo" />
|
|
16102
|
+
case 'JSXAttribute':
|
|
16103
|
+
return false;
|
|
16104
|
+
// no: [NODE] = [];
|
|
16105
|
+
// no: ({ NODE }) = [];
|
|
16106
|
+
case 'ObjectPattern':
|
|
16107
|
+
case 'ArrayPattern':
|
|
16108
|
+
return false;
|
|
16109
|
+
// no: new.NODE
|
|
16110
|
+
// no: NODE.target
|
|
16111
|
+
case 'MetaProperty':
|
|
16112
|
+
return false;
|
|
16113
|
+
// yes: type X = { somePropert: NODE }
|
|
16114
|
+
// no: type X = { NODE: OtherType }
|
|
16115
|
+
case 'ObjectTypeProperty':
|
|
16116
|
+
return parent.key !== node;
|
|
16117
|
+
// yes: enum X { Foo = NODE }
|
|
16118
|
+
// no: enum X { NODE }
|
|
16119
|
+
case 'TSEnumMember':
|
|
16120
|
+
return parent.id !== node;
|
|
16121
|
+
// yes: { [NODE]: value }
|
|
16122
|
+
// no: { NODE: value }
|
|
16123
|
+
case 'TSPropertySignature':
|
|
16124
|
+
if (parent.key === node) {
|
|
16125
|
+
return !!parent.computed;
|
|
16126
|
+
}
|
|
16127
|
+
return true;
|
|
16128
|
+
}
|
|
16129
|
+
return true;
|
|
16130
|
+
}
|
|
16000
16131
|
|
|
16001
16132
|
const isLiteralWhitelisted = /*#__PURE__*/ makeMap('true,false,null,this');
|
|
16002
16133
|
const transformExpression = (node, context) => {
|
|
@@ -16328,6 +16459,11 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
16328
16459
|
continue;
|
|
16329
16460
|
}
|
|
16330
16461
|
if (sibling && sibling.type === 9 /* IF */) {
|
|
16462
|
+
// Check if v-else was followed by v-else-if
|
|
16463
|
+
if (dir.name === 'else-if' &&
|
|
16464
|
+
sibling.branches[sibling.branches.length - 1].condition === undefined) {
|
|
16465
|
+
context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
|
|
16466
|
+
}
|
|
16331
16467
|
// move the node to the if node's branches
|
|
16332
16468
|
context.removeNode();
|
|
16333
16469
|
const branch = createIfBranch(node, dir);
|
|
@@ -17294,7 +17430,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
17294
17430
|
// acrtual ref instead.
|
|
17295
17431
|
if (context.inline && (value === null || value === void 0 ? void 0 : value.content)) {
|
|
17296
17432
|
valueNode = createFunctionExpression(['_value', '_refs']);
|
|
17297
|
-
valueNode.body = createBlockStatement(processInlineRef(context
|
|
17433
|
+
valueNode.body = createBlockStatement(processInlineRef(context, value.content));
|
|
17298
17434
|
}
|
|
17299
17435
|
}
|
|
17300
17436
|
// skip is on <component>, or is="vue:xxx"
|
|
@@ -17540,7 +17676,7 @@ function dedupeProperties(properties) {
|
|
|
17540
17676
|
const name = prop.key.content;
|
|
17541
17677
|
const existing = knownProps.get(name);
|
|
17542
17678
|
if (existing) {
|
|
17543
|
-
if (name === 'style' || name === 'class' || name
|
|
17679
|
+
if (name === 'style' || name === 'class' || isOn(name)) {
|
|
17544
17680
|
mergeAsArray$1(existing, prop);
|
|
17545
17681
|
}
|
|
17546
17682
|
// unexpected duplicate, should have emitted error during parse
|
|
@@ -17614,14 +17750,18 @@ function stringifyDynamicPropNames(props) {
|
|
|
17614
17750
|
function isComponentTag(tag) {
|
|
17615
17751
|
return tag[0].toLowerCase() + tag.slice(1) === 'component';
|
|
17616
17752
|
}
|
|
17617
|
-
function processInlineRef(
|
|
17753
|
+
function processInlineRef(context, raw) {
|
|
17618
17754
|
const body = [createSimpleExpression(`_refs['${raw}'] = _value`)];
|
|
17619
|
-
const
|
|
17755
|
+
const { bindingMetadata, helperString } = context;
|
|
17756
|
+
const type = bindingMetadata[raw];
|
|
17620
17757
|
if (type === "setup-ref" /* SETUP_REF */) {
|
|
17621
17758
|
body.push(createSimpleExpression(`${raw}.value = _value`));
|
|
17622
17759
|
}
|
|
17760
|
+
else if (type === "setup-maybe-ref" /* SETUP_MAYBE_REF */) {
|
|
17761
|
+
body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) && (${raw}.value = _value)`));
|
|
17762
|
+
}
|
|
17623
17763
|
else if (type === "setup-let" /* SETUP_LET */) {
|
|
17624
|
-
body.push(createSimpleExpression(`${raw} = _value`));
|
|
17764
|
+
body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) ? ${raw}.value = _value : ${raw} = _value`));
|
|
17625
17765
|
}
|
|
17626
17766
|
return body;
|
|
17627
17767
|
}
|
|
@@ -17632,26 +17772,24 @@ const transformSlotOutlet = (node, context) => {
|
|
|
17632
17772
|
const { slotName, slotProps } = processSlotOutlet(node, context);
|
|
17633
17773
|
const slotArgs = [
|
|
17634
17774
|
context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
|
|
17635
|
-
slotName
|
|
17775
|
+
slotName,
|
|
17776
|
+
'{}',
|
|
17777
|
+
'undefined',
|
|
17778
|
+
'true'
|
|
17636
17779
|
];
|
|
17780
|
+
let expectedLen = 2;
|
|
17637
17781
|
if (slotProps) {
|
|
17638
|
-
slotArgs
|
|
17782
|
+
slotArgs[2] = slotProps;
|
|
17783
|
+
expectedLen = 3;
|
|
17639
17784
|
}
|
|
17640
17785
|
if (children.length) {
|
|
17641
|
-
|
|
17642
|
-
|
|
17643
|
-
}
|
|
17644
|
-
slotArgs.push(createFunctionExpression([], children, false, false, loc));
|
|
17786
|
+
slotArgs[3] = createFunctionExpression([], children, false, false, loc);
|
|
17787
|
+
expectedLen = 4;
|
|
17645
17788
|
}
|
|
17646
17789
|
if (context.scopeId && !context.slotted) {
|
|
17647
|
-
|
|
17648
|
-
slotArgs.push(`{}`);
|
|
17649
|
-
}
|
|
17650
|
-
if (!children.length) {
|
|
17651
|
-
slotArgs.push(`undefined`);
|
|
17652
|
-
}
|
|
17653
|
-
slotArgs.push(`true`);
|
|
17790
|
+
expectedLen = 5;
|
|
17654
17791
|
}
|
|
17792
|
+
slotArgs.splice(expectedLen); // remove unused arguments
|
|
17655
17793
|
node.codegenNode = createCallExpression(context.helper(RENDER_SLOT), slotArgs, loc);
|
|
17656
17794
|
}
|
|
17657
17795
|
};
|
|
@@ -17698,7 +17836,7 @@ function processSlotOutlet(node, context) {
|
|
|
17698
17836
|
};
|
|
17699
17837
|
}
|
|
17700
17838
|
|
|
17701
|
-
const fnExpRE = /^\s*([\w$_]
|
|
17839
|
+
const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
17702
17840
|
const transformOn = (dir, node, context, augmentor) => {
|
|
17703
17841
|
const { loc, modifiers, arg } = dir;
|
|
17704
17842
|
if (!dir.exp && !modifiers.length) {
|
|
@@ -17733,7 +17871,7 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
17733
17871
|
}
|
|
17734
17872
|
let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
|
|
17735
17873
|
if (exp) {
|
|
17736
|
-
const isMemberExp = isMemberExpression(exp.content);
|
|
17874
|
+
const isMemberExp = isMemberExpression(exp.content, context);
|
|
17737
17875
|
const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
|
|
17738
17876
|
const hasMultipleStatements = exp.content.includes(`;`);
|
|
17739
17877
|
// process the expression since it's been skipped
|
|
@@ -17990,7 +18128,8 @@ const transformModel = (dir, node, context) => {
|
|
|
17990
18128
|
const maybeRef = context.inline &&
|
|
17991
18129
|
bindingType &&
|
|
17992
18130
|
bindingType !== "setup-const" /* SETUP_CONST */;
|
|
17993
|
-
if (!expString.trim() ||
|
|
18131
|
+
if (!expString.trim() ||
|
|
18132
|
+
(!isMemberExpression(expString, context) && !maybeRef)) {
|
|
17994
18133
|
context.onError(createCompilerError(42 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
|
|
17995
18134
|
return createTransformProps();
|
|
17996
18135
|
}
|
|
@@ -18299,6 +18438,12 @@ function baseCompile(template, options = {}) {
|
|
|
18299
18438
|
}
|
|
18300
18439
|
const ast = isString(template) ? baseParse(template, options) : template;
|
|
18301
18440
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
|
|
18441
|
+
if (options.isTS) {
|
|
18442
|
+
const { expressionPlugins } = options;
|
|
18443
|
+
if (!expressionPlugins || !expressionPlugins.includes('typescript')) {
|
|
18444
|
+
options.expressionPlugins = [...(expressionPlugins || []), 'typescript'];
|
|
18445
|
+
}
|
|
18446
|
+
}
|
|
18302
18447
|
transform(ast, extend({}, options, {
|
|
18303
18448
|
prefixIdentifiers,
|
|
18304
18449
|
nodeTransforms: [
|
|
@@ -21065,7 +21210,8 @@ const warnTransitionChildren = (node, context) => {
|
|
|
21065
21210
|
};
|
|
21066
21211
|
function hasMultipleChildren(node) {
|
|
21067
21212
|
// #1352 filter out potential comment nodes.
|
|
21068
|
-
const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */
|
|
21213
|
+
const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */ &&
|
|
21214
|
+
!(c.type === 2 /* TEXT */ && !c.content.trim())));
|
|
21069
21215
|
const child = children[0];
|
|
21070
21216
|
return (children.length !== 1 ||
|
|
21071
21217
|
child.type === 11 /* FOR */ ||
|
|
@@ -21423,4 +21569,4 @@ registerRuntimeCompiler(compileToFunction);
|
|
|
21423
21569
|
const Vue = createCompatVue$1();
|
|
21424
21570
|
Vue.compile = compileToFunction;
|
|
21425
21571
|
|
|
21426
|
-
exports
|
|
21572
|
+
module.exports = Vue;
|