Skip to content

Commit e123a57

Browse files
Benjamin NewmanJounQin
authored andcommitted
chore(deps): migrate from unrs-resolver to oxc-resolver
Resolves #412. - Replace unrs-resolver with oxc-resolver ^11.0.0 - Update eslint-import-context to ^0.2.0 - Update documentation references - Adjust test for oxc-resolver's directory-first resolution
1 parent 4b2c0c5 commit e123a57

6 files changed

Lines changed: 41 additions & 28 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ So what are the differences from `eslint-plugin-import` exactly?
7777
- we target [Node `^18.18.0 || ^20.9.0 || >=21.1.0`](https://github.com/un-ts/eslint-plugin-import-x/blob/8b2d6d3b612eb57fb68c3fddec25b02fc622df7c/package.json#L12) + [ESLint `^8.57.0 || ^9.0.0`](https://github.com/un-ts/eslint-plugin-import-x/blob/8b2d6d3b612eb57fb68c3fddec25b02fc622df7c/package.json#L71), while `eslint-plugin-import` targets [Node `>=4`](https://github.com/import-js/eslint-plugin-import/blob/da5f6ec13160cb288338db0c2a00c34b2d932f0d/package.json#L6) and [ESLint `^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9`](https://github.com/import-js/eslint-plugin-import/blob/da5f6ec13160cb288338db0c2a00c34b2d932f0d/package.json#L115C16-L115C64)
7878
- we don't depend on old and outdated dependencies, so [we have 16 dependencies](https://npmgraph.js.org/?q=eslint-plugin-import-x) compared to [117 dependencies for `eslint-plugin-import`](https://npmgraph.js.org/?q=eslint-plugin-import)
7979
- `eslint-plugin-import` uses `tsconfig-paths` + `typescript` itself to load `tsconfig`s while we use the single `get-tsconfig` instead, which is much faster and cleaner
80-
- `eslint-plugin-import` uses [`resolve`] which doesn't support the `exports` field in `package.json` while we build our own rust-based resolver [`unrs-resolver`] instead, which is feature-rich and way more performant.
80+
- `eslint-plugin-import` uses [`resolve`] which doesn't support the `exports` field in `package.json` while we use the rust-based resolver [`oxc-resolver`] instead, which is feature-rich and way more performant.
8181
- Our [v3 resolver](./resolvers/README.md#v3) interface shares a single `resolver` instance by default which is used all across resolving chains so it would benefit from caching and memoization out-of-the-box
8282
- ...
8383

@@ -682,7 +682,7 @@ Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.m
682682
[`get-tsconfig`]: https://github.com/privatenumber/get-tsconfig
683683
[`tsconfig-paths`]: https://github.com/dividab/tsconfig-paths
684684
[`typescript`]: https://github.com/microsoft/TypeScript
685-
[`unrs-resolver`]: https://github.com/unrs/unrs-resolver
685+
[`oxc-resolver`]: https://github.com/oxc-project/oxc-resolver
686686
[`resolve`]: https://www.npmjs.com/package/resolve
687687
[`externals`]: https://webpack.github.io/docs/library-and-externals.html
688688
[1stG.me]: https://www.1stG.me

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,11 @@
7979
"@typescript-eslint/types": "^8.56.0",
8080
"comment-parser": "^1.4.1",
8181
"debug": "^4.4.1",
82-
"eslint-import-context": "^0.1.9",
82+
"eslint-import-context": "^0.2.0",
8383
"is-glob": "^4.0.3",
8484
"minimatch": "^9.0.3 || ^10.1.2",
8585
"semver": "^7.7.2",
86-
"stable-hash-x": "^0.2.0",
87-
"unrs-resolver": "^1.9.2"
86+
"stable-hash-x": "^0.2.0"
8887
},
8988
"devDependencies": {
9089
"@1stg/commitlint-config": "^5.1.0",

resolvers/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ the resolver name used in logs/debug output
104104

105105
### Example
106106

107-
Here is most of the [New Node resolver] at the time of this writing. It is just a wrapper around [`unrs-resolver`][unrs-resolver]:
107+
Here is most of the [New Node resolver] at the time of this writing. It is just a wrapper around [`oxc-resolver`][oxc-resolver]:
108108

109109
```js
110110
import module from 'node:module'
111111
import path from 'node:path'
112112

113-
import { ResolverFactory } from 'unrs-resolver'
114-
import type { NapiResolveOptions } from 'unrs-resolver'
113+
import { ResolverFactory } from 'oxc-resolver'
114+
import type { NapiResolveOptions } from 'oxc-resolver'
115115

116116
import type { NewResolver } from './types.js'
117117

@@ -253,5 +253,5 @@ If the resolver cannot resolve `source` relative to `file`, it should just retur
253253
[eslint-import-context]: https://github.com/un-ts/eslint-import-context
254254
[eslint-plugin-import]: https://github.com/import-js/eslint-plugin-import
255255
[eslint-plugin-import-x]: https://github.com/un-ts/eslint-plugin-import-x
256+
[oxc-resolver]: https://github.com/oxc-project/oxc-resolver
256257
[resolve]: https://github.com/browserify/resolve
257-
[unrs-resolver]: https://github.com/unrs/unrs-resolver

src/node-resolver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { isBuiltin } from 'node:module'
22
import path from 'node:path'
33

4-
import { ResolverFactory } from 'unrs-resolver'
5-
import type { NapiResolveOptions } from 'unrs-resolver'
4+
import { ResolverFactory } from 'oxc-resolver'
5+
import type { NapiResolveOptions } from 'oxc-resolver'
66

77
import type { NewResolver } from './types.js'
88

test/rules/no-duplicates.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ ruleTester.run('no-duplicates', rule, {
8787

8888
// ensure resolved path results in warnings
8989
tInvalid({
90-
code: "import { x } from './bar'; import { y } from 'bar';",
91-
output: "import { x, y } from './bar'; ",
90+
code: "import { x } from './bar/'; import { y } from 'bar';",
91+
output: "import { x, y } from './bar/'; ",
9292
settings: {
9393
'import-x/resolve': {
9494
paths: [path.resolve('test/fixtures')],

yarn.lock

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,30 +2068,30 @@ __metadata:
20682068
linkType: hard
20692069

20702070
"@emnapi/core@npm:^1.4.3":
2071-
version: 1.4.3
2072-
resolution: "@emnapi/core@npm:1.4.3"
2071+
version: 1.8.1
2072+
resolution: "@emnapi/core@npm:1.8.1"
20732073
dependencies:
2074-
"@emnapi/wasi-threads": "npm:1.0.2"
2074+
"@emnapi/wasi-threads": "npm:1.1.0"
20752075
tslib: "npm:^2.4.0"
2076-
checksum: 10c0/e30101d16d37ef3283538a35cad60e22095aff2403fb9226a35330b932eb6740b81364d525537a94eb4fb51355e48ae9b10d779c0dd1cdcd55d71461fe4b45c7
2076+
checksum: 10c0/2c242f4b49779bac403e1cbcc98edacdb1c8ad36562408ba9a20663824669e930bc8493be46a2522d9dc946b8d96cd7073970bae914928c7671b5221c85b432e
20772077
languageName: node
20782078
linkType: hard
20792079

20802080
"@emnapi/runtime@npm:^1.4.3":
2081-
version: 1.4.3
2082-
resolution: "@emnapi/runtime@npm:1.4.3"
2081+
version: 1.8.1
2082+
resolution: "@emnapi/runtime@npm:1.8.1"
20832083
dependencies:
20842084
tslib: "npm:^2.4.0"
2085-
checksum: 10c0/3b7ab72d21cb4e034f07df80165265f85f445ef3f581d1bc87b67e5239428baa00200b68a7d5e37a0425c3a78320b541b07f76c5530f6f6f95336a6294ebf30b
2085+
checksum: 10c0/f4929d75e37aafb24da77d2f58816761fe3f826aad2e37fa6d4421dac9060cbd5098eea1ac3c9ecc4526b89deb58153852fa432f87021dc57863f2ff726d713f
20862086
languageName: node
20872087
linkType: hard
20882088

2089-
"@emnapi/wasi-threads@npm:1.0.2":
2090-
version: 1.0.2
2091-
resolution: "@emnapi/wasi-threads@npm:1.0.2"
2089+
"@emnapi/wasi-threads@npm:1.1.0":
2090+
version: 1.1.0
2091+
resolution: "@emnapi/wasi-threads@npm:1.1.0"
20922092
dependencies:
20932093
tslib: "npm:^2.4.0"
2094-
checksum: 10c0/f0621b1fc715221bd2d8332c0ca922617bcd77cdb3050eae50a124eb8923c54fa425d23982dc8f29d505c8798a62d1049bace8b0686098ff9dd82270e06d772e
2094+
checksum: 10c0/e6d54bf2b1e64cdd83d2916411e44e579b6ae35d5def0dea61a3c452d9921373044dff32a8b8473ae60c80692bdc39323e98b96a3f3d87ba6886b24dd0ef7ca1
20952095
languageName: node
20962096
linkType: hard
20972097

@@ -5924,7 +5924,7 @@ __metadata:
59245924
languageName: node
59255925
linkType: hard
59265926

5927-
"eslint-import-context@npm:^0.1.8, eslint-import-context@npm:^0.1.9":
5927+
"eslint-import-context@npm:^0.1.8":
59285928
version: 0.1.9
59295929
resolution: "eslint-import-context@npm:0.1.9"
59305930
dependencies:
@@ -5939,6 +5939,21 @@ __metadata:
59395939
languageName: node
59405940
linkType: hard
59415941

5942+
"eslint-import-context@npm:^0.2.0":
5943+
version: 0.2.0
5944+
resolution: "eslint-import-context@npm:0.2.0"
5945+
dependencies:
5946+
get-tsconfig: "npm:^4.10.1"
5947+
stable-hash-x: "npm:^0.2.0"
5948+
peerDependencies:
5949+
oxc-resolver: ^11.0.0
5950+
peerDependenciesMeta:
5951+
oxc-resolver:
5952+
optional: true
5953+
checksum: 10c0/43d9f47e603eed7f0e865b3ba7707951136c26cbd5bdcaa1aca0bfc0d5b3aa938b1058286dbd9df10d47e8228831f2f9dc8f489a36846e1e05c60965dc83b1f5
5954+
languageName: node
5955+
linkType: hard
5956+
59425957
"eslint-import-resolver-typescript@npm:^4.4.4":
59435958
version: 4.4.4
59445959
resolution: "eslint-import-resolver-typescript@npm:4.4.4"
@@ -6102,7 +6117,7 @@ __metadata:
61026117
eslint: "npm:^9.29.0"
61036118
eslint-config-prettier: "npm:^10.1.5"
61046119
eslint-doc-generator: "npm:^2.2.2"
6105-
eslint-import-context: "npm:^0.1.9"
6120+
eslint-import-context: "npm:^0.2.0"
61066121
eslint-import-resolver-typescript: "npm:^4.4.4"
61076122
eslint-import-resolver-webpack: "npm:^0.13.10"
61086123
eslint-import-test-order-redirect: "link:./test/fixtures/order-redirect"
@@ -6140,7 +6155,6 @@ __metadata:
61406155
tsdown: "npm:^0.12.9"
61416156
typescript: "npm:^5.8.3"
61426157
typescript-eslint: "npm:^8.56.0"
6143-
unrs-resolver: "npm:^1.9.2"
61446158
yarn-berry-deduplicate: "npm:^6.1.3"
61456159
peerDependencies:
61466160
"@typescript-eslint/utils": ^8.56.0
@@ -13075,7 +13089,7 @@ __metadata:
1307513089
languageName: node
1307613090
linkType: hard
1307713091

13078-
"unrs-resolver@npm:^1.7.11, unrs-resolver@npm:^1.9.2":
13092+
"unrs-resolver@npm:^1.7.11":
1307913093
version: 1.9.2
1308013094
resolution: "unrs-resolver@npm:1.9.2"
1308113095
dependencies:

0 commit comments

Comments
 (0)