UNPKG

1.29 kBTypeScriptView Raw
1import { Node } from 'estree-walker';
2
3export 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
11export interface DataToEsmOptions {
12 compact?: boolean;
13 indent?: string;
14 namedExports?: boolean;
15 objectShorthand?: boolean;
16 preferConst?: boolean;
17}
18
19export type AddExtension = (filename: string, ext?: string) => string;
20export const addExtension: AddExtension;
21
22export type AttachScopes = (ast: Node, propertyName?: string) => AttachedScope;
23export const attachScopes: AttachScopes;
24
25export 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;
30export const createFilter: CreateFilter;
31
32export type MakeLegalIdentifier = (str: string) => string;
33export const makeLegalIdentifier: MakeLegalIdentifier;
34
35export type DataToEsm = (data: any, options?: DataToEsmOptions) => string;
36export const dataToEsm: DataToEsm;
37
38export type ExtractAssignedNames = (param: Node) => Array<string>;
39export const extractAssignedNames: ExtractAssignedNames;