@vue/compat 3.4.36 → 3.4.38

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,5 @@
1
1
  /**
2
- * @vue/compat v3.4.36
2
+ * @vue/compat v3.4.38
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -7,7 +7,7 @@
7
7
 
8
8
  var parser = require('@babel/parser');
9
9
  var estreeWalker = require('estree-walker');
10
- var decode_js = require('entities/dist/decode.js');
10
+ var decode_js = require('entities/lib/decode.js');
11
11
  var sourceMapJs = require('source-map-js');
12
12
 
13
13
  /*! #__NO_SIDE_EFFECTS__ */
@@ -763,7 +763,7 @@ class BaseReactiveHandler {
763
763
  return isShallow2;
764
764
  } else if (key === "__v_raw") {
765
765
  if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
766
- // this means the reciever is a user proxy of the reactive proxy
766
+ // this means the receiver is a user proxy of the reactive proxy
767
767
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
768
768
  return target;
769
769
  }
@@ -2651,7 +2651,7 @@ const KeepAliveImpl = {
2651
2651
  }
2652
2652
  function pruneCacheEntry(key) {
2653
2653
  const cached = cache.get(key);
2654
- if (!current || !isSameVNodeType(cached, current)) {
2654
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
2655
2655
  unmount(cached);
2656
2656
  } else if (current) {
2657
2657
  resetShapeFlag(current);
@@ -2710,6 +2710,10 @@ const KeepAliveImpl = {
2710
2710
  return rawVNode;
2711
2711
  }
2712
2712
  let vnode = getInnerChild(rawVNode);
2713
+ if (vnode.type === Comment) {
2714
+ current = null;
2715
+ return vnode;
2716
+ }
2713
2717
  const comp = vnode.type;
2714
2718
  const name = getComponentName(
2715
2719
  isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
@@ -4151,7 +4155,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
4151
4155
  return vm;
4152
4156
  }
4153
4157
  }
4154
- Vue.version = `2.6.14-compat:${"3.4.36"}`;
4158
+ Vue.version = `2.6.14-compat:${"3.4.38"}`;
4155
4159
  Vue.config = singletonApp.config;
4156
4160
  Vue.use = (plugin, ...options) => {
4157
4161
  if (plugin && isFunction(plugin.install)) {
@@ -4622,7 +4626,7 @@ function provide(key, value) {
4622
4626
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
4623
4627
  const instance = currentInstance || currentRenderingInstance;
4624
4628
  if (instance || currentApp) {
4625
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
4629
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
4626
4630
  if (provides && key in provides) {
4627
4631
  return provides[key];
4628
4632
  } else if (arguments.length > 1) {
@@ -7103,13 +7107,13 @@ function baseCreateRenderer(options, createHydrationFns) {
7103
7107
  namespace
7104
7108
  );
7105
7109
  }
7110
+ container._vnode = vnode;
7106
7111
  if (!isFlushing) {
7107
7112
  isFlushing = true;
7108
7113
  flushPreFlushCbs();
7109
7114
  flushPostFlushCbs();
7110
7115
  isFlushing = false;
7111
7116
  }
7112
- container._vnode = vnode;
7113
7117
  };
7114
7118
  const internals = {
7115
7119
  p: patch,
@@ -7490,7 +7494,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
7490
7494
  return options.get ? options.get(localValue) : localValue;
7491
7495
  },
7492
7496
  set(value) {
7493
- if (!hasChanged(value, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
7497
+ const emittedValue = options.set ? options.set(value) : value;
7498
+ if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
7494
7499
  return;
7495
7500
  }
7496
7501
  const rawProps = i.vnode.props;
@@ -7499,7 +7504,6 @@ function useModel(props, name, options = EMPTY_OBJ) {
7499
7504
  localValue = value;
7500
7505
  trigger();
7501
7506
  }
7502
- const emittedValue = options.set ? options.set(value) : value;
7503
7507
  i.emit(`update:${name}`, emittedValue);
7504
7508
  if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
7505
7509
  trigger();
@@ -9172,7 +9176,7 @@ function isMemoSame(cached, memo) {
9172
9176
  return true;
9173
9177
  }
9174
9178
 
9175
- const version = "3.4.36";
9179
+ const version = "3.4.38";
9176
9180
  const warn$1 = NOOP;
9177
9181
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9178
9182
  const devtools = void 0;
@@ -9184,7 +9188,8 @@ const _ssrUtils = {
9184
9188
  setCurrentRenderingInstance,
9185
9189
  isVNode: isVNode,
9186
9190
  normalizeVNode,
9187
- getComponentPublicInstance
9191
+ getComponentPublicInstance,
9192
+ ensureValidVNode
9188
9193
  };
9189
9194
  const ssrUtils = _ssrUtils ;
9190
9195
  const resolveFilter = resolveFilter$1 ;
@@ -12437,10 +12442,11 @@ function isCoreComponent(tag) {
12437
12442
  }
12438
12443
  const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
12439
12444
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
12440
- const isMemberExpressionNode = (path, context) => {
12445
+ const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
12446
+ const isMemberExpressionNode = (exp, context) => {
12441
12447
  try {
12442
- let ret = parser.parseExpression(path, {
12443
- plugins: context.expressionPlugins
12448
+ let ret = exp.ast || parser.parseExpression(getExpSource(exp), {
12449
+ plugins: context.expressionPlugins ? [...context.expressionPlugins, "typescript"] : ["typescript"]
12444
12450
  });
12445
12451
  ret = unwrapTSNode(ret);
12446
12452
  return ret.type === "MemberExpression" || ret.type === "OptionalMemberExpression" || ret.type === "Identifier" && ret.name !== "undefined";
@@ -12449,6 +12455,24 @@ const isMemberExpressionNode = (path, context) => {
12449
12455
  }
12450
12456
  };
12451
12457
  const isMemberExpression = isMemberExpressionNode;
12458
+ const isFnExpressionNode = (exp, context) => {
12459
+ try {
12460
+ let ret = exp.ast || parser.parseExpression(getExpSource(exp), {
12461
+ plugins: context.expressionPlugins ? [...context.expressionPlugins, "typescript"] : ["typescript"]
12462
+ });
12463
+ if (ret.type === "Program") {
12464
+ ret = ret.body[0];
12465
+ if (ret.type === "ExpressionStatement") {
12466
+ ret = ret.expression;
12467
+ }
12468
+ }
12469
+ ret = unwrapTSNode(ret);
12470
+ return ret.type === "FunctionExpression" || ret.type === "ArrowFunctionExpression";
12471
+ } catch (e) {
12472
+ return false;
12473
+ }
12474
+ };
12475
+ const isFnExpression = isFnExpressionNode;
12452
12476
  function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
12453
12477
  return advancePositionWithMutation(
12454
12478
  {
@@ -15831,7 +15855,7 @@ function resolveComponentType(node, context, ssr = false) {
15831
15855
  } else {
15832
15856
  exp = isProp.exp;
15833
15857
  if (!exp) {
15834
- exp = createSimpleExpression(`is`, false, isProp.loc);
15858
+ exp = createSimpleExpression(`is`, false, isProp.arg.loc);
15835
15859
  {
15836
15860
  exp = isProp.exp = processExpression(exp, context);
15837
15861
  }
@@ -16390,7 +16414,6 @@ function processSlotOutlet(node, context) {
16390
16414
  };
16391
16415
  }
16392
16416
 
16393
- const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
16394
16417
  const transformOn$1 = (dir, node, context, augmentor) => {
16395
16418
  const { loc, modifiers, arg } = dir;
16396
16419
  if (!dir.exp && !modifiers.length) {
@@ -16431,8 +16454,8 @@ const transformOn$1 = (dir, node, context, augmentor) => {
16431
16454
  }
16432
16455
  let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
16433
16456
  if (exp) {
16434
- const isMemberExp = isMemberExpression(exp.content, context);
16435
- const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
16457
+ const isMemberExp = isMemberExpression(exp, context);
16458
+ const isInlineStatement = !(isMemberExp || isFnExpression(exp, context));
16436
16459
  const hasMultipleStatements = exp.content.includes(`;`);
16437
16460
  if (context.prefixIdentifiers) {
16438
16461
  isInlineStatement && context.addIdentifiers(`$event`);
@@ -16602,7 +16625,7 @@ const transformModel$1 = (dir, node, context) => {
16602
16625
  return createTransformProps();
16603
16626
  }
16604
16627
  const maybeRef = context.inline && (bindingType === "setup-let" || bindingType === "setup-ref" || bindingType === "setup-maybe-ref");
16605
- if (!expString.trim() || !isMemberExpression(expString, context) && !maybeRef) {
16628
+ if (!expString.trim() || !isMemberExpression(exp, context) && !maybeRef) {
16606
16629
  context.onError(
16607
16630
  createCompilerError(42, exp.loc)
16608
16631
  );
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.4.36
2
+ * @vue/compat v3.4.38
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -817,7 +817,7 @@ class BaseReactiveHandler {
817
817
  return isShallow2;
818
818
  } else if (key === "__v_raw") {
819
819
  if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
820
- // this means the reciever is a user proxy of the reactive proxy
820
+ // this means the receiver is a user proxy of the reactive proxy
821
821
  Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
822
822
  return target;
823
823
  }
@@ -3467,7 +3467,7 @@ const KeepAliveImpl = {
3467
3467
  }
3468
3468
  function pruneCacheEntry(key) {
3469
3469
  const cached = cache.get(key);
3470
- if (!current || !isSameVNodeType(cached, current)) {
3470
+ if (cached && (!current || !isSameVNodeType(cached, current))) {
3471
3471
  unmount(cached);
3472
3472
  } else if (current) {
3473
3473
  resetShapeFlag(current);
@@ -3529,6 +3529,10 @@ const KeepAliveImpl = {
3529
3529
  return rawVNode;
3530
3530
  }
3531
3531
  let vnode = getInnerChild(rawVNode);
3532
+ if (vnode.type === Comment) {
3533
+ current = null;
3534
+ return vnode;
3535
+ }
3532
3536
  const comp = vnode.type;
3533
3537
  const name = getComponentName(
3534
3538
  isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
@@ -5246,7 +5250,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5246
5250
  return vm;
5247
5251
  }
5248
5252
  }
5249
- Vue.version = `2.6.14-compat:${"3.4.36"}`;
5253
+ Vue.version = `2.6.14-compat:${"3.4.38"}`;
5250
5254
  Vue.config = singletonApp.config;
5251
5255
  Vue.use = (plugin, ...options) => {
5252
5256
  if (plugin && isFunction(plugin.install)) {
@@ -5822,7 +5826,7 @@ function provide(key, value) {
5822
5826
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
5823
5827
  const instance = currentInstance || currentRenderingInstance;
5824
5828
  if (instance || currentApp) {
5825
- const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
5829
+ const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
5826
5830
  if (provides && key in provides) {
5827
5831
  return provides[key];
5828
5832
  } else if (arguments.length > 1) {
@@ -8828,13 +8832,13 @@ function baseCreateRenderer(options, createHydrationFns) {
8828
8832
  namespace
8829
8833
  );
8830
8834
  }
8835
+ container._vnode = vnode;
8831
8836
  if (!isFlushing) {
8832
8837
  isFlushing = true;
8833
8838
  flushPreFlushCbs();
8834
8839
  flushPostFlushCbs();
8835
8840
  isFlushing = false;
8836
8841
  }
8837
- container._vnode = vnode;
8838
8842
  };
8839
8843
  const internals = {
8840
8844
  p: patch,
@@ -9252,7 +9256,8 @@ function useModel(props, name, options = EMPTY_OBJ) {
9252
9256
  return options.get ? options.get(localValue) : localValue;
9253
9257
  },
9254
9258
  set(value) {
9255
- if (!hasChanged(value, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
9259
+ const emittedValue = options.set ? options.set(value) : value;
9260
+ if (!hasChanged(emittedValue, localValue) && !(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))) {
9256
9261
  return;
9257
9262
  }
9258
9263
  const rawProps = i.vnode.props;
@@ -9261,7 +9266,6 @@ function useModel(props, name, options = EMPTY_OBJ) {
9261
9266
  localValue = value;
9262
9267
  trigger();
9263
9268
  }
9264
- const emittedValue = options.set ? options.set(value) : value;
9265
9269
  i.emit(`update:${name}`, emittedValue);
9266
9270
  if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) {
9267
9271
  trigger();
@@ -9299,9 +9303,9 @@ function emit(instance, event, ...rawArgs) {
9299
9303
  } = instance;
9300
9304
  if (emitsOptions) {
9301
9305
  if (!(event in emitsOptions) && !(event.startsWith("hook:") || event.startsWith(compatModelEventPrefix))) {
9302
- if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
9306
+ if (!propsOptions || !(toHandlerKey(camelize(event)) in propsOptions)) {
9303
9307
  warn$1(
9304
- `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`
9308
+ `Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(camelize(event))}" prop.`
9305
9309
  );
9306
9310
  }
9307
9311
  } else {
@@ -11434,7 +11438,7 @@ function isMemoSame(cached, memo) {
11434
11438
  return true;
11435
11439
  }
11436
11440
 
11437
- const version = "3.4.36";
11441
+ const version = "3.4.38";
11438
11442
  const warn = warn$1 ;
11439
11443
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11440
11444
  const devtools = devtools$1 ;
@@ -11901,8 +11905,10 @@ function useCssVars(getter) {
11901
11905
  setVarsOnVNode(instance.subTree, vars);
11902
11906
  updateTeleports(vars);
11903
11907
  };
11904
- onMounted(() => {
11908
+ onBeforeMount(() => {
11905
11909
  watchPostEffect(setVars);
11910
+ });
11911
+ onMounted(() => {
11906
11912
  const ob = new MutationObserver(setVars);
11907
11913
  ob.observe(instance.subTree.el.parentNode, { childList: true });
11908
11914
  onUnmounted(() => ob.disconnect());
@@ -14539,8 +14545,9 @@ const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
14539
14545
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
14540
14546
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
14541
14547
  const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
14542
- const isMemberExpressionBrowser = (path) => {
14543
- path = path.trim().replace(whitespaceRE, (s) => s.trim());
14548
+ const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
14549
+ const isMemberExpressionBrowser = (exp) => {
14550
+ const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
14544
14551
  let state = 0 /* inMemberExp */;
14545
14552
  let stateStack = [];
14546
14553
  let currentOpenBracketCount = 0;
@@ -14602,6 +14609,9 @@ const isMemberExpressionBrowser = (path) => {
14602
14609
  return !currentOpenBracketCount && !currentOpenParensCount;
14603
14610
  };
14604
14611
  const isMemberExpression = isMemberExpressionBrowser ;
14612
+ const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
14613
+ const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
14614
+ const isFnExpression = isFnExpressionBrowser ;
14605
14615
  function assert(condition, msg) {
14606
14616
  if (!condition) {
14607
14617
  throw new Error(msg || `unexpected compiler condition`);
@@ -17534,7 +17544,7 @@ function resolveComponentType(node, context, ssr = false) {
17534
17544
  } else {
17535
17545
  exp = isProp.exp;
17536
17546
  if (!exp) {
17537
- exp = createSimpleExpression(`is`, false, isProp.loc);
17547
+ exp = createSimpleExpression(`is`, false, isProp.arg.loc);
17538
17548
  }
17539
17549
  }
17540
17550
  if (exp) {
@@ -18038,7 +18048,6 @@ function processSlotOutlet(node, context) {
18038
18048
  };
18039
18049
  }
18040
18050
 
18041
- const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
18042
18051
  const transformOn$1 = (dir, node, context, augmentor) => {
18043
18052
  const { loc, modifiers, arg } = dir;
18044
18053
  if (!dir.exp && !modifiers.length) {
@@ -18082,8 +18091,8 @@ const transformOn$1 = (dir, node, context, augmentor) => {
18082
18091
  }
18083
18092
  let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
18084
18093
  if (exp) {
18085
- const isMemberExp = isMemberExpression(exp.content);
18086
- const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
18094
+ const isMemberExp = isMemberExpression(exp);
18095
+ const isInlineStatement = !(isMemberExp || isFnExpression(exp));
18087
18096
  const hasMultipleStatements = exp.content.includes(`;`);
18088
18097
  {
18089
18098
  validateBrowserExpression(
@@ -18231,7 +18240,7 @@ const transformModel$1 = (dir, node, context) => {
18231
18240
  return createTransformProps();
18232
18241
  }
18233
18242
  const maybeRef = false;
18234
- if (!expString.trim() || !isMemberExpression(expString) && !maybeRef) {
18243
+ if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
18235
18244
  context.onError(
18236
18245
  createCompilerError(42, exp.loc)
18237
18246
  );