@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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/load-image.js +3 -4
  3. package/package.json +14 -19
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%2Fm123-hotpink)
4
+ ![Skia Version](https://img.shields.io/badge/Skia-chrome%2Fm125-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
 
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
- REDIRECT_STATUSES = new Set([301, 302]),
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' && DATA_URI.test(source)) {
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.51",
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": "eslint . -c ./.eslintrc.yml",
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
- "eslint -c .eslintrc.yml --fix"
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.0",
136
+ "packageManager": "yarn@4.1.1",
142
137
  "optionalDependencies": {
143
- "@napi-rs/canvas-win32-x64-msvc": "0.1.51",
144
- "@napi-rs/canvas-darwin-x64": "0.1.51",
145
- "@napi-rs/canvas-linux-x64-gnu": "0.1.51",
146
- "@napi-rs/canvas-linux-arm-gnueabihf": "0.1.51",
147
- "@napi-rs/canvas-linux-x64-musl": "0.1.51",
148
- "@napi-rs/canvas-linux-arm64-gnu": "0.1.51",
149
- "@napi-rs/canvas-linux-arm64-musl": "0.1.51",
150
- "@napi-rs/canvas-darwin-arm64": "0.1.51",
151
- "@napi-rs/canvas-android-arm64": "0.1.51"
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
  }