@vantail/shared 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.d.ts +334 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +25 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/load.d.ts +36 -0
- package/dist/load.d.ts.map +1 -0
- package/dist/load.js +101 -0
- package/dist/load.js.map +1 -0
- package/dist/protocol.d.ts +81 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +30 -0
- package/dist/protocol.js.map +1 -0
- package/dist/schema.d.ts +236 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +237 -0
- package/dist/schema.js.map +1 -0
- package/package.json +38 -0
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vantail.config.ts` - the whole configuration surface.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately small. Anything that can be derived (output directories, dev
|
|
5
|
+
* server URL, platform triples) is derived rather than configured.
|
|
6
|
+
*/
|
|
7
|
+
export interface AppConfig {
|
|
8
|
+
/** Human-readable name. Used for the window title and the bundle name. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Reverse-DNS bundle identifier, e.g. `dev.wissen.myapp`. */
|
|
11
|
+
identifier: string;
|
|
12
|
+
version?: string;
|
|
13
|
+
/**
|
|
14
|
+
* A square PNG, relative to this config file. Every icon a platform asks
|
|
15
|
+
* for is scaled down from it, so give it at least 256x256 - 1024x1024 if
|
|
16
|
+
* you have it.
|
|
17
|
+
*/
|
|
18
|
+
icon?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface WindowConfig {
|
|
21
|
+
title?: string;
|
|
22
|
+
width?: number;
|
|
23
|
+
height?: number;
|
|
24
|
+
minWidth?: number;
|
|
25
|
+
minHeight?: number;
|
|
26
|
+
maxWidth?: number;
|
|
27
|
+
maxHeight?: number;
|
|
28
|
+
x?: number;
|
|
29
|
+
y?: number;
|
|
30
|
+
resizable?: boolean;
|
|
31
|
+
maximized?: boolean;
|
|
32
|
+
fullscreen?: boolean;
|
|
33
|
+
decorations?: boolean;
|
|
34
|
+
transparent?: boolean;
|
|
35
|
+
alwaysOnTop?: boolean;
|
|
36
|
+
/** Centre on the current monitor unless `x`/`y` are given. Default `true`. */
|
|
37
|
+
center?: boolean;
|
|
38
|
+
visible?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* What the window's own close button does. `close` destroys it (the
|
|
41
|
+
* default), `hide` keeps the webview - and everything it is doing -
|
|
42
|
+
* running, and `ask` leaves it to the application.
|
|
43
|
+
*/
|
|
44
|
+
closeBehavior?: "close" | "hide" | "ask";
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A filesystem scope.
|
|
48
|
+
*
|
|
49
|
+
* `false` denies everything, `true` allows everything, an array is a list of
|
|
50
|
+
* allowed globs, and the object form adds denials that win over allowances.
|
|
51
|
+
*
|
|
52
|
+
* Globs may use `$HOME`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$PICTURE`,
|
|
53
|
+
* `$VIDEO`, `$AUDIO`, `$TEMP`, `$CWD`, `$RESOURCE`, `$APPDATA`,
|
|
54
|
+
* `$APPCONFIG` and `$APPCACHE`.
|
|
55
|
+
*/
|
|
56
|
+
export type PathScope = boolean | string[] | {
|
|
57
|
+
allow?: string[];
|
|
58
|
+
deny?: string[];
|
|
59
|
+
};
|
|
60
|
+
export interface FilesystemPermissions {
|
|
61
|
+
read?: PathScope;
|
|
62
|
+
write?: PathScope;
|
|
63
|
+
/**
|
|
64
|
+
* Treat a path the user picked in a native dialog as granted for the rest
|
|
65
|
+
* of the session. Default `true` - it is what makes a narrow scope usable.
|
|
66
|
+
*/
|
|
67
|
+
grantFromDialog?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* The same for a path dropped on the window. Default `true` - without it the
|
|
70
|
+
* paths a drop reports cannot be opened.
|
|
71
|
+
*/
|
|
72
|
+
grantFromDrop?: boolean;
|
|
73
|
+
}
|
|
74
|
+
export type ClipboardPermissions = boolean | {
|
|
75
|
+
read?: boolean;
|
|
76
|
+
write?: boolean;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* One argument position of an allowed command.
|
|
80
|
+
*
|
|
81
|
+
* A string must match exactly; `{ pattern }` is a glob, where `*` matches
|
|
82
|
+
* anything including `/` because arguments are not paths.
|
|
83
|
+
*/
|
|
84
|
+
export type ArgRule = string | {
|
|
85
|
+
pattern: string;
|
|
86
|
+
};
|
|
87
|
+
export interface ShellRule {
|
|
88
|
+
/**
|
|
89
|
+
* Exactly what the application must ask for: a bare name resolved on PATH,
|
|
90
|
+
* an absolute path, or `$RESOURCE/...` for a sidecar shipped in the bundle.
|
|
91
|
+
*/
|
|
92
|
+
program: string;
|
|
93
|
+
/**
|
|
94
|
+
* One rule per argument position. The number of rules is the number of
|
|
95
|
+
* arguments allowed. Omit to allow any arguments, which for most programs
|
|
96
|
+
* amounts to allowing anything.
|
|
97
|
+
*/
|
|
98
|
+
args?: ArgRule[];
|
|
99
|
+
/** Directories the program may run in. Denied unless set. */
|
|
100
|
+
cwd?: PathScope;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Which hosts the application may reach with `network.request`.
|
|
104
|
+
*
|
|
105
|
+
* Rules take four forms:
|
|
106
|
+
*
|
|
107
|
+
* - `api.example.com` - that host exactly, any scheme, any port.
|
|
108
|
+
* - `*.example.com` - anything strictly beneath it. Not the apex.
|
|
109
|
+
* - `192.168.0.0/16` - any address in that range.
|
|
110
|
+
* - `http://192.168.1.50:9123` - that scheme and host, and that port if given.
|
|
111
|
+
*/
|
|
112
|
+
export interface NetworkPermissions {
|
|
113
|
+
allow?: string[];
|
|
114
|
+
/** Checked first, and wins. */
|
|
115
|
+
deny?: string[];
|
|
116
|
+
/**
|
|
117
|
+
* Hosts whose TLS certificate does not have to be trusted - which is what a
|
|
118
|
+
* smart-home hub needs, since it serves HTTPS with a self-signed one.
|
|
119
|
+
*
|
|
120
|
+
* Separate from `allow` because "may talk to" and "may talk to without
|
|
121
|
+
* checking who is answering" are different decisions.
|
|
122
|
+
*/
|
|
123
|
+
allowInvalidCertificates?: string[];
|
|
124
|
+
}
|
|
125
|
+
export interface ShellPermissions {
|
|
126
|
+
allow?: ShellRule[];
|
|
127
|
+
/**
|
|
128
|
+
* Handing a URL or path to the system's default application. `true` allows
|
|
129
|
+
* anything, which on every platform includes "run this program".
|
|
130
|
+
*/
|
|
131
|
+
open?: boolean | string[];
|
|
132
|
+
}
|
|
133
|
+
export interface PermissionsConfig {
|
|
134
|
+
filesystem?: FilesystemPermissions;
|
|
135
|
+
dialog?: boolean;
|
|
136
|
+
clipboard?: ClipboardPermissions;
|
|
137
|
+
notification?: boolean;
|
|
138
|
+
/** Read-only machine facts. Default `true`. */
|
|
139
|
+
os?: boolean;
|
|
140
|
+
/** Control over the app's own windows. Default `true`. */
|
|
141
|
+
window?: boolean;
|
|
142
|
+
/** Running other programs, and `shell.open`. Default: nothing. */
|
|
143
|
+
shell?: ShellPermissions;
|
|
144
|
+
/** Creating and changing the tray icon. Default `false`. */
|
|
145
|
+
tray?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Claiming key combinations system-wide. Default `false`.
|
|
148
|
+
*
|
|
149
|
+
* A global shortcut fires while other applications are in front, so it is
|
|
150
|
+
* worth granting deliberately.
|
|
151
|
+
*/
|
|
152
|
+
shortcut?: boolean;
|
|
153
|
+
/** Starting the application at login. Default `false`. */
|
|
154
|
+
autostart?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Receiving files dragged onto the window. Default `false`.
|
|
157
|
+
*
|
|
158
|
+
* Turning this on means the runtime handles drops, so the page stops
|
|
159
|
+
* getting HTML5 `drop` events for files and gets paths instead.
|
|
160
|
+
*/
|
|
161
|
+
dragDrop?: boolean;
|
|
162
|
+
/** Setting the application menu. Default `false`. */
|
|
163
|
+
menu?: boolean;
|
|
164
|
+
/** Checking for, downloading and installing updates. Default `false`. */
|
|
165
|
+
updater?: boolean;
|
|
166
|
+
/** HTTP requests made by the runtime rather than the webview. */
|
|
167
|
+
network?: NetworkPermissions;
|
|
168
|
+
/** The OS credential store. Default `false`. */
|
|
169
|
+
secrets?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Service types the application may discover, e.g. `_hub._tcp.local`.
|
|
172
|
+
* `true` allows any, which is a different request from "find me the lights".
|
|
173
|
+
*/
|
|
174
|
+
mdns?: boolean | string[];
|
|
175
|
+
/**
|
|
176
|
+
* USB HID devices the application may open, by what the hardware reports
|
|
177
|
+
* about itself. A name is whatever a device claims; an id is assigned.
|
|
178
|
+
*/
|
|
179
|
+
hid?: boolean | HidRule[];
|
|
180
|
+
}
|
|
181
|
+
export interface HidRule {
|
|
182
|
+
vendorId: number;
|
|
183
|
+
/** Any product from that vendor when omitted. */
|
|
184
|
+
productId?: number;
|
|
185
|
+
/** Narrow further to one HID usage page, e.g. `0xFFA0` for vendor-defined. */
|
|
186
|
+
usagePage?: number;
|
|
187
|
+
}
|
|
188
|
+
/** A menu entry. `type` defaults to `normal` when omitted. */
|
|
189
|
+
export type MenuItem = {
|
|
190
|
+
type?: "normal";
|
|
191
|
+
/** Identifies the item in `menu.click` events and in `menu.setEnabled`. */
|
|
192
|
+
id: string;
|
|
193
|
+
label: string;
|
|
194
|
+
enabled?: boolean;
|
|
195
|
+
/** e.g. `CmdOrCtrl+S`, `Alt+Shift+F4`. */
|
|
196
|
+
accelerator?: string;
|
|
197
|
+
} | {
|
|
198
|
+
type: "checkbox";
|
|
199
|
+
id: string;
|
|
200
|
+
label: string;
|
|
201
|
+
checked?: boolean;
|
|
202
|
+
enabled?: boolean;
|
|
203
|
+
accelerator?: string;
|
|
204
|
+
} | {
|
|
205
|
+
type: "submenu";
|
|
206
|
+
label: string;
|
|
207
|
+
items: MenuItem[];
|
|
208
|
+
enabled?: boolean;
|
|
209
|
+
} | {
|
|
210
|
+
type: "separator";
|
|
211
|
+
} | {
|
|
212
|
+
type: "predefined";
|
|
213
|
+
item: PredefinedMenuItem;
|
|
214
|
+
label?: string;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Platform-provided menu items.
|
|
218
|
+
*
|
|
219
|
+
* On macOS these are not decoration: without `copy`, `paste`, `undo` and
|
|
220
|
+
* `selectAll` present in the menu, their keyboard shortcuts do not work
|
|
221
|
+
* anywhere in the application.
|
|
222
|
+
*/
|
|
223
|
+
export type PredefinedMenuItem = "separator" | "copy" | "cut" | "paste" | "selectAll" | "undo" | "redo" | "minimize" | "maximize" | "fullscreen" | "hide" | "hideOthers" | "showAll" | "closeWindow" | "quit" | "about" | "services" | "bringAllToFront";
|
|
224
|
+
export interface TrayConfig {
|
|
225
|
+
/** PNG path. Relative paths resolve inside the application's resources. */
|
|
226
|
+
icon?: string;
|
|
227
|
+
tooltip?: string;
|
|
228
|
+
/** Text beside the icon. macOS only. */
|
|
229
|
+
title?: string;
|
|
230
|
+
/** Render as a monochrome template so macOS can invert it. Recommended. */
|
|
231
|
+
iconAsTemplate?: boolean;
|
|
232
|
+
menu?: MenuItem[];
|
|
233
|
+
/**
|
|
234
|
+
* What a left click does. A right click always opens the menu.
|
|
235
|
+
*
|
|
236
|
+
* `showWindow` (the default) brings the window back if it is hidden,
|
|
237
|
+
* focuses it if it is behind something, and opens the menu if it is already
|
|
238
|
+
* in front.
|
|
239
|
+
*/
|
|
240
|
+
leftClick?: "showWindow" | "menu" | "event";
|
|
241
|
+
/** Which window `showWindow` brings back. `main` by default. */
|
|
242
|
+
window?: string;
|
|
243
|
+
}
|
|
244
|
+
export interface UpdaterConfig {
|
|
245
|
+
/**
|
|
246
|
+
* URL of the update manifest. `{{target}}`, `{{arch}}` and
|
|
247
|
+
* `{{currentVersion}}` are substituted before the request.
|
|
248
|
+
*/
|
|
249
|
+
endpoint: string;
|
|
250
|
+
/**
|
|
251
|
+
* base64 ed25519 public key, from `vantail updater keygen`. Updates that do
|
|
252
|
+
* not verify against it are refused before anything is extracted.
|
|
253
|
+
*/
|
|
254
|
+
publicKey: string;
|
|
255
|
+
/** Default 30000. */
|
|
256
|
+
timeoutMs?: number;
|
|
257
|
+
}
|
|
258
|
+
export interface VantailConfig {
|
|
259
|
+
app: AppConfig;
|
|
260
|
+
/** The window opened at startup, labelled `main`. */
|
|
261
|
+
window?: WindowConfig;
|
|
262
|
+
permissions?: PermissionsConfig;
|
|
263
|
+
/**
|
|
264
|
+
* The application menu, installed at startup.
|
|
265
|
+
*
|
|
266
|
+
* On macOS, leaving this out installs the standard one - About, Hide, Quit,
|
|
267
|
+
* the Edit items and a Window menu - because without a menu Cmd-W, Cmd-Q,
|
|
268
|
+
* Cmd-C and the rest do nothing at all. Pass `[]` for no menu on purpose.
|
|
269
|
+
*/
|
|
270
|
+
menu?: MenuItem[];
|
|
271
|
+
/** The tray icon, created at startup. */
|
|
272
|
+
tray?: TrayConfig;
|
|
273
|
+
updater?: UpdaterConfig;
|
|
274
|
+
/**
|
|
275
|
+
* Custom URL schemes this application answers to, e.g. `["myapp"]`, so that
|
|
276
|
+
* `myapp://callback` reaches it. Registered with the OS by
|
|
277
|
+
* `vantail package`.
|
|
278
|
+
*
|
|
279
|
+
* Reserved schemes - `http`, `file`, `javascript` and the like - are
|
|
280
|
+
* refused.
|
|
281
|
+
*/
|
|
282
|
+
protocols?: string[];
|
|
283
|
+
/**
|
|
284
|
+
* Refuse to start twice: a second launch hands its arguments to the running
|
|
285
|
+
* application and exits.
|
|
286
|
+
*
|
|
287
|
+
* Defaults to on when `protocols` is set, because on Windows and Linux that
|
|
288
|
+
* is how a deep link reaches an application that is already running.
|
|
289
|
+
*/
|
|
290
|
+
singleInstance?: boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Quit once every window is closed. Default `true`. Set it to `false` for
|
|
293
|
+
* an application that lives in the tray and has no window most of the time.
|
|
294
|
+
*/
|
|
295
|
+
quitOnLastWindowClosed?: boolean;
|
|
296
|
+
/** Directory of built web assets, relative to the config file. Default `dist`. */
|
|
297
|
+
distDir?: string;
|
|
298
|
+
/** Force the webview inspector on or off. Defaults to on in `vantail dev`. */
|
|
299
|
+
devtools?: boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Where `vantail package` writes bundles. Default {@link DEFAULT_OUT_DIR}.
|
|
302
|
+
*
|
|
303
|
+
* Visible on purpose: this holds the application someone is meant to find
|
|
304
|
+
* and open. Vantail's own scratch - the generated dev config, the updater
|
|
305
|
+
* signing key - stays in `.vantail`.
|
|
306
|
+
*/
|
|
307
|
+
outDir?: string;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* The shape the runtime actually reads. `vantail dev` and `vantail package`
|
|
311
|
+
* generate this; nobody writes it by hand.
|
|
312
|
+
*/
|
|
313
|
+
export interface RuntimeConfig extends Omit<VantailConfig, "outDir"> {
|
|
314
|
+
dev?: {
|
|
315
|
+
url: string;
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Identity function that exists purely so editors can type-check and complete
|
|
320
|
+
* `vantail.config.ts`.
|
|
321
|
+
*/
|
|
322
|
+
export declare function defineConfig(config: VantailConfig): VantailConfig;
|
|
323
|
+
/**
|
|
324
|
+
* Where a packaged application lands.
|
|
325
|
+
*
|
|
326
|
+
* Not a dot-directory: Finder hides those, and the whole point of this folder
|
|
327
|
+
* is that someone can open it and double-click what is inside. `.vantail` is
|
|
328
|
+
* for what Vantail needs and nobody else does - the generated dev config, the
|
|
329
|
+
* updater signing key.
|
|
330
|
+
*/
|
|
331
|
+
export declare const DEFAULT_OUT_DIR = "build";
|
|
332
|
+
/** Where Vantail keeps its own working files, which are nobody else's business. */
|
|
333
|
+
export declare const INTERNAL_DIR = ".vantail";
|
|
334
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.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ACH,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;IAClB,yCAAyC;IACzC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC;IAClE,GAAG,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAEjE;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,UAAU,CAAC;AAEvC,mFAAmF;AACnF,eAAO,MAAM,YAAY,aAAa,CAAC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vantail.config.ts` - the whole configuration surface.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately small. Anything that can be derived (output directories, dev
|
|
5
|
+
* server URL, platform triples) is derived rather than configured.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Identity function that exists purely so editors can type-check and complete
|
|
9
|
+
* `vantail.config.ts`.
|
|
10
|
+
*/
|
|
11
|
+
export function defineConfig(config) {
|
|
12
|
+
return config;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Where a packaged application lands.
|
|
16
|
+
*
|
|
17
|
+
* Not a dot-directory: Finder hides those, and the whole point of this folder
|
|
18
|
+
* is that someone can open it and double-click what is inside. `.vantail` is
|
|
19
|
+
* for what Vantail needs and nobody else does - the generated dev config, the
|
|
20
|
+
* updater signing key.
|
|
21
|
+
*/
|
|
22
|
+
export const DEFAULT_OUT_DIR = "build";
|
|
23
|
+
/** Where Vantail keeps its own working files, which are nobody else's business. */
|
|
24
|
+
export const INTERNAL_DIR = ".vantail";
|
|
25
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiVH;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAqB;IAChD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC;AAEvC,mFAAmF;AACnF,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
|
package/dist/load.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loading `vantail.config.ts`.
|
|
3
|
+
*
|
|
4
|
+
* Node can run TypeScript directly these days, but only the subset it can
|
|
5
|
+
* strip types from - and a config that imports from a workspace package still
|
|
6
|
+
* has to resolve. So the config is bundled first, with everything that is not
|
|
7
|
+
* a relative import left external, and the result imported once.
|
|
8
|
+
*
|
|
9
|
+
* The temporary bundle is written next to the config file so that Node
|
|
10
|
+
* resolves those externals from the project's own `node_modules`.
|
|
11
|
+
*/
|
|
12
|
+
import type { VantailConfig } from "./config.js";
|
|
13
|
+
import { type ParsedConfig } from "./schema.js";
|
|
14
|
+
/** Accepted config file names, in the order they are looked for. */
|
|
15
|
+
export declare const CONFIG_FILE_NAMES: readonly ["vantail.config.ts", "vantail.config.mts", "vantail.config.js", "vantail.config.mjs"];
|
|
16
|
+
export interface LoadedProjectConfig {
|
|
17
|
+
config: ParsedConfig;
|
|
18
|
+
/** Absolute path to the config file. */
|
|
19
|
+
path: string;
|
|
20
|
+
/** Directory the config lives in - the project root. */
|
|
21
|
+
root: string;
|
|
22
|
+
}
|
|
23
|
+
export declare class ConfigError extends Error {
|
|
24
|
+
readonly problems: string[];
|
|
25
|
+
constructor(message: string, problems?: string[]);
|
|
26
|
+
}
|
|
27
|
+
/** Find a config file at or above `from`. */
|
|
28
|
+
export declare function findConfigFile(from: string): string | undefined;
|
|
29
|
+
export declare function loadConfig(options: {
|
|
30
|
+
cwd?: string;
|
|
31
|
+
/** An explicit `--config` path. Skips the search. */
|
|
32
|
+
path?: string;
|
|
33
|
+
}): Promise<LoadedProjectConfig>;
|
|
34
|
+
/** Re-exported so callers get the input type without a second import. */
|
|
35
|
+
export type { VantailConfig, ParsedConfig };
|
|
36
|
+
//# sourceMappingURL=load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAE7D,oEAAoE;AACpE,eAAO,MAAM,iBAAiB,YAC5B,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,CACZ,CAAC;AAEX,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,YAAY,CAAC;IACrB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAE5B,YAAY,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,EAAO,EAQnD;CACF;AAED,6CAA6C;AAC7C,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAW/D;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA8B/B;AAqCD,yEAAyE;AACzE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/load.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loading `vantail.config.ts`.
|
|
3
|
+
*
|
|
4
|
+
* Node can run TypeScript directly these days, but only the subset it can
|
|
5
|
+
* strip types from - and a config that imports from a workspace package still
|
|
6
|
+
* has to resolve. So the config is bundled first, with everything that is not
|
|
7
|
+
* a relative import left external, and the result imported once.
|
|
8
|
+
*
|
|
9
|
+
* The temporary bundle is written next to the config file so that Node
|
|
10
|
+
* resolves those externals from the project's own `node_modules`.
|
|
11
|
+
*/
|
|
12
|
+
import { rm, writeFile } from "node:fs/promises";
|
|
13
|
+
import { existsSync } from "node:fs";
|
|
14
|
+
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
15
|
+
import { pathToFileURL } from "node:url";
|
|
16
|
+
import { build } from "esbuild";
|
|
17
|
+
import { parseConfig } from "./schema.js";
|
|
18
|
+
/** Accepted config file names, in the order they are looked for. */
|
|
19
|
+
export const CONFIG_FILE_NAMES = [
|
|
20
|
+
"vantail.config.ts",
|
|
21
|
+
"vantail.config.mts",
|
|
22
|
+
"vantail.config.js",
|
|
23
|
+
"vantail.config.mjs",
|
|
24
|
+
];
|
|
25
|
+
export class ConfigError extends Error {
|
|
26
|
+
problems;
|
|
27
|
+
constructor(message, problems = []) {
|
|
28
|
+
super(problems.length
|
|
29
|
+
? `${message}\n${problems.map((p) => ` - ${p}`).join("\n")}`
|
|
30
|
+
: message);
|
|
31
|
+
this.name = "ConfigError";
|
|
32
|
+
this.problems = problems;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Find a config file at or above `from`. */
|
|
36
|
+
export function findConfigFile(from) {
|
|
37
|
+
let current = resolve(from);
|
|
38
|
+
while (true) {
|
|
39
|
+
for (const name of CONFIG_FILE_NAMES) {
|
|
40
|
+
const candidate = join(current, name);
|
|
41
|
+
if (existsSync(candidate))
|
|
42
|
+
return candidate;
|
|
43
|
+
}
|
|
44
|
+
const parent = dirname(current);
|
|
45
|
+
if (parent === current)
|
|
46
|
+
return undefined;
|
|
47
|
+
current = parent;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export async function loadConfig(options) {
|
|
51
|
+
const cwd = options.cwd ?? process.cwd();
|
|
52
|
+
const path = options.path
|
|
53
|
+
? isAbsolute(options.path)
|
|
54
|
+
? options.path
|
|
55
|
+
: resolve(cwd, options.path)
|
|
56
|
+
: findConfigFile(cwd);
|
|
57
|
+
if (!path) {
|
|
58
|
+
throw new ConfigError(`No ${CONFIG_FILE_NAMES[0]} found in ${cwd} or any parent directory.\n` +
|
|
59
|
+
`Create one, or run \`vantail\` from inside a Vantail project.`);
|
|
60
|
+
}
|
|
61
|
+
if (!existsSync(path)) {
|
|
62
|
+
throw new ConfigError(`Config file not found: ${path}`);
|
|
63
|
+
}
|
|
64
|
+
const exported = await importConfigModule(path);
|
|
65
|
+
const value = exported.default ?? exported;
|
|
66
|
+
const parsed = parseConfig(value);
|
|
67
|
+
if (!parsed.ok) {
|
|
68
|
+
throw new ConfigError(`Invalid config in ${basename(path)}:`, parsed.problems);
|
|
69
|
+
}
|
|
70
|
+
return { config: parsed.config, path, root: dirname(path) };
|
|
71
|
+
}
|
|
72
|
+
async function importConfigModule(path) {
|
|
73
|
+
const bundled = await build({
|
|
74
|
+
entryPoints: [path],
|
|
75
|
+
bundle: true,
|
|
76
|
+
write: false,
|
|
77
|
+
platform: "node",
|
|
78
|
+
format: "esm",
|
|
79
|
+
target: `node${process.versions.node.split(".")[0]}`,
|
|
80
|
+
// Only inline the project's own files. Package imports stay external so
|
|
81
|
+
// that `defineConfig` does not drag a bundler's worth of code in with it.
|
|
82
|
+
packages: "external",
|
|
83
|
+
sourcemap: false,
|
|
84
|
+
logLevel: "silent",
|
|
85
|
+
});
|
|
86
|
+
const code = bundled.outputFiles?.[0]?.text;
|
|
87
|
+
if (code === undefined) {
|
|
88
|
+
throw new ConfigError(`Could not bundle ${path}`);
|
|
89
|
+
}
|
|
90
|
+
// Unique name so repeated loads (a dev-server restart) are not served from
|
|
91
|
+
// Node's module cache.
|
|
92
|
+
const temporary = join(dirname(path), `.vantail.config.${process.pid}.${Date.now().toString(36)}.mjs`);
|
|
93
|
+
try {
|
|
94
|
+
await writeFile(temporary, code, "utf8");
|
|
95
|
+
return await import(pathToFileURL(temporary).href);
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
await rm(temporary, { force: true });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=load.js.map
|
package/dist/load.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IA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C,IAAI,CAAC;QACnB,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;QACpD,wEAAwE;QACxE,0EAA0E;QAC1E,QAAQ,EAAE,UAAU;QACpB,SAAS,EAAE,KAAK;QAChB,QAAQ,EAAE,QAAQ;KACnB,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;IAC5C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,WAAW,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,2EAA2E;IAC3E,uBAAuB;IACvB,MAAM,SAAS,GAAG,IAAI,CACpB,OAAO,CAAC,IAAI,CAAC,EACb,mBAAmB,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAChE,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACzC,OAAO,MAAM,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire protocol between a Vantail application and its native runtime.
|
|
3
|
+
*
|
|
4
|
+
* One request, one response, matched by `id`. Nothing else crosses the
|
|
5
|
+
* boundary: no handles, no callbacks, no shared memory. Keeping it this
|
|
6
|
+
* boring is what lets the SDK be a thin wrapper and the runtime a plain
|
|
7
|
+
* `match` statement.
|
|
8
|
+
*/
|
|
9
|
+
/** A call from JavaScript into the runtime. */
|
|
10
|
+
export interface VantailRequest {
|
|
11
|
+
id: string;
|
|
12
|
+
/** Namespaced method name, e.g. `filesystem.readText`. */
|
|
13
|
+
method: string;
|
|
14
|
+
params?: unknown;
|
|
15
|
+
}
|
|
16
|
+
/** The error half of a response. `code` is stable and safe to branch on. */
|
|
17
|
+
export interface VantailErrorPayload {
|
|
18
|
+
code: string;
|
|
19
|
+
message: string;
|
|
20
|
+
data?: unknown;
|
|
21
|
+
}
|
|
22
|
+
export interface VantailResponse {
|
|
23
|
+
id: string;
|
|
24
|
+
result?: unknown;
|
|
25
|
+
error?: VantailErrorPayload;
|
|
26
|
+
}
|
|
27
|
+
/** An unsolicited push from the runtime, e.g. the window was resized. */
|
|
28
|
+
export interface VantailEventMessage {
|
|
29
|
+
event: string;
|
|
30
|
+
payload: unknown;
|
|
31
|
+
}
|
|
32
|
+
export type VantailIncoming = VantailResponse | VantailEventMessage;
|
|
33
|
+
export declare function isEventMessage(message: VantailIncoming): message is VantailEventMessage;
|
|
34
|
+
/**
|
|
35
|
+
* Error codes the runtime can return.
|
|
36
|
+
*
|
|
37
|
+
* `NO_RUNTIME` is the one code produced by the SDK itself: it means the page
|
|
38
|
+
* is running in a plain browser, with no runtime on the other end.
|
|
39
|
+
*/
|
|
40
|
+
export declare const ErrorCode: {
|
|
41
|
+
readonly NO_RUNTIME: "NO_RUNTIME";
|
|
42
|
+
readonly UNKNOWN_METHOD: "UNKNOWN_METHOD";
|
|
43
|
+
readonly INVALID_PARAMS: "INVALID_PARAMS";
|
|
44
|
+
readonly PERMISSION_DENIED: "PERMISSION_DENIED";
|
|
45
|
+
readonly NOT_FOUND: "NOT_FOUND";
|
|
46
|
+
readonly ALREADY_EXISTS: "ALREADY_EXISTS";
|
|
47
|
+
readonly IO_ERROR: "IO_ERROR";
|
|
48
|
+
readonly INVALID_UTF8: "INVALID_UTF8";
|
|
49
|
+
readonly UNSUPPORTED: "UNSUPPORTED";
|
|
50
|
+
readonly INTERNAL: "INTERNAL";
|
|
51
|
+
};
|
|
52
|
+
export type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
|
|
53
|
+
/**
|
|
54
|
+
* The object the runtime injects before any page script runs.
|
|
55
|
+
*
|
|
56
|
+
* It is a pipe and nothing more - promises, typed methods and event
|
|
57
|
+
* subscriptions are all built on top of it in `@vantail/api`, so the
|
|
58
|
+
* protocol can grow without shipping a new runtime.
|
|
59
|
+
*/
|
|
60
|
+
export interface VantailBridge {
|
|
61
|
+
/** Version of the native runtime that injected this bridge. */
|
|
62
|
+
version: string;
|
|
63
|
+
/** Static application facts, available without a round trip. */
|
|
64
|
+
app: {
|
|
65
|
+
name: string;
|
|
66
|
+
version: string;
|
|
67
|
+
identifier: string;
|
|
68
|
+
isDev: boolean;
|
|
69
|
+
platform: string;
|
|
70
|
+
arch: string;
|
|
71
|
+
};
|
|
72
|
+
postMessage(message: VantailRequest): void;
|
|
73
|
+
/** Returns an unsubscribe function. */
|
|
74
|
+
subscribe(listener: (message: VantailIncoming) => void): () => void;
|
|
75
|
+
}
|
|
76
|
+
declare global {
|
|
77
|
+
interface Window {
|
|
78
|
+
__VANTAIL__?: VantailBridge;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,+CAA+C;AAC/C,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IAC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,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACrE;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,WAAW,CAAC,EAAE,aAAa,CAAC;KAC7B;CACF"}
|
package/dist/protocol.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire protocol between a Vantail application and its native runtime.
|
|
3
|
+
*
|
|
4
|
+
* One request, one response, matched by `id`. Nothing else crosses the
|
|
5
|
+
* boundary: no handles, no callbacks, no shared memory. Keeping it this
|
|
6
|
+
* boring is what lets the SDK be a thin wrapper and the runtime a plain
|
|
7
|
+
* `match` statement.
|
|
8
|
+
*/
|
|
9
|
+
export function isEventMessage(message) {
|
|
10
|
+
return typeof message.event === "string";
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Error codes the runtime can return.
|
|
14
|
+
*
|
|
15
|
+
* `NO_RUNTIME` is the one code produced by the SDK itself: it means the page
|
|
16
|
+
* is running in a plain browser, with no runtime on the other end.
|
|
17
|
+
*/
|
|
18
|
+
export const ErrorCode = {
|
|
19
|
+
NO_RUNTIME: "NO_RUNTIME",
|
|
20
|
+
UNKNOWN_METHOD: "UNKNOWN_METHOD",
|
|
21
|
+
INVALID_PARAMS: "INVALID_PARAMS",
|
|
22
|
+
PERMISSION_DENIED: "PERMISSION_DENIED",
|
|
23
|
+
NOT_FOUND: "NOT_FOUND",
|
|
24
|
+
ALREADY_EXISTS: "ALREADY_EXISTS",
|
|
25
|
+
IO_ERROR: "IO_ERROR",
|
|
26
|
+
INVALID_UTF8: "INVALID_UTF8",
|
|
27
|
+
UNSUPPORTED: "UNSUPPORTED",
|
|
28
|
+
INTERNAL: "INTERNAL",
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA+BH,MAAM,UAAU,cAAc,CAC5B,OAAwB;IAExB,OAAO,OAAQ,OAA+B,CAAC,KAAK,KAAK,QAAQ,CAAC;AACpE,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,UAAU,EAAE,YAAY;IACxB,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,SAAS,EAAE,WAAW;IACtB,cAAc,EAAE,gBAAgB;IAChC,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;IAC5B,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,UAAU;CACZ,CAAC"}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime validation for `vantail.config.ts`.
|
|
3
|
+
*
|
|
4
|
+
* Kept in its own entry point so `@vantail/api` - which ships to the browser
|
|
5
|
+
* - never pulls Zod into an application bundle.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
export declare const appSchema: z.ZodObject<{
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
identifier: z.ZodString;
|
|
11
|
+
version: z.ZodOptional<z.ZodString>;
|
|
12
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
export declare const windowSchema: z.ZodObject<{
|
|
15
|
+
title: z.ZodOptional<z.ZodString>;
|
|
16
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
minWidth: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
minHeight: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
maxWidth: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
maxHeight: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
x: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
y: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
resizable: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
maximized: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
fullscreen: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
decorations: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
transparent: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
alwaysOnTop: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
center: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
visible: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
+
closeBehavior: z.ZodOptional<z.ZodEnum<{
|
|
33
|
+
ask: "ask";
|
|
34
|
+
close: "close";
|
|
35
|
+
hide: "hide";
|
|
36
|
+
}>>;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
/**
|
|
39
|
+
* Menus nest, so the schema does too. Zod needs the explicit annotation
|
|
40
|
+
* because a recursive type cannot be inferred from its own definition.
|
|
41
|
+
*/
|
|
42
|
+
export declare const menuItemSchema: z.ZodType<unknown>;
|
|
43
|
+
export declare const traySchema: z.ZodObject<{
|
|
44
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
45
|
+
tooltip: z.ZodOptional<z.ZodString>;
|
|
46
|
+
title: z.ZodOptional<z.ZodString>;
|
|
47
|
+
iconAsTemplate: z.ZodOptional<z.ZodBoolean>;
|
|
48
|
+
menu: z.ZodOptional<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
49
|
+
leftClick: z.ZodOptional<z.ZodEnum<{
|
|
50
|
+
event: "event";
|
|
51
|
+
menu: "menu";
|
|
52
|
+
showWindow: "showWindow";
|
|
53
|
+
}>>;
|
|
54
|
+
window: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
export declare const updaterSchema: z.ZodObject<{
|
|
57
|
+
endpoint: z.ZodString;
|
|
58
|
+
publicKey: z.ZodString;
|
|
59
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
export declare const permissionsSchema: z.ZodObject<{
|
|
62
|
+
filesystem: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
read: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodObject<{
|
|
64
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
65
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
66
|
+
}, z.core.$strict>]>>;
|
|
67
|
+
write: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodObject<{
|
|
68
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
69
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
|
+
}, z.core.$strict>]>>;
|
|
71
|
+
grantFromDialog: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
+
grantFromDrop: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
}, z.core.$strict>>;
|
|
74
|
+
dialog: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
clipboard: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
76
|
+
read: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
write: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
}, z.core.$strict>]>>;
|
|
79
|
+
notification: z.ZodOptional<z.ZodBoolean>;
|
|
80
|
+
os: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
+
window: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
shell: z.ZodOptional<z.ZodObject<{
|
|
83
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
84
|
+
program: z.ZodString;
|
|
85
|
+
args: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
86
|
+
pattern: z.ZodString;
|
|
87
|
+
}, z.core.$strict>]>>>;
|
|
88
|
+
cwd: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodObject<{
|
|
89
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
90
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
91
|
+
}, z.core.$strict>]>>;
|
|
92
|
+
}, z.core.$strict>>>;
|
|
93
|
+
open: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
|
|
94
|
+
}, z.core.$strict>>;
|
|
95
|
+
tray: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
shortcut: z.ZodOptional<z.ZodBoolean>;
|
|
97
|
+
dragDrop: z.ZodOptional<z.ZodBoolean>;
|
|
98
|
+
autostart: z.ZodOptional<z.ZodBoolean>;
|
|
99
|
+
menu: z.ZodOptional<z.ZodBoolean>;
|
|
100
|
+
updater: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
network: z.ZodOptional<z.ZodObject<{
|
|
102
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
103
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
104
|
+
allowInvalidCertificates: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
105
|
+
}, z.core.$strict>>;
|
|
106
|
+
secrets: z.ZodOptional<z.ZodBoolean>;
|
|
107
|
+
mdns: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
|
|
108
|
+
hid: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodObject<{
|
|
109
|
+
vendorId: z.ZodNumber;
|
|
110
|
+
productId: z.ZodOptional<z.ZodNumber>;
|
|
111
|
+
usagePage: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
}, z.core.$strict>>]>>;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
export declare const configSchema: z.ZodObject<{
|
|
115
|
+
app: z.ZodObject<{
|
|
116
|
+
name: z.ZodString;
|
|
117
|
+
identifier: z.ZodString;
|
|
118
|
+
version: z.ZodOptional<z.ZodString>;
|
|
119
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
120
|
+
}, z.core.$strict>;
|
|
121
|
+
window: z.ZodOptional<z.ZodObject<{
|
|
122
|
+
title: z.ZodOptional<z.ZodString>;
|
|
123
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
124
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
minWidth: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
minHeight: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
maxWidth: z.ZodOptional<z.ZodNumber>;
|
|
128
|
+
maxHeight: z.ZodOptional<z.ZodNumber>;
|
|
129
|
+
x: z.ZodOptional<z.ZodNumber>;
|
|
130
|
+
y: z.ZodOptional<z.ZodNumber>;
|
|
131
|
+
resizable: z.ZodOptional<z.ZodBoolean>;
|
|
132
|
+
maximized: z.ZodOptional<z.ZodBoolean>;
|
|
133
|
+
fullscreen: z.ZodOptional<z.ZodBoolean>;
|
|
134
|
+
decorations: z.ZodOptional<z.ZodBoolean>;
|
|
135
|
+
transparent: z.ZodOptional<z.ZodBoolean>;
|
|
136
|
+
alwaysOnTop: z.ZodOptional<z.ZodBoolean>;
|
|
137
|
+
center: z.ZodOptional<z.ZodBoolean>;
|
|
138
|
+
visible: z.ZodOptional<z.ZodBoolean>;
|
|
139
|
+
closeBehavior: z.ZodOptional<z.ZodEnum<{
|
|
140
|
+
ask: "ask";
|
|
141
|
+
close: "close";
|
|
142
|
+
hide: "hide";
|
|
143
|
+
}>>;
|
|
144
|
+
}, z.core.$strict>>;
|
|
145
|
+
permissions: z.ZodOptional<z.ZodObject<{
|
|
146
|
+
filesystem: z.ZodOptional<z.ZodObject<{
|
|
147
|
+
read: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodObject<{
|
|
148
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
149
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
150
|
+
}, z.core.$strict>]>>;
|
|
151
|
+
write: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodObject<{
|
|
152
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
153
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
154
|
+
}, z.core.$strict>]>>;
|
|
155
|
+
grantFromDialog: z.ZodOptional<z.ZodBoolean>;
|
|
156
|
+
grantFromDrop: z.ZodOptional<z.ZodBoolean>;
|
|
157
|
+
}, z.core.$strict>>;
|
|
158
|
+
dialog: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
+
clipboard: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
160
|
+
read: z.ZodOptional<z.ZodBoolean>;
|
|
161
|
+
write: z.ZodOptional<z.ZodBoolean>;
|
|
162
|
+
}, z.core.$strict>]>>;
|
|
163
|
+
notification: z.ZodOptional<z.ZodBoolean>;
|
|
164
|
+
os: z.ZodOptional<z.ZodBoolean>;
|
|
165
|
+
window: z.ZodOptional<z.ZodBoolean>;
|
|
166
|
+
shell: z.ZodOptional<z.ZodObject<{
|
|
167
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
168
|
+
program: z.ZodString;
|
|
169
|
+
args: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
170
|
+
pattern: z.ZodString;
|
|
171
|
+
}, z.core.$strict>]>>>;
|
|
172
|
+
cwd: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodObject<{
|
|
173
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
174
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
175
|
+
}, z.core.$strict>]>>;
|
|
176
|
+
}, z.core.$strict>>>;
|
|
177
|
+
open: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
|
|
178
|
+
}, z.core.$strict>>;
|
|
179
|
+
tray: z.ZodOptional<z.ZodBoolean>;
|
|
180
|
+
shortcut: z.ZodOptional<z.ZodBoolean>;
|
|
181
|
+
dragDrop: z.ZodOptional<z.ZodBoolean>;
|
|
182
|
+
autostart: z.ZodOptional<z.ZodBoolean>;
|
|
183
|
+
menu: z.ZodOptional<z.ZodBoolean>;
|
|
184
|
+
updater: z.ZodOptional<z.ZodBoolean>;
|
|
185
|
+
network: z.ZodOptional<z.ZodObject<{
|
|
186
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
187
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
188
|
+
allowInvalidCertificates: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
189
|
+
}, z.core.$strict>>;
|
|
190
|
+
secrets: z.ZodOptional<z.ZodBoolean>;
|
|
191
|
+
mdns: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
|
|
192
|
+
hid: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodObject<{
|
|
193
|
+
vendorId: z.ZodNumber;
|
|
194
|
+
productId: z.ZodOptional<z.ZodNumber>;
|
|
195
|
+
usagePage: z.ZodOptional<z.ZodNumber>;
|
|
196
|
+
}, z.core.$strict>>]>>;
|
|
197
|
+
}, z.core.$strict>>;
|
|
198
|
+
menu: z.ZodOptional<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
199
|
+
tray: z.ZodOptional<z.ZodObject<{
|
|
200
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
201
|
+
tooltip: z.ZodOptional<z.ZodString>;
|
|
202
|
+
title: z.ZodOptional<z.ZodString>;
|
|
203
|
+
iconAsTemplate: z.ZodOptional<z.ZodBoolean>;
|
|
204
|
+
menu: z.ZodOptional<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
|
|
205
|
+
leftClick: z.ZodOptional<z.ZodEnum<{
|
|
206
|
+
event: "event";
|
|
207
|
+
menu: "menu";
|
|
208
|
+
showWindow: "showWindow";
|
|
209
|
+
}>>;
|
|
210
|
+
window: z.ZodOptional<z.ZodString>;
|
|
211
|
+
}, z.core.$strict>>;
|
|
212
|
+
updater: z.ZodOptional<z.ZodObject<{
|
|
213
|
+
endpoint: z.ZodString;
|
|
214
|
+
publicKey: z.ZodString;
|
|
215
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
216
|
+
}, z.core.$strict>>;
|
|
217
|
+
protocols: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
218
|
+
singleInstance: z.ZodOptional<z.ZodBoolean>;
|
|
219
|
+
quitOnLastWindowClosed: z.ZodOptional<z.ZodBoolean>;
|
|
220
|
+
distDir: z.ZodOptional<z.ZodString>;
|
|
221
|
+
devtools: z.ZodOptional<z.ZodBoolean>;
|
|
222
|
+
outDir: z.ZodOptional<z.ZodString>;
|
|
223
|
+
}, z.core.$strict>;
|
|
224
|
+
export type ParsedConfig = z.infer<typeof configSchema>;
|
|
225
|
+
/**
|
|
226
|
+
* Validate a config object, returning either the parsed value or a list of
|
|
227
|
+
* messages already formatted for a terminal.
|
|
228
|
+
*/
|
|
229
|
+
export declare function parseConfig(value: unknown): {
|
|
230
|
+
ok: true;
|
|
231
|
+
config: ParsedConfig;
|
|
232
|
+
} | {
|
|
233
|
+
ok: false;
|
|
234
|
+
problems: string[];
|
|
235
|
+
};
|
|
236
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsBxB,eAAO,MAAM,SAAS;;;;;kBAYX,CAAC;AAEZ,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;kBAqBd,CAAC;AAkEZ;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAsC7C,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;kBAUZ,CAAC;AAEZ,eAAO,MAAM,aAAa;;;;kBAWf,CAAC;AAEZ,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA4BnB,CAAC;AAEZ,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAwBd,CAAC;AAEZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;GAGG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,OAAO,GACb;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAUxE"}
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime validation for `vantail.config.ts`.
|
|
3
|
+
*
|
|
4
|
+
* Kept in its own entry point so `@vantail/api` - which ships to the browser
|
|
5
|
+
* - never pulls Zod into an application bundle.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
const pathScope = z.union([
|
|
9
|
+
z.boolean(),
|
|
10
|
+
z.array(z.string()),
|
|
11
|
+
z
|
|
12
|
+
.object({
|
|
13
|
+
allow: z.array(z.string()).optional(),
|
|
14
|
+
deny: z.array(z.string()).optional(),
|
|
15
|
+
})
|
|
16
|
+
.strict(),
|
|
17
|
+
]);
|
|
18
|
+
const clipboardPermissions = z.union([
|
|
19
|
+
z.boolean(),
|
|
20
|
+
z
|
|
21
|
+
.object({ read: z.boolean().optional(), write: z.boolean().optional() })
|
|
22
|
+
.strict(),
|
|
23
|
+
]);
|
|
24
|
+
const positive = z.number().positive();
|
|
25
|
+
export const appSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
name: z.string().min(1, "app.name cannot be empty"),
|
|
28
|
+
identifier: z
|
|
29
|
+
.string()
|
|
30
|
+
.regex(/^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+$/, "app.identifier must be reverse-DNS, e.g. dev.wissen.myapp"),
|
|
31
|
+
version: z.string().optional(),
|
|
32
|
+
icon: z.string().optional(),
|
|
33
|
+
})
|
|
34
|
+
.strict();
|
|
35
|
+
export const windowSchema = z
|
|
36
|
+
.object({
|
|
37
|
+
title: z.string().optional(),
|
|
38
|
+
width: positive.optional(),
|
|
39
|
+
height: positive.optional(),
|
|
40
|
+
minWidth: positive.optional(),
|
|
41
|
+
minHeight: positive.optional(),
|
|
42
|
+
maxWidth: positive.optional(),
|
|
43
|
+
maxHeight: positive.optional(),
|
|
44
|
+
x: z.number().optional(),
|
|
45
|
+
y: z.number().optional(),
|
|
46
|
+
resizable: z.boolean().optional(),
|
|
47
|
+
maximized: z.boolean().optional(),
|
|
48
|
+
fullscreen: z.boolean().optional(),
|
|
49
|
+
decorations: z.boolean().optional(),
|
|
50
|
+
transparent: z.boolean().optional(),
|
|
51
|
+
alwaysOnTop: z.boolean().optional(),
|
|
52
|
+
center: z.boolean().optional(),
|
|
53
|
+
visible: z.boolean().optional(),
|
|
54
|
+
closeBehavior: z.enum(["close", "hide", "ask"]).optional(),
|
|
55
|
+
})
|
|
56
|
+
.strict();
|
|
57
|
+
const argRule = z.union([
|
|
58
|
+
z.string(),
|
|
59
|
+
z.object({ pattern: z.string() }).strict(),
|
|
60
|
+
]);
|
|
61
|
+
const shellRule = z
|
|
62
|
+
.object({
|
|
63
|
+
program: z.string().min(1),
|
|
64
|
+
args: z.array(argRule).optional(),
|
|
65
|
+
cwd: pathScope.optional(),
|
|
66
|
+
})
|
|
67
|
+
.strict();
|
|
68
|
+
const networkPermissions = z
|
|
69
|
+
.object({
|
|
70
|
+
allow: z.array(z.string()).optional(),
|
|
71
|
+
deny: z.array(z.string()).optional(),
|
|
72
|
+
allowInvalidCertificates: z.array(z.string()).optional(),
|
|
73
|
+
})
|
|
74
|
+
.strict();
|
|
75
|
+
const usbId = z.number().int().min(0).max(0xffff);
|
|
76
|
+
const hidPermissions = z.union([
|
|
77
|
+
z.boolean(),
|
|
78
|
+
z.array(z
|
|
79
|
+
.object({
|
|
80
|
+
vendorId: usbId,
|
|
81
|
+
productId: usbId.optional(),
|
|
82
|
+
usagePage: usbId.optional(),
|
|
83
|
+
})
|
|
84
|
+
.strict()),
|
|
85
|
+
]);
|
|
86
|
+
const shellPermissions = z
|
|
87
|
+
.object({
|
|
88
|
+
allow: z.array(shellRule).optional(),
|
|
89
|
+
open: z.union([z.boolean(), z.array(z.string())]).optional(),
|
|
90
|
+
})
|
|
91
|
+
.strict();
|
|
92
|
+
const PREDEFINED = [
|
|
93
|
+
"separator",
|
|
94
|
+
"copy",
|
|
95
|
+
"cut",
|
|
96
|
+
"paste",
|
|
97
|
+
"selectAll",
|
|
98
|
+
"undo",
|
|
99
|
+
"redo",
|
|
100
|
+
"minimize",
|
|
101
|
+
"maximize",
|
|
102
|
+
"fullscreen",
|
|
103
|
+
"hide",
|
|
104
|
+
"hideOthers",
|
|
105
|
+
"showAll",
|
|
106
|
+
"closeWindow",
|
|
107
|
+
"quit",
|
|
108
|
+
"about",
|
|
109
|
+
"services",
|
|
110
|
+
"bringAllToFront",
|
|
111
|
+
];
|
|
112
|
+
/**
|
|
113
|
+
* Menus nest, so the schema does too. Zod needs the explicit annotation
|
|
114
|
+
* because a recursive type cannot be inferred from its own definition.
|
|
115
|
+
*/
|
|
116
|
+
export const menuItemSchema = z.lazy(() => z.union([
|
|
117
|
+
z
|
|
118
|
+
.object({
|
|
119
|
+
type: z.literal("normal").optional(),
|
|
120
|
+
id: z.string().min(1),
|
|
121
|
+
label: z.string(),
|
|
122
|
+
enabled: z.boolean().optional(),
|
|
123
|
+
accelerator: z.string().optional(),
|
|
124
|
+
})
|
|
125
|
+
.strict(),
|
|
126
|
+
z
|
|
127
|
+
.object({
|
|
128
|
+
type: z.literal("checkbox"),
|
|
129
|
+
id: z.string().min(1),
|
|
130
|
+
label: z.string(),
|
|
131
|
+
checked: z.boolean().optional(),
|
|
132
|
+
enabled: z.boolean().optional(),
|
|
133
|
+
accelerator: z.string().optional(),
|
|
134
|
+
})
|
|
135
|
+
.strict(),
|
|
136
|
+
z
|
|
137
|
+
.object({
|
|
138
|
+
type: z.literal("submenu"),
|
|
139
|
+
label: z.string(),
|
|
140
|
+
items: z.array(menuItemSchema),
|
|
141
|
+
enabled: z.boolean().optional(),
|
|
142
|
+
})
|
|
143
|
+
.strict(),
|
|
144
|
+
z.object({ type: z.literal("separator") }).strict(),
|
|
145
|
+
z
|
|
146
|
+
.object({
|
|
147
|
+
type: z.literal("predefined"),
|
|
148
|
+
item: z.enum(PREDEFINED),
|
|
149
|
+
label: z.string().optional(),
|
|
150
|
+
})
|
|
151
|
+
.strict(),
|
|
152
|
+
]));
|
|
153
|
+
export const traySchema = z
|
|
154
|
+
.object({
|
|
155
|
+
icon: z.string().optional(),
|
|
156
|
+
tooltip: z.string().optional(),
|
|
157
|
+
title: z.string().optional(),
|
|
158
|
+
iconAsTemplate: z.boolean().optional(),
|
|
159
|
+
menu: z.array(menuItemSchema).optional(),
|
|
160
|
+
leftClick: z.enum(["showWindow", "menu", "event"]).optional(),
|
|
161
|
+
window: z.string().optional(),
|
|
162
|
+
})
|
|
163
|
+
.strict();
|
|
164
|
+
export const updaterSchema = z
|
|
165
|
+
.object({
|
|
166
|
+
endpoint: z.string().url("updater.endpoint must be a URL"),
|
|
167
|
+
publicKey: z
|
|
168
|
+
.string()
|
|
169
|
+
.min(1, "updater.publicKey is required - generate one with `vantail updater keygen`"),
|
|
170
|
+
timeoutMs: positive.optional(),
|
|
171
|
+
})
|
|
172
|
+
.strict();
|
|
173
|
+
export const permissionsSchema = z
|
|
174
|
+
.object({
|
|
175
|
+
filesystem: z
|
|
176
|
+
.object({
|
|
177
|
+
read: pathScope.optional(),
|
|
178
|
+
write: pathScope.optional(),
|
|
179
|
+
grantFromDialog: z.boolean().optional(),
|
|
180
|
+
grantFromDrop: z.boolean().optional(),
|
|
181
|
+
})
|
|
182
|
+
.strict()
|
|
183
|
+
.optional(),
|
|
184
|
+
dialog: z.boolean().optional(),
|
|
185
|
+
clipboard: clipboardPermissions.optional(),
|
|
186
|
+
notification: z.boolean().optional(),
|
|
187
|
+
os: z.boolean().optional(),
|
|
188
|
+
window: z.boolean().optional(),
|
|
189
|
+
shell: shellPermissions.optional(),
|
|
190
|
+
tray: z.boolean().optional(),
|
|
191
|
+
shortcut: z.boolean().optional(),
|
|
192
|
+
dragDrop: z.boolean().optional(),
|
|
193
|
+
autostart: z.boolean().optional(),
|
|
194
|
+
menu: z.boolean().optional(),
|
|
195
|
+
updater: z.boolean().optional(),
|
|
196
|
+
network: networkPermissions.optional(),
|
|
197
|
+
secrets: z.boolean().optional(),
|
|
198
|
+
mdns: z.union([z.boolean(), z.array(z.string())]).optional(),
|
|
199
|
+
hid: hidPermissions.optional(),
|
|
200
|
+
})
|
|
201
|
+
.strict();
|
|
202
|
+
export const configSchema = z
|
|
203
|
+
.object({
|
|
204
|
+
app: appSchema,
|
|
205
|
+
window: windowSchema.optional(),
|
|
206
|
+
permissions: permissionsSchema.optional(),
|
|
207
|
+
menu: z.array(menuItemSchema).optional(),
|
|
208
|
+
tray: traySchema.optional(),
|
|
209
|
+
updater: updaterSchema.optional(),
|
|
210
|
+
protocols: z
|
|
211
|
+
.array(z
|
|
212
|
+
.string()
|
|
213
|
+
.regex(/^[a-z][a-z0-9+.-]*$/, "a protocol must start with a lowercase letter and contain only lowercase letters, digits, +, - and ."))
|
|
214
|
+
.optional(),
|
|
215
|
+
singleInstance: z.boolean().optional(),
|
|
216
|
+
quitOnLastWindowClosed: z.boolean().optional(),
|
|
217
|
+
distDir: z.string().optional(),
|
|
218
|
+
devtools: z.boolean().optional(),
|
|
219
|
+
outDir: z.string().optional(),
|
|
220
|
+
})
|
|
221
|
+
.strict();
|
|
222
|
+
/**
|
|
223
|
+
* Validate a config object, returning either the parsed value or a list of
|
|
224
|
+
* messages already formatted for a terminal.
|
|
225
|
+
*/
|
|
226
|
+
export function parseConfig(value) {
|
|
227
|
+
const result = configSchema.safeParse(value);
|
|
228
|
+
if (result.success) {
|
|
229
|
+
return { ok: true, config: result.data };
|
|
230
|
+
}
|
|
231
|
+
const problems = result.error.issues.map((issue) => {
|
|
232
|
+
const path = issue.path.join(".");
|
|
233
|
+
return path ? `${path}: ${issue.message}` : issue.message;
|
|
234
|
+
});
|
|
235
|
+
return { ok: false, problems };
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC;IACxB,CAAC,CAAC,OAAO,EAAE;IACX,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACnB,CAAC;SACE,MAAM,CAAC;QACN,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ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Y,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC7C,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3C,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACjD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;IAC5D,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACjC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vantail/shared",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared types, error codes and config schema for Vantail.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Vantail/vantail.git",
|
|
9
|
+
"directory": "packages/shared"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/Vantail/vantail",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./schema": {
|
|
22
|
+
"types": "./dist/schema.d.ts",
|
|
23
|
+
"default": "./dist/schema.js"
|
|
24
|
+
},
|
|
25
|
+
"./load": {
|
|
26
|
+
"types": "./dist/load.d.ts",
|
|
27
|
+
"default": "./dist/load.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc -p tsconfig.json",
|
|
32
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"zod": "^4.0.0",
|
|
36
|
+
"esbuild": "^0.28.0"
|
|
37
|
+
}
|
|
38
|
+
}
|