-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new private
vips
package (#64845)
- Loading branch information
1 parent
12c8ca7
commit 5d7ecbe
Showing
17 changed files
with
1,016 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. --> | ||
|
||
## Unreleased | ||
|
||
### New Features | ||
|
||
- Initial public release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# `@wordpress/vips` | ||
|
||
Helper package to interact with [`wasm-vips`](https://github.com/kleisauke/wasm-vips). | ||
|
||
## Installation | ||
|
||
Install the module | ||
|
||
```bash | ||
npm install @wordpress/vips --save | ||
``` | ||
|
||
## API Reference | ||
|
||
<!-- START TOKEN(Autogenerated API docs) --> | ||
|
||
### cancelOperations | ||
|
||
Cancels all ongoing image operations for a given item ID. | ||
|
||
The onProgress callbacks check for an IDs existence in this list, killing the process if it's absent. | ||
|
||
_Parameters_ | ||
|
||
- _id_ `ItemId`: Item ID. | ||
|
||
_Returns_ | ||
|
||
- boolean Whether any operation was cancelled. | ||
|
||
### compressImage | ||
|
||
Compresses an existing image using vips. | ||
|
||
_Parameters_ | ||
|
||
- _id_ `ItemId`: Item ID. | ||
- _buffer_ `ArrayBuffer`: Original file buffer. | ||
- _type_ `string`: Mime type. | ||
- _quality_ Desired quality. | ||
- _interlaced_ Whether to use interlaced/progressive mode. Only used if the outputType supports it. | ||
|
||
_Returns_ | ||
|
||
- `Promise< ArrayBuffer >`: Compressed file data. | ||
|
||
### convertImageFormat | ||
|
||
Converts an image to a different format using vips. | ||
|
||
_Parameters_ | ||
|
||
- _id_ `ItemId`: Item ID. | ||
- _buffer_ `ArrayBuffer`: Original file buffer. | ||
- _inputType_ `string`: Input mime type. | ||
- _outputType_ `string`: Output mime type. | ||
- _quality_ Desired quality. | ||
- _interlaced_ Whether to use interlaced/progressive mode. Only used if the outputType supports it. | ||
|
||
### hasTransparency | ||
|
||
Determines whether an image has an alpha channel. | ||
|
||
_Parameters_ | ||
|
||
- _buffer_ `ArrayBuffer`: Original file object. | ||
|
||
_Returns_ | ||
|
||
- `Promise< boolean >`: Whether the image has an alpha channel. | ||
|
||
### resizeImage | ||
|
||
Resizes an image using vips. | ||
|
||
_Parameters_ | ||
|
||
- _id_ `ItemId`: Item ID. | ||
- _buffer_ `ArrayBuffer`: Original file buffer. | ||
- _type_ `string`: Mime type. | ||
- _resize_ `ImageSizeCrop`: Resize options. | ||
- _smartCrop_ Whether to use smart cropping (i.e. saliency-aware). | ||
|
||
_Returns_ | ||
|
||
- `Promise< { buffer: ArrayBuffer; width: number; height: number; originalWidth: number; originalHeight: number; } >`: Processed file data plus the old and new dimensions. | ||
|
||
### setLocation | ||
|
||
Dynamically sets the location / public path to use for loading the WASM files. | ||
|
||
This is required when loading this module in an inline worker, where globals such as **webpack_public_path** are not available. | ||
|
||
_Parameters_ | ||
|
||
- _newLocation_ `string`: Location, typically a base URL such as "<https://example.com/path/to/js/...">. | ||
|
||
<!-- END TOKEN(Autogenerated API docs) --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "@wordpress/vips", | ||
"version": "1.0.0-prerelease", | ||
"private": true, | ||
"description": "Utils for working with libvips.", | ||
"author": "The WordPress Contributors", | ||
"license": "GPL-2.0-or-later", | ||
"keywords": [ | ||
"wordpress", | ||
"media", | ||
"libvips" | ||
], | ||
"homepage": "https://github.com/WordPress/gutenberg/tree/HEAD/packages/vips/README.md", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/WordPress/gutenberg.git", | ||
"directory": "packages/vips" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/WordPress/gutenberg/issues" | ||
}, | ||
"engines": { | ||
"node": ">=18.12.0", | ||
"npm": ">=8.19.2" | ||
}, | ||
"main": "build/index.js", | ||
"module": "build-module/index.js", | ||
"types": "build-types", | ||
"dependencies": { | ||
"wasm-vips": "^0.0.10" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
Oops, something went wrong.
5d7ecbe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 5d7ecbe.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11440326942
📝 Reported issues:
/test/e2e/specs/site-editor/site-editor-url-navigation.spec.js