Make compatible with node >=22 (#2273)

Breaking change: uplifts the minimum version of node required to v20
This commit is contained in:
GCHQDeveloper581 2026-04-28 07:18:44 +01:00 committed by GitHub
parent e0ba5d2812
commit 864afa85aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 21 additions and 18 deletions

View File

@ -3,7 +3,7 @@
{ {
"name": "CyberChef", "name": "CyberChef",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-18-bookworm", "image": "mcr.microsoft.com/devcontainers/javascript-node:22-trixie",
// Features to add to the dev container. More info: https://containers.dev/features. // Features to add to the dev container. More info: https://containers.dev/features.
"features": { "features": {

View File

@ -21,7 +21,7 @@ jobs:
- name: Set node version - name: Set node version
uses: actions/setup-node@v6 uses: actions/setup-node@v6
with: with:
node-version: 18 node-version: '20.x'
registry-url: "https://registry.npmjs.org" registry-url: "https://registry.npmjs.org"
- name: Install - name: Install

View File

@ -17,7 +17,7 @@ jobs:
- name: Set node version - name: Set node version
uses: actions/setup-node@v6 uses: actions/setup-node@v6
with: with:
node-version: 18 node-version: '20.x'
registry-url: "https://registry.npmjs.org" registry-url: "https://registry.npmjs.org"
- name: Install - name: Install

View File

@ -27,7 +27,7 @@ jobs:
- name: Set node version - name: Set node version
uses: actions/setup-node@v6 uses: actions/setup-node@v6
with: with:
node-version: 18 node-version: '20.x'
registry-url: "https://registry.npmjs.org" registry-url: "https://registry.npmjs.org"
- name: Install - name: Install

2
.nvmrc
View File

@ -1 +1 @@
18 22

View File

@ -4,7 +4,7 @@
# Modifier --platform=$BUILDPLATFORM limits the platform to "BUILDPLATFORM" during buildx multi-platform builds # Modifier --platform=$BUILDPLATFORM limits the platform to "BUILDPLATFORM" during buildx multi-platform builds
# This is because npm "chromedriver" package is not compatiable with all platforms # This is because npm "chromedriver" package is not compatiable with all platforms
# For more info see: https://docs.docker.com/build/building/multi-platform/#cross-compilation # For more info see: https://docs.docker.com/build/building/multi-platform/#cross-compilation
FROM --platform=$BUILDPLATFORM node:18-alpine AS builder FROM --platform=$BUILDPLATFORM node:22-alpine AS builder
WORKDIR /app WORKDIR /app

View File

@ -120,7 +120,7 @@ CyberChef is built to support
## Node.js support ## Node.js support
CyberChef is built to fully support Node.js `v16`. For more information, see the ["Node API" wiki page](https://github.com/gchq/CyberChef/wiki/Node-API) CyberChef is built to fully support Node.js `v22`. For more information, see the ["Node API" wiki page](https://github.com/gchq/CyberChef/wiki/Node-API)
## Contributing ## Contributing

View File

@ -16,6 +16,9 @@ module.exports = function(api) {
"regenerator": true "regenerator": true
} }
] ]
] ],
"generatorOpts": {
"importAttributesKeyword": "with"
}
}; };
}; };

View File

@ -36,7 +36,7 @@
"browserslist": [ "browserslist": [
"Chrome >= 50", "Chrome >= 50",
"Firefox >= 38", "Firefox >= 38",
"node >= 16" "node >= 22"
], ],
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "^7.28.6", "@babel/eslint-parser": "^7.28.6",

View File

@ -7,7 +7,7 @@
*/ */
import Chef from "./Chef.mjs"; import Chef from "./Chef.mjs";
import OperationConfig from "./config/OperationConfig.json" assert {type: "json"}; import OperationConfig from "./config/OperationConfig.json" with { type: "json" };
import OpModules from "./config/modules/OpModules.mjs"; import OpModules from "./config/modules/OpModules.mjs";
import loglevelMessagePrefix from "loglevel-message-prefix"; import loglevelMessagePrefix from "loglevel-message-prefix";

View File

@ -4,7 +4,7 @@
* @license Apache-2.0 * @license Apache-2.0
*/ */
import OperationConfig from "./config/OperationConfig.json" assert {type: "json"}; import OperationConfig from "./config/OperationConfig.json" with { type: "json" };
import OperationError from "./errors/OperationError.mjs"; import OperationError from "./errors/OperationError.mjs";
import Operation from "./Operation.mjs"; import Operation from "./Operation.mjs";
import DishError from "./errors/DishError.mjs"; import DishError from "./errors/DishError.mjs";

View File

@ -1,4 +1,4 @@
import OperationConfig from "../config/OperationConfig.json" assert {type: "json"}; import OperationConfig from "../config/OperationConfig.json" with { type: "json" };
import Utils, { isWorkerEnvironment } from "../Utils.mjs"; import Utils, { isWorkerEnvironment } from "../Utils.mjs";
import Recipe from "../Recipe.mjs"; import Recipe from "../Recipe.mjs";
import Dish from "../Dish.mjs"; import Dish from "../Dish.mjs";

View File

@ -10,7 +10,7 @@
import NodeDish from "./NodeDish.mjs"; import NodeDish from "./NodeDish.mjs";
import NodeRecipe from "./NodeRecipe.mjs"; import NodeRecipe from "./NodeRecipe.mjs";
import OperationConfig from "../core/config/OperationConfig.json" assert {type: "json"}; import OperationConfig from "../core/config/OperationConfig.json" with { type: "json" };
import { sanitise, removeSubheadingsFromArray, sentenceToCamelCase } from "./apiUtils.mjs"; import { sanitise, removeSubheadingsFromArray, sentenceToCamelCase } from "./apiUtils.mjs";
import ExcludedOperationError from "../core/errors/ExcludedOperationError.mjs"; import ExcludedOperationError from "../core/errors/ExcludedOperationError.mjs";

View File

@ -17,8 +17,8 @@ import * as CanvasComponents from "../core/lib/CanvasComponents.mjs";
// CyberChef // CyberChef
import App from "./App.mjs"; import App from "./App.mjs";
import Categories from "../core/config/Categories.json" assert {type: "json"}; import Categories from "../core/config/Categories.json" with { type: "json" };
import OperationConfig from "../core/config/OperationConfig.json" assert {type: "json"}; import OperationConfig from "../core/config/OperationConfig.json" with { type: "json" };
/** /**

View File

@ -1,5 +1,5 @@
import sm from "sitemap"; import sm from "sitemap";
import OperationConfig from "../../core/config/OperationConfig.json" assert { type: "json" }; import OperationConfig from "../../core/config/OperationConfig.json" with { type: "json" };
/** /**
* Generates an XML sitemap for all CyberChef operations and a number of recipes. * Generates an XML sitemap for all CyberChef operations and a number of recipes.

View File

@ -1,6 +1,6 @@
import TestRegister from "../../lib/TestRegister.mjs"; import TestRegister from "../../lib/TestRegister.mjs";
import Categories from "../../../src/core/config/Categories.json" assert {type: "json"}; import Categories from "../../../src/core/config/Categories.json" with { type: "json" };
import OperationConfig from "../../../src/core/config/OperationConfig.json" assert {type: "json"}; import OperationConfig from "../../../src/core/config/OperationConfig.json" with { type: "json" };
import it from "../assertionHandler.mjs"; import it from "../assertionHandler.mjs";
import assert from "assert"; import assert from "assert";