@uniformdev/next-app-router 20.81.1-alpha.29.sha-2124c4c450 → 20.81.1-alpha.38.sha-299feccf62
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/{UniformResolvedComposition-JOJTO1N5.d.mts → UniformResolvedComposition-Ckhza3b7.d.mts} +14 -3
- package/dist/{UniformResolvedComposition-DxnyzdYY.d.ts → UniformResolvedComposition-Dr73WwIO.d.ts} +14 -3
- package/dist/cache.d.mts +6 -4
- package/dist/cache.d.ts +6 -4
- package/dist/cache.js +81 -21
- package/dist/cache.mjs +81 -21
- package/dist/cf-vinext.d.mts +3 -2
- package/dist/cf-vinext.d.ts +3 -2
- package/dist/cf-vinext.js +120 -37
- package/dist/cf-vinext.mjs +120 -37
- package/dist/compat.d.mts +1 -1
- package/dist/compat.d.ts +1 -1
- package/dist/component.js +3 -0
- package/dist/component.mjs +3 -0
- package/dist/createPreviewGETRouteHandler-ii7w-gAc.d.mts +25 -0
- package/dist/createPreviewGETRouteHandler-ii7w-gAc.d.ts +25 -0
- package/dist/edge.d.mts +2 -1
- package/dist/edge.d.ts +2 -1
- package/dist/edge.js +120 -37
- package/dist/edge.mjs +120 -37
- package/dist/handler.d.mts +3 -24
- package/dist/handler.d.ts +3 -24
- package/dist/handler.js +144 -104
- package/dist/handler.mjs +145 -105
- package/dist/index.d.mts +60 -29
- package/dist/index.d.ts +60 -29
- package/dist/index.esm.js +118 -59
- package/dist/index.js +114 -57
- package/dist/index.mjs +118 -59
- package/dist/middleware.d.mts +8 -0
- package/dist/middleware.d.ts +8 -0
- package/dist/middleware.js +3 -3
- package/dist/middleware.mjs +3 -3
- package/dist/{resolveRouteFromPath-BVy72a9s.d.ts → resolveRouteFromPath-BpuMu5ZS.d.ts} +17 -16
- package/dist/{resolveRouteFromPath-C62DO3_K.d.mts → resolveRouteFromPath-DWNRjFHQ.d.mts} +17 -16
- package/dist/{uniformEdgeMiddleware-BOyFWW7Z.d.mts → uniformEdgeMiddleware-BcitsCE7.d.mts} +9 -5
- package/dist/{uniformEdgeMiddleware-BiqRqhob.d.ts → uniformEdgeMiddleware-D2frG4_C.d.ts} +9 -5
- package/dist/vercel.d.mts +7 -3
- package/dist/vercel.d.ts +7 -3
- package/dist/vercel.js +134 -38
- package/dist/vercel.mjs +134 -38
- package/package.json +10 -10
package/dist/{UniformResolvedComposition-JOJTO1N5.d.mts → UniformResolvedComposition-Ckhza3b7.d.mts}
RENAMED
|
@@ -13,6 +13,10 @@ type CompositionCache = {
|
|
|
13
13
|
componentId: string;
|
|
14
14
|
}) => ComponentInstance | null;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Creates a cache of the compositions rendered during a request, which components read with
|
|
18
|
+
* `getUniformComposition` and `getUniformComponent`. Each request starts empty.
|
|
19
|
+
*/
|
|
16
20
|
declare const createCompositionCache: () => CompositionCache;
|
|
17
21
|
|
|
18
22
|
type ResolveComponentResult = {
|
|
@@ -50,15 +54,22 @@ type UniformResolvedCompositionProps = {
|
|
|
50
54
|
* Function to map empty placeholders to React components.
|
|
51
55
|
*/
|
|
52
56
|
resolveEmptyPlaceholder?: ResolveEmptyPlaceholderFunction;
|
|
57
|
+
/**
|
|
58
|
+
* Marks the page's primary composition. It sets the composition metadata of the visitor's
|
|
59
|
+
* context, which Uniform Insights attributes page hits and goals to, and the default consent
|
|
60
|
+
* from its page state. In the editor and draft states it also loads the contextual editing
|
|
61
|
+
* script. Set it on one composition per page.
|
|
62
|
+
*/
|
|
63
|
+
pageComposition?: boolean;
|
|
53
64
|
/**
|
|
54
65
|
* Composition cache, will be used to cache the composition.
|
|
55
66
|
*/
|
|
56
67
|
compositionCache?: CompositionCache;
|
|
57
68
|
};
|
|
58
69
|
/**
|
|
59
|
-
* Renders a resolved composition, or nothing when the result is a redirect or not found.
|
|
60
|
-
*
|
|
61
|
-
*
|
|
70
|
+
* Renders a resolved composition, or nothing when the result is a redirect or not found. Render it
|
|
71
|
+
* before the root layout's `UniformContext`, and set `pageComposition` on the page's primary
|
|
72
|
+
* composition.
|
|
62
73
|
*/
|
|
63
74
|
declare function UniformResolvedComposition(props: UniformResolvedCompositionProps): React.JSX.Element;
|
|
64
75
|
|
package/dist/{UniformResolvedComposition-DxnyzdYY.d.ts → UniformResolvedComposition-Dr73WwIO.d.ts}
RENAMED
|
@@ -13,6 +13,10 @@ type CompositionCache = {
|
|
|
13
13
|
componentId: string;
|
|
14
14
|
}) => ComponentInstance | null;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Creates a cache of the compositions rendered during a request, which components read with
|
|
18
|
+
* `getUniformComposition` and `getUniformComponent`. Each request starts empty.
|
|
19
|
+
*/
|
|
16
20
|
declare const createCompositionCache: () => CompositionCache;
|
|
17
21
|
|
|
18
22
|
type ResolveComponentResult = {
|
|
@@ -50,15 +54,22 @@ type UniformResolvedCompositionProps = {
|
|
|
50
54
|
* Function to map empty placeholders to React components.
|
|
51
55
|
*/
|
|
52
56
|
resolveEmptyPlaceholder?: ResolveEmptyPlaceholderFunction;
|
|
57
|
+
/**
|
|
58
|
+
* Marks the page's primary composition. It sets the composition metadata of the visitor's
|
|
59
|
+
* context, which Uniform Insights attributes page hits and goals to, and the default consent
|
|
60
|
+
* from its page state. In the editor and draft states it also loads the contextual editing
|
|
61
|
+
* script. Set it on one composition per page.
|
|
62
|
+
*/
|
|
63
|
+
pageComposition?: boolean;
|
|
53
64
|
/**
|
|
54
65
|
* Composition cache, will be used to cache the composition.
|
|
55
66
|
*/
|
|
56
67
|
compositionCache?: CompositionCache;
|
|
57
68
|
};
|
|
58
69
|
/**
|
|
59
|
-
* Renders a resolved composition, or nothing when the result is a redirect or not found.
|
|
60
|
-
*
|
|
61
|
-
*
|
|
70
|
+
* Renders a resolved composition, or nothing when the result is a redirect or not found. Render it
|
|
71
|
+
* before the root layout's `UniformContext`, and set `pageComposition` on the page's primary
|
|
72
|
+
* composition.
|
|
62
73
|
*/
|
|
63
74
|
declare function UniformResolvedComposition(props: UniformResolvedCompositionProps): React.JSX.Element;
|
|
64
75
|
|
package/dist/cache.d.mts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { R as ResolveCompositionByIdOptions, a as ResolveCompositionBySlugOptions, b as ResolveRouteFromCodeOptions, c as ResolveRouteFromPathOptions } from './resolveRouteFromPath-
|
|
1
|
+
import { R as ResolveCompositionByIdOptions, a as ResolveCompositionBySlugOptions, b as ResolveRouteFromCodeOptions, c as ResolveRouteFromPathOptions } from './resolveRouteFromPath-DWNRjFHQ.mjs';
|
|
2
2
|
import { R as ResolvedCompositionResult, a as ResolvedRouteResult } from './composition-C7voY4YR.mjs';
|
|
3
3
|
import '@uniformdev/next-app-router-shared';
|
|
4
4
|
import '@uniformdev/canvas';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* `resolveRouteFromCode` inside a `'use cache'` scope for published content, tagged with the
|
|
8
|
-
* route path and the resolved composition id. Other
|
|
8
|
+
* project map patterns that can match the route path and the resolved composition id. Other
|
|
9
|
+
* states resolve uncached.
|
|
9
10
|
*/
|
|
10
11
|
declare const resolveRouteFromCode: ({ code, }: ResolveRouteFromCodeOptions) => Promise<ResolvedRouteResult>;
|
|
11
12
|
/**
|
|
12
|
-
* `resolveRouteFromPath` inside a `'use cache'` scope for published content, tagged with the
|
|
13
|
-
* and the resolved composition id. Other states
|
|
13
|
+
* `resolveRouteFromPath` inside a `'use cache'` scope for published content, tagged with the
|
|
14
|
+
* project map patterns that can match the path and the resolved composition id. Other states
|
|
15
|
+
* resolve uncached.
|
|
14
16
|
*/
|
|
15
17
|
declare const resolveRouteFromPath: ({ path, ...source }: ResolveRouteFromPathOptions) => Promise<ResolvedRouteResult>;
|
|
16
18
|
/**
|
package/dist/cache.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { R as ResolveCompositionByIdOptions, a as ResolveCompositionBySlugOptions, b as ResolveRouteFromCodeOptions, c as ResolveRouteFromPathOptions } from './resolveRouteFromPath-
|
|
1
|
+
import { R as ResolveCompositionByIdOptions, a as ResolveCompositionBySlugOptions, b as ResolveRouteFromCodeOptions, c as ResolveRouteFromPathOptions } from './resolveRouteFromPath-BpuMu5ZS.js';
|
|
2
2
|
import { R as ResolvedCompositionResult, a as ResolvedRouteResult } from './composition-C7voY4YR.js';
|
|
3
3
|
import '@uniformdev/next-app-router-shared';
|
|
4
4
|
import '@uniformdev/canvas';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* `resolveRouteFromCode` inside a `'use cache'` scope for published content, tagged with the
|
|
8
|
-
* route path and the resolved composition id. Other
|
|
8
|
+
* project map patterns that can match the route path and the resolved composition id. Other
|
|
9
|
+
* states resolve uncached.
|
|
9
10
|
*/
|
|
10
11
|
declare const resolveRouteFromCode: ({ code, }: ResolveRouteFromCodeOptions) => Promise<ResolvedRouteResult>;
|
|
11
12
|
/**
|
|
12
|
-
* `resolveRouteFromPath` inside a `'use cache'` scope for published content, tagged with the
|
|
13
|
-
* and the resolved composition id. Other states
|
|
13
|
+
* `resolveRouteFromPath` inside a `'use cache'` scope for published content, tagged with the
|
|
14
|
+
* project map patterns that can match the path and the resolved composition id. Other states
|
|
15
|
+
* resolve uncached.
|
|
14
16
|
*/
|
|
15
17
|
declare const resolveRouteFromPath: ({ path, ...source }: ResolveRouteFromPathOptions) => Promise<ResolvedRouteResult>;
|
|
16
18
|
/**
|
package/dist/cache.js
CHANGED
|
@@ -1135,10 +1135,56 @@ var import_cache5 = require("next/cache");
|
|
|
1135
1135
|
|
|
1136
1136
|
// src/utils/tag.ts
|
|
1137
1137
|
var encodePathForTag = (path) => path.split("/").map((segment) => /[^\x00-\x7F]/.test(segment) ? encodeURIComponent(segment) : segment).join("/");
|
|
1138
|
-
var
|
|
1139
|
-
|
|
1140
|
-
|
|
1138
|
+
var ROUTE_TAG = "route";
|
|
1139
|
+
var FETCH_CACHED_ROUTE_TAG = "route-fetch";
|
|
1140
|
+
var COMPOSITIONS_TAG = "compositions";
|
|
1141
|
+
var MAX_SHAPE_SEGMENTS = 4;
|
|
1142
|
+
var DYNAMIC_SEGMENT = ":";
|
|
1143
|
+
var MAX_TAG_LENGTH = 256;
|
|
1144
|
+
var hashString = (value) => {
|
|
1145
|
+
let hash = 2166136261;
|
|
1146
|
+
for (let i = 0; i < value.length; i++) {
|
|
1147
|
+
hash ^= value.charCodeAt(i);
|
|
1148
|
+
hash = Math.imul(hash, 16777619);
|
|
1149
|
+
}
|
|
1150
|
+
return (hash >>> 0).toString(16);
|
|
1141
1151
|
};
|
|
1152
|
+
var limitTagLength = (tag) => tag.length > MAX_TAG_LENGTH ? `${tag.slice(0, MAX_TAG_LENGTH - 9)}#${hashString(tag)}` : tag;
|
|
1153
|
+
var toTagSegments = (path) => {
|
|
1154
|
+
var _a;
|
|
1155
|
+
return encodePathForTag((_a = path.split("?")[0]) != null ? _a : "").toLowerCase().split("/").filter(Boolean);
|
|
1156
|
+
};
|
|
1157
|
+
var buildShapes = (segments) => segments.reduce(
|
|
1158
|
+
(shapes, segment) => shapes.flatMap((shape) => [
|
|
1159
|
+
[...shape, segment],
|
|
1160
|
+
[...shape, DYNAMIC_SEGMENT]
|
|
1161
|
+
]),
|
|
1162
|
+
[[]]
|
|
1163
|
+
);
|
|
1164
|
+
var buildShapeTag = (shape, segmentCount) => {
|
|
1165
|
+
const deeper = segmentCount > shape.length ? `/+${segmentCount - shape.length}` : "";
|
|
1166
|
+
return limitTagLength(`route-shape:/${shape.join("/")}${deeper}`);
|
|
1167
|
+
};
|
|
1168
|
+
var buildSubtreeTag = (shape) => limitTagLength(`route-subtree:/${shape.join("/")}`);
|
|
1169
|
+
var buildRouteShapeTags = (path) => {
|
|
1170
|
+
const segments = toTagSegments(path);
|
|
1171
|
+
return buildShapes(segments.slice(0, MAX_SHAPE_SEGMENTS)).map(
|
|
1172
|
+
(shape) => buildShapeTag(shape, segments.length)
|
|
1173
|
+
);
|
|
1174
|
+
};
|
|
1175
|
+
var buildRouteSubtreeTags = (path) => {
|
|
1176
|
+
const segments = toTagSegments(path);
|
|
1177
|
+
const prefixLengths = Math.min(segments.length, MAX_SHAPE_SEGMENTS + 1);
|
|
1178
|
+
return Array.from(
|
|
1179
|
+
{ length: prefixLengths },
|
|
1180
|
+
(_, length) => buildShapes(segments.slice(0, length)).map(buildSubtreeTag)
|
|
1181
|
+
).flat();
|
|
1182
|
+
};
|
|
1183
|
+
var buildRouteTags = (path) => [
|
|
1184
|
+
ROUTE_TAG,
|
|
1185
|
+
...buildRouteShapeTags(path),
|
|
1186
|
+
...buildRouteSubtreeTags(path)
|
|
1187
|
+
];
|
|
1142
1188
|
var buildCompositionTag = (compositionId) => {
|
|
1143
1189
|
return `composition:${compositionId}`.toLowerCase();
|
|
1144
1190
|
};
|
|
@@ -1147,19 +1193,7 @@ var buildCompositionSlugTag = (slug) => {
|
|
|
1147
1193
|
};
|
|
1148
1194
|
|
|
1149
1195
|
// src/clients/tags.ts
|
|
1150
|
-
var generateRouteCacheTags = ({ path }) =>
|
|
1151
|
-
const tags = ["route"];
|
|
1152
|
-
if (path) {
|
|
1153
|
-
const pathWithoutQuery = path.split("?")[0];
|
|
1154
|
-
const pieces = pathWithoutQuery.split("/");
|
|
1155
|
-
for (let i = 0; i < pieces.length; i++) {
|
|
1156
|
-
const segmentPieces = pieces.slice(0, i + 1);
|
|
1157
|
-
const segment = segmentPieces.join("/");
|
|
1158
|
-
tags.push(buildPathTag(segment));
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
return tags;
|
|
1162
|
-
};
|
|
1196
|
+
var generateRouteCacheTags = ({ path }) => buildRouteTags(path);
|
|
1163
1197
|
|
|
1164
1198
|
// src/clients/canvas.ts
|
|
1165
1199
|
var import_server_only = require("server-only");
|
|
@@ -1423,7 +1457,7 @@ var buildCanvasClientOptions = (options) => {
|
|
|
1423
1457
|
} else {
|
|
1424
1458
|
requestedUrl = new URL(req.url);
|
|
1425
1459
|
}
|
|
1426
|
-
const tags = [];
|
|
1460
|
+
const tags = [COMPOSITIONS_TAG];
|
|
1427
1461
|
if (requestedUrl) {
|
|
1428
1462
|
const compositionIdKey = "compositionId";
|
|
1429
1463
|
const compositionIdsKey = "compositionIDs";
|
|
@@ -1467,7 +1501,7 @@ var getCompositionDeliveryClient = (options) => {
|
|
|
1467
1501
|
// src/clients/route.ts
|
|
1468
1502
|
var import_server_only2 = require("server-only");
|
|
1469
1503
|
var getRouteCacheTags = (requestedUrl) => {
|
|
1470
|
-
const tags = [
|
|
1504
|
+
const tags = [ROUTE_TAG];
|
|
1471
1505
|
if (requestedUrl) {
|
|
1472
1506
|
const pathKey = "path";
|
|
1473
1507
|
const path = requestedUrl.searchParams.get(pathKey);
|
|
@@ -1496,8 +1530,11 @@ var getRouteClient = (options) => {
|
|
|
1496
1530
|
} else {
|
|
1497
1531
|
requestedUrl = new URL(req.url);
|
|
1498
1532
|
}
|
|
1499
|
-
const tags = getRouteCacheTags(requestedUrl);
|
|
1500
1533
|
const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
|
|
1534
|
+
const tags = [
|
|
1535
|
+
...getRouteCacheTags(requestedUrl),
|
|
1536
|
+
...fetchCache === "no-cache" || fetchCache === "no-store" ? [] : [FETCH_CACHED_ROUTE_TAG]
|
|
1537
|
+
];
|
|
1501
1538
|
return fetch(req, {
|
|
1502
1539
|
...init,
|
|
1503
1540
|
headers: {
|
|
@@ -1598,10 +1635,32 @@ var DataClient = class {
|
|
|
1598
1635
|
var import_next_app_router_shared = require("@uniformdev/next-app-router-shared");
|
|
1599
1636
|
var deserializePageState = ({ code }) => (0, import_next_app_router_shared.deserializeEvaluationResult)({ input: code });
|
|
1600
1637
|
|
|
1638
|
+
// src/config/helpers.ts
|
|
1639
|
+
var import_resolved = __toESM(require("@uniformdev/next-app-router/config/resolved"));
|
|
1640
|
+
var getDefaultConsent = () => {
|
|
1641
|
+
if (typeof import_resolved.default.defaultConsent === "boolean") {
|
|
1642
|
+
return import_resolved.default.defaultConsent;
|
|
1643
|
+
}
|
|
1644
|
+
return false;
|
|
1645
|
+
};
|
|
1646
|
+
|
|
1601
1647
|
// src/data/pageStateFromSource.ts
|
|
1602
1648
|
var pageStateFromSource = (source) => {
|
|
1603
|
-
|
|
1604
|
-
|
|
1649
|
+
if (source.pageState) {
|
|
1650
|
+
return source.pageState;
|
|
1651
|
+
}
|
|
1652
|
+
if (source.code !== void 0) {
|
|
1653
|
+
return deserializePageState({ code: source.code });
|
|
1654
|
+
}
|
|
1655
|
+
return {
|
|
1656
|
+
compositionState: CANVAS_PUBLISHED_STATE,
|
|
1657
|
+
routePath: "/",
|
|
1658
|
+
keys: void 0,
|
|
1659
|
+
releaseId: void 0,
|
|
1660
|
+
defaultConsent: getDefaultConsent(),
|
|
1661
|
+
previewMode: void 0,
|
|
1662
|
+
locale: void 0
|
|
1663
|
+
};
|
|
1605
1664
|
};
|
|
1606
1665
|
|
|
1607
1666
|
// src/data/resolveCompositionForPageState.ts
|
|
@@ -1697,6 +1756,7 @@ var resolveCompositionCached = async (pageState, selector, matchedRoute) => {
|
|
|
1697
1756
|
dataClient: createScopeDataClient()
|
|
1698
1757
|
}),
|
|
1699
1758
|
[
|
|
1759
|
+
COMPOSITIONS_TAG,
|
|
1700
1760
|
"compositionId" in selector ? buildCompositionTag(selector.compositionId) : buildCompositionSlugTag(selector.slug)
|
|
1701
1761
|
]
|
|
1702
1762
|
);
|
package/dist/cache.mjs
CHANGED
|
@@ -1119,10 +1119,56 @@ import { cacheTag } from "next/cache";
|
|
|
1119
1119
|
|
|
1120
1120
|
// src/utils/tag.ts
|
|
1121
1121
|
var encodePathForTag = (path) => path.split("/").map((segment) => /[^\x00-\x7F]/.test(segment) ? encodeURIComponent(segment) : segment).join("/");
|
|
1122
|
-
var
|
|
1123
|
-
|
|
1124
|
-
|
|
1122
|
+
var ROUTE_TAG = "route";
|
|
1123
|
+
var FETCH_CACHED_ROUTE_TAG = "route-fetch";
|
|
1124
|
+
var COMPOSITIONS_TAG = "compositions";
|
|
1125
|
+
var MAX_SHAPE_SEGMENTS = 4;
|
|
1126
|
+
var DYNAMIC_SEGMENT = ":";
|
|
1127
|
+
var MAX_TAG_LENGTH = 256;
|
|
1128
|
+
var hashString = (value) => {
|
|
1129
|
+
let hash = 2166136261;
|
|
1130
|
+
for (let i = 0; i < value.length; i++) {
|
|
1131
|
+
hash ^= value.charCodeAt(i);
|
|
1132
|
+
hash = Math.imul(hash, 16777619);
|
|
1133
|
+
}
|
|
1134
|
+
return (hash >>> 0).toString(16);
|
|
1125
1135
|
};
|
|
1136
|
+
var limitTagLength = (tag) => tag.length > MAX_TAG_LENGTH ? `${tag.slice(0, MAX_TAG_LENGTH - 9)}#${hashString(tag)}` : tag;
|
|
1137
|
+
var toTagSegments = (path) => {
|
|
1138
|
+
var _a;
|
|
1139
|
+
return encodePathForTag((_a = path.split("?")[0]) != null ? _a : "").toLowerCase().split("/").filter(Boolean);
|
|
1140
|
+
};
|
|
1141
|
+
var buildShapes = (segments) => segments.reduce(
|
|
1142
|
+
(shapes, segment) => shapes.flatMap((shape) => [
|
|
1143
|
+
[...shape, segment],
|
|
1144
|
+
[...shape, DYNAMIC_SEGMENT]
|
|
1145
|
+
]),
|
|
1146
|
+
[[]]
|
|
1147
|
+
);
|
|
1148
|
+
var buildShapeTag = (shape, segmentCount) => {
|
|
1149
|
+
const deeper = segmentCount > shape.length ? `/+${segmentCount - shape.length}` : "";
|
|
1150
|
+
return limitTagLength(`route-shape:/${shape.join("/")}${deeper}`);
|
|
1151
|
+
};
|
|
1152
|
+
var buildSubtreeTag = (shape) => limitTagLength(`route-subtree:/${shape.join("/")}`);
|
|
1153
|
+
var buildRouteShapeTags = (path) => {
|
|
1154
|
+
const segments = toTagSegments(path);
|
|
1155
|
+
return buildShapes(segments.slice(0, MAX_SHAPE_SEGMENTS)).map(
|
|
1156
|
+
(shape) => buildShapeTag(shape, segments.length)
|
|
1157
|
+
);
|
|
1158
|
+
};
|
|
1159
|
+
var buildRouteSubtreeTags = (path) => {
|
|
1160
|
+
const segments = toTagSegments(path);
|
|
1161
|
+
const prefixLengths = Math.min(segments.length, MAX_SHAPE_SEGMENTS + 1);
|
|
1162
|
+
return Array.from(
|
|
1163
|
+
{ length: prefixLengths },
|
|
1164
|
+
(_, length) => buildShapes(segments.slice(0, length)).map(buildSubtreeTag)
|
|
1165
|
+
).flat();
|
|
1166
|
+
};
|
|
1167
|
+
var buildRouteTags = (path) => [
|
|
1168
|
+
ROUTE_TAG,
|
|
1169
|
+
...buildRouteShapeTags(path),
|
|
1170
|
+
...buildRouteSubtreeTags(path)
|
|
1171
|
+
];
|
|
1126
1172
|
var buildCompositionTag = (compositionId) => {
|
|
1127
1173
|
return `composition:${compositionId}`.toLowerCase();
|
|
1128
1174
|
};
|
|
@@ -1131,19 +1177,7 @@ var buildCompositionSlugTag = (slug) => {
|
|
|
1131
1177
|
};
|
|
1132
1178
|
|
|
1133
1179
|
// src/clients/tags.ts
|
|
1134
|
-
var generateRouteCacheTags = ({ path }) =>
|
|
1135
|
-
const tags = ["route"];
|
|
1136
|
-
if (path) {
|
|
1137
|
-
const pathWithoutQuery = path.split("?")[0];
|
|
1138
|
-
const pieces = pathWithoutQuery.split("/");
|
|
1139
|
-
for (let i = 0; i < pieces.length; i++) {
|
|
1140
|
-
const segmentPieces = pieces.slice(0, i + 1);
|
|
1141
|
-
const segment = segmentPieces.join("/");
|
|
1142
|
-
tags.push(buildPathTag(segment));
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
return tags;
|
|
1146
|
-
};
|
|
1180
|
+
var generateRouteCacheTags = ({ path }) => buildRouteTags(path);
|
|
1147
1181
|
|
|
1148
1182
|
// src/clients/canvas.ts
|
|
1149
1183
|
import "server-only";
|
|
@@ -1407,7 +1441,7 @@ var buildCanvasClientOptions = (options) => {
|
|
|
1407
1441
|
} else {
|
|
1408
1442
|
requestedUrl = new URL(req.url);
|
|
1409
1443
|
}
|
|
1410
|
-
const tags = [];
|
|
1444
|
+
const tags = [COMPOSITIONS_TAG];
|
|
1411
1445
|
if (requestedUrl) {
|
|
1412
1446
|
const compositionIdKey = "compositionId";
|
|
1413
1447
|
const compositionIdsKey = "compositionIDs";
|
|
@@ -1451,7 +1485,7 @@ var getCompositionDeliveryClient = (options) => {
|
|
|
1451
1485
|
// src/clients/route.ts
|
|
1452
1486
|
import "server-only";
|
|
1453
1487
|
var getRouteCacheTags = (requestedUrl) => {
|
|
1454
|
-
const tags = [
|
|
1488
|
+
const tags = [ROUTE_TAG];
|
|
1455
1489
|
if (requestedUrl) {
|
|
1456
1490
|
const pathKey = "path";
|
|
1457
1491
|
const path = requestedUrl.searchParams.get(pathKey);
|
|
@@ -1480,8 +1514,11 @@ var getRouteClient = (options) => {
|
|
|
1480
1514
|
} else {
|
|
1481
1515
|
requestedUrl = new URL(req.url);
|
|
1482
1516
|
}
|
|
1483
|
-
const tags = getRouteCacheTags(requestedUrl);
|
|
1484
1517
|
const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
|
|
1518
|
+
const tags = [
|
|
1519
|
+
...getRouteCacheTags(requestedUrl),
|
|
1520
|
+
...fetchCache === "no-cache" || fetchCache === "no-store" ? [] : [FETCH_CACHED_ROUTE_TAG]
|
|
1521
|
+
];
|
|
1485
1522
|
return fetch(req, {
|
|
1486
1523
|
...init,
|
|
1487
1524
|
headers: {
|
|
@@ -1582,10 +1619,32 @@ var DataClient = class {
|
|
|
1582
1619
|
import { deserializeEvaluationResult } from "@uniformdev/next-app-router-shared";
|
|
1583
1620
|
var deserializePageState = ({ code }) => deserializeEvaluationResult({ input: code });
|
|
1584
1621
|
|
|
1622
|
+
// src/config/helpers.ts
|
|
1623
|
+
import config from "@uniformdev/next-app-router/config/resolved";
|
|
1624
|
+
var getDefaultConsent = () => {
|
|
1625
|
+
if (typeof config.defaultConsent === "boolean") {
|
|
1626
|
+
return config.defaultConsent;
|
|
1627
|
+
}
|
|
1628
|
+
return false;
|
|
1629
|
+
};
|
|
1630
|
+
|
|
1585
1631
|
// src/data/pageStateFromSource.ts
|
|
1586
1632
|
var pageStateFromSource = (source) => {
|
|
1587
|
-
|
|
1588
|
-
|
|
1633
|
+
if (source.pageState) {
|
|
1634
|
+
return source.pageState;
|
|
1635
|
+
}
|
|
1636
|
+
if (source.code !== void 0) {
|
|
1637
|
+
return deserializePageState({ code: source.code });
|
|
1638
|
+
}
|
|
1639
|
+
return {
|
|
1640
|
+
compositionState: CANVAS_PUBLISHED_STATE,
|
|
1641
|
+
routePath: "/",
|
|
1642
|
+
keys: void 0,
|
|
1643
|
+
releaseId: void 0,
|
|
1644
|
+
defaultConsent: getDefaultConsent(),
|
|
1645
|
+
previewMode: void 0,
|
|
1646
|
+
locale: void 0
|
|
1647
|
+
};
|
|
1589
1648
|
};
|
|
1590
1649
|
|
|
1591
1650
|
// src/data/resolveCompositionForPageState.ts
|
|
@@ -1681,6 +1740,7 @@ var resolveCompositionCached = async (pageState, selector, matchedRoute) => {
|
|
|
1681
1740
|
dataClient: createScopeDataClient()
|
|
1682
1741
|
}),
|
|
1683
1742
|
[
|
|
1743
|
+
COMPOSITIONS_TAG,
|
|
1684
1744
|
"compositionId" in selector ? buildCompositionTag(selector.compositionId) : buildCompositionSlugTag(selector.slug)
|
|
1685
1745
|
]
|
|
1686
1746
|
);
|
package/dist/cf-vinext.d.mts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { C as CreateEdgeRouteStoreOptions, a as CreateCachedManifestProviderOptions, U as UniformEdgeMiddlewareOptions } from './uniformEdgeMiddleware-
|
|
1
|
+
import { C as CreateEdgeRouteStoreOptions, a as CreateCachedManifestProviderOptions, U as UniformEdgeMiddlewareOptions } from './uniformEdgeMiddleware-BcitsCE7.mjs';
|
|
2
2
|
import { E as EdgeRouteStore, M as ManifestProvider, a as EdgeRouteFilter } from './models-kIvBB7Tv.mjs';
|
|
3
3
|
import * as next_server from 'next/server';
|
|
4
4
|
import '@uniformdev/context';
|
|
5
5
|
import './middleware.mjs';
|
|
6
6
|
import '@uniformdev/next-app-router-shared';
|
|
7
|
+
import './createPreviewGETRouteHandler-ii7w-gAc.mjs';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Creates an edge route store for `uniformEdgeMiddleware` that keeps its records in vinext's data
|
|
10
|
-
* cache, tagged
|
|
11
|
+
* cache, tagged like a cached route for each page's path, so publishing a composition or changing the project
|
|
11
12
|
* map expires the records of its paths through the preview route handler's `revalidateTag`.
|
|
12
13
|
*
|
|
13
14
|
* Requires the optional peer dependency `vinext`.
|
package/dist/cf-vinext.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { C as CreateEdgeRouteStoreOptions, a as CreateCachedManifestProviderOptions, U as UniformEdgeMiddlewareOptions } from './uniformEdgeMiddleware-
|
|
1
|
+
import { C as CreateEdgeRouteStoreOptions, a as CreateCachedManifestProviderOptions, U as UniformEdgeMiddlewareOptions } from './uniformEdgeMiddleware-D2frG4_C.js';
|
|
2
2
|
import { E as EdgeRouteStore, M as ManifestProvider, a as EdgeRouteFilter } from './models-kIvBB7Tv.js';
|
|
3
3
|
import * as next_server from 'next/server';
|
|
4
4
|
import '@uniformdev/context';
|
|
5
5
|
import './middleware.js';
|
|
6
6
|
import '@uniformdev/next-app-router-shared';
|
|
7
|
+
import './createPreviewGETRouteHandler-ii7w-gAc.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Creates an edge route store for `uniformEdgeMiddleware` that keeps its records in vinext's data
|
|
10
|
-
* cache, tagged
|
|
11
|
+
* cache, tagged like a cached route for each page's path, so publishing a composition or changing the project
|
|
11
12
|
* map expires the records of its paths through the preview route handler's `revalidateTag`.
|
|
12
13
|
*
|
|
13
14
|
* Requires the optional peer dependency `vinext`.
|