@file-ud.js/plugins 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +583 -0
- package/dist/downloader/index.d.mts +2 -0
- package/dist/downloader/index.d.ts +2 -0
- package/dist/downloader/index.js +126 -0
- package/dist/downloader/index.js.map +1 -0
- package/dist/downloader/index.mjs +124 -0
- package/dist/downloader/index.mjs.map +1 -0
- package/dist/index-CVuMEvjg.d.ts +201 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +781 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +773 -0
- package/dist/index.mjs.map +1 -0
- package/dist/retry/index.d.mts +84 -0
- package/dist/retry/index.d.ts +84 -0
- package/dist/retry/index.js +126 -0
- package/dist/retry/index.js.map +1 -0
- package/dist/retry/index.mjs +124 -0
- package/dist/retry/index.mjs.map +1 -0
- package/dist/uploader/index.d.mts +2 -0
- package/dist/uploader/index.d.ts +2 -0
- package/dist/uploader/index.js +658 -0
- package/dist/uploader/index.js.map +1 -0
- package/dist/uploader/index.mjs +652 -0
- package/dist/uploader/index.mjs.map +1 -0
- package/package.json +78 -0
- package/src/uploader/compress/README.md +388 -0
- package/src/uploader/validator/README.md +563 -0
- package/src/uploader/watermark/README.md +498 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,781 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@file-ud.js/core');
|
|
4
|
+
|
|
5
|
+
// src/uploader/compress/compress-image-plugin.ts
|
|
6
|
+
var BasePlugin = class {
|
|
7
|
+
constructor() {
|
|
8
|
+
/** 插件版本 */
|
|
9
|
+
this.version = "1.0.0";
|
|
10
|
+
/** 插件优先级 */
|
|
11
|
+
this.priority = 0;
|
|
12
|
+
/** 是否关键插件 */
|
|
13
|
+
this.critical = false;
|
|
14
|
+
/** 插件描述 */
|
|
15
|
+
this.desc = "";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 安装插件 - 统一日志输出
|
|
19
|
+
*/
|
|
20
|
+
install(transfer) {
|
|
21
|
+
console.log(`${this.name} \u2705 \u63D2\u4EF6\u5DF2\u5B89\u88C5`);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 创建基础错误对象
|
|
25
|
+
* @param file - 当前文件
|
|
26
|
+
* @param uploader - 上传器实例
|
|
27
|
+
* @returns 基础错误对象
|
|
28
|
+
*/
|
|
29
|
+
createBaseError(file, uploader) {
|
|
30
|
+
return new core.FileUDError(
|
|
31
|
+
core.ErrorCode.UNKNOWN,
|
|
32
|
+
"",
|
|
33
|
+
{
|
|
34
|
+
uploader,
|
|
35
|
+
plugin: this.name,
|
|
36
|
+
fileName: file.fileName,
|
|
37
|
+
fileSize: file.File.size,
|
|
38
|
+
fileType: file.File.type
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 抛出验证错误
|
|
44
|
+
* @param error - 错误对象
|
|
45
|
+
* @returns Promise.reject
|
|
46
|
+
*/
|
|
47
|
+
throwError(error) {
|
|
48
|
+
return Promise.reject(error);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 销毁插件
|
|
52
|
+
*/
|
|
53
|
+
destroy() {
|
|
54
|
+
console.log(`${this.name} \u{1F512} \u63D2\u4EF6\u5DF2\u9500\u6BC1`);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/uploader/compress/compress-image-plugin.ts
|
|
59
|
+
var CompressImagePlugin = class extends BasePlugin {
|
|
60
|
+
constructor(options = {}) {
|
|
61
|
+
super();
|
|
62
|
+
this.name = "compress-image-plugin";
|
|
63
|
+
this.priority = 10;
|
|
64
|
+
this.desc = "\u56FE\u7247\u538B\u7F29\u63D2\u4EF6";
|
|
65
|
+
this.defaultOptions = {
|
|
66
|
+
quality: 0.8,
|
|
67
|
+
maxWidth: 1920,
|
|
68
|
+
maxHeight: 1080,
|
|
69
|
+
format: "jpeg",
|
|
70
|
+
showInfo: true,
|
|
71
|
+
onCompressStart: function(file) {
|
|
72
|
+
throw new Error("Function not implemented.");
|
|
73
|
+
},
|
|
74
|
+
onCompressComplete: function(file, compressedFile) {
|
|
75
|
+
throw new Error("Function not implemented.");
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
this.options = { ...this.defaultOptions, ...options };
|
|
79
|
+
}
|
|
80
|
+
async onFileSelect(uploadFile, context) {
|
|
81
|
+
if (!uploadFile.File.type.startsWith("image/")) {
|
|
82
|
+
return uploadFile;
|
|
83
|
+
}
|
|
84
|
+
const originalSize = uploadFile.File.size;
|
|
85
|
+
try {
|
|
86
|
+
this.options.onCompressStart?.(uploadFile);
|
|
87
|
+
const compressedFile = await this.compressImage(uploadFile.File);
|
|
88
|
+
const compressedSize = compressedFile.size;
|
|
89
|
+
const ratio = ((originalSize - compressedSize) / originalSize * 100).toFixed(1);
|
|
90
|
+
if (this.options.showInfo) {
|
|
91
|
+
console.log(
|
|
92
|
+
`\u{1F4F8} \u538B\u7F29\u5B8C\u6210: ${uploadFile.fileName} | ${core.formatFileSize(originalSize)} \u2192 ${core.formatFileSize(compressedSize)} (\u51CF\u5C11 ${ratio}%)`
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
uploadFile.proxy.File = compressedFile;
|
|
96
|
+
this.options.onCompressComplete?.(uploadFile, compressedFile);
|
|
97
|
+
uploadFile.proxy.formatSize = core.formatFileSize(compressedSize);
|
|
98
|
+
return uploadFile;
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error(`\u538B\u7F29\u5931\u8D25: ${uploadFile.fileName}`, error);
|
|
101
|
+
return uploadFile;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
compressImage(file) {
|
|
105
|
+
return new Promise((resolve, reject) => {
|
|
106
|
+
const img = new Image();
|
|
107
|
+
const url = URL.createObjectURL(file);
|
|
108
|
+
img.onload = () => {
|
|
109
|
+
URL.revokeObjectURL(url);
|
|
110
|
+
let { width, height } = img;
|
|
111
|
+
if (width > this.options.maxWidth) {
|
|
112
|
+
height = Math.floor(height * (this.options.maxWidth / width));
|
|
113
|
+
width = this.options.maxWidth;
|
|
114
|
+
}
|
|
115
|
+
if (height > this.options.maxHeight) {
|
|
116
|
+
width = Math.floor(width * (this.options.maxHeight / height));
|
|
117
|
+
height = this.options.maxHeight;
|
|
118
|
+
}
|
|
119
|
+
const canvas = document.createElement("canvas");
|
|
120
|
+
canvas.width = width;
|
|
121
|
+
canvas.height = height;
|
|
122
|
+
const ctx = canvas.getContext("2d");
|
|
123
|
+
if (!ctx) {
|
|
124
|
+
reject(new Error("\u65E0\u6CD5\u521B\u5EFA Canvas \u4E0A\u4E0B\u6587"));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
ctx.drawImage(img, 0, 0, width, height);
|
|
128
|
+
canvas.toBlob(
|
|
129
|
+
(blob) => {
|
|
130
|
+
if (blob) {
|
|
131
|
+
const compressedFile = new File(
|
|
132
|
+
[blob],
|
|
133
|
+
file.name.replace(/\.\w+$/, `.${this.options.format}`),
|
|
134
|
+
{ type: `image/${this.options.format}` }
|
|
135
|
+
);
|
|
136
|
+
resolve(compressedFile);
|
|
137
|
+
} else {
|
|
138
|
+
reject(new Error("\u538B\u7F29\u5931\u8D25"));
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
`image/${this.options.format}`,
|
|
142
|
+
this.options.quality
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
img.onerror = () => reject(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
|
|
146
|
+
img.src = url;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
var WatermarkPlugin = class extends BasePlugin {
|
|
151
|
+
constructor(options = {}) {
|
|
152
|
+
super();
|
|
153
|
+
this.name = "watermark-plugin";
|
|
154
|
+
this.priority = 20;
|
|
155
|
+
this.desc = "\u6C34\u5370\u63D2\u4EF6\uFF08\u652F\u6301\u6587\u5B57/\u56FE\u7247\u6C34\u5370\uFF09";
|
|
156
|
+
this.defaultOptions = {
|
|
157
|
+
text: "\xA9 FileUD",
|
|
158
|
+
imageUrl: "",
|
|
159
|
+
position: "bottom-right",
|
|
160
|
+
opacity: 0.6,
|
|
161
|
+
fontSize: 24,
|
|
162
|
+
color: "#ffffff",
|
|
163
|
+
padding: 20,
|
|
164
|
+
imageWidth: 100,
|
|
165
|
+
imageHeight: 100
|
|
166
|
+
};
|
|
167
|
+
this.options = { ...this.defaultOptions, ...options };
|
|
168
|
+
}
|
|
169
|
+
async onFileSelect(file, context) {
|
|
170
|
+
if (!file.File.type.startsWith("image/")) {
|
|
171
|
+
return file;
|
|
172
|
+
}
|
|
173
|
+
try {
|
|
174
|
+
const watermarkedFile = await this.addWatermark(file.File);
|
|
175
|
+
file.proxy.File = watermarkedFile;
|
|
176
|
+
file.proxy.formatSize = core.formatFileSize(watermarkedFile.size);
|
|
177
|
+
console.log(`\u{1F4A7} \u6C34\u5370\u5DF2\u6DFB\u52A0: ${file.fileName}`);
|
|
178
|
+
return file;
|
|
179
|
+
} catch (error) {
|
|
180
|
+
console.error(`\u6C34\u5370\u6DFB\u52A0\u5931\u8D25: ${file.fileName}`, error);
|
|
181
|
+
return file;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
addWatermark(file) {
|
|
185
|
+
return new Promise((resolve, reject) => {
|
|
186
|
+
const img = new Image();
|
|
187
|
+
const url = URL.createObjectURL(file);
|
|
188
|
+
img.onload = () => {
|
|
189
|
+
URL.revokeObjectURL(url);
|
|
190
|
+
const canvas = document.createElement("canvas");
|
|
191
|
+
canvas.width = img.width;
|
|
192
|
+
canvas.height = img.height;
|
|
193
|
+
const ctx = canvas.getContext("2d");
|
|
194
|
+
if (!ctx) {
|
|
195
|
+
reject(new Error("\u65E0\u6CD5\u521B\u5EFA Canvas \u4E0A\u4E0B\u6587"));
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
ctx.drawImage(img, 0, 0);
|
|
199
|
+
ctx.globalAlpha = this.options.opacity;
|
|
200
|
+
if (this.options.imageUrl) {
|
|
201
|
+
this.addImageWatermark(ctx, canvas, resolve, reject, file);
|
|
202
|
+
} else if (this.options.text) {
|
|
203
|
+
this.addTextWatermark(ctx, canvas, resolve, reject, file);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
img.onerror = () => reject(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
|
|
207
|
+
img.src = url;
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* 添加文字水印
|
|
212
|
+
*/
|
|
213
|
+
addTextWatermark(ctx, canvas, resolve, reject, originalFile) {
|
|
214
|
+
ctx.font = `${this.options.fontSize}px Arial`;
|
|
215
|
+
ctx.fillStyle = this.options.color;
|
|
216
|
+
ctx.textAlign = "center";
|
|
217
|
+
ctx.textBaseline = "middle";
|
|
218
|
+
const text = this.options.text;
|
|
219
|
+
const textWidth = ctx.measureText(text).width;
|
|
220
|
+
const padding = this.options.padding;
|
|
221
|
+
const { x, y } = this.calculatePosition(
|
|
222
|
+
ctx,
|
|
223
|
+
canvas,
|
|
224
|
+
textWidth,
|
|
225
|
+
this.options.fontSize,
|
|
226
|
+
padding
|
|
227
|
+
);
|
|
228
|
+
ctx.fillText(text, x, y);
|
|
229
|
+
canvas.toBlob((blob) => {
|
|
230
|
+
if (blob) {
|
|
231
|
+
const watermarkedFile = new File([blob], originalFile.name, {
|
|
232
|
+
type: originalFile.type
|
|
233
|
+
});
|
|
234
|
+
resolve(watermarkedFile);
|
|
235
|
+
} else {
|
|
236
|
+
reject(new Error("\u6C34\u5370\u6DFB\u52A0\u5931\u8D25"));
|
|
237
|
+
}
|
|
238
|
+
}, originalFile.type);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* 添加图片水印
|
|
242
|
+
*/
|
|
243
|
+
addImageWatermark(ctx, canvas, resolve, reject, originalFile) {
|
|
244
|
+
const watermarkImg = new Image();
|
|
245
|
+
watermarkImg.crossOrigin = "Anonymous";
|
|
246
|
+
watermarkImg.onload = () => {
|
|
247
|
+
let drawWidth = this.options.imageWidth;
|
|
248
|
+
let drawHeight = this.options.imageHeight;
|
|
249
|
+
if (!drawWidth && !drawHeight) {
|
|
250
|
+
drawWidth = watermarkImg.width;
|
|
251
|
+
drawHeight = watermarkImg.height;
|
|
252
|
+
} else if (drawWidth && !drawHeight) {
|
|
253
|
+
drawHeight = watermarkImg.height / watermarkImg.width * drawWidth;
|
|
254
|
+
} else if (!drawWidth && drawHeight) {
|
|
255
|
+
drawWidth = watermarkImg.width / watermarkImg.height * drawHeight;
|
|
256
|
+
}
|
|
257
|
+
const padding = this.options.padding;
|
|
258
|
+
const { x, y } = this.calculatePosition(
|
|
259
|
+
ctx,
|
|
260
|
+
canvas,
|
|
261
|
+
drawWidth,
|
|
262
|
+
drawHeight,
|
|
263
|
+
padding
|
|
264
|
+
);
|
|
265
|
+
ctx.drawImage(watermarkImg, x, y, drawWidth, drawHeight);
|
|
266
|
+
canvas.toBlob((blob) => {
|
|
267
|
+
if (blob) {
|
|
268
|
+
const watermarkedFile = new File([blob], originalFile.name, {
|
|
269
|
+
type: originalFile.type
|
|
270
|
+
});
|
|
271
|
+
resolve(watermarkedFile);
|
|
272
|
+
} else {
|
|
273
|
+
reject(new Error("\u6C34\u5370\u6DFB\u52A0\u5931\u8D25"));
|
|
274
|
+
}
|
|
275
|
+
}, originalFile.type);
|
|
276
|
+
};
|
|
277
|
+
watermarkImg.onerror = () => {
|
|
278
|
+
reject(new Error("\u6C34\u5370\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"));
|
|
279
|
+
};
|
|
280
|
+
watermarkImg.src = this.options.imageUrl;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* 计算水印位置
|
|
284
|
+
*/
|
|
285
|
+
calculatePosition(ctx, canvas, width, height, padding) {
|
|
286
|
+
const pad = padding ?? this.options.padding;
|
|
287
|
+
let x, y;
|
|
288
|
+
switch (this.options.position) {
|
|
289
|
+
case "top-left":
|
|
290
|
+
x = pad;
|
|
291
|
+
y = pad;
|
|
292
|
+
break;
|
|
293
|
+
case "top-right":
|
|
294
|
+
x = canvas.width - width - pad;
|
|
295
|
+
y = pad;
|
|
296
|
+
break;
|
|
297
|
+
case "bottom-left":
|
|
298
|
+
x = pad;
|
|
299
|
+
y = canvas.height - height - pad;
|
|
300
|
+
break;
|
|
301
|
+
case "bottom-right":
|
|
302
|
+
x = canvas.width - width - pad;
|
|
303
|
+
y = canvas.height - height - pad;
|
|
304
|
+
break;
|
|
305
|
+
default:
|
|
306
|
+
x = (canvas.width - width) / 2;
|
|
307
|
+
y = (canvas.height - height) / 2;
|
|
308
|
+
}
|
|
309
|
+
return { x, y };
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
var FileValidatorPlugin = class extends BasePlugin {
|
|
313
|
+
constructor(options = {}) {
|
|
314
|
+
super();
|
|
315
|
+
this.name = "file-validator-plugin";
|
|
316
|
+
this.priority = 0;
|
|
317
|
+
// 最先执行
|
|
318
|
+
this.critical = true;
|
|
319
|
+
this.desc = "\u57FA\u7840\u9A8C\u8BC1\u63D2\u4EF6\uFF08\u5927\u5C0F\u3001\u7C7B\u578B\u3001\u6570\u91CF\uFF09";
|
|
320
|
+
this.defaultOptions = {
|
|
321
|
+
maxSize: Infinity,
|
|
322
|
+
minSize: 0,
|
|
323
|
+
accept: [],
|
|
324
|
+
allowEmpty: false,
|
|
325
|
+
customValidate: async () => true,
|
|
326
|
+
messages: {}
|
|
327
|
+
};
|
|
328
|
+
this.options = { ...this.defaultOptions, ...options };
|
|
329
|
+
}
|
|
330
|
+
async created(uploader) {
|
|
331
|
+
uploader.inputHTML?.setAttribute("accept", this.options.accept.join(","));
|
|
332
|
+
}
|
|
333
|
+
async onFileSelect(file, context) {
|
|
334
|
+
const uploader = context.transfer;
|
|
335
|
+
const baseError = this.createBaseError(file, uploader);
|
|
336
|
+
if (!this.options.allowEmpty && file.File.size === 0) {
|
|
337
|
+
const msg = this.options.messages.empty?.() || `\u6587\u4EF6 ${file.fileName} \u662F\u7A7A\u6587\u4EF6`;
|
|
338
|
+
return this.throwError(
|
|
339
|
+
baseError.setCode(core.ErrorCode.FILE_EMPTY).setMessage(msg)
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
if (file.File.size < this.options.minSize) {
|
|
343
|
+
const msg = this.options.messages.minSize?.(this.options.minSize, file.File.size) || `\u6587\u4EF6 ${file.fileName} \u592A\u5C0F\uFF0C\u6700\u5C0F ${core.formatFileSize(this.options.minSize)}`;
|
|
344
|
+
return this.throwError(
|
|
345
|
+
baseError.setCode(core.ErrorCode.FILE_TOO_SMALL).setMessage(msg).setContext({
|
|
346
|
+
minSize: this.options.minSize,
|
|
347
|
+
currentSize: file.File.size
|
|
348
|
+
})
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
if (file.File.size > this.options.maxSize) {
|
|
352
|
+
const msg = this.options.messages.maxSize?.(this.options.maxSize, file.File.size) || `\u6587\u4EF6 ${file.fileName} \u592A\u5927\uFF0C\u6700\u5927 ${core.formatFileSize(this.options.maxSize)}`;
|
|
353
|
+
return this.throwError(
|
|
354
|
+
baseError.setCode(core.ErrorCode.FILE_TOO_LARGE).setMessage(msg).setContext({
|
|
355
|
+
maxSize: this.options.maxSize,
|
|
356
|
+
currentSize: file.File.size
|
|
357
|
+
})
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
if (!core.validator.type(this.options.accept, file)) {
|
|
361
|
+
const msg = this.options.messages.accept?.(this.options.accept, file.fileName) || `\u6587\u4EF6 ${file.fileName} \u7C7B\u578B\u4E0D\u652F\u6301\uFF0C\u5141\u8BB8\uFF1A${this.options.accept.join(", ")}`;
|
|
362
|
+
return this.throwError(
|
|
363
|
+
baseError.setCode(core.ErrorCode.INVALID_TYPE).setMessage(msg)
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
try {
|
|
367
|
+
const customResult = await this.options.customValidate(
|
|
368
|
+
file.File,
|
|
369
|
+
core.FileUDError
|
|
370
|
+
);
|
|
371
|
+
if (!customResult) {
|
|
372
|
+
const msg = this.options.messages.custom?.(file.fileName) || `\u6587\u4EF6 ${file.fileName} \u9A8C\u8BC1\u5931\u8D25`;
|
|
373
|
+
return this.throwError(
|
|
374
|
+
baseError.setCode(core.ErrorCode.FILE_CORRUPTED).setMessage(msg)
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
} catch (error) {
|
|
378
|
+
console.log("\u{1F680} ~ FileValidatorPlugin ~ onFileSelect ~ error:", error);
|
|
379
|
+
return this.throwError(
|
|
380
|
+
baseError.setCode(core.ErrorCode.PLUGIN_ERROR).setMessage("\u6587\u4EF6\u9A8C\u8BC1\u8FC7\u7A0B\u51FA\u9519").setContext({
|
|
381
|
+
originalError: error
|
|
382
|
+
})
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
return file;
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
var ImageValidatorPlugin = class extends BasePlugin {
|
|
389
|
+
constructor(options = {}) {
|
|
390
|
+
super();
|
|
391
|
+
this.options = options;
|
|
392
|
+
this.name = "image-validator-plugin";
|
|
393
|
+
this.priority = 0;
|
|
394
|
+
this.desc = "\u56FE\u7247\u9A8C\u8BC1\u63D2\u4EF6\uFF08\u5C3A\u5BF8\u3001\u6BD4\u4F8B\u3001\u5206\u8FA8\u7387\uFF09";
|
|
395
|
+
}
|
|
396
|
+
async onFileSelect(file, context) {
|
|
397
|
+
if (!file.File.type.startsWith("image/")) {
|
|
398
|
+
return file;
|
|
399
|
+
}
|
|
400
|
+
const dimensions = await this.getImageDimensions(file.File);
|
|
401
|
+
const baseError = this.createBaseError(file, context.transfer);
|
|
402
|
+
if (this.options.exactWidth && dimensions.width !== this.options.exactWidth) {
|
|
403
|
+
return this.throwError(
|
|
404
|
+
baseError.setCode(core.ErrorCode.IMAGE_WIDTH_INVALID).setMessage(
|
|
405
|
+
`\u5BBD\u5EA6\u5FC5\u987B\u4E3A ${this.options.exactWidth}px\uFF0C\u5F53\u524D ${dimensions.width}px`
|
|
406
|
+
).setContext({ width: dimensions.width })
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
if (this.options.minWidth && dimensions.width < this.options.minWidth) {
|
|
410
|
+
return this.throwError(
|
|
411
|
+
baseError.setCode(core.ErrorCode.IMAGE_WIDTH_INVALID).setMessage(
|
|
412
|
+
`\u5BBD\u5EA6\u4E0D\u80FD\u5C0F\u4E8E ${this.options.minWidth}px\uFF0C\u5F53\u524D ${dimensions.width}px`
|
|
413
|
+
).setContext({ width: dimensions.width })
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
if (this.options.maxWidth && dimensions.width > this.options.maxWidth) {
|
|
417
|
+
return this.throwError(
|
|
418
|
+
baseError.setCode(core.ErrorCode.IMAGE_WIDTH_INVALID).setMessage(
|
|
419
|
+
`\u5BBD\u5EA6\u4E0D\u80FD\u5927\u4E8E ${this.options.maxWidth}px\uFF0C\u5F53\u524D ${dimensions.width}px`
|
|
420
|
+
).setContext({ width: dimensions.width })
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
if (this.options.exactHeight && dimensions.height !== this.options.exactHeight) {
|
|
424
|
+
return this.throwError(
|
|
425
|
+
baseError.setCode(core.ErrorCode.IMAGE_HEIGHT_INVALID).setMessage(
|
|
426
|
+
`\u9AD8\u5EA6\u5FC5\u987B\u4E3A ${this.options.exactHeight}px\uFF0C\u5F53\u524D ${dimensions.height}px`
|
|
427
|
+
).setContext({ height: dimensions.height })
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
if (this.options.minHeight && dimensions.height < this.options.minHeight) {
|
|
431
|
+
return this.throwError(
|
|
432
|
+
baseError.setCode(core.ErrorCode.IMAGE_HEIGHT_INVALID).setMessage(
|
|
433
|
+
`\u9AD8\u5EA6\u4E0D\u80FD\u5C0F\u4E8E ${this.options.minHeight}px\uFF0C\u5F53\u524D ${dimensions.height}px`
|
|
434
|
+
).setContext({ height: dimensions.height })
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
if (this.options.maxHeight && dimensions.height > this.options.maxHeight) {
|
|
438
|
+
return this.throwError(
|
|
439
|
+
baseError.setCode(core.ErrorCode.IMAGE_HEIGHT_INVALID).setMessage(
|
|
440
|
+
`\u9AD8\u5EA6\u4E0D\u80FD\u5927\u4E8E ${this.options.maxHeight}px\uFF0C\u5F53\u524D ${dimensions.height}px`
|
|
441
|
+
).setContext({ height: dimensions.height })
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
if (this.options.square && dimensions.width !== dimensions.height) {
|
|
445
|
+
return this.throwError(
|
|
446
|
+
baseError.setCode(core.ErrorCode.IMAGE_NOT_SQUARE).setMessage(
|
|
447
|
+
`\u56FE\u7247\u5FC5\u987B\u662F\u6B63\u65B9\u5F62\uFF0C\u5F53\u524D ${dimensions.width}x${dimensions.height}`
|
|
448
|
+
).setContext({
|
|
449
|
+
width: dimensions.width,
|
|
450
|
+
height: dimensions.height
|
|
451
|
+
})
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
const aspectRatio = dimensions.width / dimensions.height;
|
|
455
|
+
if (this.options.minAspectRatio && aspectRatio < this.options.minAspectRatio) {
|
|
456
|
+
return this.throwError(
|
|
457
|
+
baseError.setCode(core.ErrorCode.IMAGE_ASPECT_RATIO_INVALID).setMessage(
|
|
458
|
+
`\u5BBD\u9AD8\u6BD4\u4E0D\u80FD\u5C0F\u4E8E ${this.options.minAspectRatio}\uFF0C\u5F53\u524D ${aspectRatio.toFixed(2)}`
|
|
459
|
+
).setContext({ aspectRatio })
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
if (this.options.maxAspectRatio && aspectRatio > this.options.maxAspectRatio) {
|
|
463
|
+
return this.throwError(
|
|
464
|
+
baseError.setCode(core.ErrorCode.IMAGE_ASPECT_RATIO_INVALID).setMessage(
|
|
465
|
+
`\u5BBD\u9AD8\u6BD4\u4E0D\u80FD\u5927\u4E8E ${this.options.maxAspectRatio}\uFF0C\u5F53\u524D ${aspectRatio.toFixed(2)}`
|
|
466
|
+
).setContext({ aspectRatio })
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
if (this.options.aspectRatios?.length) {
|
|
470
|
+
const isValid = this.options.aspectRatios.some(
|
|
471
|
+
(ratio) => Math.abs(aspectRatio - ratio) < 0.01
|
|
472
|
+
);
|
|
473
|
+
if (!isValid) {
|
|
474
|
+
return this.throwError(
|
|
475
|
+
baseError.setCode(core.ErrorCode.IMAGE_ASPECT_RATIO_INVALID).setMessage(
|
|
476
|
+
`\u5BBD\u9AD8\u6BD4\u5FC5\u987B\u4E3A ${this.options.aspectRatios.join(", ")}\uFF0C\u5F53\u524D ${aspectRatio.toFixed(2)}`
|
|
477
|
+
).setContext({ aspectRatio })
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
const resolution = dimensions.width * dimensions.height;
|
|
482
|
+
if (this.options.minResolution && resolution < this.options.minResolution) {
|
|
483
|
+
return this.throwError(
|
|
484
|
+
baseError.setCode(core.ErrorCode.IMAGE_RESOLUTION_INVALID).setMessage(
|
|
485
|
+
`\u5206\u8FA8\u7387\u4E0D\u80FD\u5C0F\u4E8E ${this.options.minResolution}px\xB2\uFF0C\u5F53\u524D ${resolution}px\xB2`
|
|
486
|
+
).setContext({ resolution })
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
if (this.options.maxResolution && resolution > this.options.maxResolution) {
|
|
490
|
+
return this.throwError(
|
|
491
|
+
baseError.setCode(core.ErrorCode.IMAGE_RESOLUTION_INVALID).setMessage(
|
|
492
|
+
`\u5206\u8FA8\u7387\u4E0D\u80FD\u5927\u4E8E ${this.options.maxResolution}px\xB2\uFF0C\u5F53\u524D ${resolution}px\xB2`
|
|
493
|
+
).setContext({ resolution })
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
if (this.options.allowAnimated === false && file.File.type === "image/gif") {
|
|
497
|
+
const isAnimated = await this.isAnimatedGif(file.File);
|
|
498
|
+
if (isAnimated) {
|
|
499
|
+
return this.throwError(
|
|
500
|
+
baseError.setCode(core.ErrorCode.IMAGE_ANIMATED).setMessage("\u4E0D\u652F\u6301\u52A8\u6001\u56FE\u7247")
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
file.metadata = {
|
|
505
|
+
...file.metadata,
|
|
506
|
+
width: dimensions.width,
|
|
507
|
+
height: dimensions.height,
|
|
508
|
+
aspectRatio,
|
|
509
|
+
resolution
|
|
510
|
+
};
|
|
511
|
+
return file;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* 获取图片尺寸
|
|
515
|
+
*/
|
|
516
|
+
async getImageDimensions(file) {
|
|
517
|
+
return new Promise((resolve, reject) => {
|
|
518
|
+
const img = new Image();
|
|
519
|
+
img.onload = () => resolve({ width: img.width, height: img.height });
|
|
520
|
+
img.onerror = reject;
|
|
521
|
+
img.src = URL.createObjectURL(file);
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* 检查 GIF 是否为动态图片
|
|
526
|
+
*/
|
|
527
|
+
async isAnimatedGif(file) {
|
|
528
|
+
const buffer = await file.arrayBuffer();
|
|
529
|
+
const view = new DataView(buffer);
|
|
530
|
+
if (view.getUint8(0) !== 71 || view.getUint8(1) !== 73 || view.getUint8(2) !== 70 || view.getUint8(3) !== 56) {
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
let frames = 0;
|
|
534
|
+
const maxFrames = 2;
|
|
535
|
+
let offset = 6;
|
|
536
|
+
while (offset < view.byteLength && frames < maxFrames) {
|
|
537
|
+
const blockId = view.getUint8(offset);
|
|
538
|
+
if (blockId === 33) {
|
|
539
|
+
offset += 2;
|
|
540
|
+
const blockSize = view.getUint8(offset);
|
|
541
|
+
offset += blockSize + 1;
|
|
542
|
+
} else if (blockId === 44) {
|
|
543
|
+
frames++;
|
|
544
|
+
offset += 10;
|
|
545
|
+
} else if (blockId === 59) {
|
|
546
|
+
break;
|
|
547
|
+
} else {
|
|
548
|
+
offset++;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return frames > 1;
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
var VideoValidatorPlugin = class extends BasePlugin {
|
|
555
|
+
constructor(options = {}) {
|
|
556
|
+
super();
|
|
557
|
+
this.options = options;
|
|
558
|
+
this.name = "video-validator-plugin";
|
|
559
|
+
this.version = "1.0.0";
|
|
560
|
+
this.priority = 0;
|
|
561
|
+
}
|
|
562
|
+
async onFileSelect(file, context) {
|
|
563
|
+
if (!file.File.type.startsWith("video/")) {
|
|
564
|
+
return file;
|
|
565
|
+
}
|
|
566
|
+
const metadata = await this.getVideoMetadata(file.File);
|
|
567
|
+
const baseError = this.createBaseError(file, context.transfer);
|
|
568
|
+
if (this.options.minDuration && metadata.duration < this.options.minDuration) {
|
|
569
|
+
return this.throwError(
|
|
570
|
+
baseError.setCode(core.ErrorCode.VIDEO_DURATION_INVALID).setMessage(
|
|
571
|
+
`\u89C6\u9891\u65F6\u957F\u4E0D\u80FD\u5C0F\u4E8E ${this.options.minDuration}\u79D2\uFF0C\u5F53\u524D ${metadata.duration.toFixed(1)}\u79D2`
|
|
572
|
+
).setContext({ duration: metadata.duration })
|
|
573
|
+
);
|
|
574
|
+
}
|
|
575
|
+
if (this.options.maxDuration && metadata.duration > this.options.maxDuration) {
|
|
576
|
+
return this.throwError(
|
|
577
|
+
baseError.setCode(core.ErrorCode.VIDEO_DURATION_INVALID).setMessage(
|
|
578
|
+
`\u89C6\u9891\u65F6\u957F\u4E0D\u80FD\u5927\u4E8E ${this.options.maxDuration}\u79D2\uFF0C\u5F53\u524D ${metadata.duration.toFixed(1)}\u79D2`
|
|
579
|
+
).setContext({ duration: metadata.duration })
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
if (this.options.minWidth && metadata.width < this.options.minWidth) {
|
|
583
|
+
return this.throwError(
|
|
584
|
+
baseError.setCode(core.ErrorCode.VIDEO_WIDTH_INVALID).setMessage(
|
|
585
|
+
`\u89C6\u9891\u5BBD\u5EA6\u4E0D\u80FD\u5C0F\u4E8E ${this.options.minWidth}px\uFF0C\u5F53\u524D ${metadata.width}px`
|
|
586
|
+
).setContext({ width: metadata.width })
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
if (this.options.minHeight && metadata.height < this.options.minHeight) {
|
|
590
|
+
return this.throwError(
|
|
591
|
+
baseError.setCode(core.ErrorCode.VIDEO_HEIGHT_INVALID).setMessage(
|
|
592
|
+
`\u89C6\u9891\u9AD8\u5EA6\u4E0D\u80FD\u5C0F\u4E8E ${this.options.minHeight}px\uFF0C\u5F53\u524D ${metadata.height}px`
|
|
593
|
+
).setContext({ height: metadata.height })
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
if (this.options.minBitrate && metadata.bitrate < this.options.minBitrate) {
|
|
597
|
+
return this.throwError(
|
|
598
|
+
baseError.setCode(core.ErrorCode.VIDEO_BITRATE_INVALID).setMessage(
|
|
599
|
+
`\u89C6\u9891\u6BD4\u7279\u7387\u4E0D\u80FD\u5C0F\u4E8E ${this.options.minBitrate}kbps\uFF0C\u5F53\u524D ${metadata.bitrate}kbps`
|
|
600
|
+
).setContext({ bitrate: metadata.bitrate })
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
if (this.options.maxBitrate && metadata.bitrate > this.options.maxBitrate) {
|
|
604
|
+
return this.throwError(
|
|
605
|
+
baseError.setCode(core.ErrorCode.VIDEO_BITRATE_INVALID).setMessage(
|
|
606
|
+
`\u89C6\u9891\u6BD4\u7279\u7387\u4E0D\u80FD\u5927\u4E8E ${this.options.maxBitrate}kbps\uFF0C\u5F53\u524D ${metadata.bitrate}kbps`
|
|
607
|
+
).setContext({ bitrate: metadata.bitrate })
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
if (this.options.allowedCodecs?.length) {
|
|
611
|
+
const codecValid = this.options.allowedCodecs.some(
|
|
612
|
+
(codec) => metadata.codec?.includes(codec)
|
|
613
|
+
);
|
|
614
|
+
if (!codecValid) {
|
|
615
|
+
return this.throwError(
|
|
616
|
+
baseError.setCode(core.ErrorCode.VIDEO_CODEC_INVALID).setMessage(
|
|
617
|
+
`\u89C6\u9891\u7F16\u7801\u683C\u5F0F\u4E0D\u652F\u6301\uFF0C\u5F53\u524D ${metadata.codec || "\u672A\u77E5"}\uFF0C\u5141\u8BB8\uFF1A${this.options.allowedCodecs.join(", ")}`
|
|
618
|
+
).setContext({ codec: metadata.codec })
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
file.metadata = { ...file.metadata, video: metadata };
|
|
623
|
+
return file;
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* 获取视频元数据
|
|
627
|
+
*/
|
|
628
|
+
async getVideoMetadata(file) {
|
|
629
|
+
return new Promise((resolve, reject) => {
|
|
630
|
+
const video = document.createElement("video");
|
|
631
|
+
video.preload = "metadata";
|
|
632
|
+
video.onloadedmetadata = () => {
|
|
633
|
+
URL.revokeObjectURL(video.src);
|
|
634
|
+
resolve({
|
|
635
|
+
duration: video.duration,
|
|
636
|
+
width: video.videoWidth,
|
|
637
|
+
height: video.videoHeight,
|
|
638
|
+
bitrate: 0,
|
|
639
|
+
// 浏览器无法直接获取比特率,需要后端提供或估算
|
|
640
|
+
codec: video.currentSrc.split(",").pop()?.split('"')[1]
|
|
641
|
+
});
|
|
642
|
+
};
|
|
643
|
+
video.onerror = () => {
|
|
644
|
+
URL.revokeObjectURL(video.src);
|
|
645
|
+
reject(new Error("Failed to load video metadata"));
|
|
646
|
+
};
|
|
647
|
+
video.src = URL.createObjectURL(file);
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
// src/retry/smart-retry-plugin.ts
|
|
653
|
+
var SmartRetryPlugin = class {
|
|
654
|
+
// 文件ID -> 重试定时器
|
|
655
|
+
constructor(config = {}) {
|
|
656
|
+
this.name = "SmartRetryPlugin";
|
|
657
|
+
this.version = "1.0.0";
|
|
658
|
+
this.desc = "\u667A\u80FD\u91CD\u8BD5\u7B56\u7565\u63D2\u4EF6\uFF0C\u540C\u65F6\u652F\u6301\u4E0A\u4F20/\u4E0B\u8F7D\uFF0C\u652F\u6301\u6307\u6570\u9000\u907F\u3001\u7EBF\u6027\u589E\u957F\u7B49\u591A\u79CD\u91CD\u8BD5\u7B56\u7565";
|
|
659
|
+
this.priority = 10;
|
|
660
|
+
this.retryCountMap = /* @__PURE__ */ new Map();
|
|
661
|
+
// 文件ID -> 重试次数
|
|
662
|
+
this.retryTimerMap = /* @__PURE__ */ new Map();
|
|
663
|
+
this.config = {
|
|
664
|
+
maxRetries: config.maxRetries ?? 3,
|
|
665
|
+
strategy: config.strategy ?? "exponential",
|
|
666
|
+
initialDelay: config.initialDelay ?? 1e3,
|
|
667
|
+
maxDelay: config.maxDelay ?? 3e4,
|
|
668
|
+
retryableErrors: config.retryableErrors ?? [],
|
|
669
|
+
showRetryNotification: config.showRetryNotification ?? true
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* 插件初始化
|
|
674
|
+
*/
|
|
675
|
+
install(transfer, options) {
|
|
676
|
+
console.log(`\u2705 [${this.name}] \u63D2\u4EF6\u5DF2\u5B89\u88C5`, this.config);
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* 传输失败时触发(上传/下载通用)
|
|
680
|
+
*/
|
|
681
|
+
onError(error, file, context) {
|
|
682
|
+
const fileId = file.fileId;
|
|
683
|
+
const currentRetries = this.retryCountMap.get(fileId) || 0;
|
|
684
|
+
if (currentRetries >= this.config.maxRetries) {
|
|
685
|
+
console.warn(
|
|
686
|
+
`[${this.name}] \u6587\u4EF6 ${file.fileName} \u5DF2\u8FBE\u5230\u6700\u5927\u91CD\u8BD5\u6B21\u6570 (${this.config.maxRetries})\uFF0C\u505C\u6B62\u91CD\u8BD5`
|
|
687
|
+
);
|
|
688
|
+
this.cleanup(fileId);
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
if (!this.isRetryableError(error)) {
|
|
692
|
+
console.log(
|
|
693
|
+
`[${this.name}] \u6587\u4EF6 ${file.fileName} \u7684\u9519\u8BEF\u4E0D\u53EF\u91CD\u8BD5\uFF0C\u8DF3\u8FC7\u91CD\u8BD5`
|
|
694
|
+
);
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
const delay = this.calculateDelay(currentRetries);
|
|
698
|
+
const timer = setTimeout(() => {
|
|
699
|
+
console.log(
|
|
700
|
+
`[${this.name}] \u6587\u4EF6 ${file.fileName} \u7B2C ${currentRetries + 1}/${this.config.maxRetries} \u6B21\u91CD\u8BD5\uFF08\u5EF6\u8FDF ${delay}ms\uFF09`
|
|
701
|
+
);
|
|
702
|
+
this.retryCountMap.set(fileId, currentRetries + 1);
|
|
703
|
+
file.retry();
|
|
704
|
+
this.retryTimerMap.delete(fileId);
|
|
705
|
+
}, delay);
|
|
706
|
+
this.retryTimerMap.set(fileId, timer);
|
|
707
|
+
if (this.config.showRetryNotification) {
|
|
708
|
+
console.info(
|
|
709
|
+
`[${this.name}] \u23F3 \u6587\u4EF6 ${file.fileName} \u5C06\u5728 ${delay}ms \u540E\u81EA\u52A8\u91CD\u8BD5...`
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* 传输成功时清理重试状态
|
|
715
|
+
*/
|
|
716
|
+
onSuccess(response, file, context) {
|
|
717
|
+
this.cleanup(file.fileId);
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* 文件移除时清理重试状态
|
|
721
|
+
*/
|
|
722
|
+
destroy() {
|
|
723
|
+
this.retryTimerMap.forEach((timer) => clearTimeout(timer));
|
|
724
|
+
this.retryTimerMap.clear();
|
|
725
|
+
this.retryCountMap.clear();
|
|
726
|
+
console.log(`\u{1F5D1}\uFE0F [${this.name}] \u63D2\u4EF6\u5DF2\u9500\u6BC1`);
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
729
|
+
* 判断错误是否可重试
|
|
730
|
+
*/
|
|
731
|
+
isRetryableError(error) {
|
|
732
|
+
if (this.config.retryableErrors.length === 0) {
|
|
733
|
+
return true;
|
|
734
|
+
}
|
|
735
|
+
const errorCode = error.code || error.message || "";
|
|
736
|
+
return this.config.retryableErrors.some(
|
|
737
|
+
(code) => errorCode.includes(code)
|
|
738
|
+
);
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* 计算延迟时间
|
|
742
|
+
*/
|
|
743
|
+
calculateDelay(retryCount) {
|
|
744
|
+
const { strategy, initialDelay, maxDelay } = this.config;
|
|
745
|
+
let delay;
|
|
746
|
+
switch (strategy) {
|
|
747
|
+
case "fixed":
|
|
748
|
+
delay = initialDelay;
|
|
749
|
+
break;
|
|
750
|
+
case "linear":
|
|
751
|
+
delay = initialDelay * (retryCount + 1);
|
|
752
|
+
break;
|
|
753
|
+
case "exponential":
|
|
754
|
+
default:
|
|
755
|
+
delay = initialDelay * Math.pow(2, retryCount);
|
|
756
|
+
break;
|
|
757
|
+
}
|
|
758
|
+
return Math.min(delay, maxDelay);
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* 清理文件的重试状态
|
|
762
|
+
*/
|
|
763
|
+
cleanup(fileId) {
|
|
764
|
+
const timer = this.retryTimerMap.get(fileId);
|
|
765
|
+
if (timer) {
|
|
766
|
+
clearTimeout(timer);
|
|
767
|
+
this.retryTimerMap.delete(fileId);
|
|
768
|
+
}
|
|
769
|
+
this.retryCountMap.delete(fileId);
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
exports.BasePlugin = BasePlugin;
|
|
774
|
+
exports.CompressImagePlugin = CompressImagePlugin;
|
|
775
|
+
exports.FileValidatorPlugin = FileValidatorPlugin;
|
|
776
|
+
exports.ImageValidatorPlugin = ImageValidatorPlugin;
|
|
777
|
+
exports.SmartRetryPlugin = SmartRetryPlugin;
|
|
778
|
+
exports.VideoValidatorPlugin = VideoValidatorPlugin;
|
|
779
|
+
exports.WatermarkPlugin = WatermarkPlugin;
|
|
780
|
+
//# sourceMappingURL=out.js.map
|
|
781
|
+
//# sourceMappingURL=index.js.map
|