@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.prod.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
|
/**
|
|
@@ -1479,7 +1476,8 @@ class ComputedRefImpl {
|
|
|
1479
1476
|
function computed(getterOrOptions, debugOptions) {
|
|
1480
1477
|
let getter;
|
|
1481
1478
|
let setter;
|
|
1482
|
-
|
|
1479
|
+
const onlyGetter = isFunction(getterOrOptions);
|
|
1480
|
+
if (onlyGetter) {
|
|
1483
1481
|
getter = getterOrOptions;
|
|
1484
1482
|
setter = NOOP;
|
|
1485
1483
|
}
|
|
@@ -1487,7 +1485,7 @@ function computed(getterOrOptions, debugOptions) {
|
|
|
1487
1485
|
getter = getterOrOptions.get;
|
|
1488
1486
|
setter = getterOrOptions.set;
|
|
1489
1487
|
}
|
|
1490
|
-
const cRef = new ComputedRefImpl(getter, setter,
|
|
1488
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter);
|
|
1491
1489
|
return cRef;
|
|
1492
1490
|
}
|
|
1493
1491
|
|
|
@@ -1852,21 +1850,14 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // true onl
|
|
|
1852
1850
|
return renderFnWithContext;
|
|
1853
1851
|
}
|
|
1854
1852
|
|
|
1855
|
-
/**
|
|
1856
|
-
* dev only flag to track whether $attrs was used during render.
|
|
1857
|
-
* If $attrs was used during render then the warning for failed attrs
|
|
1858
|
-
* fallthrough can be suppressed.
|
|
1859
|
-
*/
|
|
1860
|
-
let accessedAttrs = false;
|
|
1861
1853
|
function markAttrsAccessed() {
|
|
1862
|
-
accessedAttrs = true;
|
|
1863
1854
|
}
|
|
1864
1855
|
function renderComponentRoot(instance) {
|
|
1865
1856
|
const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
|
|
1866
1857
|
let result;
|
|
1858
|
+
let fallthroughAttrs;
|
|
1867
1859
|
const prev = setCurrentRenderingInstance(instance);
|
|
1868
1860
|
try {
|
|
1869
|
-
let fallthroughAttrs;
|
|
1870
1861
|
if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
|
|
1871
1862
|
// withProxy is a proxy with a different `has` trap only for
|
|
1872
1863
|
// runtime-compiled render functions using `with` block.
|
|
@@ -1895,95 +1886,57 @@ function renderComponentRoot(instance) {
|
|
|
1895
1886
|
? attrs
|
|
1896
1887
|
: getFunctionalFallthrough(attrs);
|
|
1897
1888
|
}
|
|
1898
|
-
// attr merging
|
|
1899
|
-
// in dev mode, comments are preserved, and it's possible for a template
|
|
1900
|
-
// to have comments along side the root element which makes it a fragment
|
|
1901
|
-
let root = result;
|
|
1902
|
-
let setRoot = undefined;
|
|
1903
|
-
if (false &&
|
|
1904
|
-
result.patchFlag > 0 &&
|
|
1905
|
-
result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) ;
|
|
1906
|
-
if (fallthroughAttrs && inheritAttrs !== false) {
|
|
1907
|
-
const keys = Object.keys(fallthroughAttrs);
|
|
1908
|
-
const { shapeFlag } = root;
|
|
1909
|
-
if (keys.length) {
|
|
1910
|
-
if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
|
|
1911
|
-
if (propsOptions && keys.some(isModelListener)) {
|
|
1912
|
-
// If a v-model listener (onUpdate:xxx) has a corresponding declared
|
|
1913
|
-
// prop, it indicates this component expects to handle v-model and
|
|
1914
|
-
// it should not fallthrough.
|
|
1915
|
-
// related: #1543, #1643, #1989
|
|
1916
|
-
fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
|
|
1917
|
-
}
|
|
1918
|
-
root = cloneVNode(root, fallthroughAttrs);
|
|
1919
|
-
}
|
|
1920
|
-
else if (false && !accessedAttrs && root.type !== Comment) ;
|
|
1921
|
-
}
|
|
1922
|
-
}
|
|
1923
|
-
if (true &&
|
|
1924
|
-
isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
|
|
1925
|
-
vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
|
|
1926
|
-
root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
|
|
1927
|
-
const { class: cls, style } = vnode.props || {};
|
|
1928
|
-
if (cls || style) {
|
|
1929
|
-
if (false && inheritAttrs === false) ;
|
|
1930
|
-
root = cloneVNode(root, {
|
|
1931
|
-
class: cls,
|
|
1932
|
-
style: style
|
|
1933
|
-
});
|
|
1934
|
-
}
|
|
1935
|
-
}
|
|
1936
|
-
// inherit directives
|
|
1937
|
-
if (vnode.dirs) {
|
|
1938
|
-
if (false && !isElementRoot(root)) ;
|
|
1939
|
-
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
1940
|
-
}
|
|
1941
|
-
// inherit transition data
|
|
1942
|
-
if (vnode.transition) {
|
|
1943
|
-
if (false && !isElementRoot(root)) ;
|
|
1944
|
-
root.transition = vnode.transition;
|
|
1945
|
-
}
|
|
1946
|
-
if (false && setRoot) ;
|
|
1947
|
-
else {
|
|
1948
|
-
result = root;
|
|
1949
|
-
}
|
|
1950
1889
|
}
|
|
1951
1890
|
catch (err) {
|
|
1952
1891
|
blockStack.length = 0;
|
|
1953
1892
|
handleError(err, instance, 1 /* RENDER_FUNCTION */);
|
|
1954
1893
|
result = createVNode(Comment);
|
|
1955
1894
|
}
|
|
1895
|
+
// attr merging
|
|
1896
|
+
// in dev mode, comments are preserved, and it's possible for a template
|
|
1897
|
+
// to have comments along side the root element which makes it a fragment
|
|
1898
|
+
let root = result;
|
|
1899
|
+
if (fallthroughAttrs && inheritAttrs !== false) {
|
|
1900
|
+
const keys = Object.keys(fallthroughAttrs);
|
|
1901
|
+
const { shapeFlag } = root;
|
|
1902
|
+
if (keys.length) {
|
|
1903
|
+
if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
|
|
1904
|
+
if (propsOptions && keys.some(isModelListener)) {
|
|
1905
|
+
// If a v-model listener (onUpdate:xxx) has a corresponding declared
|
|
1906
|
+
// prop, it indicates this component expects to handle v-model and
|
|
1907
|
+
// it should not fallthrough.
|
|
1908
|
+
// related: #1543, #1643, #1989
|
|
1909
|
+
fallthroughAttrs = filterModelListeners(fallthroughAttrs, propsOptions);
|
|
1910
|
+
}
|
|
1911
|
+
root = cloneVNode(root, fallthroughAttrs);
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
if (isCompatEnabled("INSTANCE_ATTRS_CLASS_STYLE" /* INSTANCE_ATTRS_CLASS_STYLE */, instance) &&
|
|
1916
|
+
vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */ &&
|
|
1917
|
+
root.shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
|
|
1918
|
+
const { class: cls, style } = vnode.props || {};
|
|
1919
|
+
if (cls || style) {
|
|
1920
|
+
root = cloneVNode(root, {
|
|
1921
|
+
class: cls,
|
|
1922
|
+
style: style
|
|
1923
|
+
});
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
// inherit directives
|
|
1927
|
+
if (vnode.dirs) {
|
|
1928
|
+
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
1929
|
+
}
|
|
1930
|
+
// inherit transition data
|
|
1931
|
+
if (vnode.transition) {
|
|
1932
|
+
root.transition = vnode.transition;
|
|
1933
|
+
}
|
|
1934
|
+
{
|
|
1935
|
+
result = root;
|
|
1936
|
+
}
|
|
1956
1937
|
setCurrentRenderingInstance(prev);
|
|
1957
1938
|
return result;
|
|
1958
1939
|
}
|
|
1959
|
-
/**
|
|
1960
|
-
* dev only
|
|
1961
|
-
* In dev mode, template root level comments are rendered, which turns the
|
|
1962
|
-
* template into a fragment root, but we need to locate the single element
|
|
1963
|
-
* root for attrs and scope id processing.
|
|
1964
|
-
*/
|
|
1965
|
-
const getChildRoot = (vnode) => {
|
|
1966
|
-
const rawChildren = vnode.children;
|
|
1967
|
-
const dynamicChildren = vnode.dynamicChildren;
|
|
1968
|
-
const childRoot = filterSingleRoot(rawChildren);
|
|
1969
|
-
if (!childRoot) {
|
|
1970
|
-
return [vnode, undefined];
|
|
1971
|
-
}
|
|
1972
|
-
const index = rawChildren.indexOf(childRoot);
|
|
1973
|
-
const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;
|
|
1974
|
-
const setRoot = (updatedRoot) => {
|
|
1975
|
-
rawChildren[index] = updatedRoot;
|
|
1976
|
-
if (dynamicChildren) {
|
|
1977
|
-
if (dynamicIndex > -1) {
|
|
1978
|
-
dynamicChildren[dynamicIndex] = updatedRoot;
|
|
1979
|
-
}
|
|
1980
|
-
else if (updatedRoot.patchFlag > 0) {
|
|
1981
|
-
vnode.dynamicChildren = [...dynamicChildren, updatedRoot];
|
|
1982
|
-
}
|
|
1983
|
-
}
|
|
1984
|
-
};
|
|
1985
|
-
return [normalizeVNode(childRoot), setRoot];
|
|
1986
|
-
};
|
|
1987
1940
|
function filterSingleRoot(children) {
|
|
1988
1941
|
let singleRoot;
|
|
1989
1942
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -2024,11 +1977,6 @@ const filterModelListeners = (attrs, props) => {
|
|
|
2024
1977
|
}
|
|
2025
1978
|
return res;
|
|
2026
1979
|
};
|
|
2027
|
-
const isElementRoot = (vnode) => {
|
|
2028
|
-
return (vnode.shapeFlag & (6 /* COMPONENT */ | 1 /* ELEMENT */) ||
|
|
2029
|
-
vnode.type === Comment // potential v-if branch switch
|
|
2030
|
-
);
|
|
2031
|
-
};
|
|
2032
1980
|
function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
|
2033
1981
|
const { props: prevProps, children: prevChildren, component } = prevVNode;
|
|
2034
1982
|
const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
|
|
@@ -2459,8 +2407,8 @@ function normalizeSuspenseChildren(vnode) {
|
|
|
2459
2407
|
function normalizeSuspenseSlot(s) {
|
|
2460
2408
|
let block;
|
|
2461
2409
|
if (isFunction(s)) {
|
|
2462
|
-
const
|
|
2463
|
-
if (
|
|
2410
|
+
const trackBlock = isBlockTreeEnabled && s._c;
|
|
2411
|
+
if (trackBlock) {
|
|
2464
2412
|
// disableTracking: false
|
|
2465
2413
|
// allow block tracking for compiled slots
|
|
2466
2414
|
// (see ./componentRenderContext.ts)
|
|
@@ -2468,7 +2416,7 @@ function normalizeSuspenseSlot(s) {
|
|
|
2468
2416
|
openBlock();
|
|
2469
2417
|
}
|
|
2470
2418
|
s = s();
|
|
2471
|
-
if (
|
|
2419
|
+
if (trackBlock) {
|
|
2472
2420
|
s._d = true;
|
|
2473
2421
|
block = currentBlock;
|
|
2474
2422
|
closeBlock();
|
|
@@ -4285,7 +4233,7 @@ function createCompatVue(createApp, createSingletonApp) {
|
|
|
4285
4233
|
return vm;
|
|
4286
4234
|
}
|
|
4287
4235
|
}
|
|
4288
|
-
Vue.version = "3.2.
|
|
4236
|
+
Vue.version = "3.2.13";
|
|
4289
4237
|
Vue.config = singletonApp.config;
|
|
4290
4238
|
Vue.use = (p, ...options) => {
|
|
4291
4239
|
if (p && isFunction(p.install)) {
|
|
@@ -4741,7 +4689,7 @@ function createAppAPI(render, hydrate) {
|
|
|
4741
4689
|
isMounted = true;
|
|
4742
4690
|
app._container = rootContainer;
|
|
4743
4691
|
rootContainer.__vue_app__ = app;
|
|
4744
|
-
return vnode.component.proxy;
|
|
4692
|
+
return getExposeProxy(vnode.component) || vnode.component.proxy;
|
|
4745
4693
|
}
|
|
4746
4694
|
},
|
|
4747
4695
|
unmount() {
|
|
@@ -4926,14 +4874,14 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4926
4874
|
for (const key in props) {
|
|
4927
4875
|
if ((forcePatchValue && key.endsWith('value')) ||
|
|
4928
4876
|
(isOn(key) && !isReservedProp(key))) {
|
|
4929
|
-
patchProp(el, key, null, props[key]);
|
|
4877
|
+
patchProp(el, key, null, props[key], false, undefined, parentComponent);
|
|
4930
4878
|
}
|
|
4931
4879
|
}
|
|
4932
4880
|
}
|
|
4933
4881
|
else if (props.onClick) {
|
|
4934
4882
|
// Fast path for click listeners (which is most often) to avoid
|
|
4935
4883
|
// iterating through props.
|
|
4936
|
-
patchProp(el, 'onClick', null, props.onClick);
|
|
4884
|
+
patchProp(el, 'onClick', null, props.onClick, false, undefined, parentComponent);
|
|
4937
4885
|
}
|
|
4938
4886
|
}
|
|
4939
4887
|
// vnode / directive hooks
|
|
@@ -8383,7 +8331,6 @@ let postFlushIndex = 0;
|
|
|
8383
8331
|
const resolvedPromise = Promise.resolve();
|
|
8384
8332
|
let currentFlushPromise = null;
|
|
8385
8333
|
let currentPreFlushParentJob = null;
|
|
8386
|
-
const RECURSION_LIMIT = 100;
|
|
8387
8334
|
function nextTick(fn) {
|
|
8388
8335
|
const p = currentFlushPromise || resolvedPromise;
|
|
8389
8336
|
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
@@ -8501,11 +8448,17 @@ function flushJobs(seen) {
|
|
|
8501
8448
|
// 2. If a component is unmounted during a parent component's update,
|
|
8502
8449
|
// its update can be skipped.
|
|
8503
8450
|
queue.sort((a, b) => getId(a) - getId(b));
|
|
8451
|
+
// conditional usage of checkRecursiveUpdate must be determined out of
|
|
8452
|
+
// try ... catch block since Rollup by default de-optimizes treeshaking
|
|
8453
|
+
// inside try-catch. This can leave all warning code unshaked. Although
|
|
8454
|
+
// they would get eventually shaken by a minifier like terser, some minifiers
|
|
8455
|
+
// would fail to do that (e.g. https://github.com/evanw/esbuild/issues/1610)
|
|
8456
|
+
const check = NOOP;
|
|
8504
8457
|
try {
|
|
8505
8458
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
8506
8459
|
const job = queue[flushIndex];
|
|
8507
8460
|
if (job && job.active !== false) {
|
|
8508
|
-
if (false &&
|
|
8461
|
+
if (false && check(job)) ;
|
|
8509
8462
|
// console.log(`running:`, job.id)
|
|
8510
8463
|
callWithErrorHandling(job, null, 14 /* SCHEDULER */);
|
|
8511
8464
|
}
|
|
@@ -8525,27 +8478,6 @@ function flushJobs(seen) {
|
|
|
8525
8478
|
flushJobs(seen);
|
|
8526
8479
|
}
|
|
8527
8480
|
}
|
|
8528
|
-
}
|
|
8529
|
-
function checkRecursiveUpdates(seen, fn) {
|
|
8530
|
-
if (!seen.has(fn)) {
|
|
8531
|
-
seen.set(fn, 1);
|
|
8532
|
-
}
|
|
8533
|
-
else {
|
|
8534
|
-
const count = seen.get(fn);
|
|
8535
|
-
if (count > RECURSION_LIMIT) {
|
|
8536
|
-
const instance = fn.ownerInstance;
|
|
8537
|
-
const componentName = instance && getComponentName(instance.type);
|
|
8538
|
-
warn(`Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. ` +
|
|
8539
|
-
`This means you have a reactive effect that is mutating its own ` +
|
|
8540
|
-
`dependencies and thus recursively triggering itself. Possible sources ` +
|
|
8541
|
-
`include component template, render function, updated hook or ` +
|
|
8542
|
-
`watcher source function.`);
|
|
8543
|
-
return true;
|
|
8544
|
-
}
|
|
8545
|
-
else {
|
|
8546
|
-
seen.set(fn, count + 1);
|
|
8547
|
-
}
|
|
8548
|
-
}
|
|
8549
8481
|
}
|
|
8550
8482
|
|
|
8551
8483
|
// Simple effect.
|
|
@@ -8769,7 +8701,7 @@ function createPathGetter(ctx, path) {
|
|
|
8769
8701
|
return cur;
|
|
8770
8702
|
};
|
|
8771
8703
|
}
|
|
8772
|
-
function traverse(value, seen
|
|
8704
|
+
function traverse(value, seen) {
|
|
8773
8705
|
if (!isObject(value) || value["__v_skip" /* SKIP */]) {
|
|
8774
8706
|
return value;
|
|
8775
8707
|
}
|
|
@@ -8978,7 +8910,7 @@ function isMemoSame(cached, memo) {
|
|
|
8978
8910
|
}
|
|
8979
8911
|
|
|
8980
8912
|
// Core API ------------------------------------------------------------------
|
|
8981
|
-
const version = "3.2.
|
|
8913
|
+
const version = "3.2.13";
|
|
8982
8914
|
const _ssrUtils = {
|
|
8983
8915
|
createComponentInstance,
|
|
8984
8916
|
setupComponent,
|
|
@@ -9115,19 +9047,13 @@ function patchClass(el, value, isSVG) {
|
|
|
9115
9047
|
|
|
9116
9048
|
function patchStyle(el, prev, next) {
|
|
9117
9049
|
const style = el.style;
|
|
9050
|
+
const currentDisplay = style.display;
|
|
9118
9051
|
if (!next) {
|
|
9119
9052
|
el.removeAttribute('style');
|
|
9120
9053
|
}
|
|
9121
9054
|
else if (isString(next)) {
|
|
9122
9055
|
if (prev !== next) {
|
|
9123
|
-
const current = style.display;
|
|
9124
9056
|
style.cssText = next;
|
|
9125
|
-
// indicates that the `display` of the element is controlled by `v-show`,
|
|
9126
|
-
// so we always keep the current `display` value regardless of the `style` value,
|
|
9127
|
-
// thus handing over control to `v-show`.
|
|
9128
|
-
if ('_vod' in el) {
|
|
9129
|
-
style.display = current;
|
|
9130
|
-
}
|
|
9131
9057
|
}
|
|
9132
9058
|
}
|
|
9133
9059
|
else {
|
|
@@ -9142,6 +9068,12 @@ function patchStyle(el, prev, next) {
|
|
|
9142
9068
|
}
|
|
9143
9069
|
}
|
|
9144
9070
|
}
|
|
9071
|
+
// indicates that the `display` of the element is controlled by `v-show`,
|
|
9072
|
+
// so we always keep the current `display` value regardless of the `style` value,
|
|
9073
|
+
// thus handing over control to `v-show`.
|
|
9074
|
+
if ('_vod' in el) {
|
|
9075
|
+
style.display = currentDisplay;
|
|
9076
|
+
}
|
|
9145
9077
|
}
|
|
9146
9078
|
const importantRE = /\s*!important$/;
|
|
9147
9079
|
function setStyle(style, name, val) {
|
|
@@ -9507,6 +9439,7 @@ class VueElement extends BaseClass {
|
|
|
9507
9439
|
this._instance = null;
|
|
9508
9440
|
this._connected = false;
|
|
9509
9441
|
this._resolved = false;
|
|
9442
|
+
this._numberProps = null;
|
|
9510
9443
|
if (this.shadowRoot && hydrate) {
|
|
9511
9444
|
hydrate(this._createVNode(), this.shadowRoot);
|
|
9512
9445
|
}
|
|
@@ -9518,18 +9451,17 @@ class VueElement extends BaseClass {
|
|
|
9518
9451
|
this._setAttr(this.attributes[i].name);
|
|
9519
9452
|
}
|
|
9520
9453
|
// watch future attr changes
|
|
9521
|
-
|
|
9454
|
+
new MutationObserver(mutations => {
|
|
9522
9455
|
for (const m of mutations) {
|
|
9523
9456
|
this._setAttr(m.attributeName);
|
|
9524
9457
|
}
|
|
9525
|
-
});
|
|
9526
|
-
observer.observe(this, { attributes: true });
|
|
9458
|
+
}).observe(this, { attributes: true });
|
|
9527
9459
|
}
|
|
9528
9460
|
connectedCallback() {
|
|
9529
9461
|
this._connected = true;
|
|
9530
9462
|
if (!this._instance) {
|
|
9531
9463
|
this._resolveDef();
|
|
9532
|
-
|
|
9464
|
+
this._update();
|
|
9533
9465
|
}
|
|
9534
9466
|
}
|
|
9535
9467
|
disconnectedCallback() {
|
|
@@ -9550,15 +9482,31 @@ class VueElement extends BaseClass {
|
|
|
9550
9482
|
}
|
|
9551
9483
|
const resolve = (def) => {
|
|
9552
9484
|
this._resolved = true;
|
|
9485
|
+
const { props, styles } = def;
|
|
9486
|
+
const hasOptions = !isArray(props);
|
|
9487
|
+
const rawKeys = props ? (hasOptions ? Object.keys(props) : props) : [];
|
|
9488
|
+
// cast Number-type props set before resolve
|
|
9489
|
+
let numberProps;
|
|
9490
|
+
if (hasOptions) {
|
|
9491
|
+
for (const key in this._props) {
|
|
9492
|
+
const opt = props[key];
|
|
9493
|
+
if (opt === Number || (opt && opt.type === Number)) {
|
|
9494
|
+
this._props[key] = toNumber(this._props[key]);
|
|
9495
|
+
(numberProps || (numberProps = Object.create(null)))[key] = true;
|
|
9496
|
+
}
|
|
9497
|
+
}
|
|
9498
|
+
}
|
|
9499
|
+
if (numberProps) {
|
|
9500
|
+
this._numberProps = numberProps;
|
|
9501
|
+
this._update();
|
|
9502
|
+
}
|
|
9553
9503
|
// check if there are props set pre-upgrade or connect
|
|
9554
9504
|
for (const key of Object.keys(this)) {
|
|
9555
9505
|
if (key[0] !== '_') {
|
|
9556
9506
|
this._setProp(key, this[key]);
|
|
9557
9507
|
}
|
|
9558
9508
|
}
|
|
9559
|
-
const { props, styles } = def;
|
|
9560
9509
|
// defining getter/setters on prototype
|
|
9561
|
-
const rawKeys = props ? (isArray(props) ? props : Object.keys(props)) : [];
|
|
9562
9510
|
for (const key of rawKeys.map(camelize)) {
|
|
9563
9511
|
Object.defineProperty(this, key, {
|
|
9564
9512
|
get() {
|
|
@@ -9580,7 +9528,11 @@ class VueElement extends BaseClass {
|
|
|
9580
9528
|
}
|
|
9581
9529
|
}
|
|
9582
9530
|
_setAttr(key) {
|
|
9583
|
-
|
|
9531
|
+
let value = this.getAttribute(key);
|
|
9532
|
+
if (this._numberProps && this._numberProps[key]) {
|
|
9533
|
+
value = toNumber(value);
|
|
9534
|
+
}
|
|
9535
|
+
this._setProp(camelize(key), value, false);
|
|
9584
9536
|
}
|
|
9585
9537
|
/**
|
|
9586
9538
|
* @internal
|
|
@@ -9595,7 +9547,7 @@ class VueElement extends BaseClass {
|
|
|
9595
9547
|
if (val !== this._props[key]) {
|
|
9596
9548
|
this._props[key] = val;
|
|
9597
9549
|
if (this._instance) {
|
|
9598
|
-
|
|
9550
|
+
this._update();
|
|
9599
9551
|
}
|
|
9600
9552
|
// reflect
|
|
9601
9553
|
if (shouldReflect) {
|
|
@@ -9611,6 +9563,9 @@ class VueElement extends BaseClass {
|
|
|
9611
9563
|
}
|
|
9612
9564
|
}
|
|
9613
9565
|
}
|
|
9566
|
+
_update() {
|
|
9567
|
+
render(this._createVNode(), this.shadowRoot);
|
|
9568
|
+
}
|
|
9614
9569
|
_createVNode() {
|
|
9615
9570
|
const vnode = createVNode(this._def, extend({}, this._props));
|
|
9616
9571
|
if (!this._instance) {
|
|
@@ -10795,7 +10750,7 @@ const errorMessages = {
|
|
|
10795
10750
|
// transform errors
|
|
10796
10751
|
[28 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
|
|
10797
10752
|
[29 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
|
|
10798
|
-
[30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if.`,
|
|
10753
|
+
[30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
|
|
10799
10754
|
[31 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
|
|
10800
10755
|
[32 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
|
|
10801
10756
|
[33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
|
|
@@ -11065,84 +11020,27 @@ function isCoreComponent(tag) {
|
|
|
11065
11020
|
const nonIdentifierRE = /^\d|[^\$\w]/;
|
|
11066
11021
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
11067
11022
|
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
11068
|
-
const
|
|
11069
|
-
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
|
|
11073
|
-
|
|
11074
|
-
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
|
|
11078
|
-
|
|
11079
|
-
let state = 0 /* inMemberExp */;
|
|
11080
|
-
let stateStack = [];
|
|
11081
|
-
let currentOpenBracketCount = 0;
|
|
11082
|
-
let currentOpenParensCount = 0;
|
|
11083
|
-
let currentStringType = null;
|
|
11084
|
-
for (let i = 0; i < path.length; i++) {
|
|
11085
|
-
const char = path.charAt(i);
|
|
11086
|
-
switch (state) {
|
|
11087
|
-
case 0 /* inMemberExp */:
|
|
11088
|
-
if (char === '[') {
|
|
11089
|
-
stateStack.push(state);
|
|
11090
|
-
state = 1 /* inBrackets */;
|
|
11091
|
-
currentOpenBracketCount++;
|
|
11092
|
-
}
|
|
11093
|
-
else if (char === '(') {
|
|
11094
|
-
stateStack.push(state);
|
|
11095
|
-
state = 2 /* inParens */;
|
|
11096
|
-
currentOpenParensCount++;
|
|
11097
|
-
}
|
|
11098
|
-
else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
|
|
11099
|
-
return false;
|
|
11100
|
-
}
|
|
11101
|
-
break;
|
|
11102
|
-
case 1 /* inBrackets */:
|
|
11103
|
-
if (char === `'` || char === `"` || char === '`') {
|
|
11104
|
-
stateStack.push(state);
|
|
11105
|
-
state = 3 /* inString */;
|
|
11106
|
-
currentStringType = char;
|
|
11107
|
-
}
|
|
11108
|
-
else if (char === `[`) {
|
|
11109
|
-
currentOpenBracketCount++;
|
|
11110
|
-
}
|
|
11111
|
-
else if (char === `]`) {
|
|
11112
|
-
if (!--currentOpenBracketCount) {
|
|
11113
|
-
state = stateStack.pop();
|
|
11114
|
-
}
|
|
11115
|
-
}
|
|
11116
|
-
break;
|
|
11117
|
-
case 2 /* inParens */:
|
|
11118
|
-
if (char === `'` || char === `"` || char === '`') {
|
|
11119
|
-
stateStack.push(state);
|
|
11120
|
-
state = 3 /* inString */;
|
|
11121
|
-
currentStringType = char;
|
|
11122
|
-
}
|
|
11123
|
-
else if (char === `(`) {
|
|
11124
|
-
currentOpenParensCount++;
|
|
11125
|
-
}
|
|
11126
|
-
else if (char === `)`) {
|
|
11127
|
-
// if the exp ends as a call then it should not be considered valid
|
|
11128
|
-
if (i === path.length - 1) {
|
|
11129
|
-
return false;
|
|
11130
|
-
}
|
|
11131
|
-
if (!--currentOpenParensCount) {
|
|
11132
|
-
state = stateStack.pop();
|
|
11133
|
-
}
|
|
11134
|
-
}
|
|
11135
|
-
break;
|
|
11136
|
-
case 3 /* inString */:
|
|
11137
|
-
if (char === currentStringType) {
|
|
11138
|
-
state = stateStack.pop();
|
|
11139
|
-
currentStringType = null;
|
|
11140
|
-
}
|
|
11141
|
-
break;
|
|
11023
|
+
const isMemberExpressionNode = (path, context) => {
|
|
11024
|
+
path = path.trim();
|
|
11025
|
+
if (!validFirstIdentCharRE.test(path[0])) {
|
|
11026
|
+
return false;
|
|
11027
|
+
}
|
|
11028
|
+
try {
|
|
11029
|
+
let ret = parser.parseExpression(path, {
|
|
11030
|
+
plugins: [...context.expressionPlugins, ...babelParserDefaultPlugins]
|
|
11031
|
+
});
|
|
11032
|
+
if (ret.type === 'TSAsExpression' || ret.type === 'TSTypeAssertion') {
|
|
11033
|
+
ret = ret.expression;
|
|
11142
11034
|
}
|
|
11035
|
+
return (ret.type === 'MemberExpression' ||
|
|
11036
|
+
ret.type === 'OptionalMemberExpression' ||
|
|
11037
|
+
ret.type === 'Identifier');
|
|
11038
|
+
}
|
|
11039
|
+
catch (e) {
|
|
11040
|
+
return false;
|
|
11143
11041
|
}
|
|
11144
|
-
return !currentOpenBracketCount && !currentOpenParensCount;
|
|
11145
11042
|
};
|
|
11043
|
+
const isMemberExpression = isMemberExpressionNode;
|
|
11146
11044
|
function getInnerRange(loc, offset, length) {
|
|
11147
11045
|
const source = loc.source.substr(offset, length);
|
|
11148
11046
|
const newLoc = {
|
|
@@ -11890,6 +11788,13 @@ function parseAttributes(context, type) {
|
|
|
11890
11788
|
emitError(context, 3 /* END_TAG_WITH_ATTRIBUTES */);
|
|
11891
11789
|
}
|
|
11892
11790
|
const attr = parseAttribute(context, attributeNames);
|
|
11791
|
+
// Trim whitespace between class
|
|
11792
|
+
// https://github.com/vuejs/vue-next/issues/4251
|
|
11793
|
+
if (attr.type === 6 /* ATTRIBUTE */ &&
|
|
11794
|
+
attr.value &&
|
|
11795
|
+
attr.name === 'class') {
|
|
11796
|
+
attr.value.content = attr.value.content.replace(/\s+/g, ' ').trim();
|
|
11797
|
+
}
|
|
11893
11798
|
if (type === 0 /* Start */) {
|
|
11894
11799
|
props.push(attr);
|
|
11895
11800
|
}
|
|
@@ -11952,8 +11857,11 @@ function parseAttribute(context, nameSet) {
|
|
|
11952
11857
|
isStatic = false;
|
|
11953
11858
|
if (!content.endsWith(']')) {
|
|
11954
11859
|
emitError(context, 27 /* X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END */);
|
|
11860
|
+
content = content.substr(1);
|
|
11861
|
+
}
|
|
11862
|
+
else {
|
|
11863
|
+
content = content.substr(1, content.length - 2);
|
|
11955
11864
|
}
|
|
11956
|
-
content = content.substr(1, content.length - 2);
|
|
11957
11865
|
}
|
|
11958
11866
|
else if (isSlot) {
|
|
11959
11867
|
// #1241 special case for v-slot: vuetify relies extensively on slot
|
|
@@ -12220,7 +12128,7 @@ function walk$1(node, context, doNotHoistNode = false) {
|
|
|
12220
12128
|
// This is only a concern for pre-stringification (via transformHoist by
|
|
12221
12129
|
// @vue/compiler-dom), but doing it here allows us to perform only one full
|
|
12222
12130
|
// walk of the AST and allow `stringifyStatic` to stop walking as soon as its
|
|
12223
|
-
//
|
|
12131
|
+
// stringification threshold is met.
|
|
12224
12132
|
let canStringify = true;
|
|
12225
12133
|
const { children } = node;
|
|
12226
12134
|
const originalCount = children.length;
|
|
@@ -12466,7 +12374,7 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
12466
12374
|
else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
|
|
12467
12375
|
// some helper calls can be hoisted,
|
|
12468
12376
|
// such as the `normalizeProps` generated by the compiler for pre-normalize class,
|
|
12469
|
-
// in this case we need to respect the
|
|
12377
|
+
// in this case we need to respect the ConstantType of the helper's argments
|
|
12470
12378
|
valueType = getConstantTypeOfHelperCall(value, context);
|
|
12471
12379
|
}
|
|
12472
12380
|
else {
|
|
@@ -13094,22 +13002,22 @@ function genHoists(hoists, context) {
|
|
|
13094
13002
|
const { push, newline, helper, scopeId, mode } = context;
|
|
13095
13003
|
const genScopeId = scopeId != null && mode !== 'function';
|
|
13096
13004
|
newline();
|
|
13097
|
-
//
|
|
13098
|
-
// get the proper scopeId as well.
|
|
13005
|
+
// generate inlined withScopeId helper
|
|
13099
13006
|
if (genScopeId) {
|
|
13100
|
-
push(
|
|
13007
|
+
push(`const _withScopeId = n => (${helper(PUSH_SCOPE_ID)}("${scopeId}"),n=n(),${helper(POP_SCOPE_ID)}(),n)`);
|
|
13101
13008
|
newline();
|
|
13102
13009
|
}
|
|
13103
|
-
hoists.
|
|
13010
|
+
for (let i = 0; i < hoists.length; i++) {
|
|
13011
|
+
const exp = hoists[i];
|
|
13104
13012
|
if (exp) {
|
|
13105
|
-
|
|
13013
|
+
const needScopeIdWrapper = genScopeId && exp.type === 13 /* VNODE_CALL */;
|
|
13014
|
+
push(`const _hoisted_${i + 1} = ${needScopeIdWrapper ? `${PURE_ANNOTATION} _withScopeId(() => ` : ``}`);
|
|
13106
13015
|
genNode(exp, context);
|
|
13016
|
+
if (needScopeIdWrapper) {
|
|
13017
|
+
push(`)`);
|
|
13018
|
+
}
|
|
13107
13019
|
newline();
|
|
13108
13020
|
}
|
|
13109
|
-
});
|
|
13110
|
-
if (genScopeId) {
|
|
13111
|
-
push(`${helper(POP_SCOPE_ID)}()`);
|
|
13112
|
-
newline();
|
|
13113
13021
|
}
|
|
13114
13022
|
context.pure = false;
|
|
13115
13023
|
}
|
|
@@ -13585,7 +13493,7 @@ function isReferencedIdentifier(id, parent, parentStack) {
|
|
|
13585
13493
|
if (id.name === 'arguments') {
|
|
13586
13494
|
return false;
|
|
13587
13495
|
}
|
|
13588
|
-
if (
|
|
13496
|
+
if (isReferenced(id, parent)) {
|
|
13589
13497
|
return true;
|
|
13590
13498
|
}
|
|
13591
13499
|
// babel's isReferenced check returns false for ids being assigned to, so we
|
|
@@ -13698,7 +13606,159 @@ const isFunctionType = (node) => {
|
|
|
13698
13606
|
const isStaticProperty = (node) => node &&
|
|
13699
13607
|
(node.type === 'ObjectProperty' || node.type === 'ObjectMethod') &&
|
|
13700
13608
|
!node.computed;
|
|
13701
|
-
const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node;
|
|
13609
|
+
const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node;
|
|
13610
|
+
/**
|
|
13611
|
+
* Copied from https://github.com/babel/babel/blob/main/packages/babel-types/src/validators/isReferenced.ts
|
|
13612
|
+
* To avoid runtime dependency on @babel/types (which includes process references)
|
|
13613
|
+
* This file should not change very often in babel but we may need to keep it
|
|
13614
|
+
* up-to-date from time to time.
|
|
13615
|
+
*
|
|
13616
|
+
* https://github.com/babel/babel/blob/main/LICENSE
|
|
13617
|
+
*
|
|
13618
|
+
*/
|
|
13619
|
+
function isReferenced(node, parent, grandparent) {
|
|
13620
|
+
switch (parent.type) {
|
|
13621
|
+
// yes: PARENT[NODE]
|
|
13622
|
+
// yes: NODE.child
|
|
13623
|
+
// no: parent.NODE
|
|
13624
|
+
case 'MemberExpression':
|
|
13625
|
+
case 'OptionalMemberExpression':
|
|
13626
|
+
if (parent.property === node) {
|
|
13627
|
+
return !!parent.computed;
|
|
13628
|
+
}
|
|
13629
|
+
return parent.object === node;
|
|
13630
|
+
case 'JSXMemberExpression':
|
|
13631
|
+
return parent.object === node;
|
|
13632
|
+
// no: let NODE = init;
|
|
13633
|
+
// yes: let id = NODE;
|
|
13634
|
+
case 'VariableDeclarator':
|
|
13635
|
+
return parent.init === node;
|
|
13636
|
+
// yes: () => NODE
|
|
13637
|
+
// no: (NODE) => {}
|
|
13638
|
+
case 'ArrowFunctionExpression':
|
|
13639
|
+
return parent.body === node;
|
|
13640
|
+
// no: class { #NODE; }
|
|
13641
|
+
// no: class { get #NODE() {} }
|
|
13642
|
+
// no: class { #NODE() {} }
|
|
13643
|
+
// no: class { fn() { return this.#NODE; } }
|
|
13644
|
+
case 'PrivateName':
|
|
13645
|
+
return false;
|
|
13646
|
+
// no: class { NODE() {} }
|
|
13647
|
+
// yes: class { [NODE]() {} }
|
|
13648
|
+
// no: class { foo(NODE) {} }
|
|
13649
|
+
case 'ClassMethod':
|
|
13650
|
+
case 'ClassPrivateMethod':
|
|
13651
|
+
case 'ObjectMethod':
|
|
13652
|
+
if (parent.key === node) {
|
|
13653
|
+
return !!parent.computed;
|
|
13654
|
+
}
|
|
13655
|
+
return false;
|
|
13656
|
+
// yes: { [NODE]: "" }
|
|
13657
|
+
// no: { NODE: "" }
|
|
13658
|
+
// depends: { NODE }
|
|
13659
|
+
// depends: { key: NODE }
|
|
13660
|
+
case 'ObjectProperty':
|
|
13661
|
+
if (parent.key === node) {
|
|
13662
|
+
return !!parent.computed;
|
|
13663
|
+
}
|
|
13664
|
+
// parent.value === node
|
|
13665
|
+
return !grandparent || grandparent.type !== 'ObjectPattern';
|
|
13666
|
+
// no: class { NODE = value; }
|
|
13667
|
+
// yes: class { [NODE] = value; }
|
|
13668
|
+
// yes: class { key = NODE; }
|
|
13669
|
+
case 'ClassProperty':
|
|
13670
|
+
if (parent.key === node) {
|
|
13671
|
+
return !!parent.computed;
|
|
13672
|
+
}
|
|
13673
|
+
return true;
|
|
13674
|
+
case 'ClassPrivateProperty':
|
|
13675
|
+
return parent.key !== node;
|
|
13676
|
+
// no: class NODE {}
|
|
13677
|
+
// yes: class Foo extends NODE {}
|
|
13678
|
+
case 'ClassDeclaration':
|
|
13679
|
+
case 'ClassExpression':
|
|
13680
|
+
return parent.superClass === node;
|
|
13681
|
+
// yes: left = NODE;
|
|
13682
|
+
// no: NODE = right;
|
|
13683
|
+
case 'AssignmentExpression':
|
|
13684
|
+
return parent.right === node;
|
|
13685
|
+
// no: [NODE = foo] = [];
|
|
13686
|
+
// yes: [foo = NODE] = [];
|
|
13687
|
+
case 'AssignmentPattern':
|
|
13688
|
+
return parent.right === node;
|
|
13689
|
+
// no: NODE: for (;;) {}
|
|
13690
|
+
case 'LabeledStatement':
|
|
13691
|
+
return false;
|
|
13692
|
+
// no: try {} catch (NODE) {}
|
|
13693
|
+
case 'CatchClause':
|
|
13694
|
+
return false;
|
|
13695
|
+
// no: function foo(...NODE) {}
|
|
13696
|
+
case 'RestElement':
|
|
13697
|
+
return false;
|
|
13698
|
+
case 'BreakStatement':
|
|
13699
|
+
case 'ContinueStatement':
|
|
13700
|
+
return false;
|
|
13701
|
+
// no: function NODE() {}
|
|
13702
|
+
// no: function foo(NODE) {}
|
|
13703
|
+
case 'FunctionDeclaration':
|
|
13704
|
+
case 'FunctionExpression':
|
|
13705
|
+
return false;
|
|
13706
|
+
// no: export NODE from "foo";
|
|
13707
|
+
// no: export * as NODE from "foo";
|
|
13708
|
+
case 'ExportNamespaceSpecifier':
|
|
13709
|
+
case 'ExportDefaultSpecifier':
|
|
13710
|
+
return false;
|
|
13711
|
+
// no: export { foo as NODE };
|
|
13712
|
+
// yes: export { NODE as foo };
|
|
13713
|
+
// no: export { NODE as foo } from "foo";
|
|
13714
|
+
case 'ExportSpecifier':
|
|
13715
|
+
// @ts-expect-error
|
|
13716
|
+
if (grandparent === null || grandparent === void 0 ? void 0 : grandparent.source) {
|
|
13717
|
+
return false;
|
|
13718
|
+
}
|
|
13719
|
+
return parent.local === node;
|
|
13720
|
+
// no: import NODE from "foo";
|
|
13721
|
+
// no: import * as NODE from "foo";
|
|
13722
|
+
// no: import { NODE as foo } from "foo";
|
|
13723
|
+
// no: import { foo as NODE } from "foo";
|
|
13724
|
+
// no: import NODE from "bar";
|
|
13725
|
+
case 'ImportDefaultSpecifier':
|
|
13726
|
+
case 'ImportNamespaceSpecifier':
|
|
13727
|
+
case 'ImportSpecifier':
|
|
13728
|
+
return false;
|
|
13729
|
+
// no: import "foo" assert { NODE: "json" }
|
|
13730
|
+
case 'ImportAttribute':
|
|
13731
|
+
return false;
|
|
13732
|
+
// no: <div NODE="foo" />
|
|
13733
|
+
case 'JSXAttribute':
|
|
13734
|
+
return false;
|
|
13735
|
+
// no: [NODE] = [];
|
|
13736
|
+
// no: ({ NODE }) = [];
|
|
13737
|
+
case 'ObjectPattern':
|
|
13738
|
+
case 'ArrayPattern':
|
|
13739
|
+
return false;
|
|
13740
|
+
// no: new.NODE
|
|
13741
|
+
// no: NODE.target
|
|
13742
|
+
case 'MetaProperty':
|
|
13743
|
+
return false;
|
|
13744
|
+
// yes: type X = { somePropert: NODE }
|
|
13745
|
+
// no: type X = { NODE: OtherType }
|
|
13746
|
+
case 'ObjectTypeProperty':
|
|
13747
|
+
return parent.key !== node;
|
|
13748
|
+
// yes: enum X { Foo = NODE }
|
|
13749
|
+
// no: enum X { NODE }
|
|
13750
|
+
case 'TSEnumMember':
|
|
13751
|
+
return parent.id !== node;
|
|
13752
|
+
// yes: { [NODE]: value }
|
|
13753
|
+
// no: { NODE: value }
|
|
13754
|
+
case 'TSPropertySignature':
|
|
13755
|
+
if (parent.key === node) {
|
|
13756
|
+
return !!parent.computed;
|
|
13757
|
+
}
|
|
13758
|
+
return true;
|
|
13759
|
+
}
|
|
13760
|
+
return true;
|
|
13761
|
+
}
|
|
13702
13762
|
|
|
13703
13763
|
const isLiteralWhitelisted = /*#__PURE__*/ makeMap('true,false,null,this');
|
|
13704
13764
|
const transformExpression = (node, context) => {
|
|
@@ -14024,6 +14084,11 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
14024
14084
|
continue;
|
|
14025
14085
|
}
|
|
14026
14086
|
if (sibling && sibling.type === 9 /* IF */) {
|
|
14087
|
+
// Check if v-else was followed by v-else-if
|
|
14088
|
+
if (dir.name === 'else-if' &&
|
|
14089
|
+
sibling.branches[sibling.branches.length - 1].condition === undefined) {
|
|
14090
|
+
context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
|
|
14091
|
+
}
|
|
14027
14092
|
// move the node to the if node's branches
|
|
14028
14093
|
context.removeNode();
|
|
14029
14094
|
const branch = createIfBranch(node, dir);
|
|
@@ -14956,7 +15021,7 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
14956
15021
|
// acrtual ref instead.
|
|
14957
15022
|
if (context.inline && (value === null || value === void 0 ? void 0 : value.content)) {
|
|
14958
15023
|
valueNode = createFunctionExpression(['_value', '_refs']);
|
|
14959
|
-
valueNode.body = createBlockStatement(processInlineRef(context
|
|
15024
|
+
valueNode.body = createBlockStatement(processInlineRef(context, value.content));
|
|
14960
15025
|
}
|
|
14961
15026
|
}
|
|
14962
15027
|
// skip is on <component>, or is="vue:xxx"
|
|
@@ -15179,7 +15244,7 @@ function dedupeProperties(properties) {
|
|
|
15179
15244
|
const name = prop.key.content;
|
|
15180
15245
|
const existing = knownProps.get(name);
|
|
15181
15246
|
if (existing) {
|
|
15182
|
-
if (name === 'style' || name === 'class' || name
|
|
15247
|
+
if (name === 'style' || name === 'class' || isOn(name)) {
|
|
15183
15248
|
mergeAsArray$1(existing, prop);
|
|
15184
15249
|
}
|
|
15185
15250
|
// unexpected duplicate, should have emitted error during parse
|
|
@@ -15253,14 +15318,18 @@ function stringifyDynamicPropNames(props) {
|
|
|
15253
15318
|
function isComponentTag(tag) {
|
|
15254
15319
|
return tag[0].toLowerCase() + tag.slice(1) === 'component';
|
|
15255
15320
|
}
|
|
15256
|
-
function processInlineRef(
|
|
15321
|
+
function processInlineRef(context, raw) {
|
|
15257
15322
|
const body = [createSimpleExpression(`_refs['${raw}'] = _value`)];
|
|
15258
|
-
const
|
|
15323
|
+
const { bindingMetadata, helperString } = context;
|
|
15324
|
+
const type = bindingMetadata[raw];
|
|
15259
15325
|
if (type === "setup-ref" /* SETUP_REF */) {
|
|
15260
15326
|
body.push(createSimpleExpression(`${raw}.value = _value`));
|
|
15261
15327
|
}
|
|
15328
|
+
else if (type === "setup-maybe-ref" /* SETUP_MAYBE_REF */) {
|
|
15329
|
+
body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) && (${raw}.value = _value)`));
|
|
15330
|
+
}
|
|
15262
15331
|
else if (type === "setup-let" /* SETUP_LET */) {
|
|
15263
|
-
body.push(createSimpleExpression(`${raw} = _value`));
|
|
15332
|
+
body.push(createSimpleExpression(`${helperString(IS_REF)}(${raw}) ? ${raw}.value = _value : ${raw} = _value`));
|
|
15264
15333
|
}
|
|
15265
15334
|
return body;
|
|
15266
15335
|
}
|
|
@@ -15271,26 +15340,24 @@ const transformSlotOutlet = (node, context) => {
|
|
|
15271
15340
|
const { slotName, slotProps } = processSlotOutlet(node, context);
|
|
15272
15341
|
const slotArgs = [
|
|
15273
15342
|
context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
|
|
15274
|
-
slotName
|
|
15343
|
+
slotName,
|
|
15344
|
+
'{}',
|
|
15345
|
+
'undefined',
|
|
15346
|
+
'true'
|
|
15275
15347
|
];
|
|
15348
|
+
let expectedLen = 2;
|
|
15276
15349
|
if (slotProps) {
|
|
15277
|
-
slotArgs
|
|
15350
|
+
slotArgs[2] = slotProps;
|
|
15351
|
+
expectedLen = 3;
|
|
15278
15352
|
}
|
|
15279
15353
|
if (children.length) {
|
|
15280
|
-
|
|
15281
|
-
|
|
15282
|
-
}
|
|
15283
|
-
slotArgs.push(createFunctionExpression([], children, false, false, loc));
|
|
15354
|
+
slotArgs[3] = createFunctionExpression([], children, false, false, loc);
|
|
15355
|
+
expectedLen = 4;
|
|
15284
15356
|
}
|
|
15285
15357
|
if (context.scopeId && !context.slotted) {
|
|
15286
|
-
|
|
15287
|
-
slotArgs.push(`{}`);
|
|
15288
|
-
}
|
|
15289
|
-
if (!children.length) {
|
|
15290
|
-
slotArgs.push(`undefined`);
|
|
15291
|
-
}
|
|
15292
|
-
slotArgs.push(`true`);
|
|
15358
|
+
expectedLen = 5;
|
|
15293
15359
|
}
|
|
15360
|
+
slotArgs.splice(expectedLen); // remove unused arguments
|
|
15294
15361
|
node.codegenNode = createCallExpression(context.helper(RENDER_SLOT), slotArgs, loc);
|
|
15295
15362
|
}
|
|
15296
15363
|
};
|
|
@@ -15337,7 +15404,7 @@ function processSlotOutlet(node, context) {
|
|
|
15337
15404
|
};
|
|
15338
15405
|
}
|
|
15339
15406
|
|
|
15340
|
-
const fnExpRE = /^\s*([\w$_]
|
|
15407
|
+
const fnExpRE = /^\s*([\w$_]+|(async\s*)?\([^)]*?\))\s*=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
15341
15408
|
const transformOn = (dir, node, context, augmentor) => {
|
|
15342
15409
|
const { loc, modifiers, arg } = dir;
|
|
15343
15410
|
if (!dir.exp && !modifiers.length) {
|
|
@@ -15372,7 +15439,7 @@ const transformOn = (dir, node, context, augmentor) => {
|
|
|
15372
15439
|
}
|
|
15373
15440
|
let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
|
|
15374
15441
|
if (exp) {
|
|
15375
|
-
const isMemberExp = isMemberExpression(exp.content);
|
|
15442
|
+
const isMemberExp = isMemberExpression(exp.content, context);
|
|
15376
15443
|
const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
|
|
15377
15444
|
const hasMultipleStatements = exp.content.includes(`;`);
|
|
15378
15445
|
// process the expression since it's been skipped
|
|
@@ -15629,7 +15696,8 @@ const transformModel = (dir, node, context) => {
|
|
|
15629
15696
|
const maybeRef = context.inline &&
|
|
15630
15697
|
bindingType &&
|
|
15631
15698
|
bindingType !== "setup-const" /* SETUP_CONST */;
|
|
15632
|
-
if (!expString.trim() ||
|
|
15699
|
+
if (!expString.trim() ||
|
|
15700
|
+
(!isMemberExpression(expString, context) && !maybeRef)) {
|
|
15633
15701
|
context.onError(createCompilerError(42 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
|
|
15634
15702
|
return createTransformProps();
|
|
15635
15703
|
}
|
|
@@ -15937,6 +16005,12 @@ function baseCompile(template, options = {}) {
|
|
|
15937
16005
|
}
|
|
15938
16006
|
const ast = isString(template) ? baseParse(template, options) : template;
|
|
15939
16007
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);
|
|
16008
|
+
if (options.isTS) {
|
|
16009
|
+
const { expressionPlugins } = options;
|
|
16010
|
+
if (!expressionPlugins || !expressionPlugins.includes('typescript')) {
|
|
16011
|
+
options.expressionPlugins = [...(expressionPlugins || []), 'typescript'];
|
|
16012
|
+
}
|
|
16013
|
+
}
|
|
15940
16014
|
transform(ast, extend({}, options, {
|
|
15941
16015
|
prefixIdentifiers,
|
|
15942
16016
|
nodeTransforms: [
|
|
@@ -19004,4 +19078,4 @@ registerRuntimeCompiler(compileToFunction);
|
|
|
19004
19078
|
const Vue = createCompatVue$1();
|
|
19005
19079
|
Vue.compile = compileToFunction;
|
|
19006
19080
|
|
|
19007
|
-
exports
|
|
19081
|
+
module.exports = Vue;
|