Skip to content

Commit ad180c3

Browse files
authored
feat: use crypto.randomUUID rather than uuid (#892)
1 parent 118e15b commit ad180c3

File tree

8 files changed

+7
-28
lines changed

8 files changed

+7
-28
lines changed

packages/babel-plugin-component-annotate/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
"@swc/jest": "^0.2.21",
5959
"@types/jest": "^28.1.3",
6060
"@types/node": "^18.6.3",
61-
"@types/uuid": "^9.0.1",
6261
"eslint": "^8.18.0",
6362
"jest": "^28.1.1",
6463
"premove": "^4.0.0",

packages/esbuild-plugin/jest.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,4 @@ module.exports = {
33
transform: {
44
"^.+\\.(t|j)sx?$": ["@swc/jest"],
55
},
6-
moduleNameMapper: {
7-
uuid: require.resolve("uuid"), // https://stackoverflow.com/a/73203803
8-
},
96
};

packages/esbuild-plugin/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848
"prepack": "ts-node ./src/prepack.ts"
4949
},
5050
"dependencies": {
51-
"@sentry/bundler-plugin-core": "5.1.1",
52-
"uuid": "^9.0.0"
51+
"@sentry/bundler-plugin-core": "5.1.1"
5352
},
5453
"devDependencies": {
5554
"@sentry-internal/eslint-config": "5.1.1",
@@ -58,7 +57,6 @@
5857
"@swc/jest": "^0.2.21",
5958
"@types/jest": "^28.1.3",
6059
"@types/node": "^18.6.3",
61-
"@types/uuid": "^9.0.1",
6260
"eslint": "^8.18.0",
6361
"jest": "^28.1.1",
6462
"premove": "^4.0.0",

packages/esbuild-plugin/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from "@sentry/bundler-plugin-core";
1010
import * as path from "node:path";
1111
import { createRequire } from "node:module";
12-
import { v4 as uuidv4 } from "uuid";
12+
import { randomUUID } from "node:crypto";
1313

1414
interface EsbuildOnResolveArgs {
1515
path: string;
@@ -268,7 +268,7 @@ export function sentryEsbuildPlugin(userOptions: Options = {}): any {
268268
sideEffects: true,
269269
pluginName,
270270
namespace: "sentry-debug-id-stub",
271-
suffix: "?sentry-module-id=" + uuidv4(),
271+
suffix: "?sentry-module-id=" + randomUUID(),
272272
};
273273
});
274274

@@ -278,7 +278,7 @@ export function sentryEsbuildPlugin(userOptions: Options = {}): any {
278278
return {
279279
loader: "js",
280280
pluginName,
281-
contents: getDebugIdSnippet(uuidv4()).code(),
281+
contents: getDebugIdSnippet(randomUUID()).code(),
282282
};
283283
}
284284
);

packages/webpack-plugin/jest.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,4 @@ module.exports = {
33
transform: {
44
"^.+\\.(t|j)sx?$": ["@swc/jest"],
55
},
6-
moduleNameMapper: {
7-
uuid: require.resolve("uuid"), // https://stackoverflow.com/a/73203803
8-
},
96
};

packages/webpack-plugin/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@
5353
"prepack": "ts-node ./src/prepack.ts"
5454
},
5555
"dependencies": {
56-
"@sentry/bundler-plugin-core": "5.1.1",
57-
"uuid": "^9.0.0"
56+
"@sentry/bundler-plugin-core": "5.1.1"
5857
},
5958
"devDependencies": {
6059
"@sentry-internal/eslint-config": "5.1.1",
@@ -63,7 +62,6 @@
6362
"@swc/jest": "^0.2.21",
6463
"@types/jest": "^28.1.3",
6564
"@types/node": "^18.6.3",
66-
"@types/uuid": "^9.0.1",
6765
"@types/webpack": "npm:@types/webpack@^4",
6866
"eslint": "^8.18.0",
6967
"jest": "^28.1.1",

packages/webpack-plugin/src/webpack4and5.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import * as path from "node:path";
1313
import { fileURLToPath } from "node:url";
1414
import { createRequire } from "node:module";
15-
import { v4 as uuidv4 } from "uuid";
15+
import { randomUUID } from "node:crypto";
1616

1717
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
1818
// @ts-ignore Rollup transpiles import.meta for us for CJS
@@ -240,7 +240,7 @@ export function sentryWebpackPluginFactory({
240240
const codeToInject = staticInjectionCode.clone();
241241
if (sourcemapsEnabled) {
242242
const hash = arg?.chunk?.contentHash?.javascript ?? arg?.chunk?.hash;
243-
const debugId = hash ? stringToUUID(hash) : uuidv4();
243+
const debugId = hash ? stringToUUID(hash) : randomUUID();
244244
codeToInject.append(getDebugIdSnippet(debugId));
245245
}
246246
return codeToInject.code();

yarn.lock

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2587,11 +2587,6 @@
25872587
dependencies:
25882588
source-map "^0.6.1"
25892589

2590-
"@types/uuid@^9.0.1":
2591-
version "9.0.1"
2592-
resolved "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.1.tgz#98586dc36aee8dacc98cc396dbca8d0429647aa6"
2593-
integrity sha512-rFT3ak0/2trgvp4yYZo5iKFEPsET7vKydKF+VRCxlQ9bpheehyAJH89dAkaLEq/j/RZXJIqcgsmPJKUP1Z28HA==
2594-
25952590
"@types/webpack-sources@*":
25962591
version "3.2.0"
25972592
resolved "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-3.2.0.tgz#16d759ba096c289034b26553d2df1bf45248d38b"
@@ -10584,11 +10579,6 @@ uuid@8.3.2:
1058410579
resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
1058510580
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
1058610581

10587-
uuid@^9.0.0:
10588-
version "9.0.0"
10589-
resolved "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
10590-
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
10591-
1059210582
v8-compile-cache-lib@^3.0.1:
1059310583
version "3.0.1"
1059410584
resolved "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf"

0 commit comments

Comments
 (0)