@netlify/plugin-nextjs 5.0.0-beta.6 → 5.0.0-beta.8

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.
Files changed (40) hide show
  1. package/dist/build/cache.js +1 -1
  2. package/dist/build/content/prerendered.js +3 -3
  3. package/dist/build/content/server.js +3 -3
  4. package/dist/build/content/static.js +3 -3
  5. package/dist/build/functions/edge.js +3 -3
  6. package/dist/build/functions/server.js +4 -4
  7. package/dist/build/image-cdn.js +1 -1
  8. package/dist/build/plugin-context.js +1 -1
  9. package/dist/build/templates/handler-monorepo.tmpl.js +46 -0
  10. package/dist/build/templates/handler.tmpl.js +37 -0
  11. package/dist/esm-chunks/{chunk-WELZ7LFO.js → chunk-5JVNISGM.js} +12 -1
  12. package/dist/esm-chunks/{chunk-PCJY2SS7.js → chunk-ETPYUOBQ.js} +4 -4
  13. package/dist/esm-chunks/{chunk-X7XIMV6B.js → chunk-HYBEXB2Z.js} +1 -1
  14. package/dist/esm-chunks/{chunk-W5TLWQMF.js → chunk-N23TUUXK.js} +69 -17
  15. package/dist/esm-chunks/chunk-VDDK7MXY.js +1661 -0
  16. package/dist/esm-chunks/{chunk-MFN4GH7U.js → chunk-VZNKO4OO.js} +1 -1
  17. package/dist/esm-chunks/{chunk-KDRFBPAR.js → chunk-WSPFUAK4.js} +17 -29
  18. package/dist/esm-chunks/{chunk-NE4HYI2D.js → chunk-WT2HN3M6.js} +1 -1
  19. package/dist/esm-chunks/{chunk-UDWVXRI2.js → chunk-XFDUV7DP.js} +3 -3
  20. package/dist/esm-chunks/{chunk-COJ526HO.js → chunk-YMFYCTRI.js} +4 -4
  21. package/dist/esm-chunks/{chunk-AMJYZZKR.js → chunk-ZWFKLYLH.js} +6 -3
  22. package/dist/esm-chunks/package-2CI3IXK3.js +131 -0
  23. package/dist/index.js +12 -12
  24. package/dist/run/config.js +1 -1
  25. package/dist/run/constants.js +1 -1
  26. package/dist/run/handlers/cache.cjs +1765 -79
  27. package/dist/run/handlers/server.js +60 -38
  28. package/dist/run/handlers/tracing.js +52883 -0
  29. package/dist/run/headers.js +2 -2
  30. package/dist/run/next.cjs +1722 -34
  31. package/dist/run/revalidate.js +2 -2
  32. package/dist/run/systemlog.js +2 -2
  33. package/dist/shared/blobkey.js +1 -1
  34. package/edge-runtime/lib/headers.ts +18 -4
  35. package/edge-runtime/lib/next-request.ts +6 -1
  36. package/edge-runtime/lib/response.ts +56 -13
  37. package/edge-runtime/lib/util.ts +13 -3
  38. package/edge-runtime/middleware.ts +1 -0
  39. package/edge-runtime/shim/index.js +27 -0
  40. package/package.json +1 -1
@@ -7,7 +7,7 @@
7
7
  import {
8
8
  __commonJS,
9
9
  __require
10
- } from "./chunk-WELZ7LFO.js";
10
+ } from "./chunk-5JVNISGM.js";
11
11
 
12
12
  // node_modules/fast-glob/out/utils/array.js
