| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3db9b40 commit efd6815
20 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -174,9 +174,9 @@ const experimentalModuleList = new SafeSet(); | |||
| 174 | 174 | }; | |
| 175 | 175 | } | |
| 176 | 176 | ||
| 177 | - // Set up internalBinding() in the closure. | ||
| 178 | 177 | /** | |
| 179 | - * @type {InternalBinding} | ||
| 178 | + * Set up internalBinding() in the closure. | ||
| 179 | + * @type {import('typings/globals').internalBinding} | ||
| 180 | 180 | */ | |
| 181 | 181 | let internalBinding; | |
| 182 | 182 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,30 +2,14 @@ | |||
| 2 | 2 | "include": ["lib", "doc"], | |
| 3 | 3 | "exclude": ["src", "tools", "out"], | |
| 4 | 4 | "files": [ | |
| 5 | - "./typings/internalBinding/async_wrap.d.ts", | ||
| 6 | - "./typings/internalBinding/blob.d.ts", | ||
| 7 | - "./typings/internalBinding/config.d.ts", | ||
| 8 | - "./typings/internalBinding/constants.d.ts", | ||
| 9 | - "./typings/internalBinding/fs.d.ts", | ||
| 10 | - "./typings/internalBinding/http_parser.d.ts", | ||
| 11 | - "./typings/internalBinding/messaging.d.ts", | ||
| 12 | - "./typings/internalBinding/options.d.ts", | ||
| 13 | - "./typings/internalBinding/os.d.ts", | ||
| 14 | - "./typings/internalBinding/serdes.d.ts", | ||
| 15 | - "./typings/internalBinding/symbols.d.ts", | ||
| 16 | - "./typings/internalBinding/timers.d.ts", | ||
| 17 | - "./typings/internalBinding/types.d.ts", | ||
| 18 | - "./typings/internalBinding/url.d.ts", | ||
| 19 | - "./typings/internalBinding/util.d.ts", | ||
| 20 | - "./typings/internalBinding/worker.d.ts", | ||
| 21 | 5 | "./typings/globals.d.ts", | |
| 22 | 6 | "./typings/primordials.d.ts" | |
| 23 | 7 | ], | |
| 24 | 8 | "compilerOptions": { | |
| 25 | 9 | "allowJs": true, | |
| 26 | 10 | "checkJs": false, | |
| 27 | 11 | "noEmit": true, | |
| 28 | - "lib": ["ESNext"], | ||
| 12 | + "lib": ["ESNext", "DOM"], | ||
| 29 | 13 | "target": "ESNext", | |
| 30 | 14 | "module": "CommonJS", | |
| 31 | 15 | "baseUrl": ".", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,20 @@ | |||
| 1 | + import {AsyncWrapBinding} from "./internalBinding/async_wrap"; | ||
| 2 | + import {BlobBinding} from "./internalBinding/blob"; | ||
| 3 | + import {ConfigBinding} from "./internalBinding/config"; | ||
| 4 | + import {ConstantsBinding} from "./internalBinding/constants"; | ||
| 5 | + import {HttpParserBinding} from "./internalBinding/http_parser"; | ||
| 6 | + import {FsBinding} from "./internalBinding/fs"; | ||
| 7 | + import {MessagingBinding} from "./internalBinding/messaging"; | ||
| 8 | + import {OptionsBinding} from "./internalBinding/options"; | ||
| 9 | + import {OSBinding} from "./internalBinding/os"; | ||
| 10 | + import {SerdesBinding} from "./internalBinding/serdes"; | ||
| 11 | + import {SymbolsBinding} from "./internalBinding/symbols"; | ||
| 12 | + import {TimersBinding} from "./internalBinding/timers"; | ||
| 13 | + import {TypesBinding} from "./internalBinding/types"; | ||
| 14 | + import {URLBinding} from "./internalBinding/url"; | ||
| 15 | + import {UtilBinding} from "./internalBinding/util"; | ||
| 16 | + import {WorkerBinding} from "./internalBinding/worker"; | ||
| 17 | + | ||
| 1 | 18 | declare type TypedArray = | |
| 2 | 19 | | Uint8Array | |
| 3 | 20 | | Uint8ClampedArray | |
@@ -10,3 +27,34 @@ declare type TypedArray = | |||
| 10 | 27 | | Float64Array | |
| 11 | 28 | | BigUint64Array | |
| 12 | 29 | | BigInt64Array; | |
| 30 | + | ||
| 31 | + interface InternalBindingMap { | ||
| 32 | + async_wrap: AsyncWrapBinding; | ||
| 33 | + blob: BlobBinding; | ||
| 34 | + config: ConfigBinding; | ||
| 35 | + constants: ConstantsBinding; | ||
| 36 | + fs: FsBinding; | ||
| 37 | + http_parser: HttpParserBinding; | ||
| 38 | + messaging: MessagingBinding; | ||
| 39 | + options: OptionsBinding; | ||
| 40 | + os: OSBinding; | ||
| 41 | + serdes: SerdesBinding; | ||
| 42 | + symbols: SymbolsBinding; | ||
| 43 | + timers: TimersBinding; | ||
| 44 | + types: TypesBinding; | ||
| 45 | + url: URLBinding; | ||
| 46 | + util: UtilBinding; | ||
| 47 | + worker: WorkerBinding; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + type InternalBindingKeys = keyof InternalBindingMap; | ||
| 51 | + | ||
| 52 | + declare function internalBinding<T extends InternalBindingKeys>(binding: T): InternalBindingMap[T] | ||
| 53 | + | ||
| 54 | + declare global { | ||
| 55 | + namespace NodeJS { | ||
| 56 | + interface Global { | ||
| 57 | + internalBinding<T extends InternalBindingKeys>(binding: T): InternalBindingMap[T] | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,7 +72,7 @@ declare namespace InternalAsyncWrapBinding { | |||
| 72 | 72 | } | |
| 73 | 73 | } | |
| 74 | 74 | ||
| 75 | - declare function InternalBinding(binding: 'async_wrap'): { | ||
| 75 | + export interface AsyncWrapBinding { | ||
| 76 | 76 | setupHooks(): { | |
| 77 | 77 | init: ( | |
| 78 | 78 | asyncId: number, | |
@@ -129,4 +129,4 @@ declare function InternalBinding(binding: 'async_wrap'): { | |||
| 129 | 129 | kDefaultTriggerAsyncId: 3; | |
| 130 | 130 | }; | |
| 131 | 131 | Providers: InternalAsyncWrapBinding.Providers; | |
| 132 | - }; | ||
| 132 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,10 +10,10 @@ declare namespace InternalBlobBinding { | |||
| 10 | 10 | } | |
| 11 | 11 | } | |
| 12 | 12 | ||
| 13 | - declare function InternalBinding(binding: 'blob'): { | ||
| 13 | + export interface BlobBinding { | ||
| 14 | 14 | createBlob(sources: Array<Uint8Array | InternalBlobBinding.BlobHandle>, length: number): InternalBlobBinding.BlobHandle; | |
| 15 | 15 | FixedSizeBlobCopyJob: typeof InternalBlobBinding.FixedSizeBlobCopyJob; | |
| 16 | 16 | getDataObject(id: string): [handle: InternalBlobBinding.BlobHandle | undefined, length: number, type: string] | undefined; | |
| 17 | 17 | storeDataObject(id: string, handle: InternalBlobBinding.BlobHandle, size: number, type: string): void; | |
| 18 | 18 | revokeDataObject(id: string): void; | |
| 19 | - }; | ||
| 19 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - declare function InternalBinding(binding: 'config'): { | ||
| 1 | + export interface ConfigBinding { | ||
| 2 | 2 | isDebugBuild: boolean; | |
| 3 | 3 | hasOpenSSL: boolean; | |
| 4 | 4 | fipsMode: boolean; | |
@@ -9,4 +9,4 @@ declare function InternalBinding(binding: 'config'): { | |||
| 9 | 9 | noBrowserGlobals: boolean; | |
| 10 | 10 | bits: number; | |
| 11 | 11 | hasDtrace: boolean; | |
| 12 | - }; | ||
| 12 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - declare function InternalBinding(binding: 'constants'): { | ||
| 1 | + export interface ConstantsBinding { | ||
| 2 | 2 | os: { | |
| 3 | 3 | UV_UDP_REUSEADDR: 4; | |
| 4 | 4 | dlopen: { | |
@@ -382,4 +382,4 @@ declare function InternalBinding(binding: 'constants'): { | |||
| 382 | 382 | TRACE_EVENT_PHASE_LEAVE_CONTEXT: 41; | |
| 383 | 383 | TRACE_EVENT_PHASE_LINK_IDS: 61; | |
| 384 | 384 | }; | |
| 385 | - }; | ||
| 385 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -109,7 +109,7 @@ declare namespace InternalFSBinding { | |||
| 109 | 109 | ||
| 110 | 110 | function internalModuleReadJSON(path: string): [] | [string, boolean]; | |
| 111 | 111 | function internalModuleStat(path: string): number; | |
| 112 | - | ||
| 112 | + | ||
| 113 | 113 | function lchown(path: string, uid: number, gid: number, req: FSReqCallback): void; | |
| 114 | 114 | function lchown(path: string, uid: number, gid: number, req: undefined, ctx: FSSyncContext): void; | |
| 115 | 115 | function lchown(path: string, uid: number, gid: number, usePromises: typeof kUsePromises): Promise<void>; | |
@@ -198,7 +198,7 @@ declare namespace InternalFSBinding { | |||
| 198 | 198 | function symlink(target: StringOrBuffer, path: StringOrBuffer, type: number, req: FSReqCallback): void; | |
| 199 | 199 | function symlink(target: StringOrBuffer, path: StringOrBuffer, type: number, req: undefined, ctx: FSSyncContext): void; | |
| 200 | 200 | function symlink(target: StringOrBuffer, path: StringOrBuffer, type: number, usePromises: typeof kUsePromises): Promise<void>; | |
| 201 | - | ||
| 201 | + | ||
| 202 | 202 | function unlink(path: string, req: FSReqCallback): void; | |
| 203 | 203 | function unlink(path: string, req: undefined, ctx: FSSyncContext): void; | |
| 204 | 204 | function unlink(path: string, usePromises: typeof kUsePromises): Promise<void>; | |
@@ -220,7 +220,7 @@ declare namespace InternalFSBinding { | |||
| 220 | 220 | function writeString(fd: number, value: string, pos: unknown, encoding: unknown, usePromises: typeof kUsePromises): Promise<number>; | |
| 221 | 221 | } | |
| 222 | 222 | ||
| 223 | - declare function InternalBinding(binding: 'fs'): { | ||
| 223 | + export interface FsBinding { | ||
| 224 | 224 | FSReqCallback: typeof InternalFSBinding.FSReqCallback; | |
| 225 | 225 | ||
| 226 | 226 | FileHandle: typeof InternalFSBinding.FileHandle; | |
@@ -269,4 +269,4 @@ declare function InternalBinding(binding: 'fs'): { | |||
| 269 | 269 | writeBuffer: typeof InternalFSBinding.writeBuffer; | |
| 270 | 270 | writeBuffers: typeof InternalFSBinding.writeBuffers; | |
| 271 | 271 | writeString: typeof InternalFSBinding.writeString; | |
| 272 | - }; | ||
| 272 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,7 +39,7 @@ declare namespace InternalHttpParserBinding { | |||
| 39 | 39 | } | |
| 40 | 40 | } | |
| 41 | 41 | ||
| 42 | - declare function InternalBinding(binding: 'http_parser'): { | ||
| 42 | + export interface HttpParserBinding { | ||
| 43 | 43 | methods: string[]; | |
| 44 | 44 | HTTPParser: typeof InternalHttpParserBinding.HTTPParser; | |
| 45 | - }; | ||
| 45 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,7 @@ declare namespace InternalMessagingBinding { | |||
| 17 | 17 | } | |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | - declare function InternalBinding(binding: 'messaging'): { | ||
| 20 | + export interface MessagingBinding { | ||
| 21 | 21 | DOMException: typeof import('internal/per_context/domexception').DOMException; | |
| 22 | 22 | MessageChannel: typeof InternalMessagingBinding.MessageChannel; | |
| 23 | 23 | MessagePort: typeof InternalMessagingBinding.MessagePort; | |
@@ -29,4 +29,4 @@ declare function InternalBinding(binding: 'messaging'): { | |||
| 29 | 29 | moveMessagePortToContext(port: typeof InternalMessagingBinding.MessagePort, context: any): typeof InternalMessagingBinding.MessagePort; | |
| 30 | 30 | setDeserializerCreateObjectFunction(func: (deserializeInfo: string) => any): void; | |
| 31 | 31 | broadcastChannel(name: string): typeof InternalMessagingBinding.MessagePort; | |
| 32 | - }; | ||
| 32 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments