Do not mangle names on minification for Node prod build - property names are used for search in bake
This commit is contained in:
parent
25e0585742
commit
48f3a3b18f
40
Gruntfile.js
40
Gruntfile.js
@ -6,6 +6,7 @@ const NodeExternals = require("webpack-node-externals");
|
||||
const Inliner = require("web-resource-inliner");
|
||||
const glob = require("glob");
|
||||
const path = require("path");
|
||||
const UglifyJSWebpackPlugin = require("uglifyjs-webpack-plugin");
|
||||
|
||||
/**
|
||||
* Grunt configuration for building the app in various formats.
|
||||
@ -26,7 +27,7 @@ module.exports = function (grunt) {
|
||||
|
||||
grunt.registerTask("node",
|
||||
"Compiles CyberChef into a single NodeJS module.",
|
||||
["clean", "exec:generateConfig", "exec:generateNodeIndex", "webpack:node", "chmod:build"]);
|
||||
["clean", "exec:generateConfig", "exec:generateNodeIndex", "webpack:node", "webpack:nodeRepl", "chmod:build"]);
|
||||
|
||||
grunt.registerTask("test",
|
||||
"A task which runs all the tests in test/tests.",
|
||||
@ -267,6 +268,43 @@ module.exports = function (grunt) {
|
||||
plugins: [
|
||||
new webpack.DefinePlugin(BUILD_CONSTANTS)
|
||||
],
|
||||
// Need to preserve property names for bake, search
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new UglifyJSWebpackPlugin({
|
||||
uglifyOptions: {
|
||||
mangle: false,
|
||||
}
|
||||
})
|
||||
]
|
||||
},
|
||||
},
|
||||
nodeRepl: {
|
||||
mode: "production",
|
||||
target: "node",
|
||||
entry: "./src/node/repl-index.mjs",
|
||||
externals: [NodeExternals({
|
||||
whitelist: ["crypto-api/src/crypto-api"]
|
||||
})],
|
||||
output: {
|
||||
filename: "CyberChef-repl.js",
|
||||
path: __dirname + "/build/node",
|
||||
library: "CyberChef",
|
||||
libraryTarget: "commonjs2"
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin(BUILD_CONSTANTS)
|
||||
],
|
||||
// Need to preserve property names for bake, search
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new UglifyJSWebpackPlugin({
|
||||
uglifyOptions: {
|
||||
mangle: false,
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"webpack-dev-server": {
|
||||
|
4340
package-lock.json
generated
4340
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -66,6 +66,7 @@
|
||||
"sass-loader": "^7.1.0",
|
||||
"sitemap": "^1.13.0",
|
||||
"style-loader": "^0.21.0",
|
||||
"uglifyjs-webpack-plugin": "^2.0.1",
|
||||
"url-loader": "^1.0.1",
|
||||
"web-resource-inliner": "^4.2.1",
|
||||
"webpack": "^4.16.4",
|
||||
|
@ -7,9 +7,7 @@
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import { operations } from "./index";
|
||||
import chef from "./index";
|
||||
import { decapitalise } from "./apiUtils";
|
||||
import repl from "repl";
|
||||
import "babel-polyfill";
|
||||
|
||||
@ -28,10 +26,9 @@ const replServer = repl.start({
|
||||
prompt: "chef > ",
|
||||
});
|
||||
|
||||
operations.forEach((op) => {
|
||||
replServer.context[decapitalise(op.opName)] = op;
|
||||
Object.keys(chef).forEach((key) => {
|
||||
if (key !== "operations") {
|
||||
replServer.context[key] = chef[key];
|
||||
}
|
||||
});
|
||||
|
||||
replServer.context.help = chef.help;
|
||||
replServer.context.bake = chef.bake;
|
||||
replServer.context.Dish = chef.Dish;
|
||||
|
Loading…
x
Reference in New Issue
Block a user