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.
- package/out/binDownload.js +36 -6
- package/out/binDownload.js.map +1 -1
- package/out/codeSign/codesign.js +7 -23
- package/out/codeSign/codesign.js.map +1 -1
- package/out/codeSign/macCodeSign.js +2 -2
- package/out/codeSign/macCodeSign.js.map +1 -1
- package/out/configuration.d.ts +36 -2
- package/out/configuration.js.map +1 -1
- package/out/electron/ElectronFramework.js +4 -1
- package/out/electron/ElectronFramework.js.map +1 -1
- package/out/electron/electronVersion.js +9 -4
- package/out/electron/electronVersion.js.map +1 -1
- package/out/fileMatcher.d.ts +2 -1
- package/out/fileMatcher.js +0 -1
- package/out/fileMatcher.js.map +1 -1
- package/out/fileTransformer.js +2 -1
- package/out/fileTransformer.js.map +1 -1
- package/out/forge-maker.js +6 -2
- package/out/forge-maker.js.map +1 -1
- package/out/index.d.ts +1 -1
- package/out/index.js.map +1 -1
- package/out/linuxPackager.js +1 -1
- package/out/linuxPackager.js.map +1 -1
- package/out/mac/MacTargetHelper.d.ts +24 -0
- package/out/mac/MacTargetHelper.js +267 -0
- package/out/mac/MacTargetHelper.js.map +1 -0
- package/out/macPackager.d.ts +21 -7
- package/out/macPackager.js +218 -346
- package/out/macPackager.js.map +1 -1
- package/out/node-module-collector/moduleManager.d.ts +1 -0
- package/out/node-module-collector/moduleManager.js +2 -0
- package/out/node-module-collector/moduleManager.js.map +1 -1
- package/out/node-module-collector/nodeModulesCollector.d.ts +3 -2
- package/out/node-module-collector/nodeModulesCollector.js +23 -3
- package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/out/node-module-collector/pnpmNodeModulesCollector.js +5 -1
- package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
- package/out/options/SnapOptions.d.ts +415 -56
- package/out/options/SnapOptions.js.map +1 -1
- package/out/options/linuxOptions.d.ts +8 -0
- package/out/options/linuxOptions.js.map +1 -1
- package/out/packager.js +4 -4
- package/out/packager.js.map +1 -1
- package/out/platformPackager.js +9 -5
- package/out/platformPackager.js.map +1 -1
- package/out/publish/PublishManager.js +2 -2
- package/out/publish/PublishManager.js.map +1 -1
- package/out/publish/updateInfoBuilder.d.ts +4 -0
- package/out/publish/updateInfoBuilder.js +14 -2
- package/out/publish/updateInfoBuilder.js.map +1 -1
- package/out/targets/AppxTarget.js +2 -1
- package/out/targets/AppxTarget.js.map +1 -1
- package/out/targets/ArchiveTarget.js +1 -1
- package/out/targets/ArchiveTarget.js.map +1 -1
- package/out/targets/FlatpakTarget.js +2 -4
- package/out/targets/FlatpakTarget.js.map +1 -1
- package/out/targets/FpmTarget.js +30 -6
- package/out/targets/FpmTarget.js.map +1 -1
- package/out/targets/LinuxTargetHelper.d.ts +4 -1
- package/out/targets/LinuxTargetHelper.js +134 -8
- package/out/targets/LinuxTargetHelper.js.map +1 -1
- package/out/targets/MsiTarget.js +7 -4
- package/out/targets/MsiTarget.js.map +1 -1
- package/out/targets/MsiWrappedTarget.js +1 -1
- package/out/targets/MsiWrappedTarget.js.map +1 -1
- package/out/targets/appimage/AppImageTarget.js +2 -1
- package/out/targets/appimage/AppImageTarget.js.map +1 -1
- package/out/targets/archive.js +2 -6
- package/out/targets/archive.js.map +1 -1
- package/out/targets/nsis/NsisTarget.js +26 -16
- package/out/targets/nsis/NsisTarget.js.map +1 -1
- package/out/targets/nsis/nsisScriptGenerator.js +2 -3
- package/out/targets/nsis/nsisScriptGenerator.js.map +1 -1
- package/out/targets/nsis/nsisUtil.d.ts +0 -7
- package/out/targets/nsis/nsisUtil.js +5 -48
- package/out/targets/nsis/nsisUtil.js.map +1 -1
- package/out/targets/pkg.js +1 -1
- package/out/targets/pkg.js.map +1 -1
- package/out/targets/snap/SnapTarget.d.ts +36 -0
- package/out/targets/snap/SnapTarget.js +105 -0
- package/out/targets/snap/SnapTarget.js.map +1 -0
- package/out/targets/snap/core24.d.ts +52 -0
- package/out/targets/snap/core24.js +448 -0
- package/out/targets/snap/core24.js.map +1 -0
- package/out/targets/snap/coreCustom.d.ts +28 -0
- package/out/targets/snap/coreCustom.js +63 -0
- package/out/targets/snap/coreCustom.js.map +1 -0
- package/out/targets/snap/coreLegacy.d.ts +20 -0
- package/out/targets/snap/coreLegacy.js +278 -0
- package/out/targets/snap/coreLegacy.js.map +1 -0
- package/out/targets/snap/snapcraftBuilder.d.ts +39 -0
- package/out/targets/snap/snapcraftBuilder.js +419 -0
- package/out/targets/snap/snapcraftBuilder.js.map +1 -0
- package/out/toolsets/linux.d.ts +5 -0
- package/out/toolsets/linux.js +55 -23
- package/out/toolsets/linux.js.map +1 -1
- package/out/toolsets/windows.d.ts +19 -0
- package/out/toolsets/windows.js +126 -18
- package/out/toolsets/windows.js.map +1 -1
- package/out/util/bundledTool.js +2 -1
- package/out/util/bundledTool.js.map +1 -1
- package/out/util/config/config.js +4 -3
- package/out/util/config/config.js.map +1 -1
- package/out/util/electronGet.d.ts +6 -1
- package/out/util/electronGet.js +15 -7
- package/out/util/electronGet.js.map +1 -1
- package/out/util/envPath.d.ts +2 -0
- package/out/util/envPath.js +28 -0
- package/out/util/envPath.js.map +1 -0
- package/out/util/packageMetadata.js +2 -1
- package/out/util/packageMetadata.js.map +1 -1
- package/out/util/toolsetLock.d.ts +1 -0
- package/out/util/toolsetLock.js +23 -0
- package/out/util/toolsetLock.js.map +1 -0
- package/out/util/yarn.js +1 -1
- package/out/util/yarn.js.map +1 -1
- package/out/version.d.ts +1 -1
- package/out/version.js +1 -1
- package/out/version.js.map +1 -1
- package/out/vm/vm.d.ts +1 -0
- package/out/vm/vm.js +18 -0
- package/out/vm/vm.js.map +1 -1
- package/package.json +9 -9
- package/scheme.json +1401 -107
- package/templates/nsis/multiUser.nsh +14 -12
- package/out/targets/snap.d.ts +0 -17
- package/out/targets/snap.js +0 -337
- package/out/targets/snap.js.map +0 -1
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MacTargetHelper = void 0;
|
|
4
|
+
const notarize_1 = require("@electron/notarize");
|
|
5
|
+
const util_identities_1 = require("@electron/osx-sign/dist/cjs/util-identities");
|
|
6
|
+
const builder_util_1 = require("builder-util");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const macCodeSign_1 = require("../codeSign/macCodeSign");
|
|
9
|
+
const pathManager_1 = require("../util/pathManager");
|
|
10
|
+
class MacTargetHelper {
|
|
11
|
+
constructor(packager) {
|
|
12
|
+
this.packager = packager;
|
|
13
|
+
}
|
|
14
|
+
handleNullIdentity(fallBackToAdhoc) {
|
|
15
|
+
if (this.packager.forceCodeSigning) {
|
|
16
|
+
throw new builder_util_1.InvalidConfigurationError("identity explicitly is set to null, but forceCodeSigning is set to true");
|
|
17
|
+
}
|
|
18
|
+
builder_util_1.log.info({ reason: "identity explicitly is set to null" }, "skipped macOS code signing");
|
|
19
|
+
if (fallBackToAdhoc) {
|
|
20
|
+
builder_util_1.log.warn("arm64 requires signing, but identity is set to null and signing is being skipped");
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
async findSigningIdentity(isMas, isDevelopment, qualifier, keychainFile, config, fallBackToAdhoc) {
|
|
25
|
+
const certificateTypes = MacTargetHelper.getCertificateTypes(isMas, isDevelopment);
|
|
26
|
+
let identity = null;
|
|
27
|
+
for (const certificateType of certificateTypes) {
|
|
28
|
+
identity = await (0, macCodeSign_1.findIdentity)(certificateType, qualifier, keychainFile);
|
|
29
|
+
if (identity != null) {
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (identity == null) {
|
|
34
|
+
if (!isMas && !isDevelopment && config.type !== "distribution") {
|
|
35
|
+
identity = await (0, macCodeSign_1.findIdentity)("Mac Developer", qualifier, keychainFile);
|
|
36
|
+
if (identity != null) {
|
|
37
|
+
builder_util_1.log.warn("Mac Developer is used to sign app — it is only for development and testing, not for production");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const noIdentity = !config.sign && identity == null;
|
|
41
|
+
if (qualifier === "-") {
|
|
42
|
+
identity = new util_identities_1.Identity("-", undefined);
|
|
43
|
+
}
|
|
44
|
+
else if (noIdentity && fallBackToAdhoc) {
|
|
45
|
+
builder_util_1.log.warn(null, "falling back to ad-hoc signature for macOS application code signing");
|
|
46
|
+
identity = new util_identities_1.Identity("-", undefined);
|
|
47
|
+
}
|
|
48
|
+
else if (noIdentity) {
|
|
49
|
+
await (0, macCodeSign_1.reportError)(isMas, certificateTypes, qualifier, keychainFile, this.packager.forceCodeSigning);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return identity;
|
|
54
|
+
}
|
|
55
|
+
async buildSignOptions(appPath, identity, type, isMas, config, keychainFile, arch) {
|
|
56
|
+
let filter = config.signIgnore;
|
|
57
|
+
if (Array.isArray(filter)) {
|
|
58
|
+
if (filter.length == 0) {
|
|
59
|
+
filter = null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (filter != null) {
|
|
63
|
+
filter = filter.length === 0 ? null : [filter];
|
|
64
|
+
}
|
|
65
|
+
const filterRe = filter == null
|
|
66
|
+
? null
|
|
67
|
+
: filter.map(it => {
|
|
68
|
+
try {
|
|
69
|
+
return new RegExp(it);
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
throw new builder_util_1.InvalidConfigurationError(`Invalid regex filter pattern: ${it}. ${e.message}`);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
let binaries = config.binaries || undefined;
|
|
76
|
+
if (binaries) {
|
|
77
|
+
// Accept absolute paths for external binaries, else resolve relative paths from the artifact's app Contents path.
|
|
78
|
+
binaries = (await Promise.all(binaries.flatMap(async (destination) => {
|
|
79
|
+
const expandedDestination = this.packager.expandArch(destination, arch);
|
|
80
|
+
return await Promise.all(expandedDestination.map(async (d) => {
|
|
81
|
+
if (await (0, builder_util_1.statOrNull)(d)) {
|
|
82
|
+
return d;
|
|
83
|
+
}
|
|
84
|
+
return path.resolve(appPath, d);
|
|
85
|
+
}));
|
|
86
|
+
}))).flat();
|
|
87
|
+
builder_util_1.log.info({ binaries, arch: arch == null ? null : builder_util_1.Arch[arch] }, "signing additional user-defined binaries for arch");
|
|
88
|
+
}
|
|
89
|
+
const signOptions = {
|
|
90
|
+
identityValidation: false,
|
|
91
|
+
// https://github.com/electron-userland/electron-builder/issues/1699
|
|
92
|
+
// kext are signed by the chipset manufacturers. You need a special certificate (only available on request) from Apple to be able to sign kext.
|
|
93
|
+
ignore: (file) => {
|
|
94
|
+
if (filterRe != null) {
|
|
95
|
+
for (const regExp of filterRe) {
|
|
96
|
+
if (regExp.test(file)) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return (file.endsWith(".kext") ||
|
|
102
|
+
file.startsWith("/Contents/PlugIns", appPath.length) ||
|
|
103
|
+
file.includes("/node_modules/puppeteer/.local-chromium") ||
|
|
104
|
+
file.includes("/node_modules/playwright-firefox/.local-browsers") ||
|
|
105
|
+
file.includes("/node_modules/playwright/.local-browsers"));
|
|
106
|
+
/* Those are browser automating modules, browser (chromium, nightly) cannot be signed
|
|
107
|
+
https://github.com/electron-userland/electron-builder/issues/2010
|
|
108
|
+
https://github.com/electron-userland/electron-builder/issues/5383
|
|
109
|
+
*/
|
|
110
|
+
},
|
|
111
|
+
identity: identity ? identity.hash || identity.name : undefined,
|
|
112
|
+
type,
|
|
113
|
+
platform: isMas ? "mas" : "darwin",
|
|
114
|
+
version: this.packager.config.electronVersion || undefined,
|
|
115
|
+
app: appPath,
|
|
116
|
+
keychain: keychainFile || undefined,
|
|
117
|
+
binaries,
|
|
118
|
+
// https://github.com/electron-userland/electron-builder/issues/1480
|
|
119
|
+
strictVerify: config.strictVerify,
|
|
120
|
+
preAutoEntitlements: config.preAutoEntitlements,
|
|
121
|
+
optionsForFile: await this.getOptionsForFile(appPath, isMas, config),
|
|
122
|
+
provisioningProfile: config.provisioningProfile || undefined,
|
|
123
|
+
};
|
|
124
|
+
return signOptions;
|
|
125
|
+
}
|
|
126
|
+
async createMasInstaller(appPath, outDir, masOptions, keychainFile, isDevelopment, arch) {
|
|
127
|
+
const certType = isDevelopment ? "Mac Developer" : "3rd Party Mac Developer Installer";
|
|
128
|
+
const masInstallerIdentity = await (0, macCodeSign_1.findIdentity)(certType, masOptions.identity, keychainFile);
|
|
129
|
+
if (masInstallerIdentity == null) {
|
|
130
|
+
throw new builder_util_1.InvalidConfigurationError(`Cannot find valid "${certType}" identity to sign MAS installer, please see https://electron.build/code-signing`);
|
|
131
|
+
}
|
|
132
|
+
MacTargetHelper.assertSafePathForCommandUsage(outDir, "output directory");
|
|
133
|
+
// mas uploaded to AppStore, so, use "-" instead of space for name
|
|
134
|
+
// path.basename prevents path traversal if a crafted artifactName contains "../"
|
|
135
|
+
const artifactName = path.basename(this.packager.expandArtifactNamePattern(masOptions, "pkg", arch));
|
|
136
|
+
MacTargetHelper.assertSafePathForCommandUsage(artifactName, "artifact name");
|
|
137
|
+
const artifactPath = path.resolve(outDir, artifactName);
|
|
138
|
+
await this.packager.doFlat(appPath, artifactPath, masInstallerIdentity, keychainFile);
|
|
139
|
+
await this.packager.info.emitArtifactBuildCompleted({
|
|
140
|
+
file: artifactPath,
|
|
141
|
+
target: null,
|
|
142
|
+
arch: builder_util_1.Arch.x64,
|
|
143
|
+
safeArtifactName: this.packager.computeSafeArtifactName(artifactName, "pkg", arch, true, this.packager.platformSpecificBuildOptions.defaultArch),
|
|
144
|
+
packager: this.packager,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
async getOptionsForFile(appPath, isMas, customSignOptions) {
|
|
148
|
+
const resourceList = await this.packager.resourceList;
|
|
149
|
+
const entitlementsSuffix = isMas ? "mas" : "mac";
|
|
150
|
+
const getEntitlements = (filePath) => {
|
|
151
|
+
if (filePath === appPath) {
|
|
152
|
+
if (customSignOptions.entitlements) {
|
|
153
|
+
return customSignOptions.entitlements;
|
|
154
|
+
}
|
|
155
|
+
const p = `entitlements.${entitlementsSuffix}.plist`;
|
|
156
|
+
if (resourceList.includes(p)) {
|
|
157
|
+
return path.join(this.packager.info.buildResourcesDir, p);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
return (0, pathManager_1.getTemplatePath)("entitlements.mac.plist");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (filePath.includes("Library/LoginItems")) {
|
|
164
|
+
return customSignOptions.entitlementsLoginHelper;
|
|
165
|
+
}
|
|
166
|
+
if (customSignOptions.entitlementsInherit) {
|
|
167
|
+
return customSignOptions.entitlementsInherit;
|
|
168
|
+
}
|
|
169
|
+
const p = `entitlements.${entitlementsSuffix}.inherit.plist`;
|
|
170
|
+
if (resourceList.includes(p)) {
|
|
171
|
+
return path.join(this.packager.info.buildResourcesDir, p);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
return (0, pathManager_1.getTemplatePath)("entitlements.mac.plist");
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const requirements = isMas || this.packager.platformSpecificBuildOptions.requirements == null
|
|
178
|
+
? undefined
|
|
179
|
+
: await this.packager.getResource(this.packager.platformSpecificBuildOptions.requirements);
|
|
180
|
+
// harden by default for mac builds. Only harden mas builds if explicitly true (backward compatibility)
|
|
181
|
+
const hardenedRuntime = isMas ? customSignOptions.hardenedRuntime === true : customSignOptions.hardenedRuntime !== false;
|
|
182
|
+
return (filePath) => {
|
|
183
|
+
const entitlements = getEntitlements(filePath);
|
|
184
|
+
return {
|
|
185
|
+
entitlements: entitlements || undefined,
|
|
186
|
+
hardenedRuntime: hardenedRuntime !== null && hardenedRuntime !== void 0 ? hardenedRuntime : undefined,
|
|
187
|
+
timestamp: customSignOptions.timestamp || undefined,
|
|
188
|
+
requirements: requirements || undefined,
|
|
189
|
+
additionalArguments: customSignOptions.additionalArguments || [],
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
static getCertificateTypes(isMas, isDevelopment) {
|
|
194
|
+
if (isDevelopment) {
|
|
195
|
+
return isMas ? ["Mac Developer", "Apple Development"] : ["Mac Developer", "Developer ID Application"];
|
|
196
|
+
}
|
|
197
|
+
return isMas ? ["Apple Distribution", "3rd Party Mac Developer Application"] : ["Developer ID Application"];
|
|
198
|
+
}
|
|
199
|
+
static isMasTarget(targetName) {
|
|
200
|
+
return targetName === "mas" || targetName === "mas-dev";
|
|
201
|
+
}
|
|
202
|
+
static getPlatformTypeFromTarget(targetName) {
|
|
203
|
+
if (targetName === "mas")
|
|
204
|
+
return "mas";
|
|
205
|
+
if (targetName === "mas-dev")
|
|
206
|
+
return "mas-dev";
|
|
207
|
+
return "mac";
|
|
208
|
+
}
|
|
209
|
+
static assertSafePathForCommandUsage(pathValue, description) {
|
|
210
|
+
if (/[\0\r\n"'`$;&|<>]/.test(pathValue)) {
|
|
211
|
+
throw new builder_util_1.InvalidConfigurationError(`Invalid ${description}: contains unsupported shell-special characters`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
static getNotarizeOptions(appPath) {
|
|
215
|
+
const tool = "notarytool";
|
|
216
|
+
const teamId = process.env.APPLE_TEAM_ID;
|
|
217
|
+
const appleId = process.env.APPLE_ID;
|
|
218
|
+
const appleIdPassword = process.env.APPLE_APP_SPECIFIC_PASSWORD;
|
|
219
|
+
if (appleId || appleIdPassword) {
|
|
220
|
+
if (!appleId) {
|
|
221
|
+
throw new builder_util_1.InvalidConfigurationError(`APPLE_ID env var needs to be set`);
|
|
222
|
+
}
|
|
223
|
+
if (!appleIdPassword) {
|
|
224
|
+
throw new builder_util_1.InvalidConfigurationError(`APPLE_APP_SPECIFIC_PASSWORD env var needs to be set`);
|
|
225
|
+
}
|
|
226
|
+
if (!teamId) {
|
|
227
|
+
throw new builder_util_1.InvalidConfigurationError(`APPLE_TEAM_ID env var needs to be set`);
|
|
228
|
+
}
|
|
229
|
+
return { tool, appPath, appleId, appleIdPassword, teamId };
|
|
230
|
+
}
|
|
231
|
+
const appleApiKey = process.env.APPLE_API_KEY;
|
|
232
|
+
const appleApiKeyId = process.env.APPLE_API_KEY_ID;
|
|
233
|
+
const appleApiIssuer = process.env.APPLE_API_ISSUER;
|
|
234
|
+
if (appleApiKey || appleApiKeyId || appleApiIssuer) {
|
|
235
|
+
if (!appleApiKey || !appleApiKeyId || !appleApiIssuer) {
|
|
236
|
+
throw new builder_util_1.InvalidConfigurationError(`Env vars APPLE_API_KEY, APPLE_API_KEY_ID and APPLE_API_ISSUER need to be set`);
|
|
237
|
+
}
|
|
238
|
+
return { tool, appPath, appleApiKey, appleApiKeyId, appleApiIssuer };
|
|
239
|
+
}
|
|
240
|
+
const keychain = process.env.APPLE_KEYCHAIN;
|
|
241
|
+
const keychainProfile = process.env.APPLE_KEYCHAIN_PROFILE;
|
|
242
|
+
if (keychainProfile) {
|
|
243
|
+
let args = { keychainProfile };
|
|
244
|
+
if (keychain) {
|
|
245
|
+
args = { ...args, keychain };
|
|
246
|
+
}
|
|
247
|
+
return { tool, appPath, ...args };
|
|
248
|
+
}
|
|
249
|
+
return undefined;
|
|
250
|
+
}
|
|
251
|
+
async notarizeIfProvided(appPath) {
|
|
252
|
+
const notarizeOptions = this.packager.platformSpecificBuildOptions.notarize;
|
|
253
|
+
if (notarizeOptions === false) {
|
|
254
|
+
builder_util_1.log.info({ reason: "`notarize` options were set explicitly `false`" }, "skipped macOS notarization");
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const options = MacTargetHelper.getNotarizeOptions(appPath);
|
|
258
|
+
if (!options) {
|
|
259
|
+
builder_util_1.log.warn({ reason: "`notarize` options were unable to be generated" }, "skipped macOS notarization");
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
await (0, notarize_1.notarize)(options);
|
|
263
|
+
builder_util_1.log.info(null, "notarization successful");
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
exports.MacTargetHelper = MacTargetHelper;
|
|
267
|
+
//# sourceMappingURL=MacTargetHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MacTargetHelper.js","sourceRoot":"","sources":["../../src/mac/MacTargetHelper.ts"],"names":[],"mappings":";;;AAAA,iDAA6C;AAG7C,iFAAsE;AACtE,+CAA+E;AAE/E,6BAA4B;AAC5B,yDAA6E;AAG7E,qDAAqD;AAIrD,MAAa,eAAe;IAC1B,YAAoB,QAAqB;QAArB,aAAQ,GAAR,QAAQ,CAAa;IAAG,CAAC;IAE7C,kBAAkB,CAAC,eAAwB;QACzC,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;YACnC,MAAM,IAAI,wCAAyB,CAAC,yEAAyE,CAAC,CAAA;QAChH,CAAC;QACD,kBAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,oCAAoC,EAAE,EAAE,4BAA4B,CAAC,CAAA;QACxF,IAAI,eAAe,EAAE,CAAC;YACpB,kBAAG,CAAC,IAAI,CAAC,kFAAkF,CAAC,CAAA;QAC9F,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,KAAc,EACd,aAAsB,EACtB,SAA6B,EAC7B,YAA8B,EAC9B,MAA2C,EAC3C,eAAwB;QAExB,MAAM,gBAAgB,GAAG,eAAe,CAAC,mBAAmB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;QAElF,IAAI,QAAQ,GAAoB,IAAI,CAAA;QACpC,KAAK,MAAM,eAAe,IAAI,gBAAgB,EAAE,CAAC;YAC/C,QAAQ,GAAG,MAAM,IAAA,0BAAY,EAAC,eAAe,EAAE,SAAS,EAAE,YAAY,CAAC,CAAA;YACvE,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;gBACrB,MAAK;YACP,CAAC;QACH,CAAC;QAED,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACrB,IA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K,KAAK,EAAE,CAAC;YAC9B,kBAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,gDAAgD,EAAE,EAAE,4BAA4B,CAAC,CAAA;YACpG,OAAM;QACR,CAAC;QACD,MAAM,OAAO,GAAG,eAAe,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;QAC3D,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,kBAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,gDAAgD,EAAE,EAAE,4BAA4B,CAAC,CAAA;YACpG,OAAM;QACR,CAAC;QACD,MAAM,IAAA,mBAAQ,EAAC,OAAO,CAAC,CAAA;QACvB,kBAAG,CAAC,IAAI,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAA;IAC3C,CAAC;CACF;AA/SD,0CA+SC","sourcesContent":["import { notarize } from \"@electron/notarize\"\nimport { NotarizeOptionsNotaryTool, NotaryToolKeychainCredentials } from \"@electron/notarize/lib/types\"\nimport { PerFileSignOptions, SigningDistributionType, SignOptions } from \"@electron/osx-sign/dist/cjs/types\"\nimport { Identity } from \"@electron/osx-sign/dist/cjs/util-identities\"\nimport { Arch, InvalidConfigurationError, log, statOrNull } from \"builder-util\"\nimport { Nullish } from \"builder-util-runtime\"\nimport * as path from \"path\"\nimport { CertType, findIdentity, reportError } from \"../codeSign/macCodeSign\"\nimport type { MacPackager } from \"../macPackager\"\nimport { MacConfiguration, MasConfiguration } from \"../options/macOptions\"\nimport { getTemplatePath } from \"../util/pathManager\"\n\nexport type PlatformType = \"mas\" | \"mas-dev\" | \"mac\"\n\nexport class MacTargetHelper {\n constructor(private packager: MacPackager) {}\n\n handleNullIdentity(fallBackToAdhoc: boolean): boolean {\n if (this.packager.forceCodeSigning) {\n throw new InvalidConfigurationError(\"identity explicitly is set to null, but forceCodeSigning is set to true\")\n }\n log.info({ reason: \"identity explicitly is set to null\" }, \"skipped macOS code signing\")\n if (fallBackToAdhoc) {\n log.warn(\"arm64 requires signing, but identity is set to null and signing is being skipped\")\n }\n return false\n }\n\n async findSigningIdentity(\n isMas: boolean,\n isDevelopment: boolean,\n qualifier: string | undefined,\n keychainFile: string | Nullish,\n config: MacConfiguration | MasConfiguration,\n fallBackToAdhoc: boolean\n ): Promise<Identity | null> {\n const certificateTypes = MacTargetHelper.getCertificateTypes(isMas, isDevelopment)\n\n let identity: Identity | null = null\n for (const certificateType of certificateTypes) {\n identity = await findIdentity(certificateType, qualifier, keychainFile)\n if (identity != null) {\n break\n }\n }\n\n if (identity == null) {\n if (!isMas && !isDevelopment && config.type !== \"distribution\") {\n identity = await findIdentity(\"Mac Developer\", qualifier, keychainFile)\n if (identity != null) {\n log.warn(\"Mac Developer is used to sign app — it is only for development and testing, not for production\")\n }\n }\n\n const noIdentity = !config.sign && identity == null\n if (qualifier === \"-\") {\n identity = new Identity(\"-\", undefined)\n } else if (noIdentity && fallBackToAdhoc) {\n log.warn(null, \"falling back to ad-hoc signature for macOS application code signing\")\n identity = new Identity(\"-\", undefined)\n } else if (noIdentity) {\n await reportError(isMas, certificateTypes, qualifier, keychainFile, this.packager.forceCodeSigning)\n return null\n }\n }\n\n return identity\n }\n\n async buildSignOptions(\n appPath: string,\n identity: Identity,\n type: SigningDistributionType,\n isMas: boolean,\n config: MacConfiguration | MasConfiguration,\n keychainFile: string | Nullish,\n arch: Arch\n ): Promise<SignOptions> {\n let filter = config.signIgnore\n if (Array.isArray(filter)) {\n if (filter.length == 0) {\n filter = null\n }\n } else if (filter != null) {\n filter = filter.length === 0 ? null : [filter]\n }\n\n const filterRe =\n filter == null\n ? null\n : filter.map(it => {\n try {\n return new RegExp(it)\n } catch (e: any) {\n throw new InvalidConfigurationError(`Invalid regex filter pattern: ${it}. ${e.message}`)\n }\n })\n\n let binaries = config.binaries || undefined\n if (binaries) {\n // Accept absolute paths for external binaries, else resolve relative paths from the artifact's app Contents path.\n binaries = (\n await Promise.all(\n binaries.flatMap(async destination => {\n const expandedDestination = this.packager.expandArch(destination, arch)\n return await Promise.all(\n expandedDestination.map(async d => {\n if (await statOrNull(d)) {\n return d\n }\n return path.resolve(appPath, d)\n })\n )\n })\n )\n ).flat()\n log.info({ binaries, arch: arch == null ? null : Arch[arch] }, \"signing additional user-defined binaries for arch\")\n }\n\n const signOptions: SignOptions = {\n identityValidation: false,\n // https://github.com/electron-userland/electron-builder/issues/1699\n // kext are signed by the chipset manufacturers. You need a special certificate (only available on request) from Apple to be able to sign kext.\n ignore: (file: string) => {\n if (filterRe != null) {\n for (const regExp of filterRe) {\n if (regExp.test(file)) {\n return true\n }\n }\n }\n return (\n file.endsWith(\".kext\") ||\n file.startsWith(\"/Contents/PlugIns\", appPath.length) ||\n file.includes(\"/node_modules/puppeteer/.local-chromium\") ||\n file.includes(\"/node_modules/playwright-firefox/.local-browsers\") ||\n file.includes(\"/node_modules/playwright/.local-browsers\")\n )\n\n /* Those are browser automating modules, browser (chromium, nightly) cannot be signed\n https://github.com/electron-userland/electron-builder/issues/2010\n https://github.com/electron-userland/electron-builder/issues/5383\n */\n },\n identity: identity ? identity.hash || identity.name : undefined,\n type,\n platform: isMas ? \"mas\" : \"darwin\",\n version: this.packager.config.electronVersion || undefined,\n app: appPath,\n keychain: keychainFile || undefined,\n binaries,\n // https://github.com/electron-userland/electron-builder/issues/1480\n strictVerify: config.strictVerify,\n preAutoEntitlements: config.preAutoEntitlements,\n optionsForFile: await this.getOptionsForFile(appPath, isMas, config),\n provisioningProfile: config.provisioningProfile || undefined,\n }\n\n return signOptions\n }\n\n async createMasInstaller(appPath: string, outDir: string, masOptions: MasConfiguration, keychainFile: string | Nullish, isDevelopment: boolean, arch: Arch): Promise<void> {\n const certType = isDevelopment ? \"Mac Developer\" : \"3rd Party Mac Developer Installer\"\n const masInstallerIdentity = await findIdentity(certType, masOptions.identity, keychainFile)\n\n if (masInstallerIdentity == null) {\n throw new InvalidConfigurationError(`Cannot find valid \"${certType}\" identity to sign MAS installer, please see https://electron.build/code-signing`)\n }\n\n MacTargetHelper.assertSafePathForCommandUsage(outDir, \"output directory\")\n\n // mas uploaded to AppStore, so, use \"-\" instead of space for name\n // path.basename prevents path traversal if a crafted artifactName contains \"../\"\n const artifactName = path.basename(this.packager.expandArtifactNamePattern(masOptions, \"pkg\", arch))\n MacTargetHelper.assertSafePathForCommandUsage(artifactName, \"artifact name\")\n const artifactPath = path.resolve(outDir, artifactName)\n await this.packager.doFlat(appPath, artifactPath, masInstallerIdentity, keychainFile)\n await this.packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n target: null,\n arch: Arch.x64,\n safeArtifactName: this.packager.computeSafeArtifactName(artifactName, \"pkg\", arch, true, this.packager.platformSpecificBuildOptions.defaultArch),\n packager: this.packager,\n })\n }\n\n async getOptionsForFile(appPath: string, isMas: boolean, customSignOptions: MacConfiguration | MasConfiguration): Promise<(filePath: string) => PerFileSignOptions> {\n const resourceList = await this.packager.resourceList\n const entitlementsSuffix = isMas ? \"mas\" : \"mac\"\n\n const getEntitlements = (filePath: string) => {\n if (filePath === appPath) {\n if (customSignOptions.entitlements) {\n return customSignOptions.entitlements\n }\n const p = `entitlements.${entitlementsSuffix}.plist`\n if (resourceList.includes(p)) {\n return path.join(this.packager.info.buildResourcesDir, p)\n } else {\n return getTemplatePath(\"entitlements.mac.plist\")\n }\n }\n\n if (filePath.includes(\"Library/LoginItems\")) {\n return customSignOptions.entitlementsLoginHelper\n }\n\n if (customSignOptions.entitlementsInherit) {\n return customSignOptions.entitlementsInherit\n }\n const p = `entitlements.${entitlementsSuffix}.inherit.plist`\n if (resourceList.includes(p)) {\n return path.join(this.packager.info.buildResourcesDir, p)\n } else {\n return getTemplatePath(\"entitlements.mac.plist\")\n }\n }\n\n const requirements =\n isMas || this.packager.platformSpecificBuildOptions.requirements == null\n ? undefined\n : await this.packager.getResource(this.packager.platformSpecificBuildOptions.requirements)\n\n // harden by default for mac builds. Only harden mas builds if explicitly true (backward compatibility)\n const hardenedRuntime = isMas ? customSignOptions.hardenedRuntime === true : customSignOptions.hardenedRuntime !== false\n\n return (filePath: string): PerFileSignOptions => {\n const entitlements = getEntitlements(filePath)\n return {\n entitlements: entitlements || undefined,\n hardenedRuntime: hardenedRuntime ?? undefined,\n timestamp: customSignOptions.timestamp || undefined,\n requirements: requirements || undefined,\n additionalArguments: customSignOptions.additionalArguments || [],\n }\n }\n }\n\n static getCertificateTypes(isMas: boolean, isDevelopment: boolean): CertType[] {\n if (isDevelopment) {\n return isMas ? [\"Mac Developer\", \"Apple Development\"] : [\"Mac Developer\", \"Developer ID Application\"]\n }\n return isMas ? [\"Apple Distribution\", \"3rd Party Mac Developer Application\"] : [\"Developer ID Application\"]\n }\n\n static isMasTarget(targetName: string): boolean {\n return targetName === \"mas\" || targetName === \"mas-dev\"\n }\n\n static getPlatformTypeFromTarget(targetName: string): PlatformType {\n if (targetName === \"mas\") return \"mas\"\n if (targetName === \"mas-dev\") return \"mas-dev\"\n return \"mac\"\n }\n\n static assertSafePathForCommandUsage(pathValue: string, description: string): void {\n if (/[\\0\\r\\n\"'`$;&|<>]/.test(pathValue)) {\n throw new InvalidConfigurationError(`Invalid ${description}: contains unsupported shell-special characters`)\n }\n }\n\n static getNotarizeOptions(appPath: string): NotarizeOptionsNotaryTool | undefined {\n const tool = \"notarytool\"\n const teamId = process.env.APPLE_TEAM_ID\n const appleId = process.env.APPLE_ID\n const appleIdPassword = process.env.APPLE_APP_SPECIFIC_PASSWORD\n\n if (appleId || appleIdPassword) {\n if (!appleId) {\n throw new InvalidConfigurationError(`APPLE_ID env var needs to be set`)\n }\n if (!appleIdPassword) {\n throw new InvalidConfigurationError(`APPLE_APP_SPECIFIC_PASSWORD env var needs to be set`)\n }\n if (!teamId) {\n throw new InvalidConfigurationError(`APPLE_TEAM_ID env var needs to be set`)\n }\n return { tool, appPath, appleId, appleIdPassword, teamId }\n }\n\n const appleApiKey = process.env.APPLE_API_KEY\n const appleApiKeyId = process.env.APPLE_API_KEY_ID\n const appleApiIssuer = process.env.APPLE_API_ISSUER\n if (appleApiKey || appleApiKeyId || appleApiIssuer) {\n if (!appleApiKey || !appleApiKeyId || !appleApiIssuer) {\n throw new InvalidConfigurationError(`Env vars APPLE_API_KEY, APPLE_API_KEY_ID and APPLE_API_ISSUER need to be set`)\n }\n return { tool, appPath, appleApiKey, appleApiKeyId, appleApiIssuer }\n }\n\n const keychain = process.env.APPLE_KEYCHAIN\n const keychainProfile = process.env.APPLE_KEYCHAIN_PROFILE\n if (keychainProfile) {\n let args: NotaryToolKeychainCredentials = { keychainProfile }\n if (keychain) {\n args = { ...args, keychain }\n }\n return { tool, appPath, ...args }\n }\n\n return undefined\n }\n\n async notarizeIfProvided(appPath: string): Promise<void> {\n const notarizeOptions = this.packager.platformSpecificBuildOptions.notarize\n if (notarizeOptions === false) {\n log.info({ reason: \"`notarize` options were set explicitly `false`\" }, \"skipped macOS notarization\")\n return\n }\n const options = MacTargetHelper.getNotarizeOptions(appPath)\n if (!options) {\n log.warn({ reason: \"`notarize` options were unable to be generated\" }, \"skipped macOS notarization\")\n return\n }\n await notarize(options)\n log.info(null, \"notarization successful\")\n }\n}\n"]}
|
package/out/macPackager.d.ts
CHANGED
|
@@ -6,30 +6,44 @@ import { AppInfo } from "./appInfo";
|
|
|
6
6
|
import { CodeSigningInfo, CreateKeychainOptions } from "./codeSign/macCodeSign";
|
|
7
7
|
import { Target } from "./core";
|
|
8
8
|
import { AfterPackContext } from "./index";
|
|
9
|
-
import {
|
|
9
|
+
import { MacTargetHelper } from "./mac/MacTargetHelper";
|
|
10
|
+
import { MacConfiguration, MasConfiguration } from "./options/macOptions";
|
|
10
11
|
import { Packager } from "./packager";
|
|
11
12
|
import { DoPackOptions, PlatformPackager } from "./platformPackager";
|
|
12
13
|
export type CustomMacSignOptions = SignOptions;
|
|
13
14
|
export type CustomMacSign = (configuration: CustomMacSignOptions, packager: MacPackager) => Promise<void>;
|
|
14
|
-
export declare class MacPackager extends PlatformPackager<MacConfiguration> {
|
|
15
|
+
export declare class MacPackager extends PlatformPackager<MacConfiguration | MasConfiguration> {
|
|
15
16
|
readonly codeSigningInfo: MemoLazy<CreateKeychainOptions | null, CodeSigningInfo>;
|
|
16
17
|
private _iconPath;
|
|
18
|
+
private _activePackConfig;
|
|
19
|
+
readonly helper: MacTargetHelper;
|
|
17
20
|
constructor(info: Packager);
|
|
18
21
|
get defaultTarget(): Array<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Get the merged configuration for a specific platform type
|
|
24
|
+
*/
|
|
25
|
+
private getPlatformConfig;
|
|
19
26
|
expandArch(pattern: string, arch?: Arch | null): string[];
|
|
20
27
|
protected prepareAppInfo(appInfo: AppInfo): AppInfo;
|
|
21
28
|
getIconPath(): Promise<string | null>;
|
|
22
29
|
createTargets(targets: Array<string>, mapper: (name: string, factory: (outDir: string) => Target) => void): void;
|
|
23
30
|
protected doPack(config: DoPackOptions<MacConfiguration>): Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* Handle universal build packing
|
|
33
|
+
*/
|
|
34
|
+
private doUniversalPack;
|
|
24
35
|
pack(outDir: string, arch: Arch, targets: Array<Target>, taskManager: AsyncTaskManager): Promise<void>;
|
|
36
|
+
private packMasTargets;
|
|
37
|
+
private packMacTargets;
|
|
38
|
+
private signMas;
|
|
39
|
+
/**
|
|
40
|
+
* Main signing method with platform awareness
|
|
41
|
+
*/
|
|
25
42
|
private sign;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
protected doFlat(appPath: string, outFile: string, identity: Identity, keychain: string | Nullish): Promise<any>;
|
|
43
|
+
protected doSign(opts: SignOptions, customSignOptions: MacConfiguration | MasConfiguration, identity: Identity | null): Promise<void>;
|
|
44
|
+
doFlat(appPath: string, outFile: string, identity: Identity, keychain: string | Nullish): Promise<any>;
|
|
29
45
|
getElectronSrcDir(dist: string): string;
|
|
30
46
|
getElectronDestinationDir(appOutDir: string): string;
|
|
31
47
|
applyCommonInfo(appPlist: any, contentsPath: string): Promise<void>;
|
|
32
48
|
protected signApp(packContext: AfterPackContext, isAsar: boolean): Promise<boolean>;
|
|
33
|
-
notarizeIfProvided(appPath: string): Promise<void>;
|
|
34
|
-
private getNotarizeOptions;
|
|
35
49
|
}
|