export interface TransformResult { code: string; isTransformed: boolean; } /** * Rewrite relative `.mjs` require paths to `.js` in CJS output * * When esbuild transforms ESM to CJS, it converts `import './foo.mjs'` to `require('./foo.mjs')`. * Since the packer renames `.mjs` files to `.js` in the snapshot, the require paths must be * updated to match. This handles the rewriting at build time. * * @param code - The CJS code after esbuild transformation * @returns Code with relative .mjs require paths rewritten to .js */ export declare function rewriteMjsRequirePaths(code: string): string; type ExportsValue = any; /** * Make a package.json "exports" value resolvable by require() after pkg's * ESM->CJS transform (#281): `.mjs` targets become `.js` (assumes the file was * transformed), and conditions require() cannot resolve get a `require` * mirroring `import`, unless a later condition already resolves. */ export declare function normalizeExportsForCJS(exportsField: ExportsValue): ExportsValue; /** * Transform ESM code to CommonJS using esbuild * This allows ESM modules to be compiled to bytecode via vm.Script * Uses Babel parser for detecting unsupported ESM features, then esbuild for fast transformation * * @param code - The ESM source code to transform * @param filename - The filename for error reporting * @returns Object with transformed code and success flag */ export declare function transformESMtoCJS(code: string, filename: string): TransformResult; export {}; //# sourceMappingURL=esm-transformer.d.ts.map