@napi-rs/canvas 0.1.53 → 0.1.54

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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/load-image.js +11 -7
  3. package/package.json +16 -14
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%2Fm126-hotpink)
4
+ ![Skia Version](https://img.shields.io/badge/Skia-chrome%2Fm128-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
 
@@ -353,7 +353,7 @@ $ cd canvas
353
353
 
354
354
  # Download Skia binaries:
355
355
  # It will pull the binaries match the git hash in `./skia` submodule
356
- $ node scripts/release-skia-binary.js --download
356
+ $ node scripts/release-skia-binary.mjs --download
357
357
 
358
358
  # Install NPM packages, build the Node.js addon:
359
359
  $ npm install -g yarn
package/load-image.js CHANGED
@@ -61,14 +61,18 @@ function makeRequest(url, resolve, reject, redirectCount, requestOptions) {
61
61
 
62
62
  lib
63
63
  .get(url.toString(), requestOptions || {}, (res) => {
64
- const shouldRedirect = REDIRECT_STATUSES.has(res.statusCode) && typeof res.headers.location === 'string'
65
- if (shouldRedirect && redirectCount > 0)
66
- return makeRequest(new URL(res.headers.location), resolve, reject, redirectCount - 1, requestOptions)
67
- if (typeof res.statusCode === 'number' && (res.statusCode < 200 || res.statusCode >= 300)) {
68
- return reject(new Error(`remote source rejected with status code ${res.statusCode}`))
64
+ try {
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, url.origin), 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
+ }
71
+
72
+ consumeStream(res).then(resolve, reject)
73
+ } catch (err) {
74
+ reject(err)
69
75
  }
70
-
71
- consumeStream(res).then(resolve, reject)
72
76
  })
73
77
  .on('error', reject)
74
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@napi-rs/canvas",
3
- "version": "0.1.53",
3
+ "version": "0.1.54",
4
4
  "description": "Canvas for Node.js with skia backend",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -71,7 +71,7 @@
71
71
  "@jimp/jpeg": "^0.22.10",
72
72
  "@jimp/png": "^0.22.10",
73
73
  "@napi-rs/cli": "^2.18.0",
74
- "@octokit/rest": "^20.0.2",
74
+ "@octokit/rest": "^21.0.0",
75
75
  "@swc-node/register": "^1.8.0",
76
76
  "@swc/core": "^1.4.0",
77
77
  "@taplo/cli": "^0.7.0",
@@ -84,12 +84,13 @@
84
84
  "canvaskit-wasm": "^0.39.1",
85
85
  "colorette": "^2.0.20",
86
86
  "conventional-changelog-cli": "^5.0.0",
87
+ "core-js": "^3.38.0",
87
88
  "echarts": "^5.4.3",
88
89
  "husky": "^9.0.10",
89
90
  "lint-staged": "^15.2.1",
90
91
  "lodash": "^4.17.21",
91
92
  "npm-run-all2": "^6.1.2",
92
- "oxlint": "^0.4.0",
93
+ "oxlint": "^0.7.0",
93
94
  "pinst": "^3.0.0",
94
95
  "png.js": "^0.2.1",
95
96
  "prettier": "^3.2.5",
@@ -109,7 +110,8 @@
109
110
  },
110
111
  "ava": {
111
112
  "require": [
112
- "@swc-node/register"
113
+ "@swc-node/register",
114
+ "core-js/proposals/promise-with-resolvers.js"
113
115
  ],
114
116
  "extensions": [
115
117
  "ts"
@@ -133,16 +135,16 @@
133
135
  "singleQuote": true,
134
136
  "arrowParens": "always"
135
137
  },
136
- "packageManager": "yarn@4.2.2",
138
+ "packageManager": "yarn@4.4.0",
137
139
  "optionalDependencies": {
138
- "@napi-rs/canvas-win32-x64-msvc": "0.1.53",
139
- "@napi-rs/canvas-darwin-x64": "0.1.53",
140
- "@napi-rs/canvas-linux-x64-gnu": "0.1.53",
141
- "@napi-rs/canvas-linux-arm-gnueabihf": "0.1.53",
142
- "@napi-rs/canvas-linux-x64-musl": "0.1.53",
143
- "@napi-rs/canvas-linux-arm64-gnu": "0.1.53",
144
- "@napi-rs/canvas-linux-arm64-musl": "0.1.53",
145
- "@napi-rs/canvas-darwin-arm64": "0.1.53",
146
- "@napi-rs/canvas-android-arm64": "0.1.53"
140
+ "@napi-rs/canvas-win32-x64-msvc": "0.1.54",
141
+ "@napi-rs/canvas-darwin-x64": "0.1.54",
142
+ "@napi-rs/canvas-linux-x64-gnu": "0.1.54",
143
+ "@napi-rs/canvas-linux-arm-gnueabihf": "0.1.54",
144
+ "@napi-rs/canvas-linux-x64-musl": "0.1.54",
145
+ "@napi-rs/canvas-linux-arm64-gnu": "0.1.54",
146
+ "@napi-rs/canvas-linux-arm64-musl": "0.1.54",
147
+ "@napi-rs/canvas-darwin-arm64": "0.1.54",
148
+ "@napi-rs/canvas-android-arm64": "0.1.54"
147
149
  }
148
150
  }