Skip to content

Commit 7a77c8e

Browse files
Copilotmtrezza
andcommitted
Remove uuid dependency and use crypto.randomUUID instead
Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
1 parent 2f90751 commit 7a77c8e

File tree

3 files changed

+2
-12
lines changed

3 files changed

+2
-12
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"dependencies": {
3434
"@babel/runtime-corejs3": "7.28.4",
3535
"react-native-crypto-js": "1.0.0",
36-
"uuid": "13.0.0",
3736
"ws": "8.18.3"
3837
},
3938
"devDependencies": {
@@ -136,7 +135,6 @@
136135
".*": "./babel-jest.js"
137136
},
138137
"transformIgnorePatterns": [
139-
"/node_modules/(?!uuid)/",
140138
"package.json"
141139
],
142140
"testEnvironment": "jsdom"

src/__tests__/weapp-test.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ const mockWeChat = require('./test_helpers/mockWeChat');
2020

2121
global.wx = mockWeChat;
2222

23-
jest.mock('uuid', () => {
24-
return () => 0;
25-
});
26-
2723
describe('WeChat', () => {
2824
beforeEach(() => {
2925
process.env.PARSE_BUILD = 'weapp';

src/uuid.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@ if (process.env.PARSE_BUILD === 'weapp') {
1414
s[8] = s[13] = s[18] = s[23] = '-';
1515
return s.join('');
1616
};
17-
} else if (process.env.PARSE_BUILD === 'node' || process.env.PARSE_BUILD === 'react-native') {
18-
// Use Node.js built-in crypto.randomUUID() for Node and React Native builds
19-
// React Native tests run in Node.js environment, and uuid v13 is ESM-only
20-
uuid = require('crypto').randomUUID;
2117
} else {
22-
// Use uuid package for browser builds
23-
uuid = require('uuid').v4;
18+
// Use crypto.randomUUID() for Node, React Native, and browser builds
19+
uuid = require('crypto').randomUUID;
2420
}
2521

2622
export default uuid;

0 commit comments

Comments
 (0)