Debian Codegraph @

legacy/src/pluginutils.d.ts

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