@uniformdev/next-app-router 20.7.1-alpha.121 → 20.7.1-alpha.122
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/cache.js +2 -1
- package/dist/cache.mjs +2 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +13 -7
- package/dist/index.js +13 -7
- package/dist/index.mjs +13 -7
- package/dist/middleware.d.mts +4 -0
- package/dist/middleware.d.ts +4 -0
- package/dist/middleware.js +18 -58
- package/dist/middleware.mjs +18 -58
- package/package.json +8 -8
package/dist/cache.js
CHANGED
|
@@ -1845,7 +1845,8 @@ var DefaultDataClient = class {
|
|
|
1845
1845
|
path: options.pageState.routePath,
|
|
1846
1846
|
state: options.pageState.compositionState,
|
|
1847
1847
|
withComponentIDs: true,
|
|
1848
|
-
releaseId: options.pageState.releaseId
|
|
1848
|
+
releaseId: options.pageState.releaseId,
|
|
1849
|
+
locale: options.pageState.locale
|
|
1849
1850
|
};
|
|
1850
1851
|
const resolvedRoute = await this.getRouteFromApi({
|
|
1851
1852
|
source: "pageState",
|
package/dist/cache.mjs
CHANGED
|
@@ -1834,7 +1834,8 @@ var DefaultDataClient = class {
|
|
|
1834
1834
|
path: options.pageState.routePath,
|
|
1835
1835
|
state: options.pageState.compositionState,
|
|
1836
1836
|
withComponentIDs: true,
|
|
1837
|
-
releaseId: options.pageState.releaseId
|
|
1837
|
+
releaseId: options.pageState.releaseId,
|
|
1838
|
+
locale: options.pageState.locale
|
|
1838
1839
|
};
|
|
1839
1840
|
const resolvedRoute = await this.getRouteFromApi({
|
|
1840
1841
|
source: "pageState",
|
package/dist/index.d.mts
CHANGED
|
@@ -214,6 +214,7 @@ type CreateStaticParamsOptions = {
|
|
|
214
214
|
rewrite?: (options: {
|
|
215
215
|
path: string;
|
|
216
216
|
}) => Promise<RewriteRequestPathResult | undefined>;
|
|
217
|
+
locale?: string;
|
|
217
218
|
};
|
|
218
219
|
/**
|
|
219
220
|
* Function to generate all possible page states for the given paths in playground mode.
|
package/dist/index.d.ts
CHANGED
|
@@ -214,6 +214,7 @@ type CreateStaticParamsOptions = {
|
|
|
214
214
|
rewrite?: (options: {
|
|
215
215
|
path: string;
|
|
216
216
|
}) => Promise<RewriteRequestPathResult | undefined>;
|
|
217
|
+
locale?: string;
|
|
217
218
|
};
|
|
218
219
|
/**
|
|
219
220
|
* Function to generate all possible page states for the given paths in playground mode.
|
package/dist/index.esm.js
CHANGED
|
@@ -3356,7 +3356,8 @@ var createUniformPlaygroundStaticParams = async (options) => {
|
|
|
3356
3356
|
runnables,
|
|
3357
3357
|
path: route.compositionApiResponse.composition._id,
|
|
3358
3358
|
keys: void 0,
|
|
3359
|
-
state: route.compositionApiResponse.state
|
|
3359
|
+
state: route.compositionApiResponse.state,
|
|
3360
|
+
locale: options.locale
|
|
3360
3361
|
});
|
|
3361
3362
|
return (_a = choices == null ? void 0 : choices.map((code) => {
|
|
3362
3363
|
return {
|
|
@@ -3369,7 +3370,7 @@ var createUniformStaticParams = async (options) => {
|
|
|
3369
3370
|
const { paths, rewrite } = options;
|
|
3370
3371
|
const codes = [];
|
|
3371
3372
|
for (const path of paths) {
|
|
3372
|
-
const pageStates = await processRoutePath({ path, rewrite });
|
|
3373
|
+
const pageStates = await processRoutePath({ path, rewrite, locale: options.locale });
|
|
3373
3374
|
if (pageStates) {
|
|
3374
3375
|
codes.push(...pageStates);
|
|
3375
3376
|
}
|
|
@@ -3382,7 +3383,8 @@ var createUniformStaticParams = async (options) => {
|
|
|
3382
3383
|
};
|
|
3383
3384
|
async function processRoutePath({
|
|
3384
3385
|
path,
|
|
3385
|
-
rewrite
|
|
3386
|
+
rewrite,
|
|
3387
|
+
locale
|
|
3386
3388
|
}) {
|
|
3387
3389
|
var _a;
|
|
3388
3390
|
const routeClient = getRouteClient({
|
|
@@ -3403,7 +3405,8 @@ async function processRoutePath({
|
|
|
3403
3405
|
runnables,
|
|
3404
3406
|
path: resolvedPath,
|
|
3405
3407
|
keys: rewrittenPath == null ? void 0 : rewrittenPath.keys,
|
|
3406
|
-
state: CANVAS_PUBLISHED_STATE
|
|
3408
|
+
state: CANVAS_PUBLISHED_STATE,
|
|
3409
|
+
locale
|
|
3407
3410
|
});
|
|
3408
3411
|
return choices;
|
|
3409
3412
|
}
|
|
@@ -3521,7 +3524,8 @@ var generatePossiblePageStates = ({
|
|
|
3521
3524
|
runnables,
|
|
3522
3525
|
path,
|
|
3523
3526
|
keys,
|
|
3524
|
-
state
|
|
3527
|
+
state,
|
|
3528
|
+
locale
|
|
3525
3529
|
}) => {
|
|
3526
3530
|
const dependencyMap = buildDependencyMap(runnables);
|
|
3527
3531
|
const initialState = {
|
|
@@ -3532,7 +3536,8 @@ var generatePossiblePageStates = ({
|
|
|
3532
3536
|
components: {},
|
|
3533
3537
|
defaultConsent: void 0,
|
|
3534
3538
|
previewMode: void 0,
|
|
3535
|
-
rules: void 0
|
|
3539
|
+
rules: void 0,
|
|
3540
|
+
locale
|
|
3536
3541
|
};
|
|
3537
3542
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3538
3543
|
return allStates.map((payload) => serializeEvaluationResult({ payload }));
|
|
@@ -3702,7 +3707,8 @@ var DefaultDataClient = class {
|
|
|
3702
3707
|
path: options.pageState.routePath,
|
|
3703
3708
|
state: options.pageState.compositionState,
|
|
3704
3709
|
withComponentIDs: true,
|
|
3705
|
-
releaseId: options.pageState.releaseId
|
|
3710
|
+
releaseId: options.pageState.releaseId,
|
|
3711
|
+
locale: options.pageState.locale
|
|
3706
3712
|
};
|
|
3707
3713
|
const resolvedRoute = await this.getRouteFromApi({
|
|
3708
3714
|
source: "pageState",
|
package/dist/index.js
CHANGED
|
@@ -3377,7 +3377,8 @@ var createUniformPlaygroundStaticParams = async (options) => {
|
|
|
3377
3377
|
runnables,
|
|
3378
3378
|
path: route.compositionApiResponse.composition._id,
|
|
3379
3379
|
keys: void 0,
|
|
3380
|
-
state: route.compositionApiResponse.state
|
|
3380
|
+
state: route.compositionApiResponse.state,
|
|
3381
|
+
locale: options.locale
|
|
3381
3382
|
});
|
|
3382
3383
|
return (_a = choices == null ? void 0 : choices.map((code) => {
|
|
3383
3384
|
return {
|
|
@@ -3390,7 +3391,7 @@ var createUniformStaticParams = async (options) => {
|
|
|
3390
3391
|
const { paths, rewrite } = options;
|
|
3391
3392
|
const codes = [];
|
|
3392
3393
|
for (const path of paths) {
|
|
3393
|
-
const pageStates = await processRoutePath({ path, rewrite });
|
|
3394
|
+
const pageStates = await processRoutePath({ path, rewrite, locale: options.locale });
|
|
3394
3395
|
if (pageStates) {
|
|
3395
3396
|
codes.push(...pageStates);
|
|
3396
3397
|
}
|
|
@@ -3403,7 +3404,8 @@ var createUniformStaticParams = async (options) => {
|
|
|
3403
3404
|
};
|
|
3404
3405
|
async function processRoutePath({
|
|
3405
3406
|
path,
|
|
3406
|
-
rewrite
|
|
3407
|
+
rewrite,
|
|
3408
|
+
locale
|
|
3407
3409
|
}) {
|
|
3408
3410
|
var _a;
|
|
3409
3411
|
const routeClient = getRouteClient({
|
|
@@ -3424,7 +3426,8 @@ async function processRoutePath({
|
|
|
3424
3426
|
runnables,
|
|
3425
3427
|
path: resolvedPath,
|
|
3426
3428
|
keys: rewrittenPath == null ? void 0 : rewrittenPath.keys,
|
|
3427
|
-
state: CANVAS_PUBLISHED_STATE
|
|
3429
|
+
state: CANVAS_PUBLISHED_STATE,
|
|
3430
|
+
locale
|
|
3428
3431
|
});
|
|
3429
3432
|
return choices;
|
|
3430
3433
|
}
|
|
@@ -3542,7 +3545,8 @@ var generatePossiblePageStates = ({
|
|
|
3542
3545
|
runnables,
|
|
3543
3546
|
path,
|
|
3544
3547
|
keys,
|
|
3545
|
-
state
|
|
3548
|
+
state,
|
|
3549
|
+
locale
|
|
3546
3550
|
}) => {
|
|
3547
3551
|
const dependencyMap = buildDependencyMap(runnables);
|
|
3548
3552
|
const initialState = {
|
|
@@ -3553,7 +3557,8 @@ var generatePossiblePageStates = ({
|
|
|
3553
3557
|
components: {},
|
|
3554
3558
|
defaultConsent: void 0,
|
|
3555
3559
|
previewMode: void 0,
|
|
3556
|
-
rules: void 0
|
|
3560
|
+
rules: void 0,
|
|
3561
|
+
locale
|
|
3557
3562
|
};
|
|
3558
3563
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3559
3564
|
return allStates.map((payload) => (0, import_next_app_router_shared8.serializeEvaluationResult)({ payload }));
|
|
@@ -3723,7 +3728,8 @@ var DefaultDataClient = class {
|
|
|
3723
3728
|
path: options.pageState.routePath,
|
|
3724
3729
|
state: options.pageState.compositionState,
|
|
3725
3730
|
withComponentIDs: true,
|
|
3726
|
-
releaseId: options.pageState.releaseId
|
|
3731
|
+
releaseId: options.pageState.releaseId,
|
|
3732
|
+
locale: options.pageState.locale
|
|
3727
3733
|
};
|
|
3728
3734
|
const resolvedRoute = await this.getRouteFromApi({
|
|
3729
3735
|
source: "pageState",
|
package/dist/index.mjs
CHANGED
|
@@ -3356,7 +3356,8 @@ var createUniformPlaygroundStaticParams = async (options) => {
|
|
|
3356
3356
|
runnables,
|
|
3357
3357
|
path: route.compositionApiResponse.composition._id,
|
|
3358
3358
|
keys: void 0,
|
|
3359
|
-
state: route.compositionApiResponse.state
|
|
3359
|
+
state: route.compositionApiResponse.state,
|
|
3360
|
+
locale: options.locale
|
|
3360
3361
|
});
|
|
3361
3362
|
return (_a = choices == null ? void 0 : choices.map((code) => {
|
|
3362
3363
|
return {
|
|
@@ -3369,7 +3370,7 @@ var createUniformStaticParams = async (options) => {
|
|
|
3369
3370
|
const { paths, rewrite } = options;
|
|
3370
3371
|
const codes = [];
|
|
3371
3372
|
for (const path of paths) {
|
|
3372
|
-
const pageStates = await processRoutePath({ path, rewrite });
|
|
3373
|
+
const pageStates = await processRoutePath({ path, rewrite, locale: options.locale });
|
|
3373
3374
|
if (pageStates) {
|
|
3374
3375
|
codes.push(...pageStates);
|
|
3375
3376
|
}
|
|
@@ -3382,7 +3383,8 @@ var createUniformStaticParams = async (options) => {
|
|
|
3382
3383
|
};
|
|
3383
3384
|
async function processRoutePath({
|
|
3384
3385
|
path,
|
|
3385
|
-
rewrite
|
|
3386
|
+
rewrite,
|
|
3387
|
+
locale
|
|
3386
3388
|
}) {
|
|
3387
3389
|
var _a;
|
|
3388
3390
|
const routeClient = getRouteClient({
|
|
@@ -3403,7 +3405,8 @@ async function processRoutePath({
|
|
|
3403
3405
|
runnables,
|
|
3404
3406
|
path: resolvedPath,
|
|
3405
3407
|
keys: rewrittenPath == null ? void 0 : rewrittenPath.keys,
|
|
3406
|
-
state: CANVAS_PUBLISHED_STATE
|
|
3408
|
+
state: CANVAS_PUBLISHED_STATE,
|
|
3409
|
+
locale
|
|
3407
3410
|
});
|
|
3408
3411
|
return choices;
|
|
3409
3412
|
}
|
|
@@ -3521,7 +3524,8 @@ var generatePossiblePageStates = ({
|
|
|
3521
3524
|
runnables,
|
|
3522
3525
|
path,
|
|
3523
3526
|
keys,
|
|
3524
|
-
state
|
|
3527
|
+
state,
|
|
3528
|
+
locale
|
|
3525
3529
|
}) => {
|
|
3526
3530
|
const dependencyMap = buildDependencyMap(runnables);
|
|
3527
3531
|
const initialState = {
|
|
@@ -3532,7 +3536,8 @@ var generatePossiblePageStates = ({
|
|
|
3532
3536
|
components: {},
|
|
3533
3537
|
defaultConsent: void 0,
|
|
3534
3538
|
previewMode: void 0,
|
|
3535
|
-
rules: void 0
|
|
3539
|
+
rules: void 0,
|
|
3540
|
+
locale
|
|
3536
3541
|
};
|
|
3537
3542
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3538
3543
|
return allStates.map((payload) => serializeEvaluationResult({ payload }));
|
|
@@ -3702,7 +3707,8 @@ var DefaultDataClient = class {
|
|
|
3702
3707
|
path: options.pageState.routePath,
|
|
3703
3708
|
state: options.pageState.compositionState,
|
|
3704
3709
|
withComponentIDs: true,
|
|
3705
|
-
releaseId: options.pageState.releaseId
|
|
3710
|
+
releaseId: options.pageState.releaseId,
|
|
3711
|
+
locale: options.pageState.locale
|
|
3706
3712
|
};
|
|
3707
3713
|
const resolvedRoute = await this.getRouteFromApi({
|
|
3708
3714
|
source: "pageState",
|
package/dist/middleware.d.mts
CHANGED
|
@@ -57,6 +57,10 @@ type HandleOptions = {
|
|
|
57
57
|
* If not provided, middleware will use the server config default consent or false if not set.
|
|
58
58
|
*/
|
|
59
59
|
defaultConsent?: boolean | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* If provided, the middleware will use this locale to resolve the route.
|
|
62
|
+
*/
|
|
63
|
+
locale?: string;
|
|
60
64
|
};
|
|
61
65
|
declare const uniformMiddleware: (options?: HandleOptions) => (request: NextRequest) => Promise<NextResponse<unknown>>;
|
|
62
66
|
declare const handleUniformRoute: ({ request, dataClient, ...options }: HandleOptions & {
|
package/dist/middleware.d.ts
CHANGED
|
@@ -57,6 +57,10 @@ type HandleOptions = {
|
|
|
57
57
|
* If not provided, middleware will use the server config default consent or false if not set.
|
|
58
58
|
*/
|
|
59
59
|
defaultConsent?: boolean | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* If provided, the middleware will use this locale to resolve the route.
|
|
62
|
+
*/
|
|
63
|
+
locale?: string;
|
|
60
64
|
};
|
|
61
65
|
declare const uniformMiddleware: (options?: HandleOptions) => (request: NextRequest) => Promise<NextResponse<unknown>>;
|
|
62
66
|
declare const handleUniformRoute: ({ request, dataClient, ...options }: HandleOptions & {
|
package/dist/middleware.js
CHANGED
|
@@ -5015,7 +5015,8 @@ var DefaultDataClient = class {
|
|
|
5015
5015
|
path: options.pageState.routePath,
|
|
5016
5016
|
state: options.pageState.compositionState,
|
|
5017
5017
|
withComponentIDs: true,
|
|
5018
|
-
releaseId: options.pageState.releaseId
|
|
5018
|
+
releaseId: options.pageState.releaseId,
|
|
5019
|
+
locale: options.pageState.locale
|
|
5019
5020
|
};
|
|
5020
5021
|
const resolvedRoute = await this.getRouteFromApi({
|
|
5021
5022
|
source: "pageState",
|
|
@@ -5324,32 +5325,6 @@ var calculateScoreChanges = ({
|
|
|
5324
5325
|
return changes;
|
|
5325
5326
|
};
|
|
5326
5327
|
|
|
5327
|
-
// src/middleware/generateETag.ts
|
|
5328
|
-
var generateETag = ({ pageState, modified }) => {
|
|
5329
|
-
const pieces = [modified.valueOf().toString()];
|
|
5330
|
-
const shortKeys = {};
|
|
5331
|
-
const sortedComponentKeys = Object.keys(pageState.components).sort();
|
|
5332
|
-
sortedComponentKeys.forEach((key) => {
|
|
5333
|
-
const value = pageState.components[key];
|
|
5334
|
-
for (let i = 0; i < key.length; i++) {
|
|
5335
|
-
const shortKey = key.slice(0, i + 1);
|
|
5336
|
-
if (!shortKeys[shortKey]) {
|
|
5337
|
-
shortKeys[shortKey] = true;
|
|
5338
|
-
pieces.push(shortKey);
|
|
5339
|
-
break;
|
|
5340
|
-
}
|
|
5341
|
-
}
|
|
5342
|
-
if (value.indexes) {
|
|
5343
|
-
pieces.push(...value.indexes.map((index) => index.toString()));
|
|
5344
|
-
}
|
|
5345
|
-
if (typeof value.visibility === "boolean") {
|
|
5346
|
-
pieces.push(value.visibility ? "0" : "1");
|
|
5347
|
-
}
|
|
5348
|
-
});
|
|
5349
|
-
const eTag = pieces.join("-");
|
|
5350
|
-
return eTag;
|
|
5351
|
-
};
|
|
5352
|
-
|
|
5353
5328
|
// src/middleware/resolveRoute.ts
|
|
5354
5329
|
var resolveRoute = async ({
|
|
5355
5330
|
path,
|
|
@@ -5357,7 +5332,8 @@ var resolveRoute = async ({
|
|
|
5357
5332
|
searchParams,
|
|
5358
5333
|
draftModeEnabled,
|
|
5359
5334
|
dataClient,
|
|
5360
|
-
releaseId
|
|
5335
|
+
releaseId,
|
|
5336
|
+
locale
|
|
5361
5337
|
}) => {
|
|
5362
5338
|
var _a;
|
|
5363
5339
|
let result;
|
|
@@ -5370,7 +5346,8 @@ var resolveRoute = async ({
|
|
|
5370
5346
|
searchParams,
|
|
5371
5347
|
draftModeEnabled,
|
|
5372
5348
|
dataClient,
|
|
5373
|
-
releaseId
|
|
5349
|
+
releaseId,
|
|
5350
|
+
locale
|
|
5374
5351
|
});
|
|
5375
5352
|
} catch (e) {
|
|
5376
5353
|
console.warn(`Failed to retrieve route by path: ${path} with state ${state}`, e);
|
|
@@ -5387,7 +5364,8 @@ var retrieveRouteByPath = async ({
|
|
|
5387
5364
|
searchParams,
|
|
5388
5365
|
draftModeEnabled,
|
|
5389
5366
|
dataClient,
|
|
5390
|
-
releaseId
|
|
5367
|
+
releaseId,
|
|
5368
|
+
locale
|
|
5391
5369
|
}) => {
|
|
5392
5370
|
var _a;
|
|
5393
5371
|
return await dataClient.getRoute({
|
|
@@ -5400,7 +5378,8 @@ var retrieveRouteByPath = async ({
|
|
|
5400
5378
|
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, state),
|
|
5401
5379
|
withComponentIDs: true,
|
|
5402
5380
|
withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
|
|
5403
|
-
releaseId
|
|
5381
|
+
releaseId,
|
|
5382
|
+
locale
|
|
5404
5383
|
}
|
|
5405
5384
|
});
|
|
5406
5385
|
};
|
|
@@ -5559,7 +5538,8 @@ var handlePlaygroundRequest = async ({
|
|
|
5559
5538
|
isDraftModeEnabled: true
|
|
5560
5539
|
// this is checked above
|
|
5561
5540
|
}),
|
|
5562
|
-
rules
|
|
5541
|
+
rules,
|
|
5542
|
+
locale: options.locale
|
|
5563
5543
|
};
|
|
5564
5544
|
const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
|
|
5565
5545
|
payload: pageState
|
|
@@ -5595,7 +5575,8 @@ var handleRouteRequest = async ({
|
|
|
5595
5575
|
searchParams: request.nextUrl.searchParams,
|
|
5596
5576
|
draftModeEnabled,
|
|
5597
5577
|
dataClient,
|
|
5598
|
-
releaseId: (_c = options.release) == null ? void 0 : _c.id
|
|
5578
|
+
releaseId: (_c = options.release) == null ? void 0 : _c.id,
|
|
5579
|
+
locale: options.locale
|
|
5599
5580
|
}),
|
|
5600
5581
|
createOnDemandContext({
|
|
5601
5582
|
cookies: request.cookies,
|
|
@@ -5682,24 +5663,9 @@ var handleRouteRequest = async ({
|
|
|
5682
5663
|
defaultConsent: options.defaultConsent
|
|
5683
5664
|
}),
|
|
5684
5665
|
previewMode,
|
|
5685
|
-
rules
|
|
5666
|
+
rules,
|
|
5667
|
+
locale: options.locale
|
|
5686
5668
|
};
|
|
5687
|
-
const eTagsConfig = serverConfig2.eTags;
|
|
5688
|
-
const generateETags = typeof (eTagsConfig == null ? void 0 : eTagsConfig.generateETags) === "boolean" ? eTagsConfig.generateETags : false;
|
|
5689
|
-
let eTag = void 0;
|
|
5690
|
-
if (state === CANVAS_PUBLISHED_STATE && generateETags) {
|
|
5691
|
-
eTag = generateETag({ pageState, modified: new Date(route.compositionApiResponse.modified) });
|
|
5692
|
-
const ifNoneMatch = request.headers.get("If-None-Match");
|
|
5693
|
-
const quotedETag = `"${eTag}"`;
|
|
5694
|
-
if (ifNoneMatch === quotedETag) {
|
|
5695
|
-
return new import_server.NextResponse(null, {
|
|
5696
|
-
status: 304,
|
|
5697
|
-
headers: {
|
|
5698
|
-
ETag: quotedETag
|
|
5699
|
-
}
|
|
5700
|
-
});
|
|
5701
|
-
}
|
|
5702
|
-
}
|
|
5703
5669
|
const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
|
|
5704
5670
|
payload: pageState
|
|
5705
5671
|
});
|
|
@@ -5708,13 +5674,6 @@ var handleRouteRequest = async ({
|
|
|
5708
5674
|
pathToRewriteTo = `/uniform/${code}`;
|
|
5709
5675
|
}
|
|
5710
5676
|
const headers = new Headers();
|
|
5711
|
-
if (eTag) {
|
|
5712
|
-
const eTagCacheControl = typeof (eTagsConfig == null ? void 0 : eTagsConfig.cacheControl) !== "undefined" ? eTagsConfig.cacheControl : "no-cache, must-revalidate";
|
|
5713
|
-
headers.append("ETag", `"${eTag}"`);
|
|
5714
|
-
if (eTagCacheControl) {
|
|
5715
|
-
headers.append("Cache-Control", eTagCacheControl);
|
|
5716
|
-
}
|
|
5717
|
-
}
|
|
5718
5677
|
if (serializedScoreCookie) {
|
|
5719
5678
|
headers.append(
|
|
5720
5679
|
"Set-Cookie",
|
|
@@ -5763,7 +5722,8 @@ var extractAndEvaluateRunnables = async ({
|
|
|
5763
5722
|
releaseId,
|
|
5764
5723
|
defaultConsent,
|
|
5765
5724
|
previewMode,
|
|
5766
|
-
rules: void 0
|
|
5725
|
+
rules: void 0,
|
|
5726
|
+
locale: void 0
|
|
5767
5727
|
}
|
|
5768
5728
|
}
|
|
5769
5729
|
});
|
package/dist/middleware.mjs
CHANGED
|
@@ -5005,7 +5005,8 @@ var DefaultDataClient = class {
|
|
|
5005
5005
|
path: options.pageState.routePath,
|
|
5006
5006
|
state: options.pageState.compositionState,
|
|
5007
5007
|
withComponentIDs: true,
|
|
5008
|
-
releaseId: options.pageState.releaseId
|
|
5008
|
+
releaseId: options.pageState.releaseId,
|
|
5009
|
+
locale: options.pageState.locale
|
|
5009
5010
|
};
|
|
5010
5011
|
const resolvedRoute = await this.getRouteFromApi({
|
|
5011
5012
|
source: "pageState",
|
|
@@ -5319,32 +5320,6 @@ var calculateScoreChanges = ({
|
|
|
5319
5320
|
return changes;
|
|
5320
5321
|
};
|
|
5321
5322
|
|
|
5322
|
-
// src/middleware/generateETag.ts
|
|
5323
|
-
var generateETag = ({ pageState, modified }) => {
|
|
5324
|
-
const pieces = [modified.valueOf().toString()];
|
|
5325
|
-
const shortKeys = {};
|
|
5326
|
-
const sortedComponentKeys = Object.keys(pageState.components).sort();
|
|
5327
|
-
sortedComponentKeys.forEach((key) => {
|
|
5328
|
-
const value = pageState.components[key];
|
|
5329
|
-
for (let i = 0; i < key.length; i++) {
|
|
5330
|
-
const shortKey = key.slice(0, i + 1);
|
|
5331
|
-
if (!shortKeys[shortKey]) {
|
|
5332
|
-
shortKeys[shortKey] = true;
|
|
5333
|
-
pieces.push(shortKey);
|
|
5334
|
-
break;
|
|
5335
|
-
}
|
|
5336
|
-
}
|
|
5337
|
-
if (value.indexes) {
|
|
5338
|
-
pieces.push(...value.indexes.map((index) => index.toString()));
|
|
5339
|
-
}
|
|
5340
|
-
if (typeof value.visibility === "boolean") {
|
|
5341
|
-
pieces.push(value.visibility ? "0" : "1");
|
|
5342
|
-
}
|
|
5343
|
-
});
|
|
5344
|
-
const eTag = pieces.join("-");
|
|
5345
|
-
return eTag;
|
|
5346
|
-
};
|
|
5347
|
-
|
|
5348
5323
|
// src/middleware/resolveRoute.ts
|
|
5349
5324
|
var resolveRoute = async ({
|
|
5350
5325
|
path,
|
|
@@ -5352,7 +5327,8 @@ var resolveRoute = async ({
|
|
|
5352
5327
|
searchParams,
|
|
5353
5328
|
draftModeEnabled,
|
|
5354
5329
|
dataClient,
|
|
5355
|
-
releaseId
|
|
5330
|
+
releaseId,
|
|
5331
|
+
locale
|
|
5356
5332
|
}) => {
|
|
5357
5333
|
var _a;
|
|
5358
5334
|
let result;
|
|
@@ -5365,7 +5341,8 @@ var resolveRoute = async ({
|
|
|
5365
5341
|
searchParams,
|
|
5366
5342
|
draftModeEnabled,
|
|
5367
5343
|
dataClient,
|
|
5368
|
-
releaseId
|
|
5344
|
+
releaseId,
|
|
5345
|
+
locale
|
|
5369
5346
|
});
|
|
5370
5347
|
} catch (e) {
|
|
5371
5348
|
console.warn(`Failed to retrieve route by path: ${path} with state ${state}`, e);
|
|
@@ -5382,7 +5359,8 @@ var retrieveRouteByPath = async ({
|
|
|
5382
5359
|
searchParams,
|
|
5383
5360
|
draftModeEnabled,
|
|
5384
5361
|
dataClient,
|
|
5385
|
-
releaseId
|
|
5362
|
+
releaseId,
|
|
5363
|
+
locale
|
|
5386
5364
|
}) => {
|
|
5387
5365
|
var _a;
|
|
5388
5366
|
return await dataClient.getRoute({
|
|
@@ -5395,7 +5373,8 @@ var retrieveRouteByPath = async ({
|
|
|
5395
5373
|
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, state),
|
|
5396
5374
|
withComponentIDs: true,
|
|
5397
5375
|
withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
|
|
5398
|
-
releaseId
|
|
5376
|
+
releaseId,
|
|
5377
|
+
locale
|
|
5399
5378
|
}
|
|
5400
5379
|
});
|
|
5401
5380
|
};
|
|
@@ -5554,7 +5533,8 @@ var handlePlaygroundRequest = async ({
|
|
|
5554
5533
|
isDraftModeEnabled: true
|
|
5555
5534
|
// this is checked above
|
|
5556
5535
|
}),
|
|
5557
|
-
rules
|
|
5536
|
+
rules,
|
|
5537
|
+
locale: options.locale
|
|
5558
5538
|
};
|
|
5559
5539
|
const code = serializeEvaluationResult({
|
|
5560
5540
|
payload: pageState
|
|
@@ -5590,7 +5570,8 @@ var handleRouteRequest = async ({
|
|
|
5590
5570
|
searchParams: request.nextUrl.searchParams,
|
|
5591
5571
|
draftModeEnabled,
|
|
5592
5572
|
dataClient,
|
|
5593
|
-
releaseId: (_c = options.release) == null ? void 0 : _c.id
|
|
5573
|
+
releaseId: (_c = options.release) == null ? void 0 : _c.id,
|
|
5574
|
+
locale: options.locale
|
|
5594
5575
|
}),
|
|
5595
5576
|
createOnDemandContext({
|
|
5596
5577
|
cookies: request.cookies,
|
|
@@ -5677,24 +5658,9 @@ var handleRouteRequest = async ({
|
|
|
5677
5658
|
defaultConsent: options.defaultConsent
|
|
5678
5659
|
}),
|
|
5679
5660
|
previewMode,
|
|
5680
|
-
rules
|
|
5661
|
+
rules,
|
|
5662
|
+
locale: options.locale
|
|
5681
5663
|
};
|
|
5682
|
-
const eTagsConfig = serverConfig2.eTags;
|
|
5683
|
-
const generateETags = typeof (eTagsConfig == null ? void 0 : eTagsConfig.generateETags) === "boolean" ? eTagsConfig.generateETags : false;
|
|
5684
|
-
let eTag = void 0;
|
|
5685
|
-
if (state === CANVAS_PUBLISHED_STATE && generateETags) {
|
|
5686
|
-
eTag = generateETag({ pageState, modified: new Date(route.compositionApiResponse.modified) });
|
|
5687
|
-
const ifNoneMatch = request.headers.get("If-None-Match");
|
|
5688
|
-
const quotedETag = `"${eTag}"`;
|
|
5689
|
-
if (ifNoneMatch === quotedETag) {
|
|
5690
|
-
return new NextResponse(null, {
|
|
5691
|
-
status: 304,
|
|
5692
|
-
headers: {
|
|
5693
|
-
ETag: quotedETag
|
|
5694
|
-
}
|
|
5695
|
-
});
|
|
5696
|
-
}
|
|
5697
|
-
}
|
|
5698
5664
|
const code = serializeEvaluationResult({
|
|
5699
5665
|
payload: pageState
|
|
5700
5666
|
});
|
|
@@ -5703,13 +5669,6 @@ var handleRouteRequest = async ({
|
|
|
5703
5669
|
pathToRewriteTo = `/uniform/${code}`;
|
|
5704
5670
|
}
|
|
5705
5671
|
const headers = new Headers();
|
|
5706
|
-
if (eTag) {
|
|
5707
|
-
const eTagCacheControl = typeof (eTagsConfig == null ? void 0 : eTagsConfig.cacheControl) !== "undefined" ? eTagsConfig.cacheControl : "no-cache, must-revalidate";
|
|
5708
|
-
headers.append("ETag", `"${eTag}"`);
|
|
5709
|
-
if (eTagCacheControl) {
|
|
5710
|
-
headers.append("Cache-Control", eTagCacheControl);
|
|
5711
|
-
}
|
|
5712
|
-
}
|
|
5713
5672
|
if (serializedScoreCookie) {
|
|
5714
5673
|
headers.append(
|
|
5715
5674
|
"Set-Cookie",
|
|
@@ -5758,7 +5717,8 @@ var extractAndEvaluateRunnables = async ({
|
|
|
5758
5717
|
releaseId,
|
|
5759
5718
|
defaultConsent,
|
|
5760
5719
|
previewMode,
|
|
5761
|
-
rules: void 0
|
|
5720
|
+
rules: void 0,
|
|
5721
|
+
locale: void 0
|
|
5762
5722
|
}
|
|
5763
5723
|
}
|
|
5764
5724
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/next-app-router",
|
|
3
|
-
"version": "20.7.1-alpha.
|
|
3
|
+
"version": "20.7.1-alpha.122+165bd517ae",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -86,12 +86,12 @@
|
|
|
86
86
|
"typescript": "5.9.2"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@uniformdev/canvas-react": "20.7.1-alpha.
|
|
90
|
-
"@uniformdev/next-app-router-client": "20.7.1-alpha.
|
|
91
|
-
"@uniformdev/next-app-router-shared": "20.7.1-alpha.
|
|
92
|
-
"@uniformdev/redirect": "20.7.1-alpha.
|
|
93
|
-
"@uniformdev/richtext": "20.7.1-alpha.
|
|
94
|
-
"@uniformdev/webhooks": "20.7.1-alpha.
|
|
89
|
+
"@uniformdev/canvas-react": "20.7.1-alpha.122+165bd517ae",
|
|
90
|
+
"@uniformdev/next-app-router-client": "20.7.1-alpha.122+165bd517ae",
|
|
91
|
+
"@uniformdev/next-app-router-shared": "20.7.1-alpha.122+165bd517ae",
|
|
92
|
+
"@uniformdev/redirect": "20.7.1-alpha.122+165bd517ae",
|
|
93
|
+
"@uniformdev/richtext": "20.7.1-alpha.122+165bd517ae",
|
|
94
|
+
"@uniformdev/webhooks": "20.7.1-alpha.122+165bd517ae",
|
|
95
95
|
"@vercel/functions": "^2.2.2",
|
|
96
96
|
"encoding": "^0.1.13",
|
|
97
97
|
"server-only": "^0.0.1",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"publishConfig": {
|
|
109
109
|
"access": "public"
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "165bd517ae4be47e55ffc82dbbcfa5f116eed371"
|
|
112
112
|
}
|