@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.
@@ -1530,14 +1530,7 @@ const hmrDirtyComponents = new Set();
1530
1530
  // Note: for a component to be eligible for HMR it also needs the __hmrId option
1531
1531
  // to be set so that its instances can be registered / removed.
1532
1532
  if ((process.env.NODE_ENV !== 'production')) {
1533
- const globalObject = typeof global !== 'undefined'
1534
- ? global
1535
- : typeof self !== 'undefined'
1536
- ? self
1537
- : typeof window !== 'undefined'
1538
- ? window
1539
- : {};
1540
- globalObject.__VUE_HMR_RUNTIME__ = {
1533
+ getGlobalThis().__VUE_HMR_RUNTIME__ = {
1541
1534
  createRecord: tryWrap(createRecord),
1542
1535
  rerender: tryWrap(rerender),
1543
1536
  reload: tryWrap(reload)
@@ -3632,7 +3625,7 @@ function defineAsyncComponent(source) {
3632
3625
  };
3633
3626
  // suspense-controlled or SSR.
3634
3627
  if ((suspensible && instance.suspense) ||
3635
- (false )) {
3628
+ (isInSSRComponentSetup)) {
3636
3629
  return load()
3637
3630
  .then(comp => {
3638
3631
  return () => createInnerComp(comp, instance);
@@ -5312,7 +5305,7 @@ function createCompatVue(createApp, createSingletonApp) {
5312
5305
  return vm;
5313
5306
  }
5314
5307
  }
5315
- Vue.version = "3.2.15";
5308
+ Vue.version = "3.2.19";
5316
5309
  Vue.config = singletonApp.config;
5317
5310
  Vue.use = (p, ...options) => {
5318
5311
  if (p && isFunction(p.install)) {
@@ -6261,20 +6254,22 @@ function isSupported() {
6261
6254
  * istanbul-ignore-next
6262
6255
  */
6263
6256
  function initFeatureFlags() {
6264
- let needWarn = false;
6257
+ const needWarn = [];
6265
6258
  if (typeof __VUE_OPTIONS_API__ !== 'boolean') {
6266
- needWarn = true;
6259
+ (process.env.NODE_ENV !== 'production') && needWarn.push(`__VUE_OPTIONS_API__`);
6267
6260
  getGlobalThis().__VUE_OPTIONS_API__ = true;
6268
6261
  }
6269
6262
  if (typeof __VUE_PROD_DEVTOOLS__ !== 'boolean') {
6270
- needWarn = true;
6263
+ (process.env.NODE_ENV !== 'production') && needWarn.push(`__VUE_PROD_DEVTOOLS__`);
6271
6264
  getGlobalThis().__VUE_PROD_DEVTOOLS__ = false;
6272
6265
  }
6273
- if ((process.env.NODE_ENV !== 'production') && needWarn) {
6274
- console.warn(`You are running the esm-bundler build of Vue. It is recommended to ` +
6275
- `configure your bundler to explicitly replace feature flag globals ` +
6276
- `with boolean literals to get proper tree-shaking in the final bundle. ` +
6277
- `See http://link.vuejs.org/feature-flags for more details.`);
6266
+ if ((process.env.NODE_ENV !== 'production') && needWarn.length) {
6267
+ const multi = needWarn.length > 1;
6268
+ console.warn(`Feature flag${multi ? `s` : ``} ${needWarn.join(', ')} ${multi ? `are` : `is`} not explicitly defined. You are running the esm-bundler build of Vue, ` +
6269
+ `which expects these compile-time feature flags to be globally injected ` +
6270
+ `via the bundler config in order to get better tree-shaking in the ` +
6271
+ `production bundle.\n\n` +
6272
+ `For more details, see http://link.vuejs.org/feature-flags.`);
6278
6273
  }
6279
6274
  }
6280
6275
 
@@ -9670,7 +9665,12 @@ function setupStatefulComponent(instance, isSSR) {
9670
9665
  function handleSetupResult(instance, setupResult, isSSR) {
9671
9666
  if (isFunction(setupResult)) {
9672
9667
  // setup returned an inline render function
9673
- {
9668
+ if (instance.type.__ssrInlineRender) {
9669
+ // when the function's name is `ssrRender` (compiled by SFC inline mode),
9670
+ // set it as ssrRender instead.
9671
+ instance.ssrRender = setupResult;
9672
+ }
9673
+ else {
9674
9674
  instance.render = setupResult;
9675
9675
  }
9676
9676
  }
@@ -9719,9 +9719,11 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
9719
9719
  }
9720
9720
  }
9721
9721
  // template / render function normalization
9722
+ // could be already set when returned from setup()
9722
9723
  if (!instance.render) {
9723
- // could be set from setup()
9724
- if (compile && !Component.render) {
9724
+ // only do on-the-fly compile if not in SSR - SSR on-the-fly compliation
9725
+ // is done by server-renderer
9726
+ if (!isSSR && compile && !Component.render) {
9725
9727
  const template = (instance.vnode.props &&
9726
9728
  instance.vnode.props['inline-template']) ||
9727
9729
  Component.template;
@@ -10431,6 +10433,23 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
10431
10433
  callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
10432
10434
  };
10433
10435
  };
10436
+ // in SSR there is no need to setup an actual effect, and it should be noop
10437
+ // unless it's eager
10438
+ if (isInSSRComponentSetup) {
10439
+ // we will also not call the invalidate callback (+ runner is not set up)
10440
+ onInvalidate = NOOP;
10441
+ if (!cb) {
10442
+ getter();
10443
+ }
10444
+ else if (immediate) {
10445
+ callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
10446
+ getter(),
10447
+ isMultiSource ? [] : undefined,
10448
+ onInvalidate
10449
+ ]);
10450
+ }
10451
+ return NOOP;
10452
+ }
10434
10453
  let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
10435
10454
  const job = () => {
10436
10455
  if (!effect.active) {
@@ -10967,7 +10986,7 @@ function isMemoSame(cached, memo) {
10967
10986
  }
10968
10987
 
10969
10988
  // Core API ------------------------------------------------------------------
10970
- const version = "3.2.15";
10989
+ const version = "3.2.19";
10971
10990
  const _ssrUtils = {
10972
10991
  createComponentInstance,
10973
10992
  setupComponent,
@@ -12469,6 +12488,31 @@ function callModelHook(el, binding, vnode, prevVNode, hook) {
12469
12488
  }
12470
12489
  const fn = modelToUse[hook];
12471
12490
  fn && fn(el, binding, vnode, prevVNode);
12491
+ }
12492
+ // SSR vnode transforms, only used when user includes client-oriented render
12493
+ // function in SSR
12494
+ function initVModelForSSR() {
12495
+ vModelText.getSSRProps = ({ value }) => ({ value });
12496
+ vModelRadio.getSSRProps = ({ value }, vnode) => {
12497
+ if (vnode.props && looseEqual(vnode.props.value, value)) {
12498
+ return { checked: true };
12499
+ }
12500
+ };
12501
+ vModelCheckbox.getSSRProps = ({ value }, vnode) => {
12502
+ if (isArray(value)) {
12503
+ if (vnode.props && looseIndexOf(value, vnode.props.value) > -1) {
12504
+ return { checked: true };
12505
+ }
12506
+ }
12507
+ else if (isSet(value)) {
12508
+ if (vnode.props && value.has(vnode.props.value)) {
12509
+ return { checked: true };
12510
+ }
12511
+ }
12512
+ else if (value) {
12513
+ return { checked: true };
12514
+ }
12515
+ };
12472
12516
  }
12473
12517
 
12474
12518
  const systemModifiers = ['ctrl', 'shift', 'alt', 'meta'];
@@ -12597,6 +12641,15 @@ const vShow = {
12597
12641
  };
12598
12642
  function setDisplay(el, value) {
12599
12643
  el.style.display = value ? el._vod : 'none';
12644
+ }
12645
+ // SSR vnode transforms, only used when user includes client-oriented render
12646
+ // function in SSR
12647
+ function initVShowForSSR() {
12648
+ vShow.getSSRProps = ({ value }) => {
12649
+ if (!value) {
12650
+ return { style: { display: 'none' } };
12651
+ }
12652
+ };
12600
12653
  }
12601
12654
 
12602
12655
  const rendererOptions = extend({ patchProp }, nodeOps);
@@ -12732,7 +12785,19 @@ function normalizeContainer(container) {
12732
12785
  warn$1(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
12733
12786
  }
12734
12787
  return container;
12735
- }
12788
+ }
12789
+ let ssrDirectiveInitialized = false;
12790
+ /**
12791
+ * @internal
12792
+ */
12793
+ const initDirectivesForSSR = () => {
12794
+ if (!ssrDirectiveInitialized) {
12795
+ ssrDirectiveInitialized = true;
12796
+ initVModelForSSR();
12797
+ initVShowForSSR();
12798
+ }
12799
+ }
12800
+ ;
12736
12801
 
12737
12802
  var runtimeDom = /*#__PURE__*/Object.freeze({
12738
12803
  __proto__: null,
@@ -12740,6 +12805,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12740
12805
  hydrate: hydrate,
12741
12806
  createApp: createApp,
12742
12807
  createSSRApp: createSSRApp,
12808
+ initDirectivesForSSR: initDirectivesForSSR,
12743
12809
  defineCustomElement: defineCustomElement,
12744
12810
  defineSSRCustomElement: defineSSRCustomElement,
12745
12811
  VueElement: VueElement,
@@ -15026,7 +15092,7 @@ function createStructuralDirectiveTransform(name, fn) {
15026
15092
  }
15027
15093
 
15028
15094
  const PURE_ANNOTATION = `/*#__PURE__*/`;
15029
- 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 }) {
15095
+ 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 }) {
15030
15096
  const context = {
15031
15097
  mode,
15032
15098
  prefixIdentifiers,
@@ -15036,6 +15102,7 @@ function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode
15036
15102
  optimizeImports,
15037
15103
  runtimeGlobalName,
15038
15104
  runtimeModuleName,
15105
+ ssrRuntimeModuleName,
15039
15106
  ssr,
15040
15107
  isTS,
15041
15108
  inSSR,
@@ -15161,7 +15228,7 @@ function generate(ast, options = {}) {
15161
15228
  };
15162
15229
  }
15163
15230
  function genFunctionPreamble(ast, context) {
15164
- const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName } = context;
15231
+ const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName, ssrRuntimeModuleName } = context;
15165
15232
  const VueBinding = runtimeGlobalName;
15166
15233
  const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
15167
15234
  // Generate const declaration for helpers
@@ -18046,4 +18113,4 @@ Vue.compile = compileToFunction;
18046
18113
  const { configureCompat: configureCompat$1 } = Vue;
18047
18114
 
18048
18115
  export default Vue;
18049
- 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 };
18116
+ 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 };
@@ -1516,14 +1516,7 @@ var Vue = (function () {
1516
1516
  // Note: for a component to be eligible for HMR it also needs the __hmrId option
1517
1517
  // to be set so that its instances can be registered / removed.
1518
1518
  {
1519
- const globalObject = typeof global !== 'undefined'
1520
- ? global
1521
- : typeof self !== 'undefined'
1522
- ? self
1523
- : typeof window !== 'undefined'
1524
- ? window
1525
- : {};
1526
- globalObject.__VUE_HMR_RUNTIME__ = {
1519
+ getGlobalThis().__VUE_HMR_RUNTIME__ = {
1527
1520
  createRecord: tryWrap(createRecord),
1528
1521
  rerender: tryWrap(rerender),
1529
1522
  reload: tryWrap(reload)
@@ -5285,7 +5278,7 @@ var Vue = (function () {
5285
5278
  return vm;
5286
5279
  }
5287
5280
  }
5288
- Vue.version = "3.2.15";
5281
+ Vue.version = "3.2.19";
5289
5282
  Vue.config = singletonApp.config;
5290
5283
  Vue.use = (p, ...options) => {
5291
5284
  if (p && isFunction(p.install)) {
@@ -9631,9 +9624,11 @@ var Vue = (function () {
9631
9624
  }
9632
9625
  }
9633
9626
  // template / render function normalization
9627
+ // could be already set when returned from setup()
9634
9628
  if (!instance.render) {
9635
- // could be set from setup()
9636
- if (compile && !Component.render) {
9629
+ // only do on-the-fly compile if not in SSR - SSR on-the-fly compliation
9630
+ // is done by server-renderer
9631
+ if (!isSSR && compile && !Component.render) {
9637
9632
  const template = (instance.vnode.props &&
9638
9633
  instance.vnode.props['inline-template']) ||
9639
9634
  Component.template;
@@ -10849,7 +10844,7 @@ var Vue = (function () {
10849
10844
  }
10850
10845
 
10851
10846
  // Core API ------------------------------------------------------------------
10852
- const version = "3.2.15";
10847
+ const version = "3.2.19";
10853
10848
  /**
10854
10849
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10855
10850
  * @internal
@@ -12588,7 +12583,11 @@ var Vue = (function () {
12588
12583
  warn$1(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
12589
12584
  }
12590
12585
  return container;
12591
- }
12586
+ }
12587
+ /**
12588
+ * @internal
12589
+ */
12590
+ const initDirectivesForSSR = NOOP;
12592
12591
 
12593
12592
  var runtimeDom = /*#__PURE__*/Object.freeze({
12594
12593
  __proto__: null,
@@ -12596,6 +12595,7 @@ var Vue = (function () {
12596
12595
  hydrate: hydrate,
12597
12596
  createApp: createApp,
12598
12597
  createSSRApp: createSSRApp,
12598
+ initDirectivesForSSR: initDirectivesForSSR,
12599
12599
  defineCustomElement: defineCustomElement,
12600
12600
  defineSSRCustomElement: defineSSRCustomElement,
12601
12601
  VueElement: VueElement,
@@ -14881,7 +14881,7 @@ var Vue = (function () {
14881
14881
  }
14882
14882
 
14883
14883
  const PURE_ANNOTATION = `/*#__PURE__*/`;
14884
- 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 }) {
14884
+ 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 }) {
14885
14885
  const context = {
14886
14886
  mode,
14887
14887
  prefixIdentifiers,
@@ -14891,6 +14891,7 @@ var Vue = (function () {
14891
14891
  optimizeImports,
14892
14892
  runtimeGlobalName,
14893
14893
  runtimeModuleName,
14894
+ ssrRuntimeModuleName,
14894
14895
  ssr,
14895
14896
  isTS,
14896
14897
  inSSR,
@@ -15016,7 +15017,7 @@ var Vue = (function () {
15016
15017
  };
15017
15018
  }
15018
15019
  function genFunctionPreamble(ast, context) {
15019
- const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName } = context;
15020
+ const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName, ssrRuntimeModuleName } = context;
15020
15021
  const VueBinding = runtimeGlobalName;
15021
15022
  const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
15022
15023
  // Generate const declaration for helpers