image-js 1.4.0 → 1.5.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/dist/image-js.esm.js +11 -2
- package/dist/image-js.esm.js.map +1 -1
- package/dist/image-js.esm.min.js +2 -2
- package/dist/image-js.esm.min.js.map +1 -1
- package/dist/image-js.umd.js +11 -2
- package/dist/image-js.umd.js.map +1 -1
- package/dist/image-js.umd.min.js +2 -2
- package/dist/image-js.umd.min.js.map +1 -1
- package/lib/utils/cross_platform.d.ts +1 -0
- package/lib/utils/cross_platform.d.ts.map +1 -1
- package/lib/utils/cross_platform.js +9 -1
- package/lib/utils/cross_platform.js.map +1 -1
- package/package.json +4 -2
- package/src/utils/cross_platform.ts +11 -1
package/dist/image-js.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* image-js v1.
|
|
2
|
+
* image-js v1.5.0
|
|
3
3
|
* Image processing and manipulation in JavaScript
|
|
4
4
|
* https://github.com/image-js/image-js#readme
|
|
5
5
|
*
|
|
@@ -23211,13 +23211,22 @@ ${indent}columns: ${matrix.columns}
|
|
|
23211
23211
|
let CanvasCtorNode;
|
|
23212
23212
|
/**
|
|
23213
23213
|
* Returns a 2D canvas context for rendering on the browser or Node.js.
|
|
23214
|
+
* On Node.js this requires the optional `skia-canvas` package to be installed.
|
|
23214
23215
|
* @param width - Width of the canvas.
|
|
23215
23216
|
* @param height - Height of the canvas.
|
|
23216
23217
|
* @returns The initialised canvas context.
|
|
23217
23218
|
*/
|
|
23218
23219
|
function getCanvasContext(width, height) {
|
|
23219
23220
|
if (isNode()) {
|
|
23220
|
-
|
|
23221
|
+
if (!CanvasCtorNode) {
|
|
23222
|
+
try {
|
|
23223
|
+
CanvasCtorNode = getRequireFn()('skia-canvas').Canvas;
|
|
23224
|
+
} catch (error) {
|
|
23225
|
+
throw new Error('drawText on Node.js requires the optional "skia-canvas" package. Install it with: npm install skia-canvas', {
|
|
23226
|
+
cause: error
|
|
23227
|
+
});
|
|
23228
|
+
}
|
|
23229
|
+
}
|
|
23221
23230
|
return new CanvasCtorNode(width, height).getContext('2d');
|
|
23222
23231
|
} else {
|
|
23223
23232
|
CanvasCtorBrowser ??= globalThis.OffscreenCanvas;
|