-
-
Notifications
You must be signed in to change notification settings - Fork 438
chore: trim runtime dependencies — remove enhanced-resolve/semver, swap micromatch → picomatch #1701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: trim runtime dependencies — remove enhanced-resolve/semver, swap micromatch → picomatch #1701
Changes from 2 commits
887b4e8
532b0de
b931e8e
d783fad
65e0876
d2b78c9
633fbe9
619f7f6
b915af5
44d4ac9
ccb0192
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import type { Chalk } from 'chalk'; | ||
| import * as fs from 'fs'; | ||
| import micromatch from 'micromatch'; | ||
| import picomatch from 'picomatch'; | ||
| import * as path from 'path'; | ||
| import * as webpack from 'webpack'; | ||
| import type typescript from 'typescript'; | ||
|
|
@@ -65,11 +65,20 @@ export function formatErrors( | |
| context, | ||
| diagnostic.file.fileName | ||
| ); | ||
| const matchResult = micromatch( | ||
| [relativeFileName], | ||
| loaderOptions.reportFiles | ||
| // Split positive and negative patterns to replicate micromatch semantics: | ||
| // a file must match a positive pattern AND not match any negative pattern. | ||
| const positivePatterns = loaderOptions.reportFiles.filter( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot please replace
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done — replaced the two |
||
| p => !p.startsWith('!') | ||
| ); | ||
| if (matchResult.length === 0) { | ||
| const negativePatterns = loaderOptions.reportFiles | ||
| .filter(p => p.startsWith('!')) | ||
| .map(p => p.slice(1)); | ||
| const matchPos = picomatch( | ||
| positivePatterns.length > 0 ? positivePatterns : ['**'] | ||
| ); | ||
| const matchNeg = | ||
| negativePatterns.length > 0 ? picomatch(negativePatterns) : null; | ||
| if (!matchPos(relativeFileName) || (matchNeg && matchNeg(relativeFileName))) { | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please remove
versionGte(compiler!.version, '3.6.3')test from the if statementThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Removed
versionGte(compiler!.version, '3.6.3')from the condition — the if now simply checkscompiler!.version !== undefined. TheversionGtehelper function was also removed since it had no remaining usages.