import UglifyJS from 'uglify-js'; import Module, { ModuleCache, SourceOptions, TranspileOptions } from './module'; import { RawSourceMap } from 'source-map'; import ImportVisitor from './import_visitor'; export default class JsModule extends Module { importVisitor: ImportVisitor; mergeImports(imports: { source: string; pattern?: string; }[]): string[]; matchImport(code: string): void; /** * (partially) handle browserify.transform in package.json * @param {string} fpath * @param {string} code */ browserify(fpath: string, code: string): Promise; /** * parse the module code and construct dependencies. */ parse(): Promise; load(): Promise<{ code: string; map?: RawSourceMap; }>; transpile(options: TranspileOptions): Promise; /** * Find deps of code and compare them with existing `this.deps` to see if there's * new dep to parse. Only the modules of the root packet are checked. */ checkImports({ code, intermediate }: SourceOptions & { intermediate: boolean; }): Promise; minify(): Promise; _minify({ code, map }: TranspileOptions): Promise; _declare(code: string): string; _transform({ code, map, minify }: TranspileOptions): Promise<{ code: string; map: any; }>; _transpile({ code, map }: TranspileOptions): Promise; getMinifyOptions(): Record & { compress: { dead_code: boolean; global_defs: { process: { env: { BROWSER: boolean; NODE_ENV: string | undefined; }; }; }; }; keep_fnames: any; }; uglify({ code, map }: SourceOptions): UglifyJS.MinifyOutput; }