Skip to content

Commit

Permalink
chore(api): generate types + docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jwerle committed Apr 2, 2024
1 parent c460428 commit e311c97
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 17 deletions.
4 changes: 2 additions & 2 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,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#L1127)
## [`emit(name, value, target, options)`](https://github.com/socketsupply/socket/blob/master/api/ipc.js#L1135)
Emit event to be dispatched on `window` object.
Expand All @@ -1603,7 +1603,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#L1186)
## [`send(command, value, options)`](https://github.com/socketsupply/socket/blob/master/api/ipc.js#L1194)
Sends an async IPC command request with parameters.
Expand Down
62 changes: 47 additions & 15 deletions api/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6537,7 +6537,10 @@ declare module "socket:console" {
trace(...objects: any[]): void;
warn(...args: any[]): void;
}
const _default: Console;
const _default: Console & {
Console: typeof Console;
globalConsole: globalThis.Console;
};
export default _default;
}

Expand Down Expand Up @@ -11383,7 +11386,8 @@ declare module "socket:commonjs/loader" {
* extensions?: string[] | Set<string>
* origin?: URL | string,
* statuses?: Cache
* cache?: { response?: Cache, status?: Cache }
* cache?: { response?: Cache, status?: Cache },
* headers?: Headers | Map | object | string[][]
* }} LoaderOptions
*/
/**
Expand Down Expand Up @@ -11687,6 +11691,11 @@ declare module "socket:commonjs/loader" {
response: Cache;
status: Cache;
};
/**
* Headers used in too loader requests.
* @type {Headers}
*/
get headers(): Headers;
/**
* A set of supported `Loader` extensions.
* @type {Set<string>}
Expand Down Expand Up @@ -11734,6 +11743,7 @@ declare module "socket:commonjs/loader" {
response?: Cache;
status?: Cache;
};
headers?: Headers | Map<any, any> | object | string[][];
};
export type RequestOptions = {
loader?: Loader;
Expand Down Expand Up @@ -11962,6 +11972,13 @@ declare module "socket:commonjs/package" {
* @type {typeof Dependencies}
*/
static Dependencies: typeof Dependencies;
/**
* Creates and loads a package
* @param {string|URL|NameOptions|Name} name
* @param {PackageOptions & PackageLoadOptions=} [options]
* @return {Package}
*/
static load(name: string | URL | NameOptions | Name, options?: (PackageOptions & PackageLoadOptions) | undefined): Package;
/**
* `Package` class constructor.
* @param {string|URL|NameOptions|Name} name
Expand All @@ -11979,11 +11996,23 @@ declare module "socket:commonjs/package" {
* @type {string}
*/
get url(): string;
/**
* A reference to the package subpath imports and browser mappings.
* These values are typically used with its corresponding `Module`
* instance require resolvers.
* @type {object}
*/
get imports(): any;
/**
* A loader for this package, if available. This value may be `null`.
* @type {Loader}
*/
get loader(): Loader;
/**
* `true` if the package was actually "loaded", otherwise `false`.
* @type {boolean}
*/
get loaded(): boolean;
/**
* The name of the package.
* @type {string}
Expand Down Expand Up @@ -13087,7 +13116,13 @@ declare module "socket:commonjs/module" {
* @param {object} global
*/
export function CommonJSModuleScope(exports: object, require: (arg0: string) => any, module: Module, __filename: string, __dirname: string, process: typeof process, global: object): void;
export function createRequire(url: any, options?: any): any;
/**
* Creates a `require` function from a given module URL.
* @param {string|URL} url
* @param {ModuleOptions=} [options]
* @return {RequireFunction}
*/
export function createRequire(url: string | URL, options?: ModuleOptions | undefined): RequireFunction;
/**
* @typedef {import('./require.js').RequireResolver[]} ModuleResolver
*/
Expand Down Expand Up @@ -14881,34 +14916,31 @@ declare module "socket:npm/module" {
* @typedef {{
* package: Package
* origin: string,
* type: 'commonjs' | 'module',,
* type: 'commonjs' | 'module',
* url: string
* }} ModuleResolution
*/
/**
* Resolves an NPM module for a given `specifier` and an optional `origin`.
* @param {string|URL} specifier
* @param {string|URL=} [origin]
* @param {{ prefix?: string }} [options]
* @param {{ prefix?: string, type?: 'commonjs' | 'module' }} [options]
* @return {ModuleResolution|null}
*/
export function resolve(specifier: string | URL, origin?: (string | URL) | undefined, options?: {
prefix?: string;
type?: 'commonjs' | 'module';
}): ModuleResolution | null;
/**
* ,
* url: string
* }} ModuleResolution
*/
export type resolve = {
package: Package;
origin: string;
type: 'commonjs' | 'module';
};
namespace _default {
export { resolve };
}
export default _default;
export type ModuleResolution = {
package: Package;
origin: string;
type: 'commonjs' | 'module';
url: string;
};
import { Package } from "socket:commonjs/package";
}

Expand Down

0 comments on commit e311c97

Please sign in to comment.