@vue/compat 3.3.0-alpha.4 → 3.3.0-alpha.6
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-compat.d.ts +1 -1
- package/dist/vue.cjs.js +177 -133
- package/dist/vue.cjs.prod.js +170 -147
- package/dist/vue.esm-browser.js +143 -126
- package/dist/vue.esm-browser.prod.js +1 -1
- package/dist/vue.esm-bundler.js +153 -126
- package/dist/vue.global.js +142 -125
- package/dist/vue.global.prod.js +1 -1
- package/dist/vue.runtime.esm-browser.js +126 -109
- package/dist/vue.runtime.esm-browser.prod.js +1 -1
- package/dist/vue.runtime.esm-bundler.js +136 -109
- package/dist/vue.runtime.global.js +125 -108
- package/dist/vue.runtime.global.prod.js +1 -1
- package/package.json +3 -3
package/dist/vue-compat.d.ts
CHANGED
package/dist/vue.cjs.js
CHANGED
|
@@ -13,6 +13,100 @@ function makeMap(str, expectsLowerCase) {
|
|
|
13
13
|
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
const EMPTY_OBJ = Object.freeze({}) ;
|
|
17
|
+
const EMPTY_ARR = Object.freeze([]) ;
|
|
18
|
+
const NOOP = () => {
|
|
19
|
+
};
|
|
20
|
+
const NO = () => false;
|
|
21
|
+
const onRE = /^on[^a-z]/;
|
|
22
|
+
const isOn = (key) => onRE.test(key);
|
|
23
|
+
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
24
|
+
const extend = Object.assign;
|
|
25
|
+
const remove = (arr, el) => {
|
|
26
|
+
const i = arr.indexOf(el);
|
|
27
|
+
if (i > -1) {
|
|
28
|
+
arr.splice(i, 1);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
32
|
+
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
|
|
33
|
+
const isArray = Array.isArray;
|
|
34
|
+
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
35
|
+
const isSet = (val) => toTypeString(val) === "[object Set]";
|
|
36
|
+
const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
37
|
+
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
|
38
|
+
const isFunction = (val) => typeof val === "function";
|
|
39
|
+
const isString = (val) => typeof val === "string";
|
|
40
|
+
const isSymbol = (val) => typeof val === "symbol";
|
|
41
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
42
|
+
const isPromise = (val) => {
|
|
43
|
+
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
44
|
+
};
|
|
45
|
+
const objectToString = Object.prototype.toString;
|
|
46
|
+
const toTypeString = (value) => objectToString.call(value);
|
|
47
|
+
const toRawType = (value) => {
|
|
48
|
+
return toTypeString(value).slice(8, -1);
|
|
49
|
+
};
|
|
50
|
+
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
51
|
+
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
52
|
+
const isReservedProp = /* @__PURE__ */ makeMap(
|
|
53
|
+
// the leading comma is intentional so empty string "" is also included
|
|
54
|
+
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
55
|
+
);
|
|
56
|
+
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
57
|
+
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
58
|
+
);
|
|
59
|
+
const cacheStringFunction = (fn) => {
|
|
60
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
61
|
+
return (str) => {
|
|
62
|
+
const hit = cache[str];
|
|
63
|
+
return hit || (cache[str] = fn(str));
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
const camelizeRE = /-(\w)/g;
|
|
67
|
+
const camelize = cacheStringFunction((str) => {
|
|
68
|
+
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
69
|
+
});
|
|
70
|
+
const hyphenateRE = /\B([A-Z])/g;
|
|
71
|
+
const hyphenate = cacheStringFunction(
|
|
72
|
+
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
|
73
|
+
);
|
|
74
|
+
const capitalize = cacheStringFunction(
|
|
75
|
+
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
76
|
+
);
|
|
77
|
+
const toHandlerKey = cacheStringFunction(
|
|
78
|
+
(str) => str ? `on${capitalize(str)}` : ``
|
|
79
|
+
);
|
|
80
|
+
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
81
|
+
const invokeArrayFns = (fns, arg) => {
|
|
82
|
+
for (let i = 0; i < fns.length; i++) {
|
|
83
|
+
fns[i](arg);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const def = (obj, key, value) => {
|
|
87
|
+
Object.defineProperty(obj, key, {
|
|
88
|
+
configurable: true,
|
|
89
|
+
enumerable: false,
|
|
90
|
+
value
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
const looseToNumber = (val) => {
|
|
94
|
+
const n = parseFloat(val);
|
|
95
|
+
return isNaN(n) ? val : n;
|
|
96
|
+
};
|
|
97
|
+
const toNumber = (val) => {
|
|
98
|
+
const n = isString(val) ? Number(val) : NaN;
|
|
99
|
+
return isNaN(n) ? val : n;
|
|
100
|
+
};
|
|
101
|
+
let _globalThis;
|
|
102
|
+
const getGlobalThis = () => {
|
|
103
|
+
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
104
|
+
};
|
|
105
|
+
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
106
|
+
function genPropsAccessExp(name) {
|
|
107
|
+
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
|
108
|
+
}
|
|
109
|
+
|
|
16
110
|
const PatchFlagNames = {
|
|
17
111
|
[1]: `TEXT`,
|
|
18
112
|
[2]: `CLASS`,
|
|
@@ -295,100 +389,6 @@ const replacer = (_key, val) => {
|
|
|
295
389
|
return val;
|
|
296
390
|
};
|
|
297
391
|
|
|
298
|
-
const EMPTY_OBJ = Object.freeze({}) ;
|
|
299
|
-
const EMPTY_ARR = Object.freeze([]) ;
|
|
300
|
-
const NOOP = () => {
|
|
301
|
-
};
|
|
302
|
-
const NO = () => false;
|
|
303
|
-
const onRE = /^on[^a-z]/;
|
|
304
|
-
const isOn = (key) => onRE.test(key);
|
|
305
|
-
const isModelListener = (key) => key.startsWith("onUpdate:");
|
|
306
|
-
const extend = Object.assign;
|
|
307
|
-
const remove = (arr, el) => {
|
|
308
|
-
const i = arr.indexOf(el);
|
|
309
|
-
if (i > -1) {
|
|
310
|
-
arr.splice(i, 1);
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
314
|
-
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
|
|
315
|
-
const isArray = Array.isArray;
|
|
316
|
-
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
317
|
-
const isSet = (val) => toTypeString(val) === "[object Set]";
|
|
318
|
-
const isDate = (val) => toTypeString(val) === "[object Date]";
|
|
319
|
-
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
|
320
|
-
const isFunction = (val) => typeof val === "function";
|
|
321
|
-
const isString = (val) => typeof val === "string";
|
|
322
|
-
const isSymbol = (val) => typeof val === "symbol";
|
|
323
|
-
const isObject = (val) => val !== null && typeof val === "object";
|
|
324
|
-
const isPromise = (val) => {
|
|
325
|
-
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
326
|
-
};
|
|
327
|
-
const objectToString = Object.prototype.toString;
|
|
328
|
-
const toTypeString = (value) => objectToString.call(value);
|
|
329
|
-
const toRawType = (value) => {
|
|
330
|
-
return toTypeString(value).slice(8, -1);
|
|
331
|
-
};
|
|
332
|
-
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
333
|
-
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
334
|
-
const isReservedProp = /* @__PURE__ */ makeMap(
|
|
335
|
-
// the leading comma is intentional so empty string "" is also included
|
|
336
|
-
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
|
337
|
-
);
|
|
338
|
-
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
|
339
|
-
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
|
340
|
-
);
|
|
341
|
-
const cacheStringFunction = (fn) => {
|
|
342
|
-
const cache = /* @__PURE__ */ Object.create(null);
|
|
343
|
-
return (str) => {
|
|
344
|
-
const hit = cache[str];
|
|
345
|
-
return hit || (cache[str] = fn(str));
|
|
346
|
-
};
|
|
347
|
-
};
|
|
348
|
-
const camelizeRE = /-(\w)/g;
|
|
349
|
-
const camelize = cacheStringFunction((str) => {
|
|
350
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
351
|
-
});
|
|
352
|
-
const hyphenateRE = /\B([A-Z])/g;
|
|
353
|
-
const hyphenate = cacheStringFunction(
|
|
354
|
-
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
|
355
|
-
);
|
|
356
|
-
const capitalize = cacheStringFunction(
|
|
357
|
-
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
|
358
|
-
);
|
|
359
|
-
const toHandlerKey = cacheStringFunction(
|
|
360
|
-
(str) => str ? `on${capitalize(str)}` : ``
|
|
361
|
-
);
|
|
362
|
-
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
363
|
-
const invokeArrayFns = (fns, arg) => {
|
|
364
|
-
for (let i = 0; i < fns.length; i++) {
|
|
365
|
-
fns[i](arg);
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
const def = (obj, key, value) => {
|
|
369
|
-
Object.defineProperty(obj, key, {
|
|
370
|
-
configurable: true,
|
|
371
|
-
enumerable: false,
|
|
372
|
-
value
|
|
373
|
-
});
|
|
374
|
-
};
|
|
375
|
-
const looseToNumber = (val) => {
|
|
376
|
-
const n = parseFloat(val);
|
|
377
|
-
return isNaN(n) ? val : n;
|
|
378
|
-
};
|
|
379
|
-
const toNumber = (val) => {
|
|
380
|
-
const n = isString(val) ? Number(val) : NaN;
|
|
381
|
-
return isNaN(n) ? val : n;
|
|
382
|
-
};
|
|
383
|
-
let _globalThis;
|
|
384
|
-
const getGlobalThis = () => {
|
|
385
|
-
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
386
|
-
};
|
|
387
|
-
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
388
|
-
function genPropsAccessExp(name) {
|
|
389
|
-
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
392
|
function warn$1(msg, ...args) {
|
|
393
393
|
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
394
394
|
}
|
|
@@ -4194,8 +4194,8 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
|
4194
4194
|
return ret;
|
|
4195
4195
|
}
|
|
4196
4196
|
|
|
4197
|
-
function defineComponent(options) {
|
|
4198
|
-
return isFunction(options) ? { setup: options, name: options.name } : options;
|
|
4197
|
+
function defineComponent(options, extraOptions) {
|
|
4198
|
+
return isFunction(options) ? extend({}, extraOptions, { setup: options, name: options.name }) : options;
|
|
4199
4199
|
}
|
|
4200
4200
|
|
|
4201
4201
|
const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
|
@@ -4777,7 +4777,7 @@ const FILTERS = "filters";
|
|
|
4777
4777
|
function resolveComponent(name, maybeSelfReference) {
|
|
4778
4778
|
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
4779
4779
|
}
|
|
4780
|
-
const NULL_DYNAMIC_COMPONENT = Symbol();
|
|
4780
|
+
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
4781
4781
|
function resolveDynamicComponent(component) {
|
|
4782
4782
|
if (isString(component)) {
|
|
4783
4783
|
return resolveAsset(COMPONENTS, component, false) || component;
|
|
@@ -6354,7 +6354,7 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
6354
6354
|
const hasDefault = hasOwn(opt, "default");
|
|
6355
6355
|
if (hasDefault && value === void 0) {
|
|
6356
6356
|
const defaultValue = opt.default;
|
|
6357
|
-
if (opt.type !== Function && isFunction(defaultValue)) {
|
|
6357
|
+
if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
|
|
6358
6358
|
const { propsDefaults } = instance;
|
|
6359
6359
|
if (key in propsDefaults) {
|
|
6360
6360
|
value = propsDefaults[key];
|
|
@@ -6493,7 +6493,7 @@ function validateProps(rawProps, props, instance) {
|
|
|
6493
6493
|
}
|
|
6494
6494
|
}
|
|
6495
6495
|
function validateProp(name, value, prop, isAbsent) {
|
|
6496
|
-
const { type, required, validator } = prop;
|
|
6496
|
+
const { type, required, validator, skipCheck } = prop;
|
|
6497
6497
|
if (required && isAbsent) {
|
|
6498
6498
|
warn('Missing required prop: "' + name + '"');
|
|
6499
6499
|
return;
|
|
@@ -6501,7 +6501,7 @@ function validateProp(name, value, prop, isAbsent) {
|
|
|
6501
6501
|
if (value == null && !prop.required) {
|
|
6502
6502
|
return;
|
|
6503
6503
|
}
|
|
6504
|
-
if (type != null && type !== true) {
|
|
6504
|
+
if (type != null && type !== true && !skipCheck) {
|
|
6505
6505
|
let isValid = false;
|
|
6506
6506
|
const types = isArray(type) ? type : [type];
|
|
6507
6507
|
const expectedTypes = [];
|
|
@@ -6743,7 +6743,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
6743
6743
|
return vm;
|
|
6744
6744
|
}
|
|
6745
6745
|
}
|
|
6746
|
-
Vue.version = `2.6.14-compat:${"3.3.0-alpha.
|
|
6746
|
+
Vue.version = `2.6.14-compat:${"3.3.0-alpha.6"}`;
|
|
6747
6747
|
Vue.config = singletonApp.config;
|
|
6748
6748
|
Vue.use = (p, ...options) => {
|
|
6749
6749
|
if (p && isFunction(p.install)) {
|
|
@@ -9638,10 +9638,10 @@ function convertLegacyComponent(comp, instance) {
|
|
|
9638
9638
|
return comp;
|
|
9639
9639
|
}
|
|
9640
9640
|
|
|
9641
|
-
const Fragment = Symbol("
|
|
9642
|
-
const Text = Symbol("
|
|
9643
|
-
const Comment = Symbol("
|
|
9644
|
-
const Static = Symbol("
|
|
9641
|
+
const Fragment = Symbol.for("v-fgt");
|
|
9642
|
+
const Text = Symbol.for("v-txt");
|
|
9643
|
+
const Comment = Symbol.for("v-cmt");
|
|
9644
|
+
const Static = Symbol.for("v-stc");
|
|
9645
9645
|
const blockStack = [];
|
|
9646
9646
|
let currentBlock = null;
|
|
9647
9647
|
function openBlock(disableTracking = false) {
|
|
@@ -10103,13 +10103,29 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
10103
10103
|
}
|
|
10104
10104
|
let currentInstance = null;
|
|
10105
10105
|
const getCurrentInstance = () => currentInstance || currentRenderingInstance;
|
|
10106
|
+
let internalSetCurrentInstance;
|
|
10107
|
+
let globalCurrentInstanceSetters;
|
|
10108
|
+
let settersKey = "__VUE_INSTANCE_SETTERS__";
|
|
10109
|
+
{
|
|
10110
|
+
if (!(globalCurrentInstanceSetters = getGlobalThis()[settersKey])) {
|
|
10111
|
+
globalCurrentInstanceSetters = getGlobalThis()[settersKey] = [];
|
|
10112
|
+
}
|
|
10113
|
+
globalCurrentInstanceSetters.push((i) => currentInstance = i);
|
|
10114
|
+
internalSetCurrentInstance = (instance) => {
|
|
10115
|
+
if (globalCurrentInstanceSetters.length > 1) {
|
|
10116
|
+
globalCurrentInstanceSetters.forEach((s) => s(instance));
|
|
10117
|
+
} else {
|
|
10118
|
+
globalCurrentInstanceSetters[0](instance);
|
|
10119
|
+
}
|
|
10120
|
+
};
|
|
10121
|
+
}
|
|
10106
10122
|
const setCurrentInstance = (instance) => {
|
|
10107
|
-
|
|
10123
|
+
internalSetCurrentInstance(instance);
|
|
10108
10124
|
instance.scope.on();
|
|
10109
10125
|
};
|
|
10110
10126
|
const unsetCurrentInstance = () => {
|
|
10111
10127
|
currentInstance && currentInstance.scope.off();
|
|
10112
|
-
|
|
10128
|
+
internalSetCurrentInstance(null);
|
|
10113
10129
|
};
|
|
10114
10130
|
const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
|
|
10115
10131
|
function validateComponentName(name, config) {
|
|
@@ -10432,6 +10448,11 @@ function defineExpose(exposed) {
|
|
|
10432
10448
|
warnRuntimeUsage(`defineExpose`);
|
|
10433
10449
|
}
|
|
10434
10450
|
}
|
|
10451
|
+
function defineOptions(options) {
|
|
10452
|
+
{
|
|
10453
|
+
warnRuntimeUsage(`defineOptions`);
|
|
10454
|
+
}
|
|
10455
|
+
}
|
|
10435
10456
|
function withDefaults(props, defaults) {
|
|
10436
10457
|
{
|
|
10437
10458
|
warnRuntimeUsage(`withDefaults`);
|
|
@@ -10457,18 +10478,23 @@ function mergeDefaults(raw, defaults) {
|
|
|
10457
10478
|
{}
|
|
10458
10479
|
) : raw;
|
|
10459
10480
|
for (const key in defaults) {
|
|
10460
|
-
|
|
10481
|
+
if (key.startsWith("__skip"))
|
|
10482
|
+
continue;
|
|
10483
|
+
let opt = props[key];
|
|
10461
10484
|
if (opt) {
|
|
10462
10485
|
if (isArray(opt) || isFunction(opt)) {
|
|
10463
|
-
props[key] = { type: opt, default: defaults[key] };
|
|
10486
|
+
opt = props[key] = { type: opt, default: defaults[key] };
|
|
10464
10487
|
} else {
|
|
10465
10488
|
opt.default = defaults[key];
|
|
10466
10489
|
}
|
|
10467
10490
|
} else if (opt === null) {
|
|
10468
|
-
props[key] = { default: defaults[key] };
|
|
10491
|
+
opt = props[key] = { default: defaults[key] };
|
|
10469
10492
|
} else {
|
|
10470
10493
|
warn(`props default key "${key}" has no corresponding declaration.`);
|
|
10471
10494
|
}
|
|
10495
|
+
if (opt && defaults[`__skip_${key}`]) {
|
|
10496
|
+
opt.skipFactory = true;
|
|
10497
|
+
}
|
|
10472
10498
|
}
|
|
10473
10499
|
return props;
|
|
10474
10500
|
}
|
|
@@ -10523,7 +10549,7 @@ function h(type, propsOrChildren, children) {
|
|
|
10523
10549
|
}
|
|
10524
10550
|
}
|
|
10525
10551
|
|
|
10526
|
-
const ssrContextKey = Symbol(
|
|
10552
|
+
const ssrContextKey = Symbol.for("v-scx");
|
|
10527
10553
|
const useSSRContext = () => {
|
|
10528
10554
|
{
|
|
10529
10555
|
const ctx = inject(ssrContextKey);
|
|
@@ -10737,7 +10763,7 @@ function isMemoSame(cached, memo) {
|
|
|
10737
10763
|
return true;
|
|
10738
10764
|
}
|
|
10739
10765
|
|
|
10740
|
-
const version = "3.3.0-alpha.
|
|
10766
|
+
const version = "3.3.0-alpha.6";
|
|
10741
10767
|
const _ssrUtils = {
|
|
10742
10768
|
createComponentInstance,
|
|
10743
10769
|
setupComponent,
|
|
@@ -12394,6 +12420,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
|
|
|
12394
12420
|
defineCustomElement: defineCustomElement,
|
|
12395
12421
|
defineEmits: defineEmits,
|
|
12396
12422
|
defineExpose: defineExpose,
|
|
12423
|
+
defineOptions: defineOptions,
|
|
12397
12424
|
defineProps: defineProps,
|
|
12398
12425
|
defineSSRCustomElement: defineSSRCustomElement,
|
|
12399
12426
|
get devtools () { return devtools; },
|
|
@@ -12808,6 +12835,20 @@ function createBlockStatement(body) {
|
|
|
12808
12835
|
loc: locStub
|
|
12809
12836
|
};
|
|
12810
12837
|
}
|
|
12838
|
+
function getVNodeHelper(ssr, isComponent) {
|
|
12839
|
+
return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
|
|
12840
|
+
}
|
|
12841
|
+
function getVNodeBlockHelper(ssr, isComponent) {
|
|
12842
|
+
return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
|
|
12843
|
+
}
|
|
12844
|
+
function convertToBlock(node, { helper, removeHelper, inSSR }) {
|
|
12845
|
+
if (!node.isBlock) {
|
|
12846
|
+
node.isBlock = true;
|
|
12847
|
+
removeHelper(getVNodeHelper(inSSR, node.isComponent));
|
|
12848
|
+
helper(OPEN_BLOCK);
|
|
12849
|
+
helper(getVNodeBlockHelper(inSSR, node.isComponent));
|
|
12850
|
+
}
|
|
12851
|
+
}
|
|
12811
12852
|
|
|
12812
12853
|
const isStaticExp = (p) => p.type === 4 && p.isStatic;
|
|
12813
12854
|
const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
|
|
@@ -12925,12 +12966,6 @@ function isTemplateNode(node) {
|
|
|
12925
12966
|
function isSlotOutlet(node) {
|
|
12926
12967
|
return node.type === 1 && node.tagType === 2;
|
|
12927
12968
|
}
|
|
12928
|
-
function getVNodeHelper(ssr, isComponent) {
|
|
12929
|
-
return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
|
|
12930
|
-
}
|
|
12931
|
-
function getVNodeBlockHelper(ssr, isComponent) {
|
|
12932
|
-
return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
|
|
12933
|
-
}
|
|
12934
12969
|
const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
|
|
12935
12970
|
function getUnnormalizedProps(props, callPath = []) {
|
|
12936
12971
|
if (props && !isString(props) && props.type === 14) {
|
|
@@ -13063,14 +13098,6 @@ function getMemoedVNodeCall(node) {
|
|
|
13063
13098
|
return node;
|
|
13064
13099
|
}
|
|
13065
13100
|
}
|
|
13066
|
-
function makeBlock(node, { helper, removeHelper, inSSR }) {
|
|
13067
|
-
if (!node.isBlock) {
|
|
13068
|
-
node.isBlock = true;
|
|
13069
|
-
removeHelper(getVNodeHelper(inSSR, node.isComponent));
|
|
13070
|
-
helper(OPEN_BLOCK);
|
|
13071
|
-
helper(getVNodeBlockHelper(inSSR, node.isComponent));
|
|
13072
|
-
}
|
|
13073
|
-
}
|
|
13074
13101
|
|
|
13075
13102
|
const deprecationData = {
|
|
13076
13103
|
["COMPILER_IS_ON_ELEMENT"]: {
|
|
@@ -14360,7 +14387,7 @@ function createRootCodegen(root, context) {
|
|
|
14360
14387
|
if (isSingleElementRoot(root, child) && child.codegenNode) {
|
|
14361
14388
|
const codegenNode = child.codegenNode;
|
|
14362
14389
|
if (codegenNode.type === 13) {
|
|
14363
|
-
|
|
14390
|
+
convertToBlock(codegenNode, context);
|
|
14364
14391
|
}
|
|
14365
14392
|
root.codegenNode = codegenNode;
|
|
14366
14393
|
} else {
|
|
@@ -15228,7 +15255,7 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
|
|
|
15228
15255
|
estreeWalker.walk(root, {
|
|
15229
15256
|
enter(node, parent) {
|
|
15230
15257
|
parent && parentStack.push(parent);
|
|
15231
|
-
if (parent && parent.type.startsWith("TS") &&
|
|
15258
|
+
if (parent && parent.type.startsWith("TS") && !TS_NODE_TYPES.includes(parent.type)) {
|
|
15232
15259
|
return this.skip();
|
|
15233
15260
|
}
|
|
15234
15261
|
if (node.type === "Identifier") {
|
|
@@ -15459,6 +15486,18 @@ function isReferenced(node, parent, grandparent) {
|
|
|
15459
15486
|
}
|
|
15460
15487
|
return true;
|
|
15461
15488
|
}
|
|
15489
|
+
const TS_NODE_TYPES = [
|
|
15490
|
+
"TSAsExpression",
|
|
15491
|
+
// foo as number
|
|
15492
|
+
"TSTypeAssertion",
|
|
15493
|
+
// (<number>foo)
|
|
15494
|
+
"TSNonNullExpression",
|
|
15495
|
+
// foo!
|
|
15496
|
+
"TSInstantiationExpression",
|
|
15497
|
+
// foo<string>
|
|
15498
|
+
"TSSatisfiesExpression"
|
|
15499
|
+
// foo satisfies T
|
|
15500
|
+
];
|
|
15462
15501
|
|
|
15463
15502
|
const isLiteralWhitelisted = /* @__PURE__ */ makeMap("true,false,null,this");
|
|
15464
15503
|
const transformExpression = (node, context) => {
|
|
@@ -15499,7 +15538,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
15499
15538
|
const isAssignmentLVal = parent && parent.type === "AssignmentExpression" && parent.left === id;
|
|
15500
15539
|
const isUpdateArg = parent && parent.type === "UpdateExpression" && parent.argument === id;
|
|
15501
15540
|
const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack);
|
|
15502
|
-
if (type
|
|
15541
|
+
if (isConst(type) || type === "setup-reactive-const" || localVars[raw]) {
|
|
15503
15542
|
return raw;
|
|
15504
15543
|
} else if (type === "setup-ref") {
|
|
15505
15544
|
return `${raw}.value`;
|
|
@@ -15543,6 +15582,8 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
15543
15582
|
return `$setup.${raw}`;
|
|
15544
15583
|
} else if (type === "props-aliased") {
|
|
15545
15584
|
return `$props['${bindingMetadata.__propsAliases[raw]}']`;
|
|
15585
|
+
} else if (type === "literal-const") {
|
|
15586
|
+
return raw;
|
|
15546
15587
|
} else if (type) {
|
|
15547
15588
|
return `$${type}.${raw}`;
|
|
15548
15589
|
}
|
|
@@ -15556,7 +15597,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
15556
15597
|
const isAllowedGlobal = isGloballyWhitelisted(rawExp);
|
|
15557
15598
|
const isLiteral = isLiteralWhitelisted(rawExp);
|
|
15558
15599
|
if (!asParams && !isScopeVarReference && !isAllowedGlobal && !isLiteral) {
|
|
15559
|
-
if (bindingMetadata[node.content]
|
|
15600
|
+
if (isConst(bindingMetadata[node.content])) {
|
|
15560
15601
|
node.constType = 1;
|
|
15561
15602
|
}
|
|
15562
15603
|
node.content = rewriteIdentifier(rawExp);
|
|
@@ -15672,6 +15713,9 @@ function stringifyExpression(exp) {
|
|
|
15672
15713
|
return exp.children.map(stringifyExpression).join("");
|
|
15673
15714
|
}
|
|
15674
15715
|
}
|
|
15716
|
+
function isConst(type) {
|
|
15717
|
+
return type === "setup-const" || type === "literal-const";
|
|
15718
|
+
}
|
|
15675
15719
|
|
|
15676
15720
|
const transformIf = createStructuralDirectiveTransform(
|
|
15677
15721
|
/^(if|else|else-if)$/,
|
|
@@ -15855,7 +15899,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
15855
15899
|
const ret = firstChild.codegenNode;
|
|
15856
15900
|
const vnodeCall = getMemoedVNodeCall(ret);
|
|
15857
15901
|
if (vnodeCall.type === 13) {
|
|
15858
|
-
|
|
15902
|
+
convertToBlock(vnodeCall, context);
|
|
15859
15903
|
}
|
|
15860
15904
|
injectProp(vnodeCall, keyProperty, context);
|
|
15861
15905
|
return ret;
|
|
@@ -16640,7 +16684,7 @@ function resolveSetupReference(name, context) {
|
|
|
16640
16684
|
return PascalName;
|
|
16641
16685
|
}
|
|
16642
16686
|
};
|
|
16643
|
-
const fromConst = checkType("setup-const") || checkType("setup-reactive-const");
|
|
16687
|
+
const fromConst = checkType("setup-const") || checkType("setup-reactive-const") || checkType("literal-const");
|
|
16644
16688
|
if (fromConst) {
|
|
16645
16689
|
return context.inline ? (
|
|
16646
16690
|
// in inline mode, const setup bindings (e.g. imports) can be used as-is
|
|
@@ -17642,7 +17686,7 @@ const transformMemo = (node, context) => {
|
|
|
17642
17686
|
const codegenNode = node.codegenNode || context.currentNode.codegenNode;
|
|
17643
17687
|
if (codegenNode && codegenNode.type === 13) {
|
|
17644
17688
|
if (node.tagType !== 1) {
|
|
17645
|
-
|
|
17689
|
+
convertToBlock(codegenNode, context);
|
|
17646
17690
|
}
|
|
17647
17691
|
node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
|
|
17648
17692
|
dir.exp,
|