vite-plugin-compression
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -1,10 +0,28 @@ | ||
# [0.3.0](https://github.com/anncwb/vite-plugin-compression/compare/v0.2.4...v0.3.0) (2021-07-05) | ||
## [0.3.1](https://github.com/anncwb/vite-plugin-compression/compare/v0.2.4...v0.3.1) (2021-07-18) | ||
### Features | ||
### Bug Fixes | ||
* automatically generate ext ([ccf8635](https://github.com/anncwb/vite-plugin-compression/commit/ccf8635807f03b1d46b6f090b4c533274ef77b15)) | ||
* type error,fix [#5](https://github.com/anncwb/vite-plugin-compression/issues/5) ([cd6c313](https://github.com/anncwb/vite-plugin-compression/commit/cd6c313f63b4a8147d518e17c887049cdae6f1b7)) | ||
## [0.3.1](https://github.com/anncwb/vite-plugin-compression/compare/v0.2.4...v0.3.1) (2021-07-18) | ||
### Bug Fixes | ||
* type error,fix [#5](https://github.com/anncwb/vite-plugin-compression/issues/5) ([cd6c313](https://github.com/anncwb/vite-plugin-compression/commit/cd6c313f63b4a8147d518e17c887049cdae6f1b7)) | ||
## [0.2.6](https://github.com/anncwb/vite-plugin-compression/compare/v0.2.4...v0.2.6) (2021-07-18) | ||
### Bug Fixes | ||
* type error,fix [#5](https://github.com/anncwb/vite-plugin-compression/issues/5) ([cd6c313](https://github.com/anncwb/vite-plugin-compression/commit/cd6c313f63b4a8147d518e17c887049cdae6f1b7)) | ||
## [0.2.5](https://github.com/anncwb/vite-plugin-compression/compare/v0.2.4...v0.2.5) (2021-05-09) | ||
@@ -11,0 +29,0 @@ |
@@ -48,4 +48,4 @@ import { Plugin } from 'vite'; | ||
declare const _default: (options?: VitePluginCompression) => Plugin; | ||
declare const exportFn: (options?: VitePluginCompression) => Plugin; | ||
export default _default; | ||
export default exportFn; |
@@ -64,3 +64,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __defProp = Object.defineProperty; | ||
var mtimeCache = new Map(); | ||
var src_default = (options = {}) => { | ||
var exportFn = (options = {}) => { | ||
let outputPath; | ||
@@ -96,5 +96,4 @@ let config; | ||
debug("files:", files); | ||
if (!files.length) { | ||
if (!files.length) | ||
return; | ||
} | ||
files = filterFiles(files, filter); | ||
@@ -117,3 +116,3 @@ const compressOptions = getCompressionOptions(algorithm, compressionOptions); | ||
const size = content.byteLength; | ||
const cname = getOutputFileName(filePath, getDefaultExt(algorithm, ext)); | ||
const cname = getOutputFileName(filePath, ext); | ||
compressMap.set(filePath, { | ||
@@ -171,11 +170,2 @@ size: size / 1024, | ||
} | ||
function getDefaultExt(algorithm, def) { | ||
if (algorithm === "gzip") { | ||
return ".gz"; | ||
} | ||
if (algorithm === "brotliCompress") { | ||
return ".br"; | ||
} | ||
return def; | ||
} | ||
function compress(content, algorithm, options = {}) { | ||
@@ -203,4 +193,6 @@ return new Promise((resolve, reject) => { | ||
} | ||
module.exports = exportFn; | ||
var src_default = exportFn; | ||
exports.default = src_default; |
{ | ||
"name": "vite-plugin-compression", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Use gzip or brotli to compress resources.", | ||
@@ -38,3 +38,3 @@ "main": "dist/index.js", | ||
"debug": "^4.3.2", | ||
"fs-extra": "^10.0.0" | ||
"fs-extra": "^9.1.0" | ||
}, | ||
@@ -47,4 +47,4 @@ "peerDependencies": { | ||
"@types/debug": "^4.1.6", | ||
"@types/fs-extra": "^9.0.11", | ||
"@types/node": "^16.0.0", | ||
"@types/fs-extra": "^9.0.12", | ||
"@types/node": "^14.17.5", | ||
"conventional-changelog-cli": "^2.1.1", | ||
@@ -54,6 +54,6 @@ "ini": "^2.0.0", | ||
"rimraf": "^3.0.2", | ||
"tsup": "^4.12.0", | ||
"tsup": "^4.12.5", | ||
"typescript": "^4.3.5", | ||
"vite": "^2.4.0" | ||
"vite": "^2.4.2" | ||
} | ||
} |
@@ -50,3 +50,3 @@ # vite-plugin-compression | ||
| algorithm | `string` | `gzip` | Compression algorithm, optional ['gzip','brotliCompress' ,'deflate','deflateRaw'] | | ||
| ext | `string` | `auto` | Suffix of the generated compressed package,If it is gzip/or brotli, you don’t need to upload it | | ||
| ext | `string` | `.gz` | Suffix of the generated compressed package | | ||
| compressionOptions | `object` | - | The parameters of the corresponding compression algorithm | | ||
@@ -53,0 +53,0 @@ | deleteOriginFile | `boolean` | - | Whether to delete source files after compression | |
@@ -50,3 +50,3 @@ # vite-plugin-compression | ||
| algorithm | `string` | `gzip` | 压缩算法,可选 [ 'gzip' , 'brotliCompress' ,'deflate' , 'deflateRaw'] | | ||
| ext | `string` | `auto` | 生成的压缩包后缀,如果是 gzip/或者 brotli,可以不传 | | ||
| ext | `string` | `.gz` | 生成的压缩包后缀 | | ||
| compressionOptions | `object` | - | 对应的压缩算法的参数 | | ||
@@ -53,0 +53,0 @@ | deleteOriginFile | `boolean` | - | 压缩后是否删除源文件 | |
Sorry, the diff of this file is not supported yet
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
22412
424
+ Addedat-least-node@1.0.0(transitive)
+ Addedfs-extra@9.1.0(transitive)
- Removedfs-extra@10.1.0(transitive)
Updatedfs-extra@^9.1.0