@unocss/webpack 66.4.1 → 66.4.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/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
package/dist/rspack.cjs
CHANGED
package/dist/rspack.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import MagicString from 'magic-string';
|
|
|
7
7
|
import { cssIdRE, createGenerator, BetterMap } from '@unocss/core';
|
|
8
8
|
import { createRecoveryConfigLoader } from '@unocss/config';
|
|
9
9
|
import { createFilter } from 'unplugin-utils';
|
|
10
|
-
import
|
|
10
|
+
import crypto from 'node:crypto';
|
|
11
11
|
import 'pathe';
|
|
12
12
|
import { createUnplugin } from 'unplugin';
|
|
13
13
|
import WebpackSources from 'webpack-sources';
|
|
@@ -31,7 +31,7 @@ function getPath(id) {
|
|
|
31
31
|
function isCssId(id) {
|
|
32
32
|
return cssIdRE.test(id);
|
|
33
33
|
}
|
|
34
|
-
function hash(str) {
|
|
34
|
+
function hash$1(str) {
|
|
35
35
|
let i;
|
|
36
36
|
let l;
|
|
37
37
|
let hval = 2166136261;
|
|
@@ -45,7 +45,7 @@ function transformSkipCode(code, map, SKIP_RULES_RE, keyFlag) {
|
|
|
45
45
|
for (const item of Array.from(code.matchAll(SKIP_RULES_RE))) {
|
|
46
46
|
if (item != null) {
|
|
47
47
|
const matched = item[0];
|
|
48
|
-
const withHashKey = `${keyFlag}${hash(matched)}`;
|
|
48
|
+
const withHashKey = `${keyFlag}${hash$1(matched)}`;
|
|
49
49
|
map.set(withHashKey, matched);
|
|
50
50
|
code = code.replace(matched, withHashKey);
|
|
51
51
|
}
|
|
@@ -258,8 +258,9 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
+
const hash = crypto.hash ?? ((algorithm, data, outputEncoding) => crypto.createHash(algorithm).update(data).digest(outputEncoding));
|
|
261
262
|
function getHash(input, length = 8) {
|
|
262
|
-
return
|
|
263
|
+
return hash("sha256", input, "hex").substring(0, length);
|
|
263
264
|
}
|
|
264
265
|
|
|
265
266
|
function resolveId(id, importer) {
|
|
@@ -9,7 +9,7 @@ const MagicString = require('magic-string');
|
|
|
9
9
|
const core = require('@unocss/core');
|
|
10
10
|
const config = require('@unocss/config');
|
|
11
11
|
const unpluginUtils = require('unplugin-utils');
|
|
12
|
-
const
|
|
12
|
+
const crypto = require('node:crypto');
|
|
13
13
|
require('pathe');
|
|
14
14
|
const unplugin$1 = require('unplugin');
|
|
15
15
|
const WebpackSources = require('webpack-sources');
|
|
@@ -20,6 +20,7 @@ const process__default = /*#__PURE__*/_interopDefaultCompat(process);
|
|
|
20
20
|
const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
21
21
|
const remapping__default = /*#__PURE__*/_interopDefaultCompat(remapping);
|
|
22
22
|
const MagicString__default = /*#__PURE__*/_interopDefaultCompat(MagicString);
|
|
23
|
+
const crypto__default = /*#__PURE__*/_interopDefaultCompat(crypto);
|
|
23
24
|
const WebpackSources__default = /*#__PURE__*/_interopDefaultCompat(WebpackSources);
|
|
24
25
|
|
|
25
26
|
const INCLUDE_COMMENT = "@unocss-include";
|
|
@@ -41,7 +42,7 @@ function getPath(id) {
|
|
|
41
42
|
function isCssId(id) {
|
|
42
43
|
return core.cssIdRE.test(id);
|
|
43
44
|
}
|
|
44
|
-
function hash(str) {
|
|
45
|
+
function hash$1(str) {
|
|
45
46
|
let i;
|
|
46
47
|
let l;
|
|
47
48
|
let hval = 2166136261;
|
|
@@ -55,7 +56,7 @@ function transformSkipCode(code, map, SKIP_RULES_RE, keyFlag) {
|
|
|
55
56
|
for (const item of Array.from(code.matchAll(SKIP_RULES_RE))) {
|
|
56
57
|
if (item != null) {
|
|
57
58
|
const matched = item[0];
|
|
58
|
-
const withHashKey = `${keyFlag}${hash(matched)}`;
|
|
59
|
+
const withHashKey = `${keyFlag}${hash$1(matched)}`;
|
|
59
60
|
map.set(withHashKey, matched);
|
|
60
61
|
code = code.replace(matched, withHashKey);
|
|
61
62
|
}
|
|
@@ -268,8 +269,9 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
268
269
|
};
|
|
269
270
|
}
|
|
270
271
|
|
|
272
|
+
const hash = crypto__default.hash ?? ((algorithm, data, outputEncoding) => crypto__default.createHash(algorithm).update(data).digest(outputEncoding));
|
|
271
273
|
function getHash(input, length = 8) {
|
|
272
|
-
return
|
|
274
|
+
return hash("sha256", input, "hex").substring(0, length);
|
|
273
275
|
}
|
|
274
276
|
|
|
275
277
|
function resolveId(id, importer) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/webpack",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.4.
|
|
4
|
+
"version": "66.4.2",
|
|
5
5
|
"description": "The Webpack plugin for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"unplugin": "^2.3.5",
|
|
69
69
|
"unplugin-utils": "^0.2.4",
|
|
70
70
|
"webpack-sources": "^3.3.3",
|
|
71
|
-
"@unocss/config": "66.4.
|
|
72
|
-
"@unocss/core": "66.4.
|
|
71
|
+
"@unocss/config": "66.4.2",
|
|
72
|
+
"@unocss/core": "66.4.2"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/webpack": "^5.28.5",
|