1
1
'use strict' ;
2
2
3
- var asyncGenerator = function ( ) {
4
- function AwaitValue ( value ) {
5
- this . value = value ;
6
- }
7
-
8
- function AsyncGenerator ( gen ) {
9
- var front , back ;
10
-
11
- function send ( key , arg ) {
12
- return new Promise ( function ( resolve , reject ) {
13
- var request = {
14
- key : key ,
15
- arg : arg ,
16
- resolve : resolve ,
17
- reject : reject ,
18
- next : null
19
- } ;
20
-
21
- if ( back ) {
22
- back = back . next = request ;
23
- } else {
24
- front = back = request ;
25
- resume ( key , arg ) ;
26
- }
27
- } ) ;
28
- }
29
-
30
- function resume ( key , arg ) {
31
- try {
32
- var result = gen [ key ] ( arg ) ;
33
- var value = result . value ;
34
-
35
- if ( value instanceof AwaitValue ) {
36
- Promise . resolve ( value . value ) . then ( function ( arg ) {
37
- resume ( "next" , arg ) ;
38
- } , function ( arg ) {
39
- resume ( "throw" , arg ) ;
40
- } ) ;
41
- } else {
42
- settle ( result . done ? "return" : "normal" , result . value ) ;
43
- }
44
- } catch ( err ) {
45
- settle ( "throw" , err ) ;
46
- }
47
- }
48
-
49
- function settle ( type , value ) {
50
- switch ( type ) {
51
- case "return" :
52
- front . resolve ( {
53
- value : value ,
54
- done : true
55
- } ) ;
56
- break ;
57
-
58
- case "throw" :
59
- front . reject ( value ) ;
60
- break ;
61
-
62
- default :
63
- front . resolve ( {
64
- value : value ,
65
- done : false
66
- } ) ;
67
- break ;
68
- }
69
-
70
- front = front . next ;
71
-
72
- if ( front ) {
73
- resume ( front . key , front . arg ) ;
74
- } else {
75
- back = null ;
76
- }
77
- }
78
-
79
- this . _invoke = send ;
80
-
81
- if ( typeof gen . return !== "function" ) {
82
- this . return = undefined ;
83
- }
84
- }
85
-
86
- if ( typeof Symbol === "function" && Symbol . asyncIterator ) {
87
- AsyncGenerator . prototype [ Symbol . asyncIterator ] = function ( ) {
88
- return this ;
89
- } ;
90
- }
91
-
92
- AsyncGenerator . prototype . next = function ( arg ) {
93
- return this . _invoke ( "next" , arg ) ;
94
- } ;
95
-
96
- AsyncGenerator . prototype . throw = function ( arg ) {
97
- return this . _invoke ( "throw" , arg ) ;
98
- } ;
99
-
100
- AsyncGenerator . prototype . return = function ( arg ) {
101
- return this . _invoke ( "return" , arg ) ;
102
- } ;
103
-
104
- return {
105
- wrap : function ( fn ) {
106
- return function ( ) {
107
- return new AsyncGenerator ( fn . apply ( this , arguments ) ) ;
108
- } ;
109
- } ,
110
- await : function ( value ) {
111
- return new AwaitValue ( value ) ;
112
- }
113
- } ;
114
- } ( ) ;
115
-
116
3
var classCallCheck = function ( instance , Constructor ) {
117
4
if ( ! ( instance instanceof Constructor ) ) {
118
5
throw new TypeError ( "Cannot call a class as a function" ) ;
@@ -137,6 +24,44 @@ var createClass = function () {
137
24
} ;
138
25
} ( ) ;
139
26
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
140
65
var toArray = function ( arr ) {
141
66
return Array . isArray ( arr ) ? arr : Array . from ( arr ) ;
142
67
} ;
@@ -151,7 +76,8 @@ var defaultOptions = {
151
76
onBuildExit : [ ] ,
152
77
dev : true ,
153
78
verbose : false ,
154
- safe : false
79
+ safe : false ,
80
+ quiet : false
155
81
} ;
156
82
157
83
var WebpackShellPlugin = function ( ) {
@@ -163,7 +89,7 @@ var WebpackShellPlugin = function () {
163
89
164
90
createClass ( WebpackShellPlugin , [ {
165
91
key : 'puts' ,
166
- value : function puts ( error , stdout , stderr ) {
92
+ value : function puts ( error ) {
167
93
if ( error ) {
168
94
throw error ;
169
95
}
@@ -220,13 +146,13 @@ var WebpackShellPlugin = function () {
220
146
}
221
147
} , {
222
148
key : 'mergeOptions' ,
223
- value : function mergeOptions ( options , defaults ) {
224
- for ( var key in defaults ) {
149
+ value : function mergeOptions ( options , defaults$$1 ) {
150
+ for ( var key in defaults$$1 ) {
225
151
if ( options . hasOwnProperty ( key ) ) {
226
- defaults [ key ] = options [ key ] ;
152
+ defaults$$1 [ key ] = options [ key ] ;
227
153
}
228
154
}
229
- return defaults ;
155
+ return defaults$$1 ;
230
156
}
231
157
} , {
232
158
key : 'apply' ,
@@ -235,13 +161,20 @@ var WebpackShellPlugin = function () {
235
161
236
162
compiler . plugin ( 'compilation' , function ( compilation ) {
237
163
if ( _this . options . verbose ) {
238
- console . log ( 'Report compilation: ' + compilation ) ;
239
- console . warn ( 'WebpackShellPlugin [' + new Date ( ) + ']: Verbose is being deprecated, please remove.' ) ;
164
+ if ( ! _this . options . quiet ) {
165
+ console . log ( 'Report compilation: ' + compilation ) ;
166
+ //eslint-disable-next-line
167
+ console . warn ( 'WebpackShellPlugin [' + new Date ( ) + ']: Verbose is being deprecated, please remove.' ) ;
168
+ }
240
169
}
241
170
if ( _this . options . onBuildStart . length ) {
242
- console . log ( 'Executing pre-build scripts' ) ;
243
- for ( var i = 0 ; i < _this . options . onBuildStart . length ; i ++ ) {
244
- _this . handleScript ( _this . options . onBuildStart [ i ] ) ;
171
+ if ( ! _this . options . quiet ) {
172
+ console . log ( 'Executing pre-build scripts' ) ;
173
+ }
174
+ for ( var index = 0 ; index < _this . options . onBuildStart . length ;
175
+ // eslint-disable-next-line
176
+ index += 1 ) {
177
+ _this . handleScript ( _this . options . onBuildStart [ index ] ) ;
245
178
}
246
179
if ( _this . options . dev ) {
247
180
_this . options . onBuildStart = [ ] ;
@@ -251,9 +184,13 @@ var WebpackShellPlugin = function () {
251
184
252
185
compiler . plugin ( 'after-emit' , function ( compilation , callback ) {
253
186
if ( _this . options . onBuildEnd . length ) {
254
- console . log ( 'Executing post-build scripts' ) ;
255
- for ( var i = 0 ; i < _this . options . onBuildEnd . length ; i ++ ) {
256
- _this . handleScript ( _this . options . onBuildEnd [ i ] ) ;
187
+ if ( ! _this . options . quiet ) {
188
+ console . log ( 'Executing post-build scripts' ) ;
189
+ }
190
+ for ( var index = 0 ; index < _this . options . onBuildEnd . length ;
191
+ // eslint-disable-next-line
192
+ index += 1 ) {
193
+ _this . handleScript ( _this . options . onBuildEnd [ index ] ) ;
257
194
}
258
195
if ( _this . options . dev ) {
259
196
_this . options . onBuildEnd = [ ] ;
@@ -264,9 +201,13 @@ var WebpackShellPlugin = function () {
264
201
265
202
compiler . plugin ( 'done' , function ( ) {
266
203
if ( _this . options . onBuildExit . length ) {
267
- console . log ( 'Executing additional scripts before exit' ) ;
268
- for ( var i = 0 ; i < _this . options . onBuildExit . length ; i ++ ) {
269
- _this . handleScript ( _this . options . onBuildExit [ i ] ) ;
204
+ if ( ! _this . options . quiet ) {
205
+ console . log ( 'Executing additional scripts before exit' ) ;
206
+ }
207
+ for ( var index = 0 ; index < _this . options . onBuildExit . length ;
208
+ // eslint-disable-next-line
209
+ index += 1 ) {
210
+ _this . handleScript ( _this . options . onBuildExit [ index ] ) ;
270
211
}
271
212
}
272
213
} ) ;
@@ -275,4 +216,4 @@ var WebpackShellPlugin = function () {
275
216
return WebpackShellPlugin ;
276
217
} ( ) ;
277
218
278
- module . exports = WebpackShellPlugin ;
219
+ module . exports = WebpackShellPlugin ;
0 commit comments