@compas/code-gen
Version:
Generate various boring parts of your server
42 lines (41 loc) • 1.09 kB
TypeScript
/**
* Collect and format JS imports. We only support ES module style imports for now.
*/
export class JavascriptImportCollector {
/**
* Resolve and type the import collector for JS files.
*
* @param {import("../file/context.js").GenerateFile}file
* @returns {JavascriptImportCollector}
*/
static getImportCollector(file: import("../file/context.js").GenerateFile, typeImports?: boolean): JavascriptImportCollector;
constructor(isTypeImports?: boolean);
/**
* @private
*/
private isTypeImports;
/**
* @private
* @type {Map<string, Set<string>>}
*/
private destructuredImports;
/**
* @private
* @type {Set<string>}
*/
private rawImports;
/**
* Use a destructure import
*
* @param {string} path
* @param {string} symbol
*/
destructure(path: string, symbol: string): void;
/**
* Add a raw import. These are deduplicated, before writing.
*
* @param {string} importString
*/
raw(importString: string): void;
toString(): string;
}