Skip to content

Commit

Permalink
chore(uuid): update uuid to 9.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
unadlib committed Dec 15, 2022
1 parent 1e1a80f commit b52cab1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "data-transport",
"version": "3.3.2",
"version": "3.3.3",
"description": "A simple and responsible transport",
"main": "lib/index.js",
"unpkg": "dist/index.umd.js",
Expand Down Expand Up @@ -79,6 +79,6 @@
}
},
"dependencies": {
"uuid": "^8.3.0"
"uuid": "^9.0.0"
}
}
16 changes: 2 additions & 14 deletions src/transport.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { v4 } from 'uuid';
import { v4 as uuid } from 'uuid';
import {
listenerKey,
originalListensMapKey,
Expand Down Expand Up @@ -246,19 +246,7 @@ export abstract class Transport<T = any, P = any> {
const hasRespond = params.respond ?? true;
const timeout = params.timeout ?? this[timeoutKey];
const name = params.name ?? options;
const transportId = v4({
// In nodejs, crypto.getRandomValues() not supported.
// workaround: https://github.com/uuidjs/uuid/issues/375
rng() {
const randomNumbers: number[] = new Array(16);
let r;
for (let i = 0; i < 16; i++) {
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
randomNumbers[i] = ((r as number) >>> ((i & 0x03) << 3)) & 0xff;
}
return randomNumbers;
},
});
const transportId = uuid();
if (__DEV__ && (!name || typeof name !== 'string')) {
throw new Error(`The event name should be a string, and it's required.`);
}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5846,10 +5846,10 @@ util-deprecate@^1.0.1, util-deprecate@~1.0.1:
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=

uuid@^8.3.0:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
uuid@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==

v8-compile-cache@^2.0.3:
version "2.2.0"
Expand Down

0 comments on commit b52cab1

Please sign in to comment.