@vue/compat 3.6.0-alpha.5 → 3.6.0-alpha.6

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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.6.0-alpha.5
2
+ * @vue/compat v3.6.0-alpha.6
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -4950,7 +4950,8 @@ function createHydrationFunctions(rendererInternals) {
4950
4950
  node,
4951
4951
  container,
4952
4952
  null,
4953
- parentComponent
4953
+ parentComponent,
4954
+ parentSuspense
4954
4955
  );
4955
4956
  } else {
4956
4957
  mountComponent(
@@ -7737,7 +7738,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7737
7738
  return vm;
7738
7739
  }
7739
7740
  }
7740
- Vue.version = `2.6.14-compat:${"3.6.0-alpha.5"}`;
7741
+ Vue.version = `2.6.14-compat:${"3.6.0-alpha.6"}`;
7741
7742
  Vue.config = singletonApp.config;
7742
7743
  Vue.use = (plugin, ...options) => {
7743
7744
  if (plugin && isFunction(plugin.install)) {
@@ -8836,29 +8837,7 @@ function renderComponentRoot(instance) {
8836
8837
  }
8837
8838
  root = cloneVNode(root, fallthroughAttrs, false, true);
8838
8839
  } else if (!accessedAttrs && root.type !== Comment) {
8839
- const allAttrs = Object.keys(attrs);
8840
- const eventAttrs = [];
8841
- const extraAttrs = [];
8842
- for (let i = 0, l = allAttrs.length; i < l; i++) {
8843
- const key = allAttrs[i];
8844
- if (isOn(key)) {
8845
- if (!isModelListener(key)) {
8846
- eventAttrs.push(key[2].toLowerCase() + key.slice(3));
8847
- }
8848
- } else {
8849
- extraAttrs.push(key);
8850
- }
8851
- }
8852
- if (extraAttrs.length) {
8853
- warn$1(
8854
- `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
8855
- );
8856
- }
8857
- if (eventAttrs.length) {
8858
- warn$1(
8859
- `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
8860
- );
8861
- }
8840
+ warnExtraneousAttributes(attrs);
8862
8841
  }
8863
8842
  }
8864
8843
  }
@@ -8931,6 +8910,31 @@ const getChildRoot = (vnode) => {
8931
8910
  };
8932
8911
  return [normalizeVNode(childRoot), setRoot];
8933
8912
  };
