pluginutils.d.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { Node } from 'estree-walker';
  2. export interface AttachedScope {
  3. parent?: AttachedScope;
  4. isBlockScope: boolean;
  5. declarations: { [key: string]: boolean };
  6. addDeclaration(node: Node, isBlockDeclaration: boolean, isVar: boolean): void;
  7. contains(name: string): boolean;
  8. }
  9. export interface DataToEsmOptions {
  10. compact?: boolean;
  11. indent?: string;
  12. namedExports?: boolean;
  13. objectShorthand?: boolean;
  14. preferConst?: boolean;
  15. }
  16. export type AddExtension = (filename: string, ext?: string) => string;
  17. export const addExtension: AddExtension;
  18. export type AttachScopes = (ast: Node, propertyName?: string) => AttachedScope;
  19. export const attachScopes: AttachScopes;
  20. export type CreateFilter = (
  21. include?: Array<string | RegExp> | string | RegExp | null,
  22. exclude?: Array<string | RegExp> | string | RegExp | null,
  23. options?: { resolve?: string | false | null }
  24. ) => (id: string | any) => boolean;
  25. export const createFilter: CreateFilter;
  26. export type MakeLegalIdentifier = (str: string) => string;
  27. export const makeLegalIdentifier: MakeLegalIdentifier;
  28. export type DataToEsm = (data: any, options?: DataToEsmOptions) => string;
  29. export const dataToEsm: DataToEsm;
  30. export type ExtractAssignedNames = (param: Node) => Array<string>;
  31. export const extractAssignedNames: ExtractAssignedNames;