Преглед изворни кода

Converted all modules from CommonJS to ES6

n1474335 пре 8 година
родитељ
комит
131b3a83c1
75 измењених фајлова са 395 додато и 282 уклоњено
  1. 2 1
      .babelrc
  2. 2 2
      src/.eslintrc.json
  3. 5 3
      src/core/Chef.js
  4. 4 2
      src/core/Dish.js
  5. 5 3
      src/core/FlowControl.js
  6. 4 2
      src/core/Ingredient.js
  7. 5 3
      src/core/Operation.js
  8. 4 7
      src/core/Recipe.js
  9. 4 2
      src/core/Utils.js
  10. 3 1
      src/core/config/Categories.js
  11. 41 39
      src/core/config/OperationConfig.js
  12. 3 1
      src/core/lib/canvascomponents.js
  13. 7 5
      src/core/lib/uas_parser.js
  14. 3 1
      src/core/operations/Base.js
  15. 4 2
      src/core/operations/Base58.js
  16. 4 2
      src/core/operations/Base64.js
  17. 5 3
      src/core/operations/BitwiseOp.js
  18. 4 2
      src/core/operations/ByteRepr.js
  19. 5 3
      src/core/operations/CharEnc.js
  20. 4 2
      src/core/operations/Checksum.js
  21. 6 4
      src/core/operations/Cipher.js
  22. 16 14
      src/core/operations/Code.js
  23. 10 8
      src/core/operations/Compress.js
  24. 3 1
      src/core/operations/Convert.js
  25. 3 2
      src/core/operations/DateTime.js
  26. 4 2
      src/core/operations/Endian.js
  27. 4 2
      src/core/operations/Entropy.js
  28. 3 1
      src/core/operations/Extract.js
  29. 4 2
      src/core/operations/FileType.js
  30. 4 2
      src/core/operations/HTML.js
  31. 4 2
      src/core/operations/HTTP.js
  32. 7 5
      src/core/operations/Hash.js
  33. 4 2
      src/core/operations/Hexdump.js
  34. 6 5
      src/core/operations/IP.js
  35. 6 4
      src/core/operations/JS.js
  36. 3 1
      src/core/operations/MAC.js
  37. 4 2
      src/core/operations/MorseCode.js
  38. 3 1
      src/core/operations/NetBIOS.js
  39. 3 1
      src/core/operations/Numberwang.js
  40. 3 1
      src/core/operations/OS.js
  41. 5 3
      src/core/operations/PublicKey.js
  42. 4 2
      src/core/operations/Punycode.js
  43. 3 1
      src/core/operations/QuotedPrintable.js
  44. 3 1
      src/core/operations/Rotate.js
  45. 4 2
      src/core/operations/SeqUtils.js
  46. 5 3
      src/core/operations/StrUtils.js
  47. 4 2
      src/core/operations/Tidy.js
  48. 4 2
      src/core/operations/URL.js
  49. 3 1
      src/core/operations/UUID.js
  50. 4 2
      src/core/operations/Unicode.js
  51. 2 2
      src/node/index.js
  52. 36 34
      src/web/App.js
  53. 5 3
      src/web/ControlsWaiter.js
  54. 3 1
      src/web/HTMLCategory.js
  55. 4 2
      src/web/HTMLIngredient.js
  56. 5 3
      src/web/HTMLOperation.js
  57. 5 3
      src/web/HighlighterWaiter.js
  58. 5 3
      src/web/InputWaiter.js
  59. 13 11
      src/web/Manager.js
  60. 6 4
      src/web/OperationsWaiter.js
  61. 4 2
      src/web/OptionsWaiter.js
  62. 5 3
      src/web/OutputWaiter.js
  63. 6 4
      src/web/RecipeWaiter.js
  64. 4 2
      src/web/SeasonalWaiter.js
  65. 4 2
      src/web/WindowWaiter.js
  66. 8 8
      src/web/css/index.js
  67. 1 1
      src/web/css/lib/bootstrap.less
  68. 5 5
      src/web/index.js
  69. 4 2
      test/TestRegister.js
  70. 8 15
      test/TestRunner.js
  71. 1 1
      test/tests/operations/Base58.js
  72. 1 1
      test/tests/operations/Compress.js
  73. 1 1
      test/tests/operations/FlowControl.js
  74. 1 1
      test/tests/operations/MorseCode.js
  75. 1 1
      test/tests/operations/StrUtils.js

+ 2 - 1
.babelrc

@@ -5,7 +5,8 @@
                 "chrome": 40,
                 "firefox": 35,
                 "edge": 14
-            }
+            },
+            "modules": false
         }]
     ]
 }

+ 2 - 2
src/.eslintrc.json

@@ -3,12 +3,12 @@
         "ecmaVersion": 6,
         "ecmaFeatures": {
             "impliedStrict": true
-        }
+        },
+        "sourceType": "module"
     },
     "env": {
         "browser": true,
         "es6": true,
-        "commonjs": true,
         "node": true
     },
     "extends": "eslint:recommended",

+ 5 - 3
src/core/Chef.js

@@ -1,5 +1,5 @@
-var Dish = require("./Dish.js"),
-    Recipe = require("./Recipe.js");
+import Dish from "./Dish.js";
+import Recipe from "./Recipe.js";
 
 
 /**
@@ -11,7 +11,7 @@ var Dish = require("./Dish.js"),
  *
  * @class
  */
-var Chef = module.exports = function() {
+var Chef = function() {
     this.dish = new Dish();
 };
 
@@ -122,3 +122,5 @@ Chef.prototype.silentBake = function(recipeConfig) {
     }
     return new Date().getTime() - startTime;
 };
+
+export default Chef;

+ 4 - 2
src/core/Dish.js

@@ -1,4 +1,4 @@
-var Utils = require("./Utils.js");
+import Utils from "./Utils.js";
 
 
 /**
@@ -12,7 +12,7 @@ var Utils = require("./Utils.js");
  * @param {byteArray|string|number} value - The value of the input data.
  * @param {number} type - The data type of value, see Dish enums.
  */
-var Dish = module.exports = function(value, type) {
+var Dish = function(value, type) {
     this.value = value || typeof value == "string" ? value : null;
     this.type  = type || Dish.BYTE_ARRAY;
 };
@@ -203,3 +203,5 @@ Dish.prototype.valid = function() {
             return false;
     }
 };
+
+export default Dish;

+ 5 - 3
src/core/FlowControl.js

@@ -1,5 +1,5 @@
-var Recipe = require("./Recipe.js"),
-    Dish = require("./Dish.js");
+import Recipe from "./Recipe.js";
+import Dish from "./Dish.js";
 
 
 /**
@@ -11,7 +11,7 @@ var Recipe = require("./Recipe.js"),
  *
  * @namespace
  */
