From f97f0b6eeff5110abf2eca019d52b805ec2ccdfe Mon Sep 17 00:00:00 2001 From: Sergey Rubanov Date: Tue, 3 Oct 2023 22:27:53 +0200 Subject: [PATCH] docs: update docs --- api/README.md | 130 +++++++++++++++++++++++---------------------- api/crypto.js | 10 ++-- api/errors.js | 14 ++--- api/fs/dir.js | 4 +- api/fs/handle.js | 4 +- api/fs/index.js | 28 ++++++---- api/fs/promises.js | 8 +-- api/index.d.ts | 107 +++++++++++++++++++++++++------------ api/os.js | 17 ++++++ api/process.js | 8 +++ api/test/index.js | 3 ++ api/window.js | 3 ++ 12 files changed, 211 insertions(+), 125 deletions(-) diff --git a/api/README.md b/api/README.md index d99a4493d6..8f6a8d25f9 100644 --- a/api/README.md +++ b/api/README.md @@ -318,6 +318,7 @@ External docs: https://nodejs.org/api/buffer.html ## [webcrypto](https://github.com/socketsupply/socket/blob/master/api/crypto.js#L27) +External docs: https://developer.mozilla.org/en-US/docs/Web/API/Crypto WebCrypto API ## [ready](https://github.com/socketsupply/socket/blob/master/api/crypto.js#L56) @@ -337,24 +338,27 @@ Generate cryptographically strong random values into the `buffer` | :--- | :--- | :--- | | Not specified | TypedArray | | -## [`rand64()`](https://github.com/socketsupply/socket/blob/master/api/crypto.js#L90) +## [`rand64()`](https://github.com/socketsupply/socket/blob/master/api/crypto.js#L94) -This is a `FunctionDeclaration` named `rand64` in `api/crypto.js`, it's exported but undocumented. +Generate a random 64-bit number. +| Return Value | Type | Description | +| :--- | :--- | :--- | +| A random 64-bit number. | BigInt | | -## [RANDOM_BYTES_QUOTA](https://github.com/socketsupply/socket/blob/master/api/crypto.js#L98) +## [RANDOM_BYTES_QUOTA](https://github.com/socketsupply/socket/blob/master/api/crypto.js#L102) Maximum total size of random bytes per page -## [MAX_RANDOM_BYTES](https://github.com/socketsupply/socket/blob/master/api/crypto.js#L103) +## [MAX_RANDOM_BYTES](https://github.com/socketsupply/socket/blob/master/api/crypto.js#L107) Maximum total size for random bytes. -## [MAX_RANDOM_BYTES_PAGES](https://github.com/socketsupply/socket/blob/master/api/crypto.js#L108) +## [MAX_RANDOM_BYTES_PAGES](https://github.com/socketsupply/socket/blob/master/api/crypto.js#L112) Maximum total amount of allocated per page of bytes (max/quota) -## [`randomBytes(size)`](https://github.com/socketsupply/socket/blob/master/api/crypto.js#L116) +## [`randomBytes(size)`](https://github.com/socketsupply/socket/blob/master/api/crypto.js#L120) Generate `size` random bytes. @@ -366,7 +370,7 @@ Generate `size` random bytes. | :--- | :--- | :--- | | Not specified | Buffer | A promise that resolves with an instance of socket.Buffer with random bytes. | -## [`createDigest(algorithm, message)`](https://github.com/socketsupply/socket/blob/master/api/crypto.js#L143) +## [`createDigest(algorithm, message)`](https://github.com/socketsupply/socket/blob/master/api/crypto.js#L147) @@ -731,7 +735,7 @@ External docs: https://nodejs.org/api/events.html ## [`access(path, mode , callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L84) -External docs: https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsopenpath-flags-mode-callback +External docs: https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsopenpath-flags-mode-callback Asynchronously check access a file for a given mode calling `callback` upon success or error. @@ -757,6 +761,7 @@ Asynchronously changes the permissions of a file. ## [`close(fd, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L166) +External docs: https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsclosefd-callback Asynchronously close a file descriptor calling `callback` upon success or error. | Argument | Type | Default | Optional | Description | @@ -764,14 +769,21 @@ Asynchronously close a file descriptor calling `callback` upon success or error. | fd | number | | false | | | callback | function(Error?)? | | false | | -## [`copyFile()`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L182) +## [`copyFile(src, dest, flags, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L190) -This is a `FunctionDeclaration` named `copyFile` in `api/fs/index.js`, it's exported but undocumented. +External docs: https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fscopyfilesrc-dest-mode-callback +Asynchronously copies `src` to `dest` calling `callback` upon success or error. +| Argument | Type | Default | Optional | Description | +| :--- | :--- | :---: | :---: | :--- | +| src | string | | false | The source file path. | +| dest | string | | false | The destination file path. | +| flags | number | | false | Modifiers for copy operation. | +| callback | function(Error=) | | true | The function to call after completion. | -## [`createReadStream(path, options)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L210) +## [`createReadStream(path, options)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L218) -External docs: https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fscreatewritestreampath-options +External docs: https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fscreatewritestreampath-options | Argument | Type | Default | Optional | Description | @@ -783,9 +795,9 @@ External docs: https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fscreatewri | :--- | :--- | :--- | | Not specified | ReadStream | | -## [`createWriteStream(path, options)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L250) +## [`createWriteStream(path, options)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L258) -External docs: https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fscreatewritestreampath-options +External docs: https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fscreatewritestreampath-options | Argument | Type | Default | Optional | Description | @@ -797,9 +809,9 @@ External docs: https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fscreatewri | :--- | :--- | :--- | | Not specified | WriteStream | | -## [`fstat(fd, options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L294) +## [`fstat(fd, options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L302) -External docs: https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsfstatfd-options-callback +External docs: https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsfstatfd-options-callback Invokes the callback with the for the file descriptor. See the POSIX fstat(2) documentation for more detail. @@ -811,8 +823,9 @@ Invokes the callback with the for the file descriptor. See | options | object? \| function? | | false | An options object. | | callback | function? | | false | The function to call after completion. | -## [`open(path, flags , mode , options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L399) +## [`open(path, flags , mode , options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L407) +External docs: https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsopenpath-flags-mode-callback Asynchronously open a file calling `callback` upon success or error. | Argument | Type | Default | Optional | Description | @@ -823,8 +836,9 @@ Asynchronously open a file calling `callback` upon success or error. | options | object? \| function? | | false | | | callback | function(Error?, number?)? | | false | | -## [`opendir(path, options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L452) +## [`opendir(path, options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L460) +External docs: https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsreaddirpath-options-callback Asynchronously open a directory calling `callback` upon success or error. | Argument | Type | Default | Optional | Description | @@ -835,8 +849,9 @@ Asynchronously open a directory calling `callback` upon success or error. | options.withFileTypes | boolean? | false | false | | | callback | function(Error?, Dir?)? | | false | | -## [`read(fd, buffer, offset, length, position, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L478) +## [`read(fd, buffer, offset, length, position, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L486) +External docs: https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsreadfd-buffer-offset-length-position-callback Asynchronously read from an open file descriptor. | Argument | Type | Default | Optional | Description | @@ -848,8 +863,9 @@ Asynchronously read from an open file descriptor. | position | number \| BigInt \| null | | false | Specifies where to begin reading from in the file. If position is null or -1 , data will be read from the current file position, and the file position will be updated. If position is an integer, the file position will be unchanged. | | callback | function(Error?, number?, Buffer?) | | false | | -## [`readdir(path, options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L512) +## [`readdir(path, options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L520) +External docs: https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsreaddirpath-options-callback Asynchronously read all entries in a directory. | Argument | Type | Default | Optional | Description | @@ -860,7 +876,7 @@ Asynchronously read all entries in a directory. | options.withFileTypes ? false | boolean? | | false | | | callback | function(Error?, object) | | false | | -## [`readFile(path, options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L563) +## [`readFile(path, options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L571) @@ -873,7 +889,7 @@ Asynchronously read all entries in a directory. | options.signal | AbortSignal? | | false | | | callback | function(Error?, Buffer?) | | false | | -## [`stat(path, options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L682) +## [`stat(path, options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L690) @@ -886,7 +902,7 @@ Asynchronously read all entries in a directory. | options.signal | AbortSignal? | | false | | | callback | function(Error?, Stats?) | | false | | -## [`writeFile(path, data, options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L778) +## [`writeFile(path, data, options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L786) @@ -928,7 +944,7 @@ Asynchronously read all entries in a directory. ## [`access(path, mode, options)`](https://github.com/socketsupply/socket/blob/master/api/fs/promises.js#L86) -External docs: https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromisesaccesspath-mode +External docs: https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromisesaccesspath-mode Asynchronously check access a file. | Argument | Type | Default | Optional | Description | @@ -999,7 +1015,7 @@ External docs: https://nodejs.org/api/fs.html#fspromisesopendirpath-options ## [`readdir(path, options)`](https://github.com/socketsupply/socket/blob/master/api/fs/promises.js#L260) -External docs: https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromisesreaddirpath-options +External docs: https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromisesreaddirpath-options | Argument | Type | Default | Optional | Description | @@ -1011,7 +1027,7 @@ External docs: https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromisesr ## [`readFile(path, options)`](https://github.com/socketsupply/socket/blob/master/api/fs/promises.js#L293) -External docs: https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromisesreadfilepath-options +External docs: https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromisesreadfilepath-options | Argument | Type | Default | Optional | Description | @@ -1043,7 +1059,7 @@ External docs: https://nodejs.org/api/fs.html#fspromisesstatpath-options ## [`writeFile(path, data, options)`](https://github.com/socketsupply/socket/blob/master/api/fs/promises.js#L446) -External docs: https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromiseswritefilefile-data-options +External docs: https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromiseswritefilefile-data-options | Argument | Type | Default | Optional | Description | @@ -1213,12 +1229,11 @@ Returns the operating system name. The operating system's end-of-line marker. `'\r\n'` on Windows and `'\n'` on POSIX. -## [`rusage()`](https://github.com/socketsupply/socket/blob/master/api/os.js#L302) - -This is a `FunctionDeclaration` named `rusage` in `api/os.js`, it's exported but undocumented. +## [`rusage()`](https://github.com/socketsupply/socket/blob/master/api/os.js#L306) +Get resource usage. -## [`uptime()`](https://github.com/socketsupply/socket/blob/master/api/os.js#L312) +## [`uptime()`](https://github.com/socketsupply/socket/blob/master/api/os.js#L316) Returns the system uptime in seconds. @@ -1226,20 +1241,13 @@ Returns the system uptime in seconds. | :--- | :--- | :--- | | Not specified | number | The system uptime in seconds. | -## [`uname()`](https://github.com/socketsupply/socket/blob/master/api/os.js#L318) - -This is a `FunctionDeclaration` named `uname` in `api/os.js`, it's exported but undocumented. +## [`uname()`](https://github.com/socketsupply/socket/blob/master/api/os.js#L327) +Returns the operating system name. -## [`hrtime()`](https://github.com/socketsupply/socket/blob/master/api/os.js#L328) - -This is a `FunctionDeclaration` named `hrtime` in `api/os.js`, it's exported but undocumented. - - -## [`availableMemory()`](https://github.com/socketsupply/socket/blob/master/api/os.js#L337) - -This is a `FunctionDeclaration` named `availableMemory` in `api/os.js`, it's exported but undocumented. - +| Return Value | Type | Description | +| :--- | :--- | :--- | +| Not specified | string | The operating system name. | # [Path](https://github.com/socketsupply/socket/blob/master/api/path/path.js#L9) @@ -1475,12 +1483,15 @@ Converts this `Path` instance to a string. import process from 'socket:process' ``` -## [`nextTick()`](https://github.com/socketsupply/socket/blob/master/api/process.js#L38) +## [`nextTick(callback)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L42) -This is a `FunctionDeclaration` named `nextTick` in `api/process.js`, it's exported but undocumented. +Adds callback to the 'nextTick' queue. +| Argument | Type | Default | Optional | Description | +| :--- | :--- | :---: | :---: | :--- | +| callback | Function | | false | | -## [`homedir()`](https://github.com/socketsupply/socket/blob/master/api/process.js#L67) +## [`homedir()`](https://github.com/socketsupply/socket/blob/master/api/process.js#L71) @@ -1488,7 +1499,7 @@ This is a `FunctionDeclaration` named `nextTick` in `api/process.js`, it's expor | :--- | :--- | :--- | | Not specified | string | The home directory of the current user. | -## [`hrtime(time)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L76) +## [`hrtime(time)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L80) Computed high resolution time as a `BigInt`. @@ -1500,7 +1511,7 @@ Computed high resolution time as a `BigInt`. | :--- | :--- | :--- | | Not specified | bigint | | -## [`exit(code)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L100) +## [`exit(code)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L104) @@ -1508,10 +1519,13 @@ Computed high resolution time as a `BigInt`. | :--- | :--- | :---: | :---: | :--- | | code | number | 0 | true | The exit code. Default: 0. | -## [`memoryUsage()`](https://github.com/socketsupply/socket/blob/master/api/process.js#L108) +## [`memoryUsage()`](https://github.com/socketsupply/socket/blob/master/api/process.js#L116) -This is a `FunctionDeclaration` named `memoryUsage` in `api/process.js`, it's exported but undocumented. +Returns an object describing the memory usage of the Node.js process measured in bytes. +| Return Value | Type | Description | +| :--- | :--- | :--- | +| Not specified | Object | | # [Test](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L17) @@ -2035,12 +2049,7 @@ Retrieves the computed styles for a given element. | :--- | :--- | :---: | :---: | :--- | | ) | (result: { total: number, success: number, fail: number | > void} callback | false | | -## [GLOBAL_TEST_RUNNER](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1048) - -This is a `VariableDeclaration` named `GLOBAL_TEST_RUNNER` in `api/test/index.js`, it's exported but undocumented. - - -## [`only(name, fn)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1057) +## [`only(name, fn)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1060) @@ -2049,7 +2058,7 @@ This is a `VariableDeclaration` named `GLOBAL_TEST_RUNNER` in `api/test/index.js | name | string | | false | | | fn | TestFn | | false | | -## [`skip(_name, _fn)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1067) +## [`skip(_name, _fn)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1070) @@ -2058,7 +2067,7 @@ This is a `VariableDeclaration` named `GLOBAL_TEST_RUNNER` in `api/test/index.js | _name | string | | false | | | _fn | TestFn | | false | | -## [`setStrict(strict)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1073) +## [`setStrict(strict)`](https://github.com/socketsupply/socket/blob/master/api/test/index.js#L1076) @@ -2324,8 +2333,3 @@ Removes a listener from the window. An alias for `removeListener`. | event | string | | false | the event to remove the listener from | | cb | function(*): void | | false | the callback to remove | -## [constants](https://github.com/socketsupply/socket/blob/master/api/window.js#L409) - -This is a `VariableDeclaration` named `constants` in `api/window.js`, it's exported but undocumented. - - diff --git a/api/crypto.js b/api/crypto.js index 379aa249aa..35b9239637 100644 --- a/api/crypto.js +++ b/api/crypto.js @@ -22,7 +22,7 @@ import * as exports from './crypto.js' /** * WebCrypto API - * @see {https://developer.mozilla.org/en-US/docs/Web/API/Crypto} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Crypto} */ export let webcrypto = globalThis.crypto?.webcrypto ?? globalThis.crypto @@ -57,8 +57,8 @@ export const ready = Promise.all(pending) /** * libsodium API - * @see {https://doc.libsodium.org/} - * @see {https://github.com/jedisct1/libsodium.js} + * @see {@link https://doc.libsodium.org/} + * @see {@link https://github.com/jedisct1/libsodium.js} */ export { sodium } @@ -87,6 +87,10 @@ export function getRandomValues (buffer, ...args) { // so this is re-used instead of creating new one each rand64() call const tmp = new Uint32Array(2) +/** + * Generate a random 64-bit number. + * @returns {BigInt} - A random 64-bit number. + */ export function rand64 () { getRandomValues(tmp) return (BigInt(tmp[0]) << 32n) | BigInt(tmp[1]) diff --git a/api/errors.js b/api/errors.js index e672682dbb..99f587de12 100644 --- a/api/errors.js +++ b/api/errors.js @@ -20,7 +20,7 @@ export const TIMEOUT_ERR = 23 export class AbortError extends Error { /** * The code given to an `ABORT_ERR` `DOMException` - * @see {https://developer.mozilla.org/en-US/docs/Web/API/DOMException} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException} */ static get code () { return ABORT_ERR } @@ -268,7 +268,7 @@ export class InternalError extends Error { export class InvalidAccessError extends Error { /** * The code given to an `INVALID_ACCESS_ERR` `DOMException` - * @see {https://developer.mozilla.org/en-US/docs/Web/API/DOMException} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException} */ static get code () { return INVALID_ACCESS_ERR } @@ -301,7 +301,7 @@ export class InvalidAccessError extends Error { export class NetworkError extends Error { /** * The code given to an `NETWORK_ERR` `DOMException` - * @see {https://developer.mozilla.org/en-US/docs/Web/API/DOMException} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException} */ static get code () { return NETWORK_ERR } @@ -336,7 +336,7 @@ export class NetworkError extends Error { export class NotAllowedError extends Error { /** * The code given to an `NOT_ALLOWED_ERR` `DOMException` - * @see {https://developer.mozilla.org/en-US/docs/Web/API/DOMException} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException} */ static get code () { return NOT_ALLOWED_ERR } @@ -369,7 +369,7 @@ export class NotAllowedError extends Error { export class NotFoundError extends Error { /** * The code given to an `NOT_FOUND_ERR` `DOMException` - * @see {https://developer.mozilla.org/en-US/docs/Web/API/DOMException} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException} */ static get code () { return NOT_FOUND_ERR } @@ -402,7 +402,7 @@ export class NotFoundError extends Error { export class NotSupportedError extends Error { /** * The code given to an `NOT_SUPPORTED_ERR` `DOMException` - * @see {https://developer.mozilla.org/en-US/docs/Web/API/DOMException} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException} */ static get code () { return NOT_SUPPORTED_ERR } @@ -494,7 +494,7 @@ export class OperationError extends Error { export class TimeoutError extends Error { /** * The code given to an `TIMEOUT_ERR` `DOMException` - * @see {https://developer.mozilla.org/en-US/docs/Web/API/DOMException} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException} */ static get code () { return TIMEOUT_ERR } diff --git a/api/fs/dir.js b/api/fs/dir.js index 002373d586..3f816c31db 100644 --- a/api/fs/dir.js +++ b/api/fs/dir.js @@ -37,7 +37,7 @@ export function sortDirectoryEntries (a, b) { * A containerr for a directory and its entries. This class supports scanning * a directory entry by entry with a `read()` method. The `Symbol.asyncIterator` * interface is exposed along with an AsyncGenerator `entries()` method. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#class-fsdir} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#class-fsdir} */ export class Dir { static from (fdOrHandle, options) { @@ -179,7 +179,7 @@ export class Dir { /** * A container for a directory entry. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#class-fsdirent} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#class-fsdirent} */ export class Dirent { static get UNKNOWN () { return UV_DIRENT_UNKNOWN } diff --git a/api/fs/handle.js b/api/fs/handle.js index 81b9ac3c42..3e3adca70b 100644 --- a/api/fs/handle.js +++ b/api/fs/handle.js @@ -43,7 +43,7 @@ export const kClosed = Symbol.for('fs.FileHandle.closed') /** * A container for a descriptor tracked in `fds` and opened in the native layer. * This class implements the Node.js `FileHandle` interface - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#class-filehandle} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#class-filehandle} */ export class FileHandle extends EventEmitter { static get DEFAULT_ACCESS_MODE () { return F_OK } @@ -109,7 +109,7 @@ export class FileHandle extends EventEmitter { /** * Asynchronously open a file. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromisesopenpath-flags-mode} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromisesopenpath-flags-mode} * @param {string | Buffer | URL} path * @param {string=} [flags = 'r'] * @param {string=} [mode = 0o666] diff --git a/api/fs/index.js b/api/fs/index.js index e85f265167..7337b2c0ba 100644 --- a/api/fs/index.js +++ b/api/fs/index.js @@ -76,7 +76,7 @@ async function visit (path, options, callback) { /** * Asynchronously check access a file for a given mode calling `callback` * upon success or error. - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsopenpath-flags-mode-callback} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsopenpath-flags-mode-callback} * @param {string | Buffer | URL} path * @param {string?|function(Error?)?} [mode = F_OK(0)] * @param {function(Error?)?} [callback] @@ -159,7 +159,7 @@ export function chown (path, uid, gid, callback) { /** * Asynchronously close a file descriptor calling `callback` upon success or error. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsclosefd-callback} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsclosefd-callback} * @param {number} fd * @param {function(Error?)?} [callback] */ @@ -179,6 +179,14 @@ export function close (fd, callback) { } } +/** + * Asynchronously copies `src` to `dest` calling `callback` upon success or error. + * @param {string} src - The source file path. + * @param {string} dest - The destination file path. + * @param {number} flags - Modifiers for copy operation. + * @param {function(Error=)=} [callback] - The function to call after completion. + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fscopyfilesrc-dest-mode-callback} + */ export function copyFile (src, dest, flags, callback) { if (typeof src !== 'string') { throw new TypeError('The argument \'src\' must be a string') @@ -202,7 +210,7 @@ export function copyFile (src, dest, flags, callback) { } /** - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fscreatewritestreampath-options} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fscreatewritestreampath-options} * @param {string | Buffer | URL} path * @param {object?} [options] * @returns {ReadStream} @@ -242,7 +250,7 @@ export function createReadStream (path, options) { } /** - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fscreatewritestreampath-options} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fscreatewritestreampath-options} * @param {string | Buffer | URL} path * @param {object?} [options] * @returns {WriteStream} @@ -285,7 +293,7 @@ export function createWriteStream (path, options) { * Invokes the callback with the for the file descriptor. See * the POSIX fstat(2) documentation for more detail. * - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsfstatfd-options-callback} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsfstatfd-options-callback} * * @param {number} fd - A file descriptor. * @param {object?|function?} [options] - An options object. @@ -389,7 +397,7 @@ export function mkdir (path, options, callback) { /** * Asynchronously open a file calling `callback` upon success or error. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsopenpath-flags-mode-callback} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsopenpath-flags-mode-callback} * @param {string | Buffer | URL} path * @param {string?} [flags = 'r'] * @param {string?} [mode = 0o666] @@ -442,7 +450,7 @@ export function open (path, flags = 'r', mode = 0o666, options = null, callback) /** * Asynchronously open a directory calling `callback` upon success or error. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsreaddirpath-options-callback} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsreaddirpath-options-callback} * @param {string | Buffer | URL} path * @param {object?|function(Error?, Dir?)} [options] * @param {string?} [options.encoding = 'utf8'] @@ -467,7 +475,7 @@ export function opendir (path, options = {}, callback) { /** * Asynchronously read from an open file descriptor. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsreadfd-buffer-offset-length-position-callback} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsreadfd-buffer-offset-length-position-callback} * @param {number} fd * @param {object | Buffer | TypedArray} buffer - The buffer that the data will be written to. * @param {number} offset - The position in buffer to write the data to. @@ -502,7 +510,7 @@ export function read (fd, buffer, offset, length, position, options, callback) { /** * Asynchronously read all entries in a directory. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsreaddirpath-options-callback} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsreaddirpath-options-callback} * @param {string | Buffer | URL } path * @param {object?|function(Error?, object[])} [options] * @param {string?} [options.encoding ? 'utf8'] @@ -765,7 +773,7 @@ export function unlink (path, callback) { } /** - * @see {@url https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fswritefilefile-data-options-callback} + * @see {@url https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fswritefilefile-data-options-callback} * @param {string | Buffer | URL | number } path - filename or file descriptor * @param {string | Buffer | TypedArray | DataView | object } data * @param {object?} options diff --git a/api/fs/promises.js b/api/fs/promises.js index 9184eaddd7..a1073dcd5f 100644 --- a/api/fs/promises.js +++ b/api/fs/promises.js @@ -78,7 +78,7 @@ async function visit (path, options, callback) { /** * Asynchronously check access a file. - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromisesaccesspath-mode} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromisesaccesspath-mode} * @param {string | Buffer | URL} path * @param {string?} [mode] * @param {object?} [options] @@ -251,7 +251,7 @@ export async function opendir (path, options) { } /** - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromisesreaddirpath-options} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromisesreaddirpath-options} * @param {string | Buffer | URL} path * @param {object?} options * @param {string?} [options.encoding = 'utf8'] @@ -282,7 +282,7 @@ export async function readdir (path, options) { } /** - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromisesreadfilepath-options} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromisesreadfilepath-options} * @param {string} path * @param {object?} [options] * @param {(string|null)?} [options.encoding = null] @@ -432,7 +432,7 @@ export async function unlink (path) { } /** - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromiseswritefilefile-data-options} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromiseswritefilefile-data-options} * @param {string | Buffer | URL | FileHandle} path - filename or FileHandle * @param {string|Buffer|Array|DataView|TypedArray} data * @param {object?} [options] diff --git a/api/index.d.ts b/api/index.d.ts index 5232166cba..b829db5cda 100644 --- a/api/index.d.ts +++ b/api/index.d.ts @@ -17,7 +17,7 @@ declare module "socket:errors" { export class AbortError extends Error { /** * The code given to an `ABORT_ERR` `DOMException` - * @see {https://developer.mozilla.org/en-US/docs/Web/API/DOMException} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException} */ static get code(): number; /** @@ -154,7 +154,7 @@ declare module "socket:errors" { export class InvalidAccessError extends Error { /** * The code given to an `INVALID_ACCESS_ERR` `DOMException` - * @see {https://developer.mozilla.org/en-US/docs/Web/API/DOMException} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException} */ static get code(): number; /** @@ -173,7 +173,7 @@ declare module "socket:errors" { export class NetworkError extends Error { /** * The code given to an `NETWORK_ERR` `DOMException` - * @see {https://developer.mozilla.org/en-US/docs/Web/API/DOMException} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException} */ static get code(): number; /** @@ -192,7 +192,7 @@ declare module "socket:errors" { export class NotAllowedError extends Error { /** * The code given to an `NOT_ALLOWED_ERR` `DOMException` - * @see {https://developer.mozilla.org/en-US/docs/Web/API/DOMException} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException} */ static get code(): number; /** @@ -211,7 +211,7 @@ declare module "socket:errors" { export class NotFoundError extends Error { /** * The code given to an `NOT_FOUND_ERR` `DOMException` - * @see {https://developer.mozilla.org/en-US/docs/Web/API/DOMException} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException} */ static get code(): number; /** @@ -230,7 +230,7 @@ declare module "socket:errors" { export class NotSupportedError extends Error { /** * The code given to an `NOT_SUPPORTED_ERR` `DOMException` - * @see {https://developer.mozilla.org/en-US/docs/Web/API/DOMException} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException} */ static get code(): number; /** @@ -278,7 +278,7 @@ declare module "socket:errors" { export class TimeoutError extends Error { /** * The code given to an `TIMEOUT_ERR` `DOMException` - * @see {https://developer.mozilla.org/en-US/docs/Web/API/DOMException} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMException} */ static get code(): number; /** @@ -704,14 +704,29 @@ declare module "socket:os" { * @returns {string} - The operating system's default directory for temporary files. */ export function tmpdir(): string; + /** + * Get resource usage. + */ export function rusage(): any; /** * Returns the system uptime in seconds. * @returns {number} - The system uptime in seconds. */ export function uptime(): number; + /** + * Returns the operating system name. + * @returns {string} - The operating system name. + */ export function uname(): string; + /** + * It's implemented in process.hrtime.bigint() + * @ignore + */ export function hrtime(): any; + /** + * Node.js doesn't have this method. + * @ignore + */ export function availableMemory(): any; /** * @type {string} @@ -723,7 +738,11 @@ declare module "socket:os" { } declare module "socket:process" { - export function nextTick(callback: any): void; + /** + * Adds callback to the 'nextTick' queue. + * @param {Function} callback + */ + export function nextTick(callback: Function): void; /** * @returns {string} The home directory of the current user. */ @@ -741,9 +760,11 @@ declare module "socket:process" { * @param {number=} [code=0] - The exit code. Default: 0. */ export function exit(code?: number | undefined): Promise; - export function memoryUsage(): { - rss: any; - }; + /** + * Returns an object describing the memory usage of the Node.js process measured in bytes. + * @returns {Object} + */ + export function memoryUsage(): any; export namespace memoryUsage { function rss(): any; } @@ -1951,7 +1972,7 @@ declare module "socket:fs/handle" { /** * A container for a descriptor tracked in `fds` and opened in the native layer. * This class implements the Node.js `FileHandle` interface - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#class-filehandle} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#class-filehandle} */ export class FileHandle extends EventEmitter { static get DEFAULT_ACCESS_MODE(): any; @@ -1973,7 +1994,7 @@ declare module "socket:fs/handle" { static access(path: string, mode?: number, options?: object | undefined): boolean; /** * Asynchronously open a file. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromisesopenpath-flags-mode} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromisesopenpath-flags-mode} * @param {string | Buffer | URL} path * @param {string=} [flags = 'r'] * @param {string=} [mode = 0o666] @@ -2227,7 +2248,7 @@ declare module "socket:fs/dir" { * A containerr for a directory and its entries. This class supports scanning * a directory entry by entry with a `read()` method. The `Symbol.asyncIterator` * interface is exposed along with an AsyncGenerator `entries()` method. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#class-fsdir} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#class-fsdir} */ export class Dir { static from(fdOrHandle: any, options: any): exports.Dir; @@ -2266,7 +2287,7 @@ declare module "socket:fs/dir" { } /** * A container for a directory entry. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#class-fsdirent} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#class-fsdirent} */ export class Dirent { static get UNKNOWN(): any; @@ -2332,7 +2353,7 @@ declare module "socket:fs/dir" { declare module "socket:fs/promises" { /** * Asynchronously check access a file. - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromisesaccesspath-mode} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromisesaccesspath-mode} * @param {string | Buffer | URL} path * @param {string?} [mode] * @param {object?} [options] @@ -2390,7 +2411,7 @@ declare module "socket:fs/promises" { */ export function opendir(path: string | Buffer | URL, options?: object | null): Promise; /** - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromisesreaddirpath-options} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromisesreaddirpath-options} * @param {string | Buffer | URL} path * @param {object?} options * @param {string?} [options.encoding = 'utf8'] @@ -2398,7 +2419,7 @@ declare module "socket:fs/promises" { */ export function readdir(path: string | Buffer | URL, options: object | null): Promise; /** - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromisesreadfilepath-options} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromisesreadfilepath-options} * @param {string} path * @param {object?} [options] * @param {(string|null)?} [options.encoding = null] @@ -2440,7 +2461,7 @@ declare module "socket:fs/promises" { */ export function unlink(path: any): Promise; /** - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fspromiseswritefilefile-data-options} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fspromiseswritefilefile-data-options} * @param {string | Buffer | URL | FileHandle} path - filename or FileHandle * @param {string|Buffer|Array|DataView|TypedArray} data * @param {object?} [options] @@ -2472,7 +2493,7 @@ declare module "socket:fs/index" { /** * Asynchronously check access a file for a given mode calling `callback` * upon success or error. - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsopenpath-flags-mode-callback} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsopenpath-flags-mode-callback} * @param {string | Buffer | URL} path * @param {string?|function(Error?)?} [mode = F_OK(0)] * @param {function(Error?)?} [callback] @@ -2500,21 +2521,29 @@ declare module "socket:fs/index" { export function chown(path: any, uid: any, gid: any, callback: any): void; /** * Asynchronously close a file descriptor calling `callback` upon success or error. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsclosefd-callback} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsclosefd-callback} * @param {number} fd * @param {function(Error?)?} [callback] */ export function close(fd: number, callback?: ((arg0: Error | null) => any) | null): void; - export function copyFile(src: any, dest: any, flags: any, callback: any): void; /** - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fscreatewritestreampath-options} + * Asynchronously copies `src` to `dest` calling `callback` upon success or error. + * @param {string} src - The source file path. + * @param {string} dest - The destination file path. + * @param {number} flags - Modifiers for copy operation. + * @param {function(Error=)=} [callback] - The function to call after completion. + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fscopyfilesrc-dest-mode-callback} + */ + export function copyFile(src: string, dest: string, flags: number, callback?: ((arg0: Error | undefined) => any) | undefined): void; + /** + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fscreatewritestreampath-options} * @param {string | Buffer | URL} path * @param {object?} [options] * @returns {ReadStream} */ export function createReadStream(path: string | Buffer | URL, options?: object | null): ReadStream; /** - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fscreatewritestreampath-options} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fscreatewritestreampath-options} * @param {string | Buffer | URL} path * @param {object?} [options] * @returns {WriteStream} @@ -2524,7 +2553,7 @@ declare module "socket:fs/index" { * Invokes the callback with the for the file descriptor. See * the POSIX fstat(2) documentation for more detail. * - * @see {@link https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsfstatfd-options-callback} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsfstatfd-options-callback} * * @param {number} fd - A file descriptor. * @param {object?|function?} [options] - An options object. @@ -2545,7 +2574,7 @@ declare module "socket:fs/index" { export function mkdir(path: any, options: any, callback: any): void; /** * Asynchronously open a file calling `callback` upon success or error. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsopenpath-flags-mode-callback} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsopenpath-flags-mode-callback} * @param {string | Buffer | URL} path * @param {string?} [flags = 'r'] * @param {string?} [mode = 0o666] @@ -2555,7 +2584,7 @@ declare module "socket:fs/index" { export function open(path: string | Buffer | URL, flags?: string | null, mode?: string | null, options?: any, callback?: ((arg0: Error | null, arg1: number | null) => any) | null): void; /** * Asynchronously open a directory calling `callback` upon success or error. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsreaddirpath-options-callback} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsreaddirpath-options-callback} * @param {string | Buffer | URL} path * @param {object?|function(Error?, Dir?)} [options] * @param {string?} [options.encoding = 'utf8'] @@ -2565,7 +2594,7 @@ declare module "socket:fs/index" { export function opendir(path: string | Buffer | URL, options: {}, callback: ((arg0: Error | null, arg1: Dir | null) => any) | null): void; /** * Asynchronously read from an open file descriptor. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsreadfd-buffer-offset-length-position-callback} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsreadfd-buffer-offset-length-position-callback} * @param {number} fd * @param {object | Buffer | TypedArray} buffer - The buffer that the data will be written to. * @param {number} offset - The position in buffer to write the data to. @@ -2576,7 +2605,7 @@ declare module "socket:fs/index" { export function read(fd: number, buffer: object | Buffer | TypedArray, offset: number, length: number, position: number | BigInt | null, options: any, callback: (arg0: Error | null, arg1: number | null, arg2: Buffer | null) => any): void; /** * Asynchronously read all entries in a directory. - * @see {https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsreaddirpath-options-callback} + * @see {@link https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fsreaddirpath-options-callback} * @param {string | Buffer | URL } path * @param {object?|function(Error?, object[])} [options] * @param {string?} [options.encoding ? 'utf8'] @@ -2628,7 +2657,7 @@ declare module "socket:fs/index" { */ export function unlink(path: any, callback: any): void; /** - * @see {@url https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fswritefilefile-data-options-callback} + * @see {@url https://nodejs.org/dist/latest-v20.x/docs/api/fs.html#fswritefilefile-data-options-callback} * @param {string | Buffer | URL | number } path - filename or file descriptor * @param {string | Buffer | TypedArray | DataView | object } data * @param {object?} options @@ -2676,7 +2705,11 @@ declare module "socket:crypto" { * @return {TypedArray} */ export function getRandomValues(buffer: TypedArray, ...args: any[]): TypedArray; - export function rand64(): bigint; + /** + * Generate a random 64-bit number. + * @returns {BigInt} - A random 64-bit number. + */ + export function rand64(): BigInt; /** * Generate `size` random bytes. * @param {number} size - The number of bytes to generate. The size must not be larger than 2**31 - 1. @@ -2694,7 +2727,7 @@ declare module "socket:crypto" { */ /** * WebCrypto API - * @see {https://developer.mozilla.org/en-US/docs/Web/API/Crypto} + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Crypto} */ export let webcrypto: any; /** @@ -3307,6 +3340,9 @@ declare module "socket:window" { #private; } export default ApplicationWindow; + /** + * @ignore + */ export const constants: typeof statuses; import ipc from "socket:ipc"; import * as statuses from "socket:window/constants"; @@ -3601,7 +3637,7 @@ declare module "socket:net" { export class Server extends EventEmitter { constructor(options: any, handler: any); _connections: number; - id: bigint; + id: BigInt; onconnection(data: any): void; listen(port: any, address: any, cb: any): this; _address: { @@ -3635,7 +3671,7 @@ declare module "socket:net" { pause(): this; resume(): this; connect(...args: any[]): this; - id: bigint; + id: BigInt; remotePort: any; remoteAddress: any; unref(): this; @@ -4893,6 +4929,9 @@ declare module "socket:test/index" { fail: number; }) => void): void; } + /** + * @ignore + */ export const GLOBAL_TEST_RUNNER: TestRunner; export default test; export type testWithProperties = { diff --git a/api/os.js b/api/os.js index 33a2492ad9..f8bdd11f22 100644 --- a/api/os.js +++ b/api/os.js @@ -299,6 +299,10 @@ export const EOL = (() => { return '\n' })() +// FIXME: should be process.resourceUsage() +/** + * Get resource usage. + */ export function rusage () { const { err, data } = ipc.sendSync('os.rusage') if (err) throw err @@ -315,6 +319,11 @@ export function uptime () { return data } +// FIXME: should be os.machine() + os.release() + os.type() + os.version() +/** + * Returns the operating system name. + * @returns {string} - The operating system name. + */ export function uname () { if (!cache.uname) { const { err, data } = ipc.sendSync('os.uname') @@ -325,6 +334,10 @@ export function uname () { return cache.uname } +/** + * It's implemented in process.hrtime.bigint() + * @ignore + */ export function hrtime () { const result = ipc.sendSync('os.hrtime', {}, { desiredResponseType: 'arraybuffer' @@ -334,6 +347,10 @@ export function hrtime () { return result.data.readBigUInt64BE(0) } +/** + * Node.js doesn't have this method. + * @ignore + */ export function availableMemory () { const result = ipc.sendSync('os.availableMemory', {}, { desiredResponseType: 'arraybuffer' diff --git a/api/process.js b/api/process.js index 2ed9a059de..58c6a78291 100644 --- a/api/process.js +++ b/api/process.js @@ -35,6 +35,10 @@ if (!isNode) { export default process +/** + * Adds callback to the 'nextTick' queue. + * @param {Function} callback + */ export function nextTick (callback) { if (typeof process.nextTick === 'function' && process.nextTick !== nextTick) { process.nextTick(callback) @@ -105,6 +109,10 @@ export async function exit (code) { } } +/** + * Returns an object describing the memory usage of the Node.js process measured in bytes. + * @returns {Object} + */ export function memoryUsage () { const rss = memoryUsage.rss() return { diff --git a/api/test/index.js b/api/test/index.js index 5f0b011ee4..db6b35a8c8 100644 --- a/api/test/index.js +++ b/api/test/index.js @@ -1045,6 +1045,9 @@ function printLine (line) { console.log(line) } +/** + * @ignore + */ export const GLOBAL_TEST_RUNNER = new TestRunner() initContext(GLOBAL_TEST_RUNNER) diff --git a/api/window.js b/api/window.js index c2417f302e..f0c3f08a0d 100644 --- a/api/window.js +++ b/api/window.js @@ -406,4 +406,7 @@ export class ApplicationWindow { } export default ApplicationWindow +/** + * @ignore + */ export const constants = statuses