@netlify/plugin-nextjs 5.3.3-canary-no-cache-fix.0 → 5.3.3
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/README.md +62 -2
- package/dist/build/content/prerendered.js +28 -5
- package/dist/build/content/server.js +2 -12
- package/dist/build/plugin-context.js +18 -0
- package/dist/build/verification.js +5 -8
- package/dist/esm-chunks/{package-VUTYVNOL.js → package-7AUBRXLQ.js} +7 -7
- package/dist/run/config.js +2 -0
- package/dist/run/handlers/cache.cjs +45 -17
- package/dist/run/handlers/tracing.js +1 -1
- package/edge-runtime/lib/next-request.ts +14 -26
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# Next.js Runtime
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a aria-label="npm version" href="https://www.npmjs.com/package/@netlify/plugin-nextjs">
|
|
@@ -16,3 +16,63 @@ Netlify. You should not normally need to install it yourself, as it is used auto
|
|
|
16
16
|
builds of Next.js sites. See
|
|
17
17
|
[the docs for using Next.js on Netlify](https://docs.netlify.com/frameworks/next-js/overview/) for
|
|
18
18
|
more details.
|
|
19
|
+
|
|
20
|
+
Next.js is supported natively on Netlify, and in most cases you will not need to install or
|
|
21
|
+
configure anything. This repo includes the packages used to support Next.js on Netlify.
|
|
22
|
+
|
|
23
|
+
## Prerequisites
|
|
24
|
+
|
|
25
|
+
- Next.js 13.5 or later
|
|
26
|
+
- Node.js 18 or later
|
|
27
|
+
- The latest version of the [Netlify CLI](https://docs.netlify.com/cli/get-started/)
|
|
28
|
+
|
|
29
|
+
## Deploying
|
|
30
|
+
|
|
31
|
+
If you build on Netlify, the Next.js Runtime will work with no additional configuration.
|
|
32
|
+
|
|
33
|
+
## Manually installing the Next.js Runtime
|
|
34
|
+
|
|
35
|
+
The Next.js Runtime installs automatically for new Next.js sites on Netlify. You can also install it
|
|
36
|
+
manually in the following ways:
|
|
37
|
+
|
|
38
|
+
### From the UI (Recommended)
|
|
39
|
+
|
|
40
|
+
You can go to the [UI](https://app.netlify.com/plugins/@netlify/plugin-nextjs/install) and choose
|
|
41
|
+
the site to install the Next.js Runtime on. This method is recommended because you will benefit from
|
|
42
|
+
auto-upgrades to important fixes and feature updates.
|
|
43
|
+
|
|
44
|
+
### From `npm`
|
|
45
|
+
|
|
46
|
+
```shell
|
|
47
|
+
npm install -D @netlify/plugin-nextjs
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
...then add the following to your `netlify.toml` file:
|
|
51
|
+
|
|
52
|
+
```toml
|
|
53
|
+
[[plugins]]
|
|
54
|
+
package = "@netlify/plugin-nextjs"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This method is recommended if you wish to pin the Next.js Runtime to a specific version.
|
|
58
|
+
|
|
59
|
+
## v4
|
|
60
|
+
|
|
61
|
+
If you are using Next.js 10-13.4 or Node.js < 18, you must use v4 of the Next.js Runtime.
|
|
62
|
+
|
|
63
|
+
If you are still using v4, you can find
|
|
64
|
+
[its README here](https://github.com/netlify/next-runtime/blob/v4/README.md) and the
|
|
65
|
+
[v4 Runtime docs here](https://docs.netlify.com/frameworks/next-js/runtime-v4/overview/).
|
|
66
|
+
|
|
67
|
+
### Upgrading from v4 to v5
|
|
68
|
+
|
|
69
|
+
To upgrade from v4 to v5, please visit
|
|
70
|
+
[the v5 documentation](https://docs.netlify.com/frameworks/next-js/overview/).
|
|
71
|
+
|
|
72
|
+
## Feedback
|
|
73
|
+
|
|
74
|
+
If you think you have found a bug in Next.js on Netlify,
|
|
75
|
+
[please open an issue](https://github.com/netlify/next-runtime/issues). If you have comments or
|
|
76
|
+
feature requests, [see the discussion board](https://github.com/netlify/next-runtime/discussions)
|
|
77
|
+
|
|
78
|
+
Please note that v4 will only receive security fixes and critical bug fixes.
|
|
@@ -14,6 +14,9 @@ import {
|
|
|
14
14
|
init_esm,
|
|
15
15
|
trace
|
|
16
16
|
} from "../../esm-chunks/chunk-GNGHTHMQ.js";
|
|
17
|
+
import {
|
|
18
|
+
require_semver
|
|
19
|
+
} from "../../esm-chunks/chunk-EFGWM7RS.js";
|
|
17
20
|
import {
|
|
18
21
|
__toESM
|
|
19
22
|
} from "../../esm-chunks/chunk-OEQOKJGE.js";
|
|
@@ -132,6 +135,7 @@ function pLimit(concurrency) {
|
|
|
132
135
|
}
|
|
133
136
|
|
|
134
137
|
// src/build/content/prerendered.ts
|
|
138
|
+
var import_semver = __toESM(require_semver(), 1);
|
|
135
139
|
import { encodeBlobKey } from "../../shared/blobkey.js";
|
|
136
140
|
var tracer = wrapTracer(trace.getTracer("Next runtime"));
|
|
137
141
|
var writeCacheEntry = async (route, value, lastModified, ctx) => {
|
|
@@ -147,12 +151,22 @@ var buildPagesCacheValue = async (path) => ({
|
|
|
147
151
|
kind: "PAGE",
|
|
148
152
|
html: await readFile(`${path}.html`, "utf-8"),
|
|
149
153
|
pageData: JSON.parse(await readFile(`${path}.json`, "utf-8")),
|
|
150
|
-
postponed: void 0,
|
|
151
154
|
headers: void 0,
|
|
152
155
|
status: void 0
|
|
153
156
|
});
|
|
154
|
-
var buildAppCacheValue = async (path) => {
|
|
157
|
+
var buildAppCacheValue = async (path, shouldUseAppPageKind) => {
|
|
155
158
|
const meta = JSON.parse(await readFile(`${path}.meta`, "utf-8"));
|
|
159
|
+
const html = await readFile(`${path}.html`, "utf-8");
|
|
160
|
+
if (shouldUseAppPageKind) {
|
|
161
|
+
return {
|
|
162
|
+
kind: "APP_PAGE",
|
|
163
|
+
html,
|
|
164
|
+
rscData: await readFile(`${path}.rsc`, "base64").catch(
|
|
165
|
+
() => readFile(`${path}.prefetch.rsc`, "base64")
|
|
166
|
+
),
|
|
167
|
+
...meta
|
|
168
|
+
};
|
|
169
|
+
}
|
|
156
170
|
const rsc = await readFile(`${path}.rsc`, "utf-8").catch(
|
|
157
171
|
() => readFile(`${path}.prefetch.rsc`, "utf-8")
|
|
158
172
|
);
|
|
@@ -161,7 +175,7 @@ var buildAppCacheValue = async (path) => {
|
|
|
161
175
|
}
|
|
162
176
|
return {
|
|
163
177
|
kind: "PAGE",
|
|
164
|
-
html
|
|
178
|
+
html,
|
|
165
179
|
pageData: rsc,
|
|
166
180
|
...meta
|
|
167
181
|
};
|
|
@@ -182,6 +196,9 @@ var copyPrerenderedContent = async (ctx) => {
|
|
|
182
196
|
await mkdir(ctx.blobDir, { recursive: true });
|
|
183
197
|
const manifest = await ctx.getPrerenderManifest();
|
|
184
198
|
const limitConcurrentPrerenderContentHandling = pLimit(10);
|
|
199
|
+
const shouldUseAppPageKind = ctx.nextVersion ? (0, import_semver.satisfies)(ctx.nextVersion, ">=15.0.0-canary.13 <15.0.0-d || >15.0.0-rc.0", {
|
|
200
|
+
includePrerelease: true
|
|
201
|
+
}) : false;
|
|
185
202
|
await Promise.all(
|
|
186
203
|
Object.entries(manifest.routes).map(
|
|
187
204
|
([route, meta]) => limitConcurrentPrerenderContentHandling(async () => {
|
|
@@ -198,7 +215,10 @@ var copyPrerenderedContent = async (ctx) => {
|
|
|
198
215
|
value = await buildPagesCacheValue(join(ctx.publishDir, "server/pages", key));
|
|
199
216
|
break;
|
|
200
217
|
case meta.dataRoute?.endsWith(".rsc"):
|
|
201
|
-
value = await buildAppCacheValue(
|
|
218
|
+
value = await buildAppCacheValue(
|
|
219
|
+
join(ctx.publishDir, "server/app", key),
|
|
220
|
+
shouldUseAppPageKind
|
|
221
|
+
);
|
|
202
222
|
break;
|
|
203
223
|
case meta.dataRoute === null:
|
|
204
224
|
value = await buildRouteCacheValue(
|
|
@@ -216,7 +236,10 @@ var copyPrerenderedContent = async (ctx) => {
|
|
|
216
236
|
if (existsSync(join(ctx.publishDir, `server/app/_not-found.html`))) {
|
|
217
237
|
const lastModified = Date.now();
|
|
218
238
|
const key = "/404";
|
|
219
|
-
const value = await buildAppCacheValue(
|
|
239
|
+
const value = await buildAppCacheValue(
|
|
240
|
+
join(ctx.publishDir, "server/app/_not-found"),
|
|
241
|
+
shouldUseAppPageKind
|
|
242
|
+
);
|
|
220
243
|
await writeCacheEntry(key, value, lastModified, ctx);
|
|
221
244
|
}
|
|
222
245
|
} catch (error) {
|
|
@@ -40,7 +40,6 @@ import { join as posixJoin, sep as posixSep } from "node:path/posix";
|
|
|
40
40
|
var import_fast_glob = __toESM(require_out(), 1);
|
|
41
41
|
var import_semver = __toESM(require_semver(), 1);
|
|
42
42
|
import { RUN_CONFIG } from "../../run/constants.js";
|
|
43
|
-
import { verifyNextVersion } from "../verification.js";
|
|
44
43
|
var tracer = wrapTracer(trace.getTracer("Next runtime"));
|
|
45
44
|
var toPosixPath = (path) => path.split(sep).join(posixSep);
|
|
46
45
|
function isError(error) {
|
|
@@ -191,17 +190,8 @@ var copyNextDependencies = async (ctx) => {
|
|
|
191
190
|
}
|
|
192
191
|
await Promise.all(promises);
|
|
193
192
|
const serverHandlerRequire = createRequire(posixJoin(ctx.serverHandlerDir, ":internal:"));
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const { version } = serverHandlerRequire("next/package.json");
|
|
197
|
-
if (version) {
|
|
198
|
-
nextVersion = version;
|
|
199
|
-
}
|
|
200
|
-
} catch {
|
|
201
|
-
}
|
|
202
|
-
if (nextVersion) {
|
|
203
|
-
verifyNextVersion(ctx, nextVersion);
|
|
204
|
-
await patchNextModules(ctx, nextVersion, serverHandlerRequire.resolve);
|
|
193
|
+
if (ctx.nextVersion) {
|
|
194
|
+
await patchNextModules(ctx, ctx.nextVersion, serverHandlerRequire.resolve);
|
|
205
195
|
}
|
|
206
196
|
try {
|
|
207
197
|
const nextEntryAbsolutePath = serverHandlerRequire.resolve("next");
|
|
@@ -15,7 +15,9 @@ import {
|
|
|
15
15
|
var import_semver = __toESM(require_semver(), 1);
|
|
16
16
|
import { existsSync, readFileSync } from "node:fs";
|
|
17
17
|
import { readFile } from "node:fs/promises";
|
|
18
|
+
import { createRequire } from "node:module";
|
|
18
19
|
import { join, relative, resolve } from "node:path";
|
|
20
|
+
import { join as posixJoin } from "node:path/posix";
|
|
19
21
|
import { fileURLToPath } from "node:url";
|
|
20
22
|
var MODULE_DIR = fileURLToPath(new URL(".", import.meta.url));
|
|
21
23
|
var PLUGIN_DIR = join(MODULE_DIR, "../..");
|
|
@@ -248,6 +250,22 @@ var PluginContext = class {
|
|
|
248
250
|
async getRoutesManifest() {
|
|
249
251
|
return JSON.parse(await readFile(join(this.publishDir, "routes-manifest.json"), "utf-8"));
|
|
250
252
|
}
|
|
253
|
+
#nextVersion = void 0;
|
|
254
|
+
/**
|
|
255
|
+
* Get Next.js version that was used to build the site
|
|
256
|
+
*/
|
|
257
|
+
get nextVersion() {
|
|
258
|
+
if (this.#nextVersion === void 0) {
|
|
259
|
+
try {
|
|
260
|
+
const serverHandlerRequire = createRequire(posixJoin(this.standaloneRootDir, ":internal:"));
|
|
261
|
+
const { version } = serverHandlerRequire("next/package.json");
|
|
262
|
+
this.#nextVersion = version;
|
|
263
|
+
} catch {
|
|
264
|
+
this.#nextVersion = null;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return this.#nextVersion;
|
|
268
|
+
}
|
|
251
269
|
/** Fails a build with a message and an optional error */
|
|
252
270
|
failBuild(message, error) {
|
|
253
271
|
return this.utils.build.failBuild(message, error instanceof Error ? { error } : void 0);
|
|
@@ -46,6 +46,11 @@ function verifyPublishDir(ctx) {
|
|
|
46
46
|
`Your publish directory does not contain expected Next.js build output. Please make sure you are using Next.js version (${SUPPORTED_NEXT_VERSIONS})`
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
|
+
if (ctx.nextVersion && !(0, import_semver.satisfies)(ctx.nextVersion, SUPPORTED_NEXT_VERSIONS, { includePrerelease: true })) {
|
|
50
|
+
ctx.failBuild(
|
|
51
|
+
`@netlify/plugin-next@5 requires Next.js version ${SUPPORTED_NEXT_VERSIONS}, but found ${ctx.nextVersion}. Please upgrade your project's Next.js version.`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
49
54
|
}
|
|
50
55
|
if (ctx.buildConfig.output === "export") {
|
|
51
56
|
if (!ctx.exportDetail?.success) {
|
|
@@ -58,13 +63,6 @@ function verifyPublishDir(ctx) {
|
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
65
|
}
|
|
61
|
-
function verifyNextVersion(ctx, nextVersion) {
|
|
62
|
-
if (!(0, import_semver.satisfies)(nextVersion, SUPPORTED_NEXT_VERSIONS, { includePrerelease: true })) {
|
|
63
|
-
ctx.failBuild(
|
|
64
|
-
`@netlify/plugin-next@5 requires Next.js version ${SUPPORTED_NEXT_VERSIONS}, but found ${nextVersion}. Please upgrade your project's Next.js version.`
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
66
|
async function verifyNoAdvancedAPIRoutes(ctx) {
|
|
69
67
|
const apiRoutesConfigs = await getAPIRoutesConfigs(ctx);
|
|
70
68
|
const unsupportedAPIRoutes = apiRoutesConfigs.filter((apiRouteConfig) => {
|
|
@@ -80,7 +78,6 @@ Refer to https://ntl.fyi/next-scheduled-bg-function-migration as migration examp
|
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
80
|
export {
|
|
83
|
-
verifyNextVersion,
|
|
84
81
|
verifyNoAdvancedAPIRoutes,
|
|
85
82
|
verifyPublishDir
|
|
86
83
|
};
|
|
@@ -8,7 +8,7 @@ import "./chunk-OEQOKJGE.js";
|
|
|
8
8
|
|
|
9
9
|
// package.json
|
|
10
10
|
var name = "@netlify/plugin-nextjs";
|
|
11
|
-
var version = "5.3.3
|
|
11
|
+
var version = "5.3.3";
|
|
12
12
|
var description = "Run Next.js seamlessly on Netlify";
|
|
13
13
|
var main = "./dist/index.js";
|
|
14
14
|
var type = "module";
|
|
@@ -42,7 +42,7 @@ var scripts = {
|
|
|
42
42
|
};
|
|
43
43
|
var repository = {
|
|
44
44
|
type: "git",
|
|
45
|
-
url: "git+https://github.com/netlify/next-runtime
|
|
45
|
+
url: "git+https://github.com/netlify/next-runtime.git"
|
|
46
46
|
};
|
|
47
47
|
var keywords = [
|
|
48
48
|
"nextjs",
|
|
@@ -52,19 +52,19 @@ var keywords = [
|
|
|
52
52
|
];
|
|
53
53
|
var license = "MIT";
|
|
54
54
|
var bugs = {
|
|
55
|
-
url: "https://github.com/netlify/next-runtime
|
|
55
|
+
url: "https://github.com/netlify/next-runtime/issues"
|
|
56
56
|
};
|
|
57
|
-
var homepage = "https://github.com/netlify/next-runtime
|
|
57
|
+
var homepage = "https://github.com/netlify/next-runtime#readme";
|
|
58
58
|
var devDependencies = {
|
|
59
59
|
"@fastly/http-compute-js": "1.1.4",
|
|
60
60
|
"@netlify/blobs": "^7.3.0",
|
|
61
|
-
"@netlify/build": "^29.
|
|
61
|
+
"@netlify/build": "^29.48.1",
|
|
62
62
|
"@netlify/edge-bundler": "^12.0.1",
|
|
63
63
|
"@netlify/edge-functions": "^2.8.1",
|
|
64
64
|
"@netlify/eslint-config-node": "^7.0.1",
|
|
65
65
|
"@netlify/functions": "^2.7.0",
|
|
66
66
|
"@netlify/serverless-functions-api": "^1.18.4",
|
|
67
|
-
"@netlify/zip-it-and-ship-it": "^9.
|
|
67
|
+
"@netlify/zip-it-and-ship-it": "^9.37.0",
|
|
68
68
|
"@opentelemetry/api": "^1.8.0",
|
|
69
69
|
"@opentelemetry/exporter-trace-otlp-http": "^0.51.0",
|
|
70
70
|
"@opentelemetry/resources": "^1.24.0",
|
|
@@ -87,7 +87,7 @@ var devDependencies = {
|
|
|
87
87
|
memfs: "^4.9.2",
|
|
88
88
|
"mock-require": "^3.0.3",
|
|
89
89
|
msw: "^2.0.7",
|
|
90
|
-
next: "^
|
|
90
|
+
next: "^15.0.0-canary.28",
|
|
91
91
|
os: "^0.1.2",
|
|
92
92
|
outdent: "^0.8.0",
|
|
93
93
|
"p-limit": "^5.0.0",
|
package/dist/run/config.js
CHANGED
|
@@ -21,6 +21,8 @@ var setRunConfig = (config) => {
|
|
|
21
21
|
}
|
|
22
22
|
config.experimental = {
|
|
23
23
|
...config.experimental,
|
|
24
|
+
// @ts-expect-error incrementalCacheHandlerPath was removed from config type
|
|
25
|
+
// but we still need to set it for older Next.js versions
|
|
24
26
|
incrementalCacheHandlerPath: cacheHandler
|
|
25
27
|
};
|
|
26
28
|
config.cacheHandler = cacheHandler;
|
|
@@ -95,8 +95,6 @@ var pipeline = (0, import_util.promisify)(import_stream.pipeline);
|
|
|
95
95
|
|
|
96
96
|
// src/run/handlers/cache.cts
|
|
97
97
|
var import_constants = require("next/dist/lib/constants.js");
|
|
98
|
-
var import_load_manifest = require("next/dist/server/load-manifest.js");
|
|
99
|
-
var import_normalize_page_path = require("next/dist/shared/lib/page-path/normalize-page-path.js");
|
|
100
98
|
var import_regional_blob_store = require("../regional-blob-store.cjs");
|
|
101
99
|
var import_request_context = require("./request-context.cjs");
|
|
102
100
|
var import_tracer = require("./tracer.cjs");
|
|
@@ -157,20 +155,31 @@ var NetlifyCacheHandler = class {
|
|
|
157
155
|
}
|
|
158
156
|
return restOfRouteValue;
|
|
159
157
|
}
|
|
160
|
-
injectEntryToPrerenderManifest(key, revalidate) {
|
|
158
|
+
async injectEntryToPrerenderManifest(key, revalidate) {
|
|
161
159
|
if (this.options.serverDistDir && (typeof revalidate === "number" || revalidate === false)) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
160
|
+
try {
|
|
161
|
+
const { loadManifest } = await import("next/dist/server/load-manifest.js");
|
|
162
|
+
const prerenderManifest = loadManifest(
|
|
163
|
+
(0, import_node_path.join)(this.options.serverDistDir, "..", "prerender-manifest.json")
|
|
164
|
+
);
|
|
165
|
+
try {
|
|
166
|
+
const { normalizePagePath } = await import("next/dist/shared/lib/page-path/normalize-page-path.js");
|
|
167
|
+
prerenderManifest.routes[key] = {
|
|
168
|
+
experimentalPPR: void 0,
|
|
169
|
+
dataRoute: (0, import_posix.join)("/_next/data", `${normalizePagePath(key)}.json`),
|
|
170
|
+
srcRoute: null,
|
|
171
|
+
// FIXME: provide actual source route, however, when dynamically appending it doesn't really matter
|
|
172
|
+
initialRevalidateSeconds: revalidate,
|
|
173
|
+
// Pages routes do not have a prefetch data route.
|
|
174
|
+
prefetchDataRoute: void 0
|
|
175
|
+
};
|
|
176
|
+
} catch {
|
|
177
|
+
const { SharedRevalidateTimings } = await import("next/dist/server/lib/incremental-cache/shared-revalidate-timings.js");
|
|
178
|
+
const sharedRevalidateTimings = new SharedRevalidateTimings(prerenderManifest);
|
|
179
|
+
sharedRevalidateTimings.set(key, revalidate);
|
|
180
|
+
}
|
|
181
|
+
} catch {
|
|
182
|
+
}
|
|
174
183
|
}
|
|
175
184
|
}
|
|
176
185
|
async get(...args) {
|
|
@@ -216,12 +225,24 @@ var NetlifyCacheHandler = class {
|
|
|
216
225
|
case "PAGE": {
|
|
217
226
|
span.addEvent("PAGE", { lastModified: blob.lastModified });
|
|
218
227
|
const { revalidate, ...restOfPageValue } = blob.value;
|
|
219
|
-
this.injectEntryToPrerenderManifest(key, revalidate);
|
|
228
|
+
await this.injectEntryToPrerenderManifest(key, revalidate);
|
|
220
229
|
return {
|
|
221
230
|
lastModified: blob.lastModified,
|
|
222
231
|
value: restOfPageValue
|
|
223
232
|
};
|
|
224
233
|
}
|
|
234
|
+
case "APP_PAGE": {
|
|
235
|
+
span.addEvent("APP_PAGE", { lastModified: blob.lastModified });
|
|
236
|
+
const { revalidate, rscData, ...restOfPageValue } = blob.value;
|
|
237
|
+
await this.injectEntryToPrerenderManifest(key, revalidate);
|
|
238
|
+
return {
|
|
239
|
+
lastModified: blob.lastModified,
|
|
240
|
+
value: {
|
|
241
|
+
...restOfPageValue,
|
|
242
|
+
rscData: rscData ? import_node_buffer.Buffer.from(rscData, "base64") : void 0
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
}
|
|
225
246
|
default:
|
|
226
247
|
span.recordException(new Error(`Unknown cache entry kind: ${blob.value?.kind}`));
|
|
227
248
|
}
|
|
@@ -242,6 +263,13 @@ var NetlifyCacheHandler = class {
|
|
|
242
263
|
revalidate: context.revalidate
|
|
243
264
|
};
|
|
244
265
|
}
|
|
266
|
+
if (data?.kind === "APP_PAGE") {
|
|
267
|
+
return {
|
|
268
|
+
...data,
|
|
269
|
+
revalidate: context.revalidate,
|
|
270
|
+
rscData: data.rscData?.toString("base64")
|
|
271
|
+
};
|
|
272
|
+
}
|
|
245
273
|
return data;
|
|
246
274
|
}
|
|
247
275
|
async set(...args) {
|
|
@@ -298,7 +326,7 @@ var NetlifyCacheHandler = class {
|
|
|
298
326
|
let cacheTags = [];
|
|
299
327
|
if (cacheEntry.value?.kind === "FETCH") {
|
|
300
328
|
cacheTags = [...tags, ...softTags];
|
|
301
|
-
} else if (cacheEntry.value?.kind === "PAGE" || cacheEntry.value?.kind === "ROUTE") {
|
|
329
|
+
} else if (cacheEntry.value?.kind === "PAGE" || cacheEntry.value?.kind === "APP_PAGE" || cacheEntry.value?.kind === "ROUTE") {
|
|
302
330
|
cacheTags = cacheEntry.value.headers?.[import_constants.NEXT_CACHE_TAGS_HEADER]?.split(",") || [];
|
|
303
331
|
} else {
|
|
304
332
|
return false;
|
|
@@ -67385,7 +67385,7 @@ var import_semantic_conventions = __toESM(require_src(), 1);
|
|
|
67385
67385
|
import { getLogger } from "./request-context.cjs";
|
|
67386
67386
|
var {
|
|
67387
67387
|
default: { version, name }
|
|
67388
|
-
} = await import("../../esm-chunks/package-
|
|
67388
|
+
} = await import("../../esm-chunks/package-7AUBRXLQ.js");
|
|
67389
67389
|
var sdk = new import_sdk_node.NodeSDK({
|
|
67390
67390
|
resource: new import_resources.Resource({
|
|
67391
67391
|
[import_semantic_conventions.SEMRESATTRS_SERVICE_NAME]: name,
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { Context } from '@netlify/edge-functions'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
addBasePath,
|
|
5
|
+
addTrailingSlash,
|
|
6
|
+
normalizeDataUrl,
|
|
7
|
+
normalizeLocalePath,
|
|
8
|
+
removeBasePath,
|
|
9
|
+
} from './util.ts'
|
|
4
10
|
|
|
5
11
|
interface I18NConfig {
|
|
6
12
|
defaultLocale: string
|
|
@@ -41,43 +47,25 @@ const normalizeRequestURL = (
|
|
|
41
47
|
): { url: string; detectedLocale?: string } => {
|
|
42
48
|
const url = new URL(originalURL)
|
|
43
49
|
|
|
44
|
-
|
|
45
|
-
const didRemoveBasePath = url.toString() !== originalURL
|
|
50
|
+
let pathname = removeBasePath(url.pathname, nextConfig?.basePath)
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (nextConfig?.i18n) {
|
|
50
|
-
const { pathname, detectedLocale: detected } = normalizeLocalePath(
|
|
51
|
-
url.pathname,
|
|
52
|
-
nextConfig?.i18n?.locales,
|
|
53
|
-
)
|
|
54
|
-
if (!nextConfig?.skipMiddlewareUrlNormalize) {
|
|
55
|
-
url.pathname = pathname || '/'
|
|
56
|
-
}
|
|
57
|
-
detectedLocale = detected
|
|
58
|
-
}
|
|
52
|
+
// If it exists, remove the locale from the URL and store it
|
|
53
|
+
const { detectedLocale } = normalizeLocalePath(pathname, nextConfig?.i18n?.locales)
|
|
59
54
|
|
|
60
55
|
if (!nextConfig?.skipMiddlewareUrlNormalize) {
|
|
61
56
|
// We want to run middleware for data requests and expose the URL of the
|
|
62
57
|
// corresponding pages, so we have to normalize the URLs before running
|
|
63
58
|
// the handler.
|
|
64
|
-
|
|
59
|
+
pathname = normalizeDataUrl(pathname)
|
|
65
60
|
|
|
66
61
|
// Normalizing the trailing slash based on the `trailingSlash` configuration
|
|
67
62
|
// property from the Next.js config.
|
|
68
|
-
if (nextConfig?.trailingSlash
|
|
69
|
-
|
|
63
|
+
if (nextConfig?.trailingSlash) {
|
|
64
|
+
pathname = addTrailingSlash(pathname)
|
|
70
65
|
}
|
|
71
66
|
}
|
|
72
67
|
|
|
73
|
-
|
|
74
|
-
url.pathname = addBasePath(url.pathname, nextConfig?.basePath)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// keep the locale in the url for request.nextUrl object
|
|
78
|
-
if (detectedLocale) {
|
|
79
|
-
url.pathname = `/${detectedLocale}${url.pathname}`
|
|
80
|
-
}
|
|
68
|
+
url.pathname = addBasePath(pathname, nextConfig?.basePath)
|
|
81
69
|
|
|
82
70
|
return {
|
|
83
71
|
url: url.toString(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/plugin-nextjs",
|
|
3
|
-
"version": "5.3.3
|
|
3
|
+
"version": "5.3.3",
|
|
4
4
|
"description": "Run Next.js seamlessly on Netlify",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/netlify/next-runtime
|
|
17
|
+
"url": "git+https://github.com/netlify/next-runtime.git"
|
|
18
18
|
},
|
|
19
19
|
"keywords": [
|
|
20
20
|
"nextjs",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"bugs": {
|
|
27
|
-
"url": "https://github.com/netlify/next-runtime
|
|
27
|
+
"url": "https://github.com/netlify/next-runtime/issues"
|
|
28
28
|
},
|
|
29
|
-
"homepage": "https://github.com/netlify/next-runtime
|
|
29
|
+
"homepage": "https://github.com/netlify/next-runtime#readme"
|
|
30
30
|
}
|