crypto.ts 763 B

12345678910111213
  1. // Indirection point for the package.json "browser" field. When bun builds
  2. // browser-sdk.js with --target browser, this file is swapped for
  3. // crypto.browser.ts — avoiding a ~500KB crypto-browserify polyfill that Bun
  4. // would otherwise inline for `import ... from 'crypto'`. Node/bun builds use
  5. // this file unchanged.
  6. //
  7. // NOTE: `export { randomUUID } from 'crypto'` (re-export syntax) breaks under
  8. // bun-internal's bytecode compilation — the generated bytecode shows the
  9. // import but the binding doesn't link (`ReferenceError: randomUUID is not
  10. // defined`). The explicit import-then-export below produces a correct live
  11. // binding. See integration-tests-ant-native failure on PR #20957/#21178.
  12. import { randomUUID } from 'crypto'
  13. export { randomUUID }