picgo 1.5.10 → 1.6.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.
Files changed (60) hide show
  1. package/.github/workflows/release.yml +60 -0
  2. package/.node-version +1 -1
  3. package/CHANGELOG.md +20 -0
  4. package/README.md +1 -1
  5. package/dist/core/Lifecycle.d.ts +14 -15
  6. package/dist/core/PicGo.d.ts +48 -49
  7. package/dist/i18n/en.d.ts +2 -2
  8. package/dist/i18n/index.d.ts +18 -18
  9. package/dist/i18n/zh-CN.d.ts +97 -97
  10. package/dist/i18n/zh-TW.d.ts +2 -2
  11. package/dist/index.cjs.js +2 -2
  12. package/dist/index.cjs.js.map +1 -0
  13. package/dist/index.d.ts +10 -10
  14. package/dist/index.esm.js +2 -2
  15. package/dist/index.esm.js.map +1 -0
  16. package/dist/lib/Commander.d.ts +22 -22
  17. package/dist/lib/LifecyclePlugins.d.ts +17 -17
  18. package/dist/lib/Logger.d.ts +19 -19
  19. package/dist/lib/PluginHandler.d.ts +10 -10
  20. package/dist/lib/PluginLoader.d.ts +27 -27
  21. package/dist/lib/Request.d.ts +12 -12
  22. package/dist/plugins/commander/config.d.ts +3 -3
  23. package/dist/plugins/commander/i18n.d.ts +3 -3
  24. package/dist/plugins/commander/index.d.ts +3 -3
  25. package/dist/plugins/commander/init.d.ts +3 -3
  26. package/dist/plugins/commander/pluginHandler.d.ts +3 -3
  27. package/dist/plugins/commander/proxy.d.ts +3 -3
  28. package/dist/plugins/commander/setting.d.ts +5 -5
  29. package/dist/plugins/commander/upload.d.ts +3 -3
  30. package/dist/plugins/commander/use.d.ts +3 -3
  31. package/dist/plugins/transformer/base64.d.ts +5 -5
  32. package/dist/plugins/transformer/index.d.ts +3 -3
  33. package/dist/plugins/transformer/path.d.ts +5 -5
  34. package/dist/plugins/uploader/aliyun.d.ts +2 -2
  35. package/dist/plugins/uploader/github.d.ts +2 -2
  36. package/dist/plugins/uploader/imgur.d.ts +2 -2
  37. package/dist/plugins/uploader/index.d.ts +3 -3
  38. package/dist/plugins/uploader/qiniu.d.ts +2 -2
  39. package/dist/plugins/uploader/smms.d.ts +2 -2
  40. package/dist/plugins/uploader/tcyun.d.ts +8 -8
  41. package/dist/plugins/uploader/upyun.d.ts +2 -2
  42. package/dist/types/index.d.ts +540 -542
  43. package/dist/types/oldRequest.d.ts +19 -19
  44. package/dist/utils/common.d.ts +118 -106
  45. package/dist/utils/createContext.d.ts +6 -6
  46. package/dist/utils/db.d.ts +15 -15
  47. package/dist/utils/enum.d.ts +27 -27
  48. package/dist/utils/eventBus.d.ts +3 -4
  49. package/dist/utils/getClipboardImage.d.ts +4 -4
  50. package/dist/utils/initUtils.d.ts +26 -26
  51. package/dist/utils/interfaces.d.ts +202 -203
  52. package/dist/utils/static.d.ts +1 -1
  53. package/eslint.config.js +134 -0
  54. package/package.json +39 -37
  55. package/rollup.config.js +59 -66
  56. package/.eslintignore +0 -2
  57. package/.eslintrc.js +0 -25
  58. package/.github/workflows/alpha.yml +0 -22
  59. package/.github/workflows/main.yml +0 -22
  60. package/.github/workflows/manually.yml +0 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "picgo",
