compression-webpack-plugin
Advanced tools
Comparing version 8.0.1 to 9.0.0
@@ -159,9 +159,9 @@ "use strict"; | ||
else { | ||
buffer = source.source(); | ||
buffer = source.source(); | ||
if (!Buffer.isBuffer(buffer)) { | ||
// eslint-disable-next-line no-param-reassign | ||
buffer = Buffer.from(buffer); | ||
} | ||
if (!Buffer.isBuffer(buffer)) { | ||
// eslint-disable-next-line no-param-reassign | ||
buffer = Buffer.from(buffer); | ||
} | ||
} | ||
@@ -221,29 +221,5 @@ if (buffer.length < this.options.threshold) { | ||
const match = /^([^?#]*)(\?[^#]*)?(#.*)?$/.exec(name); | ||
const [, replacerFile] = match; | ||
const replacerQuery = match[2] || ""; | ||
const replacerFragment = match[3] || ""; | ||
const replacerExt = _path.default.extname(replacerFile); | ||
const replacerBase = _path.default.basename(replacerFile); | ||
const replacerName = replacerBase.slice(0, replacerBase.length - replacerExt.length); | ||
const replacerPath = replacerFile.slice(0, replacerFile.length - replacerBase.length); | ||
const pathData = { | ||
file: replacerFile, | ||
query: replacerQuery, | ||
fragment: replacerFragment, | ||
path: replacerPath, | ||
base: replacerBase, | ||
name: replacerName, | ||
ext: replacerExt || "" | ||
}; | ||
let newFilename = this.options.filename; | ||
if (typeof newFilename === "function") { | ||
newFilename = newFilename(pathData); | ||
} | ||
const newName = newFilename.replace(/\[(file|query|fragment|path|base|name|ext)]/g, (p0, p1) => pathData[p1]); | ||
const newFilename = compilation.getPath(this.options.filename, { | ||
filename: name | ||
}); | ||
const newInfo = { | ||
@@ -253,3 +229,3 @@ compressed: true | ||
if (info.immutable && /(\[name]|\[base]|\[file])/.test(newFilename)) { | ||
if (info.immutable && /(\[name]|\[base]|\[file])/.test(this.options.filename)) { | ||
newInfo.immutable = true; | ||
@@ -271,3 +247,3 @@ } | ||
related: { | ||
[relatedName]: newName | ||
[relatedName]: newFilename | ||
} | ||
@@ -277,3 +253,3 @@ }); | ||
compilation.emitAsset(newName, output.source, newInfo); | ||
compilation.emitAsset(newFilename, output.source, newInfo); | ||
})()); | ||
@@ -280,0 +256,0 @@ } |
@@ -40,2 +40,3 @@ { | ||
"description": "Include all assets that pass test assertion.", | ||
"link": "https://github.com/webpack-contrib/compression-webpack-plugin/#test", | ||
"oneOf": [ | ||
@@ -49,2 +50,3 @@ { | ||
"description": "Include all assets matching any of these conditions.", | ||
"link": "https://github.com/webpack-contrib/compression-webpack-plugin/#include", | ||
"oneOf": [ | ||
@@ -58,2 +60,3 @@ { | ||
"description": "Exclude all assets matching any of these conditions.", | ||
"link": "https://github.com/webpack-contrib/compression-webpack-plugin/#exclude", | ||
"oneOf": [ | ||
@@ -67,2 +70,3 @@ { | ||
"description": "The compression algorithm/function.", | ||
"link": "https://github.com/webpack-contrib/compression-webpack-plugin/#algorithm", | ||
"anyOf": [ | ||
@@ -79,2 +83,3 @@ { | ||
"description": "Compression options for `algorithm`.", | ||
"link": "https://github.com/webpack-contrib/compression-webpack-plugin/#compressionoptions", | ||
"additionalProperties": true, | ||
@@ -85,2 +90,3 @@ "type": "object" | ||
"description": "Only assets bigger than this size are processed. In bytes.", | ||
"link": "https://github.com/webpack-contrib/compression-webpack-plugin/#threshold", | ||
"type": "number" | ||
@@ -90,2 +96,3 @@ }, | ||
"description": "Only assets that compress better than this ratio are processed (`minRatio = Compressed Size / Original Size`).", | ||
"link": "https://github.com/webpack-contrib/compression-webpack-plugin/#minratio", | ||
"type": "number" | ||
@@ -95,2 +102,3 @@ }, | ||
"description": "Whether to delete the original assets or not.", | ||
"link": "https://github.com/webpack-contrib/compression-webpack-plugin/#deleteoriginalassets", | ||
"anyOf": [ | ||
@@ -107,2 +115,3 @@ { | ||
"description": "The target asset filename.", | ||
"link": "https://github.com/webpack-contrib/compression-webpack-plugin/#filename", | ||
"anyOf": [ | ||
@@ -109,0 +118,0 @@ { |
{ | ||
"name": "compression-webpack-plugin", | ||
"version": "8.0.1", | ||
"version": "9.0.0", | ||
"description": "Prepare compressed versions of assets to serve them with Content-Encoding", | ||
@@ -43,3 +43,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"schema-utils": "^3.0.0", | ||
"schema-utils": "^3.1.0", | ||
"serialize-javascript": "^6.0.0" | ||
@@ -49,26 +49,26 @@ }, | ||
"@babel/cli": "^7.14.5", | ||
"@babel/core": "^7.14.6", | ||
"@babel/preset-env": "^7.14.7", | ||
"@commitlint/cli": "^12.1.4", | ||
"@commitlint/config-conventional": "^12.1.4", | ||
"@babel/core": "^7.15.0", | ||
"@babel/preset-env": "^7.15.0", | ||
"@commitlint/cli": "^13.1.0", | ||
"@commitlint/config-conventional": "^13.1.0", | ||
"@gfx/zopfli": "^1.0.15", | ||
"@webpack-contrib/eslint-config-webpack": "^3.0.0", | ||
"babel-jest": "^27.0.5", | ||
"babel-jest": "^27.0.6", | ||
"cross-env": "^7.0.3", | ||
"del": "^6.0.0", | ||
"del-cli": "^4.0.0", | ||
"eslint": "^7.29.0", | ||
"eslint": "^7.30.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.23.4", | ||
"eslint-plugin-import": "^2.24.0", | ||
"file-loader": "^6.2.0", | ||
"husky": "^6.0.0", | ||
"jest": "^27.0.5", | ||
"lint-staged": "^11.0.0", | ||
"husky": "^7.0.0", | ||
"jest": "^27.0.6", | ||
"lint-staged": "^11.1.2", | ||
"memfs": "^3.2.2", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.3.1", | ||
"prettier": "^2.3.2", | ||
"standard-version": "^9.3.0", | ||
"webpack": "^5.40.0", | ||
"webpack": "^5.51.0", | ||
"webpack-stats-plugin": "^1.0.3", | ||
"workbox-webpack-plugin": "^6.1.5" | ||
"workbox-webpack-plugin": "^6.2.4" | ||
}, | ||
@@ -75,0 +75,0 @@ "keywords": [ |
@@ -278,3 +278,3 @@ <div align="center"> | ||
// Available properties described above, for the `String` notation | ||
if (/\.svg$/.test(pathData.file)) { | ||
if (/\.svg$/.test(pathData.filename)) { | ||
return "assets/svg/[path][base].gz"; | ||
@@ -281,0 +281,0 @@ } |
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
27597
355
Updatedschema-utils@^3.1.0