diff --git a/.changeset/chubby-hornets-greet.md b/.changeset/chubby-hornets-greet.md deleted file mode 100644 index ce4e0c7e..00000000 --- a/.changeset/chubby-hornets-greet.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"enhanced-resolve": minor ---- - -Added promise API and support to resolve without `context` and `resolveContext`. diff --git a/.changeset/extension-alias-for-exports.md b/.changeset/extension-alias-for-exports.md deleted file mode 100644 index f53470e6..00000000 --- a/.changeset/extension-alias-for-exports.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"enhanced-resolve": minor ---- - -Add `extensionAliasForExports` option. When `true`, `extensionAlias` also applies to paths resolved through the `package.json` `exports` field. Off by default to match Node.js; opt in for full TypeScript-resolver parity with packages that ship `.ts` sources alongside the compiled `.js` they declare in `exports`. diff --git a/.changeset/fix-dos-device-paths.md b/.changeset/fix-dos-device-paths.md deleted file mode 100644 index e7ac77fc..00000000 --- a/.changeset/fix-dos-device-paths.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"enhanced-resolve": patch ---- - -Properly handle DOS device paths (`\\?\…` and `\\.\…`). diff --git a/.changeset/fix-exports-field-parent-fallback.md b/.changeset/fix-exports-field-parent-fallback.md deleted file mode 100644 index 31686bd6..00000000 --- a/.changeset/fix-exports-field-parent-fallback.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"enhanced-resolve": patch ---- - -Prevent fallback to parent node_modules when the `exports` field target file is not found. diff --git a/.changeset/fix-imports-field-no-chaining.md b/.changeset/fix-imports-field-no-chaining.md deleted file mode 100644 index 97362691..00000000 --- a/.changeset/fix-imports-field-no-chaining.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"enhanced-resolve": patch ---- - -Imports field spec deviation: non-relative targets (e.g. `"#a": "#b"`) no longer re-enter imports resolution, aligning with the Node.js ESM spec where `PACKAGE_IMPORTS_RESOLVE` does not recursively resolve `#` specifiers. - -Previously `{ "#a": "#b", "#b": "./the.js" }` would chain-resolve `#a` to `./the.js`; now it correctly fails, matching Node.js behavior. diff --git a/.changeset/fix-join-cache-memory-leak.md b/.changeset/fix-join-cache-memory-leak.md deleted file mode 100644 index ccb3dc4a..00000000 --- a/.changeset/fix-join-cache-memory-leak.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"enhanced-resolve": patch ---- - -Move `cachedJoin`/`cachedDirname`/`createCachedBasename` caches from module-level globals to per-Resolver instances. This prevents unbounded memory growth in long-running processes — when a Resolver is garbage collected, its join/dirname/basename caches are released with it. diff --git a/.changeset/fix-tsconfig-paths-missing-config.md b/.changeset/fix-tsconfig-paths-missing-config.md deleted file mode 100644 index 3a648e74..00000000 --- a/.changeset/fix-tsconfig-paths-missing-config.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"enhanced-resolve": patch ---- - -Fixed when `tsconfig: true` is used (default config file) and no `tsconfig.json` exists. diff --git a/.changeset/large-beds-sell.md b/.changeset/large-beds-sell.md deleted file mode 100644 index eccc4472..00000000 --- a/.changeset/large-beds-sell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"enhanced-resolve": patch ---- - -Apply the `extensionAlias` option to the `imports` field to be align with typescript resolution. diff --git a/.changeset/neat-toys-serve.md b/.changeset/neat-toys-serve.md deleted file mode 100644 index aad34b50..00000000 --- a/.changeset/neat-toys-serve.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"enhanced-resolve": patch ---- - -Improved performance of the many plugins. diff --git a/.changeset/perf-stack-entry-linked-list.md b/.changeset/perf-stack-entry-linked-list.md deleted file mode 100644 index 126dfda7..00000000 --- a/.changeset/perf-stack-entry-linked-list.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"enhanced-resolve": patch ---- - -Replace the `Set`-based resolver stack with a singly-linked `StackEntry` class that exposes a Set-compatible API. - -Each `doResolve` call now prepends a single linked-list node instead of cloning the entire Set, making stack push O(1) in time and memory. Recursion detection walks the linked list (O(n)), but because the stack is typically shallow this is much cheaper than cloning a Set per call. diff --git a/.changeset/perf-tsconfig-strip-comments-cache.md b/.changeset/perf-tsconfig-strip-comments-cache.md deleted file mode 100644 index 4b63a44a..00000000 --- a/.changeset/perf-tsconfig-strip-comments-cache.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"enhanced-resolve": patch ---- - -Cache the result of `stripJsonComments` + `JSON.parse` in `readJson` using a `WeakMap` keyed by the raw file buffer. This avoids redundant comment-stripping and JSON parsing on every resolve call that reads tsconfig.json files (via `stripComments: true`), improving TsconfigPathsPlugin warm performance by ~20-35% depending on the depth of the `extends` chain. diff --git a/.changeset/serious-zebras-cross.md b/.changeset/serious-zebras-cross.md deleted file mode 100644 index f0ff49c2..00000000 --- a/.changeset/serious-zebras-cross.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"enhanced-resolve": patch ---- - -Avoid OOM in CachedInputFileSystem when duration is Infinity. diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f92d2d7..163b0896 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,39 @@ # enhanced-resolve +## 5.21.0 + +### Minor Changes + +- Added promise API and support to resolve without `context` and `resolveContext`. (by [@alexander-akait](https://github.com/alexander-akait) in [#520](https://github.com/webpack/enhanced-resolve/pull/520)) + +- Add `extensionAliasForExports` option. When `true`, `extensionAlias` also applies to paths resolved through the `package.json` `exports` field. Off by default to match Node.js; opt in for full TypeScript-resolver parity with packages that ship `.ts` sources alongside the compiled `.js` they declare in `exports`. (by [@alexander-akait](https://github.com/alexander-akait) in [#554](https://github.com/webpack/enhanced-resolve/pull/554)) + +### Patch Changes + +- Properly handle DOS device paths (`\\?\…` and `\\.\…`). (by [@alexander-akait](https://github.com/alexander-akait) in [#551](https://github.com/webpack/enhanced-resolve/pull/551)) + +- Prevent fallback to parent node_modules when the `exports` field target file is not found. (by [@xiaoxiaojx](https://github.com/xiaoxiaojx) in [#495](https://github.com/webpack/enhanced-resolve/pull/495)) + +- Imports field spec deviation: non-relative targets (e.g. `"#a": "#b"`) no longer re-enter imports resolution, aligning with the Node.js ESM spec where `PACKAGE_IMPORTS_RESOLVE` does not recursively resolve `#` specifiers. (by [@xiaoxiaojx](https://github.com/xiaoxiaojx) in [#503](https://github.com/webpack/enhanced-resolve/pull/503)) + + Previously `{ "#a": "#b", "#b": "./the.js" }` would chain-resolve `#a` to `./the.js`; now it correctly fails, matching Node.js behavior. + +- Move `cachedJoin`/`cachedDirname`/`createCachedBasename` caches from module-level globals to per-Resolver instances. This prevents unbounded memory growth in long-running processes — when a Resolver is garbage collected, its join/dirname/basename caches are released with it. (by [@xiaoxiaojx](https://github.com/xiaoxiaojx) in [#507](https://github.com/webpack/enhanced-resolve/pull/507)) + +- Fixed when `tsconfig: true` is used (default config file) and no `tsconfig.json` exists. (by [@xiaoxiaojx](https://github.com/xiaoxiaojx) in [#502](https://github.com/webpack/enhanced-resolve/pull/502)) + +- Apply the `extensionAlias` option to the `imports` field to be align with typescript resolution. (by [@alexander-akait](https://github.com/alexander-akait) in [#549](https://github.com/webpack/enhanced-resolve/pull/549)) + +- Improved performance of the many plugins. (by [@alexander-akait](https://github.com/alexander-akait) in [#529](https://github.com/webpack/enhanced-resolve/pull/529)) + +- Replace the `Set`-based resolver stack with a singly-linked `StackEntry` class that exposes a Set-compatible API. (by [@xiaoxiaojx](https://github.com/xiaoxiaojx) in [#526](https://github.com/webpack/enhanced-resolve/pull/526)) + + Each `doResolve` call now prepends a single linked-list node instead of cloning the entire Set, making stack push O(1) in time and memory. Recursion detection walks the linked list (O(n)), but because the stack is typically shallow this is much cheaper than cloning a Set per call. + +- Cache the result of `stripJsonComments` + `JSON.parse` in `readJson` using a `WeakMap` keyed by the raw file buffer. This avoids redundant comment-stripping and JSON parsing on every resolve call that reads tsconfig.json files (via `stripComments: true`), improving TsconfigPathsPlugin warm performance by ~20-35% depending on the depth of the `extends` chain. (by [@xiaoxiaojx](https://github.com/xiaoxiaojx) in [#524](https://github.com/webpack/enhanced-resolve/pull/524)) + +- Avoid OOM in CachedInputFileSystem when duration is Infinity. (by [@alexander-akait](https://github.com/alexander-akait) in [#527](https://github.com/webpack/enhanced-resolve/pull/527)) + ## 5.20.1 ### Patch Changes diff --git a/package.json b/package.json index 946ef83d..f6c80ee6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "enhanced-resolve", - "version": "5.20.1", + "version": "5.21.0", "description": "Offers a async require.resolve function. It's highly configurable.", "homepage": "http://github.com/webpack/enhanced-resolve", "repository": {