OperationConfig now loaded into App via value-loader so that operation code is only included in the worker

This commit is contained in:
n1474335 2017-07-16 23:33:47 +01:00
parent 760ab688b2
commit cc3aad17e1
6 changed files with 4000 additions and 1237 deletions

5162
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,8 @@
"babel-core": "^6.24.0",
"babel-loader": "^6.4.0",
"babel-polyfill": "^6.23.0",
"babel-preset-env": "^1.2.2",
"babel-preset-env": "^1.6.0",
"babel-regenerator-runtime": "^6.5.0",
"css-loader": "^0.27.3",
"exports-loader": "^0.6.4",
"extract-text-webpack-plugin": "^2.1.0",
@ -48,7 +49,7 @@
"grunt-execute": "^0.2.2",
"grunt-jsdoc": "^2.1.0",
"grunt-webpack": "^2.0.1",
"html-webpack-plugin": "^2.28.0",
"html-webpack-plugin": "^2.29.0",
"imports-loader": "^0.7.1",
"ink-docstrap": "^1.1.4",
"jsdoc-babel": "^0.3.0",
@ -59,6 +60,7 @@
"postcss-loader": "^2.0.5",
"style-loader": "^0.15.0",
"url-loader": "^0.5.8",
"value-loader": "^0.1.3",
"web-resource-inliner": "^4.1.0",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.5.0",

View File

@ -0,0 +1,23 @@
/**
* Re-exports OperationConfig in value-loader format without the run function
* allowing the web app to access metadata about operations without having to
* import all the dependencies.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2017
* @license Apache-2.0
*/
import "babel-regenerator-runtime";
import Utils from "../Utils.js";
import OperationConfig from "./OperationConfig.js";
// Remove the run function from each operation config
for (let opConf in OperationConfig) {
delete OperationConfig[opConf].run;
}
// Export a string version of the meta config so that it can be imported using
// value-loader without any of the dependencies.
export default "module.exports = " + JSON.stringify(OperationConfig) + ";";

View File

@ -2291,7 +2291,7 @@ const OperationConfig = {
}
]
},
"Windows Filetime to UNIX Timestamp":{
"Windows Filetime to UNIX Timestamp": {
description: "Converts a Windows Filetime value to a UNIX timestamp.<br><br>A Windows Filetime is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 UTC.<br><br>A UNIX timestamp is a 32-bit value representing the number of seconds since January 1, 1970 UTC (the UNIX epoch).<br><br>This operation also supports UNIX timestamps in milliseconds, microseconds and nanoseconds.",
run: DateTime.runFromFiletimeToUnix,
inputType: "string",
@ -2304,7 +2304,7 @@ const OperationConfig = {
}
]
},
"UNIX Timestamp to Windows Filetime":{
"UNIX Timestamp to Windows Filetime": {
description: "Converts a UNIX timestamp to a Windows Filetime value.<br><br>A Windows Filetime is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 UTC.<br><br>A UNIX timestamp is a 32-bit value representing the number of seconds since January 1, 1970 UTC (the UNIX epoch).<br><br>This operation also supports UNIX timestamps in milliseconds, microseconds and nanoseconds.",
run: DateTime.runToFiletimeFromUnix,
inputType: "string",

View File

@ -17,7 +17,7 @@ import CanvasComponents from "../core/lib/canvascomponents.js";
// CyberChef
import App from "./App.js";
import Categories from "../core/config/Categories.js";
import OperationConfig from "../core/config/OperationConfig.js";
import OperationConfig from "value-loader?name=default!../core/config/MetaConfig.js";
/**

View File

@ -9,26 +9,26 @@ const ExtractTextPlugin = require("extract-text-webpack-plugin");
* @license Apache-2.0
*/
const banner = "/**\n" +
"* CyberChef - The Cyber Swiss Army Knife\n" +
"*\n" +
"* @copyright Crown Copyright 2016\n" +
"* @license Apache-2.0\n" +
"*\n" +
"* Copyright 2016 Crown Copyright\n" +
"*\n" +
'* Licensed under the Apache License, Version 2.0 (the "License");\n' +
"* you may not use this file except in compliance with the License.\n" +
"* You may obtain a copy of the License at\n" +
"*\n" +
"* http://www.apache.org/licenses/LICENSE-2.0\n" +
"*\n" +
"* Unless required by applicable law or agreed to in writing, software\n" +
'* distributed under the License is distributed on an "AS IS" BASIS,\n' +
"* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
"* See the License for the specific language governing permissions and\n" +
"* limitations under the License.\n" +
"*/\n";
const banner = `/**
* CyberChef - The Cyber Swiss Army Knife
*
* @copyright Crown Copyright 2016
* @license Apache-2.0
*
* Copyright 2016 Crown Copyright
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/`;
module.exports = {
plugins: [