You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 74dd5f0
Browse filesBrowse the repository at this point in the historyBrowse files
fix(dependencies): preserve wrappedContextRegExp flags in context matcher (#22303)
* fix(dependencies): preserve wrappedContextRegExp flags in context matcher
The wrapped-request branches of ContextDependencyHelpers rebuilt the
matcher from wrappedContextRegExp.source only, dropping the user's
i/m/s/u flags, while the fallback path passed the RegExp object intact.
So module.parser.javascript.wrappedContextRegExp: /\.jsx?$/i silently
became case-sensitive. Reuse the flags (minus stateful g/y) when
rebuilding the RegExp.
Signed-off-by: Eshiv Pandey <[email protected]>
* fix(dependencies): keep context matcher valid under Unicode flags
Preserving the user's `wrappedContextRegExp` flags means `u`/`v` can now
reach the rebuilt matcher. `quoteMeta` escaped `-` as `\-`, which is an
invalid escape outside a character class in Unicode mode, so a request
with a literal `-` in its static prefix or postfix (for example
importing a template literal like ./dir/module-${x}.js) threw and
aborted the build. `-` is a literal outside `[...]` and the quoted
string is only ever concatenated between anchors, so leave it unescaped.
Covers both the wrapped-context (template-literal) and wrapped-expression
(concatenation) paths with Unicode-mode, hyphen-in-prefix cases.
Signed-off-by: Eshiv Pandey <[email protected]>
* test(dependencies): trim wrapped-context-regexp-flags comment to 3 lines
Signed-off-by: Eshiv Pandey <[email protected]>
---------
Signed-off-by: Eshiv Pandey <[email protected]>
0 commit comments