universal-picgo 1.8.0 → 1.10.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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "universal-picgo",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "type": "module",
5
5
  "description": "picgo lib for node, browser and electron",
6
6
  "main": "./dist/index.js",
@@ -27,19 +27,28 @@
27
27
  "devDependencies": {
28
28
  "@terwer/eslint-config-custom": "^1.3.6",
29
29
  "@terwer/vite-config-custom": "^0.7.6",
30
+ "@types/mime": "^3.0.4",
30
31
  "@types/mime-types": "^2.1.4",
31
32
  "vite-plugin-node-polyfills": "^0.21.0"
32
33
  },
33
34
  "dependencies": {
35
+ "@aws-sdk/client-s3": "^3.421.0",
36
+ "@aws-sdk/s3-request-presigner": "^3.421.0",
37
+ "@smithy/types": "^2.12.0",
38
+ "@smithy/protocol-http": "^3.3.0",
39
+ "@smithy/querystring-builder": "^2.2.0",
40
+ "@smithy/fetch-http-handler": "^2.5.0",
34
41
  "@picgo/i18n": "^1.0.0",
35
42
  "ali-oss": "^6.20.0",
36
43
  "axios": "^1.6.8",
37
44
  "dayjs": "^1.11.10",
38
45
  "js-yaml": "^4.1.0",
46
+ "mime": "^2.5.2",
39
47
  "mime-types": "^2.1.35",
40
48
  "queue": "^7.0.0",
41
49
  "universal-picgo-store": "workspace:*",
42
- "zhi-lib-base": "^0.8.0"
50
+ "zhi-lib-base": "^0.8.0",
51
+ "file-type": "^16.2.0"
43
52
  },
