From 1800bad61da4b3c5ab42402a8e79b56d42da5596 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Tue, 21 Mar 2017 23:56:46 +0000 Subject: [PATCH] Added babel-preset-env with browser version targets and babel-polyfill --- .babelrc | 12 +++++++++++- Gruntfile.js | 10 +++++----- package.json | 3 ++- src/js/operations/Compress.js | 3 ++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.babelrc b/.babelrc index d9f1134f..ae8447ec 100644 --- a/.babelrc +++ b/.babelrc @@ -1 +1,11 @@ -{ "presets": [ "es2015" ] } \ No newline at end of file +{ + "presets": [ + ["env", { + "targets": { + "chrome": 40, + "firefox": 35, + "edge": 14 + } + }] + ] +} \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 6ac2917d..a48ba340 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -148,7 +148,7 @@ module.exports = function(grunt) { }, web: { target: "web", - entry: "./src/js/views/html/main.js", + entry: ["babel-polyfill", "./src/js/views/html/main.js"], output: { filename: "scripts.js", path: "build/dev" @@ -156,7 +156,7 @@ module.exports = function(grunt) { }, tests: { target: "node", - entry: "./test/TestRunner.js", + entry: ["babel-polyfill", "./test/TestRunner.js"], output: { filename: "index.js", path: "build/test" @@ -170,7 +170,7 @@ module.exports = function(grunt) { }, node: { target: "node", - entry: "./src/js/views/node/index.js", + entry: ["babel-polyfill", "./src/js/views/node/index.js"], output: { filename: "CyberChef.js", path: "build/node", @@ -434,7 +434,7 @@ module.exports = function(grunt) { }, js: { files: "src/js/**/*.js", - tasks: ["concat:js", "chmod:build"] + tasks: ["webpack:web", "chmod:build"] }, html: { files: "src/html/**/*.html", @@ -446,7 +446,7 @@ module.exports = function(grunt) { }, grunt: { files: "Gruntfile.js", - tasks: ["clean:dev", "concat:css", "concat:js", "copy:htmlDev", "copy:staticDev", "chmod:build"] + tasks: ["clean:dev", "concat:css", "webpack:web", "copy:htmlDev", "copy:staticDev", "chmod:build"] } }, }); diff --git a/package.json b/package.json index 8c600a48..b27f7039 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "devDependencies": { "babel-core": "^6.24.0", "babel-loader": "^6.4.0", - "babel-preset-es2015": "^6.24.0", + "babel-polyfill": "^6.23.0", + "babel-preset-env": "^1.2.2", "exports-loader": "^0.6.4", "grunt": ">=0.4.5", "grunt-chmod": "~1.1.1", diff --git a/src/js/operations/Compress.js b/src/js/operations/Compress.js index f3d3c5b5..3e6fd159 100755 --- a/src/js/operations/Compress.js +++ b/src/js/operations/Compress.js @@ -1,4 +1,5 @@ -var rawdeflate = require("zlibjs/bin/rawdeflate.min"), +var Utils = require("../core/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"),