css-loader 6.3.0 → 6.4.0
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/plugins/index.js +4 -4
- package/dist/utils.js +37 -36
- package/package.json +1 -1
package/dist/plugins/index.js
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "icssParser", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _postcssIcssParser.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "importParser", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _postcssImportParser.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "urlParser", {
|
package/dist/utils.js
CHANGED
|
@@ -3,29 +3,29 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.shouldUseIcssPlugin = shouldUseIcssPlugin;
|
|
11
|
-
exports.normalizeUrl = normalizeUrl;
|
|
12
|
-
exports.requestify = requestify;
|
|
6
|
+
exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
|
|
7
|
+
exports.camelCase = camelCase;
|
|
8
|
+
exports.combineRequests = combineRequests;
|
|
9
|
+
exports.getExportCode = getExportCode;
|
|
13
10
|
exports.getFilter = getFilter;
|
|
11
|
+
exports.getImportCode = getImportCode;
|
|
12
|
+
exports.getModuleCode = getModuleCode;
|
|
14
13
|
exports.getModulesOptions = getModulesOptions;
|
|
15
14
|
exports.getModulesPlugins = getModulesPlugins;
|
|
16
|
-
exports.normalizeSourceMap = normalizeSourceMap;
|
|
17
15
|
exports.getPreRequester = getPreRequester;
|
|
18
|
-
exports.
|
|
19
|
-
exports.getModuleCode = getModuleCode;
|
|
20
|
-
exports.getExportCode = getExportCode;
|
|
21
|
-
exports.resolveRequests = resolveRequests;
|
|
16
|
+
exports.isDataUrl = isDataUrl;
|
|
22
17
|
exports.isUrlRequestable = isUrlRequestable;
|
|
18
|
+
exports.normalizeOptions = normalizeOptions;
|
|
19
|
+
exports.normalizeSourceMap = normalizeSourceMap;
|
|
20
|
+
exports.normalizeUrl = normalizeUrl;
|
|
21
|
+
exports.requestify = requestify;
|
|
22
|
+
exports.resolveRequests = resolveRequests;
|
|
23
|
+
exports.shouldUseIcssPlugin = shouldUseIcssPlugin;
|
|
24
|
+
exports.shouldUseImportPlugin = shouldUseImportPlugin;
|
|
25
|
+
exports.shouldUseModulesPlugins = shouldUseModulesPlugins;
|
|
26
|
+
exports.shouldUseURLPlugin = shouldUseURLPlugin;
|
|
23
27
|
exports.sort = sort;
|
|
24
|
-
exports.combineRequests = combineRequests;
|
|
25
|
-
exports.camelCase = camelCase;
|
|
26
28
|
exports.stringifyRequest = stringifyRequest;
|
|
27
|
-
exports.isDataUrl = isDataUrl;
|
|
28
|
-
exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
|
|
29
29
|
|
|
30
30
|
var _url = require("url");
|
|
31
31
|
|
|
@@ -313,22 +313,16 @@ function escapeLocalIdent(localident) {
|
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
function defaultGetLocalIdent(loaderContext, localIdentName, localName, options) {
|
|
316
|
-
let relativeMatchResource = "";
|
|
317
316
|
const {
|
|
318
|
-
context
|
|
317
|
+
context,
|
|
318
|
+
hashSalt
|
|
319
319
|
} = options;
|
|
320
320
|
const {
|
|
321
321
|
resourcePath
|
|
322
|
-
} = loaderContext;
|
|
323
|
-
|
|
324
|
-
if (loaderContext._module && loaderContext._module.matchResource) {
|
|
325
|
-
relativeMatchResource = `${normalizePath( // eslint-disable-next-line no-underscore-dangle
|
|
326
|
-
_path.default.relative(context, loaderContext._module.matchResource))}\x00`;
|
|
327
|
-
}
|
|
328
|
-
|
|
322
|
+
} = loaderContext;
|
|
329
323
|
const relativeResourcePath = normalizePath(_path.default.relative(context, resourcePath)); // eslint-disable-next-line no-param-reassign
|
|
330
324
|
|
|
331
|
-
options.content = `${
|
|
325
|
+
options.content = `${relativeResourcePath}\x00${localName}`;
|
|
332
326
|
let {
|
|
333
327
|
hashFunction,
|
|
334
328
|
hashDigest,
|
|
@@ -345,21 +339,28 @@ function defaultGetLocalIdent(loaderContext, localIdentName, localName, options)
|
|
|
345
339
|
// eslint-disable-next-line no-param-reassign
|
|
346
340
|
|
|
347
341
|
localIdentName = localIdentName.replace(/\[(?:([^:\]]+):)?(?:hash|contenthash|fullhash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi, () => hashName === "fullhash" ? "[fullhash]" : "[contenthash]");
|
|
348
|
-
}
|
|
342
|
+
}
|
|
349
343
|
|
|
344
|
+
let localIdentHash = "";
|
|
350
345
|
|
|
351
|
-
|
|
346
|
+
for (let tier = 0; localIdentHash.length < hashDigestLength; tier++) {
|
|
347
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
348
|
+
const hash = loaderContext._compiler.webpack.util.createHash(hashFunction);
|
|
352
349
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
350
|
+
if (hashSalt) {
|
|
351
|
+
hash.update(hashSalt);
|
|
352
|
+
}
|
|
356
353
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
354
|
+
const tierSalt = Buffer.allocUnsafe(4);
|
|
355
|
+
tierSalt.writeUInt32LE(tier);
|
|
356
|
+
hash.update(tierSalt);
|
|
357
|
+
hash.update(options.content);
|
|
358
|
+
localIdentHash = (localIdentHash + hash.digest(hashDigest) // Remove all leading digits
|
|
359
|
+
).replace(/^\d+/, "") // Replace all slashes with underscores (same as in base64url)
|
|
360
|
+
.replace(/\//g, "_") // Remove everything that is not an alphanumeric or underscore
|
|
361
|
+
.replace(/[^A-Za-z0-9_]+/g, "").slice(0, hashDigestLength);
|
|
362
|
+
} // TODO need improve on webpack side, we should allow to pass hash/contentHash without chunk property, also `data` for `getPath` should be looks good without chunk property
|
|
360
363
|
|
|
361
|
-
hash.update(options.content);
|
|
362
|
-
const localIdentHash = hash.digest(hashDigest).slice(0, hashDigestLength).replace(/[/+]/g, "_").replace(/^\d/g, "_"); // TODO need improve on webpack side, we should allow to pass hash/contentHash without chunk property, also `data` for `getPath` should be looks good without chunk property
|
|
363
364
|
|
|
364
365
|
const ext = _path.default.extname(resourcePath);
|
|
365
366
|
|