3
- "version": "1.5.10",
3
+ "version": "1.6.0",
4
4
  "description": "A tool for picture uploading",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -11,18 +11,6 @@
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
14
- "scripts": {
15
- "start": "node ./bin/picgo",
16
- "lint": "eslint src/**/*.ts && npm run build",
17
- "test": "echo \"Error: no test specified\" && exit 1",
18
- "build": "cross-env NODE_ENV=production rimraf ./dist && rollup -c rollup.config.js",
19
- "dev": "cross-env NODE_ENV=development rollup -c rollup.config.js -w",
20
- "patch": "npm version patch && git push origin master && git push origin --tags",
21
- "minor": "npm version minor && git push origin master && git push origin --tags",
22
- "major": "npm version major && git push origin master && git push origin --tags",
23
- "cz": "git-cz",
24
- "release": "bump-version"
25
- },
26
14
  "keywords": [
27
15
  "picture",
28
16
  "upload",
@@ -50,14 +38,18 @@
50
38
  "author": "Molunerfinn",
51
39
  "license": "MIT",
52
40
  "devDependencies": {
53
- "@picgo/bump-version": "^1.1.2",
54
- "@rollup/plugin-commonjs": "^21.0.0",
55
- "@rollup/plugin-json": "^4.1.0",
56
- "@rollup/plugin-node-resolve": "^13.0.5",
57
- "@rollup/plugin-replace": "^3.0.0",
41
+ "@eslint/js": "^9.39.1",
42
+ "@picgo/bump-version": "^2.0.0",
43
+ "@rollup/plugin-commonjs": "^29.0.0",
44
+ "@rollup/plugin-json": "^6.1.0",
45
+ "@rollup/plugin-node-resolve": "^16.0.3",
46
+ "@rollup/plugin-replace": "^6.0.3",
47
+ "@rollup/plugin-terser": "^0.4.4",
48
+ "@rollup/plugin-typescript": "^12.3.0",
58
49
  "@types/cross-spawn": "^6.0.0",
59
50
  "@types/ejs": "^3.0.5",
60
51
  "@types/fs-extra": "^5.0.4",
52
+ "@types/glob": "^7.2.0",
61
53
  "@types/image-size": "^0.0.29",
62
54
  "@types/inquirer": "^0.0.42",
63
55
  "@types/js-yaml": "^4.0.5",
@@ -65,32 +57,29 @@
65
57
  "@types/md5": "^2.1.32",
66
58
  "@types/mime-types": "^2.1.0",
67
59
  "@types/minimatch": "^3.0.3",
68
- "@types/node": "16.11.7",
60
+ "@types/node": "20.19.26",
69
61
  "@types/resolve": "^0.0.8",
70
62
  "@types/rimraf": "^3.0.0",
71
63
  "@types/tunnel": "^0.0.3",
72
- "@typescript-eslint/eslint-plugin": "3",
73
- "@typescript-eslint/parser": "^3.2.0",
74
- "babel-eslint": "^10.1.0",
75
- "builtins": "^4.0.0",
64
+ "@typescript-eslint/eslint-plugin": "^8.49.0",
65
+ "@typescript-eslint/parser": "^8.49.0",
66
+ "commitizen": "^4.3.1",
76
67
  "conventional-changelog": "^3.0.6",
77
68
  "copyfiles": "^2.1.0",
78
69
  "cross-env": "^7.0.3",
79
70
  "cz-customizable": "^5.10.0",
80
- "eslint": "7",
81
- "eslint-config-standard-with-typescript": "^18.0.2",
82
- "eslint-plugin-import": "2",
83
- "eslint-plugin-node": "11",
84
- "eslint-plugin-promise": "4",
85
- "eslint-plugin-standard": "4",
71
+ "eslint": "^9.39.1",
72
+ "eslint-config-prettier": "^10.1.8",
73
+ "eslint-plugin-import": "^2.32.0",
74
+ "eslint-plugin-promise": "^7.2.1",
86
75
  "execa": "^5.1.1",
87
- "husky": "^1.3.1",
76
+ "globals": "^16.5.0",
77
+ "husky": "^9.1.7",
88
78
  "pre-commit": "^1.2.2",
89
- "rollup": "^2.58.0",
79
+ "rollup": "^4.53.3",
80
+ "rollup-plugin-copy": "^3.5.0",
90
81
  "rollup-plugin-string": "^3.0.0",
91
- "rollup-plugin-terser": "^7.0.2",
92
- "rollup-plugin-typescript2": "^0.30.0",
93
- "typescript": "^4.8.2"
82
+ "typescript": "^5.9.3"
94
83
  },
95
84
  "dependencies": {
96
85
  "@picgo/i18n": "^1.0.0",
@@ -103,6 +92,7 @@
103
92
  "dayjs": "^1.7.4",
104
93
  "download-git-repo": "^3.0.2",
105
94
  "ejs": "^2.6.1",
95
+ "form-data": "^4.0.5",
106
96
  "fs-extra": "^6.0.1",
107
97
  "globby": "^11.0.4",
108
98
  "image-size": "^0.8.3",
@@ -116,7 +106,7 @@
116
106
  "minimist": "^1.2.5",
117
107
  "qiniu": "^7.2.1",
118
108
  "resolve": "^1.8.1",
119
- "rimraf": "^3.0.2",
109
+ "rimraf": "^6.1.2",
120
110
  "tunnel": "^0.0.6"
121
111
  },
122
112
  "repository": {
@@ -128,6 +118,18 @@
128
118
  },
129
119
  "plugins": {},
130
120
  "engines": {
131
- "node": ">= 12.0.0"
121
+ "node": ">= 20.0.0"
122
+ },
123
+ "scripts": {
124
+ "start": "node ./bin/picgo",
125
+ "lint": "eslint src --ext .ts",
126
+ "test": "echo \"Error: no test specified\" && exit 1",
127
+ "build": "cross-env NODE_ENV=production rimraf ./dist && rollup -c rollup.config.js",
128
+ "dev": "cross-env NODE_ENV=development rollup -c rollup.config.js -w",
129
+ "patch": "npm version patch && git push origin master && git push origin --tags",
130
+ "minor": "npm version minor && git push origin master && git push origin --tags",
131
+ "major": "npm version major && git push origin master && git push origin --tags",
132
+ "cz": "git-cz",
133
+ "release": "bump-version"
132
134
  }
133
- }
135
+ }
package/rollup.config.js CHANGED
@@ -1,13 +1,19 @@
1
- import { terser } from 'rollup-plugin-terser'
2
- import pkg from './package.json'
3
- import typescript from 'rollup-plugin-typescript2'
1
+ import { readFileSync, existsSync } from 'node:fs'
2
+ import { builtinModules } from 'node:module'
3
+ import terser from '@rollup/plugin-terser'
4
+
4
5
  import commonjs from '@rollup/plugin-commonjs'
