Skip to content

Commit

Permalink
Added webpack-bundle-analyzer to production build. Refactored some mo…
Browse files Browse the repository at this point in the history
…dules to improve performance. Removed moment-timezone from Utils to drastically reduce module size.
  • Loading branch information
n1474335 committed Dec 25, 2018
1 parent b29bb6f commit 43dcd54
Show file tree
Hide file tree
Showing 48 changed files with 207 additions and 102 deletions.
6 changes: 6 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const NodeExternals = require("webpack-node-externals");
const Inliner = require("web-resource-inliner");
const glob = require("glob");
Expand Down Expand Up @@ -209,6 +210,11 @@ module.exports = function (grunt) {
minifyCSS: true
}
}),
new BundleAnalyzerPlugin({
analyzerMode: "static",
reportFilename: "build/prod/BundleAnalyzerReport.html",
openAnalyzer: false
}),
]
},
webInline: {
Expand Down
170 changes: 152 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"url-loader": "^1.1.2",
"web-resource-inliner": "^4.2.1",
"webpack": "^4.25.1",
"webpack-bundle-analyzer": "^3.0.3",
"webpack-dev-server": "^3.1.10",
"webpack-node-externals": "^1.7.2",
"worker-loader": "^2.0.0"
Expand Down Expand Up @@ -96,7 +97,6 @@
"jquery": "^3.3.1",
"js-crc": "^0.2.0",
"js-sha3": "^0.8.0",
"jsbn": "^1.1.0",
"jsesc": "^2.5.1",
"jsonpath": "^1.0.0",
"jsonwebtoken": "^8.3.0",
Expand Down
33 changes: 0 additions & 33 deletions src/core/Utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import utf8 from "utf8";
import moment from "moment-timezone";
import {fromBase64} from "./lib/Base64";
import {fromHex} from "./lib/Hex";
import {fromDecimal} from "./lib/Decimal";
Expand Down Expand Up @@ -797,38 +796,6 @@ class Utils {
}


/**
* Expresses a number of milliseconds in a human readable format.
*
* Range | Sample Output
* -----------------------------|-------------------------------
* 0 to 45 seconds | a few seconds ago
* 45 to 90 seconds | a minute ago
* 90 seconds to 45 minutes | 2 minutes ago ... 45 minutes ago
* 45 to 90 minutes | an hour ago
* 90 minutes to 22 hours | 2 hours ago ... 22 hours ago
* 22 to 36 hours | a day ago
* 36 hours to 25 days | 2 days ago ... 25 days ago
* 25 to 45 days | a month ago
* 45 to 345 days | 2 months ago ... 11 months ago
* 345 to 545 days (1.5 years) | a year ago
* 546 days+ | 2 years ago ... 20 years ago
*
* @param {number} ms
* @returns {string}
*
* @example
* // returns "3 minutes"
* Utils.fuzzyTime(152435);
*
* // returns "5 days"
* Utils.fuzzyTime(456851321);
*/
static fuzzyTime(ms) {
return moment.duration(ms, "milliseconds").humanize();
}


/**
* Formats a list of files or directories.
*
Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/Adler32Checksum.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Adler32Checksum extends Operation {
super();

this.name = "Adler-32 Checksum";
this.module = "Hashing";
this.module = "Crypto";
this.description = "Adler-32 is a checksum algorithm which was invented by Mark Adler in 1995, and is a modification of the Fletcher checksum. Compared to a cyclic redundancy check of the same length, it trades reliability for speed (preferring the latter).<br><br>Adler-32 is more reliable than Fletcher-16, and slightly less reliable than Fletcher-32.";
this.infoURL = "https://wikipedia.org/wiki/Adler-32";
this.inputType = "byteArray";
Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/AnalyseHash.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AnalyseHash extends Operation {
super();

this.name = "Analyse hash";
this.module = "Hashing";
this.module = "Crypto";
this.description = "Tries to determine information about a given hash and suggests which algorithm may have been used to generate it based on its length.";
this.infoURL = "https://wikipedia.org/wiki/Comparison_of_cryptographic_hash_functions";
this.inputType = "string";
Expand Down
Loading

0 comments on commit 43dcd54

Please sign in to comment.