@@ -17,6 +17,7 @@ var Config = require('./Config.js'),
17
17
ExtractTextPlugin = require ( 'extract-text-webpack-plugin' ) ;
18
18
19
19
var UtilFs = require ( '../utils/fs.js' ) ;
20
+ var UtilPath = require ( '../utils/path.js' ) ;
20
21
21
22
var ENVS = {
22
23
LOCAL : 'local' ,
@@ -196,8 +197,6 @@ var Project = function () {
196
197
} , {
197
198
key : 'fixCss' ,
198
199
value : function fixCss ( ) {
199
- var _this2 = this ;
200
-
201
200
var config = this . config . getConfig ( ) ,
202
201
entries = config . entry ,
203
202
cssExtNames = config . entryExtNames . css ,
@@ -233,12 +232,12 @@ var Project = function () {
233
232
234
233
entryItem . forEach ( function ( cssPath ) {
235
234
var originCssPath = sysPath . join ( config . context , cssPath ) ;
236
- var requiredPath = _this2 . _normalizePath ( sysPath . relative ( sysPath . dirname ( cacheFilePath ) , originCssPath ) ) ;
235
+ var requiredPath = UtilPath . normalize ( sysPath . relative ( sysPath . dirname ( cacheFilePath ) , originCssPath ) ) ;
237
236
fs . appendFileSync ( cacheFilePath , 'require("' + requiredPath + '");' , 'utf-8' ) ;
238
237
} ) ;
239
238
} else {
240
239
var originCssPath = sysPath . join ( config . context , entry ) ;
241
- var requiredPath = _this2 . _normalizePath ( sysPath . relative ( sysPath . dirname ( cacheFilePath ) , originCssPath ) ) ;
240
+ var requiredPath = UtilPath . normalize ( sysPath . relative ( sysPath . dirname ( cacheFilePath ) , originCssPath ) ) ;
242
241
fs . writeFileSync ( cacheFilePath , 'require("' + requiredPath + '");' , 'utf-8' ) ;
243
242
}
244
243
@@ -251,7 +250,7 @@ var Project = function () {
251
250
} , {
252
251
key : 'lint' ,
253
252
value : function lint ( dir , callback ) {
254
- var _this3 = this ;
253
+ var _this2 = this ;
255
254
256
255
warn ( 'Linting JS Files ...' ) ;
257
256
@@ -263,7 +262,7 @@ var Project = function () {
263
262
}
264
263
265
264
var files = [ '.js' , '.yaml' , '.yml' , '.json' , '' ] . map ( function ( ext ) {
266
- return path . join ( _this3 . cwd , '.eslintrc' + ext ) ;
265
+ return path . join ( _this2 . cwd , '.eslintrc' + ext ) ;
267
266
} ) ;
268
267
var config = UtilFs . readFileAny ( files ) ;
269
268
@@ -288,7 +287,7 @@ var Project = function () {
288
287
} , {
289
288
key : 'pack' ,
290
289
value : function pack ( opt , callback ) {
291
- var _this4 = this ;
290
+ var _this3 = this ;
292
291
293
292
var config = this . config . getConfig ( ) ;
294
293
UtilFs . deleteFolderRecursive ( this . cachePath ) ;
@@ -322,7 +321,7 @@ var Project = function () {
322
321
config . output = config . output . dev ;
323
322
}
324
323
325
- _this4 . fixCss ( ) ;
324
+ _this3 . fixCss ( ) ;
326
325
327
326
if ( opt . clean ) {
328
327
try {
@@ -369,7 +368,7 @@ var Project = function () {
369
368
}
370
369
} ) ;
371
370
info ( ) ;
372
- _this4 . packCallbacks . forEach ( function ( cb ) {
371
+ _this3 . packCallbacks . forEach ( function ( cb ) {
373
372
return cb ( opt , stats ) ;
374
373
} ) ;
375
374
}
@@ -380,7 +379,7 @@ var Project = function () {
380
379
381
380
if ( opt . lint ) {
382
381
async . series ( [ function ( callback ) {
383
- return _this4 . lint ( callback ) ;
382
+ return _this3 . lint ( callback ) ;
384
383
} ] , function ( err , results ) {
385
384
if ( ! err ) {
386
385
if ( results [ 0 ] && results [ 1 ] ) {
@@ -440,18 +439,6 @@ var Project = function () {
440
439
return sysPath . resolve ( context , lintPathItem ) ;
441
440
} ) ;
442
441
}
443
- } , {
444
- key : '_normalizePath' ,
445
- value : function _normalizePath ( str , stripTrailing ) {
446
- if ( typeof str !== 'string' ) {
447
- throw new TypeError ( 'expected a string' ) ;
448
- }
449
- str = str . replace ( / [ \\ \/ ] + / g, '/' ) ;
450
- if ( stripTrailing !== false ) {
451
- str = str . replace ( / \/ $ / , '' ) ;
452
- }
453
- return str ;
454
- }
455
442
} , {
456
443
key : '_requireUncached' ,
457
444
value : function _requireUncached ( module ) {
0 commit comments