@uniformdev/next-app-router 20.80.2 → 20.81.1-alpha.4.sha-de16ebeee7
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-DBO-oo7J.d.ts → UniformComposition-T7CRvU1H.d.ts} +2 -8
- package/dist/{UniformComposition-le6UEB_r.d.mts → UniformComposition-fq7Qfhvp.d.mts} +2 -8
- package/dist/cache.d.mts +1 -3
- package/dist/cache.d.ts +1 -3
- package/dist/cache.js +127 -811
- package/dist/cache.mjs +126 -810
- package/dist/compat.d.mts +2 -4
- package/dist/compat.d.ts +2 -4
- package/dist/component.d.mts +10 -1
- package/dist/component.d.ts +10 -1
- package/dist/component.js +113 -617
- package/dist/component.mjs +112 -640
- package/dist/config/default.js +0 -1
- package/dist/config/default.mjs +0 -1
- package/dist/edge.d.mts +44 -0
- package/dist/edge.d.ts +44 -0
- package/dist/edge.js +751 -0
- package/dist/edge.mjs +720 -0
- package/dist/handler.js +87 -616
- package/dist/handler.mjs +85 -614
- package/dist/index.d.mts +15 -36
- package/dist/index.d.ts +15 -36
- package/dist/index.esm.js +1935 -5585
- package/dist/index.js +1929 -5579
- package/dist/index.mjs +1935 -5585
- package/dist/middleware.d.mts +52 -13
- package/dist/middleware.d.ts +52 -13
- package/dist/middleware.js +410 -5746
- package/dist/middleware.mjs +417 -5776
- package/dist/resolveRouteFromCode-CId7aItt.d.mts +48 -0
- package/dist/resolveRouteFromCode-CId7aItt.d.ts +48 -0
- package/package.json +24 -9
- package/dist/client-BElN_CWD.d.mts +0 -786
- package/dist/client-BElN_CWD.d.ts +0 -786
- package/dist/resolveRouteFromCode-BOvjIvM2.d.ts +0 -18
- package/dist/resolveRouteFromCode-CuJ4JHeb.d.mts +0 -18
package/dist/config/default.js
CHANGED
package/dist/config/default.mjs
CHANGED
package/dist/edge.d.mts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ManifestV2 } from '@uniformdev/context';
|
|
2
|
+
import { TransformEdgeStreamOptions } from '@uniformdev/context-edge';
|
|
3
|
+
import { NextRequest } from 'next/server';
|
|
4
|
+
import { HandleOptions } from './middleware.mjs';
|
|
5
|
+
import '@uniformdev/next-app-router-shared';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Marks the edge middleware's own fetch of the rendered page, so the middleware lets it through
|
|
9
|
+
* when the matcher also covers the rewrite destination.
|
|
10
|
+
*/
|
|
11
|
+
declare const UNIFORM_EDGE_ORIGIN_HEADER = "x-uniform-edge-origin";
|
|
12
|
+
type UniformEdgeMiddlewareOptions = HandleOptions & {
|
|
13
|
+
/**
|
|
14
|
+
* The project's Context manifest, which chooses the visitor's variants. Bake it into the build
|
|
15
|
+
* (for example with `uniform context manifest download`) so the middleware makes no network
|
|
16
|
+
* calls. Variants for signals published after the build are chosen in the browser.
|
|
17
|
+
*/
|
|
18
|
+
manifest: ManifestV2;
|
|
19
|
+
/**
|
|
20
|
+
* Called when the NESI transform fails. Receives the error and, when available, the decoded
|
|
21
|
+
* HTML chunk that triggered it. The response keeps streaming the untransformed HTML.
|
|
22
|
+
*/
|
|
23
|
+
onError?: TransformEdgeStreamOptions['onError'];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Returns middleware that rewrites each request to its Uniform code like `uniformMiddleware`, and
|
|
27
|
+
* processes the NESI tags in the page at the edge. HTML document requests fetch the page rendered
|
|
28
|
+
* for the route's code and keep only the visitor's variants from the tags it contains, which
|
|
29
|
+
* `UniformComposition` renders for published personalizations and tests when `edgeMode` is enabled
|
|
30
|
+
* in `uniform.server.config`. Client navigations, prefetches and draft requests are rewritten, and
|
|
31
|
+
* their variants are chosen in the browser.
|
|
32
|
+
*
|
|
33
|
+
* Requires the optional peer dependency `@uniformdev/context-edge`.
|
|
34
|
+
*/
|
|
35
|
+
declare const uniformEdgeMiddleware: (options: UniformEdgeMiddlewareOptions) => (request: NextRequest) => Promise<Response>;
|
|
36
|
+
/**
|
|
37
|
+
* Handles one request the way {@link uniformEdgeMiddleware} does. The transformed response is
|
|
38
|
+
* personalized, so it is marked `private, no-store`.
|
|
39
|
+
*/
|
|
40
|
+
declare const handleUniformEdgeRoute: ({ request, manifest, onError, ...options }: UniformEdgeMiddlewareOptions & {
|
|
41
|
+
request: NextRequest;
|
|
42
|
+
}) => Promise<Response>;
|
|
43
|
+
|
|
44
|
+
export { UNIFORM_EDGE_ORIGIN_HEADER, type UniformEdgeMiddlewareOptions, handleUniformEdgeRoute, uniformEdgeMiddleware };
|
package/dist/edge.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ManifestV2 } from '@uniformdev/context';
|
|
2
|
+
import { TransformEdgeStreamOptions } from '@uniformdev/context-edge';
|
|
3
|
+
import { NextRequest } from 'next/server';
|
|
4
|
+
import { HandleOptions } from './middleware.js';
|
|
5
|
+
import '@uniformdev/next-app-router-shared';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Marks the edge middleware's own fetch of the rendered page, so the middleware lets it through
|
|
9
|
+
* when the matcher also covers the rewrite destination.
|
|
10
|
+
*/
|
|
11
|
+
declare const UNIFORM_EDGE_ORIGIN_HEADER = "x-uniform-edge-origin";
|
|
12
|
+
type UniformEdgeMiddlewareOptions = HandleOptions & {
|
|
13
|
+
/**
|
|
14
|
+
* The project's Context manifest, which chooses the visitor's variants. Bake it into the build
|
|
15
|
+
* (for example with `uniform context manifest download`) so the middleware makes no network
|
|
16
|
+
* calls. Variants for signals published after the build are chosen in the browser.
|
|
17
|
+
*/
|
|
18
|
+
manifest: ManifestV2;
|
|
19
|
+
/**
|
|
20
|
+
* Called when the NESI transform fails. Receives the error and, when available, the decoded
|
|
21
|
+
* HTML chunk that triggered it. The response keeps streaming the untransformed HTML.
|
|
22
|
+
*/
|
|
23
|
+
onError?: TransformEdgeStreamOptions['onError'];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Returns middleware that rewrites each request to its Uniform code like `uniformMiddleware`, and
|
|
27
|
+
* processes the NESI tags in the page at the edge. HTML document requests fetch the page rendered
|
|
28
|
+
* for the route's code and keep only the visitor's variants from the tags it contains, which
|
|
29
|
+
* `UniformComposition` renders for published personalizations and tests when `edgeMode` is enabled
|
|
30
|
+
* in `uniform.server.config`. Client navigations, prefetches and draft requests are rewritten, and
|
|
31
|
+
* their variants are chosen in the browser.
|
|
32
|
+
*
|
|
33
|
+
* Requires the optional peer dependency `@uniformdev/context-edge`.
|
|
34
|
+
*/
|
|
35
|
+
declare const uniformEdgeMiddleware: (options: UniformEdgeMiddlewareOptions) => (request: NextRequest) => Promise<Response>;
|
|
36
|
+
/**
|
|
37
|
+
* Handles one request the way {@link uniformEdgeMiddleware} does. The transformed response is
|
|
38
|
+
* personalized, so it is marked `private, no-store`.
|
|
39
|
+
*/
|
|
40
|
+
declare const handleUniformEdgeRoute: ({ request, manifest, onError, ...options }: UniformEdgeMiddlewareOptions & {
|
|
41
|
+
request: NextRequest;
|
|
42
|
+
}) => Promise<Response>;
|
|
43
|
+
|
|
44
|
+
export { UNIFORM_EDGE_ORIGIN_HEADER, type UniformEdgeMiddlewareOptions, handleUniformEdgeRoute, uniformEdgeMiddleware };
|