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

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

View file

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

View file

@ -6,24 +6,27 @@
* @license Apache-2.0
*/
const chef = require("cyberchef");
const assert = require("assert");
const d = chef.bake("Testing, 1 2 3", [
chef.toHex,
chef.reverse,
{
op: chef.unique,
args: {
delimiter: "Space",
}
},
{
op: chef.multiply,
args: {
delimiter: "Space",
}
}
]);
require("cyberchef").then(chef => {
assert.equal(d.value, "630957449041920");
const d = chef.bake("Testing, 1 2 3", [
chef.toHex,
chef.reverse,
{
op: chef.unique,
args: {
delimiter: "Space",
}
},
{
op: chef.multiply,
args: {
delimiter: "Space",
}
}
]);
assert.equal(d.value, "630957449041920");
});

View file

@ -6,7 +6,7 @@
* @license Apache-2.0
*/
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", [
toHex,