diff --git a/libs/.gitkeep b/libs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/libs/zhi-picgo-core/.eslintignore b/libs/zhi-picgo-core/.eslintignore deleted file mode 100644 index f06235c..0000000 --- a/libs/zhi-picgo-core/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -dist diff --git a/libs/zhi-picgo-core/.eslintrc.cjs b/libs/zhi-picgo-core/.eslintrc.cjs deleted file mode 100644 index a1993b7..0000000 --- a/libs/zhi-picgo-core/.eslintrc.cjs +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - root: true, - extends: ["./node_modules/@terwer/eslint-config-custom/typescript/index.cjs"], -} diff --git a/libs/zhi-picgo-core/CHANGELOG.md b/libs/zhi-picgo-core/CHANGELOG.md deleted file mode 100644 index 33e2220..0000000 --- a/libs/zhi-picgo-core/CHANGELOG.md +++ /dev/null @@ -1,401 +0,0 @@ -# zhi-picgo-core - -## 1.7.0 - -### Minor Changes - -- feat: fit latest siyuan note - -## 1.6.1 - -### Patch Changes - -- chore: format code - -# :tada: 1.5.0 (2022-11-13) - -# :tada: 1.5.0-alpha.17 (2022-11-13) - -### :sparkles: Features - -- update picgo.use ([e19bb6e](https://github.com/PicGo/PicGo-Core/commit/e19bb6e)) - -### :bug: Bug Fixes - -- some case will cause proxy not work ([6272303](https://github.com/PicGo/PicGo-Core/commit/6272303)) - -# :tada: 1.5.0-alpha.16 (2022-11-09) - -### :bug: Bug Fixes - -- upyun url-options is not required ([9736a11](https://github.com/PicGo/PicGo-Core/commit/9736a11)) - -# :tada: 1.5.0-alpha.15 (2022-10-24) - -### :bug: Bug Fixes - -- tencent cos url encode bug ([eafb70f](https://github.com/PicGo/PicGo-Core/commit/eafb70f)) - -# :tada: 1.5.0-alpha.14 (2022-10-24) - -### :bug: Bug Fixes - -- url encode bug ([4c70e9b](https://github.com/PicGo/PicGo-Core/commit/4c70e9b)) - -# :tada: 1.5.0-alpha.13 (2022-10-19) - -### :bug: Bug Fixes - -- type error ([b934e8a](https://github.com/PicGo/PicGo-Core/commit/b934e8a)) - -### :package: Chore - -- create oldRequest types ([749359a](https://github.com/PicGo/PicGo-Core/commit/749359a)) - -# :tada: 1.5.0-alpha.12 (2022-10-14) - -### :bug: Bug Fixes - -- types bug ([d77e6f3](https://github.com/PicGo/PicGo-Core/commit/d77e6f3)) - -# :tada: 1.5.0-alpha.11 (2022-10-13) - -# :tada: 1.5.0-alpha.10 (2022-09-25) - -### :sparkles: Features - -- add zh-TW ([#135](https://github.com/PicGo/PicGo-Core/issues/135)) ([d111d6a](https://github.com/PicGo/PicGo-Core/commit/d111d6a)) -- update linux.sh ([#134](https://github.com/PicGo/PicGo-Core/issues/134)) ([2910c20](https://github.com/PicGo/PicGo-Core/commit/2910c20)) - -### :bug: Bug Fixes - -- some texts in zh-TW ([#136](https://github.com/PicGo/PicGo-Core/issues/136)) ([907e6c9](https://github.com/PicGo/PicGo-Core/commit/907e6c9)) -- url image download bug & tencent cos url encode bug ([53d54f8](https://github.com/PicGo/PicGo-Core/commit/53d54f8)) - -# :tada: 1.5.0-alpha.9 (2022-09-03) - -### :sparkles: Features - -- finish request -> axios ([b89cf1e](https://github.com/PicGo/PicGo-Core/commit/b89cf1e)) - -### :bug: Bug Fixes - -- qiniu error msg can't show ([0e4661b](https://github.com/PicGo/PicGo-Core/commit/0e4661b)) -- sm.ms backupDomain message text ([45424d1](https://github.com/PicGo/PicGo-Core/commit/45424d1)) -- when request-options resolveWithFullResponse is false bug ([eb8217a](https://github.com/PicGo/PicGo-Core/commit/eb8217a)) - -# :tada: 1.5.0-alpha.8 (2022-08-27) - -### :sparkles: Features - -- add backupDomain for sm.ms ([c6d54f1](https://github.com/PicGo/PicGo-Core/commit/c6d54f1)) -- add debug logger type ([4342268](https://github.com/PicGo/PicGo-Core/commit/4342268)) -- add picgo.use for easily using plugin ([c0107f1](https://github.com/PicGo/PicGo-Core/commit/c0107f1)) - -### :bug: Bug Fixes - -- sometime tencent-cloud error message is empty ([6355e1b](https://github.com/PicGo/PicGo-Core/commit/6355e1b)) - -# :tada: 1.5.0-alpha.7 (2022-08-20) - -### :sparkles: Features - -- finish i18n text ([11b3197](https://github.com/PicGo/PicGo-Core/commit/11b3197)) - -### :bug: Bug Fixes - -- aliyun content-type -> Content-Type ([a649fcc](https://github.com/PicGo/PicGo-Core/commit/a649fcc)) - -# :tada: 1.5.0-alpha.6 (2022-08-17) - -### :bug: Bug Fixes - -- tencent cos upload error ([61df53a](https://github.com/PicGo/PicGo-Core/commit/61df53a)) - -# :tada: 1.5.0-alpha.5 (2022-07-31) - -### :sparkles: Features - -- add log file size limit ([158be01](https://github.com/PicGo/PicGo-Core/commit/158be01)) -- change inner db to @picgo/store ([0e90af3](https://github.com/PicGo/PicGo-Core/commit/0e90af3)) - -### :bug: Bug Fixes - -- build error ([674a6b5](https://github.com/PicGo/PicGo-Core/commit/674a6b5)) - -# :tada: 1.5.0-alpha.4 (2022-05-26) - -### :sparkles: Features - -- add userAgent for tencent cloud COS ([acac59a](https://github.com/PicGo/PicGo-Core/commit/acac59a)) - -# :tada: 1.5.0-alpha.3 (2022-04-04) - -### :bug: Bug Fixes - -- picgo-gui clipboard image uploading error ([1302f76](https://github.com/PicGo/PicGo-Core/commit/1302f76)) - -# :tada: 1.5.0-alpha.2 (2022-04-03) - -### :sparkles: Features - -- add wayland support for linux ([#119](https://github.com/PicGo/PicGo-Core/issues/119)) ([28905f2](https://github.com/PicGo/PicGo-Core/commit/28905f2)) - -### :bug: Bug Fixes - -- qiniu && upyun errors ([587dd3f](https://github.com/PicGo/PicGo-Core/commit/587dd3f)) - -# :tada: 1.5.0-alpha.1 (2022-03-08) - -### :sparkles: Features - -- add options for tencent cos ([1fccdcc](https://github.com/PicGo/PicGo-Core/commit/1fccdcc)), closes [#117](https://github.com/PicGo/PicGo-Core/issues/117) -- **i18n:** add i18n for picgo ([4b93a76](https://github.com/PicGo/PicGo-Core/commit/4b93a76)) - -### :bug: Bug Fixes - -- build error in windows ([5616fb9](https://github.com/PicGo/PicGo-Core/commit/5616fb9)) - -### :package: Chore - -- add alpha branch for alpha version ([6882022](https://github.com/PicGo/PicGo-Core/commit/6882022)), closes [#106](https://github.com/PicGo/PicGo-Core/issues/106) - -# :tada: 1.5.0-alpha.0 (2021-10-26) - -### :package: Chore - -- **build:** migrate to esbuild and change export assignment to esm export ([#102](https://github.com/PicGo/PicGo-Core/issues/102)) ([2a6cd18](https://github.com/PicGo/PicGo-Core/commit/2a6cd18)) - -## :tada: 1.4.26 (2021-08-23) - -### :bug: Bug Fixes - -- engine bug in package.json ([1c65144](https://github.com/PicGo/PicGo-Core/commit/1c65144)) - -## :tada: 1.4.25 (2021-08-21) - -### :bug: Bug Fixes - -- handle clipboard file path error ([ff4ec86](https://github.com/PicGo/PicGo-Core/commit/ff4ec86)), closes [#97](https://github.com/PicGo/PicGo-Core/issues/97) -- **error:** throw error when transform failed ([#96](https://github.com/PicGo/PicGo-Core/issues/96)) ([57fce75](https://github.com/PicGo/PicGo-Core/commit/57fce75)) -- clipboard path contains space ([#95](https://github.com/PicGo/PicGo-Core/issues/95)) ([d2b73c1](https://github.com/PicGo/PicGo-Core/commit/d2b73c1)) - -## :tada: 1.4.24 (2021-08-01) - -### :sparkles: Features - -- uploaded now can be modified since picgo will not use this value ([b6a8b58](https://github.com/PicGo/PicGo-Core/commit/b6a8b58)) - -## :tada: 1.4.23 (2021-07-27) - -### :bug: Bug Fixes - -- cases when clipboard of wsl contain image file ([#91](https://github.com/PicGo/PicGo-Core/issues/91)) ([adfc55e](https://github.com/PicGo/PicGo-Core/commit/adfc55e)) - -### :package: Chore - -- add github actions for publishing ([caae80e](https://github.com/PicGo/PicGo-Core/commit/caae80e)) - -## :tada: 1.4.22 (2021-07-27) - -### :sparkles: Features - -- **smms:** smms now supports image without token ([#89](https://github.com/PicGo/PicGo-Core/issues/89)) ([456b81c](https://github.com/PicGo/PicGo-Core/commit/456b81c)) -- add support for clipboard in wsl ([#87](https://github.com/PicGo/PicGo-Core/issues/87)) ([3e230de](https://github.com/PicGo/PicGo-Core/commit/3e230de)) - -## :tada: 1.4.21 (2021-05-09) - -### :bug: Bug Fixes - -- output empty after uploading when using isolate context ([79c228b](https://github.com/PicGo/PicGo-Core/commit/79c228b)) - -## :tada: 1.4.20 (2021-05-09) - -### :sparkles: Features - -- add createContext for each upload process ([ecde023](https://github.com/PicGo/PicGo-Core/commit/ecde023)) - -### :package: Chore - -- add debug launch.json ([9950259](https://github.com/PicGo/PicGo-Core/commit/9950259)) - -## :tada: 1.4.19 (2021-04-04) - -### :sparkles: Features - -- add current uploader && transformer log ([67b2bb1](https://github.com/PicGo/PicGo-Core/commit/67b2bb1)) -- limit some of config's capabilities ([f901505](https://github.com/PicGo/PicGo-Core/commit/f901505)) - -## :tada: 1.4.18 (2021-03-06) - -### :bug: Bug Fixes - -- unregister plugin delete pluginMap ([85228d8](https://github.com/PicGo/PicGo-Core/commit/85228d8)) - -## :tada: 1.4.17 (2021-02-09) - -### :bug: Bug Fixes - -- **type:** type error in index.d.ts ([f617658](https://github.com/PicGo/PicGo-Core/commit/f617658)), closes [#69](https://github.com/PicGo/PicGo-Core/issues/69) - -## :tada: 1.4.16 (2021-02-08) - -### :sparkles: Features - -- add proxy & registry options for pluginHandler ([b10b963](https://github.com/PicGo/PicGo-Core/commit/b10b963)) -- dynamic proxy getter with ctx.Request.request ([687805f](https://github.com/PicGo/PicGo-Core/commit/687805f)), closes [#64](https://github.com/PicGo/PicGo-Core/issues/64) -- supporting install specific version of plugin ([35e15b0](https://github.com/PicGo/PicGo-Core/commit/35e15b0)) - -## :tada: 1.4.15 (2021-01-24) - -### :sparkles: Features - -- add local plugin install/uninstall/update support & imporve plugin name handler ([f8ec464](https://github.com/PicGo/PicGo-Core/commit/f8ec464)) - -## :tada: 1.4.14 (2020-12-19) - -### :bug: Bug Fixes - -- types error ([303a4ec](https://github.com/PicGo/PicGo-Core/commit/303a4ec)) - -## :tada: 1.4.13 (2020-12-19) - -### :sparkles: Features - -- new addPlugin api for node projects ([5a18432](https://github.com/PicGo/PicGo-Core/commit/5a18432)) - -### :bug: Bug Fixes - -- **type:** some type error ([233a6ca](https://github.com/PicGo/PicGo-Core/commit/233a6ca)) -- pluginLoader can't get the full plugin list ([83535b9](https://github.com/PicGo/PicGo-Core/commit/83535b9)), closes [#60](https://github.com/PicGo/PicGo-Core/issues/60) - -## :tada: 1.4.12 (2020-11-04) - -### :bug: Bug Fixes - -- let tcyun error info more detail ([ddf645f](https://github.com/PicGo/PicGo-Core/commit/ddf645f)) -- not encode before uploading an image with url ([c0aee32](https://github.com/PicGo/PicGo-Core/commit/c0aee32)) -- qiniu error handler ([de94212](https://github.com/PicGo/PicGo-Core/commit/de94212)) - -## :tada: 1.4.11 (2020-07-12) - -### :bug: Bug Fixes - -- initailize db function error ([df7d526](https://github.com/PicGo/PicGo-Core/commit/df7d526)) - -## :tada: 1.4.10 (2020-06-28) - -### :bug: Bug Fixes - -- url image hash bug ([e405221](https://github.com/PicGo/PicGo-Core/commit/e405221)) - -## :tada: 1.4.9 (2020-06-27) - -### :sparkles: Features - -- add plugin running && error logs ([6adc070](https://github.com/PicGo/PicGo-Core/commit/6adc070)) -- **transformer:** add fallback to support more image formats such as HEIC ([0f5d2a9](https://github.com/PicGo/PicGo-Core/commit/0f5d2a9)), closes [#13](https://github.com/PicGo/PicGo-Core/issues/13) - -### :bug: Bug Fixes - -- multiline logs format ([444a42f](https://github.com/PicGo/PicGo-Core/commit/444a42f)) -- the issue of lost logs ([daa7508](https://github.com/PicGo/PicGo-Core/commit/daa7508)) -- the order of the uploaded list may not be the same as the order entered ([2bf1ed9](https://github.com/PicGo/PicGo-Core/commit/2bf1ed9)), closes [#40](https://github.com/PicGo/PicGo-Core/issues/40) -- unregisterPlugin's bug ([966bfd8](https://github.com/PicGo/PicGo-Core/commit/966bfd8)) - -### :package: Chore - -- add vscode workspace settings & migrate tslint to eslint ([50a4842](https://github.com/PicGo/PicGo-Core/commit/50a4842)) - -## :tada: 1.4.8 (2020-04-04) - -### :bug: Bug Fixes - -- encode url before finishing ([7a6b39c](https://github.com/PicGo/PicGo-Core/commit/7a6b39c)) -- return true if decodeURI throw error to avoid crash ([d09d77a](https://github.com/PicGo/PicGo-Core/commit/d09d77a)) -- win10 cmd crash bug when "picgo upload" ([#35](https://github.com/PicGo/PicGo-Core/issues/35)) ([deec252](https://github.com/PicGo/PicGo-Core/commit/deec252)) - -## :tada: 1.4.7 (2020-03-07) - -### :sparkles: Features - -- add smms-v2 support ([7e10655](https://github.com/PicGo/PicGo-Core/commit/7e10655)) -- remove weibo support ([96b2b3a](https://github.com/PicGo/PicGo-Core/commit/96b2b3a)) - -### :pencil: Documentation - -- update README ([aff6326](https://github.com/PicGo/PicGo-Core/commit/aff6326)) - -## :tada: 1.4.6 (2020-02-23) - -### :bug: Bug Fixes - -- auto generate a local png bug ([c54ac67](https://github.com/PicGo/PicGo-Core/commit/c54ac67)) - -## :tada: 1.4.5 (2020-02-23) - -### :sparkles: Features - -- add upload image from URL support ([0d87342](https://github.com/PicGo/PicGo-Core/commit/0d87342)) - -### :package: Chore - -- travis-ci deploy option ([a2a89cd](https://github.com/PicGo/PicGo-Core/commit/a2a89cd)) - -## :tada: 1.4.4 (2019-12-30) - -### :bug: Bug Fixes - -- image_repeated error from smms ([#28](https://github.com/PicGo/PicGo-Core/issues/28)) ([f246b8d](https://github.com/PicGo/PicGo-Core/commit/f246b8d)) - -## :tada: 1.4.3 (2019-12-27) - -### :sparkles: Features - -- add aliyun optionUrl option ([0a3bdea](https://github.com/PicGo/PicGo-Core/commit/0a3bdea)) - -## :tada: 1.4.2 (2019-12-26) - -### :bug: Bug Fixes - -- cli source ([be6cdcc](https://github.com/PicGo/PicGo-Core/commit/be6cdcc)) - -## :tada: 1.4.1 (2019-12-26) - -# :tada: 1.4.0 (2019-12-26) - -### :sparkles: Features - -- add config methods && pluginHandler to ctx ([f9bb9fb](https://github.com/PicGo/PicGo-Core/commit/f9bb9fb)) -- **plugin:** passing environment variables ([50467c7](https://github.com/PicGo/PicGo-Core/commit/50467c7)) - -### :bug: Bug Fixes - -- correct sm.ms err msg ([#18](https://github.com/PicGo/PicGo-Core/issues/18)) ([f0a4e8a](https://github.com/PicGo/PicGo-Core/commit/f0a4e8a)) -- pluginHandler args length error ([e15eac2](https://github.com/PicGo/PicGo-Core/commit/e15eac2)) - -### :package: Chore - -- **types:** added typings field to export type inform… ([#23](https://github.com/PicGo/PicGo-Core/issues/23)) ([8bb16e7](https://github.com/PicGo/PicGo-Core/commit/8bb16e7)) - -## :tada: 1.3.7 (2019-05-12) - -### :bug: Bug Fixes - -- **clipboard:** clipboard image getter error in macOS ([8314604](https://github.com/PicGo/PicGo-Core/commit/8314604)) - -## :tada: 1.3.6 (2019-04-20) - -### :bug: Bug Fixes - -- clipboard image upload under win10 ([48b72ed](https://github.com/PicGo/PicGo-Core/commit/48b72ed)) - -## :tada: 1.3.5 (2019-04-15) - -### :bug: Bug Fixes - -- writing log sometimes disappeared ([d36c0ae](https://github.com/PicGo/PicGo-Core/commit/d36c0ae)) - -### :package: Chore - -- add picgo bump version ([c312302](https://github.com/PicGo/PicGo-Core/commit/c312302)) diff --git a/libs/zhi-picgo-core/README.md b/libs/zhi-picgo-core/README.md deleted file mode 100644 index 4edf102..0000000 --- a/libs/zhi-picgo-core/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# zhi-picgo-core - -A tool for picture uploading forked from [PicGO-Core](https://github.com/PicGo/PicGo-Core), for electron usage. - -![picgo-core](https://cdn.jsdelivr.net/gh/Molunerfinn/test/picgo/picgo-core-fix.jpg) - -## Usage - -### Use in node project - -#### Common JS - -```js -const { PicGo } = require("picgo") -``` - -#### ES Module - -```js -import { PicGo } from "picgo" -``` - -#### API usage example - -```js -const picgo = new PicGo() - -// upload a picture from path -picgo.upload(["/xxx/xxx.jpg"]) - -// upload a picture from clipboard -picgo.upload() -``` - -### Use in electron - -```js -const { PicGo } = require("/Users/terwer/Documents/mydocs/zhi-framework/zhi/libs/zhi-picgo-core/dist/index.cjs.js") -const picgo = new PicGo() -console.log(picgo) -``` - -## Documentation - -For more details, you can checkout [documentation](https://picgo.github.io/PicGo-Core-Doc/). diff --git a/libs/zhi-picgo-core/dist/core/Lifecycle.d.ts b/libs/zhi-picgo-core/dist/core/Lifecycle.d.ts deleted file mode 100644 index d05bbbe..0000000 --- a/libs/zhi-picgo-core/dist/core/Lifecycle.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// -import { EventEmitter } from "events"; -import { IPicGo } from "../types"; -export declare class Lifecycle extends EventEmitter { - private readonly ctx; - constructor(ctx: IPicGo); - start(input: any[]): Promise; - private beforeTransform; - private doTransform; - private beforeUpload; - private doUpload; - private afterUpload; - private handlePlugins; -} -export default Lifecycle; diff --git a/libs/zhi-picgo-core/dist/core/PicGo.d.ts b/libs/zhi-picgo-core/dist/core/PicGo.d.ts deleted file mode 100644 index a0f9692..0000000 --- a/libs/zhi-picgo-core/dist/core/PicGo.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/// -import { EventEmitter } from "events"; -import Commander from "../lib/Commander"; -import { Logger } from "../lib/Logger"; -import { IHelper, IImgInfo, IPicGo, IStringKeyMap, IPluginLoader, II18nManager, IPicGoPlugin, IPicGoPluginInterface, IRequest } from "../types"; -import Request from "../lib/Request"; -import PluginHandler from "../lib/PluginHandler"; -export declare class PicGo extends EventEmitter implements IPicGo { - private _config; - private lifecycle; - private db; - private _pluginLoader; - configPath: string; - baseDir: string; - helper: IHelper; - log: Logger; - cmd: Commander; - output: IImgInfo[]; - input: any[]; - pluginHandler: PluginHandler; - /** - * @deprecated will be removed in v1.5.0+ - * - * use request instead - */ - Request: Request; - i18n: II18nManager; - VERSION: string; - GUI_VERSION?: string; - get pluginLoader(): IPluginLoader; - constructor(configPath?: string); - private initConfigPath; - private initConfig; - private init; - /** - * easily mannually load a plugin - * if provide plugin name, will register plugin by name - * or just instantiate a plugin - */ - use(plugin: IPicGoPlugin, name?: string): IPicGoPluginInterface; - registerCommands(): void; - getConfig(name?: string): T; - saveConfig(config: IStringKeyMap): void; - removeConfig(key: string, propName: string): void; - setConfig(config: IStringKeyMap): void; - unsetConfig(key: string, propName: string): void; - get request(): IRequest["request"]; - upload(input?: any[]): Promise; -} diff --git a/libs/zhi-picgo-core/dist/i18n/en.d.ts b/libs/zhi-picgo-core/dist/i18n/en.d.ts deleted file mode 100644 index 8150461..0000000 --- a/libs/zhi-picgo-core/dist/i18n/en.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { ILocales } from "./zh-CN"; -export declare const EN: ILocales; diff --git a/libs/zhi-picgo-core/dist/i18n/index.d.ts b/libs/zhi-picgo-core/dist/i18n/index.d.ts deleted file mode 100644 index d7c103d..0000000 --- a/libs/zhi-picgo-core/dist/i18n/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { ILocalesKey } from "./zh-CN"; -import { IPicGo } from "../types"; -import { IStringKeyMap, II18nManager } from "../types/index"; -import { ILocale } from "@picgo/i18n/dist/types"; -declare class I18nManager implements II18nManager { - private readonly i18n; - private readonly objectAdapter; - private readonly ctx; - constructor(ctx: IPicGo); - private loadOutterI18n; - private getOutterI18nFolder; - translate(key: ILocalesKey | T, args?: IStringKeyMap): string; - setLanguage(language: string): void; - addLocale(language: string, locales: ILocale): boolean; - addLanguage(language: string, locales: ILocale): boolean; - getLanguageList(): string[]; -} -export { I18nManager }; diff --git a/libs/zhi-picgo-core/dist/i18n/zh-CN.d.ts b/libs/zhi-picgo-core/dist/i18n/zh-CN.d.ts deleted file mode 100644 index 4d9e3ed..0000000 --- a/libs/zhi-picgo-core/dist/i18n/zh-CN.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -export declare const ZH_CN: { - UPLOAD_FAILED: string; - CHECK_SETTINGS: string; - CHECK_SETTINGS_AND_NETWORK: string; - UPLOAD_FAILED_REASON: string; - SERVER_ERROR: string; - AUTH_FAILED: string; - PICBED_SMMS: string; - PICBED_SMMS_TOKEN: string; - PICBED_SMMS_BACKUP_DOMAIN: string; - PICBED_SMMS_MESSAGE_BACKUP_DOMAIN: string; - PICBED_ALICLOUD: string; - PICBED_ALICLOUD_ACCESSKEYID: string; - PICBED_ALICLOUD_ACCESSKEYSECRET: string; - PICBED_ALICLOUD_BUCKET: string; - PICBED_ALICLOUD_AREA: string; - PICBED_ALICLOUD_PATH: string; - PICBED_ALICLOUD_CUSTOMURL: string; - PICBED_ALICLOUD_OPTIONS: string; - PICBED_ALICLOUD_MESSAGE_AREA: string; - PICBED_ALICLOUD_MESSAGE_PATH: string; - PICBED_ALICLOUD_MESSAGE_OPTIONS: string; - PICBED_ALICLOUD_MESSAGE_CUSTOMURL: string; - PICBED_TENCENTCLOUD: string; - PICBED_TENCENTCLOUD_VERSION: string; - PICBED_TENCENTCLOUD_SECRETID: string; - PICBED_TENCENTCLOUD_SECRETKEY: string; - PICBED_TENCENTCLOUD_APPID: string; - PICBED_TENCENTCLOUD_BUCKET: string; - PICBED_TENCENTCLOUD_AREA: string; - PICBED_TENCENTCLOUD_PATH: string; - PICBED_TENCENTCLOUD_OPTIONS: string; - PICBED_TENCENTCLOUD_CUSTOMURL: string; - PICBED_TENCENTCLOUD_MESSAGE_APPID: string; - PICBED_TENCENTCLOUD_MESSAGE_AREA: string; - PICBED_TENCENTCLOUD_MESSAGE_PATH: string; - PICBED_TENCENTCLOUD_MESSAGE_CUSTOMURL: string; - PICBED_TENCENTCLOUD_MESSAGE_OPTIONS: string; - PICBED_GITHUB: string; - PICBED_GITHUB_TOKEN: string; - PICBED_GITHUB_REPO: string; - PICBED_GITHUB_PATH: string; - PICBED_GITHUB_BRANCH: string; - PICBED_GITHUB_CUSTOMURL: string; - PICBED_GITHUB_MESSAGE_REPO: string; - PICBED_GITHUB_MESSAGE_BRANCH: string; - PICBED_GITHUB_MESSAGE_PATH: string; - PICBED_GITHUB_MESSAGE_CUSTOMURL: string; - PICBED_QINIU: string; - PICBED_QINIU_ACCESSKEY: string; - PICBED_QINIU_SECRETKEY: string; - PICBED_QINIU_BUCKET: string; - PICBED_QINIU_PATH: string; - PICBED_QINIU_URL: string; - PICBED_QINIU_OPTIONS: string; - PICBED_QINIU_AREA: string; - PICBED_QINIU_MESSAGE_PATH: string; - PICBED_QINIU_MESSAGE_AREA: string; - PICBED_QINIU_MESSAGE_OPTIONS: string; - PICBED_QINIU_MESSAGE_URL: string; - PICBED_IMGUR: string; - PICBED_IMGUR_CLIENTID: string; - PICBED_IMGUR_PROXY: string; - PICBED_IMGUR_MESSAGE_PROXY: string; - PICBED_UPYUN: string; - PICBED_UPYUN_BUCKET: string; - PICBED_UPYUN_OPERATOR: string; - PICBED_UPYUN_PASSWORD: string; - PICBED_UPYUN_PATH: string; - PICBED_UPYUN_URL: string; - PICBED_UPYUN_OPTIONS: string; - PICBED_UPYUN_MESSAGE_OPERATOR: string; - PICBED_UPYUN_MESSAGE_PASSWORD: string; - PICBED_UPYUN_MESSAGE_URL: string; - PICBED_UPYUN_MESSAGE_OPTIONS: string; - PICBED_UPYUN_MESSAGE_PATH: string; - PLUGIN_HANDLER_PLUGIN_INSTALL_SUCCESS: string; - PLUGIN_HANDLER_PLUGIN_INSTALL_FAILED: string; - PLUGIN_HANDLER_PLUGIN_INSTALL_FAILED_REASON: string; - PLUGIN_HANDLER_PLUGIN_INSTALL_FAILED_PATH: string; - PLUGIN_HANDLER_PLUGIN_UNINSTALL_SUCCESS: string; - PLUGIN_HANDLER_PLUGIN_UNINSTALL_FAILED: string; - PLUGIN_HANDLER_PLUGIN_UNINSTALL_FAILED_REASON: string; - PLUGIN_HANDLER_PLUGIN_UNINSTALL_FAILED_VALID: string; - PLUGIN_HANDLER_PLUGIN_UPDATE_SUCCESS: string; - PLUGIN_HANDLER_PLUGIN_UPDATE_FAILED: string; - PLUGIN_HANDLER_PLUGIN_UPDATE_FAILED_REASON: string; - PLUGIN_HANDLER_PLUGIN_UPDATE_FAILED_VALID: string; -}; -export type ILocalesKey = keyof typeof ZH_CN; -export type ILocales = typeof ZH_CN; diff --git a/libs/zhi-picgo-core/dist/i18n/zh-TW.d.ts b/libs/zhi-picgo-core/dist/i18n/zh-TW.d.ts deleted file mode 100644 index 45f1c0e..0000000 --- a/libs/zhi-picgo-core/dist/i18n/zh-TW.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { ILocales } from "./zh-CN"; -export declare const ZH_TW: ILocales; diff --git a/libs/zhi-picgo-core/dist/index.cjs.js b/libs/zhi-picgo-core/dist/index.cjs.js deleted file mode 100644 index 7c7cfc9..0000000 --- a/libs/zhi-picgo-core/dist/index.cjs.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("fs-extra"),t=require("path"),n=require("events"),r=require("os"),i=require("commander"),s=require("inquirer"),a=require("image-size"),o=require("url"),l=require("chalk"),u=require("minimatch"),c=require("globby"),d=require("ejs"),p=require("download-git-repo"),g=require("rimraf"),E=require("dayjs"),_=require("util"),I=require("crypto"),f=require("mime-types"),h=require("qiniu"),P=require("ali-oss"),C=require("stream"),m=require("arraybuffer-to-buffer"),U=require("md5"),N=require("upyun"),L=require("resolve"),S=require("lodash"),D=require("child_process"),A=require("is-wsl"),T=require("axios"),y=require("form-data"),O=require("https"),B=require("tunnel"),b=require("@picgo/store"),x=require("cross-spawn"),w=require("js-yaml"),R=require("@picgo/i18n");function G(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var $=G(e),v=G(t),M=G(r),H=G(s),F=G(l),q=G(u),k=G(c),K=G(d),Y=G(p),j=G(g),Q=G(E),W=G(_),z=G(I),V=G(f),J=G(h),X=G(P),Z=G(m),ee=G(U),te=G(N),ne=G(L),re=G(A),ie=G(T),se=G(y),ae=G(O),oe=G(B),le=G(x),ue=G(w);const ce={handle:e=>{const t=e.cmd;t.program.command("install ").description("install picgo plugin").alias("add").option("-p, --proxy ","Add proxy for installing").option("-r, --registry ","Choose a registry for installing").action(((t,n)=>{const{proxy:r,registry:i}=n,s={proxy:r,registry:i};e.pluginHandler.install(t,s).catch((t=>{e.log.error(t)}))})),t.program.command("uninstall ").alias("rm").description("uninstall picgo plugin").action((t=>{e.pluginHandler.uninstall(t).catch((t=>{e.log.error(t)}))})),t.program.command("update ").description("update picgo plugin").option("-p, --proxy ","Add proxy for installing").option("-r, --registry ","Choose a registry for installing").action(((t,n)=>{const{proxy:r,registry:i}=n,s={proxy:r,registry:i};e.pluginHandler.update(t,s).catch((t=>{e.log.error(t)}))}))}},de={handle:e=>{e.cmd.program.option("-c, --config ","set config path")}},pe=e=>e.startsWith("http://")||e.startsWith("https://"),ge=e=>((e=>{e=e||"";try{return e!==decodeURI(e)}catch(e){return!0}})(e)||(e=encodeURI(e)),e),Ee=e=>{try{const{width:t=0,height:n=0}=a.imageSize(e);return{real:!0,width:t,height:n}}catch(e){return{real:!1,width:200,height:200}}},_e=e=>/^@[^/]+\/picgo-plugin-/.test(e)?"scope":e.startsWith("picgo-plugin-")?"normal":Ie(e)?"simple":"unknown",Ie=e=>{if(v.default.isAbsolute(e))return!1;const t=v.default.join(process.cwd(),e);return!$.default.existsSync(t)&&(!e.includes("/")&&!e.includes("\\"))},fe=(e,t="")=>t?`@${t}/picgo-plugin-${e}`:`picgo-plugin-${e}`,he=e=>e.split(v.default.sep).join("/"),Pe=(e,t=!1)=>{if(e.includes("@")){let n=/(.+\/)?(picgo-plugin-\w+)(@.+)*/;t&&(n=/(.+\/)?(^@[^/]+\/picgo-plugin-\w+)(@.+)*/);const r=e.match(n);return r?r[2]:(console.warn("can not remove plugin version"),e)}return e},Ce=[],me=e=>Ce.some((t=>e.startsWith(t))),Ue=e=>"object"==typeof e&&!Array.isArray(e)&&Object.keys(e).length>0;function Ne(e){try{return JSON.parse(e)}catch(t){return e}}const Le={handle:e=>{e.cmd.program.command("upload").description("upload, go go go").arguments("[input...]").alias("u").action((t=>{(async()=>{const n=t.map((e=>pe(e)?e:v.default.resolve(e))).filter((t=>{const n=$.default.existsSync(t)||pe(t);return n||e.log.warn(`${t} does not exist.`),n}));await e.upload(n)})().catch((t=>{e.log.error(t)}))}))}},Se=async(e,t,n,r)=>{const i=await e.cmd.inquirer.prompt(t),s="uploader"===n?`picBed.${r}`:"transformer"===n?`transformer.${r}`:r;e.saveConfig({[s]:i})},De={handle:e=>{e.cmd.program.command("set").alias("config").arguments(" [name]").description("configure config of picgo modules").action(((t,n)=>{(async()=>{var r,i;try{switch(t){case"uploader":case"transformer":if(n){const r=e.helper[t].get(n);if(!r)return e.log.error(`No ${t} named ${n}`);r.config&&await Se(e,r.config(e),t,n)}else{const n=[{type:"list",name:`${t}`,choices:e.helper[t].getIdList(),message:`Choose a(n) ${t}`}],r=await e.cmd.inquirer.prompt(n),i=e.helper[t].get(r[t]);(null==i?void 0:i.config)&&await Se(e,i.config(e),t,r[t])}break;case"plugin":if(n){if(n.includes("picgo-plugin-")||(n=`picgo-plugin-${n}`),!Object.keys(e.getConfig("picgoPlugins")).includes(n))return e.log.error(`No plugin named ${n}`);(null===(r=e.pluginLoader.getPlugin(n))||void 0===r?void 0:r.config)&&await Se(e,e.pluginLoader.getPlugin(n).config(e),"plugin",n)}else{const t=[{type:"list",name:"plugin",choices:e.pluginLoader.getFullList(),message:"Choose a plugin"}],n=await e.cmd.inquirer.prompt(t);(null===(i=e.pluginLoader.getPlugin(n.plugin))||void 0===i?void 0:i.config)&&await Se(e,e.pluginLoader.getPlugin(n.plugin).config(e),"plugin",n.plugin)}break;default:return e.log.warn(`No module named ${t}`),e.log.warn("Available modules are uploader|transformer|plugin")}const s="plugin"===t?"plugins":t;e.log.success("Configure config successfully!"),e.log.info(`If you want to use this config, please run 'picgo use ${s}'`)}catch(t){if(e.log.error(t),process.argv.includes("--debug"))throw t}})().catch((t=>{e.log.error(t)}))}))}},Ae={handle:async e=>{const t=e.cmd;t.program.command("use").arguments("[module]").description("use modules of picgo").action((n=>{(async()=>{try{let r=[];const i={uploader:{type:"list",name:"uploader",message:"Use an uploader",choices:e.helper.uploader.getIdList(),default:e.getConfig("picBed.uploader")||e.getConfig("picBed.current")||"github"},transformer:{type:"list",name:"transformer",message:"Use a transformer",choices:e.helper.transformer.getIdList(),default:e.getConfig("picBed.transformer")||"path"},plugins:{type:"checkbox",name:"plugins",message:"Use plugins",choices:e.pluginLoader.getFullList(),default:Object.keys(e.getConfig("picgoPlugins")).filter((t=>e.getConfig(`picgoPlugins.${t}`)))}};if(n){if(!i[n])return e.log.warn(`No module named ${n}`),e.log.warn("Available modules are uploader|transformer|plugins");r.push(i[n])}else r=Object.keys(i).map((e=>i[e]));const s=await t.inquirer.prompt(r);if(s.plugins){const t=e.getConfig("picgoPlugins");Object.keys(t).map((e=>{s.plugins.includes(e)?t[e]=!0:t[e]=!1})),e.saveConfig({picgoPlugins:t})}e.saveConfig({"picBed.current":s.uploader||e.getConfig("picBed.current"),"picBed.uploader":s.uploader||e.getConfig("picBed.current"),"picBed.transformer":s.transformer||"path"}),e.log.success("Configure config successfully!")}catch(t){if(e.log.error(t),process.argv.includes("--debug"))throw t}})().catch((t=>{e.log.error(t)}))}))}},Te={handle:e=>{e.cmd.program.option("-p, --proxy ","set proxy for uploading",(t=>{e.setConfig({"picBed.proxy":t})}))}},ye=async(e,t)=>{try{const n=Be(t.tmp),r=v.default.join(t.tmp,"template");let i={};n.prompts&&n.prompts.length>0&&(i=await e.cmd.inquirer.prompt(n.prompts));let s=await k.default(["**/*"],{cwd:r,dot:!0});if(s=s.filter((t=>{let r="";return Object.keys(n.filters).forEach((e=>{q.default(t,e,{dot:!0})&&(r=t)})),!r||Oe(e,n.filters[r],i)})),0===s.length)return e.log.warn("Template files not found!");const a=be(s,r,i);xe(t.dest,a),"function"==typeof n.complete&&n.complete({answers:i,options:t,files:s,ctx:e}),n.completeMessage&&e.log.success(n.completeMessage),e.log.success("Done!")}catch(t){return e.log.error(t)}},Oe=(e,t,n)=>{const r=new Function("data","with (data) { return "+t+"}");try{return r(n)}catch(n){return e.log.error(`Error when evaluating filter condition: ${JSON.stringify(t)}`),!1}},Be=e=>{const t=v.default.join(e,"index.js");if($.default.existsSync(t)){return require(t)}return{}},be=(e,t,n)=>{const r={};return e.forEach((e=>{const i=$.default.readFileSync(v.default.join(t,e),"utf8"),s=K.default.render(i,n);(Buffer.isBuffer(s)||/[^\s]/.test(s))&&(r[e]=s)})),r},xe=(e,t)=>{Object.keys(t).forEach((n=>{const r=v.default.join(e,n);$.default.ensureDirSync(v.default.dirname(r)),$.default.writeFileSync(r,t[n])}))},we=(e,t)=>{t.offline?$.default.existsSync(t.template)?ye(e,t).catch((t=>{e.log.error(t)})):e.log.error(`Local template ${t.template} not found`):(t.template=t.hasSlash?t.template:"PicGo/picgo-template-"+t.template,Re(e,t))},Re=(e,t)=>{$.default.existsSync(t.tmp)&&j.default.sync(t.tmp),e.log.info("Template files are downloading..."),Y.default(t.template,t.tmp,{clone:t.clone},(n=>{if(n)return e.log.error(n);e.log.success("Template files are downloaded!"),ye(e,t).catch((t=>{e.log.error(t)}))}))},Ge={handle:async e=>{e.cmd.program.command("init").arguments("