piclist 0.9.1 → 1.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/.eslintrc.js +4 -1
- package/dist/core/Lifecycle.d.ts +1 -1
- package/dist/core/PicGo.d.ts +1 -1
- package/dist/i18n/en.d.ts +1 -1
- package/dist/i18n/index.d.ts +4 -4
- package/dist/i18n/zh-CN.d.ts +2 -2
- package/dist/i18n/zh-TW.d.ts +1 -1
- package/dist/index.cjs.js +2 -2
- package/dist/index.esm.js +2 -2
- package/dist/lib/Commander.d.ts +2 -2
- package/dist/lib/LifecyclePlugins.d.ts +1 -1
- package/dist/lib/Logger.d.ts +1 -1
- package/dist/lib/PluginHandler.d.ts +1 -1
- package/dist/lib/PluginLoader.d.ts +1 -1
- package/dist/lib/Request.d.ts +2 -2
- package/dist/plugins/beforetransformer/compress.d.ts +1 -1
- package/dist/plugins/beforetransformer/watermark.d.ts +1 -1
- package/dist/plugins/beforeupload/buildInRename.d.ts +1 -1
- package/dist/plugins/commander/config.d.ts +1 -1
- package/dist/plugins/commander/i18n.d.ts +1 -1
- package/dist/plugins/commander/index.d.ts +1 -1
- package/dist/plugins/commander/init.d.ts +1 -1
- package/dist/plugins/commander/pluginHandler.d.ts +1 -1
- package/dist/plugins/commander/proxy.d.ts +1 -1
- package/dist/plugins/commander/setting.d.ts +1 -1
- package/dist/plugins/commander/upload.d.ts +1 -1
- package/dist/plugins/commander/use.d.ts +1 -1
- package/dist/plugins/transformer/base64.d.ts +1 -1
- package/dist/plugins/transformer/index.d.ts +1 -1
- package/dist/plugins/transformer/path.d.ts +1 -1
- package/dist/plugins/uploader/aliyun.d.ts +1 -1
- package/dist/plugins/uploader/github.d.ts +1 -1
- package/dist/plugins/uploader/imgur.d.ts +1 -1
- package/dist/plugins/uploader/index.d.ts +1 -1
- package/dist/plugins/uploader/local.d.ts +1 -1
- package/dist/plugins/uploader/qiniu.d.ts +1 -1
- package/dist/plugins/uploader/sftp.d.ts +1 -1
- package/dist/plugins/uploader/smms.d.ts +1 -1
- package/dist/plugins/uploader/tcyun.d.ts +1 -1
- package/dist/plugins/uploader/upyun.d.ts +1 -1
- package/dist/plugins/uploader/webdav.d.ts +1 -1
- package/dist/types/index.d.ts +33 -49
- package/dist/types/oldRequest.d.ts +3 -7
- package/dist/utils/common.d.ts +1 -1
- package/dist/utils/createContext.d.ts +1 -1
- package/dist/utils/db.d.ts +2 -2
- package/dist/utils/getClipboardImage.d.ts +2 -2
- package/dist/utils/initUtils.d.ts +1 -1
- package/dist/utils/interfaces.d.ts +9 -13
- package/dist/utils/sshClient.d.ts +1 -1
- package/package.json +28 -38
- package/rollup.config.js +2 -2
package/dist/lib/Commander.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { Inquirer } from 'inquirer';
|
|
3
|
-
import { IPlugin, ICommander, IPicGo } from '../types';
|
|
2
|
+
import { type Inquirer } from 'inquirer';
|
|
3
|
+
import { type IPlugin, type ICommander, type IPicGo } from '../types';
|
|
4
4
|
export declare class Commander implements ICommander {
|
|
5
5
|
private readonly name;
|
|
6
6
|
static currentPlugin: string | null;
|
package/dist/lib/Logger.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILogArgvType, ILogArgvTypeWithError, ILogger, IPicGo } from '../types';
|
|
1
|
+
import { type ILogArgvType, type ILogArgvTypeWithError, type ILogger, type IPicGo } from '../types';
|
|
2
2
|
export declare class Logger implements ILogger {
|
|
3
3
|
private readonly level;
|
|
4
4
|
private readonly ctx;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IProcessEnv, IPluginHandler, IPluginHandlerOptions, IPicGo, IPluginHandlerResult } from '../types';
|
|
1
|
+
import { type IProcessEnv, type IPluginHandler, type IPluginHandlerOptions, type IPicGo, type IPluginHandlerResult } from '../types';
|
|
2
2
|
export declare class PluginHandler implements IPluginHandler {
|
|
3
3
|
private readonly ctx;
|
|
4
4
|
constructor(ctx: IPicGo);
|
package/dist/lib/Request.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { IPicGo, IRequestConfig, IOldReqOptions, IResponse, IRequest } from '../types';
|
|
1
|
+
import { type AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { type IPicGo, type IRequestConfig, type IOldReqOptions, type IResponse, type IRequest } from '../types';
|
|
3
3
|
export declare class Request implements IRequest {
|
|
4
4
|
private readonly ctx;
|
|
5
5
|
private proxy;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IPicGo } from '../../types';
|
|
1
|
+
import { type IPicGo } from '../../types';
|
|
2
2
|
export default function register(ctx: IPicGo): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IPicGo } from '../../types';
|
|
1
|
+
import { type IPicGo } from '../../types';
|
|
2
2
|
export default function register(ctx: IPicGo): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IPicGo } from '../../types';
|
|
1
|
+
import { type IPicGo } from '../../types';
|
|
2
2
|
export default function register(ctx: IPicGo): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IPicGo } from '../../types';
|
|
1
|
+
import { type IPicGo } from '../../types';
|
|
2
2
|
export default function register(ctx: IPicGo): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IPicGo } from '../../types';
|
|
1
|
+
import { type IPicGo } from '../../types';
|
|
2
2
|
export default function register(ctx: IPicGo): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IPicGo } from '../../types';
|
|
1
|
+
import { type IPicGo } from '../../types';
|
|
2
2
|
export default function register(ctx: IPicGo): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IPicGo } from '../../types';
|
|
1
|
+
import { type IPicGo } from '../../types';
|
|
2
2
|
export default function register(ctx: IPicGo): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IPicGo } from '../../types';
|
|
1
|
+
import { type IPicGo } from '../../types';
|
|
2
2
|
export default function register(ctx: IPicGo): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IPicGo } from '../../types';
|
|
1
|
+
import { type IPicGo } from '../../types';
|
|
2
2
|
export default function register(ctx: IPicGo): void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import { Command } from 'commander';
|
|
4
|
-
import { Inquirer } from 'inquirer';
|
|
5
|
-
import { FormatEnum, GravityEnum } from 'sharp';
|
|
6
|
-
import { IRequestPromiseOptions } from './oldRequest';
|
|
3
|
+
import { type Command } from 'commander';
|
|
4
|
+
import { type Inquirer } from 'inquirer';
|
|
5
|
+
import { type FormatEnum, type GravityEnum } from 'sharp';
|
|
6
|
+
import { type IRequestPromiseOptions } from './oldRequest';
|
|
7
7
|
export interface IPicGo extends NodeJS.EventEmitter {
|
|
8
8
|
/**
|
|
9
9
|
* picgo configPath
|
|
@@ -161,37 +161,37 @@ export interface IPluginLoader {
|
|
|
161
161
|
export interface IRequestOld {
|
|
162
162
|
request: import('axios').AxiosInstance;
|
|
163
163
|
}
|
|
164
|
-
export
|
|
164
|
+
export type IOldReqOptions = Omit<IRequestPromiseOptions & {
|
|
165
165
|
url: string;
|
|
166
166
|
}, 'auth'>;
|
|
167
|
-
export
|
|
167
|
+
export type IOldReqOptionsWithFullResponse = IOldReqOptions & {
|
|
168
168
|
resolveWithFullResponse: true;
|
|
169
169
|
};
|
|
170
|
-
export
|
|
170
|
+
export type IOldReqOptionsWithJSON = IOldReqOptions & {
|
|
171
171
|
json: true;
|
|
172
172
|
};
|
|
173
173
|
/**
|
|
174
174
|
* for PicGo new request api, the response will be json format
|
|
175
175
|
*/
|
|
176
|
-
export
|
|
176
|
+
export type IReqOptions<T = any> = AxiosRequestConfig<T> & {
|
|
177
177
|
resolveWithFullResponse: true;
|
|
178
178
|
};
|
|
179
179
|
/**
|
|
180
180
|
* for PicGo new request api, the response will be Buffer
|
|
181
181
|
*/
|
|
182
|
-
export
|
|
182
|
+
export type IReqOptionsWithArrayBufferRes<T = any> = IReqOptions<T> & {
|
|
183
183
|
responseType: 'arraybuffer';
|
|
184
184
|
};
|
|
185
185
|
/**
|
|
186
186
|
* for PicGo new request api, the response will be just response data. (not statusCode, headers, etc.)
|
|
187
187
|
*/
|
|
188
|
-
export
|
|
189
|
-
export
|
|
188
|
+
export type IReqOptionsWithBodyResOnly<T = any> = AxiosRequestConfig<T>;
|
|
189
|
+
export type IFullResponse<T = any, U = any> = AxiosResponse<T, U> & {
|
|
190
190
|
statusCode: number;
|
|
191
191
|
body: T;
|
|
192
192
|
};
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
type AxiosResponse<T = any, U = any> = import('axios').AxiosResponse<T, U>;
|
|
194
|
+
type AxiosRequestConfig<T = any> = import('axios').AxiosRequestConfig<T>;
|
|
195
195
|
interface IRequestOptionsWithFullResponse {
|
|
196
196
|
resolveWithFullResponse: true;
|
|
197
197
|
}
|
|
@@ -205,7 +205,7 @@ interface IRequestOptionsWithResponseTypeArrayBuffer {
|
|
|
205
205
|
* T is the response data type
|
|
206
206
|
* U is the config type
|
|
207
207
|
*/
|
|
208
|
-
export
|
|
208
|
+
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;
|
|
209
209
|
/**
|
|
210
210
|
* the old request lib will be removed in v1.5.0+
|
|
211
211
|
* the request options have the following properties
|
|
@@ -213,18 +213,14 @@ export declare type IResponse<T, U> = U extends IRequestOptionsWithFullResponse
|
|
|
213
213
|
export interface IRequestLibOnlyOptions {
|
|
214
214
|
proxy?: string;
|
|
215
215
|
body?: any;
|
|
216
|
-
formData?:
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
[key: string]: any;
|
|
221
|
-
} | string | undefined;
|
|
222
|
-
}
|
|
223
|
-
export declare type IRequestConfig<T> = T extends IRequestLibOnlyOptions ? IOldReqOptions : AxiosRequestConfig;
|
|
216
|
+
formData?: Record<string, any> | undefined;
|
|
217
|
+
form?: Record<string, any> | string | undefined;
|
|
218
|
+
}
|
|
219
|
+
export type IRequestConfig<T> = T extends IRequestLibOnlyOptions ? IOldReqOptions : AxiosRequestConfig;
|
|
224
220
|
export interface IRequest {
|
|
225
221
|
request: <T, U extends (IRequestConfig<U> extends IOldReqOptions ? IOldReqOptions : IRequestConfig<U> extends AxiosRequestConfig ? AxiosRequestConfig : never)>(config: U) => Promise<IResponse<T, U>>;
|
|
226
222
|
}
|
|
227
|
-
export
|
|
223
|
+
export type ILogColor = 'blue' | 'green' | 'yellow' | 'red';
|
|
228
224
|
/**
|
|
229
225
|
* for uploading image info
|
|
230
226
|
*/
|
|
@@ -241,12 +237,8 @@ export interface IImgInfo {
|
|
|
241
237
|
export interface IPathTransformedImgInfo extends IImgInfo {
|
|
242
238
|
success: boolean;
|
|
243
239
|
}
|
|
244
|
-
export
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
export interface ICLIConfigs {
|
|
248
|
-
[module: string]: IStringKeyMap<any>;
|
|
249
|
-
}
|
|
240
|
+
export type IStringKeyMap<T> = Record<string, T extends T ? T : any>;
|
|
241
|
+
export type ICLIConfigs = Record<string, IStringKeyMap<any>>;
|
|
250
242
|
/** SM.MS 图床配置项 */
|
|
251
243
|
export interface ISmmsConfig {
|
|
252
244
|
token: string;
|
|
@@ -406,9 +398,7 @@ export interface IConfig {
|
|
|
406
398
|
proxy?: string;
|
|
407
399
|
[others: string]: any;
|
|
408
400
|
};
|
|
409
|
-
picgoPlugins:
|
|
410
|
-
[pluginName: string]: boolean;
|
|
411
|
-
};
|
|
401
|
+
picgoPlugins: Record<string, boolean>;
|
|
412
402
|
debug?: boolean;
|
|
413
403
|
silent?: boolean;
|
|
414
404
|
settings?: {
|
|
@@ -433,7 +423,7 @@ export interface IPlugin {
|
|
|
433
423
|
config?: (ctx: IPicGo) => IPluginConfig[];
|
|
434
424
|
[propName: string]: any;
|
|
435
425
|
}
|
|
436
|
-
export
|
|
426
|
+
export type IPluginNameType = 'simple' | 'scope' | 'normal' | 'unknown';
|
|
437
427
|
export interface IPluginProcessResult {
|
|
438
428
|
success: boolean;
|
|
439
429
|
/**
|
|
@@ -461,7 +451,7 @@ export interface IPluginHandlerOptions {
|
|
|
461
451
|
/**
|
|
462
452
|
* for picgo npm plugins
|
|
463
453
|
*/
|
|
464
|
-
export
|
|
454
|
+
export type IPicGoPlugin = (ctx: IPicGo) => IPicGoPluginInterface;
|
|
465
455
|
/**
|
|
466
456
|
* interfaces for PicGo plugin
|
|
467
457
|
*/
|
|
@@ -522,9 +512,7 @@ export interface IImgSize {
|
|
|
522
512
|
/**
|
|
523
513
|
* for initUtils
|
|
524
514
|
*/
|
|
525
|
-
export
|
|
526
|
-
[filePath: string]: string | Buffer;
|
|
527
|
-
}
|
|
515
|
+
export type IFileTree = Record<string, string | Buffer>;
|
|
528
516
|
export interface IOptions {
|
|
529
517
|
template: string;
|
|
530
518
|
dest: string;
|
|
@@ -549,13 +537,11 @@ export interface IClipboardImage {
|
|
|
549
537
|
/**
|
|
550
538
|
* for install command environment variable
|
|
551
539
|
*/
|
|
552
|
-
export
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
export
|
|
556
|
-
export
|
|
557
|
-
export declare type Nullable<T> = T | null;
|
|
558
|
-
export declare type Undefinable<T> = T | undefined;
|
|
540
|
+
export type IProcessEnv = Record<string, Undefinable<string>>;
|
|
541
|
+
export type ILogArgvType = string | number;
|
|
542
|
+
export type ILogArgvTypeWithError = ILogArgvType | Error;
|
|
543
|
+
export type Nullable<T> = T | null;
|
|
544
|
+
export type Undefinable<T> = T | undefined;
|
|
559
545
|
export interface ILogger {
|
|
560
546
|
success: (...msg: ILogArgvType[]) => void;
|
|
561
547
|
info: (...msg: ILogArgvType[]) => void;
|
|
@@ -567,9 +553,7 @@ export interface IConfigChangePayload<T> {
|
|
|
567
553
|
configName: string;
|
|
568
554
|
value: T;
|
|
569
555
|
}
|
|
570
|
-
export
|
|
571
|
-
[key: string]: any;
|
|
572
|
-
}
|
|
556
|
+
export type ILocale = Record<string, any>;
|
|
573
557
|
export interface II18nManager {
|
|
574
558
|
/**
|
|
575
559
|
* translate text
|
|
@@ -595,8 +579,8 @@ export interface II18nManager {
|
|
|
595
579
|
*/
|
|
596
580
|
getLanguageList: () => string[];
|
|
597
581
|
}
|
|
598
|
-
export
|
|
599
|
-
export
|
|
582
|
+
export type availableConvertFormat = keyof FormatEnum;
|
|
583
|
+
export type availableWatermarkPosition = keyof GravityEnum;
|
|
600
584
|
export interface IBuildInWaterMarkOptions {
|
|
601
585
|
isAddWatermark?: boolean;
|
|
602
586
|
watermarkType?: 'text' | 'image';
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
[key: string]: any;
|
|
4
|
-
}
|
|
1
|
+
export type IMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
2
|
+
export type IHeaders = Record<string, any>;
|
|
5
3
|
export interface IRequestPromiseOptions {
|
|
6
4
|
baseUrl?: string | undefined;
|
|
7
5
|
url?: string;
|
|
8
6
|
method?: IMethod;
|
|
9
|
-
formData?:
|
|
10
|
-
[key: string]: any;
|
|
11
|
-
} | undefined;
|
|
7
|
+
formData?: Record<string, any> | undefined;
|
|
12
8
|
qs?: any;
|
|
13
9
|
json?: boolean;
|
|
14
10
|
body?: any;
|
package/dist/utils/common.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import { IImgSize, IPathTransformedImgInfo, IPluginNameType, ILogger, IPicGo, IBuildInCompressOptions, IBuildInWaterMarkOptions } from '../types';
|
|
3
|
+
import { type IImgSize, type IPathTransformedImgInfo, type IPluginNameType, type ILogger, type IPicGo, type IBuildInCompressOptions, type IBuildInWaterMarkOptions } from '../types';
|
|
4
4
|
import sharp from 'sharp';
|
|
5
5
|
export declare function randomStringGenerator(length: number): string;
|
|
6
6
|
export declare function renameFileNameWithTimestamp(oldName: string): string;
|
package/dist/utils/db.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IConfig, IPicGo } from '../types';
|
|
2
|
-
import { IJSON } from '@picgo/store/dist/types';
|
|
1
|
+
import { type IConfig, type IPicGo } from '../types';
|
|
2
|
+
import { type IJSON } from '@picgo/store/dist/types';
|
|
3
3
|
declare class DB {
|
|
4
4
|
private readonly ctx;
|
|
5
5
|
private readonly db;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPicGo, IClipboardImage } from '../types';
|
|
2
|
-
export
|
|
1
|
+
import { type IPicGo, type IClipboardImage } from '../types';
|
|
2
|
+
export type Platform = 'darwin' | 'win32' | 'win10' | 'linux' | 'wsl';
|
|
3
3
|
declare const getClipboardImage: (ctx: IPicGo) => Promise<IClipboardImage>;
|
|
4
4
|
export default getClipboardImage;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** This file is deprecated */
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import { PicGo } from '../core/PicGo';
|
|
4
|
-
import LifecyclePlugins from '../lib/LifecyclePlugins';
|
|
5
|
-
import { IWebdavPlistConfig } from '../types';
|
|
3
|
+
import { type PicGo } from '../core/PicGo';
|
|
4
|
+
import type LifecyclePlugins from '../lib/LifecyclePlugins';
|
|
5
|
+
import { type IWebdavPlistConfig } from '../types';
|
|
6
6
|
/**
|
|
7
7
|
* for plugin config
|
|
8
8
|
*/
|
|
@@ -139,9 +139,7 @@ export interface IConfig {
|
|
|
139
139
|
transformer?: string;
|
|
140
140
|
proxy: string;
|
|
141
141
|
};
|
|
142
|
-
picgoPlugins:
|
|
143
|
-
[propName: string]: boolean;
|
|
144
|
-
};
|
|
142
|
+
picgoPlugins: Record<string, boolean>;
|
|
145
143
|
debug?: boolean;
|
|
146
144
|
silent?: boolean;
|
|
147
145
|
settings?: {
|
|
@@ -196,10 +194,8 @@ export interface IClipboardImage {
|
|
|
196
194
|
/**
|
|
197
195
|
* for install command environment variable
|
|
198
196
|
*/
|
|
199
|
-
export
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
export
|
|
203
|
-
export
|
|
204
|
-
export declare type Nullable<T> = T | null;
|
|
205
|
-
export declare type Undefinable<T> = T | undefined;
|
|
197
|
+
export type IProcessEnv = Record<string, Undefinable<string>>;
|
|
198
|
+
export type ILogArgvType = string | number;
|
|
199
|
+
export type ILogArgvTypeWithError = ILogArgvType | Error;
|
|
200
|
+
export type Nullable<T> = T | null;
|
|
201
|
+
export type Undefinable<T> = T | undefined;
|