css-loader 5.0.1 → 5.0.2

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/dist/utils.js CHANGED
@@ -46,8 +46,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
46
46
  MIT License http://www.opensource.org/licenses/mit-license.php
47
47
  Author Tobias Koppers @sokra
48
48
  */
49
- const whitespace = '[\\x20\\t\\r\\n\\f]';
50
- const unescapeRegExp = new RegExp(`\\\\([\\da-f]{1,6}${whitespace}?|(${whitespace})|.)`, 'ig');
49
+ const whitespace = "[\\x20\\t\\r\\n\\f]";
50
+ const unescapeRegExp = new RegExp(`\\\\([\\da-f]{1,6}${whitespace}?|(${whitespace})|.)`, "ig");
51
51
  const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
52
52
 
53
53
  function unescape(str) {
@@ -67,7 +67,7 @@ function unescape(str) {
67
67
  }
68
68
 
69
69
  function normalizePath(file) {
70
- return _path.default.sep === '\\' ? file.replace(/\\/g, '/') : file;
70
+ return _path.default.sep === "\\" ? file.replace(/\\/g, "/") : file;
71
71
  } // eslint-disable-next-line no-control-regex
72
72
 
73
73
 
@@ -75,9 +75,9 @@ const filenameReservedRegex = /[<>:"/\\|?*]/g; // eslint-disable-next-line no-co
75
75
 
76
76
  const reControlChars = /[\u0000-\u001f\u0080-\u009f]/g;
77
77
 
78
- function escapeLocalident(localident) {
78
+ function escapeLocalIdent(localident) {
79
79
  return (0, _cssesc.default)(localident // For `[hash]` placeholder
80
- .replace(/^((-?[0-9])|--)/, '_$1').replace(filenameReservedRegex, '-').replace(reControlChars, '-').replace(/\./g, '-'), {
80
+ .replace(/^((-?[0-9])|--)/, "_$1").replace(filenameReservedRegex, "-").replace(reControlChars, "-").replace(/\./g, "-"), {
81
81
  isIdentifier: true
82
82
  });
83
83
  }
@@ -100,14 +100,14 @@ function normalizeUrl(url, isStringValue) {
100
100
  let normalizedUrl = url;
101
101
 
102
102
  if (isStringValue && /\\(\n|\r\n|\r|\f)/.test(normalizedUrl)) {
103
- normalizedUrl = normalizedUrl.replace(/\\(\n|\r\n|\r|\f)/g, '');
103
+ normalizedUrl = normalizedUrl.replace(/\\(\n|\r\n|\r|\f)/g, "");
104
104
  }
105
105
 
106
106
  if (matchNativeWin32Path.test(url)) {
107
- return decodeURIComponent(normalizedUrl);
107
+ return decodeURI(normalizedUrl);
108
108
  }
109
109
 
110
- return decodeURIComponent(unescape(normalizedUrl));
110
+ return decodeURI(unescape(normalizedUrl));
111
111
  }
112
112
 
113
113
  function requestify(url, rootContext) {
@@ -115,12 +115,12 @@ function requestify(url, rootContext) {
115
115
  return (0, _url.fileURLToPath)(url);
116
116
  }
117
117
 
118
- return url.charAt(0) === '/' ? (0, _loaderUtils.urlToRequest)(url, rootContext) : (0, _loaderUtils.urlToRequest)(url);
118
+ return url.charAt(0) === "/" ? (0, _loaderUtils.urlToRequest)(url, rootContext) : (0, _loaderUtils.urlToRequest)(url);
119
119
  }
120
120
 
121
121
  function getFilter(filter, resourcePath) {
122
122
  return (...args) => {
123
- if (typeof filter === 'function') {
123
+ if (typeof filter === "function") {
124
124
  return filter(...args, resourcePath);
125
125
  }
126
126
 
@@ -129,7 +129,7 @@ function getFilter(filter, resourcePath) {
129
129
  }
130
130
 
131
131
  function getValidLocalName(localName, exportLocalsConvention) {
132
- if (exportLocalsConvention === 'dashesOnly') {
132
+ if (exportLocalsConvention === "dashesOnly") {
133
133
  return dashesCamelCase(localName);
134
134
  }
135
135
 
@@ -145,7 +145,7 @@ function getModulesOptions(rawOptions, loaderContext) {
145
145
  } = loaderContext;
146
146
  let isIcss;
147
147
 
148
- if (typeof rawOptions.modules === 'undefined') {
148
+ if (typeof rawOptions.modules === "undefined") {
149
149
  const isModules = moduleRegExp.test(resourcePath);
150
150
 
151
151
  if (!isModules) {
@@ -155,32 +155,32 @@ function getModulesOptions(rawOptions, loaderContext) {
155
155
  if (!isModules && !isIcss) {
156
156
  return false;
157
157
  }
158
- } else if (typeof rawOptions.modules === 'boolean' && rawOptions.modules === false) {
158
+ } else if (typeof rawOptions.modules === "boolean" && rawOptions.modules === false) {
159
159
  return false;
160
160
  }
161
161
 
162
162
  let modulesOptions = {
163
- compileType: isIcss ? 'icss' : 'module',
163
+ compileType: isIcss ? "icss" : "module",
164
164
  auto: true,
165
- mode: 'local',
165
+ mode: "local",
166
166
  exportGlobals: false,
167
- localIdentName: '[hash:base64]',
167
+ localIdentName: "[hash:base64]",
168
168
  localIdentContext: loaderContext.rootContext,
169
- localIdentHashPrefix: '',
169
+ localIdentHashPrefix: "",
170
170
  // eslint-disable-next-line no-undefined
171
171
  localIdentRegExp: undefined,
172
172
  // eslint-disable-next-line no-undefined
173
173
  getLocalIdent: undefined,
174
174
  namedExport: false,
175
- exportLocalsConvention: 'asIs',
175
+ exportLocalsConvention: "asIs",
176
176
  exportOnlyLocals: false
177
177
  };
178
178
 
179
- if (typeof rawOptions.modules === 'boolean' || typeof rawOptions.modules === 'string') {
180
- modulesOptions.mode = typeof rawOptions.modules === 'string' ? rawOptions.modules : 'local';
179
+ if (typeof rawOptions.modules === "boolean" || typeof rawOptions.modules === "string") {
180
+ modulesOptions.mode = typeof rawOptions.modules === "string" ? rawOptions.modules : "local";
181
181
  } else {
182
182
  if (rawOptions.modules) {
183
- if (typeof rawOptions.modules.auto === 'boolean') {
183
+ if (typeof rawOptions.modules.auto === "boolean") {
184
184
  const isModules = rawOptions.modules.auto && moduleRegExp.test(resourcePath);
185
185
 
186
186
  if (!isModules) {
@@ -192,7 +192,7 @@ function getModulesOptions(rawOptions, loaderContext) {
192
192
  if (!isModules) {
193
193
  return false;
194
194
  }
195
- } else if (typeof rawOptions.modules.auto === 'function') {
195
+ } else if (typeof rawOptions.modules.auto === "function") {
196
196
  const isModule = rawOptions.modules.auto(resourcePath);
197
197
 
198
198
  if (!isModule) {
@@ -200,8 +200,8 @@ function getModulesOptions(rawOptions, loaderContext) {
200
200
  }
201
201
  }
202
202
 
203
- if (rawOptions.modules.namedExport === true && typeof rawOptions.modules.exportLocalsConvention === 'undefined') {
204
- modulesOptions.exportLocalsConvention = 'camelCaseOnly';
203
+ if (rawOptions.modules.namedExport === true && typeof rawOptions.modules.exportLocalsConvention === "undefined") {
204
+ modulesOptions.exportLocalsConvention = "camelCaseOnly";
205
205
  }
206
206
  }
207
207
 
@@ -210,7 +210,7 @@ function getModulesOptions(rawOptions, loaderContext) {
210
210
  };
211
211
  }
212
212
 
213
- if (typeof modulesOptions.mode === 'function') {
213
+ if (typeof modulesOptions.mode === "function") {
214
214
  modulesOptions.mode = modulesOptions.mode(loaderContext.resourcePath);
215
215
  }
216
216
 
@@ -219,13 +219,13 @@ function getModulesOptions(rawOptions, loaderContext) {
219
219
  throw new Error('The "modules.namedExport" option requires the "esModules" option to be enabled');
220
220
  }
221
221
 
222
- if (modulesOptions.exportLocalsConvention !== 'camelCaseOnly' && modulesOptions.exportLocalsConvention !== 'dashesOnly') {
222
+ if (modulesOptions.exportLocalsConvention !== "camelCaseOnly" && modulesOptions.exportLocalsConvention !== "dashesOnly") {
223
223
  throw new Error('The "modules.namedExport" option requires the "modules.exportLocalsConvention" option to be "camelCaseOnly" or "dashesOnly"');
224
224
  }
225
225
  }
226
226
 
227
227
  if (/\[emoji(?::(\d+))?\]/i.test(modulesOptions.localIdentName)) {
228
- loaderContext.emitWarning('Emoji is deprecated and will be removed in next major release.');
228
+ loaderContext.emitWarning("Emoji is deprecated and will be removed in next major release.");
229
229
  }
230
230
 
231
231
  return modulesOptions;
@@ -234,12 +234,12 @@ function getModulesOptions(rawOptions, loaderContext) {
234
234
  function normalizeOptions(rawOptions, loaderContext) {
235
235
  const modulesOptions = getModulesOptions(rawOptions, loaderContext);
236
236
  return {
237
- url: typeof rawOptions.url === 'undefined' ? true : rawOptions.url,
238
- import: typeof rawOptions.import === 'undefined' ? true : rawOptions.import,
237
+ url: typeof rawOptions.url === "undefined" ? true : rawOptions.url,
238
+ import: typeof rawOptions.import === "undefined" ? true : rawOptions.import,
239
239
  modules: modulesOptions,
240
- sourceMap: typeof rawOptions.sourceMap === 'boolean' ? rawOptions.sourceMap : loaderContext.sourceMap,
241
- importLoaders: typeof rawOptions.importLoaders === 'string' ? parseInt(rawOptions.importLoaders, 10) : rawOptions.importLoaders,
242
- esModule: typeof rawOptions.esModule === 'undefined' ? true : rawOptions.esModule
240
+ sourceMap: typeof rawOptions.sourceMap === "boolean" ? rawOptions.sourceMap : loaderContext.sourceMap,
241
+ importLoaders: typeof rawOptions.importLoaders === "string" ? parseInt(rawOptions.importLoaders, 10) : rawOptions.importLoaders,
242
+ esModule: typeof rawOptions.esModule === "undefined" ? true : rawOptions.esModule
243
243
  };
244
244
  }
245
245
 
@@ -248,7 +248,7 @@ function shouldUseImportPlugin(options) {
248
248
  return false;
249
249
  }
250
250
 
251
- if (typeof options.import === 'boolean') {
251
+ if (typeof options.import === "boolean") {
252
252
  return options.import;
253
253
  }
254
254
 
@@ -260,7 +260,7 @@ function shouldUseURLPlugin(options) {
260
260
  return false;
261
261
  }
262
262
 
263
- if (typeof options.url === 'boolean') {
263
+ if (typeof options.url === "boolean") {
264
264
  return options.url;
265
265
  }
266
266
 
@@ -268,7 +268,7 @@ function shouldUseURLPlugin(options) {
268
268
  }
269
269
 
270
270
  function shouldUseModulesPlugins(options) {
271
- return options.modules.compileType === 'module';
271
+ return options.modules.compileType === "module";
272
272
  }
273
273
 
274
274
  function shouldUseIcssPlugin(options) {
@@ -293,7 +293,7 @@ function getModulesPlugins(options, loaderContext) {
293
293
  generateScopedName(exportName) {
294
294
  let localIdent;
295
295
 
296
- if (typeof getLocalIdent !== 'undefined') {
296
+ if (typeof getLocalIdent !== "undefined") {
297
297
  localIdent = getLocalIdent(loaderContext, localIdentName, unescape(exportName), {
298
298
  context: localIdentContext,
299
299
  hashPrefix: localIdentHashPrefix,
@@ -303,16 +303,16 @@ function getModulesPlugins(options, loaderContext) {
303
303
  // getLocalIdent method.
304
304
 
305
305
 
306
- if (typeof localIdent === 'undefined' || localIdent === null) {
306
+ if (typeof localIdent === "undefined" || localIdent === null) {
307
307
  localIdent = defaultGetLocalIdent(loaderContext, localIdentName, unescape(exportName), {
308
308
  context: localIdentContext,
309
309
  hashPrefix: localIdentHashPrefix,
310
310
  regExp: localIdentRegExp
311
311
  });
312
- return escapeLocalident(localIdent).replace(/\\\[local\\]/gi, exportName);
312
+ return escapeLocalIdent(localIdent).replace(/\\\[local\\]/gi, exportName);
313
313
  }
314
314
 
315
- return escapeLocalident(localIdent);
315
+ return escapeLocalIdent(localIdent);
316
316
  },
317
317
 
318
318
  exportGlobals: options.modules.exportGlobals
@@ -328,26 +328,26 @@ const IS_NATIVE_WIN32_PATH = /^[a-z]:[/\\]|^\\\\/i;
328
328
  const ABSOLUTE_SCHEME = /^[a-z0-9+\-.]+:/i;
329
329
 
330
330
  function getURLType(source) {
331
- if (source[0] === '/') {
332
- if (source[1] === '/') {
333
- return 'scheme-relative';
331
+ if (source[0] === "/") {
332
+ if (source[1] === "/") {
333
+ return "scheme-relative";
334
334
  }
335
335
 
336
- return 'path-absolute';
336
+ return "path-absolute";
337
337
  }
338
338
 
339
339
  if (IS_NATIVE_WIN32_PATH.test(source)) {
340
- return 'path-absolute';
340
+ return "path-absolute";
341
341
  }
342
342
 
343
- return ABSOLUTE_SCHEME.test(source) ? 'absolute' : 'path-relative';
343
+ return ABSOLUTE_SCHEME.test(source) ? "absolute" : "path-relative";
344
344
  }
345
345
 
346
346
  function normalizeSourceMap(map, resourcePath) {
347
347
  let newMap = map; // Some loader emit source map as string
348
348
  // Strip any JSON XSSI avoidance prefix from the string (as documented in the source maps specification), and then parse the string as JSON.
349
349
 
350
- if (typeof newMap === 'string') {
350
+ if (typeof newMap === "string") {
351
351
  newMap = JSON.parse(newMap);
352
352
  }
353
353
 
@@ -362,14 +362,14 @@ function normalizeSourceMap(map, resourcePath) {
362
362
  // We should normalize path because previous loaders like `sass-loader` using backslash when generate source map
363
363
  newMap.sources = newMap.sources.map(source => {
364
364
  // Non-standard syntax from `postcss`
365
- if (source.indexOf('<') === 0) {
365
+ if (source.indexOf("<") === 0) {
366
366
  return source;
367
367
  }
368
368
 
369
369
  const sourceType = getURLType(source); // Do no touch `scheme-relative` and `absolute` URLs
370
370
 
371
- if (sourceType === 'path-relative' || sourceType === 'path-absolute') {
372
- const absoluteSource = sourceType === 'path-relative' && sourceRoot ? _path.default.resolve(sourceRoot, normalizePath(source)) : normalizePath(source);
371
+ if (sourceType === "path-relative" || sourceType === "path-absolute") {
372
+ const absoluteSource = sourceType === "path-relative" && sourceRoot ? _path.default.resolve(sourceRoot, normalizePath(source)) : normalizePath(source);
373
373
  return _path.default.relative(_path.default.dirname(resourcePath), absoluteSource);
374
374
  }
375
375
 
@@ -391,9 +391,9 @@ function getPreRequester({
391
391
  }
392
392
 
393
393
  if (number === false) {
394
- cache[number] = '';
394
+ cache[number] = "";
395
395
  } else {
396
- const loadersRequest = loaders.slice(loaderIndex, loaderIndex + 1 + (typeof number !== 'number' ? 0 : number)).map(x => x.request).join('!');
396
+ const loadersRequest = loaders.slice(loaderIndex, loaderIndex + 1 + (typeof number !== "number" ? 0 : number)).map(x => x.request).join("!");
397
397
  cache[number] = `-!${loadersRequest}!`;
398
398
  }
399
399
 
@@ -402,7 +402,7 @@ function getPreRequester({
402
402
  }
403
403
 
404
404
  function getImportCode(imports, options) {
405
- let code = '';
405
+ let code = "";
406
406
 
407
407
  for (const item of imports) {
408
408
  const {
@@ -413,7 +413,7 @@ function getImportCode(imports, options) {
413
413
 
414
414
  if (options.esModule) {
415
415
  if (icss && options.modules.namedExport) {
416
- code += `import ${options.modules.exportOnlyLocals ? '' : `${importName}, `}* as ${importName}_NAMED___ from ${url};\n`;
416
+ code += `import ${options.modules.exportOnlyLocals ? "" : `${importName}, `}* as ${importName}_NAMED___ from ${url};\n`;
417
417
  } else {
418
418
  code += `import ${importName} from ${url};\n`;
419
419
  }
@@ -422,7 +422,7 @@ function getImportCode(imports, options) {
422
422
  }
423
423
  }
424
424
 
425
- return code ? `// Imports\n${code}` : '';
425
+ return code ? `// Imports\n${code}` : "";
426
426
  }
427
427
 
428
428
  function normalizeSourceMapForRuntime(map, loaderContext) {
@@ -430,16 +430,16 @@ function normalizeSourceMapForRuntime(map, loaderContext) {
430
430
 
431
431
  if (resultMap) {
432
432
  delete resultMap.file;
433
- resultMap.sourceRoot = '';
433
+ resultMap.sourceRoot = "";
434
434
  resultMap.sources = resultMap.sources.map(source => {
435
435
  // Non-standard syntax from `postcss`
436
- if (source.indexOf('<') === 0) {
436
+ if (source.indexOf("<") === 0) {
437
437
  return source;
438
438
  }
439
439
 
440
440
  const sourceType = getURLType(source);
441
441
 
442
- if (sourceType !== 'path-relative') {
442
+ if (sourceType !== "path-relative") {
443
443
  return source;
444
444
  }
445
445
 
@@ -457,12 +457,12 @@ function normalizeSourceMapForRuntime(map, loaderContext) {
457
457
 
458
458
  function getModuleCode(result, api, replacements, options, loaderContext) {
459
459
  if (options.modules.exportOnlyLocals === true) {
460
- return '';
460
+ return "";
461
461
  }
462
462
 
463
- const sourceMapValue = options.sourceMap ? `,${normalizeSourceMapForRuntime(result.map, loaderContext)}` : '';
463
+ const sourceMapValue = options.sourceMap ? `,${normalizeSourceMapForRuntime(result.map, loaderContext)}` : "";
464
464
  let code = JSON.stringify(result.css);
465
- let beforeCode = `var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(${options.sourceMap ? '___CSS_LOADER_API_SOURCEMAP_IMPORT___' : 'function(i){return i[1]}'});\n`;
465
+ let beforeCode = `var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(${options.sourceMap ? "___CSS_LOADER_API_SOURCEMAP_IMPORT___" : "function(i){return i[1]}"});\n`;
466
466
 
467
467
  for (const item of api) {
468
468
  const {
@@ -470,7 +470,7 @@ function getModuleCode(result, api, replacements, options, loaderContext) {
470
470
  media,
471
471
  dedupe
472
472
  } = item;
473
- beforeCode += url ? `___CSS_LOADER_EXPORT___.push([module.id, ${JSON.stringify(`@import url(${url});`)}${media ? `, ${JSON.stringify(media)}` : ''}]);\n` : `___CSS_LOADER_EXPORT___.i(${item.importName}${media ? `, ${JSON.stringify(media)}` : dedupe ? ', ""' : ''}${dedupe ? ', true' : ''});\n`;
473
+ beforeCode += url ? `___CSS_LOADER_EXPORT___.push([module.id, ${JSON.stringify(`@import url(${url});`)}${media ? `, ${JSON.stringify(media)}` : ""}]);\n` : `___CSS_LOADER_EXPORT___.i(${item.importName}${media ? `, ${JSON.stringify(media)}` : dedupe ? ', ""' : ""}${dedupe ? ", true" : ""});\n`;
474
474
  }
475
475
 
476
476
  for (const item of replacements) {
@@ -481,16 +481,16 @@ function getModuleCode(result, api, replacements, options, loaderContext) {
481
481
  } = item;
482
482
 
483
483
  if (localName) {
484
- code = code.replace(new RegExp(replacementName, 'g'), () => options.modules.namedExport ? `" + ${importName}_NAMED___[${JSON.stringify(getValidLocalName(localName, options.modules.exportLocalsConvention))}] + "` : `" + ${importName}.locals[${JSON.stringify(localName)}] + "`);
484
+ code = code.replace(new RegExp(replacementName, "g"), () => options.modules.namedExport ? `" + ${importName}_NAMED___[${JSON.stringify(getValidLocalName(localName, options.modules.exportLocalsConvention))}] + "` : `" + ${importName}.locals[${JSON.stringify(localName)}] + "`);
485
485
  } else {
486
486
  const {
487
487
  hash,
488
488
  needQuotes
489
489
  } = item;
490
- const getUrlOptions = [].concat(hash ? [`hash: ${JSON.stringify(hash)}`] : []).concat(needQuotes ? 'needQuotes: true' : []);
491
- const preparedOptions = getUrlOptions.length > 0 ? `, { ${getUrlOptions.join(', ')} }` : '';
490
+ const getUrlOptions = [].concat(hash ? [`hash: ${JSON.stringify(hash)}`] : []).concat(needQuotes ? "needQuotes: true" : []);
491
+ const preparedOptions = getUrlOptions.length > 0 ? `, { ${getUrlOptions.join(", ")} }` : "";
492
492
  beforeCode += `var ${replacementName} = ___CSS_LOADER_GET_URL_IMPORT___(${importName}${preparedOptions});\n`;
493
- code = code.replace(new RegExp(replacementName, 'g'), () => `" + ${replacementName} + "`);
493
+ code = code.replace(new RegExp(replacementName, "g"), () => `" + ${replacementName} + "`);
494
494
  }
495
495
  }
496
496
 
@@ -502,8 +502,8 @@ function dashesCamelCase(str) {
502
502
  }
503
503
 
504
504
  function getExportCode(exports, replacements, options) {
505
- let code = '// Exports\n';
506
- let localsCode = '';
505
+ let code = "// Exports\n";
506
+ let localsCode = "";
507
507
 
508
508
  const addExportToLocalsCode = (name, value) => {
509
509
  if (options.modules.namedExport) {
@@ -522,7 +522,7 @@ function getExportCode(exports, replacements, options) {
522
522
  value
523
523
  } of exports) {
524
524
  switch (options.modules.exportLocalsConvention) {
525
- case 'camelCase':
525
+ case "camelCase":
526
526
  {
527
527
  addExportToLocalsCode(name, value);
528
528
  const modifiedName = (0, _camelcase.default)(name);
@@ -534,13 +534,13 @@ function getExportCode(exports, replacements, options) {
534
534
  break;
535
535
  }
536
536
 
537
- case 'camelCaseOnly':
537
+ case "camelCaseOnly":
538
538
  {
539
539
  addExportToLocalsCode((0, _camelcase.default)(name), value);
540
540
  break;
541
541
  }
542
542
 
543
- case 'dashes':
543
+ case "dashes":
544
544
  {
545
545
  addExportToLocalsCode(name, value);
546
546
  const modifiedName = dashesCamelCase(name);
@@ -552,13 +552,13 @@ function getExportCode(exports, replacements, options) {
552
552
  break;
553
553
  }
554
554
 
555
- case 'dashesOnly':
555
+ case "dashesOnly":
556
556
  {
557
557
  addExportToLocalsCode(dashesCamelCase(name), value);
558
558
  break;
559
559
  }
560
560
 
561
- case 'asIs':
561
+ case "asIs":
562
562
  default:
563
563
  addExportToLocalsCode(name, value);
564
564
  break;
@@ -575,7 +575,7 @@ function getExportCode(exports, replacements, options) {
575
575
  const {
576
576
  importName
577
577
  } = item;
578
- localsCode = localsCode.replace(new RegExp(replacementName, 'g'), () => {
578
+ localsCode = localsCode.replace(new RegExp(replacementName, "g"), () => {
579
579
  if (options.modules.namedExport) {
580
580
  return `" + ${importName}_NAMED___[${JSON.stringify(getValidLocalName(localName, options.modules.exportLocalsConvention))}] + "`;
581
581
  } else if (options.modules.exportOnlyLocals) {
@@ -585,12 +585,12 @@ function getExportCode(exports, replacements, options) {
585
585
  return `" + ${importName}.locals[${JSON.stringify(localName)}] + "`;
586
586
  });
587
587
  } else {
588
- localsCode = localsCode.replace(new RegExp(replacementName, 'g'), () => `" + ${replacementName} + "`);
588
+ localsCode = localsCode.replace(new RegExp(replacementName, "g"), () => `" + ${replacementName} + "`);
589
589
  }
590
590
  }
591
591
 
592
592
  if (options.modules.exportOnlyLocals) {
593
- code += options.modules.namedExport ? localsCode : `${options.esModule ? 'export default' : 'module.exports ='} {\n${localsCode}\n};\n`;
593
+ code += options.modules.namedExport ? localsCode : `${options.esModule ? "export default" : "module.exports ="} {\n${localsCode}\n};\n`;
594
594
  return code;
595
595
  }
596
596
 
@@ -598,14 +598,12 @@ function getExportCode(exports, replacements, options) {
598
598
  code += options.modules.namedExport ? localsCode : `___CSS_LOADER_EXPORT___.locals = {\n${localsCode}\n};\n`;
599
599
  }
600
600
 
601
- code += `${options.esModule ? 'export default' : 'module.exports ='} ___CSS_LOADER_EXPORT___;\n`;
601
+ code += `${options.esModule ? "export default" : "module.exports ="} ___CSS_LOADER_EXPORT___;\n`;
602
602
  return code;
603
603
  }
604
604
 
605
605
  async function resolveRequests(resolve, context, possibleRequests) {
606
- return resolve(context, possibleRequests[0]).then(result => {
607
- return result;
608
- }).catch(error => {
606
+ return resolve(context, possibleRequests[0]).then(result => result).catch(error => {
609
607
  const [, ...tailPossibleRequests] = possibleRequests;
610
608
 
611
609
  if (tailPossibleRequests.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "css-loader",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "css loader module for webpack",
5
5
  "license": "MIT",
6
6
  "repository": "webpack-contrib/css-loader",
@@ -45,54 +45,54 @@
45
45
  "dependencies": {
46
46
  "camelcase": "^6.2.0",
47
47
  "cssesc": "^3.0.0",
48
- "icss-utils": "^5.0.0",
48
+ "icss-utils": "^5.1.0",
49
49
  "loader-utils": "^2.0.0",
50
- "postcss": "^8.1.4",
50
+ "postcss": "^8.2.4",
51
51
  "postcss-modules-extract-imports": "^3.0.0",
52
52
  "postcss-modules-local-by-default": "^4.0.0",
53
53
  "postcss-modules-scope": "^3.0.0",
54
54
  "postcss-modules-values": "^4.0.0",
55
55
  "postcss-value-parser": "^4.1.0",
56
56
  "schema-utils": "^3.0.0",
57
- "semver": "^7.3.2"
57
+ "semver": "^7.3.4"
58
58
  },
59
59
  "devDependencies": {
60
- "@babel/cli": "^7.12.1",
61
- "@babel/core": "^7.12.3",
62
- "@babel/preset-env": "^7.12.1",
60
+ "@babel/cli": "^7.12.13",
61
+ "@babel/core": "^7.12.13",
62
+ "@babel/preset-env": "^7.12.13",
63
63
  "@commitlint/cli": "^11.0.0",
64
64
  "@commitlint/config-conventional": "^11.0.0",
65
65
  "@webpack-contrib/defaults": "^6.3.0",
66
66
  "@webpack-contrib/eslint-config-webpack": "^3.0.0",
67
67
  "babel-jest": "^26.6.3",
68
- "cross-env": "^7.0.2",
68
+ "cross-env": "^7.0.3",
69
69
  "del": "^6.0.0",
70
70
  "del-cli": "^3.0.1",
71
- "es-check": "^5.1.2",
72
- "eslint": "^7.12.1",
73
- "eslint-config-prettier": "^6.15.0",
71
+ "es-check": "^5.2.0",
72
+ "eslint": "^7.19.0",
73
+ "eslint-config-prettier": "^7.2.0",
74
74
  "eslint-plugin-import": "^2.22.1",
75
75
  "file-loader": "^6.2.0",
76
- "husky": "^4.3.0",
76
+ "husky": "^4.3.8",
77
77
  "jest": "^26.6.3",
78
- "less": "^3.12.2",
79
- "less-loader": "^7.0.2",
80
- "lint-staged": "^10.5.1",
78
+ "less": "^4.1.1",
79
+ "less-loader": "^7.1.0",
80
+ "lint-staged": "^10.5.3",
81
81
  "memfs": "^3.2.0",
82
- "mini-css-extract-plugin": "^1.2.1",
82
+ "mini-css-extract-plugin": "^1.3.5",
83
83
  "npm-run-all": "^4.1.5",
84
84
  "postcss-loader": "^4.0.4",
85
85
  "postcss-preset-env": "^6.7.0",
86
86
  "prettier": "^2.1.2",
87
- "sass": "^1.28.0",
88
- "sass-loader": "^10.0.5",
87
+ "sass": "^1.32.6",
88
+ "sass-loader": "^10.1.0",
89
89
  "standard-version": "^9.0.0",
90
90
  "strip-ansi": "^6.0.0",
91
91
  "style-loader": "^2.0.0",
92
92
  "stylus": "^0.54.8",
93
- "stylus-loader": "^4.2.0",
93
+ "stylus-loader": "^4.3.0",
94
94
  "url-loader": "^4.1.1",
95
- "webpack": "^5.4.0"
95
+ "webpack": "^5.20.1"
96
96
  },
97
97
  "keywords": [
98
98
  "webpack",