Merge branch 'master' into feat/support-other-keys-in-parse-csr

This commit is contained in:
a3957273 2024-06-11 22:51:32 +01:00 committed by GitHub
commit 4528a1bdb6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 2946 additions and 1933 deletions

View file

@ -1 +0,0 @@
src/core/vendor/**

View file

@ -1,116 +0,0 @@
{
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 2022,
"ecmaFeatures": {
"impliedStrict": true
},
"sourceType": "module",
"allowImportExportEverywhere": true
},
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"rules": {
// enable additional rules
"no-eval": "error",
"no-implied-eval": "error",
"dot-notation": "error",
"eqeqeq": ["error", "smart"],
"no-caller": "error",
"no-extra-bind": "error",
"no-unused-expressions": "error",
"no-useless-call": "error",
"no-useless-return": "error",
"radix": "warn",
// modify rules from base configurations
"no-unused-vars": ["error", {
"args": "none",
"vars": "all"
}],
"no-empty": ["error", {
"allowEmptyCatch": true
}],
// disable rules from base configurations
"no-control-regex": "off",
"require-atomic-updates": "off",
"no-async-promise-executor": "off",
// stylistic conventions
"brace-style": ["error", "1tbs"],
"space-before-blocks": ["error", "always"],
"block-spacing": "error",
"array-bracket-spacing": "error",
"comma-spacing": "error",
"spaced-comment": ["error", "always", { "exceptions": ["/"] } ],
"comma-style": "error",
"computed-property-spacing": "error",
"no-trailing-spaces": "warn",
"eol-last": "error",
"func-call-spacing": "error",
"key-spacing": ["warn", {
"mode": "minimum"
}],
"indent": ["error", 4, {
"ignoreComments": true,
"ArrayExpression": "first",
"SwitchCase": 1
}],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "double", {
"avoidEscape": true,
"allowTemplateLiterals": true
}],
"camelcase": ["error", {
"properties": "always"
}],
"semi": ["error", "always"],
"unicode-bom": "error",
"require-jsdoc": ["error", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true,
"ArrowFunctionExpression": true
}
}],
"keyword-spacing": ["error", {
"before": true,
"after": true
}],
"no-multiple-empty-lines": ["warn", {
"max": 2,
"maxEOF": 1,
"maxBOF": 0
}],
"no-whitespace-before-property": "error",
"operator-linebreak": ["error", "after"],
"space-in-parens": "error",
"no-var": "error",
"prefer-const": "error"
},
"overrides": [
{
"files": "tests/**/*",
"rules": {
"no-unused-expressions": "off",
"no-console": "off"
}
}
],
"globals": {
"$": false,
"jQuery": false,
"log": false,
"app": false,
"COMPILE_TIME": false,
"COMPILE_MSG": false,
"PKG_VERSION": false
}
}

View file

@ -431,6 +431,18 @@ module.exports = function (grunt) {
} }
}, },
stdout: false stdout: false
},
fixJimpModule: {
command: function () {
switch (process.platform) {
case "darwin":
// Space added before comma to prevent multiple modifications
return `sed -i '' 's/"es\\/index.js",/"es\\/index.js" ,\\n "type": "module",/' ./node_modules/jimp/package.json`;
default:
return `sed -i 's/"es\\/index.js",/"es\\/index.js" ,\\n "type": "module",/' ./node_modules/jimp/package.json`;
}
},
stdout: false
} }
}, },
}); });

129
eslint.config.mjs Executable file
View file

@ -0,0 +1,129 @@
import babelParser from "@babel/eslint-parser";
import jsdoc from "eslint-plugin-jsdoc";
import js from "@eslint/js";
import globals from "globals";
export default [
js.configs.recommended,
{
languageOptions: {
ecmaVersion: 2022,
parser: babelParser,
parserOptions: {
ecmaVersion: 2022,
ecmaFeatures: {
impliedStrict: true
},
sourceType: "module",
allowImportExportEverywhere: true
},
globals: {
...globals.browser,
...globals.node,
...globals.es6,
"$": false,
"jQuery": false,
"log": false,
"app": false,
"COMPILE_TIME": false,
"COMPILE_MSG": false,
"PKG_VERSION": false
},
},
ignores: ["src/core/vendor/**"],
plugins: {
jsdoc
},
rules: {
// enable additional rules
"no-eval": "error",
"no-implied-eval": "error",
"dot-notation": "error",
"eqeqeq": ["error", "smart"],
"no-caller": "error",
"no-extra-bind": "error",
"no-unused-expressions": "error",
"no-useless-call": "error",
"no-useless-return": "error",
"radix": "warn",
// modify rules from base configurations
"no-unused-vars": ["error", {
"args": "none",
"vars": "all",
"caughtErrors": "none"
}],
"no-empty": ["error", {
"allowEmptyCatch": true
}],
// disable rules from base configurations
"no-control-regex": "off",
"require-atomic-updates": "off",
"no-async-promise-executor": "off",
// stylistic conventions
"brace-style": ["error", "1tbs"],
"space-before-blocks": ["error", "always"],
"block-spacing": "error",
"array-bracket-spacing": "error",
"comma-spacing": "error",
"spaced-comment": ["error", "always", { "exceptions": ["/"] }],
"comma-style": "error",
"computed-property-spacing": "error",
"no-trailing-spaces": "warn",
"eol-last": "error",
"func-call-spacing": "error",
"key-spacing": ["warn", {
"mode": "minimum"
}],
"indent": ["error", 4, {
"ignoreComments": true,
"ArrayExpression": "first",
"SwitchCase": 1
}],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "double", {
"avoidEscape": true,
"allowTemplateLiterals": true
}],
"camelcase": ["error", {
"properties": "always"
}],
"semi": ["error", "always"],
"unicode-bom": "error",
"jsdoc/require-jsdoc": ["error", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true,
"ArrowFunctionExpression": false
}
}],
"keyword-spacing": ["error", {
"before": true,
"after": true
}],
"no-multiple-empty-lines": ["warn", {
"max": 2,
"maxEOF": 1,
"maxBOF": 0
}],
"no-whitespace-before-property": "error",
"operator-linebreak": ["error", "after"],
"space-in-parens": "error",
"no-var": "error",
"prefer-const": "error",
"no-console": "error"
},
},
// File-pattern specific overrides
{
files: ["tests/**/*"],
rules: {
"no-unused-expressions": "off",
"no-console": "off"
}
},
];

