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.
@@ -928,8 +928,6 @@ const shallowReadonlyHandlers = /*#__PURE__*/ extend({}, readonlyHandlers, {
928
928
  get: shallowReadonlyGet
929
929
  });
930
930
 
931
- const toReactive = (value) => isObject(value) ? reactive(value) : value;
932
- const toReadonly = (value) => isObject(value) ? readonly(value) : value;
933
931
  const toShallow = (value) => value;
934
932
  const getProto = (v) => Reflect.getPrototypeOf(v);
935
933
  function get$1(target, key, isReadonly = false, isShallow = false) {
@@ -1317,7 +1315,9 @@ function toRaw(observed) {
1317
1315
  function markRaw(value) {
1318
1316
  def(value, "__v_skip" /* SKIP */, true);
1319
1317
  return value;
1320
- }
1318
+ }
1319
+ const toReactive = (value) => isObject(value) ? reactive(value) : value;
1320
+ const toReadonly = (value) => isObject(value) ? readonly(value) : value;
1321
1321
 
1322
1322
  function trackRefValue(ref) {
1323
1323
  if (isTracking()) {
@@ -1347,7 +1347,6 @@ function triggerRefValue(ref, newVal) {
1347
1347
  }
1348
1348
  }
1349
1349
  }
1350
- const convert = (val) => isObject(val) ? reactive(val) : val;
1351
1350
  function isRef(r) {
1352
1351
  return Boolean(r && r.__v_isRef === true);
1353
1352
  }
@@ -1357,13 +1356,19 @@ function ref(value) {
1357
1356
  function shallowRef(value) {
1358
1357
  return createRef(value, true);
1359
1358
  }
1359
+ function createRef(rawValue, shallow) {
1360
+ if (isRef(rawValue)) {
1361
+ return rawValue;
1362
+ }
1363
+ return new RefImpl(rawValue, shallow);
1364
+ }
1360
1365
  class RefImpl {
1361
1366
  constructor(value, _shallow) {
1362
1367
  this._shallow = _shallow;
1363
1368
  this.dep = undefined;
1364
1369
  this.__v_isRef = true;
1365
1370
  this._rawValue = _shallow ? value : toRaw(value);
1366
- this._value = _shallow ? value : convert(value);
1371
+ this._value = _shallow ? value : toReactive(value);
1367
1372
  }
1368
1373
  get value() {
1369
1374
  trackRefValue(this);
@@ -1373,17 +1378,11 @@ class RefImpl {
1373
1378
  newVal = this._shallow ? newVal : toRaw(newVal);
1374
1379
  if (hasChanged(newVal, this._rawValue)) {
1375
1380
  this._rawValue = newVal;
1376
- this._value = this._shallow ? newVal : convert(newVal);
1381
+ this._value = this._shallow ? newVal : toReactive(newVal);
1377
1382
  triggerRefValue(this, newVal);
1378
1383
  }
1379
1384
  }
1380
1385
  }
1381
- function createRef(rawValue, shallow) {
1382
- if (isRef(rawValue)) {
1383
- return rawValue;
1384
- }
1385
- return new RefImpl(rawValue, shallow);
1386
- }
1387
1386
  function triggerRef(ref) {
1388
1387
  triggerRefValue(ref, ref.value );
1389
1388
  }
@@ -1514,14 +1513,7 @@ const hmrDirtyComponents = new Set();
1514
1513
  // Note: for a component to be eligible for HMR it also needs the __hmrId option
1515
1514
  // to be set so that its instances can be registered / removed.
1516
1515
  {
1517
- const globalObject = typeof global !== 'undefined'
1518
- ? global
1519
- : typeof self !== 'undefined'
1520
- ? self
1521
- : typeof window !== 'undefined'
1522
- ? window
1523
- : {};
1524
- globalObject.__VUE_HMR_RUNTIME__ = {
1516
+ getGlobalThis().__VUE_HMR_RUNTIME__ = {
1525
1517
  createRecord: tryWrap(createRecord),
1526
1518
  rerender: tryWrap(rerender),
1527
1519
  reload: tryWrap(reload)
@@ -1642,14 +1634,32 @@ function tryWrap(fn) {
1642
1634
  }
1643
1635
 
1644
1636
  let devtools;
1645
- function setDevtoolsHook(hook) {
1637
+ let buffer = [];
1638
+ function emit(event, ...args) {
1639
+ if (devtools) {
1640
+ devtools.emit(event, ...args);
1641
+ }
1642
+ else {
1643
+ buffer.push({ event, args });
1644
+ }
1645
+ }
1646
+ function setDevtoolsHook(hook, target) {
1646
1647
  devtools = hook;
1648
+ if (devtools) {
1649
+ devtools.enabled = true;
1650
+ buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
1651
+ buffer = [];
1652
+ }
1653
+ else {
1654
+ const replay = (target.__VUE_DEVTOOLS_HOOK_REPLAY__ =
1655
+ target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []);
1656
+ replay.push((newHook) => {
1657
+ setDevtoolsHook(newHook, target);
1658
+ });
1659
+ }
1647
1660
  }
1648
1661
  function devtoolsInitApp(app, version) {
1649
- // TODO queue if devtools is undefined
1650
- if (!devtools)
1651
- return;
1652
- devtools.emit("app:init" /* APP_INIT */, app, version, {
1662
+ emit("app:init" /* APP_INIT */, app, version, {
1653
1663
  Fragment,
1654
1664
  Text,
1655
1665
  Comment,
@@ -1657,9 +1667,7 @@ function devtoolsInitApp(app, version) {
1657
1667
  });
1658
1668
  }
1659
1669
  function devtoolsUnmountApp(app) {
1660
- if (!devtools)
1661
- return;
1662
- devtools.emit("app:unmount" /* APP_UNMOUNT */, app);
1670
+ emit("app:unmount" /* APP_UNMOUNT */, app);
1663
1671
  }
1664
1672
  const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
1665
1673
  const devtoolsComponentUpdated =
@@ -1668,27 +1676,21 @@ const devtoolsComponentRemoved =
1668
1676
  /*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* COMPONENT_REMOVED */);
1669
1677
  function createDevtoolsComponentHook(hook) {
1670
1678
  return (component) => {
1671
- if (!devtools)
1672
- return;
1673
- devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
1679
+ emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
1674
1680
  };
1675
1681
  }
1676
1682
  const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
1677
1683
  const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
1678
1684
  function createDevtoolsPerformanceHook(hook) {
1679
1685
  return (component, type, time) => {
1680
- if (!devtools)
1681
- return;
1682
- devtools.emit(hook, component.appContext.app, component.uid, component, type, time);
1686
+ emit(hook, component.appContext.app, component.uid, component, type, time);
1683
1687
  };
1684
1688
  }
1685
1689
  function devtoolsComponentEmit(component, event, params) {
1686
- if (!devtools)
1687
- return;
1688
- devtools.emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
1690
+ emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
1689
1691
  }
1690
1692
 
1691
- function emit(instance, event, ...rawArgs) {
1693
+ function emit$1(instance, event, ...rawArgs) {
1692
1694
  const props = instance.vnode.props || EMPTY_OBJ;
1693
1695
  {
1694
1696
  const { emitsOptions, propsOptions: [propsOptions] } = instance;
@@ -5059,10 +5061,10 @@ function createHydrationRenderer(options) {
5059
5061
  }
5060
5062
  // implementation
5061
5063
  function baseCreateRenderer(options, createHydrationFns) {
5064
+ const target = getGlobalThis();
5065
+ target.__VUE__ = true;
5062
5066
  {
5063
- const target = getGlobalThis();
5064
- target.__VUE__ = true;
5065
- setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__);
5067
+ setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
5066
5068
  }
5067
5069
  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;
5068
5070
  // Note: functions inside this closure should use `const xxx = () => {}`
@@ -7624,7 +7626,7 @@ function createComponentInstance(vnode, parent, suspense) {
7624
7626
  instance.ctx = createDevRenderContext(instance);
7625
7627
  }
7626
7628
  instance.root = parent ? parent.root : instance;
7627
- instance.emit = emit.bind(null, instance);
7629
+ instance.emit = emit$1.bind(null, instance);
7628
7630
  // apply custom element special handling
7629
7631
  if (vnode.ce) {
7630
7632
  vnode.ce(instance);
@@ -7778,9 +7780,11 @@ const isRuntimeOnly = () => !compile;
7778
7780
  function finishComponentSetup(instance, isSSR, skipOptions) {
7779
7781
  const Component = instance.type;
7780
7782
  // template / render function normalization
7783
+ // could be already set when returned from setup()
7781
7784
  if (!instance.render) {
7782
- // could be set from setup()
7783
- if (compile && !Component.render) {
7785
+ // only do on-the-fly compile if not in SSR - SSR on-the-fly compliation
7786
+ // is done by server-renderer
7787
+ if (!isSSR && compile && !Component.render) {
7784
7788
  const template = Component.template;
7785
7789
  if (template) {
7786
7790
  {
@@ -8979,7 +8983,7 @@ function isMemoSame(cached, memo) {
8979
8983
  }
8980
8984
 
8981
8985
  // Core API ------------------------------------------------------------------
8982
- const version = "3.2.13";
8986
+ const version = "3.2.17";
8983
8987
  /**
8984
8988
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
8985
8989
  * @internal
@@ -10601,7 +10605,11 @@ function normalizeContainer(container) {
10601
10605
  warn$1(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
10602
10606
  }
10603
10607
  return container;
10604
- }
10608
+ }
10609
+ /**
10610
+ * @internal
10611
+ */
10612
+ const initDirectivesForSSR = NOOP;
10605
10613
 
10606
10614
  var runtimeDom = /*#__PURE__*/Object.freeze({
10607
10615
  __proto__: null,
@@ -10609,6 +10617,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
10609
10617
  hydrate: hydrate,
10610
10618
  createApp: createApp,
10611
10619
  createSSRApp: createSSRApp,
10620
+ initDirectivesForSSR: initDirectivesForSSR,
10612
10621
  defineCustomElement: defineCustomElement,
10613
10622
  defineSSRCustomElement: defineSSRCustomElement,
10614
10623
  VueElement: VueElement,
@@ -10831,7 +10840,7 @@ const errorMessages = {
10831
10840
  [47 /* X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
10832
10841
  [48 /* X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
10833
10842
  [49 /* X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
10834
- // just to fullfill types
10843
+ // just to fulfill types
10835
10844
  [50 /* __EXTEND_POINT__ */]: ``
10836
10845
  };
10837
10846
 
@@ -12806,7 +12815,7 @@ function createStructuralDirectiveTransform(name, fn) {
12806
12815
  }
12807
12816
 
12808
12817
  const PURE_ANNOTATION = `/*#__PURE__*/`;
12809
- function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssr = false, isTS = false, inSSR = false }) {
12818
+ function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssrRuntimeModuleName = 'vue/server-renderer', ssr = false, isTS = false, inSSR = false }) {
12810
12819
  const context = {
12811
12820
  mode,
12812
12821
  prefixIdentifiers,
@@ -12816,6 +12825,7 @@ function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode
12816
12825
  optimizeImports,
12817
12826
  runtimeGlobalName,
12818
12827
  runtimeModuleName,
12828
+ ssrRuntimeModuleName,
12819
12829
  ssr,
12820
12830
  isTS,
12821
12831
  inSSR,
@@ -12936,7 +12946,7 @@ function generate(ast, options = {}) {
12936
12946
  };
12937
12947
  }
12938
12948
  function genFunctionPreamble(ast, context) {
12939
- const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName } = context;
12949
+ const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName, ssrRuntimeModuleName } = context;
12940
12950
  const VueBinding = runtimeGlobalName;
12941
12951
  const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
12942
12952
  // Generate const declaration for helpers
@@ -14972,9 +14982,9 @@ const transformModel = (dir, node, context) => {
14972
14982
  const eventArg = context.isTS ? `($event: any)` : `$event`;
14973
14983
  {
14974
14984
  assignmentExp = createCompoundExpression([
14975
- `${eventArg} => (`,
14985
+ `${eventArg} => ((`,
14976
14986
  exp,
14977
- ` = $event)`
14987
+ `) = $event)`
14978
14988
  ]);
14979
14989
  }
14980
14990
  const props = [
@@ -15593,4 +15603,4 @@ function compileToFunction(template, options) {
15593
15603
  }
15594
15604
  registerRuntimeCompiler(compileToFunction);
15595
15605
 
15596
- export { BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compileToFunction 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 };
15606
+ export { BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compileToFunction 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 };