piclist 2.0.4 → 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 {
@@ -540,49 +541,27 @@ export type availableConvertFormat = keyof FormatEnum;
540
541
  export type availableWatermarkPosition = keyof GravityEnum;
541
542
  export interface IBuildInWaterMarkOptions {
542
543
  isAddWatermark?: boolean;
543
- isAddWatermarkMap?: {
544
- [key: string]: boolean;
545
- };
544
+ isAddWatermarkMap?: Record<string, boolean>;
546
545
  watermarkType?: 'text' | 'image';
547
- watermarkTypeMap?: {
548
- [key: string]: 'text' | 'image';
549
- };
546
+ watermarkTypeMap?: Record<string, 'text' | 'image'>;
550
547
  isFullScreenWatermark?: boolean;
551
- isFullScreenWatermarkMap?: {
552
- [key: string]: boolean;
553
- };
548
+ isFullScreenWatermarkMap?: Record<string, boolean>;
554
549
  watermarkDegree?: number;
555
- watermarkDegreeMap?: {
556
- [key: string]: number;
557
- };
550
+ watermarkDegreeMap?: Record<string, number>;
558
551
  watermarkText?: string;
559
- watermarkTextMap?: {
560
- [key: string]: string;
561
- };
552
+ watermarkTextMap?: Record<string, string>;
562
553
  watermarkFontPath?: string;
563
- watermarkFontPathMap?: {
564
- [key: string]: string;
565
- };
554
+ watermarkFontPathMap?: Record<string, string>;
566
555
  watermarkScaleRatio?: number;
567
- watermarkScaleRatioMap?: {
568
- [key: string]: number;
569
- };
556
+ watermarkScaleRatioMap?: Record<string, number>;
570
557
  watermarkColor?: string;
571
- watermarkColorMap?: {
572
- [key: string]: string;
573
- };
558
+ watermarkColorMap?: Record<string, string>;
574
559
  watermarkImagePath?: string;
575
- watermarkImagePathMap?: {
576
- [key: string]: string;
577
- };
560
+ watermarkImagePathMap?: Record<string, string>;
578
561
  watermarkPosition?: availableWatermarkPosition;
579
- watermarkPositionMap?: {
580
- [key: string]: availableWatermarkPosition;
581
- };
562
+ watermarkPositionMap?: Record<string, availableWatermarkPosition>;
582
563
  watermarkImageOpacity?: number;
583
- watermarkImageOpacityMap?: {
584
- [key: string]: number;
585
- };
564
+ watermarkImageOpacityMap?: Record<string, number>;
586
565
  [propName: string]: any;
587
566
  }
588
567
  export interface IBuildInWaterMarkOptionsTreated {
@@ -601,65 +580,35 @@ export interface IBuildInWaterMarkOptionsTreated {
601
580
  }
602
581
  export interface IBuildInCompressOptions {
603
582
  quality?: number;
604
- qualityMap?: {
605
- [key: string]: number;
606
- };
583
+ qualityMap?: Record<string, number>;
607
584
  isConvert?: boolean;
608
- isConvertMap?: {
609
- [key: string]: boolean;
610
- };
585
+ isConvertMap?: Record<string, boolean>;
611
586
  convertFormat?: availableConvertFormat;
612
- convertFormatMap?: {
613
- [key: string]: availableConvertFormat;
614
- };
587
+ convertFormatMap?: Record<string, availableConvertFormat>;
615
588
  isReSize?: boolean;
616
- isReSizeMap?: {
617
- [key: string]: boolean;
618
- };
589
+ isReSizeMap?: Record<string, boolean>;
619
590
  reSizeWidth?: number;
620
- reSizeWidthMap?: {
621
- [key: string]: number;
622
- };
591
+ reSizeWidthMap?: Record<string, number>;
623
592
  reSizeHeight?: number;
624
- reSizeHeightMap?: {
625
- [key: string]: number;
626
- };
593
+ reSizeHeightMap?: Record<string, number>;
627
594
  skipReSizeOfSmallImg?: boolean;
628
- skipReSizeOfSmallImgMap?: {
629
- [key: string]: boolean;
630
- };
595
+ skipReSizeOfSmallImgMap?: Record<string, boolean>;
631
596
  isReSizeByPercent?: boolean;
632
- isReSizeByPercentMap?: {
633
- [key: string]: boolean;
634
- };
597
+ isReSizeByPercentMap?: Record<string, boolean>;
635
598
  reSizePercent?: number;
636
- reSizePercentMap?: {
637
- [key: string]: number;
638
- };
599
+ reSizePercentMap?: Record<string, number>;
639
600
  isRotate?: boolean;
640
- isRotateMap?: {
641
- [key: string]: boolean;
642
- };
601
+ isRotateMap?: Record<string, boolean>;
643
602
  rotateDegree?: number;
644
- rotateDegreeMap?: {
645
- [key: string]: number;
646
- };
603
+ rotateDegreeMap?: Record<string, number>;
647
604
  isRemoveExif?: boolean;
648
- isRemoveExifMap?: {
649
- [key: string]: boolean;
650
- };
605
+ isRemoveExifMap?: Record<string, boolean>;
651
606
  isFlip?: boolean;
652
- isFlipMap?: {
653
- [key: string]: boolean;
654
- };
607
+ isFlipMap?: Record<string, boolean>;
655
608
  isFlop?: boolean;
656
- isFlopMap?: {
657
- [key: string]: boolean;
658
- };
609
+ isFlopMap?: Record<string, boolean>;
659
610
  formatConvertObj?: any;
660
- formatConvertObjMap?: {
661
- [key: string]: any;
662
- };
611
+ formatConvertObjMap?: Record<string, any>;
663
612
  [propName: string]: any;
664
613
  }
665
614
  export interface IBuildInCompressOptionsTreated {
package/eslint.config.js CHANGED
@@ -1,47 +1,45 @@
1
- import eslint from '@eslint/js'
1
+ import js from '@eslint/js'
2
2
  import { defineConfig } from 'eslint/config'
3
- import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
3
+ import configPrettier from 'eslint-config-prettier'
4
+ import jsonc from 'eslint-plugin-jsonc'
5
+ import pluginPrettier from 'eslint-plugin-prettier/recommended'
4
6
  import simpleImportSort from 'eslint-plugin-simple-import-sort'
5
7
  import eslintPluginUnicorn from 'eslint-plugin-unicorn'
6
8
  import globals from 'globals'
9
+ import jsoncParser from 'jsonc-eslint-parser'
7
10
  import tseslint from 'typescript-eslint'
8
-
9
11
  export default defineConfig(
10
12
  {
11
- files: [
12
- './src/*.{ts,tsx,cts,mts,js,cjs,mjs}',
13
- './scripts/*.{ts,js,mjs}',
14
- './test/*.{ts,js,mjs}',
15
- './bin/picgo',
16
- './bin/picgo-server'
17
- ]
18
- },
19
- {
20
- ignores: ['**/node_modules/**', '**/dist/**', '**/webpack.config.js', 'vitest.workspace.mjs']
13
+ ignores: ['**/node_modules/**', '**/dist/**', 'vitest.workspace.mjs'],
21
14
  },
22
- eslint.configs.recommended,
15
+ js.configs.recommended,
23
16
  ...tseslint.configs.recommended,
24
17
  ...tseslint.configs.stylistic,
25
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
+ },
26
34
  plugins: {
27
35
  'simple-import-sort': simpleImportSort,
28
- unicorn: eslintPluginUnicorn
36
+ unicorn: eslintPluginUnicorn,
29
37
  },
30
38
  rules: {
39
+ 'unicorn/prefer-node-protocol': 'error',
40
+ 'unicorn/prefer-module': 'error',
31
41
  'simple-import-sort/imports': 'error',
32
- 'simple-import-sort/exports': 'error'
33
- }
34
- },
35
- {
36
- languageOptions: {
37
- parserOptions: {
38
- warnOnUnsupportedTypeScriptVersion: false
39
- },
40
- globals: globals.node
41
- }
42
- },
43
- {
44
- rules: {
42
+ 'simple-import-sort/exports': 'error',
45
43
  eqeqeq: 'error',
46
44
  'no-caller': 'error',
47
45
  'no-constant-condition': ['error', { checkLoops: false }],
@@ -56,22 +54,18 @@ export default defineConfig(
56
54
  'prefer-const': 'error',
57
55
  'prefer-object-spread': 'error',
58
56
  'unicode-bom': ['error', 'never'],
59
- // 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',
60
60
  'no-extra-boolean-cast': 'off',
61
61
  'no-case-declarations': 'off',
62
62
  'no-cond-assign': 'off',
63
63
  'no-control-regex': 'off',
64
64
  'no-inner-declarations': 'off',
65
65
  'no-empty': 'off',
66
-
67
66
  // @typescript-eslint/eslint-plugin
68
- 'no-unused-expressions': 'off',
69
67
  '@typescript-eslint/no-unused-expressions': 'off',
70
68
  '@typescript-eslint/ban-ts-comment': 'off',
71
- '@typescript-eslint/class-literal-property-style': 'off',
72
- '@typescript-eslint/consistent-indexed-object-style': 'off',
73
- '@typescript-eslint/consistent-generic-constructors': 'off',
74
- '@typescript-eslint/no-duplicate-enum-values': 'off',
75
69
  '@typescript-eslint/no-empty-function': 'off',
76
70
  '@typescript-eslint/no-namespace': 'off',
77
71
  '@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
@@ -80,12 +74,46 @@ export default defineConfig(
80
74
  '@typescript-eslint/no-explicit-any': 'off',
81
75
  '@typescript-eslint/no-empty-object-type': 'off', // {} is a totally useful and valid type.
82
76
  '@typescript-eslint/no-require-imports': 'off',
83
- '@typescript-eslint/no-unused-vars': 'off',
84
77
  '@typescript-eslint/no-inferrable-types': 'off',
85
78
  // Pending https://github.com/typescript-eslint/typescript-eslint/issues/4820
86
79
  '@typescript-eslint/prefer-optional-chain': 'off',
87
- 'unicorn/prefer-node-protocol': 'error'
88
- }
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
+ },
89
117
  },
90
118
  {
91
119
  files: ['**/*.mjs', '**/*.mts'],
@@ -97,9 +125,10 @@ export default defineConfig(
97
125
  { name: '__dirname' },
98
126
  { name: 'require' },
99
127
  { name: 'module' },
100
- { name: 'exports' }
101
- ]
102
- }
128
+ { name: 'exports' },
129
+ ],
130
+ },
103
131
  },
