@napi-rs/canvas 0.1.29 → 0.1.31
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 +3 -3
- package/index.d.ts +51 -3
- package/index.js +19 -59
- package/js-binding.js +65 -36
- package/load-image.js +21 -10
- package/package.json +38 -36
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
|
|
|
@@ -96,7 +96,7 @@ main()
|
|
|
96
96
|
const { writeFileSync } = require('fs')
|
|
97
97
|
const { join } = require('path')
|
|
98
98
|
|
|
99
|
-
const { createCanvas, GlobalFonts } = require('
|
|
99
|
+
const { createCanvas, GlobalFonts } = require('@napi-rs/canvas')
|
|
100
100
|
|
|
101
101
|
GlobalFonts.registerFromPath(join(__dirname, '..', 'fonts', 'AppleColorEmoji@2x.ttf'), 'Apple Emoji')
|
|
102
102
|
GlobalFonts.registerFromPath(join(__dirname, '..', '__test__', 'fonts', 'COLRv1.ttf'), 'COLRv1')
|
|
@@ -328,7 +328,7 @@ $ node scripts/build-skia.js
|
|
|
328
328
|
|
|
329
329
|
# Install NPM packages, build the Node.js addon:
|
|
330
330
|
$ npm install -g yarn
|
|
331
|
-
$ yarn install --mode=skip
|
|
331
|
+
$ yarn install --mode=skip-build # Here are modules that are used for benchmarking and are hard to install, you can skip it by specifying `--mode=skip-build`
|
|
332
332
|
$ sudo dnf install clang # https://fedora.pkgs.org/34/fedora-x86_64/clang-12.0.0-0.3.rc1.fc34.x86_64.rpm.html
|
|
333
333
|
$ yarn build
|
|
334
334
|
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference lib="dom" />
|
|
2
|
-
|
|
3
1
|
// Clear all type of caches in Skia
|
|
4
2
|
export function clearAllCache(): void
|
|
5
3
|
|
|
@@ -250,8 +248,9 @@ export interface StrokeOptions {
|
|
|
250
248
|
export interface SKRSContext2D
|
|
251
249
|
extends Omit<
|
|
252
250
|
CanvasRenderingContext2D,
|
|
253
|
-
'drawImage' | 'createPattern' | 'getTransform' | 'drawFocusIfNeeded' | 'scrollPathIntoView'
|
|
251
|
+
'drawImage' | 'createPattern' | 'getTransform' | 'drawFocusIfNeeded' | 'scrollPathIntoView' | 'canvas'
|
|
254
252
|
> {
|
|
253
|
+
canvas: Canvas
|
|
255
254
|
/**
|
|
256
255
|
* @param startAngle The angle at which to begin the gradient, in radians. Angle measurements start vertically above the centre and move around clockwise.
|
|
257
256
|
* @param x The x-axis coordinate of the centre of the gradient.
|
|
@@ -302,9 +301,58 @@ export interface SvgCanvas {
|
|
|
302
301
|
}
|
|
303
302
|
|
|
304
303
|
export interface AvifConfig {
|
|
304
|
+
/** 0-100 scale, 100 is lossless */
|
|
305
305
|
quality?: number
|
|
306
|
+
/** 0-100 scale */
|
|
307
|
+
alphaQuality?: number
|
|
308
|
+
/** rav1e preset 1 (slow) 10 (fast but crappy), default is 4 */
|
|
306
309
|
speed?: number
|
|
310
|
+
/** How many threads should be used (0 = match core count) */
|
|
307
311
|
threads?: number
|
|
312
|
+
/** set to '4:2:0' to use chroma subsampling, default '4:4:4' */
|
|
313
|
+
chromaSubsampling?: ChromaSubsampling
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* https://en.wikipedia.org/wiki/Chroma_subsampling#Types_of_sampling_and_subsampling
|
|
317
|
+
* https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_concepts
|
|
318
|
+
*/
|
|
319
|
+
export enum ChromaSubsampling {
|
|
320
|
+
/**
|
|
321
|
+
* Each of the three Y'CbCr components has the same sample rate, thus there is no chroma subsampling. This scheme is sometimes used in high-end film scanners and cinematic post-production.
|
|
322
|
+
* Note that "4:4:4" may instead be wrongly referring to R'G'B' color space, which implicitly also does not have any chroma subsampling (except in JPEG R'G'B' can be subsampled).
|
|
323
|
+
* Formats such as HDCAM SR can record 4:4:4 R'G'B' over dual-link HD-SDI.
|
|
324
|
+
*/
|
|
325
|
+
Yuv444 = 0,
|
|
326
|
+
/**
|
|
327
|
+
* The two chroma components are sampled at half the horizontal sample rate of luma: the horizontal chroma resolution is halved. This reduces the bandwidth of an uncompressed video signal by one-third.
|
|
328
|
+
* Many high-end digital video formats and interfaces use this scheme:
|
|
329
|
+
* - [AVC-Intra 100](https://en.wikipedia.org/wiki/AVC-Intra)
|
|
330
|
+
* - [Digital Betacam](https://en.wikipedia.org/wiki/Betacam#Digital_Betacam)
|
|
331
|
+
* - [Betacam SX](https://en.wikipedia.org/wiki/Betacam#Betacam_SX)
|
|
332
|
+
* - [DVCPRO50](https://en.wikipedia.org/wiki/DV#DVCPRO) and [DVCPRO HD](https://en.wikipedia.org/wiki/DV#DVCPRO_HD)
|
|
333
|
+
* - [Digital-S](https://en.wikipedia.org/wiki/Digital-S)
|
|
334
|
+
* - [CCIR 601](https://en.wikipedia.org/wiki/Rec._601) / [Serial Digital Interface](https://en.wikipedia.org/wiki/Serial_digital_interface) / [D1](https://en.wikipedia.org/wiki/D-1_(Sony))
|
|
335
|
+
* - [ProRes (HQ, 422, LT, and Proxy)](https://en.wikipedia.org/wiki/Apple_ProRes)
|
|
336
|
+
* - [XDCAM HD422](https://en.wikipedia.org/wiki/XDCAM)
|
|
337
|
+
* - [Canon MXF HD422](https://en.wikipedia.org/wiki/Canon_XF-300)
|
|
338
|
+
*/
|
|
339
|
+
Yuv422 = 1,
|
|
340
|
+
/**
|
|
341
|
+
* n 4:2:0, the horizontal sampling is doubled compared to 4:1:1,
|
|
342
|
+
* but as the **Cb** and **Cr** channels are only sampled on each alternate line in this scheme, the vertical resolution is halved.
|
|
343
|
+
* The data rate is thus the same.
|
|
344
|
+
* This fits reasonably well with the PAL color encoding system, since this has only half the vertical chrominance resolution of [NTSC](https://en.wikipedia.org/wiki/NTSC).
|
|
345
|
+
* It would also fit extremely well with the [SECAM](https://en.wikipedia.org/wiki/SECAM) color encoding system,
|
|
346
|
+
* since like that format, 4:2:0 only stores and transmits one color channel per line (the other channel being recovered from the previous line).
|
|
347
|
+
* However, little equipment has actually been produced that outputs a SECAM analogue video signal.
|
|
348
|
+
* In general, SECAM territories either have to use a PAL-capable display or a [transcoder](https://en.wikipedia.org/wiki/Transcoding) to convert the PAL signal to SECAM for display.
|
|
349
|
+
*/
|
|
350
|
+
Yuv420 = 2,
|
|
351
|
+
/**
|
|
352
|
+
* What if the chroma subsampling model is 4:0:0?
|
|
353
|
+
* That says to use every pixel of luma data, but that each row has 0 chroma samples applied to it. The resulting image, then, is comprised solely of the luminance data—a greyscale image.
|
|
354
|
+
*/
|
|
355
|
+
Yuv400 = 3,
|
|
308
356
|
}
|
|
309
357
|
|
|
310
358
|
export class Canvas {
|
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
CanvasRenderingContext2D,
|
|
7
7
|
CanvasElement,
|
|
8
8
|
SVGCanvas,
|
|
9
|
-
Path2D,
|
|
9
|
+
Path: Path2D,
|
|
10
10
|
ImageData,
|
|
11
11
|
Image,
|
|
12
12
|
CanvasPattern,
|
|
@@ -31,68 +31,28 @@ const SvgExportFlag = {
|
|
|
31
31
|
// eslint-disable-next-line sonarjs/no-unused-collection
|
|
32
32
|
const Fonts = []
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
34
|
+
if (!('families' in GlobalFonts)) {
|
|
35
|
+
Object.defineProperty(GlobalFonts, 'families', {
|
|
36
|
+
get: function () {
|
|
37
|
+
return JSON.parse(GlobalFonts.getFamilies())
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
}
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
if (!('has' in GlobalFonts)) {
|
|
43
|
+
Object.defineProperty(GlobalFonts, 'has', {
|
|
44
|
+
value: function has(name) {
|
|
45
|
+
return !!JSON.parse(GlobalFonts.getFamilies()).find(({ family }) => family === name)
|
|
46
|
+
},
|
|
47
|
+
configurable: false,
|
|
48
|
+
enumerable: false,
|
|
49
|
+
writable: false,
|
|
50
|
+
})
|
|
51
|
+
}
|
|
48
52
|
|
|
49
53
|
function createCanvas(width, height, flag) {
|
|
50
54
|
const isSvgBackend = typeof flag !== 'undefined'
|
|
51
|
-
|
|
52
|
-
const {
|
|
53
|
-
encode: canvasEncode,
|
|
54
|
-
encodeSync: canvasEncodeSync,
|
|
55
|
-
toBuffer: canvasToBuffer,
|
|
56
|
-
toDataURL: canvasToDataURL,
|
|
57
|
-
toDataURLAsync: canvasToDataURLAsync,
|
|
58
|
-
} = Object.getPrototypeOf(canvasElement)
|
|
59
|
-
|
|
60
|
-
canvasElement.encode = function encode(type, qualityOrConfig = {}) {
|
|
61
|
-
if (type === 'avif') {
|
|
62
|
-
return canvasEncode.call(this, type, JSON.stringify(qualityOrConfig))
|
|
63
|
-
}
|
|
64
|
-
return canvasEncode.call(this, type, qualityOrConfig)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
canvasElement.encodeSync = function encodeSync(type, qualityOrConfig = {}) {
|
|
68
|
-
if (type === 'avif') {
|
|
69
|
-
return canvasEncodeSync.call(this, type, JSON.stringify(qualityOrConfig))
|
|
70
|
-
}
|
|
71
|
-
return canvasEncodeSync.call(this, type, qualityOrConfig)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
canvasElement.toBuffer = function toBuffer(type = 'image/png', qualityOrConfig = {}) {
|
|
75
|
-
if (type === 'avif') {
|
|
76
|
-
return canvasToBuffer.call(this, type, JSON.stringify(qualityOrConfig))
|
|
77
|
-
}
|
|
78
|
-
return canvasToBuffer.call(this, type, qualityOrConfig)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
canvasElement.toDataURL = function toDataURL(type = 'image/png', qualityOrConfig = {}) {
|
|
82
|
-
if (type === 'avif') {
|
|
83
|
-
return canvasToDataURL.call(this, type, JSON.stringify(qualityOrConfig))
|
|
84
|
-
}
|
|
85
|
-
return canvasToDataURL.call(this, type, qualityOrConfig)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
canvasElement.toDataURLAsync = function toDataURLAsync(type = 'image/png', qualityOrConfig = {}) {
|
|
89
|
-
if (type === 'avif') {
|
|
90
|
-
return canvasToDataURLAsync.call(this, type, JSON.stringify(qualityOrConfig))
|
|
91
|
-
}
|
|
92
|
-
return canvasToDataURLAsync.call(this, type, qualityOrConfig)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return canvasElement
|
|
55
|
+
return isSvgBackend ? new SVGCanvas(width, height, flag) : new CanvasElement(width, height)
|
|
96
56
|
}
|
|
97
57
|
|
|
98
58
|
class Canvas {
|
package/js-binding.js
CHANGED
|
@@ -5,27 +5,54 @@ const { platform, arch } = process
|
|
|
5
5
|
|
|
6
6
|
let nativeBinding = null
|
|
7
7
|
let localFileExisted = false
|
|
8
|
-
let isMusl = false
|
|
9
8
|
let loadError = null
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
throw new Error(`Unsupported architecture on Android ${arch}`)
|
|
15
|
-
}
|
|
16
|
-
localFileExisted = existsSync(join(__dirname, 'skia.android-arm64.node'))
|
|
10
|
+
function isMusl() {
|
|
11
|
+
// For Node 10
|
|
12
|
+
if (!process.report || typeof process.report.getReport !== 'function') {
|
|
17
13
|
try {
|
|
18
|
-
|
|
19
|
-
nativeBinding = require('./skia.android-arm64.node')
|
|
20
|
-
} else {
|
|
21
|
-
nativeBinding = require('@napi-rs/canvas-android-arm64')
|
|
22
|
-
}
|
|
14
|
+
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
|
|
23
15
|
} catch (e) {
|
|
24
|
-
|
|
16
|
+
return true
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
const { glibcVersionRuntime } = process.report.getReport().header
|
|
20
|
+
return !glibcVersionRuntime
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
switch (platform) {
|
|
25
|
+
case 'android':
|
|
26
|
+
switch (arch) {
|
|
27
|
+
case 'arm64':
|
|
28
|
+
localFileExisted = existsSync(join(__dirname, 'skia.android-arm64.node'))
|
|
29
|
+
try {
|
|
30
|
+
if (localFileExisted) {
|
|
31
|
+
nativeBinding = require('./skia.android-arm64.node')
|
|
32
|
+
} else {
|
|
33
|
+
nativeBinding = require('@napi-rs/canvas-android-arm64')
|
|
34
|
+
}
|
|
35
|
+
} catch (e) {
|
|
36
|
+
loadError = e
|
|
37
|
+
}
|
|
38
|
+
break
|
|
39
|
+
case 'arm':
|
|
40
|
+
localFileExisted = existsSync(join(__dirname, 'skia.android-arm-eabi.node'))
|
|
41
|
+
try {
|
|
42
|
+
if (localFileExisted) {
|
|
43
|
+
nativeBinding = require('./skia.android-arm-eabi.node')
|
|
44
|
+
} else {
|
|
45
|
+
nativeBinding = require('@napi-rs/canvas-android-arm-eabi')
|
|
46
|
+
}
|
|
47
|
+
} catch (e) {
|
|
48
|
+
loadError = e
|
|
49
|
+
}
|
|
50
|
+
break
|
|
51
|
+
default:
|
|
52
|
+
throw new Error(`Unsupported architecture on Android ${arch}`)
|
|
25
53
|
}
|
|
26
54
|
break
|
|
27
55
|
case 'win32':
|
|
28
|
-
// eslint-disable-next-line sonarjs/no-nested-switch
|
|
29
56
|
switch (arch) {
|
|
30
57
|
case 'x64':
|
|
31
58
|
localFileExisted = existsSync(join(__dirname, 'skia.win32-x64-msvc.node'))
|
|
@@ -68,7 +95,6 @@ switch (platform) {
|
|
|
68
95
|
}
|
|
69
96
|
break
|
|
70
97
|
case 'darwin':
|
|
71
|
-
// eslint-disable-next-line sonarjs/no-nested-switch
|
|
72
98
|
switch (arch) {
|
|
73
99
|
case 'x64':
|
|
74
100
|
localFileExisted = existsSync(join(__dirname, 'skia.darwin-x64.node'))
|
|
@@ -114,11 +140,9 @@ switch (platform) {
|
|
|
114
140
|
}
|
|
115
141
|
break
|
|
116
142
|
case 'linux':
|
|
117
|
-
// eslint-disable-next-line sonarjs/no-nested-switch
|
|
118
143
|
switch (arch) {
|
|
119
144
|
case 'x64':
|
|
120
|
-
|
|
121
|
-
if (isMusl) {
|
|
145
|
+
if (isMusl()) {
|
|
122
146
|
localFileExisted = existsSync(join(__dirname, 'skia.linux-x64-musl.node'))
|
|
123
147
|
try {
|
|
124
148
|
if (localFileExisted) {
|
|
@@ -143,8 +167,7 @@ switch (platform) {
|
|
|
143
167
|
}
|
|
144
168
|
break
|
|
145
169
|
case 'arm64':
|
|
146
|
-
|
|
147
|
-
if (isMusl) {
|
|
170
|
+
if (isMusl()) {
|
|
148
171
|
localFileExisted = existsSync(join(__dirname, 'skia.linux-arm64-musl.node'))
|
|
149
172
|
try {
|
|
150
173
|
if (localFileExisted) {
|
|
@@ -196,33 +219,39 @@ if (!nativeBinding) {
|
|
|
196
219
|
}
|
|
197
220
|
|
|
198
221
|
const {
|
|
199
|
-
|
|
222
|
+
ChromaSubsampling,
|
|
223
|
+
SvgExportFlag,
|
|
200
224
|
CanvasRenderingContext2D,
|
|
201
|
-
|
|
202
|
-
SVGCanvas,
|
|
203
|
-
Path,
|
|
225
|
+
CanvasGradient,
|
|
204
226
|
ImageData,
|
|
205
227
|
Image,
|
|
206
|
-
CanvasPattern,
|
|
207
|
-
GlobalFonts,
|
|
208
|
-
convertSVGTextToPath,
|
|
209
228
|
PathOp,
|
|
210
229
|
FillType,
|
|
211
|
-
StrokeJoin,
|
|
212
230
|
StrokeCap,
|
|
231
|
+
StrokeJoin,
|
|
232
|
+
Path,
|
|
233
|
+
CanvasPattern,
|
|
234
|
+
convertSVGTextToPath,
|
|
235
|
+
CanvasElement,
|
|
236
|
+
SVGCanvas,
|
|
237
|
+
clearAllCache,
|
|
238
|
+
GlobalFonts,
|
|
213
239
|
} = nativeBinding
|
|
214
240
|
|
|
215
|
-
module.exports.
|
|
241
|
+
module.exports.ChromaSubsampling = ChromaSubsampling
|
|
242
|
+
module.exports.SvgExportFlag = SvgExportFlag
|
|
216
243
|
module.exports.CanvasRenderingContext2D = CanvasRenderingContext2D
|
|
217
|
-
module.exports.
|
|
218
|
-
module.exports.SVGCanvas = SVGCanvas
|
|
219
|
-
module.exports.Path2D = Path
|
|
244
|
+
module.exports.CanvasGradient = CanvasGradient
|
|
220
245
|
module.exports.ImageData = ImageData
|
|
221
246
|
module.exports.Image = Image
|
|
222
|
-
module.exports.CanvasPattern = CanvasPattern
|
|
223
|
-
module.exports.GlobalFonts = GlobalFonts
|
|
224
|
-
module.exports.convertSVGTextToPath = convertSVGTextToPath
|
|
225
247
|
module.exports.PathOp = PathOp
|
|
226
248
|
module.exports.FillType = FillType
|
|
227
|
-
module.exports.StrokeJoin = StrokeJoin
|
|
228
249
|
module.exports.StrokeCap = StrokeCap
|
|
250
|
+
module.exports.StrokeJoin = StrokeJoin
|
|
251
|
+
module.exports.Path = Path
|
|
252
|
+
module.exports.CanvasPattern = CanvasPattern
|
|
253
|
+
module.exports.convertSVGTextToPath = convertSVGTextToPath
|
|
254
|
+
module.exports.CanvasElement = CanvasElement
|
|
255
|
+
module.exports.SVGCanvas = SVGCanvas
|
|
256
|
+
module.exports.clearAllCache = clearAllCache
|
|
257
|
+
module.exports.GlobalFonts = GlobalFonts
|
package/load-image.js
CHANGED
|
@@ -32,7 +32,7 @@ module.exports = async function loadImage(source, options = {}) {
|
|
|
32
32
|
// if source is a string or URL instance
|
|
33
33
|
if (typeof source === 'string' || source instanceof URL) {
|
|
34
34
|
// if the source exists as a file, construct image from that file
|
|
35
|
-
if (
|
|
35
|
+
if (await exists(source)) {
|
|
36
36
|
return createImage(await fs.promises.readFile(source), options.alt)
|
|
37
37
|
} else {
|
|
38
38
|
// the source is a remote url here
|
|
@@ -60,16 +60,18 @@ function makeRequest(url, resolve, reject, redirectCount, requestOptions) {
|
|
|
60
60
|
// lazy load the lib
|
|
61
61
|
const lib = isHttps ? (!https ? (https = require('https')) : https) : !http ? (http = require('http')) : http
|
|
62
62
|
|
|
63
|
-
lib
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
lib
|
|
64
|
+
.get(url, requestOptions || {}, (res) => {
|
|
65
|
+
const shouldRedirect = REDIRECT_STATUSES.has(res.statusCode) && typeof res.headers.location === 'string'
|
|
66
|
+
if (shouldRedirect && redirectCount > 0)
|
|
67
|
+
return makeRequest(new URL(res.headers.location), resolve, reject, redirectCount - 1, requestOptions)
|
|
68
|
+
if (typeof res.statusCode === 'number' && (res.statusCode < 200 || res.statusCode >= 300)) {
|
|
69
|
+
return reject(new Error(`remote source rejected with status code ${res.statusCode}`))
|
|
70
|
+
}
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
consumeStream(res).then(resolve, reject)
|
|
73
|
+
})
|
|
74
|
+
.on('error', reject)
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
// use stream/consumers in the future?
|
|
@@ -99,3 +101,12 @@ function isBufferLike(src) {
|
|
|
99
101
|
src instanceof Object.getPrototypeOf(Uint8Array)
|
|
100
102
|
)
|
|
101
103
|
}
|
|
104
|
+
|
|
105
|
+
async function exists(path) {
|
|
106
|
+
try {
|
|
107
|
+
await fs.promises.access(path, fs.constants.F_OK)
|
|
108
|
+
return true
|
|
109
|
+
} catch {
|
|
110
|
+
return false
|
|
111
|
+
}
|
|
112
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@napi-rs/canvas",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"description": "Canvas for Node.js with skia backend",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "https://github.com/Brooooooklyn/canvas.git",
|
|
@@ -49,52 +49,54 @@
|
|
|
49
49
|
"scripts": {
|
|
50
50
|
"artifacts": "napi artifacts",
|
|
51
51
|
"bench": "node -r @swc-node/register benchmark/bench.ts",
|
|
52
|
-
"build": "napi build --platform --release",
|
|
53
|
-
"build:debug": "napi build --platform",
|
|
52
|
+
"build": "napi build --platform --release --js js-binding.js",
|
|
53
|
+
"build:debug": "napi build --platform --js js-binding.js",
|
|
54
54
|
"format": "run-p format:source format:rs",
|
|
55
55
|
"format:rs": "cargo fmt",
|
|
56
56
|
"format:source": "prettier . -w",
|
|
57
57
|
"lint": "eslint . -c ./.eslintrc.yml",
|
|
58
58
|
"prepublishOnly": "pinst --disable && napi prepublish -t npm",
|
|
59
59
|
"postpublish": "pinst --enable",
|
|
60
|
+
"test:ci": "ava -c 1",
|
|
60
61
|
"test": "ava",
|
|
61
62
|
"version": "napi version && conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
64
|
-
"@jimp/core": "^0.16.
|
|
65
|
-
"@jimp/custom": "^0.16.
|
|
66
|
-
"@jimp/jpeg": "^0.16.
|
|
67
|
-
"@jimp/png": "^0.16.
|
|
68
|
-
"@napi-rs/cli": "^2.
|
|
69
|
-
"@octokit/rest": "^19.0.
|
|
70
|
-
"@swc-node/register": "^1.5.
|
|
71
|
-
"@
|
|
72
|
-
"@types/
|
|
73
|
-
"@
|
|
74
|
-
"@typescript-eslint/
|
|
75
|
-
"
|
|
65
|
+
"@jimp/core": "^0.16.2",
|
|
66
|
+
"@jimp/custom": "^0.16.2",
|
|
67
|
+
"@jimp/jpeg": "^0.16.2",
|
|
68
|
+
"@jimp/png": "^0.16.2",
|
|
69
|
+
"@napi-rs/cli": "^2.14.0",
|
|
70
|
+
"@octokit/rest": "^19.0.5",
|
|
71
|
+
"@swc-node/register": "^1.5.4",
|
|
72
|
+
"@swc/core": "^1.3.24",
|
|
73
|
+
"@types/lodash": "^4.14.191",
|
|
74
|
+
"@types/node": "^18.11.18",
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "^5.47.1",
|
|
76
|
+
"@typescript-eslint/parser": "^5.47.1",
|
|
77
|
+
"ava": "^5.1.0",
|
|
76
78
|
"benny": "^3.7.1",
|
|
77
|
-
"canvas": "^2.
|
|
78
|
-
"canvaskit-wasm": "^0.
|
|
79
|
+
"canvas": "^2.11.0",
|
|
80
|
+
"canvaskit-wasm": "^0.37.2",
|
|
79
81
|
"colorette": "^2.0.19",
|
|
80
82
|
"conventional-changelog-cli": "^2.2.2",
|
|
81
|
-
"echarts": "^5.
|
|
82
|
-
"eslint": "^8.
|
|
83
|
+
"echarts": "^5.4.1",
|
|
84
|
+
"eslint": "^8.31.0",
|
|
83
85
|
"eslint-config-prettier": "^8.5.0",
|
|
84
86
|
"eslint-plugin-import": "^2.26.0",
|
|
85
87
|
"eslint-plugin-prettier": "^4.2.1",
|
|
86
|
-
"eslint-plugin-sonarjs": "^0.
|
|
87
|
-
"husky": "^8.0.
|
|
88
|
-
"lint-staged": "^13.0
|
|
88
|
+
"eslint-plugin-sonarjs": "^0.17.0",
|
|
89
|
+
"husky": "^8.0.2",
|
|
90
|
+
"lint-staged": "^13.1.0",
|
|
89
91
|
"lodash": "^4.17.21",
|
|
90
92
|
"npm-run-all": "^4.1.5",
|
|
91
93
|
"pinst": "^3.0.0",
|
|
92
94
|
"png.js": "^0.2.1",
|
|
93
|
-
"prettier": "^2.
|
|
95
|
+
"prettier": "^2.8.1",
|
|
94
96
|
"pretty-bytes": "^6.0.0",
|
|
95
|
-
"skia-canvas": "^1.0.
|
|
96
|
-
"table": "^6.8.
|
|
97
|
-
"typescript": "^4.
|
|
97
|
+
"skia-canvas": "^1.0.1",
|
|
98
|
+
"table": "^6.8.1",
|
|
99
|
+
"typescript": "^4.9.4"
|
|
98
100
|
},
|
|
99
101
|
"lint-staged": {
|
|
100
102
|
"*.@(js|ts|tsx|yml|yaml|md|json|html)": [
|
|
@@ -130,16 +132,16 @@
|
|
|
130
132
|
"singleQuote": true,
|
|
131
133
|
"arrowParens": "always"
|
|
132
134
|
},
|
|
133
|
-
"packageManager": "yarn@3.
|
|
135
|
+
"packageManager": "yarn@3.3.1",
|
|
134
136
|
"optionalDependencies": {
|
|
135
|
-
"@napi-rs/canvas-win32-x64-msvc": "0.1.
|
|
136
|
-
"@napi-rs/canvas-darwin-x64": "0.1.
|
|
137
|
-
"@napi-rs/canvas-linux-x64-gnu": "0.1.
|
|
138
|
-
"@napi-rs/canvas-linux-arm-gnueabihf": "0.1.
|
|
139
|
-
"@napi-rs/canvas-linux-x64-musl": "0.1.
|
|
140
|
-
"@napi-rs/canvas-linux-arm64-gnu": "0.1.
|
|
141
|
-
"@napi-rs/canvas-linux-arm64-musl": "0.1.
|
|
142
|
-
"@napi-rs/canvas-darwin-arm64": "0.1.
|
|
143
|
-
"@napi-rs/canvas-android-arm64": "0.1.
|
|
137
|
+
"@napi-rs/canvas-win32-x64-msvc": "0.1.31",
|
|
138
|
+
"@napi-rs/canvas-darwin-x64": "0.1.31",
|
|
139
|
+
"@napi-rs/canvas-linux-x64-gnu": "0.1.31",
|
|
140
|
+
"@napi-rs/canvas-linux-arm-gnueabihf": "0.1.31",
|
|
141
|
+
"@napi-rs/canvas-linux-x64-musl": "0.1.31",
|
|
142
|
+
"@napi-rs/canvas-linux-arm64-gnu": "0.1.31",
|
|
143
|
+
"@napi-rs/canvas-linux-arm64-musl": "0.1.31",
|
|
144
|
+
"@napi-rs/canvas-darwin-arm64": "0.1.31",
|
|
145
|
+
"@napi-rs/canvas-android-arm64": "0.1.31"
|
|
144
146
|
}
|
|
145
147
|
}
|