crypto.ts
utils/crypto.ts
No strong subsystem tag
14
Lines
763
Bytes
1
Exports
3
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with general runtime concerns. It contains 14 lines, 3 detected imports, and 1 detected exports.
Important relationships
Detected exports
randomUUID
Keywords
cryptorandomuuidbrowserbuildsfilebytecodebindingindirectionpointpackage
Detected imports
cryptocryptocrypto
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
// Indirection point for the package.json "browser" field. When bun builds
// browser-sdk.js with --target browser, this file is swapped for
// crypto.browser.ts — avoiding a ~500KB crypto-browserify polyfill that Bun
// would otherwise inline for `import ... from 'crypto'`. Node/bun builds use
// this file unchanged.
//
// NOTE: `export { randomUUID } from 'crypto'` (re-export syntax) breaks under
// bun-internal's bytecode compilation — the generated bytecode shows the
// import but the binding doesn't link (`ReferenceError: randomUUID is not
// defined`). The explicit import-then-export below produces a correct live
// binding. See integration-tests-ant-native failure on PR #20957/#21178.
import { randomUUID } from 'crypto'
export { randomUUID }