Skip to content

Commit

Permalink
Merge pull request #18922 from Snuffleupagus/node-canvas-3
Browse files Browse the repository at this point in the history
[api-minor] Update the `canvas` package to version 3
  • Loading branch information
Snuffleupagus authored Oct 20, 2024
2 parents 025c087 + 54e00b0 commit 2a4630f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 214 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [18, lts/*]
node-version: [18, lts/*, 22]

steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2244,7 +2244,7 @@ function packageJson() {
bugs: DIST_BUGS_URL,
license: DIST_LICENSE,
optionalDependencies: {
canvas: "^2.11.2",
canvas: "^3.0.0-rc2",
path2d: "^0.2.1",
},
browser: {
Expand Down
218 changes: 8 additions & 210 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"autoprefixer": "^10.4.20",
"babel-loader": "^9.2.1",
"caniuse-lite": "^1.0.30001667",
"canvas": "^2.11.2",
"canvas": "^3.0.0-rc2",
"core-js": "^3.38.1",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
Expand Down
6 changes: 5 additions & 1 deletion src/display/node_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ if (isNodeJS) {
applyPath2DToCanvasRenderingContext &&
Path2D
) {
applyPath2DToCanvasRenderingContext(CanvasRenderingContext2D);
try {
applyPath2DToCanvasRenderingContext(CanvasRenderingContext2D);
} catch (ex) {
warn(`applyPath2DToCanvasRenderingContext: "${ex}".`);
}
globalThis.Path2D = Path2D;
} else {
warn("Cannot polyfill `Path2D`, rendering may be broken.");
Expand Down

0 comments on commit 2a4630f

Please sign in to comment.