universal-picgo 2.0.0 → 2.1.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/dist/README.md +100 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +21675 -0
- package/dist/package.json +53 -0
- package/dist/src/core/ExternalPicgo.d.ts +24 -0
- package/dist/src/core/Lifecycle.d.ts +15 -0
- package/dist/src/core/PicListUploader.d.ts +50 -0
- package/dist/src/core/PicListUploader.spec.d.ts +1 -0
- package/dist/src/core/UniversalPicGo.d.ts +51 -0
- package/dist/src/core/UniversalPicGo.spec.d.ts +1 -0
- package/dist/src/db/config/index.d.ts +32 -0
- package/dist/src/db/config/index.spec.d.ts +1 -0
- package/dist/src/db/externalPicGo/index.d.ts +26 -0
- package/dist/src/db/pluginLoder/index.d.ts +24 -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/browserI18nDb.d.ts +16 -0
- package/dist/src/i18n/en.d.ts +3 -0
- package/dist/src/i18n/index.d.ts +18 -0
- package/dist/src/i18n/simpleI18n.d.ts +19 -0
- package/dist/src/i18n/zh-CN.d.ts +143 -0
- package/dist/src/i18n/zh-TW.d.ts +3 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/src/index.spec.d.ts +1 -0
- package/dist/src/lib/LifecyclePlugins.d.ts +18 -0
- package/dist/src/lib/PicGoRequest.d.ts +20 -0
- package/dist/src/lib/PicGoRequest.spec.d.ts +1 -0
- package/dist/src/lib/PluginHandler.d.ts +20 -0
- package/dist/src/lib/PluginLoader.d.ts +29 -0
- package/dist/src/plugins/transformer/base64.d.ts +6 -0
- package/dist/src/plugins/transformer/index.d.ts +4 -0
- package/dist/src/plugins/transformer/path.d.ts +6 -0
- package/dist/src/plugins/uploader/aliyun/index.d.ts +3 -0
- package/dist/src/plugins/uploader/aliyun/node.d.ts +1 -0
- package/dist/src/plugins/uploader/aliyun/web.d.ts +7 -0
- package/dist/src/plugins/uploader/aliyun/web.spec.d.ts +1 -0
- package/dist/src/plugins/uploader/awss3.d.ts +3 -0
- package/dist/src/plugins/uploader/github.d.ts +3 -0
- package/dist/src/plugins/uploader/gitlab.d.ts +3 -0
- package/dist/src/plugins/uploader/imgur.d.ts +3 -0
- package/dist/src/plugins/uploader/index.d.ts +4 -0
- package/dist/src/plugins/uploader/lsky/index.d.ts +3 -0
- package/dist/src/plugins/uploader/qiniu/digest.d.ts +7 -0
- package/dist/src/plugins/uploader/qiniu/index.d.ts +3 -0
- package/dist/src/plugins/uploader/qiniu/rs.d.ts +13 -0
- package/dist/src/plugins/uploader/qiniu/util.d.ts +8 -0
- package/dist/src/plugins/uploader/s3/uploader.d.ts +30 -0
- package/dist/src/plugins/uploader/s3/utils.d.ts +8 -0
- package/dist/src/plugins/uploader/s3/utils.spec.d.ts +1 -0
- package/dist/src/plugins/uploader/smms.d.ts +3 -0
- package/dist/src/plugins/uploader/tcyun.d.ts +9 -0
- package/dist/src/plugins/uploader/upyun/index.d.ts +3 -0
- package/dist/src/utils/CodingUtil.d.ts +39 -0
- package/dist/src/utils/CodingUtil.spec.d.ts +1 -0
- package/dist/src/utils/browserUtils.d.ts +12 -0
- package/dist/src/utils/clipboard/browser.d.ts +4 -0
- package/dist/src/utils/clipboard/electron.d.ts +4 -0
- package/dist/src/utils/common.d.ts +137 -0
- package/dist/src/utils/constants.d.ts +1 -0
- package/dist/src/utils/createContext.d.ts +9 -0
- package/dist/src/utils/cryptoUtil.d.ts +7 -0
- package/dist/src/utils/enums.d.ts +32 -0
- package/dist/src/utils/getClipboardImage.d.ts +4 -0
- package/dist/src/utils/hashUtil.d.ts +2 -0
- package/dist/src/utils/image-size/detector.d.ts +4 -0
- package/dist/src/utils/image-size/index.d.ts +12 -0
- package/dist/src/utils/image-size/types/bmp.d.ts +3 -0
- package/dist/src/utils/image-size/types/cur.d.ts +3 -0
- package/dist/src/utils/image-size/types/dds.d.ts +3 -0
- package/dist/src/utils/image-size/types/gif.d.ts +3 -0
- package/dist/src/utils/image-size/types/heif.d.ts +3 -0
- package/dist/src/utils/image-size/types/icns.d.ts +3 -0
- package/dist/src/utils/image-size/types/ico.d.ts +3 -0
- package/dist/src/utils/image-size/types/index.d.ts +21 -0
- package/dist/src/utils/image-size/types/interface.d.ts +15 -0
- package/dist/src/utils/image-size/types/j2c.d.ts +3 -0
- package/dist/src/utils/image-size/types/jp2.d.ts +3 -0
- package/dist/src/utils/image-size/types/jpg.d.ts +3 -0
- package/dist/src/utils/image-size/types/ktx.d.ts +3 -0
- package/dist/src/utils/image-size/types/png.d.ts +3 -0
- package/dist/src/utils/image-size/types/pnm.d.ts +3 -0
- package/dist/src/utils/image-size/types/psd.d.ts +3 -0
- package/dist/src/utils/image-size/types/svg.d.ts +3 -0
- package/dist/src/utils/image-size/types/tga.d.ts +3 -0
- package/dist/src/utils/image-size/types/tiff.d.ts +3 -0
- package/dist/src/utils/image-size/types/utils.d.ts +17 -0
- package/dist/src/utils/image-size/types/webp.d.ts +3 -0
- package/dist/src/utils/mimeLookup.d.ts +1 -0
- package/dist/src/utils/nodePolyfill.d.ts +4 -0
- package/dist/src/utils/nodeUtils.d.ts +31 -0
- package/dist/src/utils/os/index.d.ts +3 -0
- package/dist/src/utils/os/is-docker/index.d.ts +2 -0
- package/dist/src/utils/os/is-inside-container/index.d.ts +1 -0
- package/dist/src/utils/os/is-wsl/index.d.ts +2 -0
- package/dist/src/utils/pathObject.d.ts +4 -0
- package/dist/src/utils/pathObject.spec.d.ts +1 -0
- package/dist/src/utils/picgoEventBus.d.ts +4 -0
- package/dist/src/utils/pluginRuntime.d.ts +9 -0
- package/dist/src/utils/pluginRuntime.spec.d.ts +1 -0
- package/dist/vite.config.d.ts +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { UniversalPicGoHeadlessManager, createPicGoHeadlessManager } from './headless';
|
|
2
|
+
import { isElectronRuntime, isPicGoPluginPackageName, isThirdPartyPluginRuntimeAvailable } from './utils/pluginRuntime';
|
|
3
|
+
import { deepMerge, getByPath, setByPath, unsetByPath } from './utils/pathObject';
|
|
4
|
+
import { calculateMD5, isFileOrBlob, isSiyuanProxyAvailable } from './utils/common';
|
|
5
|
+
import { IConfig, IExternalPicgoConfig, IImgInfo, IPicBedType, IPicGo, IPicgoDb, IPicGoPlugin, IPluginConfig, IUniversalPicGoOptions, IUploaderConfigItem, IUploaderConfigListItem } from './types';
|
|
6
|
+
import { IBusEvent, PicgoTypeEnum } from './utils/enums';
|
|
7
|
+
import { currentWin, hasNodeEnv, parentWin, win } from 'universal-picgo-store';
|
|
8
|
+
import { picgoEventBus } from './utils/picgoEventBus';
|
|
9
|
+
import { default as ExternalPicgoConfigDb } from './db/externalPicGo';
|
|
10
|
+
import { default as PluginLoaderDb } from './db/pluginLoder';
|
|
11
|
+
import { default as ConfigDb } from './db/config';
|
|
12
|
+
import { PicListUploader } from './core/PicListUploader';
|
|
13
|
+
import { ExternalPicgo } from './core/ExternalPicgo';
|
|
14
|
+
import { UniversalPicGo } from './core/UniversalPicGo';
|
|
15
|
+
|
|
16
|
+
export { UniversalPicGo, ExternalPicgo, PicListUploader, picgoEventBus };
|
|
17
|
+
export { UniversalPicGoHeadlessManager, createPicGoHeadlessManager };
|
|
18
|
+
export { ConfigDb, PluginLoaderDb, ExternalPicgoConfigDb };
|
|
19
|
+
export { PicgoTypeEnum, IBusEvent };
|
|
20
|
+
export { isFileOrBlob, calculateMD5, isSiyuanProxyAvailable };
|
|
21
|
+
export { deepMerge, getByPath, setByPath, unsetByPath };
|
|
22
|
+
export { isElectronRuntime, isPicGoPluginPackageName, isThirdPartyPluginRuntimeAvailable };
|
|
23
|
+
export { win, currentWin, parentWin, hasNodeEnv };
|
|
24
|
+
export { type IPicGo, type IImgInfo, type IPicgoDb, type IConfig, type IExternalPicgoConfig, type IPicBedType, type IUploaderConfigItem, type IUploaderConfigListItem, type IPluginConfig, type IPicGoPlugin, type IUniversalPicGoOptions, };
|
|
25
|
+
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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ILifecyclePlugins, IPlugin } from '../types';
|
|
2
|
+
|
|
3
|
+
declare class LifecyclePlugins implements ILifecyclePlugins {
|
|
4
|
+
static currentPlugin: string | null;
|
|
5
|
+
private readonly list;
|
|
6
|
+
private readonly pluginIdMap;
|
|
7
|
+
private readonly name;
|
|
8
|
+
constructor(name: string);
|
|
9
|
+
getName(): string;
|
|
10
|
+
get(id: string): IPlugin | undefined;
|
|
11
|
+
getList(): IPlugin[];
|
|
12
|
+
getIdList(): string[];
|
|
13
|
+
register(id: string, plugin: IPlugin): void;
|
|
14
|
+
unregister(pluginName: string): void;
|
|
15
|
+
}
|
|
16
|
+
export declare const setCurrentPluginName: (name?: string | null) => void;
|
|
17
|
+
export declare const getCurrentPluginName: () => string | null;
|
|
18
|
+
export { LifecyclePlugins };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IPicGo, IResponse } from '../types';
|
|
2
|
+
import { AxiosRequestConfig } from 'axios';
|
|
3
|
+
|
|
4
|
+
declare class PicGoRequestWrapper {
|
|
5
|
+
private readonly ctx;
|
|
6
|
+
private readonly logger;
|
|
7
|
+
private proxy;
|
|
8
|
+
private options;
|
|
9
|
+
constructor(ctx: IPicGo);
|
|
10
|
+
private init;
|
|
11
|
+
private handleProxy;
|
|
12
|
+
/**
|
|
13
|
+
* PicGo 统一请求封装,基于 axios
|
|
14
|
+
*
|
|
15
|
+
* @param userOptions
|
|
16
|
+
* @constructor
|
|
17
|
+
*/
|
|
18
|
+
PicGoRequest<T, U extends AxiosRequestConfig>(userOptions: U): Promise<IResponse<T, U>>;
|
|
19
|
+
}
|
|
20
|
+
export { PicGoRequestWrapper };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IPicGo, IPluginHandler, IPluginHandlerOptions, IPluginHandlerResult, IProcessEnv } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare class PluginHandler implements IPluginHandler {
|
|
4
|
+
private readonly ctx;
|
|
5
|
+
constructor(ctx: IPicGo);
|
|
6
|
+
install(plugins: string[], options: IPluginHandlerOptions, env: IProcessEnv | undefined): Promise<IPluginHandlerResult<boolean>>;
|
|
7
|
+
uninstall(plugins: string[]): Promise<IPluginHandlerResult<boolean>>;
|
|
8
|
+
update(plugins: string[], options: IPluginHandlerOptions, env: IProcessEnv | undefined): Promise<IPluginHandlerResult<boolean>>;
|
|
9
|
+
/**
|
|
10
|
+
* 执行 NPM 命令
|
|
11
|
+
*
|
|
12
|
+
* @param subCommand - 要执行的 NPM 命令
|
|
13
|
+
* @param modules - 模块数组
|
|
14
|
+
* @param cwd 当前路径
|
|
15
|
+
* @param options
|
|
16
|
+
* @param env 环境变量
|
|
17
|
+
* @returns 执行结果的 Promise
|
|
18
|
+
*/
|
|
19
|
+
private execCommand;
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IPicGo, IPicGoPlugin, IPicGoPluginInterface, IPluginLoader } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Local plugin loader, file system is required
|
|
5
|
+
*/
|
|
6
|
+
export declare class PluginLoader implements IPluginLoader {
|
|
7
|
+
private readonly ctx;
|
|
8
|
+
private readonly logger;
|
|
9
|
+
private db?;
|
|
10
|
+
private list;
|
|
11
|
+
private readonly fullList;
|
|
12
|
+
private readonly pluginMap;
|
|
13
|
+
constructor(ctx: IPicGo);
|
|
14
|
+
load(): boolean;
|
|
15
|
+
registerPlugin(name: string, plugin?: IPicGoPlugin): void;
|
|
16
|
+
unregisterPlugin(name: string): void;
|
|
17
|
+
getPlugin(name: string): IPicGoPluginInterface | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Get the list of enabled plugins
|
|
20
|
+
*/
|
|
21
|
+
getList(): string[];
|
|
22
|
+
hasPlugin(name: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Get the full list of plugins, whether it is enabled or not
|
|
25
|
+
*/
|
|
26
|
+
getFullList(): string[];
|
|
27
|
+
private init;
|
|
28
|
+
private resolvePlugin;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { handleWeb as handleNode } from './web';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { IAliyunConfig, IPicGo } from '../../../types';
|
|
3
|
+
|
|
4
|
+
declare const generateSignature: (options: IAliyunConfig, fileName: string, date: string) => string;
|
|
5
|
+
declare const postOptions: (options: IAliyunConfig, fileName: string, signature: string, image: Buffer, date: string) => AxiosRequestConfig;
|
|
6
|
+
declare const handleWeb: (ctx: IPicGo) => Promise<IPicGo>;
|
|
7
|
+
export { handleWeb, generateSignature, postOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Mac } from './digest';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 上传策略
|
|
5
|
+
* @link https://developer.qiniu.com/kodo/manual/1206/put-policy
|
|
6
|
+
*/
|
|
7
|
+
declare class PutPolicy {
|
|
8
|
+
private readonly expires;
|
|
9
|
+
constructor(options: any);
|
|
10
|
+
getFlags(): any;
|
|
11
|
+
uploadToken(mac: Mac): string;
|
|
12
|
+
}
|
|
13
|
+
export { PutPolicy };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const util: {
|
|
2
|
+
urlsafeBase64Encode: (jsonFlags: string) => string;
|
|
3
|
+
urlSafeBase64Decode: (fromStr: string) => string;
|
|
4
|
+
base64ToUrlSafe: (v: string) => string;
|
|
5
|
+
urlSafeToBase64: (v: string) => string;
|
|
6
|
+
hmacSha1: (encodedFlags: string, secretKey: string) => string;
|
|
7
|
+
};
|
|
8
|
+
export { util };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IAwsS3Config, IImgInfo, IPicGo } from '../../../types';
|
|
2
|
+
import { S3Client, ObjectCannedACL } 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: ObjectCannedACL | undefined;
|
|
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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Buffer } from './nodePolyfill';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 提供编码和解码相关的实用方法
|
|
5
|
+
*
|
|
6
|
+
* @author terwer
|
|
7
|
+
* @since 1.8.0
|
|
8
|
+
*/
|
|
9
|
+
declare class CodingUtil {
|
|
10
|
+
/**
|
|
11
|
+
* 编码字符串为 base64 格式
|
|
12
|
+
*
|
|
13
|
+
* @returns 编码后的 base64 字符串
|
|
14
|
+
* @param input - string | Uint8Array | ArrayBuffer
|
|
15
|
+
*/
|
|
16
|
+
static encodeToBase64String(input: any): string;
|
|
17
|
+
/**
|
|
18
|
+
* 解码 base64
|
|
19
|
+
*
|
|
20
|
+
* @returns 解码后的值
|
|
21
|
+
* @param input - 要解码的 base64 字符串
|
|
22
|
+
*/
|
|
23
|
+
static decodeBase64(input: string): Buffer;
|
|
24
|
+
/**
|
|
25
|
+
* 编码字符串为十六进制格式
|
|
26
|
+
*
|
|
27
|
+
* @param input 要编码的字符串
|
|
28
|
+
* @returns 编码后的十六进制字符串
|
|
29
|
+
*/
|
|
30
|
+
static encodeToHexString(input: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* 解码十六进制
|
|
33
|
+
*
|
|
34
|
+
* @param input 要解码的十六进制字符串
|
|
35
|
+
* @returns 解码后的值
|
|
36
|
+
*/
|
|
37
|
+
static decodeHex(input: string): Buffer;
|
|
38
|
+
}
|
|
39
|
+
export { CodingUtil };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { ILogger } from 'zhi-lib-base';
|
|
2
|
+
import { Buffer } from './nodePolyfill';
|
|
3
|
+
import { win } from 'universal-picgo-store';
|
|
4
|
+
import { IImgSize, IPathTransformedImgInfo, IPicGo, IPluginNameType } from '../types';
|
|
5
|
+
|
|
6
|
+
export declare const isUrl: (url: string) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* 检测输入是否为 base64 编码的字符串
|
|
9
|
+
*
|
|
10
|
+
* @param input - 输入字符串或 Buffer
|
|
11
|
+
* @returns- 如果是 base64 编码则返回 true,否则返回 false
|
|
12
|
+
*/
|
|
13
|
+
export declare const isBase64: (input: any) => boolean;
|
|
14
|
+
export declare const base64ToBuffer: (base64: string) => Buffer | typeof win.Buffer;
|
|
15
|
+
export declare const bufferToBase64: (buffer: Buffer | typeof win.Buffer) => any;
|
|
16
|
+
export declare const getBase64File: (base64: string) => Promise<IPathTransformedImgInfo>;
|
|
17
|
+
export declare const getFSFile: (filePath: string) => Promise<IPathTransformedImgInfo>;
|
|
18
|
+
export declare const isFileOrBlob: (val: any) => boolean;
|
|
19
|
+
export declare const isBuffer: (val: any) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* 将 file 对象转换为 Buffer
|
|
22
|
+
*
|
|
23
|
+
* @param file - file
|
|
24
|
+
* @author terwer
|
|
25
|
+
* @version 0.9.0
|
|
26
|
+
* @since 0.9.0
|
|
27
|
+
*/
|
|
28
|
+
export declare const fileToBuffer: (file: any) => Promise<any>;
|
|
29
|
+
export declare const getBlobFile: (blob: any) => Promise<IPathTransformedImgInfo>;
|
|
30
|
+
export declare const getURLFile: (url: string, ctx: IPicGo) => Promise<IPathTransformedImgInfo>;
|
|
31
|
+
/**
|
|
32
|
+
* detect the input string's type
|
|
33
|
+
* for example
|
|
34
|
+
* 1. @xxx/picgo-plugin-xxx -> scope
|
|
35
|
+
* 2. picgo-plugin-xxx -> normal
|
|
36
|
+
* 3. xxx -> simple
|
|
37
|
+
* 4. not exists or is a path -> unknown
|
|
38
|
+
* @param name
|
|
39
|
+
*/
|
|
40
|
+
export declare const getPluginNameType: (name: string) => IPluginNameType;
|
|
41
|
+
/**
|
|
42
|
+
* detect the input string is a simple plugin name or not
|
|
43
|
+
* for example
|
|
44
|
+
* 1. xxx -> true
|
|
45
|
+
* 2. /Usr/xx/xxxx/picgo-plugin-xxx -> false
|
|
46
|
+
* @param nameOrPath pluginNameOrPath
|
|
47
|
+
*/
|
|
48
|
+
export declare const isSimpleName: (nameOrPath: string) => boolean;
|
|
49
|
+
/**
|
|
50
|
+
* streamline the full plugin name to a simple one
|
|
51
|
+
* for example:
|
|
52
|
+
* 1. picgo-plugin-xxx -> xxx
|
|
53
|
+
* 2. @xxx/picgo-plugin-yyy -> yyy
|
|
54
|
+
* @param name pluginFullName
|
|
55
|
+
*/
|
|
56
|
+
export declare const handleStreamlinePluginName: (name: string) => string;
|
|
57
|
+
/**
|
|
58
|
+
* complete plugin name to full name
|
|
59
|
+
* for example:
|
|
60
|
+
* 1. xxx -> picgo-plugin-xxx
|
|
61
|
+
* 2. picgo-plugin-xxx -> picgo-plugin-xxx
|
|
62
|
+
* @param name pluginSimpleName
|
|
63
|
+
* @param scope pluginScope
|
|
64
|
+
*/
|
|
65
|
+
export declare const handleCompletePluginName: (name: string, scope?: string) => string;
|
|
66
|
+
/**
|
|
67
|
+
* handle transform the path to unix style
|
|
68
|
+
* for example
|
|
69
|
+
* 1. C:\\xxx\\xxx -> C:/xxx/xxx
|
|
70
|
+
* 2. /xxx/xxx -> /xxx/xxx
|
|
71
|
+
* @param pathStr
|
|
72
|
+
*/
|
|
73
|
+
export declare const handleUnixStylePath: (pathStr: string) => string;
|
|
74
|
+
/**
|
|
75
|
+
* remove plugin version when register plugin name
|
|
76
|
+
* 1. picgo-plugin-xxx@1.0.0 -> picgo-plugin-xxx
|
|
77
|
+
* 2. @xxx/picgo-plugin-xxx@1.0.0 -> @xxx/picgo-plugin-xxx
|
|
78
|
+
* @param nameOrPath
|
|
79
|
+
* @param scope
|
|
80
|
+
*/
|
|
81
|
+
export declare const removePluginVersion: (nameOrPath: string, scope?: boolean) => string;
|
|
82
|
+
/**
|
|
83
|
+
* the config black item list which won't be setted
|
|
84
|
+
* only can be got
|
|
85
|
+
*/
|
|
86
|
+
export declare const configBlackList: never[];
|
|
87
|
+
/**
|
|
88
|
+
* check some config key is in blackList
|
|
89
|
+
* @param key
|
|
90
|
+
*/
|
|
91
|
+
export declare const isConfigKeyInBlackList: (key: string) => boolean;
|
|
92
|
+
/**
|
|
93
|
+
* check the input config is valid
|
|
94
|
+
* config must be object such as { xxx: 'xxx' }
|
|
95
|
+
* && can't be array
|
|
96
|
+
* @param config
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
99
|
+
export declare const isInputConfigValid: (config: any) => boolean;
|
|
100
|
+
export declare function safeParse<T>(str: string): T | string;
|
|
101
|
+
export declare const forceNumber: (num?: string | number) => number;
|
|
102
|
+
export declare const getImageSize: (file: Buffer | typeof win.Buffer) => IImgSize;
|
|
103
|
+
export declare const calculateMD5: (input: string) => string;
|
|
104
|
+
/**
|
|
105
|
+
* handle install/uninstall/update plugin name or path
|
|
106
|
+
* for example
|
|
107
|
+
* 1. picgo-plugin-xxx -> picgo-plugin-xxx
|
|
108
|
+
* 2. @xxx/picgo-plugin-xxx -> @xxx/picgo-plugin-xxx
|
|
109
|
+
* 3. xxx -> picgo-plugin-xxx
|
|
110
|
+
* 4. ./xxxx/picgo-plugin-xxx -> /absolutePath/.../xxxx/picgo-plugin-xxx
|
|
111
|
+
* 5. /absolutePath/.../picgo-plugin-xxx -> /absolutePath/.../picgo-plugin-xxx
|
|
112
|
+
* @param nameOrPath pluginName or pluginPath
|
|
113
|
+
* @param logger
|
|
114
|
+
*/
|
|
115
|
+
export declare const getProcessPluginName: (nameOrPath: string, logger: ILogger) => string;
|
|
116
|
+
/**
|
|
117
|
+
* get the normal plugin name
|
|
118
|
+
* for example:
|
|
119
|
+
* 1. picgo-plugin-xxx -> picgo-plugin-xxx
|
|
120
|
+
* 2. @xxx/picgo-plugin-xxx -> @xxx/picgo-plugin-xxx
|
|
121
|
+
* 3. ./xxxx/picgo-plugin-xxx -> picgo-plugin-xxx
|
|
122
|
+
* 4. /absolutePath/.../picgo-plugin-xxx -> picgo-plugin-xxx
|
|
123
|
+
* 5. an exception: [package.json's name] !== [folder name]
|
|
124
|
+
* then use [package.json's name], usually match the scope package.
|
|
125
|
+
* 6. if plugin name has version: picgo-plugin-xxx@x.x.x then remove the version
|
|
126
|
+
* @param nameOrPath
|
|
127
|
+
* @param logger
|
|
128
|
+
*/
|
|
129
|
+
export declare const getNormalPluginName: (nameOrPath: string, logger: ILogger) => string;
|
|
130
|
+
/**
|
|
131
|
+
* 思源笔记内置代理是否可用。
|
|
132
|
+
*
|
|
133
|
+
* `siyuan.proxy` 中保存的端口会随思源重启失效,因此这里不再依赖落盘 origin,
|
|
134
|
+
* 只判断当前运行时 window 是否为思源环境。
|
|
135
|
+
*/
|
|
136
|
+
export declare const isSiyuanProxyAvailable: () => boolean;
|
|
137
|
+
export declare const getSiyuanProxyUrl: () => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CLIPBOARD_IMAGE_FOLDER = "picgo-clipboard-images";
|
|
@@ -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,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* these events will be catched by users
|
|
3
|
+
*/
|
|
4
|
+
export declare enum IBuildInEvent {
|
|
5
|
+
UPLOAD_PROGRESS = "uploadProgress",
|
|
6
|
+
FAILED = "failed",
|
|
7
|
+
BEFORE_TRANSFORM = "beforeTransform",
|
|
8
|
+
BEFORE_UPLOAD = "beforeUpload",
|
|
9
|
+
AFTER_UPLOAD = "afterUpload",
|
|
10
|
+
FINISHED = "finished",
|
|
11
|
+
INSTALL = "install",
|
|
12
|
+
UNINSTALL = "uninstall",
|
|
13
|
+
UPDATE = "update",
|
|
14
|
+
NOTIFICATION = "notification"
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* these events will be catched only by picgo
|
|
18
|
+
*/
|
|
19
|
+
export declare enum IBusEvent {
|
|
20
|
+
CONFIG_CHANGE = "CONFIG_CHANGE"
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* PicGo 类型枚举
|
|
24
|
+
*
|
|
25
|
+
* @version 1.6.0
|
|
26
|
+
* @since 1.6.0
|
|
27
|
+
* @author terwer
|
|
28
|
+
*/
|
|
29
|
+
export declare enum PicgoTypeEnum {
|
|
30
|
+
Bundled = "bundled",
|
|
31
|
+
App = "app"
|
|
32
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { win } from 'universal-picgo-store';
|
|
2
|
+
import { imageType } from './types';
|
|
3
|
+
import { ISizeCalculationResult } from './types/interface';
|
|
4
|
+
|
|
5
|
+
type CallbackFn = (e: Error | null, r?: ISizeCalculationResult) => void;
|
|
6
|
+
export default imageSize;
|
|
7
|
+
export declare function imageSize(input: typeof win.Uint8Array | string): ISizeCalculationResult;
|
|
8
|
+
export declare function imageSize(input: string, callback: CallbackFn): void;
|
|
9
|
+
export declare const disableFS: (v: boolean) => void;
|
|
10
|
+
export declare const disableTypes: (types: imageType[]) => void;
|
|
11
|
+
export declare const setConcurrency: (c: number) => void;
|
|
12
|
+
export declare const types: string[];
|