app-builder-lib 26.11.1 → 26.12.1

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.
Files changed (128) hide show
  1. package/out/binDownload.js +36 -6
  2. package/out/binDownload.js.map +1 -1
  3. package/out/codeSign/codesign.js +7 -23
  4. package/out/codeSign/codesign.js.map +1 -1
  5. package/out/codeSign/macCodeSign.js +2 -2
  6. package/out/codeSign/macCodeSign.js.map +1 -1
  7. package/out/configuration.d.ts +36 -2
  8. package/out/configuration.js.map +1 -1
  9. package/out/electron/ElectronFramework.js +4 -1
  10. package/out/electron/ElectronFramework.js.map +1 -1
  11. package/out/electron/electronVersion.js +9 -4
  12. package/out/electron/electronVersion.js.map +1 -1
  13. package/out/fileMatcher.d.ts +2 -1
  14. package/out/fileMatcher.js +0 -1
  15. package/out/fileMatcher.js.map +1 -1
  16. package/out/fileTransformer.js +2 -1
  17. package/out/fileTransformer.js.map +1 -1
  18. package/out/forge-maker.js +6 -2
  19. package/out/forge-maker.js.map +1 -1
  20. package/out/index.d.ts +1 -1
  21. package/out/index.js.map +1 -1
  22. package/out/linuxPackager.js +1 -1
  23. package/out/linuxPackager.js.map +1 -1
  24. package/out/mac/MacTargetHelper.d.ts +24 -0
  25. package/out/mac/MacTargetHelper.js +267 -0
  26. package/out/mac/MacTargetHelper.js.map +1 -0
  27. package/out/macPackager.d.ts +21 -7
  28. package/out/macPackager.js +218 -346
  29. package/out/macPackager.js.map +1 -1
  30. package/out/node-module-collector/moduleManager.d.ts +1 -0
  31. package/out/node-module-collector/moduleManager.js +2 -0
  32. package/out/node-module-collector/moduleManager.js.map +1 -1
  33. package/out/node-module-collector/nodeModulesCollector.d.ts +3 -2
  34. package/out/node-module-collector/nodeModulesCollector.js +23 -3
  35. package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
  36. package/out/node-module-collector/pnpmNodeModulesCollector.js +5 -1
  37. package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
  38. package/out/options/SnapOptions.d.ts +415 -56
  39. package/out/options/SnapOptions.js.map +1 -1
  40. package/out/options/linuxOptions.d.ts +8 -0
  41. package/out/options/linuxOptions.js.map +1 -1
  42. package/out/packager.js +4 -4
  43. package/out/packager.js.map +1 -1
  44. package/out/platformPackager.js +9 -5
  45. package/out/platformPackager.js.map +1 -1
  46. package/out/publish/PublishManager.js +2 -2
  47. package/out/publish/PublishManager.js.map +1 -1
  48. package/out/publish/updateInfoBuilder.d.ts +4 -0
  49. package/out/publish/updateInfoBuilder.js +14 -2
  50. package/out/publish/updateInfoBuilder.js.map +1 -1
  51. package/out/targets/AppxTarget.js +2 -1
  52. package/out/targets/AppxTarget.js.map +1 -1
  53. package/out/targets/ArchiveTarget.js +1 -1
  54. package/out/targets/ArchiveTarget.js.map +1 -1
  55. package/out/targets/FlatpakTarget.js +2 -4
  56. package/out/targets/FlatpakTarget.js.map +1 -1
  57. package/out/targets/FpmTarget.js +30 -6
  58. package/out/targets/FpmTarget.js.map +1 -1
  59. package/out/targets/LinuxTargetHelper.d.ts +4 -1
  60. package/out/targets/LinuxTargetHelper.js +134 -8
  61. package/out/targets/LinuxTargetHelper.js.map +1 -1
  62. package/out/targets/MsiTarget.js +7 -4
  63. package/out/targets/MsiTarget.js.map +1 -1
  64. package/out/targets/MsiWrappedTarget.js +1 -1
  65. package/out/targets/MsiWrappedTarget.js.map +1 -1
  66. package/out/targets/appimage/AppImageTarget.js +2 -1
  67. package/out/targets/appimage/AppImageTarget.js.map +1 -1
  68. package/out/targets/archive.js +2 -6
  69. package/out/targets/archive.js.map +1 -1
  70. package/out/targets/nsis/NsisTarget.js +26 -16
  71. package/out/targets/nsis/NsisTarget.js.map +1 -1
  72. package/out/targets/nsis/nsisScriptGenerator.js +2 -3
  73. package/out/targets/nsis/nsisScriptGenerator.js.map +1 -1
  74. package/out/targets/nsis/nsisUtil.d.ts +0 -7
  75. package/out/targets/nsis/nsisUtil.js +5 -48
  76. package/out/targets/nsis/nsisUtil.js.map +1 -1
  77. package/out/targets/pkg.js +1 -1
  78. package/out/targets/pkg.js.map +1 -1
  79. package/out/targets/snap/SnapTarget.d.ts +36 -0
  80. package/out/targets/snap/SnapTarget.js +105 -0
  81. package/out/targets/snap/SnapTarget.js.map +1 -0
  82. package/out/targets/snap/core24.d.ts +52 -0
  83. package/out/targets/snap/core24.js +448 -0
  84. package/out/targets/snap/core24.js.map +1 -0
  85. package/out/targets/snap/coreCustom.d.ts +28 -0
  86. package/out/targets/snap/coreCustom.js +63 -0
  87. package/out/targets/snap/coreCustom.js.map +1 -0
  88. package/out/targets/snap/coreLegacy.d.ts +20 -0
  89. package/out/targets/snap/coreLegacy.js +278 -0
  90. package/out/targets/snap/coreLegacy.js.map +1 -0
  91. package/out/targets/snap/snapcraftBuilder.d.ts +39 -0
  92. package/out/targets/snap/snapcraftBuilder.js +419 -0
  93. package/out/targets/snap/snapcraftBuilder.js.map +1 -0
  94. package/out/toolsets/linux.d.ts +5 -0
  95. package/out/toolsets/linux.js +55 -23
  96. package/out/toolsets/linux.js.map +1 -1
  97. package/out/toolsets/windows.d.ts +19 -0
  98. package/out/toolsets/windows.js +126 -18
  99. package/out/toolsets/windows.js.map +1 -1
  100. package/out/util/bundledTool.js +2 -1
  101. package/out/util/bundledTool.js.map +1 -1
  102. package/out/util/config/config.js +4 -3
  103. package/out/util/config/config.js.map +1 -1
  104. package/out/util/electronGet.d.ts +6 -1
  105. package/out/util/electronGet.js +15 -7
  106. package/out/util/electronGet.js.map +1 -1
  107. package/out/util/envPath.d.ts +2 -0
  108. package/out/util/envPath.js +28 -0
  109. package/out/util/envPath.js.map +1 -0
  110. package/out/util/packageMetadata.js +2 -1
  111. package/out/util/packageMetadata.js.map +1 -1
  112. package/out/util/toolsetLock.d.ts +1 -0
  113. package/out/util/toolsetLock.js +23 -0
  114. package/out/util/toolsetLock.js.map +1 -0
  115. package/out/util/yarn.js +1 -1
  116. package/out/util/yarn.js.map +1 -1
  117. package/out/version.d.ts +1 -1
  118. package/out/version.js +1 -1
  119. package/out/version.js.map +1 -1
  120. package/out/vm/vm.d.ts +1 -0
  121. package/out/vm/vm.js +18 -0
  122. package/out/vm/vm.js.map +1 -1
  123. package/package.json +9 -9
  124. package/scheme.json +1401 -107
  125. package/templates/nsis/multiUser.nsh +14 -12
  126. package/out/targets/snap.d.ts +0 -17
  127. package/out/targets/snap.js +0 -337
  128. package/out/targets/snap.js.map +0 -1
@@ -1,108 +1,197 @@
1
1
  import { TargetSpecificOptions } from "../core";
2
+ import { SnapcraftYAML } from "../targets/snap/snapcraft";
2
3
  import { CommonLinuxOptions } from "./linuxOptions";
