mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-09 15:55:01 -04:00
undeclarye module type, remove deep import test. add file extensions to some imports
This commit is contained in:
parent
ce7427b288
commit
16db8b0b72
7 changed files with 11 additions and 47 deletions
13
Gruntfile.js
13
Gruntfile.js
|
@ -48,7 +48,7 @@ module.exports = function (grunt) {
|
|||
|
||||
grunt.registerTask("testnodeconsumer",
|
||||
"A task which checks whether consuming CJS and ESM apps work with the CyberChef build",
|
||||
["exec:setupNodeConsumers", "exec:testCJSNodeConsumer", "exec:testESMNodeConsumer", "exec:testESMDeepImportNodeConsumer", "exec:teardownNodeConsumers"]);
|
||||
["exec:setupNodeConsumers", "exec:testCJSNodeConsumer", "exec:testESMNodeConsumer", "exec:teardownNodeConsumers"]);
|
||||
|
||||
grunt.registerTask("default",
|
||||
"Lints the code base",
|
||||
|
@ -413,17 +413,10 @@ module.exports = function (grunt) {
|
|||
testESMNodeConsumer: {
|
||||
command: chainCommands([
|
||||
`cd ${nodeConsumerTestPath}`,
|
||||
"node --no-warnings --experimental-modules esm-consumer.mjs",
|
||||
"node --no-warnings --experimental-modules --experimental-json-modules --experimental-specifier-resolution=node esm-consumer.mjs",
|
||||
]),
|
||||
stdout: false,
|
||||
},
|
||||
testESMDeepImportNodeConsumer: {
|
||||
command: chainCommands([
|
||||
`cd ${nodeConsumerTestPath}`,
|
||||
"node --no-warnings --experimental-modules esm-deep-import-consumer.mjs",
|
||||
]),
|
||||
stdout: false,
|
||||
},
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"name": "cyberchef",
|
||||
"type": "module",
|
||||
"version": "9.20.3",
|
||||
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
|
||||
"author": "n1474335 <n1474335@gmail.com>",
|
||||
|
@ -163,7 +162,7 @@
|
|||
"scripts": {
|
||||
"start": "grunt dev",
|
||||
"build": "grunt prod",
|
||||
"repl": "node src/node/repl.js",
|
||||
"repl": "node --experimental-modules --experimental-json-modules --experimental-specifier-resolution=node --no-warnings ./src/node/repl.mjs",
|
||||
"test": "grunt configTests && node --experimental-modules --no-warnings --no-deprecation tests/node/index.mjs && node --experimental-modules --no-warnings --no-deprecation tests/operations/index.mjs",
|
||||
"test-node-consumer": "grunt testnodeconsumer",
|
||||
"testui": "grunt testui",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import OperationError from "./OperationError.mjs";
|
||||
import DishError from "./DishError.mjs";
|
||||
import ExcludedOperationError from "./ExcludedOperationError";
|
||||
import ExcludedOperationError from "./ExcludedOperationError.mjs";
|
||||
|
||||
export {
|
||||
OperationError,
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
import Operation from "../Operation.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import {isImage} from "../lib/FileType";
|
||||
import {toBase64} from "../lib/Base64";
|
||||
import {isImage} from "../lib/FileType.mjs";
|
||||
import {toBase64} from "../lib/Base64.mjs";
|
||||
import jimp from "jimp";
|
||||
import {isWorkerEnvironment} from "../Utils";
|
||||
import {isWorkerEnvironment} from "../Utils.mjs";
|
||||
|
||||
/**
|
||||
* Generate Image operation
|
||||
|
|
|
@ -41,7 +41,7 @@ let code = `/**
|
|||
import NodeDish from "./NodeDish.mjs";
|
||||
import { _wrap, help, bake, _explainExcludedFunction } from "./api.mjs";
|
||||
import File from "./File.mjs";
|
||||
import { OperationError, DishError, ExcludedOperationError } from "../core/errors/index";
|
||||
import { OperationError, DishError, ExcludedOperationError } from "../core/errors/index.mjs";
|
||||
import {
|
||||
// import as core_ to avoid name clashes after wrap.
|
||||
`;
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
const chef = require("./cjs.js");
|
||||
const repl = require("repl");
|
||||
import chef from "./index.mjs"
|
||||
import repl from "repl"
|
||||
|
||||
|
||||
/* eslint no-console: ["off"] */
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* Tests to ensure that a consuming app can use named imports from deep import patch
|
||||
*
|
||||
* @author d98762625 [d98762625@gmail.com]
|
||||
* @copyright Crown Copyright 2019
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import assert from "assert";
|
||||
import { bake, toHex, reverse, unique, multiply } from "cyberchef/src/node/index.mjs";
|
||||
|
||||
const d = bake("Testing, 1 2 3", [
|
||||
toHex,
|
||||
reverse,
|
||||
{
|
||||
op: unique,
|
||||
args: {
|
||||
delimiter: "Space",
|
||||
}
|
||||
},
|
||||
{
|
||||
op: multiply,
|
||||
args: {
|
||||
delimiter: "Space",
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
assert.equal(d.value, "630957449041920");
|
Loading…
Add table
Add a link
Reference in a new issue