104
- eslintPluginPrettierRecommended
132
+ configPrettier,
133
+ pluginPrettier,
105
134
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piclist",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "Modified PicGo core, A tool for picture uploading",
5
5
  "author": {
6
6
  "name": "Kuingsmile",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "license": "MIT",
56
56
  "devDependencies": {
57
- "@eslint/js": "^9.39.1",
57
+ "@eslint/js": "^9.39.2",
58
58
  "@rollup/plugin-commonjs": "^29.0.0",
59
59
  "@rollup/plugin-json": "^6.1.0",
60
60
  "@rollup/plugin-node-resolve": "^16.0.3",
@@ -72,57 +72,57 @@
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.46.3",
76
- "@typescript-eslint/parser": "^8.46.3",
77
75
  "cross-env": "^10.1.0",
78
76
  "dpdm": "^3.14.0",
79
- "eslint": "^9.39.1",
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
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.53.1",
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.46.3",
92
- "rimraf": "^6.1.0"
92
+ "typescript-eslint": "^8.52.0"
93
93
  },
94
94
  "dependencies": {
95
- "@aws-sdk/client-s3": "3.931.0",
96
- "@aws-sdk/lib-storage": "3.931.0",
97
- "@aws-sdk/s3-request-presigner": "3.931.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.4.5",
99
+ "@piclist/store": "^3.0.0",
100
+ "@smithy/node-http-handler": "4.4.7",
101
101
  "axios": "^1.13.2",
102
- "chalk": "^5.4.1",
102
+ "chalk": "^5.6.2",
103
103
  "commander": "^8.1.0",
104
104
  "cross-spawn": "^7.0.6",
105
105
  "dayjs": "^1.11.19",
106
- "file-type": "21.1.0",
107
- "form-data": "^4.0.4",
108
- "fs-extra": "^11.3.2",
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
114
  "js-yaml": "^4.1.1",
115
- "lodash-es": "^4.17.21",
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
121
  "resolve": "^1.22.11",
122
- "sharp": "^0.34.4",
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 = []