app-builder-lib 27.0.0-alpha.4 → 27.0.0-alpha.6
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/appInfo.d.ts +1 -1
- package/dist/appInfo.d.ts.map +1 -1
- package/dist/appInfo.js +3 -3
- package/dist/appInfo.js.map +1 -1
- package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
- package/dist/codeSign/mac/macCodeSign.js +3 -6
- package/dist/codeSign/mac/macCodeSign.js.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.js +6 -4
- package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.js +31 -21
- package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
- package/dist/configuration.d.ts +84 -44
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js +11 -1
- package/dist/configuration.js.map +1 -1
- package/dist/electron/ElectronFramework.d.ts +2 -1
- package/dist/electron/ElectronFramework.d.ts.map +1 -1
- package/dist/electron/ElectronFramework.js +32 -28
- package/dist/electron/ElectronFramework.js.map +1 -1
- package/dist/electron/electronArchSupport.d.ts +12 -0
- package/dist/electron/electronArchSupport.d.ts.map +1 -0
- package/dist/electron/electronArchSupport.js +58 -0
- package/dist/electron/electronArchSupport.js.map +1 -0
- package/dist/electron/electronVersion.d.ts.map +1 -1
- package/dist/electron/electronVersion.js +1 -11
- package/dist/electron/electronVersion.js.map +1 -1
- package/dist/electron/mac/electronMac.js +12 -21
- package/dist/electron/mac/electronMac.js.map +1 -1
- package/dist/electron/mac/electronMacUtils.d.ts +24 -0
- package/dist/electron/mac/electronMacUtils.d.ts.map +1 -0
- package/dist/electron/mac/electronMacUtils.js +42 -0
- package/dist/electron/mac/electronMacUtils.js.map +1 -0
- package/dist/fileMatcher.d.ts +27 -2
- package/dist/fileMatcher.d.ts.map +1 -1
- package/dist/fileMatcher.js +204 -16
- package/dist/fileMatcher.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/indexInternal.d.ts +8 -5
- package/dist/indexInternal.d.ts.map +1 -1
- package/dist/indexInternal.js +8 -4
- package/dist/indexInternal.js.map +1 -1
- package/dist/macPackager.d.ts.map +1 -1
- package/dist/macPackager.js +15 -3
- package/dist/macPackager.js.map +1 -1
- package/dist/node-module-collector/moduleManager.d.ts +3 -1
- package/dist/node-module-collector/moduleManager.d.ts.map +1 -1
- package/dist/node-module-collector/moduleManager.js +9 -1
- package/dist/node-module-collector/moduleManager.js.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.d.ts +17 -1
- package/dist/node-module-collector/nodeModulesCollector.d.ts.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.js +67 -1
- package/dist/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.js +5 -5
- package/dist/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
- package/dist/node-module-collector/types.d.ts +2 -0
- package/dist/node-module-collector/types.d.ts.map +1 -1
- package/dist/node-module-collector/types.js.map +1 -1
- package/dist/options/MsixOptions.d.ts +126 -0
- package/dist/options/MsixOptions.d.ts.map +1 -0
- package/dist/options/MsixOptions.js +2 -0
- package/dist/options/MsixOptions.js.map +1 -0
- package/dist/options/PlatformSpecificBuildOptions.d.ts +0 -6
- package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/options/SnapOptions.d.ts +15 -13
- package/dist/options/SnapOptions.d.ts.map +1 -1
- package/dist/options/SnapOptions.js.map +1 -1
- package/dist/options/macOptions.d.ts +4 -4
- package/dist/options/macOptions.d.ts.map +1 -1
- package/dist/options/macOptions.js.map +1 -1
- package/dist/options/winOptions.d.ts +166 -36
- package/dist/options/winOptions.d.ts.map +1 -1
- package/dist/options/winOptions.js.map +1 -1
- package/dist/packager.d.ts +2 -0
- package/dist/packager.d.ts.map +1 -1
- package/dist/packager.js +26 -21
- package/dist/packager.js.map +1 -1
- package/dist/platformPackager.d.ts +2 -0
- package/dist/platformPackager.d.ts.map +1 -1
- package/dist/platformPackager.js +6 -0
- package/dist/platformPackager.js.map +1 -1
- package/dist/publish/PublishManager.d.ts +1 -0
- package/dist/publish/PublishManager.d.ts.map +1 -1
- package/dist/publish/PublishManager.js +20 -6
- package/dist/publish/PublishManager.js.map +1 -1
- package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
- package/dist/publish/updateInfoBuilder.js +20 -22
- package/dist/publish/updateInfoBuilder.js.map +1 -1
- package/dist/targets/archive.d.ts +11 -0
- package/dist/targets/archive.d.ts.map +1 -1
- package/dist/targets/archive.js +40 -22
- package/dist/targets/archive.js.map +1 -1
- package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
- package/dist/targets/linux/FpmTarget.js +3 -3
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.d.ts.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.js +5 -6
- package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
- package/dist/targets/linux/snap/SnapTarget.d.ts +1 -1
- package/dist/targets/linux/snap/SnapTarget.d.ts.map +1 -1
- package/dist/targets/linux/snap/SnapTarget.js +23 -1
- package/dist/targets/linux/snap/SnapTarget.js.map +1 -1
- package/dist/targets/linux/snap/core24.d.ts +1 -1
- package/dist/targets/linux/snap/core24.d.ts.map +1 -1
- package/dist/targets/linux/snap/core24.js +3 -2
- package/dist/targets/linux/snap/core24.js.map +1 -1
- package/dist/targets/linux/snap/coreCustom.d.ts +1 -1
- package/dist/targets/linux/snap/coreCustom.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreCustom.js +2 -2
- package/dist/targets/linux/snap/coreCustom.js.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.d.ts +1 -1
- package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.js +2 -1
- package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
- package/dist/targets/linux/snap/snapcraft.d.ts +190 -0
- package/dist/targets/linux/snap/snapcraft.d.ts.map +1 -0
- package/dist/targets/linux/snap/snapcraft.js +11 -0
- package/dist/targets/linux/snap/snapcraft.js.map +1 -0
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts +7 -1
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts.map +1 -1
- package/dist/targets/linux/snap/snapcraftBuilder.js +57 -20
- package/dist/targets/linux/snap/snapcraftBuilder.js.map +1 -1
- package/dist/targets/mac/MacTargetHelper.d.ts +6 -0
- package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
- package/dist/targets/mac/MacTargetHelper.js +22 -1
- package/dist/targets/mac/MacTargetHelper.js.map +1 -1
- package/dist/targets/targetFactory.d.ts +7 -0
- package/dist/targets/targetFactory.d.ts.map +1 -1
- package/dist/targets/targetFactory.js +28 -0
- package/dist/targets/targetFactory.js.map +1 -1
- package/dist/targets/win/AppxTarget.d.ts +0 -2
- package/dist/targets/win/AppxTarget.d.ts.map +1 -1
- package/dist/targets/win/AppxTarget.js +37 -317
- package/dist/targets/win/AppxTarget.js.map +1 -1
- package/dist/targets/win/MsixTarget.d.ts +22 -0
- package/dist/targets/win/MsixTarget.d.ts.map +1 -0
- package/dist/targets/win/MsixTarget.js +214 -0
- package/dist/targets/win/MsixTarget.js.map +1 -0
- package/dist/targets/win/nsis/NsisTarget.d.ts +3 -2
- package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.js +28 -46
- package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.js +2 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.js.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.d.ts +5 -2
- package/dist/targets/win/nsis/nsisUtil.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.js +46 -22
- package/dist/targets/win/nsis/nsisUtil.js.map +1 -1
- package/dist/targets/win/nsis/progId.d.ts +21 -0
- package/dist/targets/win/nsis/progId.d.ts.map +1 -0
- package/dist/targets/win/nsis/progId.js +60 -0
- package/dist/targets/win/nsis/progId.js.map +1 -0
- package/dist/targets/win/winAppUtil.d.ts +115 -0
- package/dist/targets/win/winAppUtil.d.ts.map +1 -0
- package/dist/targets/win/winAppUtil.js +407 -0
- package/dist/targets/win/winAppUtil.js.map +1 -0
- package/dist/toolsets/7zip.d.ts.map +1 -1
- package/dist/toolsets/7zip.js +3 -1
- package/dist/toolsets/7zip.js.map +1 -1
- package/dist/toolsets/appimage.d.ts +3 -3
- package/dist/toolsets/appimage.d.ts.map +1 -1
- package/dist/toolsets/appimage.js +9 -6
- package/dist/toolsets/appimage.js.map +1 -1
- package/dist/toolsets/custom.d.ts +1 -3
- package/dist/toolsets/custom.d.ts.map +1 -1
- package/dist/toolsets/custom.js +4 -133
- package/dist/toolsets/custom.js.map +1 -1
- package/dist/toolsets/fpm.d.ts.map +1 -1
- package/dist/toolsets/fpm.js +11 -5
- package/dist/toolsets/fpm.js.map +1 -1
- package/dist/toolsets/icons.d.ts.map +1 -1
- package/dist/toolsets/icons.js +4 -1
- package/dist/toolsets/icons.js.map +1 -1
- package/dist/toolsets/linuxToolsMac.d.ts.map +1 -1
- package/dist/toolsets/linuxToolsMac.js +4 -1
- package/dist/toolsets/linuxToolsMac.js.map +1 -1
- package/dist/toolsets/nsis.d.ts.map +1 -1
- package/dist/toolsets/nsis.js +6 -3
- package/dist/toolsets/nsis.js.map +1 -1
- package/dist/toolsets/version.d.ts +12 -0
- package/dist/toolsets/version.d.ts.map +1 -0
- package/dist/toolsets/version.js +13 -0
- package/dist/toolsets/version.js.map +1 -0
- package/dist/toolsets/winCodeSign.d.ts +20 -3
- package/dist/toolsets/winCodeSign.d.ts.map +1 -1
- package/dist/toolsets/winCodeSign.js +56 -27
- package/dist/toolsets/winCodeSign.js.map +1 -1
- package/dist/toolsets/wine.d.ts +2 -1
- package/dist/toolsets/wine.d.ts.map +1 -1
- package/dist/toolsets/wine.js +15 -13
- package/dist/toolsets/wine.js.map +1 -1
- package/dist/util/NodeModuleCopyHelper.js +3 -3
- package/dist/util/NodeModuleCopyHelper.js.map +1 -1
- package/dist/util/appFileCopier.d.ts +39 -0
- package/dist/util/appFileCopier.d.ts.map +1 -1
- package/dist/util/appFileCopier.js +88 -22
- package/dist/util/appFileCopier.js.map +1 -1
- package/dist/util/config/config.d.ts +1 -0
- package/dist/util/config/config.d.ts.map +1 -1
- package/dist/util/config/config.js +4 -1
- package/dist/util/config/config.js.map +1 -1
- package/dist/util/config/load.d.ts +2 -2
- package/dist/util/config/load.d.ts.map +1 -1
- package/dist/util/config/load.js +3 -12
- package/dist/util/config/load.js.map +1 -1
- package/dist/util/config/schemaValidator.js +1 -1
- package/dist/util/config/schemaValidator.js.map +1 -1
- package/dist/util/electronGet.d.ts +6 -3
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +40 -20
- package/dist/util/electronGet.js.map +1 -1
- package/dist/util/flags.d.ts +0 -2
- package/dist/util/flags.d.ts.map +1 -1
- package/dist/util/flags.js +0 -6
- package/dist/util/flags.js.map +1 -1
- package/dist/util/hash.d.ts +1 -1
- package/dist/util/hash.d.ts.map +1 -1
- package/dist/util/hash.js +1 -15
- package/dist/util/hash.js.map +1 -1
- package/dist/util/packageMetadata.js +0 -10
- package/dist/util/packageMetadata.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/vm/ParallelsVm.d.ts.map +1 -1
- package/dist/vm/ParallelsVm.js +18 -5
- package/dist/vm/ParallelsVm.js.map +1 -1
- package/dist/winPackager.d.ts.map +1 -1
- package/dist/winPackager.js +3 -0
- package/dist/winPackager.js.map +1 -1
- package/package.json +8 -8
- package/scheme.json +556 -133
- package/templates/appx/appxmanifest.xml +1 -1
- package/templates/msix/appxmanifest.xml +45 -0
- package/templates/nsis/installSection.nsh +14 -0
|
@@ -3,8 +3,8 @@ import { TargetConfigType } from "../core.js";
|
|
|
3
3
|
import { PlatformSpecificBuildOptions } from "./PlatformSpecificBuildOptions.js";
|
|
4
4
|
export interface WindowsConfiguration extends PlatformSpecificBuildOptions {
|
|
5
5
|
/**
|
|
6
|
-
* The target package type: list of `nsis`, `nsis-web` (Web installer), `portable` ([portable]https://www.electron.build/nsis#portable)
|
|
7
|
-
* AppX
|
|
6
|
+
* The target package type: list of `nsis`, `nsis-web` (Web installer), `portable` ([portable app](https://www.electron.build/nsis#portable) without installation), `appx`, `msix`, `msi`, `msi-wrapped`, `squirrel`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.
|
|
7
|
+
* AppX and MSIX packages can be built on Windows 10 or Windows Server 2012 R2 (version 6.3+) or later, and on macOS via Parallels Desktop.
|
|
8
8
|
*
|
|
9
9
|
* To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.
|
|
10
10
|
*
|
|
@@ -21,25 +21,50 @@ export interface WindowsConfiguration extends PlatformSpecificBuildOptions {
|
|
|
21
21
|
*/
|
|
22
22
|
readonly legalTrademarks?: string | null;
|
|
23
23
|
/**
|
|
24
|
-
* Code signing configuration.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
24
|
+
* Code signing configuration. Code signing stamps every installer and executable
|
|
25
|
+
* electron-builder produces with an Authenticode signature, so that Windows (SmartScreen / UAC)
|
|
26
|
+
* and your auto-updater can verify the publisher and that the files were not tampered with.
|
|
27
|
+
*
|
|
28
|
+
* How this option behaves:
|
|
29
|
+
* - Leave **unset** to sign using credentials discovered from the environment — primarily a
|
|
30
|
+
* certificate supplied via `WIN_CSC_LINK` (or `CSC_LINK`) with its password in
|
|
31
|
+
* `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`). `WIN_CSC_LINK` accepts a file path, an
|
|
32
|
+
* `https://` URL, or a base64-encoded certificate. This is the recommended setup for CI.
|
|
33
|
+
* - Set to `false` or `null` to **disable** code signing entirely (executable resources such as
|
|
34
|
+
* the icon and metadata are still edited).
|
|
35
|
+
* - Set to an **object** to configure signing explicitly. The `type` field selects the signing
|
|
36
|
+
* backend (`signtool` is the implicit default) and dispatches to a dedicated sign manager;
|
|
37
|
+
* provide exactly one of the modes below. Each output artifact is signed individually, and by
|
|
38
|
+
* default executables are dual-signed (see `signingHashAlgorithms`).
|
|
28
39
|
*
|
|
29
40
|
* - `{ type: "signtool", ... }` — Sign with a local certificate file (.pfx/.p12) or a
|
|
30
|
-
* certificate from the Windows certificate store.
|
|
41
|
+
* certificate from the Windows certificate store. Uses Microsoft `signtool.exe` on Windows and
|
|
42
|
+
* `osslsigncode` on macOS/Linux.
|
|
31
43
|
* - `{ type: "hsm", ... }` — Sign using a Hardware Security Module (HSM) or FIPS-compliant
|
|
32
44
|
* hardware token via signtool's `/csp` (cryptographic service provider) and `/kc` (key
|
|
33
|
-
* container) flags. Requires `
|
|
45
|
+
* container) flags. Requires a modern `winCodeSign` toolset (the default — only the legacy
|
|
46
|
+
* `"0.0.0"` pin is unsupported). Windows-only.
|
|
34
47
|
* - `{ type: "pkcs11", ... }` — Sign using a PKCS#11 hardware token via osslsigncode.
|
|
35
48
|
* Available on macOS and Linux CI without a Windows VM.
|
|
36
49
|
* - `{ type: "azure", ... }` — Sign via Azure Trusted Signing (cloud service). Requires
|
|
37
50
|
* Azure Entra ID environment variables for authentication.
|
|
51
|
+
*
|
|
52
|
+
* See [Code Signing](https://www.electron.build/code-signing).
|
|
38
53
|
*/
|
|
39
54
|
readonly sign?: WindowsSigningConfiguration | false | null;
|
|
40
55
|
/**
|
|
41
|
-
* Whether
|
|
42
|
-
*
|
|
56
|
+
* Whether the NSIS auto-updater should verify the Authenticode signature of a downloaded update
|
|
57
|
+
* before installing it. This is a **runtime** check performed by your app via electron-updater,
|
|
58
|
+
* not a build-time check.
|
|
59
|
+
*
|
|
60
|
+
* When enabled (the default), the resolved [publisher name](#publisherName) is embedded into
|
|
61
|
+
* `app-update.yml` at build time. At update time electron-updater inspects the certificate that
|
|
62
|
+
* signed the downloaded installer and compares its subject (Distinguished Name / Common Name)
|
|
63
|
+
* against that publisher name, refusing to install on a mismatch. This prevents a tampered or
|
|
64
|
+
* maliciously substituted update from being installed.
|
|
65
|
+
*
|
|
66
|
+
* Set to `false` to skip verification — in which case the publisher name is **not** embedded.
|
|
67
|
+
* Disable this only if your updates are not Authenticode-signed.
|
|
43
68
|
*
|
|
44
69
|
* @default true
|
|
45
70
|
*/
|
|
@@ -51,63 +76,146 @@ export interface WindowsConfiguration extends PlatformSpecificBuildOptions {
|
|
|
51
76
|
*/
|
|
52
77
|
readonly requestedExecutionLevel?: RequestedExecutionLevel | null;
|
|
53
78
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
79
|
+
* Additional file name suffixes to code sign, beyond the default. By default electron-builder
|
|
80
|
+
* only signs `.exe` files; list extra suffixes here to also sign e.g. `.dll`, `.node`, or
|
|
81
|
+
* specific file names. Advanced option — most apps do not need it.
|
|
82
|
+
*
|
|
83
|
+
* Each entry is matched with `String.endsWith`, so both bare extensions (`".dll"`) and full file
|
|
84
|
+
* names (`"mybinary.dll"`) work. Prefix a pattern with `!` to *exclude* a suffix that would
|
|
85
|
+
* otherwise be signed. Positive patterns are evaluated first, then negative ones. For example,
|
|
86
|
+
* `["somefilename", ".dll", "!.appx"]` signs `.dll` files (and anything ending in `somefilename`)
|
|
87
|
+
* but never signs `.appx` files.
|
|
88
|
+
*
|
|
56
89
|
* @see https://github.com/electron-userland/electron-builder/issues/7329
|
|
57
90
|
* @default null
|
|
58
91
|
*/
|
|
59
92
|
readonly signExts?: string[] | null;
|
|
60
93
|
}
|
|
61
94
|
export type RequestedExecutionLevel = "asInvoker" | "highestAvailable" | "requireAdministrator";
|
|
95
|
+
/**
|
|
96
|
+
* Options shared by every certificate-based signing mode (`signtool`, `hsm`, `pkcs11`). These
|
|
97
|
+
* control the signature itself — publisher identity, digest algorithms, timestamping, and the
|
|
98
|
+
* extra certificates added to the signature block — independently of where the private key lives.
|
|
99
|
+
*/
|
|
62
100
|
interface WindowsSigningSharedOptions {
|
|
63
101
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
102
|
+
* The publisher name(s) to associate with the signature, written exactly as the subject appears
|
|
103
|
+
* in your code signing certificate. May be a single string or an array — an array is useful when
|
|
104
|
+
* rotating certificates, so updates signed by either the old or the new certificate still verify.
|
|
105
|
+
*
|
|
106
|
+
* This value is not a `signtool` argument; it is consumed in two places:
|
|
107
|
+
* - **Update verification** — when [verifyUpdateCodeSignature](#verifyUpdateCodeSignature) is
|
|
108
|
+
* enabled, it is written into `app-update.yml` and electron-updater checks it against the
|
|
109
|
+
* certificate that signed each downloaded update.
|
|
110
|
+
* - **AppX / MSIX identity** — the package `Publisher` attribute must equal the certificate
|
|
111
|
+
* subject, so electron-builder derives it from this value (or the certificate) to keep them
|
|
112
|
+
* in sync; a mismatch makes packaging fail with `ERROR_BAD_FORMAT`.
|
|
113
|
+
*
|
|
114
|
+
* Defaults to the Common Name (CN) extracted from your code signing certificate. Set to `null`
|
|
115
|
+
* to opt out.
|
|
116
|
+
*
|
|
117
|
+
* @see https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073
|
|
66
118
|
*/
|
|
67
119
|
readonly publisherName?: string | Array<string> | null;
|
|
68
120
|
/**
|
|
69
|
-
*
|
|
121
|
+
* The digest (hash) algorithms to sign with, applied via signtool's `/fd` flag (or
|
|
122
|
+
* osslsigncode's `-h`). One signing pass runs per entry, in order; listing more than one
|
|
123
|
+
* **dual-signs** the file, with each additional signature appended as a nested signature
|
|
124
|
+
* (signtool `/as`). Signing with both `sha1` and `sha256` lets a single binary validate on
|
|
125
|
+
* legacy (pre-SHA-2) Windows as well as modern Windows.
|
|
126
|
+
*
|
|
127
|
+
* Some targets override this: `.msi` cannot be dual-signed (a single hash is used) and AppX/MSIX
|
|
128
|
+
* is always `sha256` only.
|
|
129
|
+
*
|
|
70
130
|
* @default ['sha1', 'sha256']
|
|
71
131
|
*/
|
|
72
132
|
readonly signingHashAlgorithms?: Array<"sha1" | "sha256"> | null;
|
|
73
133
|
/**
|
|
74
|
-
* The URL of the RFC 3161
|
|
134
|
+
* The URL of the [RFC 3161](https://www.ietf.org/rfc/rfc3161.txt) timestamp server, used for
|
|
135
|
+
* SHA-256 and nested/appended signatures (signtool's `/tr` flag). Timestamping records *when*
|
|
136
|
+
* the file was signed so the signature stays valid after the signing certificate expires.
|
|
137
|
+
* Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE=true`.
|
|
138
|
+
*
|
|
75
139
|
* @default http://timestamp.digicert.com
|
|
76
140
|
*/
|
|
77
141
|
readonly rfc3161TimeStampServer?: string | null;
|
|
78
142
|
/**
|
|
79
|
-
* The URL of the
|
|
143
|
+
* The URL of the legacy Authenticode timestamp server, used for SHA-1 signatures (signtool's
|
|
144
|
+
* `/t` flag). This is also the timestamp server used by `osslsigncode` (`-t`) when signing on
|
|
145
|
+
* macOS/Linux. See [rfc3161TimeStampServer](#rfc3161TimeStampServer) for SHA-256 / nested
|
|
146
|
+
* signatures. Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE=true`.
|
|
147
|
+
*
|
|
80
148
|
* @default http://timestamp.digicert.com
|
|
81
149
|
*/
|
|
82
150
|
readonly timeStampServer?: string | null;
|
|
83
151
|
/**
|
|
84
|
-
*
|
|
152
|
+
* Path to an additional certificate file (typically an intermediate / cross-signing CA
|
|
153
|
+
* certificate) whose contents are added to the signature block via signtool's `/ac` flag. Use
|
|
154
|
+
* this when the signing certificate's full chain is not already present on target machines and
|
|
155
|
+
* you want it embedded in the signature so the chain can be validated.
|
|
85
156
|
*/
|
|
86
157
|
readonly additionalCertificateFile?: string | null;
|
|
87
158
|
/**
|
|
88
|
-
*
|
|
159
|
+
* A custom signing hook that **replaces** electron-builder's built-in `signtool` /
|
|
160
|
+
* `osslsigncode` invocation. Provide a function, or the path / module id of a file that exports
|
|
161
|
+
* a `sign` function (resolved relative to the project, then as a module).
|
|
162
|
+
*
|
|
163
|
+
* The hook is invoked once per signing pass (i.e. once per entry in
|
|
164
|
+
* [signingHashAlgorithms](#signingHashAlgorithms)) and receives a configuration object describing
|
|
165
|
+
* the file to sign (`path`), the resolved certificate info (`cscInfo`), the current `hash`, and
|
|
166
|
+
* whether this pass is a nested signature (`isNest`), plus a `computeSignToolArgs(isWin)` helper
|
|
167
|
+
* that returns the default arguments electron-builder would otherwise have used. Use this to
|
|
168
|
+
* integrate an external or cloud signing service. See
|
|
169
|
+
* [Code Signing](https://www.electron.build/code-signing).
|
|
89
170
|
*/
|
|
90
171
|
readonly sign?: CustomWindowsSign | string | null;
|
|
91
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Sign with a certificate file (`.pfx` / `.p12`) or with a certificate from the Windows
|
|
175
|
+
* certificate store, using Microsoft `signtool.exe` on Windows and `osslsigncode` on macOS/Linux.
|
|
176
|
+
* This is the default mode when `win.sign` is unset. Supply the certificate one of four ways:
|
|
177
|
+
* a file via `certificateFile` (or the `WIN_CSC_LINK` env var), or a store lookup via
|
|
178
|
+
* `certificateSubjectName` or `certificateSha1`.
|
|
179
|
+
*/
|
|
92
180
|
export interface WindowsSigntoolSigningConfig extends WindowsSigningSharedOptions {
|
|
181
|
+
/** Discriminator selecting the default file/store signing mode. */
|
|
93
182
|
readonly type: "signtool";
|
|
94
183
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
184
|
+
* Path to the PKCS#12 certificate file (`.pfx` or `.p12`) holding both the signing certificate
|
|
185
|
+
* and its private key. Passed to signtool via `/f` (or osslsigncode via `-pkcs12`).
|
|
186
|
+
*
|
|
187
|
+
* Prefer supplying this out-of-band via the `WIN_CSC_LINK` (or `CSC_LINK`) environment variable
|
|
188
|
+
* instead of hardcoding a path — that variable also accepts an `https://` URL or a base64-encoded
|
|
189
|
+
* certificate, which is safer and more convenient on CI. See
|
|
190
|
+
* [Code Signing](https://www.electron.build/code-signing).
|
|
97
191
|
*/
|
|
98
192
|
readonly certificateFile?: string | null;
|
|
99
193
|
/**
|
|
100
|
-
* The password
|
|
101
|
-
*
|
|
194
|
+
* The password protecting the private key in `certificateFile`. Passed to signtool via `/p`
|
|
195
|
+
* (or osslsigncode via `-pass`).
|
|
196
|
+
*
|
|
197
|
+
* Prefer the `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`) environment variable so the secret
|
|
198
|
+
* never lands in your build configuration.
|
|
102
199
|
*/
|
|
103
200
|
readonly certificatePassword?: string | null;
|
|
104
201
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
202
|
+
* Select the signing certificate from the Windows certificate store by (a substring of) its
|
|
203
|
+
* subject name, instead of pointing at a `.pfx` file. electron-builder enumerates the installed
|
|
204
|
+
* code-signing certificates, picks the match, and signs by its thumbprint
|
|
205
|
+
* (`/sha1 <thumbprint> /s <store>`). **Required for EV (Extended Validation) certificates**,
|
|
206
|
+
* whose private keys live on a hardware token and cannot be exported to a file.
|
|
207
|
+
*
|
|
208
|
+
* Works only on Windows (or macOS with Parallels Desktop, via the bundled Windows VM).
|
|
107
209
|
*/
|
|
108
210
|
readonly certificateSubjectName?: string | null;
|
|
109
211
|
/**
|
|
110
|
-
*
|
|
212
|
+
* Select the signing certificate from the Windows certificate store by its SHA-1 thumbprint,
|
|
213
|
+
* instead of pointing at a `.pfx` file. electron-builder looks the certificate up in the store
|
|
214
|
+
* and signs with `/sha1 <thumbprint> /s <store>`. Like
|
|
215
|
+
* [certificateSubjectName](#certificateSubjectName), this suits EV certificates backed by a
|
|
216
|
+
* hardware token; if both are set, both must resolve to the same certificate.
|
|
217
|
+
*
|
|
218
|
+
* Works only on Windows (or macOS with Parallels Desktop, via the bundled Windows VM).
|
|
111
219
|
*/
|
|
112
220
|
readonly certificateSha1?: string | null;
|
|
113
221
|
}
|
|
@@ -116,6 +224,7 @@ export interface WindowsSigntoolSigningConfig extends WindowsSigningSharedOption
|
|
|
116
224
|
* real-hardware test coverage is limited.
|
|
117
225
|
*/
|
|
118
226
|
export interface WindowsHsmSigningConfig extends WindowsSigningSharedOptions {
|
|
227
|
+
/** Discriminator selecting HSM / hardware-token signing via signtool's `/csp` and `/kc` flags. */
|
|
119
228
|
readonly type: "hsm";
|
|
120
229
|
/**
|
|
121
230
|
* The name of the cryptographic service provider (CSP) that holds the private key.
|
|
@@ -123,7 +232,8 @@ export interface WindowsHsmSigningConfig extends WindowsSigningSharedOptions {
|
|
|
123
232
|
* - Google Cloud KMS: `"Google Cloud KMS Provider"`
|
|
124
233
|
* - Smart card / FIPS token: `"Microsoft Base Smart Card Crypto Provider"`
|
|
125
234
|
*
|
|
126
|
-
* Requires `
|
|
235
|
+
* Requires a modern `winCodeSign` toolset (the default; only the legacy `"0.0.0"` pin is
|
|
236
|
+
* unsupported). Windows-only — use `type: "pkcs11"` on macOS/Linux.
|
|
127
237
|
*/
|
|
128
238
|
readonly cryptoServiceProvider: string;
|
|
129
239
|
/**
|
|
@@ -139,19 +249,31 @@ export interface WindowsHsmSigningConfig extends WindowsSigningSharedOptions {
|
|
|
139
249
|
*/
|
|
140
250
|
readonly certificateFile?: string | null;
|
|
141
251
|
/**
|
|
142
|
-
*
|
|
252
|
+
* Alternative to `certificateFile`: locate the public certificate in the Windows certificate
|
|
253
|
+
* store by its SHA-1 thumbprint. The private key still comes from the HSM via
|
|
254
|
+
* `cryptoServiceProvider` / `keyContainer`; this only identifies which public certificate to sign
|
|
255
|
+
* with.
|
|
143
256
|
*/
|
|
144
257
|
readonly certificateSha1?: string | null;
|
|
145
258
|
/**
|
|
146
|
-
*
|
|
259
|
+
* Alternative to `certificateFile`: locate the public certificate in the Windows certificate
|
|
260
|
+
* store by (a substring of) its subject name. The private key still comes from the HSM via
|
|
261
|
+
* `cryptoServiceProvider` / `keyContainer`; this only identifies which public certificate to sign
|
|
262
|
+
* with.
|
|
147
263
|
*/
|
|
148
264
|
readonly certificateSubjectName?: string | null;
|
|
149
265
|
}
|
|
150
266
|
/**
|
|
267
|
+
* Sign with a PKCS#11 hardware token (smart card, USB HSM, cloud KMS exposed via a PKCS#11
|
|
268
|
+
* provider) using `osslsigncode`. Unlike `hsm`, this mode does **not** require Windows or a
|
|
269
|
+
* Windows VM, so it can sign Windows binaries directly from macOS/Linux CI. The token PIN is read
|
|
270
|
+
* from the `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`) environment variable.
|
|
271
|
+
*
|
|
151
272
|
* @beta PKCS#11 signing is available in v27 as a beta feature. The interface is stable but
|
|
152
273
|
* real-hardware test coverage is limited.
|
|
153
274
|
*/
|
|
154
275
|
export interface WindowsPkcs11SigningConfig extends WindowsSigningSharedOptions {
|
|
276
|
+
/** Discriminator selecting cross-platform PKCS#11 token signing via `osslsigncode`. */
|
|
155
277
|
readonly type: "pkcs11";
|
|
156
278
|
/**
|
|
157
279
|
* Path to the PKCS#11 shared library (`.so` on Linux, `.dylib` on macOS).
|
|
@@ -178,14 +300,19 @@ export interface WindowsPkcs11SigningConfig extends WindowsSigningSharedOptions
|
|
|
178
300
|
readonly certificateFile?: string | null;
|
|
179
301
|
}
|
|
180
302
|
/**
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
* `"0.0.0"`) remains supported for migration.
|
|
303
|
+
* The `signtool /dlib` Azure Trusted Signing integration was introduced in `toolsets.winCodeSign: 1.3.0`.
|
|
304
|
+
* The legacy PowerShell integration is deprecated, but leverages the same underlying Azure APIs, so both interfaces share the same config shape.
|
|
184
305
|
*/
|
|
185
306
|
export interface WindowsAzureSigningConfig {
|
|
307
|
+
/** Discriminator selecting Azure Trusted Signing (cloud signing — no local certificate). */
|
|
186
308
|
readonly type: "azure";
|
|
187
309
|
/**
|
|
188
|
-
*
|
|
310
|
+
* The publisher name to associate with the signature, exactly as it appears in the certificate
|
|
311
|
+
* issued by your Trusted Signing certificate profile. Required. Used for
|
|
312
|
+
* [update verification](#verifyUpdateCodeSignature) (embedded in `app-update.yml` and checked by
|
|
313
|
+
* electron-updater) and must match the certificate subject.
|
|
314
|
+
*
|
|
315
|
+
* @see https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073
|
|
189
316
|
*/
|
|
190
317
|
readonly publisherName: string;
|
|
191
318
|
/**
|
|
@@ -197,15 +324,18 @@ export interface WindowsAzureSigningConfig {
|
|
|
197
324
|
*/
|
|
198
325
|
readonly endpoint: string;
|
|
199
326
|
/**
|
|
200
|
-
* The Certificate Profile
|
|
327
|
+
* The name of the Trusted Signing Certificate Profile to sign with, as created in your Azure
|
|
328
|
+
* Code Signing Account. Maps to the DLib metadata field `CertificateProfileName`.
|
|
201
329
|
*/
|
|
202
330
|
readonly certificateProfileName: string;
|
|
203
331
|
/**
|
|
204
|
-
* The Code Signing Account
|
|
332
|
+
* The name of the Azure Trusted Signing (Code Signing) Account that owns the certificate profile.
|
|
333
|
+
* Maps to the DLib metadata field `CodeSigningAccountName`.
|
|
205
334
|
*/
|
|
206
335
|
readonly codeSigningAccountName: string;
|
|
207
336
|
/**
|
|
208
|
-
* The
|
|
337
|
+
* The digest algorithm used to hash the files being signed. Maps to the DLib metadata field
|
|
338
|
+
* `FileDigest`.
|
|
209
339
|
* @default SHA256
|
|
210
340
|
*/
|
|
211
341
|
readonly fileDigest?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"winOptions.d.ts","sourceRoot":"","sources":["../../src/options/winOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC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AkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrD;AAID,MAAM,MAAM,2BAA2B,GAAG,4BAA4B,GAAG,uBAAuB,GAAG,0BAA0B,GAAG,yBAAyB,CAAA;AAEzJ,uEAAuE;AACvE,MAAM,MAAM,2BAA2B,GAAG,4BAA4B,GAAG,uBAAuB,GAAG,0BAA0B,CAAA;AAE7H;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,oBAAoB,GAAG,2BAA2B,GAAG,IAAI,CAGnH;AAED,0FAA0F;AAC1F,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAE9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"winOptions.js","sourceRoot":"","sources":["../../src/options/winOptions.ts"],"names":[],"mappings":"AA4RA;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAAC,MAA4B;IAC7E,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;IACvB,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,wBAAwB,CAAC,MAA4B;IACnE,OAAO,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,CAAA;AACtD,CAAC","sourcesContent":["import { CustomWindowsSign } from \"../codeSign/win/windowsSignToolManager.js\"\nimport { TargetConfigType } from \"../core.js\"\nimport { PlatformSpecificBuildOptions } from \"./PlatformSpecificBuildOptions.js\"\n\nexport interface WindowsConfiguration extends PlatformSpecificBuildOptions {\n /**\n * The target package type: list of `nsis`, `nsis-web` (Web installer), `portable` ([portable]https://www.electron.build/nsis#portable) app without installation), `appx`, `msi`, `msi-wrapped`, `squirrel`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n * AppX package can be built only on Windows 10.\n *\n * To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.\n *\n * @default nsis\n */\n readonly target?: TargetConfigType\n\n /**\n * The path to application icon.\n * @default build/icon.ico\n */\n readonly icon?: string | null\n\n /**\n * The trademarks and registered trademarks.\n */\n readonly legalTrademarks?: string | null\n\n /**\n * Code signing configuration. Set to `false` or `null` to disable Windows code signing\n * (executable resources such as the icon and metadata are still edited). Leave unset to\n * sign using credentials discovered from the environment (e.g. `WIN_CSC_LINK`). Otherwise\n * provide exactly one of the following signing modes:\n *\n * - `{ type: \"signtool\", ... }` — Sign with a local certificate file (.pfx/.p12) or a\n * certificate from the Windows certificate store.\n * - `{ type: \"hsm\", ... }` — Sign using a Hardware Security Module (HSM) or FIPS-compliant\n * hardware token via signtool's `/csp` (cryptographic service provider) and `/kc` (key\n * container) flags. Requires `toolsets.winCodeSign: \"1.x\"`. Windows-only.\n * - `{ type: \"pkcs11\", ... }` — Sign using a PKCS#11 hardware token via osslsigncode.\n * Available on macOS and Linux CI without a Windows VM.\n * - `{ type: \"azure\", ... }` — Sign via Azure Trusted Signing (cloud service). Requires\n * Azure Entra ID environment variables for authentication.\n */\n readonly sign?: WindowsSigningConfiguration | false | null\n\n /**\n * Whether to verify the signature of an available update before installation.\n * The [publisher name](#publisherName) will be used for the signature verification.\n *\n * @default true\n */\n readonly verifyUpdateCodeSignature?: boolean\n\n /**\n * The [security level](https://msdn.microsoft.com/en-us/library/6ad1fshk.aspx#Anchor_9) at which the application requests to be executed.\n * Cannot be specified per target, allowed only in the `win`.\n * @default asInvoker\n */\n readonly requestedExecutionLevel?: RequestedExecutionLevel | null\n\n /**\n * Explicit file name/extensions (`str.endsWith`) to also sign. Advanced option.\n * Supports negative patterns, e.g. example that excludes `.appx` files: `[\"somefilename\", \".dll\", \"!.appx\"]`.\n * @see https://github.com/electron-userland/electron-builder/issues/7329\n * @default null\n */\n readonly signExts?: string[] | null\n}\n\nexport type RequestedExecutionLevel = \"asInvoker\" | \"highestAvailable\" | \"requireAdministrator\"\n\n// ─── Shared base for signtool-family signing modes ───────────────────────────\n\ninterface WindowsSigningSharedOptions {\n /**\n * [The publisher name](https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073), exactly as in your code signed certificate. Several names can be provided.\n * Defaults to common name from your code signing certificate.\n */\n readonly publisherName?: string | Array<string> | null\n\n /**\n * Array of signing algorithms used. For AppX `sha256` is always used.\n * @default ['sha1', 'sha256']\n */\n readonly signingHashAlgorithms?: Array<\"sha1\" | \"sha256\"> | null\n\n /**\n * The URL of the RFC 3161 time stamp server.\n * @default http://timestamp.digicert.com\n */\n readonly rfc3161TimeStampServer?: string | null\n\n /**\n * The URL of the time stamp server.\n * @default http://timestamp.digicert.com\n */\n readonly timeStampServer?: string | null\n\n /**\n * The path to an additional certificate file you want to add to the signature block.\n */\n readonly additionalCertificateFile?: string | null\n\n /**\n * The custom function (or path to file or module id) to sign Windows executables.\n */\n readonly sign?: CustomWindowsSign | string | null\n}\n\n// ─── Signing mode: signtool (file or Windows certificate store) ──────────────\n\nexport interface WindowsSigntoolSigningConfig extends WindowsSigningSharedOptions {\n readonly type: \"signtool\"\n\n /**\n * The path to the *.pfx or *.p12 certificate file. Prefer the `WIN_CSC_LINK` environment\n * variable when possible. See [Code Signing](https://www.electron.build/code-signing).\n */\n readonly certificateFile?: string | null\n\n /**\n * The password to the certificate provided in `certificateFile`. Prefer the\n * `WIN_CSC_KEY_PASSWORD` environment variable when possible.\n */\n readonly certificatePassword?: string | null\n\n /**\n * The name of the subject of the signing certificate. Required for EV Code Signing.\n * Works only on Windows (or macOS with Parallels Desktop).\n */\n readonly certificateSubjectName?: string | null\n\n /**\n * The SHA1 hash of the signing certificate. Works only on Windows (or macOS with Parallels Desktop).\n */\n readonly certificateSha1?: string | null\n}\n\n// ─── Signing mode: hsm (Hardware Security Module via signtool /csp /kc) ──────\n\n/**\n * @beta HSM signing is available in v27 as a beta feature. The interface is stable but\n * real-hardware test coverage is limited.\n */\nexport interface WindowsHsmSigningConfig extends WindowsSigningSharedOptions {\n readonly type: \"hsm\"\n\n /**\n * The name of the cryptographic service provider (CSP) that holds the private key.\n * Maps to signtool's `/csp` flag. Examples:\n * - Google Cloud KMS: `\"Google Cloud KMS Provider\"`\n * - Smart card / FIPS token: `\"Microsoft Base Smart Card Crypto Provider\"`\n *\n * Requires `toolsets.winCodeSign: \"1.x\"`. Windows-only — use `type: \"pkcs11\"` on macOS/Linux.\n */\n readonly cryptoServiceProvider: string\n\n /**\n * The key container name within the CSP. Maps to signtool's `/kc` flag.\n *\n * Example for Google Cloud KMS:\n * `\"projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME/cryptoKeyVersions/1\"`\n */\n readonly keyContainer: string\n\n /**\n * Path to the certificate file containing the public certificate chain (.crt / .cer / .pfx).\n * The private key is NOT read from this file — it is provided by the HSM via `cryptoServiceProvider`.\n */\n readonly certificateFile?: string | null\n\n /**\n * The SHA1 thumbprint of the certificate in the Windows certificate store.\n */\n readonly certificateSha1?: string | null\n\n /**\n * The subject name of the certificate in the Windows certificate store.\n */\n readonly certificateSubjectName?: string | null\n}\n\n// ─── Signing mode: pkcs11 (cross-platform PKCS#11 via osslsigncode) ──────────\n\n/**\n * @beta PKCS#11 signing is available in v27 as a beta feature. The interface is stable but\n * real-hardware test coverage is limited.\n */\nexport interface WindowsPkcs11SigningConfig extends WindowsSigningSharedOptions {\n readonly type: \"pkcs11\"\n\n /**\n * Path to the PKCS#11 shared library (`.so` on Linux, `.dylib` on macOS).\n * The library must be installed separately — electron-builder does not bundle it.\n *\n * Example: `\"/usr/lib/x86_64-linux-gnu/opensc-pkcs11.so\"`\n *\n * Must be paired with `pkcs11KeyUri`.\n */\n readonly pkcs11Module: string\n\n /**\n * RFC 7512 PKCS#11 URI identifying the private key within the module.\n * Maps to osslsigncode's `-key` parameter.\n *\n * Example: `\"pkcs11:token=MyToken;object=MyKey;type=private\"`\n *\n * Must be paired with `pkcs11Module`.\n */\n readonly pkcs11KeyUri: string\n\n /**\n * Optional path to a certificate chain file to accompany the PKCS#11 key.\n * If omitted the certificate embedded in the token is used.\n */\n readonly certificateFile?: string | null\n}\n\n// ─── Signing mode: azure (Azure Trusted Signing) ──────────────────────────────\n\n/**\n * @beta The `signtool /dlib` Azure Trusted Signing integration introduced in v27 is a beta\n * feature. The legacy PowerShell fallback (triggered when `toolsets.winCodeSign` is unset or\n * `\"0.0.0\"`) remains supported for migration.\n */\nexport interface WindowsAzureSigningConfig {\n readonly type: \"azure\"\n\n /**\n * [The publisher name](https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073), exactly as in your code signed certificate. Several names can be provided.\n */\n readonly publisherName: string\n\n /**\n * The Trusted Signing Account endpoint. The URI value must align to the region your Trusted\n * Signing Account and Certificate Profile were created in.\n *\n * Requires Azure Entra ID environment variables per\n * [Microsoft's documentation](https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition).\n */\n readonly endpoint: string\n\n /**\n * The Certificate Profile name. Translates to field: CertificateProfileName.\n */\n readonly certificateProfileName: string\n\n /**\n * The Code Signing Account name. Translates to field: CodeSigningAccountName.\n */\n readonly codeSigningAccountName: string\n\n /**\n * The file digest algorithm. Translates to field: FileDigest.\n * @default SHA256\n */\n readonly fileDigest?: string\n\n /**\n * The RFC3161 timestamp server. Translates to field: TimestampRfc3161.\n * @default http://timestamp.acs.microsoft.com\n */\n readonly timestampRfc3161?: string\n\n /**\n * The timestamp digest algorithm. Translates to field: TimestampDigest.\n * @default SHA256\n */\n readonly timestampDigest?: string\n\n /**\n * Additional fields to include verbatim in the `metadata.json` file passed to\n * `Azure.CodeSigning.Dlib.dll` via `signtool /dmdf`. Use this for DLib-specific options\n * not covered by the typed fields above (e.g. `ExcludeCredentials`, `CorrelationId`).\n */\n readonly additionalMetadata?: Record<string, string>\n}\n\n// ─── Discriminated union ──────────────────────────────────────────────────────\n\nexport type WindowsSigningConfiguration = WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | WindowsPkcs11SigningConfig | WindowsAzureSigningConfig\n\n/** Signing modes that use signtool.exe or osslsigncode (not Azure). */\nexport type WindowsSigntoolFamilyConfig = WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | WindowsPkcs11SigningConfig\n\n/**\n * Resolves the active signing configuration object. `false`, `null`, and unset all mean\n * \"no explicit signing config object\" (env-based discovery still applies when unset).\n */\nexport function resolveWindowsSigningConfiguration(config: WindowsConfiguration): WindowsSigningConfiguration | null {\n const { sign } = config\n return sign == null || sign === false ? null : sign\n}\n\n/** Whether Windows code signing has been explicitly disabled via `sign: false | null`. */\nexport function isWindowsSigningDisabled(config: WindowsConfiguration): boolean {\n return config.sign === false || config.sign === null\n}\n"]}
|
|
1
|
+
{"version":3,"file":"winOptions.js","sourceRoot":"","sources":["../../src/options/winOptions.ts"],"names":[],"mappings":"AA8ZA;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAAC,MAA4B;IAC7E,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;IACvB,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,wBAAwB,CAAC,MAA4B;IACnE,OAAO,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,CAAA;AACtD,CAAC","sourcesContent":["import { CustomWindowsSign } from \"../codeSign/win/windowsSignToolManager.js\"\nimport { TargetConfigType } from \"../core.js\"\nimport { PlatformSpecificBuildOptions } from \"./PlatformSpecificBuildOptions.js\"\n\nexport interface WindowsConfiguration extends PlatformSpecificBuildOptions {\n /**\n * The target package type: list of `nsis`, `nsis-web` (Web installer), `portable` ([portable app](https://www.electron.build/nsis#portable) without installation), `appx`, `msix`, `msi`, `msi-wrapped`, `squirrel`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n * AppX and MSIX packages can be built on Windows 10 or Windows Server 2012 R2 (version 6.3+) or later, and on macOS via Parallels Desktop.\n *\n * To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.\n *\n * @default nsis\n */\n readonly target?: TargetConfigType\n\n /**\n * The path to application icon.\n * @default build/icon.ico\n */\n readonly icon?: string | null\n\n /**\n * The trademarks and registered trademarks.\n */\n readonly legalTrademarks?: string | null\n\n /**\n * Code signing configuration. Code signing stamps every installer and executable\n * electron-builder produces with an Authenticode signature, so that Windows (SmartScreen / UAC)\n * and your auto-updater can verify the publisher and that the files were not tampered with.\n *\n * How this option behaves:\n * - Leave **unset** to sign using credentials discovered from the environment — primarily a\n * certificate supplied via `WIN_CSC_LINK` (or `CSC_LINK`) with its password in\n * `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`). `WIN_CSC_LINK` accepts a file path, an\n * `https://` URL, or a base64-encoded certificate. This is the recommended setup for CI.\n * - Set to `false` or `null` to **disable** code signing entirely (executable resources such as\n * the icon and metadata are still edited).\n * - Set to an **object** to configure signing explicitly. The `type` field selects the signing\n * backend (`signtool` is the implicit default) and dispatches to a dedicated sign manager;\n * provide exactly one of the modes below. Each output artifact is signed individually, and by\n * default executables are dual-signed (see `signingHashAlgorithms`).\n *\n * - `{ type: \"signtool\", ... }` — Sign with a local certificate file (.pfx/.p12) or a\n * certificate from the Windows certificate store. Uses Microsoft `signtool.exe` on Windows and\n * `osslsigncode` on macOS/Linux.\n * - `{ type: \"hsm\", ... }` — Sign using a Hardware Security Module (HSM) or FIPS-compliant\n * hardware token via signtool's `/csp` (cryptographic service provider) and `/kc` (key\n * container) flags. Requires a modern `winCodeSign` toolset (the default — only the legacy\n * `\"0.0.0\"` pin is unsupported). Windows-only.\n * - `{ type: \"pkcs11\", ... }` — Sign using a PKCS#11 hardware token via osslsigncode.\n * Available on macOS and Linux CI without a Windows VM.\n * - `{ type: \"azure\", ... }` — Sign via Azure Trusted Signing (cloud service). Requires\n * Azure Entra ID environment variables for authentication.\n *\n * See [Code Signing](https://www.electron.build/code-signing).\n */\n readonly sign?: WindowsSigningConfiguration | false | null\n\n /**\n * Whether the NSIS auto-updater should verify the Authenticode signature of a downloaded update\n * before installing it. This is a **runtime** check performed by your app via electron-updater,\n * not a build-time check.\n *\n * When enabled (the default), the resolved [publisher name](#publisherName) is embedded into\n * `app-update.yml` at build time. At update time electron-updater inspects the certificate that\n * signed the downloaded installer and compares its subject (Distinguished Name / Common Name)\n * against that publisher name, refusing to install on a mismatch. This prevents a tampered or\n * maliciously substituted update from being installed.\n *\n * Set to `false` to skip verification — in which case the publisher name is **not** embedded.\n * Disable this only if your updates are not Authenticode-signed.\n *\n * @default true\n */\n readonly verifyUpdateCodeSignature?: boolean\n\n /**\n * The [security level](https://msdn.microsoft.com/en-us/library/6ad1fshk.aspx#Anchor_9) at which the application requests to be executed.\n * Cannot be specified per target, allowed only in the `win`.\n * @default asInvoker\n */\n readonly requestedExecutionLevel?: RequestedExecutionLevel | null\n\n /**\n * Additional file name suffixes to code sign, beyond the default. By default electron-builder\n * only signs `.exe` files; list extra suffixes here to also sign e.g. `.dll`, `.node`, or\n * specific file names. Advanced option — most apps do not need it.\n *\n * Each entry is matched with `String.endsWith`, so both bare extensions (`\".dll\"`) and full file\n * names (`\"mybinary.dll\"`) work. Prefix a pattern with `!` to *exclude* a suffix that would\n * otherwise be signed. Positive patterns are evaluated first, then negative ones. For example,\n * `[\"somefilename\", \".dll\", \"!.appx\"]` signs `.dll` files (and anything ending in `somefilename`)\n * but never signs `.appx` files.\n *\n * @see https://github.com/electron-userland/electron-builder/issues/7329\n * @default null\n */\n readonly signExts?: string[] | null\n}\n\nexport type RequestedExecutionLevel = \"asInvoker\" | \"highestAvailable\" | \"requireAdministrator\"\n\n// ─── Shared base for signtool-family signing modes ───────────────────────────\n\n/**\n * Options shared by every certificate-based signing mode (`signtool`, `hsm`, `pkcs11`). These\n * control the signature itself — publisher identity, digest algorithms, timestamping, and the\n * extra certificates added to the signature block — independently of where the private key lives.\n */\ninterface WindowsSigningSharedOptions {\n /**\n * The publisher name(s) to associate with the signature, written exactly as the subject appears\n * in your code signing certificate. May be a single string or an array — an array is useful when\n * rotating certificates, so updates signed by either the old or the new certificate still verify.\n *\n * This value is not a `signtool` argument; it is consumed in two places:\n * - **Update verification** — when [verifyUpdateCodeSignature](#verifyUpdateCodeSignature) is\n * enabled, it is written into `app-update.yml` and electron-updater checks it against the\n * certificate that signed each downloaded update.\n * - **AppX / MSIX identity** — the package `Publisher` attribute must equal the certificate\n * subject, so electron-builder derives it from this value (or the certificate) to keep them\n * in sync; a mismatch makes packaging fail with `ERROR_BAD_FORMAT`.\n *\n * Defaults to the Common Name (CN) extracted from your code signing certificate. Set to `null`\n * to opt out.\n *\n * @see https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073\n */\n readonly publisherName?: string | Array<string> | null\n\n /**\n * The digest (hash) algorithms to sign with, applied via signtool's `/fd` flag (or\n * osslsigncode's `-h`). One signing pass runs per entry, in order; listing more than one\n * **dual-signs** the file, with each additional signature appended as a nested signature\n * (signtool `/as`). Signing with both `sha1` and `sha256` lets a single binary validate on\n * legacy (pre-SHA-2) Windows as well as modern Windows.\n *\n * Some targets override this: `.msi` cannot be dual-signed (a single hash is used) and AppX/MSIX\n * is always `sha256` only.\n *\n * @default ['sha1', 'sha256']\n */\n readonly signingHashAlgorithms?: Array<\"sha1\" | \"sha256\"> | null\n\n /**\n * The URL of the [RFC 3161](https://www.ietf.org/rfc/rfc3161.txt) timestamp server, used for\n * SHA-256 and nested/appended signatures (signtool's `/tr` flag). Timestamping records *when*\n * the file was signed so the signature stays valid after the signing certificate expires.\n * Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE=true`.\n *\n * @default http://timestamp.digicert.com\n */\n readonly rfc3161TimeStampServer?: string | null\n\n /**\n * The URL of the legacy Authenticode timestamp server, used for SHA-1 signatures (signtool's\n * `/t` flag). This is also the timestamp server used by `osslsigncode` (`-t`) when signing on\n * macOS/Linux. See [rfc3161TimeStampServer](#rfc3161TimeStampServer) for SHA-256 / nested\n * signatures. Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE=true`.\n *\n * @default http://timestamp.digicert.com\n */\n readonly timeStampServer?: string | null\n\n /**\n * Path to an additional certificate file (typically an intermediate / cross-signing CA\n * certificate) whose contents are added to the signature block via signtool's `/ac` flag. Use\n * this when the signing certificate's full chain is not already present on target machines and\n * you want it embedded in the signature so the chain can be validated.\n */\n readonly additionalCertificateFile?: string | null\n\n /**\n * A custom signing hook that **replaces** electron-builder's built-in `signtool` /\n * `osslsigncode` invocation. Provide a function, or the path / module id of a file that exports\n * a `sign` function (resolved relative to the project, then as a module).\n *\n * The hook is invoked once per signing pass (i.e. once per entry in\n * [signingHashAlgorithms](#signingHashAlgorithms)) and receives a configuration object describing\n * the file to sign (`path`), the resolved certificate info (`cscInfo`), the current `hash`, and\n * whether this pass is a nested signature (`isNest`), plus a `computeSignToolArgs(isWin)` helper\n * that returns the default arguments electron-builder would otherwise have used. Use this to\n * integrate an external or cloud signing service. See\n * [Code Signing](https://www.electron.build/code-signing).\n */\n readonly sign?: CustomWindowsSign | string | null\n}\n\n// ─── Signing mode: signtool (file or Windows certificate store) ──────────────\n\n/**\n * Sign with a certificate file (`.pfx` / `.p12`) or with a certificate from the Windows\n * certificate store, using Microsoft `signtool.exe` on Windows and `osslsigncode` on macOS/Linux.\n * This is the default mode when `win.sign` is unset. Supply the certificate one of four ways:\n * a file via `certificateFile` (or the `WIN_CSC_LINK` env var), or a store lookup via\n * `certificateSubjectName` or `certificateSha1`.\n */\nexport interface WindowsSigntoolSigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting the default file/store signing mode. */\n readonly type: \"signtool\"\n\n /**\n * Path to the PKCS#12 certificate file (`.pfx` or `.p12`) holding both the signing certificate\n * and its private key. Passed to signtool via `/f` (or osslsigncode via `-pkcs12`).\n *\n * Prefer supplying this out-of-band via the `WIN_CSC_LINK` (or `CSC_LINK`) environment variable\n * instead of hardcoding a path — that variable also accepts an `https://` URL or a base64-encoded\n * certificate, which is safer and more convenient on CI. See\n * [Code Signing](https://www.electron.build/code-signing).\n */\n readonly certificateFile?: string | null\n\n /**\n * The password protecting the private key in `certificateFile`. Passed to signtool via `/p`\n * (or osslsigncode via `-pass`).\n *\n * Prefer the `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`) environment variable so the secret\n * never lands in your build configuration.\n */\n readonly certificatePassword?: string | null\n\n /**\n * Select the signing certificate from the Windows certificate store by (a substring of) its\n * subject name, instead of pointing at a `.pfx` file. electron-builder enumerates the installed\n * code-signing certificates, picks the match, and signs by its thumbprint\n * (`/sha1 <thumbprint> /s <store>`). **Required for EV (Extended Validation) certificates**,\n * whose private keys live on a hardware token and cannot be exported to a file.\n *\n * Works only on Windows (or macOS with Parallels Desktop, via the bundled Windows VM).\n */\n readonly certificateSubjectName?: string | null\n\n /**\n * Select the signing certificate from the Windows certificate store by its SHA-1 thumbprint,\n * instead of pointing at a `.pfx` file. electron-builder looks the certificate up in the store\n * and signs with `/sha1 <thumbprint> /s <store>`. Like\n * [certificateSubjectName](#certificateSubjectName), this suits EV certificates backed by a\n * hardware token; if both are set, both must resolve to the same certificate.\n *\n * Works only on Windows (or macOS with Parallels Desktop, via the bundled Windows VM).\n */\n readonly certificateSha1?: string | null\n}\n\n// ─── Signing mode: hsm (Hardware Security Module via signtool /csp /kc) ──────\n\n/**\n * @beta HSM signing is available in v27 as a beta feature. The interface is stable but\n * real-hardware test coverage is limited.\n */\nexport interface WindowsHsmSigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting HSM / hardware-token signing via signtool's `/csp` and `/kc` flags. */\n readonly type: \"hsm\"\n\n /**\n * The name of the cryptographic service provider (CSP) that holds the private key.\n * Maps to signtool's `/csp` flag. Examples:\n * - Google Cloud KMS: `\"Google Cloud KMS Provider\"`\n * - Smart card / FIPS token: `\"Microsoft Base Smart Card Crypto Provider\"`\n *\n * Requires a modern `winCodeSign` toolset (the default; only the legacy `\"0.0.0\"` pin is\n * unsupported). Windows-only — use `type: \"pkcs11\"` on macOS/Linux.\n */\n readonly cryptoServiceProvider: string\n\n /**\n * The key container name within the CSP. Maps to signtool's `/kc` flag.\n *\n * Example for Google Cloud KMS:\n * `\"projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME/cryptoKeyVersions/1\"`\n */\n readonly keyContainer: string\n\n /**\n * Path to the certificate file containing the public certificate chain (.crt / .cer / .pfx).\n * The private key is NOT read from this file — it is provided by the HSM via `cryptoServiceProvider`.\n */\n readonly certificateFile?: string | null\n\n /**\n * Alternative to `certificateFile`: locate the public certificate in the Windows certificate\n * store by its SHA-1 thumbprint. The private key still comes from the HSM via\n * `cryptoServiceProvider` / `keyContainer`; this only identifies which public certificate to sign\n * with.\n */\n readonly certificateSha1?: string | null\n\n /**\n * Alternative to `certificateFile`: locate the public certificate in the Windows certificate\n * store by (a substring of) its subject name. The private key still comes from the HSM via\n * `cryptoServiceProvider` / `keyContainer`; this only identifies which public certificate to sign\n * with.\n */\n readonly certificateSubjectName?: string | null\n}\n\n// ─── Signing mode: pkcs11 (cross-platform PKCS#11 via osslsigncode) ──────────\n\n/**\n * Sign with a PKCS#11 hardware token (smart card, USB HSM, cloud KMS exposed via a PKCS#11\n * provider) using `osslsigncode`. Unlike `hsm`, this mode does **not** require Windows or a\n * Windows VM, so it can sign Windows binaries directly from macOS/Linux CI. The token PIN is read\n * from the `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`) environment variable.\n *\n * @beta PKCS#11 signing is available in v27 as a beta feature. The interface is stable but\n * real-hardware test coverage is limited.\n */\nexport interface WindowsPkcs11SigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting cross-platform PKCS#11 token signing via `osslsigncode`. */\n readonly type: \"pkcs11\"\n\n /**\n * Path to the PKCS#11 shared library (`.so` on Linux, `.dylib` on macOS).\n * The library must be installed separately — electron-builder does not bundle it.\n *\n * Example: `\"/usr/lib/x86_64-linux-gnu/opensc-pkcs11.so\"`\n *\n * Must be paired with `pkcs11KeyUri`.\n */\n readonly pkcs11Module: string\n\n /**\n * RFC 7512 PKCS#11 URI identifying the private key within the module.\n * Maps to osslsigncode's `-key` parameter.\n *\n * Example: `\"pkcs11:token=MyToken;object=MyKey;type=private\"`\n *\n * Must be paired with `pkcs11Module`.\n */\n readonly pkcs11KeyUri: string\n\n /**\n * Optional path to a certificate chain file to accompany the PKCS#11 key.\n * If omitted the certificate embedded in the token is used.\n */\n readonly certificateFile?: string | null\n}\n\n// ─── Signing mode: azure (Azure Trusted Signing) ──────────────────────────────\n\n/**\n * The `signtool /dlib` Azure Trusted Signing integration was introduced in `toolsets.winCodeSign: 1.3.0`.\n * The legacy PowerShell integration is deprecated, but leverages the same underlying Azure APIs, so both interfaces share the same config shape.\n */\nexport interface WindowsAzureSigningConfig {\n /** Discriminator selecting Azure Trusted Signing (cloud signing — no local certificate). */\n readonly type: \"azure\"\n\n /**\n * The publisher name to associate with the signature, exactly as it appears in the certificate\n * issued by your Trusted Signing certificate profile. Required. Used for\n * [update verification](#verifyUpdateCodeSignature) (embedded in `app-update.yml` and checked by\n * electron-updater) and must match the certificate subject.\n *\n * @see https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073\n */\n readonly publisherName: string\n\n /**\n * The Trusted Signing Account endpoint. The URI value must align to the region your Trusted\n * Signing Account and Certificate Profile were created in.\n *\n * Requires Azure Entra ID environment variables per\n * [Microsoft's documentation](https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition).\n */\n readonly endpoint: string\n\n /**\n * The name of the Trusted Signing Certificate Profile to sign with, as created in your Azure\n * Code Signing Account. Maps to the DLib metadata field `CertificateProfileName`.\n */\n readonly certificateProfileName: string\n\n /**\n * The name of the Azure Trusted Signing (Code Signing) Account that owns the certificate profile.\n * Maps to the DLib metadata field `CodeSigningAccountName`.\n */\n readonly codeSigningAccountName: string\n\n /**\n * The digest algorithm used to hash the files being signed. Maps to the DLib metadata field\n * `FileDigest`.\n * @default SHA256\n */\n readonly fileDigest?: string\n\n /**\n * The RFC3161 timestamp server. Translates to field: TimestampRfc3161.\n * @default http://timestamp.acs.microsoft.com\n */\n readonly timestampRfc3161?: string\n\n /**\n * The timestamp digest algorithm. Translates to field: TimestampDigest.\n * @default SHA256\n */\n readonly timestampDigest?: string\n\n /**\n * Additional fields to include verbatim in the `metadata.json` file passed to\n * `Azure.CodeSigning.Dlib.dll` via `signtool /dmdf`. Use this for DLib-specific options\n * not covered by the typed fields above (e.g. `ExcludeCredentials`, `CorrelationId`).\n */\n readonly additionalMetadata?: Record<string, string>\n}\n\n// ─── Discriminated union ──────────────────────────────────────────────────────\n\nexport type WindowsSigningConfiguration = WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | WindowsPkcs11SigningConfig | WindowsAzureSigningConfig\n\n/** Signing modes that use signtool.exe or osslsigncode (not Azure). */\nexport type WindowsSigntoolFamilyConfig = WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | WindowsPkcs11SigningConfig\n\n/**\n * Resolves the active signing configuration object. `false`, `null`, and unset all mean\n * \"no explicit signing config object\" (env-based discovery still applies when unset).\n */\nexport function resolveWindowsSigningConfiguration(config: WindowsConfiguration): WindowsSigningConfiguration | null {\n const { sign } = config\n return sign == null || sign === false ? null : sign\n}\n\n/** Whether Windows code signing has been explicitly disabled via `sign: false | null`. */\nexport function isWindowsSigningDisabled(config: WindowsConfiguration): boolean {\n return config.sign === false || config.sign === null\n}\n"]}
|
package/dist/packager.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ export declare class Packager {
|
|
|
49
49
|
_appInfo: AppInfo | null;
|
|
50
50
|
get appInfo(): AppInfo;
|
|
51
51
|
readonly tempDirManager: TmpDir;
|
|
52
|
+
private readonly buildFinalizeTasks;
|
|
53
|
+
addBuildFinalizeTask(task: () => Promise<void>): void;
|
|
52
54
|
private _repositoryInfo;
|
|
53
55
|
readonly options: PackagerOptions;
|
|
54
56
|
readonly debugLogger: DebugLogger;
|
package/dist/packager.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packager.d.ts","sourceRoot":"","sources":["../src/packager.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"packager.d.ts","sourceRoot":"","sources":["../src/packager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAGJ,WAAW,EAUX,MAAM,EACP,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAqB,MAAM,sBAAsB,CAAA;AAM3E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAClH,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGlE,OAAO,EAAE,SAAS,EAAmB,MAAM,gBAAgB,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AASxD,OAAO,EAAqB,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,EAA8B,EAAE,EAAE,MAAM,kCAAkC,CAAA;AAMjF,KAAK,cAAc,GAAG;IACpB,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAA;IAEtD,UAAU,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAA;IACzC,YAAY,EAAE,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAA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,CAAC,KAAK,EAAE,oBAAoB,EAAE,SAAS,CAAC,EAAE,GAAG;IAY3E;;OAEG;IACG,mBAAmB,CAAC,KAAK,EAAE,eAAe;IAI1C,0BAA0B,CAAC,KAAK,EAAE,eAAe;IAKjD,uBAAuB,CAAC,IAAI,EAAE,MAAM;IAIpC,qBAAqB,CAAC,IAAI,EAAE,MAAM;IAIlC,cAAc,CAAC,OAAO,EAAE,iBAAiB;IAIzC,aAAa,CAAC,OAAO,EAAE,gBAAgB;IAIvC,aAAa,CAAC,OAAO,EAAE,gBAAgB;IAIvC,gBAAgB,CAAC,OAAO,EAAE,gBAAgB;IAI1C,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAgD/B,KAAK,CAAC,cAAc,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC;YA2E1D,mDAAmD;YAenD,OAAO;YAyGP,YAAY;IAwBb,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;CAgDlF;AA+BD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACrC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC9D,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAA;CACtC"}
|
package/dist/packager.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Arch, archFromString, AsyncTaskManager, DebugLogger, executeFinally, getArtifactArchName, InvalidConfigurationError, log, MAX_FILE_REQUESTS, orNullIfFileNotExist, sanitizeDirPath, safeStringifyJson, serializeToYaml, TmpDir, } from "builder-util";
|
|
2
2
|
import { CancellationToken, deepAssign, retry } from "builder-util-runtime";
|
|
3
3
|
import { isCI } from "ci-info";
|
|
4
4
|
import { Lazy } from "lazy-val";
|
|
@@ -8,7 +8,9 @@ import { AppInfo } from "./appInfo.js";
|
|
|
8
8
|
import { readAsarJson } from "./asar/asar.js";
|
|
9
9
|
import { Platform } from "./core.js";
|
|
10
10
|
import { createElectronFrameworkSupport } from "./electron/ElectronFramework.js";
|
|
11
|
-
import {
|
|
11
|
+
import { assertElectronArchSupported } from "./electron/electronArchSupport.js";
|
|
12
|
+
import { isElectronBased } from "./Framework.js";
|
|
13
|
+
import { addTargetsForPlatform, computeArchToTargetNamesMap, createTargets, NoOpTarget } from "./targets/targetFactory.js";
|
|
12
14
|
import { computeDefaultAppDirectory, getConfig, validateConfiguration } from "./util/config/config.js";
|
|
13
15
|
import { expandMacro } from "./util/macroExpander.js";
|
|
14
16
|
import { checkMetadata, readPackageJson } from "./util/packageMetadata.js";
|
|
@@ -58,6 +60,9 @@ export class Packager {
|
|
|
58
60
|
get appInfo() {
|
|
59
61
|
return this._appInfo;
|
|
60
62
|
}
|
|
63
|
+
addBuildFinalizeTask(task) {
|
|
64
|
+
this.buildFinalizeTasks.push(task);
|
|
65
|
+
}
|
|
61
66
|
get repositoryInfo() {
|
|
62
67
|
return this._repositoryInfo.value;
|
|
63
68
|
}
|
|
@@ -93,6 +98,10 @@ export class Packager {
|
|
|
93
98
|
this.eventEmitter = new AsyncEventEmitter();
|
|
94
99
|
this._appInfo = null;
|
|
95
100
|
this.tempDirManager = new TmpDir("packager");
|
|
101
|
+
// Tasks that must run after EVERY target has finished building — the only point at which the
|
|
102
|
+
// shared appOutDir can be mutated without racing a concurrent target that reads it. Used by NSIS
|
|
103
|
+
// to write elevate.exe into win-unpacked without it leaking into Squirrel/zip/etc. (see #9852).
|
|
104
|
+
this.buildFinalizeTasks = [];
|
|
96
105
|
this._repositoryInfo = new Lazy(() => getRepositoryInfo(this.projectDir, this.metadata, this.devMetadata));
|
|
97
106
|
this.debugLogger = new DebugLogger(log.isDebugEnabled);
|
|
98
107
|
this.runtimeEnvironmentVariables = {};
|
|
@@ -111,28 +120,11 @@ export class Packager {
|
|
|
111
120
|
const result = Array();
|
|
112
121
|
return result.length === 0 && currentIfNotSpecified ? [archFromString(process.arch)] : result;
|
|
113
122
|
}
|
|
114
|
-
|
|
115
|
-
if (archToType == null) {
|
|
116
|
-
archToType = new Map();
|
|
117
|
-
targets.set(platform, archToType);
|
|
118
|
-
}
|
|
119
|
-
if (types.length === 0) {
|
|
123
|
+
addTargetsForPlatform(targets, platform, types, commonArch, archToType => {
|
|
120
124
|
for (const arch of commonArch(false)) {
|
|
121
125
|
archToType.set(arch, []);
|
|
122
126
|
}
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
for (const type of types) {
|
|
126
|
-
const suffixPos = type.lastIndexOf(":");
|
|
127
|
-
if (suffixPos > 0) {
|
|
128
|
-
addValue(archToType, archFromString(type.substring(suffixPos + 1)), type.substring(0, suffixPos));
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
for (const arch of commonArch(true)) {
|
|
132
|
-
addValue(archToType, arch, type);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
127
|
+
});
|
|
136
128
|
}
|
|
137
129
|
if (options.mac != null) {
|
|
138
130
|
processTargets(Platform.MAC, options.mac);
|
|
@@ -361,6 +353,11 @@ export class Packager {
|
|
|
361
353
|
if (this.cancellationToken.cancelled) {
|
|
362
354
|
break;
|
|
363
355
|
}
|
|
356
|
+
// fail fast when the requested arch has no official Electron build anymore (Electron 44 removed win32-ia32 and linux-armv7l);
|
|
357
|
+
// skipped for prepackaged apps since nothing is downloaded then
|
|
358
|
+
if (this.options.prepackaged == null && isElectronBased(this.framework)) {
|
|
359
|
+
assertElectronArchSupported(platform, arch, this.framework.version, this.config);
|
|
360
|
+
}
|
|
364
361
|
// support os and arch macro in output value
|
|
365
362
|
const outDir = path.resolve(this.projectDir, packager.expandMacro(this.config.directories.output, Arch[arch]));
|
|
366
363
|
const targetList = createTargets(nameToTarget, targetNames.length === 0 ? packager.defaultTarget : targetNames, outDir, packager);
|
|
@@ -398,6 +395,14 @@ export class Packager {
|
|
|
398
395
|
}
|
|
399
396
|
await target.finishBuild();
|
|
400
397
|
}
|
|
398
|
+
// Every target has now finished reading the shared appOutDir(s), so finalize tasks may safely
|
|
399
|
+
// mutate them (e.g. NSIS copying elevate.exe into win-unpacked — see #9852).
|
|
400
|
+
for (const task of this.buildFinalizeTasks) {
|
|
401
|
+
if (this.cancellationToken.cancelled) {
|
|
402
|
+
break;
|
|
403
|
+
}
|
|
404
|
+
await task();
|
|
405
|
+
}
|
|
401
406
|
return platformToTarget;
|
|
402
407
|
}
|
|
403
408
|
async createHelper(platform) {
|