index.js 546 B

1234567891011121314151617181920
  1. import { NODE_VERSION } from '../nodeVersion.js';
  2. import { setDomainAsyncContextStrategy } from './domain.js';
  3. import { setHooksAsyncContextStrategy } from './hooks.js';
  4. /**
  5. * Sets the correct async context strategy for Node.js
  6. *
  7. * Node.js >= 14 uses AsyncLocalStorage
  8. * Node.js < 14 uses domains
  9. */
  10. function setNodeAsyncContextStrategy() {
  11. if (NODE_VERSION.major >= 14) {
  12. setHooksAsyncContextStrategy();
  13. } else {
  14. setDomainAsyncContextStrategy();
  15. }
  16. }
  17. export { setNodeAsyncContextStrategy };
  18. //# sourceMappingURL=index.js.map