piclist 2.4.0 → 2.4.2
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/AGENTS.md +36 -0
- package/README.md +2 -1
- package/README_en.md +2 -1
- package/dist/core/Lifecycle.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/Commander.d.ts +2 -2
- package/dist/lib/PluginHandler.d.ts +1 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/utils/common/compress.d.ts +6 -0
- package/dist/utils/common/config.d.ts +6 -0
- package/dist/utils/common/hash.d.ts +4 -0
- package/dist/utils/common/imageFile.d.ts +5 -0
- package/dist/utils/common/plugin.d.ts +9 -0
- package/dist/utils/common/processingOptions.d.ts +3 -0
- package/dist/utils/common/rename.d.ts +5 -0
- package/dist/utils/common/url.d.ts +3 -0
- package/dist/utils/common/watermark.d.ts +4 -0
- package/dist/utils/common.d.ts +9 -46
- package/dist/utils/inquirerShim.d.ts +23 -0
- package/package.json +25 -25
package/dist/lib/Commander.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { Inquirer } from 'inquirer';
|
|
3
2
|
import { ICommander, IPicGo, IPlugin } from '../types';
|
|
3
|
+
import { IInquirerAdapter } from '../utils/inquirerShim';
|
|
4
4
|
export declare class Commander implements ICommander {
|
|
5
5
|
private readonly name;
|
|
6
6
|
static currentPlugin: string | null;
|
|
@@ -8,7 +8,7 @@ export declare class Commander implements ICommander {
|
|
|
8
8
|
private readonly pluginIdMap;
|
|
9
9
|
private readonly ctx;
|
|
10
10
|
program: Command;
|
|
11
|
-
inquirer:
|
|
11
|
+
inquirer: IInquirerAdapter;
|
|
12
12
|
constructor(ctx: IPicGo);
|
|
13
13
|
getName(): string;
|
|
14
14
|
init(): void;
|
|
@@ -2,6 +2,7 @@ import { IPicGo, IPluginHandler, IPluginHandlerOptions, IPluginHandlerResult, IP
|
|
|
2
2
|
export declare class PluginHandler implements IPluginHandler {
|
|
3
3
|
private readonly ctx;
|
|
4
4
|
constructor(ctx: IPicGo);
|
|
5
|
+
getList(): Promise<string[]>;
|
|
5
6
|
install(plugins: string[], options?: IPluginHandlerOptions, env?: IProcessEnv): Promise<IPluginHandlerResult<boolean>>;
|
|
6
7
|
uninstall(plugins: string[]): Promise<IPluginHandlerResult<boolean>>;
|
|
7
8
|
update(plugins: string[], options?: IPluginHandlerOptions, env?: IProcessEnv): Promise<IPluginHandlerResult<boolean>>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { Inquirer } from 'inquirer';
|
|
3
2
|
import { FormatEnum, GravityEnum } from 'sharp';
|
|
4
3
|
import type { ConfigManager } from '../utils/configManager';
|
|
4
|
+
import type { IInquirerAdapter } from '../utils/inquirerShim';
|
|
5
5
|
import { IRequestPromiseOptions } from './oldRequest';
|
|
6
6
|
export interface IPicGo extends NodeJS.EventEmitter {
|
|
7
7
|
configPath: string;
|
|
@@ -61,7 +61,7 @@ export interface IHelper {
|
|
|
61
61
|
}
|
|
62
62
|
export interface ICommander extends ILifecyclePlugins {
|
|
63
63
|
program: Command;
|
|
64
|
-
inquirer:
|
|
64
|
+
inquirer: IInquirerAdapter;
|
|
65
65
|
}
|
|
66
66
|
export interface IPluginLoader {
|
|
67
67
|
registerPlugin: (name: string, plugin?: IPicGoPlugin) => Promise<void>;
|
|
@@ -427,6 +427,7 @@ export interface IPluginProcessResult {
|
|
|
427
427
|
fullName: string;
|
|
428
428
|
}
|
|
429
429
|
export interface IPluginHandler {
|
|
430
|
+
getList: () => Promise<string[]>;
|
|
430
431
|
install: (plugins: string[], options: IPluginHandlerOptions, env?: IProcessEnv) => Promise<IPluginHandlerResult<boolean>>;
|
|
431
432
|
update: (plugins: string[], options: IPluginHandlerOptions, env?: IProcessEnv) => Promise<IPluginHandlerResult<boolean>>;
|
|
432
433
|
uninstall: (plugins: string[]) => Promise<IPluginHandlerResult<boolean>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IBuildInCompressOptions, IBuildInWaterMarkOptions, ILogger } from '../../types';
|
|
2
|
+
export declare function imageCompress(img: Buffer, options: IBuildInCompressOptions, rawFormat: string, logger: ILogger): Promise<Buffer>;
|
|
3
|
+
export declare function getConvertedFormat(options: IBuildInCompressOptions | undefined, rawFormat: string): string;
|
|
4
|
+
export declare const isNeedAddWatermark: (watermarkOptions: IBuildInWaterMarkOptions | undefined, fileExt: string) => boolean;
|
|
5
|
+
export declare const isNeedCompress: (compressOptions: IBuildInCompressOptions | undefined, fileExt: string) => boolean;
|
|
6
|
+
export declare const removeExif: (img: Buffer, fileExt: string) => Promise<Buffer>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const configBlackList: string[];
|
|
2
|
+
export declare const isConfigKeyInBlackList: (key: string) => boolean;
|
|
3
|
+
export declare const isInputConfigValid: (config: any) => boolean;
|
|
4
|
+
export declare function safeParse<T>(str: string): T | string;
|
|
5
|
+
export declare const forceNumber: (num?: string | number) => number;
|
|
6
|
+
export declare const isDev: () => boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IImgSize, IPathTransformedImgInfo, IPicGo } from '../../types';
|
|
2
|
+
export declare const getImageSize: (file: Buffer) => IImgSize;
|
|
3
|
+
export declare const getFSFile: (filePath: string) => Promise<IPathTransformedImgInfo>;
|
|
4
|
+
export declare function getImageTypeByMagicNumber(buffer: Buffer | Uint8Array): string;
|
|
5
|
+
export declare const getURLFile: (url: string, ctx: IPicGo) => Promise<IPathTransformedImgInfo>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ILogger, IPluginNameType } from '../../types';
|
|
2
|
+
export declare const getPluginNameType: (name: string) => IPluginNameType;
|
|
3
|
+
export declare const isSimpleName: (nameOrPath: string) => boolean;
|
|
4
|
+
export declare const handleStreamlinePluginName: (name: string) => string;
|
|
5
|
+
export declare const handleCompletePluginName: (name: string, scope?: string) => string;
|
|
6
|
+
export declare const getProcessPluginName: (nameOrPath: string, logger?: ILogger | Console) => string;
|
|
7
|
+
export declare const getNormalPluginName: (nameOrPath: string, logger?: ILogger | Console) => string;
|
|
8
|
+
export declare const handleUnixStylePath: (pathStr: string) => string;
|
|
9
|
+
export declare const removePluginVersion: (nameOrPath: string, scope?: boolean) => string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IBuildInCompressOptions, IBuildInCompressOptionsTreated, IBuildInWaterMarkOptions, IBuildInWaterMarkOptionsTreated } from '../../types';
|
|
2
|
+
export declare function getTreatedWaterMarkOptions(global: IBuildInWaterMarkOptions | undefined, idSpecificConfig: Partial<IBuildInWaterMarkOptions>, picBed: string, id: string): IBuildInWaterMarkOptionsTreated;
|
|
3
|
+
export declare function getTreatedCompressOptions(global: IBuildInCompressOptions | undefined, idSpecificConfig: Partial<IBuildInCompressOptions>, picBed: string, id: string): IBuildInCompressOptionsTreated;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BinaryLike } from 'node:crypto';
|
|
2
|
+
export declare function randomStringGenerator(length: number): string;
|
|
3
|
+
export declare function renameFileNameWithTimestamp(oldName: string): string;
|
|
4
|
+
export declare function renameFileNameWithRandomString(oldName: string, length?: number): string;
|
|
5
|
+
export declare function renameFileNameWithCustomString(oldName: string, customFormat: string, affixFileName?: string, fileBuffer?: BinaryLike): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import sharp from 'sharp';
|
|
2
|
+
import type { IBuildInWaterMarkOptions, ILogger } from '../../types';
|
|
3
|
+
export declare function AddWatermark(img: Buffer, watermarkType: 'text' | 'image', defaultWatermarkFontPath: string, isFullScreenWatermark?: boolean, watermarkDegree?: number, text?: string, watermarkFontPath?: string, watermarkScaleRatio?: number, watermarkColor?: string, watermarkImagePath?: string, position?: sharp.Gravity, watermarkImageOpacity?: number): Promise<Buffer>;
|
|
4
|
+
export declare function imageAddWaterMark(img: Buffer, options: IBuildInWaterMarkOptions, defaultWatermarkFontPath: string, logger: ILogger): Promise<Buffer>;
|
package/dist/utils/common.d.ts
CHANGED
|
@@ -1,46 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export declare const isUrlEncode: (url: string) => boolean;
|
|
11
|
-
export declare const handleUrlEncode: (url: string) => string;
|
|
12
|
-
export declare const getImageSize: (file: Buffer) => IImgSize;
|
|
13
|
-
export declare const getFSFile: (filePath: string) => Promise<IPathTransformedImgInfo>;
|
|
14
|
-
export declare function getImageTypeByMagicNumber(buffer: Buffer | Uint8Array): string;
|
|
15
|
-
export declare const getURLFile: (url: string, ctx: IPicGo) => Promise<IPathTransformedImgInfo>;
|
|
16
|
-
export declare const getPluginNameType: (name: string) => IPluginNameType;
|
|
17
|
-
export declare const isSimpleName: (nameOrPath: string) => boolean;
|
|
18
|
-
export declare const handleStreamlinePluginName: (name: string) => string;
|
|
19
|
-
export declare const handleCompletePluginName: (name: string, scope?: string) => string;
|
|
20
|
-
export declare const getProcessPluginName: (nameOrPath: string, logger?: ILogger | Console) => string;
|
|
21
|
-
export declare const getNormalPluginName: (nameOrPath: string, logger?: ILogger | Console) => string;
|
|
22
|
-
export declare const handleUnixStylePath: (pathStr: string) => string;
|
|
23
|
-
export declare const removePluginVersion: (nameOrPath: string, scope?: boolean) => string;
|
|
24
|
-
/**
|
|
25
|
-
* the config black item list which won't be setted
|
|
26
|
-
* only can be got
|
|
27
|
-
*/
|
|
28
|
-
export declare const configBlackList: never[];
|
|
29
|
-
/**
|
|
30
|
-
* check some config key is in blackList
|
|
31
|
-
* @param key
|
|
32
|
-
*/
|
|
33
|
-
export declare const isConfigKeyInBlackList: (key: string) => boolean;
|
|
34
|
-
export declare const isInputConfigValid: (config: any) => boolean;
|
|
35
|
-
export declare function safeParse<T>(str: string): T | string;
|
|
36
|
-
export declare const forceNumber: (num?: string | number) => number;
|
|
37
|
-
export declare const isDev: () => boolean;
|
|
38
|
-
export declare function AddWatermark(img: Buffer, watermarkType: 'text' | 'image', defaultWatermarkFontPath: string, isFullScreenWatermark?: boolean, watermarkDegree?: number, text?: string, watermarkFontPath?: string, watermarkScaleRatio?: number, watermarkColor?: string, watermarkImagePath?: string, position?: sharp.Gravity, watermarkImageOpacity?: number): Promise<Buffer>;
|
|
39
|
-
export declare function getTreatedWaterMarkOptions(global: IBuildInWaterMarkOptions | undefined, idSpecificConfig: Partial<IBuildInWaterMarkOptions>, picBed: string, id: string): IBuildInWaterMarkOptionsTreated;
|
|
40
|
-
export declare function getTreatedCompressOptions(global: IBuildInCompressOptions | undefined, idSpecificConfig: Partial<IBuildInCompressOptions>, picBed: string, id: string): IBuildInCompressOptionsTreated;
|
|
41
|
-
export declare function imageAddWaterMark(img: Buffer, options: IBuildInWaterMarkOptions, defaultWatermarkFontPath: string, logger: ILogger): Promise<Buffer>;
|
|
42
|
-
export declare function imageCompress(img: Buffer, options: IBuildInCompressOptions, rawFormat: string, logger: ILogger): Promise<Buffer>;
|
|
43
|
-
export declare function getConvertedFormat(options: IBuildInCompressOptions | undefined, rawFormat: string): string;
|
|
44
|
-
export declare const isNeedAddWatermark: (watermarkOptions: IBuildInWaterMarkOptions | undefined, fileExt: string) => boolean;
|
|
45
|
-
export declare const isNeedCompress: (compressOptions: IBuildInCompressOptions | undefined, fileExt: string) => boolean;
|
|
46
|
-
export declare const removeExif: (img: Buffer, fileExt: string) => Promise<Buffer>;
|
|
1
|
+
export { getConvertedFormat, imageCompress, isNeedAddWatermark, isNeedCompress, removeExif } from './common/compress';
|
|
2
|
+
export { configBlackList, forceNumber, isConfigKeyInBlackList, isDev, isInputConfigValid, safeParse, } from './common/config';
|
|
3
|
+
export { getMd5 } from './common/hash';
|
|
4
|
+
export { getFSFile, getImageSize, getImageTypeByMagicNumber, getURLFile } from './common/imageFile';
|
|
5
|
+
export { getNormalPluginName, getPluginNameType, getProcessPluginName, handleCompletePluginName, handleStreamlinePluginName, handleUnixStylePath, isSimpleName, removePluginVersion, } from './common/plugin';
|
|
6
|
+
export { getTreatedCompressOptions, getTreatedWaterMarkOptions } from './common/processingOptions';
|
|
7
|
+
export { randomStringGenerator, renameFileNameWithCustomString, renameFileNameWithRandomString, renameFileNameWithTimestamp, } from './common/rename';
|
|
8
|
+
export { handleUrlEncode, isUrl, isUrlEncode } from './common/url';
|
|
9
|
+
export { AddWatermark, imageAddWaterMark } from './common/watermark';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface IInquirerQuestion {
|
|
2
|
+
type: string;
|
|
3
|
+
name: string;
|
|
4
|
+
message?: string;
|
|
5
|
+
choices?: ({
|
|
6
|
+
name: string;
|
|
7
|
+
value: any;
|
|
8
|
+
} | string)[];
|
|
9
|
+
default?: any;
|
|
10
|
+
validate?: (val: any) => boolean | string | Promise<boolean | string>;
|
|
11
|
+
when?: boolean | ((answers: Record<string, any>) => boolean | Promise<boolean>);
|
|
12
|
+
filter?: (val: any) => any;
|
|
13
|
+
transformer?: (val: any) => string;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
export interface IInquirerAdapter {
|
|
17
|
+
prompt<T = Record<string, any>>(questions: IInquirerQuestion[]): Promise<T>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates an adapter whose `.prompt()` method mirrors the legacy
|
|
21
|
+
* `inquirer.prompt(questions)` API.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createInquirerAdapter(): IInquirerAdapter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piclist",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "Modified PicGo core, A tool for picture uploading",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"picture",
|
|
@@ -61,27 +61,27 @@
|
|
|
61
61
|
"baseline-browser-mapping": "^2.9.13"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aws-sdk/client-s3": "3.
|
|
65
|
-
"@aws-sdk/lib-storage": "3.
|
|
66
|
-
"@aws-sdk/s3-request-presigner": "3.
|
|
64
|
+
"@aws-sdk/client-s3": "3.1063.0",
|
|
65
|
+
"@aws-sdk/lib-storage": "3.1063.0",
|
|
66
|
+
"@aws-sdk/s3-request-presigner": "3.1063.0",
|
|
67
|
+
"@inquirer/prompts": "^8.5.2",
|
|
67
68
|
"@piclist/i18n": "^2.0.0",
|
|
68
69
|
"@piclist/store": "^3.0.1",
|
|
69
|
-
"@smithy/node-http-handler": "4.
|
|
70
|
-
"axios": "^1.
|
|
70
|
+
"@smithy/node-http-handler": "4.7.7",
|
|
71
|
+
"axios": "^1.17.0",
|
|
71
72
|
"chalk": "^5.6.2",
|
|
72
|
-
"commander": "^
|
|
73
|
+
"commander": "^15.0.0",
|
|
73
74
|
"cross-spawn": "^7.0.6",
|
|
74
|
-
"dayjs": "^1.11.
|
|
75
|
+
"dayjs": "^1.11.21",
|
|
75
76
|
"dotenv": "^17.4.2",
|
|
76
77
|
"file-type": "22.0.1",
|
|
77
78
|
"form-data": "^4.0.5",
|
|
78
|
-
"fs-extra": "^11.3.
|
|
79
|
+
"fs-extra": "^11.3.5",
|
|
79
80
|
"heic-convert": "^2.1.0",
|
|
80
81
|
"hpagent": "1.2.0",
|
|
81
82
|
"image-size": "^2.0.2",
|
|
82
|
-
"inquirer": "^6.0.0",
|
|
83
83
|
"is-wsl": "^3.1.0",
|
|
84
|
-
"js-yaml": "^4.
|
|
84
|
+
"js-yaml": "^4.2.0",
|
|
85
85
|
"lodash-es": "^4.18.1",
|
|
86
86
|
"mime": "4.1.0",
|
|
87
87
|
"minimist": "^1.2.8",
|
|
@@ -92,12 +92,13 @@
|
|
|
92
92
|
"sharp": "0.34.4",
|
|
93
93
|
"text-to-svg": "^3.1.5",
|
|
94
94
|
"tunnel": "^0.0.6",
|
|
95
|
-
"
|
|
95
|
+
"ulid": "^3.0.2",
|
|
96
|
+
"uuid": "^14.0.0",
|
|
96
97
|
"webdav": "^5.10.0"
|
|
97
98
|
},
|
|
98
99
|
"devDependencies": {
|
|
99
100
|
"@eslint/js": "^10.0.1",
|
|
100
|
-
"@rollup/plugin-commonjs": "^29.0.
|
|
101
|
+
"@rollup/plugin-commonjs": "^29.0.3",
|
|
101
102
|
"@rollup/plugin-json": "^6.1.0",
|
|
102
103
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
103
104
|
"@rollup/plugin-replace": "^6.0.3",
|
|
@@ -105,37 +106,36 @@
|
|
|
105
106
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
106
107
|
"@types/cross-spawn": "^6.0.6",
|
|
107
108
|
"@types/fs-extra": "^11.0.4",
|
|
108
|
-
"@types/heic-convert": "^2.1.
|
|
109
|
-
"@types/inquirer": "^0.0.42",
|
|
109
|
+
"@types/heic-convert": "^2.1.1",
|
|
110
110
|
"@types/js-yaml": "^4.0.9",
|
|
111
111
|
"@types/lodash-es": "^4.17.12",
|
|
112
|
-
"@types/node": "25.
|
|
112
|
+
"@types/node": "25.9.2",
|
|
113
113
|
"@types/resolve": "^1.20.6",
|
|
114
114
|
"@types/text-to-svg": "^3.1.4",
|
|
115
115
|
"@types/tunnel": "^0.0.7",
|
|
116
116
|
"@vitest/coverage-v8": "^4.1.0",
|
|
117
117
|
"cross-env": "^10.1.0",
|
|
118
|
-
"dpdm": "^4.0
|
|
119
|
-
"eslint": "^10.
|
|
118
|
+
"dpdm": "^4.2.0",
|
|
119
|
+
"eslint": "^10.4.1",
|
|
120
120
|
"eslint-config-prettier": "^10.1.8",
|
|
121
|
-
"eslint-plugin-jsonc": "^3.
|
|
122
|
-
"eslint-plugin-prettier": "^5.5.
|
|
121
|
+
"eslint-plugin-jsonc": "^3.2.0",
|
|
122
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
123
123
|
"eslint-plugin-simple-import-sort": "^13.0.0",
|
|
124
124
|
"eslint-plugin-unicorn": "^64.0.0",
|
|
125
125
|
"husky": "^9.1.7",
|
|
126
126
|
"jsonc-eslint-parser": "^3.1.0",
|
|
127
127
|
"node-bump-version": "^2.0.0",
|
|
128
|
-
"prettier": "^3.8.
|
|
128
|
+
"prettier": "^3.8.3",
|
|
129
129
|
"rimraf": "^6.1.3",
|
|
130
|
-
"rollup": "^4.
|
|
130
|
+
"rollup": "^4.61.1",
|
|
131
131
|
"rollup-plugin-copy": "^3.5.0",
|
|
132
132
|
"rollup-plugin-string": "^3.0.0",
|
|
133
133
|
"typescript": "^6.0.3",
|
|
134
|
-
"typescript-eslint": "^8.
|
|
135
|
-
"vitest": "^4.1.
|
|
134
|
+
"typescript-eslint": "^8.60.1",
|
|
135
|
+
"vitest": "^4.1.8"
|
|
136
136
|
},
|
|
137
137
|
"engines": {
|
|
138
|
-
"node": ">=22.
|
|
138
|
+
"node": ">=22.12.0"
|
|
139
139
|
},
|
|
140
140
|
"publishConfig": {
|
|
141
141
|
"access": "public"
|