8913
+ function warnExtraneousAttributes(attrs) {
8914
+ const allAttrs = Object.keys(attrs);
8915
+ const eventAttrs = [];
8916
+ const extraAttrs = [];
8917
+ for (let i = 0, l = allAttrs.length; i < l; i++) {
8918
+ const key = allAttrs[i];
8919
+ if (isOn(key)) {
8920
+ if (!isModelListener(key)) {
8921
+ eventAttrs.push(key[2].toLowerCase() + key.slice(3));
8922
+ }
8923
+ } else {
8924
+ extraAttrs.push(key);
8925
+ }
8926
+ }
8927
+ if (extraAttrs.length) {
8928
+ warn$1(
8929
+ `Extraneous non-props attributes (${extraAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`
8930
+ );
8931
+ }
8932
+ if (eventAttrs.length) {
8933
+ warn$1(
8934
+ `Extraneous non-emits event listeners (${eventAttrs.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`
8935
+ );
8936
+ }
8937
+ }
8934
8938
  function filterSingleRoot(children, recurse = true) {
8935
8939
  let singleRoot;
8936
8940
  for (let i = 0; i < children.length; i++) {
@@ -10255,7 +10259,8 @@ function baseCreateRenderer(options, createHydrationFns) {
10255
10259
  n2,
10256
10260
  container,
10257
10261
  anchor,
10258
- parentComponent
10262
+ parentComponent,
10263
+ parentSuspense
10259
10264
  );
10260
10265
  }
10261
10266
  } else {
@@ -10317,7 +10322,42 @@ function baseCreateRenderer(options, createHydrationFns) {
10317
10322
  }
10318
10323
  if (isHmrUpdating) initialVNode.el = null;
10319
10324
  if (instance.asyncDep) {
10320
- parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
10325
+ if (parentSuspense) {
10326
+ const hydratedEl = instance.vnode.el;
10327
+ parentSuspense.registerDep(instance, (setupResult) => {
10328
+ const { vnode } = instance;
10329
+ {
10330
+ pushWarningContext(vnode);
10331
+ }
10332
+ handleSetupResult(instance, setupResult, false);
10333
+ if (hydratedEl) {
10334
+ vnode.el = hydratedEl;
10335
+ }
10336
+ const placeholder = !hydratedEl && instance.subTree.el;
10337
+ setupRenderEffect(
10338
+ instance,
10339
+ vnode,
10340
+ // component may have been moved before resolve.
10341
+ // if this is not a hydration, instance.subTree will be the comment
10342
+ // placeholder.
10343
+ hostParentNode(hydratedEl || instance.subTree.el),
10344
+ // anchor will not be used if this is hydration, so only need to
10345
+ // consider the comment placeholder case.
10346
+ hydratedEl ? null : getNextHostNode(instance.subTree),
10347
+ parentSuspense,
10348
+ namespace,
10349
+ optimized
10350
+ );
10351
+ if (placeholder) {
10352
+ vnode.placeholder = null;
10353
+ hostRemove(placeholder);
10354
+ }
10355
+ updateHOCHostEl(instance, vnode.el);
10356
+ {
10357
+ popWarningContext();
10358
+ }
10359
+ });
10360
+ }
10321
10361
  if (!initialVNode.el) {
10322
10362
  const placeholder = instance.subTree = createVNode(Comment);
10323
10363
  processCommentNode(null, placeholder, container, anchor);
@@ -11685,7 +11725,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11685
11725
  m: move,
11686
11726
  um: unmount,
11687
11727
  n: next,
11688
- o: { parentNode, remove }
11728
+ o: { parentNode }
11689
11729
  } = rendererInternals;
11690
11730
  let parentSuspenseId;
11691
11731
  const isSuspensible = isVNodeSuspensible(vnode);
@@ -11860,12 +11900,11 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11860
11900
  next() {
11861
11901
  return suspense.activeBranch && next(suspense.activeBranch);
11862
11902
  },
11863
- registerDep(instance, setupRenderEffect, optimized2) {
11903
+ registerDep(instance, onResolve) {
11864
11904
  const isInPendingSuspense = !!suspense.pendingBranch;
11865
11905
  if (isInPendingSuspense) {
11866
11906
  suspense.deps++;
11867
11907
  }
11868
- const hydratedEl = instance.vnode.el;
11869
11908
  instance.asyncDep.catch((err) => {
11870
11909
  handleError(err, instance, 0);
11871
11910
  }).then((asyncSetupResult) => {
@@ -11873,37 +11912,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11873
11912
  return;
11874
11913
  }
11875
11914
  instance.asyncResolved = true;
11876
- const { vnode: vnode2 } = instance;
11877
- {
11878
- pushWarningContext(vnode2);
11879
- }
11880
- handleSetupResult(instance, asyncSetupResult, false);
11881
- if (hydratedEl) {
11882
- vnode2.el = hydratedEl;
11883
- }
11884
- const placeholder = !hydratedEl && instance.subTree.el;
11885
- setupRenderEffect(
11886
- instance,
11887
- vnode2,
11888
- // component may have been moved before resolve.
11889
- // if this is not a hydration, instance.subTree will be the comment
11890
- // placeholder.
11891
- parentNode(hydratedEl || instance.subTree.el),
11892
- // anchor will not be used if this is hydration, so only need to
11893
- // consider the comment placeholder case.
11894
- hydratedEl ? null : next(instance.subTree),
11895
- suspense,
11896
- namespace,
11897
- optimized2
11898
- );
11899
- if (placeholder) {
11900
- vnode2.placeholder = null;
11901
- remove(placeholder);
11902
- }
11903
- updateHOCHostEl(instance, vnode2.el);
11904
- {
11905
- popWarningContext();
11906
- }
11915
+ onResolve(asyncSetupResult);
11907
11916
  if (isInPendingSuspense && --suspense.deps === 0) {
11908
11917
  suspense.resolve();
11909
11918
  }
@@ -13164,7 +13173,7 @@ function isMemoSame(cached, memo) {
13164
13173
  return true;
13165
13174
  }
13166
13175
 
13167
- const version = "3.6.0-alpha.5";
13176
+ const version = "3.6.0-alpha.6";
13168
13177
  const warn = warn$1 ;
13169
13178
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
13170
13179
  const devtools = devtools$1 ;
@@ -22087,7 +22096,9 @@ const isNonKeyModifier = /* @__PURE__ */ makeMap(
22087
22096
  `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
22088
22097
  );
22089
22098
  const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
22090
- const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
22099
+ const isKeyboardEvent = /* @__PURE__ */ makeMap(
22100
+ `onkeyup,onkeydown,onkeypress`
22101
+ );
22091
22102
  const resolveModifiers = (key, modifiers, context, loc) => {
22092
22103
  const keyModifiers = [];
22093
22104
  const nonKeyModifiers = [];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.6.0-alpha.5
2
+ * @vue/compat v3.6.0-alpha.6
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2189,9 +2189,119 @@ function traverse(value, depth = Infinity, seen) {
2189
2189
  return value;
2190
2190
  }
2191
2191
 
2192
+ const stack$1 = [];
2192
2193
  function pushWarningContext(ctx) {
2194
+ stack$1.push(ctx);
2193
2195
  }
2194
2196
  function popWarningContext() {
2197
+ stack$1.pop();
2198
+ }
2199
+ let isWarning = false;
2200
+ function warn$2(msg, ...args) {
2201
+ if (isWarning) return;
2202
+ isWarning = true;
2203
+ const prevSub = setActiveSub();
2204
+ const entry = stack$1.length ? stack$1[stack$1.length - 1] : null;
2205
+ const instance = isVNode(entry) ? entry.component : entry;
2206
+ const appWarnHandler = instance && instance.appContext.config.warnHandler;
2207
+ const trace = getComponentTrace();
2208
+ if (appWarnHandler) {
2209
+ callWithErrorHandling(
2210
+ appWarnHandler,
2211
+ instance,
2212
+ 11,
2213
+ [
2214
+ // eslint-disable-next-line no-restricted-syntax
2215
+ msg + args.map((a) => {
2216
+ var _a, _b;
2217
+ return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
2218
+ }).join(""),
2219
+ instance && instance.proxy || instance,
2220
+ trace.map(
2221
+ ({ ctx }) => `at <${formatComponentName(instance, ctx.type)}>`
2222
+ ).join("\n"),
2223
+ trace
2224
+ ]
2225
+ );
2226
+ } else {
2227
+ const warnArgs = [`[Vue warn]: ${msg}`, ...args];
2228
+ if (trace.length && // avoid spamming console during tests
2229
+ true) {
2230
+ warnArgs.push(`
2231
+ `, ...formatTrace(trace));
2232
+ }
2233
+ console.warn(...warnArgs);
2234
+ }
2235
+ setActiveSub(prevSub);
2236
+ isWarning = false;
2237
+ }
2238
+ function getComponentTrace() {
2239
+ let currentCtx = stack$1[stack$1.length - 1];
2240
+ if (!currentCtx) {
2241
+ return [];
2242
+ }
2243
+ const normalizedStack = [];
2244
+ while (currentCtx) {
2245
+ const last = normalizedStack[0];
2246
+ if (last && last.ctx === currentCtx) {
2247
+ last.recurseCount++;
2248
+ } else {
2249
+ normalizedStack.push({
2250
+ ctx: currentCtx,
2251
+ recurseCount: 0
2252
+ });
2253
+ }
2254
+ if (isVNode(currentCtx)) {
2255
+ const parent = currentCtx.component && currentCtx.component.parent;
2256
+ currentCtx = parent && parent.vnode || parent;
2257
+ } else {
2258
+ currentCtx = currentCtx.parent;
2259
+ }
2260
+ }
2261
+ return normalizedStack;
2262
+ }
2263
+ function formatTrace(trace) {
2264
+ const logs = [];
2265
+ trace.forEach((entry, i) => {
2266
+ logs.push(...i === 0 ? [] : [`
2267
+ `], ...formatTraceEntry(entry));
2268
+ });
2269
+ return logs;
2270
+ }
2271
+ function formatTraceEntry({ ctx, recurseCount }) {
2272
+ const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
2273
+ const instance = isVNode(ctx) ? ctx.component : ctx;
2274
+ const isRoot = instance ? instance.parent == null : false;
2275
+ const open = ` at <${formatComponentName(instance, ctx.type, isRoot)}`;
2276
+ const close = `>` + postfix;
2277
+ return ctx.props ? [open, ...formatProps(ctx.props), close] : [open + close];
2278
+ }
2279
+ function formatProps(props) {
2280
+ const res = [];
2281
+ const keys = Object.keys(props);
2282
+ keys.slice(0, 3).forEach((key) => {
2283
+ res.push(...formatProp(key, props[key]));
2284
+ });
2285
+ if (keys.length > 3) {
2286
+ res.push(` ...`);
2287
+ }
2288
+ return res;
2289
+ }
2290
+ function formatProp(key, value, raw) {
2291
+ if (isString(value)) {
2292
+ value = JSON.stringify(value);
2293
+ return raw ? value : [`${key}=${value}`];
2294
+ } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
2295
+ return raw ? value : [`${key}=${value}`];
2296
+ } else if (isRef(value)) {
2297
+ value = formatProp(key, toRaw(value.value), true);
2298
+ return raw ? value : [`${key}=Ref<`, value, `>`];
2299
+ } else if (isFunction(value)) {
2300
+ return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
2301
+ } else {
2302
+ value = toRaw(value);
2303
+ return raw ? value : [`${key}=`, value];
2304
+ }
2195
2305
  }
2196
2306
  function assertNumber(val, type) {
2197
2307
  return;
@@ -3884,7 +3994,8 @@ function createHydrationFunctions(rendererInternals) {
3884
3994
  node,
3885
3995
  container,
3886
3996
  null,
3887
- parentComponent
3997
+ parentComponent,
3998
+ parentSuspense
3888
3999
  );
3889
4000
  } else {
3890
4001
  mountComponent(
@@ -6198,7 +6309,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6198
6309
  return vm;
6199
6310
  }
6200
6311
  }
6201
- Vue.version = `2.6.14-compat:${"3.6.0-alpha.5"}`;
6312
+ Vue.version = `2.6.14-compat:${"3.6.0-alpha.6"}`;
6202
6313
  Vue.config = singletonApp.config;
6203
6314
  Vue.use = (plugin, ...options) => {
6204
6315
  if (plugin && isFunction(plugin.install)) {
@@ -7040,7 +7151,7 @@ function renderComponentRoot(instance) {
7040
7151
  const proxyToUse = withProxy || proxy;
7041
7152
  const thisProxy = false ? new Proxy(proxyToUse, {
7042
7153
  get(target, key, receiver) {
7043
- warn(
7154
+ warn$2(
7044
7155
  `Property '${String(
7045
7156
  key
7046
7157
  )}' was accessed via 'this'. Avoid using 'this' in templates.`
@@ -8216,7 +8327,8 @@ function baseCreateRenderer(options, createHydrationFns) {
8216
8327
  n2,
8217
8328
  container,
8218
8329
  anchor,
8219
- parentComponent
8330
+ parentComponent,
8331
+ parentSuspense
8220
8332
  );
8221
8333
  }
8222
8334
  } else {
@@ -8264,7 +8376,36 @@ function baseCreateRenderer(options, createHydrationFns) {
8264
8376
  setupComponent(instance, false, optimized);
8265
8377
  }
8266
8378
  if (instance.asyncDep) {
8267
- parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
8379
+ if (parentSuspense) {
8380
+ const hydratedEl = instance.vnode.el;
8381
+ parentSuspense.registerDep(instance, (setupResult) => {
8382
+ const { vnode } = instance;
8383
+ handleSetupResult(instance, setupResult, false);
8384
+ if (hydratedEl) {
8385
+ vnode.el = hydratedEl;
8386
+ }
8387
+ const placeholder = !hydratedEl && instance.subTree.el;
8388
+ setupRenderEffect(
8389
+ instance,
8390
+ vnode,
8391
+ // component may have been moved before resolve.
8392
+ // if this is not a hydration, instance.subTree will be the comment
8393
+ // placeholder.
8394
+ hostParentNode(hydratedEl || instance.subTree.el),
8395
+ // anchor will not be used if this is hydration, so only need to
8396
+ // consider the comment placeholder case.
8397
+ hydratedEl ? null : getNextHostNode(instance.subTree),
8398
+ parentSuspense,
8399
+ namespace,
8400
+ optimized
8401
+ );
8402
+ if (placeholder) {
8403
+ vnode.placeholder = null;
8404
+ hostRemove(placeholder);
8405
+ }
8406
+ updateHOCHostEl(instance, vnode.el);
8407
+ });
8408
+ }
8268
8409
  if (!initialVNode.el) {
8269
8410
  const placeholder = instance.subTree = createVNode(Comment);
8270
8411
  processCommentNode(null, placeholder, container, anchor);
@@ -9520,7 +9661,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9520
9661
  m: move,
9521
9662
  um: unmount,
9522
9663
  n: next,
9523
- o: { parentNode, remove }
9664
+ o: { parentNode }
9524
9665
  } = rendererInternals;
9525
9666
  let parentSuspenseId;
9526
9667
  const isSuspensible = isVNodeSuspensible(vnode);
@@ -9680,12 +9821,11 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9680
9821
  next() {
9681
9822
  return suspense.activeBranch && next(suspense.activeBranch);
9682
9823
  },
9683
- registerDep(instance, setupRenderEffect, optimized2) {
9824
+ registerDep(instance, onResolve) {
9684
9825
  const isInPendingSuspense = !!suspense.pendingBranch;
9685
9826
  if (isInPendingSuspense) {
9686
9827
  suspense.deps++;
9687
9828
  }
9688
- const hydratedEl = instance.vnode.el;
9689
9829
  instance.asyncDep.catch((err) => {
9690
9830
  handleError(err, instance, 0);
9691
9831
  }).then((asyncSetupResult) => {
@@ -9693,31 +9833,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9693
9833
  return;
9694
9834
  }
9695
9835
  instance.asyncResolved = true;
9696
- const { vnode: vnode2 } = instance;
9697
- handleSetupResult(instance, asyncSetupResult, false);
9698
- if (hydratedEl) {
9699
- vnode2.el = hydratedEl;
9700
- }
9701
- const placeholder = !hydratedEl && instance.subTree.el;
9702
- setupRenderEffect(
9703
- instance,
9704
- vnode2,
9705
- // component may have been moved before resolve.
9706
- // if this is not a hydration, instance.subTree will be the comment
9707
- // placeholder.
9708
- parentNode(hydratedEl || instance.subTree.el),
9709
- // anchor will not be used if this is hydration, so only need to
9710
- // consider the comment placeholder case.
9711
- hydratedEl ? null : next(instance.subTree),
9712
- suspense,
9713
- namespace,
9714
- optimized2
9715
- );
9716
- if (placeholder) {
9717
- vnode2.placeholder = null;
9718
- remove(placeholder);
9719
- }
9720
- updateHOCHostEl(instance, vnode2.el);
9836
+ onResolve(asyncSetupResult);
9721
9837
  if (isInPendingSuspense && --suspense.deps === 0) {
9722
9838
  suspense.resolve();
9723
9839
  }
@@ -10547,9 +10663,33 @@ function getComponentPublicInstance(instance) {
10547
10663
  return instance.proxy;
10548
10664
  }
10549
10665
  }
10666
+ const classifyRE = /(?:^|[-_])\w/g;
10667
+ const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
10550
10668
  function getComponentName(Component, includeInferred = true) {
10551
10669
  return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
10552
10670
  }
10671
+ function formatComponentName(instance, Component, isRoot = false) {
10672
+ let name = getComponentName(Component);
10673
+ if (!name && Component.__file) {
10674
+ const match = Component.__file.match(/([^/\\]+)\.\w+$/);
10675
+ if (match) {
10676
+ name = match[1];
10677
+ }
10678
+ }
10679
+ if (!name && instance) {
10680
+ const inferFromRegistry = (registry) => {
10681
+ for (const key in registry) {
10682
+ if (registry[key] === Component) {
10683
+ return key;
10684
+ }
10685
+ }
10686
+ };
10687
+ name = inferFromRegistry(instance.components) || instance.parent && inferFromRegistry(
10688
+ instance.parent.type.components
10689
+ ) || inferFromRegistry(instance.appContext.components);
10690
+ }
10691
+ return name ? classify(name) : isRoot ? `App` : `Anonymous`;
10692
+ }
10553
10693
  function isClassComponent(value) {
10554
10694
  return isFunction(value) && "__vccOpts" in value;
10555
10695
  }
@@ -10616,7 +10756,7 @@ function isMemoSame(cached, memo) {
10616
10756
  return true;
10617
10757
  }
10618
10758
 
10619
- const version = "3.6.0-alpha.5";
10759
+ const version = "3.6.0-alpha.6";
10620
10760
  const warn$1 = NOOP;
10621
10761
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10622
10762
  const devtools = void 0;
@@ -19171,7 +19311,9 @@ const isNonKeyModifier = /* @__PURE__ */ makeMap(
19171
19311
  `stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
19172
19312
  );
19173
19313
  const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
19174
- const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`);
19314
+ const isKeyboardEvent = /* @__PURE__ */ makeMap(
19315
+ `onkeyup,onkeydown,onkeypress`
19316
+ );
19175
19317
  const resolveModifiers = (key, modifiers, context, loc) => {
19176
19318
  const keyModifiers = [];
19177
19319
  const nonKeyModifiers = [];