@napi-rs/canvas 0.1.70 → 0.1.71
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 +1 -1
- package/geometry.js +1 -1
- package/js-binding.js +83 -102
- package/load-image.js +1 -1
- package/package.json +36 -36
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# `skr canvas`
|
|
2
2
|
|
|
3
3
|
[](https://github.com/Brooooooklyn/canvas/actions/workflows/CI.yaml)
|
|
4
|
-

|
|
5
5
|
[](https://packagephobia.com/result?p=@napi-rs/canvas)
|
|
6
6
|
[](https://npmcharts.com/compare/@napi-rs/canvas?minimal=true)
|
|
7
7
|
|
package/geometry.js
CHANGED
|
@@ -473,7 +473,7 @@ class DOMMatrix {
|
|
|
473
473
|
console.info([mat.slice(0, 4), mat.slice(4, 8), mat.slice(8, 12), mat.slice(12, 16)])
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
-
[inspect.custom](depth
|
|
476
|
+
[inspect.custom](depth) {
|
|
477
477
|
if (depth < 0) return '[DOMMatrix]'
|
|
478
478
|
|
|
479
479
|
const { a, b, c, d, e, f, is2D, isIdentity } = this
|
package/js-binding.js
CHANGED
|
@@ -59,9 +59,9 @@ const isMuslFromChildProcess = () => {
|
|
|
59
59
|
function requireNative() {
|
|
60
60
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
61
61
|
try {
|
|
62
|
-
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
|
|
62
|
+
nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
|
|
63
63
|
} catch (err) {
|
|
64
|
-
loadErrors.push(err)
|
|
64
|
+
loadErrors.push(err)
|
|
65
65
|
}
|
|
66
66
|
} else if (process.platform === 'android') {
|
|
67
67
|
if (process.arch === 'arm64') {
|
|
@@ -75,7 +75,6 @@ function requireNative() {
|
|
|
75
75
|
} catch (e) {
|
|
76
76
|
loadErrors.push(e)
|
|
77
77
|
}
|
|
78
|
-
|
|
79
78
|
} else if (process.arch === 'arm') {
|
|
80
79
|
try {
|
|
81
80
|
return require('./skia.android-arm-eabi.node')
|
|
@@ -87,7 +86,6 @@ function requireNative() {
|
|
|
87
86
|
} catch (e) {
|
|
88
87
|
loadErrors.push(e)
|
|
89
88
|
}
|
|
90
|
-
|
|
91
89
|
} else {
|
|
92
90
|
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
|
93
91
|
}
|
|
@@ -103,7 +101,6 @@ function requireNative() {
|
|
|
103
101
|
} catch (e) {
|
|
104
102
|
loadErrors.push(e)
|
|
105
103
|
}
|
|
106
|
-
|
|
107
104
|
} else if (process.arch === 'ia32') {
|
|
108
105
|
try {
|
|
109
106
|
return require('./skia.win32-ia32-msvc.node')
|
|
@@ -115,7 +112,6 @@ function requireNative() {
|
|
|
115
112
|
} catch (e) {
|
|
116
113
|
loadErrors.push(e)
|
|
117
114
|
}
|
|
118
|
-
|
|
119
115
|
} else if (process.arch === 'arm64') {
|
|
120
116
|
try {
|
|
121
117
|
return require('./skia.win32-arm64-msvc.node')
|
|
@@ -127,21 +123,20 @@ function requireNative() {
|
|
|
127
123
|
} catch (e) {
|
|
128
124
|
loadErrors.push(e)
|
|
129
125
|
}
|
|
130
|
-
|
|
131
126
|
} else {
|
|
132
127
|
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
|
133
128
|
}
|
|
134
129
|
} else if (process.platform === 'darwin') {
|
|
135
130
|
try {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
131
|
+
return require('./skia.darwin-universal.node')
|
|
132
|
+
} catch (e) {
|
|
133
|
+
loadErrors.push(e)
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
return require('@napi-rs/canvas-darwin-universal')
|
|
137
|
+
} catch (e) {
|
|
138
|
+
loadErrors.push(e)
|
|
139
|
+
}
|
|
145
140
|
|
|
146
141
|
if (process.arch === 'x64') {
|
|
147
142
|
try {
|
|
@@ -154,7 +149,6 @@ function requireNative() {
|
|
|
154
149
|
} catch (e) {
|
|
155
150
|
loadErrors.push(e)
|
|
156
151
|
}
|
|
157
|
-
|
|
158
152
|
} else if (process.arch === 'arm64') {
|
|
159
153
|
try {
|
|
160
154
|
return require('./skia.darwin-arm64.node')
|
|
@@ -166,7 +160,6 @@ function requireNative() {
|
|
|
166
160
|
} catch (e) {
|
|
167
161
|
loadErrors.push(e)
|
|
168
162
|
}
|
|
169
|
-
|
|
170
163
|
} else {
|
|
171
164
|
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
|
172
165
|
}
|
|
@@ -182,7 +175,6 @@ function requireNative() {
|
|
|
182
175
|
} catch (e) {
|
|
183
176
|
loadErrors.push(e)
|
|
184
177
|
}
|
|
185
|
-
|
|
186
178
|
} else if (process.arch === 'arm64') {
|
|
187
179
|
try {
|
|
188
180
|
return require('./skia.freebsd-arm64.node')
|
|
@@ -194,7 +186,6 @@ function requireNative() {
|
|
|
194
186
|
} catch (e) {
|
|
195
187
|
loadErrors.push(e)
|
|
196
188
|
}
|
|
197
|
-
|
|
198
189
|
} else {
|
|
199
190
|
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
|
200
191
|
}
|
|
@@ -202,106 +193,98 @@ function requireNative() {
|
|
|
202
193
|
if (process.arch === 'x64') {
|
|
203
194
|
if (isMusl()) {
|
|
204
195
|
try {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
196
|
+
return require('./skia.linux-x64-musl.node')
|
|
197
|
+
} catch (e) {
|
|
198
|
+
loadErrors.push(e)
|
|
199
|
+
}
|
|
200
|
+
try {
|
|
201
|
+
return require('@napi-rs/canvas-linux-x64-musl')
|
|
202
|
+
} catch (e) {
|
|
203
|
+
loadErrors.push(e)
|
|
204
|
+
}
|
|
215
205
|
} else {
|
|
216
206
|
try {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
207
|
+
return require('./skia.linux-x64-gnu.node')
|
|
208
|
+
} catch (e) {
|
|
209
|
+
loadErrors.push(e)
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
return require('@napi-rs/canvas-linux-x64-gnu')
|
|
213
|
+
} catch (e) {
|
|
214
|
+
loadErrors.push(e)
|
|
215
|
+
}
|
|
227
216
|
}
|
|
228
217
|
} else if (process.arch === 'arm64') {
|
|
229
218
|
if (isMusl()) {
|
|
230
219
|
try {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
220
|
+
return require('./skia.linux-arm64-musl.node')
|
|
221
|
+
} catch (e) {
|
|
222
|
+
loadErrors.push(e)
|
|
223
|
+
}
|
|
224
|
+
try {
|
|
225
|
+
return require('@napi-rs/canvas-linux-arm64-musl')
|
|
226
|
+
} catch (e) {
|
|
227
|
+
loadErrors.push(e)
|
|
228
|
+
}
|
|
241
229
|
} else {
|
|
242
230
|
try {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
231
|
+
return require('./skia.linux-arm64-gnu.node')
|
|
232
|
+
} catch (e) {
|
|
233
|
+
loadErrors.push(e)
|
|
234
|
+
}
|
|
235
|
+
try {
|
|
236
|
+
return require('@napi-rs/canvas-linux-arm64-gnu')
|
|
237
|
+
} catch (e) {
|
|
238
|
+
loadErrors.push(e)
|
|
239
|
+
}
|
|
253
240
|
}
|
|
254
241
|
} else if (process.arch === 'arm') {
|
|
255
242
|
if (isMusl()) {
|
|
256
243
|
try {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
244
|
+
return require('./skia.linux-arm-musleabihf.node')
|
|
245
|
+
} catch (e) {
|
|
246
|
+
loadErrors.push(e)
|
|
247
|
+
}
|
|
248
|
+
try {
|
|
249
|
+
return require('@napi-rs/canvas-linux-arm-musleabihf')
|
|
250
|
+
} catch (e) {
|
|
251
|
+
loadErrors.push(e)
|
|
252
|
+
}
|
|
267
253
|
} else {
|
|
268
254
|
try {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
255
|
+
return require('./skia.linux-arm-gnueabihf.node')
|
|
256
|
+
} catch (e) {
|
|
257
|
+
loadErrors.push(e)
|
|
258
|
+
}
|
|
259
|
+
try {
|
|
260
|
+
return require('@napi-rs/canvas-linux-arm-gnueabihf')
|
|
261
|
+
} catch (e) {
|
|
262
|
+
loadErrors.push(e)
|
|
263
|
+
}
|
|
279
264
|
}
|
|
280
265
|
} else if (process.arch === 'riscv64') {
|
|
281
266
|
if (isMusl()) {
|
|
282
267
|
try {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
268
|
+
return require('./skia.linux-riscv64-musl.node')
|
|
269
|
+
} catch (e) {
|
|
270
|
+
loadErrors.push(e)
|
|
271
|
+
}
|
|
272
|
+
try {
|
|
273
|
+
return require('@napi-rs/canvas-linux-riscv64-musl')
|
|
274
|
+
} catch (e) {
|
|
275
|
+
loadErrors.push(e)
|
|
276
|
+
}
|
|
293
277
|
} else {
|
|
294
278
|
try {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
279
|
+
return require('./skia.linux-riscv64-gnu.node')
|
|
280
|
+
} catch (e) {
|
|
281
|
+
loadErrors.push(e)
|
|
282
|
+
}
|
|
283
|
+
try {
|
|
284
|
+
return require('@napi-rs/canvas-linux-riscv64-gnu')
|
|
285
|
+
} catch (e) {
|
|
286
|
+
loadErrors.push(e)
|
|
287
|
+
}
|
|
305
288
|
}
|
|
306
289
|
} else if (process.arch === 'ppc64') {
|
|
307
290
|
try {
|
|
@@ -314,7 +297,6 @@ function requireNative() {
|
|
|
314
297
|
} catch (e) {
|
|
315
298
|
loadErrors.push(e)
|
|
316
299
|
}
|
|
317
|
-
|
|
318
300
|
} else if (process.arch === 's390x') {
|
|
319
301
|
try {
|
|
320
302
|
return require('./skia.linux-s390x-gnu.node')
|
|
@@ -326,7 +308,6 @@ function requireNative() {
|
|
|
326
308
|
} catch (e) {
|
|
327
309
|
loadErrors.push(e)
|
|
328
310
|
}
|
|
329
|
-
|
|
330
311
|
} else {
|
|
331
312
|
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
|
332
313
|
}
|
package/load-image.js
CHANGED
|
@@ -36,7 +36,7 @@ module.exports = async function loadImage(source, options = {}) {
|
|
|
36
36
|
// if source is a string or URL instance
|
|
37
37
|
if (typeof source === 'string') {
|
|
38
38
|
// if the source exists as a file, construct image from that file
|
|
39
|
-
if (
|
|
39
|
+
if (!source.startsWith('http') && !source.startsWith('https') && (await exists(source))) {
|
|
40
40
|
return createImage(source, options.alt)
|
|
41
41
|
} else {
|
|
42
42
|
// the source is a remote url here
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@napi-rs/canvas",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.71",
|
|
4
4
|
"description": "Canvas for Node.js with skia backend",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -67,39 +67,39 @@
|
|
|
67
67
|
"version": "napi version && conventional-changelog -p angular -i CHANGELOG.md -s && git add ."
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@jimp/core": "^1.
|
|
71
|
-
"@jimp/custom": "^0.22.
|
|
72
|
-
"@jimp/jpeg": "^0.22.
|
|
73
|
-
"@jimp/png": "^0.22.
|
|
74
|
-
"@napi-rs/cli": "^3.0.0-alpha.
|
|
75
|
-
"@octokit/rest": "^
|
|
76
|
-
"@swc-node/register": "^1.
|
|
77
|
-
"@swc/core": "^1.
|
|
70
|
+
"@jimp/core": "^1.6.0",
|
|
71
|
+
"@jimp/custom": "^0.22.12",
|
|
72
|
+
"@jimp/jpeg": "^0.22.12",
|
|
73
|
+
"@jimp/png": "^0.22.12",
|
|
74
|
+
"@napi-rs/cli": "^3.0.0-alpha.88",
|
|
75
|
+
"@octokit/rest": "^22.0.0",
|
|
76
|
+
"@swc-node/register": "^1.10.10",
|
|
77
|
+
"@swc/core": "^1.11.31",
|
|
78
78
|
"@taplo/cli": "^0.7.0",
|
|
79
|
-
"@types/lodash": "^4.
|
|
80
|
-
"@types/node": "^
|
|
79
|
+
"@types/lodash": "^4.17.17",
|
|
80
|
+
"@types/node": "^22.15.30",
|
|
81
81
|
"@types/semver": "^7",
|
|
82
|
-
"ava": "^6.
|
|
83
|
-
"canvas": "^3.
|
|
82
|
+
"ava": "^6.3.0",
|
|
83
|
+
"canvas": "^3.1.0",
|
|
84
84
|
"canvaskit-wasm": "^0.40.0",
|
|
85
85
|
"colorette": "^2.0.20",
|
|
86
86
|
"conventional-changelog-cli": "^5.0.0",
|
|
87
|
-
"core-js": "^3.
|
|
88
|
-
"echarts": "^5.
|
|
89
|
-
"husky": "^9.
|
|
90
|
-
"lint-staged": "^
|
|
87
|
+
"core-js": "^3.42.0",
|
|
88
|
+
"echarts": "^5.6.0",
|
|
89
|
+
"husky": "^9.1.7",
|
|
90
|
+
"lint-staged": "^16.1.0",
|
|
91
91
|
"lodash": "^4.17.21",
|
|
92
|
-
"npm-run-all2": "^
|
|
93
|
-
"oxlint": "^0.
|
|
92
|
+
"npm-run-all2": "^8.0.4",
|
|
93
|
+
"oxlint": "^0.18.0",
|
|
94
94
|
"pinst": "^3.0.0",
|
|
95
95
|
"png.js": "^0.2.1",
|
|
96
|
-
"prettier": "^3.
|
|
96
|
+
"prettier": "^3.5.3",
|
|
97
97
|
"pretty-bytes": "^7.0.0",
|
|
98
|
-
"semver": "^7.
|
|
99
|
-
"skia-canvas": "^2.0.
|
|
100
|
-
"table": "^6.
|
|
101
|
-
"tinybench": "^4.0.
|
|
102
|
-
"typescript": "^5.
|
|
98
|
+
"semver": "^7.7.2",
|
|
99
|
+
"skia-canvas": "^2.0.2",
|
|
100
|
+
"table": "^6.9.0",
|
|
101
|
+
"tinybench": "^4.0.1",
|
|
102
|
+
"typescript": "^5.8.3"
|
|
103
103
|
},
|
|
104
104
|
"lint-staged": {
|
|
105
105
|
"*.@(js|ts|tsx|yml|yaml|md|json|html)": [
|
|
@@ -136,17 +136,17 @@
|
|
|
136
136
|
"singleQuote": true,
|
|
137
137
|
"arrowParens": "always"
|
|
138
138
|
},
|
|
139
|
-
"packageManager": "yarn@4.9.
|
|
139
|
+
"packageManager": "yarn@4.9.2",
|
|
140
140
|
"optionalDependencies": {
|
|
141
|
-
"@napi-rs/canvas-linux-x64-gnu": "0.1.
|
|
142
|
-
"@napi-rs/canvas-darwin-x64": "0.1.
|
|
143
|
-
"@napi-rs/canvas-win32-x64-msvc": "0.1.
|
|
144
|
-
"@napi-rs/canvas-linux-arm-gnueabihf": "0.1.
|
|
145
|
-
"@napi-rs/canvas-linux-x64-musl": "0.1.
|
|
146
|
-
"@napi-rs/canvas-linux-arm64-gnu": "0.1.
|
|
147
|
-
"@napi-rs/canvas-linux-arm64-musl": "0.1.
|
|
148
|
-
"@napi-rs/canvas-darwin-arm64": "0.1.
|
|
149
|
-
"@napi-rs/canvas-android-arm64": "0.1.
|
|
150
|
-
"@napi-rs/canvas-linux-riscv64-gnu": "0.1.
|
|
141
|
+
"@napi-rs/canvas-linux-x64-gnu": "0.1.71",
|
|
142
|
+
"@napi-rs/canvas-darwin-x64": "0.1.71",
|
|
143
|
+
"@napi-rs/canvas-win32-x64-msvc": "0.1.71",
|
|
144
|
+
"@napi-rs/canvas-linux-arm-gnueabihf": "0.1.71",
|
|
145
|
+
"@napi-rs/canvas-linux-x64-musl": "0.1.71",
|
|
146
|
+
"@napi-rs/canvas-linux-arm64-gnu": "0.1.71",
|
|
147
|
+
"@napi-rs/canvas-linux-arm64-musl": "0.1.71",
|
|
148
|
+
"@napi-rs/canvas-darwin-arm64": "0.1.71",
|
|
149
|
+
"@napi-rs/canvas-android-arm64": "0.1.71",
|
|
150
|
+
"@napi-rs/canvas-linux-riscv64-gnu": "0.1.71"
|
|
151
151
|
}
|
|
152
152
|
}
|