undeclarye module type, remove deep import test. add file extensions to some imports

This commit is contained in:
d98762625 2020-05-22 11:46:21 +01:00
parent ce7427b288
commit 16db8b0b72
7 changed files with 11 additions and 47 deletions

View file

@ -48,7 +48,7 @@ module.exports = function (grunt) {
grunt.registerTask("testnodeconsumer", grunt.registerTask("testnodeconsumer",
"A task which checks whether consuming CJS and ESM apps work with the CyberChef build", "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", grunt.registerTask("default",
"Lints the code base", "Lints the code base",
@ -413,17 +413,10 @@ module.exports = function (grunt) {
testESMNodeConsumer: { testESMNodeConsumer: {
command: chainCommands([ command: chainCommands([
`cd ${nodeConsumerTestPath}`, `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, stdout: false,
}, }
testESMDeepImportNodeConsumer: {
command: chainCommands([
`cd ${nodeConsumerTestPath}`,
"node --no-warnings --experimental-modules esm-deep-import-consumer.mjs",
]),
stdout: false,
},
}, },
}); });
}; };

View file

@ -1,6 +1,5 @@
{ {
"name": "cyberchef", "name": "cyberchef",
"type": "module",
"version": "9.20.3", "version": "9.20.3",
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
"author": "n1474335 <n1474335@gmail.com>", "author": "n1474335 <n1474335@gmail.com>",
@ -163,7 +162,7 @@
"scripts": { "scripts": {
"start": "grunt dev", "start": "grunt dev",
"build": "grunt prod", "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": "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", "test-node-consumer": "grunt testnodeconsumer",
"testui": "grunt testui", "testui": "grunt testui",

View file

@ -1,6 +1,6 @@
import OperationError from "./OperationError.mjs"; import OperationError from "./OperationError.mjs";
import DishError from "./DishError.mjs"; import DishError from "./DishError.mjs";
import ExcludedOperationError from "./ExcludedOperationError"; import ExcludedOperationError from "./ExcludedOperationError.mjs";
export { export {
OperationError, OperationError,

View file

@ -7,10 +7,10 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import {isImage} from "../lib/FileType"; import {isImage} from "../lib/FileType.mjs";
import {toBase64} from "../lib/Base64"; import {toBase64} from "../lib/Base64.mjs";
import jimp from "jimp"; import jimp from "jimp";
import {isWorkerEnvironment} from "../Utils"; import {isWorkerEnvironment} from "../Utils.mjs";
/** /**
* Generate Image operation * Generate Image operation

View file

@ -41,7 +41,7 @@ let code = `/**
import NodeDish from "./NodeDish.mjs"; import NodeDish from "./NodeDish.mjs";
import { _wrap, help, bake, _explainExcludedFunction } from "./api.mjs"; import { _wrap, help, bake, _explainExcludedFunction } from "./api.mjs";
import File from "./File.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 {
// import as core_ to avoid name clashes after wrap. // import as core_ to avoid name clashes after wrap.
`; `;

View file

@ -7,8 +7,8 @@
* @license Apache-2.0 * @license Apache-2.0
*/ */
const chef = require("./cjs.js"); import chef from "./index.mjs"
const repl = require("repl"); import repl from "repl"
/* eslint no-console: ["off"] */ /* eslint no-console: ["off"] */

View file

@ -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");