@uppy/compressor
Advanced tools
Comparing version 0.2.5 to 0.3.0
# @uppy/compressor | ||
## 0.3.0 | ||
Released: 2022-05-30 | ||
Included in: Uppy v2.11.0 | ||
- @uppy/compressor: Fix Compressor docs, pass files array to compressor:complete event (Artur Paikin / #3682) | ||
## 0.2.5 | ||
@@ -4,0 +11,0 @@ |
@@ -58,2 +58,3 @@ "use strict"; | ||
let totalCompressedSize = 0; | ||
const compressedFiles = []; | ||
@@ -85,2 +86,3 @@ const compressAndApplyResult = _classPrivateFieldLooseBase(this, _RateLimitedQueue)[_RateLimitedQueue].wrapPromiseFunction(async file => { | ||
}); | ||
compressedFiles.push(file); | ||
} catch (err) { | ||
@@ -121,3 +123,3 @@ this.uppy.log(`[Image Compressor] Failed to compress ${file.id}:`, 'warning'); | ||
await Promise.all(promises); | ||
this.uppy.emit('compressor:complete'); // Only show informer if Compressor mananged to save at least a kilobyte | ||
this.uppy.emit('compressor:complete', compressedFiles); // Only show informer if Compressor mananged to save at least a kilobyte | ||
@@ -124,0 +126,0 @@ if (totalCompressedSize > 1024) { |
{ | ||
"name": "@uppy/compressor", | ||
"description": "Uppy plugin that compresses images before upload, saving up to 60% in size", | ||
"version": "0.2.5", | ||
"version": "0.3.0", | ||
"license": "MIT", | ||
@@ -27,3 +27,3 @@ "main": "lib/index.js", | ||
"@transloadit/prettier-bytes": "^0.0.9", | ||
"@uppy/utils": "^4.0.7", | ||
"@uppy/utils": "^4.1.0", | ||
"compressorjs": "^1.1.1", | ||
@@ -34,3 +34,3 @@ "preact": "^10.5.13", | ||
"peerDependencies": { | ||
"@uppy/core": "^2.1.9" | ||
"@uppy/core": "^2.3.0" | ||
}, | ||
@@ -37,0 +37,0 @@ "publishConfig": { |
@@ -46,2 +46,3 @@ import { BasePlugin } from '@uppy/core' | ||
let totalCompressedSize = 0 | ||
const compressedFiles = [] | ||
const compressAndApplyResult = this.#RateLimitedQueue.wrapPromiseFunction( | ||
@@ -64,2 +65,3 @@ async (file) => { | ||
this.uppy.setFileMeta(file.id, { name, type }) | ||
compressedFiles.push(file) | ||
} catch (err) { | ||
@@ -103,3 +105,3 @@ this.uppy.log(`[Image Compressor] Failed to compress ${file.id}:`, 'warning') | ||
this.uppy.emit('compressor:complete') | ||
this.uppy.emit('compressor:complete', compressedFiles) | ||
@@ -106,0 +108,0 @@ // Only show informer if Compressor mananged to save at least a kilobyte |
import type { PluginOptions, BasePlugin } from '@uppy/core' | ||
import { UppyFile } from '@uppy/utils' | ||
import type CompressorLocale from './generatedLocale' | ||
@@ -10,4 +11,12 @@ | ||
export type CompressorCompleteCallback<TMeta> = (files: UppyFile<TMeta>[]) => void; | ||
declare module '@uppy/core' { | ||
export interface UppyEventMap<TMeta> { | ||
'compressor:complete': CompressorCompleteCallback<TMeta> | ||
} | ||
} | ||
declare class Compressor extends BasePlugin<CompressorOptions> {} | ||
export default Compressor |
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
22801
266
Updated@uppy/utils@^4.1.0