vue 3.3.9 → 3.3.11

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.
@@ -1,5 +1,3 @@
1
1
  if (typeof require !== 'undefined') {
2
- try {
3
- require('@vue/compiler-sfc').registerTS(() => require('typescript'))
4
- } catch (e) {}
2
+ require('@vue/compiler-sfc').registerTS(() => require('typescript'))
5
3
  }
package/dist/vue.cjs.js CHANGED
@@ -19,7 +19,15 @@ function _interopNamespaceDefault(e) {
19
19
 
20
20
  var runtimeDom__namespace = /*#__PURE__*/_interopNamespaceDefault(runtimeDom);
21
21
 
22
- const compileCache = /* @__PURE__ */ Object.create(null);
22
+ const compileCache = /* @__PURE__ */ new WeakMap();
23
+ function getCache(options) {
24
+ let c = compileCache.get(options != null ? options : shared.EMPTY_OBJ);
25
+ if (!c) {
26
+ c = /* @__PURE__ */ Object.create(null);
27
+ compileCache.set(options != null ? options : shared.EMPTY_OBJ, c);
28
+ }
29
+ return c;
30
+ }
23
31
  function compileToFunction(template, options) {
24
32
  if (!shared.isString(template)) {
25
33
  if (template.nodeType) {
@@ -30,7 +38,8 @@ function compileToFunction(template, options) {
30
38
  }
31
39
  }
32
40
  const key = template;
33
- const cached = compileCache[key];
41
+ const cache = getCache(options);
42
+ const cached = cache[key];
34
43
  if (cached) {
35
44
  return cached;
36
45
  }
@@ -65,7 +74,7 @@ ${codeFrame}` : message);
65
74
  }
66
75
  const render = new Function("Vue", code)(runtimeDom__namespace);
67
76
  render._rc = true;
68
- return compileCache[key] = render;
77
+ return cache[key] = render;
69
78
  }
70
79
  runtimeDom.registerRuntimeCompiler(compileToFunction);
71
80
 
@@ -19,7 +19,15 @@ function _interopNamespaceDefault(e) {
19
19
 
20
20
  var runtimeDom__namespace = /*#__PURE__*/_interopNamespaceDefault(runtimeDom);
21
21
 
22
- const compileCache = /* @__PURE__ */ Object.create(null);
22
+ const compileCache = /* @__PURE__ */ new WeakMap();
23
+ function getCache(options) {
24
+ let c = compileCache.get(options != null ? options : shared.EMPTY_OBJ);
25
+ if (!c) {
26
+ c = /* @__PURE__ */ Object.create(null);
27
+ compileCache.set(options != null ? options : shared.EMPTY_OBJ, c);
28
+ }
29
+ return c;
30
+ }
23
31
  function compileToFunction(template, options) {
24
32
  if (!shared.isString(template)) {
25
33
  if (template.nodeType) {
@@ -29,7 +37,8 @@ function compileToFunction(template, options) {
29
37
  }
30
38
  }
31
39
  const key = template;
32
- const cached = compileCache[key];
40
+ const cache = getCache(options);
41
+ const cached = cache[key];
33
42
  if (cached) {
34
43
  return cached;
35
44
  }
@@ -51,7 +60,7 @@ function compileToFunction(template, options) {
51
60
  const { code } = compilerDom.compile(template, opts);
52
61
  const render = new Function("Vue", code)(runtimeDom__namespace);
53
62
  render._rc = true;
54
- return compileCache[key] = render;
63
+ return cache[key] = render;
55
64
  }
56
65
  runtimeDom.registerRuntimeCompiler(compileToFunction);
57
66
 
@@ -12,8 +12,8 @@ const EMPTY_ARR = Object.freeze([]) ;
12
12
  const NOOP = () => {
13
13
  };
14
14
  const NO = () => false;
15
- const onRE = /^on[^a-z]/;
16
- const isOn = (key) => onRE.test(key);
15
+ const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
16
+ (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
17
17
  const isModelListener = (key) => key.startsWith("onUpdate:");
18
18
  const extend = Object.assign;
19
19
  const remove = (arr, el) => {
@@ -300,20 +300,29 @@ const replacer = (_key, val) => {
300
300
  return replacer(_key, val.value);
301
301
  } else if (isMap(val)) {
302
302
  return {
303
- [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
304
- entries[`${key} =>`] = val2;
305
- return entries;
306
- }, {})
303
+ [`Map(${val.size})`]: [...val.entries()].reduce(
304
+ (entries, [key, val2], i) => {
305
+ entries[stringifySymbol(key, i) + " =>"] = val2;
306
+ return entries;
307
+ },
308
+ {}
309
+ )
307
310
  };
308
311
  } else if (isSet(val)) {
309
312
  return {
310
- [`Set(${val.size})`]: [...val.values()]
313
+ [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
311
314
  };
315
+ } else if (isSymbol(val)) {
316
+ return stringifySymbol(val);
312
317
  } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
313
318
  return String(val);
314
319
  }
315
320
  return val;
316
321
  };
322
+ const stringifySymbol = (v, i = "") => {
323
+ var _a;
324
+ return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
325
+ };
317
326
 
318
327
  function warn$1(msg, ...args) {
319
328
  console.warn(`[Vue warn] ${msg}`, ...args);
@@ -737,8 +746,13 @@ class BaseReactiveHandler {
737
746
  return isReadonly2;
738
747
  } else if (key === "__v_isShallow") {
739
748
  return shallow;
740
- } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
741
- return target;
749
+ } else if (key === "__v_raw") {
750
+ if (receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
751
+ // this means the reciever is a user proxy of the reactive proxy
752
+ Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
753
+ return target;
754
+ }
755
+ return;
742
756
  }
743
757
  const targetIsArray = isArray(target);
744
758
  if (!isReadonly2) {
@@ -1749,13 +1763,16 @@ function queuePostFlushCb(cb) {
1749
1763
  }
1750
1764
  queueFlush();
1751
1765
  }
1752
- function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
1766
+ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
1753
1767
  {
1754
1768
  seen = seen || /* @__PURE__ */ new Map();
1755
1769
  }
1756
1770
  for (; i < queue.length; i++) {
1757
1771
  const cb = queue[i];
1758
1772
  if (cb && cb.pre) {
1773
+ if (instance && cb.id !== instance.uid) {
1774
+ continue;
1775
+ }
1759
1776
  if (checkRecursiveUpdates(seen, cb)) {
1760
1777
  continue;
1761
1778
  }
@@ -2895,7 +2912,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
2895
2912
  if (delayEnter) {
2896
2913
  activeBranch.transition.afterLeave = () => {
2897
2914
  if (pendingId === suspense.pendingId) {
2898
- move(pendingBranch, container2, anchor2, 0);
2915
+ move(
2916
+ pendingBranch,
2917
+ container2,
2918
+ next(activeBranch),
2919
+ 0
2920
+ );
2899
2921
  queuePostFlushCb(effects);
2900
2922
  }
2901
2923
  };
@@ -7297,7 +7319,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7297
7319
  updateProps(instance, nextVNode.props, prevProps, optimized);
7298
7320
  updateSlots(instance, nextVNode.children, optimized);
7299
7321
  pauseTracking();
7300
- flushPreFlushCbs();
7322
+ flushPreFlushCbs(instance);
7301
7323
  resetTracking();
7302
7324
  };
7303
7325
  const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
@@ -8974,9 +8996,9 @@ function initCustomFormatter() {
8974
8996
  return;
8975
8997
  }
8976
8998
  const vueStyle = { style: "color:#3ba776" };
8977
- const numberStyle = { style: "color:#0b1bc9" };
8978
- const stringStyle = { style: "color:#b62e24" };
8979
- const keywordStyle = { style: "color:#9d288c" };
8999
+ const numberStyle = { style: "color:#1677ff" };
9000
+ const stringStyle = { style: "color:#f5222d" };
9001
+ const keywordStyle = { style: "color:#eb2f96" };
8980
9002
  const formatter = {
8981
9003
  header(obj) {
8982
9004
  if (!isObject(obj)) {
@@ -9170,7 +9192,7 @@ function isMemoSame(cached, memo) {
9170
9192
  return true;
9171
9193
  }
9172
9194
 
9173
- const version = "3.3.9";
9195
+ const version = "3.3.11";
9174
9196
  const ssrUtils = null;
9175
9197
  const resolveFilter = null;
9176
9198
  const compatUtils = null;
@@ -9782,7 +9804,8 @@ function patchStopImmediatePropagation(e, value) {
9782
9804
  }
9783
9805
  }
9784
9806
 
9785
- const nativeOnRE = /^on[a-z]/;
9807
+ const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
9808
+ key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
9786
9809
  const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
9787
9810
  if (key === "class") {
9788
9811
  patchClass(el, nextValue, isSVG);
@@ -9816,7 +9839,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
9816
9839
  if (key === "innerHTML" || key === "textContent") {
9817
9840
  return true;
9818
9841
  }
9819
- if (key in el && nativeOnRE.test(key) && isFunction(value)) {
9842
+ if (key in el && isNativeOn(key) && isFunction(value)) {
9820
9843
  return true;
9821
9844
  }
9822
9845
  return false;
@@ -9833,7 +9856,13 @@ function shouldSetAsProp(el, key, value, isSVG) {
9833
9856
  if (key === "type" && el.tagName === "TEXTAREA") {
9834
9857
  return false;
9835
9858
  }
9836
- if (nativeOnRE.test(key) && isString(value)) {
9859
+ if (key === "width" || key === "height") {
9860
+ const tag = el.tagName;
9861
+ if (tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE") {
9862
+ return false;
9863
+ }
9864
+ }
9865
+ if (isNativeOn(key) && isString(value)) {
9837
9866
  return false;
9838
9867
  }
9839
9868
  return key in el;
@@ -10514,14 +10543,14 @@ const modifierGuards = {
10514
10543
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
10515
10544
  };
10516
10545
  const withModifiers = (fn, modifiers) => {
10517
- return (event, ...args) => {
10546
+ return fn._withMods || (fn._withMods = (event, ...args) => {
10518
10547
  for (let i = 0; i < modifiers.length; i++) {
10519
10548
  const guard = modifierGuards[modifiers[i]];
10520
10549
  if (guard && guard(event, modifiers))
10521
10550
  return;
10522
10551
  }
10523
10552
  return fn(event, ...args);
10524
- };
10553
+ });
10525
10554
  };
10526
10555
  const keyNames = {
10527
10556
  esc: "escape",
@@ -10533,7 +10562,7 @@ const keyNames = {
10533
10562
  delete: "backspace"
10534
10563
  };
10535
10564
  const withKeys = (fn, modifiers) => {
10536
- return (event) => {
10565
+ return fn._withKeys || (fn._withKeys = (event) => {
10537
10566
  if (!("key" in event)) {
10538
10567
  return;
10539
10568
  }
@@ -10541,7 +10570,7 @@ const withKeys = (fn, modifiers) => {
10541
10570
  if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) {
10542
10571
  return fn(event);
10543
10572
  }
10544
- };
10573
+ });
10545
10574
  };
10546
10575
 
10547
10576
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -14157,6 +14186,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14157
14186
  if (isEventHandler && isReservedProp(name)) {
14158
14187
  hasVnodeHook = true;
14159
14188
  }
14189
+ if (isEventHandler && value.type === 14) {
14190
+ value = value.arguments[0];
14191
+ }
14160
14192
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
14161
14193
  return;
14162
14194
  }
@@ -15427,7 +15459,15 @@ function compile(template, options = {}) {
15427
15459
  {
15428
15460
  initDev();
15429
15461
  }
15430
- const compileCache = /* @__PURE__ */ Object.create(null);
15462
+ const compileCache = /* @__PURE__ */ new WeakMap();
15463
+ function getCache(options) {
15464
+ let c = compileCache.get(options != null ? options : EMPTY_OBJ);
15465
+ if (!c) {
15466
+ c = /* @__PURE__ */ Object.create(null);
15467
+ compileCache.set(options != null ? options : EMPTY_OBJ, c);
15468
+ }
15469
+ return c;
15470
+ }
15431
15471
  function compileToFunction(template, options) {
15432
15472
  if (!isString(template)) {
15433
15473
  if (template.nodeType) {
@@ -15438,7 +15478,8 @@ function compileToFunction(template, options) {
15438
15478
  }
15439
15479
  }
15440
15480
  const key = template;
15441
- const cached = compileCache[key];
15481
+ const cache = getCache(options);
15482
+ const cached = cache[key];
15442
15483
  if (cached) {
15443
15484
  return cached;
15444
15485
  }
@@ -15473,7 +15514,7 @@ ${codeFrame}` : message);
15473
15514
  }
15474
15515
  const render = new Function("Vue", code)(runtimeDom);
15475
15516
  render._rc = true;
15476
- return compileCache[key] = render;
15517
+ return cache[key] = render;
15477
15518
  }
15478
15519
  registerRuntimeCompiler(compileToFunction);
15479
15520