picgo-plugin-img-avif 1.0.1 → 1.0.3

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 (2) hide show
  1. package/package.json +1 -4
  2. package/src/index.js +5 -5
package/package.json CHANGED
@@ -1,15 +1,12 @@
1
1
  {
2
2
  "name": "picgo-plugin-img-avif",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "一个压缩并转换图片格式的 PicGo 插件",
5
5
  "main": "src/index.js",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
9
  "homepage": "https://github.com/liyao52033/picgo-plugin-img-avif",
10
- "scripts": {
11
- "publish": "npm publish"
12
- },
13
10
  "keywords": [
14
11
  "picgo",
15
12
  "picgo-gui-plugin",
package/src/index.js CHANGED
@@ -3,7 +3,7 @@ const path = require('path')
3
3
 
4
4
  // Plugin configuration schema
5
5
  const config = (ctx) => {
6
- let userConfig = ctx.getConfig('picgo-plugin-converter')
6
+ let userConfig = ctx.getConfig('picgo-plugin-img-avif')
7
7
  if (!userConfig) {
8
8
  userConfig = {}
9
9
  }
@@ -12,7 +12,7 @@ const config = (ctx) => {
12
12
  name: 'format',
13
13
  type: 'list',
14
14
  alias: '目标格式',
15
- default: userConfig.format || 'original',
15
+ default: userConfig.format || 'avif',
16
16
  message: 'Select output format',
17
17
  choices: [
18
18
  { name: '原格式', value: 'original' },
@@ -37,7 +37,7 @@ const config = (ctx) => {
37
37
  name: 'lossless',
38
38
  type: 'confirm',
39
39
  alias: 'WebP/AVIF无损压缩',
40
- default: userConfig.lossless || false,
40
+ default: userConfig.lossless || true,
41
41
  message: 'Enable lossless compression for WebP/AVIF? (May increase file size)' // 修改提示文案
42
42
  }
43
43
  ]
@@ -46,7 +46,7 @@ const config = (ctx) => {
46
46
  // Core handler function
47
47
  const handle = async (ctx) => {
48
48
  // Get user configuration
49
- const userConfig = ctx.getConfig('picgo-plugin-converter') || {}
49
+ const userConfig = ctx.getConfig('picgo-plugin-img-avif') || {}
50
50
  const targetFormat = userConfig.format || 'original'
51
51
  const quality = parseInt(userConfig.quality) || 80
52
52
  const lossless = userConfig.lossless || false
@@ -127,7 +127,7 @@ module.exports = (ctx) => {
127
127
  const register = () => {
128
128
  // Register in the 'beforeUploadPlugins' lifecycle
129
129
  // Intercepts after Transformer (post-file) and before Uploader (pre-upload)
130
- ctx.helper.beforeUploadPlugins.register('converter', {
130
+ ctx.helper.beforeUploadPlugins.register('img-avif', {
131
131
  handle,
132
132
  config,
133
133
  name: '图片压缩与转换' // Friendly plugin name shown in the GUI