@vue/compat 3.4.0-beta.3 → 3.4.0-rc.1

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
@@ -2009,8 +2009,10 @@ function checkRecursiveUpdates(seen, fn) {
2009
2009
  if (count > RECURSION_LIMIT) {
2010
2010
  const instance = fn.ownerInstance;
2011
2011
  const componentName = instance && getComponentName(instance.type);
2012
- warn(
2013
- `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`
2012
+ handleError(
2013
+ `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
2014
+ null,
2015
+ 10
2014
2016
  );
2015
2017
  return true;
2016
2018
  } else {
@@ -6555,7 +6557,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6555
6557
  return vm;
6556
6558
  }
6557
6559
  }
6558
- Vue.version = `2.6.14-compat:${"3.4.0-beta.3"}`;
6560
+ Vue.version = `2.6.14-compat:${"3.4.0-rc.1"}`;
6559
6561
  Vue.config = singletonApp.config;
6560
6562
  Vue.use = (p, ...options) => {
6561
6563
  if (p && isFunction(p.install)) {
@@ -8283,9 +8285,9 @@ function propHasMismatch(el, key, clientValue) {
8283
8285
  let actual;
8284
8286
  let expected;
8285
8287
  if (key === "class") {
8286
- actual = el.className;
8287
- expected = normalizeClass(clientValue);
8288
- if (actual !== expected) {
8288
+ actual = toClassSet(el.getAttribute("class") || "");
8289
+ expected = toClassSet(normalizeClass(clientValue));
8290
+ if (!isSetEqual(actual, expected)) {
8289
8291
  mismatchType = mismatchKey = `class`;
8290
8292
  }
8291
8293
  } else if (key === "style") {
@@ -8317,6 +8319,20 @@ function propHasMismatch(el, key, clientValue) {
8317
8319
  }
8318
8320
  return false;
8319
8321
  }
8322
+ function toClassSet(str) {
8323
+ return new Set(str.trim().split(/\s+/));
8324
+ }
8325
+ function isSetEqual(a, b) {
8326
+ if (a.size !== b.size) {
8327
+ return false;
8328
+ }
8329
+ for (const s of a) {
8330
+ if (!b.has(s)) {
8331
+ return false;
8332
+ }
8333
+ }
8334
+ return true;
8335
+ }
8320
8336
 
8321
8337
  let supported;
8322
8338
  let perf;
@@ -11276,7 +11292,7 @@ function isMemoSame(cached, memo) {
11276
11292
  return true;
11277
11293
  }
11278
11294
 
11279
- const version = "3.4.0-beta.3";
11295
+ const version = "3.4.0-rc.1";
11280
11296
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11281
11297
  const _ssrUtils = {
11282
11298
  createComponentInstance,
@@ -12726,7 +12742,9 @@ const modifierGuards = {
12726
12742
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
12727
12743
  };
12728
12744
  const withModifiers = (fn, modifiers) => {
12729
- return fn._withMods || (fn._withMods = (event, ...args) => {
12745
+ const cache = fn._withMods || (fn._withMods = {});
12746
+ const cacheKey = modifiers.join(".");
12747
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12730
12748
  for (let i = 0; i < modifiers.length; i++) {
12731
12749
  const guard = modifierGuards[modifiers[i]];
12732
12750
  if (guard && guard(event, modifiers))
@@ -12761,7 +12779,9 @@ const withKeys = (fn, modifiers) => {
12761
12779
  );
12762
12780
  }
12763
12781
  }
12764
- return fn._withKeys || (fn._withKeys = (event) => {
12782
+ const cache = fn._withKeys || (fn._withKeys = {});
12783
+ const cacheKey = modifiers.join(".");
12784
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
12765
12785
  if (!("key" in event)) {
12766
12786
  return;
12767
12787
  }
@@ -14370,12 +14390,23 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
14370
14390
  } else if (node.type === "ObjectProperty" && parent.type === "ObjectPattern") {
14371
14391
  node.inPattern = true;
14372
14392
  } else if (isFunctionType(node)) {
14373
- walkFunctionParams(node, (id) => markScopeIdentifier(node, id, knownIds));
14393
+ if (node.scopeIds) {
14394
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
14395
+ } else {
14396
+ walkFunctionParams(
14397
+ node,
14398
+ (id) => markScopeIdentifier(node, id, knownIds)
14399
+ );
14400
+ }
14374
14401
  } else if (node.type === "BlockStatement") {
14375
- walkBlockDeclarations(
14376
- node,
14377
- (id) => markScopeIdentifier(node, id, knownIds)
14378
- );
14402
+ if (node.scopeIds) {
14403
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
14404
+ } else {
14405
+ walkBlockDeclarations(
14406
+ node,
14407
+ (id) => markScopeIdentifier(node, id, knownIds)
14408
+ );
14409
+ }
14379
14410
  }
14380
14411
  },
14381
14412
  leave(node, parent) {
@@ -14494,16 +14525,19 @@ function extractIdentifiers(param, nodes = []) {
14494
14525
  }
14495
14526
  return nodes;
14496
14527
  }
14497
- function markScopeIdentifier(node, child, knownIds) {
14498
- const { name } = child;
14499
- if (node.scopeIds && node.scopeIds.has(name)) {
14500
- return;
14501
- }
14528
+ function markKnownIds(name, knownIds) {
14502
14529
  if (name in knownIds) {
14503
14530
  knownIds[name]++;
14504
14531
  } else {
14505
14532
  knownIds[name] = 1;
14506
14533
  }
14534
+ }
14535
+ function markScopeIdentifier(node, child, knownIds) {
14536
+ const { name } = child;
14537
+ if (node.scopeIds && node.scopeIds.has(name)) {
14538
+ return;
14539
+ }
14540
+ markKnownIds(name, knownIds);
14507
14541
  (node.scopeIds || (node.scopeIds = /* @__PURE__ */ new Set())).add(name);
14508
14542
  }
14509
14543
  const isFunctionType = (node) => {
@@ -14643,7 +14677,7 @@ const isMemberExpressionNode = (path, context) => {
14643
14677
  plugins: context.expressionPlugins
14644
14678
  });
14645
14679
  ret = unwrapTSNode(ret);
14646
- return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier";
14680
+ return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier" && ret.name !== "undefined";
14647
14681
  } catch (e) {
14648
14682
  return false;
14649
14683
  }
@@ -14928,12 +14962,6 @@ const tokenizer = new Tokenizer(stack, {
14928
14962
  loc: getLoc(start - 1, end),
14929
14963
  codegenNode: void 0
14930
14964
  };
14931
- if (tokenizer.inSFCRoot) {
14932
- currentOpenTag.innerLoc = getLoc(
14933
- end + fastForward(end) + 1,
14934
- end
14935
- );
14936
- }
14937
14965
  },
14938
14966
  onopentagend(end) {
14939
14967
  endOpenTag(end);
@@ -15261,6 +15289,9 @@ function getSlice(start, end) {
15261
15289
  return currentInput.slice(start, end);
15262
15290
  }
15263
15291
  function endOpenTag(end) {
15292
+ if (tokenizer.inSFCRoot) {
15293
+ currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
15294
+ }
15264
15295
  addNode(currentOpenTag);
15265
15296
  const { tag, ns } = currentOpenTag;
15266
15297
  if (ns === 0 && currentOptions.isPreTag(tag)) {
@@ -15294,7 +15325,7 @@ function onCloseTag(el, end, isImplied = false) {
15294
15325
  if (isImplied) {
15295
15326
  setLocEnd(el.loc, backTrack(end, 60));
15296
15327
  } else {
15297
- setLocEnd(el.loc, end + fastForward(end) + 1);
15328
+ setLocEnd(el.loc, end + 1);
15298
15329
  }
15299
15330
  if (tokenizer.inSFCRoot) {
15300
15331
  if (el.children.length) {
@@ -15389,13 +15420,6 @@ function onCloseTag(el, end, isImplied = false) {
15389
15420
  }
15390
15421
  }
15391
15422
  }
15392
- function fastForward(start, c) {
15393
- let offset = 0;
15394
- while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
15395
- offset++;
15396
- }
15397
- return offset;
15398
- }
15399
15423
  function backTrack(index, c) {
15400
15424
  let i = index;
15401
15425
  while (currentInput.charCodeAt(i) !== c && i >= 0)
@@ -5254,7 +5254,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5254
5254
  return vm;
5255
5255
  }
5256
5256
  }
5257
- Vue.version = `2.6.14-compat:${"3.4.0-beta.3"}`;
5257
+ Vue.version = `2.6.14-compat:${"3.4.0-rc.1"}`;
5258
5258
  Vue.config = singletonApp.config;
5259
5259
  Vue.use = (p, ...options) => {
5260
5260
  if (p && isFunction(p.install)) {
@@ -9063,7 +9063,7 @@ function isMemoSame(cached, memo) {
9063
9063
  return true;
9064
9064
  }
9065
9065
 
9066
- const version = "3.4.0-beta.3";
9066
+ const version = "3.4.0-rc.1";
9067
9067
  const ErrorTypeStrings = null;
9068
9068
  const _ssrUtils = {
9069
9069
  createComponentInstance,
@@ -10464,7 +10464,9 @@ const modifierGuards = {
10464
10464
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
10465
10465
  };
10466
10466
  const withModifiers = (fn, modifiers) => {
10467
- return fn._withMods || (fn._withMods = (event, ...args) => {
10467
+ const cache = fn._withMods || (fn._withMods = {});
10468
+ const cacheKey = modifiers.join(".");
10469
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
10468
10470
  for (let i = 0; i < modifiers.length; i++) {
10469
10471
  const guard = modifierGuards[modifiers[i]];
10470
10472
  if (guard && guard(event, modifiers))
@@ -10493,7 +10495,9 @@ const withKeys = (fn, modifiers) => {
10493
10495
  }
10494
10496
  }
10495
10497
  }
10496
- return fn._withKeys || (fn._withKeys = (event) => {
10498
+ const cache = fn._withKeys || (fn._withKeys = {});
10499
+ const cacheKey = modifiers.join(".");
10500
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
10497
10501
  if (!("key" in event)) {
10498
10502
  return;
10499
10503
  }
@@ -11986,12 +11990,23 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
11986
11990
  } else if (node.type === "ObjectProperty" && parent.type === "ObjectPattern") {
11987
11991
  node.inPattern = true;
11988
11992
  } else if (isFunctionType(node)) {
11989
- walkFunctionParams(node, (id) => markScopeIdentifier(node, id, knownIds));
11993
+ if (node.scopeIds) {
11994
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
11995
+ } else {
11996
+ walkFunctionParams(
11997
+ node,
11998
+ (id) => markScopeIdentifier(node, id, knownIds)
11999
+ );
12000
+ }
11990
12001
  } else if (node.type === "BlockStatement") {
11991
- walkBlockDeclarations(
11992
- node,
11993
- (id) => markScopeIdentifier(node, id, knownIds)
11994
- );
12002
+ if (node.scopeIds) {
12003
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
12004
+ } else {
12005
+ walkBlockDeclarations(
12006
+ node,
12007
+ (id) => markScopeIdentifier(node, id, knownIds)
12008
+ );
12009
+ }
11995
12010
  }
11996
12011
  },
11997
12012
  leave(node, parent) {
@@ -12110,16 +12125,19 @@ function extractIdentifiers(param, nodes = []) {
12110
12125
  }
12111
12126
  return nodes;
12112
12127
  }
12113
- function markScopeIdentifier(node, child, knownIds) {
12114
- const { name } = child;
12115
- if (node.scopeIds && node.scopeIds.has(name)) {
12116
- return;
12117
- }
12128
+ function markKnownIds(name, knownIds) {
12118
12129
  if (name in knownIds) {
12119
12130
  knownIds[name]++;
12120
12131
  } else {
12121
12132
  knownIds[name] = 1;
12122
12133
  }
12134
+ }
12135
+ function markScopeIdentifier(node, child, knownIds) {
12136
+ const { name } = child;
12137
+ if (node.scopeIds && node.scopeIds.has(name)) {
12138
+ return;
12139
+ }
12140
+ markKnownIds(name, knownIds);
12123
12141
  (node.scopeIds || (node.scopeIds = /* @__PURE__ */ new Set())).add(name);
12124
12142
  }
12125
12143
  const isFunctionType = (node) => {
@@ -12259,7 +12277,7 @@ const isMemberExpressionNode = (path, context) => {
12259
12277
  plugins: context.expressionPlugins
12260
12278
  });
12261
12279
  ret = unwrapTSNode(ret);
12262
- return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier";
12280
+ return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier" && ret.name !== "undefined";
12263
12281
  } catch (e) {
12264
12282
  return false;
12265
12283
  }
@@ -12539,12 +12557,6 @@ const tokenizer = new Tokenizer(stack, {
12539
12557
  loc: getLoc(start - 1, end),
12540
12558
  codegenNode: void 0
12541
12559
  };
12542
- if (tokenizer.inSFCRoot) {
12543
- currentOpenTag.innerLoc = getLoc(
12544
- end + fastForward(end) + 1,
12545
- end
12546
- );
12547
- }
12548
12560
  },
12549
12561
  onopentagend(end) {
12550
12562
  endOpenTag(end);
@@ -12872,6 +12884,9 @@ function getSlice(start, end) {
12872
12884
  return currentInput.slice(start, end);
12873
12885
  }
12874
12886
  function endOpenTag(end) {
12887
+ if (tokenizer.inSFCRoot) {
12888
+ currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
12889
+ }
12875
12890
  addNode(currentOpenTag);
12876
12891
  const { tag, ns } = currentOpenTag;
12877
12892
  if (ns === 0 && currentOptions.isPreTag(tag)) {
@@ -12905,7 +12920,7 @@ function onCloseTag(el, end, isImplied = false) {
12905
12920
  if (isImplied) {
12906
12921
  setLocEnd(el.loc, backTrack(end, 60));
12907
12922
  } else {
12908
- setLocEnd(el.loc, end + fastForward(end) + 1);
12923
+ setLocEnd(el.loc, end + 1);
12909
12924
  }
12910
12925
  if (tokenizer.inSFCRoot) {
12911
12926
  if (el.children.length) {
@@ -12970,13 +12985,6 @@ function onCloseTag(el, end, isImplied = false) {
12970
12985
  }
12971
12986
  }
12972
12987
  }
12973
- function fastForward(start, c) {
12974
- let offset = 0;
12975
- while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
12976
- offset++;
12977
- }
12978
- return offset;
12979
- }
12980
12988
  function backTrack(index, c) {
12981
12989
  let i = index;
12982
12990
  while (currentInput.charCodeAt(i) !== c && i >= 0)
@@ -1958,8 +1958,10 @@ function checkRecursiveUpdates(seen, fn) {
1958
1958
  if (count > RECURSION_LIMIT) {
1959
1959
  const instance = fn.ownerInstance;
1960
1960
  const componentName = instance && getComponentName(instance.type);
1961
- warn(
1962
- `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`
1961
+ handleError(
1962
+ `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
1963
+ null,
1964
+ 10
1963
1965
  );
1964
1966
  return true;
1965
1967
  } else {
@@ -6477,7 +6479,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6477
6479
  return vm;
6478
6480
  }
6479
6481
  }
6480
- Vue.version = `2.6.14-compat:${"3.4.0-beta.3"}`;
6482
+ Vue.version = `2.6.14-compat:${"3.4.0-rc.1"}`;
6481
6483
  Vue.config = singletonApp.config;
6482
6484
  Vue.use = (p, ...options) => {
6483
6485
  if (p && isFunction(p.install)) {
@@ -8205,9 +8207,9 @@ function propHasMismatch(el, key, clientValue) {
8205
8207
  let actual;
8206
8208
  let expected;
8207
8209
  if (key === "class") {
8208
- actual = el.className;
8209
- expected = normalizeClass(clientValue);
8210
- if (actual !== expected) {
8210
+ actual = toClassSet(el.getAttribute("class") || "");
8211
+ expected = toClassSet(normalizeClass(clientValue));
8212
+ if (!isSetEqual(actual, expected)) {
8211
8213
  mismatchType = mismatchKey = `class`;
8212
8214
  }
8213
8215
  } else if (key === "style") {
@@ -8239,6 +8241,20 @@ function propHasMismatch(el, key, clientValue) {
8239
8241
  }
8240
8242
  return false;
8241
8243
  }
8244
+ function toClassSet(str) {
8245
+ return new Set(str.trim().split(/\s+/));
8246
+ }
8247
+ function isSetEqual(a, b) {
8248
+ if (a.size !== b.size) {
8249
+ return false;
8250
+ }
8251
+ for (const s of a) {
8252
+ if (!b.has(s)) {
8253
+ return false;
8254
+ }
8255
+ }
8256
+ return true;
8257
+ }
8242
8258
 
8243
8259
  let supported;
8244
8260
  let perf;
@@ -11181,7 +11197,7 @@ function isMemoSame(cached, memo) {
11181
11197
  return true;
11182
11198
  }
11183
11199
 
11184
- const version = "3.4.0-beta.3";
11200
+ const version = "3.4.0-rc.1";
11185
11201
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11186
11202
  const ssrUtils = null;
11187
11203
  const resolveFilter = resolveFilter$1 ;
@@ -12640,7 +12656,9 @@ const modifierGuards = {
12640
12656
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
12641
12657
  };
12642
12658
  const withModifiers = (fn, modifiers) => {
12643
- return fn._withMods || (fn._withMods = (event, ...args) => {
12659
+ const cache = fn._withMods || (fn._withMods = {});
12660
+ const cacheKey = modifiers.join(".");
12661
+ return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12644
12662
  for (let i = 0; i < modifiers.length; i++) {
12645
12663
  const guard = modifierGuards[modifiers[i]];
12646
12664
  if (guard && guard(event, modifiers))
@@ -12675,7 +12693,9 @@ const withKeys = (fn, modifiers) => {
12675
12693
  );
12676
12694
  }
12677
12695
  }
12678
- return fn._withKeys || (fn._withKeys = (event) => {
12696
+ const cache = fn._withKeys || (fn._withKeys = {});
12697
+ const cacheKey = modifiers.join(".");
12698
+ return cache[cacheKey] || (cache[cacheKey] = (event) => {
12679
12699
  if (!("key" in event)) {
12680
12700
  return;
12681
12701
  }
@@ -14513,12 +14533,6 @@ const tokenizer = new Tokenizer(stack, {
14513
14533
  loc: getLoc(start - 1, end),
14514
14534
  codegenNode: void 0
14515
14535
  };
14516
- if (tokenizer.inSFCRoot) {
14517
- currentOpenTag.innerLoc = getLoc(
14518
- end + fastForward(end) + 1,
14519
- end
14520
- );
14521
- }
14522
14536
  },
14523
14537
  onopentagend(end) {
14524
14538
  endOpenTag(end);
@@ -14843,6 +14857,9 @@ function getSlice(start, end) {
14843
14857
  return currentInput.slice(start, end);
14844
14858
  }
14845
14859
  function endOpenTag(end) {
14860
+ if (tokenizer.inSFCRoot) {
14861
+ currentOpenTag.innerLoc = getLoc(end + 1, end + 1);
14862
+ }
14846
14863
  addNode(currentOpenTag);
14847
14864
  const { tag, ns } = currentOpenTag;
14848
14865
  if (ns === 0 && currentOptions.isPreTag(tag)) {
@@ -14883,7 +14900,7 @@ function onCloseTag(el, end, isImplied = false) {
14883
14900
  if (isImplied) {
14884
14901
  setLocEnd(el.loc, backTrack(end, 60));
14885
14902
  } else {
14886
- setLocEnd(el.loc, end + fastForward(end) + 1);
14903
+ setLocEnd(el.loc, end + 1);
14887
14904
  }
14888
14905
  if (tokenizer.inSFCRoot) {
14889
14906
  if (el.children.length) {
@@ -14978,13 +14995,6 @@ function onCloseTag(el, end, isImplied = false) {
14978
14995
  }
14979
14996
  }
14980
14997
  }
14981
- function fastForward(start, c) {
14982
- let offset = 0;
14983
- while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
14984
- offset++;
14985
- }
14986
- return offset;
14987
- }
14988
14998
  function backTrack(index, c) {
14989
14999
  let i = index;
14990
15000
  while (currentInput.charCodeAt(i) !== c && i >= 0)