@netlify/plugin-nextjs 5.0.0-rc.7 → 5.0.0
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 +18 -105
- package/dist/build/image-cdn.js +1 -1
- package/dist/esm-chunks/{chunk-FMO6SJ5E.js → chunk-MCEOSJH6.js} +21 -9
- package/dist/esm-chunks/{package-NR7AMHPP.js → package-F3THTZDD.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/run/handlers/cache.cjs +7 -2
- package/dist/run/handlers/tracing.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,105 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
│ └── next.cjs
|
|
20
|
-
├── .next // or distDir name from the next.config.js
|
|
21
|
-
│ └── // content from standalone
|
|
22
|
-
├── run-config.json // the config object from the required-server-files.json
|
|
23
|
-
├── node_modules
|
|
24
|
-
├── ___netlify-server-handler.json
|
|
25
|
-
├── ___netlify-server-handler.mjs
|
|
26
|
-
└── package.json
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Testing
|
|
30
|
-
|
|
31
|
-
The repo includes two types of tests: e2e tests in the repo that use Playwright, integration tests
|
|
32
|
-
that use Vitest.
|
|
33
|
-
|
|
34
|
-
By default the e2e and integration tests run against the latest version of Next.js. To run tests
|
|
35
|
-
against a specific version, set the `NEXT_VERSION` environment variable to the desired version.
|
|
36
|
-
|
|
37
|
-
By default, PRs will run the integration tests against the latest version of Next.js. To run tests
|
|
38
|
-
against `latest`, `canary` and `13.5.1`, apply the `test all versions` label to the PR when you
|
|
39
|
-
create it. These also run nightly and on release PRs.
|
|
40
|
-
|
|
41
|
-
### Integration testing
|
|
42
|
-
|
|
43
|
-
> **Prerequisite** Run `npm run build` before running integration tests.
|
|
44
|
-
|
|
45
|
-
How to add new integration test scenarios to the application:
|
|
46
|
-
|
|
47
|
-
1. Create a new folder under `tests/fixtures/<your-name>`
|
|
48
|
-
2. Adapt the `next.config.js` to be a standalone application
|
|
49
|
-
3. Create a `postinstall` script that runs the `next build`. It's important to notice that the
|
|
50
|
-
integration tests rely on a already built next.js application in this folder. They rely on the
|
|
51
|
-
`.next` folder.
|
|
52
|
-
4. Add your test
|
|
53
|
-
|
|
54
|
-
> Currently the tests require a built version of the `dist/run/handlers/cache.cjs` so you need to
|
|
55
|
-
> run `npm run build` before executing the integration tests.
|
|
56
|
-
|
|
57
|
-
In addition, the integration tests need to be prepared before first use. You can do this by running
|
|
58
|
-
`npm run pretest`. To speed up this process and build only the fixtures whose name starts with a
|
|
59
|
-
given prefix, run `npm run pretest -- <prefix>`.
|
|
60
|
-
|
|
61
|
-
### E2E testing
|
|
62
|
-
|
|
63
|
-
> **Prerequisite**
|
|
64
|
-
>
|
|
65
|
-
> Needs the `netlify-cli` installed and being logged in having access to Netlify Testing
|
|
66
|
-
> Organization
|
|
67
|
-
|
|
68
|
-
The e2e tests can be invoked with `npm run e2e` and perform a full e2e test. This means they do the
|
|
69
|
-
following:
|
|
70
|
-
|
|
71
|
-
1. Building the next-runtime (just running `npm run build` in the repository)
|
|
72
|
-
2. Creating a temp directory and copying the provided fixture over to the directory.
|
|
73
|
-
3. Packing the runtime with `npm pack` to the temp directory.
|
|
74
|
-
4. Installing the runtime from the created zip artifact of `npm pack` (this is like installing a
|
|
75
|
-
node_module from the registry)
|
|
76
|
-
5. Creating a `netlify.toml` inside the temp directory of the fixture and adding the runtime as a
|
|
77
|
-
plugin.
|
|
78
|
-
6. Running `netlify deploy --build` invoking the runtime. This will use the
|
|
79
|
-
[next-runtime-testing](https://app.netlify.com/sites/next-runtime-testing/overview) as site to
|
|
80
|
-
deploy to.
|
|
81
|
-
7. Using the `deployId` and `url` of the deployed site to run some
|
|
82
|
-
[playwright](https://playwright.dev/) tests against, asserting the correctness of the runtime.
|
|
83
|
-
8. After the tests where run successfully, it will delete the deployment again and clean everything
|
|
84
|
-
up. In case of a failure, the deploy won't be cleaned up to leave it for troubleshooting
|
|
85
|
-
purposes.
|
|
86
|
-
|
|
87
|
-
> [!TIP] If you'd like to always keep the deployment and the local fixture around for
|
|
88
|
-
> troubleshooting, run `E2E_PERSIST=1 npm run e2e`.
|
|
89
|
-
|
|
90
|
-
### Next.js tests
|
|
91
|
-
|
|
92
|
-
There is a script `run-local-test.sh` and GitHub workflow that runs the e2e tests from the Next.js
|
|
93
|
-
repo against this repo. It requires that `next.js` is checked out in the same parent directory as
|
|
94
|
-
this repo, and is run from this repo with `./run-local-test.sh your-test-pattern-here`.
|
|
95
|
-
|
|
96
|
-
#### cleanup old deploys
|
|
97
|
-
|
|
98
|
-
To cleanup old and dangling deploys from failed builds you can run the following script:
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
npx tsx ./tools/e2e/cleanup-deploys.ts
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
This will cleanup all created deploys on the
|
|
105
|
-
[next-runtime-testing](https://app.netlify.com/sites/next-runtime-testing/overview) site.
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# `@netlify/plugin-nextjs`
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a aria-label="npm version" href="https://www.npmjs.com/package/@netlify/plugin-nextjs">
|
|
7
|
+
<img alt="" src="https://img.shields.io/npm/v/@netlify/plugin-nextjs">
|
|
8
|
+
</a>
|
|
9
|
+
<a aria-label="MIT License" href="https://img.shields.io/npm/l/@netlify/plugin-nextjs">
|
|
10
|
+
<img alt="" src="https://img.shields.io/npm/l/@netlify/plugin-nextjs">
|
|
11
|
+
</a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
This package handles the build process and creates the runtime environment for Next.js sites on
|
|
15
|
+
Netlify. You should not normally need to install it yourself, as it is used automatically during
|
|
16
|
+
builds of Next.js sites. See
|
|
17
|
+
[the docs for using Next.js on Netlify](https://docs.netlify.com/frameworks/next-js/overview/) for
|
|
18
|
+
more details.
|
package/dist/build/image-cdn.js
CHANGED
|
@@ -1565,15 +1565,27 @@ var setImageConfig = async (ctx) => {
|
|
|
1565
1565
|
if (imageLoader !== "default") {
|
|
1566
1566
|
return;
|
|
1567
1567
|
}
|
|
1568
|
-
ctx.netlifyConfig.redirects.push(
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1568
|
+
ctx.netlifyConfig.redirects.push(
|
|
1569
|
+
{
|
|
1570
|
+
from: imageEndpointPath,
|
|
1571
|
+
// w and q are too short to be used as params with id-length rule
|
|
1572
|
+
// but we are forced to do so because of the next/image loader decides on their names
|
|
1573
|
+
// eslint-disable-next-line id-length
|
|
1574
|
+
query: { url: ":url", w: ":width", q: ":quality" },
|
|
1575
|
+
to: "/.netlify/images?url=:url&w=:width&q=:quality",
|
|
1576
|
+
status: 200
|
|
1577
|
+
},
|
|
1578
|
+
// when migrating from @netlify/plugin-nextjs@4 image redirect to ipx might be cached in the browser
|
|
1579
|
+
{
|
|
1580
|
+
from: "/_ipx/*",
|
|
1581
|
+
// w and q are too short to be used as params with id-length rule
|
|
1582
|
+
// but we are forced to do so because of the next/image loader decides on their names
|
|
1583
|
+
// eslint-disable-next-line id-length
|
|
1584
|
+
query: { url: ":url", w: ":width", q: ":quality" },
|
|
1585
|
+
to: "/.netlify/images?url=:url&w=:width&q=:quality",
|
|
1586
|
+
status: 200
|
|
1587
|
+
}
|
|
1588
|
+
);
|
|
1577
1589
|
if (remotePatterns?.length !== 0 || domains?.length !== 0) {
|
|
1578
1590
|
ctx.netlifyConfig.images ||= { remote_images: [] };
|
|
1579
1591
|
ctx.netlifyConfig.images.remote_images ||= [];
|
|
@@ -8,7 +8,7 @@ import "./chunk-5JVNISGM.js";
|
|
|
8
8
|
|
|
9
9
|
// package.json
|
|
10
10
|
var name = "@netlify/plugin-nextjs";
|
|
11
|
-
var version = "5.0.0
|
|
11
|
+
var version = "5.0.0";
|
|
12
12
|
var description = "Run Next.js seamlessly on Netlify";
|
|
13
13
|
var main = "./dist/index.js";
|
|
14
14
|
var type = "module";
|
|
@@ -53,7 +53,7 @@ var homepage = "https://github.com/netlify/next-runtime-minimal#readme";
|
|
|
53
53
|
var devDependencies = {
|
|
54
54
|
"@fastly/http-compute-js": "1.1.4",
|
|
55
55
|
"@netlify/blobs": "^7.0.1",
|
|
56
|
-
"@netlify/build": "^29.
|
|
56
|
+
"@netlify/build": "^29.37.2",
|
|
57
57
|
"@netlify/edge-bundler": "^11.3.0",
|
|
58
58
|
"@netlify/edge-functions": "^2.3.1",
|
|
59
59
|
"@netlify/eslint-config-node": "^7.0.1",
|
package/dist/index.js
CHANGED
|
@@ -925,12 +925,17 @@ var NetlifyCacheHandler = class {
|
|
|
925
925
|
const lastModified = Date.now();
|
|
926
926
|
span.setAttributes({ key, lastModified, blobKey });
|
|
927
927
|
console.debug(`[NetlifyCacheHandler.set]: ${key}`);
|
|
928
|
+
let value = data;
|
|
928
929
|
if (data?.kind === "ROUTE") {
|
|
929
|
-
|
|
930
|
+
value = {
|
|
931
|
+
...data,
|
|
932
|
+
// @ts-expect-error gotta find a better solution for this
|
|
933
|
+
body: data.body.toString("base64")
|
|
934
|
+
};
|
|
930
935
|
}
|
|
931
936
|
await this.blobStore.setJSON(blobKey, {
|
|
932
937
|
lastModified,
|
|
933
|
-
value
|
|
938
|
+
value
|
|
934
939
|
});
|
|
935
940
|
if (data?.kind === "PAGE") {
|
|
936
941
|
const requestContext = (0, import_request_context.getRequestContext)();
|
|
@@ -51202,7 +51202,7 @@ var import_sdk_trace_node = __toESM(require_src14(), 1);
|
|
|
51202
51202
|
var import_semantic_conventions = __toESM(require_src(), 1);
|
|
51203
51203
|
var {
|
|
51204
51204
|
default: { version, name }
|
|
51205
|
-
} = await import("../../esm-chunks/package-
|
|
51205
|
+
} = await import("../../esm-chunks/package-F3THTZDD.js");
|
|
51206
51206
|
var sdk = new import_sdk_node.NodeSDK({
|
|
51207
51207
|
resource: new import_resources.Resource({
|
|
51208
51208
|
[import_semantic_conventions.SEMRESATTRS_SERVICE_NAME]: name,
|