Comparing version 3.2.1 to 3.3.0
@@ -23,5 +23,12 @@ #!/usr/bin/env node | ||
.option('-t, --threshold <number>', 'exclude assets smaller than this byte size. 0 (default)', function (value) { return parseInt(value); }) | ||
.option('--gzip-level <number>', 'gzip compression level 6 (default), 0 (no compression) - 9 (best compression)', function (value) { return parseInt(value); }) | ||
.option('--gzip-memory-level <number>', 'amount of memory which will be allocated for compression 8 (default), 1 (minimum memory) - 9 (maximum memory)', function (value) { return parseInt(value); }) | ||
.option('--gzip-strategy <number>', 'compression strategy 0 (default), 1 (filtered), 2 (huffman only), 3 (RLE), 4 (fixed)', function (value) { return parseInt(value); }) | ||
// TODO: Remove @deprecated --gzip-level | ||
.option('--gzip-level <number> (deprecated)', 'gzip compression level 6 (default), 0 (no compression) - 9 (best compression)', function (value) { return parseInt(value); }) | ||
.option('--level <number>', 'compression level 6 (default), 0 (no compression) - 9 (best compression)', function (value) { return parseInt(value); }) | ||
// TODO: Remove @deprecated --gzip-memory-level | ||
.option('--gzip-memory-level <number> (deprecated)', 'amount of memory which will be allocated for compression 8 (default), 1 (minimum memory) - 9 (maximum memory)', function (value) { return parseInt(value); }) | ||
.option('--memory-level <number>', 'amount of memory which will be allocated for compression 8 (default), 1 (minimum memory) - 9 (maximum memory)', function (value) { return parseInt(value); }) | ||
// TODO: Remove @deprecated --gzip-strategy | ||
.option('--gzip-strategy <number> (deprecated)', 'compression strategy 0 (default), 1 (filtered), 2 (huffman only), 3 (RLE), 4 (fixed)', function (value) { return parseInt(value); }) | ||
.option('--strategy <number>', 'compression strategy 0 (default), 1 (filtered), 2 (huffman only), 3 (RLE), 4 (fixed)', function (value) { return parseInt(value); }) | ||
.option('--deflate', 'enable deflate compression') | ||
.option('--brotli', 'enable brotli compression, Node.js >= v11.7.0') | ||
@@ -55,6 +62,16 @@ .option('--brotli-param-mode <value>', 'default, text (for UTF-8 text), font (for WOFF 2.0 fonts)') | ||
0, | ||
gzipLevel: parseInt(this.env.GZIPPER_GZIP_LEVEL) || commander_1.default.gzipLevel, | ||
gzipMemoryLevel: parseInt(this.env.GZIPPER_GZIP_MEMORY_LEVEL) || | ||
// TODO: Remove @deprecated GZIPPER_GZIP_LEVEL, gzipLevel | ||
level: parseInt(this.env.GZIPPER_LEVEL) || | ||
commander_1.default.level || | ||
parseInt(this.env.GZIPPER_GZIP_LEVEL) || | ||
commander_1.default.gzipLevel, | ||
// TODO: Remove @deprecated GZIPPER_GZIP_MEMORY_LEVEL, gzipMemoryLevel | ||
memoryLevel: parseInt(this.env.GZIPPER_MEMORY_LEVEL) || | ||
commander_1.default.memoryLevel || | ||
parseInt(this.env.GZIPPER_GZIP_MEMORY_LEVEL) || | ||
commander_1.default.gzipMemoryLevel, | ||
gzipStrategy: parseInt(this.env.GZIPPER_GZIP_STRATEGY) || | ||
// TODO: Remove @deprecated GZIPPER_GZIP_STRATEGY, gzipStrategy | ||
strategy: parseInt(this.env.GZIPPER_STRATEGY) || | ||
commander_1.default.strategy || | ||
parseInt(this.env.GZIPPER_GZIP_STRATEGY) || | ||
commander_1.default.gzipStrategy, | ||
@@ -64,2 +81,5 @@ brotli: this.env.GZIPPER_BROTLI | ||
: commander_1.default.brotli, | ||
deflate: this.env.GZIPPER_DEFLATE | ||
? !!parseInt(this.env.GZIPPER_DEFLATE) | ||
: commander_1.default.deflate, | ||
brotliParamMode: this.env.GZIPPER_BROTLI_PARAM_MODE || commander_1.default.brotliParamMode, | ||
@@ -108,2 +128,2 @@ brotliQuality: parseInt(this.env.GZIPPER_BROTLI_QUALITY) || | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFDQSx3REFBZ0M7QUFFaEMseUNBQXdDO0FBRXhDLElBQU0sT0FBTyxHQUFHLE9BQU8sQ0FBQyxnQkFBZ0IsQ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ist/index.js", |
@@ -7,7 +7,7 @@ /// <reference types="node" /> | ||
/** | ||
* Brotli | ||
* Brotli compression | ||
*/ | ||
export declare class BrotliCompression extends Compression { | ||
readonly compressionName = "BROTLI"; | ||
readonly ext = "br"; | ||
private compressionOptions; | ||
/** | ||
@@ -18,2 +18,6 @@ * Creates an instance of BrotliCompression | ||
/** | ||
* Returns brotli compression instance in closure. | ||
*/ | ||
getCompression(): () => zlib.BrotliCompress; | ||
/** | ||
* Returns human-readable brotli compression options info. | ||
@@ -23,13 +27,9 @@ */ | ||
/** | ||
* Returns brotli compression instance in closure. | ||
*/ | ||
getCompression(): () => zlib.BrotliCompress; | ||
/** | ||
* Build brotli options object [compressionOptions]. | ||
*/ | ||
private selectCompression; | ||
protected selectCompression(): void; | ||
/** | ||
* Returns human-readable brotli option name. | ||
*/ | ||
private getBrotliOptionName; | ||
protected getBrotliOptionName(index: string): string | undefined; | ||
/** | ||
@@ -36,0 +36,0 @@ * Check if brotli compression is exists on current Node.js version. |
@@ -22,3 +22,3 @@ "use strict"; | ||
/** | ||
* Brotli | ||
* Brotli compression | ||
*/ | ||
@@ -32,20 +32,8 @@ var BrotliCompression = /** @class */ (function (_super) { | ||
var _this = _super.call(this, options, logger) || this; | ||
_this.compressionName = 'BROTLI'; | ||
_this.ext = 'br'; | ||
_this.compressionOptions = {}; | ||
_this.availability(); | ||
_this.selectCompression(); | ||
return _this; | ||
} | ||
/** | ||
* Returns human-readable brotli compression options info. | ||
*/ | ||
BrotliCompression.prototype.readableOptions = function () { | ||
var options = ''; | ||
for (var _i = 0, _a = Object.entries(this.compressionOptions); _i < _a.length; _i++) { | ||
var _b = _a[_i], key = _b[0], value = _b[1]; | ||
options += this.getBrotliOptionName(parseInt(key)) + ": " + value + ", "; | ||
} | ||
return "BROTLI -> " + options.slice(0, -2); | ||
}; | ||
/** | ||
* Returns brotli compression instance in closure. | ||
@@ -62,2 +50,8 @@ */ | ||
/** | ||
* Returns human-readable brotli compression options info. | ||
*/ | ||
BrotliCompression.prototype.readableOptions = function () { | ||
return _super.prototype.readableOptions.call(this, this.getBrotliOptionName.bind(this)); | ||
}; | ||
/** | ||
* Build brotli options object [compressionOptions]. | ||
@@ -99,3 +93,3 @@ */ | ||
BrotliCompression.prototype.getBrotliOptionName = function (index) { | ||
switch (index) { | ||
switch (parseInt(index)) { | ||
case zlib_1.default.constants.BROTLI_PARAM_MODE: | ||
@@ -122,2 +116,2 @@ return 'brotliParamMode'; | ||
exports.BrotliCompression = BrotliCompression; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQnJvdGxpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvbXByZXNzaW9ucy9Ccm90bGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsOENBQXdCO0FBRXhCLDZDQUE0QztBQU01Qzs7R0FFRztBQUNIO0lBQXVDLHFDQUFXO0lBR2hEOztPQUVHO0lBQ0gsMkJBQVksT0FBc0IsRUFBRSxNQUFjO1FBQWxELFlBQ0Usa0JBQU0sT0FBTyxFQUFFLE1BQU0sQ0FBQyxTQUd2QjtRQVRlLFNBQUcsR0FBRyxJQUFJLENBQUM7UUFDbkIsd0JBQWtCLEdBQWtCLEVBQUUsQ0FBQztRQU03QyxLQUFJLENBQUMsWUFBWSxFQUFFLENBQUM7UUFDcEIsS0FBSSxDQUFDLGlCQUFpQixFQUFFLENBQUM7O0lBQzNCLENBQUM7SUFFRDs7T0FFRztJQUNJLDJDQUFlLEdBQXRCO1FBQ0UsSUFBSSxPQUFPLEdBQUcsRUFBRSxDQUFDO1FBRWpCLEtBQTJCLFVBQXVDLEVBQXZDLEtBQUEsTUFBTSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsa0JBQWtCLENBQUMsRUFBdkMsY0FBdUMsRUFBdkMsSUFBdUMsRUFBRTtZ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LLENBQUMsT0FBTyxDQUFDLENBQUM7U0FDMUI7SUFDSCxDQUFDO0lBQ0gsd0JBQUM7QUFBRCxDQUFDLEFBaEdELENBQXVDLHlCQUFXLEdBZ0dqRDtBQWhHWSw4Q0FBaUIifQ== |
/// <reference types="node" /> | ||
import zlib from 'zlib'; | ||
import { GlobalOptions } from '../interfaces'; | ||
import { GlobalOptions, CompressionOptions, BrotliOptions } from '../interfaces'; | ||
import { Logger } from '../Logger'; | ||
export declare abstract class Compression { | ||
abstract ext: string; | ||
abstract compressionName: string; | ||
protected readonly options: GlobalOptions; | ||
protected readonly logger: Logger; | ||
protected compressionOptions: CompressionOptions | BrotliOptions; | ||
/** | ||
@@ -13,9 +16,13 @@ * Creates an instance of Compression. | ||
/** | ||
* Returns a compression instance in closure. | ||
*/ | ||
abstract getCompression(): () => zlib.BrotliCompress | zlib.Gzip; | ||
/** | ||
* Returns human-readable compression options info. | ||
*/ | ||
abstract readableOptions(): string; | ||
readableOptions(keyWrapper?: (key: string) => string | undefined): string; | ||
/** | ||
* Returns a compression instance in closure. | ||
* Build compression options object [compressionOptions]. | ||
*/ | ||
abstract getCompression(): () => zlib.BrotliCompress | zlib.Gzip; | ||
protected selectCompression(): void; | ||
} |
@@ -8,8 +8,38 @@ "use strict"; | ||
function Compression(options, logger) { | ||
this.compressionOptions = {}; | ||
this.options = options; | ||
this.logger = logger; | ||
this.selectCompression(); | ||
} | ||
/** | ||
* Returns human-readable compression options info. | ||
*/ | ||
Compression.prototype.readableOptions = function (keyWrapper) { | ||
if (keyWrapper === void 0) { keyWrapper = function (key) { return key; }; } | ||
var options = ''; | ||
for (var _i = 0, _a = Object.entries(this.compressionOptions); _i < _a.length; _i++) { | ||
var _b = _a[_i], key = _b[0], value = _b[1]; | ||
options += keyWrapper(key) + ": " + value + ", "; | ||
} | ||
return this.compressionName + " -> " + options.slice(0, -2); | ||
}; | ||
/** | ||
* Build compression options object [compressionOptions]. | ||
*/ | ||
Compression.prototype.selectCompression = function () { | ||
var options = {}; | ||
if (this.options.level !== undefined) { | ||
options.level = this.options.level; | ||
} | ||
if (this.options.memoryLevel !== undefined) { | ||
options.memLevel = this.options.memoryLevel; | ||
} | ||
if (this.options.strategy !== undefined) { | ||
options.strategy = this.options.strategy; | ||
} | ||
this.compressionOptions = options; | ||
}; | ||
return Compression; | ||
}()); | ||
exports.Compression = Compression; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29tcHJlc3Npb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29tcHJlc3Npb25zL0NvbXByZXNzaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBS0E7SUFHRTs7T0FFRztJQUNILHFCQUFZLE9BQXNCLEVBQUUsTUFBYztRQUNoRCxJQUFJLENBQUMsT0FBTyxHQUFHLE9BQU8sQ0FBQztRQUN2QixJQUFJLENBQUMsTUFBTSxHQUFHLE1BQU0sQ0FBQztJQUN2QixDQUFDO0lBV0gsa0JBQUM7QUFBRCxDQUFDLEFBcEJELElBb0JDO0FBcEJxQixrQ0FBVyJ9 | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29tcHJlc3Npb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29tcHJlc3Npb25zL0NvbXByZXNzaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBU0E7SUFNRTs7T0FFRztJQUNILHFCQUFZLE9BQXNCLEVBQUUsTUFBYztRQUp4Qyx1QkFBa0IsR0FBdUMsRUFBRSxDQUFDO1FBS3BFLElBQUksQ0FBQyxPQUFPLEdBQUcsT0FBTyxDQUFDO1FBQ3ZCLElBQUksQ0FBQyxNQUFNLEdBQUcsTUFBTSxDQUFDO1FBQ3JCLElBQUksQ0FBQyxpQkFBaUIsRUFBRS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FFBQVEsR0FBRyxJQUFJLENBQUMsT0FBTyxDQUFDLFFBQVEsQ0FBQztTQUMxQztRQUVELElBQUksQ0FBQyxrQkFBa0IsR0FBRyxPQUFPLENBQUM7SUFDcEMsQ0FBQztJQUNILGtCQUFDO0FBQUQsQ0FBQyxBQXpERCxJQXlEQztBQXpEcUIsa0NBQVcifQ== |
@@ -7,7 +7,7 @@ /// <reference types="node" /> | ||
/** | ||
* Gzip | ||
* Gzip compression | ||
*/ | ||
export declare class GzipCompression extends Compression { | ||
readonly compressionName = "GZIP"; | ||
readonly ext = "gz"; | ||
private compressionOptions; | ||
/** | ||
@@ -18,13 +18,5 @@ * Creates an instance of GzipCompression. | ||
/** | ||
* Returns human-readable gzip compression options info. | ||
*/ | ||
readableOptions(): string; | ||
/** | ||
* Returns gzip compression instance in closure. | ||
*/ | ||
getCompression(): () => zlib.Gzip; | ||
/** | ||
* Build gzip options object [compressionOptions]. | ||
*/ | ||
private selectCompression; | ||
} |
@@ -22,3 +22,3 @@ "use strict"; | ||
/** | ||
* Gzip | ||
* Gzip compression | ||
*/ | ||
@@ -32,19 +32,7 @@ var GzipCompression = /** @class */ (function (_super) { | ||
var _this = _super.call(this, options, logger) || this; | ||
_this.compressionName = 'GZIP'; | ||
_this.ext = 'gz'; | ||
_this.compressionOptions = {}; | ||
_this.selectCompression(); | ||
return _this; | ||
} | ||
/** | ||
* Returns human-readable gzip compression options info. | ||
*/ | ||
GzipCompression.prototype.readableOptions = function () { | ||
var options = ''; | ||
for (var _i = 0, _a = Object.entries(this.compressionOptions); _i < _a.length; _i++) { | ||
var _b = _a[_i], key = _b[0], value = _b[1]; | ||
options += key + ": " + value + ", "; | ||
} | ||
return "GZIP -> " + options.slice(0, -2); | ||
}; | ||
/** | ||
* Returns gzip compression instance in closure. | ||
@@ -56,21 +44,5 @@ */ | ||
}; | ||
/** | ||
* Build gzip options object [compressionOptions]. | ||
*/ | ||
GzipCompression.prototype.selectCompression = function () { | ||
var options = {}; | ||
if (this.options.gzipLevel !== undefined) { | ||
options.level = this.options.gzipLevel; | ||
} | ||
if (this.options.gzipMemoryLevel !== undefined) { | ||
options.memLevel = this.options.gzipMemoryLevel; | ||
} | ||
if (this.options.gzipStrategy !== undefined) { | ||
options.strategy = this.options.gzipStrategy; | ||
} | ||
this.compressionOptions = options; | ||
}; | ||
return GzipCompression; | ||
}(Compression_1.Compression)); | ||
exports.GzipCompression = GzipCompression; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiR3ppcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wcmVzc2lvbnMvR3ppcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSw4Q0FBd0I7QUFFeEIsNkNBQTRDO0FBVTVDOztHQUVHO0FBQ0g7SUFBcUMsbUNBQVc7SUFHOUM7O09BRUc7SUFDSCx5QkFBWSxPQUFzQixFQUFFLE1BQWM7UUFBbEQsWUFDRSxrQkFBTSxPQUFPLEVBQUUsTUFBTSxDQUFDLFNBRXZCO1FBUmUsU0FBRyxHQUFHLElBQUksQ0FBQztRQUNuQix3QkFBa0IsR0FBZ0IsRUFBRSxDQUFDO1FBTTNDLEtBQUksQ0FBQyxpQkFBaUIsRUFBRSxDQUFDOztJQUMzQixDQUFDO0lBRUQ7O09BRUc7SUFDSSx5Q0FBZSxHQUF0QjtRQUNFLElBQUksT0FBTyxHQUFHLEVBQUUsQ0FBQztRQUVqQixLQUEyQixVQUF1QyxFQUF2QyxLQUFBLE1BQU0sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLGtCQUFrQixDQUFDLEVBQXZDLGNBQXVDLEVBQXZDLElBQXVDLEVBQUU7WUFBekQsSUFBQSxXQUFZLEVBQVgsV0FBRyxFQUFFLGFBQUs7WUFDcEIsT0FBTyxJQUFPLEdBQUcsVUFBSyxLQU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ZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wcmVzc2lvbnMvR3ppcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSw4Q0FBd0I7QUFFeEIsNkNBQTRDO0FBSTVDOztHQUVHO0FBQ0g7SUFBcUMsbUNBQVc7SUFHOUM7O09BRUc7SUFDSCx5QkFBWSxPQUFzQixFQUFFLE1BQWM7UUFBbEQsWUFDRSxrQkFBTSxPQUFPLEVBQUUsTUFBTSxDQUFDLFNBQ3ZCO1FBUGUscUJBQWUsR0FBRyxNQUFNLENBQUM7UUFDekIsU0FBRyxHQUFHLElBQUksQ0FBQzs7SUFNM0IsQ0FBQztJQUVEOztPQUVHO0lBQ0ksd0NBQWMsR0FBckI7UUFBQSxpQkFFQztRQURDLE9BQU8sY0FBaUIsT0FBQSxjQUFJLENBQUMsVUFBVSxDQUFDLEtBQUksQ0FBQyxrQkFBa0IsQ0FBQyxFQUF4QyxDQUF3QyxDQUFDO0lBQ25FLENBQUM7SUFDSCxzQkFBQztBQUFELENBQUMsQUFoQkQsQ0FBcUMseUJBQVcsR0FnQi9DO0FBaEJZLDBDQUFlIn0= |
@@ -24,2 +24,6 @@ import { GlobalOptions } from './interfaces'; | ||
/** | ||
* Return compression instance. | ||
*/ | ||
private getCompressionInstance; | ||
/** | ||
* Compile files in folder recursively. | ||
@@ -26,0 +30,0 @@ */ |
@@ -51,2 +51,3 @@ "use strict"; | ||
var constants_1 = require("./constants"); | ||
var Deflate_1 = require("./compressions/Deflate"); | ||
var OUTPUT_FILE_FORMAT_REGEXP = /(\[filename\]*)|(\[hash\]*)|(\[compressExt\]*)|(\[ext\]*)/g; | ||
@@ -81,5 +82,3 @@ /** | ||
} | ||
this.compressionInstance = this.options.brotli | ||
? new Brotli_1.BrotliCompression(this.options, this.logger) | ||
: new Gzip_1.GzipCompression(this.options, this.logger); | ||
this.compressionInstance = this.getCompressionInstance(); | ||
this.target = path_1.default.resolve(process.cwd(), target); | ||
@@ -128,2 +127,16 @@ this.createCompression = this.compressionInstance.getCompression(); | ||
/** | ||
* Return compression instance. | ||
*/ | ||
Gzipper.prototype.getCompressionInstance = function () { | ||
if (this.options.brotli) { | ||
return new Brotli_1.BrotliCompression(this.options, this.logger); | ||
} | ||
else if (this.options.deflate) { | ||
return new Deflate_1.DeflateCompression(this.options, this.logger); | ||
} | ||
else { | ||
return new Gzip_1.GzipCompression(this.options, this.logger); | ||
} | ||
}; | ||
/** | ||
* Compile files in folder recursively. | ||
@@ -304,2 +317,2 @@ */ | ||
exports.Gzipper = Gzipper; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiR3ppcHBlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9HemlwcGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsMENBQW9CO0FBQ3BCLDhDQUF3QjtBQUN4Qiw4Q0FBd0I7QUFDeEIsK0NBQTJCO0FBQzNCLGtEQUE0QjtBQUU1QixtQ0FBa0M7QUFDbEMsZ0RBQTBEO0FBQzFELDRDQUFzRDtBQUN0RCx5Q0FBK0M7QUFHL0MsSUFBTSx5QkFBeUIsR0FBRyw0REFBNEQsQ0FBQztBQUUvRjs7R0FFRztBQUNIO0lBbUJFOztPQUVHO0lBQ0gsaUJBQ0UsTUFBaUMsRUFDakMsVUFBcUMsRUFDckMsT0FBb0M7UUFBcEMsd0JBQUEsRUFBQSxVQUF5QixFQUFXO1FBeEJyQixhQUFRLEdBQUc7WUFDMUIsSUFBSSxFQUFFLGNBQUksQ0FBQyxTQUFTLENBQUMsWUFBRSxDQUFDLElBQUksQ0FBQztZQUM3QixLQUFLLEVBQUUsY0FBSSx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UFNLENBQzVCLFVBQUEsU0FBUyxJQUFJLE9BQUEsQ0FBQyxpQkFBaUIsQ0FBQyxRQUFRLENBQUMsU0FBUyxDQUFDLEVBQXRDLENBQXNDLENBQ3BELENBQUM7U0FDSDtRQUVELElBQUksaUJBQWlCLEVBQUU7WUFDckIsT0FBTyw0QkFBZ0IsQ0FBQyxNQUFNLENBQUMsVUFBQSxTQUFTO2dCQUN0QyxPQUFBLGlCQUFpQixDQUFDLFFBQVEsQ0FBQyxTQUFTLENBQUM7WUFBckMsQ0FBcUMsQ0FDdEMsQ0FBQztTQUNIO1FBRUQsT0FBTyw0QkFBZ0IsQ0FBQztJQUMxQixDQUFDO0lBQ0gsY0FBQztBQUFELENBQUMsQUFqUUQsSUFpUUM7QUFqUVksMEJBQU8ifQ== |
@@ -0,1 +1,3 @@ | ||
/// <reference types="node" /> | ||
import zlib from 'zlib'; | ||
export interface GlobalOptions { | ||
@@ -6,5 +8,6 @@ verbose?: boolean; | ||
threshold: number; | ||
gzipLevel?: number; | ||
gzipMemoryLevel?: number; | ||
gzipStrategy?: number; | ||
level?: number; | ||
memoryLevel?: number; | ||
strategy?: number; | ||
deflate?: boolean; | ||
brotli?: boolean; | ||
@@ -17,1 +20,9 @@ brotliParamMode?: string; | ||
} | ||
export declare type CompressionOptions = { | ||
level?: number; | ||
memoryLevel?: number; | ||
strategy?: number; | ||
} & zlib.ZlibOptions; | ||
export declare type BrotliOptions = { | ||
[key: number]: number; | ||
}; |
46
index.ts
@@ -35,4 +35,5 @@ #!/usr/bin/env node | ||
) | ||
// TODO: Remove @deprecated --gzip-level | ||
.option( | ||
'--gzip-level <number>', | ||
'--gzip-level <number> (deprecated)', | ||
'gzip compression level 6 (default), 0 (no compression) - 9 (best compression)', | ||
@@ -42,3 +43,9 @@ value => parseInt(value), | ||
.option( | ||
'--gzip-memory-level <number>', | ||
'--level <number>', | ||
'compression level 6 (default), 0 (no compression) - 9 (best compression)', | ||
value => parseInt(value), | ||
) | ||
// TODO: Remove @deprecated --gzip-memory-level | ||
.option( | ||
'--gzip-memory-level <number> (deprecated)', | ||
'amount of memory which will be allocated for compression 8 (default), 1 (minimum memory) - 9 (maximum memory)', | ||
@@ -48,6 +55,18 @@ value => parseInt(value), | ||
.option( | ||
'--gzip-strategy <number>', | ||
'--memory-level <number>', | ||
'amount of memory which will be allocated for compression 8 (default), 1 (minimum memory) - 9 (maximum memory)', | ||
value => parseInt(value), | ||
) | ||
// TODO: Remove @deprecated --gzip-strategy | ||
.option( | ||
'--gzip-strategy <number> (deprecated)', | ||
'compression strategy 0 (default), 1 (filtered), 2 (huffman only), 3 (RLE), 4 (fixed)', | ||
value => parseInt(value), | ||
) | ||
.option( | ||
'--strategy <number>', | ||
'compression strategy 0 (default), 1 (filtered), 2 (huffman only), 3 (RLE), 4 (fixed)', | ||
value => parseInt(value), | ||
) | ||
.option('--deflate', 'enable deflate compression') | ||
.option('--brotli', 'enable brotli compression, Node.js >= v11.7.0') | ||
@@ -99,8 +118,18 @@ .option( | ||
0, | ||
gzipLevel: | ||
parseInt(this.env.GZIPPER_GZIP_LEVEL as string) || program.gzipLevel, | ||
gzipMemoryLevel: | ||
// TODO: Remove @deprecated GZIPPER_GZIP_LEVEL, gzipLevel | ||
level: | ||
parseInt(this.env.GZIPPER_LEVEL as string) || | ||
program.level || | ||
parseInt(this.env.GZIPPER_GZIP_LEVEL as string) || | ||
program.gzipLevel, | ||
// TODO: Remove @deprecated GZIPPER_GZIP_MEMORY_LEVEL, gzipMemoryLevel | ||
memoryLevel: | ||
parseInt(this.env.GZIPPER_MEMORY_LEVEL as string) || | ||
program.memoryLevel || | ||
parseInt(this.env.GZIPPER_GZIP_MEMORY_LEVEL as string) || | ||
program.gzipMemoryLevel, | ||
gzipStrategy: | ||
// TODO: Remove @deprecated GZIPPER_GZIP_STRATEGY, gzipStrategy | ||
strategy: | ||
parseInt(this.env.GZIPPER_STRATEGY as string) || | ||
program.strategy || | ||
parseInt(this.env.GZIPPER_GZIP_STRATEGY as string) || | ||
@@ -111,2 +140,5 @@ program.gzipStrategy, | ||
: program.brotli, | ||
deflate: this.env.GZIPPER_DEFLATE | ||
? !!parseInt(this.env.GZIPPER_DEFLATE as string) | ||
: program.deflate, | ||
brotliParamMode: | ||
@@ -113,0 +145,0 @@ this.env.GZIPPER_BROTLI_PARAM_MODE || program.brotliParamMode, |
{ | ||
"name": "gzipper", | ||
"version": "3.2.1", | ||
"version": "3.3.0", | ||
"description": "CLI for compressing files.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -73,18 +73,19 @@ # Gzipper | ||
| Option | ENV | Description | | ||
| ----------------------------------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `-V, --version` | | output the version number | | ||
| `-v, --verbose` | `GZIPPER_VERBOSE` (0 or 1) | detailed level of logs | | ||
| `-e, --exclude <extensions>` | `GZIPPER_EXCLUDE` | exclude file extensions from compression, example: jpeg,jpg... | | ||
| `-i, --include <extensions>` | `GZIPPER_INCLUDE` | include file extensions for compression, example: js,css,html... | | ||
| `-t, --threshold <number>` | `GZIPPER_THRESHOLD` | exclude assets smaller than this byte size. 0 (default) | | ||
| `--gzip-level <number>` | `GZIPPER_GZIP_LEVEL` | gzip compression level 6 (default), 0 (no compression) - 9 (best compression) | | ||
| `--gzip-memory-level <number>` | `GZIPPER_GZIP_MEMORY_LEVEL` | amount of memory which will be allocated for compression 8 (default), 1 (minimum memory) - 9 (maximum memory) | | ||
| `--gzip-strategy <number>` | `GZIPPER_GZIP_STRATEGY` | compression strategy 0 (default), 1 (filtered), 2 (huffman only), 3 (RLE), 4 (fixed) | | ||
| `--brotli` | `GZIPPER_BROTLI` (0 or 1) | enable brotli compression, Node.js >= v11.7.0 | | ||
| `--brotli-param-mode <value>` | `GZIPPER_BROTLI_PARAM_MODE` | default, text (for UTF-8 text), font (for WOFF 2.0 fonts) | | ||
| `--brotli-quality <number>` | `GZIPPER_BROTLI_QUALITY` | brotli compression quality 11 (default), 0 - 11 | | ||
| `--brotli-size-hint <number>` | `GZIPPER_BROTLI_SIZE_HINT` | expected input size 0 (default) | | ||
| `--output-file-format <value>` | `GZIPPER_OUTPUT_FILE_FORMAT` | output file format with artifacts, default format: `[filename].[ext].[compressExt]`. Where: `filename` -> name of your file, `ext` -> file extension, `compressExt` -> compress extension (.gz, .br, etc), `hash` -> uniq uuid/v4 hash. [More examples](#output-file-format) | | ||
| `-h, --help` | | output usage information | | ||
| Option | ENV | Description | | ||
| -------------------------------------------------------------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `-V, --version` | | output the version number | | ||
| `-v, --verbose` | `GZIPPER_VERBOSE` (0 or 1) | detailed level of logs | | ||
| `-e, --exclude <extensions>` | `GZIPPER_EXCLUDE` | exclude file extensions from compression, example: jpeg,jpg... | | ||
| `-i, --include <extensions>` | `GZIPPER_INCLUDE` | include file extensions for compression, example: js,css,html... | | ||
| `-t, --threshold <number>` | `GZIPPER_THRESHOLD` | exclude assets smaller than this byte size. 0 (default) | | ||
| `--gzip-level <number>`(deprecated) or `--level` | `GZIPPER_GZIP_LEVEL`(deprecated) or `GZIPPER_LEVEL` | compression level 6 (default), 0 (no compression) - 9 (best compression) | | ||
| `--gzip-memory-level <number>`(deprecated) or `--memory-level` | `GZIPPER_GZIP_MEMORY_LEVEL`(deprecated) or `GZIPPER_MEMORY_LEVEL` | amount of memory which will be allocated for compression 8 (default), 1 (minimum memory) - 9 (maximum memory) | | ||
| `--gzip-strategy <number>`(deprecated) or `--strategy` | `GZIPPER_GZIP_STRATEGY`(deprecated) or `GZIPPER_STRATEGY` | compression strategy 0 (default), 1 (filtered), 2 (huffman only), 3 (RLE), 4 (fixed) | | ||
| `--deflate` | `GZIPPER_DEFLATE` (0 or 1) | enable deflate compression | | ||
| `--brotli` | `GZIPPER_BROTLI` (0 or 1) | enable brotli compression, Node.js >= v11.7.0 | | ||
| `--brotli-param-mode <value>` | `GZIPPER_BROTLI_PARAM_MODE` | default, text (for UTF-8 text), font (for WOFF 2.0 fonts), only for `--brotli` | | ||
| `--brotli-quality <number>` | `GZIPPER_BROTLI_QUALITY` | brotli compression quality 11 (default), 0 - 11, only for `--brotli` | | ||
| `--brotli-size-hint <number>` | `GZIPPER_BROTLI_SIZE_HINT` | expected input size 0 (default), only for `--brotli` | | ||
| `--output-file-format <value>` | `GZIPPER_OUTPUT_FILE_FORMAT` | output file format with artifacts, default format: `[filename].[ext].[compressExt]`. Where: `filename` -> name of your file, `ext` -> file extension, `compressExt` -> compress extension (.gz, .br, etc), `hash` -> uniq uuid/v4 hash. [More examples](#output-file-format) | | ||
| `-h, --help` | | output usage information | | ||
@@ -91,0 +92,0 @@ > ENV Variables have higher priority over CLI arguments. |
@@ -5,12 +5,10 @@ import zlib from 'zlib'; | ||
import { Logger } from '../Logger'; | ||
import { GlobalOptions } from '../interfaces'; | ||
import { GlobalOptions, BrotliOptions } from '../interfaces'; | ||
type BrotliOptions = { [key: number]: number }; | ||
/** | ||
* Brotli | ||
* Brotli compression | ||
*/ | ||
export class BrotliCompression extends Compression { | ||
public readonly compressionName = 'BROTLI'; | ||
public readonly ext = 'br'; | ||
private compressionOptions: BrotliOptions = {}; | ||
/** | ||
@@ -22,19 +20,5 @@ * Creates an instance of BrotliCompression | ||
this.availability(); | ||
this.selectCompression(); | ||
} | ||
/** | ||
* Returns human-readable brotli compression options info. | ||
*/ | ||
public readableOptions(): string { | ||
let options = ''; | ||
for (const [key, value] of Object.entries(this.compressionOptions)) { | ||
options += `${this.getBrotliOptionName(parseInt(key))}: ${value}, `; | ||
} | ||
return `BROTLI -> ${options.slice(0, -2)}`; | ||
} | ||
/** | ||
* Returns brotli compression instance in closure. | ||
@@ -50,5 +34,12 @@ */ | ||
/** | ||
* Returns human-readable brotli compression options info. | ||
*/ | ||
public readableOptions(): string { | ||
return super.readableOptions(this.getBrotliOptionName.bind(this)); | ||
} | ||
/** | ||
* Build brotli options object [compressionOptions]. | ||
*/ | ||
private selectCompression(): void { | ||
protected selectCompression(): void { | ||
const options: BrotliOptions = {}; | ||
@@ -95,6 +86,4 @@ | ||
*/ | ||
private getBrotliOptionName( | ||
index: number, | ||
): 'brotliParamMode' | 'brotliQuality' | 'brotliSizeHint' | undefined { | ||
switch (index) { | ||
protected getBrotliOptionName(index: string): string | undefined { | ||
switch (parseInt(index)) { | ||
case zlib.constants.BROTLI_PARAM_MODE: | ||
@@ -101,0 +90,0 @@ return 'brotliParamMode'; |
import zlib from 'zlib'; | ||
import { GlobalOptions } from '../interfaces'; | ||
import { | ||
GlobalOptions, | ||
CompressionOptions, | ||
BrotliOptions, | ||
} from '../interfaces'; | ||
import { Logger } from '../Logger'; | ||
export abstract class Compression { | ||
public abstract ext: string; | ||
public abstract compressionName: string; | ||
protected readonly options: GlobalOptions; | ||
protected readonly logger: Logger; | ||
protected compressionOptions: CompressionOptions | BrotliOptions = {}; | ||
/** | ||
@@ -15,13 +22,47 @@ * Creates an instance of Compression. | ||
this.logger = logger; | ||
this.selectCompression(); | ||
} | ||
/** | ||
* Returns a compression instance in closure. | ||
*/ | ||
public abstract getCompression(): () => zlib.BrotliCompress | zlib.Gzip; | ||
/** | ||
* Returns human-readable compression options info. | ||
*/ | ||
public abstract readableOptions(): string; | ||
public readableOptions( | ||
keyWrapper: (key: string) => string | undefined = ( | ||
key: string, | ||
): string | undefined => key, | ||
): string { | ||
let options = ''; | ||
for (const [key, value] of Object.entries(this.compressionOptions)) { | ||
options += `${keyWrapper(key)}: ${value}, `; | ||
} | ||
return `${this.compressionName} -> ${options.slice(0, -2)}`; | ||
} | ||
/** | ||
* Returns a compression instance in closure. | ||
* Build compression options object [compressionOptions]. | ||
*/ | ||
public abstract getCompression(): () => zlib.BrotliCompress | zlib.Gzip; | ||
protected selectCompression(): void { | ||
const options: CompressionOptions = {}; | ||
if (this.options.level !== undefined) { | ||
options.level = this.options.level; | ||
} | ||
if (this.options.memoryLevel !== undefined) { | ||
options.memLevel = this.options.memoryLevel; | ||
} | ||
if (this.options.strategy !== undefined) { | ||
options.strategy = this.options.strategy; | ||
} | ||
this.compressionOptions = options; | ||
} | ||
} |
@@ -7,14 +7,8 @@ import zlib from 'zlib'; | ||
type GzipOptions = { | ||
gzipLevel?: number; | ||
gzipMemoryLevel?: number; | ||
gzipStrategy?: number; | ||
} & zlib.ZlibOptions; | ||
/** | ||
* Gzip | ||
* Gzip compression | ||
*/ | ||
export class GzipCompression extends Compression { | ||
public readonly compressionName = 'GZIP'; | ||
public readonly ext = 'gz'; | ||
private compressionOptions: GzipOptions = {}; | ||
/** | ||
@@ -25,19 +19,5 @@ * Creates an instance of GzipCompression. | ||
super(options, logger); | ||
this.selectCompression(); | ||
} | ||
/** | ||
* Returns human-readable gzip compression options info. | ||
*/ | ||
public readableOptions(): string { | ||
let options = ''; | ||
for (const [key, value] of Object.entries(this.compressionOptions)) { | ||
options += `${key}: ${value}, `; | ||
} | ||
return `GZIP -> ${options.slice(0, -2)}`; | ||
} | ||
/** | ||
* Returns gzip compression instance in closure. | ||
@@ -48,23 +28,2 @@ */ | ||
} | ||
/** | ||
* Build gzip options object [compressionOptions]. | ||
*/ | ||
private selectCompression(): void { | ||
const options: GzipOptions = {}; | ||
if (this.options.gzipLevel !== undefined) { | ||
options.level = this.options.gzipLevel; | ||
} | ||
if (this.options.gzipMemoryLevel !== undefined) { | ||
options.memLevel = this.options.gzipMemoryLevel; | ||
} | ||
if (this.options.gzipStrategy !== undefined) { | ||
options.strategy = this.options.gzipStrategy; | ||
} | ||
this.compressionOptions = options; | ||
} | ||
} |
@@ -12,2 +12,3 @@ import fs from 'fs'; | ||
import { GlobalOptions } from './interfaces'; | ||
import { DeflateCompression } from './compressions/Deflate'; | ||
@@ -32,7 +33,11 @@ const OUTPUT_FILE_FORMAT_REGEXP = /(\[filename\]*)|(\[hash\]*)|(\[compressExt\]*)|(\[ext\]*)/g; | ||
private readonly outputPath: string | undefined; | ||
private readonly compressionInstance: BrotliCompression | GzipCompression; | ||
private readonly compressionInstance: | ||
| BrotliCompression | ||
| GzipCompression | ||
| DeflateCompression; | ||
private readonly target: string; | ||
private readonly createCompression: | ||
| ReturnType<BrotliCompression['getCompression']> | ||
| ReturnType<GzipCompression['getCompression']>; | ||
| ReturnType<GzipCompression['getCompression']> | ||
| ReturnType<DeflateCompression['getCompression']>; | ||
private readonly validExtensions: string[]; | ||
@@ -57,5 +62,3 @@ /** | ||
} | ||
this.compressionInstance = this.options.brotli | ||
? new BrotliCompression(this.options, this.logger) | ||
: new GzipCompression(this.options, this.logger); | ||
this.compressionInstance = this.getCompressionInstance(); | ||
this.target = path.resolve(process.cwd(), target); | ||
@@ -101,2 +104,18 @@ this.createCompression = this.compressionInstance.getCompression(); | ||
/** | ||
* Return compression instance. | ||
*/ | ||
private getCompressionInstance(): | ||
| BrotliCompression | ||
| DeflateCompression | ||
| GzipCompression { | ||
if (this.options.brotli) { | ||
return new BrotliCompression(this.options, this.logger); | ||
} else if (this.options.deflate) { | ||
return new DeflateCompression(this.options, this.logger); | ||
} else { | ||
return new GzipCompression(this.options, this.logger); | ||
} | ||
} | ||
/** | ||
* Compile files in folder recursively. | ||
@@ -103,0 +122,0 @@ */ |
@@ -0,1 +1,3 @@ | ||
import zlib from 'zlib'; | ||
export interface GlobalOptions { | ||
@@ -6,5 +8,6 @@ verbose?: boolean; | ||
threshold: number; | ||
gzipLevel?: number; | ||
gzipMemoryLevel?: number; | ||
gzipStrategy?: number; | ||
level?: number; | ||
memoryLevel?: number; | ||
strategy?: number; | ||
deflate?: boolean; | ||
brotli?: boolean; | ||
@@ -17,1 +20,9 @@ brotliParamMode?: string; | ||
} | ||
export type CompressionOptions = { | ||
level?: number; | ||
memoryLevel?: number; | ||
strategy?: number; | ||
} & zlib.ZlibOptions; | ||
export type BrotliOptions = { [key: number]: number }; |
@@ -7,3 +7,8 @@ import assert from 'assert'; | ||
import { Gzipper } from '../../../src/Gzipper'; | ||
import { COMPRESS_PATH, getFiles, clear } from '../../utils'; | ||
import { | ||
COMPRESS_PATH, | ||
getFiles, | ||
clear, | ||
COMPRESSION_EXTENSIONS, | ||
} from '../../utils'; | ||
@@ -14,5 +19,9 @@ const describeTest = disableBrotli ? describe.skip : describe; | ||
beforeEach(async () => { | ||
await clear(COMPRESS_PATH, ['.gz', '.br']); | ||
await clear(COMPRESS_PATH, COMPRESSION_EXTENSIONS); | ||
}); | ||
afterEach(async () => { | ||
await clear(COMPRESS_PATH, COMPRESSION_EXTENSIONS); | ||
}); | ||
it('--brotli should emit error on compress error', () => { | ||
@@ -203,6 +212,2 @@ const createBrotliCompress = | ||
}); | ||
afterEach(async () => { | ||
await clear(COMPRESS_PATH, ['.gz', '.br']); | ||
}); | ||
}); |
@@ -6,14 +6,23 @@ import assert from 'assert'; | ||
import { Gzipper } from '../../../src/Gzipper'; | ||
import { COMPRESS_PATH, getFiles, clear } from '../../utils'; | ||
import { | ||
COMPRESS_PATH, | ||
getFiles, | ||
clear, | ||
COMPRESSION_EXTENSIONS, | ||
} from '../../utils'; | ||
describe('CLI Gzipper -> Gzip compression', () => { | ||
beforeEach(async () => { | ||
await clear(COMPRESS_PATH, ['.gz', '.br']); | ||
await clear(COMPRESS_PATH, COMPRESSION_EXTENSIONS); | ||
}); | ||
it('--gzip-level, --gzip-memory-level, --gzip-strategy should change gzip configuration', async () => { | ||
afterEach(async () => { | ||
await clear(COMPRESS_PATH, COMPRESSION_EXTENSIONS); | ||
}); | ||
it('--level, --memory-level, --strategy should change gzip configuration', async () => { | ||
const options = { | ||
gzipLevel: 6, | ||
gzipMemoryLevel: 4, | ||
gzipStrategy: 2, | ||
level: 6, | ||
memoryLevel: 4, | ||
strategy: 2, | ||
threshold: 0, | ||
@@ -55,6 +64,2 @@ }; | ||
}); | ||
afterEach(async () => { | ||
await clear(COMPRESS_PATH, ['.gz', '.br']); | ||
}); | ||
}); |
@@ -16,2 +16,3 @@ import assert from 'assert'; | ||
clear, | ||
COMPRESSION_EXTENSIONS, | ||
} from '../utils'; | ||
@@ -26,3 +27,3 @@ import { GlobalOptions } from '../../src/interfaces'; | ||
await createFolder(COMPRESS_PATH_TARGET); | ||
await clear(COMPRESS_PATH, ['.gz', '.br']); | ||
await clear(COMPRESS_PATH, COMPRESSION_EXTENSIONS); | ||
sinonSandbox = sinon.createSandbox(); | ||
@@ -34,3 +35,3 @@ }); | ||
await clear(COMPRESS_PATH_TARGET, true); | ||
await clear(COMPRESS_PATH, ['.gz', '.br']); | ||
await clear(COMPRESS_PATH, COMPRESSION_EXTENSIONS); | ||
sinonSandbox.restore(); | ||
@@ -37,0 +38,0 @@ sinon.restore(); |
@@ -29,2 +29,96 @@ import sinon from 'sinon'; | ||
/* | ||
* @deprecated | ||
* TODO: Remove | ||
* --gzip-level | ||
* --gzip-memory-level | ||
* --gzip-strategy | ||
*/ | ||
it('--gzip-level, --gzip-memory-level, --gzip-strategy should update options', () => { | ||
const cliArguments = [ | ||
'node.exe', | ||
'index.js', | ||
'folder_to_compress', | ||
'folder_to_compress_out', | ||
'--gzip-level', | ||
'1', | ||
'--gzip-memory-level', | ||
'3', | ||
'--gzip-strategy', | ||
'5', | ||
]; | ||
const index = new Index(); | ||
(index as any).argv = cliArguments; | ||
sinonSandbox.stub(index, 'start' as any).returns(null); | ||
const result: any = index.getOptions().filterOptions(); | ||
assert.strictEqual(result.target, 'folder_to_compress'); | ||
assert.strictEqual(result.outputPath, 'folder_to_compress_out'); | ||
const response: any = { | ||
level: 1, | ||
memoryLevel: 3, | ||
strategy: 5, | ||
}; | ||
for (const value of Object.values(result.options)) { | ||
assert.notStrictEqual(value, NaN); | ||
assert.notStrictEqual(value, undefined); | ||
} | ||
for (const [key, val] of Object.entries(response)) { | ||
assert.ok(compareValues(result.options[key], val)); | ||
} | ||
}); | ||
/* | ||
* @deprecated | ||
* TODO: Remove | ||
* GZIPPER_GZIP_LEVEL | ||
* GZIPPER_GZIP_MEMORY_LEVEL | ||
* GZIPPER_GZIP_STRATEGY | ||
*/ | ||
it('GZIPPER_GZIP_LEVEL, GZIPPER_GZIP_MEMORY_LEVEL, GZIPPER_GZIP_STRATEGY should overwrite options', () => { | ||
const envArguments = { | ||
GZIPPER_GZIP_LEVEL: '5', | ||
GZIPPER_GZIP_MEMORY_LEVEL: '5', | ||
GZIPPER_GZIP_STRATEGY: '6', | ||
}; | ||
const cliArguments = [ | ||
'node.exe', | ||
'index.js', | ||
'folder_to_compress', | ||
'folder_to_compress_out', | ||
'--gzip-level', | ||
'1', | ||
'--gzip-memory-level', | ||
'3', | ||
'--gzip-strategy', | ||
'5', | ||
]; | ||
const index = new Index(); | ||
(index as any).argv = cliArguments; | ||
(index as any).env = envArguments; | ||
sinonSandbox.stub(index, 'start' as any).returns(null); | ||
const result: any = index.getOptions().filterOptions(); | ||
assert.strictEqual(result.target, 'folder_to_compress'); | ||
assert.strictEqual(result.outputPath, 'folder_to_compress_out'); | ||
const response: any = { | ||
level: 5, | ||
memoryLevel: 5, | ||
strategy: 6, | ||
}; | ||
for (const value of Object.values(result.options)) { | ||
assert.notStrictEqual(value, NaN); | ||
assert.notStrictEqual(value, undefined); | ||
} | ||
for (const [key, val] of Object.entries(response)) { | ||
assert.ok(compareValues(result.options[key], val)); | ||
} | ||
}); | ||
it('getOptions() should return target, outputPath and all options', () => { | ||
@@ -43,9 +137,10 @@ const cliArguments = [ | ||
'500', | ||
'--gzip-level', | ||
'--level', | ||
'7', | ||
'--gzip-memory-level', | ||
'--memory-level', | ||
'1', | ||
'--gzip-strategy', | ||
'--strategy', | ||
'3', | ||
'--brotli', | ||
'--deflate', | ||
'--brotli-param-mode', | ||
@@ -73,6 +168,7 @@ 'text', | ||
threshold: 500, | ||
gzipLevel: 7, | ||
gzipMemoryLevel: 1, | ||
gzipStrategy: 3, | ||
level: 7, | ||
memoryLevel: 1, | ||
strategy: 3, | ||
brotli: true, | ||
deflate: true, | ||
brotliParamMode: 'text', | ||
@@ -102,7 +198,7 @@ brotliQuality: 5, | ||
'800', | ||
'--gzip-level', | ||
'--level', | ||
'4', | ||
'--gzip-memory-level', | ||
'--memory-level', | ||
'2', | ||
'--gzip-strategy', | ||
'--strategy', | ||
'4', | ||
@@ -125,8 +221,13 @@ '--output-file-format', | ||
threshold: 800, | ||
gzipLevel: 4, | ||
gzipMemoryLevel: 2, | ||
gzipStrategy: 4, | ||
level: 4, | ||
memoryLevel: 2, | ||
strategy: 4, | ||
outputFileFormat: 'test-[filename]-out.[ext].[compressExt]', | ||
}; | ||
for (const value of Object.values(result.options)) { | ||
assert.notStrictEqual(value, NaN); | ||
assert.notStrictEqual(value, undefined); | ||
} | ||
for (const [key, val] of Object.entries(response)) { | ||
@@ -143,6 +244,7 @@ assert.ok(compareValues(result.options[key], val)); | ||
GZIPPER_THRESHOLD: '800', | ||
GZIPPER_GZIP_LEVEL: '2', | ||
GZIPPER_GZIP_MEMORY_LEVEL: '2', | ||
GZIPPER_GZIP_STRATEGY: '4', | ||
GZIPPER_LEVEL: '2', | ||
GZIPPER_MEMORY_LEVEL: '2', | ||
GZIPPER_STRATEGY: '4', | ||
GZIPPER_BROTLI: '0', | ||
GZIPPER_DEFLATE: '0', | ||
GZIPPER_BROTLI_PARAM_MODE: 'font', | ||
@@ -165,9 +267,10 @@ GZIPPER_BROTLI_QUALITY: '3', | ||
'500', | ||
'--gzip-level', | ||
'--level', | ||
'7', | ||
'--gzip-memory-level', | ||
'--memory-level', | ||
'1', | ||
'--gzip-strategy', | ||
'--strategy', | ||
'3', | ||
'--brotli', | ||
'--deflate', | ||
'--brotli-param-mode', | ||
@@ -196,6 +299,7 @@ 'text', | ||
threshold: 800, | ||
gzipLevel: 2, | ||
gzipMemoryLevel: 2, | ||
gzipStrategy: 4, | ||
level: 2, | ||
memoryLevel: 2, | ||
strategy: 4, | ||
brotli: false, | ||
deflate: false, | ||
brotliParamMode: 'font', | ||
@@ -202,0 +306,0 @@ brotliQuality: 3, |
@@ -31,2 +31,4 @@ import path from 'path'; | ||
export const COMPRESSION_EXTENSIONS = ['.gz', '.br', '.zz']; | ||
async function statExists(target: string): Promise<boolean> { | ||
@@ -33,0 +35,0 @@ try { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18460335
68
4076
153