From b5ea367d8361d3a71154545831dfcf8e03aca8e1 Mon Sep 17 00:00:00 2001 From: Sukka Date: Tue, 8 Aug 2023 23:49:33 +0800 Subject: [PATCH] refactor: drop `globby` and `synckit` (#235) Co-authored-by: JounQin --- .changeset/witty-pets-study.md | 5 ++++ package.json | 5 ++-- pnpm-lock.yaml | 42 ++++++++++++++++------------------ src/index.ts | 12 +--------- src/worker.mts | 12 ---------- 5 files changed, 28 insertions(+), 48 deletions(-) create mode 100644 .changeset/witty-pets-study.md delete mode 100644 src/worker.mts diff --git a/.changeset/witty-pets-study.md b/.changeset/witty-pets-study.md new file mode 100644 index 0000000..531a556 --- /dev/null +++ b/.changeset/witty-pets-study.md @@ -0,0 +1,5 @@ +--- +"eslint-import-resolver-typescript": minor +--- + +refactor: drop `globby` and `synckit` diff --git a/package.json b/package.json index f89afd7..c2be6d8 100644 --- a/package.json +++ b/package.json @@ -69,11 +69,10 @@ "debug": "^4.3.4", "enhanced-resolve": "^5.12.0", "eslint-module-utils": "^2.7.4", + "fast-glob": "^3.3.1", "get-tsconfig": "^4.5.0", - "globby": "^13.1.3", "is-core-module": "^2.11.0", - "is-glob": "^4.0.3", - "synckit": "^0.8.5" + "is-glob": "^4.0.3" }, "devDependencies": { "@1stg/lib-config": "^11.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8654263..691688d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,21 +21,18 @@ dependencies: eslint-plugin-import: specifier: '*' version: 2.27.5(@typescript-eslint/parser@5.57.1)(eslint-import-resolver-typescript@)(eslint@8.37.0) + fast-glob: + specifier: ^3.3.1 + version: 3.3.1 get-tsconfig: specifier: ^4.5.0 version: 4.5.0 - globby: - specifier: ^13.1.3 - version: 13.1.3 is-core-module: specifier: ^2.11.0 version: 2.11.0 is-glob: specifier: ^4.0.3 version: 4.0.3 - synckit: - specifier: ^0.8.5 - version: 0.8.5 devDependencies: '@1stg/lib-config': @@ -3144,6 +3141,7 @@ packages: picocolors: 1.0.0 tiny-glob: 0.2.9 tslib: 2.5.0 + dev: true /@prettier/plugin-pug@2.2.0(prettier@2.8.7): resolution: {integrity: sha512-W5CIXtMauz6xB4b0TeBW1Jxtk2ArggKMwqDHdGOfQ9ahABsttg2YZoQgLytETuo8Gjq0QkaGhAGD1pfDaUOZUQ==} @@ -4798,6 +4796,7 @@ packages: /define-lazy-prop@2.0.0: resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==} engines: {node: '>=8'} + dev: true /define-properties@1.1.4: resolution: {integrity: sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==} @@ -5921,8 +5920,8 @@ packages: resolution: {integrity: sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==} dev: true - /fast-glob@3.2.11: - resolution: {integrity: sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==} + /fast-glob@3.3.1: + resolution: {integrity: sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==} engines: {node: '>=8.6.0'} dependencies: '@nodelib/fs.stat': 2.0.5 @@ -6220,6 +6219,7 @@ packages: /globalyzer@0.1.0: resolution: {integrity: sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==} + dev: true /globby@10.0.1: resolution: {integrity: sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==} @@ -6228,7 +6228,7 @@ packages: '@types/glob': 7.2.0 array-union: 2.1.0 dir-glob: 3.0.1 - fast-glob: 3.2.11 + fast-glob: 3.3.1 glob: 7.2.3 ignore: 5.2.4 merge2: 1.4.1 @@ -6241,24 +6241,14 @@ packages: dependencies: array-union: 2.1.0 dir-glob: 3.0.1 - fast-glob: 3.2.11 + fast-glob: 3.3.1 ignore: 5.2.0 merge2: 1.4.1 slash: 3.0.0 - /globby@13.1.3: - resolution: {integrity: sha512-8krCNHXvlCgHDpegPzleMq07yMYTO2sXKASmZmquEYWEmCx6J5UTRbp5RwMJkTJGtcQ44YpiUYUiN0b9mzy8Bw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - dir-glob: 3.0.1 - fast-glob: 3.2.11 - ignore: 5.2.0 - merge2: 1.4.1 - slash: 4.0.0 - dev: false - /globrex@0.1.2: resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} + dev: true /gopd@1.0.1: resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} @@ -6573,6 +6563,7 @@ packages: resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} engines: {node: '>=8'} hasBin: true + dev: true /is-empty@1.2.0: resolution: {integrity: sha512-F2FnH/otLNJv0J6wc73A5Xo7oHLNnqplYqZhUu01tD54DIPvxIRSTSLkrUB/M0nHO4vo1O9PDfN4KoTxCzLh/w==} @@ -6762,6 +6753,7 @@ packages: engines: {node: '>=8'} dependencies: is-docker: 2.2.1 + dev: true /isarray@2.0.5: resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} @@ -8198,6 +8190,7 @@ packages: define-lazy-prop: 2.0.0 is-docker: 2.2.1 is-wsl: 2.2.0 + dev: true /optionator@0.8.3: resolution: {integrity: sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==} @@ -8405,6 +8398,7 @@ packages: /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} + dev: true /picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} @@ -9905,6 +9899,7 @@ packages: /slash@4.0.0: resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} engines: {node: '>=12'} + dev: true /slice-ansi@3.0.0: resolution: {integrity: sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==} @@ -10248,6 +10243,7 @@ packages: dependencies: '@pkgr/utils': 2.3.1 tslib: 2.5.0 + dev: true /tapable@2.2.1: resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} @@ -10289,6 +10285,7 @@ packages: dependencies: globalyzer: 0.1.0 globrex: 0.1.2 + dev: true /tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} @@ -10390,6 +10387,7 @@ packages: /tslib@2.5.0: resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==} + dev: true /tsutils@3.21.0(typescript@5.0.4): resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} @@ -10432,7 +10430,7 @@ packages: peerDependencies: typescript: 2 || 3 || 4 || 5 dependencies: - fast-glob: 3.2.11 + fast-glob: 3.3.1 minimatch: 5.1.0 normalize-path: 3.0.0 tslib: 2.5.0 diff --git a/src/index.ts b/src/index.ts index a707fd5..df5815e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,30 +1,20 @@ import fs from 'node:fs' import path from 'node:path' -import { fileURLToPath } from 'node:url' import debug from 'debug' import type { FileSystem, ResolveOptions, Resolver } from 'enhanced-resolve' import enhancedResolve from 'enhanced-resolve' import { hashObject } from 'eslint-module-utils/hash.js' +import { sync as globSync } from 'fast-glob' import { createPathsMatcher, getTsconfig } from 'get-tsconfig' import type { TsConfigResult } from 'get-tsconfig' import isCore from 'is-core-module' import isGlob from 'is-glob' -import { createSyncFn } from 'synckit' const IMPORTER_NAME = 'eslint-import-resolver-typescript' const log = debug(IMPORTER_NAME) -const _dirname = - typeof __dirname === 'undefined' - ? path.dirname(fileURLToPath(import.meta.url)) - : __dirname - -export const globSync = createSyncFn( - path.resolve(_dirname, 'worker.mjs'), -) - export const defaultConditionNames = [ 'types', 'import', diff --git a/src/worker.mts b/src/worker.mts deleted file mode 100644 index d13024e..0000000 --- a/src/worker.mts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Options } from 'globby' -import { runAsWorker } from 'synckit' - -runAsWorker( - async ( - patterns: string | readonly string[], - options: Options & { objectMode: true }, - ) => { - const { globby } = await import('globby') - return globby(patterns, options) - }, -)