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
#[derive(Debug, Default)]
pub struct ExternalsPresets {
/// Treat node.js built-in modules like `fs`, `path` or `vm` as external and load them via `require()` when used.
pub(crate) node: Option<bool>,
/// Treat references to `http(s)://...` and `std:...` as external and load them via import when used.
pub(crate) web: Option<bool>,
/// Treat references to `http(s)://...` and `std:...` as external and load them via async import() when used
pub(crate) web_async: Option<bool>,
/// Treat common electron built-in modules in main and preload context like `electron`, `ipc` or `shell` as external and load them via `require()` when used.
pub(crate) electron: Option<bool>,
/// Treat electron built-in modules in the main context like `app`, `ipc-main` or `shell` as external and load them via `require()` when used.
pub(crate) electron_main: Option<bool>,
/// Treat electron built-in modules in the preload context like `web-frame`, `ipc-renderer` or `shell` as external and load them via require() when used.
pub(crate) electron_preload: Option<bool>,
/// Treat electron built-in modules in the preload context like `web-frame`, `ipc-renderer` or `shell` as external and load them via require() when used.
pub(crate) electron_renderer: Option<bool>,
/// Treat `NW.js` legacy `nw.gui` module as external and load it via `require()` when used.
pub(crate) nwjs: Option<bool>,
}
impl ExternalsPresets {
pub fn node(&self) -> bool {
self.node.unwrap_or(false)
}
pub fn web(&self) -> bool {
self.web.unwrap_or(false)
}
pub fn web_async(&self) -> bool {
self.web_async.unwrap_or(false)
}
pub fn electron(&self) -> bool {
self.electron.unwrap_or(false)
}
pub fn electron_main(&self) -> bool {
self.electron_main.unwrap_or(false)
}
pub fn electron_preload(&self) -> bool {
self.electron_preload.unwrap_or(false)
}
pub fn electron_renderer(&self) -> bool {
self.electron_renderer.unwrap_or(false)
}
pub fn nwjs(&self) -> bool {
self.nwjs.unwrap_or(false)
}
}