-var FlowControl = module.exports = {
+const FlowControl = {
 
     /**
      * @constant
@@ -186,3 +186,5 @@ var FlowControl = module.exports = {
     },
 
 };
+
+export default FlowControl;

+ 4 - 2
src/core/Ingredient.js

@@ -1,4 +1,4 @@
-var Utils = require("./Utils.js");
+import Utils from "./Utils.js";
 
 
 /**
@@ -11,7 +11,7 @@ var Utils = require("./Utils.js");
  * @class
  * @param {Object} ingredientConfig
  */
-var Ingredient = module.exports = function(ingredientConfig) {
+var Ingredient = function(ingredientConfig) {
     this.name  = "";
     this.type  = "";
     this.value = null;
@@ -86,3 +86,5 @@ Ingredient.prepare = function(data, type) {
             return data;
     }
 };
+
+export default Ingredient;

+ 5 - 3
src/core/Operation.js

@@ -1,5 +1,5 @@
-var Dish = require("./Dish.js"),
-    Ingredient = require("./Ingredient.js");
+import Dish from "./Dish.js";
+import Ingredient from "./Ingredient.js";
 
 
 /**
@@ -13,7 +13,7 @@ var Dish = require("./Dish.js"),
  * @param {string} operationName
  * @param {Object} operationConfig
  */
-var Operation = module.exports = function(operationName, operationConfig) {
+var Operation = function(operationName, operationConfig) {
     this.name             = operationName;
     this.description      = "";
     this.inputType        = -1;
@@ -159,3 +159,5 @@ Operation.prototype.isDisabled = function() {
 Operation.prototype.isFlowControl = function() {
     return this.flowControl;
 };
+
+export default Operation;

+ 4 - 7
src/core/Recipe.js

@@ -1,5 +1,5 @@
-var Operation = require("./Operation.js");
-// OperationConfig required at the bottom of this file to prevent circular dependency errors
+import Operation from "./Operation.js";
+import OperationConfig from "./config/OperationConfig.js";
 
 
 /**
@@ -12,7 +12,7 @@ var Operation = require("./Operation.js");
  * @class
  * @param {Object} recipeConfig
  */
-var Recipe = module.exports = function(recipeConfig) {
+var Recipe = function(recipeConfig) {
     this.opList = [];
 
     if (recipeConfig) {
@@ -217,7 +217,4 @@ Recipe.prototype.fromString = function(recipeStr) {
     this._parseConfig(recipeConfig);
 };
 
-
-// Required here to prevent circular dependency where Recipe returns an empty object
-// See http://stackoverflow.com/a/30390378
-var OperationConfig = require("./config/OperationConfig.js");
+export default Recipe;

+ 4 - 2
src/core/Utils.js

@@ -1,4 +1,4 @@
-var CryptoJS = require("crypto-js");
+import CryptoJS from "crypto-js";
 
 
 /**
@@ -10,7 +10,7 @@ var CryptoJS = require("crypto-js");
  *
  * @namespace
  */
-var Utils = module.exports = {
+const Utils = {
 
     /**
      * Translates an ordinal into a character.
@@ -1169,6 +1169,8 @@ var Utils = module.exports = {
 
 };
 
+export default Utils;
+
 
 /**
  * Removes all duplicates from an array.

+ 3 - 1
src/core/config/Categories.js

@@ -17,7 +17,7 @@
  * @constant
  * @type {CatConf[]}
  */
-var Categories = module.exports = [
+const Categories = [
     {
         name: "Favourites",
         ops: []
@@ -291,3 +291,5 @@ var Categories = module.exports = [
         ]
     },
 ];
+
+export default Categories;

+ 41 - 39
src/core/config/OperationConfig.js

@@ -1,41 +1,41 @@
-var FlowControl     = require("../FlowControl.js"),
-    Base            = require("../operations/Base.js"),
-    Base58          = require("../operations/Base58.js"),
-    Base64          = require("../operations/Base64.js"),
-    BitwiseOp       = require("../operations/BitwiseOp.js"),
-    ByteRepr        = require("../operations/ByteRepr.js"),
-    CharEnc         = require("../operations/CharEnc.js"),
-    Checksum        = require("../operations/Checksum.js"),
-    Cipher          = require("../operations/Cipher.js"),
-    Code            = require("../operations/Code.js"),
-    Compress        = require("../operations/Compress.js"),
-    Convert         = require("../operations/Convert.js"),
-    DateTime        = require("../operations/DateTime.js"),
-    Endian          = require("../operations/Endian.js"),
-    Entropy         = require("../operations/Entropy.js"),
-    Extract         = require("../operations/Extract.js"),
-    FileType        = require("../operations/FileType.js"),
-    Hash            = require("../operations/Hash.js"),
-    Hexdump         = require("../operations/Hexdump.js"),
-    HTML            = require("../operations/HTML.js"),
-    HTTP            = require("../operations/HTTP.js"),
-    IP              = require("../operations/IP.js"),
-    JS              = require("../operations/JS.js"),
-    MAC             = require("../operations/MAC.js"),
-    MorseCode       = require("../operations/MorseCode.js"),
-    NetBIOS         = require("../operations/NetBIOS.js"),
-    Numberwang      = require("../operations/Numberwang.js"),
-    OS              = require("../operations/OS.js"),
-    PublicKey       = require("../operations/PublicKey.js"),
-    Punycode        = require("../operations/Punycode.js"),
-    QuotedPrintable = require("../operations/QuotedPrintable.js"),
-    Rotate          = require("../operations/Rotate.js"),
-    SeqUtils        = require("../operations/SeqUtils.js"),
-    StrUtils        = require("../operations/StrUtils.js"),
-    Tidy            = require("../operations/Tidy.js"),
-    Unicode         = require("../operations/Unicode.js"),
-    URL_            = require("../operations/URL.js"),
-    UUID            = require("../operations/UUID.js");
+import FlowControl from "../FlowControl.js";
+import Base from "../operations/Base.js";
+import Base58 from "../operations/Base58.js";
+import Base64 from "../operations/Base64.js";
+import BitwiseOp from "../operations/BitwiseOp.js";
+import ByteRepr from "../operations/ByteRepr.js";
+import CharEnc from "../operations/CharEnc.js";
+import Checksum from "../operations/Checksum.js";
+import Cipher from "../operations/Cipher.js";
+import Code from "../operations/Code.js";
+import Compress from "../operations/Compress.js";
+import Convert from "../operations/Convert.js";
+import DateTime from "../operations/DateTime.js";
+import Endian from "../operations/Endian.js";
+import Entropy from "../operations/Entropy.js";
+import Extract from "../operations/Extract.js";
+import FileType from "../operations/FileType.js";
+import Hash from "../operations/Hash.js";
+import Hexdump from "../operations/Hexdump.js";
+import HTML from "../operations/HTML.js";
+import HTTP from "../operations/HTTP.js";
+import IP from "../operations/IP.js";
+import JS from "../operations/JS.js";
+import MAC from "../operations/MAC.js";
+import MorseCode from "../operations/MorseCode.js";
+import NetBIOS from "../operations/NetBIOS.js";
+import Numberwang from "../operations/Numberwang.js";
+import OS from "../operations/OS.js";
+import PublicKey from "../operations/PublicKey.js";
+import Punycode from "../operations/Punycode.js";
+import QuotedPrintable from "../operations/QuotedPrintable.js";
+import Rotate from "../operations/Rotate.js";
+import SeqUtils from "../operations/SeqUtils.js";
+import StrUtils from "../operations/StrUtils.js";
+import Tidy from "../operations/Tidy.js";
+import Unicode from "../operations/Unicode.js";
+import URL_ from "../operations/URL.js";
+import UUID from "../operations/UUID.js";
 
 
 /**
@@ -78,7 +78,7 @@ var FlowControl     = require("../FlowControl.js"),
  * @constant
  * @type {Object.<string, OpConf>}
  */
-var OperationConfig = module.exports = {
+const OperationConfig = {
     "Fork": {
         description: "Split the input data up based on the specified delimiter and run all subsequent operations on each branch separately.<br><br>For example, to decode multiple Base64 strings, enter them all on separate lines then add the 'Fork' and 'From Base64' operations to the recipe. Each string will be decoded separately.",
         run: FlowControl.runFork,
@@ -3168,3 +3168,5 @@ var OperationConfig = module.exports = {
         ]
     }
 };
+
+export default OperationConfig;

+ 3 - 1
src/core/lib/canvascomponents.js

@@ -10,7 +10,7 @@
  * @constant
  * @namespace
  */
-var CanvasComponents = module.exports = {
+const CanvasComponents = {
 
     drawLine: function(ctx, startX, startY, endX, endY) {
         ctx.beginPath();
@@ -182,3 +182,5 @@ var CanvasComponents = module.exports = {
     },
 
 };
+
+export default CanvasComponents;

+ 7 - 5
src/core/lib/uas_parser.js

@@ -24,11 +24,10 @@
   OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
   WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
-"use strict";
 
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
-var UAS_parser = {
+const UAS_parser = {
 	
 	parse: function (userAgent) {
 		var result = {
@@ -135,7 +134,7 @@ var UAS_parser = {
 	}
 };
 
-var UAS_cache = {
+const UAS_cache = {
 	version: '20131025-01',
 	robots: {
 		'3': {
@@ -25816,4 +25815,7 @@ var UAS_cache = {
 			'35'
 		]
 	}
-};
+};
+
+export {UAS_parser, UAS_cache};
+export default UAS_parser;

+ 3 - 1
src/core/operations/Base.js

@@ -7,7 +7,7 @@
  *
  * @namespace
  */
-var Base = module.exports = {
+const Base = {
 
     /**
      * @constant
@@ -50,3 +50,5 @@ var Base = module.exports = {
     },
 
 };
+
+export default Base;

+ 4 - 2
src/core/operations/Base58.js

@@ -1,4 +1,4 @@
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
 
 /**
@@ -10,7 +10,7 @@ var Utils = require("../Utils.js");
  *
  * @namespace
  */
-var Base58 = module.exports = {
+const Base58 = {
 
     /**
      * @constant
@@ -133,3 +133,5 @@ var Base58 = module.exports = {
     },
 
 };
+
+export default Base58;

+ 4 - 2
src/core/operations/Base64.js

@@ -1,4 +1,4 @@
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
 
 /**
@@ -10,7 +10,7 @@ var Utils = require("../Utils.js");
  *
  * @namespace
  */
-var Base64 = module.exports = {
+const Base64 = {
 
     /**
      * @constant
@@ -342,3 +342,5 @@ var Base64 = module.exports = {
     },
 
 };
+
+export default Base64;

+ 5 - 3
src/core/operations/BitwiseOp.js

@@ -1,5 +1,5 @@
-var Utils = require("../Utils.js"),
-    CryptoJS = require("crypto-js");
+import Utils from "../Utils.js";
+import CryptoJS from "crypto-js";
 
 
 /**
@@ -11,7 +11,7 @@ var Utils = require("../Utils.js"),
  *
  * @namespace
  */
-var BitwiseOp = module.exports = {
+const BitwiseOp = {
 
     /**
      * Runs bitwise operations across the input data.
@@ -306,3 +306,5 @@ var BitwiseOp = module.exports = {
     },
 
 };
+
+export default BitwiseOp;

+ 4 - 2
src/core/operations/ByteRepr.js

@@ -1,5 +1,5 @@
 /* globals app */
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
 
 /**
@@ -11,7 +11,7 @@ var Utils = require("../Utils.js");
  *
  * @namespace
  */
-var ByteRepr = module.exports = {
+const ByteRepr = {
 
     /**
      * @constant
@@ -394,3 +394,5 @@ var ByteRepr = module.exports = {
     },
 
 };
+
+export default ByteRepr;

+ 5 - 3
src/core/operations/CharEnc.js

@@ -1,5 +1,5 @@
-var Utils = require("../Utils.js"),
-    CryptoJS = require("crypto-js");
+import Utils from "../Utils.js";
+import CryptoJS from "crypto-js";
 
 
 /**
@@ -11,7 +11,7 @@ var Utils = require("../Utils.js"),
  *
  * @namespace
  */
-var CharEnc = module.exports = {
+const CharEnc = {
 
     /**
      * @constant
@@ -46,3 +46,5 @@ var CharEnc = module.exports = {
     },
 
 };
+
+export default CharEnc;

+ 4 - 2
src/core/operations/Checksum.js

@@ -1,4 +1,4 @@
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
 
 /**
@@ -10,7 +10,7 @@ var Utils = require("../Utils.js");
  *
  * @namespace
  */
-var Checksum = module.exports = {
+const Checksum = {
 
     /**
      * Fletcher-8 Checksum operation.
@@ -191,3 +191,5 @@ var Checksum = module.exports = {
     },
 
 };
+
+export default Checksum;

+ 6 - 4
src/core/operations/Cipher.js

@@ -1,6 +1,6 @@
-var Utils = require("../Utils.js"),
-    CryptoJS = require("crypto-js"),
-    Blowfish = require("sladex-blowfish");
+import Utils from "../Utils.js";
+import CryptoJS from "crypto-js";
+import {blowfish as Blowfish} from "sladex-blowfish";
 
 
 /**
@@ -12,7 +12,7 @@ var Utils = require("../Utils.js"),
  *
  * @namespace
  */
-var Cipher = module.exports = {
+const Cipher = {
 
     /**
      * @constant
@@ -617,6 +617,8 @@ var Cipher = module.exports = {
 
 };
 
+export default Cipher;
+
 
 /**
  * Overwriting the CryptoJS OpenSSL key derivation function so that it is possible to not pass a

+ 16 - 14
src/core/operations/Code.js

@@ -1,8 +1,8 @@
-var Utils = require("../Utils.js"),
-    VKbeautify = require("vkbeautify"),
-    dom = require("xmldom").DOMParser,
-    xpath = require("xpath"),
-    prettyPrintOne = require("exports-loader?prettyPrintOne!google-code-prettify/bin/prettify.min.js");
+import Utils from "../Utils.js";
+import vkbeautify from "vkbeautify";
+import {DOMParser as dom} from "xmldom";
+import xpath from "xpath";
+import prettyPrintOne from "exports-loader?prettyPrintOne!google-code-prettify/bin/prettify.min.js";
 
 
 /**
@@ -14,7 +14,7 @@ var Utils = require("../Utils.js"),
  *
  * @namespace
  */
-var Code = module.exports = {
+const Code = {
 
     /**
      * @constant
@@ -56,7 +56,7 @@ var Code = module.exports = {
      */
     runXmlBeautify: function(input, args) {
         var indentStr = args[0];
-        return VKbeautify.xml(input, indentStr);
+        return vkbeautify.xml(input, indentStr);
     },
 
 
@@ -70,7 +70,7 @@ var Code = module.exports = {
     runJsonBeautify: function(input, args) {
         var indentStr = args[0];
         if (!input) return "";
-        return VKbeautify.json(input, indentStr);
+        return vkbeautify.json(input, indentStr);
     },
 
 
@@ -83,7 +83,7 @@ var Code = module.exports = {
      */
     runCssBeautify: function(input, args) {
         var indentStr = args[0];
-        return VKbeautify.css(input, indentStr);
+        return vkbeautify.css(input, indentStr);
     },
 
 
@@ -96,7 +96,7 @@ var Code = module.exports = {
      */
     runSqlBeautify: function(input, args) {
         var indentStr = args[0];
-        return VKbeautify.sql(input, indentStr);
+        return vkbeautify.sql(input, indentStr);
     },
 
 
@@ -115,7 +115,7 @@ var Code = module.exports = {
      */
     runXmlMinify: function(input, args) {
         var preserveComments = args[0];
-        return VKbeautify.xmlmin(input, preserveComments);
+        return vkbeautify.xmlmin(input, preserveComments);
     },
 
 
@@ -128,7 +128,7 @@ var Code = module.exports = {
      */
     runJsonMinify: function(input, args) {
         if (!input) return "";
-        return VKbeautify.jsonmin(input);
+        return vkbeautify.jsonmin(input);
     },
 
 
@@ -141,7 +141,7 @@ var Code = module.exports = {
      */
     runCssMinify: function(input, args) {
         var preserveComments = args[0];
-        return VKbeautify.cssmin(input, preserveComments);
+        return vkbeautify.cssmin(input, preserveComments);
     },
 
 
@@ -153,7 +153,7 @@ var Code = module.exports = {
      * @returns {string}
      */
     runSqlMinify: function(input, args) {
-        return VKbeautify.sqlmin(input);
+        return vkbeautify.sqlmin(input);
     },
 
 
@@ -423,3 +423,5 @@ var Code = module.exports = {
     },
 
 };
+
+export default Code;

+ 10 - 8
src/core/operations/Compress.js

@@ -1,10 +1,10 @@
-var Utils = require("../Utils.js"),
-    rawdeflate = require("zlibjs/bin/rawdeflate.min"),
-    rawinflate = require("zlibjs/bin/rawinflate.min"),
-    zlibAndGzip = require("zlibjs/bin/zlib_and_gzip.min"),
-    zip = require("zlibjs/bin/zip.min"),
-    unzip = require("zlibjs/bin/unzip.min"),
-    bzip2 = require("exports-loader?bzip2!../lib/bzip2.js");
+import Utils from "../Utils.js";
+import rawdeflate from "zlibjs/bin/rawdeflate.min";
+import rawinflate from "zlibjs/bin/rawinflate.min";
+import zlibAndGzip from "zlibjs/bin/zlib_and_gzip.min";
+import zip from "zlibjs/bin/zip.min";
+import unzip from "zlibjs/bin/unzip.min";
+import bzip2 from "exports-loader?bzip2!../lib/bzip2.js";
 
 var Zlib = {
     RawDeflate: rawdeflate.Zlib.RawDeflate,
@@ -27,7 +27,7 @@ var Zlib = {
  *
  * @namespace
  */
-var Compress = module.exports = {
+const Compress = {
 
     /**
      * @constant
@@ -569,3 +569,5 @@ var Compress = module.exports = {
         return Utils.displayFilesAsHTML(files);
     },
 };
+
+export default Compress;

+ 3 - 1
src/core/operations/Convert.js

@@ -7,7 +7,7 @@
  *
  * @namespace
  */
-var Convert = module.exports = {
+const Convert = {
 
     /**
      * @constant
@@ -410,3 +410,5 @@ var Convert = module.exports = {
     },
 
 };
+
+export default Convert;

+ 3 - 2
src/core/operations/DateTime.js

@@ -7,7 +7,7 @@
  *
  * @namespace
  */
-var DateTime = module.exports = {
+const DateTime = {
 
     /**
      * @constant
@@ -448,5 +448,6 @@ var DateTime = module.exports = {
   </tbody>\
 </table>",
 
-
 };
+
+export default DateTime;

+ 4 - 2
src/core/operations/Endian.js

@@ -1,4 +1,4 @@
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
 
 /**
@@ -10,7 +10,7 @@ var Utils = require("../Utils.js");
  *
  * @namespace
  */
-var Endian = module.exports = {
+const Endian = {
 
     /**
      * @constant
@@ -95,3 +95,5 @@ var Endian = module.exports = {
     },
 
 };
+
+export default Endian;

+ 4 - 2
src/core/operations/Entropy.js

@@ -1,4 +1,4 @@
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
 
 /**
@@ -10,7 +10,7 @@ var Utils = require("../Utils.js");
  *
  * @namespace
  */
-var Entropy = module.exports = {
+const Entropy = {
 
     /**
      * @constant
@@ -167,3 +167,5 @@ var Entropy = module.exports = {
     },
 
 };
+
+export default Entropy;

+ 3 - 1
src/core/operations/Extract.js

@@ -7,7 +7,7 @@
  *
  * @namespace
  */
-var Extract = module.exports = {
+const Extract = {
 
     /**
      * Runs search operations across the input data using regular expressions.
@@ -295,3 +295,5 @@ var Extract = module.exports = {
     },
 
 };
+
+export default Extract;

+ 4 - 2
src/core/operations/FileType.js

@@ -1,4 +1,4 @@
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
 
 /**
@@ -10,7 +10,7 @@ var Utils = require("../Utils.js");
  *
  * @namespace
  */
-var FileType = module.exports = {
+const FileType = {
 
     /**
      * Detect File Type operation.
@@ -527,3 +527,5 @@ var FileType = module.exports = {
     },
 
 };
+
+export default FileType;

+ 4 - 2
src/core/operations/HTML.js

@@ -1,4 +1,4 @@
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
 
 /**
@@ -10,7 +10,7 @@ var Utils = require("../Utils.js");
  *
  * @namespace
  */
-var HTML = module.exports = {
+const HTML = {
 
     /**
      * @constant
@@ -851,3 +851,5 @@ var HTML = module.exports = {
     },
 
 };
+
+export default HTML;

+ 4 - 2
src/core/operations/HTTP.js

@@ -1,4 +1,4 @@
-var UAParser = require("exports-loader?UAS_parser!../lib/uas_parser.js");
+import {UAS_parser as UAParser} from "../lib/uas_parser.js";
 
 
 /**
@@ -10,7 +10,7 @@ var UAParser = require("exports-loader?UAS_parser!../lib/uas_parser.js");
  *
  * @namespace
  */
-var HTTP = module.exports = {
+const HTTP = {
 
     /**
      * Strip HTTP headers operation.
@@ -52,3 +52,5 @@ var HTTP = module.exports = {
     },
 
 };
+
+export default HTTP;

+ 7 - 5
src/core/operations/Hash.js

@@ -1,7 +1,7 @@
-var Utils = require("../Utils.js"),
-    CryptoJS = require("crypto-js"),
-    CryptoApi = require("crypto-api"),
-    Checksum = require("./Checksum.js");
+import Utils from "../Utils.js";
+import CryptoJS from "crypto-js";
+import CryptoApi from "crypto-api";
+import Checksum from "./Checksum.js";
 
 
 /**
@@ -13,7 +13,7 @@ var Utils = require("../Utils.js"),
  *
  * @namespace
  */
-var Hash = module.exports = {
+const Hash = {
 
     /**
      * MD2 operation.
@@ -385,3 +385,5 @@ var Hash = module.exports = {
     },
 
 };
+
+export default Hash;

+ 4 - 2
src/core/operations/Hexdump.js

@@ -1,5 +1,5 @@
 /* globals app */
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
 
 /**
@@ -11,7 +11,7 @@ var Utils = require("../Utils.js");
  *
  * @namespace
  */
-var Hexdump = module.exports = {
+const Hexdump = {
 
     /**
      * @constant
@@ -198,3 +198,5 @@ var Hexdump = module.exports = {
     },
 
 };
+
+export default Hexdump;

+ 6 - 5
src/core/operations/IP.js

@@ -1,6 +1,6 @@
-var Utils = require("../Utils.js"),
-    Checksum = require("./Checksum.js"),
-    BigInteger = require("jsbn").BigInteger;
+import Utils from "../Utils.js";
+import Checksum from "./Checksum.js";
+import {BigInteger} from "jsbn";
 
 
 /**
@@ -12,7 +12,7 @@ var Utils = require("../Utils.js"),
  *
  * @namespace
  */
-var IP = module.exports = {
+const IP = {
 
     /**
      * @constant
@@ -1060,5 +1060,6 @@ var IP = module.exports = {
         255: {keyword: "Reserved", protocol: ""}
     },
 
-
 };
+
+export default IP;

+ 6 - 4
src/core/operations/JS.js

@@ -1,6 +1,6 @@
-var esprima = require("esprima"),
-    escodegen = require("escodegen"),
-    esmangle = require("esmangle");
+import esprima from "esprima";
+import escodegen from "escodegen";
+import esmangle from "esmangle";
 
 
 /**
@@ -12,7 +12,7 @@ var esprima = require("esprima"),
  *
  * @namespace
  */
-var JS = module.exports = {
+const JS = {
 
     /**
      * @constant
@@ -160,3 +160,5 @@ var JS = module.exports = {
     },
 
 };
+
+export default JS;

+ 3 - 1
src/core/operations/MAC.js

@@ -7,7 +7,7 @@
  *
  * @namespace
  */
-var MAC = module.exports = {
+const MAC = {
 
     /**
      * @constant
@@ -86,3 +86,5 @@ var MAC = module.exports = {
     },
 
 };
+
+export default MAC;

+ 4 - 2
src/core/operations/MorseCode.js

@@ -1,4 +1,4 @@
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
 
 /**
@@ -10,7 +10,7 @@ var Utils = require("../Utils.js");
  *
  * @namespace
  */
-var MorseCode = module.exports = {
+const MorseCode = {
 
     /**
      * @constant
@@ -186,3 +186,5 @@ var MorseCode = module.exports = {
     })(),
 
 };
+
+export default MorseCode;

+ 3 - 1
src/core/operations/NetBIOS.js

@@ -7,7 +7,7 @@
  *
  * @namespace
  */
-var NetBIOS = module.exports = {
+const NetBIOS = {
 
     /**
      * @constant
@@ -55,3 +55,5 @@ var NetBIOS = module.exports = {
     },
 
 };
+
+export default NetBIOS;

+ 3 - 1
src/core/operations/Numberwang.js

@@ -4,7 +4,7 @@
  * @author Unknown Male 282
  * @namespace
  */
-var Numberwang = module.exports = {
+const Numberwang = {
 
     /**
      * Numberwang operation. Remain indoors.
@@ -25,3 +25,5 @@ var Numberwang = module.exports = {
     },
 
 };
+
+export default Numberwang;

+ 3 - 1
src/core/operations/OS.js

@@ -7,7 +7,7 @@
  *
  * @namespace
  */
-var OS = module.exports = {
+const OS = {
 
     /**
      * Parse UNIX file permissions operation.
@@ -307,3 +307,5 @@ var OS = module.exports = {
     },
 
 };
+
+export default OS;

+ 5 - 3
src/core/operations/PublicKey.js

@@ -1,5 +1,5 @@
-var Utils = require("../Utils.js"),
-    r = require("jsrsasign");
+import Utils from "../Utils.js";
+import * as r from "jsrsasign";
 
 
 /**
@@ -11,7 +11,7 @@ var Utils = require("../Utils.js"),
  *
  * @namespace
  */
-var PublicKey = module.exports = {
+const PublicKey = {
 
     /**
      * @constant
@@ -336,6 +336,8 @@ var PublicKey = module.exports = {
 
 };
 
+export default PublicKey;
+
 
 /**
  * Overwrite X509.hex2dn function so as to join RDNs with a string which can be split on without

+ 4 - 2
src/core/operations/Punycode.js

@@ -1,4 +1,4 @@
-var punycode = require("punycode");
+import punycode from "punycode";
 
 
 /**
@@ -10,7 +10,7 @@ var punycode = require("punycode");
  *
  * @namespace
  */
-var Punycode = module.exports = {
+const Punycode = {
 
     /**
      * @constant
@@ -54,3 +54,5 @@ var Punycode = module.exports = {
     },
 
 };
+
+export default Punycode;

+ 3 - 1
src/core/operations/QuotedPrintable.js

@@ -30,7 +30,7 @@
  *
  * @namespace
  */
-var QuotedPrintable = module.exports = {
+const QuotedPrintable = {
 
     /**
      * To Quoted Printable operation.
@@ -268,3 +268,5 @@ var QuotedPrintable = module.exports = {
     },
 
 };
+
+export default QuotedPrintable;

+ 3 - 1
src/core/operations/Rotate.js

@@ -9,7 +9,7 @@
  *
  * @todo Support for UTF16
  */
-var Rotate = module.exports = {
+const Rotate = {
 
     /**
      * @constant
@@ -240,3 +240,5 @@ var Rotate = module.exports = {
     },
 
 };
+
+export default Rotate;

+ 4 - 2
src/core/operations/SeqUtils.js

@@ -1,4 +1,4 @@
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
 
 /**
@@ -10,7 +10,7 @@ var Utils = require("../Utils.js");
  *
  * @namespace
  */
-var SeqUtils = module.exports = {
+const SeqUtils = {
 
     /**
      * @constant
@@ -221,3 +221,5 @@ var SeqUtils = module.exports = {
     },
 
 };
+
+export default SeqUtils;

+ 5 - 3
src/core/operations/StrUtils.js

@@ -1,5 +1,5 @@
-var Utils = require("../Utils.js"),
-    JsDiff = require("diff");
+import Utils from "../Utils.js";
+import JsDiff from "diff";
 
 
 /**
@@ -11,7 +11,7 @@ var Utils = require("../Utils.js"),
  *
  * @namespace
  */
-var StrUtils = module.exports = {
+const StrUtils = {
 
     /**
      * @constant
@@ -538,3 +538,5 @@ var StrUtils = module.exports = {
     },
 
 };
+
+export default StrUtils;

+ 4 - 2
src/core/operations/Tidy.js

@@ -1,4 +1,4 @@
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
 
 /**
@@ -10,7 +10,7 @@ var Utils = require("../Utils.js");
  *
  * @namespace
  */
-var Tidy = module.exports = {
+const Tidy = {
 
     /**
      * @constant
@@ -239,3 +239,5 @@ var Tidy = module.exports = {
     },
 
 };
+
+export default Tidy;

+ 4 - 2
src/core/operations/URL.js

@@ -1,5 +1,5 @@
 /* globals unescape */
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
 
 /**
@@ -12,7 +12,7 @@ var Utils = require("../Utils.js");
  *
  * @namespace
  */
-var URL_ = module.exports = {
+const URL_ = {
 
     /**
      * @constant
@@ -130,3 +130,5 @@ var URL_ = module.exports = {
     },
 
 };
+
+export default URL_;

+ 3 - 1
src/core/operations/UUID.js

@@ -7,7 +7,7 @@
  *
  * @namespace
  */
-var UUID = module.exports = {
+const UUID = {
 
     /**
      * Generate UUID operation.
@@ -37,3 +37,5 @@ var UUID = module.exports = {
     },
 
 };
+
+export default UUID;

+ 4 - 2
src/core/operations/Unicode.js

@@ -1,4 +1,4 @@
-var Utils = require("../Utils.js");
+import Utils from "../Utils.js";
 
 
 /**
@@ -10,7 +10,7 @@ var Utils = require("../Utils.js");
  *
  * @namespace
  */
-var Unicode = module.exports = {
+const Unicode = {
 
     /**
      * @constant
@@ -63,3 +63,5 @@ var Unicode = module.exports = {
     },
 
 };
+
+export default Unicode;

+ 2 - 2
src/node/index.js

@@ -6,9 +6,9 @@
  * @license Apache-2.0
  */
 
-var Chef = require("../core/Chef.js");
+var Chef = require("../core/Chef.js").default;
 
-module.exports = {
+const CyberChef = module.exports = {
 
     bake: function(input, recipeConfig) {
         this.chef = new Chef();

+ 36 - 34
src/web/HTMLApp.js → src/web/App.js

@@ -1,9 +1,9 @@
-var Utils = require("../core/Utils.js"),
-    Chef = require("../core/Chef.js"),
-    Manager = require("./Manager.js"),
-    HTMLCategory = require("./HTMLCategory.js"),
-    HTMLOperation = require("./HTMLOperation.js"),
-    Split = require("split.js");
+import Utils from "../core/Utils.js";
+import Chef from "../core/Chef.js";
+import Manager from "./Manager.js";
+import HTMLCategory from "./HTMLCategory.js";
+import HTMLOperation from "./HTMLOperation.js";
+import Split from "split.js";
 
 
 /**
@@ -20,7 +20,7 @@ var Utils = require("../core/Utils.js"),
  * @param {String[]} defaultFavourites - A list of default favourite operations.
  * @param {Object} options - Default setting for app options.
  */
-var HTMLApp = module.exports = function(categories, operations, defaultFavourites, defaultOptions) {
+var App = function(categories, operations, defaultFavourites, defaultOptions) {
     this.categories  = categories;
     this.operations  = operations;
     this.dfavourites = defaultFavourites;
@@ -43,7 +43,7 @@ var HTMLApp = module.exports = function(categories, operations, defaultFavourite
  *
  * @fires Manager#appstart
  */
-HTMLApp.prototype.setup = function() {
+App.prototype.setup = function() {
     document.dispatchEvent(this.manager.appstart);
     this.initialiseSplitter();
     this.loadLocalStorage();
@@ -60,7 +60,7 @@ HTMLApp.prototype.setup = function() {
  *
  * @param {Error} err
  */
-HTMLApp.prototype.handleError = function(err) {
+App.prototype.handleError = function(err) {
     console.error(err);
     var msg = err.displayStr || err.toString();
     this.alert(msg, "danger", this.options.errorTimeout, !this.options.showErrors);
@@ -73,7 +73,7 @@ HTMLApp.prototype.handleError = function(err) {
  * @param {boolean} [step] - Set to true if we should only execute one operation instead of the
  *   whole recipe.
  */
-HTMLApp.prototype.bake = function(step) {
+App.prototype.bake = function(step) {
     var response;
 
     try {
@@ -112,7 +112,7 @@ HTMLApp.prototype.bake = function(step) {
 /**
  * Runs Auto Bake if it is set.
  */
-HTMLApp.prototype.autoBake = function() {
+App.prototype.autoBake = function() {
     if (this.autoBake_) {
         this.bake();
     }
@@ -128,7 +128,7 @@ HTMLApp.prototype.autoBake = function() {
  *
  * @returns {number} - The number of miliseconds it took to run the silent bake.
  */
-HTMLApp.prototype.silentBake = function() {
+App.prototype.silentBake = function() {
     var startTime = new Date().getTime(),
         recipeConfig = this.getRecipeConfig();
 
@@ -145,7 +145,7 @@ HTMLApp.prototype.silentBake = function() {
  *
  * @returns {string}
  */
-HTMLApp.prototype.getInput = function() {
+App.prototype.getInput = function() {
     var input = this.manager.input.get();
 
     // Save to session storage in case we need to restore it later
@@ -161,7 +161,7 @@ HTMLApp.prototype.getInput = function() {
  *
  * @param {string} input - The string to set the input to
  */
-HTMLApp.prototype.setInput = function(input) {
+App.prototype.setInput = function(input) {
     sessionStorage.setItem("inputLength", input.length);
     sessionStorage.setItem("input", input);
     this.manager.input.set(input);
@@ -174,7 +174,7 @@ HTMLApp.prototype.setInput = function(input) {
  *
  * @fires Manager#oplistcreate
  */
-HTMLApp.prototype.populateOperationsList = function() {
+App.prototype.populateOperationsList = function() {
     // Move edit button away before we overwrite it
     document.body.appendChild(document.getElementById("edit-favourites"));
 
@@ -210,7 +210,7 @@ HTMLApp.prototype.populateOperationsList = function() {
 /**
  * Sets up the adjustable splitter to allow the user to resize areas of the page.
  */
-HTMLApp.prototype.initialiseSplitter = function() {
+App.prototype.initialiseSplitter = function() {
     this.columnSplitter = Split(["#operations", "#recipe", "#IO"], {
         sizes: [20, 30, 50],
         minSize: [240, 325, 440],
@@ -234,7 +234,7 @@ HTMLApp.prototype.initialiseSplitter = function() {
  * Loads the information previously saved to the HTML5 local storage object so that user options
  * and favourites can be restored.
  */
-HTMLApp.prototype.loadLocalStorage = function() {
+App.prototype.loadLocalStorage = function() {
     // Load options
     var lOptions;
     if (localStorage.options !== undefined) {
@@ -252,7 +252,7 @@ HTMLApp.prototype.loadLocalStorage = function() {
  * Favourites category with them.
  * If the user currently has no saved favourites, the defaults from the view constructor are used.
  */
-HTMLApp.prototype.loadFavourites = function() {
+App.prototype.loadFavourites = function() {
     var favourites = localStorage.favourites &&
         localStorage.favourites.length > 2 ?
         JSON.parse(localStorage.favourites) :
@@ -283,7 +283,7 @@ HTMLApp.prototype.loadFavourites = function() {
  * @param {string[]} favourites - A list of the user's favourite operations
  * @returns {string[]} A list of the valid favourites
  */
-HTMLApp.prototype.validFavourites = function(favourites) {
+App.prototype.validFavourites = function(favourites) {
     var validFavs = [];
     for (var i = 0; i < favourites.length; i++) {
         if (this.operations.hasOwnProperty(favourites[i])) {
@@ -302,7 +302,7 @@ HTMLApp.prototype.validFavourites = function(favourites) {
  *
  * @param {string[]} favourites - A list of the user's favourite operations
  */
-HTMLApp.prototype.saveFavourites = function(favourites) {
+App.prototype.saveFavourites = function(favourites) {
     localStorage.setItem("favourites", JSON.stringify(this.validFavourites(favourites)));
 };
 
@@ -311,7 +311,7 @@ HTMLApp.prototype.saveFavourites = function(favourites) {
  * Resets favourite operations back to the default as specified in the view constructor and
  * refreshes the operation list.
  */
-HTMLApp.prototype.resetFavourites = function() {
+App.prototype.resetFavourites = function() {
     this.saveFavourites(this.dfavourites);
     this.loadFavourites();
     this.populateOperationsList();
@@ -324,7 +324,7 @@ HTMLApp.prototype.resetFavourites = function() {
  *
  * @param {string} name - The name of the operation
  */
-HTMLApp.prototype.addFavourite = function(name) {
+App.prototype.addFavourite = function(name) {
     var favourites = JSON.parse(localStorage.favourites);
 
     if (favourites.indexOf(name) >= 0) {
@@ -343,7 +343,7 @@ HTMLApp.prototype.addFavourite = function(name) {
 /**
  * Checks for input and recipe in the URI parameters and loads them if present.
  */
-HTMLApp.prototype.loadURIParams = function() {
+App.prototype.loadURIParams = function() {
     // Load query string from URI
     this.queryString = (function(a) {
         if (a === "") return {};
@@ -408,7 +408,7 @@ HTMLApp.prototype.loadURIParams = function() {
  *
  * @returns {number}
  */
-HTMLApp.prototype.nextIngId = function() {
+App.prototype.nextIngId = function() {
     return this.ingId++;
 };
 
@@ -418,7 +418,7 @@ HTMLApp.prototype.nextIngId = function() {
  *
  * @returns {Object[]}
  */
-HTMLApp.prototype.getRecipeConfig = function() {
+App.prototype.getRecipeConfig = function() {
     var recipeConfig = this.manager.recipe.getConfig();
     sessionStorage.setItem("recipeConfig", JSON.stringify(recipeConfig));
     return recipeConfig;
@@ -430,7 +430,7 @@ HTMLApp.prototype.getRecipeConfig = function() {
  *
  * @param {Object[]} recipeConfig - The recipe configuration
  */
-HTMLApp.prototype.setRecipeConfig = function(recipeConfig) {
+App.prototype.setRecipeConfig = function(recipeConfig) {
     sessionStorage.setItem("recipeConfig", JSON.stringify(recipeConfig));
     document.getElementById("rec-list").innerHTML = null;
 
@@ -471,7 +471,7 @@ HTMLApp.prototype.setRecipeConfig = function(recipeConfig) {
 /**
  * Resets the splitter positions to default.
  */
-HTMLApp.prototype.resetLayout = function() {
+App.prototype.resetLayout = function() {
     this.columnSplitter.setSizes([20, 30, 50]);
     this.ioSplitter.setSizes([50, 50]);
 
@@ -483,7 +483,7 @@ HTMLApp.prototype.resetLayout = function() {
 /**
  * Sets the compile message.
  */
-HTMLApp.prototype.setCompileMessage = function() {
+App.prototype.setCompileMessage = function() {
     // Display time since last build and compile message
     var now = new Date(),
         timeSinceCompile = Utils.fuzzyTime(now.getTime() - window.compileTime),
@@ -522,7 +522,7 @@ HTMLApp.prototype.setCompileMessage = function() {
  * // that will disappear after 5 seconds.
  * this.alert("Happy Christmas!", "info", 5000);
  */
-HTMLApp.prototype.alert = function(str, style, timeout, silent) {
+App.prototype.alert = function(str, style, timeout, silent) {
     var time = new Date();
 
     console.log("[" + time.toLocaleString() + "] " + str);
@@ -576,7 +576,7 @@ HTMLApp.prototype.alert = function(str, style, timeout, silent) {
  * // Pops up a box asking if the user would like a cookie. Prints the answer to the console.
  * this.confirm("Question", "Would you like a cookie?", function(answer) {console.log(answer);});
  */
-HTMLApp.prototype.confirm = function(title, body, callback, scope) {
+App.prototype.confirm = function(title, body, callback, scope) {
     scope = scope || this;
     document.getElementById("confirm-title").innerHTML = title;
     document.getElementById("confirm-body").innerHTML = body;
@@ -604,7 +604,7 @@ HTMLApp.prototype.confirm = function(title, body, callback, scope) {
  * Handler for the alert close button click event.
  * Closes the alert box.
  */
-HTMLApp.prototype.alertCloseClick = function() {
+App.prototype.alertCloseClick = function() {
     document.getElementById("alert").style.display = "none";
 };
 
@@ -616,7 +616,7 @@ HTMLApp.prototype.alertCloseClick = function() {
  * @listens Manager#statechange
  * @param {event} e
  */
-HTMLApp.prototype.stateChange = function(e) {
+App.prototype.stateChange = function(e) {
     this.autoBake();
 
     // Update the current history state (not creating a new one)
@@ -633,7 +633,7 @@ HTMLApp.prototype.stateChange = function(e) {
  *
  * @param {event} e
  */
-HTMLApp.prototype.popState = function(e) {
+App.prototype.popState = function(e) {
     if (window.location.href.split("#")[0] !== this.lastStateUrl) {
         this.loadURIParams();
     }
@@ -643,7 +643,7 @@ HTMLApp.prototype.popState = function(e) {
 /**
  * Function to call an external API from this view.
  */
-HTMLApp.prototype.callApi = function(url, type, data, dataType, contentType) {
+App.prototype.callApi = function(url, type, data, dataType, contentType) {
     type = type || "POST";
     data = data || {};
     dataType = dataType || undefined;
@@ -674,3 +674,5 @@ HTMLApp.prototype.callApi = function(url, type, data, dataType, contentType) {
         response: response
     };
 };
+
+export default App;

+ 5 - 3
src/web/ControlsWaiter.js

@@ -1,4 +1,4 @@
-var Utils = require("../core/Utils.js");
+import Utils from "../core/Utils.js";
 
 
 /**
@@ -9,10 +9,10 @@ var Utils = require("../core/Utils.js");
  * @license Apache-2.0
  *
  * @constructor
- * @param {HTMLApp} app - The main view object for CyberChef.
+ * @param {App} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var ControlsWaiter = module.exports = function(app, manager) {
+var ControlsWaiter = function(app, manager) {
     this.app = app;
     this.manager = manager;
 };
@@ -358,3 +358,5 @@ ControlsWaiter.prototype.supportButtonClick = function() {
         "* User-Agent: \n" + navigator.userAgent + "\n" +
         "* [Link to reproduce](" + saveLink + ")\n\n";
 };
+
+export default ControlsWaiter;

+ 3 - 1
src/web/HTMLCategory.js

@@ -9,7 +9,7 @@
  * @param {string} name - The name of the category.
  * @param {boolean} selected - Whether this category is pre-selected or not.
  */
-var HTMLCategory = module.exports = function(name, selected) {
+var HTMLCategory = function(name, selected) {
     this.name = name;
     this.selected = selected;
     this.opList = [];
@@ -48,3 +48,5 @@ HTMLCategory.prototype.toHtml = function() {
     html += "</ul></div></div>";
     return html;
 };
+
+export default HTMLCategory;

+ 4 - 2
src/web/HTMLIngredient.js

@@ -7,10 +7,10 @@
  *
  * @constructor
  * @param {Object} config - The configuration object for this ingredient.
- * @param {HTMLApp} app - The main view object for CyberChef.
+ * @param {App} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var HTMLIngredient = module.exports = function(config, app, manager) {
+var HTMLIngredient = function(config, app, manager) {
     this.app = app;
     this.manager = manager;
 
@@ -210,3 +210,5 @@ HTMLIngredient.prototype.editableOptionChange = function(e) {
 
     this.manager.recipe.ingChange();
 };
+
+export default HTMLIngredient;

+ 5 - 3
src/web/HTMLOperation.js

@@ -1,4 +1,4 @@
-var HTMLIngredient = require("./HTMLIngredient.js");
+import HTMLIngredient from "./HTMLIngredient.js";
 
 
 /**
@@ -11,10 +11,10 @@ var HTMLIngredient = require("./HTMLIngredient.js");
  * @constructor
  * @param {string} name - The name of the operation.
  * @param {Object} config - The configuration object for this operation.
- * @param {HTMLApp} app - The main view object for CyberChef.
+ * @param {App} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var HTMLOperation = module.exports = function(name, config, app, manager) {
+var HTMLOperation = function(name, config, app, manager) {
     this.app         = app;
     this.manager     = manager;
 
@@ -115,3 +115,5 @@ HTMLOperation.prototype.highlightSearchString = function(searchStr, namePos, des
             this.description.slice(descPos + searchStr.length);
     }
 };
+
+export default HTMLOperation;

+ 5 - 3
src/web/HighlighterWaiter.js

@@ -1,4 +1,4 @@
-var Utils = require("../core/Utils.js");
+import Utils from "../core/Utils.js";
 
 
 /**
@@ -9,9 +9,9 @@ var Utils = require("../core/Utils.js");
  * @license Apache-2.0
  *
  * @constructor
- * @param {HTMLApp} app - The main view object for CyberChef.
+ * @param {App} app - The main view object for CyberChef.
  */
-var HighlighterWaiter = module.exports = function(app) {
+var HighlighterWaiter = function(app) {
     this.app = app;
 
     this.mouseButtonDown = false;
@@ -507,3 +507,5 @@ HighlighterWaiter.prototype.highlight = function(textarea, highlighter, pos) {
     highlighter.scrollTop = textarea.scrollTop;
     highlighter.scrollLeft = textarea.scrollLeft;
 };
+
+export default HighlighterWaiter;

+ 5 - 3
src/web/InputWaiter.js

@@ -1,4 +1,4 @@
-var Utils = require("../core/Utils.js");
+import Utils from "../core/Utils.js";
 
 
 /**
@@ -9,10 +9,10 @@ var Utils = require("../core/Utils.js");
  * @license Apache-2.0
  *
  * @constructor
- * @param {HTMLApp} app - The main view object for CyberChef.
+ * @param {App} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var InputWaiter = module.exports = function(app, manager) {
+var InputWaiter = function(app, manager) {
     this.app = app;
     this.manager = manager;
 
@@ -218,3 +218,5 @@ InputWaiter.prototype.clearIoClick = function() {
     document.getElementById("output-selection-info").innerHTML = "";
     window.dispatchEvent(this.manager.statechange);
 };
+
+export default InputWaiter;

+ 13 - 11
src/web/Manager.js

@@ -1,12 +1,12 @@
-var WindowWaiter      = require("./WindowWaiter.js"),
-    ControlsWaiter    = require("./ControlsWaiter.js"),
-    RecipeWaiter      = require("./RecipeWaiter.js"),
-    OperationsWaiter  = require("./OperationsWaiter.js"),
-    InputWaiter       = require("./InputWaiter.js"),
-    OutputWaiter      = require("./OutputWaiter.js"),
-    OptionsWaiter     = require("./OptionsWaiter.js"),
-    HighlighterWaiter = require("./HighlighterWaiter.js"),
-    SeasonalWaiter    = require("./SeasonalWaiter.js");
+import WindowWaiter from "./WindowWaiter.js";
+import ControlsWaiter from "./ControlsWaiter.js";
+import RecipeWaiter from "./RecipeWaiter.js";
+import OperationsWaiter from "./OperationsWaiter.js";
+import InputWaiter from "./InputWaiter.js";
+import OutputWaiter from "./OutputWaiter.js";
+import OptionsWaiter from "./OptionsWaiter.js";
+import HighlighterWaiter from "./HighlighterWaiter.js";
+import SeasonalWaiter from "./SeasonalWaiter.js";
 
 
 /**
@@ -17,9 +17,9 @@ var WindowWaiter      = require("./WindowWaiter.js"),
  * @license Apache-2.0
  *
  * @constructor
- * @param {HTMLApp} app - The main view object for CyberChef.
+ * @param {App} app - The main view object for CyberChef.
  */
-var Manager = module.exports = function(app) {
+var Manager = function(app) {
     this.app = app;
 
     // Define custom events
@@ -274,3 +274,5 @@ Manager.prototype.dynamicListenerHandler = function(e) {
         }
     }
 };
+
+export default Manager;

+ 6 - 4
src/web/OperationsWaiter.js

@@ -1,5 +1,5 @@
-var HTMLOperation = require("./HTMLOperation.js"),
-    Sortable = require("sortablejs");
+import HTMLOperation from "./HTMLOperation.js";
+import Sortable from "sortablejs";
 
 
 /**
@@ -10,10 +10,10 @@ var HTMLOperation = require("./HTMLOperation.js"),
  * @license Apache-2.0
  *
  * @constructor
- * @param {HTMLApp} app - The main view object for CyberChef.
+ * @param {App} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var OperationsWaiter = module.exports = function(app, manager) {
+var OperationsWaiter = function(app, manager) {
     this.app = app;
     this.manager = manager;
 
@@ -283,3 +283,5 @@ OperationsWaiter.prototype.opIconMouseleave = function(e) {
         $(opEl).popover("show");
     }
 };
+
+export default OperationsWaiter;

+ 4 - 2
src/web/OptionsWaiter.js

@@ -6,9 +6,9 @@
  * @license Apache-2.0
  *
  * @constructor
- * @param {HTMLApp} app - The main view object for CyberChef.
+ * @param {App} app - The main view object for CyberChef.
  */
-var OptionsWaiter = module.exports = function(app) {
+var OptionsWaiter = function(app) {
     this.app = app;
 };
 
@@ -130,3 +130,5 @@ OptionsWaiter.prototype.setWordWrap = function() {
         document.getElementById("output-highlighter").classList.add("word-wrap");
     }
 };
+
+export default OptionsWaiter;

+ 5 - 3
src/web/OutputWaiter.js

@@ -1,4 +1,4 @@
-var Utils = require("../core/Utils.js");
+import Utils from "../core/Utils.js";
 
 
 /**
@@ -9,10 +9,10 @@ var Utils = require("../core/Utils.js");
  * @license Apache-2.0
  *
  * @constructor
- * @param {HTMLApp} app - The main view object for CyberChef.
+ * @param {App} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var OutputWaiter = module.exports = function(app, manager) {
+var OutputWaiter = function(app, manager) {
     this.app = app;
     this.manager = manager;
 };
@@ -189,3 +189,5 @@ OutputWaiter.prototype.maximiseOutputClick = function(e) {
         this.app.resetLayout();
     }
 };
+
+export default OutputWaiter;

+ 6 - 4
src/web/RecipeWaiter.js

@@ -1,5 +1,5 @@
-var HTMLOperation = require("./HTMLOperation.js"),
-    Sortable = require("sortablejs");
+import HTMLOperation from "./HTMLOperation.js";
+import Sortable from "sortablejs";
 
 
 /**
@@ -10,10 +10,10 @@ var HTMLOperation = require("./HTMLOperation.js"),
  * @license Apache-2.0
  *
  * @constructor
- * @param {HTMLApp} app - The main view object for CyberChef.
+ * @param {App} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var RecipeWaiter = module.exports = function(app, manager) {
+var RecipeWaiter = function(app, manager) {
     this.app = app;
     this.manager = manager;
     this.removeIntent = false;
@@ -424,3 +424,5 @@ RecipeWaiter.prototype.opAdd = function(e) {
 RecipeWaiter.prototype.opRemove = function(e) {
     window.dispatchEvent(this.manager.statechange);
 };
+
+export default RecipeWaiter;

+ 4 - 2
src/web/SeasonalWaiter.js

@@ -6,10 +6,10 @@
  * @license Apache-2.0
  *
  * @constructor
- * @param {HTMLApp} app - The main view object for CyberChef.
+ * @param {App} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var SeasonalWaiter = module.exports = function(app, manager) {
+var SeasonalWaiter = function(app, manager) {
     this.app = app;
     this.manager = manager;
 };
@@ -150,3 +150,5 @@ SeasonalWaiter.treeWalk = (function() {
         }
     };
 })();
+
+export default SeasonalWaiter;

+ 4 - 2
src/web/WindowWaiter.js

@@ -6,9 +6,9 @@
  * @license Apache-2.0
  *
  * @constructor
- * @param {HTMLApp} app - The main view object for CyberChef.
+ * @param {App} app - The main view object for CyberChef.
  */
-var WindowWaiter = module.exports = function(app) {
+var WindowWaiter = function(app) {
     this.app = app;
 };
 
@@ -50,3 +50,5 @@ WindowWaiter.prototype.windowFocus = function() {
         this.app.silentBake();
     }
 };
+
+export default WindowWaiter;

+ 8 - 8
src/web/css/index.js

@@ -6,13 +6,13 @@
  * @license Apache-2.0
  */
 
-require("google-code-prettify/src/prettify.css");
+import "google-code-prettify/src/prettify.css";
 
-require("./lib/bootstrap.less");
-require("bootstrap-switch/src/less/bootstrap3/build.less");
-require("bootstrap-colorpicker/dist/css/bootstrap-colorpicker.css");
+import "./lib/bootstrap.less";
+import "bootstrap-switch/src/less/bootstrap3/build.less";
+import "bootstrap-colorpicker/dist/css/bootstrap-colorpicker.css";
 
-require("./structure/overrides.css");
-require("./structure/layout.css");
-require("./structure/utils.css");
-require("./themes/classic.css");
+import "./structure/overrides.css";
+import "./structure/layout.css";
+import "./structure/utils.css";
+import "./themes/classic.css";

+ 1 - 1
src/web/css/lib/bootstrap.less

@@ -45,7 +45,7 @@
 @import "~bootstrap/less/panels.less";
 // @import "~bootstrap/less/responsive-embed.less";
 // @import "~bootstrap/less/wells.less";
-// @import "~bootstrap/less/close.less";
+@import "~bootstrap/less/close.less";
 
 // Components w/ JavaScript
 @import "~bootstrap/less/modals.less";

+ 5 - 5
src/web/index.js

@@ -4,10 +4,10 @@
  * @license Apache-2.0
  */
 
-var HTMLApp = require("./HTMLApp.js"),
-    Categories = require("../core/config/Categories.js"),
-    OperationConfig = require("../core/config/OperationConfig.js"),
-    CanvasComponents = require("../core/lib/canvascomponents.js");
+import App from "./App.js";
+import Categories from "../core/config/Categories.js";
+import OperationConfig from "../core/config/OperationConfig.js";
+import CanvasComponents from "../core/lib/canvascomponents.js";
 
 /**
  * Main function used to build the CyberChef web app.
@@ -38,7 +38,7 @@ var main = function() {
     };
 
     document.removeEventListener("DOMContentLoaded", main, false);
-    window.app = new HTMLApp(Categories, OperationConfig, defaultFavourites, defaultOptions);
+    window.app = new App(Categories, OperationConfig, defaultFavourites, defaultOptions);
     window.app.setup();
 };
 

+ 4 - 2
test/TestRegister.js

@@ -8,7 +8,7 @@
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
-var Chef = require("../src/core/Chef.js");
+import Chef from "../src/core/Chef.js";
 
 (function() {
     /**
@@ -87,5 +87,7 @@ var Chef = require("../src/core/Chef.js");
 
     // Singleton TestRegister, keeping things simple and obvious.
     global.TestRegister = global.TestRegister || new TestRegister();
-    module.exports = global.TestRegister;
 })();
+
+export default global.TestRegister;
+

+ 8 - 15
test/TestRunner.js

@@ -8,25 +8,18 @@
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
-var TestRegister = require("./TestRegister.js"),
-    allTestsPassing = true,
+import TestRegister from "./TestRegister.js";
+import "./tests/operations/Base58.js";
+import "./tests/operations/Compress.js";
+import "./tests/operations/FlowControl.js";
+import "./tests/operations/MorseCode.js";
+import "./tests/operations/StrUtils.js";
+
+var allTestsPassing = true,
     testStatusCounts = {
         total: 0,
     };
 
-/**
- * Requires and returns all modules that match.
- *
- * @param {Object} requireContext
- * @returns {Object[]}
- */
-function requireAll(requireContext) {
-    return requireContext.keys().map(requireContext);
-}
-
-// Import all tests
-requireAll(require.context("./tests", true, /.+\.js$/));
-
 
 /**
  * Helper function to convert a status to an icon.

+ 1 - 1
test/tests/operations/Base58.js

@@ -6,7 +6,7 @@
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
-var TestRegister = require("../../TestRegister.js");
+import TestRegister from "../../TestRegister.js";
 
 TestRegister.addTests([
     {

+ 1 - 1
test/tests/operations/Compress.js

@@ -5,7 +5,7 @@
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
-var TestRegister = require("../../TestRegister.js");
+import TestRegister from "../../TestRegister.js";
 
 TestRegister.addTests([
     {

+ 1 - 1
test/tests/operations/FlowControl.js

@@ -6,7 +6,7 @@
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
-var TestRegister = require("../../TestRegister.js");
+import TestRegister from "../../TestRegister.js";
 
 TestRegister.addTests([
     {

+ 1 - 1
test/tests/operations/MorseCode.js

@@ -6,7 +6,7 @@
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
-var TestRegister = require("../../TestRegister.js");
+import TestRegister from "../../TestRegister.js";
 
 TestRegister.addTests([
     {

+ 1 - 1
test/tests/operations/StrUtils.js

@@ -5,7 +5,7 @@
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
-var TestRegister = require("../../TestRegister.js");
+import TestRegister from "../../TestRegister.js";
 
 TestRegister.addTests([
     {