import { NodeService } from "../node/node-service"; import { ExportAssignment, ExportDeclaration, NamedExports, SourceFile, SyntaxKind } from "typescript"; import { IExportService } from "./i-export-service"; import { IPrinter, ITypescriptASTUtil } from "@wessberg/typescript-ast-util"; import { IRemover } from "../../remover/i-remover-base"; import { IUpdater } from "../../updater/i-updater-getter"; import { IDecoratorService } from "../decorator/i-decorator-service"; import { IFormatter } from "../../formatter/i-formatter-getter"; import { IJoiner } from "../../joiner/i-joiner-getter"; import { INamedExportsService } from "../named-exports/i-named-exports-service"; import { INamedImportExportCtor } from "../../light-ast/ctor/named-import-export/i-named-import-export-ctor"; import { ITypescriptLanguageService } from "@wessberg/typescript-language-service"; /** * A service for working with ExportDeclarations */ export declare class ExportService extends NodeService implements IExportService { private readonly namedExportsService; private readonly formatter; private readonly printer; /** * The allowed SyntaxKinds when parsing a SourceFile for relevant Expressions * @type {Iterable} */ protected readonly ALLOWED_KINDS: Iterable; constructor(namedExportsService: INamedExportsService, formatter: IFormatter, printer: IPrinter, updater: IUpdater, joiner: IJoiner, astUtil: ITypescriptASTUtil, decoratorService: IDecoratorService, languageService: ITypescriptLanguageService, remover: IRemover); /** * Returns true if the provided ExportDeclaration exports everything from the module it references * @param {ExportDeclaration} exportDeclaration * @returns {boolean} */ isNamespaceExport(exportDeclaration: ExportDeclaration): boolean; /** * Gets all NamespaceExportDeclarations for the provided SourceFile * @param {SourceFile} sourceFile * @param {boolean} deep * @returns {ExportDeclaration[]} */ getNamespaceExports(sourceFile: SourceFile, deep?: boolean): ExportDeclaration[]; /** * Gets the ExportDeclaration that references the given NamedExport * @param {INamedImportExportCtor | string} namedExport * @param {SourceFile} sourceFile * @param {string} path * @returns {ExportDeclaration} */ getExportWithNamedExport(namedExport: INamedImportExportCtor | string, sourceFile: SourceFile, path?: string): ExportDeclaration | undefined; /** * Gets all the ExportDeclarations that references the provided path * @param {string} path * @param {SourceFile} sourceFile * @returns {ExportDeclaration[]} */ getExportsForPath(path: string, sourceFile: SourceFile): ExportDeclaration[]; /** * Gets the default ExportAssignment of a module (such as export default Foo). * @param {SourceFile} sourceFile * @returns {ExportAssignment | undefined} */ getDefaultExportAssignment(sourceFile: SourceFile): ExportAssignment | undefined; /** * Returns the NamedExports for the provided ExportDeclaration * @param {ExportDeclaration} exportDeclaration * @returns {NamedExports} */ getNamedExportsForExportDeclaration(exportDeclaration: ExportDeclaration): NamedExports | undefined; /** * Gets the exported path for the given ExportDeclaration * @param {ExportDeclaration} exportDeclaration * @returns {string} */ getPathForExportDeclaration(exportDeclaration: ExportDeclaration): string; /** * Returns true if the provided ExportDeclaration has a NamedExport matching the provided one * @param {INamedImportExportCtor | string} namedExport * @param {ExportDeclaration} exportDeclaration * @returns {boolean} */ hasNamedExport(namedExport: INamedImportExportCtor | string, exportDeclaration: ExportDeclaration): boolean; /** * Changes the exported path for the given ExportDeclaration * @param {string} path * @param {ExportDeclaration} exportDeclaration * @returns {ExportDeclaration} */ changePathOfExportDeclaration(path: string, exportDeclaration: ExportDeclaration): ExportDeclaration; /** * Adds the given NamedExport to the given ExportDeclaration * @param {INamedImportExportCtor} namedExport * @param {ExportDeclaration} exportDeclaration * @returns {ExportDeclaration} */ addNamedExportToExportDeclaration(namedExport: INamedImportExportCtor, exportDeclaration: ExportDeclaration): ExportDeclaration; }