css-loader 6.7.0 → 6.7.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.
@@ -5,68 +5,55 @@
5
5
  Author Tobias Koppers @sokra
6
6
  */
7
7
  module.exports = function (cssWithMappingToString) {
8
- var list = []; // return the list of modules as css string
8
+ var list = [];
9
9
 
10
+ // return the list of modules as css string
10
11
  list.toString = function toString() {
11
12
  return this.map(function (item) {
12
13
  var content = "";
13
14
  var needLayer = typeof item[5] !== "undefined";
14
-
15
15
  if (item[4]) {
16
16
  content += "@supports (".concat(item[4], ") {");
17
17
  }
18
-
19
18
  if (item[2]) {
20
19
  content += "@media ".concat(item[2], " {");
21
20
  }
22
-
23
21
  if (needLayer) {
24
22
  content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
25
23
  }
26
-
27
24
  content += cssWithMappingToString(item);
28
-
29
25
  if (needLayer) {
30
26
  content += "}";
31
27
  }
32
-
33
28
  if (item[2]) {
34
29
  content += "}";
35
30
  }
36
-
37
31
  if (item[4]) {
38
32
  content += "}";
39
33
  }
40
-
41
34
  return content;
42
35
  }).join("");
43
- }; // import a list of modules into the list
44
-
36
+ };
45
37
 
38
+ // import a list of modules into the list
46
39
  list.i = function i(modules, media, dedupe, supports, layer) {
47
40
  if (typeof modules === "string") {
48
41
  modules = [[null, modules, undefined]];
49
42
  }
50
-
51
43
  var alreadyImportedModules = {};
52
-
53
44
  if (dedupe) {
54
45
  for (var k = 0; k < this.length; k++) {
55
46
  var id = this[k][0];
56
-
57
47
  if (id != null) {
58
48
  alreadyImportedModules[id] = true;
59
49
  }
60
50
  }
61
51
  }
62
-
63
52
  for (var _k = 0; _k < modules.length; _k++) {
64
53
  var item = [].concat(modules[_k]);
65
-
66
54
  if (dedupe && alreadyImportedModules[item[0]]) {
67
55
  continue;
68
56
  }
69
-
70
57
  if (typeof layer !== "undefined") {
71
58
  if (typeof item[5] === "undefined") {
72
59
  item[5] = layer;
@@ -75,7 +62,6 @@ module.exports = function (cssWithMappingToString) {
75
62
  item[5] = layer;
76
63
  }
77
64
  }
78
-
79
65
  if (media) {
80
66
  if (!item[2]) {
81
67
  item[2] = media;
@@ -84,7 +70,6 @@ module.exports = function (cssWithMappingToString) {
84
70
  item[2] = media;
85
71
  }
86
72
  }
87
-
88
73
  if (supports) {
89
74
  if (!item[4]) {
90
75
  item[4] = "".concat(supports);
@@ -93,10 +78,8 @@ module.exports = function (cssWithMappingToString) {
93
78
  item[4] = supports;
94
79
  }
95
80
  }
96
-
97
81
  list.push(item);
98
82
  }
99
83
  };
100
-
101
84
  return list;
102
85
  };
@@ -4,26 +4,23 @@ module.exports = function (url, options) {
4
4
  if (!options) {
5
5
  options = {};
6
6
  }
7
-
8
7
  if (!url) {
9
8
  return url;
10
9
  }
10
+ url = String(url.__esModule ? url.default : url);
11
11
 
12
- url = String(url.__esModule ? url.default : url); // If url is already wrapped in quotes, remove them
13
-
12
+ // If url is already wrapped in quotes, remove them
14
13
  if (/^['"].*['"]$/.test(url)) {
15
14
  url = url.slice(1, -1);
16
15
  }
17
-
18
16
  if (options.hash) {
19
17
  url += options.hash;
20
- } // Should url be wrapped?
21
- // See https://drafts.csswg.org/css-values-3/#urls
22
-
18
+ }
23
19
 
20
+ // Should url be wrapped?
21
+ // See https://drafts.csswg.org/css-values-3/#urls
24
22
  if (/["'() \t\n]|(%20)/.test(url) || options.needQuotes) {
25
23
  return "\"".concat(url.replace(/"/g, '\\"').replace(/\n/g, "\\n"), "\"");
26
24
  }
27
-
28
25
  return url;
29
26
  };
@@ -3,11 +3,9 @@
3
3
  module.exports = function (item) {
4
4
  var content = item[1];
5
5
  var cssMapping = item[3];
6
-
7
6
  if (!cssMapping) {
8
7
  return content;
9
8
  }
10
-
11
9
  if (typeof btoa === "function") {
12
10
  var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));
13
11
  var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
@@ -17,6 +15,5 @@ module.exports = function (item) {
17
15
  });
18
16
  return [content].concat(sourceURLs).concat([sourceMapping]).join("\n");
19
17
  }
20
-
21
18
  return [content].join("\n");
22
19
  };