Repository navigation
feat: export the UnsafeCache type - #703
Conversation
The `unsafeCache` option accepts a cache object, but its type was only reachable through the internal `types/UnsafeCachePlugin` file, so consumers such as webpack had to restate it.
🦋 Changeset detectedLatest commit: cb1719b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #703 +/- ##
=======================================
Coverage 98.99% 98.99%
=======================================
Files 52 52
Lines 10932 10933 +1
=======================================
+ Hits 10822 10823 +1
Misses 110 110
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. WalkthroughThe package declarations now export Merge Risk:
|
Merging this PR will degrade performance by 2.71%2 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## enhanced-resolve@5.26.2 ### Patch Changes - Export the `UnsafeCache` type of the `unsafeCache` option. (by [@alexander-akait](https://github.com/alexander-akait) in [#703](#703)) - Resolve tsconfig `extends` the way tsc does, including package `exports`. (by [@abrahamguo](https://github.com/abrahamguo) in [#709](#709)) - Resolve `paths` inherited through `extends` (with no `baseUrl`) relative to the tsconfig that declares them, substitute `${configDir}` in an inherited `baseUrl`, treat an empty `baseUrl` as the directory of its tsconfig, like tsc, and stop extending a tsconfig from changing it for later loads that share the file system cache. (by [@alexander-akait](https://github.com/alexander-akait) in [#711](#711)) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary
ResolveOptions.unsafeCacheaccepts a cache object of type{ [k: string]: undefined | ResolveRequest | ResolveRequest[] }. That type,Cache, is declared inlib/UnsafeCachePlugin.js, but the package entry doesn't export it. Consumers can only reach it through the internaltypes/UnsafeCachePlugin.d.tsfile. Webpack restates the shape for itsresolve.unsafeCacheoption (webpack/webpack#23146).This exports it from
lib/index.jsasUnsafeCache, next toResolveRequestandResolveOptions. It's namedUnsafeCachebecause a bareCacheis ambiguous at the package top level.The shape matches what
UnsafeCachePluginstores: oneResolveRequestper key for a normal resolve, the yieldedResolveRequest[]for a resolve withyield, andundefinedfor a miss.What kind of change does this PR introduce?
feat (types only)
Did you add tests for your changes?
test/yield.test.jsnow imports the cache type from the package entry (import("../").UnsafeCache) instead of the internal file, solint:types-testcovers the export. I also checked outside the repo thatUnsafeCacheand webpack's local copy are assignable both ways, that it is accepted asunsafeCache, and that non-request entries are rejected.Does this PR introduce a breaking change?
No. It only adds a type name, and runtime is unchanged.
If relevant, what needs to be documented once your change is merged or what have you documented already?
Nothing.
Use of AI
Prepared with Claude Code; reviewed by me.
Generated by Claude Code
Summary by CodeRabbit
UnsafeCachetype from the package entry point, making it available to TypeScript consumers.