@napi-rs/canvas 0.1.12 → 0.1.17
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/CHANGELOG.md +41 -0
- package/README.md +10 -2
- package/index.d.ts +0 -1
- package/index.js +28 -36
- package/js-binding.js +220 -0
- package/package.json +35 -48
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
+
## [0.1.17](https://github.com/Brooooooklyn/canvas/compare/v0.1.16...v0.1.17) (2021-12-12)
|
|
2
|
+
|
|
3
|
+
## [0.1.16](https://github.com/Brooooooklyn/canvas/compare/v0.1.15...v0.1.16) (2021-12-12)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
- make methods on ctx configurable & writable ([affe82d](https://github.com/Brooooooklyn/canvas/commit/affe82d0b8880441737497403d790f4d39a217c3))
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- chrome/m97 ([66c900f](https://github.com/Brooooooklyn/canvas/commit/66c900f4307f8204b55912659874a83513220460))
|
|
12
|
+
|
|
13
|
+
## [0.1.15](https://github.com/Brooooooklyn/canvas/compare/v0.1.14...v0.1.15) (2021-11-11)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- `vercel/nft` and `webpack` compatible issue ([f2e23f5](https://github.com/Brooooooklyn/canvas/commit/f2e23f5d763795c1e499e1eda5b70078a6de501a))
|
|
18
|
+
|
|
19
|
+
## [0.1.14](https://github.com/Brooooooklyn/canvas/compare/v0.1.13...v0.1.14) (2021-10-26)
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
- Now generating avif images is 10x+ faster. ([407d1d1](https://github.com/Brooooooklyn/canvas/commit/407d1d1f09dce622426b71ee800480534c8e0888))
|
|
24
|
+
- Use different quality for WebP and JPEG formats, which is more in line with the browser's default values. ([fdefa5d](https://github.com/Brooooooklyn/canvas/commit/fdefa5dd278fcc911cb74524388ec7960d9cd1f6))
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
- The option to generate avif removes alphaQuality and calculates it internally. ([8de6e95](https://github.com/Brooooooklyn/canvas/commit/8de6e95d23383897870c66e59698a71cd0e73631))
|
|
29
|
+
- Add a new SVG generation avif example. ([04d401a](https://github.com/Brooooooklyn/canvas/commit/04d401aaf3d35d13223e32af9e13b829f13170fc))
|
|
30
|
+
|
|
31
|
+
## [0.1.13](https://github.com/Brooooooklyn/canvas/compare/v0.1.12...v0.1.13) (2021-10-20)
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
- text align position ([435e102](https://github.com/Brooooooklyn/canvas/commit/435e102e526e206a89f6a1bae2e9f8a1d1646b9f))
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
- update rust toolchain ([1cda93b](https://github.com/Brooooooklyn/canvas/commit/1cda93b9ade402893ca1e192a35522eb5b13190a))
|
|
40
|
+
- upgrade to chrome/m96 ([a7b3ffe](https://github.com/Brooooooklyn/canvas/commit/a7b3ffe68e4125e2ab63e42c09409cd9cc49dc9f))
|
|
41
|
+
|
|
1
42
|
## [0.1.12](https://github.com/Brooooooklyn/canvas/compare/v0.1.11...v0.1.12) (2021-10-15)
|
|
2
43
|
|
|
3
44
|
### Features
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# `skr canvas`
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-

|
|
5
5
|
[](https://packagephobia.com/result?p=@napi-rs/canvas)
|
|
6
6
|
[](https://npmcharts.com/compare/@napi-rs/canvas?minimal=true)
|
|
7
7
|
|
|
@@ -298,7 +298,15 @@ path.simplify().toSVGString()
|
|
|
298
298
|
|
|
299
299
|
> The tiger.json was serialized from [gojs/samples/tiger](https://github.com/NorthwoodsSoftware/GoJS/blob/master/samples/tiger.html)
|
|
300
300
|
|
|
301
|
-
|
|
301
|
+
<img width="500" src="example/tiger.png">
|
|
302
|
+
|
|
303
|
+
```shell
|
|
304
|
+
node example/anime-girl.js
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
| SVG | PNG |
|
|
308
|
+
| ---------------------------------------------- | ---------------------------------------------- |
|
|
309
|
+
| <img width="500" src="example/anime-girl.svg"> | <img width="500" src="example/anime-girl.png"> |
|
|
302
310
|
|
|
303
311
|
# Building
|
|
304
312
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
const { platform, homedir } = require('os')
|
|
2
2
|
const { join } = require('path')
|
|
3
3
|
|
|
4
|
-
const { loadBinding } = require('@node-rs/helper')
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* __dirname means load native addon from current dir
|
|
8
|
-
* 'skia' means native addon name is `skia`
|
|
9
|
-
* the first arguments was decided by `napi.name` field in `package.json`
|
|
10
|
-
* the second arguments was decided by `name` field in `package.json`
|
|
11
|
-
* loadBinding helper will load `skia.[PLATFORM].node` from `__dirname` first
|
|
12
|
-
* If failed to load addon, it will fallback to load from `@napi-rs/skia-[PLATFORM]`
|
|
13
|
-
*/
|
|
14
4
|
const {
|
|
15
5
|
CanvasRenderingContext2D,
|
|
16
6
|
CanvasElement,
|
|
@@ -22,9 +12,9 @@ const {
|
|
|
22
12
|
CanvasPattern,
|
|
23
13
|
GlobalFonts,
|
|
24
14
|
convertSVGTextToPath: _convertSVGTextToPath,
|
|
25
|
-
} =
|
|
15
|
+
} = require('./js-binding')
|
|
26
16
|
|
|
27
|
-
const
|
|
17
|
+
const { DOMPoint, DOMMatrix, DOMRect } = require('./geometry')
|
|
28
18
|
|
|
29
19
|
const StrokeJoin = {
|
|
30
20
|
Miter: 0,
|
|
@@ -197,9 +187,9 @@ function createCanvas(width, height, flag) {
|
|
|
197
187
|
}
|
|
198
188
|
return new ImageData(widthOrImage, height, { colorSpace: 'srgb', ...attrs })
|
|
199
189
|
},
|
|
200
|
-
configurable:
|
|
190
|
+
configurable: true,
|
|
201
191
|
enumerable: false,
|
|
202
|
-
writable:
|
|
192
|
+
writable: true,
|
|
203
193
|
})
|
|
204
194
|
|
|
205
195
|
Object.defineProperty(canvasElement, 'ctx', {
|
|
@@ -221,16 +211,28 @@ function createCanvas(width, height, flag) {
|
|
|
221
211
|
toDataURLAsync: canvasToDataURLAsync,
|
|
222
212
|
} = Object.getPrototypeOf(canvasElement)
|
|
223
213
|
|
|
214
|
+
// See also: https://github.com/kornelski/cavif-rs#usage
|
|
215
|
+
const avifDefaultQuality = 80
|
|
216
|
+
const avifConfig = {
|
|
217
|
+
// Quality from 1 (worst) to 100 (best), the default value is 80. The numbers have different meaning than JPEG's quality scale. Beware when comparing codecs. There is no lossless compression support.
|
|
218
|
+
quality: avifDefaultQuality,
|
|
219
|
+
|
|
220
|
+
// Calculate alphaQuality, this is consistent with cavif.
|
|
221
|
+
// https://github.com/kornelski/cavif-rs/blob/37847b95bb81d4cf90e36b7fab2c7fbbcf95abe2/src/main.rs#L97
|
|
222
|
+
alphaQuality: Math.min((avifDefaultQuality + 100) / 2, avifDefaultQuality + avifDefaultQuality / 4 + 2),
|
|
223
|
+
threads: 0,
|
|
224
|
+
|
|
225
|
+
// Encoding speed between 1 (best, but slowest) and 10 (fastest, but a blurry mess), the default value is 4. Speeds 1 and 2 are unbelievably slow, but make files ~3-5% smaller. Speeds 7 and above degrade compression significantly, and are not recommended.
|
|
226
|
+
speed: 4,
|
|
227
|
+
}
|
|
228
|
+
|
|
224
229
|
canvasElement.encode = function encode(type, qualityOrConfig) {
|
|
225
230
|
if (type === 'avif') {
|
|
226
231
|
return canvasEncode.call(
|
|
227
232
|
this,
|
|
228
233
|
type,
|
|
229
234
|
JSON.stringify({
|
|
230
|
-
|
|
231
|
-
alphaQuality: 92,
|
|
232
|
-
threads: 0,
|
|
233
|
-
speed: 1,
|
|
235
|
+
...avifConfig,
|
|
234
236
|
...(qualityOrConfig || {}),
|
|
235
237
|
}),
|
|
236
238
|
)
|
|
@@ -244,10 +246,7 @@ function createCanvas(width, height, flag) {
|
|
|
244
246
|
this,
|
|
245
247
|
type,
|
|
246
248
|
JSON.stringify({
|
|
247
|
-
|
|
248
|
-
alphaQuality: 92,
|
|
249
|
-
threads: 0,
|
|
250
|
-
speed: 1,
|
|
249
|
+
...avifConfig,
|
|
251
250
|
...(qualityOrConfig || {}),
|
|
252
251
|
}),
|
|
253
252
|
)
|
|
@@ -261,10 +260,7 @@ function createCanvas(width, height, flag) {
|
|
|
261
260
|
this,
|
|
262
261
|
type,
|
|
263
262
|
JSON.stringify({
|
|
264
|
-
|
|
265
|
-
alphaQuality: 92,
|
|
266
|
-
threads: 0,
|
|
267
|
-
speed: 1,
|
|
263
|
+
...avifConfig,
|
|
268
264
|
...(qualityOrConfig || {}),
|
|
269
265
|
}),
|
|
270
266
|
)
|
|
@@ -278,10 +274,7 @@ function createCanvas(width, height, flag) {
|
|
|
278
274
|
this,
|
|
279
275
|
type,
|
|
280
276
|
JSON.stringify({
|
|
281
|
-
|
|
282
|
-
alphaQuality: 92,
|
|
283
|
-
threads: 0,
|
|
284
|
-
speed: 1,
|
|
277
|
+
...avifConfig,
|
|
285
278
|
...(qualityOrConfig || {}),
|
|
286
279
|
}),
|
|
287
280
|
)
|
|
@@ -295,10 +288,7 @@ function createCanvas(width, height, flag) {
|
|
|
295
288
|
this,
|
|
296
289
|
type,
|
|
297
290
|
JSON.stringify({
|
|
298
|
-
|
|
299
|
-
alphaQuality: 92,
|
|
300
|
-
threads: 0,
|
|
301
|
-
speed: 1,
|
|
291
|
+
...avifConfig,
|
|
302
292
|
...(qualityOrConfig || {}),
|
|
303
293
|
}),
|
|
304
294
|
)
|
|
@@ -335,7 +325,7 @@ if (!process.env.DISABLE_SYSTEM_FONTS_LOAD) {
|
|
|
335
325
|
}
|
|
336
326
|
|
|
337
327
|
function convertSVGTextToPath(input) {
|
|
338
|
-
return _convertSVGTextToPath(Buffer.from(input), GlobalFontsSingleton)
|
|
328
|
+
return _convertSVGTextToPath(Buffer.isBuffer(input) ? input : Buffer.from(input), GlobalFontsSingleton)
|
|
339
329
|
}
|
|
340
330
|
|
|
341
331
|
module.exports = {
|
|
@@ -349,7 +339,9 @@ module.exports = {
|
|
|
349
339
|
StrokeCap,
|
|
350
340
|
StrokeJoin,
|
|
351
341
|
SvgExportFlag,
|
|
352
|
-
...Geometry,
|
|
353
342
|
GlobalFonts: GlobalFontsSingleton,
|
|
354
343
|
convertSVGTextToPath,
|
|
344
|
+
DOMPoint,
|
|
345
|
+
DOMMatrix,
|
|
346
|
+
DOMRect,
|
|
355
347
|
}
|
package/js-binding.js
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
const { existsSync, readFileSync } = require('fs')
|
|
2
|
+
const { join } = require('path')
|
|
3
|
+
|
|
4
|
+
const { platform, arch } = process
|
|
5
|
+
|
|
6
|
+
let nativeBinding = null
|
|
7
|
+
let localFileExisted = false
|
|
8
|
+
let isMusl = false
|
|
9
|
+
let loadError = null
|
|
10
|
+
|
|
11
|
+
switch (platform) {
|
|
12
|
+
case 'android':
|
|
13
|
+
if (arch !== 'arm64') {
|
|
14
|
+
throw new Error(`Unsupported architecture on Android ${arch}`)
|
|
15
|
+
}
|
|
16
|
+
localFileExisted = existsSync(join(__dirname, 'skia.android-arm64.node'))
|
|
17
|
+
try {
|
|
18
|
+
if (localFileExisted) {
|
|
19
|
+
nativeBinding = require('./skia.android-arm64.node')
|
|
20
|
+
} else {
|
|
21
|
+
nativeBinding = require('@napi-rs/canvas-android-arm64')
|
|
22
|
+
}
|
|
23
|
+
} catch (e) {
|
|
24
|
+
loadError = e
|
|
25
|
+
}
|
|
26
|
+
break
|
|
27
|
+
case 'win32':
|
|
28
|
+
// eslint-disable-next-line sonarjs/no-nested-switch
|
|
29
|
+
switch (arch) {
|
|
30
|
+
case 'x64':
|
|
31
|
+
localFileExisted = existsSync(join(__dirname, 'skia.win32-x64-msvc.node'))
|
|
32
|
+
try {
|
|
33
|
+
if (localFileExisted) {
|
|
34
|
+
nativeBinding = require('./skia.win32-x64-msvc.node')
|
|
35
|
+
} else {
|
|
36
|
+
nativeBinding = require('@napi-rs/canvas-win32-x64-msvc')
|
|
37
|
+
}
|
|
38
|
+
} catch (e) {
|
|
39
|
+
loadError = e
|
|
40
|
+
}
|
|
41
|
+
break
|
|
42
|
+
case 'ia32':
|
|
43
|
+
localFileExisted = existsSync(join(__dirname, 'skia.win32-ia32-msvc.node'))
|
|
44
|
+
try {
|
|
45
|
+
if (localFileExisted) {
|
|
46
|
+
nativeBinding = require('./skia.win32-ia32-msvc.node')
|
|
47
|
+
} else {
|
|
48
|
+
nativeBinding = require('@napi-rs/canvas-win32-ia32-msvc')
|
|
49
|
+
}
|
|
50
|
+
} catch (e) {
|
|
51
|
+
loadError = e
|
|
52
|
+
}
|
|
53
|
+
break
|
|
54
|
+
case 'arm64':
|
|
55
|
+
localFileExisted = existsSync(join(__dirname, 'skia.win32-arm64-msvc.node'))
|
|
56
|
+
try {
|
|
57
|
+
if (localFileExisted) {
|
|
58
|
+
nativeBinding = require('./skia.win32-arm64-msvc.node')
|
|
59
|
+
} else {
|
|
60
|
+
nativeBinding = require('@napi-rs/canvas-win32-arm64-msvc')
|
|
61
|
+
}
|
|
62
|
+
} catch (e) {
|
|
63
|
+
loadError = e
|
|
64
|
+
}
|
|
65
|
+
break
|
|
66
|
+
default:
|
|
67
|
+
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
68
|
+
}
|
|
69
|
+
break
|
|
70
|
+
case 'darwin':
|
|
71
|
+
// eslint-disable-next-line sonarjs/no-nested-switch
|
|
72
|
+
switch (arch) {
|
|
73
|
+
case 'x64':
|
|
74
|
+
localFileExisted = existsSync(join(__dirname, 'skia.darwin-x64.node'))
|
|
75
|
+
try {
|
|
76
|
+
if (localFileExisted) {
|
|
77
|
+
nativeBinding = require('./skia.darwin-x64.node')
|
|
78
|
+
} else {
|
|
79
|
+
nativeBinding = require('@napi-rs/canvas-darwin-x64')
|
|
80
|
+
}
|
|
81
|
+
} catch (e) {
|
|
82
|
+
loadError = e
|
|
83
|
+
}
|
|
84
|
+
break
|
|
85
|
+
case 'arm64':
|
|
86
|
+
localFileExisted = existsSync(join(__dirname, 'skia.darwin-arm64.node'))
|
|
87
|
+
try {
|
|
88
|
+
if (localFileExisted) {
|
|
89
|
+
nativeBinding = require('./skia.darwin-arm64.node')
|
|
90
|
+
} else {
|
|
91
|
+
nativeBinding = require('@napi-rs/canvas-darwin-arm64')
|
|
92
|
+
}
|
|
93
|
+
} catch (e) {
|
|
94
|
+
loadError = e
|
|
95
|
+
}
|
|
96
|
+
break
|
|
97
|
+
default:
|
|
98
|
+
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
|
99
|
+
}
|
|
100
|
+
break
|
|
101
|
+
case 'freebsd':
|
|
102
|
+
if (arch !== 'x64') {
|
|
103
|
+
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
|
104
|
+
}
|
|
105
|
+
localFileExisted = existsSync(join(__dirname, 'skia.freebsd-x64.node'))
|
|
106
|
+
try {
|
|
107
|
+
if (localFileExisted) {
|
|
108
|
+
nativeBinding = require('./skia.freebsd-x64.node')
|
|
109
|
+
} else {
|
|
110
|
+
nativeBinding = require('@napi-rs/canvas-freebsd-x64')
|
|
111
|
+
}
|
|
112
|
+
} catch (e) {
|
|
113
|
+
loadError = e
|
|
114
|
+
}
|
|
115
|
+
break
|
|
116
|
+
case 'linux':
|
|
117
|
+
// eslint-disable-next-line sonarjs/no-nested-switch
|
|
118
|
+
switch (arch) {
|
|
119
|
+
case 'x64':
|
|
120
|
+
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
|
|
121
|
+
if (isMusl) {
|
|
122
|
+
localFileExisted = existsSync(join(__dirname, 'skia.linux-x64-musl.node'))
|
|
123
|
+
try {
|
|
124
|
+
if (localFileExisted) {
|
|
125
|
+
nativeBinding = require('./skia.linux-x64-musl.node')
|
|
126
|
+
} else {
|
|
127
|
+
nativeBinding = require('@napi-rs/canvas-linux-x64-musl')
|
|
128
|
+
}
|
|
129
|
+
} catch (e) {
|
|
130
|
+
loadError = e
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
localFileExisted = existsSync(join(__dirname, 'skia.linux-x64-gnu.node'))
|
|
134
|
+
try {
|
|
135
|
+
if (localFileExisted) {
|
|
136
|
+
nativeBinding = require('./skia.linux-x64-gnu.node')
|
|
137
|
+
} else {
|
|
138
|
+
nativeBinding = require('@napi-rs/canvas-linux-x64-gnu')
|
|
139
|
+
}
|
|
140
|
+
} catch (e) {
|
|
141
|
+
loadError = e
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
break
|
|
145
|
+
case 'arm64':
|
|
146
|
+
isMusl = readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
|
|
147
|
+
if (isMusl) {
|
|
148
|
+
localFileExisted = existsSync(join(__dirname, 'skia.linux-arm64-musl.node'))
|
|
149
|
+
try {
|
|
150
|
+
if (localFileExisted) {
|
|
151
|
+
nativeBinding = require('./skia.linux-arm64-musl.node')
|
|
152
|
+
} else {
|
|
153
|
+
nativeBinding = require('@napi-rs/canvas-linux-arm64-musl')
|
|
154
|
+
}
|
|
155
|
+
} catch (e) {
|
|
156
|
+
loadError = e
|
|
157
|
+
}
|
|
158
|
+
} else {
|
|
159
|
+
localFileExisted = existsSync(join(__dirname, 'skia.linux-arm64-gnu.node'))
|
|
160
|
+
try {
|
|
161
|
+
if (localFileExisted) {
|
|
162
|
+
nativeBinding = require('./skia.linux-arm64-gnu.node')
|
|
163
|
+
} else {
|
|
164
|
+
nativeBinding = require('@napi-rs/canvas-linux-arm64-gnu')
|
|
165
|
+
}
|
|
166
|
+
} catch (e) {
|
|
167
|
+
loadError = e
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
break
|
|
171
|
+
case 'arm':
|
|
172
|
+
localFileExisted = existsSync(join(__dirname, 'skia.linux-arm-gnueabihf.node'))
|
|
173
|
+
try {
|
|
174
|
+
if (localFileExisted) {
|
|
175
|
+
nativeBinding = require('./skia.linux-arm-gnueabihf.node')
|
|
176
|
+
} else {
|
|
177
|
+
nativeBinding = require('@napi-rs/canvas-linux-arm-gnueabihf')
|
|
178
|
+
}
|
|
179
|
+
} catch (e) {
|
|
180
|
+
loadError = e
|
|
181
|
+
}
|
|
182
|
+
break
|
|
183
|
+
default:
|
|
184
|
+
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
|
185
|
+
}
|
|
186
|
+
break
|
|
187
|
+
default:
|
|
188
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (!nativeBinding) {
|
|
192
|
+
if (loadError) {
|
|
193
|
+
throw loadError
|
|
194
|
+
}
|
|
195
|
+
throw new Error(`Failed to load native binding`)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const {
|
|
199
|
+
CanvasRenderingContext2D,
|
|
200
|
+
CanvasElement,
|
|
201
|
+
createContext,
|
|
202
|
+
SVGCanvas,
|
|
203
|
+
Path2D,
|
|
204
|
+
ImageData,
|
|
205
|
+
Image,
|
|
206
|
+
CanvasPattern,
|
|
207
|
+
GlobalFonts,
|
|
208
|
+
convertSVGTextToPath,
|
|
209
|
+
} = nativeBinding
|
|
210
|
+
|
|
211
|
+
module.exports.CanvasRenderingContext2D = CanvasRenderingContext2D
|
|
212
|
+
module.exports.CanvasElement = CanvasElement
|
|
213
|
+
module.exports.createContext = createContext
|
|
214
|
+
module.exports.SVGCanvas = SVGCanvas
|
|
215
|
+
module.exports.Path2D = Path2D
|
|
216
|
+
module.exports.ImageData = ImageData
|
|
217
|
+
module.exports.Image = Image
|
|
218
|
+
module.exports.CanvasPattern = CanvasPattern
|
|
219
|
+
module.exports.GlobalFonts = GlobalFonts
|
|
220
|
+
module.exports.convertSVGTextToPath = convertSVGTextToPath
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@napi-rs/canvas",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "Canvas for Node.js with skia backend",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "https://github.com/Brooooooklyn/canvas.git",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"files": [
|
|
22
22
|
"index.d.ts",
|
|
23
23
|
"index.js",
|
|
24
|
-
"geometry.js"
|
|
24
|
+
"geometry.js",
|
|
25
|
+
"js-binding.js"
|
|
25
26
|
],
|
|
26
27
|
"napi": {
|
|
27
28
|
"name": "skia",
|
|
@@ -49,12 +50,9 @@
|
|
|
49
50
|
"bench": "node -r @swc-node/register benchmark/bench.ts",
|
|
50
51
|
"build": "napi build --platform --release",
|
|
51
52
|
"build:debug": "napi build --platform",
|
|
52
|
-
"format": "run-p format:
|
|
53
|
-
"format:md": "prettier --parser markdown --write ./**/*.md",
|
|
54
|
-
"format:json": "prettier --parser json --write ./**/*.json",
|
|
53
|
+
"format": "run-p format:source format:rs",
|
|
55
54
|
"format:rs": "cargo fmt",
|
|
56
|
-
"format:source": "prettier
|
|
57
|
-
"format:yaml": "prettier --parser yaml --write ./**/*.{yml,yaml}",
|
|
55
|
+
"format:source": "prettier . -w",
|
|
58
56
|
"lint": "eslint . -c ./.eslintrc.yml",
|
|
59
57
|
"prepublishOnly": "pinst --disable && napi prepublish -t npm",
|
|
60
58
|
"postpublish": "pinst --enable",
|
|
@@ -66,50 +64,40 @@
|
|
|
66
64
|
"@jimp/custom": "^0.16.1",
|
|
67
65
|
"@jimp/jpeg": "^0.16.1",
|
|
68
66
|
"@jimp/png": "^0.16.1",
|
|
69
|
-
"@napi-rs/cli": "^1.3.
|
|
70
|
-
"@octokit/rest": "^18.
|
|
71
|
-
"@swc-node/register": "^1.
|
|
72
|
-
"@types/lodash": "^4.14.
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
74
|
-
"@typescript-eslint/parser": "^5.
|
|
67
|
+
"@napi-rs/cli": "^1.3.5",
|
|
68
|
+
"@octokit/rest": "^18.12.0",
|
|
69
|
+
"@swc-node/register": "^1.4.0",
|
|
70
|
+
"@types/lodash": "^4.14.178",
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
|
72
|
+
"@typescript-eslint/parser": "^5.6.0",
|
|
75
73
|
"ava": "^3.15.0",
|
|
76
|
-
"benny": "^3.
|
|
74
|
+
"benny": "^3.7.1",
|
|
77
75
|
"canvas": "^2.8.0",
|
|
78
|
-
"canvaskit-wasm": "^0.
|
|
79
|
-
"chalk": "
|
|
76
|
+
"canvaskit-wasm": "^0.31.0",
|
|
77
|
+
"chalk": "4",
|
|
80
78
|
"conventional-changelog-cli": "^2.1.1",
|
|
81
|
-
"eslint": "^
|
|
79
|
+
"eslint": "^8.4.1",
|
|
82
80
|
"eslint-config-prettier": "^8.3.0",
|
|
83
|
-
"eslint-plugin-import": "^2.
|
|
81
|
+
"eslint-plugin-import": "^2.25.3",
|
|
84
82
|
"eslint-plugin-prettier": "^4.0.0",
|
|
85
|
-
"eslint-plugin-sonarjs": "^0.
|
|
86
|
-
"husky": "^7.0.
|
|
87
|
-
"lint-staged": "^
|
|
83
|
+
"eslint-plugin-sonarjs": "^0.11.0",
|
|
84
|
+
"husky": "^7.0.4",
|
|
85
|
+
"lint-staged": "^12.1.2",
|
|
88
86
|
"lodash": "^4.17.21",
|
|
89
87
|
"npm-run-all": "^4.1.5",
|
|
90
88
|
"pinst": "^2.1.6",
|
|
91
89
|
"png.js": "^0.2.1",
|
|
92
|
-
"prettier": "^2.
|
|
90
|
+
"prettier": "^2.5.1",
|
|
93
91
|
"putasset": "^5.0.3",
|
|
94
|
-
"skia-canvas": "^0.9.
|
|
95
|
-
"typescript": "^4.
|
|
96
|
-
},
|
|
97
|
-
"dependencies": {
|
|
98
|
-
"@node-rs/helper": "^1.2.1"
|
|
92
|
+
"skia-canvas": "^0.9.27",
|
|
93
|
+
"typescript": "^4.5.3"
|
|
99
94
|
},
|
|
100
95
|
"lint-staged": {
|
|
96
|
+
"*.@(js|ts|tsx|yml|yaml|md|json)": [
|
|
97
|
+
"prettier --write"
|
|
98
|
+
],
|
|
101
99
|
"*.@(js|ts|tsx)": [
|
|
102
|
-
"prettier --write",
|
|
103
100
|
"eslint -c .eslintrc.yml --fix"
|
|
104
|
-
],
|
|
105
|
-
"*.@(yml|yaml)": [
|
|
106
|
-
"prettier --parser yaml --write"
|
|
107
|
-
],
|
|
108
|
-
"*.md": [
|
|
109
|
-
"prettier --parser markdown --write"
|
|
110
|
-
],
|
|
111
|
-
"*.json": [
|
|
112
|
-
"prettier --parser json --write"
|
|
113
101
|
]
|
|
114
102
|
},
|
|
115
103
|
"ava": {
|
|
@@ -130,18 +118,17 @@
|
|
|
130
118
|
"semi": false,
|
|
131
119
|
"trailingComma": "all",
|
|
132
120
|
"singleQuote": true,
|
|
133
|
-
"arrowParens": "always"
|
|
134
|
-
"parser": "typescript"
|
|
121
|
+
"arrowParens": "always"
|
|
135
122
|
},
|
|
136
123
|
"optionalDependencies": {
|
|
137
|
-
"@napi-rs/canvas-win32-x64-msvc": "0.1.
|
|
138
|
-
"@napi-rs/canvas-darwin-x64": "0.1.
|
|
139
|
-
"@napi-rs/canvas-linux-x64-gnu": "0.1.
|
|
140
|
-
"@napi-rs/canvas-linux-arm-gnueabihf": "0.1.
|
|
141
|
-
"@napi-rs/canvas-linux-x64-musl": "0.1.
|
|
142
|
-
"@napi-rs/canvas-linux-arm64-gnu": "0.1.
|
|
143
|
-
"@napi-rs/canvas-linux-arm64-musl": "0.1.
|
|
144
|
-
"@napi-rs/canvas-darwin-arm64": "0.1.
|
|
145
|
-
"@napi-rs/canvas-android-arm64": "0.1.
|
|
124
|
+
"@napi-rs/canvas-win32-x64-msvc": "0.1.17",
|
|
125
|
+
"@napi-rs/canvas-darwin-x64": "0.1.17",
|
|
126
|
+
"@napi-rs/canvas-linux-x64-gnu": "0.1.17",
|
|
127
|
+
"@napi-rs/canvas-linux-arm-gnueabihf": "0.1.17",
|
|
128
|
+
"@napi-rs/canvas-linux-x64-musl": "0.1.17",
|
|
129
|
+
"@napi-rs/canvas-linux-arm64-gnu": "0.1.17",
|
|
130
|
+
"@napi-rs/canvas-linux-arm64-musl": "0.1.17",
|
|
131
|
+
"@napi-rs/canvas-darwin-arm64": "0.1.17",
|
|
132
|
+
"@napi-rs/canvas-android-arm64": "0.1.17"
|
|
146
133
|
}
|
|
147
134
|
}
|