-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttps.ts
More file actions
20 lines (16 loc) · 765 Bytes
/
Copy pathhttps.ts
File metadata and controls
20 lines (16 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
* @file Lazy-loader for `node:https`. See `node/fs.ts` for the design rationale
* shared across all `node/*.ts` lazy-loaders.
*/
// eslint-disable-next-line n/prefer-node-protocol
import type * as NodeHttps from 'node:https'
import { IS_NODE } from '../constants/runtime'
let cachedHttps: typeof NodeHttps | undefined
export function getNodeHttps(): typeof NodeHttps {
if (!IS_NODE) {
return undefined as unknown as typeof NodeHttps
}
return (cachedHttps ??=
// oxlint-disable-next-line unicorn/prefer-node-protocol -- bare specifier (not node:) so webpack resolve.fallback / browser-field can stub this builtin for browser bundles; node: prefix throws UnhandledSchemeError there
/*@__PURE__*/ require('https') as typeof NodeHttps)
}