fix(lib/getpluginname): preserve hyphenated anonymous plugin names - #303
fix(lib/getpluginname): preserve hyphenated anonymous plugin names#303lprnmns wants to merge 3 commits into
Conversation
Signed-off-by: lprnmns <manasalperen@gmail.com>
There was a problem hiding this comment.
🟢 Approval recommended
The parser correction is focused, backward-compatible with covered formats, and adequately tested.
Pull request overview
Fixes anonymous plugin-name extraction for hyphenated filenames while preserving existing dotted and Windows path behavior.
Changes:
- Reworks filename parsing to strip location suffixes and extensions.
- Adds regression coverage for
my-plugin.js.
File summaries
| File | Description |
|---|---|
lib/getPluginName.js |
Corrects basename extraction for hyphenated filenames. |
test/extractPluginName.test.js |
Adds the hyphenated-filename regression test. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Fdawgs
left a comment
There was a problem hiding this comment.
Thanks for the PR, there's probably a nicer way of doing this using node:path's basename?
…ed-plugin-name-20260830 Signed-off-by: lprnmns <manasalperen@gmail.com> # Conflicts: # lib/getPluginName.js
|
Updated as suggested: the extractor now uses |
Signed-off-by: lprnmns <manasalperen@gmail.com>
Problem
Anonymous plugins called from a hyphenated filename such as my-plugin.js are auto-named plugin-auto-N instead of my-plugin-auto-N. The filename parser only permits word characters and dots, so the valid basename is truncated.
Fix
Extract the complete basename from the stack frame, then remove only the line/column suffix and final extension. Existing dotted and Windows-style filename behavior remains covered.
Tests
Compatibility
This is a narrow parser correction with no public signature change. Existing dotted, Windows-style, no-match, explicit-name, and type-level paths were validated; no lockfile or generated files changed.
Related issue
Independent current reproduction; no open issue or competing PR was found. Historical issue #38 / PR #41 addressed dotted and TypeScript filename parsing; this change covers the remaining hyphenated basename case.