fix(config): avoid dedup collisions for file:// plugins in node_modules#15598
fix(config): avoid dedup collisions for file:// plugins in node_modules#15598cyberprophet wants to merge 2 commits intoanomalyco:devfrom
Conversation
Normalize file:// plugin names from node_modules paths to package names so multiple plugins with index.js entrypoints can co-exist. Adds regression tests for package-name extraction and multi-plugin dedup behavior.
|
The following comment was made by an LLM, it may be inaccurate: I found one potentially related PR: PR #8758: "fix: use full URL for file:// plugin deduplication" This PR appears to address a similar issue with file:// plugin deduplication. It may be related to or a predecessor of the current PR #15598, as both deal with preventing false deduplication collisions for file:// plugins. However, PR #15598 specifically targets the You should verify if PR #8758 is already merged or if the current PR is intended to supersede it. |
Avoid fileURLToPath crashes on Windows for synthetic POSIX-style file URLs used in tests and fallback parsing. Keep node_modules package-name extraction for deduping plugins with index.js entrypoints.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Addressed the automation feedback in this update:
Latest commit: 0ee3a2e |
Issue for this PR
Closes #15591
Related: #10115
Type of change
What does this PR do?
Config.getPluginName()previously identifiedfile://plugins by filename only (e.g.index).When npm plugins are resolved to
.../node_modules/<pkg>/dist/index.js, different plugins collapsed to the same identity and only the last plugin survived deduplication.This PR updates plugin identity extraction to:
node_modulesfile URLs and use package identity (foo,@scope/pkg), not filename identityThis directly matches the reproduction pattern reported in #10115 (order-dependent "only last plugin" behavior).
How did you verify your code works?
bun test test/config/config.test.ts --test-name-pattern "extracts name from file:// URL|prefers local file over npm package with same name|extracts package name from node_modules file:// URL|keeps multiple npm plugins resolved as file:// URLs"✅bun run typecheck✅Also addressed CI feedback:
fileURLToPath()throwing for POSIX-like file URLs in testsScreenshots / recordings
N/A (non-UI change)
Checklist