4
+ /**
5
+ * New-style snap configuration. Use this via the `snapcraft` key in your build config.
6
+ * Selects the snapcraft core version and its per-core options.
7
+ */
8
+ export interface SnapcraftOptions extends TargetSpecificOptions {
9
+ /**
10
+ * The snap base to use as the execution environment. Determines which set of per-core options
11
+ * (`core18`, `core20`, `core22`, `core24`, `custom`) is active.
12
+ *
13
+ * Only one core may be selected per build target.
14
+ */
15
+ readonly base: "core18" | "core20" | "core22" | "core24" | "custom";
16
+ /**
17
+ * Snapcraft Store credentials — base64-encoded credentials string or file path.
18
+ * Accepts the same formats as `WIN_CSC_LINK` / `CSC_LINK`: base64 data,
19
+ * absolute/relative/`~/` file paths, and `file://` URIs.
20
+ * Relative paths are resolved against the build resources directory.
21
+ *
22
+ * Injected as `SNAPCRAFT_STORE_CREDENTIALS` into every snapcraft subprocess
23
+ * (core18/core20/core22/core24 builds and `snapcraft upload`).
24
+ * Not applied for `base: "custom"` — inject credentials manually via environment variables.
25
+ *
26
+ * The `SNAP_CSC_LINK` environment variable is the CI-friendly alternative.
27
+ * Generate with: `snapcraft export-login - | base64 -w0`
28
+ */
29
+ readonly cscLink?: string;
30
+ /**
31
+ * Configuration for a core18 build. Only active when `base` is `"core18"`.
32
+ */
33
+ readonly core18?: SnapOptionsLegacy | null;
34
+ /**
35
+ * Configuration for a core20 build. Only active when `base` is `"core20"`.
36
+ */
37
+ readonly core20?: SnapOptionsLegacy | null;
38
+ /**
39
+ * Configuration for a core22 build. Only active when `base` is `"core22"`.
40
+ */
41
+ readonly core22?: SnapOptionsLegacy | null;
42
+ /**
43
+ * **[Beta]** Options for building a core24 snap. Uses the snapcraft CLI directly.
44
+ * Inherits desktop-entry fields from `CommonLinuxOptions` and publish config from `TargetSpecificOptions`.
45
+ * @beta
46
+ */
47
+ readonly core24?: SnapOptions24 | null;
48
+ /**
49
+ * **[Beta]** Pass-through custom snap configuration. electron-builder will read the
50
+ * snapcraft.yaml at `yamlPath` and use it verbatim — no plugs, extensions,
51
+ * organize mappings, or desktop files are injected.
52
+ * @beta
53
+ */
54
+ readonly custom?: SnapOptionsCustom | null;
55
+ }
56
+ export type SnapOptionsLegacy = Omit<SnapOptions, "base">;
57
+ export interface SnapOptionsCustom {
58
+ /**
59
+ * Supports 2 routes:
60
+ * - Path to an existing `snapcraft.yaml` file, relative to `buildResourcesDir`. electron-builder reads the file and passes it through without modification.
61
+ * - A `SnapcraftYAML` object directly in the configuration. electron-builder uses the object to generate a `snapcraft.yaml` file, which is then passed through without modification.
62
+ */
63
+ readonly yaml?: string | SnapcraftYAML | null;
64
+ }
65
+ /**
66
+ * Flat snap options. Used via the `snap` key in your build config.
67
+ *
68
+ * @deprecated Prefer the `snapcraft` key with an explicit `base` field (e.g.
69
+ * `{ "snapcraft": { "base": "core24", "core24": { ... } } }`). The flat `snap`
70
+ * interface is maintained for backward compatibility and targets `core22` and
71
+ * older snap bases only.
72
+ *
73
+ * Fields inherited from {@link CommonLinuxOptions} (e.g. `description`, `category`,
74
+ * `mimeTypes`, `executableArgs`) are automatically populated from `linux.*` configuration
75
+ * and do not need to be repeated here. Per-core values take precedence when both are set.
76
+ */
3
77
  export interface SnapOptions extends CommonLinuxOptions, TargetSpecificOptions {
4
78
  /**
5
- * A snap of type base to be used as the execution environment for this snap. Examples: `core`, `core18`, `core20`, `core22`. Defaults to `core20`
79
+ * The snap base to use as the execution environment.
80
+ * Examples: `core18`, `core20`, `core22`.
81
+ *
82
+ * For new projects, use the `snapcraft` key with `base: "core24"` instead of
83
+ * this legacy interface.
6
84
  */
7
85
  readonly base?: string | null;
8
86
  /**
9
- * The type of [confinement](https://snapcraft.io/docs/reference/confinement) supported by the snap.
87
+ * Whether to use the pre-built Electron snap template for faster builds.
88
+ * When `true`, electron-builder delegates snap assembly to the upstream Electron snap
89
+ * template rather than running a full snapcraft build, significantly reducing build time.
90
+ * Defaults to `true` when `stagePackages` is not customised.
91
+ * Only applicable to x64 and armv7l builds.
92
+ */
93
+ readonly useTemplateApp?: boolean;
94
+ /**
95
+ * The type of [snap confinement](https://snapcraft.io/docs/reference/confinement).
96
+ * - `strict` — recommended; the snap runs in a fully isolated sandbox.
97
+ * - `devmode` — sandbox violations are logged but not enforced; for development only.
98
+ * - `classic` — no confinement; equivalent to a traditionally packaged application.
99
+ * Requires Snap Store approval before publishing.
10
100
  * @default strict
11
101
  */
12
102
  readonly confinement?: "devmode" | "strict" | "classic" | null;
13
103
  /**
14
- * The custom environment. Defaults to `{"TMPDIR: "$XDG_RUNTIME_DIR"}`. If you set custom, it will be merged with default.
104
+ * Environment variables injected into the snap's runtime environment.
105
+ * Merged with the electron-builder default `{ TMPDIR: "$XDG_RUNTIME_DIR" }`.
106
+ * User-supplied values take precedence.
15
107
  */
16
108
  readonly environment?: {
17
109
  [key: string]: string;
18
110
  } | null;
19
111
  /**
20
- * The 78 character long summary. Defaults to [productName](https://www.electron.build/configuration#productname).
112
+ * A short summary of the snap (max 78 characters).
113
+ * Defaults to [productName](./configuration.md#productName).
21
114
  */
22
115
  readonly summary?: string | null;
23
116
  /**
24
- * The quality grade of the snap. It can be either `devel` (i.e. a development version of the snap, so not to be published to the “stable” or “candidate” channels) or “stable” (i.e. a stable release or release candidate, which can be released to all channels).
117
+ * The quality grade of the snap.
118
+ * - `stable` — suitable for all channels, including `stable` and `candidate`.
119
+ * - `devel` — development snapshot; cannot be promoted to `stable` or `candidate`.
25
120
  * @default stable
26
121
  */
27
122
  readonly grade?: "devel" | "stable" | null;
28
123
  /**
29
- * The list of features that must be supported by the core in order for this snap to install.
124
+ * [Snapd features](https://snapcraft.io/docs/snapcraft-yaml-reference#assumes) that must
125
+ * be present on the host before the snap can be installed.
30
126
  */
31
127
  readonly assumes?: Array<string> | string | null;
32
128
  /**
33
- * The list of debian packages needs to be installed for building this snap.
129
+ * Debian packages required at **build** time (installed inside the build environment).
34
130
  */
35
131
  readonly buildPackages?: Array<string> | null;
36
132
  /**
37
- * The list of Ubuntu packages to use that are needed to support the `app` part creation. Like `depends` for `deb`.
133
+ * Ubuntu packages to **stage** alongside the app (equivalent to `depends` for deb).
38
134
  * Defaults to `["libnspr4", "libnss3", "libxss1", "libappindicator3-1", "libsecret-1-0"]`.
39
135
  *
40
- * If list contains `default`, it will be replaced to default list, so, `["default", "foo"]` can be used to add custom package `foo` in addition to defaults.
136
+ * Use the `"default"` keyword to extend the default list:
137
+ * `["default", "my-extra-lib"]` appends `my-extra-lib` to the defaults.
41
138
  */
42
139
  readonly stagePackages?: Array<string> | null;
43
140
  /**
44
- * The [hooks](https://docs.snapcraft.io/build-snaps/hooks) directory, relative to `build` (build resources directory).
141
+ * Directory containing [snap hooks](https://snapcraft.io/docs/snap-hooks), relative to
142
+ * the build resources directory (`build/`).
45
143
  * @default build/snap-hooks
46
144
  */
47
145
  readonly hooks?: string | null;
48
146
  /**
49
- * The list of [plugs](https://snapcraft.io/docs/reference/interfaces).
50
- * Defaults to `["desktop", "desktop-legacy", "home", "x11", "wayland", "unity7", "browser-support", "network", "gsettings", "audio-playback", "pulseaudio", "opengl"]`.
147
+ * [Plugs](https://snapcraft.io/docs/reference/interfaces) (consumed interfaces) to declare
148
+ * for the app entry point.
149
+ * Defaults to `["desktop", "desktop-legacy", "home", "x11", "wayland", "unity7",
150
+ * "browser-support", "network", "gsettings", "audio-playback", "pulseaudio", "opengl"]`.
51
151
  *
52
- * If list contains `default`, it will be replaced to default list, so, `["default", "foo"]` can be used to add custom plug `foo` in addition to defaults.
152
+ * Use `"default"` in the list to keep the defaults and append extras:
153
+ * `["default", "camera"]` adds `camera` to the standard set.
53
154
  *
54
- * Additional attributes can be specified using object instead of just name of plug:
55
- * ```
56
- *[
57
- * {
58
- * "browser-sandbox": {
59
- * "interface": "browser-support",
60
- * "allow-sandbox": true
61
- * },
62
- * },
63
- * "another-simple-plug-name"
64
- *]
155
+ * To configure plug attributes (e.g. `allow-sandbox` for Chromium's internal sandbox),
156
+ * use a descriptor object:
157
+ * ```json
158
+ * [
159
+ * { "browser-sandbox": { "interface": "browser-support", "allow-sandbox": true } },
160
+ * "another-simple-plug-name"
161
+ * ]
65
162
  * ```
66
163
  */
67
164
  readonly plugs?: Array<string | PlugDescriptor> | PlugDescriptor | null;
68
165
  /**
69
- * The list of [slots](https://snapcraft.io/docs/reference/interfaces).
166
+ * [Slots](https://snapcraft.io/docs/reference/interfaces) (provided interfaces) to declare
167
+ * for the app.
70
168
  *
71
- * Additional attributes can be specified using object instead of just name of slot:
169
+ * To expose an MPRIS player under the Chromium bus name (required for strict confinement):
170
+ * ```json
171
+ * [{ "mpris": { "name": "chromium" } }]
72
172
  * ```
73
- *[
74
- * {
75
- * "mpris": {
76
- * "name": "chromium"
77
- * },
78
- * }
79
- *]
80
- *
81
- * In case you want your application to be a compliant MPris player, you will need to definie
82
- * The mpris slot with "chromium" name.
83
- * This electron has it [hardcoded](https://source.chromium.org/chromium/chromium/src/+/master:components/system_media_controls/linux/system_media_controls_linux.cc;l=51;bpv=0;bpt=1),
84
- * and we need to pass this name so snap [will allow it](https://forum.snapcraft.io/t/unable-to-use-mpris-interface/15360/7) in strict confinement.
85
- *
173
+ * Chromium [hard-codes](https://source.chromium.org/chromium/chromium/src/+/master:components/system_media_controls/linux/system_media_controls_linux.cc;l=51;bpv=0;bpt=1)
174
+ * the bus name `chromium`, so the slot name must match for snapd to
175
+ * [allow it](https://forum.snapcraft.io/t/unable-to-use-mpris-interface/15360/7).
86
176
  */
87
- readonly slots?: Array<string | SlotDescriptor> | PlugDescriptor | null;
177
+ readonly slots?: Array<string | SlotDescriptor> | SlotDescriptor | null;
88
178
  /**
89
- * Specifies any [parts](https://snapcraft.io/docs/reference/parts) that should be built before this part.
90
- * Defaults to `["desktop-gtk2""]`.
179
+ * Names of snapcraft parts that must be built before the app part.
180
+ * Defaults to `["desktop-gtk2"]`.
91
181
  *
92
- * If list contains `default`, it will be replaced to default list, so, `["default", "foo"]` can be used to add custom parts `foo` in addition to defaults.
182
+ * Use `"default"` to keep the default and add extras:
183
+ * `["default", "my-helper-part"]`.
93
184
  */
94
185
  readonly after?: Array<string> | null;
95
186
  /**
96
- * Whether to use template snap. Defaults to `true` if `stagePackages` not specified.
97
- */
98
- readonly useTemplateApp?: boolean;
99
- /**
100
- * Whether or not the snap should automatically start on login.
187
+ * Whether the snap should automatically start on login.
101
188
  * @default false
102
189
  */
103
190
  readonly autoStart?: boolean;
104
191
  /**
105
- * Specifies any files to make accessible from locations such as `/usr`, `/var`, and `/etc`. See [snap layouts](https://snapcraft.io/docs/snap-layouts) to learn more.
192
+ * [Snap layouts](https://snapcraft.io/docs/snap-layouts) — bind-mount or symlink host paths
193
+ * into the snap's namespace, making libraries or config at `/usr`, `/var`, `/etc`, etc.
194
+ * accessible inside the confined environment.
106
195
  */
107
196
  readonly layout?: {
108
197
  [key: string]: {
@@ -110,30 +199,300 @@ export interface SnapOptions extends CommonLinuxOptions, TargetSpecificOptions {
110
199
  };
111
200
  } | null;
112
201
  /**
113
- * Specifies which files from the app part to stage and which to exclude. Individual files, directories, wildcards, globstars, and exclusions are accepted. See [Snapcraft filesets](https://snapcraft.io/docs/snapcraft-filesets) to learn more about the format.
114
- *
115
- * The defaults can be found in [snap.ts](https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/templates/snap/snapcraft.yaml#L29).
202
+ * Filesets controlling which files from the app part are staged into the snap.
203
+ * Supports individual files, directories, globs, globstars, and exclusions (prefix `!`).
204
+ * See [Snapcraft filesets](https://snapcraft.io/docs/snapcraft-filesets).
205
+ * When not set, the snap template's default stage list is used for legacy bases (core18/core20/core22).
116
206
  */
117
207
  readonly appPartStage?: Array<string> | null;
118
208
  /**
119
- * An optional title for the snap, may contain uppercase letters and spaces. Defaults to `productName`. See [snap format documentation](https://snapcraft.io/docs/snap-format).
209
+ * Display title for the snap (may contain uppercase letters and spaces).
210
+ * Defaults to `productName`.
211
+ * See [snap format](https://snapcraft.io/docs/snap-format).
120
212
  */
121
213
  readonly title?: string | null;
122
214
  /**
123
- * Sets the compression type for the snap. Can be xz, lzo, or null.
215
+ * Compression algorithm for the snap SquashFS image.
216
+ * - `xz` — smaller file, slower decompression (good for distribution).
217
+ * - `lzo` — larger file, faster decompression (good for development iteration).
218
+ * Omit to use snapcraft's default (`xz`).
219
+ *
220
+ * When not set, `linux.compression` is mapped automatically:
221
+ * `"store"` → `"lzo"`, `"maximum"` → `"xz"`, `"normal"` → snapcraft default.
222
+ * Explicitly setting this field always overrides the mapped value.
124
223
  */
125
224
  readonly compression?: "xz" | "lzo" | null;
126
225
  /**
127
- * Allow running the program with native wayland support with --ozone-platform=wayland.
128
- * Disabled by default because of this issue in older Electron/Snap versions: https://github.com/electron-userland/electron-builder/issues/4007
226
+ * Allow the snap to run with native Wayland support (`--ozone-platform=wayland`).
227
+ * Defaults to `false` for Electron < 38 (legacy behaviour); `true` for Electron ≥ 38.
228
+ * Set explicitly to override the version-based default.
129
229
  */
130
230
  readonly allowNativeWayland?: boolean | null;
131
231
  }
232
+ /**
233
+ * Configuration for a remote snap build on [Launchpad](https://launchpad.net/).
234
+ * Remote builds run on Canonical's infrastructure without requiring native hardware or nested virtualisation.
235
+ *
236
+ * Each electron-builder build invocation targets exactly one architecture — to build for multiple
237
+ * architectures, configure the top-level `arch` option (e.g. `arch: ["x64", "arm64"]`); each arch
238
+ * spawns a separate `snapcraft remote-build` job on Launchpad.
239
+ *
240
+ * Authentication is resolved in this order:
241
+ * 1. `cscLink` config field — base64-encoded credentials or a file path
242
+ * 2. `SNAP_CSC_LINK` environment variable — same format as `cscLink`
243
+ * (CI-recommended; follows the same pattern as `WIN_CSC_LINK` for Windows code signing)
244
+ * 3. `SNAPCRAFT_STORE_CREDENTIALS` environment variable (read directly by snapcraft)
245
+ * 4. An active interactive `snapcraft login` session
246
+ *
247
+ * **CI setup** (set once as a CI secret):
248
+ * ```sh
249
+ * export SNAP_CSC_LINK=$(snapcraft export-login - | base64 -w0)
250
+ * ```
251
+ * The resolved credentials are injected only into the spawned `snapcraft` subprocess
252
+ * environment and never exposed through `process.env`.
253
+ */
254
+ export interface RemoteBuildOptions {
255
+ /**
256
+ * Whether to enable remote build on Launchpad. Must be set explicitly to `true` to opt in.
257
+ */
258
+ enabled: boolean;
259
+ /**
260
+ * Your Launchpad username. Used to select the correct Launchpad account when more than
261
+ * one set of credentials is available.
262
+ */
263
+ launchpadUsername?: string;
264
+ /**
265
+ * Target architecture for the remote build. Accepts a single snapcraft arch string
266
+ * (e.g. `"amd64"`, `"arm64"`, `"armhf"`).
267
+ *
268
+ * To build for multiple architectures, configure electron-builder's top-level `arch` option
269
+ * (e.g. `arch: ["x64", "arm64"]`) — each arch spawns a separate remote-build job on Launchpad,
270
+ * keeping the one-build-per-artifact contract intact.
271
+ * @example "amd64"
272
+ */
273
+ buildFor?: string;
274
+ /**
275
+ * Suppress the Launchpad public-upload consent prompt by automatically accepting it.
276
+ * Your source code will be uploaded to a **public** Launchpad repository.
277
+ * Set to `true` in CI once you understand the implications.
278
+ */
279
+ acceptPublicUpload?: boolean;
280
+ /**
281
+ * Launchpad project name to use for a **private** source upload.
282
+ * The project must already exist and you must have write access.
283
+ */
284
+ privateProject?: string;
285
+ /**
286
+ * Resume a previously interrupted remote build rather than starting a new one.
287
+ */
288
+ recover?: boolean;
289
+ /**
290
+ * Maximum time in seconds to wait for the remote build to complete before aborting.
291
+ * Passed to `snapcraft remote-build` as `--timeout <seconds>`.
292
+ *
293
+ * @example 1800 // 30 minutes
294
+ */
295
+ timeout?: number;
296
+ /**
297
+ * Controls whether snapcraft may fall back to a different remote build strategy.
298
+ * - `"disable-fallback"` — always use the primary strategy, fail if unavailable.
299
+ * - `"force-fallback"` — always use the fallback strategy.
300
+ */
301
+ strategy?: "disable-fallback" | "force-fallback";
302
+ }
303
+ /**
304
+ * **[Beta]** Options for building a core24 snap. This interface does not extend the legacy
305
+ * `SnapBaseOptions` — it uses the snapcraft CLI directly.
306
+ *
307
+ * Fields inherited from {@link CommonLinuxOptions} (`description`, `category`, `mimeTypes`,
308
+ * `executableArgs`, `desktop`, `synopsis`) are automatically populated from the root `linux.*`
309
+ * configuration. You do not need to duplicate them here; values set directly on this interface
310
+ * take precedence over the cascaded `linux.*` values.
311
+ *
312
+ * @beta
313
+ */
314
+ export interface SnapOptions24 extends CommonLinuxOptions, TargetSpecificOptions {
315
+ /**
316
+ * Use [LXD](https://canonical.com/lxd) as the isolated build environment.
317
+ * Preferred over Multipass on most Linux CI systems where nested virtualisation is unavailable.
318
+ * Mutually exclusive with `useMultipass` and `useDestructiveMode`.
319
+ */
320
+ readonly useLXD?: boolean | null;
321
+ /**
322
+ * Use [Multipass](https://multipass.run/) as the isolated build environment.
323
+ * Mutually exclusive with `useLXD` and `useDestructiveMode`.
324
+ */
325
+ readonly useMultipass?: boolean | null;
326
+ /**
327
+ * Build directly on the host without an isolated VM or container (snapcraft `--destructive-mode`).
328
+ * Equivalent to setting `SNAPCRAFT_BUILD_ENVIRONMENT=host`.
329
+ *
330
+ * **Not recommended for most use cases.** Destructive mode pollutes the host environment
331
+ * and produces builds that are difficult to reproduce — any library or tool present on the
332
+ * host at build time can silently end up in the snap. Prefer `useLXD` or `useMultipass`
333
+ * for clean, reproducible builds; use `remoteBuild` for multi-architecture CI.
334
+ *
335
+ * Valid reasons to enable this option:
336
+ * - Building inside a Docker container where nested virtualisation (LXD / Multipass) is
337
+ * unavailable and a remote Launchpad build is not acceptable.
338
+ * - Running test suites in CI where the environment is already fully controlled.
339
+ *
340
+ * The `gnome` extension is incompatible with this mode enabled — do not include it in `extensions`.
341
+ * @see https://snapcraft.io/docs/build-options
342
+ */
343
+ readonly useDestructiveMode?: boolean | null;
344
+ /**
345
+ * Configuration for a remote build on [Launchpad](https://launchpad.net/).
346
+ * Enables cross-architecture builds in CI without native hardware or nested virtualisation.
347
+ * Each build invocation targets one arch; use `arch: ["x64", "arm64"]` to build for multiple.
348
+ */
349
+ readonly remoteBuild?: RemoteBuildOptions | null;
350
+ /**
351
+ * [Snapcraft extensions](https://snapcraft.io/docs/snapcraft-extensions) to apply to the app.
352
+ * Defaults to `["gnome"]` in normal builds (recommended for Electron apps on Ubuntu 24.04+).
353
+ * Automatically set to `[]` in `useDestructiveMode` builds, where the gnome extension is
354
+ * incompatible. Explicitly including `"gnome"` while `useDestructiveMode` is set will throw.
355
+ * See: https://snapcraft.io/docs/gnome-extension
356
+ */
357
+ readonly extensions?: Array<string> | null;
358
+ /**
359
+ * The type of [confinement](https://snapcraft.io/docs/reference/confinement) supported by the snap.
360
+ * @default strict
361
+ */
362
+ readonly confinement?: "devmode" | "strict" | "classic" | null;
363
+ /**
364
+ * The quality grade of the snap.
365
+ * `devel` — not publishable to stable/candidate channels.
366
+ * `stable` — suitable for all channels.
367
+ * @default stable
368
+ */
369
+ readonly grade?: "devel" | "stable" | null;
370
+ /**
371
+ * A short summary of the snap (max 78 characters). Defaults to `productName`.
372
+ */
373
+ readonly summary?: string | null;
374
+ /**
375
+ * An optional display title (may contain uppercase letters and spaces). Defaults to `productName`.
376
+ * See [snap format](https://snapcraft.io/docs/snap-format).
377
+ */
378
+ readonly title?: string | null;
379
+ /**
380
+ * Compression algorithm for the snap SquashFS image.
381
+ * - `xz` — smaller file, slower decompression (recommended for distribution).
382
+ * - `lzo` — larger file, faster decompression (useful for development iteration).
383
+ * Omit to use snapcraft's default (`xz`).
384
+ *
385
+ * When not set, `linux.compression` is mapped automatically:
386
+ * `"store"` → `"lzo"`, `"maximum"` → `"xz"`, `"normal"` → snapcraft default.
387
+ * Explicitly setting this field always overrides the mapped value.
388
+ */
389
+ readonly compression?: "xz" | "lzo" | null;
390
+ /**
391
+ * Features that must be supported by the host snapd before the snap can be installed.
392
+ * See [assumes](https://snapcraft.io/docs/snapcraft-yaml-reference#assumes).
393
+ */
394
+ readonly assumes?: Array<string> | string | null;
395
+ /**
396
+ * Debian packages required at **build** time (installed inside the build environment).
397
+ */
398
+ readonly buildPackages?: Array<string> | null;
399
+ /**
400
+ * Ubuntu packages to **stage** alongside the app (equivalent to `depends` for deb).
401
+ * Defaults to `["libnspr4", "libnss3", "libxss1", "libappindicator3-1", "libsecret-1-0"]`.
402
+ * Supports the `"default"` keyword to reference the default list:
403
+ * `["default", "my-extra-lib"]` appends `my-extra-lib` to the defaults.
404
+ */
405
+ readonly stagePackages?: Array<string> | null;
406
+ /**
407
+ * Filesets controlling which files from the app part are staged into the snap.
408
+ * Supports glob patterns and exclusions. See [filesets](https://snapcraft.io/docs/snapcraft-filesets).
409
+ */
410
+ readonly appPartStage?: Array<string> | null;
411
+ /**
412
+ * Names of other snapcraft parts that must be built before the app part.
413
+ */
414
+ readonly after?: Array<string> | null;
415
+ /**
416
+ * [Plugs](https://snapcraft.io/docs/reference/interfaces) (consumed interfaces) for the app.
417
+ * When the `gnome` extension is active, content-snap plugs (themes, GNOME platform, GPU)
418
+ * are added automatically — only list custom plugs here.
419
+ * Without any extension, defaults to the standard Electron plug set.
420
+ *
421
+ * Supports descriptor objects for plugs with attributes:
422
+ * ```json
423
+ * [{ "browser-sandbox": { "interface": "browser-support", "allow-sandbox": true } }]
424
+ * ```
425
+ */
426
+ readonly plugs?: Array<string | PlugDescriptor> | PlugDescriptor | null;
427
+ /**
428
+ * [Slots](https://snapcraft.io/docs/reference/interfaces) (provided interfaces) for the app.
429
+ * Use for MPRIS, D-Bus services, etc.
430
+ *
431
+ * Example — expose MPRIS under the Chromium bus name:
432
+ * ```json
433
+ * [{ "mpris": { "name": "chromium" } }]
434
+ * ```
435
+ */
436
+ readonly slots?: Array<string | SlotDescriptor> | SlotDescriptor | null;
437
+ /**
438
+ * [Snap layouts](https://snapcraft.io/docs/snap-layouts) — bind-mount or symlink host paths
439
+ * into the snap's namespace. User-provided layouts always override the extension defaults.
440
+ */
441
+ readonly layout?: {
442
+ [key: string]: {
443
+ [key: string]: string;
444
+ };
445
+ } | null;
446
+ /**
447
+ * Additional environment variables injected into the snap's runtime environment.
448
+ * Merged with the electron-builder defaults (`TMPDIR=$XDG_RUNTIME_DIR`).
449
+ * User-supplied values take precedence.
450
+ */
451
+ readonly environment?: {
452
+ [key: string]: string;
453
+ } | null;
454
+ /**
455
+ * Whether the app should auto-start on login (creates an autostart desktop entry).
456
+ * @default false
457
+ */
458
+ readonly autoStart?: boolean;
459
+ /**
460
+ * Set to `true` to force X11 by injecting `--ozone-platform=x11` into the snap command line.
461
+ * When unset or `false`, no flag is injected and native Wayland is allowed.
462
+ * Unlike the legacy `snap.allowNativeWayland`, there is no electron-version-based default here —
463
+ * core24 always allows Wayland unless this is explicitly `true`.
464
+ */
465
+ readonly forceX11?: boolean | null;
466
+ /**
467
+ * Directory containing [snap hooks](https://snapcraft.io/docs/snap-hooks), relative to
468
+ * the build resources directory.
469
+ * @default build/snap-hooks
470
+ */
471
+ readonly hooks?: string | null;
472
+ }
473
+ /**
474
+ * Maps a named plug to its attribute object.
475
+ * `null` uses snapd defaults for that interface.
476
+ *
477
+ * @example
478
+ * ```json
479
+ * { "browser-sandbox": { "interface": "browser-support", "allow-sandbox": true } }
480
+ * ```
481
+ */
132
482
  export interface PlugDescriptor {
133
483
  [key: string]: {
134
484
  [key: string]: any;
135
485
  } | null;
136
486
  }
487
+ /**
488
+ * Maps a named slot to its attribute object.
489
+ * `null` uses snapd defaults for that interface.
490
+ *
491
+ * @example
492
+ * ```json
493
+ * { "mpris": { "name": "chromium" } }
494
+ * ```
495
+ */
137
496
  export interface SlotDescriptor {
138
497
  [key: string]: {
139
498
  [key: string]: any;
@@ -1 +1 @@
1
- {"version":3,"file":"SnapOptions.js","sourceRoot":"","sources":["../../src/options/SnapOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { TargetSpecificOptions } from \"../core\"\nimport { CommonLinuxOptions } from \"./linuxOptions\"\n\nexport interface SnapOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * A snap of type base to be used as the execution environment for this snap. Examples: `core`, `core18`, `core20`, `core22`. Defaults to `core20`\n */\n readonly base?: string | null\n\n /**\n * The type of [confinement](https://snapcraft.io/docs/reference/confinement) supported by the snap.\n * @default strict\n */\n readonly confinement?: \"devmode\" | \"strict\" | \"classic\" | null\n\n /**\n * The custom environment. Defaults to `{\"TMPDIR: \"$XDG_RUNTIME_DIR\"}`. If you set custom, it will be merged with default.\n */\n readonly environment?: { [key: string]: string } | null\n\n /**\n * The 78 character long summary. Defaults to [productName](https://www.electron.build/configuration#productname).\n */\n readonly summary?: string | null\n\n /**\n * The quality grade of the snap. It can be either `devel` (i.e. a development version of the snap, so not to be published to the “stable” or “candidate” channels) or “stable” (i.e. a stable release or release candidate, which can be released to all channels).\n * @default stable\n */\n readonly grade?: \"devel\" | \"stable\" | null\n\n /**\n * The list of features that must be supported by the core in order for this snap to install.\n */\n readonly assumes?: Array<string> | string | null\n\n /**\n * The list of debian packages needs to be installed for building this snap.\n */\n readonly buildPackages?: Array<string> | null\n\n /**\n * The list of Ubuntu packages to use that are needed to support the `app` part creation. Like `depends` for `deb`.\n * Defaults to `[\"libnspr4\", \"libnss3\", \"libxss1\", \"libappindicator3-1\", \"libsecret-1-0\"]`.\n *\n * If list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom package `foo` in addition to defaults.\n */\n readonly stagePackages?: Array<string> | null\n\n /**\n * The [hooks](https://docs.snapcraft.io/build-snaps/hooks) directory, relative to `build` (build resources directory).\n * @default build/snap-hooks\n */\n readonly hooks?: string | null\n\n /**\n * The list of [plugs](https://snapcraft.io/docs/reference/interfaces).\n * Defaults to `[\"desktop\", \"desktop-legacy\", \"home\", \"x11\", \"wayland\", \"unity7\", \"browser-support\", \"network\", \"gsettings\", \"audio-playback\", \"pulseaudio\", \"opengl\"]`.\n *\n * If list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom plug `foo` in addition to defaults.\n *\n * Additional attributes can be specified using object instead of just name of plug:\n * ```\n *[\n * {\n * \"browser-sandbox\": {\n * \"interface\": \"browser-support\",\n * \"allow-sandbox\": true\n * },\n * },\n * \"another-simple-plug-name\"\n *]\n * ```\n */\n readonly plugs?: Array<string | PlugDescriptor> | PlugDescriptor | null\n\n /**\n * The list of [slots](https://snapcraft.io/docs/reference/interfaces).\n *\n * Additional attributes can be specified using object instead of just name of slot:\n * ```\n *[\n * {\n * \"mpris\": {\n * \"name\": \"chromium\"\n * },\n * }\n *]\n *\n * In case you want your application to be a compliant MPris player, you will need to definie\n * The mpris slot with \"chromium\" name.\n * This electron has it [hardcoded](https://source.chromium.org/chromium/chromium/src/+/master:components/system_media_controls/linux/system_media_controls_linux.cc;l=51;bpv=0;bpt=1),\n * and we need to pass this name so snap [will allow it](https://forum.snapcraft.io/t/unable-to-use-mpris-interface/15360/7) in strict confinement.\n *\n */\n readonly slots?: Array<string | SlotDescriptor> | PlugDescriptor | null\n\n /**\n * Specifies any [parts](https://snapcraft.io/docs/reference/parts) that should be built before this part.\n * Defaults to `[\"desktop-gtk2\"\"]`.\n *\n * If list contains `default`, it will be replaced to default list, so, `[\"default\", \"foo\"]` can be used to add custom parts `foo` in addition to defaults.\n */\n readonly after?: Array<string> | null\n\n /**\n * Whether to use template snap. Defaults to `true` if `stagePackages` not specified.\n */\n readonly useTemplateApp?: boolean\n\n /**\n * Whether or not the snap should automatically start on login.\n * @default false\n */\n readonly autoStart?: boolean\n\n /**\n * Specifies any files to make accessible from locations such as `/usr`, `/var`, and `/etc`. See [snap layouts](https://snapcraft.io/docs/snap-layouts) to learn more.\n */\n readonly layout?: { [key: string]: { [key: string]: string } } | null\n\n /**\n * Specifies which files from the app part to stage and which to exclude. Individual files, directories, wildcards, globstars, and exclusions are accepted. See [Snapcraft filesets](https://snapcraft.io/docs/snapcraft-filesets) to learn more about the format.\n *\n * The defaults can be found in [snap.ts](https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/templates/snap/snapcraft.yaml#L29).\n */\n readonly appPartStage?: Array<string> | null\n\n /**\n * An optional title for the snap, may contain uppercase letters and spaces. Defaults to `productName`. See [snap format documentation](https://snapcraft.io/docs/snap-format).\n */\n readonly title?: string | null\n\n /**\n * Sets the compression type for the snap. Can be xz, lzo, or null.\n */\n readonly compression?: \"xz\" | \"lzo\" | null\n\n /**\n * Allow running the program with native wayland support with --ozone-platform=wayland.\n * Disabled by default because of this issue in older Electron/Snap versions: https://github.com/electron-userland/electron-builder/issues/4007\n */\n readonly allowNativeWayland?: boolean | null\n}\n\nexport interface PlugDescriptor {\n [key: string]: { [key: string]: any } | null\n}\n\nexport interface SlotDescriptor {\n [key: string]: { [key: string]: any } | null\n}\n"]}
1
+ {"version":3,"file":"SnapOptions.js","sourceRoot":"","sources":["../../src/options/SnapOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { TargetSpecificOptions } from \"../core\"\nimport { SnapcraftYAML } from \"../targets/snap/snapcraft\"\nimport { CommonLinuxOptions } from \"./linuxOptions\"\n\n/**\n * New-style snap configuration. Use this via the `snapcraft` key in your build config.\n * Selects the snapcraft core version and its per-core options.\n */\nexport interface SnapcraftOptions extends TargetSpecificOptions {\n /**\n * The snap base to use as the execution environment. Determines which set of per-core options\n * (`core18`, `core20`, `core22`, `core24`, `custom`) is active.\n *\n * Only one core may be selected per build target.\n */\n readonly base: \"core18\" | \"core20\" | \"core22\" | \"core24\" | \"custom\"\n\n /**\n * Snapcraft Store credentials — base64-encoded credentials string or file path.\n * Accepts the same formats as `WIN_CSC_LINK` / `CSC_LINK`: base64 data,\n * absolute/relative/`~/` file paths, and `file://` URIs.\n * Relative paths are resolved against the build resources directory.\n *\n * Injected as `SNAPCRAFT_STORE_CREDENTIALS` into every snapcraft subprocess\n * (core18/core20/core22/core24 builds and `snapcraft upload`).\n * Not applied for `base: \"custom\"` — inject credentials manually via environment variables.\n *\n * The `SNAP_CSC_LINK` environment variable is the CI-friendly alternative.\n * Generate with: `snapcraft export-login - | base64 -w0`\n */\n readonly cscLink?: string\n\n /**\n * Configuration for a core18 build. Only active when `base` is `\"core18\"`.\n */\n readonly core18?: SnapOptionsLegacy | null\n /**\n * Configuration for a core20 build. Only active when `base` is `\"core20\"`.\n */\n readonly core20?: SnapOptionsLegacy | null\n /**\n * Configuration for a core22 build. Only active when `base` is `\"core22\"`.\n */\n readonly core22?: SnapOptionsLegacy | null\n\n /**\n * **[Beta]** Options for building a core24 snap. Uses the snapcraft CLI directly.\n * Inherits desktop-entry fields from `CommonLinuxOptions` and publish config from `TargetSpecificOptions`.\n * @beta\n */\n readonly core24?: SnapOptions24 | null\n /**\n * **[Beta]** Pass-through custom snap configuration. electron-builder will read the\n * snapcraft.yaml at `yamlPath` and use it verbatim — no plugs, extensions,\n * organize mappings, or desktop files are injected.\n * @beta\n */\n readonly custom?: SnapOptionsCustom | null\n}\n// Internal alias used by the core18/20/22 backward-compat fields in SnapcraftOptions.\n// Not tagged @deprecated itself to avoid cascading TS6385 hints onto those properties.\nexport type SnapOptionsLegacy = Omit<SnapOptions, \"base\">\n\nexport interface SnapOptionsCustom {\n /**\n * Supports 2 routes:\n * - Path to an existing `snapcraft.yaml` file, relative to `buildResourcesDir`. electron-builder reads the file and passes it through without modification.\n * - A `SnapcraftYAML` object directly in the configuration. electron-builder uses the object to generate a `snapcraft.yaml` file, which is then passed through without modification.\n */\n readonly yaml?: string | SnapcraftYAML | null\n}\n\n/**\n * Flat snap options. Used via the `snap` key in your build config.\n *\n * @deprecated Prefer the `snapcraft` key with an explicit `base` field (e.g.\n * `{ \"snapcraft\": { \"base\": \"core24\", \"core24\": { ... } } }`). The flat `snap`\n * interface is maintained for backward compatibility and targets `core22` and\n * older snap bases only.\n *\n * Fields inherited from {@link CommonLinuxOptions} (e.g. `description`, `category`,\n * `mimeTypes`, `executableArgs`) are automatically populated from `linux.*` configuration\n * and do not need to be repeated here. Per-core values take precedence when both are set.\n */\nexport interface SnapOptions extends CommonLinuxOptions, TargetSpecificOptions {\n /**\n * The snap base to use as the execution environment.\n * Examples: `core18`, `core20`, `core22`.\n *\n * For new projects, use the `snapcraft` key with `base: \"core24\"` instead of\n * this legacy interface.\n */\n readonly base?: string | null\n\n /**\n * Whether to use the pre-built Electron snap template for faster builds.\n * When `true`, electron-builder delegates snap assembly to the upstream Electron snap\n * template rather than running a full snapcraft build, significantly reducing build time.\n * Defaults to `true` when `stagePackages` is not customised.\n * Only applicable to x64 and armv7l builds.\n */\n readonly useTemplateApp?: boolean\n\n /**\n * The type of [snap confinement](https://snapcraft.io/docs/reference/confinement).\n * - `strict` — recommended; the snap runs in a fully isolated sandbox.\n * - `devmode` — sandbox violations are logged but not enforced; for development only.\n * - `classic` — no confinement; equivalent to a traditionally packaged application.\n * Requires Snap Store approval before publishing.\n * @default strict\n */\n readonly confinement?: \"devmode\" | \"strict\" | \"classic\" | null\n\n /**\n * Environment variables injected into the snap's runtime environment.\n * Merged with the electron-builder default `{ TMPDIR: \"$XDG_RUNTIME_DIR\" }`.\n * User-supplied values take precedence.\n */\n readonly environment?: { [key: string]: string } | null\n\n /**\n * A short summary of the snap (max 78 characters).\n * Defaults to [productName](./configuration.md#productName).\n */\n readonly summary?: string | null\n\n /**\n * The quality grade of the snap.\n * - `stable` — suitable for all channels, including `stable` and `candidate`.\n * - `devel` — development snapshot; cannot be promoted to `stable` or `candidate`.\n * @default stable\n */\n readonly grade?: \"devel\" | \"stable\" | null\n\n /**\n * [Snapd features](https://snapcraft.io/docs/snapcraft-yaml-reference#assumes) that must\n * be present on the host before the snap can be installed.\n */\n readonly assumes?: Array<string> | string | null\n\n /**\n * Debian packages required at **build** time (installed inside the build environment).\n */\n readonly buildPackages?: Array<string> | null\n\n /**\n * Ubuntu packages to **stage** alongside the app (equivalent to `depends` for deb).\n * Defaults to `[\"libnspr4\", \"libnss3\", \"libxss1\", \"libappindicator3-1\", \"libsecret-1-0\"]`.\n *\n * Use the `\"default\"` keyword to extend the default list:\n * `[\"default\", \"my-extra-lib\"]` appends `my-extra-lib` to the defaults.\n */\n readonly stagePackages?: Array<string> | null\n\n /**\n * Directory containing [snap hooks](https://snapcraft.io/docs/snap-hooks), relative to\n * the build resources directory (`build/`).\n * @default build/snap-hooks\n */\n readonly hooks?: string | null\n\n /**\n * [Plugs](https://snapcraft.io/docs/reference/interfaces) (consumed interfaces) to declare\n * for the app entry point.\n * Defaults to `[\"desktop\", \"desktop-legacy\", \"home\", \"x11\", \"wayland\", \"unity7\",\n * \"browser-support\", \"network\", \"gsettings\", \"audio-playback\", \"pulseaudio\", \"opengl\"]`.\n *\n * Use `\"default\"` in the list to keep the defaults and append extras:\n * `[\"default\", \"camera\"]` adds `camera` to the standard set.\n *\n * To configure plug attributes (e.g. `allow-sandbox` for Chromium's internal sandbox),\n * use a descriptor object:\n * ```json\n * [\n * { \"browser-sandbox\": { \"interface\": \"browser-support\", \"allow-sandbox\": true } },\n * \"another-simple-plug-name\"\n * ]\n * ```\n */\n readonly plugs?: Array<string | PlugDescriptor> | PlugDescriptor | null\n\n /**\n * [Slots](https://snapcraft.io/docs/reference/interfaces) (provided interfaces) to declare\n * for the app.\n *\n * To expose an MPRIS player under the Chromium bus name (required for strict confinement):\n * ```json\n * [{ \"mpris\": { \"name\": \"chromium\" } }]\n * ```\n * Chromium [hard-codes](https://source.chromium.org/chromium/chromium/src/+/master:components/system_media_controls/linux/system_media_controls_linux.cc;l=51;bpv=0;bpt=1)\n * the bus name `chromium`, so the slot name must match for snapd to\n * [allow it](https://forum.snapcraft.io/t/unable-to-use-mpris-interface/15360/7).\n */\n readonly slots?: Array<string | SlotDescriptor> | SlotDescriptor | null\n\n /**\n * Names of snapcraft parts that must be built before the app part.\n * Defaults to `[\"desktop-gtk2\"]`.\n *\n * Use `\"default\"` to keep the default and add extras:\n * `[\"default\", \"my-helper-part\"]`.\n */\n readonly after?: Array<string> | null\n\n /**\n * Whether the snap should automatically start on login.\n * @default false\n */\n readonly autoStart?: boolean\n\n /**\n * [Snap layouts](https://snapcraft.io/docs/snap-layouts) — bind-mount or symlink host paths\n * into the snap's namespace, making libraries or config at `/usr`, `/var`, `/etc`, etc.\n * accessible inside the confined environment.\n */\n readonly layout?: { [key: string]: { [key: string]: string } } | null\n\n /**\n * Filesets controlling which files from the app part are staged into the snap.\n * Supports individual files, directories, globs, globstars, and exclusions (prefix `!`).\n * See [Snapcraft filesets](https://snapcraft.io/docs/snapcraft-filesets).\n * When not set, the snap template's default stage list is used for legacy bases (core18/core20/core22).\n */\n readonly appPartStage?: Array<string> | null\n\n /**\n * Display title for the snap (may contain uppercase letters and spaces).\n * Defaults to `productName`.\n * See [snap format](https://snapcraft.io/docs/snap-format).\n */\n readonly title?: string | null\n\n /**\n * Compression algorithm for the snap SquashFS image.\n * - `xz` — smaller file, slower decompression (good for distribution).\n * - `lzo` — larger file, faster decompression (good for development iteration).\n * Omit to use snapcraft's default (`xz`).\n *\n * When not set, `linux.compression` is mapped automatically:\n * `\"store\"` → `\"lzo\"`, `\"maximum\"` → `\"xz\"`, `\"normal\"` → snapcraft default.\n * Explicitly setting this field always overrides the mapped value.\n */\n readonly compression?: \"xz\" | \"lzo\" | null\n\n /**\n * Allow the snap to run with native Wayland support (`--ozone-platform=wayland`).\n * Defaults to `false` for Electron < 38 (legacy behaviour); `true` for Electron ≥ 38.\n * Set explicitly to override the version-based default.\n */\n readonly allowNativeWayland?: boolean | null\n}\n\n/**\n * Configuration for a remote snap build on [Launchpad](https://launchpad.net/).\n * Remote builds run on Canonical's infrastructure without requiring native hardware or nested virtualisation.\n *\n * Each electron-builder build invocation targets exactly one architecture — to build for multiple\n * architectures, configure the top-level `arch` option (e.g. `arch: [\"x64\", \"arm64\"]`); each arch\n * spawns a separate `snapcraft remote-build` job on Launchpad.\n *\n * Authentication is resolved in this order:\n * 1. `cscLink` config field — base64-encoded credentials or a file path\n * 2. `SNAP_CSC_LINK` environment variable — same format as `cscLink`\n * (CI-recommended; follows the same pattern as `WIN_CSC_LINK` for Windows code signing)\n * 3. `SNAPCRAFT_STORE_CREDENTIALS` environment variable (read directly by snapcraft)\n * 4. An active interactive `snapcraft login` session\n *\n * **CI setup** (set once as a CI secret):\n * ```sh\n * export SNAP_CSC_LINK=$(snapcraft export-login - | base64 -w0)\n * ```\n * The resolved credentials are injected only into the spawned `snapcraft` subprocess\n * environment and never exposed through `process.env`.\n */\nexport interface RemoteBuildOptions {\n /**\n * Whether to enable remote build on Launchpad. Must be set explicitly to `true` to opt in.\n */\n enabled: boolean\n\n /**\n * Your Launchpad username. Used to select the correct Launchpad account when more than\n * one set of credentials is available.\n */\n launchpadUsername?: string\n\n /**\n * Target architecture for the remote build. Accepts a single snapcraft arch string\n * (e.g. `\"amd64\"`, `\"arm64\"`, `\"armhf\"`).\n *\n * To build for multiple architectures, configure electron-builder's top-level `arch` option\n * (e.g. `arch: [\"x64\", \"arm64\"]`) — each arch spawns a separate remote-build job on Launchpad,\n * keeping the one-build-per-artifact contract intact.\n * @example \"amd64\"\n */\n buildFor?: string\n\n /**\n * Suppress the Launchpad public-upload consent prompt by automatically accepting it.\n * Your source code will be uploaded to a **public** Launchpad repository.\n * Set to `true` in CI once you understand the implications.\n */\n acceptPublicUpload?: boolean\n\n /**\n * Launchpad project name to use for a **private** source upload.\n * The project must already exist and you must have write access.\n */\n privateProject?: string\n\n /**\n * Resume a previously interrupted remote build rather than starting a new one.\n */\n recover?: boolean\n\n /**\n * Maximum time in seconds to wait for the remote build to complete before aborting.\n * Passed to `snapcraft remote-build` as `--timeout <seconds>`.\n *\n * @example 1800 // 30 minutes\n */\n timeout?: number\n\n /**\n * Controls whether snapcraft may fall back to a different remote build strategy.\n * - `\"disable-fallback\"` — always use the primary strategy, fail if unavailable.\n * - `\"force-fallback\"` — always use the fallback strategy.\n */\n strategy?: \"disable-fallback\" | \"force-fallback\"\n}\n\n/**\n * **[Beta]** Options for building a core24 snap. This interface does not extend the legacy\n * `SnapBaseOptions` — it uses the snapcraft CLI directly.\n *\n * Fields inherited from {@link CommonLinuxOptions} (`description`, `category`, `mimeTypes`,\n * `executableArgs`, `desktop`, `synopsis`) are automatically populated from the root `linux.*`\n * configuration. You do not need to duplicate them here; values set directly on this interface\n * take precedence over the cascaded `linux.*` values.\n *\n * @beta\n */\nexport interface SnapOptions24 extends CommonLinuxOptions, TargetSpecificOptions {\n // ─── Build environment (mutually exclusive) ─────────────────────────────────\n\n /**\n * Use [LXD](https://canonical.com/lxd) as the isolated build environment.\n * Preferred over Multipass on most Linux CI systems where nested virtualisation is unavailable.\n * Mutually exclusive with `useMultipass` and `useDestructiveMode`.\n */\n readonly useLXD?: boolean | null\n\n /**\n * Use [Multipass](https://multipass.run/) as the isolated build environment.\n * Mutually exclusive with `useLXD` and `useDestructiveMode`.\n */\n readonly useMultipass?: boolean | null\n\n /**\n * Build directly on the host without an isolated VM or container (snapcraft `--destructive-mode`).\n * Equivalent to setting `SNAPCRAFT_BUILD_ENVIRONMENT=host`.\n *\n * **Not recommended for most use cases.** Destructive mode pollutes the host environment\n * and produces builds that are difficult to reproduce — any library or tool present on the\n * host at build time can silently end up in the snap. Prefer `useLXD` or `useMultipass`\n * for clean, reproducible builds; use `remoteBuild` for multi-architecture CI.\n *\n * Valid reasons to enable this option:\n * - Building inside a Docker container where nested virtualisation (LXD / Multipass) is\n * unavailable and a remote Launchpad build is not acceptable.\n * - Running test suites in CI where the environment is already fully controlled.\n *\n * The `gnome` extension is incompatible with this mode enabled — do not include it in `extensions`.\n * @see https://snapcraft.io/docs/build-options\n */\n readonly useDestructiveMode?: boolean | null\n\n /**\n * Configuration for a remote build on [Launchpad](https://launchpad.net/).\n * Enables cross-architecture builds in CI without native hardware or nested virtualisation.\n * Each build invocation targets one arch; use `arch: [\"x64\", \"arm64\"]` to build for multiple.\n */\n readonly remoteBuild?: RemoteBuildOptions | null\n\n // ─── Snapcraft extensions ────────────────────────────────────────────────────\n\n /**\n * [Snapcraft extensions](https://snapcraft.io/docs/snapcraft-extensions) to apply to the app.\n * Defaults to `[\"gnome\"]` in normal builds (recommended for Electron apps on Ubuntu 24.04+).\n * Automatically set to `[]` in `useDestructiveMode` builds, where the gnome extension is\n * incompatible. Explicitly including `\"gnome\"` while `useDestructiveMode` is set will throw.\n * See: https://snapcraft.io/docs/gnome-extension\n */\n readonly extensions?: Array<string> | null\n\n // ─── Snap metadata ───────────────────────────────────────────────────────────\n\n /**\n * The type of [confinement](https://snapcraft.io/docs/reference/confinement) supported by the snap.\n * @default strict\n */\n readonly confinement?: \"devmode\" | \"strict\" | \"classic\" | null\n\n /**\n * The quality grade of the snap.\n * `devel` — not publishable to stable/candidate channels.\n * `stable` — suitable for all channels.\n * @default stable\n */\n readonly grade?: \"devel\" | \"stable\" | null\n\n /**\n * A short summary of the snap (max 78 characters). Defaults to `productName`.\n */\n readonly summary?: string | null\n\n /**\n * An optional display title (may contain uppercase letters and spaces). Defaults to `productName`.\n * See [snap format](https://snapcraft.io/docs/snap-format).\n */\n readonly title?: string | null\n\n /**\n * Compression algorithm for the snap SquashFS image.\n * - `xz` — smaller file, slower decompression (recommended for distribution).\n * - `lzo` — larger file, faster decompression (useful for development iteration).\n * Omit to use snapcraft's default (`xz`).\n *\n * When not set, `linux.compression` is mapped automatically:\n * `\"store\"` → `\"lzo\"`, `\"maximum\"` → `\"xz\"`, `\"normal\"` → snapcraft default.\n * Explicitly setting this field always overrides the mapped value.\n */\n readonly compression?: \"xz\" | \"lzo\" | null\n\n /**\n * Features that must be supported by the host snapd before the snap can be installed.\n * See [assumes](https://snapcraft.io/docs/snapcraft-yaml-reference#assumes).\n */\n readonly assumes?: Array<string> | string | null\n\n // ─── Build packages / stage packages ────────────────────────────────────────\n\n /**\n * Debian packages required at **build** time (installed inside the build environment).\n */\n readonly buildPackages?: Array<string> | null\n\n /**\n * Ubuntu packages to **stage** alongside the app (equivalent to `depends` for deb).\n * Defaults to `[\"libnspr4\", \"libnss3\", \"libxss1\", \"libappindicator3-1\", \"libsecret-1-0\"]`.\n * Supports the `\"default\"` keyword to reference the default list:\n * `[\"default\", \"my-extra-lib\"]` appends `my-extra-lib` to the defaults.\n */\n readonly stagePackages?: Array<string> | null\n\n /**\n * Filesets controlling which files from the app part are staged into the snap.\n * Supports glob patterns and exclusions. See [filesets](https://snapcraft.io/docs/snapcraft-filesets).\n */\n readonly appPartStage?: Array<string> | null\n\n /**\n * Names of other snapcraft parts that must be built before the app part.\n */\n readonly after?: Array<string> | null\n\n // ─── Snap interfaces ─────────────────────────────────────────────────────────\n\n /**\n * [Plugs](https://snapcraft.io/docs/reference/interfaces) (consumed interfaces) for the app.\n * When the `gnome` extension is active, content-snap plugs (themes, GNOME platform, GPU)\n * are added automatically — only list custom plugs here.\n * Without any extension, defaults to the standard Electron plug set.\n *\n * Supports descriptor objects for plugs with attributes:\n * ```json\n * [{ \"browser-sandbox\": { \"interface\": \"browser-support\", \"allow-sandbox\": true } }]\n * ```\n */\n readonly plugs?: Array<string | PlugDescriptor> | PlugDescriptor | null\n\n /**\n * [Slots](https://snapcraft.io/docs/reference/interfaces) (provided interfaces) for the app.\n * Use for MPRIS, D-Bus services, etc.\n *\n * Example — expose MPRIS under the Chromium bus name:\n * ```json\n * [{ \"mpris\": { \"name\": \"chromium\" } }]\n * ```\n */\n readonly slots?: Array<string | SlotDescriptor> | SlotDescriptor | null\n\n /**\n * [Snap layouts](https://snapcraft.io/docs/snap-layouts) — bind-mount or symlink host paths\n * into the snap's namespace. User-provided layouts always override the extension defaults.\n */\n readonly layout?: { [key: string]: { [key: string]: string } } | null\n\n // ─── Runtime environment ─────────────────────────────────────────────────────\n\n /**\n * Additional environment variables injected into the snap's runtime environment.\n * Merged with the electron-builder defaults (`TMPDIR=$XDG_RUNTIME_DIR`).\n * User-supplied values take precedence.\n */\n readonly environment?: { [key: string]: string } | null\n\n /**\n * Whether the app should auto-start on login (creates an autostart desktop entry).\n * @default false\n */\n readonly autoStart?: boolean\n\n /**\n * Set to `true` to force X11 by injecting `--ozone-platform=x11` into the snap command line.\n * When unset or `false`, no flag is injected and native Wayland is allowed.\n * Unlike the legacy `snap.allowNativeWayland`, there is no electron-version-based default here —\n * core24 always allows Wayland unless this is explicitly `true`.\n */\n readonly forceX11?: boolean | null\n\n // ─── Hooks ───────────────────────────────────────────────────────────────────\n\n /**\n * Directory containing [snap hooks](https://snapcraft.io/docs/snap-hooks), relative to\n * the build resources directory.\n * @default build/snap-hooks\n */\n readonly hooks?: string | null\n}\n\n/**\n * Maps a named plug to its attribute object.\n * `null` uses snapd defaults for that interface.\n *\n * @example\n * ```json\n * { \"browser-sandbox\": { \"interface\": \"browser-support\", \"allow-sandbox\": true } }\n * ```\n */\nexport interface PlugDescriptor {\n [key: string]: { [key: string]: any } | null\n}\n\n/**\n * Maps a named slot to its attribute object.\n * `null` uses snapd defaults for that interface.\n *\n * @example\n * ```json\n * { \"mpris\": { \"name\": \"chromium\" } }\n * ```\n */\nexport interface SlotDescriptor {\n [key: string]: { [key: string]: any } | null\n}\n"]}
@@ -50,6 +50,14 @@ export interface LinuxConfiguration extends CommonLinuxOptions, PlatformSpecific
50
50
  */
51
51
  readonly icon?: string;
52
52
  }
53
+ /**
54
+ * Desktop-entry and runtime fields shared by all Linux targets and all snap core strategies.
55
+ *
56
+ * Fields set under `linux.*` in your build config (i.e. on {@link LinuxConfiguration}) are
57
+ * automatically cascaded into each snap core's options by `LinuxTargetHelper.getSnapCore()`.
58
+ * You do not need to duplicate them under `snapcraft.core24.*`, `snapcraft.core22.*`, etc.
59
+ * Per-core values always take precedence when both are set.
60
+ */
53
61
  export interface CommonLinuxOptions {
54
62
  /**
55
63
  * The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).