css-loader 0.25.0 → 0.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +289 -101
- package/index.js +5 -5
- package/lib/compile-exports.js +38 -29
- package/lib/css-base.js +50 -50
- package/lib/getImportPrefix.js +14 -14
- package/lib/getLocalIdent.js +16 -16
- package/lib/loader.js +119 -124
- package/lib/localsLoader.js +46 -46
- package/lib/processCss.js +252 -251
- package/locals.js +5 -5
- package/package.json +20 -12
- package/.eslintrc +0 -10
- package/.npmignore +0 -3
- package/.travis.yml +0 -12
package/lib/css-base.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
// css base code, injected by the css-loader
|
|
6
|
-
module.exports = function() {
|
|
7
|
-
var list = [];
|
|
8
|
-
|
|
9
|
-
// return the list of modules as css string
|
|
10
|
-
list.toString = function toString() {
|
|
11
|
-
var result = [];
|
|
12
|
-
for(var i = 0; i < this.length; i++) {
|
|
13
|
-
var item = this[i];
|
|
14
|
-
if(item[2]) {
|
|
15
|
-
result.push("@media " + item[2] + "{" + item[1] + "}");
|
|
16
|
-
} else {
|
|
17
|
-
result.push(item[1]);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return result.join("");
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// import a list of modules into the list
|
|
24
|
-
list.i = function(modules, mediaQuery) {
|
|
25
|
-
if(typeof modules === "string")
|
|
26
|
-
modules = [[null, modules, ""]];
|
|
27
|
-
var alreadyImportedModules = {};
|
|
28
|
-
for(var i = 0; i < this.length; i++) {
|
|
29
|
-
var id = this[i][0];
|
|
30
|
-
if(typeof id === "number")
|
|
31
|
-
alreadyImportedModules[id] = true;
|
|
32
|
-
}
|
|
33
|
-
for(i = 0; i < modules.length; i++) {
|
|
34
|
-
var item = modules[i];
|
|
35
|
-
// skip already imported module
|
|
36
|
-
// this implementation is not 100% perfect for weird media query combinations
|
|
37
|
-
// when a module is imported multiple times with different media queries.
|
|
38
|
-
// I hope this will never occur (Hey this way we have smaller bundles)
|
|
39
|
-
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
|
|
40
|
-
if(mediaQuery && !item[2]) {
|
|
41
|
-
item[2] = mediaQuery;
|
|
42
|
-
} else if(mediaQuery) {
|
|
43
|
-
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
|
|
44
|
-
}
|
|
45
|
-
list.push(item);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
return list;
|
|
50
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
// css base code, injected by the css-loader
|
|
6
|
+
module.exports = function() {
|
|
7
|
+
var list = [];
|
|
8
|
+
|
|
9
|
+
// return the list of modules as css string
|
|
10
|
+
list.toString = function toString() {
|
|
11
|
+
var result = [];
|
|
12
|
+
for(var i = 0; i < this.length; i++) {
|
|
13
|
+
var item = this[i];
|
|
14
|
+
if(item[2]) {
|
|
15
|
+
result.push("@media " + item[2] + "{" + item[1] + "}");
|
|
16
|
+
} else {
|
|
17
|
+
result.push(item[1]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return result.join("");
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// import a list of modules into the list
|
|
24
|
+
list.i = function(modules, mediaQuery) {
|
|
25
|
+
if(typeof modules === "string")
|
|
26
|
+
modules = [[null, modules, ""]];
|
|
27
|
+
var alreadyImportedModules = {};
|
|
28
|
+
for(var i = 0; i < this.length; i++) {
|
|
29
|
+
var id = this[i][0];
|
|
30
|
+
if(typeof id === "number")
|
|
31
|
+
alreadyImportedModules[id] = true;
|
|
32
|
+
}
|
|
33
|
+
for(i = 0; i < modules.length; i++) {
|
|
34
|
+
var item = modules[i];
|
|
35
|
+
// skip already imported module
|
|
36
|
+
// this implementation is not 100% perfect for weird media query combinations
|
|
37
|
+
// when a module is imported multiple times with different media queries.
|
|
38
|
+
// I hope this will never occur (Hey this way we have smaller bundles)
|
|
39
|
+
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
|
|
40
|
+
if(mediaQuery && !item[2]) {
|
|
41
|
+
item[2] = mediaQuery;
|
|
42
|
+
} else if(mediaQuery) {
|
|
43
|
+
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
|
|
44
|
+
}
|
|
45
|
+
list.push(item);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return list;
|
|
50
|
+
};
|
package/lib/getImportPrefix.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
module.exports = function getImportPrefix(loaderContext, query) {
|
|
6
|
-
if(query.importLoaders === false)
|
|
7
|
-
return "";
|
|
8
|
-
var importLoaders = parseInt(query.importLoaders, 10) || 0;
|
|
9
|
-
var loadersRequest = loaderContext.loaders.slice(
|
|
10
|
-
loaderContext.loaderIndex,
|
|
11
|
-
loaderContext.loaderIndex + 1 + importLoaders
|
|
12
|
-
).map(function(x) { return x.request; }).join("!");
|
|
13
|
-
return "-!" + loadersRequest + "!";
|
|
14
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
module.exports = function getImportPrefix(loaderContext, query) {
|
|
6
|
+
if(query.importLoaders === false)
|
|
7
|
+
return "";
|
|
8
|
+
var importLoaders = parseInt(query.importLoaders, 10) || 0;
|
|
9
|
+
var loadersRequest = loaderContext.loaders.slice(
|
|
10
|
+
loaderContext.loaderIndex,
|
|
11
|
+
loaderContext.loaderIndex + 1 + importLoaders
|
|
12
|
+
).map(function(x) { return x.request; }).join("!");
|
|
13
|
+
return "-!" + loadersRequest + "!";
|
|
14
|
+
};
|
package/lib/getLocalIdent.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
var loaderUtils = require("loader-utils");
|
|
6
|
-
var path = require("path");
|
|
7
|
-
|
|
8
|
-
module.exports = function getLocalIdent(loaderContext, localIdentName, localName, options) {
|
|
9
|
-
if(!options.context)
|
|
10
|
-
options.context = loaderContext.options && typeof loaderContext.options.context === "string" ? loaderContext.options.context : loaderContext.context;
|
|
11
|
-
var request = path.relative(options.context, loaderContext.resourcePath);
|
|
12
|
-
options.content = options.hashPrefix + request + "+" + localName;
|
|
13
|
-
localIdentName = localIdentName.replace(/\[local\]/gi, localName);
|
|
14
|
-
var hash = loaderUtils.interpolateName(loaderContext, localIdentName, options);
|
|
15
|
-
return hash.replace(new RegExp("[^a-zA-Z0-9\\-_\u00A0-\uFFFF]", "g"), "-").replace(/^((-?[0-9])|--)/, "_$1");
|
|
16
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
var loaderUtils = require("loader-utils");
|
|
6
|
+
var path = require("path");
|
|
7
|
+
|
|
8
|
+
module.exports = function getLocalIdent(loaderContext, localIdentName, localName, options) {
|
|
9
|
+
if(!options.context)
|
|
10
|
+
options.context = loaderContext.options && typeof loaderContext.options.context === "string" ? loaderContext.options.context : loaderContext.context;
|
|
11
|
+
var request = path.relative(options.context, loaderContext.resourcePath);
|
|
12
|
+
options.content = options.hashPrefix + request + "+" + localName;
|
|
13
|
+
localIdentName = localIdentName.replace(/\[local\]/gi, localName);
|
|
14
|
+
var hash = loaderUtils.interpolateName(loaderContext, localIdentName, options);
|
|
15
|
+
return hash.replace(new RegExp("[^a-zA-Z0-9\\-_\u00A0-\uFFFF]", "g"), "-").replace(/^((-?[0-9])|--)/, "_$1");
|
|
16
|
+
};
|
package/lib/loader.js
CHANGED
|
@@ -1,124 +1,119 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
JSON.stringify(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var
|
|
60
|
-
var
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var
|
|
71
|
-
var
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
idx = url.indexOf("
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
urlRequest
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
map
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
moduleJs + "\n\n" +
|
|
121
|
-
"// exports\n" +
|
|
122
|
-
exportJs);
|
|
123
|
-
}.bind(this));
|
|
124
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
var loaderUtils = require("loader-utils");
|
|
6
|
+
var processCss = require("./processCss");
|
|
7
|
+
var getImportPrefix = require("./getImportPrefix");
|
|
8
|
+
var compileExports = require("./compile-exports");
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
module.exports = function(content, map) {
|
|
12
|
+
if(this.cacheable) this.cacheable();
|
|
13
|
+
var callback = this.async();
|
|
14
|
+
var query = loaderUtils.getOptions(this) || {};
|
|
15
|
+
var root = query.root;
|
|
16
|
+
var moduleMode = query.modules || query.module;
|
|
17
|
+
var camelCaseKeys = query.camelCase || query.camelcase;
|
|
18
|
+
|
|
19
|
+
if(map !== null && typeof map !== "string") {
|
|
20
|
+
map = JSON.stringify(map);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
processCss(content, map, {
|
|
24
|
+
mode: moduleMode ? "local" : "global",
|
|
25
|
+
from: loaderUtils.getRemainingRequest(this),
|
|
26
|
+
to: loaderUtils.getCurrentRequest(this),
|
|
27
|
+
query: query,
|
|
28
|
+
minimize: this.minimize,
|
|
29
|
+
loaderContext: this
|
|
30
|
+
}, function(err, result) {
|
|
31
|
+
if(err) return callback(err);
|
|
32
|
+
|
|
33
|
+
var cssAsString = JSON.stringify(result.source);
|
|
34
|
+
|
|
35
|
+
// for importing CSS
|
|
36
|
+
var importUrlPrefix = getImportPrefix(this, query);
|
|
37
|
+
|
|
38
|
+
var alreadyImported = {};
|
|
39
|
+
var importJs = result.importItems.filter(function(imp) {
|
|
40
|
+
if(!imp.mediaQuery) {
|
|
41
|
+
if(alreadyImported[imp.url])
|
|
42
|
+
return false;
|
|
43
|
+
alreadyImported[imp.url] = true;
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}).map(function(imp) {
|
|
47
|
+
if(!loaderUtils.isUrlRequest(imp.url, root)) {
|
|
48
|
+
return "exports.push([module.id, " +
|
|
49
|
+
JSON.stringify("@import url(" + imp.url + ");") + ", " +
|
|
50
|
+
JSON.stringify(imp.mediaQuery) + "]);";
|
|
51
|
+
} else {
|
|
52
|
+
var importUrl = importUrlPrefix + imp.url;
|
|
53
|
+
return "exports.i(require(" + loaderUtils.stringifyRequest(this, importUrl) + "), " + JSON.stringify(imp.mediaQuery) + ");";
|
|
54
|
+
}
|
|
55
|
+
}, this).join("\n");
|
|
56
|
+
|
|
57
|
+
function importItemMatcher(item) {
|
|
58
|
+
var match = result.importItemRegExp.exec(item);
|
|
59
|
+
var idx = +match[1];
|
|
60
|
+
var importItem = result.importItems[idx];
|
|
61
|
+
var importUrl = importUrlPrefix + importItem.url;
|
|
62
|
+
return "\" + require(" + loaderUtils.stringifyRequest(this, importUrl) + ").locals" +
|
|
63
|
+
"[" + JSON.stringify(importItem.export) + "] + \"";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
cssAsString = cssAsString.replace(result.importItemRegExpG, importItemMatcher.bind(this));
|
|
67
|
+
if(query.url !== false) {
|
|
68
|
+
cssAsString = cssAsString.replace(result.urlItemRegExpG, function(item) {
|
|
69
|
+
var match = result.urlItemRegExp.exec(item);
|
|
70
|
+
var idx = +match[1];
|
|
71
|
+
var urlItem = result.urlItems[idx];
|
|
72
|
+
var url = urlItem.url;
|
|
73
|
+
idx = url.indexOf("?#");
|
|
74
|
+
if(idx < 0) idx = url.indexOf("#");
|
|
75
|
+
var urlRequest;
|
|
76
|
+
if(idx > 0) { // idx === 0 is catched by isUrlRequest
|
|
77
|
+
// in cases like url('webfont.eot?#iefix')
|
|
78
|
+
urlRequest = url.substr(0, idx);
|
|
79
|
+
return "\" + require(" + loaderUtils.stringifyRequest(this, urlRequest) + ") + \"" +
|
|
80
|
+
url.substr(idx);
|
|
81
|
+
}
|
|
82
|
+
urlRequest = url;
|
|
83
|
+
return "\" + require(" + loaderUtils.stringifyRequest(this, urlRequest) + ") + \"";
|
|
84
|
+
}.bind(this));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
var exportJs = compileExports(result, importItemMatcher.bind(this), camelCaseKeys);
|
|
89
|
+
if (exportJs) {
|
|
90
|
+
exportJs = "exports.locals = " + exportJs + ";";
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
var moduleJs;
|
|
94
|
+
if(query.sourceMap && result.map) {
|
|
95
|
+
// add a SourceMap
|
|
96
|
+
map = result.map;
|
|
97
|
+
if(map.sources) {
|
|
98
|
+
map.sources = map.sources.map(function(source) {
|
|
99
|
+
return source.split("!").pop();
|
|
100
|
+
}, this);
|
|
101
|
+
map.sourceRoot = "";
|
|
102
|
+
}
|
|
103
|
+
map.file = map.file.split("!").pop();
|
|
104
|
+
map = JSON.stringify(map);
|
|
105
|
+
moduleJs = "exports.push([module.id, " + cssAsString + ", \"\", " + map + "]);";
|
|
106
|
+
} else {
|
|
107
|
+
moduleJs = "exports.push([module.id, " + cssAsString + ", \"\"]);";
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// embed runtime
|
|
111
|
+
callback(null, "exports = module.exports = require(" + loaderUtils.stringifyRequest(this, require.resolve("./css-base.js")) + ")();\n" +
|
|
112
|
+
"// imports\n" +
|
|
113
|
+
importJs + "\n\n" +
|
|
114
|
+
"// module\n" +
|
|
115
|
+
moduleJs + "\n\n" +
|
|
116
|
+
"// exports\n" +
|
|
117
|
+
exportJs);
|
|
118
|
+
}.bind(this));
|
|
119
|
+
};
|
package/lib/localsLoader.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
var loaderUtils = require("loader-utils");
|
|
6
|
-
var processCss = require("./processCss");
|
|
7
|
-
var getImportPrefix = require("./getImportPrefix");
|
|
8
|
-
var compileExports = require("./compile-exports");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
module.exports = function(content) {
|
|
12
|
-
if(this.cacheable) this.cacheable();
|
|
13
|
-
var callback = this.async();
|
|
14
|
-
var query = loaderUtils.
|
|
15
|
-
var moduleMode = query.modules || query.module;
|
|
16
|
-
var camelCaseKeys = query.camelCase || query.camelcase;
|
|
17
|
-
|
|
18
|
-
processCss(content, null, {
|
|
19
|
-
mode: moduleMode ? "local" : "global",
|
|
20
|
-
query: query,
|
|
21
|
-
minimize: this.minimize,
|
|
22
|
-
loaderContext: this
|
|
23
|
-
}, function(err, result) {
|
|
24
|
-
if(err) return callback(err);
|
|
25
|
-
|
|
26
|
-
// for importing CSS
|
|
27
|
-
var importUrlPrefix = getImportPrefix(this, query);
|
|
28
|
-
|
|
29
|
-
function importItemMatcher(item) {
|
|
30
|
-
var match = result.importItemRegExp.exec(item);
|
|
31
|
-
var idx = +match[1];
|
|
32
|
-
var importItem = result.importItems[idx];
|
|
33
|
-
var importUrl = importUrlPrefix + importItem.url;
|
|
34
|
-
return "\" + require(" + loaderUtils.stringifyRequest(this, importUrl) + ")" +
|
|
35
|
-
"[" + JSON.stringify(importItem.export) + "] + \"";
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var exportJs = compileExports(result, importItemMatcher.bind(this), camelCaseKeys);
|
|
39
|
-
if (exportJs) {
|
|
40
|
-
exportJs = "module.exports = " + exportJs + ";";
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
callback(null, exportJs);
|
|
45
|
-
}.bind(this));
|
|
46
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
var loaderUtils = require("loader-utils");
|
|
6
|
+
var processCss = require("./processCss");
|
|
7
|
+
var getImportPrefix = require("./getImportPrefix");
|
|
8
|
+
var compileExports = require("./compile-exports");
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
module.exports = function(content) {
|
|
12
|
+
if(this.cacheable) this.cacheable();
|
|
13
|
+
var callback = this.async();
|
|
14
|
+
var query = loaderUtils.getOptions(this) || {};
|
|
15
|
+
var moduleMode = query.modules || query.module;
|
|
16
|
+
var camelCaseKeys = query.camelCase || query.camelcase;
|
|
17
|
+
|
|
18
|
+
processCss(content, null, {
|
|
19
|
+
mode: moduleMode ? "local" : "global",
|
|
20
|
+
query: query,
|
|
21
|
+
minimize: this.minimize,
|
|
22
|
+
loaderContext: this
|
|
23
|
+
}, function(err, result) {
|
|
24
|
+
if(err) return callback(err);
|
|
25
|
+
|
|
26
|
+
// for importing CSS
|
|
27
|
+
var importUrlPrefix = getImportPrefix(this, query);
|
|
28
|
+
|
|
29
|
+
function importItemMatcher(item) {
|
|
30
|
+
var match = result.importItemRegExp.exec(item);
|
|
31
|
+
var idx = +match[1];
|
|
32
|
+
var importItem = result.importItems[idx];
|
|
33
|
+
var importUrl = importUrlPrefix + importItem.url;
|
|
34
|
+
return "\" + require(" + loaderUtils.stringifyRequest(this, importUrl) + ")" +
|
|
35
|
+
"[" + JSON.stringify(importItem.export) + "] + \"";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var exportJs = compileExports(result, importItemMatcher.bind(this), camelCaseKeys);
|
|
39
|
+
if (exportJs) {
|
|
40
|
+
exportJs = "module.exports = " + exportJs + ";";
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
callback(null, exportJs);
|
|
45
|
+
}.bind(this));
|
|
46
|
+
};
|