@visulima/packem
Version:
A fast and modern bundler for Node.js and TypeScript.
36 lines (35 loc) • 1.03 kB
text/typescript
import type { LoggingFunction, SourceMapInput } from "rollup";
/**
* Options for the plugin.
*/
type Options = {
/**
* Rollup's warning function.
*/
warn?: LoggingFunction;
};
/**
* Information about the code being processed.
*/
interface CodeInfo {
/**
* The name of the file.
*/
fileName: string;
/**
* A list of import specifiers in the file.
*/
imports: string[];
}
/**
* Main internal function to transform ES module default exports in .d.ts files to be CJS compatible.
* @param code The code of the chunk.
* @param info Information about the file (name, imports).
* @param options Plugin options, including the warning function.
* @returns An object with the transformed code and a null map, or undefined if no transformation occurs or an error happens.
*/
declare const fixDtsDefaultCJSExports: (code: string, info: CodeInfo, options: Options) => {
code: string;
map: SourceMapInput | undefined;
} | undefined;
export default fixDtsDefaultCJSExports;