4220
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{ {
"name": "cyberchef", "name": "cyberchef",
"version": "10.18.7", "version": "10.18.8",
"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>",
"homepage": "https://gchq.github.io/CyberChef", "homepage": "https://gchq.github.io/CyberChef",
@ -39,29 +39,31 @@
"node >= 16" "node >= 16"
], ],
"devDependencies": { "devDependencies": {
"@babel/core": "^7.23.9", "@babel/core": "^7.24.7",
"@babel/eslint-parser": "^7.23.10", "@babel/eslint-parser": "^7.24.7",
"@babel/plugin-syntax-import-assertions": "^7.23.3", "@babel/plugin-syntax-import-assertions": "^7.24.7",
"@babel/plugin-transform-runtime": "^7.23.9", "@babel/plugin-transform-runtime": "^7.24.7",
"@babel/preset-env": "^7.23.9", "@babel/preset-env": "^7.24.7",
"@babel/runtime": "^7.23.9", "@babel/runtime": "^7.24.7",
"@codemirror/commands": "^6.3.3", "@codemirror/commands": "^6.6.0",
"@codemirror/language": "^6.10.1", "@codemirror/language": "^6.10.2",
"@codemirror/search": "^6.5.5", "@codemirror/search": "^6.5.6",
"@codemirror/state": "^6.4.0", "@codemirror/state": "^6.4.1",
"@codemirror/view": "^6.23.1", "@codemirror/view": "^6.28.0",
"autoprefixer": "^10.4.17", "autoprefixer": "^10.4.19",
"babel-loader": "^9.1.3", "babel-loader": "^9.1.3",
"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",
"base64-loader": "^1.0.0", "base64-loader": "^1.0.0",
"chromedriver": "^123.0.4", "chromedriver": "^125.0.3",
"cli-progress": "^3.12.0", "cli-progress": "^3.12.0",
"colors": "^1.4.0", "colors": "^1.4.0",
"copy-webpack-plugin": "^12.0.2", "copy-webpack-plugin": "^12.0.2",
"core-js": "^3.35.1", "core-js": "^3.37.1",
"css-loader": "6.10.0", "css-loader": "7.1.2",
"eslint": "^8.56.0", "eslint": "^9.4.0",
"eslint-plugin-jsdoc": "^48.2.9",
"globals": "^15.4.0",
"grunt": "^1.6.1", "grunt": "^1.6.1",
"grunt-chmod": "~1.1.1", "grunt-chmod": "~1.1.1",
"grunt-concurrent": "^3.0.0", "grunt-concurrent": "^3.0.0",
@ -69,25 +71,25 @@
"grunt-contrib-connect": "^4.0.0", "grunt-contrib-connect": "^4.0.0",
"grunt-contrib-copy": "~1.0.0", "grunt-contrib-copy": "~1.0.0",
"grunt-contrib-watch": "^1.1.0", "grunt-contrib-watch": "^1.1.0",
"grunt-eslint": "^24.3.0", "grunt-eslint": "^25.0.0",
"grunt-exec": "~3.0.0", "grunt-exec": "~3.0.0",
"grunt-webpack": "^6.0.0", "grunt-webpack": "^6.0.0",
"grunt-zip": "^1.0.0", "grunt-zip": "^1.0.0",
"html-webpack-plugin": "^5.6.0", "html-webpack-plugin": "^5.6.0",
"imports-loader": "^5.0.0", "imports-loader": "^5.0.0",
"mini-css-extract-plugin": "2.8.0", "mini-css-extract-plugin": "2.9.0",
"modify-source-webpack-plugin": "^3.0.0", "modify-source-webpack-plugin": "^4.1.0",
"nightwatch": "^3.4.0", "nightwatch": "^3.6.3",
"postcss": "^8.4.33", "postcss": "^8.4.38",
"postcss-css-variables": "^0.19.0", "postcss-css-variables": "^0.19.0",
"postcss-import": "^16.0.0", "postcss-import": "^16.1.0",
"postcss-loader": "^8.1.0", "postcss-loader": "^8.1.1",
"prompt": "^1.3.0", "prompt": "^1.3.0",
"sitemap": "^7.1.1", "sitemap": "^8.0.0",
"terser": "^5.27.0", "terser": "^5.31.1",
"webpack": "^5.90.1", "webpack": "^5.91.0",
"webpack-bundle-analyzer": "^4.10.1", "webpack-bundle-analyzer": "^4.10.2",
"webpack-dev-server": "4.15.1", "webpack-dev-server": "5.0.4",
"webpack-node-externals": "^3.0.0", "webpack-node-externals": "^3.0.0",
"worker-loader": "^3.0.8" "worker-loader": "^3.0.8"
}, },
@ -96,7 +98,7 @@
"@babel/polyfill": "^7.12.1", "@babel/polyfill": "^7.12.1",
"@blu3r4y/lzma": "^2.3.3", "@blu3r4y/lzma": "^2.3.3",
"@wavesenterprise/crypto-gost-js": "^2.1.0-RC1", "@wavesenterprise/crypto-gost-js": "^2.1.0-RC1",
"@xmldom/xmldom": "^0.8.0", "@xmldom/xmldom": "^0.8.10",
"argon2-browser": "^1.18.0", "argon2-browser": "^1.18.0",
"arrive": "^2.4.1", "arrive": "^2.4.1",
"avsc": "^5.7.7", "avsc": "^5.7.7",
@ -116,26 +118,26 @@
"crypto-browserify": "^3.12.0", "crypto-browserify": "^3.12.0",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"ctph.js": "0.0.5", "ctph.js": "0.0.5",
"d3": "7.8.5", "d3": "7.9.0",
"d3-hexbin": "^0.2.2", "d3-hexbin": "^0.2.2",
"diff": "^5.1.0", "diff": "^5.2.0",
"es6-promisify": "^7.0.0", "es6-promisify": "^7.0.0",
"escodegen": "^2.1.0", "escodegen": "^2.1.0",
"esprima": "^4.0.1", "esprima": "^4.0.1",
"exif-parser": "^0.1.12", "exif-parser": "^0.1.12",
"fernet": "^0.3.2", "fernet": "^0.4.0",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"flat": "^6.0.1", "flat": "^6.0.1",
"geodesy": "1.1.3", "geodesy": "1.1.3",
"highlight.js": "^11.9.0", "highlight.js": "^11.9.0",
"ieee754": "^1.1.13", "ieee754": "^1.2.1",
"jimp": "^0.16.13", "jimp": "^0.22.12",
"jquery": "3.7.1", "jquery": "3.7.1",
"js-crc": "^0.2.0", "js-crc": "^0.2.0",
"js-sha3": "^0.9.3", "js-sha3": "^0.9.3",
"jsesc": "^3.0.2", "jsesc": "^3.0.2",
"json5": "^2.2.3", "json5": "^2.2.3",
"jsonpath-plus": "^8.0.0", "jsonpath-plus": "^9.0.0",
"jsonwebtoken": "8.5.1", "jsonwebtoken": "8.5.1",
"jsqr": "^1.4.0", "jsqr": "^1.4.0",
"jsrsasign": "^11.1.0", "jsrsasign": "^11.1.0",
@ -147,9 +149,9 @@
"loglevel-message-prefix": "^3.0.0", "loglevel-message-prefix": "^3.0.0",
"lz-string": "^1.5.0", "lz-string": "^1.5.0",
"lz4js": "^0.2.0", "lz4js": "^0.2.0",
"markdown-it": "^14.0.0", "markdown-it": "^14.1.0",
"moment": "^2.30.1", "moment": "^2.30.1",
"moment-timezone": "^0.5.44", "moment-timezone": "^0.5.45",
"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",
@ -161,9 +163,9 @@
"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.2.6", "protobufjs": "^7.3.1",
"qr-image": "^3.2.0", "qr-image": "^3.2.0",
"reflect-metadata": "^0.2.1", "reflect-metadata": "^0.2.2",
"rison": "^0.1.1", "rison": "^0.1.1",
"scryptsy": "^2.1.0", "scryptsy": "^2.1.0",
"snackbarjs": "^1.1.0", "snackbarjs": "^1.1.0",
@ -171,8 +173,8 @@
"split.js": "^1.6.5", "split.js": "^1.6.5",
"ssdeep.js": "0.0.3", "ssdeep.js": "0.0.3",
"stream-browserify": "^3.0.0", "stream-browserify": "^3.0.0",
"tesseract.js": "5.0.4", "tesseract.js": "5.1.0",
"ua-parser-js": "^1.0.37", "ua-parser-js": "^1.0.38",
"unorm": "^1.6.0", "unorm": "^1.6.0",
"utf8": "^3.0.0", "utf8": "^3.0.0",
"vkbeautify": "^0.99.3", "vkbeautify": "^0.99.3",
@ -190,7 +192,7 @@
"testui": "npx grunt testui", "testui": "npx grunt testui",
"testuidev": "npx nightwatch --env=dev", "testuidev": "npx nightwatch --env=dev",
"lint": "npx grunt lint", "lint": "npx grunt lint",
"postinstall": "npx grunt exec:fixCryptoApiImports && npx grunt exec:fixSnackbarMarkup", "postinstall": "npx grunt exec:fixCryptoApiImports && npx grunt exec:fixSnackbarMarkup && npx grunt exec:fixJimpModule",
"newop": "node --experimental-modules --experimental-json-modules src/core/config/scripts/newOperation.mjs", "newop": "node --experimental-modules --experimental-json-modules src/core/config/scripts/newOperation.mjs",
"minor": "node --experimental-modules --experimental-json-modules src/core/config/scripts/newMinorVersion.mjs", "minor": "node --experimental-modules --experimental-json-modules src/core/config/scripts/newMinorVersion.mjs",
"getheapsize": "node -e 'console.log(`node heap limit = ${require(\"v8\").getHeapStatistics().heap_size_limit / (1024 * 1024)} Mb`)'", "getheapsize": "node -e 'console.log(`node heap limit = ${require(\"v8\").getHeapStatistics().heap_size_limit / (1024 * 1024)} Mb`)'",

