UNPKG

@promptbook/utils

Version:

Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action

15 lines (14 loc) • 758 B
/** * Creates a loader which imports one module on the first call and reuses the very same module afterwards * * Note: [🐌] Heavy third-party dependencies are imported lazily to keep the startup of the Promptbook CLI fast. * A statically imported dependency is loaded every single time the bundle is loaded, even when the running * command never touches it. A lazily imported dependency is loaded only when the feature is really used. * * @example * const loadJsdomModule = createLazyModuleLoader(() => import('jsdom')); * const { JSDOM } = await loadJsdomModule(); * * @private internal utility of Promptbook */ export declare function createLazyModuleLoader<TModule>(importModule: () => Promise<TModule>): () => Promise<TModule>;