import type { FileSystem } from "../../../platform/compat/fs.js"; import type { EsmDependencyLocation as RouteEsmDependencyLocation } from "../../../transforms/import-rewriter/route-adapter.js"; type SourceReader = Pick; /** Node.js built-in module names — shared across the CJS shim, esbuild externals, and Deno rewrites. */ export declare const NODE_BUILTINS: readonly ["assert", "buffer", "child_process", "cluster", "console", "constants", "crypto", "dgram", "dns", "events", "fs", "http", "http2", "https", "module", "net", "os", "path", "perf_hooks", "process", "querystring", "readline", "stream", "string_decoder", "timers", "tls", "tty", "url", "util", "v8", "vm", "worker_threads", "zlib"]; export declare function readProjectDependencies(projectDir: string, fs: Pick): Promise>; /** * Generates a CJS module loader shim for compiled Deno binaries. * * In compiled binaries, `createRequire()` can resolve module paths and load * built-in modules (fs, path, etc.), but cannot load CJS files from disk * (loadMaybeCjs fails with "path not found"). This shim works around that * limitation by using `Deno.readTextFileSync` to read CJS files and * `new Function` to evaluate them in a proper CJS wrapper with require, * exports, module, __filename, and __dirname bindings. */ export declare function generateCompiledBinaryRequireShim(projectDir: string): string; export declare function getNodeExternalPackagesToResolve(userDeps: Map): string[]; export declare function resolveNodePackageToFileUrl(projectDir: string, packageName: string, fs: SourceReader, pathToFileURL: typeof import("node:url").pathToFileURL): Promise; export type EsmDependencyLocation = RouteEsmDependencyLocation; /** * Identify the subset of user dependencies that are ESM-only and resolve each * to file:// URLs so the compiled-binary loader can import them as real ES * modules instead of transpiling them to CommonJS. CJS dependencies are omitted * and continue to load through the `createRequire`-based shim. */ export declare function resolveEsmUserDependencies(projectDir: string, fs: SourceReader, userDeps: Map): Promise>; export declare function loadVeryfrontExportsMap(projectDir: string, fs: SourceReader): Promise>; export declare function rewriteNodeExternalImports(code: string, projectDir: string, fs: SourceReader, userDeps: Map, options?: { loadRunningPackage?: () => Promise; }): Promise; export declare function rewriteCompiledBinaryVeryfrontImports(code: string): string; export declare function rewriteCompiledBinaryUserDependencyImports(code: string, userDeps: Map, esmDeps?: Map): string; export declare function rewriteDenoNpmDependencyImports(code: string, projectDir: string, fs: SourceReader, userDeps: Map): Promise; export declare function rewriteDenoNodeBuiltinImports(code: string): string; export interface RunningVeryfrontPackage { packageUrl: URL; exports: Record; } export declare function resolveVeryfrontPackageExport(specifier: string, runningPackage: RunningVeryfrontPackage): string; export declare function rewriteDenoVeryfrontImports(code: string): Promise; export declare function rewriteExternalImports(code: string, projectDir: string, fs: SourceReader, userDeps?: Map): Promise; export {}; //# sourceMappingURL=external-import-rewriter.d.ts.map