Skip to content

Commit e1d30c9

Browse files
committed
Replace CryptoJS with xxhash
1 parent 35fbfe8 commit e1d30c9

File tree

5 files changed

+12
-21
lines changed

5 files changed

+12
-21
lines changed

packages/core/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
"dependencies": {
1818
"@babel/runtime": "^7.21.0",
1919
"@stitches/core": "^1.2.8",
20-
"crypto-js": "^4.1.1",
2120
"lodash": "^4.17.21",
2221
"postcss-value-parser": "^3.3.0",
2322
"react-textarea-autosize": ">=7.1",
2423
"slate": "0.77.2",
2524
"slate-react": "0.77.2",
2625
"type-fest": "^3.0.0",
27-
"zod": "^3.21.4"
26+
"zod": "^3.21.4",
27+
"js-xxhash": "^4.0.0"
2828
},
2929
"devDependencies": {
3030
"@babel/core": "^7.12.10",
@@ -34,7 +34,6 @@
3434
"@easyblocks/test-utils": "workspace:*",
3535
"@easyblocks/utils": "workspace:*",
3636
"@jest/types": "^26.6.2",
37-
"@types/crypto-js": "^4.1.1",
3837
"@types/jest": "^26.0.20",
3938
"@types/lodash": "^4.14.191",
4039
"@types/react": "^18.2.20",

packages/core/src/compiler/compileComponent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
toArray,
1111
uniqueId,
1212
} from "@easyblocks/utils";
13-
import CryptoJS from "crypto-js";
13+
import { xxHash32 } from "js-xxhash";
1414
import { isComponentConfig } from "../checkers";
1515
import {
1616
responsiveValueAt,
@@ -1367,7 +1367,7 @@ function addStylesHash(styles: Record<PropertyKey, any>) {
13671367
delete styles["__hash"];
13681368
}
13691369

1370-
const hash = CryptoJS.SHA1(JSON.stringify(styles));
1370+
const hash = xxHash32(JSON.stringify(styles));
13711371
styles.__hash = hash.toString();
13721372
return styles;
13731373
}

packages/design-system/rollup.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ const baseConfig = {
7171
external: [
7272
...Object.keys(packageJson.peerDependencies),
7373
...Object.keys(packageJson.dependencies),
74-
/crypto-js/,
7574
/@babel\/runtime/,
7675
/lodash/,
7776
],

packages/editor/rollup.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ const baseConfig = {
6161
external: [
6262
...Object.keys(packageJson.peerDependencies),
6363
...Object.keys(packageJson.dependencies),
64-
/crypto-js/,
6564
/@babel\/runtime/,
6665
/lodash/,
6766
/react-dom/,

pnpm-lock.yaml

Lines changed: 8 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)