13
13
  var require_array = __commonJS({
@@ -8,26 +8,29 @@ import {
8
8
  copyNextDependencies,
9
9
  copyNextServerCode,
10
10
  writeTagsManifest
11
- } from "./chunk-COJ526HO.js";
12
- import {
13
- require_out
14
- } from "./chunk-MFN4GH7U.js";
11
+ } from "./chunk-YMFYCTRI.js";
15
12
  import {
16
13
  SERVER_HANDLER_NAME
17
14
  } from "./chunk-IZ2AVCVF.js";
15
+ import {
16
+ require_out
17
+ } from "./chunk-VZNKO4OO.js";
18
18
  import {
19
19
  __toESM
20
- } from "./chunk-WELZ7LFO.js";
20
+ } from "./chunk-5JVNISGM.js";
21
21
 
22
22
  // src/build/functions/server.ts
23
23
  var import_fast_glob = __toESM(require_out(), 1);
24
- import { cp, mkdir, rm, writeFile } from "fs/promises";
24
+ import { cp, mkdir, readFile, rm, writeFile } from "fs/promises";
25
25
  import { join } from "node:path";
26
26
  var copyHandlerDependencies = async (ctx) => {
27
27
  const fileList = await (0, import_fast_glob.glob)("dist/**/*", { cwd: ctx.pluginDir });
28
28
  await Promise.all(
29
29
  [...fileList].map(
30
- (path) => cp(join(ctx.pluginDir, path), join(ctx.serverHandlerDir, path), { recursive: true })
30
+ (path) => cp(join(ctx.pluginDir, path), join(ctx.serverHandlerDir, path), {
31
+ recursive: true,
32
+ force: true
33
+ })
31
34
  )
32
35
  );
33
36
  };
@@ -54,32 +57,17 @@ var writePackageMetadata = async (ctx) => {
54
57
  JSON.stringify({ type: "module" })
55
58
  );
56
59
  };
57
- var getHandlerFile = (ctx) => {
58
- const config = `
59
- export const config = {
60
- path: '/*',
61
- preferStatic: true,
62
- }`;
60
+ var getHandlerFile = async (ctx) => {
61
+ const templatesDir = join(ctx.pluginDir, "dist/build/templates");
63
62
  if (ctx.packagePath.length !== 0) {
64
- return `process.chdir('${join("/var/task", ctx.packagePath)}');
65
-
66
- let cachedHandler;
67
- export default async function(...args) {
68
- if (!cachedHandler) {
69
- const { default: handler } = await import('./${ctx.nextServerHandler}');
70
- cachedHandler = handler;
71
- }
72
- return cachedHandler(...args)
73
- };
74
-
75
- ${config}`;
63
+ const template = await readFile(join(templatesDir, "handler-monorepo.tmpl.js"), "utf-8");
64
+ return template.replaceAll("{{cwd}}", join("/var/task", ctx.packagePath)).replace("{{nextServerHandler}}", ctx.nextServerHandler);
76
65
  }
77
- return `import handler from './dist/run/handlers/server.js';
78
- export default handler;
79
- ${config}`;
66
+ return await readFile(join(templatesDir, "handler.tmpl.js"), "utf-8");
80
67
  };
81
68
  var writeHandlerFile = async (ctx) => {
82
- await writeFile(join(ctx.serverHandlerRootDir, `${SERVER_HANDLER_NAME}.mjs`), getHandlerFile(ctx));
69
+ const handler = await getHandlerFile(ctx);
70
+ await writeFile(join(ctx.serverHandlerRootDir, `${SERVER_HANDLER_NAME}.mjs`), handler);
83
71
  };
84
72
  var createServerHandler = async (ctx) => {
85
73
  await rm(ctx.serverFunctionsDir, { recursive: true, force: true });
@@ -8,7 +8,7 @@ import {
8
8
  __commonJS,
9
9
  __require,
10
10
  __toESM
11
- } from "./chunk-WELZ7LFO.js";
11
+ } from "./chunk-5JVNISGM.js";
12
12
 
13
13
  // node_modules/is-promise/index.js
14
14
  var require_is_promise = __commonJS({
@@ -6,10 +6,10 @@
6
6
 
7
7
  import {
8
8
  require_out
9
- } from "./chunk-MFN4GH7U.js";
9
+ } from "./chunk-VZNKO4OO.js";
10
10
  import {
11
11
  __toESM
12
- } from "./chunk-WELZ7LFO.js";
12
+ } from "./chunk-5JVNISGM.js";
13
13
 
14
14
  // src/build/content/prerendered.ts
15
15
  var import_fast_glob = __toESM(require_out(), 1);
@@ -30,7 +30,7 @@ var buildAppCacheValue = async (path) => ({
30
30
  });
31
31
  var buildRouteCacheValue = async (path) => ({
32
32
  kind: "ROUTE",
33
- body: await readFile(`${path}.body`, "utf-8"),
33
+ body: await readFile(`${path}.body`, "base64"),
34
34
  ...JSON.parse(await readFile(`${path}.meta`, "utf-8"))
35
35
  });
36
36
  var buildFetchCacheValue = async (path) => ({
@@ -6,10 +6,10 @@
6
6
 
7
7
  import {
8
8
  require_out
9
- } from "./chunk-MFN4GH7U.js";
9
+ } from "./chunk-VZNKO4OO.js";
10
10
  import {
11
11
  __toESM
12
- } from "./chunk-WELZ7LFO.js";
12
+ } from "./chunk-5JVNISGM.js";
13
13
 
14
14
  // src/build/content/server.ts
15
15
  var import_fast_glob = __toESM(require_out(), 1);
@@ -39,7 +39,7 @@ var copyNextServerCode = async (ctx) => {
39
39
  }
40
40
  return;
41
41
  }
