piclist 1.9.13 → 2.0.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/.github/workflows/docker.yml +5 -5
- package/CHANGELOG.md +22 -0
- package/License +22 -22
- package/README.md +1 -1
- package/README_cn.md +1 -1
- package/bin/picgo +9 -7
- package/bin/picgo-server +180 -161
- package/dist/core/Lifecycle.d.ts +35 -36
- package/dist/core/PicGo.d.ts +52 -52
- package/dist/i18n/en.d.ts +2 -2
- package/dist/i18n/index.d.ts +19 -17
- package/dist/i18n/zh-CN.d.ts +293 -289
- package/dist/i18n/zh-TW.d.ts +2 -2
- package/dist/index.d.ts +10 -10
- package/dist/index.js +2 -0
- package/dist/lib/Commander.d.ts +22 -22
- package/dist/lib/LifecyclePlugins.d.ts +26 -26
- package/dist/lib/Logger.d.ts +19 -19
- package/dist/lib/PluginHandler.d.ts +10 -10
- package/dist/lib/PluginLoader.d.ts +27 -27
- package/dist/lib/Request.d.ts +12 -12
- package/dist/plugins/beforetransformer/compress.d.ts +5 -5
- package/dist/plugins/beforetransformer/skipProcess.d.ts +5 -5
- package/dist/plugins/beforetransformer/watermark.d.ts +5 -5
- package/dist/plugins/beforeupload/buildInRename.d.ts +5 -5
- package/dist/plugins/commander/config.d.ts +3 -3
- package/dist/plugins/commander/i18n.d.ts +3 -3
- package/dist/plugins/commander/index.d.ts +3 -3
- package/dist/plugins/commander/pluginHandler.d.ts +3 -3
- package/dist/plugins/commander/proxy.d.ts +3 -3
- package/dist/plugins/commander/setting.d.ts +5 -5
- package/dist/plugins/commander/upload.d.ts +3 -3
- package/dist/plugins/commander/use.d.ts +3 -3
- package/dist/plugins/commander/utils.d.ts +2 -2
- package/dist/plugins/transformer/base64.d.ts +5 -5
- package/dist/plugins/transformer/index.d.ts +5 -5
- package/dist/plugins/transformer/path.d.ts +5 -5
- package/dist/plugins/uploader/advancedplist.d.ts +2 -2
- package/dist/plugins/uploader/alist.d.ts +2 -2
- package/dist/plugins/uploader/aliyun.d.ts +2 -2
- package/dist/plugins/uploader/awss3plist.d.ts +2 -2
- package/dist/plugins/uploader/github.d.ts +2 -2
- package/dist/plugins/uploader/imgur.d.ts +2 -2
- package/dist/plugins/uploader/index.d.ts +5 -5
- package/dist/plugins/uploader/local.d.ts +2 -2
- package/dist/plugins/uploader/lsky.d.ts +20 -21
- package/dist/plugins/uploader/piclist.d.ts +2 -2
- package/dist/plugins/uploader/qiniu.d.ts +2 -2
- package/dist/plugins/uploader/s3/uploader.d.ts +25 -24
- package/dist/plugins/uploader/s3/utils.d.ts +9 -10
- package/dist/plugins/uploader/sftp.d.ts +2 -2
- package/dist/plugins/uploader/smms.d.ts +2 -2
- package/dist/plugins/uploader/tcyun.d.ts +8 -8
- package/dist/plugins/uploader/upyun.d.ts +2 -2
- package/dist/plugins/uploader/utils.d.ts +26 -26
- package/dist/plugins/uploader/webdav.d.ts +2 -2
- package/dist/types/index.d.ts +572 -693
- package/dist/types/oldRequest.d.ts +15 -15
- package/dist/utils/common.d.ts +42 -119
- package/dist/utils/createContext.d.ts +6 -6
- package/dist/utils/db.d.ts +17 -15
- package/dist/utils/enum.d.ts +27 -27
- package/dist/utils/eventBus.d.ts +3 -4
- package/dist/utils/getClipboardImage.d.ts +4 -4
- package/dist/utils/sshClient.d.ts +16 -16
- package/dist/utils/static.d.ts +1 -1
- package/docker-compose.yaml +11 -11
- package/eslint.config.js +104 -0
- package/package.json +62 -78
- package/rollup.config.js +25 -42
- package/.eslintignore +0 -6
- package/.eslintrc.js +0 -50
- package/.github/workflows/alpha.yml +0 -22
- package/.github/workflows/main.yml +0 -22
- package/.github/workflows/manually.yml +0 -19
- package/dist/index.cjs.js +0 -2
- package/dist/index.esm.js +0 -2
- package/dist/plugins/commander/init.d.ts +0 -3
- package/dist/utils/initUtils.d.ts +0 -26
- package/dist/utils/interfaces.d.ts +0 -201
package/dist/types/index.d.ts
CHANGED
|
@@ -1,693 +1,572 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
export
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
export interface
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
*/
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
*/
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
export
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
*/
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
webPath
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* for
|
|
494
|
-
*/
|
|
495
|
-
export
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
}
|
|
573
|
-
/**
|
|
574
|
-
* for spawn output
|
|
575
|
-
*/
|
|
576
|
-
export interface IResult {
|
|
577
|
-
code: number;
|
|
578
|
-
data: string;
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* for transformer - path
|
|
582
|
-
*/
|
|
583
|
-
export interface IImgSize {
|
|
584
|
-
width: number;
|
|
585
|
-
height: number;
|
|
586
|
-
real?: boolean;
|
|
587
|
-
extname?: string;
|
|
588
|
-
}
|
|
589
|
-
/**
|
|
590
|
-
* for initUtils
|
|
591
|
-
*/
|
|
592
|
-
export type IFileTree = Record<string, string | Buffer>;
|
|
593
|
-
export interface IOptions {
|
|
594
|
-
template: string;
|
|
595
|
-
dest: string;
|
|
596
|
-
hasSlash: boolean;
|
|
597
|
-
inPlace: boolean;
|
|
598
|
-
clone: boolean;
|
|
599
|
-
offline: boolean;
|
|
600
|
-
tmp: string;
|
|
601
|
-
project: string;
|
|
602
|
-
}
|
|
603
|
-
/**
|
|
604
|
-
* for clipboard image
|
|
605
|
-
*/
|
|
606
|
-
export interface IClipboardImage {
|
|
607
|
-
imgPath: string;
|
|
608
|
-
/**
|
|
609
|
-
* if the path is generate by picgo -> false
|
|
610
|
-
* if the path is a real file path in system -> true
|
|
611
|
-
*/
|
|
612
|
-
shouldKeepAfterUploading: boolean;
|
|
613
|
-
}
|
|
614
|
-
/**
|
|
615
|
-
* for install command environment variable
|
|
616
|
-
*/
|
|
617
|
-
export type IProcessEnv = Record<string, Undefinable<string>>;
|
|
618
|
-
export type ILogArgvType = string | number;
|
|
619
|
-
export type ILogArgvTypeWithError = ILogArgvType | Error;
|
|
620
|
-
export type Nullable<T> = T | null;
|
|
621
|
-
export type Undefinable<T> = T | undefined;
|
|
622
|
-
export interface ILogger {
|
|
623
|
-
success: (...msg: ILogArgvType[]) => void;
|
|
624
|
-
info: (...msg: ILogArgvType[]) => void;
|
|
625
|
-
error: (...msg: ILogArgvTypeWithError[]) => void;
|
|
626
|
-
warn: (...msg: ILogArgvType[]) => void;
|
|
627
|
-
debug: (...msg: ILogArgvType[]) => void;
|
|
628
|
-
}
|
|
629
|
-
export interface IConfigChangePayload<T> {
|
|
630
|
-
configName: string;
|
|
631
|
-
value: T;
|
|
632
|
-
}
|
|
633
|
-
export type ILocale = Record<string, any>;
|
|
634
|
-
export interface II18nManager {
|
|
635
|
-
/**
|
|
636
|
-
* translate text
|
|
637
|
-
*/
|
|
638
|
-
translate: <T extends string>(key: T, args?: IStringKeyMap<string>) => string;
|
|
639
|
-
/**
|
|
640
|
-
* add locale to current i18n language
|
|
641
|
-
* default locale list
|
|
642
|
-
* - zh-CN
|
|
643
|
-
* - en
|
|
644
|
-
*/
|
|
645
|
-
addLocale: (language: string, locales: ILocale) => boolean;
|
|
646
|
-
/**
|
|
647
|
-
* set current language
|
|
648
|
-
*/
|
|
649
|
-
setLanguage: (language: string) => void;
|
|
650
|
-
/**
|
|
651
|
-
* dynamic add new language & locales
|
|
652
|
-
*/
|
|
653
|
-
addLanguage: (language: string, locales: ILocale) => boolean;
|
|
654
|
-
/**
|
|
655
|
-
* get language list
|
|
656
|
-
*/
|
|
657
|
-
getLanguageList: () => string[];
|
|
658
|
-
}
|
|
659
|
-
export type availableConvertFormat = keyof FormatEnum;
|
|
660
|
-
export type availableWatermarkPosition = keyof GravityEnum;
|
|
661
|
-
export interface IBuildInWaterMarkOptions {
|
|
662
|
-
isAddWatermark?: boolean;
|
|
663
|
-
watermarkType?: 'text' | 'image';
|
|
664
|
-
isFullScreenWatermark?: boolean;
|
|
665
|
-
watermarkDegree?: number;
|
|
666
|
-
watermarkText?: string;
|
|
667
|
-
watermarkFontPath?: string;
|
|
668
|
-
watermarkScaleRatio?: number;
|
|
669
|
-
watermarkColor?: string;
|
|
670
|
-
watermarkImagePath?: string;
|
|
671
|
-
watermarkPosition?: availableWatermarkPosition;
|
|
672
|
-
}
|
|
673
|
-
export interface IBuildInCompressOptions {
|
|
674
|
-
quality?: number;
|
|
675
|
-
isConvert?: boolean;
|
|
676
|
-
convertFormat?: availableConvertFormat;
|
|
677
|
-
isReSize?: boolean;
|
|
678
|
-
reSizeWidth?: number;
|
|
679
|
-
reSizeHeight?: number;
|
|
680
|
-
skipReSizeOfSmallImg?: boolean;
|
|
681
|
-
isReSizeByPercent?: boolean;
|
|
682
|
-
reSizePercent?: number;
|
|
683
|
-
isRotate?: boolean;
|
|
684
|
-
rotateDegree?: number;
|
|
685
|
-
isRemoveExif?: boolean;
|
|
686
|
-
isFlip?: boolean;
|
|
687
|
-
isFlop?: boolean;
|
|
688
|
-
[propName: string]: any;
|
|
689
|
-
}
|
|
690
|
-
export interface IBuildInSkipProcessOptions {
|
|
691
|
-
skipProcessExtList?: string;
|
|
692
|
-
}
|
|
693
|
-
export {};
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Inquirer } from 'inquirer';
|
|
3
|
+
import { FormatEnum, GravityEnum } from 'sharp';
|
|
4
|
+
import { IRequestPromiseOptions } from './oldRequest';
|
|
5
|
+
export interface IPicGo extends NodeJS.EventEmitter {
|
|
6
|
+
configPath: string;
|
|
7
|
+
baseDir: string;
|
|
8
|
+
log: ILogger;
|
|
9
|
+
cmd: ICommander;
|
|
10
|
+
output: IImgInfo[];
|
|
11
|
+
input: any[];
|
|
12
|
+
rawInput: any[];
|
|
13
|
+
processedInput: any[];
|
|
14
|
+
pluginLoader: IPluginLoader;
|
|
15
|
+
pluginHandler: IPluginHandler;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated will be removed in v1.5.0+
|
|
18
|
+
*/
|
|
19
|
+
Request: IRequest;
|
|
20
|
+
helper: IHelper;
|
|
21
|
+
VERSION: string;
|
|
22
|
+
GUI_VERSION?: string;
|
|
23
|
+
request: IRequest['request'];
|
|
24
|
+
rawInputPath?: string[];
|
|
25
|
+
i18n: II18nManager;
|
|
26
|
+
getConfig: <T>(name?: string) => T;
|
|
27
|
+
saveConfig: (config: IStringKeyMap<any>) => void;
|
|
28
|
+
removeConfig: (key: string, propName: string) => void;
|
|
29
|
+
setConfig: (config: IStringKeyMap<any>) => void;
|
|
30
|
+
unsetConfig: (key: string, propName: string) => void;
|
|
31
|
+
upload: (input?: any[]) => Promise<IImgInfo[] | Error>;
|
|
32
|
+
uploadReturnCtx: (input?: any[]) => Promise<IPicGo>;
|
|
33
|
+
}
|
|
34
|
+
export interface IPluginConfig {
|
|
35
|
+
name: string;
|
|
36
|
+
type: string;
|
|
37
|
+
required: boolean;
|
|
38
|
+
default?: any;
|
|
39
|
+
alias?: string;
|
|
40
|
+
message?: string;
|
|
41
|
+
prefix?: string;
|
|
42
|
+
[propName: string]: any;
|
|
43
|
+
}
|
|
44
|
+
export interface ILifecyclePlugins {
|
|
45
|
+
register: (id: string, plugin: IPlugin) => void;
|
|
46
|
+
unregister: (id: string) => void;
|
|
47
|
+
getName: () => string;
|
|
48
|
+
get: (id: string) => IPlugin | undefined;
|
|
49
|
+
getList: () => IPlugin[];
|
|
50
|
+
getIdList: () => string[];
|
|
51
|
+
}
|
|
52
|
+
export interface IHelper {
|
|
53
|
+
transformer: ILifecyclePlugins;
|
|
54
|
+
uploader: ILifecyclePlugins;
|
|
55
|
+
beforeTransformPlugins: ILifecyclePlugins;
|
|
56
|
+
beforeUploadPlugins: ILifecyclePlugins;
|
|
57
|
+
afterUploadPlugins: ILifecyclePlugins;
|
|
58
|
+
}
|
|
59
|
+
export interface ICommander extends ILifecyclePlugins {
|
|
60
|
+
program: Command;
|
|
61
|
+
inquirer: Inquirer;
|
|
62
|
+
}
|
|
63
|
+
export interface IPluginLoader {
|
|
64
|
+
registerPlugin: (name: string, plugin?: IPicGoPlugin) => Promise<void>;
|
|
65
|
+
unregisterPlugin: (name: string) => void;
|
|
66
|
+
getPlugin: (name: string) => Promise<IPicGoPluginInterface | undefined>;
|
|
67
|
+
getList: () => string[];
|
|
68
|
+
getFullList: () => string[];
|
|
69
|
+
hasPlugin: (name: string) => boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface IRequestOld {
|
|
72
|
+
request: import('axios').AxiosInstance;
|
|
73
|
+
}
|
|
74
|
+
export type IOldReqOptions = Omit<IRequestPromiseOptions & {
|
|
75
|
+
url: string;
|
|
76
|
+
}, 'auth'>;
|
|
77
|
+
export type IOldReqOptionsWithFullResponse = IOldReqOptions & {
|
|
78
|
+
resolveWithFullResponse: true;
|
|
79
|
+
};
|
|
80
|
+
export type IOldReqOptionsWithJSON = IOldReqOptions & {
|
|
81
|
+
json: true;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* for PicGo new request api, the response will be json format
|
|
85
|
+
*/
|
|
86
|
+
export type IReqOptions<T = any> = AxiosRequestConfig<T> & {
|
|
87
|
+
resolveWithFullResponse: true;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* for PicGo new request api, the response will be Buffer
|
|
91
|
+
*/
|
|
92
|
+
export type IReqOptionsWithArrayBufferRes<T = any> = IReqOptions<T> & {
|
|
93
|
+
responseType: 'arraybuffer';
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* for PicGo new request api, the response will be just response data. (not statusCode, headers, etc.)
|
|
97
|
+
*/
|
|
98
|
+
export type IReqOptionsWithBodyResOnly<T = any> = AxiosRequestConfig<T>;
|
|
99
|
+
export type IFullResponse<T = any, U = any> = AxiosResponse<T, U> & {
|
|
100
|
+
statusCode: number;
|
|
101
|
+
body: T;
|
|
102
|
+
};
|
|
103
|
+
type AxiosResponse<T = any, U = any> = import('axios').AxiosResponse<T, U>;
|
|
104
|
+
type AxiosRequestConfig<T = any> = import('axios').AxiosRequestConfig<T>;
|
|
105
|
+
interface IRequestOptionsWithFullResponse {
|
|
106
|
+
resolveWithFullResponse: true;
|
|
107
|
+
}
|
|
108
|
+
interface IRequestOptionsWithJSON {
|
|
109
|
+
json: true;
|
|
110
|
+
}
|
|
111
|
+
interface IRequestOptionsWithResponseTypeArrayBuffer {
|
|
112
|
+
responseType: 'arraybuffer';
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* T is the response data type
|
|
116
|
+
* U is the config type
|
|
117
|
+
*/
|
|
118
|
+
export type IResponse<T, U> = U extends IRequestOptionsWithFullResponse ? IFullResponse<T, U> : U extends IRequestOptionsWithJSON ? T : U extends IRequestOptionsWithResponseTypeArrayBuffer ? Buffer : U extends IOldReqOptionsWithFullResponse ? IFullResponse<T, U> : U extends IOldReqOptionsWithJSON ? T : U extends IOldReqOptions ? string : U extends IReqOptionsWithBodyResOnly ? T : string;
|
|
119
|
+
/**
|
|
120
|
+
* the old request lib will be removed in v1.5.0+
|
|
121
|
+
* the request options have the following properties
|
|
122
|
+
*/
|
|
123
|
+
export interface IRequestLibOnlyOptions {
|
|
124
|
+
proxy?: string;
|
|
125
|
+
body?: any;
|
|
126
|
+
formData?: Record<string, any> | undefined;
|
|
127
|
+
form?: Record<string, any> | string | undefined;
|
|
128
|
+
}
|
|
129
|
+
export type IRequestConfig<T> = T extends IRequestLibOnlyOptions ? IOldReqOptions : AxiosRequestConfig;
|
|
130
|
+
export interface IRequest {
|
|
131
|
+
request: <T, U extends IRequestConfig<U> extends IOldReqOptions ? IOldReqOptions : IRequestConfig<U> extends AxiosRequestConfig ? AxiosRequestConfig : never>(config: U) => Promise<IResponse<T, U>>;
|
|
132
|
+
}
|
|
133
|
+
export type ILogColor = 'blue' | 'green' | 'yellow' | 'red';
|
|
134
|
+
export interface IImgInfo {
|
|
135
|
+
buffer?: Buffer;
|
|
136
|
+
base64Image?: string;
|
|
137
|
+
fileName?: string;
|
|
138
|
+
width?: number;
|
|
139
|
+
height?: number;
|
|
140
|
+
extname?: string;
|
|
141
|
+
imgUrl?: string;
|
|
142
|
+
[propName: string]: any;
|
|
143
|
+
}
|
|
144
|
+
export interface IPathTransformedImgInfo extends IImgInfo {
|
|
145
|
+
success: boolean;
|
|
146
|
+
}
|
|
147
|
+
export type IStringKeyMap<T> = Record<string, T extends T ? T : any>;
|
|
148
|
+
export type ICLIConfigs = Record<string, IStringKeyMap<any>>;
|
|
149
|
+
/**
|
|
150
|
+
* Telegraph 图床配置项
|
|
151
|
+
* @deprecated since v1.9.6
|
|
152
|
+
*/
|
|
153
|
+
export interface ITelegraphConfig {
|
|
154
|
+
proxy?: string;
|
|
155
|
+
}
|
|
156
|
+
/** SM.MS 图床配置项 */
|
|
157
|
+
export interface ISmmsConfig {
|
|
158
|
+
token: string;
|
|
159
|
+
backupDomain?: string;
|
|
160
|
+
}
|
|
161
|
+
/** 内置高级自定义图床 */
|
|
162
|
+
export interface IAdvancedPlistConfig {
|
|
163
|
+
endpoint: string;
|
|
164
|
+
method?: string;
|
|
165
|
+
formDataKey?: string;
|
|
166
|
+
headers?: string;
|
|
167
|
+
body?: string;
|
|
168
|
+
resDataPath?: string;
|
|
169
|
+
customPrefix?: string;
|
|
170
|
+
webPath?: string;
|
|
171
|
+
}
|
|
172
|
+
/** 内置alist 图床配置项 */
|
|
173
|
+
export interface IAlistConfig {
|
|
174
|
+
url: string;
|
|
175
|
+
token?: string;
|
|
176
|
+
username?: string;
|
|
177
|
+
password?: string;
|
|
178
|
+
uploadPath?: string;
|
|
179
|
+
webPath?: string;
|
|
180
|
+
customUrl?: string;
|
|
181
|
+
}
|
|
182
|
+
/** 本地图床配置项 */
|
|
183
|
+
export interface ILocalConfig {
|
|
184
|
+
path: string;
|
|
185
|
+
customUrl?: string;
|
|
186
|
+
webPath?: string;
|
|
187
|
+
}
|
|
188
|
+
/** 七牛云图床配置项 */
|
|
189
|
+
export interface IQiniuConfig {
|
|
190
|
+
accessKey: string;
|
|
191
|
+
secretKey: string;
|
|
192
|
+
/** 存储空间名 */
|
|
193
|
+
bucket: string;
|
|
194
|
+
/** 自定义域名 */
|
|
195
|
+
url: string;
|
|
196
|
+
/** 存储区域编号 */
|
|
197
|
+
area: 'z0' | 'z1' | 'z2' | 'na0' | 'as0' | string;
|
|
198
|
+
/** 网址后缀,比如使用 `?imageslim` 可进行[图片瘦身](https://developer.qiniu.com/dora/api/1271/image-thin-body-imageslim) */
|
|
199
|
+
options: string;
|
|
200
|
+
/** 自定义存储路径,比如 `img/` */
|
|
201
|
+
path: string;
|
|
202
|
+
}
|
|
203
|
+
/** 又拍云图床配置项 */
|
|
204
|
+
export interface IUpyunConfig {
|
|
205
|
+
/** 存储空间名,及你的服务名 */
|
|
206
|
+
bucket: string;
|
|
207
|
+
/** 操作员 */
|
|
208
|
+
operator: string;
|
|
209
|
+
/** 密码 */
|
|
210
|
+
password: string;
|
|
211
|
+
/** 针对图片的一些后缀处理参数 */
|
|
212
|
+
options: string;
|
|
213
|
+
/** 自定义存储路径,比如 `img/` */
|
|
214
|
+
path: string;
|
|
215
|
+
/** 加速域名,注意要加 `http://` 或者 `https://` */
|
|
216
|
+
url: string;
|
|
217
|
+
/** 防盗链密钥 */
|
|
218
|
+
antiLeechToken: string;
|
|
219
|
+
/** 防盗链过期时间,单位为秒 */
|
|
220
|
+
expireTime: number;
|
|
221
|
+
/** 自定义API接入点 */
|
|
222
|
+
endpoint: string;
|
|
223
|
+
}
|
|
224
|
+
/** 腾讯云图床配置项 */
|
|
225
|
+
export interface ITcyunConfig {
|
|
226
|
+
secretId: string;
|
|
227
|
+
secretKey: string;
|
|
228
|
+
/** 存储桶名,v4 和 v5 版本不一样 */
|
|
229
|
+
bucket: string;
|
|
230
|
+
appId: string;
|
|
231
|
+
/** 存储区域,例如 ap-beijing-1 */
|
|
232
|
+
area: string;
|
|
233
|
+
/** 自定义存储路径,比如 img/ */
|
|
234
|
+
/** endpoint: string */
|
|
235
|
+
endpoint: string;
|
|
236
|
+
path: string;
|
|
237
|
+
/** 自定义域名,注意要加 `http://` 或者 `https://` */
|
|
238
|
+
webPath: string;
|
|
239
|
+
customUrl: string;
|
|
240
|
+
/** COS 版本,v4 或者 v5 */
|
|
241
|
+
version: 'v5' | 'v4';
|
|
242
|
+
/** 针对图片的一些后缀处理参数 PicGo 2.4.0+ PicGo-Core 1.5.0+ */
|
|
243
|
+
options: string;
|
|
244
|
+
/** 是否支持极智压缩 */
|
|
245
|
+
slim: boolean;
|
|
246
|
+
}
|
|
247
|
+
/** GitHub 图床配置项 */
|
|
248
|
+
export interface IGithubConfig {
|
|
249
|
+
/** 仓库名,格式是 `username/reponame` */
|
|
250
|
+
repo: string;
|
|
251
|
+
/** github token */
|
|
252
|
+
token: string;
|
|
253
|
+
/** 自定义存储路径,比如 `img/` */
|
|
254
|
+
path: string;
|
|
255
|
+
/** 自定义域名,注意要加 `http://` 或者 `https://` */
|
|
256
|
+
customUrl: string;
|
|
257
|
+
/** 分支名,默认是 `main` */
|
|
258
|
+
branch: string;
|
|
259
|
+
}
|
|
260
|
+
/** 阿里云图床配置项 */
|
|
261
|
+
export interface IAliyunConfig {
|
|
262
|
+
accessKeyId: string;
|
|
263
|
+
accessKeySecret: string;
|
|
264
|
+
/** 存储空间名 */
|
|
265
|
+
bucket: string;
|
|
266
|
+
/** 存储区域代号 */
|
|
267
|
+
area: string;
|
|
268
|
+
/** 自定义存储路径 */
|
|
269
|
+
path: string;
|
|
270
|
+
/** 网站路径,用于拼接网址路径 */
|
|
271
|
+
webPath: string;
|
|
272
|
+
/** 自定义域名,注意要加 `http://` 或者 `https://` */
|
|
273
|
+
customUrl: string;
|
|
274
|
+
/** 针对图片的一些后缀处理参数 PicGo 2.2.0+ PicGo-Core 1.4.0+ */
|
|
275
|
+
options: string;
|
|
276
|
+
}
|
|
277
|
+
/** Imgur 图床配置项 */
|
|
278
|
+
export interface IImgurConfig {
|
|
279
|
+
/** imgur 的 `clientId` */
|
|
280
|
+
clientId: string;
|
|
281
|
+
/** 代理地址,仅支持 http 代理 */
|
|
282
|
+
proxy: string;
|
|
283
|
+
/** imgur 用户名 */
|
|
284
|
+
username: string;
|
|
285
|
+
/** imgur access token */
|
|
286
|
+
accessToken: string;
|
|
287
|
+
/** imgur album name */
|
|
288
|
+
album: string;
|
|
289
|
+
}
|
|
290
|
+
/** Webdav 图床配置项 */
|
|
291
|
+
export interface IWebdavPlistConfig {
|
|
292
|
+
/** webdav 的 `host` */
|
|
293
|
+
host: string;
|
|
294
|
+
/** webdav 的 `sslEnabled` */
|
|
295
|
+
sslEnabled: boolean;
|
|
296
|
+
/** webdav 的 `username` */
|
|
297
|
+
username: string;
|
|
298
|
+
/** webdav 的 `password` */
|
|
299
|
+
password: string;
|
|
300
|
+
/** webdav 的 `path` */
|
|
301
|
+
path: string;
|
|
302
|
+
/** webdav 的 `webpath` */
|
|
303
|
+
webpath: string;
|
|
304
|
+
/** webdav 的 `customUrl` */
|
|
305
|
+
customUrl: string;
|
|
306
|
+
/** webdav 的 `authType` */
|
|
307
|
+
authType: string;
|
|
308
|
+
/** webdav 的 `options` */
|
|
309
|
+
options: string;
|
|
310
|
+
}
|
|
311
|
+
/** 内置sftp 图床配置项 */
|
|
312
|
+
export interface ISftpPlistConfig {
|
|
313
|
+
host: string;
|
|
314
|
+
port?: number;
|
|
315
|
+
username: string;
|
|
316
|
+
password?: string;
|
|
317
|
+
privateKey?: string;
|
|
318
|
+
passphrase?: string;
|
|
319
|
+
uploadPath?: string;
|
|
320
|
+
customUrl?: string;
|
|
321
|
+
webPath?: string;
|
|
322
|
+
fileUser?: string;
|
|
323
|
+
fileMode?: string;
|
|
324
|
+
dirMode?: string;
|
|
325
|
+
}
|
|
326
|
+
/** PicList 图床配置项 */
|
|
327
|
+
export interface IPicListConfig {
|
|
328
|
+
host: string;
|
|
329
|
+
port?: number;
|
|
330
|
+
picbed?: string;
|
|
331
|
+
configName?: string;
|
|
332
|
+
serverKey?: string;
|
|
333
|
+
}
|
|
334
|
+
/** 内置lsky 图床配置项 */
|
|
335
|
+
export interface ILskyConfig {
|
|
336
|
+
version: string;
|
|
337
|
+
host: string;
|
|
338
|
+
token: string;
|
|
339
|
+
strategyId: string;
|
|
340
|
+
albumId: string;
|
|
341
|
+
permission: IStringKeyMap<string>;
|
|
342
|
+
}
|
|
343
|
+
/** 内置aws s3 图床配置项 */
|
|
344
|
+
export interface IAwsS3PListUserConfig {
|
|
345
|
+
accessKeyID: string;
|
|
346
|
+
secretAccessKey: string;
|
|
347
|
+
bucketName: string;
|
|
348
|
+
uploadPath: string;
|
|
349
|
+
region?: string;
|
|
350
|
+
endpoint?: string;
|
|
351
|
+
proxy?: string;
|
|
352
|
+
urlPrefix?: string;
|
|
353
|
+
pathStyleAccess?: boolean;
|
|
354
|
+
rejectUnauthorized?: boolean;
|
|
355
|
+
acl?: string;
|
|
356
|
+
disableBucketPrefixToURL?: boolean | string;
|
|
357
|
+
options?: string;
|
|
358
|
+
}
|
|
359
|
+
/** PicGo 配置文件类型定义 */
|
|
360
|
+
export interface IConfig {
|
|
361
|
+
picBed: {
|
|
362
|
+
uploader: string;
|
|
363
|
+
current?: string;
|
|
364
|
+
smms?: ISmmsConfig;
|
|
365
|
+
qiniu?: IQiniuConfig;
|
|
366
|
+
upyun?: IUpyunConfig;
|
|
367
|
+
tcyun?: ITcyunConfig;
|
|
368
|
+
github?: IGithubConfig;
|
|
369
|
+
aliyun?: IAliyunConfig;
|
|
370
|
+
imgur?: IImgurConfig;
|
|
371
|
+
webdavplist?: IWebdavPlistConfig;
|
|
372
|
+
local?: ILocalConfig;
|
|
373
|
+
transformer?: string;
|
|
374
|
+
/** for uploader */
|
|
375
|
+
proxy?: string;
|
|
376
|
+
[others: string]: any;
|
|
377
|
+
};
|
|
378
|
+
picgoPlugins: Record<string, boolean>;
|
|
379
|
+
debug?: boolean;
|
|
380
|
+
silent?: boolean;
|
|
381
|
+
settings?: {
|
|
382
|
+
logLevel?: string[];
|
|
383
|
+
logPath?: string;
|
|
384
|
+
/** for npm */
|
|
385
|
+
registry?: string;
|
|
386
|
+
/** for npm */
|
|
387
|
+
proxy?: string;
|
|
388
|
+
[others: string]: any;
|
|
389
|
+
};
|
|
390
|
+
[configOptions: string]: any;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* for an uploader/transformer/beforeTransformHandler/beforeUploadHandler/afterUploadHandler
|
|
394
|
+
*/
|
|
395
|
+
export interface IPlugin {
|
|
396
|
+
handle: ((ctx: IPicGo) => Promise<any>) | ((ctx: IPicGo) => void);
|
|
397
|
+
name?: string;
|
|
398
|
+
config?: (ctx: IPicGo) => IPluginConfig[];
|
|
399
|
+
[propName: string]: any;
|
|
400
|
+
}
|
|
401
|
+
export type IPluginNameType = 'simple' | 'scope' | 'normal' | 'unknown';
|
|
402
|
+
export interface IPluginProcessResult {
|
|
403
|
+
success: boolean;
|
|
404
|
+
pkgName: string;
|
|
405
|
+
fullName: string;
|
|
406
|
+
}
|
|
407
|
+
export interface IPluginHandler {
|
|
408
|
+
install: (plugins: string[], options: IPluginHandlerOptions, env?: IProcessEnv) => Promise<IPluginHandlerResult<boolean>>;
|
|
409
|
+
update: (plugins: string[], options: IPluginHandlerOptions, env?: IProcessEnv) => Promise<IPluginHandlerResult<boolean>>;
|
|
410
|
+
uninstall: (plugins: string[]) => Promise<IPluginHandlerResult<boolean>>;
|
|
411
|
+
}
|
|
412
|
+
export interface IPluginHandlerResult<T> {
|
|
413
|
+
success: T;
|
|
414
|
+
body: T extends true ? string[] : string;
|
|
415
|
+
}
|
|
416
|
+
export interface IPluginHandlerOptions {
|
|
417
|
+
proxy?: string;
|
|
418
|
+
registry?: string;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* for picgo npm plugins
|
|
422
|
+
*/
|
|
423
|
+
export type IPicGoPlugin = (ctx: IPicGo) => IPicGoPluginInterface;
|
|
424
|
+
/**
|
|
425
|
+
* interfaces for PicGo plugin
|
|
426
|
+
*/
|
|
427
|
+
export interface IPicGoPluginInterface {
|
|
428
|
+
/**
|
|
429
|
+
* since PicGo-Core v1.5, register will inject ctx
|
|
430
|
+
*/
|
|
431
|
+
register: (ctx: IPicGo) => void;
|
|
432
|
+
/**
|
|
433
|
+
* this plugin's config
|
|
434
|
+
*/
|
|
435
|
+
config?: (ctx: IPicGo) => IPluginConfig[];
|
|
436
|
+
/**
|
|
437
|
+
* register uploader name
|
|
438
|
+
*/
|
|
439
|
+
uploader?: string;
|
|
440
|
+
/**
|
|
441
|
+
* register transformer name
|
|
442
|
+
*/
|
|
443
|
+
transformer?: string;
|
|
444
|
+
/**
|
|
445
|
+
* for picgo gui plugins
|
|
446
|
+
*/
|
|
447
|
+
guiMenu?: (ctx: IPicGo) => IGuiMenuItem[];
|
|
448
|
+
/**
|
|
449
|
+
* for picgo gui plugins
|
|
450
|
+
* short key -> command
|
|
451
|
+
*/
|
|
452
|
+
commands?: (ctx: IPicGo) => ICommandItem[];
|
|
453
|
+
[propName: string]: any;
|
|
454
|
+
}
|
|
455
|
+
export interface IGuiMenuItem {
|
|
456
|
+
label: string;
|
|
457
|
+
handle: (ctx: IPicGo, guiApi: any) => Promise<void>;
|
|
458
|
+
}
|
|
459
|
+
export interface ICommandItem {
|
|
460
|
+
label: string;
|
|
461
|
+
name: string;
|
|
462
|
+
key: string;
|
|
463
|
+
handle: (ctx: IPicGo, guiApi: any) => Promise<void>;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* for spawn output
|
|
467
|
+
*/
|
|
468
|
+
export interface IResult {
|
|
469
|
+
code: number;
|
|
470
|
+
data: string;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* for transformer - path
|
|
474
|
+
*/
|
|
475
|
+
export interface IImgSize {
|
|
476
|
+
width: number;
|
|
477
|
+
height: number;
|
|
478
|
+
real?: boolean;
|
|
479
|
+
extname?: string;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* for clipboard image
|
|
483
|
+
*/
|
|
484
|
+
export interface IClipboardImage {
|
|
485
|
+
imgPath: string;
|
|
486
|
+
/**
|
|
487
|
+
* if the path is generate by picgo -> false
|
|
488
|
+
* if the path is a real file path in system -> true
|
|
489
|
+
*/
|
|
490
|
+
shouldKeepAfterUploading: boolean;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* for install command environment variable
|
|
494
|
+
*/
|
|
495
|
+
export type IProcessEnv = Record<string, Undefinable<string>>;
|
|
496
|
+
export type ILogArgvType = string | number;
|
|
497
|
+
export type ILogArgvTypeWithError = ILogArgvType | Error;
|
|
498
|
+
export type Nullable<T> = T | null;
|
|
499
|
+
export type Undefinable<T> = T | undefined;
|
|
500
|
+
export interface ILogger {
|
|
501
|
+
success: (...msg: ILogArgvType[]) => void;
|
|
502
|
+
info: (...msg: ILogArgvType[]) => void;
|
|
503
|
+
error: (...msg: ILogArgvTypeWithError[]) => void;
|
|
504
|
+
warn: (...msg: ILogArgvType[]) => void;
|
|
505
|
+
debug: (...msg: ILogArgvType[]) => void;
|
|
506
|
+
}
|
|
507
|
+
export interface IConfigChangePayload<T> {
|
|
508
|
+
configName: string;
|
|
509
|
+
value: T;
|
|
510
|
+
}
|
|
511
|
+
export type ILocale = Record<string, any>;
|
|
512
|
+
export interface II18nManager {
|
|
513
|
+
/**
|
|
514
|
+
* translate text
|
|
515
|
+
*/
|
|
516
|
+
translate: <T extends string>(key: T, args?: IStringKeyMap<string>) => string;
|
|
517
|
+
/**
|
|
518
|
+
* add locale to current i18n language
|
|
519
|
+
* default locale list
|
|
520
|
+
* - zh-CN
|
|
521
|
+
* - en
|
|
522
|
+
*/
|
|
523
|
+
addLocale: (language: string, locales: ILocale) => boolean;
|
|
524
|
+
/**
|
|
525
|
+
* set current language
|
|
526
|
+
*/
|
|
527
|
+
setLanguage: (language: string) => void;
|
|
528
|
+
/**
|
|
529
|
+
* dynamic add new language & locales
|
|
530
|
+
*/
|
|
531
|
+
addLanguage: (language: string, locales: ILocale) => boolean;
|
|
532
|
+
/**
|
|
533
|
+
* get language list
|
|
534
|
+
*/
|
|
535
|
+
getLanguageList: () => string[];
|
|
536
|
+
}
|
|
537
|
+
export type availableConvertFormat = keyof FormatEnum;
|
|
538
|
+
export type availableWatermarkPosition = keyof GravityEnum;
|
|
539
|
+
export interface IBuildInWaterMarkOptions {
|
|
540
|
+
isAddWatermark?: boolean;
|
|
541
|
+
watermarkType?: 'text' | 'image';
|
|
542
|
+
isFullScreenWatermark?: boolean;
|
|
543
|
+
watermarkDegree?: number;
|
|
544
|
+
watermarkText?: string;
|
|
545
|
+
watermarkFontPath?: string;
|
|
546
|
+
watermarkScaleRatio?: number;
|
|
547
|
+
watermarkColor?: string;
|
|
548
|
+
watermarkImagePath?: string;
|
|
549
|
+
watermarkPosition?: availableWatermarkPosition;
|
|
550
|
+
watermarkImageOpacity?: number;
|
|
551
|
+
}
|
|
552
|
+
export interface IBuildInCompressOptions {
|
|
553
|
+
quality?: number;
|
|
554
|
+
isConvert?: boolean;
|
|
555
|
+
convertFormat?: availableConvertFormat;
|
|
556
|
+
isReSize?: boolean;
|
|
557
|
+
reSizeWidth?: number;
|
|
558
|
+
reSizeHeight?: number;
|
|
559
|
+
skipReSizeOfSmallImg?: boolean;
|
|
560
|
+
isReSizeByPercent?: boolean;
|
|
561
|
+
reSizePercent?: number;
|
|
562
|
+
isRotate?: boolean;
|
|
563
|
+
rotateDegree?: number;
|
|
564
|
+
isRemoveExif?: boolean;
|
|
565
|
+
isFlip?: boolean;
|
|
566
|
+
isFlop?: boolean;
|
|
567
|
+
[propName: string]: any;
|
|
568
|
+
}
|
|
569
|
+
export interface IBuildInSkipProcessOptions {
|
|
570
|
+
skipProcessExtList?: string;
|
|
571
|
+
}
|
|
572
|
+
export {};
|