@uniformdev/next-app-router 20.7.1-alpha.134 → 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.
@@ -2563,15 +2563,46 @@ var getCanvasClient = (options) => {
2563
2563
  };
2564
2564
 
2565
2565
  // src/config/helpers.ts
2566
- var import_uniform_server = __toESM(require("uniform.server.config"));
2566
+ var import_resolved = __toESM(require("@uniformdev/next-app-router/config/resolved"));
2567
2567
  var getServerConfig = () => {
2568
- return import_uniform_server.default;
2568
+ return import_resolved.default;
2569
+ };
2570
+ var getDefaultConsent = () => {
2571
+ if (typeof import_resolved.default.defaultConsent === "boolean") {
2572
+ return import_resolved.default.defaultConsent;
2573
+ }
2574
+ return false;
2575
+ };
2576
+ var getQuirkSerialization = () => {
2577
+ if (typeof import_resolved.default.quirkSerialization === "boolean") {
2578
+ return import_resolved.default.quirkSerialization;
2579
+ }
2580
+ return true;
2581
+ };
2582
+ var getMiddlewareRuntimeCache = () => {
2583
+ if (typeof import_resolved.default.middlewareRuntimeCache === "boolean") {
2584
+ return import_resolved.default.middlewareRuntimeCache;
2585
+ }
2586
+ return true;
2587
+ };
2588
+ var getPlaygroundPath = () => {
2589
+ if (typeof import_resolved.default.playgroundPath === "string") {
2590
+ return import_resolved.default.playgroundPath;
2591
+ }
2592
+ return "/uniform/playground";
2593
+ };
2594
+ var getDisableSwrMiddlewareCache = () => {
2595
+ var _a;
2596
+ if (typeof ((_a = import_resolved.default.experimental) == null ? void 0 : _a.disableSwrMiddlewareCache) === "boolean") {
2597
+ return import_resolved.default.experimental.disableSwrMiddlewareCache;
2598
+ }
2599
+ return false;
2569
2600
  };
2570
2601
 
2571
2602
  // src/data/client.ts
2572
2603
  var import_functions = require("@vercel/functions");
2573
2604
 
2574
- // src/clients/route.ts
2605
+ // src/clients/manifest.ts
2575
2606
  var import_server_only2 = require("server-only");
2576
2607
 
2577
2608
  // src/clients/tags.ts
@@ -2592,7 +2623,47 @@ var generateManifestCacheTags = () => {
2592
2623
  return ["manifest"];
2593
2624
  };
2594
2625
 
2626
+ // src/clients/manifest.ts
2627
+ var getManifestClient = (options) => {
2628
+ const cache = resolveManifestCache(options);
2629
+ const manifestClient = new ManifestClient({
2630
+ apiHost: env.getApiHost(),
2631
+ apiKey: env.getApiKey(),
2632
+ projectId: env.getProjectId(),
2633
+ limitPolicy: createLimitPolicy2({
2634
+ limit: 6
2635
+ }),
2636
+ fetch: (req, init2) => {
2637
+ const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
2638
+ return fetch(req, {
2639
+ ...init2,
2640
+ headers: {
2641
+ ...init2 == null ? void 0 : init2.headers,
2642
+ "x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
2643
+ },
2644
+ cache: fetchCache,
2645
+ next: {
2646
+ revalidate,
2647
+ tags: generateManifestCacheTags()
2648
+ }
2649
+ });
2650
+ }
2651
+ });
2652
+ return manifestClient;
2653
+ };
2654
+ var getManifest = async (options) => {
2655
+ let preview = false;
2656
+ if (options && isStateCacheMode(options)) {
2657
+ preview = options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE;
2658
+ }
2659
+ const manifestClient = getManifestClient(options);
2660
+ return manifestClient.get({
2661
+ preview
2662
+ });
2663
+ };
2664
+
2595
2665
  // src/clients/route.ts
