Repository navigation
feat: merge from upstream oxc-project/oxc-resolver - 6th - #146
Conversation
I sorted the list as alphabetize
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [crate-ci/typos](https://redirect.github.com/crate-ci/typos) | action | patch | `v1.31.1` -> `v1.31.2` | --- ### Release Notes <details> <summary>crate-ci/typos (crate-ci/typos)</summary> ### [`v1.31.2`](https://redirect.github.com/crate-ci/typos/releases/tag/v1.31.2) [Compare Source](https://redirect.github.com/crate-ci/typos/compare/v1.31.1...v1.31.2) #### \[1.31.2] - 2025-04-28 ##### Fixes - *(exclusion)* Don't confused emails as base64 - *(dict)* Correct `contamint` to `contaminant`, not `contaminat` - *(dict)* Correct `contamints` to `contaminants`, not `contaminats` ##### Performance - Improve tokenization performance </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc-resolver). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNTcuMyIsInVwZGF0ZWRJblZlciI6IjM5LjI1Ny4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…s` (#476) closes #396 A package may contain package.json inside its subdirectories, they must not participate in module resolution. Example: In the published vue package, it contains ``` vue/package.json vue/server-renderer/package.json vue/server-renderer/index.mjs ``` When requesting `vue/server-renderer`, it now esolves to `vue/server-renderer/index.mjs` with `vue/package.json`. It returned `vue/server-renderer/package.json` before this PR. `vue/server-renderer/package.json` does not participate in module resolution according to the node.js module resolution algorithm so the returned package.json resolution should not be `vue/server-renderer/package.json`. --- Note: There is an undefined behavior for resolving the `sideEffects` field. ``` vue/package.json (sideEffects: true) vue/server-renderer/package.json (sideEffects: true) vue/server-renderer/index.mjs ``` What should `sideEffects` return when requesting `vue/server-renderer`? * All current bundlers observe `vue/server-renderer/package.json (sideEffects: true)` -resolvers assume a package has only a root package.json so they just find the closes package.json starting from the end of the resolved path * But `vue/server-renderer/package.json` never participated in module resolution, why would we end up reading its `sideEffects` field?
## 🤖 New release
* `oxc_resolver`: 6.0.2 -> 7.0.0 (⚠ API breaking changes)
### ⚠ `oxc_resolver` breaking changes
```text
--- failure trait_method_added: pub trait method added ---
Description:
A non-sealed public trait added a new method without a default implementation, which breaks downstream implementations of the trait
ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-new-item-no-default
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.40.0/src/lints/trait_method_added.ron
Failed in:
trait method oxc_resolver::CachedPath::node_modules in file /tmp/.tmpKIFAk9/oxc-resolver/src/cache.rs:65
```
<details><summary><i><b>Changelog</b></i></summary><p>
<blockquote>
##
[7.0.0](oxc-project/oxc-resolver@oxc_resolver-v6.0.2...oxc_resolver-v7.0.0)
- 2025-04-29
### <!-- 1 -->Bug Fixes
- return the enclosing `package.json` if it is inside `node_modules`
([#476](oxc-project/oxc-resolver#476))
### <!-- 4 -->Refactor
- add `Debug` to `FsCachedPath`
([#478](oxc-project/oxc-resolver#478))
</blockquote>
</p></details>
---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
… `node_modules` (#482) fixes #481
This PR contains the following updates: | Package | Type | Update | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---|---|---| | | | lockFileMaintenance | All locks refreshed | | | | | | [@napi-rs/cli](https://redirect.github.com/napi-rs/napi-rs) | devDependencies | patch | [`3.0.0-alpha.77` -> `3.0.0-alpha.78`](https://renovatebot.com/diffs/npm/@napi-rs%2fcli/3.0.0-alpha.77/3.0.0-alpha.78) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [@napi-rs/wasm-runtime](https://redirect.github.com/napi-rs/napi-rs) ([source](https://redirect.github.com/napi-rs/napi-rs/tree/HEAD/wasi-runtime)) | devDependencies | patch | [`0.2.8` -> `0.2.9`](https://renovatebot.com/diffs/npm/@napi-rs%2fwasm-runtime/0.2.8/0.2.9) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [@types/node](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)) | devDependencies | minor | [`22.14.0` -> `22.15.3`](https://renovatebot.com/diffs/npm/@types%2fnode/22.14.0/22.15.3) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [emnapi](https://redirect.github.com/toyobayashi/emnapi) | devDependencies | patch | [`1.4.0` -> `1.4.3`](https://renovatebot.com/diffs/npm/emnapi/1.4.0/1.4.3) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [pnpm](https://pnpm.io) ([source](https://redirect.github.com/pnpm/pnpm/tree/HEAD/pnpm)) | packageManager | minor | [`10.7.1` -> `10.10.0`](https://renovatebot.com/diffs/npm/pnpm/10.7.1/10.10.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [vitest](https://redirect.github.com/vitest-dev/vitest) ([source](https://redirect.github.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | devDependencies | patch | [`3.1.1` -> `3.1.2`](https://renovatebot.com/diffs/npm/vitest/3.1.1/3.1.2) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | 🔧 This Pull Request updates lock files to use the latest dependency versions. --- ### Release Notes <details> <summary>napi-rs/napi-rs (@​napi-rs/cli)</summary> ### [`v3.0.0-alpha.78`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/[email protected]...@napi-rs/[email protected]) [Compare Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/[email protected]...@napi-rs/[email protected]) </details> <details> <summary>napi-rs/napi-rs (@​napi-rs/wasm-runtime)</summary> ### [`v0.2.9`](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/[email protected]...@napi-rs/[email protected]) [Compare Source](https://redirect.github.com/napi-rs/napi-rs/compare/@napi-rs/[email protected]...@napi-rs/[email protected]) </details> <details> <summary>toyobayashi/emnapi (emnapi)</summary> ### [`v1.4.3`](https://redirect.github.com/toyobayashi/emnapi/releases/tag/v1.4.3) [Compare Source](https://redirect.github.com/toyobayashi/emnapi/compare/v1.4.2...v1.4.3) #### What's Changed - update [@​emnapi/wasi-threads](https://redirect.github.com/emnapi/wasi-threads)[@​1](https://redirect.github.com/1).0.2 in the package.json dependency of [@​emnapi/core](https://redirect.github.com/emnapi/core) **Full Changelog**: toyobayashi/emnapi@v1.4.2...v1.4.3 ### [`v1.4.2`](https://redirect.github.com/toyobayashi/emnapi/releases/tag/v1.4.2) [Compare Source](https://redirect.github.com/toyobayashi/emnapi/compare/v1.4.1...v1.4.2) #### What's Changed - fix: check SharedArrayBuffer by [@​toyobayashi](https://redirect.github.com/toyobayashi) in [#​144](https://redirect.github.com/toyobayashi/emnapi/issues/144) **Full Changelog**: toyobayashi/emnapi@v1.4.1...v1.4.2 ### [`v1.4.1`](https://redirect.github.com/toyobayashi/emnapi/releases/tag/v1.4.1) [Compare Source](https://redirect.github.com/toyobayashi/emnapi/compare/v1.4.0...v1.4.1) #### What's Changed - add checks for message channel usage in web runtime by [@​gvkhna](https://redirect.github.com/gvkhna) in [#​142](https://redirect.github.com/toyobayashi/emnapi/issues/142) #### New Contributors - [@​gvkhna](https://redirect.github.com/gvkhna) made their first contribution in [#​142](https://redirect.github.com/toyobayashi/emnapi/issues/142) **Full Changelog**: toyobayashi/emnapi@v1.4.0...v1.4.1 </details> <details> <summary>pnpm/pnpm (pnpm)</summary> ### [`v10.10.0`](https://redirect.github.com/pnpm/pnpm/blob/HEAD/pnpm/CHANGELOG.md#10100) [Compare Source](https://redirect.github.com/pnpm/pnpm/compare/v10.9.0...v10.10.0) ##### Minor Changes - Allow loading the `preResolution`, `importPackage`, and `fetchers` hooks from local pnpmfile. ##### Patch Changes - Fix `cd` command, when `shellEmulator` is `true` [#​7838](https://redirect.github.com/pnpm/pnpm/issues/7838). - Sort keys in `pnpm-workspace.yaml` [#​9453](https://redirect.github.com/pnpm/pnpm/pull/9453). - Pass the `npm_package_json` environment variable to the executed scripts [#​9452](https://redirect.github.com/pnpm/pnpm/issues/9452). - Fixed a mistake in the description of the `--reporter=silent` option. ### [`v10.9.0`](https://redirect.github.com/pnpm/pnpm/blob/HEAD/pnpm/CHANGELOG.md#1090) [Compare Source](https://redirect.github.com/pnpm/pnpm/compare/v10.8.1...v10.9.0) ##### Minor Changes - **Added support for installing JSR packages.** You can now install JSR packages using the following syntax: pnpm add jsr:<pkg_name> or with a version range: pnpm add jsr:<pkg_name>@​<range> For example, running: pnpm add jsr:@​foo/bar will add the following entry to your `package.json`: ```json { "dependencies": { "@​foo/bar": "jsr:^0.1.2" } } ``` When publishing, this entry will be transformed into a format compatible with npm, older versions of Yarn, and previous pnpm versions: ```json { "dependencies": { "@​foo/bar": "npm:@​jsr/foo__bar@^0.1.2" } } ``` Related issue: [#​8941](https://redirect.github.com/pnpm/pnpm/issues/8941). Note: The `@jsr` scope defaults to <https://npm.jsr.io/> if the `@jsr:registry` setting is not defined. - Added a new setting, `dangerouslyAllowAllBuilds`, for automatically running any scripts of dependencies without the need to approve any builds. It was already possible to allow all builds by adding this to `pnpm-workspace.yaml`: ```yaml neverBuiltDependencies: [] ``` `dangerouslyAllowAllBuilds` has the same effect but also allows to be set globally via: pnpm config set dangerouslyAllowAllBuilds true It can also be set when running a command: pnpm install --dangerously-allow-all-builds ##### Patch Changes - Fix a false negative in `verifyDepsBeforeRun` when `nodeLinker` is `hoisted` and there is a workspace package without dependencies and `node_modules` directory [#​9424](https://redirect.github.com/pnpm/pnpm/issues/9424). - Explicitly drop `verifyDepsBeforeRun` support for `nodeLinker: pnp`. Combining `verifyDepsBeforeRun` and `nodeLinker: pnp` will now print a warning. ### [`v10.8.1`](https://redirect.github.com/pnpm/pnpm/blob/HEAD/pnpm/CHANGELOG.md#1081) [Compare Source](https://redirect.github.com/pnpm/pnpm/compare/v10.8.0...v10.8.1) ##### Patch Changes - Removed bright white highlighting, which didn't look good on some light themes [#​9389](https://redirect.github.com/pnpm/pnpm/pull/9389). - If there is no pnpm related configuration in `package.json`, `onlyBuiltDependencies` will be written to `pnpm-workspace.yaml` file [#​9404](https://redirect.github.com/pnpm/pnpm/pull/9404). ### [`v10.8.0`](https://redirect.github.com/pnpm/pnpm/blob/HEAD/pnpm/CHANGELOG.md#1080) [Compare Source](https://redirect.github.com/pnpm/pnpm/compare/v10.7.1...v10.8.0) ##### Minor Changes - **Experimental.** A new hook is supported for updating configuration settings. The hook can be provided via `.pnpmfile.cjs`. For example: ```js module.exports = { hooks: { updateConfig: (config) => ({ ...config, nodeLinker: "hoisted", }), }, }; ``` - Now you can use the `pnpm add` command with the `--config` flag to install new configurational dependencies [#​9377](https://redirect.github.com/pnpm/pnpm/pull/9377). ##### Patch Changes - Do not hang indefinitely, when there is a glob that starts with `!/` in `pnpm-workspace.yaml`. This fixes a regression introduced by [#​9169](https://redirect.github.com/pnpm/pnpm/pull/9169). - `pnpm audit --fix` should update the overrides in `pnpm-workspace.yaml`. - `pnpm link` should update overrides in `pnpm-workspace.yaml`, not in `package.json` [#​9365](https://redirect.github.com/pnpm/pnpm/pull/9365). </details> <details> <summary>vitest-dev/vitest (vitest)</summary> ### [`v3.1.2`](https://redirect.github.com/vitest-dev/vitest/releases/tag/v3.1.2) [Compare Source](https://redirect.github.com/vitest-dev/vitest/compare/v3.1.1...v3.1.2) ##### 🚀 Features - Draft implementation - by [@​sheremet-va](https://redirect.github.com/sheremet-va) [<samp>(86010)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/86010b34) - Draft implementation" - by [@​sheremet-va](https://redirect.github.com/sheremet-va) [<samp>(ce2a0)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/ce2a06b7) ##### 🐞 Bug Fixes - Add global `chai` variable in `vitest/globals` (fix: [#​7474](https://redirect.github.com/vitest-dev/vitest/issues/7474)) - by [@​Jay-Karia](https://redirect.github.com/Jay-Karia) in [https://github.com/vitest-dev/vitest/issues/7771](https://redirect.github.com/vitest-dev/vitest/issues/7771) and [https://github.com/vitest-dev/vitest/issues/7474](https://redirect.github.com/vitest-dev/vitest/issues/7474) [<samp>(d9297)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/d9297920) - Prevent modifying `test.exclude` when same object passed in `coverage.exclude` - by [@​AriPerkkio](https://redirect.github.com/AriPerkkio) in [https://github.com/vitest-dev/vitest/issues/7774](https://redirect.github.com/vitest-dev/vitest/issues/7774) [<samp>(c3751)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/c375101d) - Fix already hoisted mock - by [@​hi-ogawa](https://redirect.github.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/7815](https://redirect.github.com/vitest-dev/vitest/issues/7815) [<samp>(773b1)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/773b10e0) - Fix test.scoped inheritance - by [@​hi-ogawa](https://redirect.github.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/7814](https://redirect.github.com/vitest-dev/vitest/issues/7814) [<samp>(db6c3)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/db6c3bcc) - Remove pointer-events-none after resizing the left panel - by [@​alexprudhomme](https://redirect.github.com/alexprudhomme) in [https://github.com/vitest-dev/vitest/issues/7811](https://redirect.github.com/vitest-dev/vitest/issues/7811) [<samp>(a7e77)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/a7e773bd) - Default to run mode when stdin is not a TTY - by [@​kentonv](https://redirect.github.com/kentonv), [@​hi-ogawa](https://redirect.github.com/hi-ogawa) and [@​sheremet-va](https://redirect.github.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/7673](https://redirect.github.com/vitest-dev/vitest/issues/7673) [<samp>(6358f)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/6358f216) - Use happy-dom/jsdom types for `envionmentOptions` - by [@​hi-ogawa](https://redirect.github.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/7795](https://redirect.github.com/vitest-dev/vitest/issues/7795) [<samp>(67430)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/67430083) - **browser**: - Fix transform error before browser server initialization - by [@​hi-ogawa](https://redirect.github.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/7783](https://redirect.github.com/vitest-dev/vitest/issues/7783) [<samp>(5f762)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/5f762ec5) - Fix mocking from outside of root - by [@​hi-ogawa](https://redirect.github.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/7789](https://redirect.github.com/vitest-dev/vitest/issues/7789) [<samp>(03f55)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/03f55d74) - Scale iframe for non ui case - by [@​hi-ogawa](https://redirect.github.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/6512](https://redirect.github.com/vitest-dev/vitest/issues/6512) [<samp>(c3374)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/c3374808) - **coverage**: - `await` profiler calls - by [@​AriPerkkio](https://redirect.github.com/AriPerkkio) in [https://github.com/vitest-dev/vitest/issues/7763](https://redirect.github.com/vitest-dev/vitest/issues/7763) [<samp>(795a6)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/795a6433) - Expose profiling timers - by [@​AriPerkkio](https://redirect.github.com/AriPerkkio) in [https://github.com/vitest-dev/vitest/issues/7820](https://redirect.github.com/vitest-dev/vitest/issues/7820) [<samp>(5652b)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/5652bf92) - **deps**: - Update all non-major dependencies - in [https://github.com/vitest-dev/vitest/issues/7765](https://redirect.github.com/vitest-dev/vitest/issues/7765) [<samp>(7c3df)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/7c3dfb17) - Update all non-major dependencies - in [https://github.com/vitest-dev/vitest/issues/7831](https://redirect.github.com/vitest-dev/vitest/issues/7831) [<samp>(15701)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/15701f5d) - **runner**: - Correctly call test hooks and teardown functions - by [@​sheremet-va](https://redirect.github.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/7775](https://redirect.github.com/vitest-dev/vitest/issues/7775) [<samp>(3c00c)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/3c00c875) - Show stacktrace on test timeout error - by [@​hi-ogawa](https://redirect.github.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/7799](https://redirect.github.com/vitest-dev/vitest/issues/7799) [<samp>(df33b)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/df33bba7) - **ui**: - Load panel sizes from storage on initial load - by [@​userquin](https://redirect.github.com/userquin) in [https://github.com/vitest-dev/vitest/issues/7265](https://redirect.github.com/vitest-dev/vitest/issues/7265) [<samp>(6555d)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/6555d61d) - **vite-node**: - Named export should overwrite export all - by [@​hi-ogawa](https://redirect.github.com/hi-ogawa) in [https://github.com/vitest-dev/vitest/issues/7846](https://redirect.github.com/vitest-dev/vitest/issues/7846) [<samp>(5ba0d)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/5ba0d914) - Add ERR_MODULE_NOT_FOUND code error if module cannot be loaded - by [@​sheremet-va](https://redirect.github.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/7776](https://redirect.github.com/vitest-dev/vitest/issues/7776) [<samp>(f9eac)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/f9eacbc5) ##### 🏎 Performance - **browser**: Improve browser parallelisation - by [@​sheremet-va](https://redirect.github.com/sheremet-va) in [https://github.com/vitest-dev/vitest/issues/7665](https://redirect.github.com/vitest-dev/vitest/issues/7665) [<samp>(816a5)</samp>](https://redirect.github.com/vitest-dev/vitest/commit/816a5c51) ##### [View changes on GitHub](https://redirect.github.com/vitest-dev/vitest/compare/v3.1.1...v3.1.2) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 12am on monday" in timezone Asia/Shanghai, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc-resolver). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNjQuMCIsInVwZGF0ZWRJblZlciI6IjM5LjI2NC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | | | lockFileMaintenance | All locks refreshed | | [mimalloc-safe](https://redirect.github.com/napi-rs/mimalloc-safe) | dependencies | patch | `0.1.50` -> `0.1.51` | | [pnp](https://yarnpkg.com) ([source](https://redirect.github.com/yarnpkg/pnp-rs)) | dependencies | patch | `0.9.1` -> `0.9.4` | 🔧 This Pull Request updates lock files to use the latest dependency versions. --- ### Release Notes <details> <summary>napi-rs/mimalloc-safe (mimalloc-safe)</summary> ### [`v0.1.51`](https://redirect.github.com/napi-rs/mimalloc-safe/releases/tag/v0.1.51) [Compare Source](https://redirect.github.com/napi-rs/mimalloc-safe/compare/v0.1.50...v0.1.51) ##### What's Changed - chore(deps): update yarn to v4.9.0 by [@​renovate](https://redirect.github.com/renovate) in [https://github.com/napi-rs/mimalloc-safe/pull/10](https://redirect.github.com/napi-rs/mimalloc-safe/pull/10) - chore(deps): update yarn to v4.9.1 by [@​renovate](https://redirect.github.com/renovate) in [https://github.com/napi-rs/mimalloc-safe/pull/11](https://redirect.github.com/napi-rs/mimalloc-safe/pull/11) - feat: add no_opt_arch feature flag by [@​Brooooooklyn](https://redirect.github.com/Brooooooklyn) in [https://github.com/napi-rs/mimalloc-safe/pull/13](https://redirect.github.com/napi-rs/mimalloc-safe/pull/13) - feat: mimalloc v2.2.3 by [@​Brooooooklyn](https://redirect.github.com/Brooooooklyn) in [https://github.com/napi-rs/mimalloc-safe/pull/14](https://redirect.github.com/napi-rs/mimalloc-safe/pull/14) **Full Changelog**: napi-rs/mimalloc-safe@v0.1.50...v0.1.51 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 12am on monday" in timezone Asia/Shanghai, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc-resolver). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNjQuMCIsInVwZGF0ZWRJblZlciI6IjM5LjI2NC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
The only value for this option in the ecosystem is node_modules. This option also slightly impacts performance.
The only value for this option in the ecosystem is `package.json`. This option also slightly impacts performance.
## 🤖 New release
* `oxc_resolver`: 7.0.1 -> 8.0.0 (⚠ API breaking changes)
### ⚠ `oxc_resolver` breaking changes
```text
--- failure inherent_method_missing: pub method removed or renamed ---
Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.40.0/src/lints/inherent_method_missing.ron
Failed in:
ResolveOptions::with_module, previously in file /tmp/.tmpCfZ3uE/oxc_resolver/src/options.rs:342
--- failure struct_pub_field_missing: pub struct's pub field removed or renamed ---
Description:
A publicly-visible struct has at least one public field that is no longer available under its prior name. It may have been renamed or removed entirely.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.40.0/src/lints/struct_pub_field_missing.ron
Failed in:
field description_files of struct ResolveOptions, previously in file /tmp/.tmpCfZ3uE/oxc_resolver/src/options.rs:47
field modules of struct ResolveOptions, previously in file /tmp/.tmpCfZ3uE/oxc_resolver/src/options.rs:119
--- failure trait_method_added: pub trait method added ---
Description:
A non-sealed public trait added a new method without a default implementation, which breaks downstream implementations of the trait
ref: https://doc.rust-lang.org/cargo/reference/semver.html#trait-new-item-no-default
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.40.0/src/lints/trait_method_added.ron
Failed in:
trait method oxc_resolver::CachedPath::is_node_modules in file /tmp/.tmpoUaDz8/oxc-resolver/src/cache.rs:65
trait method oxc_resolver::CachedPath::inside_node_modules in file /tmp/.tmpoUaDz8/oxc-resolver/src/cache.rs:67
--- failure trait_method_missing: pub trait method removed or renamed ---
Description:
A trait method is no longer callable, and may have been renamed or removed entirely.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#major-any-change-to-trait-item-signatures
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.40.0/src/lints/trait_method_missing.ron
Failed in:
method node_modules of trait CachedPath, previously in file /tmp/.tmpCfZ3uE/oxc_resolver/src/cache.rs:65
method module_directory of trait CachedPath, previously in file /tmp/.tmpCfZ3uE/oxc_resolver/src/cache.rs:67
method cached_node_modules of trait CachedPath, previously in file /tmp/.tmpCfZ3uE/oxc_resolver/src/cache.rs:74
```
<details><summary><i><b>Changelog</b></i></summary><p>
<blockquote>
##
[8.0.0](oxc-project/oxc-resolver@oxc_resolver-v7.0.1...oxc_resolver-v8.0.0)
- 2025-05-01
### <!-- 1 -->Bug Fixes
- fix incorrect return of package.json when a workspace module has
`node_modules`
([#482](oxc-project/oxc-resolver#482))
### <!-- 2 -->Performance
- cache whether a path is `node_modules` or inside `node_modules`
([#490](oxc-project/oxc-resolver#490))
- remove a useless `load_as_directory` call
([#487](oxc-project/oxc-resolver#487))
### <!-- 4 -->Refactor
- [**breaking**] remove `description_files` option
([#488](oxc-project/oxc-resolver#488))
- [**breaking**] remove `modules` options
([#484](oxc-project/oxc-resolver#484))
</blockquote>
</p></details>
---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Documentation**
- Added a new changelog entry for version 8.0.0, highlighting a bug fix,
performance improvements, and breaking changes.
- **Chores**
- Updated the package version to 8.0.0 in project files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
WalkthroughThis update introduces module type resolution support across the resolver, exposing the detected module type (ESM, CommonJS, etc.) in API results and tests. It adds new configuration options, updates the Rust and N-API interfaces, and extends test coverage for module type and package.json path detection. Workspace and build configuration files are also refactored for clarity and modularity. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant API (Rust/N-API)
participant Resolver
participant Filesystem
User->>API (Rust/N-API): resolve(path, specifier, { moduleType: true })
API->>Resolver: resolve_impl(path, specifier, options)
Resolver->>Filesystem: locate file, package.json
Filesystem-->>Resolver: file path, package.json path
Resolver->>Resolver: determine module type (ESM/CJS/Addon/etc.)
Resolver-->>API: { resolvedPath, moduleType, packageJsonPath }
API-->>User: { resolvedPath, moduleType, packageJsonPath }
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Pull Request Overview
This PR merges upstream updates from oxc-project/oxc-resolver, adding test fixtures, extending example functionality with tsconfig support, updating benchmarks, documentation, Cargo workspace setup, and CI/workflows.
- Added ESM/CJS module‐type fixtures for resolver tests.
- Enhanced
examples/resolver.rsto parse--tsconfigand print detailed resolution info. - Refactored
Cargo.tomlfor workspace packaging, addedpico-args, and optimized build profiles. - Updated README tables and GitHub Actions workflows for NAPI release and CI checks.
Reviewed Changes
Copilot reviewed 76 out of 76 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| fixtures/misc/module-type/esm/package.json | Add minimal package.json specifying ESM type |
| fixtures/misc/module-type/cjs/package.json | Add minimal package.json specifying CommonJS type |
| examples/resolver.rs | Use pico-args, support --tsconfig, improve output |
| benches/resolver.rs | Change assertion formatting for benchmark validity checks |
| README.md | Reformat bullet lists, update tables, remove Rspack notes |
| Cargo.toml | Introduce [workspace.package], workspace dependencies, profiles, add pico-args |
| CONTRIBUTING.md | Add basic usage instructions for Rust and NAPI |
| .github/workflows/release-napi.yml | Simplify PNPM setup, add root package publish steps |
| .github/workflows/ci.yml | Enforce committed index.d.ts in CI |
| .clippy.toml | Add Clippy configuration to allow breaking API exports |
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 1778076 in 4 minutes and 1 seconds. Click for details.
- Reviewed
2050lines of code in72files - Skipped
4files when reviewing. - Skipped posting
19draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/tsconfig.rs:212
- Draft comment:
Consider adding a comment that explains the limitation of the current template variable substitution – it uses a simple head replacement (see comment at L228) and may not work correctly if ${configDir} appears mid‐string. Future improvements could consider a more robust substitution mechanism. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. src/tsconfig_serde.rs:315
- Draft comment:
The helper functiontrim_start_matches_mutis used for BOM removal. It works by slicing off the BOM character if present – ensure that edge cases (e.g. multiple BOM characters) are not an issue. A note documenting its intended behavior could be helpful. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. src/tsconfig.rs:267
- Draft comment:
When resolving path aliases inresolve_path_alias, the code first checks for an exact match and then searches for wildcards. Consider adding inline comments to clarify the matching and preference logic (L276–L305) as it is a critical part of alias resolution, and to aid future maintainers. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. src/resolution.rs:2008
- Draft comment:
The implementation ofesm_file_formatfollows the Node.js ESM resolution algorithm. It might be worth explicitly documenting the corresponding ESM steps as comments (steps 2–6) for clarity and traceability. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. src/tests/resolve.rs:48
- Draft comment:
In test 'resolve', multiple edge cases for query/fragment combinations are tested. Ensure that all possible query/fragment orders are covered; the current tests are very extensive and do a good job covering edge cases regarding escaping. Great thoroughness! - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. src/tests/module_type.rs:9
- Draft comment:
The 'module_type' tests check resolution based on file extensions; consider adding tests for cases where the package.json "type" field influences the module type as well. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The comment suggests a valid test case that isn't covered. However, this is a new file, and the author may be intentionally focusing on file extension cases first. The comment is speculative and asks for additional work rather than pointing out a clear issue with the current code. We don't have enough context to know if package.json type field testing is even in scope. The comment might be identifying a genuine gap in test coverage that could catch real bugs. Package.json type field is an important part of module resolution in Node.js. While the suggestion might be valid, it violates our rules about speculative comments and not making purely informative suggestions. The current tests are valid and complete for what they're testing. Delete the comment as it's a speculative suggestion for additional tests rather than pointing out an actual issue with the current code.
7. tests/resolve_test.rs:10
- Draft comment:
The test for Chinese paths is a nice touch. Just double-check that the path normalization function properly handles non-ASCII filenames on all supported platforms. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
8. src/tests/scoped_packages.rs:15
- Draft comment:
The scoped packages tests verify both main and browser fields. The expected results are built by joining paths with './node_modules/...'; consider verifying that the relative path resolution works as expected on platforms with different path separators. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%The comment is asking the PR author to verify the behavior of relative path resolution across different platforms. This falls under the rule of not asking the author to double-check or ensure behavior, which is not allowed.
9. src/tests/tsconfig_paths.rs:135
- Draft comment:
Good coverage of various tsconfig scenarios (paths, baseUrl, comments, BOM etc). Confirm that the fallback case for a tsconfig absence (line 124) appropriately returns a NotFound error. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
10. src/tests/resolve.rs:70
- Draft comment:
The tests checking resolution based on alias and file extensions (e.g. 'differ between directory and file') are comprehensive. It might be useful to additionally test behavior when symlink resolution is disabled (as seen in some tests) to ensure consistency. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
11. src/tests/tsconfig_paths.rs:316
- Draft comment:
Test cases for merging tsconfig (lines 232-244) are very detailed. Verify that changes to compiler options (like 'target' and 'module') do not interfere with path resolution in extended tsconfig files. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
12. Cargo.toml:6
- Draft comment:
There's an inconsistency in the URL casing in the authors field. The email address uses '[email protected]' while the URL is 'https://www.1stG.me'. Consider normalizing the casing (using one convention) for clarity. - Reason this comment was not posted:
Comment was on unchanged code.
13. examples/resolver.rs:48
- Draft comment:
Typo: The log message says "package json:". It might be clearer to use "package.json:" to more accurately reflect the conventional naming. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is an extremely minor stylistic change to a debug/example output. While technically correct that package.json is the conventional name, this is just log output in an example file. The current format is perfectly clear and understandable. This kind of nitpick doesn't meet the bar for "clearly a code change required". The conventional naming of "package.json" is well established, so there could be value in consistency. The change is trivial to make. While the change is easy, our rules explicitly state not to make purely informative comments or unimportant changes. This is clearly in that category. Delete this comment as it suggests an unimportant change to debug output formatting that doesn't affect functionality.
14. src/resolution.rs:12
- Draft comment:
Typo: The variant name "CommonJs" is typically capitalized as "CommonJS". Consider updating for consistency with standard naming conventions. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% While technically correct that 'CommonJS' is the standard capitalization, this is a relatively minor stylistic issue. The current name 'CommonJs' is still clear and unambiguous. The comment doesn't point out a functional issue or suggest an important code quality improvement. It's more of a nitpick about capitalization. The capitalization inconsistency could potentially cause confusion for developers familiar with Node.js ecosystem. Also, maintaining standard terminology across codebases has value. While consistency with standard terminology is good, this is an internal enum variant name that doesn't affect functionality. The meaning is still clear, and the comment is more about style than substance. Delete the comment as it's too minor of a stylistic suggestion and doesn't affect code functionality or maintainability in a meaningful way.
15. src/resolution.rs:13
- Draft comment:
Typo: The variant name "Json" is typically written as "JSON". Consider updating for consistency with standard naming conventions. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While JSON is commonly written in all caps, Rust has its own naming conventions. In Rust, it's actually common to use PascalCase for enum variants, andJsonis a perfectly valid and common way to name this in Rust code. For example, serde_json usesJsonin its type names. The comment is suggesting a change that goes against Rust conventions. Maybe there's a specific reason in this codebase where JSON is preferred over Json? Maybe there's a style guide I'm not aware of? Even if there was a style guide preferring JSON, this would be a minor stylistic preference rather than a clear issue. The current name follows standard Rust conventions. The comment should be deleted as it suggests changing from a valid Rust naming convention to a less idiomatic one, and it's not addressing a real issue.
16. src/resolution.rs:37
- Draft comment:
There appears to be an extra space after the doc comment marker on this line. Consider removing the extra space for consistency (i.e., use/// The algorithm uses...instead of/// The algorithm uses...). - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the comment is technically correct about the extra space, it's an extremely minor style issue in documentation. The rules state not to make comments that are obvious or unimportant. This feels like a very low-value comment that doesn't meaningfully improve code quality. The inconsistency is so minor it's barely noticeable. The extra space could be seen as a violation of consistent documentation style. Consistency in documentation formatting can make the codebase more professional and maintainable. While consistency is good, this is such a minor issue that fixing it provides almost no value. The time spent reviewing and addressing this comment would be better spent on more substantial improvements. Delete this comment as it points out an extremely minor style issue that doesn't meaningfully impact code quality or readability.
17. src/tests/package_json.rs:13
- Draft comment:
Typographical suggestion: The comment "Nested package.json do not participate in module resolution." could be improved to "Nested package.json files do not participate in module resolution." - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the suggestion technically improves the grammar, it's a very minor change to a test file comment that doesn't affect code functionality or clarity. The meaning is perfectly clear either way. According to the rules, we should not make purely informative comments or comments that are obvious/unimportant. The grammar could be considered incorrect in a technical document. Poor documentation can lead to confusion. While technically correct, this is an internal test file comment whose meaning is already clear. The benefit of fixing this minor grammar issue doesn't justify the noise of a PR comment. Delete this comment as it's too minor and doesn't affect code functionality or documentation clarity.
18. tests/resolve_test.rs:206
- Draft comment:
Typo: The path string literal contains a double slash (.pnpm//[email protected]). Please verify if this is intended or if it should be a single slash. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% The double slash pattern appears consistently throughout the test file in pnpm paths. This is likely the correct format for pnpm paths, as pnpm uses a specific directory structure for its virtual store. The comment is suggesting there's a typo when there actually isn't one - this is the intended format. I could be wrong if this is actually a bug that appears multiple times in the test file. Maybe all instances of the double slash are incorrect. The consistent usage across multiple test cases and the fact that this is specifically testing pnpm path resolution strongly suggests this is the intended format. If it were incorrect, the tests would fail. The comment should be deleted because it incorrectly flags a correct pnpm path format as a typo.
19. tests/resolve_test.rs:219
- Draft comment:
Typo: The path string literal contains a double slash (.pnpm//[email protected]). Please verify if this is intended or if it should be a single slash. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The double slash appears consistently in pnpm paths throughout the test file. This is a test file specifically for pnpm resolution, and pnpm has its own path conventions. The fact that this pattern appears multiple times suggests it's intentional. The test is passing with these paths, indicating this is the expected format. I could be wrong if this is actually a bug in the test that happens to work. I should consider that just because a test passes doesn't mean it's correct. However, the consistent use of double slashes in pnpm paths across multiple tests strongly suggests this is the intended format. If it were a typo, it would be unlikely to appear consistently. The comment should be deleted as it's questioning something that appears to be an intentional and correct part of pnpm's path structure.
Workflow ID: wflow_sUpbPrAuc8IzpEQJ
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Actionable comments posted: 7
🔭 Outside diff range comments (7)
src/tests/tsconfig_paths.rs (1)
124-133:⚠️ Potential issueBroken enum variant causes test/CI failure
ResolveError::JSONwas renamed toResolveError::Json, but the assertion still references the old variant, resulting in E0599 compiler errors (see pipeline logs).
Fix & tighten the assertion:- let error = ResolveError::Json(JSONError { + let expected_error = ResolveError::Json(JSONError { @@ - assert!(matches!(resolved_path, Err(ResolveError::JSON(_)))); + assert_eq!(resolved_path, Err(expected_error));This removes the stale variant, uses the correct casing, and validates the full error value.
🧰 Tools
🪛 GitHub Actions: Code Coverage
[error] 132-132: Rust compiler error E0599: no variant or associated item named
JSONfound for enumResolveError. Did you meanJson?🪛 GitHub Actions: CI
[error] 132-132: Rust compiler error E0599: no variant or associated item named
JSONfound for enumerror::ResolveError. Did you meanJson?src/error.rs (1)
117-124:⚠️ Potential issueCompile-time failure: undeclared
contentvariable
from_serde_json_errorno longer accepts acontentargument, yet it’s still referenced, causing E0425/E0599.- pub fn from_serde_json_error(path: PathBuf, error: &serde_json::Error) -> Self { - Self::Json(JSONError { - path, - message: error.to_string(), - line: error.line(), - column: error.column(), - content, - }) + pub fn from_serde_json_error(path: PathBuf, error: &serde_json::Error) -> Self { + Self::Json(JSONError { + path, + message: error.to_string(), + line: error.line(), + column: error.column(), + content: None, // JSON content is no longer passed around + }) }This restores successful compilation and keeps the
contentfield available for call-sites that still rely on it.
If the field itself is obsolete, remove it fromJSONErrorand all constructors instead.🧰 Tools
🪛 GitHub Actions: CI
[error] 123-123: Rust compiler error E0425: cannot find value
contentin this scope.🪛 GitHub Actions: Benchmark
[error] 123-123: Rust compiler error E0425: cannot find value
contentin this scope.🪛 GitHub Actions: Code Coverage
[error] 123-123: Rust compiler error E0425: cannot find value
contentin this scope.src/tests/incorrect_description_file.rs (2)
13-21:⚠️ Potential issueVariant rename not reflected in assertions
ResolveError::JSONwas renamed toResolveError::Json, yet thematches!macro still checks for the old variant. This fails to compile.- let error = ResolveError::Json(JSONError { ... }); - - assert!(matches!(resolution, Err(ResolveError::JSON(_)))); + let expected = ResolveError::Json(JSONError { ... }); + + assert!(matches!(resolution, Err(ResolveError::Json(_)))); + // Optional: compare the exact error value to avoid the unused-variable warning + // assert_eq!(resolution.unwrap_err(), expected);Also, the local
errorvariable is unused; either compare it (as above) or drop it altogether to silence warnings.🧰 Tools
🪛 GitHub Actions: Code Coverage
[error] 21-21: Rust compiler error E0599: no variant or associated item named
JSONfound for enumResolveError. Did you meanJson?🪛 GitHub Actions: CI
[error] 21-21: Rust compiler error E0599: no variant or associated item named
JSONfound for enumerror::ResolveError. Did you meanJson?
34-42:⚠️ Potential issueSame mismatch in second test case
Replicate the
JSON → Jsonchange and remove the unusederrorbinding to fix compilation.- let error = ResolveError::Json(JSONError { ... }); - assert!(matches!(resolution, Err(ResolveError::JSON(_)))); + assert!(matches!(resolution, Err(ResolveError::Json(_))));🧰 Tools
🪛 GitHub Actions: Code Coverage
[error] 41-41: Rust compiler error E0599: no variant or associated item named
JSONfound for enumResolveError. Did you meanJson?🪛 GitHub Actions: CI
[error] 41-41: Rust compiler error E0599: no variant or associated item named
JSONfound for enumerror::ResolveError. Did you meanJson?napi/tests/simple.test.mjs (1)
19-20:⚠️ Potential issuePromise is not returned – test may pass before the async assertion runs
Vitest only waits for the promise chain if it is returned from the test body.
Return theresolver.asyncpromise (or useawait) to ensure the assertion is executed:-resolver.async(cwd, './ts') - .then((result) => assert.isAbove(result.error.length, 0)); +return resolver + .async(cwd, './ts') + .then((result) => assert.isAbove(result.error.length, 0));tests/resolve_test.rs (1)
3-3:⚠️ Potential issue
ModuleTypeis used but not imported – will not compile
ModuleTypeis referenced in the newminimatchtest, yet it is absent from theuselist.
Add it to avoid an unresolved-name compilation error:-use unrs_resolver::{Resolution, ResolveError, ResolveOptions, Resolver}; +use unrs_resolver::{ModuleType, Resolution, ResolveError, ResolveOptions, Resolver};src/resolution.rs (1)
65-69: 💡 Verification agent🧩 Analysis chain
PartialEqignoresmodule_type– may create logical collisionsTwo
Resolutions that differ only bymodule_typewill compare equal, which can break caches keyed by the struct.- self.path == other.path && self.query == other.query && self.fragment == other.fragment + self.path == other.path + && self.query == other.query + && self.fragment == other.fragment + && self.module_type == other.module_typeVerify callers that rely on
Eq/ hashing behaviour before adopting this change.
🏁 Script executed:
#!/bin/bash # Locate the definition of Resolution and inspect its fields rg -n "struct Resolution" -n . # Confirm presence and type of `module_type` rg -n "module_type" -n .Length of output: 2323
🏁 Script executed:
#!/bin/bash # Display relevant portion of tests to see how Resolution is used in comparisons sed -n '150,260p' tests/resolve_test.rsLength of output: 4335
🏁 Script executed:
#!/bin/bash # Display the Resolution struct definition and related trait implementations sed -n '1,200p' src/resolution.rs # Check for Hash and Eq trait implementations on Resolution rg -n "impl.*Hash for Resolution" -n src/resolution.rs rg -n "impl.*Eq for Resolution" -n src/resolution.rsLength of output: 3630
Include
module_typeinPartialEqforResolutionCurrently,
Resolution::eqonly comparespath,query, andfragment, ignoringmodule_type. Two resolutions that differ solely by their module type will be deemed equal, which can lead to subtle bugs if you ever compareResolutionvalues or later deriveHash.Apply this change in
src/resolution.rs(lines 65–69):impl<C: Cache> PartialEq for Resolution<C> { fn eq(&self, other: &Self) -> bool { - self.path == other.path - && self.query == other.query - && self.fragment == other.fragment + self.path == other.path + && self.query == other.query + && self.fragment == other.fragment + && self.module_type == other.module_type } }• src/resolution.rs:65–69 — update
eqto includemodule_type.
• Review any existing uses ofResolutioncomparisons (or futureHashderivatives) to ensure they still behave as intended oncemodule_typeis part of equality.
🧹 Nitpick comments (14)
fixtures/misc/package.json (1)
1-3: Consider marking fixture packages as privateAdding
"private": trueprevents an accidentalnpm publishfrom within the fixture directory.{ "name": "misc", + "private": true }benches/resolver.rs (1)
149-152: Minor: avoid per-call resolver instantiation inside the loop
unrs_resolver()is recreated for each assertion, skewing the “validity check” wall-clock time and forcing repeated allocation/parsing of options. Cache it once:- for (path, request) in &data { - assert!(unrs_resolver().resolve(path, request).is_ok(), "{} {request}", path.display()); - } + let resolver = unrs_resolver(); + for (path, request) in &data { + assert!(resolver.resolve(path, request).is_ok(), "{} {request}", path.display()); + }napi/resolver.wasi.cjs (1)
90-90: Redundant but harmless explicit export
module.exportsalready containsModuleTypevia the spread at line 87, so this explicit assignment only duplicates the property.
No functional harm, but you could drop the extra line to reduce churn.src/tests/module_type.rs (1)
7-33: LGTM – comprehensive positive/negative coverageThe new test exercises every enum variant and the “no type” paths, giving good confidence in the resolver logic. Minor nit:
unwrap()will panic if the fixture path ever goes missing; usingexpect("resolution failed")would yield clearer diagnostics, but not blocking.CONTRIBUTING.md (1)
1-22: Consider clarifying prerequisite toolsReaders unfamiliar with
justorpnpmmay be confused. A short note such as “Installjust(https://github.com/casey/just) andpnpm(npm i -g pnpm) first” would improve onboarding..github/workflows/release-napi.yml (1)
193-226: Duplicatecp package.jsonand potentially unnecessary second copy ofREADME.md
package.jsonis copied intonapi/twice (lines 211 and 223).
Unless the first copy is reverted/overwritten bypnpm napi pre-publish, the secondcpis redundant and slows the workflow by a few seconds. Consider removing the second copy (and theREADME.mdcopy can be kept in the first block) for a simpler, deterministic publish step.- pnpm napi pre-publish --no-gh-release --tagstyle npm --npm-dir npm - - # Publish root package - cp package.json napi/package.json - cp README.md napi/README.md + pnpm napi pre-publish --no-gh-release --tagstyle npm --npm-dir npm + # Ensure README is shipped once + cp README.md napi/README.mdREADME.md (1)
47-56: Minor wording nit“Implements the ESM and CommonJS module resolution algorithm specifications” reads a bit smoother.
Feel free to ignore if you prefer the current phrasing.
src/tests/resolve.rs (1)
55-64: Potential false negative whenpackage.jsonis unexpectedly missingThe new assertion only checks
expected.to_str().unwrap().contains("node_modules").
If the resolver silently fails to locate the package JSON (returningNone) while still resolving the file, this branch will not fire for paths outsidenode_modules, masking regressions.Consider asserting the presence/absence explicitly per test case instead of inferring from a substring.
Cargo.toml (1)
18-20: Workspace self-dependency can confusecargofeaturesDeclaring
[workspace.dependencies] unrs_resolver = { version = "1.7.13", path = "." }while the root package is also named
unrs_resolverintroduces a self-dependency that activates the crate twice with different feature sets if any workspace member enables features.
Prefer the shorthand:[workspace.dependencies] unrs_resolver = { workspace = true }(or drop the entry and let members use
unrs_resolver = { path = ".." }).examples/resolver.rs (1)
9-15: Consider rejecting unexpected CLI flags for clearer UXAfter pulling the positional arguments you never call
args.finish()?, so silent leftovers go unnoticed.
For a developer-facing example it’s usually helpful to fail fast on unknown flags.src/options.rs (1)
180-185:ResolveOptionsgained amodule_typeflag but ergonomics lag behindYou added the field yet no builder (
with_module_type) exists, so users must mutate the struct manually. Adding a tiny helper keeps the fluent API consistent.@@ pub module_type: bool, } + +impl ResolveOptions { + /// Enable or disable module-type resolution. + #[must_use] + pub const fn with_module_type(mut self, flag: bool) -> Self { + self.module_type = flag; + self + } +}napi/index.d.ts (1)
195-200: Interface / result field naming collision
NapiResolveOptions.moduleTypeis a boolean flag, whileResolveResult.moduleTypeis the actual enum.
That’s fine, but consider renaming the option toresolveModuleType(or similar) to avoid confusion in TS code-completion lists.src/tests/package_json.rs (2)
20-24: Avoid discarding resolver errors – make failures explicitThe test currently calls
.ok()which converts a potentialErrintoNone, silently swallowing useful diagnostics.
If resolution unexpectedly fails, the subsequent assertions receiveNone, yielding misleading comparison errors rather than the true root cause.- let package_json = - resolver.resolve(&path, request).ok().and_then(|f| f.package_json().cloned()); + let package_json = resolver + .resolve(&path, request) + .expect(&format!("resolution failed for {path:?} {request}")) + .package_json() + .cloned();
36-38: Prime the cache with a verified resolution instead of ignoring the resultDiscarding the result (
let _ = …) may hide an unexpectedErr, leaving the cache un-primed and the follow-up test behaviour undefined. Prefer asserting the call succeeds:- // populate cache - let _ = resolver.resolve(&f, "package-json-nested"); + // populate cache (ensure success) + resolver + .resolve(&f, "package-json-nested") + .expect("failed to resolve package-json-nested for cache priming");
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (14)
Cargo.lockis excluded by!**/*.lockfixtures/enhanced_resolve/test/fixtures/multiple_modules/node_modules/m1/package.jsonis excluded by!**/node_modules/**fixtures/enhanced_resolve/test/fixtures/node_modules/complexm/package.jsonis excluded by!**/node_modules/**fixtures/enhanced_resolve/test/fixtures/node_modules/m1/package.jsonis excluded by!**/node_modules/**fixtures/enhanced_resolve/test/fixtures/node_modules/m2/package.jsonis excluded by!**/node_modules/**fixtures/misc/module-type/file.wasmis excluded by!**/*.wasmfixtures/misc/node_modules/package-json-nested/foo/bar/index.jsis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/foo/bar/package.jsonis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/foo/index.jsis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/foo/package.jsonis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/index.jsis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/package.jsonis excluded by!**/node_modules/**fixtures/pnpm/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (49)
.clippy.toml(1 hunks).github/workflows/ci.yml(1 hunks).github/workflows/release-napi.yml(2 hunks).gitignore(1 hunks)CONTRIBUTING.md(1 hunks)Cargo.toml(4 hunks)README.md(2 hunks)benches/resolver.rs(1 hunks)examples/resolver.rs(2 hunks)fixtures/misc/module-type/cjs/package.json(1 hunks)fixtures/misc/module-type/esm/package.json(1 hunks)fixtures/misc/module-type/no/package.json(1 hunks)fixtures/misc/module-type/package.json(1 hunks)fixtures/misc/package.json(1 hunks)fixtures/pnpm/.gitignore(0 hunks)fixtures/pnpm/package.json(1 hunks)fixtures/tsconfig/cases/merge_compiler_options/base-tsconfig.json(1 hunks)justfile(1 hunks)napi/Cargo.toml(1 hunks)napi/README.md(0 hunks)napi/index.d.ts(2 hunks)napi/index.js(1 hunks)napi/resolver.wasi-browser.js(1 hunks)napi/resolver.wasi.cjs(1 hunks)napi/src/lib.rs(6 hunks)napi/src/options.rs(1 hunks)napi/tests/simple.test.mjs(2 hunks)package.json(1 hunks)release-plz.toml(1 hunks)rust-toolchain.toml(1 hunks)src/cache.rs(3 hunks)src/error.rs(2 hunks)src/fs_cache.rs(11 hunks)src/lib.rs(5 hunks)src/options.rs(5 hunks)src/resolution.rs(4 hunks)src/tests/dependencies.rs(1 hunks)src/tests/incorrect_description_file.rs(2 hunks)src/tests/mod.rs(1 hunks)src/tests/module_type.rs(1 hunks)src/tests/package_json.rs(1 hunks)src/tests/resolution.rs(1 hunks)src/tests/resolve.rs(2 hunks)src/tests/scoped_packages.rs(2 hunks)src/tests/simple.rs(2 hunks)src/tests/tsconfig_paths.rs(2 hunks)src/tsconfig.rs(2 hunks)src/tsconfig_serde.rs(2 hunks)tests/resolve_test.rs(1 hunks)
💤 Files with no reviewable changes (2)
- fixtures/pnpm/.gitignore
- napi/README.md
🧰 Additional context used
🧬 Code Graph Analysis (9)
src/tests/simple.rs (2)
src/resolution.rs (2)
path(75-77)full_path(105-114)src/package_json.rs (1)
path(19-19)
src/tests/mod.rs (2)
src/resolution.rs (2)
module_type(118-120)package_json(99-101)tests/integration_test.rs (1)
package_json(39-45)
src/tests/module_type.rs (4)
src/tests/resolution.rs (1)
test(6-20)src/tests/mod.rs (1)
fixture_root(34-36)src/options.rs (1)
default(481-508)src/resolution.rs (1)
module_type(118-120)
src/tests/package_json.rs (2)
src/tests/mod.rs (1)
fixture_root(34-36)src/lib.rs (1)
default(145-147)
src/tests/resolve.rs (3)
src/resolution.rs (2)
path(75-77)full_path(105-114)src/package_json_serde.rs (1)
path(47-49)src/package_json.rs (1)
path(19-19)
napi/index.d.ts (1)
napi/resolver.wasi-browser.js (2)
ModuleType(66-66)ModuleType(66-66)
src/cache.rs (2)
src/fs_cache.rs (3)
is_node_modules(342-344)inside_node_modules(346-348)normalize_with(421-455)src/path.rs (2)
normalize_with(24-24)normalize_with(63-91)
src/tsconfig_serde.rs (2)
src/tsconfig.rs (10)
verbatim_module_syntax(396-398)set_verbatim_module_syntax(401-401)preserve_value_imports(404-406)set_preserve_value_imports(409-409)imports_not_used_as_values(412-414)set_imports_not_used_as_values(417-417)target(420-422)set_target(425-425)module(428-430)set_module(433-433)src/specifier.rs (1)
module(143-154)
src/lib.rs (5)
src/fs_cache.rs (3)
fmt(498-500)path(330-332)inside_node_modules(346-348)src/resolution.rs (4)
fmt(54-62)package_json(99-101)path(75-77)module_type(118-120)src/package_json.rs (3)
fmt(106-111)path(19-19)directory(36-36)src/cache.rs (2)
path(59-59)inside_node_modules(67-67)src/tsconfig.rs (3)
path(34-34)path(445-445)directory(42-42)
🪛 GitHub Actions: Code Coverage
src/tests/incorrect_description_file.rs
[error] 21-21: Rust compiler error E0599: no variant or associated item named JSON found for enum ResolveError. Did you mean Json?
[error] 41-41: Rust compiler error E0599: no variant or associated item named JSON found for enum ResolveError. Did you mean Json?
src/tests/tsconfig_paths.rs
[error] 132-132: Rust compiler error E0599: no variant or associated item named JSON found for enum ResolveError. Did you mean Json?
src/error.rs
[error] 123-123: Rust compiler error E0425: cannot find value content in this scope.
🪛 GitHub Actions: CI
src/tests/incorrect_description_file.rs
[error] 21-21: Rust compiler error E0599: no variant or associated item named JSON found for enum error::ResolveError. Did you mean Json?
[error] 41-41: Rust compiler error E0599: no variant or associated item named JSON found for enum error::ResolveError. Did you mean Json?
src/tests/tsconfig_paths.rs
[error] 132-132: Rust compiler error E0599: no variant or associated item named JSON found for enum error::ResolveError. Did you mean Json?
src/error.rs
[error] 123-123: Rust compiler error E0425: cannot find value content in this scope.
🪛 GitHub Actions: Benchmark
src/error.rs
[error] 123-123: Rust compiler error E0425: cannot find value content in this scope.
🪛 Biome (1.9.4)
napi/index.d.ts
[error] 22-28: The enum declaration should not be const
Const enums are not supported by bundlers and are incompatible with the 'isolatedModules' mode. Their use can lead to import inexistent values.
See TypeScript Docs for more details.
Safe fix: Turn the const enum into a regular enum.
(lint/suspicious/noConstEnum)
🔇 Additional comments (40)
fixtures/pnpm/package.json (1)
11-11: Verifyminimatch@10compatibility
minimatch≥ 10 is pure ESM and requires Node ≥ 14. Ensure all resolver tests run under a compatible runtime; otherwise pin to9.xor add"type":"module"where needed..gitignore (1)
4-4: Good consolidation of ignore rulesIgnoring
fixtures/pnpm/node_modulesat the repo root avoids per-fixture.gitignorefiles.release-plz.toml (1)
48-54: Commit-parser additions look correctNew “chore” and “ci” groups extend changelog coverage; order change for “doc” is harmless.
rust-toolchain.toml (1)
2-2: Approve toolchain version bump to Rust 1.87.0.
Updating to the latest stable snapshot aligns with the workspace andnapiupdates.fixtures/misc/module-type/no/package.json (1)
1-1: Approve emptypackage.jsonfixture.
An empty JSON object is correct for testing default module type resolution when no"type"field is present.fixtures/misc/module-type/esm/package.json (1)
1-3: Approve ESM fixturepackage.json.
Specifying"type": "module"correctly marks this directory as ES module for tests.fixtures/misc/module-type/package.json (1)
1-3: Approve CommonJS fixturepackage.json.
Specifying"type": "commonjs"correctly marks this package for module type resolution.justfile (1)
40-40: Approve simplification of example recipe comment.
The updated comment “# Run the example” is concise and still accurately describes theexampletarget.fixtures/misc/module-type/cjs/package.json (1)
1-3: Correct module type designation in fixture.The JSON properly specifies
"type": "commonjs"for this fixture.src/tests/mod.rs (1)
15-16: Register new test modules.Adding
mod module_type;andmod package_json;correctly includes the new test suites..clippy.toml (1)
1-1: Allow breaking exported API in Clippy.Setting
avoid-breaking-exported-api = falsealigns with recent public API additions..github/workflows/ci.yml (1)
105-107: Ensure index.d.ts is committed in CI.The
git diff --exit-codestep will catch uncommitted changes after WASI tests.napi/resolver.wasi-browser.js (1)
66-66: Expose ModuleType in WASI browser build.Exporting
ModuleTypealigns this module with other resolver variants and TS typings.src/tests/resolution.rs (1)
12-13: Newmodule_typeassertions look correctThe added field initialisation and the extra assertion align with the expanded
ResolutionAPI; no issues spotted.Also applies to: 18-18
fixtures/tsconfig/cases/merge_compiler_options/base-tsconfig.json (1)
7-9: JSON change is syntactically soundThe added
moduleandtargetoptions are valid TS compiler fields, and comma placement keeps the JSON valid.package.json (1)
21-21: Build flag order – verify once
pnpm build:debug --features allocator --releaseforwards flags tonapi build.
napi buildpasses all extra args tocargo. Cargo accepts--features … --releasein any order, so this should work, but run the CI build once to be sure.napi/index.js (1)
377-382: EnsureModuleTypeis present in all binding variants
module.exports.ModuleType = nativeBinding.ModuleTypeassumes every.node/ WASI build now exports the enum. If a pre-built binary is missing that symbol, resolution will fail at runtime with “undefined property” errors that won’t be caught by the current fallback logic (the JS fallback loader was removed).
Please double-check the bindings published for every target or add a defensive check:-module.exports.ModuleType = nativeBinding.ModuleType +if (nativeBinding.ModuleType === undefined) { + throw new Error('Native binding lacks ModuleType enum; please rebuild with >= v…'); +} +module.exports.ModuleType = nativeBinding.ModuleTypenapi/src/options.rs (1)
148-152:module_typeoption added – verify it is wired into the factory conversionThe field is defined here, but
impl From<NapiResolveOptions> for oxc_resolver::ResolveOptions(innapi/src/lib.rs) must copy it across; otherwise the flag is silently ignored.
Please confirm that conversion code includes:resolver_opts.module_type = napi_opts.module_type.unwrap_or(false);and that the docs in
index.d.tsreflect the exact camelCase name (moduleType).src/tests/scoped_packages.rs (1)
3-29: 👍 Extended assertions look solidThe test now validates both the resolved file path and the located
package.json, giving higher confidence inResolution’s new fields. Import style and tuple unpacking are clear and idiomatic.src/cache.rs (3)
11-12: LGTM! Debug bounds enhance debugging capabilities.Adding
Debugtrait bounds to the associated types is a good practice for improved debugging and tracing support.
65-68: Well-designed API additions for node_modules detection.The new methods
is_node_modules()andinside_node_modules()provide a clean abstraction for checking path locations relative to node_modules directories. This supports the enhanced package.json resolution logic.
96-96: Good API improvement with generic path parameter.Changing the signature to accept
P: AsRef<Path>instead of a concrete type makes the API more flexible and follows Rust best practices for path handling.src/tsconfig.rs (2)
143-179: Consistent implementation of compiler options inheritance.The new compiler options (
verbatim_module_syntax,preserve_value_imports,imports_not_used_as_values,target, andmodule) follow the established pattern for inheritance, ensuring consistency across the codebase.
395-434: Appropriate default implementations for new compiler options.The default trait implementations correctly provide no-op behavior, allowing concrete implementations to override as needed.
src/tsconfig_serde.rs (2)
149-150: Proper addition of module field with documentation link.The new
modulefield is correctly typed asOption<String>and includes a helpful documentation link to the TypeScript configuration reference.
230-268: Well-implemented accessors following established patterns.The getter and setter methods for the new compiler options correctly follow the existing implementation patterns, ensuring consistency and maintainability.
src/lib.rs (3)
314-343: Well-designed package.json resolution for node_modules.The algorithm correctly handles two cases:
- For paths inside node_modules: iterates upward to find the closest package.json within the node_modules boundary
- For paths outside node_modules: uses the standard find_package_json traversal
This improves accuracy when resolving packages within node_modules directories.
509-510: Clean simplification using map_or_else.The refactored code is more idiomatic and concise while maintaining the same functionality.
2003-2053: Comprehensive ESM module type detection.The implementation correctly follows the ESM_FILE_FORMAT algorithm from the Node.js specification, handling all standard file extensions and checking package.json type field for .js/.ts files.
napi/src/lib.rs (4)
1-4: Appropriate platform-specific allocator configuration.The conditional compilation correctly excludes platforms where mimalloc might not be suitable (ARM, FreeBSD, WASM).
15-15: Package rename from oxc_resolver to unrs_resolver.This appears to be a significant dependency change. Ensure that
unrs_resolveris the intended replacement and that all functionality is preserved.
60-79: Excellent type safety improvement with ModuleType enum.Converting from string-based module types to a typed enum improves type safety and prevents invalid values. The string_enum attribute ensures JavaScript compatibility.
255-256: Verify the forced enable_pnp behavior.When the
yarn_pnpfeature is enabled,enable_pnpis forcibly set totrue, ignoring the user's preference. This might be unexpected behavior if users want to conditionally disable PnP even when the feature is compiled in.Consider allowing users to explicitly disable PnP through options even when the feature is available:
- #[cfg(feature = "yarn_pnp")] - enable_pnp: true, + #[cfg(feature = "yarn_pnp")] + enable_pnp: op.enable_pnp.unwrap_or(true), + #[cfg(not(feature = "yarn_pnp"))] + enable_pnp: false,src/fs_cache.rs (4)
70-77: LGTM! Good addition for module resolution tracking.The implementation correctly tracks whether a path is
node_modulesitself or is inside anode_modulesdirectory, which is useful for module resolution logic.
137-137: Simplified error handling looks good.Removing the JSON content from error messages is a good practice as it avoids potentially exposing sensitive data in error logs and keeps error messages concise.
421-421: Good API improvement with generic parameter.Generalizing the signature to accept any type implementing
AsRef<Path>makes the API more flexible without changing the implementation logic.
497-501: Debug implementation is appropriately minimal.Only including the path field in the Debug output is a good choice as it avoids cluttering debug logs with internal cache state.
napi/Cargo.toml (3)
4-15: Excellent use of workspace inheritance.Using workspace inheritance for package metadata ensures consistency across the workspace and reduces duplication. This is a best practice for Rust workspaces.
18-18: Good addition of "lib" crate type.Adding
"lib"alongside"cdylib"allows the crate to be used both as a native module and as a regular Rust library, increasing its versatility.
41-45: Well-structured feature flags.The feature organization is clean:
- Default features include
tracing-subscriberfor logging- Optional
allocatorfeature for memory optimization- Proper feature forwarding for
yarn_pnpThis gives users fine-grained control over dependencies.
09034cf to
71bce9d
Compare
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed 71bce9d in 2 minutes and 15 seconds. Click for details.
- Reviewed
2106lines of code in55files - Skipped
4files when reviewing. - Skipped posting
10draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/tsconfig_serde.rs:315
- Draft comment:
The call to json_strip_comments::strip(json) is not storing its output; consider capturing the returned stripped JSON string and using that for deserialization so that comments are actually removed. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. src/resolution.rs:2001
- Draft comment:
When matching file extensions (e.g. for '.mjs', '.cjs', etc.), the comparisons are case–sensitive. Consider performing case–insensitive comparisons to account for filesystems (such as on Windows) that treat extensions case–insensitively. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. src/options.rs:390
- Draft comment:
The sanitize() method uses a debug_assert! to ensure that all non–empty extensions start with a leading dot. Since debug_assert! is only enabled in debug builds, consider enforcing this check (or returning an error) in release builds to avoid silent misconfiguration. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. tests/resolve_test.rs:15
- Draft comment:
Some test expected paths include double slashes (e.g. '/node_modules/.pnpm//minimatch@...'). Consider normalizing path separators to avoid redundant slashes unless this is the intended behavior. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
5. examples/resolver.rs:48
- Draft comment:
Minor note: In the printed output label "package json: {:?}", consider using "package.json": might be more conventional for clarity. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is a very minor formatting suggestion for debug output. While technically correct that "package.json" is the conventional way to write it, this is just debug output and doesn't affect functionality. The current format is still perfectly clear and understandable. This feels like an unnecessarily nitpicky comment. The suggestion does make the output more consistent with standard Node.js/npm ecosystem conventions. It could help maintain consistency in documentation and output. While technically correct, this is just debug output and the benefit is extremely minimal. This kind of minor formatting suggestion creates noise in PR reviews. Delete this comment. It's too minor of a suggestion about debug output formatting to warrant a PR comment.
6. napi/src/lib.rs:33
- Draft comment:
There is extra spacing in the doc comment on line 33 (double space after///) compared to other lines. Consider reducing it to a single space for consistency. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =30%<= threshold50%The comment is about a minor formatting issue, specifically extra spacing in a doc comment. While it might be useful for maintaining consistency, it doesn't provide a significant improvement to the code's functionality or readability. It seems to be more of a nitpick rather than a substantial suggestion.
7. napi/src/options.rs:244
- Draft comment:
Typographical issue: There's an extra space in the panic message. Consider replacing "for tsconfig references" with "for tsconfig references". - Reason this comment was not posted:
Comment was on unchanged code.
8. src/error.rs:74
- Draft comment:
The enum variant is renamed to "Json", but its doc comment on the previous line still reads "JSON parse error". Consider aligning the capitalization for consistency (either "JSON" or "Json"). - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% While the comment is technically correct about the inconsistency, it's a very minor stylistic issue. The term "JSON" is commonly written in all caps as it's an acronym, while the Rust naming convention prefers camelCase for enum variants. Both capitalizations are acceptable and commonly used. This seems more like a matter of preference than a real issue requiring a code change. The comment does point out a real inconsistency in the codebase. Consistency in naming can help with code readability and maintenance. However, this is an extremely minor stylistic issue. Both capitalizations are widely accepted, and this doesn't impact functionality or code quality in any meaningful way. The comment should be deleted as it's too minor and doesn't suggest a clearly necessary code change. Both capitalizations are acceptable.
9. src/resolution.rs:25
- Draft comment:
Typo in the comment: it currently reads "Path fragment#query, contains#." Given that the field is namedfragment, it should likely be "Path fragment#fragment, contains#." - Reason this comment was not posted:
Comment was on unchanged code.
10. src/tests/package_json.rs:13
- Draft comment:
Typo/grammar suggestion: In the comment "Nested package.json do not participate in module resolution.", consider revising it to "Nested package.json files do not participate in module resolution." - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The original comment is technically grammatically incorrect since "package.json" is singular but used with plural verb "do". However, the meaning is completely clear either way. The comment is about style rather than substance. Our rules say not to make purely informative comments or comments that are unimportant. The grammar is technically incorrect in the original, and fixing it would make the code slightly more professional. While true, this is an extremely minor issue that doesn't impact understanding. The rules explicitly say to avoid unimportant comments. This comment should be deleted as it's purely about grammar in a comment, which is too minor to be worth a PR comment.
Workflow ID: wflow_WCzyRVD5fsLHw8co
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
CodSpeed Performance ReportMerging #146 will not alter performanceComparing Summary
|
71bce9d to
6a2cf97
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #146 +/- ##
==========================================
- Coverage 93.41% 92.17% -1.25%
==========================================
Files 13 13
Lines 2902 3053 +151
==========================================
+ Hits 2711 2814 +103
- Misses 191 239 +48 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 1
♻️ Duplicate comments (1)
napi/index.d.ts (1)
22-28:⚠️ Potential issueConst enum violates
isolatedModules& most bundlersStatic analysis (
noConstEnum) rightly warns thatconst enumis not transpiled bytsc --isolatedModulesand breaks when code is re-emitted by tools such as Babel, SWC, or esbuild. Make it a regularenum.-export declare const enum ModuleType { +export declare enum ModuleType {🧰 Tools
🪛 Biome (1.9.4)
[error] 22-28: The enum declaration should not be const
Const enums are not supported by bundlers and are incompatible with the 'isolatedModules' mode. Their use can lead to import inexistent values.
See TypeScript Docs for more details.
Safe fix: Turn the const enum into a regular enum.(lint/suspicious/noConstEnum)
🧹 Nitpick comments (3)
src/tests/incorrect_description_file.rs (2)
13-18: Extract repeated JSON-error construction into a helper to reduce duplicationBoth tests build a
ResolveError::Json(JSONError { ... })value inline with only the path, message, line and column differing. Creating a small helper (or even a macro) inside this module will:
- make the intent clearer,
- eliminate copy-paste risk,
- ease future changes if the
JSONErrorshape evolves again.+fn json_error(base: &Path, pack: &str, msg: &str, line: usize, column: usize) -> ResolveError { + ResolveError::Json(JSONError { + path: base.join(format!("{pack}/package.json")), + message: msg.to_owned(), + line, + column, + }) +} ... -let error = ResolveError::Json(JSONError { - path: f.join("pack1/package.json"), - message: String::from("EOF while parsing a value at line 3 column 0"), - line: 3, - column: 0, -}); +let error = json_error(&f, "pack1", "EOF while parsing a value at line 3 column 0", 3, 0); ... -let error = ResolveError::Json(JSONError { - path: f.join("pack2/package.json"), - message: String::from("EOF while parsing a value at line 1 column 0"), - line: 1, - column: 0, -}); +let error = json_error(&f, "pack2", "EOF while parsing a value at line 1 column 0", 1, 0);This keeps each test focused on behaviour rather than boilerplate.
Also applies to: 32-37
19-23: Consider using pattern matching instead of full equality for fragile stringsSwitching from
matches!toassert_eq!makes the test fail on any cosmetic change to the JSON-parser’s wording, even though resolver behaviour is intact. Unless the exact message text is part of your public contract, prefer:assert!(matches!(resolution, Err(ResolveError::Json(_))));or match only the fields that matter:
if let Err(ResolveError::Json(err)) = resolution { assert_eq!(err.line, 3); assert_eq!(err.column, 0); } else { panic!("expected JSON error"); }This keeps the test stable while still guarding the important semantics.
Also applies to: 38-39
src/lib.rs (1)
509-511: Nice refactoring to use idiomatic Rust.The use of
map_or_elsemakes the error handling more concise and readable.
🛑 Comments failed to post (1)
napi/src/lib.rs (1)
255-256:
⚠️ Potential issueForcibly enabling PnP may surprise users.
When the
yarn_pnpfeature is enabled at compile time,enable_pnpis always set totrue, overriding any user configuration. This prevents users from disabling PnP at runtime even if the feature is compiled in.Consider respecting the user's configuration:
-#[cfg(feature = "yarn_pnp")] -enable_pnp: true, +#[cfg(feature = "yarn_pnp")] +enable_pnp: op.enable_pnp.unwrap_or(default.enable_pnp), +#[cfg(not(feature = "yarn_pnp"))] +enable_pnp: false,📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.#[cfg(feature = "yarn_pnp")] enable_pnp: op.enable_pnp.unwrap_or(default.enable_pnp), #[cfg(not(feature = "yarn_pnp"))] enable_pnp: false,🤖 Prompt for AI Agents
In napi/src/lib.rs around lines 255 to 256, the code forcibly sets enable_pnp to true when the yarn_pnp feature is enabled, ignoring user runtime configuration. Modify the code to check the user's configuration for enable_pnp and only set it to true by default if not explicitly disabled, thereby respecting user preferences while still enabling PnP when appropriate.
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed 6a2cf97 in 2 minutes and 50 seconds. Click for details.
- Reviewed
2150lines of code in55files - Skipped
4files when reviewing. - Skipped posting
13draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/tsconfig_serde.rs:315
- Draft comment:
It appears that the return value ofjson_strip_comments::strip(json)is discarded. Since this function typically returns a new string with comments removed, consider capturing its value (e.g.let json = json_strip_comments::strip(json);) to ensure comments are actually removed before deserialization. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. src/fs_cache.rs:395
- Draft comment:
The call tounsafe { std::ffi::OsStr::from_encoded_bytes_unchecked(slice_to_copy) }is marked with a vague comment. It would be good to add a clear justification or use a safer alternative if available, to ensure this unsafe block is sound. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. tests/resolve_test.rs:10
- Draft comment:
The test for a Chinese path uses a literal string like './fixtures/misc/中文/中文.js' which is correct, but consider adding a comment noting that proper UTF‑8 handling is under test. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. tests/resolve.rs:48
- Draft comment:
The expected resolution paths include a double slash (e.g. 'node_modules/.pnpm//[email protected]/...'). If this is intentional due to the PNPM layout, a comment explaining the double slash would help future maintainers. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. src/tsconfig.rs:2003
- Draft comment:
In the branch handling '.js' and 'ts' files the code falls back toOk(None). Verify that this behavior meets the intended resolution semantics – if no package type is found, returning None is appropriate. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. napi/index.js:367
- Draft comment:
The fallback mechanism to load a native binding and then a WASI version (lines 367–374) is robust. Consider adding a brief inline comment linking to documentation for users encountering load errors. - Reason this comment was not posted:
Comment was on unchanged code.
7. examples/resolver.rs:47
- Draft comment:
Typographical suggestion: In the printed text "package json: {:?}", consider using "package.json: {:?}" with a dot to match the conventional naming. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is a very minor stylistic change to debug output text. While technically correct that "package.json" is the conventional name, this is just debug output and the current format is perfectly clear. The comment doesn't point out any real issues or necessary code changes. The suggestion is technically correct about the conventional name. Debug output consistency could help users recognize what they're looking at. While technically correct, this is an extremely minor stylistic issue in debug output that doesn't impact functionality or code quality. This kind of nitpick creates noise in the review process. Delete this comment as it's an extremely minor stylistic suggestion about debug output text that doesn't warrant a code change.
8. napi/src/lib.rs:33
- Draft comment:
Typographical: There is an extra space after the comment marker (///) on this line. For consistency with the other comment lines, consider removing one of the spaces before 'The algorithm uses'. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% The rules state not to make comments that are obvious or unimportant. This is a very minor formatting issue that doesn't affect functionality. The doc comment is still perfectly readable and the extra space doesn't impact the rendered documentation. This kind of nitpick about spacing creates noise without adding value. The comment is technically correct about the inconsistency. Some teams might care about perfectly consistent formatting. While technically correct, this level of nitpicking about spaces in comments is exactly the kind of unimportant detail that the rules tell us to avoid commenting on. This should be handled by a formatter if the team cares about it. Delete this comment as it points out an unimportant formatting detail that doesn't meaningfully impact the code.
9. napi/src/options.rs:244
- Draft comment:
There's an extra space in the panic message: "{}is not a valid option for tsconfig references". Consider removing the extra space between 'for' and 'tsconfig references'. - Reason this comment was not posted:
Comment was on unchanged code.
10. src/error.rs:74
- Draft comment:
The doc comment above still refers to “JSON parse error” while the enum variant is namedJson. This creates an inconsistency. If renaming was intended, consider updating the comment or the variant name to maintain consistency. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The comment is about a real change in the diff - the enum variant rename. However, our rules state we should only keep comments that require code changes. While this is a documentation inconsistency, it's a relatively minor stylistic issue. The meaning is still clear regardless of capitalization. The rules emphasize focusing on logic issues rather than style. The inconsistency could potentially confuse future developers looking at the documentation. Documentation is part of code quality. While documentation is important, this capitalization difference is extremely minor and doesn't impact functionality or significantly impact readability. The meaning remains clear. Given our strict rules about only keeping comments that require clear code changes, and the minor nature of this documentation inconsistency, we should remove this comment.
11. src/tests/package_json.rs:13
- Draft comment:
Typographical/grammar suggestion: The comment reads "Nested package.json do not participate in module resolution." Consider revising it to "Nested package.json files do not participate in module resolution." for clarity and grammatical correctness. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While technically correct that "files" would make the grammar better, this is an extremely minor style issue in a comment. The meaning is perfectly clear without the change. Comments about pure grammar/style in comments (not code) don't meet the bar of "clearly requiring a code change". The rules say to only keep comments that require clear code changes. The grammar suggestion does make the comment slightly more precise and professional. Bad grammar in comments could be seen as reducing code quality. While technically correct, this level of minor grammar polishing in comments doesn't meet the high bar set in the rules for keeping comments. The meaning is clear either way. Delete this comment as it's too minor and doesn't meet the requirement of suggesting a clearly needed code change.
12. tests/resolve_test.rs:206
- Draft comment:
Typo: The directory path contains a double slash (.pnpm//minimatch). Please verify if this is intentional or an error. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% The double slash appears to be the correct expected path format for pnpm modules. This is evidenced by multiple test assertions using the same format. The test is specifically checking that the resolver produces this exact path. The comment is questioning something that is actually correct and intended. Could there be a legitimate reason why double slashes should be avoided in paths, even if the tests pass? Could this be masking a real path normalization issue? While path normalization is important, this appears to be the standard path format used by pnpm. The tests are verifying compatibility with pnpm's actual behavior, not testing ideal path handling. The comment should be deleted as it questions an intentional and correct path format used by pnpm.
13. tests/resolve_test.rs:219
- Draft comment:
Typo: The path here also contains a double slash (.pnpm//minimatch). Consider correcting it to a single slash if unintentional. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The double slash appears consistently in multiple places in the test file. This suggests it's not a typo but rather an expected part of the path structure. The test is passing with these paths, indicating this is the actual expected behavior. Looking at other similar tests in the file (like axios, ipaddr.js), they all use similar pnpm-style paths. I could be wrong about whether this is intentional - maybe it really is a bug in the test that just happens to work. Also, I don't have access to the actual filesystem to verify the real path structure. The consistency of the double slash across multiple tests and the fact that these are pnpm-specific paths strongly suggests this is intentional. If it were a bug, it would likely cause test failures. The comment should be deleted because the double slash appears to be intentional and correct for pnpm paths, not a typo that needs fixing.
Workflow ID: wflow_eLhccfkxnRZspdC9
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
napi/index.d.ts (1)
22-28:⚠️ Potential issueRemove
constfrom enum declaration.The use of
const enumis incompatible with bundlers and theisolatedModulesmode. This can lead to runtime errors.-export declare const enum ModuleType { +export declare enum ModuleType {🧰 Tools
🪛 Biome (1.9.4)
[error] 22-28: The enum declaration should not be const
Const enums are not supported by bundlers and are incompatible with the 'isolatedModules' mode. Their use can lead to import inexistent values.
See TypeScript Docs for more details.
Safe fix: Turn the const enum into a regular enum.(lint/suspicious/noConstEnum)
🧹 Nitpick comments (3)
src/tsconfig.rs (1)
143-179: Consider factoring out repetitive inheritance logicThe
extend_tsconfigmethod now contains eight nearly-identicalif … is_none() { … set_*() }blocks (and even more above).
Duplication increases maintenance cost and the likelihood of subtle copy-paste errors when new compiler options are added.A tiny helper macro or inline function would keep the code DRY and make future additions trivial:
+macro_rules! inherit_opt { + ($self_co:expr, $other_co:expr, $getter:ident, $setter:ident $(, by_val)? ) => { + if $self_co.$getter().is_none() { + if let Some(v) = $other_co.$getter() { + $self_co.$setter( + if std::mem::size_of_val(&v) == 0 { *v } else { v.to_string() } + ); + } + } + }; +}Then:
inherit_opt!(compiler_options, tsconfig.compiler_options(), verbatim_module_syntax, set_verbatim_module_syntax, by_val); inherit_opt!(compiler_options, tsconfig.compiler_options(), preserve_value_imports, set_preserve_value_imports, by_val); inherit_opt!(compiler_options, tsconfig.compiler_options(), imports_not_used_as_values, set_imports_not_used_as_values); inherit_opt!(compiler_options, tsconfig.compiler_options(), target, set_target); inherit_opt!(compiler_options, tsconfig.compiler_options(), module, set_module);This trims ~40 lines and keeps the intent crystal-clear.
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 144-144: src/tsconfig.rs#L144
Added line #L144 was not covered by tests
[warning] 146-147: src/tsconfig.rs#L146-L147
Added lines #L146 - L147 were not covered by tests
[warning] 149-149: src/tsconfig.rs#L149
Added line #L149 was not covered by tests
[warning] 152-152: src/tsconfig.rs#L152
Added line #L152 was not covered by tests
[warning] 154-155: src/tsconfig.rs#L154-L155
Added lines #L154 - L155 were not covered by tests
[warning] 157-157: src/tsconfig.rs#L157
Added line #L157 was not covered by tests
[warning] 160-160: src/tsconfig.rs#L160
Added line #L160 was not covered by tests
[warning] 162-164: src/tsconfig.rs#L162-L164
Added lines #L162 - L164 were not covered by tests
[warning] 166-166: src/tsconfig.rs#L166
Added line #L166 was not covered by tests
[warning] 172-172: src/tsconfig.rs#L172
Added line #L172 was not covered by tests
[warning] 178-178: src/tsconfig.rs#L178
Added line #L178 was not covered by testssrc/tsconfig_serde.rs (1)
149-151: Strongly typemodule,target, and related string options
module,target, andimports_not_used_as_valuesare restricted to a small, known set of values in the TS compiler (e.g."ESNext" | "CommonJS").
Modeling them asOption<String>:
- Allows invalid values through deserialization without an error.
- Requires consumers to repeat parsing/validation logic.
- Prevents the compiler from helping with exhaustive matching.
Recommend introducing lightweight enums with
#[serde(other)]fallback for unknown tokens:#[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] pub enum ModuleKind { None, CommonJS, ESNext, #[serde(other)] Unknown(String), } pub enum ScriptTarget { ES5, ES2015, ESNext, #[serde(other)] Unknown(String) }and replacing the fields with
Option<ModuleKind>/Option<ScriptTarget>.
This change pushes validation to the type system and makes downstream code clearer.Also applies to: 230-268
src/lib.rs (1)
314-343: Well-implemented package.json lookup with proper node_modules handling.The algorithm correctly differentiates between paths inside and outside
node_modules, ensuring accurate package.json association. Consider adding a comment explaining why this distinction is necessary for module type resolution.fn find_package_json_for_a_package( &self, cached_path: &C::Cp, ctx: &mut Ctx, ) -> Result<Option<Arc<C::Pj>>, ResolveError> { // Algorithm: // Find `node_modules/package/package.json` // or the first package.json if the path is not inside node_modules. + // This distinction is necessary because modules inside node_modules + // should be associated with their package root, not parent packages. let inside_node_modules = cached_path.inside_node_modules();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (14)
Cargo.lockis excluded by!**/*.lockfixtures/enhanced_resolve/test/fixtures/multiple_modules/node_modules/m1/package.jsonis excluded by!**/node_modules/**fixtures/enhanced_resolve/test/fixtures/node_modules/complexm/package.jsonis excluded by!**/node_modules/**fixtures/enhanced_resolve/test/fixtures/node_modules/m1/package.jsonis excluded by!**/node_modules/**fixtures/enhanced_resolve/test/fixtures/node_modules/m2/package.jsonis excluded by!**/node_modules/**fixtures/misc/module-type/file.wasmis excluded by!**/*.wasmfixtures/misc/node_modules/package-json-nested/foo/bar/index.jsis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/foo/bar/package.jsonis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/foo/index.jsis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/foo/package.jsonis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/index.jsis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/package.jsonis excluded by!**/node_modules/**fixtures/pnpm/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (49)
.clippy.toml(1 hunks).github/workflows/ci.yml(1 hunks).github/workflows/release-napi.yml(2 hunks).gitignore(1 hunks)CONTRIBUTING.md(1 hunks)Cargo.toml(4 hunks)README.md(2 hunks)benches/resolver.rs(1 hunks)examples/resolver.rs(2 hunks)fixtures/misc/module-type/cjs/package.json(1 hunks)fixtures/misc/module-type/esm/package.json(1 hunks)fixtures/misc/module-type/no/package.json(1 hunks)fixtures/misc/module-type/package.json(1 hunks)fixtures/misc/package.json(1 hunks)fixtures/pnpm/.gitignore(0 hunks)fixtures/pnpm/package.json(1 hunks)fixtures/tsconfig/cases/merge_compiler_options/base-tsconfig.json(1 hunks)justfile(1 hunks)napi/Cargo.toml(1 hunks)napi/README.md(0 hunks)napi/index.d.ts(2 hunks)napi/index.js(1 hunks)napi/resolver.wasi-browser.js(1 hunks)napi/resolver.wasi.cjs(1 hunks)napi/src/lib.rs(8 hunks)napi/src/options.rs(2 hunks)napi/tests/simple.test.mjs(2 hunks)package.json(1 hunks)release-plz.toml(1 hunks)rust-toolchain.toml(1 hunks)src/cache.rs(3 hunks)src/error.rs(2 hunks)src/fs_cache.rs(11 hunks)src/lib.rs(5 hunks)src/options.rs(5 hunks)src/resolution.rs(4 hunks)src/tests/dependencies.rs(1 hunks)src/tests/incorrect_description_file.rs(2 hunks)src/tests/mod.rs(1 hunks)src/tests/module_type.rs(1 hunks)src/tests/package_json.rs(1 hunks)src/tests/resolution.rs(1 hunks)src/tests/resolve.rs(2 hunks)src/tests/scoped_packages.rs(2 hunks)src/tests/simple.rs(2 hunks)src/tests/tsconfig_paths.rs(2 hunks)src/tsconfig.rs(2 hunks)src/tsconfig_serde.rs(2 hunks)tests/resolve_test.rs(2 hunks)
💤 Files with no reviewable changes (2)
- fixtures/pnpm/.gitignore
- napi/README.md
✅ Files skipped from review due to trivial changes (2)
- .github/workflows/ci.yml
- CONTRIBUTING.md
🚧 Files skipped from review as they are similar to previous changes (40)
- rust-toolchain.toml
- fixtures/misc/module-type/esm/package.json
- fixtures/misc/module-type/no/package.json
- src/tests/mod.rs
- justfile
- fixtures/misc/package.json
- .gitignore
- fixtures/tsconfig/cases/merge_compiler_options/base-tsconfig.json
- fixtures/misc/module-type/package.json
- package.json
- .clippy.toml
- src/tests/dependencies.rs
- fixtures/pnpm/package.json
- fixtures/misc/module-type/cjs/package.json
- src/tests/resolution.rs
- benches/resolver.rs
- napi/resolver.wasi.cjs
- napi/resolver.wasi-browser.js
- napi/index.js
- README.md
- src/tests/tsconfig_paths.rs
- src/tests/resolve.rs
- src/tests/scoped_packages.rs
- src/tests/incorrect_description_file.rs
- napi/tests/simple.test.mjs
- src/tests/module_type.rs
- .github/workflows/release-napi.yml
- src/tests/package_json.rs
- Cargo.toml
- examples/resolver.rs
- src/resolution.rs
- src/tests/simple.rs
- napi/src/options.rs
- src/error.rs
- src/cache.rs
- src/options.rs
- release-plz.toml
- napi/src/lib.rs
- napi/Cargo.toml
- tests/resolve_test.rs
🧰 Additional context used
🧬 Code Graph Analysis (2)
napi/index.d.ts (1)
napi/resolver.wasi-browser.js (2)
ModuleType(66-66)ModuleType(66-66)
src/tsconfig_serde.rs (1)
src/tsconfig.rs (10)
verbatim_module_syntax(396-398)set_verbatim_module_syntax(401-401)preserve_value_imports(404-406)set_preserve_value_imports(409-409)imports_not_used_as_values(412-414)set_imports_not_used_as_values(417-417)target(420-422)set_target(425-425)module(428-430)set_module(433-433)
🪛 GitHub Check: codecov/patch
src/lib.rs
[warning] 2047-2047: src/lib.rs#L2047
Added line #L2047 was not covered by tests
src/fs_cache.rs
[warning] 244-247: src/fs_cache.rs#L244-L247
Added lines #L244 - L247 were not covered by tests
[warning] 479-481: src/fs_cache.rs#L479-L481
Added lines #L479 - L481 were not covered by tests
src/tsconfig.rs
[warning] 144-144: src/tsconfig.rs#L144
Added line #L144 was not covered by tests
[warning] 146-147: src/tsconfig.rs#L146-L147
Added lines #L146 - L147 were not covered by tests
[warning] 149-149: src/tsconfig.rs#L149
Added line #L149 was not covered by tests
[warning] 152-152: src/tsconfig.rs#L152
Added line #L152 was not covered by tests
[warning] 154-155: src/tsconfig.rs#L154-L155
Added lines #L154 - L155 were not covered by tests
[warning] 157-157: src/tsconfig.rs#L157
Added line #L157 was not covered by tests
[warning] 160-160: src/tsconfig.rs#L160
Added line #L160 was not covered by tests
[warning] 162-164: src/tsconfig.rs#L162-L164
Added lines #L162 - L164 were not covered by tests
[warning] 166-166: src/tsconfig.rs#L166
Added line #L166 was not covered by tests
[warning] 172-172: src/tsconfig.rs#L172
Added line #L172 was not covered by tests
[warning] 178-178: src/tsconfig.rs#L178
Added line #L178 was not covered by tests
[warning] 396-398: src/tsconfig.rs#L396-L398
Added lines #L396 - L398 were not covered by tests
[warning] 401-401: src/tsconfig.rs#L401
Added line #L401 was not covered by tests
[warning] 404-406: src/tsconfig.rs#L404-L406
Added lines #L404 - L406 were not covered by tests
[warning] 409-409: src/tsconfig.rs#L409
Added line #L409 was not covered by tests
[warning] 412-414: src/tsconfig.rs#L412-L414
Added lines #L412 - L414 were not covered by tests
[warning] 417-417: src/tsconfig.rs#L417
Added line #L417 was not covered by tests
[warning] 420-422: src/tsconfig.rs#L420-L422
Added lines #L420 - L422 were not covered by tests
[warning] 425-425: src/tsconfig.rs#L425
Added line #L425 was not covered by tests
[warning] 428-430: src/tsconfig.rs#L428-L430
Added lines #L428 - L430 were not covered by tests
[warning] 433-433: src/tsconfig.rs#L433
Added line #L433 was not covered by tests
src/tsconfig_serde.rs
[warning] 234-236: src/tsconfig_serde.rs#L234-L236
Added lines #L234 - L236 were not covered by tests
[warning] 242-244: src/tsconfig_serde.rs#L242-L244
Added lines #L242 - L244 were not covered by tests
[warning] 250-252: src/tsconfig_serde.rs#L250-L252
Added lines #L250 - L252 were not covered by tests
🪛 Biome (1.9.4)
napi/index.d.ts
[error] 22-28: The enum declaration should not be const
Const enums are not supported by bundlers and are incompatible with the 'isolatedModules' mode. Their use can lead to import inexistent values.
See TypeScript Docs for more details.
Safe fix: Turn the const enum into a regular enum.
(lint/suspicious/noConstEnum)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (12)
napi/index.d.ts (2)
194-199: LGTM!The addition of the optional
moduleTypeconfiguration option is well-documented and maintains backward compatibility.
205-216: Well-structured interface improvements.The changes enhance type safety by using the
ModuleTypeenum and provide comprehensive documentation about the ESM resolution algorithm. The addition ofpackageJsonPathoffers valuable context for resolved modules.src/lib.rs (4)
299-311: Good improvements to package resolution logic.The switch to
find_package_json_for_a_packageprovides better handling for modules insidenode_modules, and the debug assertion ensures correctness. The addition ofmodule_typeto theResolutionstruct aligns with the PR's objectives.
509-510: Clean refactoring of error handling.The use of
map_or_elsemakes the code more idiomatic and concise while maintaining the same behavior.
2000-2053: Correct ESM file format implementation following spec.The implementation properly follows the ESM resolution algorithm specification. However, the code path at line 2047 (returning
Nonewhen package.json has no type field) lacks test coverage.Consider adding a test case for
.jsfiles without a package.json type field to improve coverage:#[test] fn test_js_file_without_package_type() { // Test that .js files return None when package.json has no type field }🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 2047-2047: src/lib.rs#L2047
Added line #L2047 was not covered by tests
80-80: Necessary imports for new functionality.The addition of
iterandModuleTypeto imports/exports supports the new module type detection feature.Also applies to: 109-109
src/fs_cache.rs (6)
70-77: Correct implementation of node_modules tracking.The logic properly identifies
node_modulesdirectories and tracks whether paths are inside them through parent chain propagation.
235-248: Good simplification of symlink handling.The use of the
?operator makes the code cleaner and more idiomatic while maintaining the same error propagation behavior.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 244-247: src/fs_cache.rs#L244-L247
Added lines #L244 - L247 were not covered by tests
137-137: Efficient error handling simplification.Removing the original JSON content from error construction reduces memory usage while maintaining sufficient debugging information through the file path.
Also applies to: 186-186
280-292: Constructor properly updated for new fields.The constructor correctly handles the new
is_node_modulesandinside_node_modulesparameters.
323-329: Good API additions and improved flexibility.The new accessor methods expose necessary state for module resolution, and the generic parameter for
normalize_withimproves API flexibility. Note that the accessor methods lack test coverage.Also applies to: 402-402
478-482: Minimal and appropriate Debug implementation.The Debug trait implementation appropriately focuses on the path field, which is the most relevant for debugging purposes.
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 479-481: src/fs_cache.rs#L479-L481
Added lines #L479 - L481 were not covered by tests
6a2cf97 to
51768a8
Compare
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed 51768a8 in 1 minute and 42 seconds. Click for details.
- Reviewed
2376lines of code in55files - Skipped
4files when reviewing. - Skipped posting
7draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/tsconfig_serde.rs:315
- Draft comment:
The result ofjson_strip_comments::strip(json)is discarded. Consider capturing its output and using the stripped JSON for deserialization to ensure that comments are truly removed before parsing. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. src/tsconfig.rs:230
- Draft comment:
The substitution logic insubstitute_template_variableonly performs a head replacement for the${configDir}template. Although noted in the comments, consider adding a more robust solution if multiple occurrences are expected in the future. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
3. examples/resolver.rs:48
- Draft comment:
Typo: Consider renaming the string literal "package json:" to "package.json:" if it's meant to refer to the package.json file. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is an extremely minor suggestion about the format of a debug print statement. It doesn't affect functionality. While technically the suggested format might be more "correct", this kind of nitpick about logging output doesn't warrant a PR comment. The rules specifically say not to make unimportant comments. The suggested format is technically more accurate since package.json is the actual filename. Maybe this consistency is worth maintaining? No - this is exactly the kind of minor, unimportant detail that the rules tell us to avoid commenting on. Debug print formatting doesn't affect functionality. Delete this comment as it's too minor and unimportant to warrant a PR review comment.
4. napi/src/options.rs:244
- Draft comment:
Typographical issue: There is a double space between 'for' and 'tsconfig' in the panic message. Consider using a single space. - Reason this comment was not posted:
Comment was on unchanged code.
5. src/resolution.rs:25
- Draft comment:
Typo in the documentation: the comment for the fragment field currently reads "Path fragment#query, contains#." It seems that it should refer to the fragment (e.g., "Path fragment#fragment, contains#.") for consistency with the field name. - Reason this comment was not posted:
Comment was on unchanged code.
6. src/resolution.rs:37
- Draft comment:
Minor typographical issue: there are two spaces after the///which appears inconsistent with the rest of the comments. Consider using a single space for consistency. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the comment is technically correct about the inconsistency, it's an extremely minor formatting issue. The comment doesn't point out any functional problems or suggest meaningful improvements to the code. Such minor formatting issues are better handled by automated formatters or linters rather than PR comments. The inconsistency could potentially affect documentation generation tools. Also, maintaining consistent formatting helps with code readability. While consistency is good, this is too minor of an issue to warrant a PR comment. It would create unnecessary noise in the review process. Delete this comment as it addresses an extremely minor formatting issue that doesn't meaningfully impact code quality or functionality.
7. src/tests/package_json.rs:13
- Draft comment:
Typo: In the comment, consider fixing grammatical number agreement. For example, 'Nested package.json files do not participate in module resolution.' - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the grammar suggestion is technically correct, it's a very minor issue in a test file comment that doesn't affect code functionality or readability. The meaning is perfectly clear either way. The comment is about something that was changed (new file), but it's an extremely trivial change that doesn't meet our bar for "clearly requires a code change". The grammar issue could potentially confuse non-native English speakers. Documentation should strive to be grammatically correct. The meaning is still clear despite the minor grammar issue, and we're instructed to not make purely informative comments or obvious/unimportant changes. This falls into that category. Delete the comment as it suggests an extremely minor grammar fix that doesn't meaningfully impact code quality or understanding.
Workflow ID: wflow_v40Ih5K7P59GELOQ
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
src/tsconfig.rs (1)
395-433: 🛠️ Refactor suggestionDefault setters still silently swallow calls – add a debug assertion
This is the same issue previously flagged: every new
set_*method inCompilerOptionshas an empty body.
If an implementation forgets to override it,extend_tsconfigwill call the no-op and silently drop configuration.Patch one example and replicate for the rest:
- fn set_module(&mut self, _module: String) {} + fn set_module(&mut self, _module: String) { + debug_assert!( + false, + "set_module called on a CompilerOptions implementation that did \ + not override the default setter" + ); + }Guarding with
#[cfg(debug_assertions)]keeps release builds unaffected while catching mistakes in tests.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 396-398: src/tsconfig.rs#L396-L398
Added lines #L396 - L398 were not covered by tests
[warning] 401-401: src/tsconfig.rs#L401
Added line #L401 was not covered by tests
[warning] 404-406: src/tsconfig.rs#L404-L406
Added lines #L404 - L406 were not covered by tests
[warning] 409-409: src/tsconfig.rs#L409
Added line #L409 was not covered by tests
[warning] 412-414: src/tsconfig.rs#L412-L414
Added lines #L412 - L414 were not covered by tests
[warning] 417-417: src/tsconfig.rs#L417
Added line #L417 was not covered by tests
[warning] 420-422: src/tsconfig.rs#L420-L422
Added lines #L420 - L422 were not covered by tests
[warning] 425-425: src/tsconfig.rs#L425
Added line #L425 was not covered by tests
[warning] 428-430: src/tsconfig.rs#L428-L430
Added lines #L428 - L430 were not covered by tests
[warning] 433-433: src/tsconfig.rs#L433
Added line #L433 was not covered by testsnapi/index.d.ts (1)
22-28:⚠️ Potential issue
const enumis still present – switch to a regularenum.Const-enums break
isolatedModulesand most bundlers (SWC, esbuild, Babel).
The same point was raised in an earlier review and remains unresolved.-export declare const enum ModuleType { +export declare enum ModuleType {🧰 Tools
🪛 Biome (1.9.4)
[error] 22-28: The enum declaration should not be const
Const enums are not supported by bundlers and are incompatible with the 'isolatedModules' mode. Their use can lead to import inexistent values.
See TypeScript Docs for more details.
Safe fix: Turn the const enum into a regular enum.(lint/suspicious/noConstEnum)
🧹 Nitpick comments (4)
src/tsconfig.rs (1)
143-178: Repeated option-copy pattern is crying out for a helper macro/function
extend_tsconfignow contains 10 almost-identicalif compiler_options.foo().is_none() { … }blocks.
The copy/paste approach makes the method long and error-prone whenever a new option is introduced.Consider extracting the pattern into a small helper macro:
+macro_rules! inherit_opt { + ($dst:expr, $src:expr, $getter:ident, $setter:ident $(, $mapper:expr )?) => { + if $dst.$getter().is_none() { + if let Some(val) = $src.$getter() { + $dst.$setter(($($mapper)?)(val)); + } + } + }; +}Usage:
inherit_opt!(compiler_options, tsconfig.compiler_options(), verbatim_module_syntax, set_verbatim_module_syntax, |v| *v); inherit_opt!(compiler_options, tsconfig.compiler_options(), imports_not_used_as_values, set_imports_not_used_as_values, |v| v.to_string());Benefits:
- 80 % less boilerplate.
- Impossible to forget the
is_none()guard or misuse*/.to_string().- Future options require one line instead of three.
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 144-144: src/tsconfig.rs#L144
Added line #L144 was not covered by tests
[warning] 146-147: src/tsconfig.rs#L146-L147
Added lines #L146 - L147 were not covered by tests
[warning] 149-149: src/tsconfig.rs#L149
Added line #L149 was not covered by tests
[warning] 152-152: src/tsconfig.rs#L152
Added line #L152 was not covered by tests
[warning] 154-155: src/tsconfig.rs#L154-L155
Added lines #L154 - L155 were not covered by tests
[warning] 157-157: src/tsconfig.rs#L157
Added line #L157 was not covered by tests
[warning] 160-160: src/tsconfig.rs#L160
Added line #L160 was not covered by tests
[warning] 162-164: src/tsconfig.rs#L162-L164
Added lines #L162 - L164 were not covered by tests
[warning] 166-166: src/tsconfig.rs#L166
Added line #L166 was not covered by tests
[warning] 172-172: src/tsconfig.rs#L172
Added line #L172 was not covered by tests
[warning] 178-178: src/tsconfig.rs#L178
Added line #L178 was not covered by testssrc/tsconfig_serde.rs (1)
230-268: Potential micro-optimisation: borrow instead of clone in settersFor the string setters (
set_imports_not_used_as_values,set_target,set_module) you eagerly allocate withString.
Callers often have an&str(seeextend_tsconfig) and therefore have toto_string()each time.Accepting
impl Into<String>avoids the extra allocation when the caller already owns theString:- fn set_target(&mut self, target: String) { + fn set_target<S: Into<String>>(&mut self, target: S) { self.target = Some(target.into()); }Same for
set_moduleandset_imports_not_used_as_values.Not critical, but removes an unnecessary clone in hot code paths.
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 234-236: src/tsconfig_serde.rs#L234-L236
Added lines #L234 - L236 were not covered by tests
[warning] 242-244: src/tsconfig_serde.rs#L242-L244
Added lines #L242 - L244 were not covered by tests
[warning] 250-252: src/tsconfig_serde.rs#L250-L252
Added lines #L250 - L252 were not covered by testssrc/lib.rs (1)
2012-2052: Extension check is case-sensitive – normalise to lower-case.
Path::extension()preserves the original case; on Windows or exotic filesystems a file likeINDEX.MJS(orfoo.Js) would bypass the match table and yieldNone.- let ext = cached_path.path().extension().and_then(|ext| ext.to_str()); + let ext = cached_path + .path() + .extension() + .and_then(|ext| ext.to_str()) + .map(|s| s.to_ascii_lowercase());Then compare against
ext.as_deref().This keeps behaviour stable on POSIX while preventing subtle mis-classification on case-insensitive platforms.
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 2047-2047: src/lib.rs#L2047
Added line #L2047 was not covered by testssrc/fs_cache.rs (1)
70-73:node_modulesdetection is case-sensitive – consider tolerant compare on Windows.
path.file_name() == "node_modules"fails if the directory is spelled differently (e.g.Node_Modules) on case-insensitive filesystems.- let is_node_modules = path.file_name().as_ref().is_some_and(|&name| name == "node_modules"); + let is_node_modules = path + .file_name() + .and_then(|name| name.to_str()) + .map(|name| name.eq_ignore_ascii_case("node_modules")) + .unwrap_or(false);Harmless on typical projects but removes a class of platform-specific edge cases.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (14)
Cargo.lockis excluded by!**/*.lockfixtures/enhanced_resolve/test/fixtures/multiple_modules/node_modules/m1/package.jsonis excluded by!**/node_modules/**fixtures/enhanced_resolve/test/fixtures/node_modules/complexm/package.jsonis excluded by!**/node_modules/**fixtures/enhanced_resolve/test/fixtures/node_modules/m1/package.jsonis excluded by!**/node_modules/**fixtures/enhanced_resolve/test/fixtures/node_modules/m2/package.jsonis excluded by!**/node_modules/**fixtures/misc/module-type/file.wasmis excluded by!**/*.wasmfixtures/misc/node_modules/package-json-nested/foo/bar/index.jsis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/foo/bar/package.jsonis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/foo/index.jsis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/foo/package.jsonis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/index.jsis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/package.jsonis excluded by!**/node_modules/**fixtures/pnpm/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (49)
.clippy.toml(1 hunks).github/workflows/ci.yml(1 hunks).github/workflows/release-napi.yml(2 hunks).gitignore(1 hunks)CONTRIBUTING.md(1 hunks)Cargo.toml(4 hunks)README.md(2 hunks)benches/resolver.rs(1 hunks)examples/resolver.rs(2 hunks)fixtures/misc/module-type/cjs/package.json(1 hunks)fixtures/misc/module-type/esm/package.json(1 hunks)fixtures/misc/module-type/no/package.json(1 hunks)fixtures/misc/module-type/package.json(1 hunks)fixtures/misc/package.json(1 hunks)fixtures/pnpm/.gitignore(0 hunks)fixtures/pnpm/package.json(1 hunks)fixtures/tsconfig/cases/merge_compiler_options/base-tsconfig.json(1 hunks)justfile(1 hunks)napi/Cargo.toml(1 hunks)napi/README.md(0 hunks)napi/index.d.ts(2 hunks)napi/index.js(1 hunks)napi/resolver.wasi-browser.js(1 hunks)napi/resolver.wasi.cjs(1 hunks)napi/src/lib.rs(8 hunks)napi/src/options.rs(2 hunks)napi/tests/simple.test.mjs(2 hunks)package.json(1 hunks)release-plz.toml(1 hunks)rust-toolchain.toml(1 hunks)src/cache.rs(3 hunks)src/error.rs(2 hunks)src/fs_cache.rs(11 hunks)src/lib.rs(5 hunks)src/options.rs(5 hunks)src/resolution.rs(4 hunks)src/tests/dependencies.rs(1 hunks)src/tests/incorrect_description_file.rs(2 hunks)src/tests/mod.rs(1 hunks)src/tests/module_type.rs(1 hunks)src/tests/package_json.rs(1 hunks)src/tests/resolution.rs(1 hunks)src/tests/resolve.rs(2 hunks)src/tests/scoped_packages.rs(2 hunks)src/tests/simple.rs(2 hunks)src/tests/tsconfig_paths.rs(2 hunks)src/tsconfig.rs(2 hunks)src/tsconfig_serde.rs(2 hunks)tests/resolve_test.rs(2 hunks)
💤 Files with no reviewable changes (2)
- fixtures/pnpm/.gitignore
- napi/README.md
✅ Files skipped from review due to trivial changes (1)
- .github/workflows/ci.yml
🚧 Files skipped from review as they are similar to previous changes (41)
- fixtures/misc/module-type/package.json
- rust-toolchain.toml
- fixtures/pnpm/package.json
- fixtures/misc/module-type/no/package.json
- fixtures/misc/module-type/cjs/package.json
- fixtures/misc/module-type/esm/package.json
- .clippy.toml
- justfile
- .gitignore
- fixtures/misc/package.json
- napi/resolver.wasi.cjs
- CONTRIBUTING.md
- package.json
- napi/resolver.wasi-browser.js
- src/tests/dependencies.rs
- .github/workflows/release-napi.yml
- fixtures/tsconfig/cases/merge_compiler_options/base-tsconfig.json
- release-plz.toml
- src/tests/incorrect_description_file.rs
- README.md
- src/tests/tsconfig_paths.rs
- src/tests/mod.rs
- src/tests/module_type.rs
- napi/index.js
- src/tests/resolve.rs
- examples/resolver.rs
- src/tests/package_json.rs
- src/tests/scoped_packages.rs
- src/error.rs
- src/tests/simple.rs
- benches/resolver.rs
- Cargo.toml
- napi/src/options.rs
- src/options.rs
- src/tests/resolution.rs
- src/cache.rs
- src/resolution.rs
- napi/Cargo.toml
- tests/resolve_test.rs
- napi/src/lib.rs
- napi/tests/simple.test.mjs
🧰 Additional context used
🧬 Code Graph Analysis (2)
napi/index.d.ts (1)
napi/resolver.wasi-browser.js (2)
ModuleType(66-66)ModuleType(66-66)
src/tsconfig_serde.rs (1)
src/tsconfig.rs (10)
verbatim_module_syntax(396-398)set_verbatim_module_syntax(401-401)preserve_value_imports(404-406)set_preserve_value_imports(409-409)imports_not_used_as_values(412-414)set_imports_not_used_as_values(417-417)target(420-422)set_target(425-425)module(428-430)set_module(433-433)
🪛 Biome (1.9.4)
napi/index.d.ts
[error] 22-28: The enum declaration should not be const
Const enums are not supported by bundlers and are incompatible with the 'isolatedModules' mode. Their use can lead to import inexistent values.
See TypeScript Docs for more details.
Safe fix: Turn the const enum into a regular enum.
(lint/suspicious/noConstEnum)
🪛 GitHub Check: codecov/patch
src/fs_cache.rs
[warning] 244-247: src/fs_cache.rs#L244-L247
Added lines #L244 - L247 were not covered by tests
[warning] 479-481: src/fs_cache.rs#L479-L481
Added lines #L479 - L481 were not covered by tests
src/lib.rs
[warning] 2047-2047: src/lib.rs#L2047
Added line #L2047 was not covered by tests
src/tsconfig.rs
[warning] 144-144: src/tsconfig.rs#L144
Added line #L144 was not covered by tests
[warning] 146-147: src/tsconfig.rs#L146-L147
Added lines #L146 - L147 were not covered by tests
[warning] 149-149: src/tsconfig.rs#L149
Added line #L149 was not covered by tests
[warning] 152-152: src/tsconfig.rs#L152
Added line #L152 was not covered by tests
[warning] 154-155: src/tsconfig.rs#L154-L155
Added lines #L154 - L155 were not covered by tests
[warning] 157-157: src/tsconfig.rs#L157
Added line #L157 was not covered by tests
[warning] 160-160: src/tsconfig.rs#L160
Added line #L160 was not covered by tests
[warning] 162-164: src/tsconfig.rs#L162-L164
Added lines #L162 - L164 were not covered by tests
[warning] 166-166: src/tsconfig.rs#L166
Added line #L166 was not covered by tests
[warning] 172-172: src/tsconfig.rs#L172
Added line #L172 was not covered by tests
[warning] 178-178: src/tsconfig.rs#L178
Added line #L178 was not covered by tests
[warning] 396-398: src/tsconfig.rs#L396-L398
Added lines #L396 - L398 were not covered by tests
[warning] 401-401: src/tsconfig.rs#L401
Added line #L401 was not covered by tests
[warning] 404-406: src/tsconfig.rs#L404-L406
Added lines #L404 - L406 were not covered by tests
[warning] 409-409: src/tsconfig.rs#L409
Added line #L409 was not covered by tests
[warning] 412-414: src/tsconfig.rs#L412-L414
Added lines #L412 - L414 were not covered by tests
[warning] 417-417: src/tsconfig.rs#L417
Added line #L417 was not covered by tests
[warning] 420-422: src/tsconfig.rs#L420-L422
Added lines #L420 - L422 were not covered by tests
[warning] 425-425: src/tsconfig.rs#L425
Added line #L425 was not covered by tests
[warning] 428-430: src/tsconfig.rs#L428-L430
Added lines #L428 - L430 were not covered by tests
[warning] 433-433: src/tsconfig.rs#L433
Added line #L433 was not covered by tests
src/tsconfig_serde.rs
[warning] 234-236: src/tsconfig_serde.rs#L234-L236
Added lines #L234 - L236 were not covered by tests
[warning] 242-244: src/tsconfig_serde.rs#L242-L244
Added lines #L242 - L244 were not covered by tests
[warning] 250-252: src/tsconfig_serde.rs#L250-L252
Added lines #L250 - L252 were not covered by tests
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Benchmark
- GitHub Check: Test (windows-latest)
🔇 Additional comments (1)
src/tsconfig_serde.rs (1)
138-151: Good addition, but please add round-trip tests for the new fields
verbatim_module_syntax,preserve_value_imports,imports_not_used_as_values,target, andmoduleare now deserialised, but there is no coverage ensuring they:
- Deserialize correctly from JSON.
- Survive a
TsConfig::extend_tsconfigmerge.- Re-serialize (if applicable) unchanged.
A minimal test that parses a mini-tsconfig, calls
extend_tsconfig, and asserts the fields are set would close the gap flagged by Codecov.
51768a8 to
4f04632
Compare
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed 4f04632 in 2 minutes and 50 seconds. Click for details.
- Reviewed
2316lines of code in55files - Skipped
4files when reviewing. - Skipped posting
12draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. napi/src/tsconfig_serde.rs:315
- Draft comment:
The call to json_strip_comments::strip(json) is discarded. If the intent is to remove comments before parsing, consider assigning its result to a variable and using that in serde_json::from_str. Otherwise the input may still contain comments. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. napi/src/options.rs:15
- Draft comment:
New field 'module_type' is added to the NapiResolveOptions. The pattern is consistent; ensure that tests cover scenarios where moduleType resolution is both enabled and disabled. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. napi/index.d.ts:22
- Draft comment:
The new ModuleType enum and related documentation are clear. Verify that the documentation examples align with implementation and that all expected casing (lowercase strings) are correctly exported. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%This comment is asking the PR author to verify alignment between documentation and implementation, which is against the rules. It doesn't provide a specific suggestion or point out a specific issue.
4. napi/src/lib.rs:45
- Draft comment:
Mapping of unrs_resolver::ModuleType to local ModuleType via the From implementation appears correct. Good job keeping the API consistent. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%This comment is purely informative, stating that the mapping appears correct. It does not provide any actionable feedback or suggestions for improvement.
5. tests/module_type.rs:1
- Draft comment:
Tests for module type detection are comprehensive. Confirm that edge cases (e.g., files without explicit module type) are also covered. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. src/tsconfig.rs:232
- Draft comment:
The substitute_template_variable function performs a simple head replacement for the TEMPLATE_VARIABLE. Consider whether nested occurrences or multiple appearances should be handled, or document that only a single occurrence at the start is supported. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
7. tests/resolve_test.rs:10
- Draft comment:
The test 'chinese' verifies that paths with Unicode characters are resolved correctly. This is a good check for internationalization support. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
8. tests/resolve_test.rs:242
- Draft comment:
The resolution of styled-components for both CJS and ESM using condition names is implemented clearly. Ensure that any platform-specific behavior on Windows is also tested (if applicable). - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
9. examples/resolver.rs:48
- Draft comment:
Typographical suggestion: Consider changing "package json" to "package.json" in the output string for clarity. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is a very minor formatting suggestion for debug output text. It's technically correct that "package.json" is the proper name of the file, but this is just debug output and the current format is perfectly clear. The change wouldn't meaningfully improve code quality or fix any real issues. The suggested change would make the output more technically accurate. Debug output consistency could be important for documentation or testing. While technically more accurate, this is an extremely minor cosmetic change to debug output that doesn't impact functionality or code quality in any meaningful way. Delete this comment as it suggests an unimportant cosmetic change to debug output text that doesn't meaningfully improve the code.
10. napi/src/options.rs:244
- Draft comment:
Typographical issue: There appears to be an extra space in the panic message at this line. Consider changing "for tsconfig references" to "for tsconfig references". - Reason this comment was not posted:
Comment was on unchanged code.
11. src/error.rs:72
- Draft comment:
Typographical note: The comment on line 72 reads "JSON parse error" while the enum variant is renamed toJson(lowercase 'son'). Consider updating the comment for consistency. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the comment is technically correct about an inconsistency, it's a very minor stylistic issue. The meaning is completely clear regardless of capitalization. The comment doesn't point out a bug or suggest an important improvement. It's more of a nitpick about documentation style. The inconsistency could potentially cause confusion for users of the API looking at documentation. Consistency in documentation is generally good practice. While consistency is good, this is an extremely minor issue that doesn't impact functionality or significantly affect readability. The meaning is clear either way. Delete this comment as it points out a trivial documentation inconsistency that doesn't meaningfully impact code quality or usability.
12. src/tests/package_json.rs:13
- Draft comment:
Typo: The comment reads "Nested package.json do not participate in module resolution." Consider revising it to "Nested package.json does not participate in module resolution." - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While technically correct grammatically, this is an extremely minor issue. The original comment is still perfectly understandable. Comments about documentation style/grammar that don't affect code understanding should generally be avoided unless they're part of a formal documentation. This is just a test file's internal comment. The grammar is technically incorrect, and maintaining good documentation is important. Maybe we should keep high standards for all comments? While good documentation is important, this minor grammatical issue doesn't impact understanding and isn't worth the overhead of a PR comment and revision cycle. Delete this comment as it's too minor and doesn't affect code understanding or functionality.
Workflow ID: wflow_fqmrFU5CeaHotykY
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
4f04632 to
56e6d60
Compare
|
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed 56e6d60 in 1 minute and 50 seconds. Click for details.
- Reviewed
2300lines of code in55files - Skipped
4files when reviewing. - Skipped posting
10draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/tsconfig_serde.rs:315
- Draft comment:
The return value ofjson_strip_comments::strip(json)is computed and immediately discarded. Typically, this function returns the JSON string with comments removed (or a Cow). Consider capturing the returned value and using that forserde_json::from_strso that TSconfig files with comments are parsed correctly. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. src/options.rs:11
- Draft comment:
The attribute#[expect(clippy::struct_excessive_bools)]is unusual. Typically lint exceptions use#[allow(...)]. If you intend to mark this lint as expected, please add a brief comment documenting why having many boolean fields is acceptable in this context. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. tests/resolve_test.rs:10
- Draft comment:
The tests in this file cover important cases (e.g., handling of Chinese characters) and look comprehensive. Ensure that all OS‐specific behavior (especially on Windows) is well‐expected in a CI environment. - Reason this comment was not posted:
Confidence changes required:20%<= threshold50%None
4. src/tsconfig.rs:192
- Draft comment:
In thebuild()method, the substitution logic for the${configDir}template variable only handles cases where the variable appears as a prefix. If other occurrences are possible, consider clarifying or extending the substitution logic. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
5. README.md:52
- Draft comment:
Typo: In the bullet point 'support project references definedtsconfig.references', it seems the word 'in' is missing after 'defined'. Consider revising to 'support project references defined intsconfig.references' for consistency with the preceding items. - Reason this comment was not posted:
Comment was on unchanged code.
6. examples/resolver.rs:48
- Draft comment:
Typographical suggestion: Consider replacing "package json" with "package.json" for consistency with common package manifest naming. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is a very minor stylistic change to debug output text. It doesn't affect functionality. While technically correct that package.json is the standard name, this is just debug output and the current format is perfectly clear. This seems too trivial to warrant a comment. The standard name is indeed "package.json" and consistency in terminology could be valuable for maintainability. While technically correct, this is just debug output text that has no impact on functionality. The comment violates our rule about not making obvious or unimportant suggestions. Delete this comment as it suggests an extremely minor stylistic change to debug output text that doesn't meaningfully impact the code.
7. napi/src/options.rs:244
- Draft comment:
Typo: There is an extra space in the panic message on this line (... for tsconfig references ...). Consider removing the extra space. - Reason this comment was not posted:
Comment was on unchanged code.
8. src/error.rs:74
- Draft comment:
Typographical consistency: The enum variant is now namedJsonwhile the doc comment still reads "JSON parse error". Consider updating the doc comment to match the variant name if this change is intentional. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the comment points out an inconsistency, JSON is a widely recognized acronym typically written in uppercase. The doc comment using "JSON" is actually more conventional and clearer than using "Json". The variant name using "Json" is likely for Rust naming conventions (CamelCase for variants), but that doesn't mean the documentation needs to follow the same casing. The comment assumes that consistency in casing between code and documentation is more important than using standard acronym conventions in documentation. Also, this is a relatively minor stylistic issue. The standard way to write the acronym is "JSON", and documentation should prioritize clarity and convention over matching code casing exactly. Delete the comment as it suggests changing correct documentation (using standard "JSON" acronym) to match code casing, which would actually make the documentation less conventional.
9. src/resolution.rs:37
- Draft comment:
There is an extra whitespace in the documentation comment. "/// The algorithm uses..." has an extra space between the triple slashes and "The"; consider changing it to "/// The algorithm uses...". - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the comment is technically correct about the extra space, this is an extremely minor formatting issue. Documentation formatting issues like this are typically handled by automated tools like rustfmt. The comment doesn't point out any functional issues or suggest meaningful improvements to the code. The extra space could be considered a consistency issue since other doc comments in the file don't have this extra space. It's part of newly added code. Even though it's in new code, this is too minor of an issue to warrant a PR comment. It doesn't affect functionality or readability significantly. Delete this comment as it points out an extremely minor formatting issue that doesn't meaningfully impact the code quality.
10. src/tests/package_json.rs:13
- Draft comment:
Typographical suggestion: The comment "Nested package.json do not participate in module resolution." might be clearer if it reads "Nested package.json files do not participate in module resolution." to better convey the intent. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment is suggesting a very minor wording improvement to documentation. While technically correct, it doesn't affect functionality and the original comment is already clear enough. This kind of minor documentation style suggestion goes against the rule about not making purely informative comments that don't require code changes. The backticks would make the documentation more consistent with Rust documentation style. The word "files" does add clarity. While the suggestion would make a minor improvement, it's not significant enough to warrant a comment. The original comment is already clear and functional. Delete the comment as it's a purely stylistic documentation suggestion that doesn't affect functionality or clarity significantly.
Workflow ID: wflow_8hvywvVpFxymOnOR
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (3)
napi/index.d.ts (1)
22-28:⚠️ Potential issue
const enumstill breaksisolatedModules– please drop theconstkeyword
The same concern was raised earlier:const enumis erased by the TS compiler and makes the declaration unusable when code is re-emitted by Babel/SWC/esbuild or whenisolatedModulesis enabled. Convert it to a plainenum.-export declare const enum ModuleType { +export declare enum ModuleType {🧰 Tools
🪛 Biome (1.9.4)
[error] 22-28: The enum declaration should not be const
Const enums are not supported by bundlers and are incompatible with the 'isolatedModules' mode. Their use can lead to import inexistent values.
See TypeScript Docs for more details.
Safe fix: Turn the const enum into a regular enum.(lint/suspicious/noConstEnum)
src/tsconfig.rs (1)
395-434:⚠️ Potential issueDefault setters still silently no-op – missing-override bugs remain
As noted in the previous review, every newly added setter does nothing in the default implementation. A forgotten override will drop configuration without warning.Add a
debug_assert!(false, “…”)(ortodo!()under#[cfg(debug_assertions)]) so failures surface during testing.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 396-398: src/tsconfig.rs#L396-L398
Added lines #L396 - L398 were not covered by tests
[warning] 401-401: src/tsconfig.rs#L401
Added line #L401 was not covered by tests
[warning] 404-406: src/tsconfig.rs#L404-L406
Added lines #L404 - L406 were not covered by tests
[warning] 409-409: src/tsconfig.rs#L409
Added line #L409 was not covered by tests
[warning] 412-414: src/tsconfig.rs#L412-L414
Added lines #L412 - L414 were not covered by tests
[warning] 417-417: src/tsconfig.rs#L417
Added line #L417 was not covered by tests
[warning] 420-422: src/tsconfig.rs#L420-L422
Added lines #L420 - L422 were not covered by tests
[warning] 425-425: src/tsconfig.rs#L425
Added line #L425 was not covered by tests
[warning] 428-430: src/tsconfig.rs#L428-L430
Added lines #L428 - L430 were not covered by tests
[warning] 433-433: src/tsconfig.rs#L433
Added line #L433 was not covered by testssrc/lib.rs (1)
323-337: Nearestpackage.jsonis still resolved last instead of firstAlgorithm should return on the first match (nearest ancestor) according to Node’s LOOKUP_PACKAGE_SCOPE, but the loop keeps walking up and overwrites
last, therefore returning the farthest match.
This was already raised in a previous review and remains unfixed.
🧹 Nitpick comments (2)
src/tsconfig.rs (1)
143-178: Repeated option-copy blocks could use a helper to avoid boilerplate
Six nearly identicalif self.foo().is_none() { … }blocks add maintenance overhead. Consider an internal macro or small helper (inherit_option!(foo)) to keepextend_tsconfigcompact.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 144-144: src/tsconfig.rs#L144
Added line #L144 was not covered by tests
[warning] 146-147: src/tsconfig.rs#L146-L147
Added lines #L146 - L147 were not covered by tests
[warning] 149-149: src/tsconfig.rs#L149
Added line #L149 was not covered by tests
[warning] 152-152: src/tsconfig.rs#L152
Added line #L152 was not covered by tests
[warning] 154-155: src/tsconfig.rs#L154-L155
Added lines #L154 - L155 were not covered by tests
[warning] 157-157: src/tsconfig.rs#L157
Added line #L157 was not covered by tests
[warning] 160-160: src/tsconfig.rs#L160
Added line #L160 was not covered by tests
[warning] 162-164: src/tsconfig.rs#L162-L164
Added lines #L162 - L164 were not covered by tests
[warning] 166-166: src/tsconfig.rs#L166
Added line #L166 was not covered by tests
[warning] 172-172: src/tsconfig.rs#L172
Added line #L172 was not covered by tests
[warning] 178-178: src/tsconfig.rs#L178
Added line #L178 was not covered by testssrc/fs_cache.rs (1)
70-78:node_modulesdetection is case-sensitive – may mis-classify paths on Windows/macOS
OsStrcomparison against the hard-coded"node_modules"string is performed byte-for-byte.
On case-insensitive file systems (e.g.NODE_MODULES,Node_Modules) this returnsfalse, breakinginside_node_modules()logic.-let is_node_modules = path.file_name().as_ref().is_some_and(|&name| name == "node_modules"); +let is_node_modules = path + .file_name() + .and_then(|n| n.to_str()) + .is_some_and(|n| n.eq_ignore_ascii_case("node_modules"));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (14)
Cargo.lockis excluded by!**/*.lockfixtures/enhanced_resolve/test/fixtures/multiple_modules/node_modules/m1/package.jsonis excluded by!**/node_modules/**fixtures/enhanced_resolve/test/fixtures/node_modules/complexm/package.jsonis excluded by!**/node_modules/**fixtures/enhanced_resolve/test/fixtures/node_modules/m1/package.jsonis excluded by!**/node_modules/**fixtures/enhanced_resolve/test/fixtures/node_modules/m2/package.jsonis excluded by!**/node_modules/**fixtures/misc/module-type/file.wasmis excluded by!**/*.wasmfixtures/misc/node_modules/package-json-nested/foo/bar/index.jsis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/foo/bar/package.jsonis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/foo/index.jsis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/foo/package.jsonis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/index.jsis excluded by!**/node_modules/**fixtures/misc/node_modules/package-json-nested/package.jsonis excluded by!**/node_modules/**fixtures/pnpm/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (49)
.clippy.toml(1 hunks).github/workflows/ci.yml(1 hunks).github/workflows/release-napi.yml(2 hunks).gitignore(1 hunks)CONTRIBUTING.md(1 hunks)Cargo.toml(4 hunks)README.md(1 hunks)benches/resolver.rs(1 hunks)examples/resolver.rs(2 hunks)fixtures/misc/module-type/cjs/package.json(1 hunks)fixtures/misc/module-type/esm/package.json(1 hunks)fixtures/misc/module-type/no/package.json(1 hunks)fixtures/misc/module-type/package.json(1 hunks)fixtures/misc/package.json(1 hunks)fixtures/pnpm/.gitignore(0 hunks)fixtures/pnpm/package.json(1 hunks)fixtures/tsconfig/cases/merge_compiler_options/base-tsconfig.json(1 hunks)justfile(1 hunks)napi/Cargo.toml(1 hunks)napi/README.md(0 hunks)napi/index.d.ts(2 hunks)napi/index.js(1 hunks)napi/resolver.wasi-browser.js(1 hunks)napi/resolver.wasi.cjs(1 hunks)napi/src/lib.rs(8 hunks)napi/src/options.rs(2 hunks)napi/tests/simple.test.mjs(2 hunks)package.json(1 hunks)release-plz.toml(1 hunks)rust-toolchain.toml(1 hunks)src/cache.rs(3 hunks)src/error.rs(2 hunks)src/fs_cache.rs(10 hunks)src/lib.rs(5 hunks)src/options.rs(5 hunks)src/resolution.rs(4 hunks)src/tests/dependencies.rs(1 hunks)src/tests/incorrect_description_file.rs(2 hunks)src/tests/mod.rs(1 hunks)src/tests/module_type.rs(1 hunks)src/tests/package_json.rs(1 hunks)src/tests/resolution.rs(1 hunks)src/tests/resolve.rs(2 hunks)src/tests/scoped_packages.rs(2 hunks)src/tests/simple.rs(2 hunks)src/tests/tsconfig_paths.rs(2 hunks)src/tsconfig.rs(2 hunks)src/tsconfig_serde.rs(2 hunks)tests/resolve_test.rs(2 hunks)
💤 Files with no reviewable changes (2)
- fixtures/pnpm/.gitignore
- napi/README.md
✅ Files skipped from review due to trivial changes (3)
- .github/workflows/ci.yml
- src/tests/dependencies.rs
- CONTRIBUTING.md
🚧 Files skipped from review as they are similar to previous changes (39)
- fixtures/misc/module-type/esm/package.json
- rust-toolchain.toml
- fixtures/misc/module-type/package.json
- fixtures/misc/module-type/cjs/package.json
- fixtures/misc/package.json
- fixtures/pnpm/package.json
- justfile
- .clippy.toml
- src/tests/resolution.rs
- src/tests/mod.rs
- napi/index.js
- fixtures/misc/module-type/no/package.json
- benches/resolver.rs
- package.json
- .gitignore
- README.md
- src/tests/tsconfig_paths.rs
- release-plz.toml
- napi/resolver.wasi-browser.js
- fixtures/tsconfig/cases/merge_compiler_options/base-tsconfig.json
- napi/resolver.wasi.cjs
- src/tests/scoped_packages.rs
- src/tests/resolve.rs
- src/tests/module_type.rs
- src/tests/incorrect_description_file.rs
- Cargo.toml
- src/tests/package_json.rs
- tests/resolve_test.rs
- src/tests/simple.rs
- src/error.rs
- examples/resolver.rs
- napi/src/options.rs
- src/resolution.rs
- napi/tests/simple.test.mjs
- .github/workflows/release-napi.yml
- src/options.rs
- src/cache.rs
- napi/Cargo.toml
- napi/src/lib.rs
🧰 Additional context used
🧬 Code Graph Analysis (2)
napi/index.d.ts (1)
napi/resolver.wasi-browser.js (2)
ModuleType(66-66)ModuleType(66-66)
src/tsconfig_serde.rs (1)
src/tsconfig.rs (10)
verbatim_module_syntax(396-398)set_verbatim_module_syntax(401-401)preserve_value_imports(404-406)set_preserve_value_imports(409-409)imports_not_used_as_values(412-414)set_imports_not_used_as_values(417-417)target(420-422)set_target(425-425)module(428-430)set_module(433-433)
🪛 GitHub Check: codecov/patch
src/lib.rs
[warning] 2047-2047: src/lib.rs#L2047
Added line #L2047 was not covered by tests
src/fs_cache.rs
[warning] 493-495: src/fs_cache.rs#L493-L495
Added lines #L493 - L495 were not covered by tests
src/tsconfig.rs
[warning] 144-144: src/tsconfig.rs#L144
Added line #L144 was not covered by tests
[warning] 146-147: src/tsconfig.rs#L146-L147
Added lines #L146 - L147 were not covered by tests
[warning] 149-149: src/tsconfig.rs#L149
Added line #L149 was not covered by tests
[warning] 152-152: src/tsconfig.rs#L152
Added line #L152 was not covered by tests
[warning] 154-155: src/tsconfig.rs#L154-L155
Added lines #L154 - L155 were not covered by tests
[warning] 157-157: src/tsconfig.rs#L157
Added line #L157 was not covered by tests
[warning] 160-160: src/tsconfig.rs#L160
Added line #L160 was not covered by tests
[warning] 162-164: src/tsconfig.rs#L162-L164
Added lines #L162 - L164 were not covered by tests
[warning] 166-166: src/tsconfig.rs#L166
Added line #L166 was not covered by tests
[warning] 172-172: src/tsconfig.rs#L172
Added line #L172 was not covered by tests
[warning] 178-178: src/tsconfig.rs#L178
Added line #L178 was not covered by tests
[warning] 396-398: src/tsconfig.rs#L396-L398
Added lines #L396 - L398 were not covered by tests
[warning] 401-401: src/tsconfig.rs#L401
Added line #L401 was not covered by tests
[warning] 404-406: src/tsconfig.rs#L404-L406
Added lines #L404 - L406 were not covered by tests
[warning] 409-409: src/tsconfig.rs#L409
Added line #L409 was not covered by tests
[warning] 412-414: src/tsconfig.rs#L412-L414
Added lines #L412 - L414 were not covered by tests
[warning] 417-417: src/tsconfig.rs#L417
Added line #L417 was not covered by tests
[warning] 420-422: src/tsconfig.rs#L420-L422
Added lines #L420 - L422 were not covered by tests
[warning] 425-425: src/tsconfig.rs#L425
Added line #L425 was not covered by tests
[warning] 428-430: src/tsconfig.rs#L428-L430
Added lines #L428 - L430 were not covered by tests
[warning] 433-433: src/tsconfig.rs#L433
Added line #L433 was not covered by tests
src/tsconfig_serde.rs
[warning] 234-236: src/tsconfig_serde.rs#L234-L236
Added lines #L234 - L236 were not covered by tests
[warning] 242-244: src/tsconfig_serde.rs#L242-L244
Added lines #L242 - L244 were not covered by tests
[warning] 250-252: src/tsconfig_serde.rs#L250-L252
Added lines #L250 - L252 were not covered by tests
🪛 Biome (1.9.4)
napi/index.d.ts
[error] 22-28: The enum declaration should not be const
Const enums are not supported by bundlers and are incompatible with the 'isolatedModules' mode. Their use can lead to import inexistent values.
See TypeScript Docs for more details.
Safe fix: Turn the const enum into a regular enum.
(lint/suspicious/noConstEnum)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Benchmark
🔇 Additional comments (2)
napi/index.d.ts (1)
194-199: Option naming alignment check
moduleType?: booleanis added here, while the Rust side names the fieldmodule_type. 🛈 Double-check the N-API layer converts between the two (camel ↔ snake) to avoid silentundefinedvalues.src/tsconfig_serde.rs (1)
230-268: Good: concrete overrides implemented
All new compiler-option accessors are fully wired up here, eliminating the silent-drop issue for the serde backend. ✅🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 234-236: src/tsconfig_serde.rs#L234-L236
Added lines #L234 - L236 were not covered by tests
[warning] 242-244: src/tsconfig_serde.rs#L242-L244
Added lines #L242 - L244 were not covered by tests
[warning] 250-252: src/tsconfig_serde.rs#L250-L252
Added lines #L250 - L252 were not covered by tests



Important
This PR adds module type detection, enhances TypeScript compiler options, improves
package.jsonhandling, and updates documentation and tests in theoxc-resolverproject.ModuleTypeenum for module type detection (ESM, CommonJS, JSON, WASM, Addon) inresolution.rs.package.jsonpath and module type.ModuleTypeenum in JavaScript API and WASI exports.module_typeoption inResolveOptionsfor module type resolution.tsconfig.rs.package.jsonlookup for modules insidenode_modulesinfs_cache.rs.CONTRIBUTING.md.README.mdfor clarity and organization.module_type.rs.package.jsonassociation inpackage_json.rs.ci.ymlandrelease-napi.yml.rust-toolchain.toml.Cargo.toml.This description was created by
for 56e6d60. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit
New Features
ModuleTypeenum.package.jsonpath when available.ModuleTypeenum in JavaScript API and WASI exports.module_typeoption to enable module type resolution.Bug Fixes
package.jsonlookup for modules insidenode_modulesdirectories.Documentation
Tests
Chores