File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -112,8 +112,29 @@ function applyArguments (patterns, args) {
112
112
* @returns {string[] } Parsed patterns.
113
113
*/
114
114
function parsePatterns ( patternOrPatterns , args ) {
115
- const patterns = toArray ( patternOrPatterns )
116
- const hasPlaceholder = patterns . some ( pattern => ARGS_PATTERN . test ( pattern ) )
115
+ let patterns = toArray ( patternOrPatterns )
116
+
117
+ const isNPM = process . env . npm_config_user_agent && process . env . npm_config_user_agent . startsWith ( 'npm' )
118
+
119
+ if ( ! isNPM ) {
120
+ // yarn | pnpm
121
+ patterns = patterns . map ( ( pattern ) => {
122
+ const match = ARGS_PATTERN . exec ( pattern )
123
+
124
+ if ( ! match ) {
125
+ return pattern
126
+ }
127
+
128
+ const patternList = pattern . split ( ' ' )
129
+ const doubleDashIndex = patternList . findIndex ( ( item ) => item === '--' )
130
+ patternList . splice ( doubleDashIndex , 1 )
131
+ pattern = patternList . join ( ' ' )
132
+
133
+ return pattern
134
+ } )
135
+ }
136
+
137
+ const hasPlaceholder = patterns . some ( ( pattern ) => ARGS_PATTERN . test ( pattern ) )
117
138
118
139
return hasPlaceholder ? applyArguments ( patterns , args ) : patterns
119
140
}
You can’t perform that action at this time.
0 commit comments