@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.
- package/dist/{UniformComposition-r8a9xGZn.d.ts → UniformComposition-d7_93l3F.d.ts} +5 -0
- package/dist/{UniformComposition-CHUPULqc.d.mts → UniformComposition-hhRIBHmn.d.mts} +5 -0
- package/dist/cache.js +55 -56
- package/dist/cache.mjs +55 -58
- package/dist/compat.d.mts +2 -2
- package/dist/compat.d.ts +2 -2
- package/dist/config/default.d.mts +5 -0
- package/dist/config/default.d.ts +5 -0
- package/dist/config/default.js +32 -0
- package/dist/config/default.mjs +11 -0
- package/dist/config.d.mts +6 -1
- package/dist/config.d.ts +6 -1
- package/dist/config.js +12 -21
- package/dist/config.mjs +12 -21
- package/dist/handler.js +14 -6
- package/dist/handler.mjs +14 -6
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +45 -19
- package/dist/index.js +45 -19
- package/dist/index.mjs +45 -19
- package/dist/middleware.js +102 -71
- package/dist/middleware.mjs +102 -71
- package/package.json +19 -8
package/dist/handler.mjs
CHANGED
|
@@ -1521,9 +1521,18 @@ import { redirect } from "next/navigation";
|
|
|
1521
1521
|
import { NextResponse } from "next/server";
|
|
1522
1522
|
|
|
1523
1523
|
// src/config/helpers.ts
|
|
1524
|
-
import
|
|
1525
|
-
var
|
|
1526
|
-
|
|
1524
|
+
import config from "@uniformdev/next-app-router/config/resolved";
|
|
1525
|
+
var getMiddlewareRuntimeCache = () => {
|
|
1526
|
+
if (typeof config.middlewareRuntimeCache === "boolean") {
|
|
1527
|
+
return config.middlewareRuntimeCache;
|
|
1528
|
+
}
|
|
1529
|
+
return true;
|
|
1530
|
+
};
|
|
1531
|
+
var getPlaygroundPath = () => {
|
|
1532
|
+
if (typeof config.playgroundPath === "string") {
|
|
1533
|
+
return config.playgroundPath;
|
|
1534
|
+
}
|
|
1535
|
+
return "/uniform/playground";
|
|
1527
1536
|
};
|
|
1528
1537
|
|
|
1529
1538
|
// src/handler/createPreviewGETRouteHandler.ts
|
|
@@ -1542,7 +1551,7 @@ var contextualEditingQueryParams = [
|
|
|
1542
1551
|
var createPreviewGETRouteHandler = (options) => {
|
|
1543
1552
|
return async (request) => {
|
|
1544
1553
|
const isConfigCheck = getQueryParam(request, "is_config_check") === "true";
|
|
1545
|
-
const
|
|
1554
|
+
const playgroundPath = getPlaygroundPath();
|
|
1546
1555
|
if (isConfigCheck) {
|
|
1547
1556
|
return Response.json(
|
|
1548
1557
|
{
|
|
@@ -2588,7 +2597,6 @@ var createPreviewPOSTRouteHandler = () => {
|
|
|
2588
2597
|
};
|
|
2589
2598
|
};
|
|
2590
2599
|
var handleSvixMessage = async (request) => {
|
|
2591
|
-
var _a;
|
|
2592
2600
|
const handlers = [
|
|
2593
2601
|
handleProjectMapNodeUpdate,
|
|
2594
2602
|
handleProjectMapNodeInsert,
|
|
@@ -2622,7 +2630,7 @@ var handleSvixMessage = async (request) => {
|
|
|
2622
2630
|
}
|
|
2623
2631
|
}
|
|
2624
2632
|
if (tags == null ? void 0 : tags.length) {
|
|
2625
|
-
const cache = (
|
|
2633
|
+
const cache = getMiddlewareRuntimeCache() ? getCache() : void 0;
|
|
2626
2634
|
for (let i = 0; i < tags.length; i++) {
|
|
2627
2635
|
const tag = tags[i];
|
|
2628
2636
|
revalidateTag(tag, "max");
|
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import { CanvasClient, RouteClient, ComponentInstance } from '@uniformdev/canvas
|
|
|
2
2
|
import { CacheMode, CanvasCacheMode, ManifestCacheMode, ProjectMapCacheMode, RewriteRequestPathResult } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import { ManifestClient } from '@uniformdev/context/api';
|
|
4
4
|
import { ProjectMapClient } from '@uniformdev/project-map';
|
|
5
|
-
import { U as UniformCompositionProps } from './UniformComposition-
|
|
6
|
-
export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-
|
|
5
|
+
import { U as UniformCompositionProps } from './UniformComposition-hhRIBHmn.mjs';
|
|
6
|
+
export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-hhRIBHmn.mjs';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-BCGVjYM-.mjs';
|
|
9
9
|
import { a as ResolvedRouteResult } from './resolveRouteFromCode-CKaYNXte.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { CanvasClient, RouteClient, ComponentInstance } from '@uniformdev/canvas
|
|
|
2
2
|
import { CacheMode, CanvasCacheMode, ManifestCacheMode, ProjectMapCacheMode, RewriteRequestPathResult } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import { ManifestClient } from '@uniformdev/context/api';
|
|
4
4
|
import { ProjectMapClient } from '@uniformdev/project-map';
|
|
5
|
-
import { U as UniformCompositionProps } from './UniformComposition-
|
|
6
|
-
export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-
|
|
5
|
+
import { U as UniformCompositionProps } from './UniformComposition-d7_93l3F.js';
|
|
6
|
+
export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-d7_93l3F.js';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-BCGVjYM-.js';
|
|
9
9
|
import { a as ResolvedRouteResult } from './resolveRouteFromCode-DgTsfMK8.js';
|
package/dist/index.esm.js
CHANGED
|
@@ -2829,14 +2829,43 @@ import { DefaultUniformClientContext } from "@uniformdev/next-app-router-client"
|
|
|
2829
2829
|
import React3 from "react";
|
|
2830
2830
|
|
|
2831
2831
|
// src/config/helpers.ts
|
|
2832
|
-
import
|
|
2833
|
-
var
|
|
2834
|
-
|
|
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;
|
|
2835
2864
|
};
|
|
2836
2865
|
|
|
2837
2866
|
// src/components/UniformContext.tsx
|
|
2838
2867
|
var UniformContext = async ({ clientContextComponent, result }) => {
|
|
2839
|
-
var _a
|
|
2868
|
+
var _a;
|
|
2840
2869
|
const manifest = await getManifest({
|
|
2841
2870
|
state: CANVAS_PUBLISHED_STATE
|
|
2842
2871
|
});
|
|
@@ -2847,10 +2876,9 @@ var UniformContext = async ({ clientContextComponent, result }) => {
|
|
|
2847
2876
|
matchedRoute: route.matchedRoute
|
|
2848
2877
|
} : void 0;
|
|
2849
2878
|
const ContextComponent = clientContextComponent || DefaultUniformClientContext;
|
|
2850
|
-
const
|
|
2851
|
-
const
|
|
2852
|
-
const
|
|
2853
|
-
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();
|
|
2854
2882
|
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
|
|
2855
2883
|
ContextComponent,
|
|
2856
2884
|
{
|
|
@@ -2884,11 +2912,13 @@ async function UniformCompositionInner({
|
|
|
2884
2912
|
resolveComponent,
|
|
2885
2913
|
resolveEmptyPlaceholder,
|
|
2886
2914
|
compositionCache,
|
|
2887
|
-
clientContextComponent
|
|
2915
|
+
clientContextComponent,
|
|
2916
|
+
dataClient
|
|
2888
2917
|
}) {
|
|
2889
2918
|
var _a, _b;
|
|
2890
2919
|
const result = await resolveRoute({
|
|
2891
|
-
code
|
|
2920
|
+
code,
|
|
2921
|
+
dataClient
|
|
2892
2922
|
});
|
|
2893
2923
|
if (!(result == null ? void 0 : result.route) || ((_a = result == null ? void 0 : result.route) == null ? void 0 : _a.type) !== "composition") {
|
|
2894
2924
|
notFound();
|
|
@@ -3571,7 +3601,7 @@ function permutationsWithoutRepetition(options, k) {
|
|
|
3571
3601
|
}
|
|
3572
3602
|
function combineAcrossGroups(perGroupSelections) {
|
|
3573
3603
|
return perGroupSelections.reduce(
|
|
3574
|
-
(acc, group) => acc.flatMap((
|
|
3604
|
+
(acc, group) => acc.flatMap((config2) => group.map((selection) => [...config2, selection])),
|
|
3575
3605
|
[[]]
|
|
3576
3606
|
);
|
|
3577
3607
|
}
|
|
@@ -3585,8 +3615,7 @@ import { getCache, waitUntil } from "@vercel/functions";
|
|
|
3585
3615
|
var MANIFEST_CACHE_KEY = "uniform-manifest";
|
|
3586
3616
|
var DefaultDataClient = class {
|
|
3587
3617
|
async getManifest(options) {
|
|
3588
|
-
|
|
3589
|
-
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;
|
|
3590
3619
|
if (cache2) {
|
|
3591
3620
|
const cachedManifest = await cache2.get(MANIFEST_CACHE_KEY);
|
|
3592
3621
|
if (cachedManifest) {
|
|
@@ -3672,18 +3701,16 @@ var DefaultDataClient = class {
|
|
|
3672
3701
|
async enhanceRoute(_options) {
|
|
3673
3702
|
}
|
|
3674
3703
|
async getRouteMiddleware(options) {
|
|
3675
|
-
var _a, _b, _c, _d;
|
|
3676
3704
|
const routeClient = getRouteClient({
|
|
3677
3705
|
searchParams: options.searchParams,
|
|
3678
3706
|
draftModeEnabled: options.draftModeEnabled
|
|
3679
3707
|
});
|
|
3680
|
-
const config = getServerConfig();
|
|
3681
3708
|
const resolvedRoute = await this.getRouteFromApi({
|
|
3682
3709
|
source: "middleware",
|
|
3683
3710
|
route: options.route,
|
|
3684
3711
|
routeClient,
|
|
3685
|
-
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && (
|
|
3686
|
-
disableSwrCache: (
|
|
3712
|
+
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache(),
|
|
3713
|
+
disableSwrCache: getDisableSwrMiddlewareCache()
|
|
3687
3714
|
});
|
|
3688
3715
|
if (resolvedRoute.type === "composition") {
|
|
3689
3716
|
await this.enhanceRoute({
|
|
@@ -3736,8 +3763,7 @@ var DefaultDataClient = class {
|
|
|
3736
3763
|
}
|
|
3737
3764
|
};
|
|
3738
3765
|
var expireMiddlewareCacheTag = async (tag) => {
|
|
3739
|
-
|
|
3740
|
-
const cache2 = ((_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) ? getCache() : null;
|
|
3766
|
+
const cache2 = getMiddlewareRuntimeCache() ? getCache() : null;
|
|
3741
3767
|
if (cache2) {
|
|
3742
3768
|
await cache2.expireTag(tag);
|
|
3743
3769
|
} else {
|
package/dist/index.js
CHANGED
|
@@ -2852,14 +2852,43 @@ var import_next_app_router_client2 = require("@uniformdev/next-app-router-client
|
|
|
2852
2852
|
var import_react4 = __toESM(require("react"));
|
|
2853
2853
|
|
|
2854
2854
|
// src/config/helpers.ts
|
|
2855
|
-
var
|
|
2856
|
-
var
|
|
2857
|
-
|
|
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;
|
|
2858
2887
|
};
|
|
2859
2888
|
|
|
2860
2889
|
// src/components/UniformContext.tsx
|
|
2861
2890
|
var UniformContext = async ({ clientContextComponent, result }) => {
|
|
2862
|
-
var _a
|
|
2891
|
+
var _a;
|
|
2863
2892
|
const manifest = await getManifest({
|
|
2864
2893
|
state: CANVAS_PUBLISHED_STATE
|
|
2865
2894
|
});
|
|
@@ -2870,10 +2899,9 @@ var UniformContext = async ({ clientContextComponent, result }) => {
|
|
|
2870
2899
|
matchedRoute: route.matchedRoute
|
|
2871
2900
|
} : void 0;
|
|
2872
2901
|
const ContextComponent = clientContextComponent || import_next_app_router_client2.DefaultUniformClientContext;
|
|
2873
|
-
const
|
|
2874
|
-
const
|
|
2875
|
-
const
|
|
2876
|
-
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();
|
|
2877
2905
|
return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(
|
|
2878
2906
|
ContextComponent,
|
|
2879
2907
|
{
|
|
@@ -2907,11 +2935,13 @@ async function UniformCompositionInner({
|
|
|
2907
2935
|
resolveComponent,
|
|
2908
2936
|
resolveEmptyPlaceholder,
|
|
2909
2937
|
compositionCache,
|
|
2910
|
-
clientContextComponent
|
|
2938
|
+
clientContextComponent,
|
|
2939
|
+
dataClient
|
|
2911
2940
|
}) {
|
|
2912
2941
|
var _a, _b;
|
|
2913
2942
|
const result = await resolveRoute({
|
|
2914
|
-
code
|
|
2943
|
+
code,
|
|
2944
|
+
dataClient
|
|
2915
2945
|
});
|
|
2916
2946
|
if (!(result == null ? void 0 : result.route) || ((_a = result == null ? void 0 : result.route) == null ? void 0 : _a.type) !== "composition") {
|
|
2917
2947
|
(0, import_navigation.notFound)();
|
|
@@ -3592,7 +3622,7 @@ function permutationsWithoutRepetition(options, k) {
|
|
|
3592
3622
|
}
|
|
3593
3623
|
function combineAcrossGroups(perGroupSelections) {
|
|
3594
3624
|
return perGroupSelections.reduce(
|
|
3595
|
-
(acc, group) => acc.flatMap((
|
|
3625
|
+
(acc, group) => acc.flatMap((config2) => group.map((selection) => [...config2, selection])),
|
|
3596
3626
|
[[]]
|
|
3597
3627
|
);
|
|
3598
3628
|
}
|
|
@@ -3606,8 +3636,7 @@ var import_functions = require("@vercel/functions");
|
|
|
3606
3636
|
var MANIFEST_CACHE_KEY = "uniform-manifest";
|
|
3607
3637
|
var DefaultDataClient = class {
|
|
3608
3638
|
async getManifest(options) {
|
|
3609
|
-
|
|
3610
|
-
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;
|
|
3611
3640
|
if (cache2) {
|
|
3612
3641
|
const cachedManifest = await cache2.get(MANIFEST_CACHE_KEY);
|
|
3613
3642
|
if (cachedManifest) {
|
|
@@ -3693,18 +3722,16 @@ var DefaultDataClient = class {
|
|
|
3693
3722
|
async enhanceRoute(_options) {
|
|
3694
3723
|
}
|
|
3695
3724
|
async getRouteMiddleware(options) {
|
|
3696
|
-
var _a, _b, _c, _d;
|
|
3697
3725
|
const routeClient = getRouteClient({
|
|
3698
3726
|
searchParams: options.searchParams,
|
|
3699
3727
|
draftModeEnabled: options.draftModeEnabled
|
|
3700
3728
|
});
|
|
3701
|
-
const config = getServerConfig();
|
|
3702
3729
|
const resolvedRoute = await this.getRouteFromApi({
|
|
3703
3730
|
source: "middleware",
|
|
3704
3731
|
route: options.route,
|
|
3705
3732
|
routeClient,
|
|
3706
|
-
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && (
|
|
3707
|
-
disableSwrCache: (
|
|
3733
|
+
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache(),
|
|
3734
|
+
disableSwrCache: getDisableSwrMiddlewareCache()
|
|
3708
3735
|
});
|
|
3709
3736
|
if (resolvedRoute.type === "composition") {
|
|
3710
3737
|
await this.enhanceRoute({
|
|
@@ -3757,8 +3784,7 @@ var DefaultDataClient = class {
|
|
|
3757
3784
|
}
|
|
3758
3785
|
};
|
|
3759
3786
|
var expireMiddlewareCacheTag = async (tag) => {
|
|
3760
|
-
|
|
3761
|
-
const cache2 = ((_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) ? (0, import_functions.getCache)() : null;
|
|
3787
|
+
const cache2 = getMiddlewareRuntimeCache() ? (0, import_functions.getCache)() : null;
|
|
3762
3788
|
if (cache2) {
|
|
3763
3789
|
await cache2.expireTag(tag);
|
|
3764
3790
|
} else {
|
package/dist/index.mjs
CHANGED
|
@@ -2829,14 +2829,43 @@ import { DefaultUniformClientContext } from "@uniformdev/next-app-router-client"
|
|
|
2829
2829
|
import React3 from "react";
|
|
2830
2830
|
|
|
2831
2831
|
// src/config/helpers.ts
|
|
2832
|
-
import
|
|
2833
|
-
var
|
|
2834
|
-
|
|
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;
|
|
2835
2864
|
};
|
|
2836
2865
|
|
|
2837
2866
|
// src/components/UniformContext.tsx
|
|
2838
2867
|
var UniformContext = async ({ clientContextComponent, result }) => {
|
|
2839
|
-
var _a
|
|
2868
|
+
var _a;
|
|
2840
2869
|
const manifest = await getManifest({
|
|
2841
2870
|
state: CANVAS_PUBLISHED_STATE
|
|
2842
2871
|
});
|
|
@@ -2847,10 +2876,9 @@ var UniformContext = async ({ clientContextComponent, result }) => {
|
|
|
2847
2876
|
matchedRoute: route.matchedRoute
|
|
2848
2877
|
} : void 0;
|
|
2849
2878
|
const ContextComponent = clientContextComponent || DefaultUniformClientContext;
|
|
2850
|
-
const
|
|
2851
|
-
const
|
|
2852
|
-
const
|
|
2853
|
-
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();
|
|
2854
2882
|
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
|
|
2855
2883
|
ContextComponent,
|
|
2856
2884
|
{
|
|
@@ -2884,11 +2912,13 @@ async function UniformCompositionInner({
|
|
|
2884
2912
|
resolveComponent,
|
|
2885
2913
|
resolveEmptyPlaceholder,
|
|
2886
2914
|
compositionCache,
|
|
2887
|
-
clientContextComponent
|
|
2915
|
+
clientContextComponent,
|
|
2916
|
+
dataClient
|
|
2888
2917
|
}) {
|
|
2889
2918
|
var _a, _b;
|
|
2890
2919
|
const result = await resolveRoute({
|
|
2891
|
-
code
|
|
2920
|
+
code,
|
|
2921
|
+
dataClient
|
|
2892
2922
|
});
|
|
2893
2923
|
if (!(result == null ? void 0 : result.route) || ((_a = result == null ? void 0 : result.route) == null ? void 0 : _a.type) !== "composition") {
|
|
2894
2924
|
notFound();
|
|
@@ -3571,7 +3601,7 @@ function permutationsWithoutRepetition(options, k) {
|
|
|
3571
3601
|
}
|
|
3572
3602
|
function combineAcrossGroups(perGroupSelections) {
|
|
3573
3603
|
return perGroupSelections.reduce(
|
|
3574
|
-
(acc, group) => acc.flatMap((
|
|
3604
|
+
(acc, group) => acc.flatMap((config2) => group.map((selection) => [...config2, selection])),
|
|
3575
3605
|
[[]]
|
|
3576
3606
|
);
|
|
3577
3607
|
}
|
|
@@ -3585,8 +3615,7 @@ import { getCache, waitUntil } from "@vercel/functions";
|
|
|
3585
3615
|
var MANIFEST_CACHE_KEY = "uniform-manifest";
|
|
3586
3616
|
var DefaultDataClient = class {
|
|
3587
3617
|
async getManifest(options) {
|
|
3588
|
-
|
|
3589
|
-
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;
|
|
3590
3619
|
if (cache2) {
|
|
3591
3620
|
const cachedManifest = await cache2.get(MANIFEST_CACHE_KEY);
|
|
3592
3621
|
if (cachedManifest) {
|
|
@@ -3672,18 +3701,16 @@ var DefaultDataClient = class {
|
|
|
3672
3701
|
async enhanceRoute(_options) {
|
|
3673
3702
|
}
|
|
3674
3703
|
async getRouteMiddleware(options) {
|
|
3675
|
-
var _a, _b, _c, _d;
|
|
3676
3704
|
const routeClient = getRouteClient({
|
|
3677
3705
|
searchParams: options.searchParams,
|
|
3678
3706
|
draftModeEnabled: options.draftModeEnabled
|
|
3679
3707
|
});
|
|
3680
|
-
const config = getServerConfig();
|
|
3681
3708
|
const resolvedRoute = await this.getRouteFromApi({
|
|
3682
3709
|
source: "middleware",
|
|
3683
3710
|
route: options.route,
|
|
3684
3711
|
routeClient,
|
|
3685
|
-
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && (
|
|
3686
|
-
disableSwrCache: (
|
|
3712
|
+
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache(),
|
|
3713
|
+
disableSwrCache: getDisableSwrMiddlewareCache()
|
|
3687
3714
|
});
|
|
3688
3715
|
if (resolvedRoute.type === "composition") {
|
|
3689
3716
|
await this.enhanceRoute({
|
|
@@ -3736,8 +3763,7 @@ var DefaultDataClient = class {
|
|
|
3736
3763
|
}
|
|
3737
3764
|
};
|
|
3738
3765
|
var expireMiddlewareCacheTag = async (tag) => {
|
|
3739
|
-
|
|
3740
|
-
const cache2 = ((_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) ? getCache() : null;
|
|
3766
|
+
const cache2 = getMiddlewareRuntimeCache() ? getCache() : null;
|
|
3741
3767
|
if (cache2) {
|
|
3742
3768
|
await cache2.expireTag(tag);
|
|
3743
3769
|
} else {
|