2666
+ var import_server_only3 = require("server-only");
2596
2667
  var getRouteCacheTags = (requestedUrl) => {
2597
2668
  const tags = ["route"];
2598
2669
  if (requestedUrl) {
@@ -2642,52 +2713,11 @@ var getRouteClient = (options) => {
2642
2713
  return client;
2643
2714
  };
2644
2715
 
2645
- // src/clients/manifest.ts
2646
- var import_server_only3 = require("server-only");
2647
- var getManifestClient = (options) => {
2648
- const cache = resolveManifestCache(options);
2649
- const manifestClient = new ManifestClient({
2650
- apiHost: env.getApiHost(),
2651
- apiKey: env.getApiKey(),
2652
- projectId: env.getProjectId(),
2653
- limitPolicy: createLimitPolicy2({
2654
- limit: 6
2655
- }),
2656
- fetch: (req, init2) => {
2657
- const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
2658
- return fetch(req, {
2659
- ...init2,
2660
- headers: {
2661
- ...init2 == null ? void 0 : init2.headers,
2662
- "x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
2663
- },
2664
- cache: fetchCache,
2665
- next: {
2666
- revalidate,
2667
- tags: generateManifestCacheTags()
2668
- }
2669
- });
2670
- }
2671
- });
2672
- return manifestClient;
2673
- };
2674
- var getManifest = async (options) => {
2675
- let preview = false;
2676
- if (options && isStateCacheMode(options)) {
2677
- preview = options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE;
2678
- }
2679
- const manifestClient = getManifestClient(options);
2680
- return manifestClient.get({
2681
- preview
2682
- });
2683
- };
2684
-
2685
2716
  // src/data/client.ts
2686
2717
  var MANIFEST_CACHE_KEY = "uniform-manifest";
2687
2718
  var DefaultDataClient = class {
2688
2719
  async getManifest(options) {
2689
- var _a, _b;
2690
- const cache = options.source === "middleware" && ((_b = (_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) != null ? _b : false) ? (0, import_functions.getCache)() : null;
2720
+ const cache = options.source === "middleware" && getMiddlewareRuntimeCache() ? (0, import_functions.getCache)() : null;
2691
2721
  if (cache) {
2692
2722
  const cachedManifest = await cache.get(MANIFEST_CACHE_KEY);
2693
2723
  if (cachedManifest) {
@@ -2773,18 +2803,16 @@ var DefaultDataClient = class {
2773
2803
  async enhanceRoute(_options3) {
2774
2804
  }
2775
2805
  async getRouteMiddleware(options) {
2776
- var _a, _b, _c, _d;
2777
2806
  const routeClient = getRouteClient({
2778
2807
  searchParams: options.searchParams,
2779
2808
  draftModeEnabled: options.draftModeEnabled
2780
2809
  });
2781
- const config = getServerConfig();
2782
2810
  const resolvedRoute = await this.getRouteFromApi({
2783
2811
  source: "middleware",
2784
2812
  route: options.route,
2785
2813
  routeClient,
2786
- enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && ((_b = (_a = config.experimental) == null ? void 0 : _a.middlewareRuntimeCache) != null ? _b : false),
2787
- disableSwrCache: (_d = (_c = config.experimental) == null ? void 0 : _c.disableSwrMiddlewareCache) != null ? _d : false
2814
+ enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache(),
2815
+ disableSwrCache: getDisableSwrMiddlewareCache()
2788
2816
  });
2789
2817
  if (resolvedRoute.type === "composition") {
2790
2818
  await this.enhanceRoute({
@@ -5269,18 +5297,17 @@ var OnDemandContext = class {
5269
5297
  __privateSet(this, _options2, options);
5270
5298
  }
5271
5299
  async getContext() {
5272
- var _a, _b, _c, _d, _e;
5300
+ var _a, _b, _c;
5273
5301
  if (!this._context) {
5274
5302
  const uniformCookie = __privateGet(this, _options2).cookies.get(UNIFORM_DEFAULT_COOKIE_NAME);
5275
5303
  const quirkCookie = __privateGet(this, _options2).cookies.get(UNIFORM_DEFAULT_QUIRK_COOKIE_NAME);
5276
- const serverConfig2 = getServerConfig();
5277
5304
  this._context = new Context({
5278
5305
  manifest: __privateGet(this, _options2).manifest,
5279
- defaultConsent: (_b = (_a = __privateGet(this, _options2).defaultConsent) != null ? _a : serverConfig2.defaultConsent) != null ? _b : false,
5306
+ defaultConsent: (_a = __privateGet(this, _options2).defaultConsent) != null ? _a : getDefaultConsent(),
5280
5307
  transitionStore: new CookieTransitionDataStore({
5281
- serverCookieValue: (_c = uniformCookie == null ? void 0 : uniformCookie.value) != null ? _c : "",
5282
- experimental_quirksEnabled: (_d = serverConfig2.experimental) == null ? void 0 : _d.quirkSerialization,
5283
- quirkCookieValue: (_e = quirkCookie == null ? void 0 : quirkCookie.value) != null ? _e : ""
5308
+ serverCookieValue: (_b = uniformCookie == null ? void 0 : uniformCookie.value) != null ? _b : "",
5309
+ experimental_quirksEnabled: getQuirkSerialization(),
5310
+ quirkCookieValue: (_c = quirkCookie == null ? void 0 : quirkCookie.value) != null ? _c : ""
5284
5311
  })
5285
5312
  });
5286
5313
  }
@@ -5435,7 +5462,7 @@ var handlePlaygroundRequest = async ({
5435
5462
  options,
5436
5463
  dataClient
5437
5464
  }) => {
5438
- var _a, _b, _c;
5465
+ var _a, _b;
5439
5466
  const id = request.nextUrl.searchParams.get("id");
5440
5467
  if (!id) {
5441
5468
  return import_server.NextResponse.json(
@@ -5475,12 +5502,13 @@ var handlePlaygroundRequest = async ({
5475
5502
  { status: 404 }
5476
5503
  );
5477
5504
  }
5478
- const serverConfig2 = getServerConfig();
5505
+ const serverConfig = getServerConfig();
5506
+ const playgroundPath = getPlaygroundPath();
5479
5507
  const onDemandContext = await createOnDemandContext({
5480
5508
  cookies: request.cookies,
5481
5509
  dataClient,
5482
5510
  defaultConsent: determineDefaultConsent({
5483
- serverConfig: serverConfig2,
5511
+ serverConfig,
5484
5512
  defaultConsent: options.defaultConsent
5485
5513
  })
5486
5514
  });
@@ -5494,7 +5522,7 @@ var handlePlaygroundRequest = async ({
5494
5522
  dynamicInputs: {},
5495
5523
  releaseId: (_a = options.release) == null ? void 0 : _a.id,
5496
5524
  defaultConsent: determineDefaultConsent({
5497
- serverConfig: serverConfig2,
5525
+ serverConfig,
5498
5526
  defaultConsent: options.defaultConsent
5499
5527
  }),
5500
5528
  keys: void 0,
@@ -5511,7 +5539,7 @@ var handlePlaygroundRequest = async ({
5511
5539
  keys: void 0,
5512
5540
  releaseId: (_b = options.release) == null ? void 0 : _b.id,
5513
5541
  defaultConsent: determineDefaultConsent({
5514
- serverConfig: serverConfig2,
5542
+ serverConfig,
5515
5543
  defaultConsent: options.defaultConsent
5516
5544
  }),
5517
5545
  previewMode: determinePreviewMode({
@@ -5527,7 +5555,7 @@ var handlePlaygroundRequest = async ({
5527
5555
  });
5528
5556
  let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "playground" }) : void 0);
5529
5557
  if (!pathToRewriteTo) {
5530
- pathToRewriteTo = `${serverConfig2.playgroundPath}${((_c = serverConfig2.playgroundPath) == null ? void 0 : _c.endsWith("/")) ? "" : "/"}${code}`;
5558
+ pathToRewriteTo = `${playgroundPath}${(playgroundPath == null ? void 0 : playgroundPath.endsWith("/")) ? "" : "/"}${code}`;
5531
5559
  }
5532
5560
  return import_server.NextResponse.rewrite(new URL(pathToRewriteTo, request.nextUrl.origin));
5533
5561
  };
@@ -5548,7 +5576,7 @@ var handleRouteRequest = async ({
5548
5576
  }))) != null ? _b : {
5549
5577
  path: `${request.nextUrl.pathname}${request.nextUrl.search}`
5550
5578
  };
5551
- const serverConfig2 = getServerConfig();
5579
+ const serverConfig = getServerConfig();
5552
5580
  const [routeResult, onDemandContext] = await Promise.all([
5553
5581
  resolveRoute({
5554
5582
  path: requestPath.path,
@@ -5563,7 +5591,7 @@ var handleRouteRequest = async ({
5563
5591
  cookies: request.cookies,
5564
5592
  dataClient,
5565
5593
  defaultConsent: determineDefaultConsent({
5566
- serverConfig: serverConfig2,
5594
+ serverConfig,
5567
5595
  defaultConsent: options.defaultConsent
5568
5596
  })
5569
5597
  })
@@ -5613,7 +5641,7 @@ var handleRouteRequest = async ({
5613
5641
  dynamicInputs: (_f = route.dynamicInputs) != null ? _f : {},
5614
5642
  releaseId: (_g = options.release) == null ? void 0 : _g.id,
5615
5643
  defaultConsent: determineDefaultConsent({
5616
- serverConfig: serverConfig2,
5644
+ serverConfig,
5617
5645
  defaultConsent: options.defaultConsent
5618
5646
  }),
5619
5647
  keys: requestPath.keys,
@@ -5630,7 +5658,7 @@ var handleRouteRequest = async ({
5630
5658
  keys: requestPath.keys,
5631
5659
  releaseId: (_h = options.release) == null ? void 0 : _h.id,
5632
5660
  defaultConsent: determineDefaultConsent({
5633
- serverConfig: serverConfig2,
5661
+ serverConfig,
5634
5662
  defaultConsent: options.defaultConsent
5635
5663
  }),
5636
5664
  previewMode,
@@ -5729,8 +5757,8 @@ var buildRoutePath = ({
5729
5757
  }
5730
5758
  return ((_b2 = (_a2 = node.locales) == null ? void 0 : _a2[locale]) == null ? void 0 : _b2.path) === route.matchedRoute;
5731
5759
  });
5760
+ const searchParams = new URLSearchParams();
5732
5761
  if ((_c = projectMapNode == null ? void 0 : projectMapNode.data) == null ? void 0 : _c.queryStrings) {
5733
- const searchParams = new URLSearchParams();
5734
5762
  if (search) {
5735
5763
  const existingSearchParams = new URLSearchParams(search);
5736
5764
  for (const [key, value] of existingSearchParams.entries()) {
@@ -5743,17 +5771,20 @@ var buildRoutePath = ({
5743
5771
  searchParams.set(qs.name, qsValue != null ? qsValue : "");
5744
5772
  }
5745
5773
  }
5746
- if (searchParams.size) {
5747
- return `${routePath}?${searchParams.toString()}`;
5748
- }
5774
+ }
5775
+ if (process.env.NODE_ENV === "development") {
5776
+ searchParams.set("cache", (/* @__PURE__ */ new Date()).valueOf().toString());
5777
+ }
5778
+ if (searchParams.size) {
5779
+ return `${routePath}?${searchParams.toString()}`;
5749
5780
  }
5750
5781
  return routePath;
5751
5782
  };
5752
5783
  var determineDefaultConsent = ({
5753
- serverConfig: serverConfig2,
5784
+ serverConfig,
5754
5785
  defaultConsent
5755
5786
  }) => {
5756
- return defaultConsent !== serverConfig2.defaultConsent ? defaultConsent : void 0;
5787
+ return defaultConsent !== serverConfig.defaultConsent ? defaultConsent : void 0;
5757
5788
  };
5758
5789
  var determinePreviewMode = ({
5759
5790
  searchParams,
@@ -2550,15 +2550,46 @@ var getCanvasClient = (options) => {
2550
2550
  };
2551
2551
 
2552
2552
  // src/config/helpers.ts
2553
- import serverConfig from "uniform.server.config";
2553
+ import config from "@uniformdev/next-app-router/config/resolved";
2554
2554
  var getServerConfig = () => {
2555
- return serverConfig;
2555
+ return config;
2556
+ };
2557
+ var getDefaultConsent = () => {
2558
+ if (typeof config.defaultConsent === "boolean") {
2559
+ return config.defaultConsent;
2560
+ }
2561
+ return false;
2562
+ };
2563
+ var getQuirkSerialization = () => {
2564
+ if (typeof config.quirkSerialization === "boolean") {
2565
+ return config.quirkSerialization;
2566
+ }
2567
+ return true;
2568
+ };
2569
+ var getMiddlewareRuntimeCache = () => {
2570
+ if (typeof config.middlewareRuntimeCache === "boolean") {
2571
+ return config.middlewareRuntimeCache;
2572
+ }
2573
+ return true;
2574
+ };
2575
+ var getPlaygroundPath = () => {
2576
+ if (typeof config.playgroundPath === "string") {
2577
+ return config.playgroundPath;
2578
+ }
2579
+ return "/uniform/playground";
2580
+ };
2581
+ var getDisableSwrMiddlewareCache = () => {
2582
+ var _a;
2583
+ if (typeof ((_a = config.experimental) == null ? void 0 : _a.disableSwrMiddlewareCache) === "boolean") {
2584
+ return config.experimental.disableSwrMiddlewareCache;
2585
+ }
2586
+ return false;
2556
2587
  };
2557
2588
 
2558
2589
  // src/data/client.ts
2559
2590
  import { getCache, waitUntil } from "@vercel/functions";
2560
2591
 
2561
- // src/clients/route.ts
2592
+ // src/clients/manifest.ts
2562
2593
  import "server-only";
2563
2594
 
2564
2595
  // src/clients/tags.ts
@@ -2579,7 +2610,47 @@ var generateManifestCacheTags = () => {
2579
2610
  return ["manifest"];
2580
2611
  };
2581
2612
 
2613
+ // src/clients/manifest.ts
2614
+ var getManifestClient = (options) => {
2615
+ const cache = resolveManifestCache(options);
2616
+ const manifestClient = new ManifestClient({
2617
+ apiHost: env.getApiHost(),
2618
+ apiKey: env.getApiKey(),
2619
+ projectId: env.getProjectId(),
2620
+ limitPolicy: createLimitPolicy2({
2621
+ limit: 6
2622
+ }),
2623
+ fetch: (req, init2) => {
2624
+ const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
2625
+ return fetch(req, {
2626
+ ...init2,
2627
+ headers: {
2628
+ ...init2 == null ? void 0 : init2.headers,
2629
+ "x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
2630
+ },
2631
+ cache: fetchCache,
2632
+ next: {
2633
+ revalidate,
2634
+ tags: generateManifestCacheTags()
2635
+ }
2636
+ });
2637
+ }
2638
+ });
2639
+ return manifestClient;
2640
+ };
2641
+ var getManifest = async (options) => {
2642
+ let preview = false;
2643
+ if (options && isStateCacheMode(options)) {
2644
+ preview = options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE;
2645
+ }
2646
+ const manifestClient = getManifestClient(options);
2647
+ return manifestClient.get({
2648
+ preview
2649
+ });
2650
+ };
2651
+
2582
2652
  // src/clients/route.ts
2653
+ import "server-only";
2583
2654
  var getRouteCacheTags = (requestedUrl) => {
2584
2655
  const tags = ["route"];
2585
2656
  if (requestedUrl) {
@@ -2629,52 +2700,11 @@ var getRouteClient = (options) => {
2629
2700
  return client;
2630
2701
  };
2631
2702
 
2632
- // src/clients/manifest.ts
2633
- import "server-only";
2634
- var getManifestClient = (options) => {
2635
- const cache = resolveManifestCache(options);
2636
- const manifestClient = new ManifestClient({
2637
- apiHost: env.getApiHost(),
2638
- apiKey: env.getApiKey(),
2639
- projectId: env.getProjectId(),
2640
- limitPolicy: createLimitPolicy2({
2641
- limit: 6
2642
- }),
2643
- fetch: (req, init2) => {
2644
- const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
2645
- return fetch(req, {
2646
- ...init2,
2647
- headers: {
2648
- ...init2 == null ? void 0 : init2.headers,
2649
- "x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
2650
- },
2651
- cache: fetchCache,
2652
- next: {
2653
- revalidate,
2654
- tags: generateManifestCacheTags()
2655
- }
2656
- });
2657
- }
2658
- });
2659
- return manifestClient;
2660
- };
2661
- var getManifest = async (options) => {
2662
- let preview = false;
2663
- if (options && isStateCacheMode(options)) {
2664
- preview = options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE;
2665
- }
2666
- const manifestClient = getManifestClient(options);
2667
- return manifestClient.get({
2668
- preview
2669
- });
2670
- };
2671
-
2672
2703
  // src/data/client.ts
2673
2704
  var MANIFEST_CACHE_KEY = "uniform-manifest";
2674
2705
  var DefaultDataClient = class {
2675
2706
  async getManifest(options) {
2676
- var _a, _b;
2677
- const cache = options.source === "middleware" && ((_b = (_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) != null ? _b : false) ? getCache() : null;
2707
+ const cache = options.source === "middleware" && getMiddlewareRuntimeCache() ? getCache() : null;
2678
2708
  if (cache) {
2679
2709
  const cachedManifest = await cache.get(MANIFEST_CACHE_KEY);
2680
2710
  if (cachedManifest) {
@@ -2760,18 +2790,16 @@ var DefaultDataClient = class {
2760
2790
  async enhanceRoute(_options3) {
2761
2791
  }
2762
2792
  async getRouteMiddleware(options) {
2763
- var _a, _b, _c, _d;
2764
2793
  const routeClient = getRouteClient({
2765
2794
  searchParams: options.searchParams,
2766
2795
  draftModeEnabled: options.draftModeEnabled
2767
2796
  });
2768
- const config = getServerConfig();
2769
2797
  const resolvedRoute = await this.getRouteFromApi({
2770
2798
  source: "middleware",
2771
2799
  route: options.route,
2772
2800
  routeClient,
2773
- enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && ((_b = (_a = config.experimental) == null ? void 0 : _a.middlewareRuntimeCache) != null ? _b : false),
2774
- disableSwrCache: (_d = (_c = config.experimental) == null ? void 0 : _c.disableSwrMiddlewareCache) != null ? _d : false
2801
+ enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache(),
2802
+ disableSwrCache: getDisableSwrMiddlewareCache()
2775
2803
  });
2776
2804
  if (resolvedRoute.type === "composition") {
2777
2805
  await this.enhanceRoute({
@@ -5261,18 +5289,17 @@ var OnDemandContext = class {
5261
5289
  __privateSet(this, _options2, options);
5262
5290
  }
5263
5291
  async getContext() {
5264
- var _a, _b, _c, _d, _e;
5292
+ var _a, _b, _c;
5265
5293
  if (!this._context) {
5266
5294
  const uniformCookie = __privateGet(this, _options2).cookies.get(UNIFORM_DEFAULT_COOKIE_NAME);
5267
5295
  const quirkCookie = __privateGet(this, _options2).cookies.get(UNIFORM_DEFAULT_QUIRK_COOKIE_NAME);
5268
- const serverConfig2 = getServerConfig();
5269
5296
  this._context = new Context({
5270
5297
  manifest: __privateGet(this, _options2).manifest,
5271
- defaultConsent: (_b = (_a = __privateGet(this, _options2).defaultConsent) != null ? _a : serverConfig2.defaultConsent) != null ? _b : false,
5298
+ defaultConsent: (_a = __privateGet(this, _options2).defaultConsent) != null ? _a : getDefaultConsent(),
5272
5299
  transitionStore: new CookieTransitionDataStore({
5273
- serverCookieValue: (_c = uniformCookie == null ? void 0 : uniformCookie.value) != null ? _c : "",
5274
- experimental_quirksEnabled: (_d = serverConfig2.experimental) == null ? void 0 : _d.quirkSerialization,
5275
- quirkCookieValue: (_e = quirkCookie == null ? void 0 : quirkCookie.value) != null ? _e : ""
5300
+ serverCookieValue: (_b = uniformCookie == null ? void 0 : uniformCookie.value) != null ? _b : "",
5301
+ experimental_quirksEnabled: getQuirkSerialization(),
5302
+ quirkCookieValue: (_c = quirkCookie == null ? void 0 : quirkCookie.value) != null ? _c : ""
5276
5303
  })
5277
5304
  });
5278
5305
  }
@@ -5427,7 +5454,7 @@ var handlePlaygroundRequest = async ({
5427
5454
  options,
5428
5455
  dataClient
5429
5456
  }) => {
5430
- var _a, _b, _c;
5457
+ var _a, _b;
5431
5458
  const id = request.nextUrl.searchParams.get("id");
5432
5459
  if (!id) {
5433
5460
  return NextResponse.json(
@@ -5467,12 +5494,13 @@ var handlePlaygroundRequest = async ({
5467
5494
  { status: 404 }
5468
5495
  );
5469
5496
  }
5470
- const serverConfig2 = getServerConfig();
5497
+ const serverConfig = getServerConfig();
5498
+ const playgroundPath = getPlaygroundPath();
5471
5499
  const onDemandContext = await createOnDemandContext({
5472
5500
  cookies: request.cookies,
5473
5501
  dataClient,
5474
5502
  defaultConsent: determineDefaultConsent({
5475
- serverConfig: serverConfig2,
5503
+ serverConfig,
5476
5504
  defaultConsent: options.defaultConsent
5477
5505
  })
5478
5506
  });
@@ -5486,7 +5514,7 @@ var handlePlaygroundRequest = async ({
5486
5514
  dynamicInputs: {},
5487
5515
  releaseId: (_a = options.release) == null ? void 0 : _a.id,
5488
5516
  defaultConsent: determineDefaultConsent({
5489
- serverConfig: serverConfig2,
5517
+ serverConfig,
5490
5518
  defaultConsent: options.defaultConsent
5491
5519
  }),
5492
5520
  keys: void 0,
@@ -5503,7 +5531,7 @@ var handlePlaygroundRequest = async ({
5503
5531
  keys: void 0,
5504
5532
  releaseId: (_b = options.release) == null ? void 0 : _b.id,
5505
5533
  defaultConsent: determineDefaultConsent({
5506
- serverConfig: serverConfig2,
5534
+ serverConfig,
5507
5535
  defaultConsent: options.defaultConsent
5508
5536
  }),
5509
5537
  previewMode: determinePreviewMode({
@@ -5519,7 +5547,7 @@ var handlePlaygroundRequest = async ({
5519
5547
  });
5520
5548
  let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "playground" }) : void 0);
5521
5549
  if (!pathToRewriteTo) {
5522
- pathToRewriteTo = `${serverConfig2.playgroundPath}${((_c = serverConfig2.playgroundPath) == null ? void 0 : _c.endsWith("/")) ? "" : "/"}${code}`;
5550
+ pathToRewriteTo = `${playgroundPath}${(playgroundPath == null ? void 0 : playgroundPath.endsWith("/")) ? "" : "/"}${code}`;
5523
5551
  }
5524
5552
  return NextResponse.rewrite(new URL(pathToRewriteTo, request.nextUrl.origin));
5525
5553
  };
@@ -5540,7 +5568,7 @@ var handleRouteRequest = async ({
5540
5568
  }))) != null ? _b : {
5541
5569
  path: `${request.nextUrl.pathname}${request.nextUrl.search}`
5542
5570
  };
5543
- const serverConfig2 = getServerConfig();
5571
+ const serverConfig = getServerConfig();
5544
5572
  const [routeResult, onDemandContext] = await Promise.all([
5545
5573
  resolveRoute({
5546
5574
  path: requestPath.path,
@@ -5555,7 +5583,7 @@ var handleRouteRequest = async ({
5555
5583
  cookies: request.cookies,
5556
5584
  dataClient,
5557
5585
  defaultConsent: determineDefaultConsent({
5558
- serverConfig: serverConfig2,
5586
+ serverConfig,
5559
5587
  defaultConsent: options.defaultConsent
5560
5588
  })
5561
5589
  })
@@ -5605,7 +5633,7 @@ var handleRouteRequest = async ({
5605
5633
  dynamicInputs: (_f = route.dynamicInputs) != null ? _f : {},
5606
5634
  releaseId: (_g = options.release) == null ? void 0 : _g.id,
5607
5635
  defaultConsent: determineDefaultConsent({
5608
- serverConfig: serverConfig2,
5636
+ serverConfig,
5609
5637
  defaultConsent: options.defaultConsent
5610
5638
  }),
5611
5639
  keys: requestPath.keys,
@@ -5622,7 +5650,7 @@ var handleRouteRequest = async ({
5622
5650
  keys: requestPath.keys,
5623
5651
  releaseId: (_h = options.release) == null ? void 0 : _h.id,
5624
5652
  defaultConsent: determineDefaultConsent({
5625
- serverConfig: serverConfig2,
5653
+ serverConfig,
5626
5654
  defaultConsent: options.defaultConsent
5627
5655
  }),
5628
5656
  previewMode,
@@ -5721,8 +5749,8 @@ var buildRoutePath = ({
5721
5749
  }
5722
5750
  return ((_b2 = (_a2 = node.locales) == null ? void 0 : _a2[locale]) == null ? void 0 : _b2.path) === route.matchedRoute;
5723
5751
  });
5752
+ const searchParams = new URLSearchParams();
5724
5753
  if ((_c = projectMapNode == null ? void 0 : projectMapNode.data) == null ? void 0 : _c.queryStrings) {
5725
- const searchParams = new URLSearchParams();
5726
5754
  if (search) {
5727
5755
  const existingSearchParams = new URLSearchParams(search);
5728
5756
  for (const [key, value] of existingSearchParams.entries()) {
@@ -5735,17 +5763,20 @@ var buildRoutePath = ({
5735
5763
  searchParams.set(qs.name, qsValue != null ? qsValue : "");
5736
5764
  }
5737
5765
  }
5738
- if (searchParams.size) {
5739
- return `${routePath}?${searchParams.toString()}`;
5740
- }
5766
+ }
5767
+ if (process.env.NODE_ENV === "development") {
5768
+ searchParams.set("cache", (/* @__PURE__ */ new Date()).valueOf().toString());
5769
+ }
5770
+ if (searchParams.size) {
5771
+ return `${routePath}?${searchParams.toString()}`;
5741
5772
  }
5742
5773
  return routePath;
5743
5774
  };
5744
5775
  var determineDefaultConsent = ({
5745
- serverConfig: serverConfig2,
5776
+ serverConfig,
5746
5777
  defaultConsent
5747
5778
  }) => {
5748
- return defaultConsent !== serverConfig2.defaultConsent ? defaultConsent : void 0;
5779
+ return defaultConsent !== serverConfig.defaultConsent ? defaultConsent : void 0;
5749
5780
  };
5750
5781
  var determinePreviewMode = ({
5751
5782
  searchParams,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/next-app-router",
3
- "version": "20.7.1-alpha.134+97fe4134d7",
3
+ "version": "20.7.1-alpha.136+b24fc21071",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -46,6 +46,11 @@
46
46
  "types": "./dist/cache.d.ts",
47
47
  "require": "./dist/cache.js",
48
48
  "import": "./dist/cache.mjs"
49
+ },
50
+ "./config/resolved": {
51
+ "types": "./dist/config/default.d.ts",
52
+ "require": "./dist/config/default.js",
53
+ "import": "./dist/config/default.mjs"
49
54
  }
50
55
  },
51
56
  "typesVersions": {
@@ -70,6 +75,12 @@
70
75
  ],
71
76
  "cache": [
72
77
  "./dist/cache.d.ts"
78
+ ],
79
+ "config/default": [
80
+ "./dist/config/default.d.ts"
81
+ ],
82
+ "config/resolved": [
83
+ "./dist/config/default.d.ts"
73
84
  ]
74
85
  }
75
86
  },
@@ -88,12 +99,12 @@
88
99
  "vitest": "3.2.4"
89
100
  },
90
101
  "dependencies": {
91
- "@uniformdev/canvas-react": "20.7.1-alpha.134+97fe4134d7",
92
- "@uniformdev/next-app-router-client": "20.7.1-alpha.134+97fe4134d7",
93
- "@uniformdev/next-app-router-shared": "20.7.1-alpha.134+97fe4134d7",
94
- "@uniformdev/redirect": "20.7.1-alpha.134+97fe4134d7",
95
- "@uniformdev/richtext": "20.7.1-alpha.134+97fe4134d7",
96
- "@uniformdev/webhooks": "20.7.1-alpha.134+97fe4134d7",
102
+ "@uniformdev/canvas-react": "20.7.1-alpha.136+b24fc21071",
103
+ "@uniformdev/next-app-router-client": "20.7.1-alpha.136+b24fc21071",
104
+ "@uniformdev/next-app-router-shared": "20.7.1-alpha.136+b24fc21071",
105
+ "@uniformdev/redirect": "20.7.1-alpha.136+b24fc21071",
106
+ "@uniformdev/richtext": "20.7.1-alpha.136+b24fc21071",
107
+ "@uniformdev/webhooks": "20.7.1-alpha.136+b24fc21071",
97
108
  "@vercel/functions": "^2.2.2",
98
109
  "encoding": "^0.1.13",
99
110
  "server-only": "^0.0.1",
@@ -110,5 +121,5 @@
110
121
  "publishConfig": {
111
122
  "access": "public"
112
123
  },
113
- "gitHead": "97fe4134d72fb8c0b3a3432e1a6a410fdedeedb4"
124
+ "gitHead": "b24fc21071984f3e41cf7d2e46345c122182a185"
114
125
  }