View file

@ -30,12 +30,12 @@ fs.readdirSync(path.join(dir, "../operations")).forEach(file => {
// Construct index file // Construct index file
let code = `/** let code = `/**
* THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateOpsIndex.mjs * THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateOpsIndex.mjs
* *
* @author n1474335 [n1474335@gmail.com] * @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright ${new Date().getUTCFullYear()} * @copyright Crown Copyright ${new Date().getUTCFullYear()}
* @license Apache-2.0 * @license Apache-2.0
*/ */
`; `;
opObjs.forEach(obj => { opObjs.forEach(obj => {

View file

@ -10,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Parses a QR code image from an image * Parses a QR code image from an image
@ -22,7 +22,7 @@ import jimp from "jimp";
export async function parseQrCode(input, normalise) { export async function parseQrCode(input, normalise) {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error opening image. (${err})`); throw new OperationError(`Error opening image. (${err})`);
} }
@ -33,8 +33,8 @@ export async function parseQrCode(input, normalise) {
image.background(0xFFFFFFFF); image.background(0xFFFFFFFF);
image.normalize(); image.normalize();
image.greyscale(); image.greyscale();
image = await image.getBufferAsync(jimp.MIME_JPEG); image = await image.getBufferAsync(Jimp.MIME_JPEG);
image = await jimp.read(image); image = await Jimp.read(image);
} }
} catch (err) { } catch (err) {
throw new OperationError(`Error normalising image. (${err})`); throw new OperationError(`Error normalising image. (${err})`);

View file

@ -9,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Add Text To Image operation * Add Text To Image operation
@ -127,7 +127,7 @@ class AddTextToImage extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error loading image. (${err})`); throw new OperationError(`Error loading image. (${err})`);
} }
@ -163,7 +163,7 @@ class AddTextToImage extends Operation {
const font = fontsMap[fontFace]; const font = fontsMap[fontFace];
// LoadFont needs an absolute url, so append the font name to self.docURL // LoadFont needs an absolute url, so append the font name to self.docURL
const jimpFont = await jimp.loadFont(self.docURL + "/" + font.default); const jimpFont = await Jimp.loadFont(self.docURL + "/" + font.default);
jimpFont.pages.forEach(function(page) { jimpFont.pages.forEach(function(page) {
if (page.bitmap) { if (page.bitmap) {
@ -190,7 +190,7 @@ class AddTextToImage extends Operation {
}); });
// Create a temporary image to hold the rendered text // Create a temporary image to hold the rendered text
const textImage = new jimp(jimp.measureText(jimpFont, text), jimp.measureTextHeight(jimpFont, text)); const textImage = new Jimp(Jimp.measureText(jimpFont, text), Jimp.measureTextHeight(jimpFont, text));
textImage.print(jimpFont, 0, 0, text); textImage.print(jimpFont, 0, 0, text);
// Scale the rendered text image to the correct size // Scale the rendered text image to the correct size
@ -198,9 +198,9 @@ class AddTextToImage extends Operation {
if (size !== 1) { if (size !== 1) {
// Use bicubic for decreasing size // Use bicubic for decreasing size
if (size > 1) { if (size > 1) {
textImage.scale(scaleFactor, jimp.RESIZE_BICUBIC); textImage.scale(scaleFactor, Jimp.RESIZE_BICUBIC);
} else { } else {
textImage.scale(scaleFactor, jimp.RESIZE_BILINEAR); textImage.scale(scaleFactor, Jimp.RESIZE_BILINEAR);
} }
} }
@ -234,9 +234,9 @@ class AddTextToImage extends Operation {
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -10,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Blur Image operation * Blur Image operation
@ -59,7 +59,7 @@ class BlurImage extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error loading image. (${err})`); throw new OperationError(`Error loading image. (${err})`);
} }
@ -79,9 +79,9 @@ class BlurImage extends Operation {
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -9,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Contain Image operation * Contain Image operation
@ -91,20 +91,20 @@ class ContainImage extends Operation {
const [width, height, hAlign, vAlign, alg, opaqueBg] = args; const [width, height, hAlign, vAlign, alg, opaqueBg] = args;
const resizeMap = { const resizeMap = {
"Nearest Neighbour": jimp.RESIZE_NEAREST_NEIGHBOR, "Nearest Neighbour": Jimp.RESIZE_NEAREST_NEIGHBOR,
"Bilinear": jimp.RESIZE_BILINEAR, "Bilinear": Jimp.RESIZE_BILINEAR,
"Bicubic": jimp.RESIZE_BICUBIC, "Bicubic": Jimp.RESIZE_BICUBIC,
"Hermite": jimp.RESIZE_HERMITE, "Hermite": Jimp.RESIZE_HERMITE,
"Bezier": jimp.RESIZE_BEZIER "Bezier": Jimp.RESIZE_BEZIER
}; };
const alignMap = { const alignMap = {
"Left": jimp.HORIZONTAL_ALIGN_LEFT, "Left": Jimp.HORIZONTAL_ALIGN_LEFT,
"Center": jimp.HORIZONTAL_ALIGN_CENTER, "Center": Jimp.HORIZONTAL_ALIGN_CENTER,
"Right": jimp.HORIZONTAL_ALIGN_RIGHT, "Right": Jimp.HORIZONTAL_ALIGN_RIGHT,
"Top": jimp.VERTICAL_ALIGN_TOP, "Top": Jimp.VERTICAL_ALIGN_TOP,
"Middle": jimp.VERTICAL_ALIGN_MIDDLE, "Middle": Jimp.VERTICAL_ALIGN_MIDDLE,
"Bottom": jimp.VERTICAL_ALIGN_BOTTOM "Bottom": Jimp.VERTICAL_ALIGN_BOTTOM
}; };
if (!isImage(input)) { if (!isImage(input)) {
@ -113,7 +113,7 @@ class ContainImage extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error loading image. (${err})`); throw new OperationError(`Error loading image. (${err})`);
} }
@ -123,16 +123,16 @@ class ContainImage extends Operation {
image.contain(width, height, alignMap[hAlign] | alignMap[vAlign], resizeMap[alg]); image.contain(width, height, alignMap[hAlign] | alignMap[vAlign], resizeMap[alg]);
if (opaqueBg) { if (opaqueBg) {
const newImage = await jimp.read(width, height, 0x000000FF); const newImage = await Jimp.read(width, height, 0x000000FF);
newImage.blit(image, 0, 0); newImage.blit(image, 0, 0);
image = newImage; image = newImage;
} }
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -8,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Convert Image Format operation * Convert Image Format operation
@ -76,19 +76,19 @@ class ConvertImageFormat extends Operation {
async run(input, args) { async run(input, args) {
const [format, jpegQuality, pngFilterType, pngDeflateLevel] = args; const [format, jpegQuality, pngFilterType, pngDeflateLevel] = args;
const formatMap = { const formatMap = {
"JPEG": jimp.MIME_JPEG, "JPEG": Jimp.MIME_JPEG,
"PNG": jimp.MIME_PNG, "PNG": Jimp.MIME_PNG,
"BMP": jimp.MIME_BMP, "BMP": Jimp.MIME_BMP,
"TIFF": jimp.MIME_TIFF "TIFF": Jimp.MIME_TIFF
}; };
const pngFilterMap = { const pngFilterMap = {
"Auto": jimp.PNG_FILTER_AUTO, "Auto": Jimp.PNG_FILTER_AUTO,
"None": jimp.PNG_FILTER_NONE, "None": Jimp.PNG_FILTER_NONE,
"Sub": jimp.PNG_FILTER_SUB, "Sub": Jimp.PNG_FILTER_SUB,
"Up": jimp.PNG_FILTER_UP, "Up": Jimp.PNG_FILTER_UP,
"Average": jimp.PNG_FILTER_AVERAGE, "Average": Jimp.PNG_FILTER_AVERAGE,
"Paeth": jimp.PNG_FILTER_PATH "Paeth": Jimp.PNG_FILTER_PATH
}; };
const mime = formatMap[format]; const mime = formatMap[format];
@ -98,7 +98,7 @@ class ConvertImageFormat extends Operation {
} }
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error opening image file. (${err})`); throw new OperationError(`Error opening image file. (${err})`);
} }

View file

@ -9,7 +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 jimp from "jimp"; import jimp from "jimp/es/index.js";
/** /**
* Cover Image operation * Cover Image operation

View file

@ -9,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Crop Image operation * Crop Image operation
@ -99,7 +99,7 @@ class CropImage extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error loading image. (${err})`); throw new OperationError(`Error loading image. (${err})`);
} }
@ -119,9 +119,9 @@ class CropImage extends Operation {
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -9,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Image Dither operation * Image Dither operation
@ -44,7 +44,7 @@ class DitherImage extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error loading image. (${err})`); throw new OperationError(`Error loading image. (${err})`);
} }
@ -55,9 +55,9 @@ class DitherImage extends Operation {
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -9,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Extract LSB operation * Extract LSB operation
@ -73,7 +73,7 @@ class ExtractLSB extends Operation {
const bit = 7 - args.pop(), const bit = 7 - args.pop(),
pixelOrder = args.pop(), pixelOrder = args.pop(),
colours = args.filter(option => option !== "").map(option => COLOUR_OPTIONS.indexOf(option)), colours = args.filter(option => option !== "").map(option => COLOUR_OPTIONS.indexOf(option)),
parsedImage = await jimp.read(input), parsedImage = await Jimp.read(input),
width = parsedImage.bitmap.width, width = parsedImage.bitmap.width,
height = parsedImage.bitmap.height, height = parsedImage.bitmap.height,
rgba = parsedImage.bitmap.data; rgba = parsedImage.bitmap.data;

View file

@ -7,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
import {RGBA_DELIM_OPTIONS} from "../lib/Delim.mjs"; import {RGBA_DELIM_OPTIONS} from "../lib/Delim.mjs";
@ -52,7 +52,7 @@ class ExtractRGBA extends Operation {
const delimiter = args[0], const delimiter = args[0],
includeAlpha = args[1], includeAlpha = args[1],
parsedImage = await jimp.read(input); parsedImage = await Jimp.read(input);
let bitmap = parsedImage.bitmap.data; let bitmap = parsedImage.bitmap.data;
bitmap = includeAlpha ? bitmap : bitmap.filter((val, idx) => idx % 4 !== 3); bitmap = includeAlpha ? bitmap : bitmap.filter((val, idx) => idx % 4 !== 3);

View file

@ -9,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Flip Image operation * Flip Image operation
@ -51,7 +51,7 @@ class FlipImage extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error loading image. (${err})`); throw new OperationError(`Error loading image. (${err})`);
} }
@ -69,9 +69,9 @@ class FlipImage extends Operation {
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -10,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Generate Image operation * Generate Image operation
@ -81,7 +81,7 @@ class GenerateImage extends Operation {
} }
const height = Math.ceil(input.length / bytesPerPixel / width); const height = Math.ceil(input.length / bytesPerPixel / width);
const image = await new jimp(width, height, (err, image) => {}); const image = await new Jimp(width, height, (err, image) => {});
if (isWorkerEnvironment()) if (isWorkerEnvironment())
self.sendStatusMessage("Generating image from data..."); self.sendStatusMessage("Generating image from data...");
@ -95,7 +95,7 @@ class GenerateImage extends Operation {
const y = Math.floor(index / width); const y = Math.floor(index / width);
const value = curByte[k] === "0" ? 0xFF : 0x00; const value = curByte[k] === "0" ? 0xFF : 0x00;
const pixel = jimp.rgbaToInt(value, value, value, 0xFF); const pixel = Jimp.rgbaToInt(value, value, value, 0xFF);
image.setPixelColor(pixel, x, y); image.setPixelColor(pixel, x, y);
} }
} }
@ -139,7 +139,7 @@ class GenerateImage extends Operation {
} }
try { try {
const pixel = jimp.rgbaToInt(red, green, blue, alpha); const pixel = Jimp.rgbaToInt(red, green, blue, alpha);
image.setPixelColor(pixel, x, y); image.setPixelColor(pixel, x, y);
} catch (err) { } catch (err) {
throw new OperationError(`Error while generating image from pixel values. (${err})`); throw new OperationError(`Error while generating image from pixel values. (${err})`);
@ -151,11 +151,11 @@ class GenerateImage extends Operation {
if (isWorkerEnvironment()) if (isWorkerEnvironment())
self.sendStatusMessage("Scaling image..."); self.sendStatusMessage("Scaling image...");
image.scaleToFit(width*scale, height*scale, jimp.RESIZE_NEAREST_NEIGHBOR); image.scaleToFit(width*scale, height*scale, Jimp.RESIZE_NEAREST_NEIGHBOR);
} }
try { try {
const imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); const imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {
throw new OperationError(`Error generating image. (${err})`); throw new OperationError(`Error generating image. (${err})`);

View file

@ -9,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Image Brightness / Contrast operation * Image Brightness / Contrast operation
@ -60,7 +60,7 @@ class ImageBrightnessContrast extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error loading image. (${err})`); throw new OperationError(`Error loading image. (${err})`);
} }
@ -78,9 +78,9 @@ class ImageBrightnessContrast extends Operation {
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -9,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Image Filter operation * Image Filter operation
@ -54,7 +54,7 @@ class ImageFilter extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error loading image. (${err})`); throw new OperationError(`Error loading image. (${err})`);
} }
@ -69,9 +69,9 @@ class ImageFilter extends Operation {
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -9,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Image Hue/Saturation/Lightness operation * Image Hue/Saturation/Lightness operation
@ -68,7 +68,7 @@ class ImageHueSaturationLightness extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error loading image. (${err})`); throw new OperationError(`Error loading image. (${err})`);
} }
@ -106,9 +106,9 @@ class ImageHueSaturationLightness extends Operation {
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -9,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Image Opacity operation * Image Opacity operation
@ -53,7 +53,7 @@ class ImageOpacity extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error loading image. (${err})`); throw new OperationError(`Error loading image. (${err})`);
} }
@ -64,9 +64,9 @@ class ImageOpacity extends Operation {
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -9,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Invert Image operation * Invert Image operation
@ -44,7 +44,7 @@ class InvertImage extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error loading image. (${err})`); throw new OperationError(`Error loading image. (${err})`);
} }
@ -55,9 +55,9 @@ class InvertImage extends Operation {
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -35,12 +35,6 @@ class JPathExpression extends Operation {
name: "Result delimiter", name: "Result delimiter",
type: "binaryShortString", type: "binaryShortString",
value: "\\n" value: "\\n"
},
{
name: "Prevent eval",
type: "boolean",
value: true,
description: "Evaluated expressions are disabled by default for security reasons"
} }
]; ];
} }
@ -51,7 +45,7 @@ class JPathExpression extends Operation {
* @returns {string} * @returns {string}
*/ */
run(input, args) { run(input, args) {
const [query, delimiter, preventEval] = args; const [query, delimiter] = args;
let results, jsonObj; let results, jsonObj;
try { try {
@ -63,8 +57,7 @@ class JPathExpression extends Operation {
try { try {
results = JSONPath({ results = JSONPath({
path: query, path: query,
json: jsonObj, json: jsonObj
preventEval: preventEval
}); });
} catch (err) { } catch (err) {
throw new OperationError(`Invalid JPath expression: ${err.message}`); throw new OperationError(`Invalid JPath expression: ${err.message}`);

View file

@ -8,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Normalise Image operation * Normalise Image operation
@ -43,7 +43,7 @@ class NormaliseImage extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error opening image file. (${err})`); throw new OperationError(`Error opening image file. (${err})`);
} }
@ -53,9 +53,9 @@ class NormaliseImage extends Operation {
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -10,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Randomize Colour Palette operation * Randomize Colour Palette operation
@ -48,7 +48,7 @@ class RandomizeColourPalette extends Operation {
if (!isImage(input)) throw new OperationError("Please enter a valid image file."); if (!isImage(input)) throw new OperationError("Please enter a valid image file.");
const seed = args[0] || (Math.random().toString().substr(2)), const seed = args[0] || (Math.random().toString().substr(2)),
parsedImage = await jimp.read(input), parsedImage = await Jimp.read(input),
width = parsedImage.bitmap.width, width = parsedImage.bitmap.width,
height = parsedImage.bitmap.height; height = parsedImage.bitmap.height;
@ -61,7 +61,7 @@ class RandomizeColourPalette extends Operation {
parsedImage.setPixelColor(parseInt(rgbHex, 16), x, y); parsedImage.setPixelColor(parseInt(rgbHex, 16), x, y);
}); });
const imageBuffer = await parsedImage.getBufferAsync(jimp.AUTO); const imageBuffer = await parsedImage.getBufferAsync(Jimp.AUTO);
return new Uint8Array(imageBuffer).buffer; return new Uint8Array(imageBuffer).buffer;
} }

