Compare commits

..

7 Commits

Author SHA1 Message Date
Lovell Fuller
660bbdb1c0 Docs: changelog for #4441 2025-08-22 20:01:46 +01:00
Lovell Fuller
4164705113 Bump devDeps 2025-08-22 20:01:18 +01:00
Bayan Bennett
c01e272db5
TypeScript: Ensure KernelEnum includes linear (#4441) 2025-08-21 09:35:41 +01:00
Lovell Fuller
8607ff2f4a Tests: remove extraneous use of toColourspace 2025-08-18 10:33:32 +01:00
Lovell Fuller
cd337e4de3 Docs: extractChannel output colourspace is b-w or grey16 2025-08-18 10:24:55 +01:00
Lovell Fuller
51d1a49abc v0.34.4-rc.1 2025-07-28 14:32:52 +01:00
Lovell Fuller
dda00f63e6 CI: Remove frontmatter from release notes 2025-07-28 11:34:31 +01:00
23 changed files with 56 additions and 36 deletions

View File

@ -313,12 +313,13 @@ jobs:
path: npm path: npm
- name: Create npm workspace tarball - name: Create npm workspace tarball
run: tar -vcaf npm-workspace.tar.xz --directory npm --exclude=from-local-build.js . run: tar -vcaf npm-workspace.tar.xz --directory npm --exclude=from-local-build.js .
- name: Parse semver for tag - uses: actions/setup-node@v4
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
uses: madhead/semver-utils@v4
id: semver
with: with:
version: ${{ github.ref_name }} node-version: "24"
- name: Create release notes
if: startsWith(github.ref, 'refs/tags/v')
run: npm run package-release-notes
- name: Create GitHub release for tag - name: Create GitHub release for tag
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
@ -327,4 +328,4 @@ jobs:
artifactContentType: application/x-xz artifactContentType: application/x-xz
prerelease: ${{ contains(github.ref, '-rc') }} prerelease: ${{ contains(github.ref, '-rc') }}
makeLatest: ${{ !contains(github.ref, '-rc') }} makeLatest: ${{ !contains(github.ref, '-rc') }}
bodyFile: "docs/src/content/docs/changelog/v${{ steps.semver.outputs.major }}.${{ steps.semver.outputs.minor }}.${{ steps.semver.outputs.patch }}.md" bodyFile: release-notes.md

1
.gitignore vendored
View File

@ -16,3 +16,4 @@ package-lock.json
.firebase .firebase
.astro .astro
docs/dist docs/dist
release-notes.md

View File

@ -61,6 +61,8 @@ const rgba = await sharp(rgb)
Extract a single channel from a multi-channel image. Extract a single channel from a multi-channel image.
The output colourspace will be either `b-w` (8-bit) or `grey16` (16-bit).
**Throws**: **Throws**:

View File

@ -8,3 +8,7 @@ slug: changelog/v0.34.4
* Ensure `autoOrient` removes existing metadata after shrink-on-load. * Ensure `autoOrient` removes existing metadata after shrink-on-load.
[#4431](https://github.com/lovell/sharp/issues/4431) [#4431](https://github.com/lovell/sharp/issues/4431)
* TypeScript: Ensure `KernelEnum` includes `linear`.
[#4441](https://github.com/lovell/sharp/pull/4441)
[@BayanBennett](https://github.com/BayanBennett)

View File

@ -74,6 +74,8 @@ function ensureAlpha (alpha) {
/** /**
* Extract a single channel from a multi-channel image. * Extract a single channel from a multi-channel image.
* *
* The output colourspace will be either `b-w` (8-bit) or `grey16` (16-bit).
*
* @example * @example
* // green.jpg is a greyscale image containing the green channel of the input * // green.jpg is a greyscale image containing the green channel of the input
* await sharp(input) * await sharp(input)

1
lib/index.d.ts vendored
View File

@ -1784,6 +1784,7 @@ declare namespace sharp {
interface KernelEnum { interface KernelEnum {
nearest: 'nearest'; nearest: 'nearest';
cubic: 'cubic'; cubic: 'cubic';
linear: 'linear';
mitchell: 'mitchell'; mitchell: 'mitchell';
lanczos2: 'lanczos2'; lanczos2: 'lanczos2';
lanczos3: 'lanczos3'; lanczos3: 'lanczos3';

View File

@ -1,6 +1,6 @@
{ {
"name": "@img/sharp-darwin-arm64", "name": "@img/sharp-darwin-arm64",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"description": "Prebuilt sharp for use with macOS 64-bit ARM", "description": "Prebuilt sharp for use with macOS 64-bit ARM",
"author": "Lovell Fuller <npm@lovell.info>", "author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://sharp.pixelplumbing.com", "homepage": "https://sharp.pixelplumbing.com",

View File

@ -1,6 +1,6 @@
{ {
"name": "@img/sharp-darwin-x64", "name": "@img/sharp-darwin-x64",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"description": "Prebuilt sharp for use with macOS x64", "description": "Prebuilt sharp for use with macOS x64",
"author": "Lovell Fuller <npm@lovell.info>", "author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://sharp.pixelplumbing.com", "homepage": "https://sharp.pixelplumbing.com",

View File

@ -1,6 +1,6 @@
{ {
"name": "@img/sharp-linux-arm", "name": "@img/sharp-linux-arm",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"description": "Prebuilt sharp for use with Linux (glibc) ARM (32-bit)", "description": "Prebuilt sharp for use with Linux (glibc) ARM (32-bit)",
"author": "Lovell Fuller <npm@lovell.info>", "author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://sharp.pixelplumbing.com", "homepage": "https://sharp.pixelplumbing.com",

View File

@ -1,6 +1,6 @@
{ {
"name": "@img/sharp-linux-arm64", "name": "@img/sharp-linux-arm64",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"description": "Prebuilt sharp for use with Linux (glibc) 64-bit ARM", "description": "Prebuilt sharp for use with Linux (glibc) 64-bit ARM",
"author": "Lovell Fuller <npm@lovell.info>", "author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://sharp.pixelplumbing.com", "homepage": "https://sharp.pixelplumbing.com",

View File

@ -1,6 +1,6 @@
{ {
"name": "@img/sharp-linux-ppc64", "name": "@img/sharp-linux-ppc64",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"description": "Prebuilt sharp for use with Linux (glibc) ppc64", "description": "Prebuilt sharp for use with Linux (glibc) ppc64",
"author": "Lovell Fuller <npm@lovell.info>", "author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://sharp.pixelplumbing.com", "homepage": "https://sharp.pixelplumbing.com",

View File

@ -1,6 +1,6 @@
{ {
"name": "@img/sharp-linux-s390x", "name": "@img/sharp-linux-s390x",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"description": "Prebuilt sharp for use with Linux (glibc) s390x", "description": "Prebuilt sharp for use with Linux (glibc) s390x",
"author": "Lovell Fuller <npm@lovell.info>", "author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://sharp.pixelplumbing.com", "homepage": "https://sharp.pixelplumbing.com",

View File

@ -1,6 +1,6 @@
{ {
"name": "@img/sharp-linux-x64", "name": "@img/sharp-linux-x64",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"description": "Prebuilt sharp for use with Linux (glibc) x64", "description": "Prebuilt sharp for use with Linux (glibc) x64",
"author": "Lovell Fuller <npm@lovell.info>", "author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://sharp.pixelplumbing.com", "homepage": "https://sharp.pixelplumbing.com",

View File

@ -1,6 +1,6 @@
{ {
"name": "@img/sharp-linuxmusl-arm64", "name": "@img/sharp-linuxmusl-arm64",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"description": "Prebuilt sharp for use with Linux (musl) 64-bit ARM", "description": "Prebuilt sharp for use with Linux (musl) 64-bit ARM",
"author": "Lovell Fuller <npm@lovell.info>", "author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://sharp.pixelplumbing.com", "homepage": "https://sharp.pixelplumbing.com",

View File

@ -1,6 +1,6 @@
{ {
"name": "@img/sharp-linuxmusl-x64", "name": "@img/sharp-linuxmusl-x64",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"description": "Prebuilt sharp for use with Linux (musl) x64", "description": "Prebuilt sharp for use with Linux (musl) x64",
"author": "Lovell Fuller <npm@lovell.info>", "author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://sharp.pixelplumbing.com", "homepage": "https://sharp.pixelplumbing.com",

View File

@ -1,6 +1,6 @@
{ {
"name": "@img/sharp", "name": "@img/sharp",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"private": "true", "private": "true",
"workspaces": [ "workspaces": [
"darwin-arm64", "darwin-arm64",

9
npm/release-notes.js Normal file
View File

@ -0,0 +1,9 @@
const { readFileSync, writeFileSync } = require('node:fs');
const { version } = require('./package.json');
const versionWithoutPreRelease = version.replace(/-rc\.\d+$/, '');
const markdown = readFileSync(`./docs/src/content/docs/changelog/v${versionWithoutPreRelease}.md`, 'utf8');
const markdownWithoutFrontmatter = markdown.replace(/---\n.*?\n---\n+/s, '');
writeFileSync('./release-notes.md', markdownWithoutFrontmatter);

View File

@ -1,6 +1,6 @@
{ {
"name": "@img/sharp-wasm32", "name": "@img/sharp-wasm32",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"description": "Prebuilt sharp for use with wasm32", "description": "Prebuilt sharp for use with wasm32",
"author": "Lovell Fuller <npm@lovell.info>", "author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://sharp.pixelplumbing.com", "homepage": "https://sharp.pixelplumbing.com",

View File

@ -1,6 +1,6 @@
{ {
"name": "@img/sharp-win32-arm64", "name": "@img/sharp-win32-arm64",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"description": "Prebuilt sharp for use with Windows 64-bit ARM", "description": "Prebuilt sharp for use with Windows 64-bit ARM",
"author": "Lovell Fuller <npm@lovell.info>", "author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://sharp.pixelplumbing.com", "homepage": "https://sharp.pixelplumbing.com",

View File

@ -1,6 +1,6 @@
{ {
"name": "@img/sharp-win32-ia32", "name": "@img/sharp-win32-ia32",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"description": "Prebuilt sharp for use with Windows x86 (32-bit)", "description": "Prebuilt sharp for use with Windows x86 (32-bit)",
"author": "Lovell Fuller <npm@lovell.info>", "author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://sharp.pixelplumbing.com", "homepage": "https://sharp.pixelplumbing.com",

View File

@ -1,6 +1,6 @@
{ {
"name": "@img/sharp-win32-x64", "name": "@img/sharp-win32-x64",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"description": "Prebuilt sharp for use with Windows x64", "description": "Prebuilt sharp for use with Windows x64",
"author": "Lovell Fuller <npm@lovell.info>", "author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://sharp.pixelplumbing.com", "homepage": "https://sharp.pixelplumbing.com",

View File

@ -1,7 +1,7 @@
{ {
"name": "sharp", "name": "sharp",
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images", "description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",
"version": "0.34.4-rc.0", "version": "0.34.4-rc.1",
"author": "Lovell Fuller <npm@lovell.info>", "author": "Lovell Fuller <npm@lovell.info>",
"homepage": "https://sharp.pixelplumbing.com", "homepage": "https://sharp.pixelplumbing.com",
"contributors": [ "contributors": [
@ -101,6 +101,7 @@
"test-leak": "./test/leak/leak.sh", "test-leak": "./test/leak/leak.sh",
"test-types": "tsd", "test-types": "tsd",
"package-from-local-build": "node npm/from-local-build.js", "package-from-local-build": "node npm/from-local-build.js",
"package-release-notes": "node npm/release-notes.js",
"docs-build": "node docs/build.mjs", "docs-build": "node docs/build.mjs",
"docs-serve": "cd docs && npm start", "docs-serve": "cd docs && npm start",
"docs-publish": "cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp" "docs-publish": "cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"
@ -141,8 +142,8 @@
"semver": "^7.7.2" "semver": "^7.7.2"
}, },
"optionalDependencies": { "optionalDependencies": {
"@img/sharp-darwin-arm64": "0.34.4-rc.0", "@img/sharp-darwin-arm64": "0.34.4-rc.1",
"@img/sharp-darwin-x64": "0.34.4-rc.0", "@img/sharp-darwin-x64": "0.34.4-rc.1",
"@img/sharp-libvips-darwin-arm64": "1.2.1", "@img/sharp-libvips-darwin-arm64": "1.2.1",
"@img/sharp-libvips-darwin-x64": "1.2.1", "@img/sharp-libvips-darwin-x64": "1.2.1",
"@img/sharp-libvips-linux-arm": "1.2.1", "@img/sharp-libvips-linux-arm": "1.2.1",
@ -152,17 +153,17 @@
"@img/sharp-libvips-linux-x64": "1.2.1", "@img/sharp-libvips-linux-x64": "1.2.1",
"@img/sharp-libvips-linuxmusl-arm64": "1.2.1", "@img/sharp-libvips-linuxmusl-arm64": "1.2.1",
"@img/sharp-libvips-linuxmusl-x64": "1.2.1", "@img/sharp-libvips-linuxmusl-x64": "1.2.1",
"@img/sharp-linux-arm": "0.34.4-rc.0", "@img/sharp-linux-arm": "0.34.4-rc.1",
"@img/sharp-linux-arm64": "0.34.4-rc.0", "@img/sharp-linux-arm64": "0.34.4-rc.1",
"@img/sharp-linux-ppc64": "0.34.4-rc.0", "@img/sharp-linux-ppc64": "0.34.4-rc.1",
"@img/sharp-linux-s390x": "0.34.4-rc.0", "@img/sharp-linux-s390x": "0.34.4-rc.1",
"@img/sharp-linux-x64": "0.34.4-rc.0", "@img/sharp-linux-x64": "0.34.4-rc.1",
"@img/sharp-linuxmusl-arm64": "0.34.4-rc.0", "@img/sharp-linuxmusl-arm64": "0.34.4-rc.1",
"@img/sharp-linuxmusl-x64": "0.34.4-rc.0", "@img/sharp-linuxmusl-x64": "0.34.4-rc.1",
"@img/sharp-wasm32": "0.34.4-rc.0", "@img/sharp-wasm32": "0.34.4-rc.1",
"@img/sharp-win32-arm64": "0.34.4-rc.0", "@img/sharp-win32-arm64": "0.34.4-rc.1",
"@img/sharp-win32-ia32": "0.34.4-rc.0", "@img/sharp-win32-ia32": "0.34.4-rc.1",
"@img/sharp-win32-x64": "0.34.4-rc.0" "@img/sharp-win32-x64": "0.34.4-rc.1"
}, },
"devDependencies": { "devDependencies": {
"@emnapi/runtime": "^1.4.5", "@emnapi/runtime": "^1.4.5",
@ -181,11 +182,11 @@
"license-checker": "^25.0.1", "license-checker": "^25.0.1",
"mocha": "^11.7.1", "mocha": "^11.7.1",
"node-addon-api": "^8.5.0", "node-addon-api": "^8.5.0",
"node-gyp": "^11.2.0", "node-gyp": "^11.4.1",
"nyc": "^17.1.0", "nyc": "^17.1.0",
"semistandard": "^17.0.0", "semistandard": "^17.0.0",
"tar-fs": "^3.1.0", "tar-fs": "^3.1.0",
"tsd": "^0.32.0" "tsd": "^0.33.0"
}, },
"license": "Apache-2.0", "license": "Apache-2.0",
"engines": { "engines": {

View File

@ -82,7 +82,6 @@ describe('Image channel extraction', function () {
const output = fixtures.path('output.extract-alpha-2-channel.png'); const output = fixtures.path('output.extract-alpha-2-channel.png');
sharp(fixtures.inputPngWithGreyAlpha) sharp(fixtures.inputPngWithGreyAlpha)
.extractChannel('alpha') .extractChannel('alpha')
.toColourspace('b-w')
.toFile(output, function (err, info) { .toFile(output, function (err, info) {
if (err) throw err; if (err) throw err;
assert.strictEqual(1, info.channels); assert.strictEqual(1, info.channels);