@napi-rs/canvas 0.1.41 → 0.1.42

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 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%2Fm113-hotpink)
4
+ ![Skia Version](https://img.shields.io/badge/Skia-chrome%2Fm116-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
 
@@ -23,17 +23,17 @@ npm install @napi-rs/canvas
23
23
 
24
24
  # Support matrix
25
25
 
26
- | | node10 | node12 | node14 | node16 |
27
- | --------------------- | ------ | ------ | ------ | ------ |
28
- | Windows x64 | ✓ | ✓ | ✓ | ✓ |
29
- | macOS x64 | ✓ | ✓ | ✓ | ✓ |
30
- | macOS arm64 (m chips) | ✓ | ✓ | ✓ | ✓ |
31
- | Linux x64 gnu | ✓ | ✓ | ✓ | ✓ |
32
- | Linux x64 musl | ✓ | ✓ | ✓ | ✓ |
33
- | Linux arm64 gnu | ✓ | ✓ | ✓ | ✓ |
34
- | Linux arm64 musl | ✓ | ✓ | ✓ | ✓ |
35
- | Linux arm gnueabihf | ✓ | ✓ | ✓ | ✓ |
36
- | Linux arm64 android | ✓ | ✓ | ✓ | ✓ |
26
+ | | node10 | node12 | node14 | node16 | node18 |
27
+ | --------------------- | ------ | ------ | ------ | ------ | ------ |
28
+ | Windows x64 | ✓ | ✓ | ✓ | ✓ | ------ |
29
+ | macOS x64 | ✓ | ✓ | ✓ | ✓ | ------ |
30
+ | macOS arm64 (m chips) | ✓ | ✓ | ✓ | ✓ | ------ |
31
+ | Linux x64 gnu | ✓ | ✓ | ✓ | ✓ | ------ |
32
+ | Linux x64 musl | ✓ | ✓ | ✓ | ✓ | ------ |
33
+ | Linux arm64 gnu | ✓ | ✓ | ✓ | ✓ | ------ |
34
+ | Linux arm64 musl | ✓ | ✓ | ✓ | ✓ | ------ |
35
+ | Linux arm gnueabihf | ✓ | ✓ | ✓ | ✓ | ------ |
36
+ | Linux arm64 android | ✓ | ✓ | ✓ | ✓ | ------ |
37
37
 
38
38
  ## System requirement
39
39
 
@@ -52,6 +52,7 @@ All Apple M chips on **macOS**.
52
52
  Since Skia relies on the [glibc](https://www.gnu.org/software/libc/) 2.18 API, you need to have at least glibc version >= 2.18 on your system.
53
53
 
54
54
  ## AWS Lambda usage
55
+
55
56
  To use this library on Lambda you will need to use a Lambda layer.
56
57
 
57
58
  You can simply attach a lambda layer by getting an ARN from [Canvas-Lambda-Layer](https://github.com/ShivamJoker/Canvas-Lambda-Layer)
package/index.js CHANGED
@@ -34,7 +34,7 @@ const Fonts = []
34
34
  if (!('families' in GlobalFonts)) {
35
35
  Object.defineProperty(GlobalFonts, 'families', {
36
36
  get: function () {
37
- return JSON.parse(GlobalFonts.getFamilies())
37
+ return JSON.parse(GlobalFonts.getFamilies().toString())
38
38
  },
39
39
  })
40
40
  }
@@ -42,7 +42,7 @@ if (!('families' in GlobalFonts)) {
42
42
  if (!('has' in GlobalFonts)) {
43
43
  Object.defineProperty(GlobalFonts, 'has', {
44
44
  value: function has(name) {
45
- return !!JSON.parse(GlobalFonts.getFamilies()).find(({ family }) => family === name)
45
+ return !!JSON.parse(GlobalFonts.getFamilies().toString()).find(({ family }) => family === name)
46
46
  },
47
47
  configurable: false,
48
48
  enumerable: false,
package/load-image.js CHANGED
@@ -61,7 +61,7 @@ function makeRequest(url, resolve, reject, redirectCount, requestOptions) {
61
61
  const lib = isHttps ? (!https ? (https = require('https')) : https) : !http ? (http = require('http')) : http
62
62
 
63
63
  lib
64
- .get(url, requestOptions || {}, (res) => {
64
+ .get(url.toString(), requestOptions || {}, (res) => {
65
65
  const shouldRedirect = REDIRECT_STATUSES.has(res.statusCode) && typeof res.headers.location === 'string'
66
66
  if (shouldRedirect && redirectCount > 0)
67
67
  return makeRequest(new URL(res.headers.location), resolve, reject, redirectCount - 1, requestOptions)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@napi-rs/canvas",
3
- "version": "0.1.41",
3
+ "version": "0.1.42",
4
4
  "description": "Canvas for Node.js with skia backend",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/Brooooooklyn/canvas.git",
@@ -51,9 +51,10 @@
51
51
  "bench": "node -r @swc-node/register benchmark/bench.ts",
52
52
  "build": "napi build --platform --release --js js-binding.js",
53
53
  "build:debug": "napi build --platform --js js-binding.js",
54
- "format": "run-p format:source format:rs",
54
+ "format": "run-p format:source format:rs format:toml",
55
55
  "format:rs": "cargo fmt",
56
56
  "format:source": "prettier . -w",
57
+ "format:toml": "taplo format",
57
58
  "lint": "eslint . -c ./.eslintrc.yml",
58
59
  "prepublishOnly": "pinst --disable && napi prepublish -t npm",
59
60
  "postpublish": "pinst --enable",
@@ -62,41 +63,41 @@
62
63
  "version": "napi version && conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
63
64
  },
64
65
  "devDependencies": {
65
- "@jimp/core": "^0.22.7",
66
- "@jimp/custom": "^0.22.7",
67
- "@jimp/jpeg": "^0.22.7",
68
- "@jimp/png": "^0.22.7",
69
- "@napi-rs/cli": "^2.14.8",
70
- "@octokit/rest": "^19.0.7",
71
- "@swc-node/register": "^1.6.2",
72
- "@swc/core": "^1.3.39",
73
- "@types/lodash": "^4.14.191",
74
- "@types/node": "^18.15.0",
75
- "@typescript-eslint/eslint-plugin": "^5.54.1",
76
- "@typescript-eslint/parser": "^5.54.1",
77
- "ava": "^5.2.0",
66
+ "@jimp/core": "^0.22.8",
67
+ "@jimp/custom": "^0.22.8",
68
+ "@jimp/jpeg": "^0.22.8",
69
+ "@jimp/png": "^0.22.8",
70
+ "@napi-rs/cli": "^2.16.2",
71
+ "@octokit/rest": "^20.0.1",
72
+ "@swc-node/register": "^1.6.6",
73
+ "@swc/core": "^1.3.71",
74
+ "@taplo/cli": "^0.5.2",
75
+ "@types/lodash": "^4.14.196",
76
+ "@types/node": "^20.4.5",
77
+ "@typescript-eslint/eslint-plugin": "^6.2.0",
78
+ "@typescript-eslint/parser": "^6.2.0",
79
+ "ava": "^5.3.1",
78
80
  "benny": "^3.7.1",
79
- "canvas": "^2.11.0",
80
- "canvaskit-wasm": "^0.38.0",
81
- "colorette": "^2.0.19",
82
- "conventional-changelog-cli": "^2.2.2",
83
- "echarts": "^5.4.1",
84
- "eslint": "^8.36.0",
85
- "eslint-config-prettier": "^8.7.0",
81
+ "canvas": "^2.11.2",
82
+ "canvaskit-wasm": "^0.38.2",
83
+ "colorette": "^2.0.20",
84
+ "conventional-changelog-cli": "^3.0.0",
85
+ "echarts": "^5.4.3",
86
+ "eslint": "^8.45.0",
87
+ "eslint-config-prettier": "^9.0.0",
86
88
  "eslint-plugin-import": "^2.27.5",
87
- "eslint-plugin-prettier": "^4.2.1",
88
- "eslint-plugin-sonarjs": "^0.19.0",
89
+ "eslint-plugin-sonarjs": "^0.20.0",
89
90
  "husky": "^8.0.3",
90
- "lint-staged": "^13.2.0",
91
+ "lint-staged": "^13.2.3",
91
92
  "lodash": "^4.17.21",
92
93
  "npm-run-all": "^4.1.5",
93
94
  "pinst": "^3.0.0",
94
95
  "png.js": "^0.2.1",
95
- "prettier": "^2.8.4",
96
- "pretty-bytes": "^6.1.0",
96
+ "prettier": "^3.0.0",
97
+ "pretty-bytes": "^6.1.1",
97
98
  "skia-canvas": "^1.0.1",
98
99
  "table": "^6.8.1",
99
- "typescript": "^5.0.0"
100
+ "typescript": "^5.1.6"
100
101
  },
101
102
  "lint-staged": {
102
103
  "*.@(js|ts|tsx|yml|yaml|md|json|html)": [
@@ -132,16 +133,16 @@
132
133
  "singleQuote": true,
133
134
  "arrowParens": "always"
134
135
  },
135
- "packageManager": "yarn@3.5.1",
136
+ "packageManager": "yarn@3.6.1",
136
137
  "optionalDependencies": {
137
- "@napi-rs/canvas-win32-x64-msvc": "0.1.41",
138
- "@napi-rs/canvas-darwin-x64": "0.1.41",
139
- "@napi-rs/canvas-linux-x64-gnu": "0.1.41",
140
- "@napi-rs/canvas-linux-arm-gnueabihf": "0.1.41",
141
- "@napi-rs/canvas-linux-x64-musl": "0.1.41",
142
- "@napi-rs/canvas-linux-arm64-gnu": "0.1.41",
143
- "@napi-rs/canvas-linux-arm64-musl": "0.1.41",
144
- "@napi-rs/canvas-darwin-arm64": "0.1.41",
145
- "@napi-rs/canvas-android-arm64": "0.1.41"
138
+ "@napi-rs/canvas-win32-x64-msvc": "0.1.42",
139
+ "@napi-rs/canvas-darwin-x64": "0.1.42",
140
+ "@napi-rs/canvas-linux-x64-gnu": "0.1.42",
141
+ "@napi-rs/canvas-linux-arm-gnueabihf": "0.1.42",
142
+ "@napi-rs/canvas-linux-x64-musl": "0.1.42",
143
+ "@napi-rs/canvas-linux-arm64-gnu": "0.1.42",
144
+ "@napi-rs/canvas-linux-arm64-musl": "0.1.42",
145
+ "@napi-rs/canvas-darwin-arm64": "0.1.42",
146
+ "@napi-rs/canvas-android-arm64": "0.1.42"
146
147
  }
147
148
  }