import type { createJiti } from "jiti"; import { loadVirtualModules } from "./loader-host-modules.js"; import type { ExtensionFactory } from "./types.ts"; export { getVirtualModules } from "./loader-host-modules.js"; /** * Persistent on-disk cache for transpiled extension modules. Entries are keyed * by source content and resolved TypeScript siblings, so they self-invalidate * when either changes; stale sibling version dirs are pruned in the background. */ declare function getTranspileCacheDir(): string; /** * Per-extension-path record of the complete file graph a transformed (jiti) * evaluation read, mapping each absolute file path to the SHA256 hex digest of * its content at evaluation time. Persisted under the versioned transpile * cache directory so pruneStaleTranspileCaches handles version cleanup. */ export interface ExtensionGraphManifest { version: 1; extensionPath: string; files: Record; } declare function graphManifestPath(extensionPath: string): string; export declare function readExtensionGraphManifest(extensionPath: string): ExtensionGraphManifest | undefined; declare function loadNativeBuiltinExtensionModule(extensionPath: string, cacheToken: ExtensionCacheToken | undefined): Promise; export interface ExtensionCacheToken { cwd: string; generation: number; } export declare function clearExtensionCache(): void; export declare function useExtensionCacheCwd(cwd: string): ExtensionCacheToken; /** * Locate an installed package's root directory without consulting its * "exports" map: require.resolve("/package.json") throws * ERR_PACKAGE_PATH_NOT_EXPORTED under Node for packages that do not export * "./package.json" (pi-ai does not), and import.meta.resolve() cannot be * used because its mere presence silently disables bytecode generation for * the compiled binary (CJS bundle). Scanning require.resolve.paths() walks * the same node_modules chain Node would, without exports-map encapsulation. */ declare function findPackageRoot(packageName: string, searchPaths?: string[]): string; /** * Get aliases for jiti (used in Node.js/development mode). * In Bun binary mode, virtualModules is used instead. */ declare function getAliases(): Record; /** * A jiti loader that resolves host package specifiers the way extensions see them: `virtualModules` share live host * instances, and outside single-file builds every other host specifier aliases to the installed host files. */ export declare function createHostModuleJiti(id: string, virtualModules: Record, options?: Parameters[1]): Promise>; export declare const extensionLoaderTestHooks: { loadVirtualModules: typeof loadVirtualModules; getAliases: typeof getAliases; findPackageRoot: typeof findPackageRoot; getTranspileCacheDir: typeof getTranspileCacheDir; graphManifestPath: typeof graphManifestPath; readExtensionGraphManifest: typeof readExtensionGraphManifest; loadExtensionModuleTransformed: (extensionPath: string, cacheToken?: ExtensionCacheToken) => Promise; loadTransformedExtensionModule: (extensionPath: string, cacheToken?: ExtensionCacheToken) => Promise; loadNativeBuiltinExtensionModule: typeof loadNativeBuiltinExtensionModule; hasNativeBuiltinFactory: (extensionPath: string) => boolean; }; export declare function loadExtensionModule(extensionPath: string, cacheToken?: ExtensionCacheToken): Promise; //# sourceMappingURL=loader-virtual-modules.d.ts.map