picgo 1.5.11 → 1.6.1

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.
Files changed (61) hide show
  1. package/.node-version +1 -1
  2. package/README.md +2 -2
  3. package/dist/core/Lifecycle.d.ts +14 -15
  4. package/dist/core/PicGo.d.ts +48 -49
  5. package/dist/i18n/en.d.ts +2 -2
  6. package/dist/i18n/index.d.ts +18 -18
  7. package/dist/i18n/zh-CN.d.ts +97 -97
  8. package/dist/i18n/zh-TW.d.ts +2 -2
  9. package/dist/index.cjs.js +2 -2
  10. package/dist/index.cjs.js.map +1 -0
  11. package/dist/index.d.ts +11 -10
  12. package/dist/index.esm.js +2 -2
  13. package/dist/index.esm.js.map +1 -0
  14. package/dist/lib/Commander.d.ts +22 -22
  15. package/dist/lib/LifecyclePlugins.d.ts +17 -17
  16. package/dist/lib/Logger.d.ts +19 -19
  17. package/dist/lib/PluginHandler.d.ts +10 -10
  18. package/dist/lib/PluginLoader.d.ts +27 -27
  19. package/dist/lib/Request.d.ts +12 -12
  20. package/dist/plugins/commander/config.d.ts +3 -3
  21. package/dist/plugins/commander/i18n.d.ts +3 -3
  22. package/dist/plugins/commander/index.d.ts +3 -3
  23. package/dist/plugins/commander/init.d.ts +3 -3
  24. package/dist/plugins/commander/pluginHandler.d.ts +3 -3
  25. package/dist/plugins/commander/proxy.d.ts +3 -3
  26. package/dist/plugins/commander/setting.d.ts +5 -5
  27. package/dist/plugins/commander/upload.d.ts +3 -3
  28. package/dist/plugins/commander/use.d.ts +3 -3
  29. package/dist/plugins/transformer/base64.d.ts +5 -5
  30. package/dist/plugins/transformer/index.d.ts +3 -3
  31. package/dist/plugins/transformer/path.d.ts +5 -5
  32. package/dist/plugins/uploader/aliyun.d.ts +2 -2
  33. package/dist/plugins/uploader/github.d.ts +2 -2
  34. package/dist/plugins/uploader/imgur.d.ts +2 -2
  35. package/dist/plugins/uploader/index.d.ts +3 -3
  36. package/dist/plugins/uploader/qiniu.d.ts +2 -2
  37. package/dist/plugins/uploader/smms.d.ts +2 -2
  38. package/dist/plugins/uploader/tcyun.d.ts +8 -8
  39. package/dist/plugins/uploader/upyun.d.ts +2 -2
  40. package/dist/types/index.d.ts +542 -542
  41. package/dist/types/oldRequest.d.ts +19 -19
  42. package/dist/utils/common.d.ts +118 -120
  43. package/dist/utils/createContext.d.ts +6 -6
  44. package/dist/utils/db.d.ts +15 -15
  45. package/dist/utils/enum.d.ts +27 -27
  46. package/dist/utils/eventBus.d.ts +3 -4
  47. package/dist/utils/getClipboardImage.d.ts +4 -4
  48. package/dist/utils/initUtils.d.ts +26 -26
  49. package/dist/utils/interfaces.d.ts +202 -203
  50. package/dist/utils/static.d.ts +1 -1
  51. package/package.json +40 -38
  52. package/.eslintignore +0 -2
  53. package/.eslintrc.js +0 -25
  54. package/.github/CODEOWNERS +0 -1
  55. package/.github/funding.yml +0 -1
  56. package/.github/workflows/alpha.yml +0 -22
  57. package/.github/workflows/main.yml +0 -22
  58. package/.github/workflows/manually.yml +0 -19
  59. package/CHANGELOG.md +0 -680
  60. package/logo.png +0 -0
  61. package/rollup.config.js +0 -87
