@vue/compat 3.2.13 → 3.2.17

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.
@@ -853,8 +853,6 @@ const shallowReadonlyHandlers = /*#__PURE__*/ extend({}, readonlyHandlers, {
853
853
  get: shallowReadonlyGet
854
854
  });
855
855
 
856
- const toReactive = (value) => isObject(value) ? reactive(value) : value;
857
- const toReadonly = (value) => isObject(value) ? readonly(value) : value;
858
856
  const toShallow = (value) => value;
859
857
  const getProto = (v) => Reflect.getPrototypeOf(v);
860
858
  function get$1(target, key, isReadonly = false, isShallow = false) {
@@ -1242,7 +1240,9 @@ function toRaw(observed) {
1242
1240
  function markRaw(value) {
1243
1241
  def(value, "__v_skip" /* SKIP */, true);
1244
1242
  return value;
1245
- }
1243
+ }
1244
+ const toReactive = (value) => isObject(value) ? reactive(value) : value;
1245
+ const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1246
1246
 
1247
1247
  function trackRefValue(ref) {
1248
1248
  if (isTracking()) {
@@ -1272,7 +1272,6 @@ function triggerRefValue(ref, newVal) {
1272
1272
  }
1273
1273
  }
1274
1274
  }
1275
- const convert = (val) => isObject(val) ? reactive(val) : val;
1276
1275
  function isRef(r) {
1277
1276
  return Boolean(r && r.__v_isRef === true);
1278
1277
  }
@@ -1282,13 +1281,19 @@ function ref(value) {
1282
1281
  function shallowRef(value) {
1283
1282
  return createRef(value, true);
1284
1283
  }
1284
+ function createRef(rawValue, shallow) {
1285
+ if (isRef(rawValue)) {
1286
+ return rawValue;
1287
+ }
1288
+ return new RefImpl(rawValue, shallow);
1289
+ }
1285
1290
  class RefImpl {
1286
1291
  constructor(value, _shallow) {
1287
1292
  this._shallow = _shallow;
1288
1293
  this.dep = undefined;
1289
1294
  this.__v_isRef = true;
1290
1295
  this._rawValue = _shallow ? value : toRaw(value);
1291
- this._value = _shallow ? value : convert(value);
1296
+ this._value = _shallow ? value : toReactive(value);
1292
1297
  }
1293
1298
  get value() {
1294
1299
  trackRefValue(this);
@@ -1298,17 +1303,11 @@ class RefImpl {
1298
1303
  newVal = this._shallow ? newVal : toRaw(newVal);
1299
1304
  if (hasChanged(newVal, this._rawValue)) {
1300
1305
  this._rawValue = newVal;
1301
- this._value = this._shallow ? newVal : convert(newVal);
1306
+ this._value = this._shallow ? newVal : toReactive(newVal);
1302
1307
  triggerRefValue(this, newVal);
1303
1308
  }
1304
1309
  }
1305
1310
  }
1306
- function createRef(rawValue, shallow) {
1307
- if (isRef(rawValue)) {
1308
- return rawValue;
1309
- }
1310
- return new RefImpl(rawValue, shallow);
1311
- }
1312
1311
  function triggerRef(ref) {
1313
1312
  triggerRefValue(ref, ref.value );
1314
1313
  }
@@ -1439,14 +1438,7 @@ const hmrDirtyComponents = new Set();
1439
1438
  // Note: for a component to be eligible for HMR it also needs the __hmrId option
1440
1439
  // to be set so that its instances can be registered / removed.
1441
1440
  {
1442
- const globalObject = typeof global !== 'undefined'
1443
- ? global
1444
- : typeof self !== 'undefined'
1445
- ? self
1446
- : typeof window !== 'undefined'
1447
- ? window
1448
- : {};
1449
- globalObject.__VUE_HMR_RUNTIME__ = {
1441
+ getGlobalThis().__VUE_HMR_RUNTIME__ = {
1450
1442
  createRecord: tryWrap(createRecord),
1451
1443
  rerender: tryWrap(rerender),
1452
1444
  reload: tryWrap(reload)
@@ -1567,14 +1559,32 @@ function tryWrap(fn) {
1567
1559
  }
1568
1560
 
1569
1561
  let devtools;
1570
- function setDevtoolsHook(hook) {
1562
+ let buffer = [];
1563
+ function emit(event, ...args) {
1564
+ if (devtools) {
1565
+ devtools.emit(event, ...args);
1566
+ }
1567
+ else {
1568
+ buffer.push({ event, args });
1569
+ }
1570
+ }
1571
+ function setDevtoolsHook(hook, target) {
1571
1572
  devtools = hook;
1573
+ if (devtools) {
1574
+ devtools.enabled = true;
1575
+ buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
1576
+ buffer = [];
1577
+ }
1578
+ else {
1579
+ const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
1580
+ target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
1581
+ replay.push((newHook) => {
1582
+ setDevtoolsHook(newHook, target);
1583
+ });
1584
+ }
1572
1585
  }
1573
1586
  function devtoolsInitApp(app, version) {
1574
- // TODO queue if devtools is undefined
1575
- if (!devtools)
1576
- return;
1577
- devtools.emit("app:init" /* APP_INIT */, app, version, {
1587
+ emit("app:init" /* APP_INIT */, app, version, {
1578
1588
  Fragment,
1579
1589
  Text,
1580
1590
  Comment,
@@ -1582,9 +1592,7 @@ function devtoolsInitApp(app, version) {
1582
1592
  });
1583
1593
  }
1584
1594
  function devtoolsUnmountApp(app) {
1585
- if (!devtools)
1586
- return;
1587
- devtools.emit("app:unmount" /* APP_UNMOUNT */, app);
1595
+ emit("app:unmount" /* APP_UNMOUNT */, app);
1588
1596
  }
1589
1597
  const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
1590
1598
  const devtoolsComponentUpdated =
@@ -1593,24 +1601,18 @@ const devtoolsComponentRemoved =
1593
1601
  /*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* COMPONENT_REMOVED */);
1594
1602
  function createDevtoolsComponentHook(hook) {
1595
1603
  return (component) => {
1596
- if (!devtools)
1597
- return;
1598
- devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
1604
+ emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
1599
1605
  };
1600
1606
  }
1601
1607
  const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
1602
1608
  const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
1603
1609
  function createDevtoolsPerformanceHook(hook) {
1604
1610
  return (component, type, time) => {
1605
- if (!devtools)
1606
- return;
1607
- devtools.emit(hook, component.appContext.app, component.uid, component, type, time);
1611
+ emit(hook, component.appContext.app, component.uid, component, type, time);
1608
1612
  };
1609
1613
  }
1610
1614
  function devtoolsComponentEmit(component, event, params) {
1611
- if (!devtools)
1612
- return;
1613
- devtools.emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
1615
+ emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
1614
1616
  }
1615
1617
 
1616
1618
  const deprecationData = {
@@ -2070,7 +2072,7 @@ function off(instance, event, fn) {
2070
2072
  events[event] = cbs.filter(cb => !(cb === fn || cb.fn === fn));
2071
2073
  return vm;
2072
2074
  }
2073
- function emit(instance, event, args) {
2075
+ function emit$1(instance, event, args) {
2074
2076
  const cbs = getRegistry(instance)[event];
2075
2077
  if (cbs) {
2076
2078
  callWithAsyncErrorHandling(cbs.map(cb => cb.bind(instance.proxy)), instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
@@ -2123,7 +2125,7 @@ function compatModelEmit(instance, event, args) {
2123
2125
  }
2124
2126
  }
2125
2127
 
2126
- function emit$1(instance, event, ...rawArgs) {
2128
+ function emit$2(instance, event, ...rawArgs) {
2127
2129
  const props = instance.vnode.props || EMPTY_OBJ;
2128
2130
  {
2129
2131
  const { emitsOptions, propsOptions: [propsOptions] } = instance;
@@ -2199,7 +2201,7 @@ function emit$1(instance, event, ...rawArgs) {
2199
2201
  }
2200
2202
  {
2201
2203
  compatModelEmit(instance, event, args);
2202
- return emit(instance, event, args);
2204
+ return emit$1(instance, event, args);
2203
2205
  }
2204
2206
  }
2205
2207
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
@@ -5198,7 +5200,7 @@ function createCompatVue(createApp, createSingletonApp) {
5198
5200
  return vm;
5199
5201
  }
5200
5202
  }
5201
- Vue.version = "3.2.13";
5203
+ Vue.version = "3.2.17";
5202
5204
  Vue.config = singletonApp.config;
5203
5205
  Vue.use = (p, ...options) => {
5204
5206
  if (p && isFunction(p.install)) {
@@ -6196,10 +6198,10 @@ function createHydrationRenderer(options) {
6196
6198
  }
6197
6199
  // implementation
6198
6200
  function baseCreateRenderer(options, createHydrationFns) {
6201
+ const target = getGlobalThis();
6202
+ target.__VUE__ = true;
6199
6203
  {
6200
- const target = getGlobalThis();
6201
- target.__VUE__ = true;
6202
- setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__);
6204
+ setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
6203
6205
  }
6204
6206
  const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP, cloneNode: hostCloneNode, insertStaticContent: hostInsertStaticContent } = options;
6205
6207
  // Note: functions inside this closure should use `const xxx = () => {}`
@@ -9384,7 +9386,7 @@ function createComponentInstance(vnode, parent, suspense) {
9384
9386
  instance.ctx = createDevRenderContext(instance);
9385
9387
  }
9386
9388
  instance.root = parent ? parent.root : instance;
9387
- instance.emit = emit$1.bind(null, instance);
9389
+ instance.emit = emit$2.bind(null, instance);
9388
9390
  // apply custom element special handling
9389
9391
  if (vnode.ce) {
9390
9392
  vnode.ce(instance);
@@ -9544,9 +9546,11 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9544
9546
  }
9545
9547
  }
9546
9548
  // template / render function normalization
9549
+ // could be already set when returned from setup()
9547
9550
  if (!instance.render) {
9548
- // could be set from setup()
9549
- if (compile && !Component.render) {
9551
+ // only do on-the-fly compile if not in SSR - SSR on-the-fly compliation
9552
+ // is done by server-renderer
9553
+ if (!isSSR && compile && !Component.render) {
9550
9554
  const template = (instance.vnode.props &&
9551
9555
  instance.vnode.props['inline-template']) ||
9552
9556
  Component.template;
@@ -10767,7 +10771,7 @@ function isMemoSame(cached, memo) {
10767
10771
  }
10768
10772
 
10769
10773
  // Core API ------------------------------------------------------------------
10770
- const version = "3.2.13";
10774
+ const version = "3.2.17";
10771
10775
  /**
10772
10776
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10773
10777
  * @internal
@@ -12518,7 +12522,11 @@ function normalizeContainer(container) {
12518
12522
  warn$1(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
12519
12523
  }
12520
12524
  return container;
12521
- }
12525
+ }
12526
+ /**
12527
+ * @internal
12528
+ */
12529
+ const initDirectivesForSSR = NOOP;
12522
12530
 
12523
12531
  var runtimeDom = /*#__PURE__*/Object.freeze({
12524
12532
  __proto__: null,
@@ -12526,6 +12534,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12526
12534
  hydrate: hydrate,
12527
12535
  createApp: createApp,
12528
12536
  createSSRApp: createSSRApp,
12537
+ initDirectivesForSSR: initDirectivesForSSR,
12529
12538
  defineCustomElement: defineCustomElement,
12530
12539
  defineSSRCustomElement: defineSSRCustomElement,
12531
12540
  VueElement: VueElement,
@@ -12715,4 +12724,4 @@ Vue.compile = (() => {
12715
12724
  const { configureCompat: configureCompat$1 } = Vue;
12716
12725
 
12717
12726
  export default Vue;
12718
- export { BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat$1 as configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineProps, defineSSRCustomElement, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter$1 as resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
12727
+ export { BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat$1 as configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineProps, defineSSRCustomElement, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter$1 as resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };