Showing 11 of 46 files from the diff.

@@ -2,13 +2,13 @@
Loading
2 2
  constructor(warning) {
3 3
    super(warning);
4 4
    const { text, line, column } = warning;
5 -
    this.name = 'Warning';
5 +
    this.name = "Warning";
6 6
7 7
    // Based on https://github.com/postcss/postcss/blob/master/lib/warning.es6#L74
8 8
    // We don't need `plugin` properties.
9 9
    this.message = `${this.name}\n\n`;
10 10
11 -
    if (typeof line !== 'undefined') {
11 +
    if (typeof line !== "undefined") {
12 12
      this.message += `(${line}:${column}) `;
13 13
    }
14 14

@@ -2,21 +2,21 @@
Loading
2 2
  MIT License http://www.opensource.org/licenses/mit-license.php
3 3
  Author Tobias Koppers @sokra
4 4
*/
5 -
import { fileURLToPath } from 'url';
6 -
import path from 'path';
7 -
8 -
import { urlToRequest, interpolateName } from 'loader-utils';
9 -
import cssesc from 'cssesc';
10 -
import modulesValues from 'postcss-modules-values';
11 -
import localByDefault from 'postcss-modules-local-by-default';
12 -
import extractImports from 'postcss-modules-extract-imports';
13 -
import modulesScope from 'postcss-modules-scope';
14 -
import camelCase from 'camelcase';
15 -
16 -
const whitespace = '[\\x20\\t\\r\\n\\f]';
5 +
import { fileURLToPath } from "url";
6 +
import path from "path";
7 +
8 +
import { urlToRequest, interpolateName } from "loader-utils";
9 +
import cssesc from "cssesc";
10 +
import modulesValues from "postcss-modules-values";
11 +
import localByDefault from "postcss-modules-local-by-default";
12 +
import extractImports from "postcss-modules-extract-imports";
13 +
import modulesScope from "postcss-modules-scope";
14 +
import camelCase from "camelcase";
15 +
16 +
const whitespace = "[\\x20\\t\\r\\n\\f]";
17 17
const unescapeRegExp = new RegExp(
18 18
  `\\\\([\\da-f]{1,6}${whitespace}?|(${whitespace})|.)`,
19 -
  'ig'
19 +
  "ig"
20 20
);
21 21
const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
22 22
@@ -41,7 +41,7 @@
Loading
41 41
}
42 42
43 43
function normalizePath(file) {
44 -
  return path.sep === '\\' ? file.replace(/\\/g, '/') : file;
44 +
  return path.sep === "\\" ? file.replace(/\\/g, "/") : file;
45 45
}
46 46
47 47
// eslint-disable-next-line no-control-regex
@@ -53,10 +53,10 @@
Loading
53 53
  return cssesc(
54 54
    localident
55 55
      // For `[hash]` placeholder
56 -
      .replace(/^((-?[0-9])|--)/, '_$1')
57 -
      .replace(filenameReservedRegex, '-')
58 -
      .replace(reControlChars, '-')
59 -
      .replace(/\./g, '-'),
56 +
      .replace(/^((-?[0-9])|--)/, "_$1")
57 +
      .replace(filenameReservedRegex, "-")
58 +
      .replace(reControlChars, "-")
59 +
      .replace(/\./g, "-"),
60 60
    { isIdentifier: true }
61 61
  );
62 62
}
@@ -81,7 +81,7 @@
Loading
81 81
  let normalizedUrl = url;
82 82
83 83
  if (isStringValue && /\\(\n|\r\n|\r|\f)/.test(normalizedUrl)) {
84 -
    normalizedUrl = normalizedUrl.replace(/\\(\n|\r\n|\r|\f)/g, '');
84 +
    normalizedUrl = normalizedUrl.replace(/\\(\n|\r\n|\r|\f)/g, "");
85 85
  }
86 86
87 87
  if (matchNativeWin32Path.test(url)) {
@@ -96,14 +96,14 @@
Loading
96 96
    return fileURLToPath(url);
97 97
  }
98 98
99 -
  return url.charAt(0) === '/'
99 +
  return url.charAt(0) === "/"
100 100
    ? urlToRequest(url, rootContext)
101 101
    : urlToRequest(url);
