Fixed operational tests and updated some dependencies

This commit is contained in:
n1474335 2023-02-27 17:55:52 +00:00
parent 9e679f411c
commit bf949c0320
30 changed files with 972 additions and 776 deletions

1617
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -39,29 +39,29 @@
"node >= 16" "node >= 16"
], ],
"devDependencies": { "devDependencies": {
"@babel/core": "^7.20.12", "@babel/core": "^7.21.0",
"@babel/eslint-parser": "^7.19.1", "@babel/eslint-parser": "^7.19.1",
"@babel/plugin-syntax-import-assertions": "^7.20.0", "@babel/plugin-syntax-import-assertions": "^7.20.0",
"@babel/plugin-transform-runtime": "^7.19.6", "@babel/plugin-transform-runtime": "^7.21.0",
"@babel/preset-env": "^7.20.2", "@babel/preset-env": "^7.20.2",
"@babel/runtime": "^7.20.7", "@babel/runtime": "^7.21.0",
"@codemirror/commands": "^6.1.3", "@codemirror/commands": "^6.2.1",
"@codemirror/language": "^6.4.0", "@codemirror/language": "^6.6.0",
"@codemirror/search": "^6.2.3", "@codemirror/search": "^6.2.3",
"@codemirror/state": "^6.2.0", "@codemirror/state": "^6.2.0",
"@codemirror/view": "^6.7.3", "@codemirror/view": "^6.9.1",
"autoprefixer": "^10.4.13", "autoprefixer": "^10.4.13",
"babel-loader": "^9.1.2", "babel-loader": "^9.1.2",
"babel-plugin-dynamic-import-node": "^2.3.3", "babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-transform-builtin-extend": "1.1.2", "babel-plugin-transform-builtin-extend": "1.1.2",
"chromedriver": "^109.0.0", "chromedriver": "^110.0.0",
"cli-progress": "^3.11.2", "cli-progress": "^3.12.0",
"colors": "^1.4.0", "colors": "^1.4.0",
"copy-webpack-plugin": "^11.0.0", "copy-webpack-plugin": "^11.0.0",
"core-js": "^3.27.1", "core-js": "^3.29.0",
"css-loader": "6.7.3", "css-loader": "6.7.3",
"eslint": "^8.31.0", "eslint": "^8.35.0",
"grunt": "^1.5.3", "grunt": "^1.6.1",
"grunt-chmod": "~1.1.1", "grunt-chmod": "~1.1.1",
"grunt-concurrent": "^3.0.0", "grunt-concurrent": "^3.0.0",
"grunt-contrib-clean": "~2.0.1", "grunt-contrib-clean": "~2.0.1",
@ -76,16 +76,16 @@
"imports-loader": "^4.0.1", "imports-loader": "^4.0.1",
"mini-css-extract-plugin": "2.7.2", "mini-css-extract-plugin": "2.7.2",
"modify-source-webpack-plugin": "^3.0.0", "modify-source-webpack-plugin": "^3.0.0",
"nightwatch": "^2.6.10", "nightwatch": "^2.6.15",
"postcss": "^8.4.21", "postcss": "^8.4.21",
"postcss-css-variables": "^0.18.0", "postcss-css-variables": "^0.18.0",
"postcss-import": "^15.1.0", "postcss-import": "^15.1.0",
"postcss-loader": "^7.0.2", "postcss-loader": "^7.0.2",
"prompt": "^1.3.0", "prompt": "^1.3.0",
"sitemap": "^7.1.1", "sitemap": "^7.1.1",
"terser": "^5.16.1", "terser": "^5.16.5",
"webpack": "^5.75.0", "webpack": "^5.75.0",
"webpack-bundle-analyzer": "^4.7.0", "webpack-bundle-analyzer": "^4.8.0",
"webpack-dev-server": "4.11.1", "webpack-dev-server": "4.11.1",
"webpack-node-externals": "^3.0.0", "webpack-node-externals": "^3.0.0",
"worker-loader": "^3.0.8" "worker-loader": "^3.0.8"
@ -112,7 +112,7 @@
"crypto-browserify": "^3.12.0", "crypto-browserify": "^3.12.0",
"crypto-js": "^4.1.1", "crypto-js": "^4.1.1",
"ctph.js": "0.0.5", "ctph.js": "0.0.5",
"d3": "7.4.4", "d3": "7.8.2",
"d3-hexbin": "^0.2.2", "d3-hexbin": "^0.2.2",
"diff": "^5.1.0", "diff": "^5.1.0",
"es6-promisify": "^7.0.0", "es6-promisify": "^7.0.0",
@ -123,14 +123,14 @@
"flat": "^5.0.2", "flat": "^5.0.2",
"geodesy": "1.1.3", "geodesy": "1.1.3",
"highlight.js": "^11.7.0", "highlight.js": "^11.7.0",
"jimp": "^0.16.2", "jimp": "^0.16.13",
"jquery": "3.6.3", "jquery": "3.6.3",
"js-crc": "^0.2.0", "js-crc": "^0.2.0",
"js-sha3": "^0.8.0", "js-sha3": "^0.8.0",
"jsesc": "^3.0.2", "jsesc": "^3.0.2",
"json5": "^2.2.3", "json5": "^2.2.3",
"jsonpath-plus": "^7.2.0", "jsonpath-plus": "^7.2.0",
"jsonwebtoken": "^9.0.0", "jsonwebtoken": "8.5.1",
"jsqr": "^1.4.0", "jsqr": "^1.4.0",
"jsrsasign": "^10.6.1", "jsrsasign": "^10.6.1",
"kbpgp": "2.1.15", "kbpgp": "2.1.15",
@ -143,7 +143,7 @@
"lz4js": "^0.2.0", "lz4js": "^0.2.0",
"markdown-it": "^13.0.1", "markdown-it": "^13.0.1",
"moment": "^2.29.4", "moment": "^2.29.4",
"moment-timezone": "^0.5.40", "moment-timezone": "^0.5.41",
"ngeohash": "^0.6.3", "ngeohash": "^0.6.3",
"node-forge": "^1.3.1", "node-forge": "^1.3.1",
"node-md6": "^0.1.0", "node-md6": "^0.1.0",
@ -155,7 +155,7 @@
"path": "^0.12.7", "path": "^0.12.7",
"popper.js": "^1.16.1", "popper.js": "^1.16.1",
"process": "^0.11.10", "process": "^0.11.10",
"protobufjs": "^7.1.2", "protobufjs": "^7.2.2",
"qr-image": "^3.2.0", "qr-image": "^3.2.0",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"scryptsy": "^2.1.0", "scryptsy": "^2.1.0",
@ -165,7 +165,7 @@
"ssdeep.js": "0.0.3", "ssdeep.js": "0.0.3",
"stream-browserify": "^3.0.0", "stream-browserify": "^3.0.0",
"tesseract.js": "3.0.3", "tesseract.js": "3.0.3",
"ua-parser-js": "^1.0.32", "ua-parser-js": "^1.0.33",
"unorm": "^1.6.0", "unorm": "^1.6.0",
"utf8": "^3.0.0", "utf8": "^3.0.0",
"vkbeautify": "^0.99.3", "vkbeautify": "^0.99.3",

View file

@ -27,8 +27,8 @@ class Chef {
* *
* @param {string|ArrayBuffer} input - The input data as a string or ArrayBuffer * @param {string|ArrayBuffer} input - The input data as a string or ArrayBuffer
* @param {Object[]} recipeConfig - The recipe configuration object * @param {Object[]} recipeConfig - The recipe configuration object
* @param {Object} options - The options object storing various user choices * @param {Object} [options={}] - The options object storing various user choices
* @param {boolean} options.attempHighlight - Whether or not to attempt highlighting * @param {string} [options.returnType] - What type to return the result as
* *
* @returns {Object} response * @returns {Object} response
* @returns {string} response.result - The output of the recipe * @returns {string} response.result - The output of the recipe
@ -37,7 +37,7 @@ class Chef {
* @returns {number} response.duration - The number of ms it took to execute the recipe * @returns {number} response.duration - The number of ms it took to execute the recipe
* @returns {number} response.error - The error object thrown by a failed operation (false if no error) * @returns {number} response.error - The error object thrown by a failed operation (false if no error)
*/ */
async bake(input, recipeConfig, options) { async bake(input, recipeConfig, options={}) {
log.debug("Chef baking"); log.debug("Chef baking");
const startTime = Date.now(), const startTime = Date.now(),
recipe = new Recipe(recipeConfig), recipe = new Recipe(recipeConfig),
@ -68,9 +68,8 @@ class Chef {
await recipe.present(this.dish); await recipe.present(this.dish);
const returnType = const returnType =
this.dish.type === Dish.HTML ? this.dish.type === Dish.HTML ? Dish.HTML :
Dish.HTML : options?.returnType ? options.returnType : Dish.ARRAY_BUFFER;
Dish.ARRAY_BUFFER;
return { return {
dish: rawDish, dish: rawDish,

View file

@ -4,6 +4,8 @@
* @license Apache-2.0 * @license Apache-2.0
*/ */
// loglevel import required for Node API
import log from "loglevel";
import utf8 from "utf8"; import utf8 from "utf8";
import {fromBase64, toBase64} from "./lib/Base64.mjs"; import {fromBase64, toBase64} from "./lib/Base64.mjs";
import {fromHex} from "./lib/Hex.mjs"; import {fromHex} from "./lib/Hex.mjs";

View file

@ -10,8 +10,7 @@ import OperationError from "../errors/OperationError.mjs";
import jsQR from "jsqr"; import jsQR from "jsqr";
import qr from "qr-image"; import qr from "qr-image";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Parses a QR code image from an image * Parses a QR code image from an image

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Add Text To Image operation * Add Text To Image operation

View file

@ -10,8 +10,7 @@ import { isWorkerEnvironment } from "../Utils.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { gaussianBlur } from "../lib/ImageManipulation.mjs"; import { gaussianBlur } from "../lib/ImageManipulation.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Blur Image operation * Blur Image operation

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Contain Image operation * Contain Image operation

View file

@ -8,8 +8,7 @@ import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Convert Image Format operation * Convert Image Format operation

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Cover Image operation * Cover Image operation

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Crop Image operation * Crop Image operation

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Image Dither operation * Image Dither operation

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import { fromBinary } from "../lib/Binary.mjs"; import { fromBinary } from "../lib/Binary.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Extract LSB operation * Extract LSB operation

View file

@ -7,8 +7,7 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
import {RGBA_DELIM_OPTIONS} from "../lib/Delim.mjs"; import {RGBA_DELIM_OPTIONS} from "../lib/Delim.mjs";

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Flip Image operation * Flip Image operation

View file

@ -59,7 +59,7 @@ class FromCharcode extends Operation {
} }
if (input.length === 0) { if (input.length === 0) {
return []; return new ArrayBuffer;
} }
if (base !== 16 && isWorkerEnvironment()) self.setOption("attemptHighlight", false); if (base !== 16 && isWorkerEnvironment()) self.setOption("attemptHighlight", false);

View file

@ -10,8 +10,7 @@ import Utils from "../Utils.mjs";
import {isImage} from "../lib/FileType.mjs"; import {isImage} from "../lib/FileType.mjs";
import {toBase64} from "../lib/Base64.mjs"; import {toBase64} from "../lib/Base64.mjs";
import {isWorkerEnvironment} from "../Utils.mjs"; import {isWorkerEnvironment} from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Generate Image operation * Generate Image operation

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Image Brightness / Contrast operation * Image Brightness / Contrast operation

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Image Filter operation * Image Filter operation

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Image Hue/Saturation/Lightness operation * Image Hue/Saturation/Lightness operation

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Image Opacity operation * Image Opacity operation

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Invert Image operation * Invert Image operation

View file

@ -8,8 +8,7 @@ import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Normalise Image operation * Normalise Image operation

View file

@ -10,8 +10,7 @@ import Utils from "../Utils.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { runHash } from "../lib/Hash.mjs"; import { runHash } from "../lib/Hash.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Randomize Colour Palette operation * Randomize Colour Palette operation

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Resize Image operation * Resize Image operation

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Rotate Image operation * Rotate Image operation

View file

@ -10,8 +10,7 @@ import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import { gaussianBlur } from "../lib/ImageManipulation.mjs"; import { gaussianBlur } from "../lib/ImageManipulation.mjs";
import { isWorkerEnvironment } from "../Utils.mjs"; import { isWorkerEnvironment } from "../Utils.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Sharpen Image operation * Sharpen Image operation

View file

@ -8,8 +8,7 @@ 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.mjs"; import {isImage} from "../lib/FileType.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* Split Colour Channels operation * Split Colour Channels operation

View file

@ -9,8 +9,7 @@ import OperationError from "../errors/OperationError.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import { isImage } from "../lib/FileType.mjs"; import { isImage } from "../lib/FileType.mjs";
import { toBase64 } from "../lib/Base64.mjs"; import { toBase64 } from "../lib/Base64.mjs";
import jimplib from "jimp/es/index.js"; import jimp from "jimp";
const jimp = jimplib.default ? jimplib.default : jimplib;
/** /**
* View Bit Plane operation * View Bit Plane operation

View file

@ -74,9 +74,7 @@ class TestRegister {
const result = await chef.bake( const result = await chef.bake(
test.input, test.input,
test.recipeConfig, test.recipeConfig,
{}, { returnType: "string" }
0,
false
); );
const ret = { const ret = {