css-loader 5.2.3 → 5.2.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [5.2.4](https://github.com/webpack-contrib/css-loader/compare/v5.2.3...v5.2.4) (2021-04-19)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * do not crash on 'false' aliases ([#1292](https://github.com/webpack-contrib/css-loader/issues/1292)) ([e913cb1](https://github.com/webpack-contrib/css-loader/commit/e913cb1d73a4f5c3c4464e0446a885e9f677a005))
11
+
5
12
  ### [5.2.3](https://github.com/webpack-contrib/css-loader/compare/v5.2.2...v5.2.3) (2021-04-19)
6
13
 
7
14
  ### Bug Fixes
@@ -47,6 +47,12 @@ const plugin = (options = {}) => {
47
47
  context
48
48
  } = options;
49
49
  const resolvedUrl = await (0, _utils.resolveRequests)(resolver, context, [...new Set([normalizedUrl, request])]);
50
+
51
+ if (!resolvedUrl) {
52
+ return;
53
+ } // eslint-disable-next-line consistent-return
54
+
55
+
50
56
  return {
51
57
  url: resolvedUrl,
52
58
  prefix,
@@ -60,12 +66,14 @@ const plugin = (options = {}) => {
60
66
  const results = await Promise.all(tasks);
61
67
 
62
68
  for (let index = 0; index <= results.length - 1; index++) {
63
- const {
64
- url,
65
- prefix,
66
- tokens
67
- } = results[index];
68
- const newUrl = prefix ? `${prefix}!${url}` : url;
69
+ const item = results[index];
70
+
71
+ if (!item) {
72
+ // eslint-disable-next-line no-continue
73
+ continue;
74
+ }
75
+
76
+ const newUrl = item.prefix ? `${item.prefix}!${item.url}` : item.url;
69
77
  const importKey = newUrl;
70
78
  let importName = imports.get(importKey);
71
79
 
@@ -85,9 +93,9 @@ const plugin = (options = {}) => {
85
93
  });
86
94
  }
87
95
 
88
- for (const [replacementIndex, token] of Object.keys(tokens).entries()) {
96
+ for (const [replacementIndex, token] of Object.keys(item.tokens).entries()) {
89
97
  const replacementName = `___CSS_LOADER_ICSS_IMPORT_${index}_REPLACEMENT_${replacementIndex}___`;
90
- const localName = tokens[token];
98
+ const localName = item.tokens[token];
91
99
  importReplacements[token] = replacementName;
92
100
  options.replacements.push({
93
101
  replacementName,
@@ -155,12 +155,10 @@ const plugin = (options = {}) => {
155
155
  const needKeep = await options.filter(url, media);
156
156
 
157
157
  if (!needKeep) {
158
- return null;
158
+ return;
159
159
  }
160
160
  }
161
161
 
162
- atRule.remove();
163
-
164
162
  if (isRequestable) {
165
163
  const request = (0, _utils.requestify)(url, options.rootContext);
166
164
  const {
@@ -168,6 +166,13 @@ const plugin = (options = {}) => {
168
166
  context
169
167
  } = options;
170
168
  const resolvedUrl = await (0, _utils.resolveRequests)(resolver, context, [...new Set([request, url])]);
169
+
170
+ if (!resolvedUrl) {
171
+ return;
172
+ }
173
+
174
+ atRule.remove(); // eslint-disable-next-line consistent-return
175
+
171
176
  return {
172
177
  url: resolvedUrl,
173
178
  media,
@@ -176,6 +181,8 @@ const plugin = (options = {}) => {
176
181
  };
177
182
  }
178
183
 
184
+ atRule.remove(); // eslint-disable-next-line consistent-return
185
+
179
186
  return {
180
187
  url,
181
188
  media,
@@ -268,7 +268,7 @@ const plugin = (options = {}) => {
268
268
  const needKeep = await options.filter(url);
269
269
 
270
270
  if (!needKeep) {
271
- return null;
271
+ return;
272
272
  }
273
273
  }
274
274
 
@@ -282,18 +282,23 @@ const plugin = (options = {}) => {
282
282
  context
283
283
  } = options;
284
284
  const resolvedUrl = await (0, _utils.resolveRequests)(resolver, context, [...new Set([request, url])]);
285
+
286
+ if (!resolvedUrl) {
287
+ return;
288
+ } // eslint-disable-next-line consistent-return
289
+
290
+
285
291
  return { ...parsedDeclaration,
286
292
  url: resolvedUrl,
287
293
  hash
288
294
  };
289
295
  }));
290
- const results = await Promise.all(resolvedDeclarations);
291
296
  const urlToNameMap = new Map();
292
297
  const urlToReplacementMap = new Map();
293
298
  let hasUrlImportHelper = false;
294
299
 
295
- for (let index = 0; index <= results.length - 1; index++) {
296
- const item = results[index];
300
+ for (let index = 0; index <= resolvedDeclarations.length - 1; index++) {
301
+ const item = resolvedDeclarations[index];
297
302
 
298
303
  if (!item) {
299
304
  // eslint-disable-next-line no-continue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "css-loader",
3
- "version": "5.2.3",
3
+ "version": "5.2.4",
4
4
  "description": "css loader module for webpack",
5
5
  "license": "MIT",
6
6
  "repository": "webpack-contrib/css-loader",
@@ -89,7 +89,7 @@
89
89
  "stylus": "^0.54.8",
90
90
  "stylus-loader": "^4.3.0",
91
91
  "url-loader": "^4.1.1",
92
- "webpack": "^5.33.2"
92
+ "webpack": "^5.34.0"
93
93
  },
94
94
  "keywords": [
95
95
  "webpack",