picgo 3.0.1 → 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.
@@ -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 };
@@ -1,3 +1,4 @@
1
1
  import { IPlugin } from '../../types';
2
+ declare const resolveUploadInput: (item: string) => string;
2
3
  declare const upload: IPlugin;
3
- export { upload };
4
+ export { resolveUploadInput, upload };
@@ -401,7 +401,20 @@ export declare enum OutputFormat {
401
401
  PRETTY = "pretty",
402
402
  JSON = "json"
403
403
  }
404
- export interface UploadOptions {
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
  }
@@ -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>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Convert the WSL network-share path emitted by some Windows integrations to
3
+ * a UNC path that Node.js can read.
4
+ *
5
+ * Windows exposes WSL files through paths such as `\\\\wsl$\\<distribution>\\...`
6
+ * or `\\\\wsl.localhost\\<distribution>\\...`, while integrations such as Typora
7
+ * may omit the leading UNC separators.
8
+ */
9
+ export declare const normalizeWslPath: (filePath: string, platform?: NodeJS.Platform) => string;
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "picgo",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
4
+ "packageManager": "pnpm@11.7.0",
4
5
  "description": "A tool for image uploading",
5
6
  "main": "dist/index.cjs.js",
6
7
  "module": "dist/index.esm.js",
@@ -37,12 +38,12 @@
37
38
  "path": "./node_modules/cz-customizable"
38
39
  },
39
40
  "cz-customizable": {
40
- "config": "./node_modules/@picgo/bump-version/.cz-config.js"
41
+ "config": "./node_modules/@picgo/bump-version/.cz-config.cjs"
41
42
  }
42
43
  },
43
44
  "commitlint": {
44
45
  "extends": [
45
- "./node_modules/@picgo/bump-version/commitlint-picgo"
46
+ "./node_modules/@picgo/bump-version/commitlint-picgo/index.cjs"
46
47
  ]
47
48
  },
48
49
  "author": "Molunerfinn",
@@ -50,7 +51,7 @@
50
51
  "devDependencies": {
51
52
  "@commitlint/cli": "^20.2.0",
52
53
  "@eslint/js": "^9.39.1",
53
- "@picgo/bump-version": "^2.0.0",
54
+ "@picgo/bump-version": "^3.0.0",
54
55
  "@rollup/plugin-commonjs": "^29.0.0",
55
56
  "@rollup/plugin-json": "^6.1.0",
56
57
  "@rollup/plugin-node-resolve": "^16.0.3",
@@ -60,7 +61,6 @@
60
61
  "@stylistic/eslint-plugin": "^5.7.0",
61
62
  "@types/cross-spawn": "^6.0.0",
62
63
  "@types/fs-extra": "^5.0.4",
63
- "@types/image-size": "^0.0.29",
64
64
  "@types/inquirer": "^0.0.42",
65
65
  "@types/js-yaml": "^4.0.5",
66
66
  "@types/lodash": "^4.14.175",
@@ -109,7 +109,7 @@
109
109
  "giget": "^2.0.0",
110
110
  "globby": "^11.0.4",
111
111
  "hono": "^4.11.3",
112
- "image-size": "^0.8.3",
112
+ "image-size-next": "2.1.1",
113
113
  "inquirer": "^6.0.0",
114
114
  "is-wsl": "^2.2.0",
115
115
  "js-yaml": "^4.1.0",
@@ -0,0 +1,3 @@
1
+ allowBuilds:
2
+ # Required by Vitest and other esbuild consumers during installation.
3
+ esbuild: true