@napi-rs/canvas 0.1.51 → 0.1.52
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 +1 -1
- package/load-image.js +3 -4
- package/package.json +14 -19
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
|
|
package/load-image.js
CHANGED
|
@@ -4,9 +4,8 @@ const { Readable } = require('stream')
|
|
|
4
4
|
|
|
5
5
|
let http, https
|
|
6
6
|
|
|
7
|
-
const MAX_REDIRECTS = 20
|
|
8
|
-
|
|
9
|
-
DATA_URI = /^\s*data:/
|
|
7
|
+
const MAX_REDIRECTS = 20
|
|
8
|
+
const REDIRECT_STATUSES = new Set([301, 302])
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Loads the given source into canvas Image
|
|
@@ -23,7 +22,7 @@ module.exports = async function loadImage(source, options = {}) {
|
|
|
23
22
|
// if the source is Image instance, copy the image src to new image
|
|
24
23
|
if (source instanceof Image) return createImage(source.src, options.alt)
|
|
25
24
|
// if source is string and in data uri format, construct image using data uri
|
|
26
|
-
if (typeof source === 'string' &&
|
|
25
|
+
if (typeof source === 'string' && source.trimStart().startsWith('data:')) {
|
|
27
26
|
const commaIdx = source.indexOf(',')
|
|
28
27
|
const encoding = source.lastIndexOf('base64', commaIdx) < 0 ? 'utf-8' : 'base64'
|
|
29
28
|
const data = Buffer.from(source.slice(commaIdx + 1), encoding)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@napi-rs/canvas",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.52",
|
|
4
4
|
"description": "Canvas for Node.js with skia backend",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"format:rs": "cargo fmt",
|
|
59
59
|
"format:source": "prettier . -w",
|
|
60
60
|
"format:toml": "taplo format",
|
|
61
|
-
"lint": "
|
|
61
|
+
"lint": "oxlint",
|
|
62
62
|
"prepublishOnly": "pinst --disable && napi prepublish -t npm",
|
|
63
63
|
"postpublish": "pinst --enable",
|
|
64
64
|
"test:ci": "ava -c 1",
|
|
@@ -78,8 +78,6 @@
|
|
|
78
78
|
"@types/lodash": "^4.14.202",
|
|
79
79
|
"@types/node": "^20.11.16",
|
|
80
80
|
"@types/semver": "^7",
|
|
81
|
-
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
82
|
-
"@typescript-eslint/parser": "^7.0.0",
|
|
83
81
|
"ava": "^6.1.1",
|
|
84
82
|
"benny": "^3.7.1",
|
|
85
83
|
"canvas": "^2.11.2",
|
|
@@ -87,14 +85,11 @@
|
|
|
87
85
|
"colorette": "^2.0.20",
|
|
88
86
|
"conventional-changelog-cli": "^4.1.0",
|
|
89
87
|
"echarts": "^5.4.3",
|
|
90
|
-
"eslint": "^8.56.0",
|
|
91
|
-
"eslint-config-prettier": "^9.1.0",
|
|
92
|
-
"eslint-plugin-import": "^2.29.1",
|
|
93
|
-
"eslint-plugin-sonarjs": "^0.24.0",
|
|
94
88
|
"husky": "^9.0.10",
|
|
95
89
|
"lint-staged": "^15.2.1",
|
|
96
90
|
"lodash": "^4.17.21",
|
|
97
91
|
"npm-run-all2": "^6.1.2",
|
|
92
|
+
"oxlint": "^0.2.17",
|
|
98
93
|
"pinst": "^3.0.0",
|
|
99
94
|
"png.js": "^0.2.1",
|
|
100
95
|
"prettier": "^3.2.5",
|
|
@@ -109,7 +104,7 @@
|
|
|
109
104
|
"prettier --write"
|
|
110
105
|
],
|
|
111
106
|
"*.@(js|ts|tsx)": [
|
|
112
|
-
"
|
|
107
|
+
"oxlint --fix"
|
|
113
108
|
]
|
|
114
109
|
},
|
|
115
110
|
"ava": {
|
|
@@ -138,16 +133,16 @@
|
|
|
138
133
|
"singleQuote": true,
|
|
139
134
|
"arrowParens": "always"
|
|
140
135
|
},
|
|
141
|
-
"packageManager": "yarn@4.1.
|
|
136
|
+
"packageManager": "yarn@4.1.1",
|
|
142
137
|
"optionalDependencies": {
|
|
143
|
-
"@napi-rs/canvas-win32-x64-msvc": "0.1.
|
|
144
|
-
"@napi-rs/canvas-darwin-x64": "0.1.
|
|
145
|
-
"@napi-rs/canvas-linux-x64-gnu": "0.1.
|
|
146
|
-
"@napi-rs/canvas-linux-arm-gnueabihf": "0.1.
|
|
147
|
-
"@napi-rs/canvas-linux-x64-musl": "0.1.
|
|
148
|
-
"@napi-rs/canvas-linux-arm64-gnu": "0.1.
|
|
149
|
-
"@napi-rs/canvas-linux-arm64-musl": "0.1.
|
|
150
|
-
"@napi-rs/canvas-darwin-arm64": "0.1.
|
|
151
|
-
"@napi-rs/canvas-android-arm64": "0.1.
|
|
138
|
+
"@napi-rs/canvas-win32-x64-msvc": "0.1.52",
|
|
139
|
+
"@napi-rs/canvas-darwin-x64": "0.1.52",
|
|
140
|
+
"@napi-rs/canvas-linux-x64-gnu": "0.1.52",
|
|
141
|
+
"@napi-rs/canvas-linux-arm-gnueabihf": "0.1.52",
|
|
142
|
+
"@napi-rs/canvas-linux-x64-musl": "0.1.52",
|
|
143
|
+
"@napi-rs/canvas-linux-arm64-gnu": "0.1.52",
|
|
144
|
+
"@napi-rs/canvas-linux-arm64-musl": "0.1.52",
|
|
145
|
+
"@napi-rs/canvas-darwin-arm64": "0.1.52",
|
|
146
|
+
"@napi-rs/canvas-android-arm64": "0.1.52"
|
|
152
147
|
}
|
|
153
148
|
}
|