@@ -311,30 +311,6 @@ function escapeLocalIdent(localident) {
311
311
) ;
312
312
}
313
313
314
- function resolveFolderTemplate ( loaderContext , localIdentName , options ) {
315
- const { context } = options ;
316
- let { resourcePath } = loaderContext ;
317
- const parsed = path . parse ( loaderContext . resourcePath ) ;
318
-
319
- if ( parsed . dir ) {
320
- resourcePath = parsed . dir + path . sep ;
321
- }
322
-
323
- let directory = path
324
- . relative ( context , `${ resourcePath } _` )
325
- . replace ( / \\ / g, "/" )
326
- . replace ( / \. \. ( \/ ) ? / g, "_$1" ) ;
327
- directory = directory . substr ( 0 , directory . length - 1 ) ;
328
-
329
- let folder = "" ;
330
-
331
- if ( directory . length > 1 ) {
332
- folder = path . basename ( directory ) ;
333
- }
334
-
335
- return localIdentName . replace ( / \[ f o l d e r \] / gi, ( ) => folder ) ;
336
- }
337
-
338
314
function defaultGetLocalIdent (
339
315
loaderContext ,
340
316
localIdentName ,
@@ -396,10 +372,10 @@ function defaultGetLocalIdent(
396
372
. replace ( / [ / + ] / g, "_" )
397
373
. replace ( / ^ \d / g, "_" ) ;
398
374
375
+ // TODO need improve on webpack side, we should allow to pass hash/contentHash without chunk property
399
376
const ext = path . extname ( loaderContext . resourcePath ) ;
400
377
const base = path . basename ( loaderContext . resourcePath ) ;
401
378
const name = base . slice ( 0 , base . length - ext . length ) ;
402
-
403
379
const data = {
404
380
filename : path . relative ( options . context , loaderContext . resourcePath ) ,
405
381
contentHash : localIdentHash ,
@@ -411,20 +387,7 @@ function defaultGetLocalIdent(
411
387
} ;
412
388
413
389
// eslint-disable-next-line no-underscore-dangle
414
- let interpolatedFilename = loaderContext . _compilation . getPath (
415
- localIdentName ,
416
- data
417
- ) ;
418
-
419
- if ( localIdentName . includes ( "[folder]" ) ) {
420
- interpolatedFilename = resolveFolderTemplate (
421
- loaderContext ,
422
- interpolatedFilename ,
423
- options
424
- ) ;
425
- }
426
-
427
- return interpolatedFilename ;
390
+ return loaderContext . _compilation . getPath ( localIdentName , data ) ;
428
391
}
429
392
430
393
const NATIVE_WIN32_PATH = / ^ [ A - Z ] : [ / \\ ] | ^ \\ \\ / i;
@@ -609,18 +572,6 @@ function getModulesOptions(rawOptions, loaderContext) {
609
572
}
610
573
}
611
574
612
- if ( / \[ e m o j i (?: : ( \d + ) ) ? \] / i. test ( modulesOptions . localIdentName ) ) {
613
- loaderContext . emitWarning (
614
- "Emoji is deprecated and will be removed in next major release."
615
- ) ;
616
- }
617
-
618
- if ( modulesOptions . localIdentName . includes ( "[folder]" ) ) {
619
- loaderContext . emitWarning (
620
- "[folder] is deprecated and will be removed in next major release. See documentation for available options (https://github.com/webpack-contrib/css-loader#localidentname)"
621
- ) ;
622
- }
623
-
624
575
return modulesOptions ;
625
576
}
626
577
0 commit comments