-
Notifications
You must be signed in to change notification settings - Fork 756
Expand file tree
/
Copy pathinterfaces.ts
More file actions
289 lines (245 loc) · 6.4 KB
/
interfaces.ts
File metadata and controls
289 lines (245 loc) · 6.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
import type { Mirrors } from '@electron/fiddle-core';
export type {
InstallStateEvent,
ProgressObject,
ReleaseInfo,
SemVer,
} from '@electron/fiddle-core';
export type Files = Map<string, string>;
export type FileTransform = (files: Files) => Promise<Files>;
export type FileTransformOperation = 'dotfiles' | 'forge';
export enum VersionSource {
remote = 'remote',
local = 'local',
pullRequest = 'pull-request',
}
export enum GistActionType {
publish = 'Publish',
update = 'Update',
delete = 'Delete',
}
export enum GistActionState {
publishing = 'publishing',
updating = 'updating',
deleting = 'deleting',
none = 'none',
}
export interface Version {
version: string;
name?: string;
localPath?: string;
}
export enum InstallState {
missing = 'missing',
downloading = 'downloading',
downloaded = 'downloaded',
installing = 'installing',
installed = 'installed',
}
export enum RunResult {
SUCCESS = 'success', // exit code === 0
FAILURE = 'failure', // ran, but exit code !== 0
INVALID = 'invalid', // could not run
}
export interface RunnableVersion extends Version {
state: InstallState;
source: VersionSource;
downloadProgress?: number;
}
export const enum ElectronReleaseChannel {
stable = 'Stable',
beta = 'Beta',
nightly = 'Nightly',
}
export interface SetLocalFiddleOptions {
filePath: string;
files: Record<string, string>;
}
export interface SetFiddleOptions {
localFiddle?: SetLocalFiddleOptions;
templateName?: string;
gistId?: string;
}
export interface SetUpMenuOptions {
acceleratorsToBlock?: BlockableAccelerator[] | null;
activeTemplate?: string | null;
}
export interface SetupRequest {
fiddle?: SetFiddleOptions;
version?: string;
showChannels: ElectronReleaseChannel[];
hideChannels: ElectronReleaseChannel[];
useObsolete?: boolean;
}
export interface BisectRequest {
setup: SetupRequest;
goodVersion: string;
badVersion: string;
}
export interface TestRequest {
setup: SetupRequest;
}
export interface OutputEntry {
text: string;
timeString: string;
isNotPre?: boolean;
}
export interface OutputOptions {
bypassBuffer?: boolean;
isNotPre?: boolean;
}
export interface GenericDialogOptions {
type: GenericDialogType;
ok: string;
cancel?: string;
wantsInput: boolean;
defaultInput?: string;
label: string | JSX.Element;
placeholder?: string;
}
export interface Contributor {
url: string;
api: string;
login: string;
avatar: string;
name: string;
bio: string;
location: string;
}
export interface Templates {
[index: string]: string | Templates;
}
export const enum GenericDialogType {
'confirm' = 'confirm',
'warning' = 'warning',
'success' = 'success',
}
export type EditorId = `${string}.${
| 'cjs'
| 'js'
| 'mjs'
| 'html'
| 'css'
| 'json'}`;
export type EditorValues = Record<EditorId, string>;
// main.{cjs,js,mjs} gets special treatment: it is required as the entry point
// when we run fiddles or create a package.json to package fiddles.
export const MAIN_CJS = 'main.cjs';
export const MAIN_JS = 'main.js';
export const MAIN_MJS = 'main.mjs';
export const PACKAGE_NAME = 'package.json';
export type ArrowPosition = 'top' | 'left' | 'bottom' | 'right';
export const enum BlockableAccelerator {
save = 'save',
saveAs = 'saveAs',
}
export interface SelectedLocalVersion {
folderPath: string;
isValidElectron: boolean;
localName?: string;
}
export type FiddleEvent =
| 'before-quit'
| 'bisect-task'
| 'clear-console'
| 'electron-types-changed'
| 'execute-monaco-command'
| 'fiddle-runner-output'
| 'fiddle-stopped'
| 'load-example'
| 'load-gist'
| 'make-fiddle'
| 'new-fiddle'
| 'new-test'
| 'open-fiddle'
| 'open-settings'
| 'open-template'
| 'package-fiddle'
| 'redo-in-editor'
| 'register-local-version'
| 'run-fiddle'
| 'save-fiddle-gist'
| 'saved-local-fiddle'
| 'select-all-in-editor'
| 'set-show-me-template'
| 'show-welcome-tour'
| 'test-task'
| 'toggle-bisect'
| 'toggle-monaco-option'
| 'undo-in-editor'
| 'version-download-progress'
| 'version-state-changed';
export interface MessageOptions {
message: string;
detail?: string;
buttons?: string[];
}
export type IPackageManager = 'npm' | 'yarn';
export interface PMOperationOptions {
dir: string;
packageManager: IPackageManager;
}
export enum GlobalSetting {
acceleratorsToBlock = 'acceleratorsToBlock',
channelsToShow = 'channelsToShow',
electronMirror = 'electronMirror',
environmentVariables = 'environmentVariables',
executionFlags = 'executionFlags',
fontFamily = 'fontFamily',
fontSize = 'fontSize',
gitHubAvatarUrl = 'gitHubAvatarUrl',
gitHubLogin = 'gitHubLogin',
gitHubName = 'gitHubName',
gitHubToken = 'gitHubToken',
hasShownTour = 'hasShownTour',
isClearingConsoleOnRun = 'isClearingConsoleOnRun',
isEnablingElectronLogging = 'isEnablingElectronLogging',
isKeepingUserDataDirs = 'isKeepingUserDataDirs',
isPublishingGistAsRevision = 'isPublishingGistAsRevision',
isUsingSystemTheme = 'isUsingSystemTheme',
knownVersion = 'known-electron-versions',
localVersion = 'local-electron-versions',
packageAuthor = 'packageAuthor',
packageManager = 'packageManager',
showObsoleteVersions = 'showObsoleteVersions',
showUndownloadedVersions = 'showUndownloadedVersions',
theme = 'theme',
}
export enum WindowSpecificSetting {
gitHubPublishAsPublic = 'gitHubPublishAsPublic',
version = 'version',
}
export interface AppStateBroadcastChannel extends BroadcastChannel {
postMessage(params: AppStateBroadcastMessage): void;
}
export type AppStateBroadcastMessage =
| {
type: AppStateBroadcastMessageType.isDownloadingAll;
payload: boolean;
}
| {
type: AppStateBroadcastMessageType.syncVersions;
payload: RunnableVersion[];
};
export enum AppStateBroadcastMessageType {
isDownloadingAll = 'isDownloadingAll',
syncVersions = 'syncVersions',
}
export type NodeTypeDTS = `${string}.d.ts`;
export type NodeTypes = Record<NodeTypeDTS, string>;
export interface PackageJsonOptions {
includeElectron?: boolean;
includeDependencies?: boolean;
}
export interface StartFiddleParams {
localPath: string | undefined;
enableElectronLogging: boolean;
isValidBuild: boolean; // If the localPath is a valid Electron build
version: string; // The user selected version
dir: string;
options: string[];
env: { [x: string]: string | undefined };
}
export interface DownloadVersionParams {
mirror: Mirrors;
}