picgo 3.0.2 → 3.1.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/README.md +86 -0
- package/dist/core/Lifecycle.d.ts +0 -2
- package/dist/i18n/zh-CN.d.ts +8 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/UploadOption.d.ts +13 -0
- package/dist/types/index.d.ts +14 -1
- package/dist/types/internal.d.ts +4 -4
- package/dist/utils/createClipboardImagePath.d.ts +1 -0
- package/dist/utils/createContext.d.ts +2 -2
- package/dist/utils/getClipboardImage.d.ts +1 -2
- package/package.json +2 -1
- package/pnpm-workspace.yaml +3 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IPicGo, ResolvedUploadOption, UploadOption } from '../types';
|
|
2
|
+
declare enum UploadOptionErrorCode {
|
|
3
|
+
InvalidOption = "INVALID_UPLOAD_OPTION",
|
|
4
|
+
UnknownUploader = "UNKNOWN_UPLOADER",
|
|
5
|
+
ConfigNotFound = "UPLOAD_CONFIG_NOT_FOUND",
|
|
6
|
+
AmbiguousConfig = "UPLOAD_CONFIG_AMBIGUOUS"
|
|
7
|
+
}
|
|
8
|
+
declare class UploadOptionError extends Error {
|
|
9
|
+
readonly code: UploadOptionErrorCode;
|
|
10
|
+
constructor(code: UploadOptionErrorCode, message: string);
|
|
11
|
+
}
|
|
12
|
+
declare const resolveUploadOptions: (ctx: IPicGo, option?: UploadOption) => ResolvedUploadOption | undefined;
|
|
13
|
+
export { resolveUploadOptions, UploadOptionError, UploadOptionErrorCode };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -401,7 +401,20 @@ export declare enum OutputFormat {
|
|
|
401
401
|
PRETTY = "pretty",
|
|
402
402
|
JSON = "json"
|
|
403
403
|
}
|
|
404
|
-
export interface
|
|
404
|
+
export interface UploadOption {
|
|
405
|
+
/** Registered uploader type. Omit to search all registered types by configuration name or ID. */
|
|
406
|
+
uploader?: string;
|
|
407
|
+
/** Friendly configuration name, matched case-insensitively within the search scope. */
|
|
408
|
+
configName?: string;
|
|
409
|
+
/** Stable configuration ID. A unique match takes precedence over configName. */
|
|
410
|
+
configId?: string;
|
|
411
|
+
}
|
|
412
|
+
export interface ResolvedUploadOption {
|
|
413
|
+
uploader: string;
|
|
414
|
+
/** PicGo Cloud may use the current login without a saved uploader profile. */
|
|
415
|
+
config?: IUploaderConfigItem;
|
|
416
|
+
}
|
|
417
|
+
export interface UploadOptions extends UploadOption {
|
|
405
418
|
/** Output format for the success message. Defaults to 'pretty'. */
|
|
406
419
|
outputFormat?: OutputFormat;
|
|
407
420
|
}
|
package/dist/types/internal.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Env, Handler } from 'hono';
|
|
2
|
-
import { IImgInfo, IServerManager } from '.';
|
|
1
|
+
import type { Env, Handler } from 'hono';
|
|
2
|
+
import type { IImgInfo, IServerManager, UploadOptions } from '.';
|
|
3
3
|
export interface IServerUploadAdapter {
|
|
4
|
-
uploadClipboard: () => Promise<IImgInfo[] | Error>;
|
|
5
|
-
uploadPaths: (paths: string[]) => Promise<IImgInfo[] | Error>;
|
|
4
|
+
uploadClipboard: (options?: UploadOptions) => Promise<IImgInfo[] | Error>;
|
|
5
|
+
uploadPaths: (paths: string[], options?: UploadOptions) => Promise<IImgInfo[] | Error>;
|
|
6
6
|
getTempDir?: () => string;
|
|
7
7
|
}
|
|
8
8
|
export interface IInternalServerManager<E extends Env = any> extends IServerManager<E> {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createClipboardImagePath: (baseDir: string) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IPicGo } from '../types';
|
|
1
|
+
import { IPicGo, ResolvedUploadOption } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* create an unique context for each upload process
|
|
4
4
|
* @param ctx
|
|
5
5
|
*/
|
|
6
|
-
export declare const createContext: (ctx: IPicGo) => IPicGo;
|
|
6
|
+
export declare const createContext: (ctx: IPicGo, option?: ResolvedUploadOption) => IPicGo;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { IPicGo, IClipboardImage } from '../types';
|
|
2
2
|
export type Platform = 'darwin' | 'win32' | 'win10' | 'linux' | 'wsl';
|
|
3
|
-
declare const getClipboardImage: (ctx: IPicGo) => Promise<IClipboardImage>;
|
|
4
|
-
export default getClipboardImage;
|
|
3
|
+
export declare const getClipboardImage: (ctx: IPicGo) => Promise<IClipboardImage>;
|
package/package.json
CHANGED