@opennextjs/aws 3.9.11 → 3.9.13
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/build/helper.d.ts +25 -1
- package/dist/build/helper.js +78 -7
- package/dist/build.d.ts +1 -1
- package/dist/build.js +3 -1
- package/dist/index.js +10 -10
- package/package.json +2 -2
package/dist/build/helper.d.ts
CHANGED
|
@@ -72,12 +72,36 @@ export type SemverOp = "=" | ">=" | "<=" | ">" | "<";
|
|
|
72
72
|
* compareSemver("2.0.0", ">=", "1.0.0") === true
|
|
73
73
|
*/
|
|
74
74
|
export declare function compareSemver(v1: string, operator: SemverOp, v2: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Check if a Next.js version is supported by the Next.js team.
|
|
77
|
+
* Major versions are supported for 2 years following their initial release.
|
|
78
|
+
*
|
|
79
|
+
* @param version - The Next.js version to check (semver format)
|
|
80
|
+
* @returns true if the version is currently supported, false otherwise
|
|
81
|
+
*/
|
|
82
|
+
export declare function isNextVersionSupported(version: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Check if the Next.js version is supported and handle errors/warnings.
|
|
85
|
+
*
|
|
86
|
+
* Note: Exits the process with code 1 if the version is not supported.
|
|
87
|
+
*
|
|
88
|
+
* @param options - Build options containing Next.js version
|
|
89
|
+
* @param allowUnsupportedNextVersion - Whether to allow using an unmaintained Next.js version
|
|
90
|
+
*/
|
|
91
|
+
export declare function checkNextVersionSupport(nextVersion: string, allowUnsupportedNextVersion: boolean, flagName?: string): void;
|
|
75
92
|
export declare function copyOpenNextConfig(inputDir: string, outputDir: string, isEdge?: boolean): void;
|
|
76
93
|
export declare function copyEnvFile(appPath: string, packagePath: string, outputPath: string): void;
|
|
94
|
+
/**
|
|
95
|
+
* Finds the path to the Next configuration file if it exists.
|
|
96
|
+
*
|
|
97
|
+
* @param appPath The directory to check for the Next config file
|
|
98
|
+
* @returns The full path to Next config file if it exists, undefined otherwise
|
|
99
|
+
*/
|
|
100
|
+
export declare function findNextConfig({ appPath, }: Pick<BuildOptions, "appPath">): string | undefined;
|
|
77
101
|
/**
|
|
78
102
|
* Check we are in a Nextjs app by looking for the Nextjs config file.
|
|
79
103
|
*/
|
|
80
|
-
export declare function checkRunningInsideNextjsApp(
|
|
104
|
+
export declare function checkRunningInsideNextjsApp({ appPath, }: Pick<BuildOptions, "appPath">): void;
|
|
81
105
|
export declare function printNextjsVersion(options: BuildOptions): void;
|
|
82
106
|
export declare function printOpenNextVersion(options: BuildOptions): void;
|
|
83
107
|
/**
|
package/dist/build/helper.js
CHANGED
|
@@ -269,6 +269,69 @@ export function compareSemver(v1, operator, v2) {
|
|
|
269
269
|
throw new Error(`Unsupported operator: ${operator}`);
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
+
/**
|
|
273
|
+
* Next.js major version release dates (YYYY-MM-DD).
|
|
274
|
+
* Each major version is supported for 2 years from its release date.
|
|
275
|
+
*
|
|
276
|
+
* Source: https://nextjs.org/support-policy#supported-versions
|
|
277
|
+
*
|
|
278
|
+
* TODO: Update this list when new Next.js major versions are released.
|
|
279
|
+
* Check https://github.com/vercel/next.js/releases for release dates.
|
|
280
|
+
*/
|
|
281
|
+
const NEXT_RELEASE_DATES = {
|
|
282
|
+
16: "2025-10-21",
|
|
283
|
+
15: "2024-10-21",
|
|
284
|
+
14: "2023-10-26",
|
|
285
|
+
13: "2022-10-26",
|
|
286
|
+
12: "2021-10-26",
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* Check if a Next.js version is supported by the Next.js team.
|
|
290
|
+
* Major versions are supported for 2 years following their initial release.
|
|
291
|
+
*
|
|
292
|
+
* @param version - The Next.js version to check (semver format)
|
|
293
|
+
* @returns true if the version is currently supported, false otherwise
|
|
294
|
+
*/
|
|
295
|
+
export function isNextVersionSupported(version) {
|
|
296
|
+
const match = version.match(/^\d+/);
|
|
297
|
+
if (!match) {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
const releaseDateStr = NEXT_RELEASE_DATES[Number(match[0])];
|
|
301
|
+
if (!releaseDateStr) {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
const releaseDate = new Date(releaseDateStr);
|
|
305
|
+
const supportEndDate = new Date(releaseDate);
|
|
306
|
+
supportEndDate.setFullYear(supportEndDate.getFullYear() + 2);
|
|
307
|
+
const now = new Date();
|
|
308
|
+
return now <= supportEndDate;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Check if the Next.js version is supported and handle errors/warnings.
|
|
312
|
+
*
|
|
313
|
+
* Note: Exits the process with code 1 if the version is not supported.
|
|
314
|
+
*
|
|
315
|
+
* @param options - Build options containing Next.js version
|
|
316
|
+
* @param allowUnsupportedNextVersion - Whether to allow using an unmaintained Next.js version
|
|
317
|
+
*/
|
|
318
|
+
export function checkNextVersionSupport(nextVersion, allowUnsupportedNextVersion, flagName = "--dangerously-use-unsupported-next-version") {
|
|
319
|
+
const isSupported = isNextVersionSupported(nextVersion);
|
|
320
|
+
if (!isSupported) {
|
|
321
|
+
const message = `Next.js version ${nextVersion} is not supported by the Next.js team.
|
|
322
|
+
Major versions are supported for 2 years from their release date.
|
|
323
|
+
Unsupported releases may contain unpatched security vulnerabilities.
|
|
324
|
+
See https://nextjs.org/support-policy for more information.`;
|
|
325
|
+
if (allowUnsupportedNextVersion) {
|
|
326
|
+
logger.warn(`${message}
|
|
327
|
+
Continuing build due to ${flagName} flag.`);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
logger.error(`${message}
|
|
331
|
+
If you want to proceed anyway, use the ${flagName} flag.`);
|
|
332
|
+
process.exit(1);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
272
335
|
export function copyOpenNextConfig(inputDir, outputDir, isEdge = false) {
|
|
273
336
|
// Copy open-next.config.mjs
|
|
274
337
|
fs.copyFileSync(path.join(inputDir, isEdge ? "open-next.config.edge.mjs" : "open-next.config.mjs"), path.join(outputDir, "open-next.config.mjs"));
|
|
@@ -285,13 +348,20 @@ export function copyEnvFile(appPath, packagePath, outputPath) {
|
|
|
285
348
|
fs.copyFileSync(envProdPath, path.join(baseOutputPath, ".env.production"));
|
|
286
349
|
}
|
|
287
350
|
}
|
|
351
|
+
/**
|
|
352
|
+
* Finds the path to the Next configuration file if it exists.
|
|
353
|
+
*
|
|
354
|
+
* @param appPath The directory to check for the Next config file
|
|
355
|
+
* @returns The full path to Next config file if it exists, undefined otherwise
|
|
356
|
+
*/
|
|
357
|
+
export function findNextConfig({ appPath, }) {
|
|
358
|
+
return ["js", "cjs", "mjs", "ts"].find((ext) => fs.existsSync(path.join(appPath, `next.config.${ext}`)));
|
|
359
|
+
}
|
|
288
360
|
/**
|
|
289
361
|
* Check we are in a Nextjs app by looking for the Nextjs config file.
|
|
290
362
|
*/
|
|
291
|
-
export function checkRunningInsideNextjsApp(
|
|
292
|
-
|
|
293
|
-
const extension = ["js", "cjs", "mjs", "ts"].find((ext) => fs.existsSync(path.join(appPath, `next.config.${ext}`)));
|
|
294
|
-
if (!extension) {
|
|
363
|
+
export function checkRunningInsideNextjsApp({ appPath, }) {
|
|
364
|
+
if (!findNextConfig({ appPath })) {
|
|
295
365
|
logger.error("Error: next.config.js not found. Please make sure you are running this command inside a Next.js app.");
|
|
296
366
|
process.exit(1);
|
|
297
367
|
}
|
|
@@ -340,11 +410,12 @@ export function getPackagePath(options) {
|
|
|
340
410
|
* @returns the Next.js runtime used: "webpack" or "turbopack"
|
|
341
411
|
*/
|
|
342
412
|
export function getBundlerRuntime(options) {
|
|
343
|
-
const
|
|
344
|
-
if (fs.existsSync(path.join(
|
|
413
|
+
const dotNextServerPath = path.join(options.appPath, ".next/server");
|
|
414
|
+
if (fs.existsSync(path.join(dotNextServerPath, "webpack-runtime.js"))) {
|
|
345
415
|
return "webpack";
|
|
346
416
|
}
|
|
347
|
-
if (fs.existsSync(path.join(
|
|
417
|
+
if (fs.existsSync(path.join(dotNextServerPath, "chunks/[turbopack]_runtime.js")) ||
|
|
418
|
+
fs.existsSync(path.join(dotNextServerPath, "chunks/ssr/[turbopack]_runtime.js"))) {
|
|
348
419
|
return "turbopack";
|
|
349
420
|
}
|
|
350
421
|
throw new Error("Unable to determine Next.js runtime (webpack or turbopack)");
|
package/dist/build.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type PublicFiles = {
|
|
2
2
|
files: string[];
|
|
3
3
|
};
|
|
4
|
-
export declare function build(openNextConfigPath?: string, nodeExternals?: string): Promise<void>;
|
|
4
|
+
export declare function build(openNextConfigPath?: string, nodeExternals?: string, allowUnsupportedNextVersion?: boolean): Promise<void>;
|
package/dist/build.js
CHANGED
|
@@ -15,7 +15,7 @@ import * as buildHelper from "./build/helper.js";
|
|
|
15
15
|
import { patchOriginalNextConfig } from "./build/patch/patches/index.js";
|
|
16
16
|
import { printHeader, showWarningOnWindows } from "./build/utils.js";
|
|
17
17
|
import logger from "./logger.js";
|
|
18
|
-
export async function build(openNextConfigPath, nodeExternals) {
|
|
18
|
+
export async function build(openNextConfigPath, nodeExternals, allowUnsupportedNextVersion) {
|
|
19
19
|
showWarningOnWindows();
|
|
20
20
|
const baseDir = process.cwd();
|
|
21
21
|
const openNextDistDir = url.fileURLToPath(new URL(".", import.meta.url));
|
|
@@ -27,6 +27,8 @@ export async function build(openNextConfigPath, nodeExternals) {
|
|
|
27
27
|
buildHelper.checkRunningInsideNextjsApp(options);
|
|
28
28
|
buildHelper.printNextjsVersion(options);
|
|
29
29
|
buildHelper.printOpenNextVersion(options);
|
|
30
|
+
// Check Next.js version support
|
|
31
|
+
buildHelper.checkNextVersionSupport(options.nextVersion, allowUnsupportedNextVersion ?? false);
|
|
30
32
|
// Build Next.js app
|
|
31
33
|
printHeader("Building Next.js app");
|
|
32
34
|
setStandaloneBuildMode(options);
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ if (command !== "build")
|
|
|
6
6
|
const args = parseArgs();
|
|
7
7
|
if (Object.keys(args).includes("--help"))
|
|
8
8
|
printHelp();
|
|
9
|
-
await build(args["--config-path"], args["--node-externals"]);
|
|
9
|
+
await build(args["--config-path"], args["--node-externals"], args["--dangerously-use-unsupported-next-version"] !== undefined);
|
|
10
10
|
function parseArgs() {
|
|
11
11
|
return process.argv.slice(2).reduce((acc, key, ind, self) => {
|
|
12
12
|
if (key.startsWith("--")) {
|
|
@@ -25,14 +25,14 @@ function parseArgs() {
|
|
|
25
25
|
}, {});
|
|
26
26
|
}
|
|
27
27
|
function printHelp() {
|
|
28
|
-
console.log(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
console.log(`Unknown command
|
|
29
|
+
|
|
30
|
+
Usage:
|
|
31
|
+
npx open-next build
|
|
32
|
+
You can use a custom config path here
|
|
33
|
+
npx open-next build --config-path ./path/to/open-next.config.ts
|
|
34
|
+
You can configure externals for the esbuild compilation of the open-next.config.ts file
|
|
35
|
+
npx open-next build --node-externals aws-sdk,sharp,sqlite3
|
|
36
|
+
`);
|
|
37
37
|
process.exit(1);
|
|
38
38
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"access": "public"
|
|
4
4
|
},
|
|
5
5
|
"name": "@opennextjs/aws",
|
|
6
|
-
"version": "3.9.
|
|
6
|
+
"version": "3.9.13",
|
|
7
7
|
"bin": {
|
|
8
8
|
"open-next": "./dist/index.js"
|
|
9
9
|
},
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"typescript": "5.9.3"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"next": "
|
|
63
|
+
"next": "~15.0.8 || ~15.1.12 || ~15.2.9 || ~15.3.9 || ~15.4.11 || ~15.5.10 || ~16.0.11 || ^16.1.5"
|
|
64
64
|
},
|
|
65
65
|
"bugs": {
|
|
66
66
|
"url": "https://github.com/opennextjs/opennextjs-aws/issues"
|