@uniformdev/next-app-router 20.7.1-alpha.123 → 20.7.1-alpha.136

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.
package/dist/index.js CHANGED
@@ -1431,6 +1431,9 @@ var CANVAS_EDITOR_STATE = 63;
1431
1431
  var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
1432
1432
  var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
1433
1433
  var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
1434
+ var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
1435
+ var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
1436
+ var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
1434
1437
  var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
1435
1438
  var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
1436
1439
  var PLACEHOLDER_ID = "placeholder";
@@ -1978,19 +1981,19 @@ var buildCompositionTag = (compositionId) => {
1978
1981
  return `composition:${compositionId}`.toLowerCase();
1979
1982
  };
1980
1983
 
1981
- // src/config/helpers.ts
1982
- var import_uniform_server = __toESM(require("uniform.server.config"));
1983
- var getServerConfig = () => {
1984
- return import_uniform_server.default;
1985
- };
1986
-
1987
1984
  // src/utils/draft.ts
1988
1985
  var isDraftModeEnabled = ({
1989
1986
  draftModeEnabled
1990
1987
  }) => {
1991
1988
  return draftModeEnabled;
1992
1989
  };
1993
- var isIncontextEditingEnabled = ({ searchParams }) => {
1990
+ var isIncontextEditingEnabled = ({
1991
+ isDraftModeEnabled: isDraftModeEnabled2,
1992
+ searchParams
1993
+ }) => {
1994
+ if (!isDraftModeEnabled2) {
1995
+ return false;
1996
+ }
1994
1997
  const containsKey = searchParams.has(IN_CONTEXT_EDITOR_QUERY_STRING_PARAM);
1995
1998
  return containsKey;
1996
1999
  };
@@ -1999,9 +2002,6 @@ var isDevelopmentEnvironment = () => {
1999
2002
  };
2000
2003
 
2001
2004
  // src/clients/cache.ts
2002
- var isSpecificCacheMode = (options) => {
2003
- return "cache" in options;
2004
- };
2005
2005
  var isStateCacheMode = (options) => {
2006
2006
  return "state" in options;
2007
2007
  };
@@ -2010,31 +2010,25 @@ var isDetectCacheMode = (options) => {
2010
2010
  };
2011
2011
  var resolveManifestCache = (options) => {
2012
2012
  return resolveCache({
2013
- options,
2014
- defaultCache: getServerConfig().manifestCache
2013
+ options
2015
2014
  });
2016
2015
  };
2017
2016
  var resolveCanvasCache = (options) => {
2018
2017
  return resolveCache({
2019
- options,
2020
- defaultCache: getServerConfig().canvasCache
2018
+ options
2021
2019
  });
2022
2020
  };
2023
2021
  var resolveProjectMapCache = (options) => {
2024
2022
  return resolveCache({
2025
- options,
2026
- defaultCache: getServerConfig().projectMapCache
2023
+ options
2027
2024
  });
2028
2025
  };
2029
2026
  var resolveCache = ({
2030
- options,
2031
- defaultCache
2027
+ options
2032
2028
  }) => {
2033
- let cache2 = defaultCache;
2029
+ let cache2 = void 0;
2034
2030
  if (options) {
2035
- if (isSpecificCacheMode(options)) {
2036
- cache2 = options.cache;
2037
- } else if (isStateCacheMode(options)) {
2031
+ if (isStateCacheMode(options)) {
2038
2032
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
2039
2033
  cache2 = {
2040
2034
  type: "no-cache",
@@ -2059,7 +2053,10 @@ var shouldCacheBeDisabled = (options) => {
2059
2053
  if (isDraftModeEnabled(options)) {
2060
2054
  return { disabled: true, reason: "DRAFT" };
2061
2055
  }
2062
- if (isIncontextEditingEnabled(options)) {
2056
+ if (isIncontextEditingEnabled({
2057
+ isDraftModeEnabled: options.draftModeEnabled,
2058
+ searchParams: options.searchParams
2059
+ })) {
2063
2060
  return { disabled: true, reason: "INCONTEXT" };
2064
2061
  }
2065
2062
  if (isDevelopmentEnvironment()) {
@@ -2822,7 +2819,6 @@ var Test = ({ index, slots, test, component, context: compositionContext }) => {
2822
2819
  const indexToShow = typeof index === "number" ? (_b = (_a = slots == null ? void 0 : slots[CANVAS_TEST_SLOT]) == null ? void 0 : _a.items[index]) != null ? _b : null : null;
2823
2820
  const event = {
2824
2821
  name: test.name,
2825
- // todo: add Control Group support
2826
2822
  control: (_d = (_c = test.variations[index]) == null ? void 0 : _c.control) != null ? _d : false,
2827
2823
  variantAssigned: true,
2828
2824
  variantId: (_f = (_e = test.variations[index]) == null ? void 0 : _e.id) != null ? _f : "NO_VARIANTS",
@@ -2854,8 +2850,45 @@ var UniformCompositionWrapper = ({
2854
2850
  // src/components/UniformContext.tsx
2855
2851
  var import_next_app_router_client2 = require("@uniformdev/next-app-router-client");
2856
2852
  var import_react4 = __toESM(require("react"));
2853
+
2854
+ // src/config/helpers.ts
2855
+ var import_resolved = __toESM(require("@uniformdev/next-app-router/config/resolved"));
2856
+ var getDisabledDevTools = () => {
2857
+ var _a;
2858
+ if (typeof ((_a = import_resolved.default.context) == null ? void 0 : _a.disableDevTools) === "boolean") {
2859
+ return import_resolved.default.context.disableDevTools;
2860
+ }
2861
+ return false;
2862
+ };
2863
+ var getDefaultConsent = () => {
2864
+ if (typeof import_resolved.default.defaultConsent === "boolean") {
2865
+ return import_resolved.default.defaultConsent;
2866
+ }
2867
+ return false;
2868
+ };
2869
+ var getQuirkSerialization = () => {
2870
+ if (typeof import_resolved.default.quirkSerialization === "boolean") {
2871
+ return import_resolved.default.quirkSerialization;
2872
+ }
2873
+ return true;
2874
+ };
2875
+ var getMiddlewareRuntimeCache = () => {
2876
+ if (typeof import_resolved.default.middlewareRuntimeCache === "boolean") {
2877
+ return import_resolved.default.middlewareRuntimeCache;
2878
+ }
2879
+ return true;
2880
+ };
2881
+ var getDisableSwrMiddlewareCache = () => {
2882
+ var _a;
2883
+ if (typeof ((_a = import_resolved.default.experimental) == null ? void 0 : _a.disableSwrMiddlewareCache) === "boolean") {
2884
+ return import_resolved.default.experimental.disableSwrMiddlewareCache;
2885
+ }
2886
+ return false;
2887
+ };
2888
+
2889
+ // src/components/UniformContext.tsx
2857
2890
  var UniformContext = async ({ clientContextComponent, result }) => {
2858
- var _a, _b, _c, _d;
2891
+ var _a;
2859
2892
  const manifest = await getManifest({
2860
2893
  state: CANVAS_PUBLISHED_STATE
2861
2894
  });
@@ -2866,10 +2899,9 @@ var UniformContext = async ({ clientContextComponent, result }) => {
2866
2899
  matchedRoute: route.matchedRoute
2867
2900
  } : void 0;
2868
2901
  const ContextComponent = clientContextComponent || import_next_app_router_client2.DefaultUniformClientContext;
2869
- const serverConfig2 = getServerConfig();
2870
- const disableDevTools = ((_a = serverConfig2.context) == null ? void 0 : _a.disableDevTools) || false;
2871
- const defaultConsent = (_c = (_b = result == null ? void 0 : result.pageState.defaultConsent) != null ? _b : serverConfig2.defaultConsent) != null ? _c : false;
2872
- const experimentalQuirkSerialization = ((_d = serverConfig2.experimental) == null ? void 0 : _d.quirkSerialization) || false;
2902
+ const disableDevTools = getDisabledDevTools();
2903
+ const defaultConsent = (_a = result == null ? void 0 : result.pageState.defaultConsent) != null ? _a : getDefaultConsent();
2904
+ const experimentalQuirkSerialization = getQuirkSerialization();
2873
2905
  return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(
2874
2906
  ContextComponent,
2875
2907
  {
@@ -2903,11 +2935,13 @@ async function UniformCompositionInner({
2903
2935
  resolveComponent,
2904
2936
  resolveEmptyPlaceholder,
2905
2937
  compositionCache,
2906
- clientContextComponent
2938
+ clientContextComponent,
2939
+ dataClient
2907
2940
  }) {
2908
2941
  var _a, _b;
2909
2942
  const result = await resolveRoute({
2910
- code
2943
+ code,
2944
+ dataClient
2911
2945
  });
2912
2946
  if (!(result == null ? void 0 : result.route) || ((_a = result == null ? void 0 : result.route) == null ? void 0 : _a.type) !== "composition") {
2913
2947
  (0, import_navigation.notFound)();
@@ -3588,7 +3622,7 @@ function permutationsWithoutRepetition(options, k) {
3588
3622
  }
3589
3623
  function combineAcrossGroups(perGroupSelections) {
3590
3624
  return perGroupSelections.reduce(
3591
- (acc, group) => acc.flatMap((config) => group.map((selection) => [...config, selection])),
3625
+ (acc, group) => acc.flatMap((config2) => group.map((selection) => [...config2, selection])),
3592
3626
  [[]]
3593
3627
  );
3594
3628
  }
@@ -3602,8 +3636,7 @@ var import_functions = require("@vercel/functions");
3602
3636
  var MANIFEST_CACHE_KEY = "uniform-manifest";
3603
3637
  var DefaultDataClient = class {
3604
3638
  async getManifest(options) {
3605
- var _a, _b;
3606
- const cache2 = options.source === "middleware" && ((_b = (_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) != null ? _b : false) ? (0, import_functions.getCache)() : null;
3639
+ const cache2 = options.source === "middleware" && getMiddlewareRuntimeCache() ? (0, import_functions.getCache)() : null;
3607
3640
  if (cache2) {
3608
3641
  const cachedManifest = await cache2.get(MANIFEST_CACHE_KEY);
3609
3642
  if (cachedManifest) {
@@ -3689,18 +3722,16 @@ var DefaultDataClient = class {
3689
3722
  async enhanceRoute(_options) {
3690
3723
  }
3691
3724
  async getRouteMiddleware(options) {
3692
- var _a, _b, _c, _d;
3693
3725
  const routeClient = getRouteClient({
3694
3726
  searchParams: options.searchParams,
3695
3727
  draftModeEnabled: options.draftModeEnabled
3696
3728
  });
3697
- const config = getServerConfig();
3698
3729
  const resolvedRoute = await this.getRouteFromApi({
3699
3730
  source: "middleware",
3700
3731
  route: options.route,
3701
3732
  routeClient,
3702
- enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && ((_b = (_a = config.experimental) == null ? void 0 : _a.middlewareRuntimeCache) != null ? _b : false),
3703
- disableSwrCache: (_d = (_c = config.experimental) == null ? void 0 : _c.disableSwrMiddlewareCache) != null ? _d : false
3733
+ enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache(),
3734
+ disableSwrCache: getDisableSwrMiddlewareCache()
3704
3735
  });
3705
3736
  if (resolvedRoute.type === "composition") {
3706
3737
  await this.enhanceRoute({
@@ -3716,12 +3747,12 @@ var DefaultDataClient = class {
3716
3747
  };
3717
3748
  }
3718
3749
  async getRoutePageState(options) {
3719
- var _a;
3720
3750
  const routeClient = getRouteClient({
3721
- cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? (_a = getServerConfig().canvasCache) != null ? _a : {
3751
+ cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
3722
3752
  type: "force-cache"
3723
3753
  } : {
3724
- type: "no-cache"
3754
+ type: "no-cache",
3755
+ bypassCache: true
3725
3756
  }
3726
3757
  });
3727
3758
  const originalRoute = {
@@ -3753,8 +3784,7 @@ var DefaultDataClient = class {
3753
3784
  }
3754
3785
  };
3755
3786
  var expireMiddlewareCacheTag = async (tag) => {
3756
- var _a;
3757
- const cache2 = ((_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) ? (0, import_functions.getCache)() : null;
3787
+ const cache2 = getMiddlewareRuntimeCache() ? (0, import_functions.getCache)() : null;
3758
3788
  if (cache2) {
3759
3789
  await cache2.expireTag(tag);
3760
3790
  } else {
package/dist/index.mjs CHANGED
@@ -1404,6 +1404,9 @@ var CANVAS_EDITOR_STATE = 63;
1404
1404
  var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
1405
1405
  var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
1406
1406
  var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
1407
+ var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
1408
+ var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
1409
+ var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
1407
1410
  var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
1408
1411
  var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
1409
1412
  var PLACEHOLDER_ID = "placeholder";
@@ -1951,19 +1954,19 @@ var buildCompositionTag = (compositionId) => {
1951
1954
  return `composition:${compositionId}`.toLowerCase();
1952
1955
  };
1953
1956
 
1954
- // src/config/helpers.ts
1955
- import serverConfig from "uniform.server.config";
1956
- var getServerConfig = () => {
1957
- return serverConfig;
1958
- };
1959
-
1960
1957
  // src/utils/draft.ts
1961
1958
  var isDraftModeEnabled = ({
1962
1959
  draftModeEnabled
1963
1960
  }) => {
1964
1961
  return draftModeEnabled;
1965
1962
  };
1966
- var isIncontextEditingEnabled = ({ searchParams }) => {
1963
+ var isIncontextEditingEnabled = ({
1964
+ isDraftModeEnabled: isDraftModeEnabled2,
1965
+ searchParams
1966
+ }) => {
1967
+ if (!isDraftModeEnabled2) {
1968
+ return false;
1969
+ }
1967
1970
  const containsKey = searchParams.has(IN_CONTEXT_EDITOR_QUERY_STRING_PARAM);
1968
1971
  return containsKey;
1969
1972
  };
@@ -1972,9 +1975,6 @@ var isDevelopmentEnvironment = () => {
1972
1975
  };
1973
1976
 
1974
1977
  // src/clients/cache.ts
1975
- var isSpecificCacheMode = (options) => {
1976
- return "cache" in options;
1977
- };
1978
1978
  var isStateCacheMode = (options) => {
1979
1979
  return "state" in options;
1980
1980
  };
@@ -1983,31 +1983,25 @@ var isDetectCacheMode = (options) => {
1983
1983
  };
1984
1984
  var resolveManifestCache = (options) => {
1985
1985
  return resolveCache({
1986
- options,
1987
- defaultCache: getServerConfig().manifestCache
1986
+ options
1988
1987
  });
1989
1988
  };
1990
1989
  var resolveCanvasCache = (options) => {
1991
1990
  return resolveCache({
1992
- options,
1993
- defaultCache: getServerConfig().canvasCache
1991
+ options
1994
1992
  });
1995
1993
  };
1996
1994
  var resolveProjectMapCache = (options) => {
1997
1995
  return resolveCache({
1998
- options,
1999
- defaultCache: getServerConfig().projectMapCache
1996
+ options
2000
1997
  });
2001
1998
  };
2002
1999
  var resolveCache = ({
2003
- options,
2004
- defaultCache
2000
+ options
2005
2001
  }) => {
2006
- let cache2 = defaultCache;
2002
+ let cache2 = void 0;
2007
2003
  if (options) {
2008
- if (isSpecificCacheMode(options)) {
2009
- cache2 = options.cache;
2010
- } else if (isStateCacheMode(options)) {
2004
+ if (isStateCacheMode(options)) {
2011
2005
  if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
2012
2006
  cache2 = {
2013
2007
  type: "no-cache",
@@ -2032,7 +2026,10 @@ var shouldCacheBeDisabled = (options) => {
2032
2026
  if (isDraftModeEnabled(options)) {
2033
2027
  return { disabled: true, reason: "DRAFT" };
2034
2028
  }
2035
- if (isIncontextEditingEnabled(options)) {
2029
+ if (isIncontextEditingEnabled({
2030
+ isDraftModeEnabled: options.draftModeEnabled,
2031
+ searchParams: options.searchParams
2032
+ })) {
2036
2033
  return { disabled: true, reason: "INCONTEXT" };
2037
2034
  }
2038
2035
  if (isDevelopmentEnvironment()) {
@@ -2799,7 +2796,6 @@ var Test = ({ index, slots, test, component, context: compositionContext }) => {
2799
2796
  const indexToShow = typeof index === "number" ? (_b = (_a = slots == null ? void 0 : slots[CANVAS_TEST_SLOT]) == null ? void 0 : _a.items[index]) != null ? _b : null : null;
2800
2797
  const event = {
2801
2798
  name: test.name,
2802
- // todo: add Control Group support
2803
2799
  control: (_d = (_c = test.variations[index]) == null ? void 0 : _c.control) != null ? _d : false,
2804
2800
  variantAssigned: true,
2805
2801
  variantId: (_f = (_e = test.variations[index]) == null ? void 0 : _e.id) != null ? _f : "NO_VARIANTS",
@@ -2831,8 +2827,45 @@ var UniformCompositionWrapper = ({
2831
2827
  // src/components/UniformContext.tsx
2832
2828
  import { DefaultUniformClientContext } from "@uniformdev/next-app-router-client";
2833
2829
  import React3 from "react";
2830
+
2831
+ // src/config/helpers.ts
2832
+ import config from "@uniformdev/next-app-router/config/resolved";
2833
+ var getDisabledDevTools = () => {
2834
+ var _a;
2835
+ if (typeof ((_a = config.context) == null ? void 0 : _a.disableDevTools) === "boolean") {
2836
+ return config.context.disableDevTools;
2837
+ }
2838
+ return false;
2839
+ };
2840
+ var getDefaultConsent = () => {
2841
+ if (typeof config.defaultConsent === "boolean") {
2842
+ return config.defaultConsent;
2843
+ }
2844
+ return false;
2845
+ };
2846
+ var getQuirkSerialization = () => {
2847
+ if (typeof config.quirkSerialization === "boolean") {
2848
+ return config.quirkSerialization;
2849
+ }
2850
+ return true;
2851
+ };
2852
+ var getMiddlewareRuntimeCache = () => {
2853
+ if (typeof config.middlewareRuntimeCache === "boolean") {
2854
+ return config.middlewareRuntimeCache;
2855
+ }
2856
+ return true;
2857
+ };
2858
+ var getDisableSwrMiddlewareCache = () => {
2859
+ var _a;
2860
+ if (typeof ((_a = config.experimental) == null ? void 0 : _a.disableSwrMiddlewareCache) === "boolean") {
2861
+ return config.experimental.disableSwrMiddlewareCache;
2862
+ }
2863
+ return false;
2864
+ };
2865
+
2866
+ // src/components/UniformContext.tsx
2834
2867
  var UniformContext = async ({ clientContextComponent, result }) => {
2835
- var _a, _b, _c, _d;
2868
+ var _a;
2836
2869
  const manifest = await getManifest({
2837
2870
  state: CANVAS_PUBLISHED_STATE
2838
2871
  });
@@ -2843,10 +2876,9 @@ var UniformContext = async ({ clientContextComponent, result }) => {
2843
2876
  matchedRoute: route.matchedRoute
2844
2877
  } : void 0;
2845
2878
  const ContextComponent = clientContextComponent || DefaultUniformClientContext;
2846
- const serverConfig2 = getServerConfig();
2847
- const disableDevTools = ((_a = serverConfig2.context) == null ? void 0 : _a.disableDevTools) || false;
2848
- const defaultConsent = (_c = (_b = result == null ? void 0 : result.pageState.defaultConsent) != null ? _b : serverConfig2.defaultConsent) != null ? _c : false;
2849
- const experimentalQuirkSerialization = ((_d = serverConfig2.experimental) == null ? void 0 : _d.quirkSerialization) || false;
2879
+ const disableDevTools = getDisabledDevTools();
2880
+ const defaultConsent = (_a = result == null ? void 0 : result.pageState.defaultConsent) != null ? _a : getDefaultConsent();
2881
+ const experimentalQuirkSerialization = getQuirkSerialization();
2850
2882
  return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
2851
2883
  ContextComponent,
2852
2884
  {
@@ -2880,11 +2912,13 @@ async function UniformCompositionInner({
2880
2912
  resolveComponent,
2881
2913
  resolveEmptyPlaceholder,
2882
2914
  compositionCache,
2883
- clientContextComponent
2915
+ clientContextComponent,
2916
+ dataClient
2884
2917
  }) {
2885
2918
  var _a, _b;
2886
2919
  const result = await resolveRoute({
2887
- code
2920
+ code,
2921
+ dataClient
2888
2922
  });
2889
2923
  if (!(result == null ? void 0 : result.route) || ((_a = result == null ? void 0 : result.route) == null ? void 0 : _a.type) !== "composition") {
2890
2924
  notFound();
@@ -3567,7 +3601,7 @@ function permutationsWithoutRepetition(options, k) {
3567
3601
  }
3568
3602
  function combineAcrossGroups(perGroupSelections) {
3569
3603
  return perGroupSelections.reduce(
3570
- (acc, group) => acc.flatMap((config) => group.map((selection) => [...config, selection])),
3604
+ (acc, group) => acc.flatMap((config2) => group.map((selection) => [...config2, selection])),
3571
3605
  [[]]
3572
3606
  );
3573
3607
  }
@@ -3581,8 +3615,7 @@ import { getCache, waitUntil } from "@vercel/functions";
3581
3615
  var MANIFEST_CACHE_KEY = "uniform-manifest";
3582
3616
  var DefaultDataClient = class {
3583
3617
  async getManifest(options) {
3584
- var _a, _b;
3585
- const cache2 = options.source === "middleware" && ((_b = (_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) != null ? _b : false) ? getCache() : null;
3618
+ const cache2 = options.source === "middleware" && getMiddlewareRuntimeCache() ? getCache() : null;
3586
3619
  if (cache2) {
3587
3620
  const cachedManifest = await cache2.get(MANIFEST_CACHE_KEY);
3588
3621
  if (cachedManifest) {
@@ -3668,18 +3701,16 @@ var DefaultDataClient = class {
3668
3701
  async enhanceRoute(_options) {
3669
3702
  }
3670
3703
  async getRouteMiddleware(options) {
3671
- var _a, _b, _c, _d;
3672
3704
  const routeClient = getRouteClient({
3673
3705
  searchParams: options.searchParams,
3674
3706
  draftModeEnabled: options.draftModeEnabled
3675
3707
  });
3676
- const config = getServerConfig();
3677
3708
  const resolvedRoute = await this.getRouteFromApi({
3678
3709
  source: "middleware",
3679
3710
  route: options.route,
3680
3711
  routeClient,
3681
- enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && ((_b = (_a = config.experimental) == null ? void 0 : _a.middlewareRuntimeCache) != null ? _b : false),
3682
- disableSwrCache: (_d = (_c = config.experimental) == null ? void 0 : _c.disableSwrMiddlewareCache) != null ? _d : false
3712
+ enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache(),
3713
+ disableSwrCache: getDisableSwrMiddlewareCache()
3683
3714
  });
3684
3715
  if (resolvedRoute.type === "composition") {
3685
3716
  await this.enhanceRoute({
@@ -3695,12 +3726,12 @@ var DefaultDataClient = class {
3695
3726
  };
3696
3727
  }
3697
3728
  async getRoutePageState(options) {
3698
- var _a;
3699
3729
  const routeClient = getRouteClient({
3700
- cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? (_a = getServerConfig().canvasCache) != null ? _a : {
3730
+ cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
3701
3731
  type: "force-cache"
3702
3732
  } : {
3703
- type: "no-cache"
3733
+ type: "no-cache",
3734
+ bypassCache: true
3704
3735
  }
3705
3736
  });
3706
3737
  const originalRoute = {
@@ -3732,8 +3763,7 @@ var DefaultDataClient = class {
3732
3763
  }
3733
3764
  };
3734
3765
  var expireMiddlewareCacheTag = async (tag) => {
3735
- var _a;
3736
- const cache2 = ((_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) ? getCache() : null;
3766
+ const cache2 = getMiddlewareRuntimeCache() ? getCache() : null;
3737
3767
  if (cache2) {
3738
3768
  await cache2.expireTag(tag);
3739
3769
  } else {