diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index b2404703..f30ba88b 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -2,7 +2,9 @@ name: Build docs on: push: branches: [master] - paths: ['impit/**'] + pull_request: + branches: [master] + workflow_dispatch: permissions: contents: read pages: write @@ -11,8 +13,8 @@ concurrency: group: deploy cancel-in-progress: false jobs: - build: - name: Build + build-rust: + name: Build rustdoc runs-on: ubuntu-latest steps: - name: Checkout repository @@ -21,9 +23,6 @@ jobs: uses: dtolnay/rust-toolchain@stable - name: Configure cache uses: Swatinem/rust-cache@v2 - - name: Setup pages - id: pages - uses: actions/configure-pages@v5 - name: Clean docs folder run: cargo clean --doc - name: Build docs @@ -33,17 +32,68 @@ jobs: - name: Copy redirect run: cp impit/docs/index.html target/doc/index.html - name: Upload artifact - uses: actions/upload-pages-artifact@v4 + uses: actions/upload-artifact@v4 with: path: target/doc/ + name: rustdoc + + build-node: + name: Build typedoc + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v5 + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + - name: Configure cache + uses: Swatinem/rust-cache@v2 + - name: Use Node.js + uses: actions/setup-node@v5 + with: + node-version: 24 + + - name: Enable Corepack + run: | + corepack enable + corepack prepare yarn@stable --activate + + - name: Activate cache for Node.js + uses: actions/setup-node@v5 + with: + node-version: 24 + cache: yarn + cache-dependency-path: impit-node/yarn.lock + + - name: Install dependencies + run: cd impit-node && yarn + + - name: Build docs + run: cd impit-node && yarn docs + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + path: impit-node/docs/ + name: typedoc + deploy: name: Deploy + if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest - needs: build + needs: [build-rust, build-node] steps: + - name: Download typedoc artifact + uses: actions/download-artifact@v5 + with: + name: typedoc + path: docs/ + - name: Setup pages + uses: actions/configure-pages@v5 - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file + uses: actions/deploy-pages@v4 + with: + folder: docs diff --git a/impit-node/.gitignore b/impit-node/.gitignore index 69dbb161..1b79283b 100644 --- a/impit-node/.gitignore +++ b/impit-node/.gitignore @@ -121,7 +121,7 @@ dist .AppleDouble .LSOverride -# Icon must end with two +# Icon must end with two Icon @@ -196,4 +196,5 @@ Cargo.lock *.node -example.ts \ No newline at end of file +example.ts +docs/ diff --git a/impit-node/index.d.ts b/impit-node/index.d.ts index 06f8b2a3..6e79957e 100644 --- a/impit-node/index.d.ts +++ b/impit-node/index.d.ts @@ -1,26 +1,197 @@ /* auto-generated by NAPI-RS */ /* eslint-disable */ + +export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array +/** + * The main class of the `impit` package + * + * This class is the primary interface for making HTTP requests. + * It provides methods to configure the Impit instance and to perform requests. + * + * @example + * ```ts + * import { Impit } from 'impit'; + * + * const impit = new Impit(); + * const response = await impit.fetch('https://example.com'); + * console.log(await response.text()); + * ``` + */ export declare class Impit { + /** + * Creates a new `Impit` instance with the given options. + * + * The `options` parameter allows you to customize the behavior of the Impit instance. + * If no options are provided, default settings will be used. + * + * @example + * ```ts + * import { Impit } from 'impit'; + * + * const impit = new Impit({ + * timeout: 5e3, // Set a default timeout of 5000 + * headers: { + * 'Authorization: 'Bearer ', + * }, + * browser: 'chrome', + * }); + * ``` + */ constructor(options?: ImpitOptions | undefined | null) - /** Fetch a URL with the given options. */ + /** + * Fetch a URL with the given options. + * + * This method performs an HTTP request to the specified URL using the provided options. + * It returns a promise that resolves to an {@link ImpitResponse} object containing the response data. + * + * This method is designed to be API-compatible with the {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch | Fetch API `fetch`} global method. + * + * @example + * ```ts + * import { Impit } from 'impit'; + * + * const impit = new Impit(); + * const response = await impit.fetch('https://example.com', { + * method: 'GET', + * headers: { + * 'Accept': 'application/json' + * }, + * timeout: 5e3, + * }); + * ``` + */ fetch(url: string, requestInit?: RequestInit | undefined | null): Promise } export type ImpitWrapper = Impit +/** + * Represents an HTTP response. + * + * The `ImpitResponse` class provides access to the response status, headers, and body. + * It also includes methods to read the response body in various formats such as text, JSON, + * ArrayBuffer, and as a stream. + * + * This class is designed to be API-compatible with the {@link https://developer.mozilla.org/en-US/docs/Web/API/Response | Fetch API Response} class. + * + * @hideconstructor + */ export declare class ImpitResponse { + /** + * HTTP status code of the response. + * + * Example: `200` for a successful response. + */ status: number + /** + * Status text of the response. + * + * A short description of the status code. + * + * Example: "OK" for status code 200. + */ statusText: string + /** + * HTTP headers of the response. + * + * An instance of the {@link https://developer.mozilla.org/en-US/docs/Web/API/Headers | Headers} class. + */ headers: Headers + /** `true` if the response status code is in the range 200-299. */ ok: boolean + /** + * URL of the response. + * + * In case of redirects, this will be the final URL after all redirects have been followed. + */ url: string + /** @ignore */ decodeBuffer(buffer: Buffer): string + /** + * Returns the response body as an `ArrayBuffer`. + * + * This method is asynchronous and returns a promise that resolves to an `ArrayBuffer` containing the response body data. + * + * @example + * ```ts + * const response = await impit.fetch('https://example.com'); + * const arrayBuffer = await response.arrayBuffer(); + * + * console.log(arrayBuffer); // ArrayBuffer([ 0x3c, 0x68, 0x74, 0x6d, 0x6c, ... ]) + * ``` + * + * Note that you cannot call this method multiple times on the same response instance, + * as the response body can only be consumed once. Subsequent calls will result in an error. + */ arrayBuffer(): Promise + /** + * Returns the response body as a `Uint8Array`. + * + * This method is asynchronous and returns a promise that resolves to a `Uint8Array` containing the response body data. + * + * @example + * ```ts + * const response = await impit.fetch('https://example.com'); + * const uint8Array = await response.bytes(); + * + * console.log(uint8Array); // Uint8Array([ 0x3c, 0x68, 0x74, 0x6d, 0x6c, ... ]) + * ``` + * + * Note that you cannot call this method multiple times on the same response instance, + * as the response body can only be consumed once. Subsequent calls will result in an error. + */ bytes(): Promise + /** + * Returns the response body as a string. + * + * This method is asynchronous and returns a promise that resolves to a string containing the response body data. + * + * @example + * ```ts + * const response = await impit.fetch('https://example.com'); + * const text = await response.text(); + * + * console.log(text); // "..." + * ``` + */ text(): Promise + /** + * Parses the response body as JSON. + * + * This method is asynchronous and returns a promise that resolves to the parsed JSON object. + * + * @example + * ```ts + * const response = await impit.fetch('https://api.example.com/data'); + * const data = await response.json(); + * + * console.log(data); // Parsed JSON object + * ``` + */ json(): Promise + /** + * Returns the response body as a `ReadableStream`. + * + * This property provides access to the response body as a stream of data, allowing you to read it in chunks. + * + * @example + * ```ts + * const response = await impit.fetch('https://example.com'); + * const reader = response.body.getReader(); + * + * let result; + * while (!(result = await reader.read()).done) { + * console.log(result.value); // Uint8Array chunk + * } + * ``` + */ get body(): ReadableStream } +/** + * Supported browsers for emulation. + * + * See {@link ImpitOptions.browser} for more details and usage. + */ export type Browser = 'chrome'| 'firefox'; @@ -32,41 +203,119 @@ export type HttpMethod = 'GET'| 'HEAD'| 'OPTIONS'; +/** + * Options for configuring an {@link Impit} instance. + * + * These options allow you to customize the behavior of the Impit instance, including browser emulation, TLS settings, proxy configuration, timeouts, and more. + * + * If no options are provided, default settings will be used. + * + * See {@link Impit} for usage. + */ export interface ImpitOptions { + /** + * What browser to emulate. + * + * @default `undefined` (no browser emulation) + */ browser?: Browser + /** + * Ignore TLS errors such as invalid certificates. + * + * @default `false` + */ ignoreTlsErrors?: boolean + /** + * Whether to fallback to a vanilla user-agent if the emulated browser + * is not supported by the target website. + * + * @default `false` + */ vanillaFallback?: boolean + /** + * Proxy URL to use for this Impit instance. + * + * Supports HTTP, HTTPS, SOCKS4 and SOCKS5 proxies. + * + * @default `undefined` (no proxy) + */ proxyUrl?: string /** Default timeout for this Impit instance in milliseconds. */ timeout?: number - /** Enable HTTP/3 support. */ + /** + * Enable HTTP/3 support. + * + * @default `false` + */ http3?: boolean - /** Follow redirects. */ + /** + * Whether to follow redirects or not. + * + * @default `true` + */ followRedirects?: boolean /** - * Maximum number of redirects to follow. Default is `10`. + * Maximum number of redirects to follow. * * If this number is exceeded, the request will be rejected with an error. + * + * @default `10` */ maxRedirects?: number - /** Pass a ToughCookie instance to Impit. */ + /** + * Pass a {@link https://github.com/salesforce/tough-cookie | `ToughCookie`} instance to Impit. + * + * This `impit` instance will use the provided cookie jar for both storing and retrieving cookies. + * + * @default `undefined` (no cookie jar, i.e., cookies are not stored or sent across requests) + */ cookieJar?: { setCookie: (cookie: string, url: string, cb?: any) => Promise | void, getCookieString: (url: string) => Promise | string } -/** Additional headers to include in every request made by this Impit instance. */ +/** + * Additional headers to include in every request made by this Impit instance. + * + * Can be an object, a Map, or an array of tuples or an instance of the {@link https://developer.mozilla.org/en-US/docs/Web/API/Headers | Headers} class. + * + * @default `undefined` (no additional headers) + */ headers?: Headers | Record | [string, string][] /** * Local address to bind the client to. Useful for testing purposes or when you want to bind the client to a specific network interface. * - * Can be an IP address in the format "xxx.xxx.xxx.xxx" (for IPv4) or "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" (for IPv6). + * Can be an IP address in the format `xxx.xxx.xxx.xxx` (for IPv4) or `ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff` (for IPv6). + * + * @default `undefined` (the OS will choose the local address) */ localAddress?: string } +/** + * Options for configuring an individual HTTP request. + * + * These options allow you to customize the behavior of a specific request, including the HTTP method, headers, body, timeout, and whether to force HTTP/3. + * + * If no options are provided, default settings will be used. + * + * See {@link Impit.fetch} for usage. + */ export interface RequestInit { + /** + * HTTP method to use for the request. Default is `GET`. + * + * Can be one of: `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS`. + */ method?: HttpMethod + /** + * Additional headers to include in the request. + * + * Can be an object, a Map, or an array of tuples or an instance of the {@link https://developer.mozilla.org/en-US/docs/Web/API/Headers | Headers} class. + * + * Note that headers set here will override any default headers set in {@link ImpitOptions.headers}. + */ headers?: Headers | Record | [string, string][] + /** Request body. Can be a string, Buffer, ArrayBuffer, TypedArray, DataView, Blob, File, URLSearchParams, FormData or ReadableStream. */ body?: string | ArrayBuffer | Uint8Array | DataView | Blob | File | URLSearchParams | FormData | ReadableStream - /** Request timeout in milliseconds. Overrides the Impit-wide timeout option. */ + /** Request timeout in milliseconds. Overrides the Impit-wide timeout option from {@link ImpitOptions.timeout}. */ timeout?: number - /** Force the request to use HTTP/3. If the server doesn't expect HTTP/3, the request will fail. */ + /** Force the request to use HTTP/3. If the server doesn't expect HTTP/3 or the Impit instance doesn't have HTTP/3 enabled (via the {@link ImpitOptions.http3} option), the request will fail. */ forceHttp3?: boolean } diff --git a/impit-node/index.js b/impit-node/index.js index 11b37148..60c47549 100644 --- a/impit-node/index.js +++ b/impit-node/index.js @@ -80,8 +80,8 @@ function requireNative() { try { const binding = require('impit-android-arm64') const bindingPackageVersion = require('impit-android-arm64/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -96,8 +96,8 @@ function requireNative() { try { const binding = require('impit-android-arm-eabi') const bindingPackageVersion = require('impit-android-arm-eabi/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -116,8 +116,8 @@ function requireNative() { try { const binding = require('impit-win32-x64-msvc') const bindingPackageVersion = require('impit-win32-x64-msvc/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -132,8 +132,8 @@ function requireNative() { try { const binding = require('impit-win32-ia32-msvc') const bindingPackageVersion = require('impit-win32-ia32-msvc/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -148,8 +148,8 @@ function requireNative() { try { const binding = require('impit-win32-arm64-msvc') const bindingPackageVersion = require('impit-win32-arm64-msvc/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -167,8 +167,8 @@ function requireNative() { try { const binding = require('impit-darwin-universal') const bindingPackageVersion = require('impit-darwin-universal/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -183,8 +183,8 @@ function requireNative() { try { const binding = require('impit-darwin-x64') const bindingPackageVersion = require('impit-darwin-x64/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -199,8 +199,8 @@ function requireNative() { try { const binding = require('impit-darwin-arm64') const bindingPackageVersion = require('impit-darwin-arm64/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -219,8 +219,8 @@ function requireNative() { try { const binding = require('impit-freebsd-x64') const bindingPackageVersion = require('impit-freebsd-x64/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -235,8 +235,8 @@ function requireNative() { try { const binding = require('impit-freebsd-arm64') const bindingPackageVersion = require('impit-freebsd-arm64/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -256,8 +256,8 @@ function requireNative() { try { const binding = require('impit-linux-x64-musl') const bindingPackageVersion = require('impit-linux-x64-musl/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -272,8 +272,8 @@ function requireNative() { try { const binding = require('impit-linux-x64-gnu') const bindingPackageVersion = require('impit-linux-x64-gnu/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -290,8 +290,8 @@ function requireNative() { try { const binding = require('impit-linux-arm64-musl') const bindingPackageVersion = require('impit-linux-arm64-musl/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -306,8 +306,8 @@ function requireNative() { try { const binding = require('impit-linux-arm64-gnu') const bindingPackageVersion = require('impit-linux-arm64-gnu/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -324,8 +324,8 @@ function requireNative() { try { const binding = require('impit-linux-arm-musleabihf') const bindingPackageVersion = require('impit-linux-arm-musleabihf/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -340,8 +340,8 @@ function requireNative() { try { const binding = require('impit-linux-arm-gnueabihf') const bindingPackageVersion = require('impit-linux-arm-gnueabihf/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -358,8 +358,8 @@ function requireNative() { try { const binding = require('impit-linux-riscv64-musl') const bindingPackageVersion = require('impit-linux-riscv64-musl/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -374,8 +374,8 @@ function requireNative() { try { const binding = require('impit-linux-riscv64-gnu') const bindingPackageVersion = require('impit-linux-riscv64-gnu/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -391,8 +391,8 @@ function requireNative() { try { const binding = require('impit-linux-ppc64-gnu') const bindingPackageVersion = require('impit-linux-ppc64-gnu/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -407,8 +407,8 @@ function requireNative() { try { const binding = require('impit-linux-s390x-gnu') const bindingPackageVersion = require('impit-linux-s390x-gnu/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -427,8 +427,8 @@ function requireNative() { try { const binding = require('impit-openharmony-arm64') const bindingPackageVersion = require('impit-openharmony-arm64/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -443,8 +443,8 @@ function requireNative() { try { const binding = require('impit-openharmony-x64') const bindingPackageVersion = require('impit-openharmony-x64/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -459,8 +459,8 @@ function requireNative() { try { const binding = require('impit-openharmony-arm') const bindingPackageVersion = require('impit-openharmony-arm/package.json').version - if (bindingPackageVersion !== '0.5.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.5.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.5.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.5.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { diff --git a/impit-node/package.json b/impit-node/package.json index 52424c88..f9350d61 100644 --- a/impit-node/package.json +++ b/impit-node/package.json @@ -29,6 +29,9 @@ "express": "^5.0.0", "socks-server-lib": "^0.0.3", "tough-cookie": "^6.0.0", + "typedoc": "^0.28.13", + "typedoc-plugin-mdn-links": "^5.0.9", + "typescript": "^5.9.2", "vitest": "^3.0.5" }, "ava": { @@ -41,6 +44,7 @@ "artifacts": "napi artifacts --output-dir ../artifacts --npm-dir npm", "build": "napi build --platform --release --no-const-enum", "build:debug": "napi build --platform --no-const-enum", + "docs": "npm run build:debug && typedoc --plugin typedoc-plugin-mdn-links ./index.d.ts --out ./docs", "prepublishOnly": "napi prepublish -t npm --no-gh-release", "test": "vitest --retry=3", "universal": "napi universal", diff --git a/impit-node/src/impit_builder.rs b/impit-node/src/impit_builder.rs index 0f144a51..b324e08b 100644 --- a/impit-node/src/impit_builder.rs +++ b/impit-node/src/impit_builder.rs @@ -9,6 +9,9 @@ use napi_derive::napi; use crate::request::NodeCookieJar; +/// Supported browsers for emulation. +/// +/// See {@link ImpitOptions.browser} for more details and usage. #[napi(string_enum = "lowercase")] pub enum Browser { Chrome, @@ -24,34 +27,72 @@ impl From for ImpitBrowser { } } +/// Options for configuring an {@link Impit} instance. +/// +/// These options allow you to customize the behavior of the Impit instance, including browser emulation, TLS settings, proxy configuration, timeouts, and more. +/// +/// If no options are provided, default settings will be used. +/// +/// See {@link Impit} for usage. #[derive(Default)] #[napi(object)] pub struct ImpitOptions<'a> { + /// What browser to emulate. + /// + /// @default `undefined` (no browser emulation) pub browser: Option, + /// Ignore TLS errors such as invalid certificates. + /// + /// @default `false` pub ignore_tls_errors: Option, + /// Whether to fallback to a vanilla user-agent if the emulated browser + /// is not supported by the target website. + /// + /// @default `false` pub vanilla_fallback: Option, + /// Proxy URL to use for this Impit instance. + /// + /// Supports HTTP, HTTPS, SOCKS4 and SOCKS5 proxies. + /// + /// @default `undefined` (no proxy) pub proxy_url: Option, /// Default timeout for this Impit instance in milliseconds. pub timeout: Option, /// Enable HTTP/3 support. + /// + /// @default `false` pub http3: Option, - /// Follow redirects. + /// Whether to follow redirects or not. + /// + /// @default `true` pub follow_redirects: Option, - /// Maximum number of redirects to follow. Default is `10`. + /// Maximum number of redirects to follow. /// /// If this number is exceeded, the request will be rejected with an error. + /// + /// @default `10` pub max_redirects: Option, - /// Pass a ToughCookie instance to Impit. + /// Pass a {@link https://github.com/salesforce/tough-cookie | `ToughCookie`} instance to Impit. + /// + /// This `impit` instance will use the provided cookie jar for both storing and retrieving cookies. + /// + /// @default `undefined` (no cookie jar, i.e., cookies are not stored or sent across requests) #[napi( ts_type = "{ setCookie: (cookie: string, url: string, cb?: any) => Promise | void, getCookieString: (url: string) => Promise | string }" )] pub cookie_jar: Option>, /// Additional headers to include in every request made by this Impit instance. + /// + /// Can be an object, a Map, or an array of tuples or an instance of the {@link https://developer.mozilla.org/en-US/docs/Web/API/Headers | Headers} class. + /// + /// @default `undefined` (no additional headers) #[napi(ts_type = "Headers | Record | [string, string][]")] pub headers: Option>, /// Local address to bind the client to. Useful for testing purposes or when you want to bind the client to a specific network interface. /// - /// Can be an IP address in the format "xxx.xxx.xxx.xxx" (for IPv4) or "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" (for IPv6). + /// Can be an IP address in the format `xxx.xxx.xxx.xxx` (for IPv4) or `ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff` (for IPv6). + /// + /// @default `undefined` (the OS will choose the local address) pub local_address: Option, } diff --git a/impit-node/src/lib.rs b/impit-node/src/lib.rs index 401a9245..c0226480 100644 --- a/impit-node/src/lib.rs +++ b/impit-node/src/lib.rs @@ -16,6 +16,19 @@ use self::response::ImpitResponse; use impit_builder::ImpitOptions; use request::{HttpMethod, NodeCookieJar, RequestInit}; +/// The main class of the `impit` package +/// +/// This class is the primary interface for making HTTP requests. +/// It provides methods to configure the Impit instance and to perform requests. +/// +/// @example +/// ```ts +/// import { Impit } from 'impit'; +/// +/// const impit = new Impit(); +/// const response = await impit.fetch('https://example.com'); +/// console.log(await response.text()); +/// ``` #[napi(js_name = "Impit")] pub struct ImpitWrapper { inner: Impit, @@ -23,6 +36,23 @@ pub struct ImpitWrapper { #[napi] impl ImpitWrapper { + /// Creates a new `Impit` instance with the given options. + /// + /// The `options` parameter allows you to customize the behavior of the Impit instance. + /// If no options are provided, default settings will be used. + /// + /// @example + /// ```ts + /// import { Impit } from 'impit'; + /// + /// const impit = new Impit({ + /// timeout: 5e3, // Set a default timeout of 5000 + /// headers: { + /// 'Authorization: 'Bearer ', + /// }, + /// browser: 'chrome', + /// }); + /// ``` #[napi(constructor)] pub fn new(env: &Env, options: Option) -> Result { let config: Result, napi::Error> = @@ -40,6 +70,25 @@ impl ImpitWrapper { #[napi] /// Fetch a URL with the given options. + /// + /// This method performs an HTTP request to the specified URL using the provided options. + /// It returns a promise that resolves to an {@link ImpitResponse} object containing the response data. + /// + /// This method is designed to be API-compatible with the {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch | Fetch API `fetch`} global method. + /// + /// @example + /// ```ts + /// import { Impit } from 'impit'; + /// + /// const impit = new Impit(); + /// const response = await impit.fetch('https://example.com', { + /// method: 'GET', + /// headers: { + /// 'Accept': 'application/json' + /// }, + /// timeout: 5e3, + /// }); + /// ``` pub async fn fetch( &self, url: String, diff --git a/impit-node/src/request.rs b/impit-node/src/request.rs index de7cbbd5..a265b75b 100644 --- a/impit-node/src/request.rs +++ b/impit-node/src/request.rs @@ -28,19 +28,35 @@ pub enum HttpMethod { Options, } +/// Options for configuring an individual HTTP request. +/// +/// These options allow you to customize the behavior of a specific request, including the HTTP method, headers, body, timeout, and whether to force HTTP/3. +/// +/// If no options are provided, default settings will be used. +/// +/// See {@link Impit.fetch} for usage. #[derive(Default)] #[napi(object)] pub struct RequestInit { + /// HTTP method to use for the request. Default is `GET`. + /// + /// Can be one of: `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS`. pub method: Option, + /// Additional headers to include in the request. + /// + /// Can be an object, a Map, or an array of tuples or an instance of the {@link https://developer.mozilla.org/en-US/docs/Web/API/Headers | Headers} class. + /// + /// Note that headers set here will override any default headers set in {@link ImpitOptions.headers}. #[napi(ts_type = "Headers | Record | [string, string][]")] pub headers: Option>, #[napi( ts_type = "string | ArrayBuffer | Uint8Array | DataView | Blob | File | URLSearchParams | FormData | ReadableStream" )] + /// Request body. Can be a string, Buffer, ArrayBuffer, TypedArray, DataView, Blob, File, URLSearchParams, FormData or ReadableStream. pub body: Option, - /// Request timeout in milliseconds. Overrides the Impit-wide timeout option. + /// Request timeout in milliseconds. Overrides the Impit-wide timeout option from {@link ImpitOptions.timeout}. pub timeout: Option, - /// Force the request to use HTTP/3. If the server doesn't expect HTTP/3, the request will fail. + /// Force the request to use HTTP/3. If the server doesn't expect HTTP/3 or the Impit instance doesn't have HTTP/3 enabled (via the {@link ImpitOptions.http3} option), the request will fail. pub force_http3: Option, } diff --git a/impit-node/src/response.rs b/impit-node/src/response.rs index cbdd378d..628efb12 100644 --- a/impit-node/src/response.rs +++ b/impit-node/src/response.rs @@ -26,14 +26,38 @@ impl Headers { } } +/// Represents an HTTP response. +/// +/// The `ImpitResponse` class provides access to the response status, headers, and body. +/// It also includes methods to read the response body in various formats such as text, JSON, +/// ArrayBuffer, and as a stream. +/// +/// This class is designed to be API-compatible with the {@link https://developer.mozilla.org/en-US/docs/Web/API/Response | Fetch API Response} class. +/// +/// @hideconstructor #[napi] pub struct ImpitResponse { inner: RefCell>, + /// HTTP status code of the response. + /// + /// Example: `200` for a successful response. pub status: u16, + /// Status text of the response. + /// + /// A short description of the status code. + /// + /// Example: "OK" for status code 200. pub status_text: String, + /// HTTP headers of the response. + /// + /// An instance of the {@link https://developer.mozilla.org/en-US/docs/Web/API/Headers | Headers} class. #[napi(ts_type = "Headers")] pub headers: Headers, + /// `true` if the response status code is in the range 200-299. pub ok: bool, + /// URL of the response. + /// + /// In case of redirects, this will be the final URL after all redirects have been followed. pub url: String, } @@ -130,6 +154,7 @@ impl<'env> ImpitResponse { })? } + /// @ignore #[napi(ts_return_type = "string")] pub fn decode_buffer(&self, buffer: Buffer) -> Result { let encoding = self @@ -147,6 +172,20 @@ impl<'env> ImpitResponse { Ok(string) } + /// Returns the response body as an `ArrayBuffer`. + /// + /// This method is asynchronous and returns a promise that resolves to an `ArrayBuffer` containing the response body data. + /// + /// @example + /// ```ts + /// const response = await impit.fetch('https://example.com'); + /// const arrayBuffer = await response.arrayBuffer(); + /// + /// console.log(arrayBuffer); // ArrayBuffer([ 0x3c, 0x68, 0x74, 0x6d, 0x6c, ... ]) + /// ``` + /// + /// Note that you cannot call this method multiple times on the same response instance, + /// as the response body can only be consumed once. Subsequent calls will result in an error. #[napi(ts_return_type = "Promise")] pub fn array_buffer(&'env self, env: &'env Env, this: This<'env>) -> Result> { let response = self.get_inner_response(env, this)?; @@ -157,6 +196,20 @@ impl<'env> ImpitResponse { .coerce_to_object() } + /// Returns the response body as a `Uint8Array`. + /// + /// This method is asynchronous and returns a promise that resolves to a `Uint8Array` containing the response body data. + /// + /// @example + /// ```ts + /// const response = await impit.fetch('https://example.com'); + /// const uint8Array = await response.bytes(); + /// + /// console.log(uint8Array); // Uint8Array([ 0x3c, 0x68, 0x74, 0x6d, 0x6c, ... ]) + /// ``` + /// + /// Note that you cannot call this method multiple times on the same response instance, + /// as the response body can only be consumed once. Subsequent calls will result in an error. #[napi(ts_return_type = "Promise")] pub fn bytes(&'env self, env: &'env Env, this: This<'env>) -> Result> { let array_buffer_promise = self.array_buffer(env, this)?; @@ -171,6 +224,17 @@ impl<'env> ImpitResponse { then.apply(Some(&array_buffer_promise), cb) } + /// Returns the response body as a string. + /// + /// This method is asynchronous and returns a promise that resolves to a string containing the response body data. + /// + /// @example + /// ```ts + /// const response = await impit.fetch('https://example.com'); + /// const text = await response.text(); + /// + /// console.log(text); // "..." + /// ``` #[napi(ts_return_type = "Promise")] pub fn text(&'env self, env: &'env Env, this: This<'env>) -> Result> { let response = self.get_inner_response(env, this)?; @@ -180,6 +244,17 @@ impl<'env> ImpitResponse { .apply(response, ()) } + /// Parses the response body as JSON. + /// + /// This method is asynchronous and returns a promise that resolves to the parsed JSON object. + /// + /// @example + /// ```ts + /// const response = await impit.fetch('https://api.example.com/data'); + /// const data = await response.json(); + /// + /// console.log(data); // Parsed JSON object + /// ``` #[napi(ts_return_type = "Promise")] pub fn json(&'env self, env: &'env Env, this: This<'env>) -> Result> { let response = self.get_inner_response(env, this)?; @@ -189,6 +264,20 @@ impl<'env> ImpitResponse { .apply(response, ()) } + /// Returns the response body as a `ReadableStream`. + /// + /// This property provides access to the response body as a stream of data, allowing you to read it in chunks. + /// + /// @example + /// ```ts + /// const response = await impit.fetch('https://example.com'); + /// const reader = response.body.getReader(); + /// + /// let result; + /// while (!(result = await reader.read()).done) { + /// console.log(result.value); // Uint8Array chunk + /// } + /// ``` #[napi( getter, js_name = "body", diff --git a/impit-node/yarn.lock b/impit-node/yarn.lock index dd862283..b0e6c050 100644 --- a/impit-node/yarn.lock +++ b/impit-node/yarn.lock @@ -215,6 +215,19 @@ __metadata: languageName: node linkType: hard +"@gerrit0/mini-shiki@npm:^3.12.0": + version: 3.12.2 + resolution: "@gerrit0/mini-shiki@npm:3.12.2" + dependencies: + "@shikijs/engine-oniguruma": "npm:^3.12.2" + "@shikijs/langs": "npm:^3.12.2" + "@shikijs/themes": "npm:^3.12.2" + "@shikijs/types": "npm:^3.12.2" + "@shikijs/vscode-textmate": "npm:^10.0.2" + checksum: 10c0/01d2318b326f3fbd847cfb214d4afe3ac31587edaa4e7332fd8c6c87b130cb2ec2fa2a4cfc5660b092c928d5e971f9e6c66b613cf4f9f6735131fa309c1a0400 + languageName: node + linkType: hard + "@inquirer/checkbox@npm:^4.2.2": version: 4.2.2 resolution: "@inquirer/checkbox@npm:4.2.2" @@ -1364,6 +1377,51 @@ __metadata: languageName: node linkType: hard +"@shikijs/engine-oniguruma@npm:^3.12.2": + version: 3.12.2 + resolution: "@shikijs/engine-oniguruma@npm:3.12.2" + dependencies: + "@shikijs/types": "npm:3.12.2" + "@shikijs/vscode-textmate": "npm:^10.0.2" + checksum: 10c0/89887dda52949f82537388000b13f9060ae1fcdd87f4b305282b97bdbb1afde0bc4abb8f4f046896164fd8b9c251923f2a4d780fac933fa214ba90fb957a9873 + languageName: node + linkType: hard + +"@shikijs/langs@npm:^3.12.2": + version: 3.12.2 + resolution: "@shikijs/langs@npm:3.12.2" + dependencies: + "@shikijs/types": "npm:3.12.2" + checksum: 10c0/1e72b8efedb5d3959ac4d4fea5a2d5eb7855eea5cddc35e21b5090bf903d40c058214be8c1d63355ad2cffc022be8ec0297bdc6695eddc91c02324dcc417814d + languageName: node + linkType: hard + +"@shikijs/themes@npm:^3.12.2": + version: 3.12.2 + resolution: "@shikijs/themes@npm:3.12.2" + dependencies: + "@shikijs/types": "npm:3.12.2" + checksum: 10c0/728b89554a166dca87aa3a4b53d0aa2c0b2c560252036275b3e8d3b4c790cf8fc980b5e06574e4fbad223627149eff150af12db5acd599fffd71e6ff6391af18 + languageName: node + linkType: hard + +"@shikijs/types@npm:3.12.2, @shikijs/types@npm:^3.12.2": + version: 3.12.2 + resolution: "@shikijs/types@npm:3.12.2" + dependencies: + "@shikijs/vscode-textmate": "npm:^10.0.2" + "@types/hast": "npm:^3.0.4" + checksum: 10c0/74622ac69a84f0d7b66f6f9253bdaa0fee69b7bc97d5f85e12b2a70a9d77d2b04fdbccf65fcd9460449340a214594cb945fee8b3d2c091175e58e8cdf2cb2920 + languageName: node + linkType: hard + +"@shikijs/vscode-textmate@npm:^10.0.2": + version: 10.0.2 + resolution: "@shikijs/vscode-textmate@npm:10.0.2" + checksum: 10c0/36b682d691088ec244de292dc8f91b808f95c89466af421cf84cbab92230f03c8348649c14b3251991b10ce632b0c715e416e992dd5f28ff3221dc2693fd9462 + languageName: node + linkType: hard + "@tybys/wasm-util@npm:^0.10.0": version: 0.10.0 resolution: "@tybys/wasm-util@npm:0.10.0" @@ -1438,6 +1496,15 @@ __metadata: languageName: node linkType: hard +"@types/hast@npm:^3.0.4": + version: 3.0.4 + resolution: "@types/hast@npm:3.0.4" + dependencies: + "@types/unist": "npm:*" + checksum: 10c0/3249781a511b38f1d330fd1e3344eed3c4e7ea8eff82e835d35da78e637480d36fad37a78be5a7aed8465d237ad0446abc1150859d0fde395354ea634decf9f7 + languageName: node + linkType: hard + "@types/http-errors@npm:*": version: 2.0.5 resolution: "@types/http-errors@npm:2.0.5" @@ -1505,6 +1572,13 @@ __metadata: languageName: node linkType: hard +"@types/unist@npm:*": + version: 3.0.3 + resolution: "@types/unist@npm:3.0.3" + checksum: 10c0/2b1e4adcab78388e088fcc3c0ae8700f76619dbcb4741d7d201f87e2cb346bfc29a89003cfea2d76c996e1061452e14fcd737e8b25aacf949c1f2d6b2bc3dd60 + languageName: node + linkType: hard + "@vitest/expect@npm:3.2.4": version: 3.2.4 resolution: "@vitest/expect@npm:3.2.4" @@ -1968,6 +2042,13 @@ __metadata: languageName: node linkType: hard +"entities@npm:^4.4.0": + version: 4.5.0 + resolution: "entities@npm:4.5.0" + checksum: 10c0/5b039739f7621f5d1ad996715e53d964035f75ad3b9a4d38c6b3804bb226e282ffeae2443624d8fdd9c47d8e926ae9ac009c54671243f0c3294c26af7cc85250 + languageName: node + linkType: hard + "env-paths@npm:^2.2.0": version: 2.2.1 resolution: "env-paths@npm:2.2.1" @@ -2494,6 +2575,9 @@ __metadata: impit-win32-x64-msvc: "npm:0.5.4" socks-server-lib: "npm:^0.0.3" tough-cookie: "npm:^6.0.0" + typedoc: "npm:^0.28.13" + typedoc-plugin-mdn-links: "npm:^5.0.9" + typescript: "npm:^5.9.2" vitest: "npm:^3.0.5" dependenciesMeta: impit-darwin-arm64: @@ -2602,6 +2686,15 @@ __metadata: languageName: node linkType: hard +"linkify-it@npm:^5.0.0": + version: 5.0.0 + resolution: "linkify-it@npm:5.0.0" + dependencies: + uc.micro: "npm:^2.0.0" + checksum: 10c0/ff4abbcdfa2003472fc3eb4b8e60905ec97718e11e33cca52059919a4c80cc0e0c2a14d23e23d8c00e5402bc5a885cdba8ca053a11483ab3cc8b3c7a52f88e2d + languageName: node + linkType: hard + "locate-path@npm:^7.2.0": version: 7.2.0 resolution: "locate-path@npm:7.2.0" @@ -2625,6 +2718,13 @@ __metadata: languageName: node linkType: hard +"lunr@npm:^2.3.9": + version: 2.3.9 + resolution: "lunr@npm:2.3.9" + checksum: 10c0/77d7dbb4fbd602aac161e2b50887d8eda28c0fa3b799159cee380fbb311f1e614219126ecbbd2c3a9c685f1720a8109b3c1ca85cc893c39b6c9cc6a62a1d8a8b + languageName: node + linkType: hard + "magic-string@npm:^0.30.17": version: 0.30.19 resolution: "magic-string@npm:0.30.19" @@ -2653,6 +2753,22 @@ __metadata: languageName: node linkType: hard +"markdown-it@npm:^14.1.0": + version: 14.1.0 + resolution: "markdown-it@npm:14.1.0" + dependencies: + argparse: "npm:^2.0.1" + entities: "npm:^4.4.0" + linkify-it: "npm:^5.0.0" + mdurl: "npm:^2.0.0" + punycode.js: "npm:^2.3.1" + uc.micro: "npm:^2.1.0" + bin: + markdown-it: bin/markdown-it.mjs + checksum: 10c0/9a6bb444181d2db7016a4173ae56a95a62c84d4cbfb6916a399b11d3e6581bf1cc2e4e1d07a2f022ae72c25f56db90fbe1e529fca16fbf9541659dc53480d4b4 + languageName: node + linkType: hard + "math-intrinsics@npm:^1.1.0": version: 1.1.0 resolution: "math-intrinsics@npm:1.1.0" @@ -2660,6 +2776,13 @@ __metadata: languageName: node linkType: hard +"mdurl@npm:^2.0.0": + version: 2.0.0 + resolution: "mdurl@npm:2.0.0" + checksum: 10c0/633db522272f75ce4788440669137c77540d74a83e9015666a9557a152c02e245b192edc20bc90ae953bbab727503994a53b236b4d9c99bdaee594d0e7dd2ce0 + languageName: node + linkType: hard + "media-typer@npm:^1.1.0": version: 1.1.0 resolution: "media-typer@npm:1.1.0" @@ -2690,7 +2813,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.4": +"minimatch@npm:^9.0.4, minimatch@npm:^9.0.5": version: 9.0.5 resolution: "minimatch@npm:9.0.5" dependencies: @@ -3006,6 +3129,13 @@ __metadata: languageName: node linkType: hard +"punycode.js@npm:^2.3.1": + version: 2.3.1 + resolution: "punycode.js@npm:2.3.1" + checksum: 10c0/1d12c1c0e06127fa5db56bd7fdf698daf9a78104456a6b67326877afc21feaa821257b171539caedd2f0524027fa38e67b13dd094159c8d70b6d26d2bea4dfdb + languageName: node + linkType: hard + "qs@npm:^6.14.0": version: 6.14.0 resolution: "qs@npm:6.14.0" @@ -3526,6 +3656,59 @@ __metadata: languageName: node linkType: hard +"typedoc-plugin-mdn-links@npm:^5.0.9": + version: 5.0.9 + resolution: "typedoc-plugin-mdn-links@npm:5.0.9" + peerDependencies: + typedoc: 0.27.x || 0.28.x + checksum: 10c0/a1b288da2d5fa3ff5726642c2f41853f1f2c68f88c0a86a44e62dc98cb6a11d187035e23c31be0a4f8b3a23052792aa1b2105010c7299df9b5951f284b219935 + languageName: node + linkType: hard + +"typedoc@npm:^0.28.13": + version: 0.28.13 + resolution: "typedoc@npm:0.28.13" + dependencies: + "@gerrit0/mini-shiki": "npm:^3.12.0" + lunr: "npm:^2.3.9" + markdown-it: "npm:^14.1.0" + minimatch: "npm:^9.0.5" + yaml: "npm:^2.8.1" + peerDependencies: + typescript: 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x || 5.8.x || 5.9.x + bin: + typedoc: bin/typedoc + checksum: 10c0/f4815cb21a62fadbfeb6f5ad6405d3c819b6bcb20bd1e125c5b1a1a7c7bfabbd9dd67d742f767ce95283e99814a361b86bcc632e9ffa595e51e057778def4d57 + languageName: node + linkType: hard + +"typescript@npm:^5.9.2": + version: 5.9.2 + resolution: "typescript@npm:5.9.2" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 10c0/cd635d50f02d6cf98ed42de2f76289701c1ec587a363369255f01ed15aaf22be0813226bff3c53e99d971f9b540e0b3cc7583dbe05faded49b1b0bed2f638a18 + languageName: node + linkType: hard + +"typescript@patch:typescript@npm%3A^5.9.2#optional!builtin": + version: 5.9.2 + resolution: "typescript@patch:typescript@npm%3A5.9.2#optional!builtin::version=5.9.2&hash=5786d5" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 10c0/34d2a8e23eb8e0d1875072064d5e1d9c102e0bdce56a10a25c0b917b8aa9001a9cf5c225df12497e99da107dc379360bc138163c66b55b95f5b105b50578067e + languageName: node + linkType: hard + +"uc.micro@npm:^2.0.0, uc.micro@npm:^2.1.0": + version: 2.1.0 + resolution: "uc.micro@npm:2.1.0" + checksum: 10c0/8862eddb412dda76f15db8ad1c640ccc2f47cdf8252a4a30be908d535602c8d33f9855dfcccb8b8837855c1ce1eaa563f7fa7ebe3c98fd0794351aab9b9c55fa + languageName: node + linkType: hard + "undici-types@npm:~6.21.0": version: 6.21.0 resolution: "undici-types@npm:6.21.0" @@ -3800,6 +3983,15 @@ __metadata: languageName: node linkType: hard +"yaml@npm:^2.8.1": + version: 2.8.1 + resolution: "yaml@npm:2.8.1" + bin: + yaml: bin.mjs + checksum: 10c0/7c587be00d9303d2ae1566e03bc5bc7fe978ba0d9bf39cc418c3139d37929dfcb93a230d9749f2cb578b6aa5d9ebebc322415e4b653cb83acd8bc0bc321707f3 + languageName: node + linkType: hard + "yocto-queue@npm:^1.0.0": version: 1.2.1 resolution: "yocto-queue@npm:1.2.1"