picgo 1.4.26 → 1.5.0-alpha.2

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 (101) hide show
  1. package/.eslintignore +2 -0
  2. package/.github/workflows/alpha.yml +22 -0
  3. package/CHANGELOG.md +43 -0
  4. package/README.md +14 -1
  5. package/bin/picgo +1 -1
  6. package/dist/{src/core → core}/Lifecycle.d.ts +15 -15
  7. package/dist/{src/core → core}/PicGo.d.ts +44 -44
  8. package/dist/i18n/en.d.ts +2 -0
  9. package/dist/i18n/index.d.ts +16 -0
  10. package/dist/i18n/zh-CN.d.ts +65 -0
  11. package/dist/index.cjs.js +2 -0
  12. package/dist/index.d.ts +9 -0
  13. package/dist/index.esm.js +2 -0
  14. package/dist/{src/lib → lib}/Commander.d.ts +16 -16
  15. package/dist/{src/lib → lib}/LifecyclePlugins.d.ts +16 -16
  16. package/dist/{src/lib → lib}/Logger.d.ts +16 -16
  17. package/dist/{src/lib → lib}/PluginHandler.d.ts +10 -10
  18. package/dist/{src/lib → lib}/PluginLoader.d.ts +27 -27
  19. package/dist/{src/lib → lib}/Request.d.ts +11 -11
  20. package/dist/{src/plugins → plugins}/commander/config.d.ts +3 -3
  21. package/dist/plugins/commander/i18n.d.ts +3 -0
  22. package/dist/{src/plugins → plugins}/commander/index.d.ts +3 -3
  23. package/dist/{src/plugins → plugins}/commander/init.d.ts +3 -3
  24. package/dist/{src/plugins → plugins}/commander/pluginHandler.d.ts +3 -3
  25. package/dist/{src/plugins → plugins}/commander/proxy.d.ts +3 -3
  26. package/dist/{src/plugins → plugins}/commander/setting.d.ts +5 -5
  27. package/dist/{src/plugins → plugins}/commander/upload.d.ts +3 -3
  28. package/dist/{src/plugins → plugins}/commander/use.d.ts +3 -3
  29. package/dist/{src/plugins → plugins}/transformer/base64.d.ts +5 -5
  30. package/dist/{src/plugins → plugins}/transformer/index.d.ts +3 -3
  31. package/dist/{src/plugins → plugins}/transformer/path.d.ts +5 -5
  32. package/dist/plugins/uploader/aliyun.d.ts +2 -0
  33. package/dist/plugins/uploader/github.d.ts +2 -0
  34. package/dist/plugins/uploader/imgur.d.ts +2 -0
  35. package/dist/{src/plugins → plugins}/uploader/index.d.ts +3 -3
  36. package/dist/plugins/uploader/qiniu.d.ts +2 -0
  37. package/dist/plugins/uploader/smms.d.ts +2 -0
  38. package/dist/plugins/uploader/tcyun.d.ts +8 -0
  39. package/dist/plugins/uploader/upyun.d.ts +2 -0
  40. package/dist/types/index.d.ts +468 -0
  41. package/dist/{src/utils → utils}/common.d.ts +102 -101
  42. package/dist/{src/utils → utils}/createContext.d.ts +6 -6
  43. package/dist/{src/utils → utils}/db.d.ts +15 -15
  44. package/dist/{src/utils → utils}/enum.d.ts +27 -27
  45. package/dist/{src/utils → utils}/eventBus.d.ts +4 -4
  46. package/dist/{src/utils → utils}/getClipboardImage.d.ts +4 -3
  47. package/dist/{src/utils → utils}/initUtils.d.ts +26 -26
  48. package/dist/{src/utils → utils}/interfaces.d.ts +203 -203
  49. package/package.json +27 -22
  50. package/rollup.config.js +82 -0
  51. package/dist/package.json +0 -127
  52. package/dist/src/core/Lifecycle.js +0 -123
  53. package/dist/src/core/PicGo.js +0 -210
  54. package/dist/src/index.d.ts +0 -2
  55. package/dist/src/index.js +0 -6
  56. package/dist/src/lib/Commander.js +0 -56
  57. package/dist/src/lib/LifecyclePlugins.js +0 -52
  58. package/dist/src/lib/Logger.js +0 -82
  59. package/dist/src/lib/PluginHandler.js +0 -260
  60. package/dist/src/lib/PluginLoader.js +0 -145
  61. package/dist/src/lib/Request.js +0 -42
  62. package/dist/src/plugins/commander/config.js +0 -11
  63. package/dist/src/plugins/commander/index.js +0 -21
  64. package/dist/src/plugins/commander/init.js +0 -122
  65. package/dist/src/plugins/commander/pluginHandler.js +0 -43
  66. package/dist/src/plugins/commander/proxy.js +0 -14
  67. package/dist/src/plugins/commander/setting.js +0 -102
  68. package/dist/src/plugins/commander/upload.js +0 -35
  69. package/dist/src/plugins/commander/use.js +0 -87
  70. package/dist/src/plugins/transformer/base64.js +0 -9
  71. package/dist/src/plugins/transformer/index.js +0 -16
  72. package/dist/src/plugins/transformer/path.js +0 -42
  73. package/dist/src/plugins/uploader/aliyun.d.ts +0 -7
  74. package/dist/src/plugins/uploader/aliyun.js +0 -129
  75. package/dist/src/plugins/uploader/github.d.ts +0 -7
  76. package/dist/src/plugins/uploader/github.js +0 -101
  77. package/dist/src/plugins/uploader/imgur.d.ts +0 -7
  78. package/dist/src/plugins/uploader/imgur.js +0 -81
  79. package/dist/src/plugins/uploader/index.js +0 -26
  80. package/dist/src/plugins/uploader/qiniu.d.ts +0 -7
  81. package/dist/src/plugins/uploader/qiniu.js +0 -132
  82. package/dist/src/plugins/uploader/smms.d.ts +0 -7
  83. package/dist/src/plugins/uploader/smms.js +0 -74
  84. package/dist/src/plugins/uploader/tcyun.d.ts +0 -13
  85. package/dist/src/plugins/uploader/tcyun.js +0 -218
  86. package/dist/src/plugins/uploader/upyun.d.ts +0 -7
  87. package/dist/src/plugins/uploader/upyun.js +0 -128
  88. package/dist/src/types/index.d.ts +0 -471
  89. package/dist/src/utils/clipboard/linux.sh +0 -18
  90. package/dist/src/utils/clipboard/mac.applescript +0 -0
  91. package/dist/src/utils/clipboard/windows.ps1 +0 -26
  92. package/dist/src/utils/clipboard/windows10.ps1 +0 -47
  93. package/dist/src/utils/clipboard/wsl.sh +0 -18
  94. package/dist/src/utils/common.js +0 -353
  95. package/dist/src/utils/createContext.js +0 -45
  96. package/dist/src/utils/db.js +0 -85
  97. package/dist/src/utils/enum.js +0 -33
  98. package/dist/src/utils/eventBus.js +0 -6
  99. package/dist/src/utils/getClipboardImage.js +0 -101
  100. package/dist/src/utils/initUtils.js +0 -120
  101. package/dist/src/utils/interfaces.js +0 -3
