From 932ad367b5b37ea0f3c559b13691bdb8f1ef9d8e Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Tue, 6 May 2025 12:31:54 +0100 Subject: [PATCH] perf: switch to `empathic` find package traversal Uses `empathic/find` for finding the closest `package.json`, a much faster and smaller library than the various over-specialised alternatives lying around. --- package.json | 2 +- src/cache.js | 2 +- yarn.lock | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 907d927e..f2c89251 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "node": "^18.20.0 || ^20.10.0 || >=22.0.0" }, "dependencies": { - "find-up": "^5.0.0" + "empathic": "^1.1.0" }, "peerDependencies": { "@babel/core": "^7.12.0", diff --git a/src/cache.js b/src/cache.js index 7d953f3b..9879dc0a 100644 --- a/src/cache.js +++ b/src/cache.js @@ -12,7 +12,7 @@ const path = require("path"); const zlib = require("zlib"); const { promisify } = require("util"); const { readFile, writeFile, mkdir } = require("fs/promises"); -const { sync: findUpSync } = require("find-up"); +const { up: findUpSync } = require("empathic/find"); const { env } = process; const transform = require("./transform"); const serialize = require("./serialize"); diff --git a/yarn.lock b/yarn.lock index d542600b..133e0551 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1956,10 +1956,10 @@ __metadata: "@babel/eslint-parser": ^7.23.3 "@babel/preset-env": ^7.23.3 c8: ^10.1.2 + empathic: ^1.1.0 eslint: ^9.6.0 eslint-config-prettier: ^9.1.0 eslint-plugin-prettier: ^5.1.3 - find-up: ^5.0.0 globals: ^15.8.0 husky: ^9.1.5 lint-staged: ^15.2.9 @@ -2376,6 +2376,13 @@ __metadata: languageName: node linkType: hard +"empathic@npm:^1.1.0": + version: 1.1.0 + resolution: "empathic@npm:1.1.0" + checksum: 1e41763802f14e5fa2522063f8f93e161c64916698f39e493a3e274356e39aa6f60d60f33063c92f9d5c5426fd33d9cb33baed2885a194648254181ce5495a9c + languageName: node + linkType: hard + "encoding@npm:^0.1.13": version: 0.1.13 resolution: "encoding@npm:0.1.13"