@napi-rs/canvas 0.1.15 → 0.1.20

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 CHANGED
@@ -1,27 +1,61 @@
1
- ## [0.1.15](https://github.com/Brooooooklyn/canvas/compare/v0.1.14...v0.1.15) (2021-11-11)
2
-
1
+ ## [0.1.20](https://github.com/Brooooooklyn/canvas/compare/v0.1.19...v0.1.20) (2022-02-15)
3
2
 
4
3
  ### Bug Fixes
5
4
 
6
- * `vercel/nft` and `webpack` compatible issue ([f2e23f5](https://github.com/Brooooooklyn/canvas/commit/f2e23f5d763795c1e499e1eda5b70078a6de501a))
5
+ - Fix the issue of arc to + bezier to + quad to at empty path case ([33f8558](https://github.com/Brooooooklyn/canvas/commit/33f8558f447842521213f5c685a932ac1412a530))
6
+ - scoot method for path empty case ([a1eb529](https://github.com/Brooooooklyn/canvas/commit/a1eb5292c4d3a5d2a500cdaab3ff5f0dc410ddd9))
7
+ - the quality default value case of encode(type, quality) method ([#418](https://github.com/Brooooooklyn/canvas/issues/418)) ([c4950ea](https://github.com/Brooooooklyn/canvas/commit/c4950ea88d75a5437aa85a48b1f1ca087a9784f7))
7
8
 
9
+ ### Features
8
10
 
11
+ - skia chrome/m99 ([c0687c5](https://github.com/Brooooooklyn/canvas/commit/c0687c58b45eafc657d19e9b6a3643fce7003bce))
12
+ - upgrade to napi2 ([#422](https://github.com/Brooooooklyn/canvas/issues/422)) ([4a553c7](https://github.com/Brooooooklyn/canvas/commit/4a553c711a2d2f2fd6d71a58404884bff4fe57ad))
9
13
 
10
- ## [0.1.14](https://github.com/Brooooooklyn/canvas/compare/v0.1.13...v0.1.14) (2021-10-26)
14
+ ## [0.1.19](https://github.com/Brooooooklyn/canvas/compare/v0.1.18...v0.1.19) (2021-12-31)
15
+
16
+ ### Bug Fixes
17
+
18
+ - text align and font fallback ([d80ac6b](https://github.com/Brooooooklyn/canvas/commit/d80ac6befc8861ebebc5855c1a5714b7f55e1d55))
11
19
 
20
+ ## [0.1.18](https://github.com/Brooooooklyn/canvas/compare/v0.1.17...v0.1.18) (2021-12-30)
12
21
 
13
22
  ### Bug Fixes
14
23
 
15
- * Now generating avif images is 10x+ faster. ([407d1d1](https://github.com/Brooooooklyn/canvas/commit/407d1d1f09dce622426b71ee800480534c8e0888))
16
- * 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))
24
+ - reduce install size for linux glibc/musl ([8e6c7e8](https://github.com/Brooooooklyn/canvas/commit/8e6c7e8f2aeceb2598c24f8b37faa39a961739f9))
17
25
 
26
+ ### Features
27
+
28
+ - upgrade skia to chrome/m98 ([99e3635](https://github.com/Brooooooklyn/canvas/commit/99e363540db1572a832d65e1593721ad3b051493))
29
+
30
+ ## [0.1.17](https://github.com/Brooooooklyn/canvas/compare/v0.1.16...v0.1.17) (2021-12-12)
31
+
32
+ ## [0.1.16](https://github.com/Brooooooklyn/canvas/compare/v0.1.15...v0.1.16) (2021-12-12)
33
+
34
+ ### Bug Fixes
35
+
36
+ - make methods on ctx configurable & writable ([affe82d](https://github.com/Brooooooklyn/canvas/commit/affe82d0b8880441737497403d790f4d39a217c3))
18
37
 
19
38
  ### Features
20
39
 
21
- * The option to generate avif removes alphaQuality and calculates it internally. ([8de6e95](https://github.com/Brooooooklyn/canvas/commit/8de6e95d23383897870c66e59698a71cd0e73631))
22
- * Add a new SVG generation avif example. ([04d401a](https://github.com/Brooooooklyn/canvas/commit/04d401aaf3d35d13223e32af9e13b829f13170fc))
40
+ - chrome/m97 ([66c900f](https://github.com/Brooooooklyn/canvas/commit/66c900f4307f8204b55912659874a83513220460))
41
+
42
+ ## [0.1.15](https://github.com/Brooooooklyn/canvas/compare/v0.1.14...v0.1.15) (2021-11-11)
43
+
44
+ ### Bug Fixes
45
+
46
+ - `vercel/nft` and `webpack` compatible issue ([f2e23f5](https://github.com/Brooooooklyn/canvas/commit/f2e23f5d763795c1e499e1eda5b70078a6de501a))
23
47
 
48
+ ## [0.1.14](https://github.com/Brooooooklyn/canvas/compare/v0.1.13...v0.1.14) (2021-10-26)
49
+
50
+ ### Bug Fixes
51
+
52
+ - Now generating avif images is 10x+ faster. ([407d1d1](https://github.com/Brooooooklyn/canvas/commit/407d1d1f09dce622426b71ee800480534c8e0888))
53
+ - 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))
54
+
55
+ ### Features
24
56
 
57
+ - The option to generate avif removes alphaQuality and calculates it internally. ([8de6e95](https://github.com/Brooooooklyn/canvas/commit/8de6e95d23383897870c66e59698a71cd0e73631))
58
+ - Add a new SVG generation avif example. ([04d401a](https://github.com/Brooooooklyn/canvas/commit/04d401aaf3d35d13223e32af9e13b829f13170fc))
25
59
 
26
60
  ## [0.1.13](https://github.com/Brooooooklyn/canvas/compare/v0.1.12...v0.1.13) (2021-10-20)
27
61
 
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # `skr canvas`
2
2
 
3
3
  ![CI](https://github.com/Brooooooklyn/canvas/workflows/CI/badge.svg)
4
- ![Skia Version](https://img.shields.io/badge/Skia-chrome%2Fm96-hotpink)
4
+ ![Skia Version](https://img.shields.io/badge/Skia-chrome%2Fm99-hotpink)
5
5
  [![install size](https://packagephobia.com/badge?p=@napi-rs/canvas)](https://packagephobia.com/result?p=@napi-rs/canvas)
6
6
  [![Downloads](https://img.shields.io/npm/dm/@napi-rs/canvas.svg?sanitize=true)](https://npmcharts.com/compare/@napi-rs/canvas?minimal=true)
7
7
 
@@ -300,7 +300,6 @@ path.simplify().toSVGString()
300
300
 
301
301
  <img width="500" src="example/tiger.png">
302
302
 
303
-
304
303
  ```shell
305
304
  node example/anime-girl.js
306
305
  ```
@@ -309,7 +308,6 @@ node example/anime-girl.js
309
308
  | ---------------------------------------------- | ---------------------------------------------- |
310
309
  | <img width="500" src="example/anime-girl.svg"> | <img width="500" src="example/anime-girl.png"> |
311
310
 
312
-
313
311
  # Building
314
312
 
315
313
  ## Build skia from source
package/index.js CHANGED
@@ -187,9 +187,9 @@ function createCanvas(width, height, flag) {
187
187
  }
188
188
  return new ImageData(widthOrImage, height, { colorSpace: 'srgb', ...attrs })
189
189
  },
190
- configurable: false,
190
+ configurable: true,
191
191
  enumerable: false,
192
- writable: false,
192
+ writable: true,
193
193
  })
194
194
 
195
195
  Object.defineProperty(canvasElement, 'ctx', {
@@ -237,7 +237,7 @@ function createCanvas(width, height, flag) {
237
237
  }),
238
238
  )
239
239
  }
240
- return canvasEncode.call(this, type, qualityOrConfig || 92)
240
+ return canvasEncode.call(this, type, qualityOrConfig)
241
241
  }
242
242
 
243
243
  canvasElement.encodeSync = function encodeSync(type, qualityOrConfig) {
@@ -251,7 +251,7 @@ function createCanvas(width, height, flag) {
251
251
  }),
252
252
  )
253
253
  }
254
- return canvasEncodeSync.call(this, type, qualityOrConfig || 92)
254
+ return canvasEncodeSync.call(this, type, qualityOrConfig)
255
255
  }
256
256
 
257
257
  canvasElement.toBuffer = function toBuffer(type = 'image/png', qualityOrConfig) {
@@ -265,7 +265,7 @@ function createCanvas(width, height, flag) {
265
265
  }),
266
266
  )
267
267
  }
268
- return canvasToBuffer.call(this, type, qualityOrConfig || 92)
268
+ return canvasToBuffer.call(this, type, qualityOrConfig)
269
269
  }
270
270
 
271
271
  canvasElement.toDataURL = function toDataURL(type = 'image/png', qualityOrConfig) {
@@ -279,7 +279,7 @@ function createCanvas(width, height, flag) {
279
279
  }),
280
280
  )
281
281
  }
282
- return canvasToDataURL.call(this, type, qualityOrConfig || 92)
282
+ return canvasToDataURL.call(this, type, qualityOrConfig)
283
283
  }
284
284
 
285
285
  canvasElement.toDataURLAsync = function toDataURLAsync(type = 'image/png', qualityOrConfig) {
@@ -293,7 +293,7 @@ function createCanvas(width, height, flag) {
293
293
  }),
294
294
  )
295
295
  }
296
- return canvasToDataURLAsync.call(this, type, qualityOrConfig || 92)
296
+ return canvasToDataURLAsync.call(this, type, qualityOrConfig)
297
297
  }
298
298
 
299
299
  return canvasElement
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@napi-rs/canvas",
3
- "version": "0.1.15",
3
+ "version": "0.1.20",
4
4
  "description": "Canvas for Node.js with skia backend",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/Brooooooklyn/canvas.git",
@@ -50,12 +50,9 @@
50
50
  "bench": "node -r @swc-node/register benchmark/bench.ts",
51
51
  "build": "napi build --platform --release",
52
52
  "build:debug": "napi build --platform",
53
- "format": "run-p format:md format:json format:yaml format:source format:rs",
54
- "format:md": "prettier --parser markdown --write ./**/*.md",
55
- "format:json": "prettier --parser json --write ./**/*.json",
53
+ "format": "run-p format:source format:rs",
56
54
  "format:rs": "cargo fmt",
57
- "format:source": "prettier --config ./package.json --write ./**/*.{js,ts}",
58
- "format:yaml": "prettier --parser yaml --write ./**/*.{yml,yaml}",
55
+ "format:source": "prettier . -w",
59
56
  "lint": "eslint . -c ./.eslintrc.yml",
60
57
  "prepublishOnly": "pinst --disable && napi prepublish -t npm",
61
58
  "postpublish": "pinst --enable",
@@ -67,47 +64,41 @@
67
64
  "@jimp/custom": "^0.16.1",
68
65
  "@jimp/jpeg": "^0.16.1",
69
66
  "@jimp/png": "^0.16.1",
70
- "@napi-rs/cli": "^1.3.5",
67
+ "@napi-rs/cli": "^2.4.2",
71
68
  "@octokit/rest": "^18.12.0",
72
- "@swc-node/register": "^1.4.0",
73
- "@types/lodash": "^4.14.176",
74
- "@typescript-eslint/eslint-plugin": "^5.3.1",
75
- "@typescript-eslint/parser": "^5.3.1",
76
- "ava": "^3.15.0",
69
+ "@swc-node/register": "^1.4.2",
70
+ "@types/lodash": "^4.14.178",
71
+ "@typescript-eslint/eslint-plugin": "^5.10.2",
72
+ "@typescript-eslint/parser": "^5.10.2",
73
+ "ava": "^4.0.1",
77
74
  "benny": "^3.7.1",
78
- "canvas": "^2.8.0",
79
- "canvaskit-wasm": "^0.30.0",
80
- "chalk": "^4.1.2",
81
- "conventional-changelog-cli": "^2.1.1",
82
- "eslint": "^8.2.0",
75
+ "canvas": "^2.9.0",
76
+ "canvaskit-wasm": "^0.33.0",
77
+ "colorette": "^2.0.16",
78
+ "conventional-changelog-cli": "^2.2.2",
79
+ "echarts": "^5.3.0",
80
+ "eslint": "^8.8.0",
83
81
  "eslint-config-prettier": "^8.3.0",
84
- "eslint-plugin-import": "^2.25.3",
82
+ "eslint-plugin-import": "^2.25.4",
85
83
  "eslint-plugin-prettier": "^4.0.0",
86
- "eslint-plugin-sonarjs": "^0.10.0",
84
+ "eslint-plugin-sonarjs": "^0.11.0",
87
85
  "husky": "^7.0.4",
88
- "lint-staged": "^11.2.6",
86
+ "lint-staged": "^12.3.3",
89
87
  "lodash": "^4.17.21",
90
88
  "npm-run-all": "^4.1.5",
91
89
  "pinst": "^2.1.6",
92
90
  "png.js": "^0.2.1",
93
- "prettier": "^2.4.1",
91
+ "prettier": "^2.5.1",
94
92
  "putasset": "^5.0.3",
95
- "skia-canvas": "^0.9.27",
96
- "typescript": "^4.4.4"
93
+ "skia-canvas": "^0.9.28",
94
+ "typescript": "^4.5.5"
97
95
  },
98
96
  "lint-staged": {
97
+ "*.@(js|ts|tsx|yml|yaml|md|json)": [
98
+ "prettier --write"
99
+ ],
99
100
  "*.@(js|ts|tsx)": [
100
- "prettier --write",
101
101
  "eslint -c .eslintrc.yml --fix"
102
- ],
103
- "*.@(yml|yaml)": [
104
- "prettier --parser yaml --write"
105
- ],
106
- "*.md": [
107
- "prettier --parser markdown --write"
108
- ],
109
- "*.json": [
110
- "prettier --parser json --write"
111
102
  ]
112
103
  },
113
104
  "ava": {
@@ -117,6 +108,8 @@
117
108
  "extensions": [
118
109
  "ts"
119
110
  ],
111
+ "workerThreads": false,
112
+ "cache": false,
120
113
  "timeout": "3m",
121
114
  "environmentVariables": {
122
115
  "SWC_NODE_PROJECT": "./tsconfig.json",
@@ -128,18 +121,17 @@
128
121
  "semi": false,
129
122
  "trailingComma": "all",
130
123
  "singleQuote": true,
131
- "arrowParens": "always",
132
- "parser": "typescript"
124
+ "arrowParens": "always"
133
125
  },
134
126
  "optionalDependencies": {
135
- "@napi-rs/canvas-win32-x64-msvc": "0.1.15",
136
- "@napi-rs/canvas-darwin-x64": "0.1.15",
137
- "@napi-rs/canvas-linux-x64-gnu": "0.1.15",
138
- "@napi-rs/canvas-linux-arm-gnueabihf": "0.1.15",
139
- "@napi-rs/canvas-linux-x64-musl": "0.1.15",
140
- "@napi-rs/canvas-linux-arm64-gnu": "0.1.15",
141
- "@napi-rs/canvas-linux-arm64-musl": "0.1.15",
142
- "@napi-rs/canvas-darwin-arm64": "0.1.15",
143
- "@napi-rs/canvas-android-arm64": "0.1.15"
127
+ "@napi-rs/canvas-win32-x64-msvc": "0.1.20",
128
+ "@napi-rs/canvas-darwin-x64": "0.1.20",
129
+ "@napi-rs/canvas-linux-x64-gnu": "0.1.20",
130
+ "@napi-rs/canvas-linux-arm-gnueabihf": "0.1.20",
131
+ "@napi-rs/canvas-linux-x64-musl": "0.1.20",
132
+ "@napi-rs/canvas-linux-arm64-gnu": "0.1.20",
133
+ "@napi-rs/canvas-linux-arm64-musl": "0.1.20",
134
+ "@napi-rs/canvas-darwin-arm64": "0.1.20",
135
+ "@napi-rs/canvas-android-arm64": "0.1.20"
144
136
  }
145
137
  }