Skip to content

Commit

Permalink
build(deps): remove upath
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Feb 5, 2025
1 parent 884a9e3 commit 4a15022
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 33 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@
},
"dependencies": {
"camelcase": "^6.3.0",
"semver": "^7.6.3",
"upath": "^2.0.1"
"semver": "^7.6.3"
}
}
4 changes: 2 additions & 2 deletions scripts/license-checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { init } = require("license-checker");
/** @type {string[]} */
// @ts-ignore: module is a JSON file
const copyLeftLicenses = require("spdx-copyleft");
const { joinSafe } = require("upath");
const { join } = require("node:path");

const check = promisify(init);

Expand Down Expand Up @@ -54,7 +54,7 @@ async function checkLicenses() {
const licenses = await check({
direct: true,
production: true,
start: joinSafe(__dirname, ".."),
start: join(__dirname, ".."),
});

const copyLeftLicensesList = Object.keys(licenses).filter((license) => {
Expand Down
50 changes: 25 additions & 25 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { execFile, spawn, spawnSync } = require("node:child_process");
const { promisify } = require("node:util");
const camelCase = require("camelcase");
const { lt } = require("semver");
const { joinSafe, normalizeTrim } = require("upath");
const { normalize, resolve: pathResolve } = require("node:path");

const execFileAsync = promisify(execFile);

Expand Down Expand Up @@ -110,7 +110,7 @@ class Poppler {
this.popplerPath = popplerPath;
}
if (platform === "win32" && !popplerPath) {
this.popplerPath = joinSafe(
this.popplerPath = pathResolve(
__dirname,
"lib",
"win32",
Expand All @@ -127,7 +127,7 @@ class Poppler {
`Unable to find ${process.platform} Poppler binaries, please pass the installation directory as a parameter to the Poppler instance.`
);
}
this.popplerPath = normalizeTrim(this.popplerPath);
this.popplerPath = normalize(this.popplerPath);
}

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

const { stdout } = await execFileAsync(
joinSafe(this.popplerPath, "pdfattach"),
pathResolve(this.popplerPath, "pdfattach"),
args
);
return Promise.resolve(stdout);
Expand Down Expand Up @@ -209,7 +209,7 @@ class Poppler {
args.push(file);

const { stdout } = await execFileAsync(
joinSafe(this.popplerPath, "pdfdetach"),
pathResolve(this.popplerPath, "pdfdetach"),
args
);
return Promise.resolve(stdout);
Expand Down Expand Up @@ -244,7 +244,7 @@ class Poppler {

try {
const { stderr } = await execFileAsync(
joinSafe(this.popplerPath, "pdffonts"),
pathResolve(this.popplerPath, "pdffonts"),
["-v"]
);

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

const child = spawn(
joinSafe(this.popplerPath, "pdffonts"),
pathResolve(this.popplerPath, "pdffonts"),
args
);

Expand Down Expand Up @@ -345,7 +345,7 @@ class Poppler {

try {
const { stderr } = await execFileAsync(
joinSafe(this.popplerPath, "pdfimages"),
pathResolve(this.popplerPath, "pdfimages"),
["-v"]
);

Expand All @@ -362,7 +362,7 @@ class Poppler {
}

const child = spawn(
joinSafe(this.popplerPath, "pdfimages"),
pathResolve(this.popplerPath, "pdfimages"),
args
);

Expand Down Expand Up @@ -464,7 +464,7 @@ class Poppler {

try {
const { stderr } = await execFileAsync(
joinSafe(this.popplerPath, "pdfinfo"),
pathResolve(this.popplerPath, "pdfinfo"),
["-v"]
);

Expand All @@ -489,7 +489,7 @@ class Poppler {
}

const child = spawn(
joinSafe(this.popplerPath, "pdfinfo"),
pathResolve(this.popplerPath, "pdfinfo"),
args
);

Expand Down Expand Up @@ -583,7 +583,7 @@ class Poppler {

try {
const { stderr } = await execFileAsync(
joinSafe(this.popplerPath, "pdfseparate"),
pathResolve(this.popplerPath, "pdfseparate"),
["-v"]
);

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

const { stdout } = await execFileAsync(
joinSafe(this.popplerPath, "pdfseparate"),
pathResolve(this.popplerPath, "pdfseparate"),
args
);
return Promise.resolve(stdout);
Expand Down Expand Up @@ -767,7 +767,7 @@ class Poppler {

try {
const { stderr } = await execFileAsync(
joinSafe(this.popplerPath, "pdftocairo"),
pathResolve(this.popplerPath, "pdftocairo"),
["-v"]
);

Expand All @@ -783,7 +783,7 @@ class Poppler {
);

const child = spawn(
joinSafe(this.popplerPath, "pdftocairo"),
pathResolve(this.popplerPath, "pdftocairo"),
args
);

Expand Down Expand Up @@ -908,7 +908,7 @@ class Poppler {

try {
const { stderr } = await execFileAsync(
joinSafe(this.popplerPath, "pdftohtml"),
pathResolve(this.popplerPath, "pdftohtml"),
["-v"]
);

Expand All @@ -925,7 +925,7 @@ class Poppler {
}

const child = spawn(
joinSafe(this.popplerPath, "pdftohtml"),
pathResolve(this.popplerPath, "pdftohtml"),
args
);

Expand Down Expand Up @@ -1109,7 +1109,7 @@ class Poppler {

try {
const { stderr } = await execFileAsync(
joinSafe(this.popplerPath, "pdftoppm"),
pathResolve(this.popplerPath, "pdftoppm"),
["-v"]
);

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

const child = spawn(
joinSafe(this.popplerPath, "pdftoppm"),
pathResolve(this.popplerPath, "pdftoppm"),
args
);

Expand Down Expand Up @@ -1341,7 +1341,7 @@ class Poppler {

try {
const { stderr } = await execFileAsync(
joinSafe(this.popplerPath, "pdftops"),
pathResolve(this.popplerPath, "pdftops"),
["-v"]
);

Expand All @@ -1357,7 +1357,7 @@ class Poppler {
);

const child = spawn(
joinSafe(this.popplerPath, "pdftops"),
pathResolve(this.popplerPath, "pdftops"),
args
);

Expand Down Expand Up @@ -1491,7 +1491,7 @@ class Poppler {

try {
const { stderr } = await execFileAsync(
joinSafe(this.popplerPath, "pdftotext"),
pathResolve(this.popplerPath, "pdftotext"),
["-v"]
);

Expand All @@ -1507,7 +1507,7 @@ class Poppler {
);

const child = spawn(
joinSafe(this.popplerPath, "pdftotext"),
pathResolve(this.popplerPath, "pdftotext"),
args
);

Expand Down Expand Up @@ -1572,7 +1572,7 @@ class Poppler {

try {
const { stderr } = await execFileAsync(
joinSafe(this.popplerPath, "pdfunite"),
pathResolve(this.popplerPath, "pdfunite"),
["-v"]
);

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

const { stdout } = await execFileAsync(
joinSafe(this.popplerPath, "pdfunite"),
pathResolve(this.popplerPath, "pdfunite"),
args
);
return Promise.resolve(stdout);
Expand Down
8 changes: 4 additions & 4 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { access, readFile, unlink } = require("node:fs/promises");
const { promisify } = require("node:util");
const { glob } = require("glob");
const { lt } = require("semver");
const { joinSafe, normalizeTrim } = require("upath");
const { join, normalize } = require("node:path");

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

if (platform === "win32" && !popplerPath) {
popplerPath = joinSafe(
popplerPath = join(
__dirname,
"lib",
"win32",
Expand All @@ -40,7 +40,7 @@ function getTestBinaryPath() {
);
}

return normalizeTrim(popplerPath);
return normalize(popplerPath);
}

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

beforeAll(async () => {
const { stderr } = await execFileAsync(
joinSafe(testBinaryPath, "pdftoppm"),
join(testBinaryPath, "pdftoppm"),
["-v"]
);

Expand Down

0 comments on commit 4a15022

Please sign in to comment.