@napi-rs/canvas 0.1.50 → 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 +18 -20
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,9 +1,12 @@
|
|
|
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
|
-
"repository":
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Brooooooklyn/canvas.git"
|
|
9
|
+
},
|
|
7
10
|
"license": "MIT",
|
|
8
11
|
"keywords": [
|
|
9
12
|
"napi-rs",
|
|
@@ -55,7 +58,7 @@
|
|
|
55
58
|
"format:rs": "cargo fmt",
|
|
56
59
|
"format:source": "prettier . -w",
|
|
57
60
|
"format:toml": "taplo format",
|
|
58
|
-
"lint": "
|
|
61
|
+
"lint": "oxlint",
|
|
59
62
|
"prepublishOnly": "pinst --disable && napi prepublish -t npm",
|
|
60
63
|
"postpublish": "pinst --enable",
|
|
61
64
|
"test:ci": "ava -c 1",
|
|
@@ -75,8 +78,6 @@
|
|
|
75
78
|
"@types/lodash": "^4.14.202",
|
|
76
79
|
"@types/node": "^20.11.16",
|
|
77
80
|
"@types/semver": "^7",
|
|
78
|
-
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
79
|
-
"@typescript-eslint/parser": "^7.0.0",
|
|
80
81
|
"ava": "^6.1.1",
|
|
81
82
|
"benny": "^3.7.1",
|
|
82
83
|
"canvas": "^2.11.2",
|
|
@@ -84,14 +85,11 @@
|
|
|
84
85
|
"colorette": "^2.0.20",
|
|
85
86
|
"conventional-changelog-cli": "^4.1.0",
|
|
86
87
|
"echarts": "^5.4.3",
|
|
87
|
-
"eslint": "^8.56.0",
|
|
88
|
-
"eslint-config-prettier": "^9.1.0",
|
|
89
|
-
"eslint-plugin-import": "^2.29.1",
|
|
90
|
-
"eslint-plugin-sonarjs": "^0.24.0",
|
|
91
88
|
"husky": "^9.0.10",
|
|
92
89
|
"lint-staged": "^15.2.1",
|
|
93
90
|
"lodash": "^4.17.21",
|
|
94
91
|
"npm-run-all2": "^6.1.2",
|
|
92
|
+
"oxlint": "^0.2.17",
|
|
95
93
|
"pinst": "^3.0.0",
|
|
96
94
|
"png.js": "^0.2.1",
|
|
97
95
|
"prettier": "^3.2.5",
|
|
@@ -106,7 +104,7 @@
|
|
|
106
104
|
"prettier --write"
|
|
107
105
|
],
|
|
108
106
|
"*.@(js|ts|tsx)": [
|
|
109
|
-
"
|
|
107
|
+
"oxlint --fix"
|
|
110
108
|
]
|
|
111
109
|
},
|
|
112
110
|
"ava": {
|
|
@@ -135,16 +133,16 @@
|
|
|
135
133
|
"singleQuote": true,
|
|
136
134
|
"arrowParens": "always"
|
|
137
135
|
},
|
|
138
|
-
"packageManager": "yarn@4.1.
|
|
136
|
+
"packageManager": "yarn@4.1.1",
|
|
139
137
|
"optionalDependencies": {
|
|
140
|
-
"@napi-rs/canvas-win32-x64-msvc": "0.1.
|
|
141
|
-
"@napi-rs/canvas-darwin-x64": "0.1.
|
|
142
|
-
"@napi-rs/canvas-linux-x64-gnu": "0.1.
|
|
143
|
-
"@napi-rs/canvas-linux-arm-gnueabihf": "0.1.
|
|
144
|
-
"@napi-rs/canvas-linux-x64-musl": "0.1.
|
|
145
|
-
"@napi-rs/canvas-linux-arm64-gnu": "0.1.
|
|
146
|
-
"@napi-rs/canvas-linux-arm64-musl": "0.1.
|
|
147
|
-
"@napi-rs/canvas-darwin-arm64": "0.1.
|
|
148
|
-
"@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"
|
|
149
147
|
}
|
|
150
148
|
}
|