css-loader 3.4.2 → 3.5.3
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/CHANGELOG.md +32 -0
- package/README.md +151 -13
- package/dist/index.js +50 -24
- package/dist/options.json +22 -2
- package/dist/plugins/postcss-icss-parser.js +27 -24
- package/dist/plugins/postcss-import-parser.js +89 -81
- package/dist/plugins/postcss-url-parser.js +71 -117
- package/dist/utils.js +180 -198
- package/package.json +26 -27
package/dist/utils.js
CHANGED
|
@@ -7,13 +7,15 @@ exports.normalizeUrl = normalizeUrl;
|
|
|
7
7
|
exports.getFilter = getFilter;
|
|
8
8
|
exports.getModulesPlugins = getModulesPlugins;
|
|
9
9
|
exports.normalizeSourceMap = normalizeSourceMap;
|
|
10
|
+
exports.getPreRequester = getPreRequester;
|
|
10
11
|
exports.getImportCode = getImportCode;
|
|
11
12
|
exports.getModuleCode = getModuleCode;
|
|
12
13
|
exports.getExportCode = getExportCode;
|
|
14
|
+
exports.shouldUseModulesPlugins = shouldUseModulesPlugins;
|
|
13
15
|
|
|
14
16
|
var _path = _interopRequireDefault(require("path"));
|
|
15
17
|
|
|
16
|
-
var _loaderUtils =
|
|
18
|
+
var _loaderUtils = require("loader-utils");
|
|
17
19
|
|
|
18
20
|
var _normalizePath = _interopRequireDefault(require("normalize-path"));
|
|
19
21
|
|
|
@@ -29,10 +31,6 @@ var _postcssModulesScope = _interopRequireDefault(require("postcss-modules-scope
|
|
|
29
31
|
|
|
30
32
|
var _camelcase = _interopRequireDefault(require("camelcase"));
|
|
31
33
|
|
|
32
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
33
|
-
|
|
34
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
-
|
|
36
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
35
|
|
|
38
36
|
/*
|
|
@@ -75,7 +73,7 @@ function getLocalIdent(loaderContext, localIdentName, localName, options) {
|
|
|
75
73
|
options.content = `${options.hashPrefix + request}+${unescape(localName)}`; // Using `[path]` placeholder outputs `/` we need escape their
|
|
76
74
|
// Also directories can contains invalid characters for css we need escape their too
|
|
77
75
|
|
|
78
|
-
return (0, _cssesc.default)(_loaderUtils.
|
|
76
|
+
return (0, _cssesc.default)((0, _loaderUtils.interpolateName)(loaderContext, localIdentName, options) // For `[hash]` placeholder
|
|
79
77
|
.replace(/^((-?[0-9])|--)/, '_$1').replace(filenameReservedRegex, '-').replace(reControlChars, '-').replace(reRelativePath, '-').replace(/\./g, '-'), {
|
|
80
78
|
isIdentifier: true
|
|
81
79
|
}).replace(/\\\[local\\\]/gi, localName);
|
|
@@ -105,9 +103,34 @@ function getFilter(filter, resourcePath, defaultFilter = null) {
|
|
|
105
103
|
};
|
|
106
104
|
}
|
|
107
105
|
|
|
106
|
+
function shouldUseModulesPlugins(modules, resourcePath) {
|
|
107
|
+
if (typeof modules === 'undefined') {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (typeof modules === 'boolean') {
|
|
112
|
+
return modules;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (typeof modules === 'string') {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (typeof modules.auto === 'boolean') {
|
|
120
|
+
return modules.auto ? /\.module\.\w+$/i.test(resourcePath) : false;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (modules.auto instanceof RegExp) {
|
|
124
|
+
return modules.auto.test(resourcePath);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
|
|
108
130
|
function getModulesPlugins(options, loaderContext) {
|
|
109
131
|
let modulesOptions = {
|
|
110
132
|
mode: 'local',
|
|
133
|
+
exportGlobals: false,
|
|
111
134
|
localIdentName: '[hash:base64]',
|
|
112
135
|
getLocalIdent,
|
|
113
136
|
hashPrefix: '',
|
|
@@ -120,27 +143,40 @@ function getModulesPlugins(options, loaderContext) {
|
|
|
120
143
|
modulesOptions = Object.assign({}, modulesOptions, options.modules);
|
|
121
144
|
}
|
|
122
145
|
|
|
123
|
-
|
|
124
|
-
mode
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
localIdent = getLocalIdent(loaderContext, modulesOptions.localIdentName, exportName, {
|
|
146
|
+
if (typeof modulesOptions.mode === 'function') {
|
|
147
|
+
modulesOptions.mode = modulesOptions.mode(loaderContext.resourcePath);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
let plugins = [];
|
|
151
|
+
|
|
152
|
+
try {
|
|
153
|
+
plugins = [_postcssModulesValues.default, (0, _postcssModulesLocalByDefault.default)({
|
|
154
|
+
mode: modulesOptions.mode
|
|
155
|
+
}), (0, _postcssModulesExtractImports.default)(), (0, _postcssModulesScope.default)({
|
|
156
|
+
generateScopedName: function generateScopedName(exportName) {
|
|
157
|
+
let localIdent = modulesOptions.getLocalIdent(loaderContext, modulesOptions.localIdentName, exportName, {
|
|
135
158
|
context: modulesOptions.context,
|
|
136
159
|
hashPrefix: modulesOptions.hashPrefix,
|
|
137
160
|
regExp: modulesOptions.localIdentRegExp
|
|
138
161
|
});
|
|
139
|
-
}
|
|
140
162
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
163
|
+
if (!localIdent) {
|
|
164
|
+
localIdent = getLocalIdent(loaderContext, modulesOptions.localIdentName, exportName, {
|
|
165
|
+
context: modulesOptions.context,
|
|
166
|
+
hashPrefix: modulesOptions.hashPrefix,
|
|
167
|
+
regExp: modulesOptions.localIdentRegExp
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return localIdent;
|
|
172
|
+
},
|
|
173
|
+
exportGlobals: modulesOptions.exportGlobals
|
|
174
|
+
})];
|
|
175
|
+
} catch (error) {
|
|
176
|
+
loaderContext.emitError(error);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return plugins;
|
|
144
180
|
}
|
|
145
181
|
|
|
146
182
|
function normalizeSourceMap(map) {
|
|
@@ -168,113 +204,47 @@ function normalizeSourceMap(map) {
|
|
|
168
204
|
return newMap;
|
|
169
205
|
}
|
|
170
206
|
|
|
171
|
-
function
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
207
|
+
function getPreRequester({
|
|
208
|
+
loaders,
|
|
209
|
+
loaderIndex
|
|
210
|
+
}) {
|
|
211
|
+
const cache = Object.create(null);
|
|
212
|
+
return number => {
|
|
213
|
+
if (cache[number]) {
|
|
214
|
+
return cache[number];
|
|
215
|
+
}
|
|
175
216
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
217
|
+
if (number === false) {
|
|
218
|
+
cache[number] = '';
|
|
219
|
+
} else {
|
|
220
|
+
const loadersRequest = loaders.slice(loaderIndex, loaderIndex + 1 + (typeof number !== 'number' ? 0 : number)).map(x => x.request).join('!');
|
|
221
|
+
cache[number] = `-!${loadersRequest}!`;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return cache[number];
|
|
225
|
+
};
|
|
179
226
|
}
|
|
180
227
|
|
|
181
|
-
function getImportCode(loaderContext,
|
|
182
|
-
|
|
183
|
-
const codeItems = [];
|
|
184
|
-
const atRuleImportNames = new Map();
|
|
185
|
-
const urlImportNames = new Map();
|
|
186
|
-
let importPrefix;
|
|
228
|
+
function getImportCode(loaderContext, exportType, imports, esModule) {
|
|
229
|
+
let code = '';
|
|
187
230
|
|
|
188
231
|
if (exportType === 'full') {
|
|
189
|
-
|
|
190
|
-
|
|
232
|
+
const apiUrl = (0, _loaderUtils.stringifyRequest)(loaderContext, require.resolve('./runtime/api'));
|
|
233
|
+
code += esModule ? `import ___CSS_LOADER_API_IMPORT___ from ${apiUrl};\n` : `var ___CSS_LOADER_API_IMPORT___ = require(${apiUrl});\n`;
|
|
191
234
|
}
|
|
192
235
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
media
|
|
201
|
-
} = item;
|
|
202
|
-
const preparedMedia = media ? `, ${JSON.stringify(media)}` : '';
|
|
203
|
-
|
|
204
|
-
if (!(0, _loaderUtils.isUrlRequest)(url)) {
|
|
205
|
-
codeItems.push(`exports.push([module.id, ${JSON.stringify(`@import url(${url});`)}${preparedMedia}]);`);
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
let importName = atRuleImportNames.get(url);
|
|
210
|
-
|
|
211
|
-
if (!importName) {
|
|
212
|
-
if (!importPrefix) {
|
|
213
|
-
importPrefix = getImportPrefix(loaderContext, importLoaders);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
importName = `___CSS_LOADER_AT_RULE_IMPORT_${atRuleImportNames.size}___`;
|
|
217
|
-
importItems.push(esModule ? `import ${importName} from ${(0, _loaderUtils.stringifyRequest)(loaderContext, importPrefix + url)};` : `var ${importName} = require(${(0, _loaderUtils.stringifyRequest)(loaderContext, importPrefix + url)});`);
|
|
218
|
-
atRuleImportNames.set(url, importName);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
codeItems.push(`exports.i(${importName}${preparedMedia});`);
|
|
222
|
-
}
|
|
223
|
-
break;
|
|
224
|
-
|
|
225
|
-
case 'url':
|
|
226
|
-
{
|
|
227
|
-
if (urlImportNames.size === 0) {
|
|
228
|
-
importItems.push(esModule ? `import ___CSS_LOADER_GET_URL_IMPORT___ from ${(0, _loaderUtils.stringifyRequest)(loaderContext, require.resolve('./runtime/getUrl.js'))};` : `var ___CSS_LOADER_GET_URL_IMPORT___ = require(${(0, _loaderUtils.stringifyRequest)(loaderContext, require.resolve('./runtime/getUrl.js'))});`);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
const {
|
|
232
|
-
replacementName,
|
|
233
|
-
url,
|
|
234
|
-
hash,
|
|
235
|
-
needQuotes
|
|
236
|
-
} = item;
|
|
237
|
-
let importName = urlImportNames.get(url);
|
|
238
|
-
|
|
239
|
-
if (!importName) {
|
|
240
|
-
importName = `___CSS_LOADER_URL_IMPORT_${urlImportNames.size}___`;
|
|
241
|
-
importItems.push(esModule ? `import ${importName} from ${(0, _loaderUtils.stringifyRequest)(loaderContext, url)};` : `var ${importName} = require(${(0, _loaderUtils.stringifyRequest)(loaderContext, url)});`);
|
|
242
|
-
urlImportNames.set(url, importName);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
const getUrlOptions = [].concat(hash ? [`hash: ${JSON.stringify(hash)}`] : []).concat(needQuotes ? 'needQuotes: true' : []);
|
|
246
|
-
const preparedOptions = getUrlOptions.length > 0 ? `, { ${getUrlOptions.join(', ')} }` : '';
|
|
247
|
-
codeItems.push(`var ${replacementName} = ___CSS_LOADER_GET_URL_IMPORT___(${importName}${preparedOptions});`);
|
|
248
|
-
}
|
|
249
|
-
break;
|
|
250
|
-
|
|
251
|
-
case 'icss-import':
|
|
252
|
-
{
|
|
253
|
-
const {
|
|
254
|
-
importName,
|
|
255
|
-
url,
|
|
256
|
-
media
|
|
257
|
-
} = item;
|
|
258
|
-
const preparedMedia = media ? `, ${JSON.stringify(media)}` : ', ""';
|
|
259
|
-
|
|
260
|
-
if (!importPrefix) {
|
|
261
|
-
importPrefix = getImportPrefix(loaderContext, importLoaders);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
importItems.push(esModule ? `import ${importName} from ${(0, _loaderUtils.stringifyRequest)(loaderContext, importPrefix + url)};` : `var ${importName} = require(${(0, _loaderUtils.stringifyRequest)(loaderContext, importPrefix + url)});`);
|
|
236
|
+
for (const item of imports) {
|
|
237
|
+
const {
|
|
238
|
+
importName,
|
|
239
|
+
url
|
|
240
|
+
} = item;
|
|
241
|
+
code += esModule ? `import ${importName} from ${url};\n` : `var ${importName} = require(${url});\n`;
|
|
242
|
+
}
|
|
265
243
|
|
|
266
|
-
|
|
267
|
-
codeItems.push(`exports.i(${importName}${preparedMedia}, true);`);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
break;
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
const items = importItems.concat(codeItems);
|
|
274
|
-
return items.length > 0 ? `// Imports\n${items.join('\n')}\n` : '';
|
|
244
|
+
return code ? `// Imports\n${code}` : '';
|
|
275
245
|
}
|
|
276
246
|
|
|
277
|
-
function getModuleCode(
|
|
247
|
+
function getModuleCode(result, exportType, sourceMap, apiImports, urlReplacements, icssReplacements, esModule) {
|
|
278
248
|
if (exportType !== 'full') {
|
|
279
249
|
return '';
|
|
280
250
|
}
|
|
@@ -284,114 +254,126 @@ function getModuleCode(loaderContext, result, exportType, sourceMap, replacers)
|
|
|
284
254
|
map
|
|
285
255
|
} = result;
|
|
286
256
|
const sourceMapValue = sourceMap && map ? `,${map}` : '';
|
|
287
|
-
let
|
|
288
|
-
|
|
257
|
+
let code = JSON.stringify(css);
|
|
258
|
+
let beforeCode = '';
|
|
259
|
+
beforeCode += esModule ? `var exports = ___CSS_LOADER_API_IMPORT___(${sourceMap});\n` : `exports = ___CSS_LOADER_API_IMPORT___(${sourceMap});\n`;
|
|
260
|
+
|
|
261
|
+
for (const item of apiImports) {
|
|
289
262
|
const {
|
|
290
263
|
type,
|
|
291
|
-
|
|
292
|
-
|
|
264
|
+
media,
|
|
265
|
+
dedupe
|
|
266
|
+
} = item;
|
|
267
|
+
beforeCode += type === 'internal' ? `exports.i(${item.importName}${media ? `, ${JSON.stringify(media)}` : dedupe ? ', ""' : ''}${dedupe ? ', true' : ''});\n` : `exports.push([module.id, ${JSON.stringify(`@import url(${item.url});`)}${media ? `, ${JSON.stringify(media)}` : ''}]);\n`;
|
|
268
|
+
}
|
|
293
269
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
270
|
+
for (const item of urlReplacements) {
|
|
271
|
+
const {
|
|
272
|
+
replacementName,
|
|
273
|
+
importName,
|
|
274
|
+
hash,
|
|
275
|
+
needQuotes
|
|
276
|
+
} = item;
|
|
277
|
+
const getUrlOptions = [].concat(hash ? [`hash: ${JSON.stringify(hash)}`] : []).concat(needQuotes ? 'needQuotes: true' : []);
|
|
278
|
+
const preparedOptions = getUrlOptions.length > 0 ? `, { ${getUrlOptions.join(', ')} }` : '';
|
|
279
|
+
beforeCode += `var ${replacementName} = ___CSS_LOADER_GET_URL_IMPORT___(${importName}${preparedOptions});\n`;
|
|
280
|
+
code = code.replace(new RegExp(replacementName, 'g'), () => `" + ${replacementName} + "`);
|
|
281
|
+
}
|
|
297
282
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
283
|
+
for (const replacement of icssReplacements) {
|
|
284
|
+
const {
|
|
285
|
+
replacementName,
|
|
286
|
+
importName,
|
|
287
|
+
localName
|
|
288
|
+
} = replacement;
|
|
289
|
+
code = code.replace(new RegExp(replacementName, 'g'), () => `" + ${importName}.locals[${JSON.stringify(localName)}] + "`);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return `${beforeCode}// Module\nexports.push([module.id, ${code}, ""${sourceMapValue}]);\n`;
|
|
307
293
|
}
|
|
308
294
|
|
|
309
295
|
function dashesCamelCase(str) {
|
|
310
296
|
return str.replace(/-+(\w)/g, (match, firstLetter) => firstLetter.toUpperCase());
|
|
311
297
|
}
|
|
312
298
|
|
|
313
|
-
function getExportCode(
|
|
314
|
-
|
|
315
|
-
let
|
|
316
|
-
|
|
317
|
-
if (exports.length > 0) {
|
|
318
|
-
const exportLocals = [];
|
|
299
|
+
function getExportCode(exports, exportType, localsConvention, icssReplacements, esModule) {
|
|
300
|
+
let code = '';
|
|
301
|
+
let localsCode = '';
|
|
319
302
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
exports.forEach(item => {
|
|
325
|
-
const {
|
|
326
|
-
name,
|
|
327
|
-
value
|
|
328
|
-
} = item;
|
|
303
|
+
const addExportToLocalsCode = (name, value) => {
|
|
304
|
+
if (localsCode) {
|
|
305
|
+
localsCode += `,\n`;
|
|
306
|
+
}
|
|
329
307
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
{
|
|
333
|
-
addExportedLocal(name, value);
|
|
334
|
-
const modifiedName = (0, _camelcase.default)(name);
|
|
308
|
+
localsCode += `\t${JSON.stringify(name)}: ${JSON.stringify(value)}`;
|
|
309
|
+
};
|
|
335
310
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
311
|
+
for (const {
|
|
312
|
+
name,
|
|
313
|
+
value
|
|
314
|
+
} of exports) {
|
|
315
|
+
switch (localsConvention) {
|
|
316
|
+
case 'camelCase':
|
|
317
|
+
{
|
|
318
|
+
addExportToLocalsCode(name, value);
|
|
319
|
+
const modifiedName = (0, _camelcase.default)(name);
|
|
339
320
|
|
|
340
|
-
|
|
321
|
+
if (modifiedName !== name) {
|
|
322
|
+
addExportToLocalsCode(modifiedName, value);
|
|
341
323
|
}
|
|
342
324
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
addExportedLocal((0, _camelcase.default)(name), value);
|
|
346
|
-
break;
|
|
347
|
-
}
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
348
327
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
328
|
+
case 'camelCaseOnly':
|
|
329
|
+
{
|
|
330
|
+
addExportToLocalsCode((0, _camelcase.default)(name), value);
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
353
333
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
334
|
+
case 'dashes':
|
|
335
|
+
{
|
|
336
|
+
addExportToLocalsCode(name, value);
|
|
337
|
+
const modifiedName = dashesCamelCase(name);
|
|
357
338
|
|
|
358
|
-
|
|
339
|
+
if (modifiedName !== name) {
|
|
340
|
+
addExportToLocalsCode(modifiedName, value);
|
|
359
341
|
}
|
|
360
342
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
addExportedLocal(dashesCamelCase(name), value);
|
|
364
|
-
break;
|
|
365
|
-
}
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
366
345
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
346
|
+
case 'dashesOnly':
|
|
347
|
+
{
|
|
348
|
+
addExportToLocalsCode(dashesCamelCase(name), value);
|
|
370
349
|
break;
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
case 'asIs':
|
|
353
|
+
default:
|
|
354
|
+
addExportToLocalsCode(name, value);
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
for (const replacement of icssReplacements) {
|
|
360
|
+
const {
|
|
361
|
+
replacementName,
|
|
362
|
+
importName,
|
|
363
|
+
localName
|
|
364
|
+
} = replacement;
|
|
365
|
+
localsCode = localsCode.replace(new RegExp(replacementName, 'g'), () => exportType === 'locals' ? `" + ${importName}[${JSON.stringify(localName)}] + "` : `" + ${importName}.locals[${JSON.stringify(localName)}] + "`);
|
|
384
366
|
}
|
|
385
367
|
|
|
386
368
|
if (exportType === 'locals') {
|
|
387
|
-
|
|
369
|
+
code += `${esModule ? 'export default' : 'module.exports ='} ${localsCode ? `{\n${localsCode}\n}` : '{}'};\n`;
|
|
388
370
|
} else {
|
|
389
|
-
if (
|
|
390
|
-
|
|
371
|
+
if (localsCode) {
|
|
372
|
+
code += `exports.locals = {\n${localsCode}\n};\n`;
|
|
391
373
|
}
|
|
392
374
|
|
|
393
|
-
|
|
375
|
+
code += `${esModule ? 'export default' : 'module.exports ='} exports;\n`;
|
|
394
376
|
}
|
|
395
377
|
|
|
396
|
-
return `// Exports\n${
|
|
378
|
+
return `// Exports\n${code}`;
|
|
397
379
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "css-loader",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.3",
|
|
4
4
|
"description": "css loader module for webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/css-loader",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"postbuild": "npm run validate:runtime",
|
|
25
25
|
"commitlint": "commitlint --from=master",
|
|
26
26
|
"security": "npm audit",
|
|
27
|
-
"lint:prettier": "prettier
|
|
27
|
+
"lint:prettier": "prettier --list-different .",
|
|
28
28
|
"lint:js": "eslint --cache .",
|
|
29
29
|
"lint": "npm-run-all -l -p \"lint:**\"",
|
|
30
30
|
"test:only": "cross-env NODE_ENV=test jest",
|
|
@@ -48,47 +48,46 @@
|
|
|
48
48
|
"icss-utils": "^4.1.1",
|
|
49
49
|
"loader-utils": "^1.2.3",
|
|
50
50
|
"normalize-path": "^3.0.0",
|
|
51
|
-
"postcss": "^7.0.
|
|
51
|
+
"postcss": "^7.0.27",
|
|
52
52
|
"postcss-modules-extract-imports": "^2.0.0",
|
|
53
53
|
"postcss-modules-local-by-default": "^3.0.2",
|
|
54
|
-
"postcss-modules-scope": "^2.
|
|
54
|
+
"postcss-modules-scope": "^2.2.0",
|
|
55
55
|
"postcss-modules-values": "^3.0.0",
|
|
56
|
-
"postcss-value-parser": "^4.0.
|
|
57
|
-
"schema-utils": "^2.6.
|
|
56
|
+
"postcss-value-parser": "^4.0.3",
|
|
57
|
+
"schema-utils": "^2.6.6",
|
|
58
|
+
"semver": "^6.3.0"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"@babel/cli": "^7.
|
|
61
|
-
"@babel/core": "^7.
|
|
62
|
-
"@babel/preset-env": "^7.
|
|
63
|
-
"@commitlint/cli": "^8.3.
|
|
61
|
+
"@babel/cli": "^7.8.4",
|
|
62
|
+
"@babel/core": "^7.9.0",
|
|
63
|
+
"@babel/preset-env": "^7.9.5",
|
|
64
|
+
"@commitlint/cli": "^8.3.5",
|
|
64
65
|
"@commitlint/config-conventional": "^8.3.4",
|
|
65
66
|
"@webpack-contrib/defaults": "^6.3.0",
|
|
66
67
|
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
67
|
-
"babel-jest": "^
|
|
68
|
-
"
|
|
69
|
-
"cross-env": "^6.0.3",
|
|
68
|
+
"babel-jest": "^25.4.0",
|
|
69
|
+
"cross-env": "^7.0.2",
|
|
70
70
|
"del": "^5.1.0",
|
|
71
71
|
"del-cli": "^3.0.0",
|
|
72
72
|
"es-check": "^5.1.0",
|
|
73
73
|
"eslint": "^6.8.0",
|
|
74
|
-
"eslint-config-prettier": "^6.
|
|
75
|
-
"eslint-plugin-import": "^2.
|
|
76
|
-
"file-loader": "^
|
|
77
|
-
"husky": "^4.
|
|
78
|
-
"jest": "^
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"memfs": "^3.0.3",
|
|
74
|
+
"eslint-config-prettier": "^6.11.0",
|
|
75
|
+
"eslint-plugin-import": "^2.20.2",
|
|
76
|
+
"file-loader": "^6.0.0",
|
|
77
|
+
"husky": "^4.2.5",
|
|
78
|
+
"jest": "^25.4.0",
|
|
79
|
+
"lint-staged": "^10.1.7",
|
|
80
|
+
"memfs": "^3.1.2",
|
|
82
81
|
"npm-run-all": "^4.1.5",
|
|
83
82
|
"postcss-loader": "^3.0.0",
|
|
84
83
|
"postcss-preset-env": "^6.7.0",
|
|
85
|
-
"prettier": "^
|
|
86
|
-
"sass": "^1.
|
|
87
|
-
"sass-loader": "^8.0.
|
|
88
|
-
"standard-version": "^7.0
|
|
84
|
+
"prettier": "^2.0.5",
|
|
85
|
+
"sass": "^1.26.3",
|
|
86
|
+
"sass-loader": "^8.0.2",
|
|
87
|
+
"standard-version": "^7.1.0",
|
|
89
88
|
"strip-ansi": "^6.0.0",
|
|
90
|
-
"url-loader": "^
|
|
91
|
-
"webpack": "^4.
|
|
89
|
+
"url-loader": "^4.1.0",
|
|
90
|
+
"webpack": "^4.43.0"
|
|
92
91
|
},
|
|
93
92
|
"keywords": [
|
|
94
93
|
"webpack",
|