@uniformdev/next-app-router 20.7.1-alpha.121 → 20.7.1-alpha.123
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 +2749 -2829
- package/dist/middleware.mjs +2777 -2860
- 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 & {
|