@vue/compat 3.4.4 → 3.4.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
@@ -4110,10 +4110,11 @@ function doWatch(source, cb, {
4110
4110
  scheduler = () => queueJob(job);
4111
4111
  }
4112
4112
  const effect = new ReactiveEffect(getter, NOOP, scheduler);
4113
+ const scope = getCurrentScope();
4113
4114
  const unwatch = () => {
4114
4115
  effect.stop();
4115
- if (instance && instance.scope) {
4116
- remove(instance.scope.effects, effect);
4116
+ if (scope) {
4117
+ remove(scope.effects, effect);
4117
4118
  }
4118
4119
  };
4119
4120
  {
@@ -6601,7 +6602,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6601
6602
  return vm;
6602
6603
  }
6603
6604
  }
6604
- Vue.version = `2.6.14-compat:${"3.4.4"}`;
6605
+ Vue.version = `2.6.14-compat:${"3.4.5"}`;
6605
6606
  Vue.config = singletonApp.config;
6606
6607
  Vue.use = (p, ...options) => {
6607
6608
  if (p && isFunction(p.install)) {
@@ -11321,7 +11322,7 @@ function isMemoSame(cached, memo) {
11321
11322
  return true;
11322
11323
  }
11323
11324
 
11324
- const version = "3.4.4";
11325
+ const version = "3.4.5";
11325
11326
  const warn = warn$1 ;
11326
11327
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11327
11328
  const devtools = devtools$1 ;
@@ -14488,6 +14489,18 @@ function isInDestructureAssignment(parent, parentStack) {
14488
14489
  }
14489
14490
  return false;
14490
14491
  }
14492
+ function isInNewExpression(parentStack) {
14493
+ let i = parentStack.length;
14494
+ while (i--) {
14495
+ const p = parentStack[i];
14496
+ if (p.type === "NewExpression") {
14497
+ return true;
14498
+ } else if (p.type !== "MemberExpression") {
14499
+ break;
14500
+ }
14501
+ }
14502
+ return false;
14503
+ }
14491
14504
  function walkFunctionParams(node, onIdent) {
14492
14505
  for (const p of node.params) {
14493
14506
  for (const id of extractIdentifiers(p)) {
@@ -17073,12 +17086,17 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
17073
17086
  const isAssignmentLVal = parent && parent.type === "AssignmentExpression" && parent.left === id;
17074
17087
  const isUpdateArg = parent && parent.type === "UpdateExpression" && parent.argument === id;
17075
17088
  const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack);
17089
+ const isNewExpression = parent && isInNewExpression(parentStack);
17090
+ const wrapWithUnref = (raw2) => {
17091
+ const wrapped = `${context.helperString(UNREF)}(${raw2})`;
17092
+ return isNewExpression ? `(${wrapped})` : wrapped;
17093
+ };
17076
17094
  if (isConst(type) || type === "setup-reactive-const" || localVars[raw]) {
17077
17095
  return raw;
17078
17096
  } else if (type === "setup-ref") {
17079
17097
  return `${raw}.value`;
17080
17098
  } else if (type === "setup-maybe-ref") {
17081
- return isAssignmentLVal || isUpdateArg || isDestructureAssignment ? `${raw}.value` : `${context.helperString(UNREF)}(${raw})`;
17099
+ return isAssignmentLVal || isUpdateArg || isDestructureAssignment ? `${raw}.value` : wrapWithUnref(raw);
17082
17100
  } else if (type === "setup-let") {
17083
17101
  if (isAssignmentLVal) {
17084
17102
  const { right: rVal, operator } = parent;
@@ -17105,7 +17123,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
17105
17123
  } else if (isDestructureAssignment) {
17106
17124
  return raw;
17107
17125
  } else {
17108
- return `${context.helperString(UNREF)}(${raw})`;
17126
+ return wrapWithUnref(raw);
17109
17127
  }
17110
17128
  } else if (type === "props") {
17111
17129
  return genPropsAccessExp(raw);
@@ -3100,10 +3100,11 @@ function doWatch(source, cb, {
3100
3100
  scheduler = () => queueJob(job);
3101
3101
  }
3102
3102
  const effect = new ReactiveEffect(getter, NOOP, scheduler);
3103
+ const scope = getCurrentScope();
3103
3104
  const unwatch = () => {
3104
3105
  effect.stop();
3105
- if (instance && instance.scope) {
3106
- remove(instance.scope.effects, effect);
3106
+ if (scope) {
3107
+ remove(scope.effects, effect);
3107
3108
  }
3108
3109
  };
3109
3110
  if (cb) {
@@ -5282,7 +5283,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5282
5283
  return vm;
5283
5284
  }
5284
5285
  }
5285
- Vue.version = `2.6.14-compat:${"3.4.4"}`;
5286
+ Vue.version = `2.6.14-compat:${"3.4.5"}`;
5286
5287
  Vue.config = singletonApp.config;
5287
5288
  Vue.use = (p, ...options) => {
5288
5289
  if (p && isFunction(p.install)) {
@@ -9082,7 +9083,7 @@ function isMemoSame(cached, memo) {
9082
9083
  return true;
9083
9084
  }
9084
9085
 
9085
- const version = "3.4.4";
9086
+ const version = "3.4.5";
9086
9087
  const warn$1 = NOOP;
9087
9088
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9088
9089
  const devtools = void 0;
@@ -12078,6 +12079,18 @@ function isInDestructureAssignment(parent, parentStack) {
12078
12079
  }
12079
12080
  return false;
12080
12081
  }
12082
+ function isInNewExpression(parentStack) {
12083
+ let i = parentStack.length;
12084
+ while (i--) {
12085
+ const p = parentStack[i];
12086
+ if (p.type === "NewExpression") {
12087
+ return true;
12088
+ } else if (p.type !== "MemberExpression") {
12089
+ break;
12090
+ }
12091
+ }
12092
+ return false;
12093
+ }
12081
12094
  function walkFunctionParams(node, onIdent) {
12082
12095
  for (const p of node.params) {
12083
12096
  for (const id of extractIdentifiers(p)) {
@@ -14590,12 +14603,17 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
14590
14603
  const isAssignmentLVal = parent && parent.type === "AssignmentExpression" && parent.left === id;
14591
14604
  const isUpdateArg = parent && parent.type === "UpdateExpression" && parent.argument === id;
14592
14605
  const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack);
14606
+ const isNewExpression = parent && isInNewExpression(parentStack);
14607
+ const wrapWithUnref = (raw2) => {
14608
+ const wrapped = `${context.helperString(UNREF)}(${raw2})`;
14609
+ return isNewExpression ? `(${wrapped})` : wrapped;
14610
+ };
14593
14611
  if (isConst(type) || type === "setup-reactive-const" || localVars[raw]) {
14594
14612
  return raw;
14595
14613
  } else if (type === "setup-ref") {
14596
14614
  return `${raw}.value`;
14597
14615
  } else if (type === "setup-maybe-ref") {
14598
- return isAssignmentLVal || isUpdateArg || isDestructureAssignment ? `${raw}.value` : `${context.helperString(UNREF)}(${raw})`;
14616
+ return isAssignmentLVal || isUpdateArg || isDestructureAssignment ? `${raw}.value` : wrapWithUnref(raw);
14599
14617
  } else if (type === "setup-let") {
14600
14618
  if (isAssignmentLVal) {
14601
14619
  const { right: rVal, operator } = parent;
@@ -14622,7 +14640,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
14622
14640
  } else if (isDestructureAssignment) {
14623
14641
  return raw;
14624
14642
  } else {
14625
- return `${context.helperString(UNREF)}(${raw})`;
14643
+ return wrapWithUnref(raw);
14626
14644
  }
14627
14645
  } else if (type === "props") {
14628
14646
  return genPropsAccessExp(raw);
@@ -4040,10 +4040,11 @@ function doWatch(source, cb, {
4040
4040
  scheduler = () => queueJob(job);
4041
4041
  }
4042
4042
  const effect = new ReactiveEffect(getter, NOOP, scheduler);
4043
+ const scope = getCurrentScope();
4043
4044
  const unwatch = () => {
4044
4045
  effect.stop();
4045
- if (instance && instance.scope) {
4046
- remove(instance.scope.effects, effect);
4046
+ if (scope) {
4047
+ remove(scope.effects, effect);
4047
4048
  }
4048
4049
  };
4049
4050
  {
@@ -6523,7 +6524,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6523
6524
  return vm;
6524
6525
  }
6525
6526
  }
6526
- Vue.version = `2.6.14-compat:${"3.4.4"}`;
6527
+ Vue.version = `2.6.14-compat:${"3.4.5"}`;
6527
6528
  Vue.config = singletonApp.config;
6528
6529
  Vue.use = (p, ...options) => {
6529
6530
  if (p && isFunction(p.install)) {
@@ -11226,7 +11227,7 @@ function isMemoSame(cached, memo) {
11226
11227
  return true;
11227
11228
  }
11228
11229
 
11229
- const version = "3.4.4";
11230
+ const version = "3.4.5";
11230
11231
  const warn = warn$1 ;
11231
11232
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11232
11233
  const devtools = devtools$1 ;