@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.
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
  }
@@ -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;
@@ -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.4"}`;
6746
+ Vue.version = `2.6.14-compat:${"3.3.0-alpha.5"}`;
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("Fragment" );
9642
- const Text = Symbol("Text" );
9643
- const Comment = Symbol("Comment" );
9644
- const Static = Symbol("Static" );
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
- currentInstance = instance;
10123
+ internalSetCurrentInstance(instance);
10108
10124
  instance.scope.on();
10109
10125
  };
10110
10126
  const unsetCurrentInstance = () => {
10111
10127
  currentInstance && currentInstance.scope.off();
10112
- currentInstance = null;
10128
+ internalSetCurrentInstance(null);
10113
10129
  };
10114
10130
  const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
10115
10131
  function validateComponentName(name, config) {
@@ -10523,7 +10539,7 @@ function h(type, propsOrChildren, children) {
10523
10539
  }
10524
10540
  }
10525
10541
 
10526
- const ssrContextKey = Symbol(`ssrContext` );
10542
+ const ssrContextKey = Symbol.for("v-scx");
10527
10543
  const useSSRContext = () => {
10528
10544
  {
10529
10545
  const ctx = inject(ssrContextKey);
@@ -10737,7 +10753,7 @@ function isMemoSame(cached, memo) {
10737
10753
  return true;
10738
10754
  }
10739
10755
 
10740
- const version = "3.3.0-alpha.4";
10756
+ const version = "3.3.0-alpha.5";
10741
10757
  const _ssrUtils = {
10742
10758
  createComponentInstance,
10743
10759
  setupComponent,
@@ -12808,6 +12824,20 @@ function createBlockStatement(body) {
12808
12824
  loc: locStub
12809
12825
  };
12810
12826
  }
12827
+ function getVNodeHelper(ssr, isComponent) {
12828
+ return ssr || isComponent ? CREATE_VNODE : CREATE_ELEMENT_VNODE;
12829
+ }
12830
+ function getVNodeBlockHelper(ssr, isComponent) {
12831
+ return ssr || isComponent ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK;
12832
+ }
12833
+ function convertToBlock(node, { helper, removeHelper, inSSR }) {
12834
+ if (!node.isBlock) {
12835
+ node.isBlock = true;
12836
+ removeHelper(getVNodeHelper(inSSR, node.isComponent));
12837
+ helper(OPEN_BLOCK);
12838
+ helper(getVNodeBlockHelper(inSSR, node.isComponent));
12839
+ }
12840
+ }
12811
12841
 
12812
12842
  const isStaticExp = (p) => p.type === 4 && p.isStatic;
12813
12843
  const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
@@ -12925,12 +12955,6 @@ function isTemplateNode(node) {
12925
12955
  function isSlotOutlet(node) {
12926
12956
  return node.type === 1 && node.tagType === 2;
12927
12957
  }
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
12958
  const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
12935
12959
  function getUnnormalizedProps(props, callPath = []) {
12936
12960
  if (props && !isString(props) && props.type === 14) {
@@ -13063,14 +13087,6 @@ function getMemoedVNodeCall(node) {
13063
13087
  return node;
13064
13088
  }
13065
13089
  }
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
13090
 
13075
13091
  const deprecationData = {
13076
13092
  ["COMPILER_IS_ON_ELEMENT"]: {
@@ -14360,7 +14376,7 @@ function createRootCodegen(root, context) {
14360
14376
  if (isSingleElementRoot(root, child) && child.codegenNode) {
14361
14377
  const codegenNode = child.codegenNode;
14362
14378
  if (codegenNode.type === 13) {
14363
- makeBlock(codegenNode, context);
14379
+ convertToBlock(codegenNode, context);
14364
14380
  }
14365
14381
  root.codegenNode = codegenNode;
14366
14382
  } else {
@@ -15855,7 +15871,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
15855
15871
  const ret = firstChild.codegenNode;
15856
15872
  const vnodeCall = getMemoedVNodeCall(ret);
15857
15873
  if (vnodeCall.type === 13) {
15858
- makeBlock(vnodeCall, context);
15874
+ convertToBlock(vnodeCall, context);
15859
15875
  }
15860
15876
  injectProp(vnodeCall, keyProperty, context);
15861
15877
  return ret;
@@ -17642,7 +17658,7 @@ const transformMemo = (node, context) => {
17642
17658
  const codegenNode = node.codegenNode || context.currentNode.codegenNode;
17643
17659
  if (codegenNode && codegenNode.type === 13) {
17644
17660
  if (node.tagType !== 1) {
17645
- makeBlock(codegenNode, context);
17661
+ convertToBlock(codegenNode, context);
17646
17662
  }
17647
17663
  node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [
17648
17664
  dir.exp,