102 102
}
103 103
104 104
function getFilter(filter, resourcePath) {
105 105
  return (...args) => {
106 -
    if (typeof filter === 'function') {
106 +
    if (typeof filter === "function") {
107 107
      return filter(...args, resourcePath);
108 108
    }
109 109
@@ -112,7 +112,7 @@
Loading
112 112
}
113 113
114 114
function getValidLocalName(localName, exportLocalsConvention) {
115 -
  if (exportLocalsConvention === 'dashesOnly') {
115 +
  if (exportLocalsConvention === "dashesOnly") {
116 116
    return dashesCamelCase(localName);
117 117
  }
118 118
@@ -126,7 +126,7 @@
Loading
126 126
  const { resourcePath } = loaderContext;
127 127
  let isIcss;
128 128
129 -
  if (typeof rawOptions.modules === 'undefined') {
129 +
  if (typeof rawOptions.modules === "undefined") {
130 130
    const isModules = moduleRegExp.test(resourcePath);
131 131
132 132
    if (!isModules) {
@@ -137,38 +137,38 @@
Loading
137 137
      return false;
138 138
    }
139 139
  } else if (
140 -
    typeof rawOptions.modules === 'boolean' &&
140 +
    typeof rawOptions.modules === "boolean" &&
141 141
    rawOptions.modules === false
142 142
  ) {
143 143
    return false;
144 144
  }
145 145
146 146
  let modulesOptions = {
147 -
    compileType: isIcss ? 'icss' : 'module',
147 +
    compileType: isIcss ? "icss" : "module",
148 148
    auto: true,
149 -
    mode: 'local',
149 +
    mode: "local",
150 150
    exportGlobals: false,
151 -
    localIdentName: '[hash:base64]',
151 +
    localIdentName: "[hash:base64]",
152 152
    localIdentContext: loaderContext.rootContext,
153 -
    localIdentHashPrefix: '',
153 +
    localIdentHashPrefix: "",
154 154
    // eslint-disable-next-line no-undefined
155 155
    localIdentRegExp: undefined,
156 156
    // eslint-disable-next-line no-undefined
157 157
    getLocalIdent: undefined,
158 158
    namedExport: false,
159 -
    exportLocalsConvention: 'asIs',
159 +
    exportLocalsConvention: "asIs",
160 160
    exportOnlyLocals: false,
161 161
  };
162 162
163 163
  if (
164 -
    typeof rawOptions.modules === 'boolean' ||
165 -
    typeof rawOptions.modules === 'string'
164 +
    typeof rawOptions.modules === "boolean" ||
165 +
    typeof rawOptions.modules === "string"
166 166
  ) {
167 167
    modulesOptions.mode =
168 -
      typeof rawOptions.modules === 'string' ? rawOptions.modules : 'local';
168 +
      typeof rawOptions.modules === "string" ? rawOptions.modules : "local";
169 169
  } else {
170 170
    if (rawOptions.modules) {
171 -
      if (typeof rawOptions.modules.auto === 'boolean') {
171 +
      if (typeof rawOptions.modules.auto === "boolean") {
172 172
        const isModules =
173 173
          rawOptions.modules.auto && moduleRegExp.test(resourcePath);
174 174
@@ -181,7 +181,7 @@
Loading
181 181
        if (!isModules) {
182 182
          return false;
183 183
        }
184 -
      } else if (typeof rawOptions.modules.auto === 'function') {
184 +
      } else if (typeof rawOptions.modules.auto === "function") {
185 185
        const isModule = rawOptions.modules.auto(resourcePath);
186 186
187 187
        if (!isModule) {
@@ -191,16 +191,16 @@
Loading
191 191
192 192
      if (
193 193
        rawOptions.modules.namedExport === true &&
194 -
        typeof rawOptions.modules.exportLocalsConvention === 'undefined'
194 +
        typeof rawOptions.modules.exportLocalsConvention === "undefined"
195 195
      ) {
196 -
        modulesOptions.exportLocalsConvention = 'camelCaseOnly';
196 +
        modulesOptions.exportLocalsConvention = "camelCaseOnly";
197 197
      }
198 198
    }
199 199
200 200
    modulesOptions = { ...modulesOptions, ...(rawOptions.modules || {}) };
201 201
  }
202 202
203 -
  if (typeof modulesOptions.mode === 'function') {
203 +
  if (typeof modulesOptions.mode === "function") {
204 204
    modulesOptions.mode = modulesOptions.mode(loaderContext.resourcePath);
205 205
  }
206 206
@@ -212,8 +212,8 @@
Loading
212 212
    }
213 213
214 214
    if (
215 -
      modulesOptions.exportLocalsConvention !== 'camelCaseOnly' &&
216 -
      modulesOptions.exportLocalsConvention !== 'dashesOnly'
215 +
      modulesOptions.exportLocalsConvention !== "camelCaseOnly" &&
216 +
      modulesOptions.exportLocalsConvention !== "dashesOnly"
217 217
    ) {
218 218
      throw new Error(
219 219
        'The "modules.namedExport" option requires the "modules.exportLocalsConvention" option to be "camelCaseOnly" or "dashesOnly"'
@@ -223,7 +223,7 @@
Loading
223 223
224 224
  if (/\[emoji(?::(\d+))?\]/i.test(modulesOptions.localIdentName)) {
225 225
    loaderContext.emitWarning(
226 -
      'Emoji is deprecated and will be removed in next major release.'
226 +
      "Emoji is deprecated and will be removed in next major release."
227 227
    );
228 228
  }
229 229
@@ -234,19 +234,19 @@
Loading
234 234
  const modulesOptions = getModulesOptions(rawOptions, loaderContext);
235 235
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 240
    sourceMap:
241 -
      typeof rawOptions.sourceMap === 'boolean'
241 +
      typeof rawOptions.sourceMap === "boolean"
242 242
        ? rawOptions.sourceMap
243 243
        : loaderContext.sourceMap,
244 244
    importLoaders:
245 -
      typeof rawOptions.importLoaders === 'string'
245 +
      typeof rawOptions.importLoaders === "string"
246 246
        ? parseInt(rawOptions.importLoaders, 10)
247 247
        : rawOptions.importLoaders,
248 248
    esModule:
249 -
      typeof rawOptions.esModule === 'undefined' ? true : rawOptions.esModule,
249 +
      typeof rawOptions.esModule === "undefined" ? true : rawOptions.esModule,
250 250
  };
251 251
}
252 252
@@ -255,7 +255,7 @@
Loading
255 255
    return false;
256 256
  }
257 257
258 -
  if (typeof options.import === 'boolean') {
258 +
  if (typeof options.import === "boolean") {
259 259
    return options.import;
260 260
  }
261 261
@@ -267,7 +267,7 @@
Loading
267 267
    return false;
268 268
  }
269 269
270 -
  if (typeof options.url === 'boolean') {
270 +
  if (typeof options.url === "boolean") {
271 271
    return options.url;
272 272
  }
273 273
@@ -275,7 +275,7 @@
Loading
275 275
}
276 276
277 277
function shouldUseModulesPlugins(options) {
278 -
  return options.modules.compileType === 'module';
278 +
  return options.modules.compileType === "module";
279 279
}
280 280
281 281
function shouldUseIcssPlugin(options) {
@@ -303,7 +303,7 @@
Loading
303 303
        generateScopedName(exportName) {
304 304
          let localIdent;
305 305
306 -
          if (typeof getLocalIdent !== 'undefined') {
306 +
          if (typeof getLocalIdent !== "undefined") {
307 307
            localIdent = getLocalIdent(
308 308
              loaderContext,
309 309
              localIdentName,
@@ -318,7 +318,7 @@
Loading
318 318
319 319
          // A null/undefined value signals that we should invoke the default
320 320
          // getLocalIdent method.
321 -
          if (typeof localIdent === 'undefined' || localIdent === null) {
321 +
          if (typeof localIdent === "undefined" || localIdent === null) {
322 322
            localIdent = defaultGetLocalIdent(
323 323
              loaderContext,
324 324
              localIdentName,
@@ -352,19 +352,19 @@
Loading
352 352
const ABSOLUTE_SCHEME = /^[a-z0-9+\-.]+:/i;
353 353
354 354
function getURLType(source) {
355 -
  if (source[0] === '/') {
356 -
    if (source[1] === '/') {
357 -
      return 'scheme-relative';
355 +
  if (source[0] === "/") {
356 +
    if (source[1] === "/") {
357 +
      return "scheme-relative";
358 358
    }
359 359
360 -
    return 'path-absolute';
360 +
    return "path-absolute";
361 361
  }
362 362
363 363
  if (IS_NATIVE_WIN32_PATH.test(source)) {
364 -
    return 'path-absolute';
364 +
    return "path-absolute";
365 365
  }
366 366
367 -
  return ABSOLUTE_SCHEME.test(source) ? 'absolute' : 'path-relative';
367 +
  return ABSOLUTE_SCHEME.test(source) ? "absolute" : "path-relative";
368 368
}
369 369
370 370
function normalizeSourceMap(map, resourcePath) {
@@ -372,7 +372,7 @@
Loading
372 372
373 373
  // Some loader emit source map as string
374 374
  // Strip any JSON XSSI avoidance prefix from the string (as documented in the source maps specification), and then parse the string as JSON.
375 -
  if (typeof newMap === 'string') {
375 +
  if (typeof newMap === "string") {
376 376
    newMap = JSON.parse(newMap);
377 377
  }
378 378
@@ -387,16 +387,16 @@
Loading
387 387
    // We should normalize path because previous loaders like `sass-loader` using backslash when generate source map
388 388
    newMap.sources = newMap.sources.map((source) => {
389 389
      // Non-standard syntax from `postcss`
390 -
      if (source.indexOf('<') === 0) {
390 +
      if (source.indexOf("<") === 0) {
391 391
        return source;
392 392
      }
393 393
394 394
      const sourceType = getURLType(source);
395 395
396 396
      // Do no touch `scheme-relative` and `absolute` URLs
397 -
      if (sourceType === 'path-relative' || sourceType === 'path-absolute') {
397 +
      if (sourceType === "path-relative" || sourceType === "path-absolute") {
398 398
        const absoluteSource =
399 -
          sourceType === 'path-relative' && sourceRoot
399 +
          sourceType === "path-relative" && sourceRoot
400 400
            ? path.resolve(sourceRoot, normalizePath(source))
401 401
            : normalizePath(source);
402 402
@@ -419,15 +419,15 @@
Loading
419 419
    }
420 420
421 421
    if (number === false) {
422 -
      cache[number] = '';
422 +
      cache[number] = "";
423 423
    } else {
424 424
      const loadersRequest = loaders
425 425
        .slice(
426 426
          loaderIndex,
427 -
          loaderIndex + 1 + (typeof number !== 'number' ? 0 : number)
427 +
          loaderIndex + 1 + (typeof number !== "number" ? 0 : number)
428 428
        )
429 429
        .map((x) => x.request)
430 -
        .join('!');
430 +
        .join("!");
431 431
432 432
      cache[number] = `-!${loadersRequest}!`;
433 433
    }
@@ -437,7 +437,7 @@
Loading
437 437
}
438 438
439 439
function getImportCode(imports, options) {
440 -
  let code = '';
440 +
  let code = "";
441 441
442 442
  for (const item of imports) {
443 443
    const { importName, url, icss } = item;
@@ -445,7 +445,7 @@
Loading
445 445
    if (options.esModule) {
446 446
      if (icss && options.modules.namedExport) {
447 447
        code += `import ${
448 -
          options.modules.exportOnlyLocals ? '' : `${importName}, `
448 +
          options.modules.exportOnlyLocals ? "" : `${importName}, `
449 449
        }* as ${importName}_NAMED___ from ${url};\n`;
450 450
      } else {
451 451
        code += `import ${importName} from ${url};\n`;
@@ -455,7 +455,7 @@
Loading
455 455
    }
456 456
  }
457 457
458 -
  return code ? `// Imports\n${code}` : '';
458 +
  return code ? `// Imports\n${code}` : "";
459 459
}
460 460
461 461
function normalizeSourceMapForRuntime(map, loaderContext) {
@@ -464,17 +464,17 @@
Loading
464 464
  if (resultMap) {
465 465
    delete resultMap.file;
466 466
467 -
    resultMap.sourceRoot = '';
467 +
    resultMap.sourceRoot = "";
468 468
469 469
    resultMap.sources = resultMap.sources.map((source) => {
470 470
      // Non-standard syntax from `postcss`
471 -
      if (source.indexOf('<') === 0) {
471 +
      if (source.indexOf("<") === 0) {
472 472
        return source;
473 473
      }
474 474
475 475
      const sourceType = getURLType(source);
476 476
477 -
      if (sourceType !== 'path-relative') {
477 +
      if (sourceType !== "path-relative") {
478 478
        return source;
479 479
      }
480 480
@@ -493,19 +493,19 @@
Loading
493 493
494 494
function getModuleCode(result, api, replacements, options, loaderContext) {
495 495
  if (options.modules.exportOnlyLocals === true) {
496 -
    return '';
496 +
    return "";
497 497
  }
498 498
499 499
  const sourceMapValue = options.sourceMap
500 500
    ? `,${normalizeSourceMapForRuntime(result.map, loaderContext)}`
501 -
    : '';
501 +
    : "";
502 502
503 503
  let code = JSON.stringify(result.css);
504 504
505 505
  let beforeCode = `var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(${
506 506
    options.sourceMap
507 -
      ? '___CSS_LOADER_API_SOURCEMAP_IMPORT___'
508 -
      : 'function(i){return i[1]}'
507 +
      ? "___CSS_LOADER_API_SOURCEMAP_IMPORT___"
508 +
      : "function(i){return i[1]}"
509 509
  });\n`;
510 510
511 511
  for (const item of api) {
@@ -514,17 +514,17 @@
Loading
514 514
    beforeCode += url
515 515
      ? `___CSS_LOADER_EXPORT___.push([module.id, ${JSON.stringify(
516 516
          `@import url(${url});`
517 -
        )}${media ? `, ${JSON.stringify(media)}` : ''}]);\n`
517 +
        )}${media ? `, ${JSON.stringify(media)}` : ""}]);\n`
518 518
      : `___CSS_LOADER_EXPORT___.i(${item.importName}${
519 -
          media ? `, ${JSON.stringify(media)}` : dedupe ? ', ""' : ''
520 -
        }${dedupe ? ', true' : ''});\n`;
519 +
          media ? `, ${JSON.stringify(media)}` : dedupe ? ', ""' : ""
520 +
        }${dedupe ? ", true" : ""});\n`;
521 521
  }
522 522
523 523
  for (const item of replacements) {
524 524
    const { replacementName, importName, localName } = item;
525 525
526 526
    if (localName) {
527 -
      code = code.replace(new RegExp(replacementName, 'g'), () =>
527 +
      code = code.replace(new RegExp(replacementName, "g"), () =>
528 528
        options.modules.namedExport
529 529
          ? `" + ${importName}_NAMED___[${JSON.stringify(
530 530
              getValidLocalName(
@@ -538,13 +538,13 @@
Loading
538 538
      const { hash, needQuotes } = item;
539 539
      const getUrlOptions = []
540 540
        .concat(hash ? [`hash: ${JSON.stringify(hash)}`] : [])
541 -
        .concat(needQuotes ? 'needQuotes: true' : []);
541 +
        .concat(needQuotes ? "needQuotes: true" : []);
542 542
      const preparedOptions =
543 -
        getUrlOptions.length > 0 ? `, { ${getUrlOptions.join(', ')} }` : '';
543 +
        getUrlOptions.length > 0 ? `, { ${getUrlOptions.join(", ")} }` : "";
544 544
545 545
      beforeCode += `var ${replacementName} = ___CSS_LOADER_GET_URL_IMPORT___(${importName}${preparedOptions});\n`;
546 546
      code = code.replace(
547 -
        new RegExp(replacementName, 'g'),
547 +
        new RegExp(replacementName, "g"),
548 548
        () => `" + ${replacementName} + "`
549 549
      );
550 550
    }
@@ -560,8 +560,8 @@
Loading
560 560
}
561 561
562 562
function getExportCode(exports, replacements, options) {
563 -
  let code = '// Exports\n';
564 -
  let localsCode = '';
563 +
  let code = "// Exports\n";
564 +
  let localsCode = "";
565 565
566 566
  const addExportToLocalsCode = (name, value) => {
567 567
    if (options.modules.namedExport) {
@@ -577,7 +577,7 @@
Loading
577 577
578 578
  for (const { name, value } of exports) {
579 579
    switch (options.modules.exportLocalsConvention) {
580 -
      case 'camelCase': {
580 +
      case "camelCase": {
581 581
        addExportToLocalsCode(name, value);
582 582
583 583
        const modifiedName = camelCase(name);
@@ -587,11 +587,11 @@
Loading
587 587
        }
588 588
        break;
589 589
      }
590 -
      case 'camelCaseOnly': {
590 +
      case "camelCaseOnly": {
591 591
        addExportToLocalsCode(camelCase(name), value);
592 592
        break;
593 593
      }
594 -
      case 'dashes': {
594 +
      case "dashes": {
595 595
        addExportToLocalsCode(name, value);
596 596
597 597
        const modifiedName = dashesCamelCase(name);
@@ -601,11 +601,11 @@
Loading
601 601
        }
602 602
        break;
603 603
      }
604 -
      case 'dashesOnly': {
604 +
      case "dashesOnly": {
605 605
        addExportToLocalsCode(dashesCamelCase(name), value);
606 606
        break;
607 607
      }
608 -
      case 'asIs':
608 +
      case "asIs":
609 609
      default:
610 610
        addExportToLocalsCode(name, value);
611 611
        break;
@@ -618,7 +618,7 @@
Loading
618 618
    if (localName) {
619 619
      const { importName } = item;
620 620
621 -
      localsCode = localsCode.replace(new RegExp(replacementName, 'g'), () => {
621 +
      localsCode = localsCode.replace(new RegExp(replacementName, "g"), () => {
622 622
        if (options.modules.namedExport) {
623 623
          return `" + ${importName}_NAMED___[${JSON.stringify(
624 624
            getValidLocalName(localName, options.modules.exportLocalsConvention)
@@ -631,7 +631,7 @@
Loading
631 631
      });
632 632
    } else {
633 633
      localsCode = localsCode.replace(
634 -
        new RegExp(replacementName, 'g'),
634 +
        new RegExp(replacementName, "g"),
635 635
        () => `" + ${replacementName} + "`
636 636
      );
637 637
    }
@@ -641,7 +641,7 @@
Loading
641 641
    code += options.modules.namedExport
642 642
      ? localsCode
643 643
      : `${
644 -
          options.esModule ? 'export default' : 'module.exports ='
644 +
          options.esModule ? "export default" : "module.exports ="
645 645
        } {\n${localsCode}\n};\n`;
646 646
647 647
    return code;
@@ -654,7 +654,7 @@
Loading
654 654
  }
655 655
656 656
  code += `${
657 -
    options.esModule ? 'export default' : 'module.exports ='
657 +
    options.esModule ? "export default" : "module.exports ="
658 658
  } ___CSS_LOADER_EXPORT___;\n`;
659 659
660 660
  return code;

@@ -1,15 +1,15 @@
Loading
1 -
import valueParser from 'postcss-value-parser';
1 +
import valueParser from "postcss-value-parser";
2 2
3 3
import {
4 4
  normalizeUrl,
5 5
  resolveRequests,
6 6
  isUrlRequestable,
7 7
  requestify,
8 -
} from '../utils';
8 +
} from "../utils";
9 9
10 10
function visitor(result, parsedResults, node, key) {
11 11
  // Convert only top-level @import
12 -
  if (node.parent.type !== 'root') {
12 +
  if (node.parent.type !== "root") {
13 13
    return;
14 14
  }
15 15
@@ -29,7 +29,7 @@
Loading
29 29
  // Invalid type - `@import foo-bar;`
30 30
  if (
31 31
    paramsNodes.length === 0 ||
32 -
    (paramsNodes[0].type !== 'string' && paramsNodes[0].type !== 'function')
32 +
    (paramsNodes[0].type !== "string" && paramsNodes[0].type !== "function")
33 33
  ) {
34 34
    result.warn(`Unable to find uri in "${node.toString()}"`, { node });
35 35
@@ -39,12 +39,12 @@
Loading
39 39
  let isStringValue;
40 40
  let url;
41 41
42 -
  if (paramsNodes[0].type === 'string') {
42 +
  if (paramsNodes[0].type === "string") {
43 43
    isStringValue = true;
44 44
    url = paramsNodes[0].value;
45 45
  } else {
46 46
    // Invalid function - `@import nourl(test.css);`
47 -
    if (paramsNodes[0].value.toLowerCase() !== 'url') {
47 +
    if (paramsNodes[0].value.toLowerCase() !== "url") {
48 48
      result.warn(`Unable to find uri in "${node.toString()}"`, { node });
49 49
50 50
      return;
@@ -52,7 +52,7 @@
Loading
52 52
53 53
    isStringValue =
54 54
      paramsNodes[0].nodes.length !== 0 &&
55 -
      paramsNodes[0].nodes[0].type === 'string';
55 +
      paramsNodes[0].nodes[0].type === "string";
56 56
    url = isStringValue
57 57
      ? paramsNodes[0].nodes[0].value
58 58
      : valueParser.stringify(paramsNodes[0].nodes);
@@ -75,14 +75,14 @@
Loading
75 75
76 76
const plugin = (options = {}) => {
77 77
  return {
78 -
    postcssPlugin: 'postcss-import-parser',
78 +
    postcssPlugin: "postcss-import-parser",
79 79
    prepare(result) {
80 80
      const parsedResults = [];
81 81
82 82
      return {
83 83
        AtRule: {
84 84
          import(atRule) {
85 -
            visitor(result, parsedResults, atRule, 'params');
85 +
            visitor(result, parsedResults, atRule, "params");
86 86
          },
87 87
        },
88 88
        async OnceExit() {
@@ -97,16 +97,16 @@
Loading
97 97
            const { node, url, isStringValue, mediaNodes } = parsedResult;
98 98
99 99
            let normalizedUrl = url;
100 -
            let prefix = '';
100 +
            let prefix = "";
101 101
102 102
            const isRequestable = isUrlRequestable(normalizedUrl);
103 103
104 104
            if (isRequestable) {
105 -
              const queryParts = normalizedUrl.split('!');
105 +
              const queryParts = normalizedUrl.split("!");
106 106
107 107
              if (queryParts.length > 1) {
108 108
                normalizedUrl = queryParts.pop();
109 -
                prefix = queryParts.join('!');
109 +
                prefix = queryParts.join("!");
110 110
              }
111 111
112 112
              normalizedUrl = normalizeUrl(normalizedUrl, isStringValue);

@@ -1,11 +1,11 @@
Loading
1 -
import valueParser from 'postcss-value-parser';
1 +
import valueParser from "postcss-value-parser";
2 2
3 3
import {
4 4
  normalizeUrl,
5 5
  requestify,
6 6
  resolveRequests,
7 7
  isUrlRequestable,
8 -
} from '../utils';
8 +
} from "../utils";
9 9
10 10
const isUrlFunc = /url/i;
11 11
const isImageSetFunc = /^(?:-webkit-)?image-set$/i;
@@ -17,7 +17,7 @@
Loading
17 17
18 18
function shouldHandleRule(rule, node, result) {
19 19
  // https://www.w3.org/TR/css-syntax-3/#typedef-url-token
20 -
  if (rule.url.replace(/^[\s]+|[\s]+$/g, '').length === 0) {
20 +
  if (rule.url.replace(/^[\s]+|[\s]+$/g, "").length === 0) {
21 21
    result.warn(`Unable to find uri in '${node.toString()}'`, { node });
22 22
23 23
    return false;
@@ -38,13 +38,13 @@
Loading
38 38
  const parsed = valueParser(node[key]);
39 39
40 40
  parsed.walk((valueNode) => {
41 -
    if (valueNode.type !== 'function') {
41 +
    if (valueNode.type !== "function") {
42 42
      return;
43 43
    }
44 44
45 45
    if (isUrlFunc.test(valueNode.value)) {
46 46
      const { nodes } = valueNode;
47 -
      const isStringValue = nodes.length !== 0 && nodes[0].type === 'string';
47 +
      const isStringValue = nodes.length !== 0 && nodes[0].type === "string";
48 48
      const url = isStringValue ? nodes[0].value : valueParser.stringify(nodes);
49 49
50 50
      const rule = {
@@ -65,10 +65,10 @@
Loading
65 65
      for (const nNode of valueNode.nodes) {
66 66
        const { type, value } = nNode;
67 67
68 -
        if (type === 'function' && isUrlFunc.test(value)) {
68 +
        if (type === "function" && isUrlFunc.test(value)) {
69 69
          const { nodes } = nNode;
70 70
          const isStringValue =
71 -
            nodes.length !== 0 && nodes[0].type === 'string';
71 +
            nodes.length !== 0 && nodes[0].type === "string";
72 72
          const url = isStringValue
73 73
            ? nodes[0].value
74 74
            : valueParser.stringify(nodes);
@@ -87,7 +87,7 @@
Loading
87 87
              parsed,
88 88
            });
89 89
          }
90 -
        } else if (type === 'string') {
90 +
        } else if (type === "string") {
91 91
          const rule = {
92 92
            node: nNode,
93 93
            url: value,
@@ -114,13 +114,13 @@
Loading
114 114
115 115
const plugin = (options = {}) => {
116 116
  return {
117 -
    postcssPlugin: 'postcss-url-parser',
117 +
    postcssPlugin: "postcss-url-parser",
118 118
    prepare(result) {
119 119
      const parsedResults = [];
120 120
121 121
      return {
122 122
        Declaration(declaration) {
123 -
          visitor(result, parsedResults, declaration, 'value');
123 +
          visitor(result, parsedResults, declaration, "value");
124 124
        },
125 125
        async OnceExit() {
126 126
          if (parsedResults.length === 0) {
@@ -137,13 +137,13 @@
Loading
137 137
            const { url, isStringValue } = parsedResult.rule;
138 138
139 139
            let normalizedUrl = url;
140 -
            let prefix = '';
140 +
            let prefix = "";
141 141
142 -
            const queryParts = normalizedUrl.split('!');
142 +
            const queryParts = normalizedUrl.split("!");
143 143
144 144
            if (queryParts.length > 1) {
145 145
              normalizedUrl = queryParts.pop();
146 -
              prefix = queryParts.join('!');
146 +
              prefix = queryParts.join("!");
147 147
            }
148 148
149 149
            normalizedUrl = normalizeUrl(normalizedUrl, isStringValue);
@@ -155,9 +155,9 @@
Loading
155 155
156 156
            if (!hasUrlImportHelper) {
157 157
              options.imports.push({
158 -
                importName: '___CSS_LOADER_GET_URL_IMPORT___',
158 +
                importName: "___CSS_LOADER_GET_URL_IMPORT___",
159 159
                url: options.urlHandler(
160 -
                  require.resolve('../runtime/getUrl.js')
160 +
                  require.resolve("../runtime/getUrl.js")
161 161
                ),
162 162
                index: -1,
163 163
              });
@@ -168,8 +168,8 @@
Loading
168 168
            const splittedUrl = normalizedUrl.split(/(\?)?#/);
169 169
            const [pathname, query, hashOrQuery] = splittedUrl;
170 170
171 -
            let hash = query ? '?' : '';
172 -
            hash += hashOrQuery ? `#${hashOrQuery}` : '';
171 +
            let hash = query ? "?" : "";
172 +
            hash += hashOrQuery ? `#${hashOrQuery}` : "";
173 173
174 174
            const request = requestify(pathname, options.rootContext);
175 175
@@ -226,7 +226,7 @@
Loading
226 226
            }
227 227
228 228
            // eslint-disable-next-line no-param-reassign
229 -
            rule.node.type = 'word';
229 +
            rule.node.type = "word";
230 230
            // eslint-disable-next-line no-param-reassign
231 231
            rule.node.value = replacementName;
232 232

@@ -17,15 +17,15 @@
Loading
17 17
      }
18 18
19 19
      return content;
20 -
    }).join('');
20 +
    }).join("");
21 21
  };
22 22
23 23
  // import a list of modules into the list
24 24
  // eslint-disable-next-line func-names
25 25
  list.i = function (modules, mediaQuery, dedupe) {
26 -
    if (typeof modules === 'string') {
26 +
    if (typeof modules === "string") {
27 27
      // eslint-disable-next-line no-param-reassign
28 -
      modules = [[null, modules, '']];
28 +
      modules = [[null, modules, ""]];
29 29
    }
30 30
31 31
    const alreadyImportedModules = {};

@@ -1,3 +1,3 @@
Loading
1 -
const loader = require('./index');
1 +
const loader = require("./index");
2 2
3 3
module.exports = loader.default;

@@ -1,7 +1,7 @@
Loading
1 1
module.exports = function cssWithMappingToString(item) {
2 2
  const [, content, , cssMapping] = item;
3 3
4 -
  if (typeof btoa === 'function') {
4 +
  if (typeof btoa === "function") {
5 5
    // eslint-disable-next-line no-undef
6 6
    const base64 = btoa(
7 7
      unescape(encodeURIComponent(JSON.stringify(cssMapping)))
@@ -10,11 +10,11 @@
Loading
10 10
    const sourceMapping = `/*# ${data} */`;
11 11
12 12
    const sourceURLs = cssMapping.sources.map(
13 -
      (source) => `/*# sourceURL=${cssMapping.sourceRoot || ''}${source} */`
13 +
      (source) => `/*# sourceURL=${cssMapping.sourceRoot || ""}${source} */`
14 14
    );
15 15
16 -
    return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
16 +
    return [content].concat(sourceURLs).concat([sourceMapping]).join("\n");
17 17
  }
18 18
19 -
  return [content].join('\n');
19 +
  return [content].join("\n");
20 20
};

@@ -1,10 +1,10 @@
Loading
1 -
import { extractICSS, replaceValueSymbols, replaceSymbols } from 'icss-utils';
1 +
import { extractICSS, replaceValueSymbols, replaceSymbols } from "icss-utils";
2 2
3 -
import { normalizeUrl, resolveRequests, requestify } from '../utils';
3 +
import { normalizeUrl, resolveRequests, requestify } from "../utils";
4 4
5 5
const plugin = (options = {}) => {
6 6
  return {
7 -
    postcssPlugin: 'postcss-icss-parser',
7 +
    postcssPlugin: "postcss-icss-parser",
8 8
    async OnceExit(root) {
9 9
      const importReplacements = Object.create(null);
10 10
      const { icssImports, icssExports } = extractICSS(root);
@@ -21,13 +21,13 @@
Loading
21 21
        }
22 22
23 23
        let normalizedUrl = url;
24 -
        let prefix = '';
24 +
        let prefix = "";
25 25
26 -
        const queryParts = normalizedUrl.split('!');
26 +
        const queryParts = normalizedUrl.split("!");
27 27
28 28
        if (queryParts.length > 1) {
29 29
          normalizedUrl = queryParts.pop();
30 -
          prefix = queryParts.join('!');
30 +
          prefix = queryParts.join("!");
31 31
        }
32 32
33 33
        const request = requestify(

@@ -2,16 +2,16 @@
Loading
2 2
  MIT License http://www.opensource.org/licenses/mit-license.php
3 3
  Author Tobias Koppers @sokra
4 4
*/
5 -
import { getOptions, stringifyRequest } from 'loader-utils';
6 -
import postcss from 'postcss';
7 -
import postcssPkg from 'postcss/package.json';
8 -
import { validate } from 'schema-utils';
9 -
import { satisfies } from 'semver';
10 -
11 -
import CssSyntaxError from './CssSyntaxError';
12 -
import Warning from './Warning';
13 -
import schema from './options.json';
14 -
import { icssParser, importParser, urlParser } from './plugins';
5 +
import { getOptions, stringifyRequest } from "loader-utils";
6 +
import postcss from "postcss";
7 +
import postcssPkg from "postcss/package.json";
8 +
import { validate } from "schema-utils";
9 +
import { satisfies } from "semver";
10 +
11 +
import CssSyntaxError from "./CssSyntaxError";
12 +
import Warning from "./Warning";
13 +
import schema from "./options.json";
14 +
import { icssParser, importParser, urlParser } from "./plugins";
15 15
import {
16 16
  normalizeOptions,
17 17
  shouldUseModulesPlugins,
@@ -26,14 +26,14 @@
Loading
26 26
  getModulesPlugins,
27 27
  normalizeSourceMap,
28 28
  sort,
29 -
} from './utils';
29 +
} from "./utils";
30 30
31 31
export default async function loader(content, map, meta) {
32 32
  const rawOptions = getOptions(this);
33 33
34 34
  validate(schema, rawOptions, {
35 -
    name: 'CSS Loader',
36 -
    baseDataPath: 'options',
35 +
    name: "CSS Loader",
36 +
    baseDataPath: "options",
37 37
  });
38 38
39 39
  const plugins = [];
@@ -61,10 +61,10 @@
Loading
61 61
62 62
  if (shouldUseImportPlugin(options)) {
63 63
    const resolver = this.getResolve({
64 -
      conditionNames: ['style'],
65 -
      extensions: ['.css'],
66 -
      mainFields: ['css', 'style', 'main', '...'],
67 -
      mainFiles: ['index', '...'],
64 +
      conditionNames: ["style"],
65 +
      extensions: [".css"],
66 +
      mainFields: ["css", "style", "main", "..."],
67 +
      mainFiles: ["index", "..."],
68 68
      restrictions: [/\.css$/i],
69 69
    });
70 70
@@ -89,8 +89,8 @@
Loading
89 89
90 90
  if (shouldUseURLPlugin(options)) {
91 91
    const urlResolver = this.getResolve({
92 -
      conditionNames: ['asset'],
93 -
      mainFields: ['asset'],
92 +
      conditionNames: ["asset"],
93 +
      mainFields: ["asset"],
94 94
      mainFiles: [],
95 95
      extensions: [],
96 96
    });
@@ -113,10 +113,10 @@
Loading
113 113
114 114
  if (shouldUseIcssPlugin(options)) {
115 115
    const icssResolver = this.getResolve({
116 -
      conditionNames: ['style'],
116 +
      conditionNames: ["style"],
117 117
      extensions: [],
118 -
      mainFields: ['css', 'style', 'main', '...'],
119 -
      mainFiles: ['index', '...'],
118 +
      mainFields: ["css", "style", "main", "..."],
119 +
      mainFiles: ["index", "..."],
120 120
    });
121 121
122 122
    plugins.push(
@@ -143,7 +143,7 @@
Loading
143 143
144 144
    if (
145 145
      ast &&
146 -
      ast.type === 'postcss' &&
146 +
      ast.type === "postcss" &&
147 147
      satisfies(ast.version, `^${postcssPkg.version}`)
148 148
    ) {
149 149
      // eslint-disable-next-line no-param-reassign
@@ -174,7 +174,7 @@
Loading
174 174
    }
175 175
176 176
    callback(
177 -
      error.name === 'CssSyntaxError' ? new CssSyntaxError(error) : error
177 +
      error.name === "CssSyntaxError" ? new CssSyntaxError(error) : error
178 178
    );
179 179
180 180
    return;
@@ -194,16 +194,16 @@
Loading
194 194
195 195
  if (options.modules.exportOnlyLocals !== true) {
196 196
    imports.unshift({
197 -
      importName: '___CSS_LOADER_API_IMPORT___',
198 -
      url: stringifyRequest(this, require.resolve('./runtime/api')),
197 +
      importName: "___CSS_LOADER_API_IMPORT___",
198 +
      url: stringifyRequest(this, require.resolve("./runtime/api")),
199 199
    });
200 200
201 201
    if (options.sourceMap) {
202 202
      imports.unshift({
203 -
        importName: '___CSS_LOADER_API_SOURCEMAP_IMPORT___',
203 +
        importName: "___CSS_LOADER_API_SOURCEMAP_IMPORT___",
204 204
        url: stringifyRequest(
205 205
          this,
206 -
          require.resolve('./runtime/cssWithMappingToString')
206 +
          require.resolve("./runtime/cssWithMappingToString")
207 207
        ),
208 208
      });
209 209
    }

@@ -7,7 +7,7 @@
Loading
7 7
  // eslint-disable-next-line no-underscore-dangle, no-param-reassign
8 8
  url = url && url.__esModule ? url.default : url;
9 9
10 -
  if (typeof url !== 'string') {
10 +
  if (typeof url !== "string") {
11 11
    return url;
12 12
  }
13 13
@@ -25,7 +25,7 @@
Loading
25 25
  // Should url be wrapped?
26 26
  // See https://drafts.csswg.org/css-values-3/#urls
27 27
  if (/["'() \t\n]/.test(url) || options.needQuotes) {
28 -
    return `"${url.replace(/"/g, '\\"').replace(/\n/g, '\\n')}"`;
28 +
    return `"${url.replace(/"/g, '\\"').replace(/\n/g, "\\n")}"`;
29 29
  }
30 30
31 31
  return url;

@@ -4,17 +4,17 @@
Loading
4 4
5 5
    const { reason, line, column, file } = error;
6 6
7 -
    this.name = 'CssSyntaxError';
7 +
    this.name = "CssSyntaxError";
8 8
9 9
    // Based on https://github.com/postcss/postcss/blob/master/lib/css-syntax-error.es6#L132
10 10
    // We don't need `plugin` and `file` properties.
11 11
    this.message = `${this.name}\n\n`;
12 12
13 -
    if (typeof line !== 'undefined') {
13 +
    if (typeof line !== "undefined") {
14 14
      this.message += `(${line}:${column}) `;
15 15
    }
16 16
17 -
    this.message += file ? `${file} ` : '<css input> ';
17 +
    this.message += file ? `${file} ` : "<css input> ";
18 18
    this.message += `${reason}`;
19 19
20 20
    const code = error.showSourceCode();
Files Coverage
src 99.42%
Project Totals (11 files) 99.42%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading