export = ExportHookDescriptor; /** @typedef {import('./package-finder').Metadata} Metadata */ /** * @typedef {Object} HookControls * @property {() => void} rerun */ /** * @template {Object} T * @callback Handler * @param {T} mod * @param {Metadata & HookControls} metadata * @returns {T | null | void} */ /** * @typedef {Object} Descriptor * @property {string} name module name, as passed to `require`, to handle. * @property {string=} file if provided, the file under the module's root that we want to hook. otherwise, the module's `main` will be hooked. * @property {string} version if provided, hooks will only execute against an installed module that matches the semver version range */ /** * Export information and function handlers that should be invoked on require * for a given module. * @template {Object} [T=any] */ declare class ExportHookDescriptor { /** * A static factory function for creating descriptors with different params. * @template {Object} T * @param {Descriptor | string} descriptor export info and handlers * @param {Handler[]=} handlers * @returns {ExportHookDescriptor} */ static create(descriptor: Descriptor | string, handlers?: Handler[] | undefined): ExportHookDescriptor; /** * @param {Descriptor} options * @param {Handler[]} handlers */ constructor({ name, file, version }: Descriptor, handlers: Handler[]); /** @type {string} */ name: string; /** @type {string=} */ file: string | undefined; /** @type {string} */ shortname: string; /** @type {string} */ version: string; /** @type {Handler[]} */ handlers: Handler[]; } declare namespace ExportHookDescriptor { export { Metadata, HookControls, Handler, Descriptor }; } type Metadata = import("./package-finder").Metadata; type HookControls = { rerun: () => void; }; type Handler = (mod: T, metadata: Metadata & HookControls) => T | null | void; type Descriptor = { /** * module name, as passed to `require`, to handle. */ name: string; /** * if provided, the file under the module's root that we want to hook. otherwise, the module's `main` will be hooked. */ file?: string | undefined; /** * if provided, hooks will only execute against an installed module that matches the semver version range */ version: string; }; //# sourceMappingURL=export-hook-descriptor.d.ts.map