UNPKG

2.31 kBTypeScriptView Raw
1/// <reference types="node" />
2import { EventEmitter } from 'events';
3export declare type ModuleType = 'prod' | 'dev' | 'optional';
4export declare type RebuildMode = 'sequential' | 'parallel';
5export interface RebuildOptions {
6 buildPath: string;
7 electronVersion: string;
8 arch?: string;
9 extraModules?: string[];
10 onlyModules?: string[] | null;
11 force?: boolean;
12 headerURL?: string;
13 types?: ModuleType[];
14 mode?: RebuildMode;
15 debug?: boolean;
16 useCache?: boolean;
17 useElectronClang?: boolean;
18 cachePath?: string;
19 prebuildTagPrefix?: string;
20 projectRootPath?: string;
21 forceABI?: number;
22 disablePreGypCopy?: boolean;
23}
24export declare type HashTree = {
25 [path: string]: string | HashTree;
26};
27export interface RebuilderOptions extends RebuildOptions {
28 lifecycle: EventEmitter;
29}
30export declare enum BuildType {
31 Debug = "Debug",
32 Release = "Release"
33}
34export declare class Rebuilder {
35 private ABIVersion;
36 nodeGypPath: string;
37 prodDeps: Set<string>;
38 rebuilds: (() => Promise<void>)[];
39 realModulePaths: Set<string>;
40 realNodeModulesPaths: Set<string>;
41 lifecycle: EventEmitter;
42 buildPath: string;
43 electronVersion: string;
44 platform: string;
45 arch: string;
46 extraModules: string[];
47 onlyModules: string[] | null;
48 force: boolean;
49 headerURL: string;
50 types: ModuleType[];
51 mode: RebuildMode;
52 debug: boolean;
53 useCache: boolean;
54 cachePath: string;
55 prebuildTagPrefix: string;
56 projectRootPath?: string;
57 msvsVersion?: string;
58 useElectronClang: boolean;
59 disablePreGypCopy: boolean;
60 constructor(options: RebuilderOptions);
61 get ABI(): string;
62 get buildType(): BuildType;
63 rebuild(): Promise<void>;
64 private hashDirectory;
65 private dHashTree;
66 private generateCacheKey;
67 rebuildModuleAt(modulePath: string): Promise<void>;
68 rebuildAllModulesIn(nodeModulesPath: string, prefix?: string): Promise<void>;
69 findModule(moduleName: string, fromDir: string, foundFn: ((p: string) => Promise<void>)): Promise<void[]>;
70 markChildrenAsProdDeps(modulePath: string): Promise<void>;
71}
72export declare type RebuildResult = Promise<void> & {
73 lifecycle: EventEmitter;
74};
75export declare function rebuild(options: RebuildOptions): RebuildResult;
76
\No newline at end of file