42
- await cp(srcPath, destPath, { recursive: true });
42
+ await cp(srcPath, destPath, { recursive: true, force: true });
43
43
  })
44
44
  );
45
45
  };
@@ -72,7 +72,7 @@ var copyNextDependencies = async (ctx) => {
72
72
  }
73
73
  const src = join(ctx.standaloneDir, entry);
74
74
  const dest = join(ctx.serverHandlerDir, entry);
75
- await cp(src, dest, { recursive: true, verbatimSymlinks: true });
75
+ await cp(src, dest, { recursive: true, verbatimSymlinks: true, force: true });
76
76
  if (entry === "node_modules") {
77
77
  await recreateNodeModuleSymlinks(ctx.resolve("node_modules"), dest);
78
78
  }
@@ -6,13 +6,13 @@
6
6
 
7
7
  import {
8
8
  require_out
9
- } from "./chunk-MFN4GH7U.js";
9
+ } from "./chunk-VZNKO4OO.js";
10
10
  import {
11
11
  encodeBlobKey
12
12
  } from "./chunk-TYCYFZ22.js";
13
13
  import {
14
14
  __toESM
15
- } from "./chunk-WELZ7LFO.js";
15
+ } from "./chunk-5JVNISGM.js";
16
16
 
17
17
  // src/build/content/static.ts
18
18
  var import_fast_glob = __toESM(require_out(), 1);