@@ -1,19 +1,19 @@
1
- export declare type IMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
2
- export interface IHeaders {
3
- [key: string]: any;
4
- }
5
- export interface IRequestPromiseOptions {
6
- baseUrl?: string | undefined;
7
- url?: string;
8
- method?: IMethod;
9
- formData?: {
10
- [key: string]: any;
11
- } | undefined;
12
- qs?: any;
13
- json?: boolean;
14
- body?: any;
15
- resolveWithFullResponse?: boolean;
16
- headers?: IHeaders;
17
- proxy?: any;
18
- timeout?: number;
19
- }
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 interface IHeaders {
3
+ [key: string]: any;
4
+ }
5
+ export interface IRequestPromiseOptions {
6
+ baseUrl?: string | undefined;
7
+ url?: string;
8
+ method?: IMethod;
9
+ formData?: {
10
+ [key: string]: any;
11
+ } | undefined;
12
+ qs?: any;
13
+ json?: boolean;
14
+ body?: any;
15
+ resolveWithFullResponse?: boolean;
16
+ headers?: IHeaders;
17
+ proxy?: any;
18
+ timeout?: number;
19
+ }
@@ -1,120 +1,118 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { IImgSize, IPathTransformedImgInfo, IPluginNameType, ILogger, IPicGo } from '../types';
4
- export declare const isUrl: (url: string) => boolean;
5
- export declare const isUrlEncode: (url: string) => boolean;
6
- /**
7
- * just encode the url with encodeURI
8
- */
9
- export declare const handleUrlEncode: (url: string) => string;
10
- /**
11
- * @param urlPath the url path need to be encoded safely
12
- * @returns the safely encoded url path
13
- *
14
- * for example:
15
- *
16
- * /a b/, /c d.jpg -> /a%20b/c%20d.jpg
17
- *
18
- * /a/b, /c#d.jpg -> /a/b/c%23d.jpg
19
- */
20
- export declare const handleUrlPathSafeEncode: (...urlPathList: string[]) => string;
21
- export declare const getImageSize: (file: Buffer) => IImgSize;
22
- export declare const getFSFile: (filePath: string) => Promise<IPathTransformedImgInfo>;
23
- export declare const getURLFile: (url: string, ctx: IPicGo) => Promise<IPathTransformedImgInfo>;
24
- /**
25
- * detect the input string's type
26
- * for example
27
- * 1. @xxx/picgo-plugin-xxx -> scope
28
- * 2. picgo-plugin-xxx -> normal
29
- * 3. xxx -> simple
30
- * 4. not exists or is a path -> unknown
31
- * @param name
32
- */
33
- export declare const getPluginNameType: (name: string) => IPluginNameType;
34
- /**
35
- * detect the input string is a simple plugin name or not
36
- * for example
37
- * 1. xxx -> true
38
- * 2. /Usr/xx/xxxx/picgo-plugin-xxx -> false
39
- * @param name pluginNameOrPath
40
- */
41
- export declare const isSimpleName: (nameOrPath: string) => boolean;
42
- /**
43
- * streamline the full plugin name to a simple one
44
- * for example:
45
- * 1. picgo-plugin-xxx -> xxx
46
- * 2. @xxx/picgo-plugin-yyy -> yyy
47
- * @param name pluginFullName
48
- */
49
- export declare const handleStreamlinePluginName: (name: string) => string;
50
- /**
51
- * complete plugin name to full name
52
- * for example:
53
- * 1. xxx -> picgo-plugin-xxx
54
- * 2. picgo-plugin-xxx -> picgo-plugin-xxx
55
- * @param name pluginSimpleName
56
- * @param scope pluginScope
57
- */
58
- export declare const handleCompletePluginName: (name: string, scope?: string) => string;
59
- /**
60
- * handle install/uninstall/update plugin name or path
61
- * for example
62
- * 1. picgo-plugin-xxx -> picgo-plugin-xxx
63
- * 2. @xxx/picgo-plugin-xxx -> @xxx/picgo-plugin-xxx
64
- * 3. xxx -> picgo-plugin-xxx
65
- * 4. ./xxxx/picgo-plugin-xxx -> /absolutePath/.../xxxx/picgo-plugin-xxx
66
- * 5. /absolutePath/.../picgo-plugin-xxx -> /absolutePath/.../picgo-plugin-xxx
67
- * @param nameOrPath pluginName or pluginPath
68
- */
69
- export declare const getProcessPluginName: (nameOrPath: string, logger?: ILogger | Console) => string;
70
- /**
71
- * get the normal plugin name
72
- * for example:
73
- * 1. picgo-plugin-xxx -> picgo-plugin-xxx
74
- * 2. @xxx/picgo-plugin-xxx -> @xxx/picgo-plugin-xxx
75
- * 3. ./xxxx/picgo-plugin-xxx -> picgo-plugin-xxx
76
- * 4. /absolutePath/.../picgo-plugin-xxx -> picgo-plugin-xxx
77
- * 5. an exception: [package.json's name] !== [folder name]
78
- * then use [package.json's name], usually match the scope package.
79
- * 6. if plugin name has version: picgo-plugin-xxx@x.x.x then remove the version
80
- * @param nameOrPath
81
- */
82
- export declare const getNormalPluginName: (nameOrPath: string, logger?: ILogger | Console) => string;
83
- /**
84
- * handle transform the path to unix style
85
- * for example
86
- * 1. C:\\xxx\\xxx -> C:/xxx/xxx
87
- * 2. /xxx/xxx -> /xxx/xxx
88
- * @param path
89
- */
90
- export declare const handleUnixStylePath: (pathStr: string) => string;
91
- /**
92
- * remove plugin version when register plugin name
93
- * 1. picgo-plugin-xxx@1.0.0 -> picgo-plugin-xxx
94
- * 2. @xxx/picgo-plugin-xxx@1.0.0 -> @xxx/picgo-plugin-xxx
95
- * @param nameOrPath
96
- * @param scope
97
- */
98
- export declare const removePluginVersion: (nameOrPath: string, scope?: boolean) => string;
99
- /**
100
- * the config black item list which won't be setted
101
- * only can be got
102
- */
103
- export declare const configBlackList: never[];
104
- /**
105
- * check some config key is in blackList
106
- * @param key
107
- */
108
- export declare const isConfigKeyInBlackList: (key: string) => boolean;
109
- /**
110
- * check the input config is valid
111
- * config must be object such as { xxx: 'xxx' }
112
- * && can't be array
113
- * @param config
114
- * @returns
115
- */
116
- export declare const isInputConfigValid: (config: any) => boolean;
117
- export declare function safeParse<T>(str: string): T | string;
118
- export declare const forceNumber: (num?: string | number) => number;
119
- export declare const isDev: () => boolean;
120
- export declare const isProd: () => boolean;
1
+ import { IImgSize, IPathTransformedImgInfo, IPluginNameType, ILogger, IPicGo } from '../types';
2
+ export declare const isUrl: (url: string) => boolean;
3
+ export declare const isUrlEncode: (url: string) => boolean;
4
+ /**
5
+ * just encode the url with encodeURI
6
+ */
7
+ export declare const handleUrlEncode: (url: string) => string;
8
+ /**
9
+ * @param urlPath the url path need to be encoded safely
10
+ * @returns the safely encoded url path
11
+ *
12
+ * for example:
13
+ *
14
+ * /a b/, /c d.jpg -> /a%20b/c%20d.jpg
15
+ *
16
+ * /a/b, /c#d.jpg -> /a/b/c%23d.jpg
17
+ */
18
+ export declare const handleUrlPathSafeEncode: (...urlPathList: string[]) => string;
19
+ export declare const getImageSize: (file: Buffer) => IImgSize;
20
+ export declare const getFSFile: (filePath: string) => Promise<IPathTransformedImgInfo>;
21
+ export declare const getURLFile: (url: string, ctx: IPicGo) => Promise<IPathTransformedImgInfo>;
22
+ /**
23
+ * detect the input string's type
24
+ * for example
25
+ * 1. @xxx/picgo-plugin-xxx -> scope
26
+ * 2. picgo-plugin-xxx -> normal
27
+ * 3. xxx -> simple
28
+ * 4. not exists or is a path -> unknown
29
+ * @param name
30
+ */
31
+ export declare const getPluginNameType: (name: string) => IPluginNameType;
32
+ /**
33
+ * detect the input string is a simple plugin name or not
34
+ * for example
35
+ * 1. xxx -> true
36
+ * 2. /Usr/xx/xxxx/picgo-plugin-xxx -> false
37
+ * @param name pluginNameOrPath
38
+ */
39
+ export declare const isSimpleName: (nameOrPath: string) => boolean;
40
+ /**
41
+ * streamline the full plugin name to a simple one
42
+ * for example:
43
+ * 1. picgo-plugin-xxx -> xxx
44
+ * 2. @xxx/picgo-plugin-yyy -> yyy
45
+ * @param name pluginFullName
46
+ */
47
+ export declare const handleStreamlinePluginName: (name: string) => string;
48
+ /**
49
+ * complete plugin name to full name
50
+ * for example:
51
+ * 1. xxx -> picgo-plugin-xxx
52
+ * 2. picgo-plugin-xxx -> picgo-plugin-xxx
53
+ * @param name pluginSimpleName
54
+ * @param scope pluginScope
55
+ */
56
+ export declare const handleCompletePluginName: (name: string, scope?: string) => string;
57
+ /**
58
+ * handle install/uninstall/update plugin name or path
59
+ * for example
60
+ * 1. picgo-plugin-xxx -> picgo-plugin-xxx
61
+ * 2. @xxx/picgo-plugin-xxx -> @xxx/picgo-plugin-xxx
62
+ * 3. xxx -> picgo-plugin-xxx
63
+ * 4. ./xxxx/picgo-plugin-xxx -> /absolutePath/.../xxxx/picgo-plugin-xxx
64
+ * 5. /absolutePath/.../picgo-plugin-xxx -> /absolutePath/.../picgo-plugin-xxx
65
+ * @param nameOrPath pluginName or pluginPath
66
+ */
67
+ export declare const getProcessPluginName: (nameOrPath: string, logger?: ILogger | Console) => string;
68
+ /**
69
+ * get the normal plugin name
70
+ * for example:
71
+ * 1. picgo-plugin-xxx -> picgo-plugin-xxx
72
+ * 2. @xxx/picgo-plugin-xxx -> @xxx/picgo-plugin-xxx
73
+ * 3. ./xxxx/picgo-plugin-xxx -> picgo-plugin-xxx
74
+ * 4. /absolutePath/.../picgo-plugin-xxx -> picgo-plugin-xxx
75
+ * 5. an exception: [package.json's name] !== [folder name]
76
+ * then use [package.json's name], usually match the scope package.
77
+ * 6. if plugin name has version: picgo-plugin-xxx@x.x.x then remove the version
78
+ * @param nameOrPath
79
+ */
80
+ export declare const getNormalPluginName: (nameOrPath: string, logger?: ILogger | Console) => string;
81
+ /**
82
+ * handle transform the path to unix style
83
+ * for example
84
+ * 1. C:\\xxx\\xxx -> C:/xxx/xxx
85
+ * 2. /xxx/xxx -> /xxx/xxx
86
+ * @param path
87
+ */
88
+ export declare const handleUnixStylePath: (pathStr: string) => string;
89
+ /**
90
+ * remove plugin version when register plugin name
91
+ * 1. picgo-plugin-xxx@1.0.0 -> picgo-plugin-xxx
92
+ * 2. @xxx/picgo-plugin-xxx@1.0.0 -> @xxx/picgo-plugin-xxx
93
+ * @param nameOrPath
94
+ * @param scope
95
+ */
96
+ export declare const removePluginVersion: (nameOrPath: string, scope?: boolean) => string;
97
+ /**
98
+ * the config black item list which won't be setted
99
+ * only can be got
100
+ */
101
+ export declare const configBlackList: never[];
102
+ /**
103
+ * check some config key is in blackList
104
+ * @param key
105
+ */
106
+ export declare const isConfigKeyInBlackList: (key: string) => boolean;
107
+ /**
108
+ * check the input config is valid
109
+ * config must be object such as { xxx: 'xxx' }
110
+ * && can't be array
111
+ * @param config
112
+ * @returns
113
+ */
114
+ export declare const isInputConfigValid: (config: any) => boolean;
115
+ export declare function safeParse<T>(str: string): T | string;
116
+ export declare const forceNumber: (num?: string | number) => number;
117
+ export declare const isDev: () => boolean;
118
+ export declare const isProd: () => boolean;
@@ -1,6 +1,6 @@
1
- import { IPicGo } from '../types';
2
- /**
3
- * create an unique context for each upload process
4
- * @param ctx
5
- */
6
- export declare const createContext: (ctx: IPicGo) => IPicGo;
1
+ import { IPicGo } from '../types';
2
+ /**
3
+ * create an unique context for each upload process
4
+ * @param ctx
5
+ */
6
+ export declare const createContext: (ctx: IPicGo) => IPicGo;
@@ -1,15 +1,15 @@
1
- import { IConfig, IPicGo } from '../types';
2
- import { IJSON } from '@picgo/store/dist/types';
3
- declare class DB {
4
- private readonly ctx;
5
- private readonly db;
6
- constructor(ctx: IPicGo);
7
- read(flush?: boolean): IJSON;
8
- get(key?: string): any;
9
- set(key: string, value: any): void;
10
- has(key: string): boolean;
11
- unset(key: string, value: any): boolean;
12
- saveConfig(config: Partial<IConfig>): void;
13
- removeConfig(config: IConfig): void;
14
- }
15
- export default DB;
1
+ import { IConfig, IPicGo } from '../types';
2
+ import { IJSON } from '@picgo/store/dist/types';
3
+ declare class DB {
4
+ private readonly ctx;
5
+ private readonly db;
6
+ constructor(ctx: IPicGo);
7
+ read(flush?: boolean): IJSON;
8
+ get(key?: string): any;
9
+ set(key: string, value: any): void;
10
+ has(key: string): boolean;
11
+ unset(key: string, value: any): boolean;
12
+ saveConfig(config: Partial<IConfig>): void;
13
+ removeConfig(config: IConfig): void;
14
+ }
15
+ export default DB;
@@ -1,27 +1,27 @@
1
- export declare enum ILogType {
2
- success = "success",
3
- info = "info",
4
- warn = "warn",
5
- error = "error"
6
- }
7
- /**
8
- * these events will be catched by users
9
- */
10
- export declare enum IBuildInEvent {
11
- UPLOAD_PROGRESS = "uploadProgress",
12
- FAILED = "failed",
13
- BEFORE_TRANSFORM = "beforeTransform",
14
- BEFORE_UPLOAD = "beforeUpload",
15
- AFTER_UPLOAD = "afterUpload",
16
- FINISHED = "finished",
17
- INSTALL = "install",
18
- UNINSTALL = "uninstall",
19
- UPDATE = "update",
20
- NOTIFICATION = "notification"
21
- }
22
- /**
23
- * these events will be catched only by picgo
24
- */
25
- export declare enum IBusEvent {
26
- CONFIG_CHANGE = "CONFIG_CHANGE"
27
- }
1
+ export declare enum ILogType {
2
+ success = "success",
3
+ info = "info",
4
+ warn = "warn",
5
+ error = "error"
6
+ }
7
+ /**
8
+ * these events will be caught by users
9
+ */
10
+ export declare enum IBuildInEvent {
11
+ UPLOAD_PROGRESS = "uploadProgress",
12
+ FAILED = "failed",
13
+ BEFORE_TRANSFORM = "beforeTransform",
14
+ BEFORE_UPLOAD = "beforeUpload",
15
+ AFTER_UPLOAD = "afterUpload",
16
+ FINISHED = "finished",
17
+ INSTALL = "install",
18
+ UNINSTALL = "uninstall",
19
+ UPDATE = "update",
20
+ NOTIFICATION = "notification"
21
+ }
22
+ /**
23
+ * these events will be caught only by picgo
24
+ */
25
+ export declare enum IBusEvent {
26
+ CONFIG_CHANGE = "CONFIG_CHANGE"
27
+ }
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- declare const eventBus: EventEmitter;
4
- export { eventBus };
1
+ import { EventEmitter } from 'events';
2
+ declare const eventBus: EventEmitter<[never]>;
3
+ export { eventBus };
@@ -1,4 +1,4 @@
1
- import { IPicGo, IClipboardImage } from '../types';
2
- export declare type Platform = 'darwin' | 'win32' | 'win10' | 'linux' | 'wsl';
3
- declare const getClipboardImage: (ctx: IPicGo) => Promise<IClipboardImage>;
4
- export default getClipboardImage;
1
+ import { IPicGo, IClipboardImage } from '../types';
2
+ export type Platform = 'darwin' | 'win32' | 'win10' | 'linux' | 'wsl';
3
+ declare const getClipboardImage: (ctx: IPicGo) => Promise<IClipboardImage>;
4
+ export default getClipboardImage;
@@ -1,26 +1,26 @@
1
- import { IPicGo, IOptions } from '../types';
2
- /**
3
- * Generate template files to destination files.
4
- * @param {PicGo} ctx
5
- * @param {IOptions} options
6
- */
7
- declare const generate: (ctx: IPicGo, options: IOptions) => Promise<any>;
8
- /**
9
- * Return the filters' result
10
- * @param ctx PicGo
11
- * @param exp condition expression
12
- * @param data options data
13
- */
14
- declare const filters: (ctx: IPicGo, exp: any, data: any) => boolean;
15
- /**
16
- * Render files to a virtual tree object
17
- * @param {array} files
18
- */
19
- declare const render: (files: string[], source: string, options: any) => any;
20
- /**
21
- * Write rendered files' content to real file
22
- * @param {string} dir
23
- * @param {object} files
24
- */
25
- declare const writeFileTree: (dir: string, files: any) => void;
26
- export { filters, generate, render, writeFileTree };
1
+ import { IPicGo, IOptions } from '../types';
2
+ /**
3
+ * Generate template files to destination files.
4
+ * @param {PicGo} ctx
5
+ * @param {IOptions} options
6
+ */
7
+ declare const generate: (ctx: IPicGo, options: IOptions) => Promise<any>;
8
+ /**
9
+ * Return the filters' result
10
+ * @param ctx PicGo
11
+ * @param exp condition expression
12
+ * @param data options data
13
+ */
14
+ declare const filters: (ctx: IPicGo, exp: any, data: any) => boolean;
15
+ /**
16
+ * Render files to a virtual tree object
17
+ * @param {array} files
18
+ */
19
+ declare const render: (files: string[], source: string, options: any) => any;
20
+ /**
21
+ * Write rendered files' content to real file
22
+ * @param {string} dir
23
+ * @param {object} files
24
+ */
25
+ declare const writeFileTree: (dir: string, files: any) => void;
26
+ export { filters, generate, render, writeFileTree };