Fixed Node imports

This commit is contained in:
n1474335 2022-03-25 18:28:01 +00:00
parent 4ef65589e8
commit 9e3733b33b
6 changed files with 1393 additions and 826 deletions

2
.nvmrc
View file

@ -1 +1 @@
17.* 17

2157
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -29,11 +29,17 @@
}, },
"main": "src/node/cjs.js", "main": "src/node/cjs.js",
"module": "src/node/index.mjs", "module": "src/node/index.mjs",
"exports": {
".": {
"require": "./src/node/cjs.js",
"import": "./src/node/index.mjs"
}
},
"bugs": "https://github.com/gchq/CyberChef/issues", "bugs": "https://github.com/gchq/CyberChef/issues",
"browserslist": [ "browserslist": [
"Chrome >= 50", "Chrome >= 50",
"Firefox >= 38", "Firefox >= 38",
"node >= 10" "node >= 16"
], ],
"devDependencies": { "devDependencies": {
"@babel/core": "^7.17.8", "@babel/core": "^7.17.8",
@ -69,7 +75,6 @@
"imports-loader": "^3.0.0", "imports-loader": "^3.0.0",
"mini-css-extract-plugin": "1.3.7", "mini-css-extract-plugin": "1.3.7",
"nightwatch": "^1.7.8", "nightwatch": "^1.7.8",
"node-sass": "^6.0.0",
"postcss": "^8.3.6", "postcss": "^8.3.6",
"postcss-css-variables": "^0.18.0", "postcss-css-variables": "^0.18.0",
"postcss-import": "^14.0.2", "postcss-import": "^14.0.2",
@ -112,7 +117,6 @@
"diff": "^5.0.0", "diff": "^5.0.0",
"es6-promisify": "^7.0.0", "es6-promisify": "^7.0.0",
"escodegen": "^2.0.0", "escodegen": "^2.0.0",
"esm": "^3.2.25",
"esprima": "^4.0.1", "esprima": "^4.0.1",
"exif-parser": "^0.1.12", "exif-parser": "^0.1.12",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
@ -140,6 +144,7 @@
"ngeohash": "^0.6.3", "ngeohash": "^0.6.3",
"node-forge": "^0.10.0", "node-forge": "^0.10.0",
"node-md6": "^0.1.0", "node-md6": "^0.1.0",
"node-sass": "^7.0.1",
"nodom": "^2.4.0", "nodom": "^2.4.0",
"notepack.io": "^2.3.0", "notepack.io": "^2.3.0",
"nwmatcher": "^1.4.4", "nwmatcher": "^1.4.4",

View file

@ -7,7 +7,5 @@
* @license Apache-2.0 * @license Apache-2.0
*/ */
/* eslint no-global-assign: ["off"] */ module.exports = (async () => await import("./index.mjs"))();
require = require("esm")(module); module.exports.File = (async () => await import("./File.mjs"))();
module.exports = require("./index.mjs");
module.exports.File = require("./File.mjs");

View file

@ -6,9 +6,10 @@
* @license Apache-2.0 * @license Apache-2.0
*/ */
const chef = require("cyberchef");
const assert = require("assert"); const assert = require("assert");
require("cyberchef").then(chef => {
const d = chef.bake("Testing, 1 2 3", [ const d = chef.bake("Testing, 1 2 3", [
chef.toHex, chef.toHex,
chef.reverse, chef.reverse,
@ -27,3 +28,5 @@ const d = chef.bake("Testing, 1 2 3", [
]); ]);
assert.equal(d.value, "630957449041920"); assert.equal(d.value, "630957449041920");
});

View file

@ -6,7 +6,7 @@
* @license Apache-2.0 * @license Apache-2.0
*/ */
import assert from "assert"; import assert from "assert";
import { bake, toHex, reverse, unique, multiply } from "cyberchef/src/node/index.mjs"; import { bake, toHex, reverse, unique, multiply } from "cyberchef";
const d = bake("Testing, 1 2 3", [ const d = bake("Testing, 1 2 3", [
toHex, toHex,