metalsmith-optimize-images 0.12.0 → 1.0.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.
package/README.md CHANGED
@@ -6,10 +6,7 @@ Metalsmith plugin for generating responsive images with optimal formats
6
6
  [![npm: version][npm-badge]][npm-url]
7
7
  [![license: MIT][license-badge]][license-url]
8
8
  [![test coverage][coverage-badge]][coverage-url]
9
- [![ESM/CommonJS][modules-badge]][npm-url]
10
- [![Known Vulnerabilities](https://snyk.io/test/npm/metalsmith-optimize-images/badge.svg)](https://snyk.io/test/npm/metalsmith-optimize-images)
11
-
12
- > This Metalsmith plugin is under active development. The API is stable, but breaking changes may occur before reaching 1.0.0.
9
+ [![ESM][modules-badge]][npm-url]
13
10
 
14
11
  > **Breaking change in 0.12.0**: When the persistent cache is enabled (`cache: true`), this plugin must now run **before** `metalsmith-static-files` in the pipeline, not after. The plugin writes variants to the source tree and the static-files plugin copies them to the build. See [Usage](#usage) for details.
15
12
 
@@ -26,9 +23,6 @@ Metalsmith plugin for generating responsive images with optimal formats
26
23
  - **Parallel processing**: Processes images in parallel
27
24
  - **Metadata generation**: Creates a JSON manifest with image information and variants
28
25
  - **Configurable compression**: Customize compression settings per format
29
- - **ESM and CommonJS support**:
30
- - ESM: `import optimizeImages from 'metalsmith-optimize-images'`
31
- - CommonJS: `const optimizeImages = require('metalsmith-optimize-images')`
32
26
 
33
27
  ## Installation
34
28
 
@@ -36,6 +30,8 @@ Metalsmith plugin for generating responsive images with optimal formats
36
30
  npm install metalsmith-optimize-images
37
31
  ```
38
32
 
33
+ This package is **ESM-only** and requires Node >= 22. CommonJS projects on Node 22 can still load it, because Node 22 lets `require` import ESM packages.
34
+
39
35
  ## Usage
40
36
 
41
37
  When the persistent cache is enabled the plugin should run **before** the static-files copy so that newly generated variants land in the cache directory and get picked up by the copy step. When the cache is disabled the plugin should run **after** assets are copied, since it needs the images to already be in the Metalsmith files object.
@@ -553,6 +549,6 @@ All AI-assisted code has been reviewed and tested to ensure it meets project sta
553
549
  [metalsmith-url]: https://metalsmith.io
554
550
  [license-badge]: https://img.shields.io/github/license/wernerglinka/metalsmith-optimize-images
555
551
  [license-url]: LICENSE
556
- [coverage-badge]: https://img.shields.io/badge/test%20coverage-92%25-brightgreen
552
+ [coverage-badge]: https://img.shields.io/badge/test%20coverage-93%25-brightgreen
557
553
  [coverage-url]: https://github.com/wernerglinka/metalsmith-optimize-images/actions/workflows/test.yml
558
- [modules-badge]: https://img.shields.io/badge/modules-ESM%2FCJS-blue
554
+ [modules-badge]: https://img.shields.io/badge/module-ESM-blue
package/package.json CHANGED
@@ -1,36 +1,27 @@
1
1
  {
2
2
  "name": "metalsmith-optimize-images",
3
- "version": "0.12.0",
3
+ "version": "1.0.0",
4
4
  "description": "Metalsmith plugin for generating responsive images with optimal formats",
5
5
  "type": "module",
6
- "main": "./lib/index.cjs",
7
- "module": "./lib/index.js",
8
- "exports": {
9
- "import": "./lib/index.js",
10
- "require": "./lib/index.cjs",
11
- "default": "./lib/index.js"
12
- },
6
+ "exports": "./src/index.js",
13
7
  "engines": {
14
- "node": ">= 18.0.0"
8
+ "node": ">= 22.0.0"
15
9
  },
16
10
  "scripts": {
17
- "build": "microbundle --entry src/index.js --output lib/index.js --target node -f esm,cjs --strict --generateTypes=false",
18
11
  "changelog": "auto-changelog -u --commit-limit false --ignore-commit-pattern '^((dev|chore|ci):|Release)'",
19
- "coverage": "c8 --include=src/**/*.js --reporter=lcov --reporter=text-summary mocha 'test/index.js' 'test/cjs.test.cjs' 'test/unit/**/*.js' -t 15000",
20
- "format": "prettier --write \"**/*.{yml,md,js,json}\"",
21
- "format:check": "prettier --list-different \"**/*.{yml,md,js,json}\"",
22
- "lint": "eslint --fix .",
23
- "lint:check": "eslint --fix-dry-run .",
24
- "prepare": "npm run build",
12
+ "test": "node --test --test-timeout=60000 'test/**/*.test.js'",
13
+ "coverage": "mkdir -p coverage && node --test --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test-timeout=60000 'test/**/*.test.js'",
14
+ "test:coverage": "npm run coverage",
15
+ "format": "biome format --write .",
16
+ "format:check": "biome format .",
17
+ "lint": "biome check --write .",
18
+ "lint:check": "biome check .",
19
+ "pre-release": "npm run lint:check && npm run format:check && npm test && npx metalsmith-plugin-mcp-server validate .",
25
20
  "release:patch": "./scripts/release.sh patch --ci",
26
21
  "release:minor": "./scripts/release.sh minor --ci",
27
22
  "release:major": "./scripts/release.sh major --ci",
28
- "release:check": "npm run lint:check && ./scripts/release.sh patch --dry-run",
29
- "test": "c8 --include=src/**/*.js mocha 'test/index.js' 'test/cjs.test.cjs' 'test/unit/**/*.js' -t 15000",
30
- "test:coverage": "c8 npm test",
31
- "test:unit": "mocha 'test/unit/**/*.js' -t 5000",
32
- "test:esm": "c8 --include=src/**/*.js mocha test/index.js -t 15000",
33
- "test:cjs": "c8 --include=src/**/*.js mocha test/cjs.test.cjs -t 15000",
23
+ "release:check": "npm run lint:check && release-it --dry-run",
24
+ "depcheck": "depcheck",
34
25
  "audit": "npm audit"
35
26
  },
36
27
  "repository": {
@@ -47,7 +38,8 @@
47
38
  "avif"
48
39
  ],
49
40
  "files": [
50
- "lib",
41
+ "src/**/*.js",
42
+ "LICENSE",
51
43
  "README.md"
52
44
  ],
53
45
  "author": "Werner Glinka <werner@glinka.co>",
@@ -62,22 +54,13 @@
62
54
  "sharp": "^0.34.5"
63
55
  },
64
56
  "devDependencies": {
57
+ "@biomejs/biome": "^2.4.0",
65
58
  "auto-changelog": "^2.5.0",
66
- "c8": "^10.1.3",
67
- "eslint": "^9.39.2",
68
- "eslint-config-prettier": "^10.1.8",
69
- "eslint-plugin-prettier": "^5.5.5",
70
- "metalsmith": "2.7.0",
71
- "microbundle": "^0.15.1",
72
- "mocha": "^11.7.5",
73
- "prettier": "^3.8.1",
74
- "release-it": "^19.2.4"
75
- },
76
- "peerDependencies": {
77
- "metalsmith": "^2.5.0"
59
+ "depcheck": "^1.4.7",
60
+ "metalsmith": "^2.5.0",
61
+ "release-it": "^20.0.0"
78
62
  },
79
63
  "publishConfig": {
80
64
  "access": "public"
81
- },
82
- "// Note": "The warning about deprecated lodash.get comes from release-it, which is only a dev dependency"
65
+ }
83
66
  }