@@ -29,7 +29,10 @@ var copyStaticContent = async (ctx) => {
29
29
  try {
30
30
  await Promise.all(
31
31
  paths.filter((path) => !paths.includes(`${path.slice(0, -5)}.json`)).map(async (path) => {
32
- await cp(join(srcDir, path), join(destDir, await encodeBlobKey(path)), { recursive: true });
32
+ await cp(join(srcDir, path), join(destDir, await encodeBlobKey(path)), {
33
+ recursive: true,
34
+ force: true
35
+ });
33
36
  })
34
37
  );
35
38
  } catch (error) {
@@ -0,0 +1,131 @@
1
+
2
+ var require = await (async () => {
3
+ var { createRequire } = await import("node:module");
4
+ return createRequire(import.meta.url);
5
+ })();
6
+
7
+ import "./chunk-5JVNISGM.js";
8
+
9
+ // package.json
10
+ var name = "@netlify/plugin-nextjs";
11
+ var version = "5.0.0-beta.8";
12
+ var description = "Run Next.js seamlessly on Netlify";
13
+ var main = "./dist/index.js";
14
+ var type = "module";
15
+ var files = [
16
+ "dist",
17
+ "edge-runtime",
18
+ "manifest.yml"
19
+ ];
20
+ var engines = {
21
+ node: ">=18.0.0"
22
+ };
23
+ var scripts = {
24
+ prepack: "clean-package",
25
+ postpack: "clean-package restore",
26
+ pretest: "node tests/prepare.mjs",
27
+ build: "node ./tools/build.js",
28
+ "build:watch": "node ./tools/build.js --watch",
29
+ lint: "eslint --cache --format=codeframe --max-warnings=0 src/**/*.ts",
30
+ test: "vitest",
31
+ "test:ci": "vitest run --reporter=default --retry=3",
32
+ e2e: "playwright test",
33
+ "e2e:ci": "playwright test"
34
+ };
35
+ var repository = {
36
+ type: "git",
37
+ url: "git+https://github.com/netlify/next-runtime-minimal.git"
38
+ };
39
+ var keywords = [
40
+ "nextjs",
41
+ "netlify",
42
+ "next",
43
+ "netlify-runtime"
44
+ ];
45
+ var license = "MIT";
46
+ var bugs = {
47
+ url: "https://github.com/netlify/next-runtime-minimal/issues"
48
+ };
49
+ var homepage = "https://github.com/netlify/next-runtime-minimal#readme";
50
+ var devDependencies = {
51
+ "@fastly/http-compute-js": "1.1.4",
52
+ "@netlify/blobs": "^6.5.0",
53
+ "@netlify/build": "^29.33.5",
54
+ "@netlify/edge-bundler": "^11.2.2",
55
+ "@netlify/edge-functions": "^2.3.0",
56
+ "@netlify/eslint-config-node": "^7.0.1",
57
+ "@netlify/functions": "^2.5.1",
58
+ "@netlify/serverless-functions-api": "^1.10.1",
59
+ "@netlify/zip-it-and-ship-it": "^9.29.1",
60
+ "@opentelemetry/api": "^1.7.0",
61
+ "@opentelemetry/sdk-node": "^0.48.0",
62
+ "@opentelemetry/exporter-trace-otlp-http": "^0.48.0",
63
+ "@opentelemetry/resources": "^1.21.0",
64
+ "@opentelemetry/semantic-conventions": "^1.21.0",
65
+ "@opentelemetry/sdk-trace-node": "^1.21.0",
66
+ "@playwright/test": "^1.40.0",
67
+ "@types/node": "^20.9.2",
68
+ "@types/uuid": "^9.0.6",
69
+ "@vercel/nft": "^0.26.0",
70
+ cheerio: "^1.0.0-rc.12",
71
+ "clean-package": "^2.2.0",
72
+ esbuild: "^0.20.0",
73
+ execa: "^8.0.1",
74
+ "fast-glob": "^3.3.2",
75
+ "fs-monkey": "^1.0.5",
76
+ "get-port": "^7.0.0",
77
+ "lambda-local": "^2.1.2",
78
+ memfs: "^4.6.0",
79
+ msw: "^2.0.7",
80
+ next: "^14.0.4",
81
+ os: "^0.1.2",
82
+ outdent: "^0.8.0",
83
+ "p-limit": "^4.0.0",
84
+ typescript: "^5.1.6",
85
+ unionfs: "^4.5.1",
86
+ uuid: "^9.0.1",
87
+ vitest: "^0.34.6"
88
+ };
89
+ var clean_package = {
90
+ indent: 2,
91
+ remove: [
92
+ "dependencies",
93
+ "devDependencies",
94
+ "scripts"
95
+ ]
96
+ };
97
+ var package_default = {
98
+ name,
99
+ version,
100
+ description,
101
+ main,
102
+ type,
103
+ files,
104
+ engines,
105
+ scripts,
106
+ repository,
107
+ keywords,
108
+ license,
109
+ bugs,
110
+ homepage,
111
+ devDependencies,
112
+ "clean-package": clean_package
113
+ };
114
+ export {
115
+ bugs,
116
+ clean_package as "clean-package",
117
+ package_default as default,
118
+ description,
119
+ devDependencies,
120
+ engines,
121
+ files,
122
+ homepage,
123
+ keywords,
124
+ license,
125
+ main,
126
+ name,
127
+ repository,
128
+ scripts,
129
+ type,
130
+ version
131
+ };
package/dist/index.js CHANGED
@@ -4,24 +4,28 @@
4
4
  return createRequire(import.meta.url);
5
5
  })();
