Skip to content

Commit 8efab96

Browse files
committed
build(deps): remove upath
1 parent 726132a commit 8efab96

File tree

4 files changed

+32
-33
lines changed

4 files changed

+32
-33
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@
110110
},
111111
"dependencies": {
112112
"camelcase": "^6.3.0",
113-
"semver": "^7.6.3",
114-
"upath": "^2.0.1"
113+
"semver": "^7.6.3"
115114
}
116115
}

scripts/license-checker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const { init } = require("license-checker");
55
/** @type {string[]} */
66
// @ts-ignore: module is a JSON file
77
const copyLeftLicenses = require("spdx-copyleft");
8-
const { joinSafe } = require("upath");
8+
const { join } = require("node:path");
99

1010
const check = promisify(init);
1111

@@ -54,7 +54,7 @@ async function checkLicenses() {
5454
const licenses = await check({
5555
direct: true,
5656
production: true,
57-
start: joinSafe(__dirname, ".."),
57+
start: join(__dirname, ".."),
5858
});
5959

6060
const copyLeftLicensesList = Object.keys(licenses).filter((license) => {

src/index.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { execFile, spawn, spawnSync } = require("node:child_process");
44
const { promisify } = require("node:util");
55
const camelCase = require("camelcase");
66
const { lt } = require("semver");
7-
const { joinSafe, normalizeTrim } = require("upath");
7+
const { normalize, resolve: pathResolve } = require("node:path");
88

99
const execFileAsync = promisify(execFile);
1010

@@ -110,7 +110,7 @@ class Poppler {
110110
this.popplerPath = popplerPath;
111111
}
112112
if (platform === "win32" && !popplerPath) {
113-
this.popplerPath = joinSafe(
113+
this.popplerPath = pathResolve(
114114
__dirname,
115115
"lib",
116116
"win32",
@@ -127,7 +127,7 @@ class Poppler {
127127
`Unable to find ${process.platform} Poppler binaries, please pass the installation directory as a parameter to the Poppler instance.`
128128
);
129129
}
130-
this.popplerPath = normalizeTrim(this.popplerPath);
130+
this.popplerPath = normalize(this.popplerPath);
131131
}
132132

133133
/**
@@ -152,7 +152,7 @@ class Poppler {
152152
args.push(file, fileToAttach, outputFile);
153153

154154
const { stdout } = await execFileAsync(
155-
joinSafe(this.popplerPath, "pdfattach"),
155+
pathResolve(this.popplerPath, "pdfattach"),
156156
args
157157
);
158158
return Promise.resolve(stdout);
@@ -209,7 +209,7 @@ class Poppler {
209209
args.push(file);
210210

211211
const { stdout } = await execFileAsync(
212-
joinSafe(this.popplerPath, "pdfdetach"),
212+
pathResolve(this.popplerPath, "pdfdetach"),
213213
args
214214
);
215215
return Promise.resolve(stdout);
@@ -244,7 +244,7 @@ class Poppler {
244244

245245
try {
246246
const { stderr } = await execFileAsync(
247-
joinSafe(this.popplerPath, "pdffonts"),
247+
pathResolve(this.popplerPath, "pdffonts"),
248248
["-v"]
249249
);
250250

@@ -257,7 +257,7 @@ class Poppler {
257257
args.push(Buffer.isBuffer(file) ? "-" : file);
258258

259259
const child = spawn(
260-
joinSafe(this.popplerPath, "pdffonts"),
260+
pathResolve(this.popplerPath, "pdffonts"),
261261
args
262262
);
263263

@@ -345,7 +345,7 @@ class Poppler {
345345

346346
try {
347347
const { stderr } = await execFileAsync(
348-
joinSafe(this.popplerPath, "pdfimages"),
348+
pathResolve(this.popplerPath, "pdfimages"),
349349
["-v"]
350350
);
351351

@@ -362,7 +362,7 @@ class Poppler {
362362
}
363363

364364
const child = spawn(
365-
joinSafe(this.popplerPath, "pdfimages"),
365+
pathResolve(this.popplerPath, "pdfimages"),
366366
args
367367
);
368368

@@ -464,7 +464,7 @@ class Poppler {
464464

465465
try {
466466
const { stderr } = await execFileAsync(
467-
joinSafe(this.popplerPath, "pdfinfo"),
467+
pathResolve(this.popplerPath, "pdfinfo"),
468468
["-v"]
469469
);
470470

@@ -489,7 +489,7 @@ class Poppler {
489489
}
490490

491491
const child = spawn(
492-
joinSafe(this.popplerPath, "pdfinfo"),
492+
pathResolve(this.popplerPath, "pdfinfo"),
493493
args
494494
);
495495

@@ -583,7 +583,7 @@ class Poppler {
583583

584584
try {
585585
const { stderr } = await execFileAsync(
586-
joinSafe(this.popplerPath, "pdfseparate"),
586+
pathResolve(this.popplerPath, "pdfseparate"),
587587
["-v"]
588588
);
589589

@@ -594,7 +594,7 @@ class Poppler {
594594
args.push(file, outputPattern);
595595

596596
const { stdout } = await execFileAsync(
597-
joinSafe(this.popplerPath, "pdfseparate"),
597+
pathResolve(this.popplerPath, "pdfseparate"),
598598
args
599599
);
600600
return Promise.resolve(stdout);
@@ -767,7 +767,7 @@ class Poppler {
767767

768768
try {
769769
const { stderr } = await execFileAsync(
770-
joinSafe(this.popplerPath, "pdftocairo"),
770+
pathResolve(this.popplerPath, "pdftocairo"),
771771
["-v"]
772772
);
773773

@@ -783,7 +783,7 @@ class Poppler {
783783
);
784784

785785
const child = spawn(
786-
joinSafe(this.popplerPath, "pdftocairo"),
786+
pathResolve(this.popplerPath, "pdftocairo"),
787787
args
788788
);
789789

@@ -908,7 +908,7 @@ class Poppler {
908908

909909
try {
910910
const { stderr } = await execFileAsync(
911-
joinSafe(this.popplerPath, "pdftohtml"),
911+
pathResolve(this.popplerPath, "pdftohtml"),
912912
["-v"]
913913
);
914914

@@ -925,7 +925,7 @@ class Poppler {
925925
}
926926

927927
const child = spawn(
928-
joinSafe(this.popplerPath, "pdftohtml"),
928+
pathResolve(this.popplerPath, "pdftohtml"),
929929
args
930930
);
931931

@@ -1109,7 +1109,7 @@ class Poppler {
11091109

11101110
try {
11111111
const { stderr } = await execFileAsync(
1112-
joinSafe(this.popplerPath, "pdftoppm"),
1112+
pathResolve(this.popplerPath, "pdftoppm"),
11131113
["-v"]
11141114
);
11151115

@@ -1122,7 +1122,7 @@ class Poppler {
11221122
args.push(Buffer.isBuffer(file) ? "-" : file, outputPath);
11231123

11241124
const child = spawn(
1125-
joinSafe(this.popplerPath, "pdftoppm"),
1125+
pathResolve(this.popplerPath, "pdftoppm"),
11261126
args
11271127
);
11281128

@@ -1341,7 +1341,7 @@ class Poppler {
13411341

13421342
try {
13431343
const { stderr } = await execFileAsync(
1344-
joinSafe(this.popplerPath, "pdftops"),
1344+
pathResolve(this.popplerPath, "pdftops"),
13451345
["-v"]
13461346
);
13471347

@@ -1357,7 +1357,7 @@ class Poppler {
13571357
);
13581358

13591359
const child = spawn(
1360-
joinSafe(this.popplerPath, "pdftops"),
1360+
pathResolve(this.popplerPath, "pdftops"),
13611361
args
13621362
);
13631363

@@ -1491,7 +1491,7 @@ class Poppler {
14911491

14921492
try {
14931493
const { stderr } = await execFileAsync(
1494-
joinSafe(this.popplerPath, "pdftotext"),
1494+
pathResolve(this.popplerPath, "pdftotext"),
14951495
["-v"]
14961496
);
14971497

@@ -1507,7 +1507,7 @@ class Poppler {
15071507
);
15081508

15091509
const child = spawn(
1510-
joinSafe(this.popplerPath, "pdftotext"),
1510+
pathResolve(this.popplerPath, "pdftotext"),
15111511
args
15121512
);
15131513

@@ -1572,7 +1572,7 @@ class Poppler {
15721572

15731573
try {
15741574
const { stderr } = await execFileAsync(
1575-
joinSafe(this.popplerPath, "pdfunite"),
1575+
pathResolve(this.popplerPath, "pdfunite"),
15761576
["-v"]
15771577
);
15781578

@@ -1586,7 +1586,7 @@ class Poppler {
15861586
args.push(outputFile);
15871587

15881588
const { stdout } = await execFileAsync(
1589-
joinSafe(this.popplerPath, "pdfunite"),
1589+
pathResolve(this.popplerPath, "pdfunite"),
15901590
args
15911591
);
15921592
return Promise.resolve(stdout);

src/index.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const { access, readFile, unlink } = require("node:fs/promises");
99
const { promisify } = require("node:util");
1010
const { glob } = require("glob");
1111
const { lt } = require("semver");
12-
const { joinSafe, normalizeTrim } = require("upath");
12+
const { join, normalize } = require("node:path");
1313

1414
const execFileAsync = promisify(execFile);
1515
const { Poppler } = require("./index");
@@ -30,7 +30,7 @@ function getTestBinaryPath() {
3030
let popplerPath = /(.+)pdfinfo/u.exec(which)?.[1];
3131

3232
if (platform === "win32" && !popplerPath) {
33-
popplerPath = joinSafe(
33+
popplerPath = join(
3434
__dirname,
3535
"lib",
3636
"win32",
@@ -40,7 +40,7 @@ function getTestBinaryPath() {
4040
);
4141
}
4242

43-
return normalizeTrim(popplerPath);
43+
return normalize(popplerPath);
4444
}
4545

4646
const testBinaryPath = getTestBinaryPath();
@@ -1011,7 +1011,7 @@ describe("Node-Poppler module", () => {
10111011

10121012
beforeAll(async () => {
10131013
const { stderr } = await execFileAsync(
1014-
joinSafe(testBinaryPath, "pdftoppm"),
1014+
join(testBinaryPath, "pdftoppm"),
10151015
["-v"]
10161016
);
10171017

0 commit comments

Comments
 (0)