@netlify/plugin-nextjs 5.0.0-beta.2 → 5.0.0-beta.4
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 +5 -2
- package/dist/build/cache.js +4 -4
- package/dist/build/content/prerendered.js +5 -5
- package/dist/build/content/server.js +5 -5
- package/dist/build/content/static.js +5 -5
- package/dist/build/functions/edge.js +6 -5
- package/dist/build/functions/server.js +7 -7
- package/dist/build/image-cdn.js +4 -4
- package/dist/build/plugin-context.js +4 -4
- package/dist/esm-chunks/{chunk-5SZ5JD6J.js → chunk-6HBXWNZS.js} +27 -9
- package/dist/esm-chunks/{chunk-S5JXJCXP.js → chunk-DZM5AUXX.js} +4 -4
- package/dist/esm-chunks/{chunk-H46DW7YI.js → chunk-EPSI5TTB.js} +2 -2
- package/dist/esm-chunks/{chunk-TJKO3X6O.js → chunk-IZY5TPZE.js} +27 -3
- package/dist/esm-chunks/{chunk-4AJYXTWN.js → chunk-K233JI4O.js} +2 -2
- package/dist/esm-chunks/{chunk-Z7ZMLVTM.js → chunk-KMPIVUVT.js} +4 -4
- package/dist/esm-chunks/{chunk-AVWFCGVE.js → chunk-MFN4GH7U.js} +3 -3
- package/dist/esm-chunks/{chunk-B6QMRLBH.js → chunk-NE4HYI2D.js} +3 -3
- package/dist/esm-chunks/{chunk-RSKIKBZH.js → chunk-WELZ7LFO.js} +2 -2
- package/dist/esm-chunks/{chunk-ALO2SSMH.js → chunk-X4Q4MYBW.js} +39 -28
- package/dist/esm-chunks/chunk-X7XIMV6B.js +105 -0
- package/dist/esm-chunks/{chunk-GGHAQM5D.js → chunk-XA2CZH5Y.js} +7 -3
- package/dist/esm-chunks/{chunk-3PTPU5GO.js → chunk-XC7T747I.js} +48 -15
- package/dist/esm-chunks/chunk-XIP2W57K.js +39 -0
- package/dist/esm-chunks/{chunk-SMSOJ2OS.js → chunk-YG3G7B2X.js} +2 -2
- package/dist/index.js +18 -14
- package/dist/run/config.js +5 -5
- package/dist/run/constants.js +4 -4
- package/dist/run/handlers/server.js +16 -14
- package/dist/run/headers.js +4 -4
- package/dist/run/revalidate.js +4 -4
- package/dist/run/systemlog.js +9 -8
- package/edge-runtime/lib/headers.ts +5 -0
- package/edge-runtime/lib/logging.ts +5 -0
- package/edge-runtime/lib/next-request.ts +43 -1
- package/edge-runtime/lib/response.ts +81 -19
- package/edge-runtime/lib/util.test.ts +39 -0
- package/edge-runtime/lib/util.ts +79 -7
- package/edge-runtime/middleware.ts +19 -2
- package/edge-runtime/next.config.json +1 -0
- package/edge-runtime/vendor/import_map.json +2 -1
- package/edge-runtime/vendor/v1-7-0--edge-utils.netlify.app/logger/logger.ts +164 -0
- package/edge-runtime/vendor/v1-7-0--edge-utils.netlify.app/logger/mod.ts +1 -0
- package/edge-runtime/vendor.ts +2 -0
- package/package.json +1 -1
- package/dist/esm-chunks/chunk-R4NHZWGU.js +0 -32
- package/dist/esm-chunks/chunk-YZXA5QBC.js +0 -60
package/README.md
CHANGED
|
@@ -17,8 +17,11 @@ How to add new integration test scenarios to the application:
|
|
|
17
17
|
4. Add your test
|
|
18
18
|
|
|
19
19
|
> Currently the tests require a built version of the `dist/run/handlers/cache.cjs` so you need to
|
|
20
|
-
> run `npm run build` before executing the integration tests.
|
|
21
|
-
|
|
20
|
+
> run `npm run build` before executing the integration tests.
|
|
21
|
+
|
|
22
|
+
In addition, the integration tests need to be prepared before first use. You can do this by running
|
|
23
|
+
`npm run pretest`. To speed up this process and build only the fixtures whose name starts with a
|
|
24
|
+
given prefix, run `npm run pretest -- <prefix>`.
|
|
22
25
|
|
|
23
26
|
### E2E testing
|
|
24
27
|
|
package/dist/build/cache.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
restoreBuildCache,
|
|
9
9
|
saveBuildCache
|
|
10
|
-
} from "../esm-chunks/chunk-
|
|
11
|
-
import "../esm-chunks/chunk-
|
|
10
|
+
} from "../esm-chunks/chunk-XA2CZH5Y.js";
|
|
11
|
+
import "../esm-chunks/chunk-WELZ7LFO.js";
|
|
12
12
|
export {
|
|
13
13
|
restoreBuildCache,
|
|
14
14
|
saveBuildCache
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
copyFetchContent,
|
|
9
9
|
copyPrerenderedContent
|
|
10
|
-
} from "../../esm-chunks/chunk-
|
|
11
|
-
import "../../esm-chunks/chunk-
|
|
12
|
-
import "../../esm-chunks/chunk-
|
|
10
|
+
} from "../../esm-chunks/chunk-DZM5AUXX.js";
|
|
11
|
+
import "../../esm-chunks/chunk-MFN4GH7U.js";
|
|
12
|
+
import "../../esm-chunks/chunk-WELZ7LFO.js";
|
|
13
13
|
export {
|
|
14
14
|
copyFetchContent,
|
|
15
15
|
copyPrerenderedContent
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
copyNextDependencies,
|
|
9
9
|
copyNextServerCode,
|
|
10
10
|
writeTagsManifest
|
|
11
|
-
} from "../../esm-chunks/chunk-
|
|
12
|
-
import "../../esm-chunks/chunk-
|
|
13
|
-
import "../../esm-chunks/chunk-
|
|
11
|
+
} from "../../esm-chunks/chunk-6HBXWNZS.js";
|
|
12
|
+
import "../../esm-chunks/chunk-MFN4GH7U.js";
|
|
13
|
+
import "../../esm-chunks/chunk-WELZ7LFO.js";
|
|
14
14
|
export {
|
|
15
15
|
copyNextDependencies,
|
|
16
16
|
copyNextServerCode,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
copyStaticContent,
|
|
10
10
|
publishStaticDir,
|
|
11
11
|
unpublishStaticDir
|
|
12
|
-
} from "../../esm-chunks/chunk-
|
|
13
|
-
import "../../esm-chunks/chunk-
|
|
14
|
-
import "../../esm-chunks/chunk-
|
|
12
|
+
} from "../../esm-chunks/chunk-KMPIVUVT.js";
|
|
13
|
+
import "../../esm-chunks/chunk-MFN4GH7U.js";
|
|
14
|
+
import "../../esm-chunks/chunk-WELZ7LFO.js";
|
|
15
15
|
export {
|
|
16
16
|
copyStaticAssets,
|
|
17
17
|
copyStaticContent,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
createEdgeHandlers
|
|
9
|
-
} from "../../esm-chunks/chunk-
|
|
10
|
-
import "../../esm-chunks/chunk-
|
|
11
|
-
import "../../esm-chunks/chunk-
|
|
9
|
+
} from "../../esm-chunks/chunk-XC7T747I.js";
|
|
10
|
+
import "../../esm-chunks/chunk-MFN4GH7U.js";
|
|
11
|
+
import "../../esm-chunks/chunk-IZY5TPZE.js";
|
|
12
|
+
import "../../esm-chunks/chunk-WELZ7LFO.js";
|
|
12
13
|
export {
|
|
13
14
|
createEdgeHandlers
|
|
14
15
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
createServerHandler
|
|
9
|
-
} from "../../esm-chunks/chunk-
|
|
10
|
-
import "../../esm-chunks/chunk-
|
|
11
|
-
import "../../esm-chunks/chunk-
|
|
12
|
-
import "../../esm-chunks/chunk-
|
|
13
|
-
import "../../esm-chunks/chunk-
|
|
9
|
+
} from "../../esm-chunks/chunk-X4Q4MYBW.js";
|
|
10
|
+
import "../../esm-chunks/chunk-6HBXWNZS.js";
|
|
11
|
+
import "../../esm-chunks/chunk-MFN4GH7U.js";
|
|
12
|
+
import "../../esm-chunks/chunk-IZY5TPZE.js";
|
|
13
|
+
import "../../esm-chunks/chunk-WELZ7LFO.js";
|
|
14
14
|
export {
|
|
15
15
|
createServerHandler
|
|
16
16
|
};
|
package/dist/build/image-cdn.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
setImageConfig
|
|
9
|
-
} from "../esm-chunks/chunk-
|
|
10
|
-
import "../esm-chunks/chunk-
|
|
9
|
+
} from "../esm-chunks/chunk-EPSI5TTB.js";
|
|
10
|
+
import "../esm-chunks/chunk-WELZ7LFO.js";
|
|
11
11
|
export {
|
|
12
12
|
setImageConfig
|
|
13
13
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
EDGE_HANDLER_NAME,
|
|
9
9
|
PluginContext,
|
|
10
10
|
SERVER_HANDLER_NAME
|
|
11
|
-
} from "../esm-chunks/chunk-
|
|
12
|
-
import "../esm-chunks/chunk-
|
|
11
|
+
} from "../esm-chunks/chunk-IZY5TPZE.js";
|
|
12
|
+
import "../esm-chunks/chunk-WELZ7LFO.js";
|
|
13
13
|
export {
|
|
14
14
|
EDGE_HANDLER_NAME,
|
|
15
15
|
PluginContext,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
require_out
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MFN4GH7U.js";
|
|
10
10
|
import {
|
|
11
11
|
__toESM
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WELZ7LFO.js";
|
|
13
13
|
|
|
14
14
|
// src/build/content/server.ts
|
|
15
15
|
var import_fast_glob = __toESM(require_out(), 1);
|
|
@@ -17,7 +17,7 @@ import { existsSync } from "node:fs";
|
|
|
17
17
|
import { cp, mkdir, readFile, readdir, readlink, symlink, writeFile } from "node:fs/promises";
|
|
18
18
|
import { dirname, join } from "node:path";
|
|
19
19
|
var copyNextServerCode = async (ctx) => {
|
|
20
|
-
const srcDir = join(ctx.
|
|
20
|
+
const srcDir = join(ctx.standaloneDir, ".next");
|
|
21
21
|
const destDir = join(ctx.serverHandlerDir, ".next");
|
|
22
22
|
const paths = await (0, import_fast_glob.default)(
|
|
23
23
|
[`*`, `server/*`, `server/chunks/*`, `server/edge-chunks/*`, `server/+(app|pages)/**/*.js`],
|
|
@@ -64,10 +64,28 @@ async function recreateNodeModuleSymlinks(src, dest, org) {
|
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
var copyNextDependencies = async (ctx) => {
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
const entries = await readdir(ctx.standaloneDir);
|
|
68
|
+
const promises = entries.map(async (entry) => {
|
|
69
|
+
if (entry === "package.json" || entry === ".next") {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const src = join(ctx.standaloneDir, entry);
|
|
73
|
+
const dest = join(ctx.serverHandlerDir, entry);
|
|
74
|
+
await cp(src, dest, { recursive: true });
|
|
75
|
+
if (entry === "node_modules") {
|
|
76
|
+
await recreateNodeModuleSymlinks(ctx.resolve("node_modules"), dest);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const rootSrcDir = join(ctx.standaloneRootDir, "node_modules");
|
|
80
|
+
const rootDestDir = join(ctx.serverHandlerRootDir, "node_modules");
|
|
81
|
+
if (existsSync(rootSrcDir) && ctx.standaloneRootDir !== ctx.standaloneDir) {
|
|
82
|
+
promises.push(
|
|
83
|
+
cp(rootSrcDir, rootDestDir, { recursive: true }).then(
|
|
84
|
+
() => recreateNodeModuleSymlinks(ctx.resolve("node_modules"), rootDestDir)
|
|
85
|
+
)
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
await Promise.all(promises);
|
|
71
89
|
};
|
|
72
90
|
var writeTagsManifest = async (ctx) => {
|
|
73
91
|
const manifest = await ctx.getPrerenderManifest();
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
require_out
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MFN4GH7U.js";
|
|
10
10
|
import {
|
|
11
11
|
__toESM
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WELZ7LFO.js";
|
|
13
13
|
|
|
14
14
|
// src/build/content/prerendered.ts
|
|
15
15
|
var import_fast_glob = __toESM(require_out(), 1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
@@ -28,6 +28,24 @@ var PluginContext = class {
|
|
|
28
28
|
get publishDir() {
|
|
29
29
|
return resolve(this.constants.PUBLISH_DIR);
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Relative package path in non monorepo setups this is an empty string
|
|
33
|
+
* @example ''
|
|
34
|
+
* @example 'apps/my-app'
|
|
35
|
+
*/
|
|
36
|
+
get packagePath() {
|
|
37
|
+
return this.constants.PACKAGE_PATH || "";
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Retrieves the root of the `.next/standalone` directory
|
|
41
|
+
*/
|
|
42
|
+
get standaloneRootDir() {
|
|
43
|
+
return join(this.publishDir, "standalone");
|
|
44
|
+
}
|
|
45
|
+
/** Retrieves the `.next/standalone/` directory monorepo aware */
|
|
46
|
+
get standaloneDir() {
|
|
47
|
+
return join(this.standaloneRootDir, this.constants.PACKAGE_PATH || "");
|
|
48
|
+
}
|
|
31
49
|
/**
|
|
32
50
|
* Absolute path of the directory that is published and deployed to the Netlify CDN
|
|
33
51
|
* Will be swapped with the publish directory
|
|
@@ -51,9 +69,15 @@ var PluginContext = class {
|
|
|
51
69
|
return this.resolve(".netlify/functions-internal");
|
|
52
70
|
}
|
|
53
71
|
/** Absolute path of the server handler */
|
|
54
|
-
get
|
|
72
|
+
get serverHandlerRootDir() {
|
|
55
73
|
return join(this.serverFunctionsDir, SERVER_HANDLER_NAME);
|
|
56
74
|
}
|
|
75
|
+
get serverHandlerDir() {
|
|
76
|
+
return join(this.serverHandlerRootDir, this.constants.PACKAGE_PATH || "");
|
|
77
|
+
}
|
|
78
|
+
get nextServerHandler() {
|
|
79
|
+
return join(this.constants.PACKAGE_PATH || "", "dist/run/handlers/server.js");
|
|
80
|
+
}
|
|
57
81
|
/**
|
|
58
82
|
* Absolute path of the directory containing the files for deno edge functions
|
|
59
83
|
* `.netlify/edge-functions`
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
require_out
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MFN4GH7U.js";
|
|
10
10
|
import {
|
|
11
11
|
__toESM
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WELZ7LFO.js";
|
|
13
13
|
|
|
14
14
|
// src/build/content/static.ts
|
|
15
15
|
var import_fast_glob = __toESM(require_out(), 1);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
__commonJS,
|
|
9
9
|
__require
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WELZ7LFO.js";
|
|
11
11
|
|
|
12
12
|
// node_modules/fast-glob/out/utils/array.js
|
|
13
13
|
var require_array = __commonJS({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
__commonJS,
|
|
9
9
|
__require,
|
|
10
10
|
__toESM
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WELZ7LFO.js";
|
|
12
12
|
|
|
13
13
|
// node_modules/is-promise/index.js
|
|
14
14
|
var require_is_promise = __commonJS({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
@@ -8,16 +8,16 @@ import {
|
|
|
8
8
|
copyNextDependencies,
|
|
9
9
|
copyNextServerCode,
|
|
10
10
|
writeTagsManifest
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6HBXWNZS.js";
|
|
12
12
|
import {
|
|
13
13
|
require_out
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MFN4GH7U.js";
|
|
15
15
|
import {
|
|
16
16
|
SERVER_HANDLER_NAME
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-IZY5TPZE.js";
|
|
18
18
|
import {
|
|
19
19
|
__toESM
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-WELZ7LFO.js";
|
|
21
21
|
|
|
22
22
|
// src/build/functions/server.ts
|
|
23
23
|
var import_fast_glob = __toESM(require_out(), 1);
|
|
@@ -33,21 +33,15 @@ var copyHandlerDependencies = async (ctx) => {
|
|
|
33
33
|
};
|
|
34
34
|
var writeHandlerManifest = async (ctx) => {
|
|
35
35
|
await writeFile(
|
|
36
|
-
join(ctx.
|
|
36
|
+
join(ctx.serverHandlerRootDir, `${SERVER_HANDLER_NAME}.json`),
|
|
37
37
|
JSON.stringify({
|
|
38
38
|
config: {
|
|
39
39
|
name: "Next.js Server Handler",
|
|
40
40
|
generator: `${ctx.pluginName}@${ctx.pluginVersion}`,
|
|
41
41
|
nodeBundler: "none",
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"dist/**",
|
|
46
|
-
".next/**",
|
|
47
|
-
".netlify/**",
|
|
48
|
-
"node_modules/**"
|
|
49
|
-
],
|
|
50
|
-
includedFilesBasePath: ctx.serverHandlerDir
|
|
42
|
+
// the folders can vary in monorepos based on the folder structure of the user so we have to glob all
|
|
43
|
+
includedFiles: ["**"],
|
|
44
|
+
includedFilesBasePath: ctx.serverHandlerRootDir
|
|
51
45
|
},
|
|
52
46
|
version: 1
|
|
53
47
|
}),
|
|
@@ -55,21 +49,38 @@ var writeHandlerManifest = async (ctx) => {
|
|
|
55
49
|
);
|
|
56
50
|
};
|
|
57
51
|
var writePackageMetadata = async (ctx) => {
|
|
58
|
-
await writeFile(join(ctx.serverHandlerDir, "package.json"), JSON.stringify({ type: "module" }));
|
|
59
|
-
};
|
|
60
|
-
var writeHandlerFile = async (ctx) => {
|
|
61
52
|
await writeFile(
|
|
62
|
-
join(ctx.
|
|
63
|
-
|
|
64
|
-
import handler from './dist/run/handlers/server.js';
|
|
65
|
-
export default handler;
|
|
66
|
-
export const config = {
|
|
67
|
-
path: '/*',
|
|
68
|
-
preferStatic: true
|
|
69
|
-
};
|
|
70
|
-
`
|
|
53
|
+
join(ctx.serverHandlerRootDir, "package.json"),
|
|
54
|
+
JSON.stringify({ type: "module" })
|
|
71
55
|
);
|
|
72
56
|
};
|
|
57
|
+
var getHandlerFile = (ctx) => {
|
|
58
|
+
const config = `
|
|
59
|
+
export const config = {
|
|
60
|
+
path: '/*',
|
|
61
|
+
preferStatic: true,
|
|
62
|
+
}`;
|
|
63
|
+
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}`;
|
|
76
|
+
}
|
|
77
|
+
return `import handler from './dist/run/handlers/server.js';
|
|
78
|
+
export default handler;
|
|
79
|
+
${config}`;
|
|
80
|
+
};
|
|
81
|
+
var writeHandlerFile = async (ctx) => {
|
|
82
|
+
await writeFile(join(ctx.serverHandlerRootDir, `${SERVER_HANDLER_NAME}.mjs`), getHandlerFile(ctx));
|
|
83
|
+
};
|
|
73
84
|
var createServerHandler = async (ctx) => {
|
|
74
85
|
await rm(ctx.serverFunctionsDir, { recursive: true, force: true });
|
|
75
86
|
await mkdir(join(ctx.serverHandlerDir, ".netlify"), { recursive: true });
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
|
+
return createRequire(import.meta.url);
|
|
5
|
+
})();
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
__commonJS,
|
|
9
|
+
__require,
|
|
10
|
+
__toESM
|
|
11
|
+
} from "./chunk-WELZ7LFO.js";
|
|
12
|
+
|
|
13
|
+
// node_modules/@netlify/functions/dist/lib/system_logger.js
|
|
14
|
+
var require_system_logger = __commonJS({
|
|
15
|
+
"node_modules/@netlify/functions/dist/lib/system_logger.js"(exports) {
|
|
16
|
+
"use strict";
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.systemLogger = exports.LogLevel = void 0;
|
|
19
|
+
var process_1 = __require("process");
|
|
20
|
+
var systemLogTag = "__nfSystemLog";
|
|
21
|
+
var serializeError = (error) => {
|
|
22
|
+
const cause = error?.cause instanceof Error ? serializeError(error.cause) : error.cause;
|
|
23
|
+
return {
|
|
24
|
+
error: error.message,
|
|
25
|
+
error_cause: cause,
|
|
26
|
+
error_stack: error.stack
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
var LogLevel2;
|
|
30
|
+
(function(LogLevel3) {
|
|
31
|
+
LogLevel3[LogLevel3["Debug"] = 1] = "Debug";
|
|
32
|
+
LogLevel3[LogLevel3["Log"] = 2] = "Log";
|
|
33
|
+
LogLevel3[LogLevel3["Error"] = 3] = "Error";
|
|
34
|
+
})(LogLevel2 = exports.LogLevel || (exports.LogLevel = {}));
|
|
35
|
+
var SystemLogger = class _SystemLogger {
|
|
36
|
+
fields;
|
|
37
|
+
logLevel;
|
|
38
|
+
constructor(fields = {}, logLevel = LogLevel2.Log) {
|
|
39
|
+
this.fields = fields;
|
|
40
|
+
this.logLevel = logLevel;
|
|
41
|
+
}
|
|
42
|
+
doLog(logger, message) {
|
|
43
|
+
if (process_1.env.NETLIFY_DEV && !process_1.env.NETLIFY_ENABLE_SYSTEM_LOGGING) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
logger(systemLogTag, JSON.stringify({ msg: message, fields: this.fields }));
|
|
47
|
+
}
|
|
48
|
+
log(message) {
|
|
49
|
+
if (this.logLevel > LogLevel2.Log) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
this.doLog(console.log, message);
|
|
53
|
+
}
|
|
54
|
+
debug(message) {
|
|
55
|
+
if (this.logLevel > LogLevel2.Debug) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
this.doLog(console.debug, message);
|
|
59
|
+
}
|
|
60
|
+
error(message) {
|
|
61
|
+
if (this.logLevel > LogLevel2.Error) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this.doLog(console.error, message);
|
|
65
|
+
}
|
|
66
|
+
withLogLevel(level) {
|
|
67
|
+
return new _SystemLogger(this.fields, level);
|
|
68
|
+
}
|
|
69
|
+
withFields(fields) {
|
|
70
|
+
return new _SystemLogger({
|
|
71
|
+
...this.fields,
|
|
72
|
+
...fields
|
|
73
|
+
}, this.logLevel);
|
|
74
|
+
}
|
|
75
|
+
withError(error) {
|
|
76
|
+
const fields = error instanceof Error ? serializeError(error) : { error };
|
|
77
|
+
return this.withFields(fields);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
exports.systemLogger = new SystemLogger();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// node_modules/@netlify/functions/dist/internal.js
|
|
85
|
+
var require_internal = __commonJS({
|
|
86
|
+
"node_modules/@netlify/functions/dist/internal.js"(exports) {
|
|
87
|
+
"use strict";
|
|
88
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89
|
+
exports.LogLevel = exports.systemLogger = void 0;
|
|
90
|
+
var system_logger_js_1 = require_system_logger();
|
|
91
|
+
Object.defineProperty(exports, "systemLogger", { enumerable: true, get: function() {
|
|
92
|
+
return system_logger_js_1.systemLogger;
|
|
93
|
+
} });
|
|
94
|
+
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function() {
|
|
95
|
+
return system_logger_js_1.LogLevel;
|
|
96
|
+
} });
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// src/run/systemlog.ts
|
|
101
|
+
var import_internal = __toESM(require_internal(), 1);
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
import_internal
|
|
105
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var require = await (async () => {
|
|
3
|
+
var { createRequire } = await import("node:module");
|
|
4
4
|
return createRequire(import.meta.url);
|
|
5
5
|
})();
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
// src/build/cache.ts
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
9
10
|
import { join } from "node:path";
|
|
10
11
|
var saveBuildCache = async (ctx) => {
|
|
11
12
|
if (await ctx.utils.cache.save(join(ctx.publishDir, "cache"))) {
|
|
@@ -15,7 +16,10 @@ var saveBuildCache = async (ctx) => {
|
|
|
15
16
|
}
|
|
16
17
|
};
|
|
17
18
|
var restoreBuildCache = async (ctx) => {
|
|
18
|
-
|
|
19
|
+
const { cache } = ctx.utils;
|
|
20
|
+
if (existsSync(join(ctx.publishDir, "cache"))) {
|
|
21
|
+
console.log("Next.js cache found.");
|
|
22
|
+
} else if (await cache.restore(join(ctx.publishDir, "cache"))) {
|
|
19
23
|
console.log("Next.js cache restored.");
|
|
20
24
|
} else {
|
|
21
25
|
console.log("No Next.js cache to restore.");
|