Skip to content

Commit

Permalink
chore(docs): generate types and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jwerle committed Apr 26, 2024
1 parent e55dbcc commit 0c1ef0f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 13 deletions.
31 changes: 23 additions & 8 deletions api/README.md
Expand Up @@ -1213,7 +1213,22 @@ Unlinks (removes) file at `path`.
| options.signal | AbortSignal? | | true | |
| callback | function(Error?) | | false | |

## [`watch(, options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L1262)
## [`writeFileSync(path, data, options)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L1265)

External docs: https://nodejs.org/api/fs.html#fswritefilesyncfile-data-options
Writes data to a file synchronously.

| Argument | Type | Default | Optional | Description |
| :--- | :--- | :---: | :---: | :--- |
| path | string \| Buffer \| URL \| number | | false | filename or file descriptor |
| data | string \| Buffer \| TypedArray \| DataView \| object | | false | |
| options | object? | | false | |
| options.encoding ? utf8 | string? | | true | |
| options.mode ? 0o666 | string? | | true | |
| options.flag ? w | string? | | true | |
| options.signal | AbortSignal? | | true | |

## [`watch(, options, callback)`](https://github.com/socketsupply/socket/blob/master/api/fs/index.js#L1300)

Watch for changes at `path` calling `callback`

Expand Down Expand Up @@ -1594,7 +1609,7 @@ Watch for changes at `path` calling `callback`
This is a `FunctionDeclaration` named `maybeMakeError` in `api/ipc.js`, it's exported but undocumented.
## [`emit(name, value, target, options)`](https://github.com/socketsupply/socket/blob/master/api/ipc.js#L1135)
## [`emit(name, value, target, options)`](https://github.com/socketsupply/socket/blob/master/api/ipc.js#L1141)
Emit event to be dispatched on `window` object.
Expand All @@ -1605,7 +1620,7 @@ Emit event to be dispatched on `window` object.
| target | EventTarget | window | true | |
| options | Object | | true | |
## [`send(command, value, options)`](https://github.com/socketsupply/socket/blob/master/api/ipc.js#L1194)
## [`send(command, value, options)`](https://github.com/socketsupply/socket/blob/master/api/ipc.js#L1200)
Sends an async IPC command request with parameters.
Expand Down Expand Up @@ -2003,20 +2018,20 @@ Converts this `Path` instance to a string.
This is a `ClassDeclaration` named ``ProcessEnvironmentEvent` (extends `Event`)` in `api/process.js`, it's exported but undocumented.


## [env](https://github.com/socketsupply/socket/blob/master/api/process.js#L26)
## [env](https://github.com/socketsupply/socket/blob/master/api/process.js#L29)

This is a `VariableDeclaration` named `env` in `api/process.js`, it's exported but undocumented.


## [`nextTick(callback)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L170)
## [`nextTick(callback)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L190)

Adds callback to the 'nextTick' queue.

| Argument | Type | Default | Optional | Description |
| :--- | :--- | :---: | :---: | :--- |
| callback | Function | | false | |

## [`hrtime(time)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L201)
## [`hrtime(time)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L221)

Computed high resolution time as a `BigInt`.

Expand All @@ -2028,15 +2043,15 @@ Computed high resolution time as a `BigInt`.
| :--- | :--- | :--- |
| Not specified | bigint | |

## [`exit(code)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L227)
## [`exit(code)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L247)



| Argument | Type | Default | Optional | Description |
| :--- | :--- | :---: | :---: | :--- |
| code | number | 0 | true | The exit code. Default: 0. |

## [`memoryUsage()`](https://github.com/socketsupply/socket/blob/master/api/process.js#L239)
## [`memoryUsage()`](https://github.com/socketsupply/socket/blob/master/api/process.js#L259)

Returns an object describing the memory usage of the Node.js process measured in bytes.

