synthesize typedef

This corrects various fields.
This commit is contained in:
David Reed 2022-12-08 17:42:51 -05:00
parent 328d4cacd2
commit 3fd72c0454
No known key found for this signature in database
GPG key ID: 2211691D8A1EE72F

22
src/uv.d.ts vendored
View file

@ -23,6 +23,7 @@ export type UVDecode = (input: Coded) => string;
/** /**
* The Ultraviolet configuration object. * The Ultraviolet configuration object.
* This interface defines the configuration options for the Ultraviolet library.
*/ */
export interface UVConfig { export interface UVConfig {
/** /**
@ -40,6 +41,7 @@ export interface UVConfig {
bare?: string | string[]; bare?: string | string[];
/** /**
* The prefix for Ultraviolet to listen on. * The prefix for Ultraviolet to listen on.
* This prefix will be used to create the URL for the service worker and the client script.
* @example `https://example.org/uv/service/` * @example `https://example.org/uv/service/`
* @example `/uv/service/` * @example `/uv/service/`
* @defaultValue `/service/` * @defaultValue `/service/`
@ -47,6 +49,7 @@ export interface UVConfig {
prefix?: string; prefix?: string;
/** /**
* The path to the Ultraviolet client script. * The path to the Ultraviolet client script.
* This script will be loaded by the browser and is responsible for communicating with the service worker.
* Both relative and absolute paths are accepted. Relative paths are resolved to the current URL * Both relative and absolute paths are accepted. Relative paths are resolved to the current URL
* @example `/uv/uv.client.js`, * @example `/uv/uv.client.js`,
* @defaultValue `/uv.client.js` or if bundle is specified and the filename is `uv.bundle.js`, the directory of the bundle + `uv.client.js` will be used automatically * @defaultValue `/uv.client.js` or if bundle is specified and the filename is `uv.bundle.js`, the directory of the bundle + `uv.client.js` will be used automatically
@ -54,20 +57,23 @@ export interface UVConfig {
client?: string; client?: string;
/** /**
* The path to the Ultraviolet service worker script. * The path to the Ultraviolet service worker script.
* This script will be registered as a service worker and is responsible for handling network requests.
* Both relative and absolute paths are accepted. Relative paths are resolved to the current URL * Both relative and absolute paths are accepted. Relative paths are resolved to the current URL
* @example `/uv/uv.sw.js`, * @example `/uv/uv.sw.js`,
* @defaultValue `/uv.sw.js` * @defaultValue `/uv.sw.js`
*/ */
handler?: string; handler?: string;
/** /**
* The path to the Ultraviolet service worker script. * The path to the bundled script that contains both the Ultraviolet client and service worker scripts.
* This path is optional and can be used instead of the `client` and `handler` paths to load a single bundled script.
* Both relative and absolute paths are accepted. Relative paths are resolved to the current URL * Both relative and absolute paths are accepted. Relative paths are resolved to the current URL
* @example `/uv/uv.sw.js`, * @example `/uv/uv.bundle.js`,
* @defaultValue `/uv.sw.js` * @defaultValue `/uv.bundle.js`
*/ */
bundle?: string; bundle?: string;
/** /**
* The path to the Ultraviolet service worker script. * The path to the Ultraviolet configuration script.
* This script should export a configuration object that will be used to configure the client and service worker.
* Both relative and absolute paths are accepted. Relative paths are resolved to the current URL * Both relative and absolute paths are accepted. Relative paths are resolved to the current URL
* @example `/uv/uv.config.js`, * @example `/uv/uv.config.js`,
* @defaultValue `/uv.config.js` * @defaultValue `/uv.config.js`
@ -75,6 +81,7 @@ export interface UVConfig {
config?: string; config?: string;
/** /**
* The path to the Ultraviolet service worker script. * The path to the Ultraviolet service worker script.
* This path is optional and can be used instead of the `handler` path to specify a custom service worker script.
* Both relative and absolute paths are accepted. Relative paths are resolved to the current URL * Both relative and absolute paths are accepted. Relative paths are resolved to the current URL
* @example `/uv/uv.sw.js`, * @example `/uv/uv.sw.js`,
* @defaultValue `/uv.sw.js` * @defaultValue `/uv.sw.js`
@ -82,13 +89,16 @@ export interface UVConfig {
sw?: string; sw?: string;
/** /**
* The URL encoder. * The URL encoder.
* This function will be used to encode URLs before they are sent to the server.
* The encoder should use `encodeURIComponent` to encode the URLs.
* @defaultValue `Ultraviolet.codec.xor.encode` * @defaultValue `Ultraviolet.codec.xor.encode`
*/ */
encodeUrl?: UVEncode; encodeUrl?: UVEncode;
/** /**
* The URL decoder. * The URL decoder.
* @defaultValue `Ultraviolet.codec.xor.encode` * This function will be used to decode URLs after they are received from the server.
* * The decoder should use `decodeURIComponent` to decode the URLs.
* @defaultValue `Ultraviolet.codec.xor.decode`
*/ */
decodeUrl?: UVDecode; decodeUrl?: UVDecode;
} }