6
6
 
7
+ import {
8
+ createServerHandler
9
+ } from "./esm-chunks/chunk-WSPFUAK4.js";
7
10
  import {
8
11
  copyFetchContent,
9
12
  copyPrerenderedContent
10
- } from "./esm-chunks/chunk-UDWVXRI2.js";
13
+ } from "./esm-chunks/chunk-XFDUV7DP.js";
14
+ import "./esm-chunks/chunk-YMFYCTRI.js";
11
15
  import {
12
16
  copyStaticAssets,
13
17
  copyStaticContent,
14
18
  publishStaticDir,
15
19
  unpublishStaticDir
16
- } from "./esm-chunks/chunk-AMJYZZKR.js";
20
+ } from "./esm-chunks/chunk-ZWFKLYLH.js";
17
21
  import {
18
22
  createEdgeHandlers
19
- } from "./esm-chunks/chunk-PCJY2SS7.js";
23
+ } from "./esm-chunks/chunk-ETPYUOBQ.js";
20
24
  import {
21
- createServerHandler
22
- } from "./esm-chunks/chunk-KDRFBPAR.js";
23
- import "./esm-chunks/chunk-COJ526HO.js";
24
- import "./esm-chunks/chunk-MFN4GH7U.js";
25
+ PluginContext
26
+ } from "./esm-chunks/chunk-IZ2AVCVF.js";
27
+ import "./esm-chunks/chunk-VZNKO4OO.js";
28
+ import "./esm-chunks/chunk-TYCYFZ22.js";
25
29
  import {
26
30
  restoreBuildCache,
27
31
  saveBuildCache
@@ -29,11 +33,7 @@ import {
29
33
  import {
30
34
  setImageConfig
31
35
  } from "./esm-chunks/chunk-EPSI5TTB.js";
32
- import {
33
- PluginContext
34
- } from "./esm-chunks/chunk-IZ2AVCVF.js";
35
- import "./esm-chunks/chunk-TYCYFZ22.js";
36
- import "./esm-chunks/chunk-WELZ7LFO.js";
36
+ import "./esm-chunks/chunk-5JVNISGM.js";
37
37
 
38
38
  // src/index.ts
39
39
  import { existsSync } from "node:fs";
@@ -10,7 +10,7 @@ import {
10
10
  setRunConfig
11
11
  } from "../esm-chunks/chunk-XIP2W57K.js";
12
12
  import "../esm-chunks/chunk-K233JI4O.js";
13
- import "../esm-chunks/chunk-WELZ7LFO.js";
13
+ import "../esm-chunks/chunk-5JVNISGM.js";
14
14
  export {
15
15
  getRunConfig,
16
16
  getTagsManifest,
@@ -8,7 +8,7 @@ import {
8
8
  MODULE_DIR,
9
9
  PLUGIN_DIR
10
10
  } from "../esm-chunks/chunk-K233JI4O.js";
11
- import "../esm-chunks/chunk-WELZ7LFO.js";
11
+ import "../esm-chunks/chunk-5JVNISGM.js";
12
12
  export {
13
13
  MODULE_DIR,
14
14
  PLUGIN_DIR