universal-picgo 1.12.1 → 2.0.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.
- package/README.md +48 -0
- package/dist/README.md +48 -0
- package/dist/index.js +19073 -82743
- package/dist/package.json +4 -7
- package/dist/src/core/UniversalPicGo.d.ts +5 -1
- package/dist/src/core/UniversalPicGo.spec.d.ts +1 -0
- package/dist/src/db/config/index.d.ts +7 -0
- package/dist/src/db/config/index.spec.d.ts +1 -0
- package/dist/src/headless/UniversalPicGoHeadlessManager.d.ts +24 -0
- package/dist/src/headless/UniversalPicGoHeadlessManager.spec.d.ts +1 -0
- package/dist/src/headless/index.d.ts +3 -0
- package/dist/src/headless/types.d.ts +116 -0
- package/dist/src/headless/uploaderSchemas.d.ts +9 -0
- package/dist/src/i18n/simpleI18n.d.ts +19 -0
- package/dist/src/index.d.ts +9 -2
- package/dist/src/lib/PluginLoader.d.ts +1 -1
- package/dist/src/plugins/uploader/aliyun/node.d.ts +1 -4
- package/dist/src/plugins/uploader/s3/utils.spec.d.ts +1 -0
- package/dist/src/utils/cryptoUtil.d.ts +7 -0
- package/dist/src/utils/mimeLookup.d.ts +1 -0
- package/dist/src/utils/pathObject.d.ts +4 -0
- package/dist/src/utils/pathObject.spec.d.ts +1 -0
- package/dist/src/utils/pluginRuntime.d.ts +9 -0
- package/dist/src/utils/pluginRuntime.spec.d.ts +1 -0
- package/package.json +4 -7
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "universal-picgo",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "picgo lib for node, browser and electron",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"@terwer/eslint-config-custom": "^1.3.6",
|
|
29
29
|
"@terwer/vite-config-custom": "^0.7.6",
|
|
30
30
|
"@types/mime": "^4.0.0",
|
|
31
|
-
"@types/mime-types": "^2.1.4",
|
|
32
31
|
"vite-plugin-node-polyfills": "^0.22.0"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
@@ -38,17 +37,15 @@
|
|
|
38
37
|
"@smithy/protocol-http": "^4.0.0",
|
|
39
38
|
"@smithy/querystring-builder": "^3.0.0",
|
|
40
39
|
"@smithy/fetch-http-handler": "^3.0.1",
|
|
41
|
-
"@picgo/i18n": "^1.0.0",
|
|
42
|
-
"ali-oss": "^6.20.0",
|
|
43
40
|
"axios": "^1.6.8",
|
|
44
41
|
"dayjs": "^1.11.11",
|
|
42
|
+
"hash.js": "^1.1.7",
|
|
43
|
+
"js-md5": "^0.8.3",
|
|
45
44
|
"js-yaml": "^4.1.0",
|
|
46
45
|
"mime": "^4.0.3",
|
|
47
|
-
"mime-types": "^2.1.35",
|
|
48
46
|
"queue": "^7.0.0",
|
|
49
47
|
"universal-picgo-store": "workspace:*",
|
|
50
|
-
"zhi-lib-base": "^0.8.0"
|
|
51
|
-
"file-type": "^16.2.0"
|
|
48
|
+
"zhi-lib-base": "^0.8.0"
|
|
52
49
|
},
|
|
53
50
|
"publishConfig": {
|
|
54
51
|
"access": "public"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PicGoRequestWrapper } from '../lib/PicGoRequest';
|
|
2
2
|
import { PluginHandler } from '../lib/PluginHandler';
|
|
3
|
-
import { IHelper, II18nManager, IImgInfo, IPicGo, IPicGoPlugin, IPicGoPluginInterface, IPluginLoader, IStringKeyMap } from '../types';
|
|
3
|
+
import { IConfig, IHelper, II18nManager, IImgInfo, IPicGo, IPicGoPlugin, IPicGoPluginInterface, IPluginLoader, IStringKeyMap, IUniversalPicGoOptions } from '../types';
|
|
4
4
|
import { EventEmitter } from '../utils/nodePolyfill';
|
|
5
5
|
import { ILogger } from 'zhi-lib-base';
|
|
6
6
|
|
|
@@ -22,9 +22,11 @@ declare class UniversalPicGo extends EventEmitter implements IPicGo {
|
|
|
22
22
|
i18n: II18nManager;
|
|
23
23
|
VERSION: string;
|
|
24
24
|
private readonly isDev;
|
|
25
|
+
private readonly usesOptionsObject;
|
|
25
26
|
get pluginLoader(): IPluginLoader;
|
|
26
27
|
getLogger(name?: string): ILogger;
|
|
27
28
|
get request(): PicGoRequestWrapper["PicGoRequest"];
|
|
29
|
+
constructor(options?: IUniversalPicGoOptions);
|
|
28
30
|
constructor(configPath?: string, pluginBaseDir?: string, zhiNpmPath?: string, isDev?: boolean);
|
|
29
31
|
/**
|
|
30
32
|
* easily mannually load a plugin
|
|
@@ -33,11 +35,13 @@ declare class UniversalPicGo extends EventEmitter implements IPicGo {
|
|
|
33
35
|
*/
|
|
34
36
|
use(plugin: IPicGoPlugin, name?: string): IPicGoPluginInterface;
|
|
35
37
|
getConfig<T>(name?: string, defaultValue?: any): T;
|
|
38
|
+
reloadConfig(): IConfig;
|
|
36
39
|
saveConfig(config: IStringKeyMap<any>): void;
|
|
37
40
|
removeConfig(key: string, propName: string): void;
|
|
38
41
|
setConfig(config: IStringKeyMap<any>): void;
|
|
39
42
|
unsetConfig(key: string, propName: string): void;
|
|
40
43
|
upload(input?: any[]): Promise<IImgInfo[] | Error>;
|
|
44
|
+
private normalizeOptions;
|
|
41
45
|
private getDefautBaseDir;
|
|
42
46
|
private initConfigPath;
|
|
43
47
|
private initZhiNpmPath;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,6 +11,13 @@ declare class ConfigDb implements IPicgoDb<IConfig> {
|
|
|
11
11
|
current: string;
|
|
12
12
|
};
|
|
13
13
|
picgoPlugins: {};
|
|
14
|
+
siyuan: {
|
|
15
|
+
waitTimeout: number;
|
|
16
|
+
retryTimes: number;
|
|
17
|
+
autoUpload: boolean;
|
|
18
|
+
replaceLink: boolean;
|
|
19
|
+
txtImageSwitch: boolean;
|
|
20
|
+
};
|
|
14
21
|
};
|
|
15
22
|
constructor(ctx: IPicGo);
|
|
16
23
|
read(flush?: boolean): IJSON;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IPicGoHeadlessManager, PicGoHeadlessManagerOptions, PicGoHeadlessSaveUploaderConfigOptions, PicGoUploaderConfigSchema, PicGoUploaderListItem, PicGoUploaderSchemaAuditResult, PicGoValidationResult } from './types';
|
|
2
|
+
import { IConfig, IImgInfo, IPicGo } from '../types';
|
|
3
|
+
|
|
4
|
+
declare class UniversalPicGoHeadlessManager implements IPicGoHeadlessManager {
|
|
5
|
+
private readonly ctx;
|
|
6
|
+
constructor(options?: PicGoHeadlessManagerOptions);
|
|
7
|
+
getContext(): IPicGo;
|
|
8
|
+
getConfig(): IConfig;
|
|
9
|
+
getCurrentUploader(): string;
|
|
10
|
+
setCurrentUploader(uploaderId: string): PicGoValidationResult;
|
|
11
|
+
listUploaders(): PicGoUploaderListItem[];
|
|
12
|
+
getUploaderSchema(uploaderId: string): PicGoUploaderConfigSchema;
|
|
13
|
+
getUploaderConfig<T extends Record<string, unknown> = Record<string, unknown>>(uploaderId: string): T;
|
|
14
|
+
validateUploaderConfig(uploaderId: string, config: Record<string, unknown>): PicGoValidationResult;
|
|
15
|
+
saveUploaderConfig(uploaderId: string, config: Record<string, unknown>, options?: PicGoHeadlessSaveUploaderConfigOptions): PicGoValidationResult;
|
|
16
|
+
auditUploaderSchemas(): PicGoUploaderSchemaAuditResult;
|
|
17
|
+
upload(input?: any[]): Promise<IImgInfo[]>;
|
|
18
|
+
private hasUploader;
|
|
19
|
+
private withSchemaDefaults;
|
|
20
|
+
private unknownUploaderResult;
|
|
21
|
+
private unknownUploaderError;
|
|
22
|
+
}
|
|
23
|
+
declare const createPicGoHeadlessManager: (options?: PicGoHeadlessManagerOptions) => UniversalPicGoHeadlessManager;
|
|
24
|
+
export { UniversalPicGoHeadlessManager, createPicGoHeadlessManager };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { UniversalPicGoHeadlessManager, createPicGoHeadlessManager } from './UniversalPicGoHeadlessManager';
|
|
2
|
+
export { BUILT_IN_UPLOADER_IDS, auditBuiltInUploaderSchemas, getPicGoUploaderSchema, isBuiltInUploaderId, listPicGoUploaders, type BuiltInUploaderId, } from './uploaderSchemas';
|
|
3
|
+
export { PICGO_HEADLESS_ERROR_CODES, PicGoHeadlessError, type IPicGoHeadlessManager, type PicGoHeadlessErrorCode, type PicGoHeadlessErrorInput, type PicGoHeadlessManagerOptions, type PicGoHeadlessSaveUploaderConfigOptions, type PicGoUploaderConfigSchema, type PicGoUploaderListItem, type PicGoUploaderSchemaAuditResult, type PicGoUploaderSchemaChoice, type PicGoUploaderSchemaField, type PicGoUploaderSchemaFieldType, type PicGoValidationFieldError, type PicGoValidationResult, } from './types';
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { IConfig, IImgInfo, IPicGo, IUniversalPicGoOptions } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare const PICGO_HEADLESS_ERROR_CODES: {
|
|
4
|
+
readonly UNKNOWN_UPLOADER: "UNKNOWN_UPLOADER";
|
|
5
|
+
readonly SCHEMA_UNAVAILABLE: "SCHEMA_UNAVAILABLE";
|
|
6
|
+
readonly UNSUPPORTED_SCHEMA_FIELD: "UNSUPPORTED_SCHEMA_FIELD";
|
|
7
|
+
readonly MISSING_REQUIRED_FIELD: "MISSING_REQUIRED_FIELD";
|
|
8
|
+
readonly INVALID_FIELD_TYPE: "INVALID_FIELD_TYPE";
|
|
9
|
+
readonly INVALID_FIELD_CHOICE: "INVALID_FIELD_CHOICE";
|
|
10
|
+
readonly VALIDATION_FAILED: "VALIDATION_FAILED";
|
|
11
|
+
readonly UPLOAD_FAILED: "UPLOAD_FAILED";
|
|
12
|
+
};
|
|
13
|
+
export type PicGoHeadlessErrorCode = (typeof PICGO_HEADLESS_ERROR_CODES)[keyof typeof PICGO_HEADLESS_ERROR_CODES];
|
|
14
|
+
export type PicGoUploaderSchemaFieldType = "input" | "password" | "confirm" | "list";
|
|
15
|
+
export interface PicGoUploaderSchemaChoice {
|
|
16
|
+
label: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}
|
|
19
|
+
export interface PicGoUploaderListItem {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
builtin: boolean;
|
|
23
|
+
schemaAvailable: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface PicGoUploaderSchemaField {
|
|
26
|
+
name: string;
|
|
27
|
+
type: PicGoUploaderSchemaFieldType;
|
|
28
|
+
label?: string;
|
|
29
|
+
alias?: string;
|
|
30
|
+
message?: string;
|
|
31
|
+
required: boolean;
|
|
32
|
+
default?: unknown;
|
|
33
|
+
valuePath: string;
|
|
34
|
+
sensitive: boolean;
|
|
35
|
+
choices?: PicGoUploaderSchemaChoice[];
|
|
36
|
+
}
|
|
37
|
+
export interface PicGoUploaderConfigSchema {
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
builtin: boolean;
|
|
41
|
+
fields: PicGoUploaderSchemaField[];
|
|
42
|
+
}
|
|
43
|
+
export interface PicGoValidationFieldError {
|
|
44
|
+
code: PicGoHeadlessErrorCode;
|
|
45
|
+
uploaderId: string;
|
|
46
|
+
field?: string;
|
|
47
|
+
message: string;
|
|
48
|
+
}
|
|
49
|
+
export interface PicGoValidationResult {
|
|
50
|
+
ok: boolean;
|
|
51
|
+
uploaderId: string;
|
|
52
|
+
errors: PicGoValidationFieldError[];
|
|
53
|
+
}
|
|
54
|
+
export interface PicGoUploaderSchemaAuditResult {
|
|
55
|
+
ok: boolean;
|
|
56
|
+
errors: PicGoValidationFieldError[];
|
|
57
|
+
}
|
|
58
|
+
export interface PicGoHeadlessManagerOptions extends IUniversalPicGoOptions {
|
|
59
|
+
/**
|
|
60
|
+
* Reuse an already initialized PicGo context. When provided, path options are
|
|
61
|
+
* ignored and no new UniversalPicGo instance is created.
|
|
62
|
+
*/
|
|
63
|
+
picgo?: IPicGo;
|
|
64
|
+
}
|
|
65
|
+
export interface PicGoHeadlessSaveUploaderConfigOptions {
|
|
66
|
+
/**
|
|
67
|
+
* Also make this uploader the PicGo current uploader after a successful save.
|
|
68
|
+
*/
|
|
69
|
+
setCurrent?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Validate with the public schema before persisting. Defaults to true.
|
|
72
|
+
*/
|
|
73
|
+
validate?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Documented raw escape hatch for advanced callers. When true, validation is
|
|
76
|
+
* skipped but the write is still scoped to the target uploader section.
|
|
77
|
+
*/
|
|
78
|
+
unsafeRaw?: boolean;
|
|
79
|
+
}
|
|
80
|
+
export interface IPicGoHeadlessManager {
|
|
81
|
+
getContext(): IPicGo;
|
|
82
|
+
getConfig(): IConfig;
|
|
83
|
+
getCurrentUploader(): string;
|
|
84
|
+
setCurrentUploader(uploaderId: string): PicGoValidationResult;
|
|
85
|
+
listUploaders(): PicGoUploaderListItem[];
|
|
86
|
+
getUploaderSchema(uploaderId: string): PicGoUploaderConfigSchema;
|
|
87
|
+
getUploaderConfig<T extends Record<string, unknown> = Record<string, unknown>>(uploaderId: string): T;
|
|
88
|
+
validateUploaderConfig(uploaderId: string, config: Record<string, unknown>): PicGoValidationResult;
|
|
89
|
+
saveUploaderConfig(uploaderId: string, config: Record<string, unknown>, options?: PicGoHeadlessSaveUploaderConfigOptions): PicGoValidationResult;
|
|
90
|
+
auditUploaderSchemas(): PicGoUploaderSchemaAuditResult;
|
|
91
|
+
upload(input?: any[]): Promise<IImgInfo[]>;
|
|
92
|
+
}
|
|
93
|
+
export interface PicGoHeadlessErrorInput {
|
|
94
|
+
code: PicGoHeadlessErrorCode;
|
|
95
|
+
message: string;
|
|
96
|
+
uploaderId?: string;
|
|
97
|
+
field?: string;
|
|
98
|
+
errors?: PicGoValidationFieldError[];
|
|
99
|
+
cause?: unknown;
|
|
100
|
+
}
|
|
101
|
+
export declare class PicGoHeadlessError extends Error {
|
|
102
|
+
readonly code: PicGoHeadlessErrorCode;
|
|
103
|
+
readonly uploaderId?: string;
|
|
104
|
+
readonly field?: string;
|
|
105
|
+
readonly errors?: PicGoValidationFieldError[];
|
|
106
|
+
readonly cause?: unknown;
|
|
107
|
+
constructor(input: PicGoHeadlessErrorInput);
|
|
108
|
+
toJSON(): {
|
|
109
|
+
name: string;
|
|
110
|
+
code: PicGoHeadlessErrorCode;
|
|
111
|
+
message: string;
|
|
112
|
+
uploaderId: string | undefined;
|
|
113
|
+
field: string | undefined;
|
|
114
|
+
errors: PicGoValidationFieldError[] | undefined;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PicGoUploaderConfigSchema, PicGoUploaderListItem, PicGoUploaderSchemaAuditResult } from './types';
|
|
2
|
+
import { IPicGo } from '../types';
|
|
3
|
+
|
|
4
|
+
export declare const BUILT_IN_UPLOADER_IDS: readonly ["github", "gitlab", "aliyun", "tcyun", "qiniu", "upyun", "smms", "imgur", "awss3", "lsky"];
|
|
5
|
+
export type BuiltInUploaderId = (typeof BUILT_IN_UPLOADER_IDS)[number];
|
|
6
|
+
export declare const isBuiltInUploaderId: (uploaderId: string) => uploaderId is "smms" | "github" | "gitlab" | "aliyun" | "tcyun" | "qiniu" | "upyun" | "imgur" | "awss3" | "lsky";
|
|
7
|
+
export declare const listPicGoUploaders: (ctx: IPicGo) => PicGoUploaderListItem[];
|
|
8
|
+
export declare const getPicGoUploaderSchema: (ctx: IPicGo, uploaderId: string) => PicGoUploaderConfigSchema | undefined;
|
|
9
|
+
export declare const auditBuiltInUploaderSchemas: (ctx: IPicGo) => PicGoUploaderSchemaAuditResult;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ILocale } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare class ObjectAdapter {
|
|
4
|
+
private locales;
|
|
5
|
+
constructor(locales: Record<string, ILocale>);
|
|
6
|
+
getLocale(language: string): ILocale;
|
|
7
|
+
setLocale(language: string, locales: ILocale): void;
|
|
8
|
+
}
|
|
9
|
+
export declare class I18n {
|
|
10
|
+
private readonly adapter;
|
|
11
|
+
private defaultLanguage;
|
|
12
|
+
private currentLanguage;
|
|
13
|
+
constructor(options: {
|
|
14
|
+
adapter: ObjectAdapter;
|
|
15
|
+
defaultLanguage: string;
|
|
16
|
+
});
|
|
17
|
+
setLanguage(language: string): void;
|
|
18
|
+
translate<T extends string>(phrase: T, args?: Record<string, string>): string | undefined;
|
|
19
|
+
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { UniversalPicGoHeadlessManager, createPicGoHeadlessManager } from './headless';
|
|
2
|
+
import { isElectronRuntime, isPicGoPluginPackageName, isThirdPartyPluginRuntimeAvailable } from './utils/pluginRuntime';
|
|
3
|
+
import { deepMerge, getByPath, setByPath, unsetByPath } from './utils/pathObject';
|
|
1
4
|
import { calculateMD5, isFileOrBlob, isSiyuanProxyAvailable } from './utils/common';
|
|
2
|
-
import { IConfig, IExternalPicgoConfig, IImgInfo, IPicBedType, IPicGo, IPicgoDb, IPicGoPlugin, IPluginConfig, IUploaderConfigItem, IUploaderConfigListItem } from './types';
|
|
5
|
+
import { IConfig, IExternalPicgoConfig, IImgInfo, IPicBedType, IPicGo, IPicgoDb, IPicGoPlugin, IPluginConfig, IUniversalPicGoOptions, IUploaderConfigItem, IUploaderConfigListItem } from './types';
|
|
3
6
|
import { IBusEvent, PicgoTypeEnum } from './utils/enums';
|
|
4
7
|
import { currentWin, hasNodeEnv, parentWin, win } from 'universal-picgo-store';
|
|
5
8
|
import { picgoEventBus } from './utils/picgoEventBus';
|
|
@@ -10,8 +13,12 @@ import { ExternalPicgo } from './core/ExternalPicgo';
|
|
|
10
13
|
import { UniversalPicGo } from './core/UniversalPicGo';
|
|
11
14
|
|
|
12
15
|
export { UniversalPicGo, ExternalPicgo, picgoEventBus };
|
|
16
|
+
export { UniversalPicGoHeadlessManager, createPicGoHeadlessManager };
|
|
13
17
|
export { ConfigDb, PluginLoaderDb, ExternalPicgoConfigDb };
|
|
14
18
|
export { PicgoTypeEnum, IBusEvent };
|
|
15
19
|
export { isFileOrBlob, calculateMD5, isSiyuanProxyAvailable };
|
|
20
|
+
export { deepMerge, getByPath, setByPath, unsetByPath };
|
|
21
|
+
export { isElectronRuntime, isPicGoPluginPackageName, isThirdPartyPluginRuntimeAvailable };
|
|
16
22
|
export { win, currentWin, parentWin, hasNodeEnv };
|
|
17
|
-
export { type IPicGo, type IImgInfo, type IPicgoDb, type IConfig, type IExternalPicgoConfig, type IPicBedType, type IUploaderConfigItem, type IUploaderConfigListItem, type IPluginConfig, type IPicGoPlugin, };
|
|
23
|
+
export { type IPicGo, type IImgInfo, type IPicgoDb, type IConfig, type IExternalPicgoConfig, type IPicBedType, type IUploaderConfigItem, type IUploaderConfigListItem, type IPluginConfig, type IPicGoPlugin, type IUniversalPicGoOptions, };
|
|
24
|
+
export { BUILT_IN_UPLOADER_IDS, PICGO_HEADLESS_ERROR_CODES, PicGoHeadlessError, auditBuiltInUploaderSchemas, getPicGoUploaderSchema, isBuiltInUploaderId, listPicGoUploaders, type BuiltInUploaderId, type IPicGoHeadlessManager, type PicGoHeadlessErrorCode, type PicGoHeadlessErrorInput, type PicGoHeadlessManagerOptions, type PicGoHeadlessSaveUploaderConfigOptions, type PicGoUploaderConfigSchema, type PicGoUploaderListItem, type PicGoUploaderSchemaAuditResult, type PicGoUploaderSchemaChoice, type PicGoUploaderSchemaField, type PicGoUploaderSchemaFieldType, type PicGoValidationFieldError, type PicGoValidationResult, } from './headless';
|
|
@@ -6,7 +6,7 @@ import { IPicGo, IPicGoPlugin, IPicGoPluginInterface, IPluginLoader } from '../t
|
|
|
6
6
|
export declare class PluginLoader implements IPluginLoader {
|
|
7
7
|
private readonly ctx;
|
|
8
8
|
private readonly logger;
|
|
9
|
-
private db
|
|
9
|
+
private db?;
|
|
10
10
|
private list;
|
|
11
11
|
private readonly fullList;
|
|
12
12
|
private readonly pluginMap;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Buffer } from './nodePolyfill';
|
|
2
|
+
|
|
3
|
+
type HashAlgorithm = "md5" | "sha1" | "sha256";
|
|
4
|
+
type DigestEncoding = "hex" | "base64" | undefined;
|
|
5
|
+
export declare function digestHash(input: string | Buffer | Uint8Array, algorithm: HashAlgorithm, encoding: DigestEncoding): string;
|
|
6
|
+
export declare function digestHmacSha1(key: string | Buffer | Uint8Array, value: string | Buffer | Uint8Array, encoding: DigestEncoding): string | Buffer;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function lookupMimeType(fileName?: string): string | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function getByPath(obj: any, path?: string, defaultValue?: any): any;
|
|
2
|
+
export declare function setByPath(obj: any, path: string, value: any): void;
|
|
3
|
+
export declare function unsetByPath(obj: any, path: string): boolean;
|
|
4
|
+
export declare function deepMerge<T extends Record<string, any>>(target: T, source: Record<string, any>): T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PicGo 第三方插件依赖 Electron 的本机能力(node_modules、@electron/remote、插件菜单等)。
|
|
3
|
+
*
|
|
4
|
+
* v2 配置会在多个运行端共享,但非 Electron 端(浏览器、Docker、publisher 的 web runtime 等)
|
|
5
|
+
* 不能读取或应用任何第三方插件配置,否则会把本机 PC-only 状态误当成跨端平台能力。
|
|
6
|
+
*/
|
|
7
|
+
export declare const isElectronRuntime: () => boolean;
|
|
8
|
+
export declare const isThirdPartyPluginRuntimeAvailable: () => boolean;
|
|
9
|
+
export declare const isPicGoPluginPackageName: (name: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "universal-picgo",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "picgo lib for node, browser and electron",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"@terwer/eslint-config-custom": "^1.3.6",
|
|
22
22
|
"@terwer/vite-config-custom": "^0.7.6",
|
|
23
23
|
"@types/mime": "^4.0.0",
|
|
24
|
-
"@types/mime-types": "^2.1.4",
|
|
25
24
|
"vite-plugin-node-polyfills": "^0.22.0"
|
|
26
25
|
},
|
|
27
26
|
"dependencies": {
|
|
@@ -31,17 +30,15 @@
|
|
|
31
30
|
"@smithy/protocol-http": "^4.0.0",
|
|
32
31
|
"@smithy/querystring-builder": "^3.0.0",
|
|
33
32
|
"@smithy/fetch-http-handler": "^3.0.1",
|
|
34
|
-
"@picgo/i18n": "^1.0.0",
|
|
35
|
-
"ali-oss": "^6.20.0",
|
|
36
33
|
"axios": "^1.6.8",
|
|
37
34
|
"dayjs": "^1.11.11",
|
|
35
|
+
"hash.js": "^1.1.7",
|
|
36
|
+
"js-md5": "^0.8.3",
|
|
38
37
|
"js-yaml": "^4.1.0",
|
|
39
38
|
"mime": "^4.0.3",
|
|
40
|
-
"mime-types": "^2.1.35",
|
|
41
39
|
"queue": "^7.0.0",
|
|
42
40
|
"zhi-lib-base": "^0.8.0",
|
|
43
|
-
"
|
|
44
|
-
"universal-picgo-store": "1.12.1"
|
|
41
|
+
"universal-picgo-store": "2.0.1"
|
|
45
42
|
},
|
|
46
43
|
"publishConfig": {
|
|
47
44
|
"access": "public"
|