Skip to content

Commit c9719aa

Browse files
committed
1 parent ee637a9 commit c9719aa

File tree

6 files changed

+24
-26
lines changed

6 files changed

+24
-26
lines changed

bun.lock

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

dist/index.cjs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2-
let crypto = require("crypto");
32

4-
exports.randomUUID = crypto.randomUUID;
3+
//#region src/crypto-polyfill.ts
4+
var _ref, _ref$crypto, _crypto, _crypto$randomUUID;
5+
function hex(byte) {
6+
return byte.toString(16).padStart(2, "0");
7+
}
8+
(_ref$crypto = (_ref = globalThis).crypto) !== null && _ref$crypto !== void 0 || (_ref.crypto = {});
9+
(_crypto$randomUUID = (_crypto = globalThis.crypto).randomUUID) !== null && _crypto$randomUUID !== void 0 || (_crypto.randomUUID = function randomUUID() {
10+
const bytes = new Uint8Array(16);
11+
for (let i = 0; i < 16; i++) bytes[i] = Math.trunc(Math.random() * 256);
12+
return hex(bytes[0]) + hex(bytes[1]) + hex(bytes[2]) + hex(bytes[3]) + "-" + hex(bytes[4]) + hex(bytes[5]) + "-" + hex(bytes[6]) + hex(bytes[7]) + "-" + hex(bytes[8]) + hex(bytes[9]) + "-" + hex(bytes[10]) + hex(bytes[11]) + hex(bytes[12]) + hex(bytes[13]) + hex(bytes[14]) + hex(bytes[15]);
13+
});
14+
const randomUUID = globalThis.crypto.randomUUID.bind(globalThis.crypto);
15+
var crypto_polyfill_default = globalThis.crypto;
16+
17+
//#endregion
18+
exports.randomUUID = randomUUID;

dist/index.d.mts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
//#region src/crypto-polyfill.d.ts
2-
declare const randomUUID: () => `${string}-${string}-${string}-${string}-${string}`;
3-
//#endregion
1+
import { randomUUID } from "node:crypto";
42
export { randomUUID };

dist/index.mjs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
//#region src/crypto-polyfill.ts
2-
var _ref, _ref$crypto, _crypto, _crypto$randomUUID;
3-
function hex(byte) {
4-
return byte.toString(16).padStart(2, "0");
5-
}
6-
(_ref$crypto = (_ref = globalThis).crypto) !== null && _ref$crypto !== void 0 || (_ref.crypto = {});
7-
(_crypto$randomUUID = (_crypto = globalThis.crypto).randomUUID) !== null && _crypto$randomUUID !== void 0 || (_crypto.randomUUID = function randomUUID() {
8-
const bytes = new Uint8Array(16);
9-
for (let i = 0; i < 16; i++) bytes[i] = Math.trunc(Math.random() * 256);
10-
return hex(bytes[0]) + hex(bytes[1]) + hex(bytes[2]) + hex(bytes[3]) + "-" + hex(bytes[4]) + hex(bytes[5]) + "-" + hex(bytes[6]) + hex(bytes[7]) + "-" + hex(bytes[8]) + hex(bytes[9]) + "-" + hex(bytes[10]) + hex(bytes[11]) + hex(bytes[12]) + hex(bytes[13]) + hex(bytes[14]) + hex(bytes[15]);
11-
});
12-
const randomUUID = globalThis.crypto.randomUUID.bind(globalThis.crypto);
13-
var crypto_polyfill_default = globalThis.crypto;
1+
import { randomUUID } from "node:crypto";
142

15-
//#endregion
163
export { randomUUID };

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"devDependencies": {
2525
"bun-types": "^1.3.9",
26-
"tsdown": "^0.20.3",
26+
"tsdown": "https://pkg.pr.new/tsdown@773",
2727
"typescript": "^5.9.3"
2828
}
2929
}

tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
"verbatimModuleSyntax": true,
2121

2222
"paths": {
23-
"crypto": ["./src/crypto-polyfill.ts"],
24-
"node:crypto": ["./src/crypto-polyfill.ts"]
23+
"crypto": ["./src/crypto-polyfill.ts"]
2524
}
2625
},
2726
"include": ["src/**/*"],

0 commit comments

Comments
 (0)