@@ -2,33 +2,12 @@ var postcss = require("postcss");
2
2
var valueParser = require ( "postcss-value-parser" ) ;
3
3
var Tokenizer = require ( "css-selector-tokenizer" ) ;
4
4
var loaderUtils = require ( "loader-utils" ) ;
5
- var icssUtils = require ( "icss-utils" ) ;
6
5
7
6
module . exports = postcss . plugin ( "css-loader-parser" , function ( options ) {
8
7
return function ( css ) {
9
- var imports = { } ;
10
- var exports = { } ;
11
8
var importItems = [ ] ;
12
9
var urlItems = [ ] ;
13
10
14
- function replaceImportsInString ( str ) {
15
- if ( options . import ) {
16
- var tokens = valueParser ( str ) ;
17
- tokens . walk ( function ( node ) {
18
- if ( node . type !== "word" ) {
19
- return ;
20
- }
21
- var token = node . value ;
22
- var importIndex = imports [ "$" + token ] ;
23
- if ( typeof importIndex === "number" ) {
24
- node . value = "___CSS_LOADER_IMPORT___" + importIndex + "___" ;
25
- }
26
- } ) ;
27
- return tokens . toString ( ) ;
28
- }
29
- return str ;
30
- }
31
-
32
11
if ( options . import ) {
33
12
css . walkAtRules ( / ^ i m p o r t $ / i, function ( rule ) {
34
13
var values = Tokenizer . parseValues ( rule . params ) ;
@@ -56,23 +35,6 @@ module.exports = postcss.plugin("css-loader-parser", function(options) {
56
35
} ) ;
57
36
}
58
37
59
- var icss = icssUtils . extractICSS ( css ) ;
60
- exports = icss . icssExports ;
61
- Object . keys ( icss . icssImports ) . forEach ( function ( key ) {
62
- var url = loaderUtils . parseString ( key ) ;
63
- Object . keys ( icss . icssImports [ key ] ) . forEach ( function ( prop ) {
64
- imports [ "$" + prop ] = importItems . length ;
65
- importItems . push ( {
66
- url : url ,
67
- export : icss . icssImports [ key ] [ prop ]
68
- } ) ;
69
- } ) ;
70
- } ) ;
71
-
72
- Object . keys ( exports ) . forEach ( function ( exportName ) {
73
- exports [ exportName ] = replaceImportsInString ( exports [ exportName ] ) ;
74
- } ) ;
75
-
76
38
function processNode ( item ) {
77
39
switch ( item . type ) {
78
40
case "value" :
@@ -81,12 +43,6 @@ module.exports = postcss.plugin("css-loader-parser", function(options) {
81
43
case "nested-item" :
82
44
item . nodes . forEach ( processNode ) ;
83
45
break ;
84
- case "item" :
85
- var importIndex = imports [ "$" + item . name ] ;
86
- if ( typeof importIndex === "number" ) {
87
- item . name = "___CSS_LOADER_IMPORT___" + importIndex + "___" ;
88
- }
89
- break ;
90
46
case "url" :
91
47
if (
92
48
options . url &&
@@ -116,14 +72,8 @@ module.exports = postcss.plugin("css-loader-parser", function(options) {
116
72
} ) ;
117
73
decl . value = Tokenizer . stringifyValues ( values ) ;
118
74
} ) ;
119
- css . walkAtRules ( function ( atrule ) {
120
- if ( typeof atrule . params === "string" ) {
121
- atrule . params = replaceImportsInString ( atrule . params ) ;
122
- }
123
- } ) ;
124
75
125
76
options . importItems = importItems ;
126
77
options . urlItems = urlItems ;
127
- options . exports = exports ;
128
78
} ;
129
79
} ) ;
0 commit comments