@vue/compat 3.2.15 → 3.2.19

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.
@@ -1455,14 +1455,7 @@ const hmrDirtyComponents = new Set();
1455
1455
  // Note: for a component to be eligible for HMR it also needs the __hmrId option
1456
1456
  // to be set so that its instances can be registered / removed.
1457
1457
  if ((process.env.NODE_ENV !== 'production')) {
1458
- const globalObject = typeof global !== 'undefined'
1459
- ? global
1460
- : typeof self !== 'undefined'
1461
- ? self
1462
- : typeof window !== 'undefined'
1463
- ? window
1464
- : {};
1465
- globalObject.__VUE_HMR_RUNTIME__ = {
1458
+ getGlobalThis().__VUE_HMR_RUNTIME__ = {
1466
1459
  createRecord: tryWrap(createRecord),
1467
1460
  rerender: tryWrap(rerender),
1468
1461
  reload: tryWrap(reload)
@@ -3557,7 +3550,7 @@ function defineAsyncComponent(source) {
3557
3550
  };
3558
3551
  // suspense-controlled or SSR.
3559
3552
  if ((suspensible && instance.suspense) ||
3560
- (false )) {
3553
+ (isInSSRComponentSetup)) {
3561
3554
  return load()
3562
3555
  .then(comp => {
3563
3556
  return () => createInnerComp(comp, instance);
@@ -5237,7 +5230,7 @@ function createCompatVue(createApp, createSingletonApp) {
5237
5230
  return vm;
5238
5231
  }
5239
5232
  }
5240
- Vue.version = "3.2.15";
5233
+ Vue.version = "3.2.19";
5241
5234
  Vue.config = singletonApp.config;
5242
5235
  Vue.use = (p, ...options) => {
5243
5236
  if (p && isFunction(p.install)) {
@@ -6186,20 +6179,22 @@ function isSupported() {
6186
6179
  * istanbul-ignore-next
6187
6180
  */
6188
6181
  function initFeatureFlags() {
6189
- let needWarn = false;
6182
+ const needWarn = [];
6190
6183
  if (typeof __VUE_OPTIONS_API__ !== 'boolean') {
6191
- needWarn = true;
6184
+ (process.env.NODE_ENV !== 'production') && needWarn.push(`__VUE_OPTIONS_API__`);
6192
6185
  getGlobalThis().__VUE_OPTIONS_API__ = true;
6193
6186
  }
6194
6187
  if (typeof __VUE_PROD_DEVTOOLS__ !== 'boolean') {
6195
- needWarn = true;
6188
+ (process.env.NODE_ENV !== 'production') && needWarn.push(`__VUE_PROD_DEVTOOLS__`);
6196
6189
  getGlobalThis().__VUE_PROD_DEVTOOLS__ = false;
6197
6190
  }
6198
- if ((process.env.NODE_ENV !== 'production') && needWarn) {
6199
- console.warn(`You are running the esm-bundler build of Vue. It is recommended to ` +
6200
- `configure your bundler to explicitly replace feature flag globals ` +
6201
- `with boolean literals to get proper tree-shaking in the final bundle. ` +
6202
- `See http://link.vuejs.org/feature-flags for more details.`);
6191
+ if ((process.env.NODE_ENV !== 'production') && needWarn.length) {
6192
+ const multi = needWarn.length > 1;
6193
+ console.warn(`Feature flag${multi ? `s` : ``} ${needWarn.join(', ')} ${multi ? `are` : `is`} not explicitly defined. You are running the esm-bundler build of Vue, ` +
6194
+ `which expects these compile-time feature flags to be globally injected ` +
6195
+ `via the bundler config in order to get better tree-shaking in the ` +
6196
+ `production bundle.\n\n` +
6197
+ `For more details, see http://link.vuejs.org/feature-flags.`);
6203
6198
  }
6204
6199
  }
6205
6200
 
@@ -9595,7 +9590,12 @@ function setupStatefulComponent(instance, isSSR) {
9595
9590
  function handleSetupResult(instance, setupResult, isSSR) {
9596
9591
  if (isFunction(setupResult)) {
9597
9592
  // setup returned an inline render function
9598
- {
9593
+ if (instance.type.__ssrInlineRender) {
9594
+ // when the function's name is `ssrRender` (compiled by SFC inline mode),
9595
+ // set it as ssrRender instead.
9596
+ instance.ssrRender = setupResult;
9597
+ }
9598
+ else {
9599
9599
  instance.render = setupResult;
9600
9600
  }
9601
9601
  }
@@ -9644,9 +9644,11 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9644
9644
  }
9645
9645
  }
9646
9646
  // template / render function normalization
9647
+ // could be already set when returned from setup()
9647
9648
  if (!instance.render) {
9648
- // could be set from setup()
9649
- if (compile && !Component.render) {
9649
+ // only do on-the-fly compile if not in SSR - SSR on-the-fly compliation
9650
+ // is done by server-renderer
9651
+ if (!isSSR && compile && !Component.render) {
9650
9652
  const template = (instance.vnode.props &&
9651
9653
  instance.vnode.props['inline-template']) ||
9652
9654
  Component.template;
@@ -10356,6 +10358,23 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
10356
10358
  callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
10357
10359
  };
10358
10360
  };
10361
+ // in SSR there is no need to setup an actual effect, and it should be noop
10362
+ // unless it's eager
10363
+ if (isInSSRComponentSetup) {
10364
+ // we will also not call the invalidate callback (+ runner is not set up)
10365
+ onInvalidate = NOOP;
10366
+ if (!cb) {
10367
+ getter();
10368
+ }
10369
+ else if (immediate) {
10370
+ callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
10371
+ getter(),
10372
+ isMultiSource ? [] : undefined,
10373
+ onInvalidate
10374
+ ]);
10375
+ }
10376
+ return NOOP;
10377
+ }
10359
10378
  let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
10360
10379
  const job = () => {
10361
10380
  if (!effect.active) {
@@ -10892,7 +10911,7 @@ function isMemoSame(cached, memo) {
10892
10911
  }
10893
10912
 
10894
10913
  // Core API ------------------------------------------------------------------
10895
- const version = "3.2.15";
10914
+ const version = "3.2.19";
10896
10915
  const _ssrUtils = {
10897
10916
  createComponentInstance,
10898
10917
  setupComponent,
@@ -12394,6 +12413,31 @@ function callModelHook(el, binding, vnode, prevVNode, hook) {
12394
12413
  }
12395
12414
  const fn = modelToUse[hook];
12396
12415
  fn && fn(el, binding, vnode, prevVNode);
12416
+ }
12417
+ // SSR vnode transforms, only used when user includes client-oriented render
12418
+ // function in SSR
12419
+ function initVModelForSSR() {
12420
+ vModelText.getSSRProps = ({ value }) => ({ value });
12421
+ vModelRadio.getSSRProps = ({ value }, vnode) => {
12422
+ if (vnode.props && looseEqual(vnode.props.value, value)) {
12423
+ return { checked: true };
12424
+ }
12425
+ };
12426
+ vModelCheckbox.getSSRProps = ({ value }, vnode) => {
12427
+ if (isArray(value)) {
12428
+ if (vnode.props && looseIndexOf(value, vnode.props.value) > -1) {
12429
+ return { checked: true };
12430
+ }
12431
+ }
12432
+ else if (isSet(value)) {
12433
+ if (vnode.props && value.has(vnode.props.value)) {
12434
+ return { checked: true };
12435
+ }
12436
+ }
12437
+ else if (value) {
12438
+ return { checked: true };
12439
+ }
12440
+ };
12397
12441
  }
12398
12442
 
12399
12443
  const systemModifiers = ['ctrl', 'shift', 'alt', 'meta'];
@@ -12522,6 +12566,15 @@ const vShow = {
12522
12566
  };
12523
12567
  function setDisplay(el, value) {
12524
12568
  el.style.display = value ? el._vod : 'none';
12569
+ }
12570
+ // SSR vnode transforms, only used when user includes client-oriented render
12571
+ // function in SSR
12572
+ function initVShowForSSR() {
12573
+ vShow.getSSRProps = ({ value }) => {
12574
+ if (!value) {
12575
+ return { style: { display: 'none' } };
12576
+ }
12577
+ };
12525
12578
  }
12526
12579
 
12527
12580
  const rendererOptions = extend({ patchProp }, nodeOps);
@@ -12657,7 +12710,19 @@ function normalizeContainer(container) {
12657
12710
  warn$1(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
12658
12711
  }
12659
12712
  return container;
12660
- }
12713
+ }
12714
+ let ssrDirectiveInitialized = false;
12715
+ /**
12716
+ * @internal
12717
+ */
12718
+ const initDirectivesForSSR = () => {
12719
+ if (!ssrDirectiveInitialized) {
12720
+ ssrDirectiveInitialized = true;
12721
+ initVModelForSSR();
12722
+ initVShowForSSR();
12723
+ }
12724
+ }
12725
+ ;
12661
12726
 
12662
12727
  var runtimeDom = /*#__PURE__*/Object.freeze({
12663
12728
  __proto__: null,
@@ -12665,6 +12730,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12665
12730
  hydrate: hydrate,
12666
12731
  createApp: createApp,
12667
12732
  createSSRApp: createSSRApp,
12733
+ initDirectivesForSSR: initDirectivesForSSR,
12668
12734
  defineCustomElement: defineCustomElement,
12669
12735
  defineSSRCustomElement: defineSSRCustomElement,
12670
12736
  VueElement: VueElement,
@@ -12850,4 +12916,4 @@ Vue.compile = (() => {
12850
12916
  const { configureCompat: configureCompat$1 } = Vue;
12851
12917
 
12852
12918
  export default Vue;
12853
- 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 };
12919
+ 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 };
@@ -1441,14 +1441,7 @@ var Vue = (function () {
1441
1441
  // Note: for a component to be eligible for HMR it also needs the __hmrId option
1442
1442
  // to be set so that its instances can be registered / removed.
1443
1443
  {
1444
- const globalObject = typeof global !== 'undefined'
1445
- ? global
1446
- : typeof self !== 'undefined'
1447
- ? self
1448
- : typeof window !== 'undefined'
1449
- ? window
1450
- : {};
1451
- globalObject.__VUE_HMR_RUNTIME__ = {
1444
+ getGlobalThis().__VUE_HMR_RUNTIME__ = {
1452
1445
  createRecord: tryWrap(createRecord),
1453
1446
  rerender: tryWrap(rerender),
1454
1447
  reload: tryWrap(reload)
@@ -5210,7 +5203,7 @@ var Vue = (function () {
5210
5203
  return vm;
5211
5204
  }
5212
5205
  }
5213
- Vue.version = "3.2.15";
5206
+ Vue.version = "3.2.19";
5214
5207
  Vue.config = singletonApp.config;
5215
5208
  Vue.use = (p, ...options) => {
5216
5209
  if (p && isFunction(p.install)) {
@@ -9556,9 +9549,11 @@ var Vue = (function () {
9556
9549
  }
9557
9550
  }
9558
9551
  // template / render function normalization
9552
+ // could be already set when returned from setup()
9559
9553
  if (!instance.render) {
9560
- // could be set from setup()
9561
- if (compile && !Component.render) {
9554
+ // only do on-the-fly compile if not in SSR - SSR on-the-fly compliation
9555
+ // is done by server-renderer
9556
+ if (!isSSR && compile && !Component.render) {
9562
9557
  const template = (instance.vnode.props &&
9563
9558
  instance.vnode.props['inline-template']) ||
9564
9559
  Component.template;
@@ -10774,7 +10769,7 @@ var Vue = (function () {
10774
10769
  }
10775
10770
 
10776
10771
  // Core API ------------------------------------------------------------------
10777
- const version = "3.2.15";
10772
+ const version = "3.2.19";
10778
10773
  /**
10779
10774
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10780
10775
  * @internal
@@ -12513,7 +12508,11 @@ var Vue = (function () {
12513
12508
  warn$1(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
12514
12509
  }
12515
12510
  return container;
12516
- }
12511
+ }
12512
+ /**
12513
+ * @internal
12514
+ */
12515
+ const initDirectivesForSSR = NOOP;
12517
12516
 
12518
12517
  var runtimeDom = /*#__PURE__*/Object.freeze({
12519
12518
  __proto__: null,
@@ -12521,6 +12520,7 @@ var Vue = (function () {
12521
12520
  hydrate: hydrate,
12522
12521
  createApp: createApp,
12523
12522
  createSSRApp: createSSRApp,
12523
+ initDirectivesForSSR: initDirectivesForSSR,
12524
12524
  defineCustomElement: defineCustomElement,
12525
12525
  defineSSRCustomElement: defineSSRCustomElement,
12526
12526
  VueElement: VueElement,