app-builder-lib 26.0.0-alpha.9 → 26.0.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/Framework.d.ts +1 -1
- package/out/Framework.js.map +1 -1
- package/out/ProtonFramework.js.map +1 -1
- package/out/appInfo.d.ts +2 -1
- package/out/appInfo.js +1 -1
- package/out/appInfo.js.map +1 -1
- package/out/asar/asar.d.ts +2 -3
- package/out/asar/asar.js +7 -4
- package/out/asar/asar.js.map +1 -1
- package/out/asar/asarUtil.js +1 -1
- package/out/asar/asarUtil.js.map +1 -1
- package/out/asar/integrity.d.ts +4 -1
- package/out/asar/integrity.js +42 -8
- package/out/asar/integrity.js.map +1 -1
- package/out/asar/unpackDetector.js.map +1 -1
- package/out/binDownload.js.map +1 -1
- package/out/codeSign/codesign.js +2 -3
- package/out/codeSign/codesign.js.map +1 -1
- package/out/codeSign/macCodeSign.d.ts +3 -2
- package/out/codeSign/macCodeSign.js +8 -10
- package/out/codeSign/macCodeSign.js.map +1 -1
- package/out/codeSign/signManager.d.ts +4 -4
- package/out/codeSign/signManager.js.map +1 -1
- package/out/codeSign/windowsCodeSign.d.ts +0 -2
- package/out/codeSign/windowsCodeSign.js +1 -14
- package/out/codeSign/windowsCodeSign.js.map +1 -1
- package/out/codeSign/windowsSignAzureManager.d.ts +3 -3
- package/out/codeSign/windowsSignAzureManager.js +3 -4
- package/out/codeSign/windowsSignAzureManager.js.map +1 -1
- package/out/codeSign/windowsSignToolManager.d.ts +4 -4
- package/out/codeSign/windowsSignToolManager.js +8 -9
- package/out/codeSign/windowsSignToolManager.js.map +1 -1
- package/out/core.d.ts +2 -2
- package/out/core.js.map +1 -1
- package/out/electron/ElectronFramework.js +13 -14
- package/out/electron/ElectronFramework.js.map +1 -1
- package/out/electron/electronMac.js +7 -9
- package/out/electron/electronMac.js.map +1 -1
- package/out/electron/electronVersion.d.ts +1 -3
- package/out/electron/electronVersion.js +3 -4
- package/out/electron/electronVersion.js.map +1 -1
- package/out/electron/electronWin.js +2 -2
- package/out/electron/electronWin.js.map +1 -1
- package/out/fileMatcher.d.ts +19 -0
- package/out/fileMatcher.js +2 -4
- package/out/fileMatcher.js.map +1 -1
- package/out/fileTransformer.js.map +1 -1
- package/out/frameworks/LibUiFramework.js +1 -1
- package/out/frameworks/LibUiFramework.js.map +1 -1
- package/out/index.d.ts +22 -23
- package/out/index.js +16 -16
- package/out/index.js.map +1 -1
- package/out/linuxPackager.js +1 -1
- package/out/linuxPackager.js.map +1 -1
- package/out/macPackager.d.ts +6 -6
- package/out/macPackager.js +30 -15
- package/out/macPackager.js.map +1 -1
- package/out/options/metadata.d.ts +1 -3
- package/out/options/metadata.js.map +1 -1
- package/out/options/winOptions.d.ts +5 -2
- package/out/options/winOptions.js.map +1 -1
- package/out/packager.js +2 -2
- package/out/packager.js.map +1 -1
- package/out/packagerApi.d.ts +1 -1
- package/out/packagerApi.js.map +1 -1
- package/out/platformPackager.d.ts +26 -12
- package/out/platformPackager.js +47 -22
- package/out/platformPackager.js.map +1 -1
- package/out/presets/rectCra.js +1 -2
- package/out/presets/rectCra.js.map +1 -1
- package/out/publish/PublishManager.d.ts +3 -3
- package/out/publish/PublishManager.js +2 -3
- package/out/publish/PublishManager.js.map +1 -1
- package/out/publish/updateInfoBuilder.js +4 -3
- package/out/publish/updateInfoBuilder.js.map +1 -1
- package/out/targets/AppxTarget.js +3 -5
- package/out/targets/AppxTarget.js.map +1 -1
- package/out/targets/FpmTarget.js +4 -6
- package/out/targets/FpmTarget.js.map +1 -1
- package/out/targets/LinuxTargetHelper.d.ts +2 -6
- package/out/targets/LinuxTargetHelper.js.map +1 -1
- package/out/targets/MsiTarget.js +2 -4
- package/out/targets/MsiTarget.js.map +1 -1
- package/out/targets/archive.js +7 -9
- package/out/targets/archive.js.map +1 -1
- package/out/targets/nsis/Defines.d.ts +1 -1
- package/out/targets/nsis/Defines.js.map +1 -1
- package/out/targets/nsis/NsisTarget.js +6 -8
- package/out/targets/nsis/NsisTarget.js.map +1 -1
- package/out/targets/nsis/nsisLang.js +1 -1
- package/out/targets/nsis/nsisLang.js.map +1 -1
- package/out/targets/nsis/nsisLicense.js +2 -2
- package/out/targets/nsis/nsisLicense.js.map +1 -1
- package/out/targets/nsis/nsisOptions.d.ts +6 -1
- package/out/targets/nsis/nsisOptions.js.map +1 -1
- package/out/targets/nsis/nsisUtil.d.ts +1 -1
- package/out/targets/nsis/nsisUtil.js +5 -6
- package/out/targets/nsis/nsisUtil.js.map +1 -1
- package/out/targets/pkg.d.ts +3 -2
- package/out/targets/pkg.js +3 -3
- package/out/targets/pkg.js.map +1 -1
- package/out/targets/snap.js.map +1 -1
- package/out/targets/targetUtil.d.ts +1 -1
- package/out/targets/targetUtil.js +1 -1
- package/out/targets/targetUtil.js.map +1 -1
- package/out/util/AppFileWalker.js.map +1 -1
- package/out/util/NodeModuleCopyHelper.js +5 -5
- package/out/util/NodeModuleCopyHelper.js.map +1 -1
- package/out/util/appBuilder.d.ts +1 -3
- package/out/util/appBuilder.js.map +1 -1
- package/out/util/appFileCopier.js +16 -15
- package/out/util/appFileCopier.js.map +1 -1
- package/out/util/bundledTool.d.ts +2 -1
- package/out/util/bundledTool.js.map +1 -1
- package/out/util/cacheManager.js +1 -2
- package/out/util/cacheManager.js.map +1 -1
- package/out/util/config/config.d.ts +3 -4
- package/out/util/config/config.js +1 -1
- package/out/util/config/config.js.map +1 -1
- package/out/util/config/load.d.ts +2 -4
- package/out/util/config/load.js +10 -4
- package/out/util/config/load.js.map +1 -1
- package/out/util/license.d.ts +2 -1
- package/out/util/license.js.map +1 -1
- package/out/util/macosVersion.js +2 -2
- package/out/util/macosVersion.js.map +1 -1
- package/out/util/macroExpander.d.ts +2 -1
- package/out/util/macroExpander.js.map +1 -1
- package/out/util/normalizePackageData.js +1 -1
- package/out/util/normalizePackageData.js.map +1 -1
- package/out/util/packageMetadata.js.map +1 -1
- package/out/util/rebuild/rebuild.js +1 -1
- package/out/util/rebuild/rebuild.js.map +1 -1
- package/out/util/resolve.js +2 -2
- package/out/util/resolve.js.map +1 -1
- package/out/util/yarn.js +2 -2
- 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/MonoVm.d.ts +1 -1
- package/out/vm/MonoVm.js.map +1 -1
- package/out/vm/ParallelsVm.js.map +1 -1
- package/out/vm/PwshVm.d.ts +6 -0
- package/out/vm/PwshVm.js +25 -0
- package/out/vm/PwshVm.js.map +1 -0
- package/out/vm/WineVm.d.ts +1 -1
- package/out/vm/WineVm.js +1 -1
- package/out/vm/WineVm.js.map +1 -1
- package/out/vm/vm.d.ts +4 -0
- package/out/vm/vm.js +42 -3
- package/out/vm/vm.js.map +1 -1
- package/out/winPackager.d.ts +3 -2
- package/out/winPackager.js.map +1 -1
- package/out/wine.js.map +1 -1
- package/package.json +11 -10
- package/scheme.json +4 -3
package/out/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Arch, ArchType } from "builder-util";
|
|
2
|
-
import { AllPublishOptions } from "builder-util-runtime";
|
|
2
|
+
import { AllPublishOptions, Nullish } from "builder-util-runtime";
|
|
3
3
|
export type Publish = AllPublishOptions | Array<AllPublishOptions> | null;
|
|
4
4
|
export type TargetConfigType = Array<string | TargetConfiguration> | string | TargetConfiguration | null;
|
|
5
5
|
export interface TargetConfiguration {
|
|
@@ -29,7 +29,7 @@ export declare abstract class Target {
|
|
|
29
29
|
readonly name: string;
|
|
30
30
|
readonly isAsyncSupported: boolean;
|
|
31
31
|
abstract readonly outDir: string;
|
|
32
|
-
abstract readonly options: TargetSpecificOptions |
|
|
32
|
+
abstract readonly options: TargetSpecificOptions | Nullish;
|
|
33
33
|
protected constructor(name: string, isAsyncSupported?: boolean);
|
|
34
34
|
checkOptions(): Promise<any>;
|
|
35
35
|
abstract build(appOutDir: string, arch: Arch): Promise<any>;
|
package/out/core.js.map
CHANGED
|
@@ -1 +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1B,QAAA,UAAU,GAAG,KAAK,CAAA","sourcesContent":["import { Arch, archFromString, ArchType } from \"builder-util\"\nimport { AllPublishOptions } from \"builder-util-runtime\"\n\n// https://github.com/YousefED/typescript-json-schema/issues/80\nexport type Publish = AllPublishOptions | Array<AllPublishOptions> | null\n\nexport type TargetConfigType = Array<string | TargetConfiguration> | string | TargetConfiguration | null\n\nexport interface TargetConfiguration {\n /**\n * The target name. e.g. `snap`.\n */\n readonly target: string\n\n /**\n * The arch or list of archs.\n */\n readonly arch?: Array<ArchType> | ArchType\n}\n\nexport class Platform {\n static MAC = new Platform(\"mac\", \"mac\", \"darwin\")\n static LINUX = new Platform(\"linux\", \"linux\", \"linux\")\n static WINDOWS = new Platform(\"windows\", \"win\", \"win32\")\n\n constructor(\n public name: string,\n public buildConfigurationKey: string,\n public nodeName: NodeJS.Platform\n ) {}\n\n toString() {\n return this.name\n }\n\n createTarget(type?: string | Array<string> | null, ...archs: Array<Arch>): Map<Platform, Map<Arch, Array<string>>> {\n if (type == null && (archs == null || archs.length === 0)) {\n return new Map([[this, new Map()]])\n }\n\n const archToType = new Map()\n\n for (const arch of archs == null || archs.length === 0 ? [archFromString(process.arch)] : archs) {\n archToType.set(arch, type == null ? [] : Array.isArray(type) ? type : [type])\n }\n return new Map([[this, archToType]])\n }\n\n static current(): Platform {\n return Platform.fromString(process.platform)\n }\n\n static fromString(name: string): Platform {\n name = name.toLowerCase()\n switch (name) {\n case Platform.MAC.nodeName:\n case Platform.MAC.name:\n return Platform.MAC\n\n case Platform.WINDOWS.nodeName:\n case Platform.WINDOWS.name:\n case Platform.WINDOWS.buildConfigurationKey:\n return Platform.WINDOWS\n\n case Platform.LINUX.nodeName:\n return Platform.LINUX\n\n default:\n throw new Error(`Unknown platform: ${name}`)\n }\n }\n}\n\nexport abstract class Target {\n abstract readonly outDir: string\n abstract readonly options: TargetSpecificOptions |
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":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import { AllPublishOptions, Nullish } from \"builder-util-runtime\"\n\n// https://github.com/YousefED/typescript-json-schema/issues/80\nexport type Publish = AllPublishOptions | Array<AllPublishOptions> | null\n\nexport type TargetConfigType = Array<string | TargetConfiguration> | string | TargetConfiguration | null\n\nexport interface TargetConfiguration {\n /**\n * The target name. e.g. `snap`.\n */\n readonly target: string\n\n /**\n * The arch or list of archs.\n */\n readonly arch?: Array<ArchType> | ArchType\n}\n\nexport class Platform {\n static MAC = new Platform(\"mac\", \"mac\", \"darwin\")\n static LINUX = new Platform(\"linux\", \"linux\", \"linux\")\n static WINDOWS = new Platform(\"windows\", \"win\", \"win32\")\n\n constructor(\n public name: string,\n public buildConfigurationKey: string,\n public nodeName: NodeJS.Platform\n ) {}\n\n toString() {\n return this.name\n }\n\n createTarget(type?: string | Array<string> | null, ...archs: Array<Arch>): Map<Platform, Map<Arch, Array<string>>> {\n if (type == null && (archs == null || archs.length === 0)) {\n return new Map([[this, new Map()]])\n }\n\n const archToType = new Map()\n\n for (const arch of archs == null || archs.length === 0 ? [archFromString(process.arch)] : archs) {\n archToType.set(arch, type == null ? [] : Array.isArray(type) ? type : [type])\n }\n return new Map([[this, archToType]])\n }\n\n static current(): Platform {\n return Platform.fromString(process.platform)\n }\n\n static fromString(name: string): Platform {\n name = name.toLowerCase()\n switch (name) {\n case Platform.MAC.nodeName:\n case Platform.MAC.name:\n return Platform.MAC\n\n case Platform.WINDOWS.nodeName:\n case Platform.WINDOWS.name:\n case Platform.WINDOWS.buildConfigurationKey:\n return Platform.WINDOWS\n\n case Platform.LINUX.nodeName:\n return Platform.LINUX\n\n default:\n throw new Error(`Unknown platform: ${name}`)\n }\n }\n}\n\nexport abstract class Target {\n abstract readonly outDir: string\n abstract readonly options: TargetSpecificOptions | Nullish\n\n protected constructor(\n readonly name: string,\n readonly isAsyncSupported: boolean = true\n ) {}\n\n async checkOptions(): Promise<any> {\n // ignore\n }\n\n abstract build(appOutDir: string, arch: Arch): Promise<any>\n\n finishBuild(): Promise<any> {\n return Promise.resolve()\n }\n}\n\nexport interface TargetSpecificOptions {\n /**\n The [artifact file name template](./configuration.md#artifact-file-name-template).\n */\n readonly artifactName?: string | null\n\n publish?: Publish\n}\n\nexport const DEFAULT_TARGET = \"default\"\nexport const DIR_TARGET = \"dir\"\n\nexport type CompressionLevel = \"store\" | \"normal\" | \"maximum\"\n\nexport interface BeforeBuildContext {\n readonly appDir: string\n readonly electronVersion: string\n readonly platform: Platform\n readonly arch: string\n}\n\nexport interface SourceRepositoryInfo {\n type?: string\n domain?: string\n user: string\n project: string\n}\n"]}
|
|
@@ -2,19 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createBrandingOpts = createBrandingOpts;
|
|
4
4
|
exports.createElectronFrameworkSupport = createElectronFrameworkSupport;
|
|
5
|
-
const bluebird_lst_1 = require("bluebird-lst");
|
|
6
5
|
const builder_util_1 = require("builder-util");
|
|
7
|
-
const builder_util_2 = require("builder-util");
|
|
8
6
|
const fs_extra_1 = require("fs-extra");
|
|
7
|
+
const fs = require("fs/promises");
|
|
9
8
|
const path = require("path");
|
|
9
|
+
const tiny_async_pool_1 = require("tiny-async-pool");
|
|
10
10
|
const index_1 = require("../index");
|
|
11
11
|
const pathManager_1 = require("../util/pathManager");
|
|
12
|
+
const resolve_1 = require("../util/resolve");
|
|
12
13
|
const electronMac_1 = require("./electronMac");
|
|
13
|
-
const electronWin_1 = require("./electronWin");
|
|
14
14
|
const electronVersion_1 = require("./electronVersion");
|
|
15
|
-
const
|
|
15
|
+
const electronWin_1 = require("./electronWin");
|
|
16
16
|
const injectFFMPEG_1 = require("./injectFFMPEG");
|
|
17
|
-
const resolve_1 = require("../util/resolve");
|
|
18
17
|
function createBrandingOpts(opts) {
|
|
19
18
|
var _a, _b;
|
|
20
19
|
return {
|
|
@@ -58,7 +57,7 @@ async function removeUnusedLanguagesIfNeeded(options) {
|
|
|
58
57
|
}
|
|
59
58
|
const { dir, langFileExt } = getLocalesConfig(options);
|
|
60
59
|
// noinspection SpellCheckingInspection
|
|
61
|
-
await
|
|
60
|
+
await (0, tiny_async_pool_1.default)(builder_util_1.MAX_FILE_REQUESTS, await (0, fs_extra_1.readdir)(dir), async (file) => {
|
|
62
61
|
if (!file.endsWith(langFileExt)) {
|
|
63
62
|
return;
|
|
64
63
|
}
|
|
@@ -67,7 +66,7 @@ async function removeUnusedLanguagesIfNeeded(options) {
|
|
|
67
66
|
return fs.rm(path.join(dir, file), { recursive: true, force: true });
|
|
68
67
|
}
|
|
69
68
|
return;
|
|
70
|
-
}
|
|
69
|
+
});
|
|
71
70
|
function getLocalesConfig(options) {
|
|
72
71
|
const { appOutDir, packager } = options;
|
|
73
72
|
if (packager.platform === index_1.Platform.MAC) {
|
|
@@ -137,8 +136,8 @@ async function unpack(prepareOptions, options, distMacOsAppName) {
|
|
|
137
136
|
// check if supplied a custom electron distributable/fork/predownloaded directory
|
|
138
137
|
if (typeof electronDist === "string") {
|
|
139
138
|
let resolvedDist;
|
|
140
|
-
// check if custom electron hook file for import
|
|
141
|
-
if ((_a = (await (0,
|
|
139
|
+
// check if custom electron hook file for import resolving
|
|
140
|
+
if ((_a = (await (0, builder_util_1.statOrNull)(electronDist))) === null || _a === void 0 ? void 0 : _a.isFile()) {
|
|
142
141
|
const customElectronDist = await (0, resolve_1.resolveFunction)(packager.appInfo.type, electronDist, "electronDist");
|
|
143
142
|
resolvedDist = await Promise.resolve(typeof customElectronDist === "function" ? customElectronDist(prepareOptions) : customElectronDist);
|
|
144
143
|
}
|
|
@@ -149,7 +148,7 @@ async function unpack(prepareOptions, options, distMacOsAppName) {
|
|
|
149
148
|
}
|
|
150
149
|
if (dist != null) {
|
|
151
150
|
const zipFile = `electron-v${options.version}-${platformName}-${options.arch}.zip`;
|
|
152
|
-
if ((await (0,
|
|
151
|
+
if ((await (0, builder_util_1.statOrNull)(path.join(dist, zipFile))) != null) {
|
|
153
152
|
builder_util_1.log.info({ dist, zipFile }, "resolved electronDist");
|
|
154
153
|
options.cache = dist;
|
|
155
154
|
dist = null;
|
|
@@ -168,8 +167,8 @@ async function unpack(prepareOptions, options, distMacOsAppName) {
|
|
|
168
167
|
const destination = packager.getElectronDestinationDir(appOutDir);
|
|
169
168
|
builder_util_1.log.info({ source, destination }, "copying Electron");
|
|
170
169
|
await (0, fs_extra_1.emptyDir)(appOutDir);
|
|
171
|
-
await (0,
|
|
172
|
-
isUseHardLink:
|
|
170
|
+
await (0, builder_util_1.copyDir)(source, destination, {
|
|
171
|
+
isUseHardLink: builder_util_1.DO_NOT_USE_HARD_LINKS,
|
|
173
172
|
});
|
|
174
173
|
}
|
|
175
174
|
await cleanupAfterUnpack(prepareOptions, distMacOsAppName, isFullCleanup);
|
|
@@ -179,8 +178,8 @@ function cleanupAfterUnpack(prepareOptions, distMacOsAppName, isFullCleanup) {
|
|
|
179
178
|
const isMac = prepareOptions.packager.platform === index_1.Platform.MAC;
|
|
180
179
|
const resourcesPath = isMac ? path.join(out, distMacOsAppName, "Contents", "Resources") : path.join(out, "resources");
|
|
181
180
|
return Promise.all([
|
|
182
|
-
isFullCleanup ? (0,
|
|
183
|
-
isFullCleanup ? (0,
|
|
181
|
+
isFullCleanup ? (0, builder_util_1.unlinkIfExists)(path.join(resourcesPath, "default_app.asar")) : Promise.resolve(),
|
|
182
|
+
isFullCleanup ? (0, builder_util_1.unlinkIfExists)(path.join(out, "version")) : Promise.resolve(),
|
|
184
183
|
isMac
|
|
185
184
|
? Promise.resolve()
|
|
186
185
|
: (0, fs_extra_1.rename)(path.join(out, "LICENSE"), path.join(out, "LICENSE.electron.txt")).catch(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElectronFramework.js","sourceRoot":"","sources":["../../src/electron/ElectronFramework.ts"],"names":[],"mappings":";;AA6BA,gDAKC;AAmID,wEAiBC;AAtLD,+CAA0C;AAC1C,+CAA8D;AAC9D,+CAAsG;AACtG,uCAAoD;AACpD,6BAA4B;AAG5B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E,aAAa,CAAC,CAAA;AAC3E,CAAC;AAED,SAAS,kBAAkB,CAAC,cAAuD,EAAE,gBAAwB,EAAE,aAAsB;IACnI,MAAM,GAAG,GAAG,cAAc,CAAC,SAAS,CAAA;IACpC,MAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,QAAQ,KAAK,gBAAQ,CAAC,GAAG,CAAA;IAC/D,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IAErH,OAAO,OAAO,CAAC,GAAG,CAAC;QACjB,aAAa,CAAC,CAAC,CAAC,IAAA,6BAAc,EAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;QAChG,aAAa,CAAC,CAAC,CAAC,IAAA,6BAAc,EAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;QAC7E,KAAK;YACH,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;YACnB,CAAC,CAAC,IAAA,iBAAM,EAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;gBACnF,YAAY;YACd,CAAC,CAAC;KACP,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { asArray, executeAppBuilder, log } from \"builder-util\"\nimport { CONCURRENCY, copyDir, DO_NOT_USE_HARD_LINKS, statOrNull, unlinkIfExists } from \"builder-util\"\nimport { emptyDir, readdir, rename } from \"fs-extra\"\nimport * as path from \"path\"\nimport { Configuration } from \"../configuration\"\nimport { BeforeCopyExtraFilesOptions, Framework, PrepareApplicationStageDirectoryOptions } from \"../Framework\"\nimport { Packager, Platform } from \"../index\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { MacPackager } from \"../macPackager\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { createMacApp } from \"./electronMac\"\nimport { addWinAsarIntegrity } from \"./electronWin\"\nimport { computeElectronVersion, getElectronVersionFromInstalled } from \"./electronVersion\"\nimport * as fs from \"fs/promises\"\nimport injectFFMPEG from \"./injectFFMPEG\"\nimport { resolveFunction } from \"../util/resolve\"\n\nexport type ElectronPlatformName = \"darwin\" | \"linux\" | \"win32\" | \"mas\"\n\n/**\n * Electron distributables branding options.\n * @see [Electron BRANDING.json](https://github.com/electron/electron/blob/master/shell/app/BRANDING.json).\n */\nexport interface ElectronBrandingOptions {\n projectName?: string\n productName?: string\n}\n\nexport function createBrandingOpts(opts: Configuration): Required<ElectronBrandingOptions> {\n return {\n projectName: opts.electronBranding?.projectName || \"electron\",\n productName: opts.electronBranding?.productName || \"Electron\",\n }\n}\n\nexport interface ElectronDownloadOptions {\n // https://github.com/electron-userland/electron-builder/issues/3077\n // must be optional\n version?: string\n\n /**\n * The [cache location](https://github.com/electron-userland/electron-download#cache-location).\n */\n cache?: string | null\n\n /**\n * The mirror.\n */\n mirror?: string | null\n\n /** @private */\n customDir?: string | null\n /** @private */\n customFilename?: string | null\n\n strictSSL?: boolean\n isVerifyChecksum?: boolean\n\n platform?: ElectronPlatformName\n arch?: string\n}\n\nfunction createDownloadOpts(opts: Configuration, platform: ElectronPlatformName, arch: string, electronVersion: string): ElectronDownloadOptions {\n return {\n platform,\n arch,\n version: electronVersion,\n ...opts.electronDownload,\n }\n}\n\nasync function beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n const { appOutDir, packager } = options\n const electronBranding = createBrandingOpts(packager.config)\n if (packager.platform === Platform.LINUX) {\n const linuxPackager = packager as LinuxPackager\n const executable = path.join(appOutDir, linuxPackager.executableName)\n await rename(path.join(appOutDir, electronBranding.projectName), executable)\n } else if (packager.platform === Platform.WINDOWS) {\n const executable = path.join(appOutDir, `${packager.appInfo.productFilename}.exe`)\n await rename(path.join(appOutDir, `${electronBranding.projectName}.exe`), executable)\n if (options.asarIntegrity) {\n await addWinAsarIntegrity(executable, options.asarIntegrity)\n }\n } else {\n await createMacApp(packager as MacPackager, appOutDir, options.asarIntegrity, (options.platformName as ElectronPlatformName) === \"mas\")\n }\n await removeUnusedLanguagesIfNeeded(options)\n}\n\nasync function removeUnusedLanguagesIfNeeded(options: BeforeCopyExtraFilesOptions) {\n const {\n packager: { config, platformSpecificBuildOptions },\n } = options\n const wantedLanguages = asArray(platformSpecificBuildOptions.electronLanguages || config.electronLanguages)\n if (!wantedLanguages.length) {\n return\n }\n\n const { dir, langFileExt } = getLocalesConfig(options)\n // noinspection SpellCheckingInspection\n await BluebirdPromise.map(\n readdir(dir),\n file => {\n if (!file.endsWith(langFileExt)) {\n return\n }\n\n const language = file.substring(0, file.length - langFileExt.length)\n if (!wantedLanguages.includes(language)) {\n return fs.rm(path.join(dir, file), { recursive: true, force: true })\n }\n return\n },\n CONCURRENCY\n )\n\n function getLocalesConfig(options: BeforeCopyExtraFilesOptions) {\n const { appOutDir, packager } = options\n if (packager.platform === Platform.MAC) {\n return { dir: packager.getResourcesDir(appOutDir), langFileExt: \".lproj\" }\n } else {\n return { dir: path.join(packager.getResourcesDir(appOutDir), \"..\", \"locales\"), langFileExt: \".pak\" }\n }\n }\n}\n\nclass ElectronFramework implements Framework {\n // noinspection JSUnusedGlobalSymbols\n readonly macOsDefaultTargets = [\"zip\", \"dmg\"]\n // noinspection JSUnusedGlobalSymbols\n readonly defaultAppIdPrefix = \"com.electron.\"\n // noinspection JSUnusedGlobalSymbols\n readonly isCopyElevateHelper = true\n // noinspection JSUnusedGlobalSymbols\n readonly isNpmRebuildRequired = true\n\n constructor(\n readonly name: string,\n readonly version: string,\n readonly distMacOsAppName: string\n ) {}\n\n getDefaultIcon(platform: Platform) {\n if (platform === Platform.LINUX) {\n return path.join(getTemplatePath(\"icons\"), \"electron-linux\")\n } else {\n // default icon is embedded into app skeleton\n return null\n }\n }\n\n async prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n await unpack(options, createDownloadOpts(options.packager.config, options.platformName, options.arch, this.version), this.distMacOsAppName)\n if (options.packager.config.downloadAlternateFFmpeg) {\n await injectFFMPEG(options, this.version)\n }\n }\n\n beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n return beforeCopyExtraFiles(options)\n }\n}\n\nexport async function createElectronFrameworkSupport(configuration: Configuration, packager: Packager): Promise<Framework> {\n let version = configuration.electronVersion\n if (version == null) {\n // for prepacked app asar no dev deps in the app.asar\n if (packager.isPrepackedAppAsar) {\n version = await getElectronVersionFromInstalled(packager.projectDir)\n if (version == null) {\n throw new Error(`Cannot compute electron version for prepacked asar`)\n }\n } else {\n version = await computeElectronVersion(packager.projectDir)\n }\n configuration.electronVersion = version\n }\n\n const branding = createBrandingOpts(configuration)\n return new ElectronFramework(branding.projectName, version, `${branding.productName}.app`)\n}\n\nasync function unpack(prepareOptions: PrepareApplicationStageDirectoryOptions, options: ElectronDownloadOptions, distMacOsAppName: string) {\n const { packager, appOutDir, platformName } = prepareOptions\n\n const electronDist = packager.config.electronDist || null\n let dist: string | null = null\n // check if supplied a custom electron distributable/fork/predownloaded directory\n if (typeof electronDist === \"string\") {\n let resolvedDist: string\n // check if custom electron hook file for import resolving\n if ((await statOrNull(electronDist))?.isFile()) {\n const customElectronDist: any = await resolveFunction(packager.appInfo.type, electronDist, \"electronDist\")\n resolvedDist = await Promise.resolve(typeof customElectronDist === \"function\" ? customElectronDist(prepareOptions) : customElectronDist)\n } else {\n resolvedDist = electronDist\n }\n dist = path.isAbsolute(resolvedDist) ? resolvedDist : path.resolve(packager.projectDir, resolvedDist)\n }\n if (dist != null) {\n const zipFile = `electron-v${options.version}-${platformName}-${options.arch}.zip`\n if ((await statOrNull(path.join(dist, zipFile))) != null) {\n log.info({ dist, zipFile }, \"resolved electronDist\")\n options.cache = dist\n dist = null\n } else {\n log.info({ electronDist: log.filePath(dist), expectedFile: zipFile }, \"custom electronDist provided but no zip found; assuming unpacked electron directory.\")\n }\n }\n\n let isFullCleanup = false\n if (dist == null) {\n await executeAppBuilder([\"unpack-electron\", \"--configuration\", JSON.stringify([options]), \"--output\", appOutDir, \"--distMacOsAppName\", distMacOsAppName])\n } else {\n isFullCleanup = true\n const source = packager.getElectronSrcDir(dist)\n const destination = packager.getElectronDestinationDir(appOutDir)\n log.info({ source, destination }, \"copying Electron\")\n await emptyDir(appOutDir)\n await copyDir(source, destination, {\n isUseHardLink: DO_NOT_USE_HARD_LINKS,\n })\n }\n\n await cleanupAfterUnpack(prepareOptions, distMacOsAppName, isFullCleanup)\n}\n\nfunction cleanupAfterUnpack(prepareOptions: PrepareApplicationStageDirectoryOptions, distMacOsAppName: string, isFullCleanup: boolean) {\n const out = prepareOptions.appOutDir\n const isMac = prepareOptions.packager.platform === Platform.MAC\n const resourcesPath = isMac ? path.join(out, distMacOsAppName, \"Contents\", \"Resources\") : path.join(out, \"resources\")\n\n return Promise.all([\n isFullCleanup ? unlinkIfExists(path.join(resourcesPath, \"default_app.asar\")) : Promise.resolve(),\n isFullCleanup ? unlinkIfExists(path.join(out, \"version\")) : Promise.resolve(),\n isMac\n ? Promise.resolve()\n : rename(path.join(out, \"LICENSE\"), path.join(out, \"LICENSE.electron.txt\")).catch(() => {\n /* ignore */\n }),\n ])\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ElectronFramework.js","sourceRoot":"","sources":["../../src/electron/ElectronFramework.ts"],"names":[],"mappings":";;AA4BA,gDAKC;AA+HD,wEAiBC;AAjLD,+CAA6I;AAC7I,uCAAoD;AACpD,kCAAiC;AACjC,6BAA4B;AAC5B,qDAAuC;AAGvC,oCAA6C;AAG7C,qDAAqD;AACrD,6CAAiD;AAC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AAS,kBAAkB,CAAC,cAAuD,EAAE,gBAAwB,EAAE,aAAsB;IACnI,MAAM,GAAG,GAAG,cAAc,CAAC,SAAS,CAAA;IACpC,MAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,QAAQ,KAAK,gBAAQ,CAAC,GAAG,CAAA;IAC/D,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IAErH,OAAO,OAAO,CAAC,GAAG,CAAC;QACjB,aAAa,CAAC,CAAC,CAAC,IAAA,6BAAc,EAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;QAChG,aAAa,CAAC,CAAC,CAAC,IAAA,6BAAc,EAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;QAC7E,KAAK;YACH,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;YACnB,CAAC,CAAC,IAAA,iBAAM,EAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;gBACnF,YAAY;YACd,CAAC,CAAC;KACP,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { asArray, copyDir, DO_NOT_USE_HARD_LINKS, executeAppBuilder, log, MAX_FILE_REQUESTS, statOrNull, unlinkIfExists } from \"builder-util\"\nimport { emptyDir, readdir, rename } from \"fs-extra\"\nimport * as fs from \"fs/promises\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { Configuration } from \"../configuration\"\nimport { BeforeCopyExtraFilesOptions, Framework, PrepareApplicationStageDirectoryOptions } from \"../Framework\"\nimport { Packager, Platform } from \"../index\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { MacPackager } from \"../macPackager\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { resolveFunction } from \"../util/resolve\"\nimport { createMacApp } from \"./electronMac\"\nimport { computeElectronVersion, getElectronVersionFromInstalled } from \"./electronVersion\"\nimport { addWinAsarIntegrity } from \"./electronWin\"\nimport injectFFMPEG from \"./injectFFMPEG\"\n\nexport type ElectronPlatformName = \"darwin\" | \"linux\" | \"win32\" | \"mas\"\n\n/**\n * Electron distributables branding options.\n * @see [Electron BRANDING.json](https://github.com/electron/electron/blob/master/shell/app/BRANDING.json).\n */\nexport interface ElectronBrandingOptions {\n projectName?: string\n productName?: string\n}\n\nexport function createBrandingOpts(opts: Configuration): Required<ElectronBrandingOptions> {\n return {\n projectName: opts.electronBranding?.projectName || \"electron\",\n productName: opts.electronBranding?.productName || \"Electron\",\n }\n}\n\nexport interface ElectronDownloadOptions {\n // https://github.com/electron-userland/electron-builder/issues/3077\n // must be optional\n version?: string\n\n /**\n * The [cache location](https://github.com/electron-userland/electron-download#cache-location).\n */\n cache?: string | null\n\n /**\n * The mirror.\n */\n mirror?: string | null\n\n /** @private */\n customDir?: string | null\n /** @private */\n customFilename?: string | null\n\n strictSSL?: boolean\n isVerifyChecksum?: boolean\n\n platform?: ElectronPlatformName\n arch?: string\n}\n\nfunction createDownloadOpts(opts: Configuration, platform: ElectronPlatformName, arch: string, electronVersion: string): ElectronDownloadOptions {\n return {\n platform,\n arch,\n version: electronVersion,\n ...opts.electronDownload,\n }\n}\n\nasync function beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n const { appOutDir, packager } = options\n const electronBranding = createBrandingOpts(packager.config)\n if (packager.platform === Platform.LINUX) {\n const linuxPackager = packager as LinuxPackager\n const executable = path.join(appOutDir, linuxPackager.executableName)\n await rename(path.join(appOutDir, electronBranding.projectName), executable)\n } else if (packager.platform === Platform.WINDOWS) {\n const executable = path.join(appOutDir, `${packager.appInfo.productFilename}.exe`)\n await rename(path.join(appOutDir, `${electronBranding.projectName}.exe`), executable)\n if (options.asarIntegrity) {\n await addWinAsarIntegrity(executable, options.asarIntegrity)\n }\n } else {\n await createMacApp(packager as MacPackager, appOutDir, options.asarIntegrity, (options.platformName as ElectronPlatformName) === \"mas\")\n }\n await removeUnusedLanguagesIfNeeded(options)\n}\n\nasync function removeUnusedLanguagesIfNeeded(options: BeforeCopyExtraFilesOptions) {\n const {\n packager: { config, platformSpecificBuildOptions },\n } = options\n const wantedLanguages = asArray(platformSpecificBuildOptions.electronLanguages || config.electronLanguages)\n if (!wantedLanguages.length) {\n return\n }\n\n const { dir, langFileExt } = getLocalesConfig(options)\n // noinspection SpellCheckingInspection\n await asyncPool(MAX_FILE_REQUESTS, await readdir(dir), async file => {\n if (!file.endsWith(langFileExt)) {\n return\n }\n\n const language = file.substring(0, file.length - langFileExt.length)\n if (!wantedLanguages.includes(language)) {\n return fs.rm(path.join(dir, file), { recursive: true, force: true })\n }\n return\n })\n\n function getLocalesConfig(options: BeforeCopyExtraFilesOptions) {\n const { appOutDir, packager } = options\n if (packager.platform === Platform.MAC) {\n return { dir: packager.getResourcesDir(appOutDir), langFileExt: \".lproj\" }\n } else {\n return { dir: path.join(packager.getResourcesDir(appOutDir), \"..\", \"locales\"), langFileExt: \".pak\" }\n }\n }\n}\n\nclass ElectronFramework implements Framework {\n // noinspection JSUnusedGlobalSymbols\n readonly macOsDefaultTargets = [\"zip\", \"dmg\"]\n // noinspection JSUnusedGlobalSymbols\n readonly defaultAppIdPrefix = \"com.electron.\"\n // noinspection JSUnusedGlobalSymbols\n readonly isCopyElevateHelper = true\n // noinspection JSUnusedGlobalSymbols\n readonly isNpmRebuildRequired = true\n\n constructor(\n readonly name: string,\n readonly version: string,\n readonly distMacOsAppName: string\n ) {}\n\n getDefaultIcon(platform: Platform) {\n if (platform === Platform.LINUX) {\n return path.join(getTemplatePath(\"icons\"), \"electron-linux\")\n } else {\n // default icon is embedded into app skeleton\n return null\n }\n }\n\n async prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n await unpack(options, createDownloadOpts(options.packager.config, options.platformName, options.arch, this.version), this.distMacOsAppName)\n if (options.packager.config.downloadAlternateFFmpeg) {\n await injectFFMPEG(options, this.version)\n }\n }\n\n beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n return beforeCopyExtraFiles(options)\n }\n}\n\nexport async function createElectronFrameworkSupport(configuration: Configuration, packager: Packager): Promise<Framework> {\n let version = configuration.electronVersion\n if (version == null) {\n // for prepacked app asar no dev deps in the app.asar\n if (packager.isPrepackedAppAsar) {\n version = await getElectronVersionFromInstalled(packager.projectDir)\n if (version == null) {\n throw new Error(`Cannot compute electron version for prepacked asar`)\n }\n } else {\n version = await computeElectronVersion(packager.projectDir)\n }\n configuration.electronVersion = version\n }\n\n const branding = createBrandingOpts(configuration)\n return new ElectronFramework(branding.projectName, version, `${branding.productName}.app`)\n}\n\nasync function unpack(prepareOptions: PrepareApplicationStageDirectoryOptions, options: ElectronDownloadOptions, distMacOsAppName: string) {\n const { packager, appOutDir, platformName } = prepareOptions\n\n const electronDist = packager.config.electronDist || null\n let dist: string | null = null\n // check if supplied a custom electron distributable/fork/predownloaded directory\n if (typeof electronDist === \"string\") {\n let resolvedDist: string\n // check if custom electron hook file for import resolving\n if ((await statOrNull(electronDist))?.isFile()) {\n const customElectronDist: any = await resolveFunction(packager.appInfo.type, electronDist, \"electronDist\")\n resolvedDist = await Promise.resolve(typeof customElectronDist === \"function\" ? customElectronDist(prepareOptions) : customElectronDist)\n } else {\n resolvedDist = electronDist\n }\n dist = path.isAbsolute(resolvedDist) ? resolvedDist : path.resolve(packager.projectDir, resolvedDist)\n }\n if (dist != null) {\n const zipFile = `electron-v${options.version}-${platformName}-${options.arch}.zip`\n if ((await statOrNull(path.join(dist, zipFile))) != null) {\n log.info({ dist, zipFile }, \"resolved electronDist\")\n options.cache = dist\n dist = null\n } else {\n log.info({ electronDist: log.filePath(dist), expectedFile: zipFile }, \"custom electronDist provided but no zip found; assuming unpacked electron directory.\")\n }\n }\n\n let isFullCleanup = false\n if (dist == null) {\n await executeAppBuilder([\"unpack-electron\", \"--configuration\", JSON.stringify([options]), \"--output\", appOutDir, \"--distMacOsAppName\", distMacOsAppName])\n } else {\n isFullCleanup = true\n const source = packager.getElectronSrcDir(dist)\n const destination = packager.getElectronDestinationDir(appOutDir)\n log.info({ source, destination }, \"copying Electron\")\n await emptyDir(appOutDir)\n await copyDir(source, destination, {\n isUseHardLink: DO_NOT_USE_HARD_LINKS,\n })\n }\n\n await cleanupAfterUnpack(prepareOptions, distMacOsAppName, isFullCleanup)\n}\n\nfunction cleanupAfterUnpack(prepareOptions: PrepareApplicationStageDirectoryOptions, distMacOsAppName: string, isFullCleanup: boolean) {\n const out = prepareOptions.appOutDir\n const isMac = prepareOptions.packager.platform === Platform.MAC\n const resourcesPath = isMac ? path.join(out, distMacOsAppName, \"Contents\", \"Resources\") : path.join(out, \"resources\")\n\n return Promise.all([\n isFullCleanup ? unlinkIfExists(path.join(resourcesPath, \"default_app.asar\")) : Promise.resolve(),\n isFullCleanup ? unlinkIfExists(path.join(out, \"version\")) : Promise.resolve(),\n isMac\n ? Promise.resolve()\n : rename(path.join(out, \"LICENSE\"), path.join(out, \"LICENSE.electron.txt\")).catch(() => {\n /* ignore */\n }),\n ])\n}\n"]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createMacApp = createMacApp;
|
|
4
|
-
const bluebird_lst_1 = require("bluebird-lst");
|
|
5
4
|
const builder_util_1 = require("builder-util");
|
|
6
|
-
const builder_util_2 = require("builder-util");
|
|
7
5
|
const promises_1 = require("fs/promises");
|
|
8
6
|
const path = require("path");
|
|
9
7
|
const appInfo_1 = require("../appInfo");
|
|
@@ -14,10 +12,10 @@ function doRename(basePath, oldName, newName) {
|
|
|
14
12
|
return (0, promises_1.rename)(path.join(basePath, oldName), path.join(basePath, newName));
|
|
15
13
|
}
|
|
16
14
|
function moveHelpers(helperSuffixes, frameworksPath, appName, prefix) {
|
|
17
|
-
return
|
|
15
|
+
return Promise.all(helperSuffixes.map(suffix => {
|
|
18
16
|
const executableBasePath = path.join(frameworksPath, `${prefix}${suffix}.app`, "Contents", "MacOS");
|
|
19
17
|
return doRename(executableBasePath, `${prefix}${suffix}`, appName + suffix).then(() => doRename(frameworksPath, `${prefix}${suffix}.app`, `${appName}${suffix}.app`));
|
|
20
|
-
});
|
|
18
|
+
}));
|
|
21
19
|
}
|
|
22
20
|
function getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist) {
|
|
23
21
|
const result = [" Helper"];
|
|
@@ -167,13 +165,13 @@ async function createMacApp(packager, appOutDir, asarIntegrity, isMas) {
|
|
|
167
165
|
}
|
|
168
166
|
const fileAssociations = packager.fileAssociations;
|
|
169
167
|
if (fileAssociations.length > 0) {
|
|
170
|
-
const documentTypes = await
|
|
168
|
+
const documentTypes = await Promise.all(fileAssociations.map(async (fileAssociation) => {
|
|
171
169
|
const extensions = (0, builder_util_1.asArray)(fileAssociation.ext).map(platformPackager_1.normalizeExt);
|
|
172
170
|
const customIcon = await packager.getResource((0, builder_util_1.getPlatformIconFileName)(fileAssociation.icon, true), `${extensions[0]}.icns`);
|
|
173
171
|
let iconFile = appPlist.CFBundleIconFile;
|
|
174
172
|
if (customIcon != null) {
|
|
175
173
|
iconFile = path.basename(customIcon);
|
|
176
|
-
await (0,
|
|
174
|
+
await (0, builder_util_1.copyOrLinkFile)(customIcon, path.join(path.join(contentsPath, "Resources"), iconFile));
|
|
177
175
|
}
|
|
178
176
|
const result = {
|
|
179
177
|
CFBundleTypeExtensions: extensions,
|
|
@@ -186,7 +184,7 @@ async function createMacApp(packager, appOutDir, asarIntegrity, isMas) {
|
|
|
186
184
|
result.LSTypeIsPackage = true;
|
|
187
185
|
}
|
|
188
186
|
return result;
|
|
189
|
-
});
|
|
187
|
+
}));
|
|
190
188
|
// `CFBundleDocumentTypes` may be defined in `mac.extendInfo`, so we need to merge it in that case
|
|
191
189
|
appPlist.CFBundleDocumentTypes = [...(appPlist.CFBundleDocumentTypes || []), ...documentTypes];
|
|
192
190
|
}
|
|
@@ -218,8 +216,8 @@ async function createMacApp(packager, appOutDir, asarIntegrity, isMas) {
|
|
|
218
216
|
await Promise.all([
|
|
219
217
|
(0, appBuilder_1.executeAppBuilderAndWriteJson)(["encode-plist"], plistDataToWrite),
|
|
220
218
|
doRename(path.join(contentsPath, "MacOS"), electronBranding.productName, appPlist.CFBundleExecutable),
|
|
221
|
-
(0,
|
|
222
|
-
(0,
|
|
219
|
+
(0, builder_util_1.unlinkIfExists)(path.join(appOutDir, "LICENSE")),
|
|
220
|
+
(0, builder_util_1.unlinkIfExists)(path.join(appOutDir, "LICENSES.chromium.html")),
|
|
223
221
|
]);
|
|
224
222
|
await moveHelpers(getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist), frameworksPath, appFilename, electronBranding.productName);
|
|
225
223
|
if (helperLoginPlist != null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electronMac.js","sourceRoot":"","sources":["../../src/electron/electronMac.ts"],"names":[],"mappings":";;AAkDA,oCAoOC;AAtRD,+CAA0C;AAC1C,+CAA+F;AAC/F,+CAA6D;AAC7D,0CAA4C;AAC5C,6BAA4B;AAC5B,wCAAqD;AAGrD,0DAAkD;AAClD,mDAA2F;AAC3F,2DAAwD;AAExD,SAAS,QAAQ,CAAC,QAAgB,EAAE,OAAe,EAAE,OAAe;IAClE,OAAO,IAAA,iBAAM,EAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,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CAAC;QAChB,GAAG,GAAG,EAAE,CAAA;QACR,QAAQ,CAAC,sBAAsB,GAAG,GAAG,CAAA;IACvC,CAAC;IAED,GAAG,CAAC,uBAAuB,GAAG,IAAI,CAAA;IAClC,2FAA2F;IAC3F,GAAG,CAAC,sBAAsB,GAAG,IAAI,CAAA;IAEjC,IAAI,gBAAgB,GAAG,GAAG,CAAC,kBAAkB,CAAA;IAC7C,IAAI,gBAAgB,IAAI,IAAI,EAAE,CAAC;QAC7B,gBAAgB,GAAG,EAAE,CAAA;QACrB,GAAG,CAAC,kBAAkB,GAAG,gBAAgB,CAAA;IAC3C,CAAC;IAED,IAAI,gBAAgB,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;QACvC,MAAM,SAAS,GAAG;YAChB,4CAA4C,EAAE,KAAK;YACnD,oBAAoB,EAAE,KAAK;YAC3B,2CAA2C,EAAE,IAAI;YACjD,qCAAqC,EAAE,KAAK;YAC5C,0CAA0C,EAAE,KAAK;SAClD,CAAA;QACD,gBAAgB,CAAC,SAAS,GAAG,SAAS,CAAA;QACtC,gBAAgB,CAAC,WAAW,CAAC,GAAG,SAAS,CAAA;IAC3C,CAAC;AACH,CAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { asArray, getPlatformIconFileName, InvalidConfigurationError, log } from \"builder-util\"\nimport { copyOrLinkFile, unlinkIfExists } from \"builder-util\"\nimport { rename, utimes } from \"fs/promises\"\nimport * as path from \"path\"\nimport { filterCFBundleIdentifier } from \"../appInfo\"\nimport { AsarIntegrity } from \"../asar/integrity\"\nimport { MacPackager } from \"../macPackager\"\nimport { normalizeExt } from \"../platformPackager\"\nimport { executeAppBuilderAndWriteJson, executeAppBuilderAsJson } from \"../util/appBuilder\"\nimport { createBrandingOpts } from \"./ElectronFramework\"\n\nfunction doRename(basePath: string, oldName: string, newName: string) {\n return rename(path.join(basePath, oldName), path.join(basePath, newName))\n}\n\nfunction moveHelpers(helperSuffixes: Array<string>, frameworksPath: string, appName: string, prefix: string): Promise<any> {\n return BluebirdPromise.map(helperSuffixes, suffix => {\n const executableBasePath = path.join(frameworksPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n return doRename(executableBasePath, `${prefix}${suffix}`, appName + suffix).then(() => doRename(frameworksPath, `${prefix}${suffix}.app`, `${appName}${suffix}.app`))\n })\n}\n\nfunction getAvailableHelperSuffixes(\n helperEHPlist: string | null,\n helperNPPlist: string | null,\n helperRendererPlist: string | null,\n helperPluginPlist: string | null,\n helperGPUPlist: string | null\n) {\n const result = [\" Helper\"]\n if (helperEHPlist != null) {\n result.push(\" Helper EH\")\n }\n if (helperNPPlist != null) {\n result.push(\" Helper NP\")\n }\n if (helperRendererPlist != null) {\n result.push(\" Helper (Renderer)\")\n }\n if (helperPluginPlist != null) {\n result.push(\" Helper (Plugin)\")\n }\n if (helperGPUPlist != null) {\n result.push(\" Helper (GPU)\")\n }\n return result\n}\n\n/** @internal */\nexport async function createMacApp(packager: MacPackager, appOutDir: string, asarIntegrity: AsarIntegrity | null, isMas: boolean) {\n const appInfo = packager.appInfo\n // Electon uses the application name (CFBundleName) to resolve helper apps\n // https://github.com/electron/electron/blob/main/shell/app/electron_main_delegate_mac.mm\n // https://github.com/electron-userland/electron-builder/issues/6962\n const appFilename = appInfo.sanitizedProductName\n const electronBranding = createBrandingOpts(packager.config)\n\n const contentsPath = path.join(appOutDir, packager.info.framework.distMacOsAppName, \"Contents\")\n const frameworksPath = path.join(contentsPath, \"Frameworks\")\n const loginItemPath = path.join(contentsPath, \"Library\", \"LoginItems\")\n\n const appPlistFilename = path.join(contentsPath, \"Info.plist\")\n const helperPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper.app`, \"Contents\", \"Info.plist\")\n const helperEHPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper EH.app`, \"Contents\", \"Info.plist\")\n const helperNPPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper NP.app`, \"Contents\", \"Info.plist\")\n const helperRendererPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (Renderer).app`, \"Contents\", \"Info.plist\")\n const helperPluginPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (Plugin).app`, \"Contents\", \"Info.plist\")\n const helperGPUPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (GPU).app`, \"Contents\", \"Info.plist\")\n const helperLoginPlistFilename = path.join(loginItemPath, `${electronBranding.productName} Login Helper.app`, \"Contents\", \"Info.plist\")\n\n const plistContent: Array<any> = await executeAppBuilderAsJson([\n \"decode-plist\",\n \"-f\",\n appPlistFilename,\n \"-f\",\n helperPlistFilename,\n \"-f\",\n helperEHPlistFilename,\n \"-f\",\n helperNPPlistFilename,\n \"-f\",\n helperRendererPlistFilename,\n \"-f\",\n helperPluginPlistFilename,\n \"-f\",\n helperGPUPlistFilename,\n \"-f\",\n helperLoginPlistFilename,\n ])\n\n if (plistContent[0] == null) {\n throw new Error(\"corrupted Electron dist\")\n }\n\n const appPlist = plistContent[0]!\n const helperPlist = plistContent[1]!\n const helperEHPlist = plistContent[2]\n const helperNPPlist = plistContent[3]\n const helperRendererPlist = plistContent[4]\n const helperPluginPlist = plistContent[5]\n const helperGPUPlist = plistContent[6]\n const helperLoginPlist = plistContent[7]\n\n const buildMetadata = packager.config\n\n /**\n * Configure bundleIdentifier for the generic Electron Helper process\n *\n * This was the only Helper in Electron 5 and before. Allow users to configure\n * the bundleIdentifier for continuity.\n */\n\n const oldHelperBundleId = (buildMetadata as any)[\"helper-bundle-id\"]\n if (oldHelperBundleId != null) {\n log.warn(\"build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId\")\n }\n\n const defaultAppId = packager.platformSpecificBuildOptions.appId\n const cfBundleIdentifier = filterCFBundleIdentifier((isMas ? packager.config.mas?.appId : defaultAppId) || defaultAppId || appInfo.macBundleIdentifier)\n\n const defaultHelperId = packager.platformSpecificBuildOptions.helperBundleId\n const helperBundleIdentifier = filterCFBundleIdentifier(\n (isMas ? packager.config.mas?.helperBundleId : defaultHelperId) || defaultHelperId || oldHelperBundleId || `${cfBundleIdentifier}.helper`\n )\n\n appPlist.CFBundleIdentifier = cfBundleIdentifier\n\n await packager.applyCommonInfo(appPlist, contentsPath)\n\n // required for electron-updater proxy\n if (!isMas) {\n configureLocalhostAts(appPlist)\n }\n\n helperPlist.CFBundleExecutable = `${appFilename} Helper`\n helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`\n helperPlist.CFBundleIdentifier = helperBundleIdentifier\n helperPlist.CFBundleVersion = appPlist.CFBundleVersion\n\n /**\n * Configure bundleIdentifier for Electron 5+ Helper processes\n *\n * In Electron 6, parts of the generic Electron Helper process were split into\n * individual helper processes. Allow users to configure the bundleIdentifiers\n * for continuity, specifically because macOS keychain access relies on\n * bundleIdentifiers not changing (i.e. across versions of Electron).\n */\n\n function configureHelper(helper: any, postfix: string, userProvidedBundleIdentifier?: string | null) {\n helper.CFBundleExecutable = `${appFilename} Helper ${postfix}`\n helper.CFBundleDisplayName = `${appInfo.productName} Helper ${postfix}`\n helper.CFBundleIdentifier = userProvidedBundleIdentifier\n ? filterCFBundleIdentifier(userProvidedBundleIdentifier)\n : filterCFBundleIdentifier(`${helperBundleIdentifier}.${postfix}`)\n helper.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n if (helperRendererPlist != null) {\n configureHelper(helperRendererPlist, \"(Renderer)\", packager.platformSpecificBuildOptions.helperRendererBundleId)\n }\n if (helperPluginPlist != null) {\n configureHelper(helperPluginPlist, \"(Plugin)\", packager.platformSpecificBuildOptions.helperPluginBundleId)\n }\n if (helperGPUPlist != null) {\n configureHelper(helperGPUPlist, \"(GPU)\", packager.platformSpecificBuildOptions.helperGPUBundleId)\n }\n if (helperEHPlist != null) {\n configureHelper(helperEHPlist, \"EH\", packager.platformSpecificBuildOptions.helperEHBundleId)\n }\n if (helperNPPlist != null) {\n configureHelper(helperNPPlist, \"NP\", packager.platformSpecificBuildOptions.helperNPBundleId)\n }\n if (helperLoginPlist != null) {\n helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`\n helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`\n // noinspection SpellCheckingInspection\n helperLoginPlist.CFBundleIdentifier = `${cfBundleIdentifier}.loginhelper`\n helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n const protocols = asArray(buildMetadata.protocols).concat(asArray(packager.platformSpecificBuildOptions.protocols))\n if (protocols.length > 0) {\n appPlist.CFBundleURLTypes = protocols.map(protocol => {\n const schemes = asArray(protocol.schemes)\n if (schemes.length === 0) {\n throw new InvalidConfigurationError(`Protocol \"${protocol.name}\": must be at least one scheme specified`)\n }\n return {\n CFBundleURLName: protocol.name,\n CFBundleTypeRole: protocol.role || \"Editor\",\n CFBundleURLSchemes: schemes.slice(),\n }\n })\n }\n\n const fileAssociations = packager.fileAssociations\n if (fileAssociations.length > 0) {\n const documentTypes = await BluebirdPromise.map(fileAssociations, async fileAssociation => {\n const extensions = asArray(fileAssociation.ext).map(normalizeExt)\n const customIcon = await packager.getResource(getPlatformIconFileName(fileAssociation.icon, true), `${extensions[0]}.icns`)\n let iconFile = appPlist.CFBundleIconFile\n if (customIcon != null) {\n iconFile = path.basename(customIcon)\n await copyOrLinkFile(customIcon, path.join(path.join(contentsPath, \"Resources\"), iconFile))\n }\n\n const result = {\n CFBundleTypeExtensions: extensions,\n CFBundleTypeName: fileAssociation.name || extensions[0],\n CFBundleTypeRole: fileAssociation.role || \"Editor\",\n LSHandlerRank: fileAssociation.rank || \"Default\",\n CFBundleTypeIconFile: iconFile,\n } as any\n\n if (fileAssociation.isPackage) {\n result.LSTypeIsPackage = true\n }\n return result\n })\n\n // `CFBundleDocumentTypes` may be defined in `mac.extendInfo`, so we need to merge it in that case\n appPlist.CFBundleDocumentTypes = [...(appPlist.CFBundleDocumentTypes || []), ...documentTypes]\n }\n\n if (asarIntegrity != null) {\n appPlist.ElectronAsarIntegrity = asarIntegrity\n }\n\n const plistDataToWrite: any = {\n [appPlistFilename]: appPlist,\n [helperPlistFilename]: helperPlist,\n }\n if (helperEHPlist != null) {\n plistDataToWrite[helperEHPlistFilename] = helperEHPlist\n }\n if (helperNPPlist != null) {\n plistDataToWrite[helperNPPlistFilename] = helperNPPlist\n }\n if (helperRendererPlist != null) {\n plistDataToWrite[helperRendererPlistFilename] = helperRendererPlist\n }\n if (helperPluginPlist != null) {\n plistDataToWrite[helperPluginPlistFilename] = helperPluginPlist\n }\n if (helperGPUPlist != null) {\n plistDataToWrite[helperGPUPlistFilename] = helperGPUPlist\n }\n if (helperLoginPlist != null) {\n plistDataToWrite[helperLoginPlistFilename] = helperLoginPlist\n }\n\n await Promise.all([\n executeAppBuilderAndWriteJson([\"encode-plist\"], plistDataToWrite),\n doRename(path.join(contentsPath, \"MacOS\"), electronBranding.productName, appPlist.CFBundleExecutable),\n unlinkIfExists(path.join(appOutDir, \"LICENSE\")),\n unlinkIfExists(path.join(appOutDir, \"LICENSES.chromium.html\")),\n ])\n\n await moveHelpers(\n getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist),\n frameworksPath,\n appFilename,\n electronBranding.productName\n )\n\n if (helperLoginPlist != null) {\n const prefix = electronBranding.productName\n const suffix = \" Login Helper\"\n const executableBasePath = path.join(loginItemPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n await doRename(executableBasePath, `${prefix}${suffix}`, appFilename + suffix).then(() => doRename(loginItemPath, `${prefix}${suffix}.app`, `${appFilename}${suffix}.app`))\n }\n\n const appPath = path.join(appOutDir, `${appInfo.productFilename}.app`)\n await rename(path.dirname(contentsPath), appPath)\n // https://github.com/electron-userland/electron-builder/issues/840\n const now = Date.now() / 1000\n await utimes(appPath, now, now)\n}\n\nfunction configureLocalhostAts(appPlist: any) {\n // https://bencoding.com/2015/07/20/app-transport-security-and-localhost/\n let ats = appPlist.NSAppTransportSecurity\n if (ats == null) {\n ats = {}\n appPlist.NSAppTransportSecurity = ats\n }\n\n ats.NSAllowsLocalNetworking = true\n // https://github.com/electron-userland/electron-builder/issues/3377#issuecomment-446035814\n ats.NSAllowsArbitraryLoads = true\n\n let exceptionDomains = ats.NSExceptionDomains\n if (exceptionDomains == null) {\n exceptionDomains = {}\n ats.NSExceptionDomains = exceptionDomains\n }\n\n if (exceptionDomains.localhost == null) {\n const allowHttp = {\n NSTemporaryExceptionAllowsInsecureHTTPSLoads: false,\n NSIncludesSubdomains: false,\n NSTemporaryExceptionAllowsInsecureHTTPLoads: true,\n NSTemporaryExceptionMinimumTLSVersion: \"1.0\",\n NSTemporaryExceptionRequiresForwardSecrecy: false,\n }\n exceptionDomains.localhost = allowHttp\n exceptionDomains[\"127.0.0.1\"] = allowHttp\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"electronMac.js","sourceRoot":"","sources":["../../src/electron/electronMac.ts"],"names":[],"mappings":";;AAkDA,oCAsOC;AAxRD,+CAA+H;AAC/H,0CAA4C;AAC5C,6BAA4B;AAC5B,wCAAqD;AAGrD,0DAAkD;AAClD,mDAA2F;AAC3F,2DAAwD;AAExD,SAAS,QAAQ,CAAC,QAAgB,EAAE,OAAe,EAAE,OAAe;IAClE,OAAO,IAAA,iBAAM,EAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAA;AAC3E,CAAC;AAED,SAAS,WAAW,CAAC,cAA6B,EAAE,cAAsB,EAAE,OAAe,EAAE,MAAc;IACzG,OAAO,OAAO,CAAC,GAAG,CAChB,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QAC1B,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,MAAM,GAAG,MAAM,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;QACnG,OAAO,QAAQ,CAAC,kBAAkB,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,EAAE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,CAAA;IAC3C,CAAC;IAED,IAAI,gBAAgB,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;QACvC,MAAM,SAAS,GAAG;YAChB,4CAA4C,EAAE,KAAK;YACnD,oBAAoB,EAAE,KAAK;YAC3B,2CAA2C,EAAE,IAAI;YACjD,qCAAqC,EAAE,KAAK;YAC5C,0CAA0C,EAAE,KAAK;SAClD,CAAA;QACD,gBAAgB,CAAC,SAAS,GAAG,SAAS,CAAA;QACtC,gBAAgB,CAAC,WAAW,CAAC,GAAG,SAAS,CAAA;IAC3C,CAAC;AACH,CAAC","sourcesContent":["import { asArray, copyOrLinkFile, getPlatformIconFileName, InvalidConfigurationError, log, unlinkIfExists } from \"builder-util\"\nimport { rename, utimes } from \"fs/promises\"\nimport * as path from \"path\"\nimport { filterCFBundleIdentifier } from \"../appInfo\"\nimport { AsarIntegrity } from \"../asar/integrity\"\nimport { MacPackager } from \"../macPackager\"\nimport { normalizeExt } from \"../platformPackager\"\nimport { executeAppBuilderAndWriteJson, executeAppBuilderAsJson } from \"../util/appBuilder\"\nimport { createBrandingOpts } from \"./ElectronFramework\"\n\nfunction doRename(basePath: string, oldName: string, newName: string) {\n return rename(path.join(basePath, oldName), path.join(basePath, newName))\n}\n\nfunction moveHelpers(helperSuffixes: Array<string>, frameworksPath: string, appName: string, prefix: string): Promise<any> {\n return Promise.all(\n helperSuffixes.map(suffix => {\n const executableBasePath = path.join(frameworksPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n return doRename(executableBasePath, `${prefix}${suffix}`, appName + suffix).then(() => doRename(frameworksPath, `${prefix}${suffix}.app`, `${appName}${suffix}.app`))\n })\n )\n}\n\nfunction getAvailableHelperSuffixes(\n helperEHPlist: string | null,\n helperNPPlist: string | null,\n helperRendererPlist: string | null,\n helperPluginPlist: string | null,\n helperGPUPlist: string | null\n) {\n const result = [\" Helper\"]\n if (helperEHPlist != null) {\n result.push(\" Helper EH\")\n }\n if (helperNPPlist != null) {\n result.push(\" Helper NP\")\n }\n if (helperRendererPlist != null) {\n result.push(\" Helper (Renderer)\")\n }\n if (helperPluginPlist != null) {\n result.push(\" Helper (Plugin)\")\n }\n if (helperGPUPlist != null) {\n result.push(\" Helper (GPU)\")\n }\n return result\n}\n\n/** @internal */\nexport async function createMacApp(packager: MacPackager, appOutDir: string, asarIntegrity: AsarIntegrity | null, isMas: boolean) {\n const appInfo = packager.appInfo\n // Electon uses the application name (CFBundleName) to resolve helper apps\n // https://github.com/electron/electron/blob/main/shell/app/electron_main_delegate_mac.mm\n // https://github.com/electron-userland/electron-builder/issues/6962\n const appFilename = appInfo.sanitizedProductName\n const electronBranding = createBrandingOpts(packager.config)\n\n const contentsPath = path.join(appOutDir, packager.info.framework.distMacOsAppName, \"Contents\")\n const frameworksPath = path.join(contentsPath, \"Frameworks\")\n const loginItemPath = path.join(contentsPath, \"Library\", \"LoginItems\")\n\n const appPlistFilename = path.join(contentsPath, \"Info.plist\")\n const helperPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper.app`, \"Contents\", \"Info.plist\")\n const helperEHPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper EH.app`, \"Contents\", \"Info.plist\")\n const helperNPPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper NP.app`, \"Contents\", \"Info.plist\")\n const helperRendererPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (Renderer).app`, \"Contents\", \"Info.plist\")\n const helperPluginPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (Plugin).app`, \"Contents\", \"Info.plist\")\n const helperGPUPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (GPU).app`, \"Contents\", \"Info.plist\")\n const helperLoginPlistFilename = path.join(loginItemPath, `${electronBranding.productName} Login Helper.app`, \"Contents\", \"Info.plist\")\n\n const plistContent: Array<any> = await executeAppBuilderAsJson([\n \"decode-plist\",\n \"-f\",\n appPlistFilename,\n \"-f\",\n helperPlistFilename,\n \"-f\",\n helperEHPlistFilename,\n \"-f\",\n helperNPPlistFilename,\n \"-f\",\n helperRendererPlistFilename,\n \"-f\",\n helperPluginPlistFilename,\n \"-f\",\n helperGPUPlistFilename,\n \"-f\",\n helperLoginPlistFilename,\n ])\n\n if (plistContent[0] == null) {\n throw new Error(\"corrupted Electron dist\")\n }\n\n const appPlist = plistContent[0]!\n const helperPlist = plistContent[1]!\n const helperEHPlist = plistContent[2]\n const helperNPPlist = plistContent[3]\n const helperRendererPlist = plistContent[4]\n const helperPluginPlist = plistContent[5]\n const helperGPUPlist = plistContent[6]\n const helperLoginPlist = plistContent[7]\n\n const buildMetadata = packager.config\n\n /**\n * Configure bundleIdentifier for the generic Electron Helper process\n *\n * This was the only Helper in Electron 5 and before. Allow users to configure\n * the bundleIdentifier for continuity.\n */\n\n const oldHelperBundleId = (buildMetadata as any)[\"helper-bundle-id\"]\n if (oldHelperBundleId != null) {\n log.warn(\"build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId\")\n }\n\n const defaultAppId = packager.platformSpecificBuildOptions.appId\n const cfBundleIdentifier = filterCFBundleIdentifier((isMas ? packager.config.mas?.appId : defaultAppId) || defaultAppId || appInfo.macBundleIdentifier)\n\n const defaultHelperId = packager.platformSpecificBuildOptions.helperBundleId\n const helperBundleIdentifier = filterCFBundleIdentifier(\n (isMas ? packager.config.mas?.helperBundleId : defaultHelperId) || defaultHelperId || oldHelperBundleId || `${cfBundleIdentifier}.helper`\n )\n\n appPlist.CFBundleIdentifier = cfBundleIdentifier\n\n await packager.applyCommonInfo(appPlist, contentsPath)\n\n // required for electron-updater proxy\n if (!isMas) {\n configureLocalhostAts(appPlist)\n }\n\n helperPlist.CFBundleExecutable = `${appFilename} Helper`\n helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`\n helperPlist.CFBundleIdentifier = helperBundleIdentifier\n helperPlist.CFBundleVersion = appPlist.CFBundleVersion\n\n /**\n * Configure bundleIdentifier for Electron 5+ Helper processes\n *\n * In Electron 6, parts of the generic Electron Helper process were split into\n * individual helper processes. Allow users to configure the bundleIdentifiers\n * for continuity, specifically because macOS keychain access relies on\n * bundleIdentifiers not changing (i.e. across versions of Electron).\n */\n\n function configureHelper(helper: any, postfix: string, userProvidedBundleIdentifier?: string | null) {\n helper.CFBundleExecutable = `${appFilename} Helper ${postfix}`\n helper.CFBundleDisplayName = `${appInfo.productName} Helper ${postfix}`\n helper.CFBundleIdentifier = userProvidedBundleIdentifier\n ? filterCFBundleIdentifier(userProvidedBundleIdentifier)\n : filterCFBundleIdentifier(`${helperBundleIdentifier}.${postfix}`)\n helper.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n if (helperRendererPlist != null) {\n configureHelper(helperRendererPlist, \"(Renderer)\", packager.platformSpecificBuildOptions.helperRendererBundleId)\n }\n if (helperPluginPlist != null) {\n configureHelper(helperPluginPlist, \"(Plugin)\", packager.platformSpecificBuildOptions.helperPluginBundleId)\n }\n if (helperGPUPlist != null) {\n configureHelper(helperGPUPlist, \"(GPU)\", packager.platformSpecificBuildOptions.helperGPUBundleId)\n }\n if (helperEHPlist != null) {\n configureHelper(helperEHPlist, \"EH\", packager.platformSpecificBuildOptions.helperEHBundleId)\n }\n if (helperNPPlist != null) {\n configureHelper(helperNPPlist, \"NP\", packager.platformSpecificBuildOptions.helperNPBundleId)\n }\n if (helperLoginPlist != null) {\n helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`\n helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`\n // noinspection SpellCheckingInspection\n helperLoginPlist.CFBundleIdentifier = `${cfBundleIdentifier}.loginhelper`\n helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n const protocols = asArray(buildMetadata.protocols).concat(asArray(packager.platformSpecificBuildOptions.protocols))\n if (protocols.length > 0) {\n appPlist.CFBundleURLTypes = protocols.map(protocol => {\n const schemes = asArray(protocol.schemes)\n if (schemes.length === 0) {\n throw new InvalidConfigurationError(`Protocol \"${protocol.name}\": must be at least one scheme specified`)\n }\n return {\n CFBundleURLName: protocol.name,\n CFBundleTypeRole: protocol.role || \"Editor\",\n CFBundleURLSchemes: schemes.slice(),\n }\n })\n }\n\n const fileAssociations = packager.fileAssociations\n if (fileAssociations.length > 0) {\n const documentTypes = await Promise.all(\n fileAssociations.map(async fileAssociation => {\n const extensions = asArray(fileAssociation.ext).map(normalizeExt)\n const customIcon = await packager.getResource(getPlatformIconFileName(fileAssociation.icon, true), `${extensions[0]}.icns`)\n let iconFile = appPlist.CFBundleIconFile\n if (customIcon != null) {\n iconFile = path.basename(customIcon)\n await copyOrLinkFile(customIcon, path.join(path.join(contentsPath, \"Resources\"), iconFile))\n }\n\n const result = {\n CFBundleTypeExtensions: extensions,\n CFBundleTypeName: fileAssociation.name || extensions[0],\n CFBundleTypeRole: fileAssociation.role || \"Editor\",\n LSHandlerRank: fileAssociation.rank || \"Default\",\n CFBundleTypeIconFile: iconFile,\n } as any\n\n if (fileAssociation.isPackage) {\n result.LSTypeIsPackage = true\n }\n return result\n })\n )\n\n // `CFBundleDocumentTypes` may be defined in `mac.extendInfo`, so we need to merge it in that case\n appPlist.CFBundleDocumentTypes = [...(appPlist.CFBundleDocumentTypes || []), ...documentTypes]\n }\n\n if (asarIntegrity != null) {\n appPlist.ElectronAsarIntegrity = asarIntegrity\n }\n\n const plistDataToWrite: any = {\n [appPlistFilename]: appPlist,\n [helperPlistFilename]: helperPlist,\n }\n if (helperEHPlist != null) {\n plistDataToWrite[helperEHPlistFilename] = helperEHPlist\n }\n if (helperNPPlist != null) {\n plistDataToWrite[helperNPPlistFilename] = helperNPPlist\n }\n if (helperRendererPlist != null) {\n plistDataToWrite[helperRendererPlistFilename] = helperRendererPlist\n }\n if (helperPluginPlist != null) {\n plistDataToWrite[helperPluginPlistFilename] = helperPluginPlist\n }\n if (helperGPUPlist != null) {\n plistDataToWrite[helperGPUPlistFilename] = helperGPUPlist\n }\n if (helperLoginPlist != null) {\n plistDataToWrite[helperLoginPlistFilename] = helperLoginPlist\n }\n\n await Promise.all([\n executeAppBuilderAndWriteJson([\"encode-plist\"], plistDataToWrite),\n doRename(path.join(contentsPath, \"MacOS\"), electronBranding.productName, appPlist.CFBundleExecutable),\n unlinkIfExists(path.join(appOutDir, \"LICENSE\")),\n unlinkIfExists(path.join(appOutDir, \"LICENSES.chromium.html\")),\n ])\n\n await moveHelpers(\n getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist),\n frameworksPath,\n appFilename,\n electronBranding.productName\n )\n\n if (helperLoginPlist != null) {\n const prefix = electronBranding.productName\n const suffix = \" Login Helper\"\n const executableBasePath = path.join(loginItemPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n await doRename(executableBasePath, `${prefix}${suffix}`, appFilename + suffix).then(() => doRename(loginItemPath, `${prefix}${suffix}.app`, `${appFilename}${suffix}.app`))\n }\n\n const appPath = path.join(appOutDir, `${appInfo.productFilename}.app`)\n await rename(path.dirname(contentsPath), appPath)\n // https://github.com/electron-userland/electron-builder/issues/840\n const now = Date.now() / 1000\n await utimes(appPath, now, now)\n}\n\nfunction configureLocalhostAts(appPlist: any) {\n // https://bencoding.com/2015/07/20/app-transport-security-and-localhost/\n let ats = appPlist.NSAppTransportSecurity\n if (ats == null) {\n ats = {}\n appPlist.NSAppTransportSecurity = ats\n }\n\n ats.NSAllowsLocalNetworking = true\n // https://github.com/electron-userland/electron-builder/issues/3377#issuecomment-446035814\n ats.NSAllowsArbitraryLoads = true\n\n let exceptionDomains = ats.NSExceptionDomains\n if (exceptionDomains == null) {\n exceptionDomains = {}\n ats.NSExceptionDomains = exceptionDomains\n }\n\n if (exceptionDomains.localhost == null) {\n const allowHttp = {\n NSTemporaryExceptionAllowsInsecureHTTPSLoads: false,\n NSIncludesSubdomains: false,\n NSTemporaryExceptionAllowsInsecureHTTPLoads: true,\n NSTemporaryExceptionMinimumTLSVersion: \"1.0\",\n NSTemporaryExceptionRequiresForwardSecrecy: false,\n }\n exceptionDomains.localhost = allowHttp\n exceptionDomains[\"127.0.0.1\"] = allowHttp\n }\n}\n"]}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Lazy } from "lazy-val";
|
|
2
2
|
import { Configuration } from "../configuration";
|
|
3
|
-
export type MetadataValue = Lazy<
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
} | null>;
|
|
3
|
+
export type MetadataValue = Lazy<Record<string, any> | null>;
|
|
6
4
|
export declare function getElectronVersion(projectDir: string, config?: Configuration): Promise<string>;
|
|
7
5
|
export declare function getElectronVersionFromInstalled(projectDir: string): Promise<string | null>;
|
|
8
6
|
export declare function getElectronPackage(projectDir: string): Promise<any>;
|
|
@@ -7,12 +7,11 @@ exports.computeElectronVersion = computeElectronVersion;
|
|
|
7
7
|
const search_module_1 = require("@electron/rebuild/lib/search-module");
|
|
8
8
|
const builder_util_1 = require("builder-util");
|
|
9
9
|
const builder_util_runtime_1 = require("builder-util-runtime");
|
|
10
|
-
const builder_util_2 = require("builder-util");
|
|
11
10
|
const fs_extra_1 = require("fs-extra");
|
|
12
11
|
const path = require("path");
|
|
13
|
-
const load_1 = require("../util/config/load");
|
|
14
12
|
const semver = require("semver");
|
|
15
13
|
const config_1 = require("../util/config/config");
|
|
14
|
+
const load_1 = require("../util/config/load");
|
|
16
15
|
const electronPackages = ["electron", "electron-prebuilt", "electron-prebuilt-compile", "electron-nightly"];
|
|
17
16
|
async function getElectronVersion(projectDir, config) {
|
|
18
17
|
if (config == null) {
|
|
@@ -66,7 +65,7 @@ async function computeElectronVersion(projectDir) {
|
|
|
66
65
|
}
|
|
67
66
|
if ((dependency === null || dependency === void 0 ? void 0 : dependency.name) === "electron-nightly") {
|
|
68
67
|
builder_util_1.log.info("You are using a nightly version of electron, be warned that those builds are highly unstable.");
|
|
69
|
-
const feedXml = await
|
|
68
|
+
const feedXml = await builder_util_1.httpExecutor.request({
|
|
70
69
|
hostname: "github.com",
|
|
71
70
|
path: `/electron/nightlies/releases.atom`,
|
|
72
71
|
headers: {
|
|
@@ -81,7 +80,7 @@ async function computeElectronVersion(projectDir) {
|
|
|
81
80
|
else if ((dependency === null || dependency === void 0 ? void 0 : dependency.version) === "latest") {
|
|
82
81
|
builder_util_1.log.warn('Electron version is set to "latest", but it is recommended to set it to some more restricted version range.');
|
|
83
82
|
try {
|
|
84
|
-
const releaseInfo = JSON.parse((await
|
|
83
|
+
const releaseInfo = JSON.parse((await builder_util_1.httpExecutor.request({
|
|
85
84
|
hostname: "github.com",
|
|
86
85
|
path: `/electron/${dependency.name === "electron-nightly" ? "nightlies" : "electron"}/releases/latest`,
|
|
87
86
|
headers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electronVersion.js","sourceRoot":"","sources":["../../src/electron/electronVersion.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"electronVersion.js","sourceRoot":"","sources":["../../src/electron/electronVersion.ts"],"names":[],"mappings":";;AAgBA,gDAQC;AAED,0EAWC;AAED,gDAWC;AAGD,wDA0DC;AA/GD,uEAAwE;AAExE,+CAA2E;AAC3E,+DAA+C;AAC/C,uCAAmC;AAEnC,6BAA4B;AAC5B,iCAAgC;AAEhC,kDAAiD;AACjD,8CAA0D;AAI1D,MAAM,gBAAgB,GAAG,CAAC,UAAU,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,kBAAkB,CAAC,CAAA;AAEpG,KAAK,UAAU,kBAAkB,CAAC,UAAkB,EAAE,MAAsB;IACjF,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IAClD,CAAC;IACD,IAAI,MAAM,CAAC,eAAe,IAAI,IAAI,EAAE,CAAC;QACnC,OAAO,MAAM,CAAC,eAAe,CAAA;IAC/B,CAAC;IACD,OAAO,sBAAsB,CAAC,UAAU,CAAC,CAAA;AAC3C,CAAC;AAEM,KAAK,UAAU,+BAA+B,CAAC,UAAkB;IAC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O,4BAA4B,CAAA;QACnG,MAAM,IAAI,wCAAyB,CACjC,oHAAoH,cAAc,iGAAiG,CACpO,CAAA;IACH,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAE,CAAC,MAAM,EAAE,CAAA;AACzC,CAAC;AAOD,SAAS,uBAAuB,CAAC,WAAgB;IAC/C,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,CAAC;QACpC,MAAM,eAAe,GAAG,WAAW,CAAC,eAAe,CAAA;QACnD,IAAI,GAAG,GAAG,eAAe,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;QAChE,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YAChB,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,CAAA;YAC7C,GAAG,GAAG,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;QACxD,CAAC;QACD,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YAChB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAA;QAC/B,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import { getProjectRootPath } from \"@electron/rebuild/lib/search-module\"\n\nimport { httpExecutor, InvalidConfigurationError, log } from \"builder-util\"\nimport { parseXml } from \"builder-util-runtime\"\nimport { readJson } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport * as semver from \"semver\"\nimport { Configuration } from \"../configuration\"\nimport { getConfig } from \"../util/config/config\"\nimport { orNullIfFileNotExist } from \"../util/config/load\"\n\nexport type MetadataValue = Lazy<Record<string, any> | null>\n\nconst electronPackages = [\"electron\", \"electron-prebuilt\", \"electron-prebuilt-compile\", \"electron-nightly\"]\n\nexport async function getElectronVersion(projectDir: string, config?: Configuration): Promise<string> {\n if (config == null) {\n config = await getConfig(projectDir, null, null)\n }\n if (config.electronVersion != null) {\n return config.electronVersion\n }\n return computeElectronVersion(projectDir)\n}\n\nexport async function getElectronVersionFromInstalled(projectDir: string): Promise<string | null> {\n for (const name of electronPackages) {\n try {\n return (await readJson(path.join(projectDir, \"node_modules\", name, \"package.json\"))).version\n } catch (e: any) {\n if (e.code !== \"ENOENT\") {\n log.warn({ name, error: e }, `cannot read electron version package.json`)\n }\n }\n }\n return null\n}\n\nexport async function getElectronPackage(projectDir: string) {\n for (const name of electronPackages) {\n try {\n return await readJson(path.join(projectDir, \"node_modules\", name, \"package.json\"))\n } catch (e: any) {\n if (e.code !== \"ENOENT\") {\n log.warn({ name, error: e }, `cannot find electron in package.json`)\n }\n }\n }\n return null\n}\n\n/** @internal */\nexport async function computeElectronVersion(projectDir: string): Promise<string> {\n const result = await getElectronVersionFromInstalled(projectDir)\n if (result != null) {\n return result\n }\n\n const potentialRootDirs = [projectDir, await getProjectRootPath(projectDir)]\n let dependency: NameAndVersion | null = null\n for (const dir of potentialRootDirs) {\n const metadata = await orNullIfFileNotExist(readJson(path.join(dir, \"package.json\")))\n dependency = metadata ? findFromPackageMetadata(metadata) : null\n if (dependency) {\n break\n }\n }\n if (dependency?.name === \"electron-nightly\") {\n log.info(\"You are using a nightly version of electron, be warned that those builds are highly unstable.\")\n const feedXml = await httpExecutor.request({\n hostname: \"github.com\",\n path: `/electron/nightlies/releases.atom`,\n headers: {\n accept: \"application/xml, application/atom+xml, text/xml, */*\",\n },\n })\n const feed = parseXml(feedXml!)\n const latestRelease = feed.element(\"entry\", false, `No published versions on GitHub`)\n const v = /\\/tag\\/v?([^/]+)$/.exec(latestRelease.element(\"link\").attribute(\"href\"))![1]\n return v.startsWith(\"v\") ? v.substring(1) : v\n } else if (dependency?.version === \"latest\") {\n log.warn('Electron version is set to \"latest\", but it is recommended to set it to some more restricted version range.')\n try {\n const releaseInfo = JSON.parse(\n (await httpExecutor.request({\n hostname: \"github.com\",\n path: `/electron/${dependency.name === \"electron-nightly\" ? \"nightlies\" : \"electron\"}/releases/latest`,\n headers: {\n accept: \"application/json\",\n },\n }))!\n )\n const version = releaseInfo.tag_name.startsWith(\"v\") ? releaseInfo.tag_name.substring(1) : releaseInfo.tag_name\n log.info({ version }, `resolve ${dependency.name}@${dependency.version}`)\n return version\n } catch (e: any) {\n log.warn(e)\n }\n\n throw new InvalidConfigurationError(`Cannot find electron dependency to get electron version in the '${path.join(projectDir, \"package.json\")}'`)\n }\n const version = dependency?.version\n if (version == null || !/^\\d/.test(version)) {\n const versionMessage = version == null ? \"\" : ` and version (\"${version}\") is not fixed in project`\n throw new InvalidConfigurationError(\n `Cannot compute electron version from installed node modules - none of the possible electron modules are installed${versionMessage}.\\nSee https://github.com/electron-userland/electron-builder/issues/3984#issuecomment-504968246`\n )\n }\n\n return semver.coerce(version)!.format()\n}\n\ninterface NameAndVersion {\n readonly name: string\n readonly version: string\n}\n\nfunction findFromPackageMetadata(packageData: any): NameAndVersion | null {\n for (const name of electronPackages) {\n const devDependencies = packageData.devDependencies\n let dep = devDependencies == null ? null : devDependencies[name]\n if (dep == null) {\n const dependencies = packageData.dependencies\n dep = dependencies == null ? null : dependencies[name]\n }\n if (dep != null) {\n return { name, version: dep }\n }\n }\n return null\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addWinAsarIntegrity = addWinAsarIntegrity;
|
|
4
|
-
const promises_1 = require("fs/promises");
|
|
5
4
|
const builder_util_1 = require("builder-util");
|
|
6
|
-
const
|
|
5
|
+
const promises_1 = require("fs/promises");
|
|
7
6
|
const path = require("path");
|
|
7
|
+
const resedit_1 = require("resedit");
|
|
8
8
|
/** @internal */
|
|
9
9
|
async function addWinAsarIntegrity(executablePath, asarIntegrity) {
|
|
10
10
|
const buffer = await (0, promises_1.readFile)(executablePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electronWin.js","sourceRoot":"","sources":["../../src/electron/electronWin.ts"],"names":[],"mappings":";;AAOA,kDAkCC;AAzCD
|
|
1
|
+
{"version":3,"file":"electronWin.js","sourceRoot":"","sources":["../../src/electron/electronWin.ts"],"names":[],"mappings":";;AAOA,kDAkCC;AAzCD,+CAAkC;AAClC,0CAAiD;AACjD,6BAA4B;AAC5B,qCAAsE;AAGtE,gBAAgB;AACT,KAAK,UAAU,mBAAmB,CAAC,cAAsB,EAAE,aAA4B;IAC5F,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAQ,EAAC,cAAc,CAAC,CAAA;IAC7C,MAAM,UAAU,GAAG,sBAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC5C,MAAM,QAAQ,GAAG,8BAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IAEtD,MAAM,WAAW,GAAG,kBAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IACtE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,mCAAmC,cAAc,EAAE,CAAC,CAAA;IACtE,CAAC;IAED,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,8BAA8B,EAAE,CAAA;IACjE,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,iCAAiC,cAAc,EAAE,CAAC,CAAA;IACpE,CAAC;IAED,8GAA8G;IAC9G,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAChH,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;QAChC,GAAG;QACH,KAAK;KACN,CAAC,CAAC,CAAA;IAEH,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;QACpB,IAAI,EAAE,WAAW;QACjB,EAAE,EAAE,cAAc;QAClB,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QAC/C,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI;QACvB,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ;KAChC,CAAC,CAAA;IAEF,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;IAEnC,MAAM,IAAA,oBAAS,EAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IACnE,kBAAG,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,kBAAG,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,EAAE,6CAA6C,CAAC,CAAA;AAC3G,CAAC","sourcesContent":["import { log } from \"builder-util\"\nimport { readFile, writeFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { NtExecutable, NtExecutableResource, Resource } from \"resedit\"\nimport { AsarIntegrity } from \"../asar/integrity\"\n\n/** @internal */\nexport async function addWinAsarIntegrity(executablePath: string, asarIntegrity: AsarIntegrity) {\n const buffer = await readFile(executablePath)\n const executable = NtExecutable.from(buffer)\n const resource = NtExecutableResource.from(executable)\n\n const versionInfo = Resource.VersionInfo.fromEntries(resource.entries)\n if (versionInfo.length !== 1) {\n throw new Error(`Failed to parse version info in ${executablePath}`)\n }\n\n const languages = versionInfo[0].getAllLanguagesForStringValues()\n if (languages.length !== 1) {\n throw new Error(`Failed to locate languages in ${executablePath}`)\n }\n\n // See: https://github.com/electron/packager/blob/00d20b99cf4aa4621103dbbd09ff7de7d2f7f539/src/resedit.ts#L124\n const integrityList = Array.from(Object.entries(asarIntegrity)).map(([file, { algorithm: alg, hash: value }]) => ({\n file: path.win32.normalize(file),\n alg,\n value,\n }))\n\n resource.entries.push({\n type: \"INTEGRITY\",\n id: \"ELECTRONASAR\",\n bin: Buffer.from(JSON.stringify(integrityList)),\n lang: languages[0].lang,\n codepage: languages[0].codepage,\n })\n\n resource.outputResource(executable)\n\n await writeFile(executablePath, Buffer.from(executable.generate()))\n log.info({ executablePath: log.filePath(executablePath) }, \"updating asar integrity executable resource\")\n}\n"]}
|
package/out/fileMatcher.d.ts
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
|
+
import { Filter } from "builder-util";
|
|
2
|
+
import { Minimatch } from "minimatch";
|
|
1
3
|
import { PlatformSpecificBuildOptions } from "./index";
|
|
2
4
|
export declare const excludedNames: string;
|
|
3
5
|
export declare const excludedExts: string;
|
|
6
|
+
export declare class FileMatcher {
|
|
7
|
+
readonly macroExpander: (pattern: string) => string;
|
|
8
|
+
readonly from: string;
|
|
9
|
+
readonly to: string;
|
|
10
|
+
readonly patterns: Array<string>;
|
|
11
|
+
excludePatterns: Array<Minimatch> | null;
|
|
12
|
+
readonly isSpecifiedAsEmptyArray: boolean;
|
|
13
|
+
constructor(from: string, to: string, macroExpander: (pattern: string) => string, patterns?: Array<string> | string | null);
|
|
14
|
+
normalizePattern(pattern: string): string;
|
|
15
|
+
addPattern(pattern: string): void;
|
|
16
|
+
prependPattern(pattern: string): void;
|
|
17
|
+
isEmpty(): boolean;
|
|
18
|
+
containsOnlyIgnore(): boolean;
|
|
19
|
+
computeParsedPatterns(result: Array<Minimatch>, fromDir?: string): void;
|
|
20
|
+
createFilter(): Filter;
|
|
21
|
+
toString(): string;
|
|
22
|
+
}
|
|
4
23
|
export interface GetFileMatchersOptions {
|
|
5
24
|
readonly macroExpander: (pattern: string) => string;
|
|
6
25
|
readonly customBuildOptions: PlatformSpecificBuildOptions;
|
package/out/fileMatcher.js
CHANGED
|
@@ -5,7 +5,6 @@ exports.getMainFileMatchers = getMainFileMatchers;
|
|
|
5
5
|
exports.getNodeModuleFileMatcher = getNodeModuleFileMatcher;
|
|
6
6
|
exports.getFileMatchers = getFileMatchers;
|
|
7
7
|
exports.copyFiles = copyFiles;
|
|
8
|
-
const bluebird_lst_1 = require("bluebird-lst");
|
|
9
8
|
const builder_util_1 = require("builder-util");
|
|
10
9
|
const promises_1 = require("fs/promises");
|
|
11
10
|
const minimatch_1 = require("minimatch");
|
|
@@ -36,7 +35,6 @@ function ensureNoEndSlash(file) {
|
|
|
36
35
|
return file;
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
|
-
/** @internal */
|
|
40
38
|
class FileMatcher {
|
|
41
39
|
constructor(from, to, macroExpander, patterns) {
|
|
42
40
|
this.macroExpander = macroExpander;
|
|
@@ -270,7 +268,7 @@ function copyFiles(matchers, transformer, isUseHardLink) {
|
|
|
270
268
|
if (matchers == null || matchers.length === 0) {
|
|
271
269
|
return Promise.resolve();
|
|
272
270
|
}
|
|
273
|
-
return
|
|
271
|
+
return Promise.all(matchers.map(async (matcher) => {
|
|
274
272
|
const fromStat = await (0, builder_util_1.statOrNull)(matcher.from);
|
|
275
273
|
if (fromStat == null) {
|
|
276
274
|
builder_util_1.log.warn({ from: matcher.from }, `file source doesn't exist`);
|
|
@@ -290,6 +288,6 @@ function copyFiles(matchers, transformer, isUseHardLink) {
|
|
|
290
288
|
}
|
|
291
289
|
builder_util_1.log.debug({ matcher }, "copying files using pattern");
|
|
292
290
|
return await (0, builder_util_1.copyDir)(matcher.from, matcher.to, { filter: matcher.createFilter(), transformer, isUseHardLink: isUseHardLink ? builder_util_1.USE_HARD_LINKS : null });
|
|
293
|
-
});
|
|
291
|
+
}));
|
|
294
292
|
}
|
|
295
293
|
//# sourceMappingURL=fileMatcher.js.map
|