View file

@ -9,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Resize Image operation * Resize Image operation
@ -80,11 +80,11 @@ class ResizeImage extends Operation {
resizeAlg = args[4]; resizeAlg = args[4];
const resizeMap = { const resizeMap = {
"Nearest Neighbour": jimp.RESIZE_NEAREST_NEIGHBOR, "Nearest Neighbour": Jimp.RESIZE_NEAREST_NEIGHBOR,
"Bilinear": jimp.RESIZE_BILINEAR, "Bilinear": Jimp.RESIZE_BILINEAR,
"Bicubic": jimp.RESIZE_BICUBIC, "Bicubic": Jimp.RESIZE_BICUBIC,
"Hermite": jimp.RESIZE_HERMITE, "Hermite": Jimp.RESIZE_HERMITE,
"Bezier": jimp.RESIZE_BEZIER "Bezier": Jimp.RESIZE_BEZIER
}; };
if (!isImage(input)) { if (!isImage(input)) {
@ -93,7 +93,7 @@ class ResizeImage extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error loading image. (${err})`); throw new OperationError(`Error loading image. (${err})`);
} }
@ -113,9 +113,9 @@ class ResizeImage extends Operation {
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -9,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Rotate Image operation * Rotate Image operation
@ -52,7 +52,7 @@ class RotateImage extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error loading image. (${err})`); throw new OperationError(`Error loading image. (${err})`);
} }
@ -63,9 +63,9 @@ class RotateImage extends Operation {
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -10,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Sharpen Image operation * Sharpen Image operation
@ -68,7 +68,7 @@ class SharpenImage extends Operation {
let image; let image;
try { try {
image = await jimp.read(input); image = await Jimp.read(input);
} catch (err) { } catch (err) {
throw new OperationError(`Error loading image. (${err})`); throw new OperationError(`Error loading image. (${err})`);
} }
@ -137,9 +137,9 @@ class SharpenImage extends Operation {
let imageBuffer; let imageBuffer;
if (image.getMIME() === "image/gif") { if (image.getMIME() === "image/gif") {
imageBuffer = await image.getBufferAsync(jimp.MIME_PNG); imageBuffer = await image.getBufferAsync(Jimp.MIME_PNG);
} else { } else {
imageBuffer = await image.getBufferAsync(jimp.AUTO); imageBuffer = await image.getBufferAsync(Jimp.AUTO);
} }
return imageBuffer.buffer; return imageBuffer.buffer;
} catch (err) { } catch (err) {

View file

@ -8,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* Split Colour Channels operation * Split Colour Channels operation
@ -41,7 +41,7 @@ class SplitColourChannels extends Operation {
// Make sure that the input is an image // Make sure that the input is an image
if (!isImage(input)) throw new OperationError("Invalid file type."); if (!isImage(input)) throw new OperationError("Invalid file type.");
const parsedImage = await jimp.read(Buffer.from(input)); const parsedImage = await Jimp.read(Buffer.from(input));
const red = new Promise(async (resolve, reject) => { const red = new Promise(async (resolve, reject) => {
try { try {
@ -51,7 +51,7 @@ class SplitColourChannels extends Operation {
{apply: "blue", params: [-255]}, {apply: "blue", params: [-255]},
{apply: "green", params: [-255]} {apply: "green", params: [-255]}
]) ])
.getBufferAsync(jimp.MIME_PNG); .getBufferAsync(Jimp.MIME_PNG);
resolve(new File([new Uint8Array((await split).values())], "red.png", {type: "image/png"})); resolve(new File([new Uint8Array((await split).values())], "red.png", {type: "image/png"}));
} catch (err) { } catch (err) {
reject(new OperationError(`Could not split red channel: ${err}`)); reject(new OperationError(`Could not split red channel: ${err}`));
@ -64,7 +64,7 @@ class SplitColourChannels extends Operation {
.color([ .color([
{apply: "red", params: [-255]}, {apply: "red", params: [-255]},
{apply: "blue", params: [-255]}, {apply: "blue", params: [-255]},
]).getBufferAsync(jimp.MIME_PNG); ]).getBufferAsync(Jimp.MIME_PNG);
resolve(new File([new Uint8Array((await split).values())], "green.png", {type: "image/png"})); resolve(new File([new Uint8Array((await split).values())], "green.png", {type: "image/png"}));
} catch (err) { } catch (err) {
reject(new OperationError(`Could not split green channel: ${err}`)); reject(new OperationError(`Could not split green channel: ${err}`));
@ -77,7 +77,7 @@ class SplitColourChannels extends Operation {
.color([ .color([
{apply: "red", params: [-255]}, {apply: "red", params: [-255]},
{apply: "green", params: [-255]}, {apply: "green", params: [-255]},
]).getBufferAsync(jimp.MIME_PNG); ]).getBufferAsync(Jimp.MIME_PNG);
resolve(new File([new Uint8Array((await split).values())], "blue.png", {type: "image/png"})); resolve(new File([new Uint8Array((await split).values())], "blue.png", {type: "image/png"}));
} catch (err) { } catch (err) {
reject(new OperationError(`Could not split blue channel: ${err}`)); reject(new OperationError(`Could not split blue channel: ${err}`));

View file

@ -9,7 +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 jimp from "jimp"; import Jimp from "jimp/es/index.js";
/** /**
* View Bit Plane operation * View Bit Plane operation
@ -52,7 +52,7 @@ class ViewBitPlane extends Operation {
if (!isImage(input)) throw new OperationError("Please enter a valid image file."); if (!isImage(input)) throw new OperationError("Please enter a valid image file.");
const [colour, bit] = args, const [colour, bit] = args,
parsedImage = await jimp.read(input), parsedImage = await Jimp.read(input),
width = parsedImage.bitmap.width, width = parsedImage.bitmap.width,
height = parsedImage.bitmap.height, height = parsedImage.bitmap.height,
colourIndex = COLOUR_OPTIONS.indexOf(colour), colourIndex = COLOUR_OPTIONS.indexOf(colour),
@ -78,7 +78,7 @@ class ViewBitPlane extends Operation {
}); });
const imageBuffer = await parsedImage.getBufferAsync(jimp.AUTO); const imageBuffer = await parsedImage.getBufferAsync(Jimp.AUTO);
return new Uint8Array(imageBuffer).buffer; return new Uint8Array(imageBuffer).buffer;
} }

View file

@ -3199,7 +3199,7 @@ const REG = [
REG index 10 Intel MM qword technology MMX vector instructions. REG index 10 Intel MM qword technology MMX vector instructions.
--------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------
These can not be used with Vector length adjustment used in vector extensions. The MM register are the ST registers aliased These can not be used with Vector length adjustment used in vector extensions. The MM register are the ST registers aliased
to MM register. Instructions that use these registers use the the SIMD vector unit registers (MM), these are called the old to MM register. Instructions that use these registers use the SIMD vector unit registers (MM), these are called the old
MMX vector instructions. When Intel added the SSE instructions to the SIMD math vector unit the new 128 bit XMM registers, MMX vector instructions. When Intel added the SSE instructions to the SIMD math vector unit the new 128 bit XMM registers,
are added into the SIMD unit then they ware made longer in size 256, then 512 across in length, with 1024 (?MM Reserved) are added into the SIMD unit then they ware made longer in size 256, then 512 across in length, with 1024 (?MM Reserved)
In which the vector length setting was added to control there size though vector setting adjustment codes. Instruction In which the vector length setting was added to control there size though vector setting adjustment codes. Instruction
@ -3784,7 +3784,7 @@ function GotoPosition( Address )
/*------------------------------------------------------------------------------------------------------------------------- /*-------------------------------------------------------------------------------------------------------------------------
Finds bit positions to the Size attribute indexes in REG array, and the Pointer Array. For the Size Attribute variations. Finds bit positions to the Size attribute indexes in REG array, and the Pointer Array. For the Size Attribute variations.
--------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------
The SizeAttribute settings is 8 digits big consisting of 1, or 0 to specify the the extended size that an operand can be made. The SizeAttribute settings is 8 digits big consisting of 1, or 0 to specify the extended size that an operand can be made.
In which an value of 01100100 is decoded as "0 = 1024, 1 = 512, 1 = 256, 0 = 128, 0 = 64, 1 = 32, 0 = 16, 0 = 8". In which an value of 01100100 is decoded as "0 = 1024, 1 = 512, 1 = 256, 0 = 128, 0 = 64, 1 = 32, 0 = 16, 0 = 8".
In which the largest bit position is 512, and is the 6th number "0 = 7, 1 = 6, 1 = 5, 0 = 4, 0 = 3, 1 = 2, 0 = 1, 0 = 0". In which the largest bit position is 512, and is the 6th number "0 = 7, 1 = 6, 1 = 5, 0 = 4, 0 = 3, 1 = 2, 0 = 1, 0 = 0".
In which 6 is the bit position for 512 as the returned Size . Each size is in order from 0 to 7, thus the size given back In which 6 is the bit position for 512 as the returned Size . Each size is in order from 0 to 7, thus the size given back

View file

@ -271,7 +271,7 @@ class Manager {
* @param {Object} [scope=this] - The object to bind to the callback function * @param {Object} [scope=this] - The object to bind to the callback function
* *
* @example * @example
* // Calls the search function whenever the the keyup, paste or search events are triggered on the * // Calls the search function whenever the keyup, paste or search events are triggered on the
* // search element * // search element
* this.addMultiEventListener("search", "keyup paste search", this.search, this); * this.addMultiEventListener("search", "keyup paste search", this.search, this);
*/ */
@ -292,7 +292,7 @@ class Manager {
* @param {Object} [scope=this] - The object to bind to the callback function * @param {Object} [scope=this] - The object to bind to the callback function
* *
* @example * @example
* // Calls the save function whenever the the keyup or paste events are triggered on any element * // Calls the save function whenever the keyup or paste events are triggered on any element
* // with the .saveable class * // with the .saveable class
* this.addMultiEventListener(".saveable", "keyup paste", this.save, this); * this.addMultiEventListener(".saveable", "keyup paste", this.save, this);
*/ */

View file

@ -189,7 +189,7 @@ TestRegister.addTests([
recipeConfig: [ recipeConfig: [
{ {
"op": "JPath expression", "op": "JPath expression",
"args": ["", "\n", true] "args": ["", "\n"]
} }
], ],
}, },
@ -205,7 +205,7 @@ TestRegister.addTests([
recipeConfig: [ recipeConfig: [
{ {
"op": "JPath expression", "op": "JPath expression",
"args": ["$.store.book[*].author", "\n", true] "args": ["$.store.book[*].author", "\n"]
} }
], ],
}, },
@ -223,7 +223,7 @@ TestRegister.addTests([
recipeConfig: [ recipeConfig: [
{ {
"op": "JPath expression", "op": "JPath expression",
"args": ["$..title", "\n", true] "args": ["$..title", "\n"]
} }
], ],
}, },
@ -238,7 +238,7 @@ TestRegister.addTests([
recipeConfig: [ recipeConfig: [
{ {
"op": "JPath expression", "op": "JPath expression",
"args": ["$.store.*", "\n", true] "args": ["$.store.*", "\n"]
} }
], ],
}, },
@ -249,7 +249,7 @@ TestRegister.addTests([
recipeConfig: [ recipeConfig: [
{ {
"op": "JPath expression", "op": "JPath expression",
"args": ["$..book[-1:]", "\n", true] "args": ["$..book[-1:]", "\n"]
} }
], ],
}, },
@ -263,7 +263,7 @@ TestRegister.addTests([
recipeConfig: [ recipeConfig: [
{ {
"op": "JPath expression", "op": "JPath expression",
"args": ["$..book[:2]", "\n", true] "args": ["$..book[:2]", "\n"]
} }
], ],
}, },
@ -277,7 +277,7 @@ TestRegister.addTests([
recipeConfig: [ recipeConfig: [
{ {
"op": "JPath expression", "op": "JPath expression",
"args": ["$..book[?(@.isbn)]", "\n", false] "args": ["$..book[?(@.isbn)]", "\n"]
} }
], ],
}, },
@ -292,7 +292,7 @@ TestRegister.addTests([
recipeConfig: [ recipeConfig: [
{ {
"op": "JPath expression", "op": "JPath expression",
"args": ["$..book[?(@.price<30 && @.category==\"fiction\")]", "\n", false] "args": ["$..book[?(@.price<30 && @.category==\"fiction\")]", "\n"]
} }
], ],
}, },
@ -306,7 +306,7 @@ TestRegister.addTests([
recipeConfig: [ recipeConfig: [
{ {
"op": "JPath expression", "op": "JPath expression",
"args": ["$..book[?(@.price<10)]", "\n", false] "args": ["$..book[?(@.price<10)]", "\n"]
} }
], ],
}, },
@ -318,12 +318,11 @@ TestRegister.addTests([
"op": "JPath expression", "op": "JPath expression",
"args": [ "args": [
"$..[?(({__proto__:[].constructor}).constructor(\"self.postMessage({action:'bakeComplete',data:{bakeId:1,dish:{type:1,value:''},duration:1,error:false,id:undefined,inputNum:2,progress:1,result:'<iframe/onload=debugger>',type: 'html'}});\")();)]", "$..[?(({__proto__:[].constructor}).constructor(\"self.postMessage({action:'bakeComplete',data:{bakeId:1,dish:{type:1,value:''},duration:1,error:false,id:undefined,inputNum:2,progress:1,result:'<iframe/onload=debugger>',type: 'html'}});\")();)]",
"\n", "\n"
true
] ]
} }
], ],
expectedOutput: "Invalid JPath expression: Eval [?(expr)] prevented in JSONPath expression." expectedMatch: /^Invalid JPath expression: jsonPath: self is not defined:/
}, },
{ {
name: "CSS selector", name: "CSS selector",

View file

@ -22,7 +22,7 @@ export const PNG_HEX = "89504e470d0a1a0a0000000d49484452000000200000002008060000
* The CyberChef logo with 'chef' * The CyberChef logo with 'chef'
* 32x32 * 32x32
*/ */
export const PNG_CHEF_B64 = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAH40lEQVR4AaXBfVAU5wEH4N/77t7ufXAnHlwE5MuK1uApVo1ppNBxgpJKKyijaewYJzRj0eokjBpbp3HQ0VpN1fqHndCxNkW4UWf8KHZaa0yR1hPH04QGGwm9Ata7KN/c5m5v9+52t8tIp1QPJOnzEHw5TF1dnTMlJWVxOBxmfD7fjY0bN34EQAVAAWgAVEwAwcQQABSAtmXLFltlZeW7iYmJqwVBQCgUogA0QRAuDg4OfuxwOEpkWW5dunRpBQAFT8FifOTcuXPPz5w5cxPP87mqqoYAmKxW63N4RMUjxGazrbBard8hOp7ncziOe7O2tnaJ0Wi0l5WVnQCgIg6CsRG3270pOzv7CCHEgDgCgYAaCoUo4pAk6T7P81Oh8/l8FStXrvwt4mAxhnPnzi3Myso6Qggx4EswGo0ZeERTVRVjoYiPzJgxYyOl1ID/kyzLPevWrbsAgCAOBvExVVVVOzmOm4pxRCIRRCIRgnGwLJvwim7NmjUZdXV17+MxLOLTdBKejmACjEZjlqIoLwCgABSMQhGfGgqFmvB0GiZAlmV/OBz2AFDxGAZjyMzMvOt0OtcyDGPFiEgkAkVRwDAMhkmSpEWjUYJxyLLcU1xcnHvixIkGABpGEEIM6enpLxCMkpOT82JpaenLHMc9IwiCv6CgoG3RokWbjUbjTOh4nofX60VGRgaGBQIBNRQKUTyFz+fbWFZW9i5GmM3m9IaGhsb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Dw7K409VF/tjWpoiiCL1eL61bt45REahisdhfmpubLwK4iBmwSE75UcvDk5tecVzKmKd7k+V0vwRgppTCodNh8NEjhIeHIQ0MKG63W3E6nXC73QxRQcVx3BOPx/NzzAGLGZzv6B8A0PCdQW80S9D/jNNoXBqeh+vllzEh1tenWLxeijiSJD0NhUI/uHbtmgdzwGAO6hoa7sqy/LuchQtHeY57iWWYFKiGxsaUkVCIQCVJUm8oFDpy8+bNqr1793ZgjgheEKWUu37+/JIF8+cv/dznM/d4vWOqu4cPH+54/PjxOF7QfwCiFwbr9BCaBwAAAABJRU5ErkJggg==";
/** /**
* The CyberChef logo with blur * The CyberChef logo with blur

View file

@ -1,7 +1,7 @@
const webpack = require("webpack"); const webpack = require("webpack");
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin"); const CopyWebpackPlugin = require("copy-webpack-plugin");
const { ModifySourcePlugin } = require("modify-source-webpack-plugin"); const { ModifySourcePlugin, ReplaceOperation } = require("modify-source-webpack-plugin");
const path = require("path"); const path = require("path");
/** /**
@ -12,13 +12,14 @@ const path = require("path");
* @license Apache-2.0 * @license Apache-2.0
*/ */
const d = new Date();
const banner = `/** const banner = `/**
* CyberChef - The Cyber Swiss Army Knife * CyberChef - The Cyber Swiss Army Knife
* *
* @copyright Crown Copyright 2016 * @copyright Crown Copyright 2016-${d.getUTCFullYear()}
* @license Apache-2.0 * @license Apache-2.0
* *
* Copyright 2016 Crown Copyright * Copyright 2016-${d.getUTCFullYear()} Crown Copyright
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -89,8 +90,9 @@ module.exports = {
{ {
// Fix toSpare(0) bug in Split.js by avoiding gutter accomodation // Fix toSpare(0) bug in Split.js by avoiding gutter accomodation
test: /split\.es\.js$/, test: /split\.es\.js$/,
modify: (src, path) => operations: [
src.replace("if (pixelSize < elementMinSize)", "if (false)") new ReplaceOperation("once", "if (pixelSize < elementMinSize)", "if (false)")
]
} }
] ]
}) })
@ -110,7 +112,8 @@ module.exports = {
"crypto": require.resolve("crypto-browserify"), "crypto": require.resolve("crypto-browserify"),
"stream": require.resolve("stream-browserify"), "stream": require.resolve("stream-browserify"),
"zlib": require.resolve("browserify-zlib"), "zlib": require.resolve("browserify-zlib"),
"process": false "process": false,
"vm": false
} }
}, },
module: { module: {