Skip to content
This repository was archived by the owner on Jul 26, 2025. It is now read-only.

Commit 19629e1

Browse files
committed
chore: update dependencies and fix demo
1 parent 30b0b08 commit 19629e1

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"@types/jest-image-snapshot": "^6.1.0",
6767
"@types/node": "^18.15.11",
6868
"@types/picomatch": "^2.3.0",
69-
"@types/react": "^18.0.34",
69+
"@types/react": "^18.0.35",
7070
"@types/react-dom": "^18.0.11",
7171
"@types/robust-point-in-polygon": "^1.0.2",
7272
"@vitejs/plugin-react": "^3.1.0",
@@ -78,11 +78,11 @@
7878
"eslint-config-cheminfo-typescript": "^11.3.1",
7979
"eslint-plugin-import": "^2.27.5",
8080
"eslint-plugin-jest": "^27.2.1",
81-
"immer": "^9.0.21",
81+
"immer": "^10.0.0",
8282
"jest": "^29.5.0",
8383
"jest-image-snapshot": "^6.1.0",
8484
"jest-matcher-deep-close-to": "^3.0.2",
85-
"postcss": "^8.4.21",
85+
"postcss": "^8.4.22",
8686
"prettier": "^2.8.7",
8787
"react": "^18.2.0",
8888
"react-dom": "^18.2.0",

src/save/write.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from 'node:fs';
2-
import { dirname, extname } from 'node:path';
3-
import { fileURLToPath } from 'node:url';
2+
import nodePath from 'node:path';
3+
import url from 'node:url';
44

55
import { Mask, Image } from '..';
66

@@ -74,14 +74,14 @@ export async function write(
7474
options?: WriteOptionsPng | WriteOptionsJpeg | WriteOptions,
7575
): Promise<void> {
7676
if (typeof path !== 'string') {
77-
path = fileURLToPath(path);
77+
path = url.fileURLToPath(path);
7878
}
7979
if (image instanceof Mask) {
8080
image = image.convertColor('GREY');
8181
}
8282
const toWrite = getDataToWrite(path, image, options);
8383
if (options?.recursive) {
84-
const dir = dirname(path);
84+
const dir = nodePath.dirname(path);
8585
await fs.promises.mkdir(dir, { recursive: true });
8686
}
8787
await fs.promises.writeFile(path, toWrite);
@@ -100,14 +100,14 @@ export function writeSync(
100100
options?: WriteOptionsPng | WriteOptionsJpeg | WriteOptions,
101101
): void {
102102
if (typeof path !== 'string') {
103-
path = fileURLToPath(path);
103+
path = url.fileURLToPath(path);
104104
}
105105
if (image instanceof Mask) {
106106
image = image.convertColor('GREY');
107107
}
108108
const toWrite = getDataToWrite(path, image, options);
109109
if (options?.recursive) {
110-
const dir = dirname(path);
110+
const dir = nodePath.dirname(path);
111111
fs.mkdirSync(dir, { recursive: true });
112112
}
113113
fs.writeFileSync(path, toWrite);
@@ -128,7 +128,7 @@ function getDataToWrite(
128128
): Uint8Array {
129129
let format: ImageFormat;
130130
if (!options || !('format' in options)) {
131-
const extension = extname(destinationPath).slice(1).toLowerCase();
131+
const extension = nodePath.extname(destinationPath).slice(1).toLowerCase();
132132
if (extension === 'png') {
133133
format = 'png';
134134
return encode(image, { format });

0 commit comments

Comments
 (0)