44
53
  "publishConfig": {
45
54
  "access": "public"
@@ -92,6 +92,29 @@ export declare const ZH_CN: {
92
92
  PICBED_UPYUN_MESSAGE_URL: string;
93
93
  PICBED_UPYUN_MESSAGE_OPTIONS: string;
94
94
  PICBED_UPYUN_MESSAGE_PATH: string;
95
+ PICBED_AWSS3PLIST: string;
96
+ PICBED_AWSS3PLIST_ACCESSKEYID: string;
97
+ PICBED_AWSS3PLIST_SECRET_ACCESSKEY: string;
98
+ PICBED_AWSS3PLIST_BUCKET: string;
99
+ PICBED_AWSS3PLIST_REGION: string;
100
+ PICBED_AWSS3PLIST_UPLOADPATH: string;
101
+ PICBED_AWSS3PLIST_ENDPOINT: string;
102
+ PICBED_AWSS3PLIST_CUSTOM_URL: string;
103
+ PICBED_AWSS3PLIST_PATHSTYLEACCESS: string;
104
+ PICBED_AWSS3PLIST_REJECTUNAUTHORIZED: string;
105
+ PICBED_AWSS3PLIST_ACL: string;
106
+ PICBED_AWSS3PLIST_CORS_PROXY: string;
107
+ PICBED_AWSS3PLIST_MESSAGE_ACCESSKEYID: string;
108
+ PICBED_AWSS3PLIST_MESSAGE_SECRET_ACCESSKEY: string;
109
+ PICBED_AWSS3PLIST_MESSAGE_BUCKET: string;
110
+ PICBED_AWSS3PLIST_MESSAGE_REGION: string;
111
+ PICBED_AWSS3PLIST_MESSAGE_UPLOADPATH: string;
112
+ PICBED_AWSS3PLIST_MESSAGE_ENDPOINT: string;
113
+ PICBED_AWSS3PLIST_MESSAGE_CUSTOM_URL: string;
114
+ PICBED_AWSS3PLIST_MESSAGE_PATHSTYLEACCESS: string;
115
+ PICBED_AWSS3PLIST_MESSAGE_REJECTUNAUTHORIZED: string;
116
+ PICBED_AWSS3PLIST_MESSAGE_ACL: string;
117
+ PICBED_AWSS3PLIST_MESSAGE_CORS_PROXY: string;
95
118
  PLUGIN_HANDLER_PLUGIN_INSTALL_SUCCESS: string;
96
119
  PLUGIN_HANDLER_PLUGIN_INSTALL_FAILED: string;
97
120
  PLUGIN_HANDLER_PLUGIN_INSTALL_FAILED_REASON: string;
@@ -0,0 +1,3 @@
1
+ import { IPicGo } from '../../types';
2
+
3
+ export default function register(ctx: IPicGo): void;
@@ -0,0 +1,30 @@
1
+ import { IAwsS3Config, IImgInfo, IPicGo } from '../../../types';
2
+ import { S3Client } from '@aws-sdk/client-s3';
3
+
4
+ export interface IUploadResult {
5
+ index: number;
6
+ key: string;
7
+ url: string;
8
+ imgURL: string;
9
+ versionId?: string;
10
+ eTag?: string;
11
+ }
12
+ declare function createS3Client(ctx: IPicGo, opts: IAwsS3Config): S3Client;
13
+ interface createUploadTaskOpts {
14
+ client: S3Client;
15
+ bucketName: string;
16
+ path: string;
17
+ item: IImgInfo;
18
+ index: number;
19
+ acl: string;
20
+ customUrl?: string;
21
+ corsProxy?: boolean;
22
+ }
23
+ declare function createUploadTask(opts: createUploadTaskOpts): Promise<IUploadResult>;
24
+ declare function getFileURL(opts: createUploadTaskOpts, eTag: string, versionId: string): Promise<string>;
25
+ declare const _default: {
26
+ createS3Client: typeof createS3Client;
27
+ createUploadTask: typeof createUploadTask;
28
+ getFileURL: typeof getFileURL;
29
+ };
30
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { IImgInfo } from '../../../types';
2
+
3
+ export declare function formatPath(info: IImgInfo, format?: string): string;
4
+ export declare function extractInfo(info: IImgInfo): Promise<{
5
+ body?: Buffer;
6
+ contentType?: string;
7
+ contentEncoding?: string;
8
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "universal-picgo",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "type": "module",
5
5
  "description": "picgo lib for node, browser and electron",
6
6
  "main": "./dist/index.js",
@@ -20,19 +20,28 @@
20
20
  "devDependencies": {
21
21
  "@terwer/eslint-config-custom": "^1.3.6",
22
22
  "@terwer/vite-config-custom": "^0.7.6",
23
+ "@types/mime": "^3.0.4",
23
24
  "@types/mime-types": "^2.1.4",
24
25
  "vite-plugin-node-polyfills": "^0.21.0"
25
26
  },
26
27
  "dependencies": {
28
+ "@aws-sdk/client-s3": "^3.421.0",
29
+ "@aws-sdk/s3-request-presigner": "^3.421.0",
30
+ "@smithy/types": "^2.12.0",
31
+ "@smithy/protocol-http": "^3.3.0",
32
+ "@smithy/querystring-builder": "^2.2.0",
33
+ "@smithy/fetch-http-handler": "^2.5.0",
27
34
  "@picgo/i18n": "^1.0.0",
28
35
  "ali-oss": "^6.20.0",
29
36
  "axios": "^1.6.8",
30
37
  "dayjs": "^1.11.10",
31
38
  "js-yaml": "^4.1.0",
39
+ "mime": "^2.5.2",
32
40
  "mime-types": "^2.1.35",
33
41
  "queue": "^7.0.0",
34
42
  "zhi-lib-base": "^0.8.0",
35
- "universal-picgo-store": "1.8.0"
43
+ "file-type": "^16.2.0",
44
+ "universal-picgo-store": "1.10.0"
36
45
  },
37
46
  "publishConfig": {
38
47
  "access": "public"
@@ -1,37 +0,0 @@
1
- /**
2
- * 使用 Electron 自有的环境执行命令
3
- */
4
- declare class ElectronCmd {
5
- /**
6
- * 使用 Electron 自带的 node 运行命令
7
- *
8
- * https://github.com/UniBO-PRISMLab/wam/issues/26#issuecomment-1456204046
9
- * https://github.com/nodejs/help/issues/3885
10
- * https://github.com/npm/pacote
11
- *
12
- * 示例:
13
- * ```
14
- * await ElectronCmd.executeCommandWithBundledNode("./node_modules/.bin/next", ["-v"], "/Users/terwer/Downloads/n")
15
- *
16
- * const command = "/Users/terwer/Documents/mydocs/siyuan-plugins/siyuan-plugin-local-service/public/setup.cjs"
17
- * const args = []
18
- * const cwd = undefined
19
- * const result = await ElectronCmd.executeCommandWithBundledNodeAsync(command, args, cwd)
20
- * if (result.status) {
21
- * console.log("命令执行成功!😄")
22
- * } else {
23
- * console.error("命令执行失败😭: ", result.msg)
24
- * }
25
- * ```
26
- *
27
- * @param command - 命令
28
- * @param args - 参数
29
- * @param cwd - 运行目录,默认 process.cwd
30
- */
31
- static executeCommandWithBundledNodeAsync(command: string, args?: string[], cwd?: string): Promise<{
32
- status: boolean;
33
- code: number;
34
- msg: string;
35
- }>;
36
- }
37
- export { ElectronCmd };
@@ -1,4 +0,0 @@
1
- import { EventEmitter } from './nodePolyfill';
2
-
3
- declare const eventBus: EventEmitter<[never]>;
4
- export { eventBus };