feat: add cleaning cache for plugin files#2732
Conversation
🦋 Changeset detectedLatest commit: cd8b914 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1775733825 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1775733825
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1775733825
# or
npm install @redocly/respect-core@0.0.0-snapshot.1775733825 |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1775739903 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1775739903
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1775739903
# or
npm install @redocly/respect-core@0.0.0-snapshot.1775739903 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1775814315 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1775814315
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1775814315
# or
npm install @redocly/respect-core@0.0.0-snapshot.1775814315 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1775819371 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1775819371
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1775819371
# or
npm install @redocly/respect-core@0.0.0-snapshot.1775819371 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1776082389 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1776082389
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1776082389
# or
npm install @redocly/respect-core@0.0.0-snapshot.1776082389 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1776085657 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1776085657
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1776085657
# or
npm install @redocly/respect-core@0.0.0-snapshot.1776085657 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1776087574 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1776087574
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1776087574
# or
npm install @redocly/respect-core@0.0.0-snapshot.1776087574 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1777472433 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1777472433
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1777472433
# or
npm install @redocly/respect-core@0.0.0-snapshot.1777472433 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1777474661 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1777474661
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1777474661
# or
npm install @redocly/respect-core@0.0.0-snapshot.1777474661 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1778237731 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1778237731
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1778237731
# or
npm install @redocly/respect-core@0.0.0-snapshot.1778237731 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1778250423 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1778250423
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1778250423
# or
npm install @redocly/respect-core@0.0.0-snapshot.1778250423 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1778253852 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1778253852
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1778253852
# or
npm install @redocly/respect-core@0.0.0-snapshot.1778253852 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1778327478 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1778327478
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1778327478
# or
npm install @redocly/respect-core@0.0.0-snapshot.1778327478 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1778335458 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1778335458
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1778335458
# or
npm install @redocly/respect-core@0.0.0-snapshot.1778335458 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1778501698 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1778501698
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1778501698
# or
npm install @redocly/respect-core@0.0.0-snapshot.1778501698 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1778506313 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1778506313
# or
npm install @redocly/openapi-core@0.0.0-snapshot.1778506313
# or
npm install @redocly/respect-core@0.0.0-snapshot.1778506313 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cd8b914. Configure here.
| export async function loadPluginModule( | ||
| absolutePluginPath: string | ||
| ): Promise<Record<string, unknown>> { | ||
| ensureEsmCacheBustHook(); |
There was a problem hiding this comment.
Misleading warning emitted on every first plugin load
Medium Severity
loadPluginModule calls ensureEsmCacheBustHook() on every first plugin load. On Node < 22.15, this emits a warning about ESM plugin reload not working — even for CLI users who never call clearPluginsCache, and for CJS-only plugin setups where cache clearing works fine without the hook. The hook is only needed after clearPluginsCache is called, since initial loads (with ?v=0) don't require version propagation to children. Moving the call exclusively to clearPluginsCache would avoid the spurious warning.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit cd8b914. Configure here.


What/Why/How?
In VSCE, we have a problem with clean cache for plugin files. This PR adds cleaning the general cache for plugin files, cjs files, and esm files.
__webpack_require__Reference
Issue Redocly/redocly-vs-code#10
VSCE Part https://github.com/Redocly/redocly/pull/22293
Testing
Tested in VSCE part
Screenshots (optional)
Check yourself
Security
Note
Medium Risk
Changes plugin loading and caching behavior, including new cache eviction logic and Node loader-hook usage for ESM reloads, which could affect plugin resolution/reload semantics across Node versions.
Overview
Adds a dedicated plugin cache layer with
clearPluginsCache()andgetPluginCacheVersion()to support reloading plugin code within a running process.resolvePluginsnow delegates all plugin module loading/caching toplugins-cache.ts, removing the legacy__webpack_require__path and enabling targeted CJSrequire.cacheeviction plus ESM cache-busting via a versionedfile:URL (with a Node >=22.15 loader-hook warning when unavailable).Updates and adds tests/fixtures to validate cache stability, explicit cache clearing for both CJS/ESM, and that eviction does not remove unrelated modules.
Reviewed by Cursor Bugbot for commit cd8b914. Bugbot is set up for automated code reviews on this repo. Configure here.