@vue/compat 3.3.0-alpha.4 → 3.3.0-alpha.5

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.
@@ -13,22 +13,99 @@ function makeMap(str, expectsLowerCase) {
13
13
  return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
14
14
  }
15
15
 
16
- const PatchFlagNames = {
17
- [1]: `TEXT`,
18
- [2]: `CLASS`,
19
- [4]: `STYLE`,
20
- [8]: `PROPS`,
21
- [16]: `FULL_PROPS`,
22
- [32]: `HYDRATE_EVENTS`,
23
- [64]: `STABLE_FRAGMENT`,
24
- [128]: `KEYED_FRAGMENT`,
25
- [256]: `UNKEYED_FRAGMENT`,
26
- [512]: `NEED_PATCH`,
27
- [1024]: `DYNAMIC_SLOTS`,
28
- [2048]: `DEV_ROOT_FRAGMENT`,
29
- [-1]: `HOISTED`,
30
- [-2]: `BAIL`
16
+ const EMPTY_OBJ = {};
17
+ const EMPTY_ARR = [];
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);
31
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
+ }
32
109
 
33
110
  const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt";
34
111
  const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
@@ -249,100 +326,6 @@ const replacer = (_key, val) => {
249
326
  return val;
250
327
  };
251
328
 
252
- const EMPTY_OBJ = {};
253
- const EMPTY_ARR = [];
254
- const NOOP = () => {
255
- };
256
- const NO = () => false;
257
- const onRE = /^on[^a-z]/;
258
- const isOn = (key) => onRE.test(key);
259
- const isModelListener = (key) => key.startsWith("onUpdate:");
260
- const extend = Object.assign;
261
- const remove = (arr, el) => {
262
- const i = arr.indexOf(el);
263
- if (i > -1) {
264
- arr.splice(i, 1);
265
- }
266
- };
267
- const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
268
- const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
269
- const isArray = Array.isArray;
270
- const isMap = (val) => toTypeString(val) === "[object Map]";
271
- const isSet = (val) => toTypeString(val) === "[object Set]";
272
- const isDate = (val) => toTypeString(val) === "[object Date]";
273
- const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
274
- const isFunction = (val) => typeof val === "function";
275
- const isString = (val) => typeof val === "string";
276
- const isSymbol = (val) => typeof val === "symbol";
277
- const isObject = (val) => val !== null && typeof val === "object";
278
- const isPromise = (val) => {
279
- return isObject(val) && isFunction(val.then) && isFunction(val.catch);
280
- };
281
- const objectToString = Object.prototype.toString;
282
- const toTypeString = (value) => objectToString.call(value);
283
- const toRawType = (value) => {
284
- return toTypeString(value).slice(8, -1);
285
- };
286
- const isPlainObject = (val) => toTypeString(val) === "[object Object]";
287
- const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
288
- const isReservedProp = /* @__PURE__ */ makeMap(
289
- // the leading comma is intentional so empty string "" is also included
290
- ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
291
- );
292
- const isBuiltInDirective = /* @__PURE__ */ makeMap(
293
- "bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
294
- );
295
- const cacheStringFunction = (fn) => {
296
- const cache = /* @__PURE__ */ Object.create(null);
297
- return (str) => {
298
- const hit = cache[str];
299
- return hit || (cache[str] = fn(str));
300
- };
301
- };
302
- const camelizeRE = /-(\w)/g;
303
- const camelize = cacheStringFunction((str) => {
304
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
305
- });
306
- const hyphenateRE = /\B([A-Z])/g;
307
- const hyphenate = cacheStringFunction(
308
- (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
309
- );
310
- const capitalize = cacheStringFunction(
311
- (str) => str.charAt(0).toUpperCase() + str.slice(1)
312
- );
313
- const toHandlerKey = cacheStringFunction(
314
- (str) => str ? `on${capitalize(str)}` : ``
315
- );
316
- const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
317
- const invokeArrayFns = (fns, arg) => {
318
- for (let i = 0; i < fns.length; i++) {
319
- fns[i](arg);
320
- }
321
- };
322
- const def = (obj, key, value) => {
323
- Object.defineProperty(obj, key, {
324
- configurable: true,
325
- enumerable: false,
326
- value
327
- });
328
- };
329
- const looseToNumber = (val) => {
330
- const n = parseFloat(val);
331
- return isNaN(n) ? val : n;
332
- };
333
- const toNumber = (val) => {
334
- const n = isString(val) ? Number(val) : NaN;
335
- return isNaN(n) ? val : n;
336
- };
337
- let _globalThis;
338
- const getGlobalThis = () => {
339
- return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
340
- };
341
- const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
342
- function genPropsAccessExp(name) {
343
- return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
344
- }
345
-
346
329
  let activeEffectScope;
347
330
  class EffectScope {
348
331
  constructor(detached = false) {
@@ -3779,7 +3762,7 @@ const FILTERS = "filters";
3779
3762
  function resolveComponent(name, maybeSelfReference) {
3780
3763
  return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
3781
3764
  }
3782
- const NULL_DYNAMIC_COMPONENT = Symbol();
3765
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
3783
3766
  function resolveDynamicComponent(component) {
3784
3767
  if (isString(component)) {
3785
3768
  return resolveAsset(COMPONENTS, component, false) || component;
@@ -5372,7 +5355,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5372
5355
  return vm;
5373
5356
  }
5374
5357
  }
5375
- Vue.version = `2.6.14-compat:${"3.3.0-alpha.4"}`;
5358
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.5"}`;
5376
5359
  Vue.config = singletonApp.config;
5377
5360
  Vue.use = (p, ...options) => {
5378
5361
  if (p && isFunction(p.install)) {
@@ -7906,10 +7889,10 @@ function convertLegacyComponent(comp, instance) {
7906
7889
  return comp;
7907
7890
  }
7908
7891
 
7909
- const Fragment = Symbol(void 0);
7910
- const Text = Symbol(void 0);
7911
- const Comment = Symbol(void 0);
7912
- const Static = Symbol(void 0);
7892
+ const Fragment = Symbol.for("v-fgt");
7893
+ const Text = Symbol.for("v-txt");
7894
+ const Comment = Symbol.for("v-cmt");
7895
+ const Static = Symbol.for("v-stc");
7913
7896
  const blockStack = [];
7914
7897
  let currentBlock = null;
7915
7898
  function openBlock(disableTracking = false) {
@@ -8337,13 +8320,29 @@ function createComponentInstance(vnode, parent, suspense) {
8337
8320
  }
8338
8321
  let currentInstance = null;
8339
8322
  const getCurrentInstance = () => currentInstance || currentRenderingInstance;
8323
+ let internalSetCurrentInstance;
8324
+ let globalCurrentInstanceSetters;
8325
+ let settersKey = "__VUE_INSTANCE_SETTERS__";
8326
+ {
8327
+ if (!(globalCurrentInstanceSetters = getGlobalThis()[settersKey])) {
8328
+ globalCurrentInstanceSetters = getGlobalThis()[settersKey] = [];
8329
+ }
8330
+ globalCurrentInstanceSetters.push((i) => currentInstance = i);
8331
+ internalSetCurrentInstance = (instance) => {
8332
+ if (globalCurrentInstanceSetters.length > 1) {
8333
+ globalCurrentInstanceSetters.forEach((s) => s(instance));
8334
+ } else {
8335
+ globalCurrentInstanceSetters[0](instance);
8336
+ }
8337
+ };
8338
+ }
8340
8339
  const setCurrentInstance = (instance) => {
8341
- currentInstance = instance;
8340
+ internalSetCurrentInstance(instance);
8342
8341
  instance.scope.on();
8343
8342
  };
8344
8343
  const unsetCurrentInstance = () => {
8345
8344
  currentInstance && currentInstance.scope.off();
8346
- currentInstance = null;
8345
+ internalSetCurrentInstance(null);
8347
8346
  };
8348
8347
  function isStatefulComponent(instance) {
8349
8348
  return instance.vnode.shapeFlag & 4;
@@ -8600,7 +8599,7 @@ function h(type, propsOrChildren, children) {
8600
8599
  }
8601
8600
  }
8602
8601
 
8603
- const ssrContextKey = Symbol(``);
8602
+ const ssrContextKey = Symbol.for("v-scx");
8604
8603
  const useSSRContext = () => {
8605
8604
  {
8606
8605
  const ctx = inject(ssrContextKey);
@@ -8639,7 +8638,7 @@ function isMemoSame(cached, memo) {
8639
8638
  return true;
8640
8639
  }
8641
8640
 
8642
- const version = "3.3.0-alpha.4";
8641
+ const version = "3.3.0-alpha.5";
8643
8642
  const _ssrUtils = {
8644
8643
  createComponentInstance,
8645
8644
  setupComponent,
@@ -10589,6 +10588,20 @@ function createBlockStatement(body) {
10589
10588
  loc: locStub
10590
10589
  };
10591
10590
  }
10591
+ function getVNodeHelper(ssr, isComponent) {
10592
+ return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
10593
+ }
10594
+ function getVNodeBlockHelper(ssr, isComponent) {
10595
+ return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
10596
+ }
10597
+ function convertToBlock(node, { helper, removeHelper, inSSR }) {
10598
+ if (!node.isBlock) {
10599
+ node.isBlock = true;
10600
+ removeHelper(getVNodeHelper(inSSR, node.isComponent));
10601
+ helper(OPEN_BLOCK);
10602
+ helper(getVNodeBlockHelper(inSSR, node.isComponent));
10603
+ }
10604
+ }
10592
10605
 
10593
10606
  const isStaticExp = (p) => p.type === 4 && p.isStatic;
10594
10607
  const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
@@ -10701,12 +10714,6 @@ function isTemplateNode(node) {
10701
10714
  function isSlotOutlet(node) {
10702
10715
  return node.type === 1 && node.tagType === 2;
10703
10716
  }
10704
- function getVNodeHelper(ssr, isComponent) {
10705
- return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
10706
- }
10707
- function getVNodeBlockHelper(ssr, isComponent) {
10708
- return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
10709
- }
10710
10717
  const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
10711
10718
  function getUnnormalizedProps(props, callPath = []) {
10712
10719
  if (props && !isString(props) && props.type === 14) {
@@ -10839,14 +10846,6 @@ function getMemoedVNodeCall(node) {
10839
10846
  return node;
10840
10847
  }
10841
10848
  }
10842
- function makeBlock(node, { helper, removeHelper, inSSR }) {
10843
- if (!node.isBlock) {
10844
- node.isBlock = true;
10845
- removeHelper(getVNodeHelper(inSSR, node.isComponent));
10846
- helper(OPEN_BLOCK);
10847
- helper(getVNodeBlockHelper(inSSR, node.isComponent));
10848
- }
10849
- }
10850
10849
 
10851
10850
  function getCompatValue(key, context) {
10852
10851
  const config = context.options ? context.options.compatConfig : context.compatConfig;
@@ -12032,7 +12031,7 @@ function createRootCodegen(root, context) {
12032
12031
  if (isSingleElementRoot(root, child) && child.codegenNode) {
12033
12032
  const codegenNode = child.codegenNode;
12034
12033
  if (codegenNode.type === 13) {
12035
- makeBlock(codegenNode, context);
12034
+ convertToBlock(codegenNode, context);
12036
12035
  }
12037
12036
  root.codegenNode = codegenNode;
12038
12037
  } else {
@@ -12040,7 +12039,6 @@ function createRootCodegen(root, context) {
12040
12039
  }
12041
12040
  } else if (children.length > 1) {
12042
12041
  let patchFlag = 64;
12043
- PatchFlagNames[64];
12044
12042
  root.codegenNode = createVNodeCall(
12045
12043
  context,
12046
12044
  helper(FRAGMENT),
@@ -13500,7 +13498,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
13500
13498
  const ret = firstChild.codegenNode;
13501
13499
  const vnodeCall = getMemoedVNodeCall(ret);
13502
13500
  if (vnodeCall.type === 13) {
13503
- makeBlock(vnodeCall, context);
13501
+ convertToBlock(vnodeCall, context);
13504
13502
  }
13505
13503
  injectProp(vnodeCall, keyProperty, context);
13506
13504
  return ret;
@@ -15247,7 +15245,7 @@ const transformMemo = (node, context) => {
15247
15245
  const codegenNode = node.codegenNode || context.currentNode.codegenNode;
15248
15246
  if (codegenNode && codegenNode.type === 13) {
15249
15247
  if (node.tagType !== 1) {
15250
- makeBlock(codegenNode, context);
15248
+ convertToBlock(codegenNode, context);
15251
15249
  }
15252
15250
  node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
15253
15251
  dir.exp,