vue 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,27 +1601,21 @@ 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
- function emit(instance, event, ...rawArgs) {
1618
+ function emit$1(instance, event, ...rawArgs) {
1617
1619
  const props = instance.vnode.props || EMPTY_OBJ;
1618
1620
  {
1619
1621
  const { emitsOptions, propsOptions: [propsOptions] } = instance;
@@ -4984,10 +4986,10 @@ function createHydrationRenderer(options) {
4984
4986
  }
4985
4987
  // implementation
4986
4988
  function baseCreateRenderer(options, createHydrationFns) {
4989
+ const target = getGlobalThis();
4990
+ target.__VUE__ = true;
4987
4991
  {
4988
- const target = getGlobalThis();
4989
- target.__VUE__ = true;
4990
- setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__);
4992
+ setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
4991
4993
  }
4992
4994
  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;
4993
4995
  // Note: functions inside this closure should use `const xxx = () => {}`
@@ -7549,7 +7551,7 @@ function createComponentInstance(vnode, parent, suspense) {
7549
7551
  instance.ctx = createDevRenderContext(instance);
7550
7552
  }
7551
7553
  instance.root = parent ? parent.root : instance;
7552
- instance.emit = emit.bind(null, instance);
7554
+ instance.emit = emit$1.bind(null, instance);
7553
7555
  // apply custom element special handling
7554
7556
  if (vnode.ce) {
7555
7557
  vnode.ce(instance);
@@ -7703,9 +7705,11 @@ const isRuntimeOnly = () => !compile;
7703
7705
  function finishComponentSetup(instance, isSSR, skipOptions) {
7704
7706
  const Component = instance.type;
7705
7707
  // template / render function normalization
7708
+ // could be already set when returned from setup()
7706
7709
  if (!instance.render) {
7707
- // could be set from setup()
7708
- if (compile && !Component.render) {
7710
+ // only do on-the-fly compile if not in SSR - SSR on-the-fly compliation
7711
+ // is done by server-renderer
7712
+ if (!isSSR && compile && !Component.render) {
7709
7713
  const template = Component.template;
7710
7714
  if (template) {
7711
7715
  {
@@ -8904,7 +8908,7 @@ function isMemoSame(cached, memo) {
8904
8908
  }
8905
8909
 
8906
8910
  // Core API ------------------------------------------------------------------
8907
- const version = "3.2.13";
8911
+ const version = "3.2.17";
8908
8912
  /**
8909
8913
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
8910
8914
  * @internal
@@ -10526,7 +10530,11 @@ function normalizeContainer(container) {
10526
10530
  warn$1(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
10527
10531
  }
10528
10532
  return container;
10529
- }
10533
+ }
10534
+ /**
10535
+ * @internal
10536
+ */
10537
+ const initDirectivesForSSR = NOOP;
10530
10538
 
10531
10539
  function initDev() {
10532
10540
  {
@@ -10550,4 +10558,4 @@ const compile$1 = () => {
10550
10558
  }
10551
10559
  };
10552
10560
 
10553
- export { BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compile$1 as compile, computed, 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, 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 };
10561
+ export { BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compile$1 as compile, computed, 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, 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 };