Expand Down
32 changes: 27 additions & 5 deletions api/index.d.ts
Expand Up @@ -1687,6 +1687,11 @@ declare module "socket:path/well-known" {
* @type {?string}
*/
export const LOG: string | null;
/**
* Well known path to the application's "tmp" folder.
* @type {?string}
*/
export const TMP: string | null;
/**
* Well known path to the application's "home" folder.
* This may be the user's HOME directory or the application container sandbox.
Expand All @@ -1705,6 +1710,7 @@ declare module "socket:path/well-known" {
export { HOME };
export { DATA };
export { LOG };
export { TMP };
}
export default _default;
}
Expand Down Expand Up @@ -2769,9 +2775,10 @@ declare module "socket:path/win32" {
import { HOME } from "socket:path/well-known";
import { DATA } from "socket:path/well-known";
import { LOG } from "socket:path/well-known";
import { TMP } from "socket:path/well-known";
import * as exports from "socket:path/win32";

export { mounts, posix, Path, DOWNLOADS, DOCUMENTS, RESOURCES, PICTURES, DESKTOP, VIDEOS, CONFIG, MUSIC, HOME, DATA, LOG };
export { mounts, posix, Path, DOWNLOADS, DOCUMENTS, RESOURCES, PICTURES, DESKTOP, VIDEOS, CONFIG, MUSIC, HOME, DATA, LOG, TMP };
}

declare module "socket:path/posix" {
Expand Down Expand Up @@ -2863,9 +2870,10 @@ declare module "socket:path/posix" {
import { HOME } from "socket:path/well-known";
import { DATA } from "socket:path/well-known";
import { LOG } from "socket:path/well-known";
import { TMP } from "socket:path/well-known";
import * as exports from "socket:path/posix";

export { mounts, win32, Path, DOWNLOADS, DOCUMENTS, RESOURCES, PICTURES, DESKTOP, VIDEOS, CONFIG, MUSIC, HOME, DATA, LOG };
export { mounts, win32, Path, DOWNLOADS, DOCUMENTS, RESOURCES, PICTURES, DESKTOP, VIDEOS, CONFIG, MUSIC, HOME, DATA, LOG, TMP };
}

declare module "socket:path/index" {
Expand All @@ -2885,9 +2893,10 @@ declare module "socket:path/index" {
import { HOME } from "socket:path/well-known";
import { DATA } from "socket:path/well-known";
import { LOG } from "socket:path/well-known";
import { TMP } from "socket:path/well-known";
import * as exports from "socket:path/index";

export { mounts, posix, win32, Path, DOWNLOADS, DOCUMENTS, RESOURCES, PICTURES, DESKTOP, VIDEOS, CONFIG, MUSIC, HOME, DATA, LOG };
export { mounts, posix, win32, Path, DOWNLOADS, DOCUMENTS, RESOURCES, PICTURES, DESKTOP, VIDEOS, CONFIG, MUSIC, HOME, DATA, LOG, TMP };
}

declare module "socket:path" {
Expand Down Expand Up @@ -2921,7 +2930,8 @@ declare module "socket:path" {
import { HOME } from "socket:path/index";
import { DATA } from "socket:path/index";
import { LOG } from "socket:path/index";
export { Path, posix, win32, mounts, DOWNLOADS, DOCUMENTS, RESOURCES, PICTURES, DESKTOP, VIDEOS, CONFIG, MUSIC, HOME, DATA, LOG };
import { TMP } from "socket:path/index";
export { Path, posix, win32, mounts, DOWNLOADS, DOCUMENTS, RESOURCES, PICTURES, DESKTOP, VIDEOS, CONFIG, MUSIC, HOME, DATA, LOG, TMP };
}

declare module "socket:fs/stream" {
Expand Down Expand Up @@ -4462,6 +4472,18 @@ declare module "socket:fs/index" {
* @param {function(Error?)} callback
*/
export function writeFile(path: string | Buffer | URL | number, data: string | Buffer | TypedArray | DataView | object, options: object | null, callback: (arg0: Error | null) => any): void;
/**
* Writes data to a file synchronously.
* @param {string | Buffer | URL | number } path - filename or file descriptor
* @param {string | Buffer | TypedArray | DataView | object } data
* @param {object?} options
* @param {string?} [options.encoding ? 'utf8']
* @param {string?} [options.mode ? 0o666]
* @param {string?} [options.flag ? 'w']
* @param {AbortSignal?} [options.signal]
* @see {@link https://nodejs.org/api/fs.html#fswritefilesyncfile-data-options}
*/
export function writeFileSync(path: string | Buffer | URL | number, data: string | Buffer | TypedArray | DataView | object, options: object | null): void;
/**
* Watch for changes at `path` calling `callback`
* @param {string}
Expand Down Expand Up @@ -4620,7 +4642,7 @@ declare module "socket:ipc" {
* @return {Result}
* @ignore
*/
export function sendSync(command: string, value?: any | null, options?: object | null): Result;
export function sendSync(command: string, value?: any | null, options?: object | null, buffer: any): Result;
/**
* Emit event to be dispatched on `window` object.
* @param {string} name
Expand Down

0 comments on commit 0c1ef0f

Please sign in to comment.