@unocss/vite 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.
Files changed (2) hide show
  1. package/dist/index.mjs +5 -4
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import { glob } from 'tinyglobby';
11
11
  import remapping from '@ampproject/remapping';
12
12
  import MagicString from 'magic-string';
13
13
  import { resolve as resolve$1 } from 'pathe';
14
- import { createHash } from 'node:crypto';
14
+ import crypto from 'node:crypto';
15
15
  import { Buffer } from 'node:buffer';
16
16
 
17
17
  const INCLUDE_COMMENT = "@unocss-include";
@@ -354,7 +354,7 @@ function ChunkModeBuildPlugin(ctx) {
354
354
  function getPath(id) {
355
355
  return id.replace(/\?.*$/, "");
356
356
  }
357
- function hash(str) {
357
+ function hash$1(str) {
358
358
  let i;
359
359
  let l;
360
360
  let hval = 2166136261;
@@ -368,7 +368,7 @@ function transformSkipCode(code, map, SKIP_RULES_RE, keyFlag) {
368
368
  for (const item of Array.from(code.matchAll(SKIP_RULES_RE))) {
369
369
  if (item != null) {
370
370
  const matched = item[0];
371
- const withHashKey = `${keyFlag}${hash(matched)}`;
371
+ const withHashKey = `${keyFlag}${hash$1(matched)}`;
372
372
  map.set(withHashKey, matched);
373
373
  code = code.replace(matched, withHashKey);
374
374
  }
@@ -669,8 +669,9 @@ function GlobalModeBuildPlugin(ctx) {
669
669
  ];
670
670
  }
671
671
 
672
+ const hash = crypto.hash ?? ((algorithm, data, outputEncoding) => crypto.createHash(algorithm).update(data).digest(outputEncoding));
672
673
  function getHash(input, length = 8) {
673
- return createHash("sha256").update(input).digest("hex").slice(0, length);
674
+ return hash("sha256", input, "hex").substring(0, length);
674
675
  }
675
676
 
676
677
  const WARN_TIMEOUT = 2e4;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
3
  "type": "module",
4
- "version": "66.4.1",
4
+ "version": "66.4.2",
5
5
  "description": "The Vite plugin for UnoCSS",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -55,9 +55,9 @@
55
55
  "pathe": "^2.0.3",
56
56
  "tinyglobby": "^0.2.14",
57
57
  "unplugin-utils": "^0.2.4",
58
- "@unocss/inspector": "66.4.1",
59
- "@unocss/core": "66.4.1",
60
- "@unocss/config": "66.4.1"
58
+ "@unocss/config": "66.4.2",
59
+ "@unocss/inspector": "66.4.2",
60
+ "@unocss/core": "66.4.2"
61
61
  },
62
62
  "devDependencies": {
63
63
  "vite": "^7.0.6"