@@ -17,6 +17,13 @@ import watch from './watch';
17
17
import { isRegExp } from '../utils/is' ;
18
18
import { ABORTED } from '../utils/signals' ;
19
19
20
+ // TODO remove this in a future version
21
+ function enforceCorrectArguments ( options ) {
22
+ if ( options !== undefined && typeof options !== 'object' ) {
23
+ throw new Error ( 'As of gobble 0.9.0, you cannot pass multiple strings to .grab() and .moveTo(). Use path.join() instead' ) ;
24
+ }
25
+ }
26
+
20
27
export default class Node extends EventEmitter2 {
21
28
constructor ( ) {
22
29
this . _gobble = true ; // makes life easier for e.g. gobble-cli
@@ -109,9 +116,9 @@ export default class Node extends EventEmitter2 {
109
116
return watchTask ;
110
117
}
111
118
112
- exclude ( patterns ) {
119
+ exclude ( patterns , options ) {
113
120
if ( typeof patterns === 'string' ) { patterns = [ patterns ] ; }
114
- return new Transformer ( this , include , { patterns, exclude : true } ) ;
121
+ return new Transformer ( this , include , { patterns, exclude : true , id : options && options . id } ) ;
115
122
}
116
123
117
124
getChanges ( inputdir ) {
@@ -147,15 +154,15 @@ export default class Node extends EventEmitter2 {
147
154
return added . concat ( removed ) . concat ( changed ) ;
148
155
}
149
156
150
- grab ( ) {
151
- const src = join . apply ( null , arguments ) ;
152
- return new Transformer ( this , grab , { src } ) ;
157
+ grab ( src , options ) {
158
+ enforceCorrectArguments ( options ) ;
159
+ return new Transformer ( this , grab , { src, id : options && options . id } ) ;
153
160
}
154
161
155
162
// Built-in transformers
156
- include ( patterns ) {
163
+ include ( patterns , options ) {
157
164
if ( typeof patterns === 'string' ) { patterns = [ patterns ] ; }
158
- return new Transformer ( this , include , { patterns } ) ;
165
+ return new Transformer ( this , include , { patterns, id : options && options . id } ) ;
159
166
}
160
167
161
168
inspect ( target , options ) {
@@ -174,9 +181,9 @@ export default class Node extends EventEmitter2 {
174
181
return this . transform ( fn , userOptions ) ;
175
182
}
176
183
177
- moveTo ( ) {
178
- const dest = join . apply ( null , arguments ) ;
179
- return new Transformer ( this , move , { dest } ) ;
184
+ moveTo ( dest , options ) {
185
+ enforceCorrectArguments ( options ) ;
186
+ return new Transformer ( this , move , { dest, id : options && options . id } ) ;
180
187
}
181
188
182
189
observe ( fn , userOptions ) {
0 commit comments