5
- import { string } from 'rollup-plugin-string'
6
6
  import json from '@rollup/plugin-json'
7
- import builtins from 'builtins'
7
+ import { nodeResolve } from '@rollup/plugin-node-resolve'
8
8
  import replace from '@rollup/plugin-replace'
9
+ import typescript from '@rollup/plugin-typescript'
10
+ import copy from 'rollup-plugin-copy'
11
+ import { string } from 'rollup-plugin-string'
12
+
13
+ const pkg = JSON.parse(readFileSync('./package.json', 'utf8'))
14
+
9
15
  const version = process.env.VERSION || pkg.version
10
- const sourcemap = 'inline'
16
+ const sourcemap = true
11
17
  const banner = `/*
12
18
  * picgo@${version}, https://github.com/PicGo/PicGo-Core
13
19
  * (c) 2018-${new Date().getFullYear()} PicGo Group
@@ -15,73 +21,60 @@ const banner = `/*
15
21
  */`
16
22
  const input = './src/index.ts'
17
23
 
18
- const commonOptions = {
19
- // Creating regex of the packages to make sure sub-paths of the
20
- // packages such as `lowdb/adapters/FileSync` are also treated as external
21
- // See https://github.com/rollup/rollup/issues/3684#issuecomment-926558056
22
- external: [
23
- ...Object.keys(pkg.dependencies),
24
- ...builtins()
25
- ].map(packageName => new RegExp(`^${packageName}(/.*)?`)),
26
- plugins: [
27
- typescript({
28
- tsconfigOverride: {
29
- compilerOptions: {
30
- target: 'ES2017',
31
- module: 'ES2015'
32
- }
33
- }
34
- }),
35
- // terser(),
36
- commonjs(),
37
- string({
38
- // Required to be specified
39
- include: [
40
- '**/*.applescript',
41
- '**/*.ps1',
42
- '**/*.sh'
43
- ]
44
- }),
45
- json(),
46
- replace({
47
- 'process.env.PICGO_VERSION': JSON.stringify(pkg.version),
48
- preventAssignment: true
49
- })
50
- ],
51
- input
52
- }
24
+ const external = [
25
+ ...(Object.keys(pkg.dependencies || {}).map(packageName => new RegExp(`^${packageName}(/.*)?`))),
26
+ ...builtinModules.map(moduleName => new RegExp(`^(node:)?${moduleName}(/.*)?`))
27
+ ]
53
28
 
54
- const isDev = process.env.NODE_ENV === 'development'
29
+ const plugins = [
30
+ typescript({ tsconfig: './tsconfig.json' }),
31
+ commonjs(),
32
+ nodeResolve({ preferBuiltins: true }),
33
+ string({
34
+ include: ['**/*.applescript', '**/*.ps1', '**/*.sh']
35
+ }),
36
+ json(),
37
+ replace({
38
+ 'process.env.PICGO_VERSION': JSON.stringify(pkg.version),
39
+ preventAssignment: true
40
+ })
41
+ ]
55
42
 
56
- if (!isDev) {
57
- commonOptions.plugins.push(terser())
43
+ if (existsSync('assets')) {
44
+ plugins.splice(1, 0, copy({ targets: [{ src: 'assets', dest: 'dist' }] }))
58
45
  }
59
46
 
60
- /** @type import('rollup').RollupOptions */
61
- const nodeCjs = {
62
- output: [{
63
- file: 'dist/index.cjs.js',
64
- format: 'cjs',
65
- banner,
66
- sourcemap
67
- }],
68
- ...commonOptions
47
+ const isDev = process.env.NODE_ENV === 'development'
48
+ const commonOptions = {
49
+ external,
50
+ plugins,
51
+ input
69
52
  }
70
53
 
71
- const nodeEsm = {
72
- output: [{
73
- file: 'dist/index.esm.js',
74
- format: 'esm',
75
- banner,
76
- sourcemap
77
- }],
78
- ...commonOptions
54
+ if (!isDev) {
55
+ commonOptions.plugins.push(terser())
79
56
  }
80
57
 
81
- const bundles = []
82
- const env = process.env.BUNDLES || ''
83
- if (env.includes('cjs')) bundles.push(nodeCjs)
84
- if (env.includes('esm')) bundles.push(nodeEsm)
85
- if (bundles.length === 0) bundles.push(nodeCjs, nodeEsm)
58
+ /** @type import('rollup').RollupOptions[] */
59
+ const bundles = [
60
+ {
61
+ output: [{
62
+ file: 'dist/index.cjs.js',
63
+ format: 'cjs',
64
+ banner,
65
+ sourcemap
66
+ }],
67
+ ...commonOptions
68
+ },
69
+ {
70
+ output: [{
71
+ file: 'dist/index.esm.js',
72
+ format: 'esm',
73
+ banner,
74
+ sourcemap
75
+ }],
76
+ ...commonOptions
77
+ }
78
+ ]
86
79
 
87
80
  export default bundles
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- node_modules
2
- dist
package/.eslintrc.js DELETED
@@ -1,25 +0,0 @@
1
- module.exports = {
2
- extends: 'standard-with-typescript',
3
- parserOptions: {
4
- project: './tsconfig.json'
5
- },
6
- rules: {
7
- '@typescript-eslint/strict-boolean-expressions': 0,
8
- // https://github.com/typescript-eslint/typescript-eslint/blob/ef88a696a157f617d38ce6d49207a4a4a089a19b/packages/eslint-plugin/docs/rules/naming-convention.md#enforce-that-interface-names-do-not-begin-with-an-i
9
- '@typescript-eslint/naming-convention': [
10
- 'error',
11
- {
12
- selector: 'interface',
13
- format: ['PascalCase'],
14
- custom: {
15
- regex: '^I[A-Z]',
16
- match: true
17
- }
18
- }
19
- ],
20
- '@typescript-eslint/prefer-nullish-coalescing': 0,
21
- '@typescript-eslint/return-await': 0,
22
- '@typescript-eslint/no-floating-promises': 0,
23
- '@typescript-eslint/no-non-null-assertion': 0
24
- }
25
- }
@@ -1,22 +0,0 @@
1
- name: publish
2
- on:
3
- push:
4
- branches:
5
- - alpha
6
- jobs:
7
- build:
8
- runs-on: ubuntu-latest
9
- steps:
10
- - name: Clone repo
11
- uses: actions/checkout@v1
12
- - name: Setup node
13
- uses: actions/setup-node@v1
14
- with:
15
- node-version: '16.x'
16
- registry-url: 'https://registry.npmjs.org'
17
- - name: Install modules
18
- run: yarn
19
- - run: npm run build
20
- - run: npm publish --tag alpha --access public
21
- env:
22
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,22 +0,0 @@
1
- name: publish
2
- on:
3
- push:
4
- branches:
5
- - master
6
- jobs:
7
- build:
8
- runs-on: ubuntu-latest
9
- steps:
10
- - name: Clone repo
11
- uses: actions/checkout@v1
12
- - name: Setup node
13
- uses: actions/setup-node@v1
14
- with:
15
- node-version: '16.x'
16
- registry-url: 'https://registry.npmjs.org'
17
- - name: Install modules
18
- run: yarn
19
- - run: npm run build
20
- - run: npm publish --access public
21
- env:
22
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,19 +0,0 @@
1
- name: manually-trigger
2
- on: workflow_dispatch
3
- jobs:
4
- build:
5
- runs-on: ubuntu-latest
6
- steps:
7
- - name: Clone repo
8
- uses: actions/checkout@v1
9
- - name: Setup node
10
- uses: actions/setup-node@v1
11
- with:
12
- node-version: '16.x'
13
- registry-url: 'https://registry.npmjs.org'
14
- - name: Install modules
15
- run: yarn
16
- - run: npm run build
17
- - run: npm publish --access public
18
- env:
19
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}