UNPKG

7.05 kBTypeScriptView Raw
1declare module "electron-builder-util/out/promise" {
2
3 export function printErrorAndExit(error: Error): void
4
5 export function executeFinally<T>(promise: Promise<T>, task: (errorOccurred: boolean) => Promise<any>): Promise<T>
6
7 export class NestedError extends Error {
8 constructor(errors: Array<Error>, message?: string)
9 }
10
11 export function orNullIfFileNotExist<T>(promise: Promise<T>): Promise<T | null>
12
13 export function orIfFileNotExist<T>(promise: Promise<T>, fallbackValue: T): Promise<T>
14}
15
16declare module "electron-builder-util/out/log" {
17 import BluebirdPromise from "bluebird-lst"
18
19 export function setPrinter(value: ((message: string) => void) | null): void
20
21 export function warn(message: string): void
22
23 export function log(message: string): void
24
25 export function subTask(title: string, promise: BluebirdPromise<any> | Promise<any>): BluebirdPromise<any>
26
27 export function task(title: string, promise: BluebirdPromise<any> | Promise<any>): BluebirdPromise<any>
28}
29
30declare module "electron-builder-util/out/tmp" {
31
32 export class TmpDir {
33 private tempPrefixPromise
34 private tempFiles
35 getTempFile(suffix: string): Promise<string>
36 cleanup(): Promise<any>
37 }
38}
39
40declare module "electron-builder-util" {
41 /// <reference types="node" />
42 import { ChildProcess, SpawnOptions } from "child_process"
43 export { TmpDir } from "electron-builder-util/out/tmp"
44 export { log, warn, task, subTask } from "electron-builder-util/out/log"
45 export { Lazy } from "electron-builder-http"
46 export const debug: debug.Debugger
47 export const debug7z: debug.Debugger
48
49 export interface BaseExecOptions {
50 cwd?: string
51 env?: any
52 stdio?: any
53 }
54
55 export interface ExecOptions extends BaseExecOptions {
56 customFds?: any
57 encoding?: string
58 timeout?: number
59 maxBuffer?: number
60 killSignal?: string
61 }
62
63 export function removePassword(input: string): string
64
65 export function exec(file: string, args?: Array<string> | null, options?: ExecOptions, isLogOutIfDebug?: boolean): Promise<string>
66
67 export interface ExtraSpawnOptions {
68 isDebugEnabled?: boolean
69 isPipeInput?: boolean
70 }
71
72 export function doSpawn(command: string, args: Array<string>, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): ChildProcess
73
74 export function spawn(command: string, args?: Array<string> | null, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise<any>
75
76 export function handleProcess(event: string, childProcess: ChildProcess, command: string, resolve: ((value?: any) => void) | null, reject: (reason?: any) => void): void
77
78 export function use<T, R>(value: T | null, task: (it: T) => R): R | null
79
80 export function debug7zArgs(command: "a" | "x"): Array<string>
81 export let tmpDirCounter: number
82
83 export function getTempName(prefix?: string | null | undefined): string
84
85 export function isEmptyOrSpaces(s: string | null | undefined): s is "" | null | undefined
86
87 export function isTokenCharValid(token: string): boolean
88
89 export function asArray<T>(v: null | undefined | T | Array<T>): Array<T>
90
91 export function getCacheDirectory(): string
92
93 export function smarten(s: string): string
94
95 export function addValue<K, T>(map: Map<K, Array<T>>, key: K, value: T): void
96
97 export function replaceDefault(inList: Array<string> | null | undefined, defaultList: Array<string>): Array<string>
98
99 export function getPlatformIconFileName(value: string | null | undefined, isMac: boolean): string | null | undefined
100
101 export function isPullRequest(): boolean | "" | undefined
102
103 export function safeStringifyJson(data: any, skippedNames?: Set<string>): string
104}
105
106declare module "electron-builder-util/out/fs" {
107 /// <reference types="node" />
108 import { Stats } from "fs-extra-p"
109 export const MAX_FILE_REQUESTS = 8
110 export const CONCURRENCY: {
111 concurrency: number
112 }
113 export type FileTransformer = (path: string) => Promise<null | string | Buffer> | null | string | Buffer
114 export type Filter = (file: string, stat: Stats) => boolean
115
116 export function unlinkIfExists(file: string): Promise<string | void>
117
118 export function statOrNull(file: string): Promise<Stats | null>
119
120 export function exists(file: string): Promise<boolean>
121
122 export interface FileConsumer {
123 consume(file: string, fileStat: Stats, parent: string, siblingNames: Array<string>): any
124 /**
125 * @default false
126 */
127 isIncludeDir?: boolean
128 }
129
130 export function walk(initialDirPath: string, filter?: Filter | null, consumer?: FileConsumer): Promise<Array<string>>
131
132 export function copyFile(src: string, dest: string, isEnsureDir?: boolean): Promise<any>
133
134 /**
135 * Hard links is used if supported and allowed.
136 * File permission is fixedallow execute for all if owner can, allow read for all if owner can.
137 *
138 * ensureDir is not called, dest parent dir must exists
139 */
140 export function copyOrLinkFile(src: string, dest: string, stats?: Stats | null, isUseHardLink?: boolean): Promise<any>
141
142 export class FileCopier {
143 private readonly isUseHardLinkFunction
144 private readonly transformer
145 isUseHardLink: boolean
146 constructor(isUseHardLinkFunction?: ((file: string) => boolean) | undefined, transformer?: FileTransformer | null | undefined)
147 copy(src: string, dest: string, stat: Stats | undefined): Promise<void>
148 }
149
150 /**
151 * Empty directories is never created.
152 * Hard links is used if supported and allowed.
153 */
154 export function copyDir(src: string, destination: string, filter?: Filter | null, transformer?: FileTransformer | null, isUseHardLink?: (file: string) => boolean): Promise<any>
155 export const DO_NOT_USE_HARD_LINKS: (file: string) => boolean
156
157 export interface Link {
158 readonly link: string
159 readonly file: string
160 }
161}
162
163declare module "electron-builder-util/out/nodeHttpExecutor" {
164 /// <reference types="node" />
165 import { CancellationToken, DownloadOptions, HttpExecutor } from "electron-builder-http"
166 import { ClientRequest } from "http"
167 import { RequestOptions } from "https"
168
169 export class NodeHttpExecutor extends HttpExecutor<ClientRequest> {
170 private httpsAgentPromise
171 download(url: string, destination: string, options?: DownloadOptions): Promise<string>
172 doApiRequest<T>(options: RequestOptions, cancellationToken: CancellationToken, requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void, redirectCount?: number): Promise<T>
173 protected doRequest(options: any, callback: (response: any) => void): any
174 }
175 export const httpExecutor: NodeHttpExecutor
176}
177
178declare module "electron-builder-util/out/binDownload" {
179
180 export function getBinFromBintray(name: string, version: string, sha2: string): Promise<string>
181
182 export function getBinFromGithub(name: string, version: string, checksum: string): Promise<string>
183
184 export function getBin(name: string, dirName: string, url: string, checksum: string): Promise<string>
185}
186
187declare module "electron-builder-util/out/deepAssign" {
188
189 export function deepAssign<T>(target: T, ...objects: Array<any>): T
190}
191
192
\No newline at end of file