piclist 2.0.3 → 2.0.5

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.
@@ -1,5 +1,5 @@
1
1
  import { IPicGo } from '../../types';
2
- export declare function formatPathHelper({ path, startSlash, endSlash, rootToEmpty }: {
2
+ export declare function formatPathHelper({ path, startSlash, endSlash, rootToEmpty, }: {
3
3
  path?: string;
4
4
  startSlash?: boolean;
5
5
  endSlash?: boolean;
@@ -139,6 +139,7 @@ export interface IImgInfo {
139
139
  height?: number;
140
140
  extname?: string;
141
141
  imgUrl?: string;
142
+ filePath?: string;
142
143
  [propName: string]: any;
143
144
  }
144
145
  export interface IPathTransformedImgInfo extends IImgInfo {
@@ -252,6 +253,8 @@ export interface IGithubConfig {
252
253
  token: string;
253
254
  /** 自定义存储路径,比如 `img/` */
254
255
  path: string;
256
+ /** 网站路径,用于拼接网址路径 */
257
+ webPath?: string;
255
258
  /** 自定义域名,注意要加 `http://` 或者 `https://` */
256
259
  customUrl: string;
257
260
  /** 分支名,默认是 `main` */
@@ -538,49 +541,27 @@ export type availableConvertFormat = keyof FormatEnum;
538
541
  export type availableWatermarkPosition = keyof GravityEnum;
539
542
  export interface IBuildInWaterMarkOptions {
540
543
  isAddWatermark?: boolean;
541
- isAddWatermarkMap?: {
542
- [key: string]: boolean;
543
- };
544
+ isAddWatermarkMap?: Record<string, boolean>;
544
545
  watermarkType?: 'text' | 'image';
545
- watermarkTypeMap?: {
546
- [key: string]: 'text' | 'image';
547
- };
546
+ watermarkTypeMap?: Record<string, 'text' | 'image'>;
548
547
  isFullScreenWatermark?: boolean;
549
- isFullScreenWatermarkMap?: {
550
- [key: string]: boolean;
551
- };
548
+ isFullScreenWatermarkMap?: Record<string, boolean>;
552
549
  watermarkDegree?: number;
553
- watermarkDegreeMap?: {
554
- [key: string]: number;
555
- };
550
+ watermarkDegreeMap?: Record<string, number>;
556
551
  watermarkText?: string;
557
- watermarkTextMap?: {
558
- [key: string]: string;
559
- };
552
+ watermarkTextMap?: Record<string, string>;
560
553
  watermarkFontPath?: string;
561
- watermarkFontPathMap?: {
562
- [key: string]: string;
563
- };
554
+ watermarkFontPathMap?: Record<string, string>;
564
555
  watermarkScaleRatio?: number;
565
- watermarkScaleRatioMap?: {
566
- [key: string]: number;
567
- };
556
+ watermarkScaleRatioMap?: Record<string, number>;
568
557
  watermarkColor?: string;
569
- watermarkColorMap?: {
570
- [key: string]: string;
571
- };
558
+ watermarkColorMap?: Record<string, string>;
572
559
  watermarkImagePath?: string;
573
- watermarkImagePathMap?: {
574
- [key: string]: string;
575
- };
560
+ watermarkImagePathMap?: Record<string, string>;
576
561
  watermarkPosition?: availableWatermarkPosition;
577
- watermarkPositionMap?: {
578
- [key: string]: availableWatermarkPosition;
579
- };
562
+ watermarkPositionMap?: Record<string, availableWatermarkPosition>;
580
563
  watermarkImageOpacity?: number;
581
- watermarkImageOpacityMap?: {
582
- [key: string]: number;
583
- };
564
+ watermarkImageOpacityMap?: Record<string, number>;
584
565
  [propName: string]: any;
585
566
  }
586
567
  export interface IBuildInWaterMarkOptionsTreated {
@@ -599,65 +580,35 @@ export interface IBuildInWaterMarkOptionsTreated {
599
580
  }
600
581
  export interface IBuildInCompressOptions {
601
582
  quality?: number;
602
- qualityMap?: {
603
- [key: string]: number;
604
- };
583
+ qualityMap?: Record<string, number>;
605
584
  isConvert?: boolean;
606
- isConvertMap?: {
607
- [key: string]: boolean;
608
- };
585
+ isConvertMap?: Record<string, boolean>;
609
586
  convertFormat?: availableConvertFormat;
610
- convertFormatMap?: {
611
- [key: string]: availableConvertFormat;
612
- };
587
+ convertFormatMap?: Record<string, availableConvertFormat>;
613
588
  isReSize?: boolean;
614
- isReSizeMap?: {
615
- [key: string]: boolean;
616
- };
589
+ isReSizeMap?: Record<string, boolean>;
617
590
  reSizeWidth?: number;
618
- reSizeWidthMap?: {
619
- [key: string]: number;
620
- };
591
+ reSizeWidthMap?: Record<string, number>;
621
592
  reSizeHeight?: number;
622
- reSizeHeightMap?: {
623
- [key: string]: number;
624
- };
593
+ reSizeHeightMap?: Record<string, number>;
625
594
  skipReSizeOfSmallImg?: boolean;
626
- skipReSizeOfSmallImgMap?: {
627
- [key: string]: boolean;
628
- };
595
+ skipReSizeOfSmallImgMap?: Record<string, boolean>;
629
596
  isReSizeByPercent?: boolean;
630
- isReSizeByPercentMap?: {
631
- [key: string]: boolean;
632
- };
597
+ isReSizeByPercentMap?: Record<string, boolean>;
633
598
  reSizePercent?: number;
634
- reSizePercentMap?: {
635
- [key: string]: number;
636
- };
599
+ reSizePercentMap?: Record<string, number>;
637
600
  isRotate?: boolean;
638
- isRotateMap?: {
639
- [key: string]: boolean;
640
- };
601
+ isRotateMap?: Record<string, boolean>;
641
602
  rotateDegree?: number;
642
- rotateDegreeMap?: {
643
- [key: string]: number;
644
- };
603
+ rotateDegreeMap?: Record<string, number>;
645
604
  isRemoveExif?: boolean;
646
- isRemoveExifMap?: {
647
- [key: string]: boolean;
648
- };
605
+ isRemoveExifMap?: Record<string, boolean>;
649
606
  isFlip?: boolean;
650
- isFlipMap?: {
651
- [key: string]: boolean;
652
- };
607
+ isFlipMap?: Record<string, boolean>;
653
608
  isFlop?: boolean;
654
- isFlopMap?: {
655
- [key: string]: boolean;
656
- };
609
+ isFlopMap?: Record<string, boolean>;
657
610
  formatConvertObj?: any;
658
- formatConvertObjMap?: {
659
- [key: string]: any;
660
- };
611
+ formatConvertObjMap?: Record<string, any>;
661
612
  [propName: string]: any;
662
613
  }
663
614
  export interface IBuildInCompressOptionsTreated {
package/eslint.config.js CHANGED
@@ -1,46 +1,45 @@
1
- import eslint from '@eslint/js'
2
- import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
1
+ import js from '@eslint/js'
2
+ import { defineConfig } from 'eslint/config'
3
+ import configPrettier from 'eslint-config-prettier'
4
+ import jsonc from 'eslint-plugin-jsonc'
5
+ import pluginPrettier from 'eslint-plugin-prettier/recommended'
3
6
  import simpleImportSort from 'eslint-plugin-simple-import-sort'
4
7
  import eslintPluginUnicorn from 'eslint-plugin-unicorn'
5
8
  import globals from 'globals'
9
+ import jsoncParser from 'jsonc-eslint-parser'
6
10
  import tseslint from 'typescript-eslint'
7
-
8
- export default tseslint.config(
11
+ export default defineConfig(
9
12
  {
10
- files: [
11
- './src/*.{ts,tsx,cts,mts,js,cjs,mjs}',
12
- './scripts/*.{ts,js,mjs}',
13
- './test/*.{ts,js,mjs}',
14
- './bin/picgo',
15
- './bin/picgo-server'
16
- ]
17
- },
18
- {
19
- ignores: ['**/node_modules/**', '**/dist/**', '**/webpack.config.js', 'vitest.workspace.mjs']
13
+ ignores: ['**/node_modules/**', '**/dist/**', 'vitest.workspace.mjs'],
20
14
  },
21
- eslint.configs.recommended,
15
+ js.configs.recommended,
22
16
  ...tseslint.configs.recommended,
23
17
  ...tseslint.configs.stylistic,
24
18
  {
19
+ files: [
20
+ 'src/**/*.{ts,tsx,cts,mts,js,cjs,mjs}',
21
+ 'scripts/**/*.{ts,js,mjs}',
22
+ 'test/**/*.{ts,js,mjs}',
23
+ './bin/picgo',
24
+ './bin/picgo-server',
25
+ 'eslint.config.js',
26
+ 'rollup.config.js',
27
+ ],
28
+ languageOptions: {
29
+ parserOptions: {
30
+ warnOnUnsupportedTypeScriptVersion: false,
31
+ },
32
+ globals: globals.node,
33
+ },
25
34
  plugins: {
26
35
  'simple-import-sort': simpleImportSort,
27
- unicorn: eslintPluginUnicorn
36
+ unicorn: eslintPluginUnicorn,
28
37
  },
29
38
  rules: {
39
+ 'unicorn/prefer-node-protocol': 'error',
40
+ 'unicorn/prefer-module': 'error',
30
41
  'simple-import-sort/imports': 'error',
31
- 'simple-import-sort/exports': 'error'
32
- }
33
- },
34
- {
35
- languageOptions: {
36
- parserOptions: {
37
- warnOnUnsupportedTypeScriptVersion: false
38
- },
39
- globals: globals.node
40
- }
41
- },
42
- {
43
- rules: {
42
+ 'simple-import-sort/exports': 'error',
44
43
  eqeqeq: 'error',
45
44
  'no-caller': 'error',
46
45
  'no-constant-condition': ['error', { checkLoops: false }],
@@ -55,22 +54,18 @@ export default tseslint.config(
55
54
  'prefer-const': 'error',
56
55
  'prefer-object-spread': 'error',
57
56
  'unicode-bom': ['error', 'never'],
58
- // Enabled in eslint:recommended, but not applicable here
57
+ 'no-console': 'off',
58
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
59
+ 'no-unused-vars': 'off',
59
60
  'no-extra-boolean-cast': 'off',
60
61
  'no-case-declarations': 'off',
61
62
  'no-cond-assign': 'off',
62
63
  'no-control-regex': 'off',
63
64
  'no-inner-declarations': 'off',
64
65
  'no-empty': 'off',
65
-
66
66
  // @typescript-eslint/eslint-plugin
67
- 'no-unused-expressions': 'off',
68
67
  '@typescript-eslint/no-unused-expressions': 'off',
69
68
  '@typescript-eslint/ban-ts-comment': 'off',
70
- '@typescript-eslint/class-literal-property-style': 'off',
71
- '@typescript-eslint/consistent-indexed-object-style': 'off',
72
- '@typescript-eslint/consistent-generic-constructors': 'off',
73
- '@typescript-eslint/no-duplicate-enum-values': 'off',
74
69
  '@typescript-eslint/no-empty-function': 'off',
75
70
  '@typescript-eslint/no-namespace': 'off',
76
71
  '@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
@@ -79,12 +74,46 @@ export default tseslint.config(
79
74
  '@typescript-eslint/no-explicit-any': 'off',
80
75
  '@typescript-eslint/no-empty-object-type': 'off', // {} is a totally useful and valid type.
81
76
  '@typescript-eslint/no-require-imports': 'off',
82
- '@typescript-eslint/no-unused-vars': 'off',
83
77
  '@typescript-eslint/no-inferrable-types': 'off',
84
78
  // Pending https://github.com/typescript-eslint/typescript-eslint/issues/4820
85
79
  '@typescript-eslint/prefer-optional-chain': 'off',
86
- 'unicorn/prefer-node-protocol': 'error'
87
- }
80
+ '@typescript-eslint/no-unused-vars': [
81
+ 'error',
82
+ {
83
+ args: 'all',
84
+ argsIgnorePattern: '^_',
85
+ caughtErrors: 'all',
86
+ caughtErrorsIgnorePattern: '^_',
87
+ },
88
+ ],
89
+ },
90
+ },
91
+ ...jsonc.configs['flat/recommended-with-jsonc'],
92
+ {
93
+ files: ['**/*.json', '**/*.jsonc', '**/*.json5'],
94
+ languageOptions: {
95
+ parser: jsoncParser,
96
+ },
97
+ rules: {
98
+ 'jsonc/array-bracket-spacing': ['error', 'never'],
99
+ 'jsonc/comma-dangle': ['error', 'never'],
100
+ 'jsonc/indent': ['error', 2],
101
+ 'jsonc/no-comments': 'off',
102
+ 'jsonc/quotes': ['error', 'double'],
103
+ },
104
+ },
105
+ {
106
+ files: ['src/i18n/**/*.json'],
107
+ rules: {
108
+ 'jsonc/sort-keys': [
109
+ 'error',
110
+ 'asc', // 升序排列
111
+ {
112
+ caseSensitive: false,
113
+ natural: true,
114
+ },
115
+ ],
116
+ },
88
117
  },
89
118
  {
90
119
  files: ['**/*.mjs', '**/*.mts'],
@@ -96,9 +125,10 @@ export default tseslint.config(
96
125
  { name: '__dirname' },
97
126
  { name: 'require' },
98
127
  { name: 'module' },
99
- { name: 'exports' }
100
- ]
101
- }
128
+ { name: 'exports' },
129
+ ],
130
+ },
102
131
  },
103
- eslintPluginPrettierRecommended
132
+ configPrettier,
133
+ pluginPrettier,
104
134
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piclist",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "Modified PicGo core, A tool for picture uploading",
5
5
  "author": {
6
6
  "name": "Kuingsmile",
@@ -54,13 +54,13 @@
54
54
  },
55
55
  "license": "MIT",
56
56
  "devDependencies": {
57
- "@eslint/js": "^9.36.0",
58
- "@rollup/plugin-commonjs": "^28.0.6",
57
+ "@eslint/js": "^9.39.2",
58
+ "@rollup/plugin-commonjs": "^29.0.0",
59
59
  "@rollup/plugin-json": "^6.1.0",
60
- "@rollup/plugin-node-resolve": "^16.0.1",
61
- "@rollup/plugin-replace": "^6.0.2",
60
+ "@rollup/plugin-node-resolve": "^16.0.3",
61
+ "@rollup/plugin-replace": "^6.0.3",
62
62
  "@rollup/plugin-terser": "^0.4.4",
63
- "@rollup/plugin-typescript": "^12.1.4",
63
+ "@rollup/plugin-typescript": "^12.3.0",
64
64
  "@types/cross-spawn": "^6.0.6",
65
65
  "@types/fs-extra": "^11.0.4",
66
66
  "@types/heic-convert": "^2.1.0",
@@ -68,61 +68,61 @@
68
68
  "@types/inquirer": "^0.0.42",
69
69
  "@types/js-yaml": "^4.0.9",
70
70
  "@types/lodash-es": "^4.17.12",
71
- "@types/node": "24.5.2",
71
+ "@types/node": "24.10.0",
72
72
  "@types/resolve": "^1.20.6",
73
73
  "@types/text-to-svg": "^3.1.4",
74
74
  "@types/tunnel": "^0.0.7",
75
- "@typescript-eslint/eslint-plugin": "^8.44.1",
76
- "@typescript-eslint/parser": "^8.44.1",
77
- "cross-env": "^10.0.0",
75
+ "cross-env": "^10.1.0",
78
76
  "dpdm": "^3.14.0",
79
- "eslint": "^9.36.0",
77
+ "eslint": "^9.39.2",
80
78
  "eslint-config-prettier": "^10.1.8",
79
+ "eslint-plugin-jsonc": "^2.21.0",
81
80
  "eslint-plugin-prettier": "^5.5.4",
82
81
  "eslint-plugin-simple-import-sort": "^12.1.1",
83
- "eslint-plugin-unicorn": "^61.0.2",
82
+ "eslint-plugin-unicorn": "^62.0.0",
84
83
  "husky": "^9.1.7",
84
+ "jsonc-eslint-parser": "^2.4.2",
85
85
  "node-bump-version": "^2.0.0",
86
- "prettier": "^3.6.2",
87
- "rollup": "^4.52.2",
86
+ "prettier": "^3.7.4",
87
+ "rimraf": "^6.1.2",
88
+ "rollup": "^4.55.1",
88
89
  "rollup-plugin-copy": "^3.5.0",
89
90
  "rollup-plugin-string": "^3.0.0",
90
91
  "typescript": "^5.8.3",
91
- "typescript-eslint": "^8.44.1",
92
- "rimraf": "^6.0.1"
92
+ "typescript-eslint": "^8.52.0"
93
93
  },
94
94
  "dependencies": {
95
- "@aws-sdk/client-s3": "3.896.0",
96
- "@aws-sdk/lib-storage": "3.896.0",
97
- "@aws-sdk/s3-request-presigner": "3.896.0",
98
- "@piclist/store": "^3.0.0",
95
+ "@aws-sdk/client-s3": "3.962.0",
96
+ "@aws-sdk/lib-storage": "3.962.0",
97
+ "@aws-sdk/s3-request-presigner": "3.962.0",
99
98
  "@piclist/i18n": "^2.0.0",
100
- "@smithy/node-http-handler": "4.2.1",
101
- "axios": "^1.12.2",
102
- "chalk": "^5.4.1",
99
+ "@piclist/store": "^3.0.0",
100
+ "@smithy/node-http-handler": "4.4.7",
101
+ "axios": "^1.13.2",
102
+ "chalk": "^5.6.2",
103
103
  "commander": "^8.1.0",
104
104
  "cross-spawn": "^7.0.6",
105
- "dayjs": "^1.11.18",
106
- "file-type": "21.0.0",
107
- "form-data": "^4.0.4",
108
- "fs-extra": "^11.3.2",
105
+ "dayjs": "^1.11.19",
106
+ "file-type": "21.3.0",
107
+ "form-data": "^4.0.5",
108
+ "fs-extra": "^11.3.3",
109
109
  "heic-convert": "^2.1.0",
110
110
  "hpagent": "1.2.0",
111
111
  "image-size": "^2.0.2",
112
112
  "inquirer": "^6.0.0",
113
113
  "is-wsl": "^3.1.0",
114
- "js-yaml": "^4.1.0",
115
- "lodash-es": "^4.17.21",
114
+ "js-yaml": "^4.1.1",
115
+ "lodash-es": "^4.17.22",
116
116
  "mime": "4.1.0",
117
117
  "minimist": "^1.2.8",
118
118
  "multer": "^2.0.2",
119
119
  "node-ssh-no-cpu-features": "^2.0.0",
120
120
  "qiniu": "7.14.0",
121
- "resolve": "^1.22.10",
122
- "sharp": "^0.34.4",
121
+ "resolve": "^1.22.11",
122
+ "sharp": "^0.34.5",
123
123
  "text-to-svg": "^3.1.5",
124
124
  "tunnel": "^0.0.6",
125
- "uuid": "^11.1.0",
125
+ "uuid": "^13.0.0",
126
126
  "webdav": "^5.8.0"
127
127
  },
128
128
  "repository": {
package/renovate.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "config:recommended"
5
+ ]
6
+ }
package/rollup.config.js CHANGED
@@ -26,28 +26,28 @@ const commonOptions = {
26
26
  // See https://github.com/rollup/rollup/issues/3684#issuecomment-926558056
27
27
  external: [
28
28
  ...Object.keys(pkg.dependencies).map(packageName => new RegExp(`^${packageName}(/.*)?`)),
29
- ...builtinModules.map(moduleName => new RegExp(`^(node:)?${moduleName}(/.*)?`))
29
+ ...builtinModules.map(moduleName => new RegExp(`^(node:)?${moduleName}(/.*)?`)),
30
30
  ],
31
31
  plugins: [
32
32
  typescript({
33
- tsconfig: './tsconfig.json'
33
+ tsconfig: './tsconfig.json',
34
34
  }),
35
35
  copy({
36
- targets: [{ src: 'assets', dest: 'dist' }]
36
+ targets: [{ src: 'assets', dest: 'dist' }],
37
37
  }),
38
38
  // terser(),
39
39
  commonjs(),
40
40
  string({
41
41
  // Required to be specified
42
- include: ['**/*.applescript', '**/*.ps1', '**/*.sh']
42
+ include: ['**/*.applescript', '**/*.ps1', '**/*.sh'],
43
43
  }),
44
44
  json(),
45
45
  replace({
46
46
  'process.env.PICGO_VERSION': JSON.stringify(pkg.version),
47
- preventAssignment: true
48
- })
47
+ preventAssignment: true,
48
+ }),
49
49
  ],
50
- input
50
+ input,
51
51
  }
52
52
 
53
53
  const isDev = process.env.NODE_ENV === 'development'
@@ -64,10 +64,10 @@ const nodeEsm = {
64
64
  file: 'dist/index.js',
65
65
  format: 'esm',
66
66
  banner,
67
- sourcemap
68
- }
67
+ sourcemap,
68
+ },
69
69
  ],
70
- ...commonOptions
70
+ ...commonOptions,
71
71
  }
72
72
 
73
73
  const bundles = []