package/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ dist
@@ -0,0 +1,22 @@
1
+ name: publish
2
+ on:
3
+ push:
4
+ branches:
5
+ - alpha
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Clone repo
11
+ uses: actions/checkout@v1
12
+ - name: Setup node
13
+ uses: actions/setup-node@v1
14
+ with:
15
+ node-version: '12.x'
16
+ registry-url: 'https://registry.npmjs.org'
17
+ - name: Install modules
18
+ run: yarn
19
+ - run: npm run build
20
+ - run: npm publish --tag alpha --access public
21
+ env:
22
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/CHANGELOG.md CHANGED
@@ -1,3 +1,46 @@
1
+ # :tada: 1.5.0-alpha.2 (2022-04-03)
2
+
3
+
4
+ ### :sparkles: Features
5
+
6
+ * add wayland support for linux ([#119](https://github.com/PicGo/PicGo-Core/issues/119)) ([28905f2](https://github.com/PicGo/PicGo-Core/commit/28905f2))
7
+
8
+
9
+ ### :bug: Bug Fixes
10
+
11
+ * qiniu && upyun errors ([587dd3f](https://github.com/PicGo/PicGo-Core/commit/587dd3f))
12
+
13
+
14
+
15
+ # :tada: 1.5.0-alpha.1 (2022-03-08)
16
+
17
+
18
+ ### :sparkles: Features
19
+
20
+ * add options for tencent cos ([1fccdcc](https://github.com/PicGo/PicGo-Core/commit/1fccdcc)), closes [#117](https://github.com/PicGo/PicGo-Core/issues/117)
21
+ * **i18n:** add i18n for picgo ([4b93a76](https://github.com/PicGo/PicGo-Core/commit/4b93a76))
22
+
23
+
24
+ ### :bug: Bug Fixes
25
+
26
+ * build error in windows ([5616fb9](https://github.com/PicGo/PicGo-Core/commit/5616fb9))
27
+
28
+
29
+ ### :package: Chore
30
+
31
+ * add alpha branch for alpha version ([6882022](https://github.com/PicGo/PicGo-Core/commit/6882022)), closes [#106](https://github.com/PicGo/PicGo-Core/issues/106)
32
+
33
+
34
+
35
+ # :tada: 1.5.0-alpha.0 (2021-10-26)
36
+
37
+
38
+ ### :package: Chore
39
+
40
+ * **build:** migrate to esbuild and change export assignment to esm export ([#102](https://github.com/PicGo/PicGo-Core/issues/102)) ([2a6cd18](https://github.com/PicGo/PicGo-Core/commit/2a6cd18))
41
+
42
+
43
+
1
44
  ## :tada: 1.4.26 (2021-08-23)
2
45
 
3
46
 
package/README.md CHANGED
@@ -87,8 +87,21 @@ Thanks to [vs-picgo](https://github.com/Spades-S/vs-picgo) && [Spades-S](https:/
87
87
 
88
88
  ### Use in node project
89
89
 
90
+ #### Common JS
91
+
92
+ ```js
93
+ const { PicGo } = require('picgo')
94
+ ```
95
+
96
+ #### ES Module
97
+
98
+ ```js
99
+ import { PicGo } from 'picgo'
100
+ ```
101
+
102
+ #### API usage example
103
+
90
104
  ```js
91
- const PicGo = require('picgo')
92
105
  const picgo = new PicGo()
93
106
 
94
107
  // upload a picture from path
package/bin/picgo CHANGED
@@ -8,7 +8,7 @@ if (configPath !== true && configPath !== '') {
8
8
  } else {
9
9
  configPath = ''
10
10
  }
11
- const PicGo = require('../dist/src/index')
11
+ const { PicGo } = require('..')
12
12
  const picgo = new PicGo(configPath)
13
13
  picgo.registerCommands()
14
14
 
@@ -1,15 +1,15 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- import { IPicGo } from '../types';
4
- declare class Lifecycle extends EventEmitter {
5
- private readonly ctx;
6
- constructor(ctx: IPicGo);
7
- start(input: any[]): Promise<IPicGo>;
8
- private beforeTransform;
9
- private doTransform;
10
- private beforeUpload;
11
- private doUpload;
12
- private afterUpload;
13
- private handlePlugins;
14
- }
15
- export default Lifecycle;
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
3
+ import { IPicGo } from '../types';
4
+ export declare class Lifecycle extends EventEmitter {
5
+ private readonly ctx;
6
+ constructor(ctx: IPicGo);
7
+ start(input: any[]): Promise<IPicGo>;
8
+ private beforeTransform;
9
+ private doTransform;
10
+ private beforeUpload;
11
+ private doUpload;
12
+ private afterUpload;
13
+ private handlePlugins;
14
+ }
15
+ export default Lifecycle;
@@ -1,44 +1,44 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- import Commander from '../lib/Commander';
4
- import Logger from '../lib/Logger';
5
- import { IHelper, IImgInfo, IPicGo, IStringKeyMap, IPluginLoader } from '../types';
6
- import Request from '../lib/Request';
7
- import PluginHandler from '../lib/PluginHandler';
8
- import { RequestPromiseAPI } from 'request-promise-native';
9
- declare class PicGo extends EventEmitter implements IPicGo {
10
- private _config;
11
- private lifecycle;
12
- private db;
13
- private _pluginLoader;
14
- configPath: string;
15
- baseDir: string;
16
- helper: IHelper;
17
- log: Logger;
18
- cmd: Commander;
19
- output: IImgInfo[];
20
- input: any[];
21
- pluginHandler: PluginHandler;
22
- /**
23
- * @deprecated will be removed in v1.5.0+
24
- *
25
- * use request instead
26
- */
27
- Request: Request;
28
- VERSION: string;
29
- GUI_VERSION?: string;
30
- get pluginLoader(): IPluginLoader;
31
- constructor(configPath?: string);
32
- private initConfigPath;
33
- private initConfig;
34
- private init;
35
- registerCommands(): void;
36
- getConfig<T>(name?: string): T;
37
- saveConfig(config: IStringKeyMap<any>): void;
38
- removeConfig(key: string, propName: string): void;
39
- setConfig(config: IStringKeyMap<any>): void;
40
- unsetConfig(key: string, propName: string): void;
41
- get request(): RequestPromiseAPI;
42
- upload(input?: any[]): Promise<IImgInfo[] | Error>;
43
- }
44
- export default PicGo;
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
3
+ import Commander from '../lib/Commander';
4
+ import { Logger } from '../lib/Logger';
5
+ import { IHelper, IImgInfo, IPicGo, IStringKeyMap, IPluginLoader, II18nManager } from '../types';
6
+ import Request from '../lib/Request';
7
+ import PluginHandler from '../lib/PluginHandler';
8
+ import { RequestPromiseAPI } from 'request-promise-native';
9
+ export declare class PicGo extends EventEmitter implements IPicGo {
10
+ private _config;
11
+ private lifecycle;
12
+ private db;
13
+ private _pluginLoader;
14
+ configPath: string;
15
+ baseDir: string;
16
+ helper: IHelper;
17
+ log: Logger;
18
+ cmd: Commander;
19
+ output: IImgInfo[];
20
+ input: any[];
21
+ pluginHandler: PluginHandler;
22
+ /**
23
+ * @deprecated will be removed in v1.5.0+
24
+ *
25
+ * use request instead
26
+ */
27
+ Request: Request;
28
+ i18n: II18nManager;
29
+ VERSION: string;
30
+ GUI_VERSION?: string;
31
+ get pluginLoader(): IPluginLoader;
32
+ constructor(configPath?: string);
33
+ private initConfigPath;
34
+ private initConfig;
35
+ private init;
36
+ registerCommands(): void;
37
+ getConfig<T>(name?: string): T;
38
+ saveConfig(config: IStringKeyMap<any>): void;
39
+ removeConfig(key: string, propName: string): void;
40
+ setConfig(config: IStringKeyMap<any>): void;
41
+ unsetConfig(key: string, propName: string): void;
42
+ get request(): RequestPromiseAPI;
43
+ upload(input?: any[]): Promise<IImgInfo[] | Error>;
44
+ }
@@ -0,0 +1,2 @@
1
+ import { ILocales } from './zh-CN';
2
+ export declare const EN: ILocales;
@@ -0,0 +1,16 @@
1
+ import { ILocalesKey } from './zh-CN';
2
+ import { IPicGo } from '../types';
3
+ import { IStringKeyMap, II18nManager } from '../types/index';
4
+ import { ILocale } from '@picgo/i18n/dist/types';
5
+ declare class I18nManager implements II18nManager {
6
+ private readonly i18n;
7
+ private readonly objectAdapter;
8
+ private readonly ctx;
9
+ constructor(ctx: IPicGo);
10
+ translate<T extends string>(key: ILocalesKey | T, args?: IStringKeyMap<string>): string;
11
+ setLanguage(language: string): void;
12
+ addLocale(language: string, locales: ILocale): boolean;
13
+ addLanguage(language: string, locales: ILocale): boolean;
14
+ getLanguageList(): string[];
15
+ }
16
+ export { I18nManager };
@@ -0,0 +1,65 @@
1
+ export declare const ZH_CN: {
2
+ UPLOAD_FAILED: string;
3
+ CHECK_SETTINGS: string;
4
+ CHECK_SETTINGS_AND_NETWORK: string;
5
+ UPLOAD_FAILED_REASON: string;
6
+ SERVER_ERROR: string;
7
+ AUTH_FAILED: string;
8
+ PICBED_SMMS: string;
9
+ PICBED_SMMS_TOKEN: string;
10
+ PICBED_ALICLOUD: string;
11
+ PICBED_ALICLOUD_ACCESSKEYID: string;
12
+ PICBED_ALICLOUD_ACCESSKEYSECRET: string;
13
+ PICBED_ALICLOUD_BUCKET: string;
14
+ PICBED_ALICLOUD_AREA: string;
15
+ PICBED_ALICLOUD_PATH: string;
16
+ PICBED_ALICLOUD_CUSTOMURL: string;
17
+ PICBED_ALICLOUD_OPTIONS: string;
18
+ PICBED_TENCENTCLOUD: string;
19
+ PICBED_TENCENTCLOUD_VERSION: string;
20
+ PICBED_TENCENTCLOUD_SECRETID: string;
21
+ PICBED_TENCENTCLOUD_SECRETKEY: string;
22
+ PICBED_TENCENTCLOUD_APPID: string;
23
+ PICBED_TENCENTCLOUD_BUCKET: string;
24
+ PICBED_TENCENTCLOUD_AREA: string;
25
+ PICBED_TENCENTCLOUD_PATH: string;
26
+ PICBED_TENCENTCLOUD_CUSTOMURL: string;
27
+ PICBED_GITHUB: string;
28
+ PICBED_GITHUB_TOKEN: string;
29
+ PICBED_GITHUB_REPO: string;
30
+ PICBED_GITHUB_PATH: string;
31
+ PICBED_GITHUB_BRANCH: string;
32
+ PICBED_GITHUB_CUSTOMURL: string;
33
+ PICBED_QINIU: string;
34
+ PICBED_QINIU_ACCESSKEY: string;
35
+ PICBED_QINIU_SECRETKEY: string;
36
+ PICBED_QINIU_BUCKET: string;
37
+ PICBED_QINIU_PATH: string;
38
+ PICBED_QINIU_URL: string;
39
+ PICBED_QINIU_OPTIONS: string;
40
+ PICBED_QINIU_AREA: string;
41
+ PICBED_IMGUR: string;
42
+ PICBED_IMGUR_CLIENTID: string;
43
+ PICBED_IMGUR_PROXY: string;
44
+ PICBED_UPYUN: string;
45
+ PICBED_UPYUN_BUCKET: string;
46
+ PICBED_UPYUN_OPERATOR: string;
47
+ PICBED_UPYUN_PASSWORD: string;
48
+ PICBED_UPYUN_PATH: string;
49
+ PICBED_UPYUN_URL: string;
50
+ PICBED_UPYUN_OPTIONS: string;
51
+ PLUGIN_HANDLER_PLUGIN_INSTALL_SUCCESS: string;
52
+ PLUGIN_HANDLER_PLUGIN_INSTALL_FAILED: string;
53
+ PLUGIN_HANDLER_PLUGIN_INSTALL_FAILED_REASON: string;
54
+ PLUGIN_HANDLER_PLUGIN_INSTALL_FAILED_PATH: string;
55
+ PLUGIN_HANDLER_PLUGIN_UNINSTALL_SUCCESS: string;
56
+ PLUGIN_HANDLER_PLUGIN_UNINSTALL_FAILED: string;
57
+ PLUGIN_HANDLER_PLUGIN_UNINSTALL_FAILED_REASON: string;
58
+ PLUGIN_HANDLER_PLUGIN_UNINSTALL_FAILED_VALID: string;
59
+ PLUGIN_HANDLER_PLUGIN_UPDATE_SUCCESS: string;
60
+ PLUGIN_HANDLER_PLUGIN_UPDATE_FAILED: string;
61
+ PLUGIN_HANDLER_PLUGIN_UPDATE_FAILED_REASON: string;
62
+ PLUGIN_HANDLER_PLUGIN_UPDATE_FAILED_VALID: string;
63
+ };
64
+ export declare type ILocalesKey = keyof typeof ZH_CN;
65
+ export declare type ILocales = typeof ZH_CN;