Update gitignore (sorry)

This commit is contained in:
olcxja 2026-05-10 14:02:17 +02:00
commit cca8b02fea
6604 changed files with 1219661 additions and 4 deletions

View file

@ -0,0 +1,33 @@
import { Configuration } from "../configuration";
import { Framework } from "../Framework";
import { Packager } from "../index";
export declare type ElectronPlatformName = "darwin" | "linux" | "win32" | "mas";
/**
* Electron distributables branding options.
* @see [Electron BRANDING.json](https://github.com/electron/electron/blob/master/shell/app/BRANDING.json).
*/
export interface ElectronBrandingOptions {
projectName?: string;
productName?: string;
}
export declare function createBrandingOpts(opts: Configuration): Required<ElectronBrandingOptions>;
export interface ElectronDownloadOptions {
version?: string;
/**
* The [cache location](https://github.com/electron-userland/electron-download#cache-location).
*/
cache?: string | null;
/**
* The mirror.
*/
mirror?: string | null;
/** @private */
customDir?: string | null;
/** @private */
customFilename?: string | null;
strictSSL?: boolean;
isVerifyChecksum?: boolean;
platform?: ElectronPlatformName;
arch?: string;
}
export declare function createElectronFrameworkSupport(configuration: Configuration, packager: Packager): Promise<Framework>;

View file

@ -0,0 +1,163 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createElectronFrameworkSupport = exports.createBrandingOpts = void 0;
const bluebird_lst_1 = require("bluebird-lst");
const builder_util_1 = require("builder-util");
const fs_1 = require("builder-util/out/fs");
const fs_extra_1 = require("fs-extra");
const lazy_val_1 = require("lazy-val");
const path = require("path");
const index_1 = require("../index");
const platformPackager_1 = require("../platformPackager");
const pathManager_1 = require("../util/pathManager");
const electronMac_1 = require("./electronMac");
const electronVersion_1 = require("./electronVersion");
const fs = require("fs/promises");
function createBrandingOpts(opts) {
var _a, _b;
return {
projectName: ((_a = opts.electronBranding) === null || _a === void 0 ? void 0 : _a.projectName) || "electron",
productName: ((_b = opts.electronBranding) === null || _b === void 0 ? void 0 : _b.productName) || "Electron",
};
}
exports.createBrandingOpts = createBrandingOpts;
function createDownloadOpts(opts, platform, arch, electronVersion) {
return {
platform,
arch,
version: electronVersion,
...opts.electronDownload,
};
}
async function beforeCopyExtraFiles(options) {
const packager = options.packager;
const appOutDir = options.appOutDir;
const electronBranding = createBrandingOpts(packager.config);
if (packager.platform === index_1.Platform.LINUX) {
if (!platformPackager_1.isSafeToUnpackElectronOnRemoteBuildServer(packager)) {
const linuxPackager = packager;
const executable = path.join(appOutDir, linuxPackager.executableName);
await fs_extra_1.rename(path.join(appOutDir, electronBranding.projectName), executable);
}
}
else if (packager.platform === index_1.Platform.WINDOWS) {
const executable = path.join(appOutDir, `${packager.appInfo.productFilename}.exe`);
await fs_extra_1.rename(path.join(appOutDir, `${electronBranding.projectName}.exe`), executable);
}
else {
await electronMac_1.createMacApp(packager, appOutDir, options.asarIntegrity, options.platformName === "mas");
const wantedLanguages = builder_util_1.asArray(packager.platformSpecificBuildOptions.electronLanguages);
if (wantedLanguages.length === 0) {
return;
}
// noinspection SpellCheckingInspection
const langFileExt = ".lproj";
const resourcesDir = packager.getResourcesDir(appOutDir);
await bluebird_lst_1.default.map(fs_extra_1.readdir(resourcesDir), file => {
if (!file.endsWith(langFileExt)) {
return;
}
const language = file.substring(0, file.length - langFileExt.length);
if (!wantedLanguages.includes(language)) {
return fs.rm(path.join(resourcesDir, file), { recursive: true, force: true });
}
return;
}, fs_1.CONCURRENCY);
}
}
class ElectronFramework {
constructor(name, version, distMacOsAppName) {
this.name = name;
this.version = version;
this.distMacOsAppName = distMacOsAppName;
// noinspection JSUnusedGlobalSymbols
this.macOsDefaultTargets = ["zip", "dmg"];
// noinspection JSUnusedGlobalSymbols
this.defaultAppIdPrefix = "com.electron.";
// noinspection JSUnusedGlobalSymbols
this.isCopyElevateHelper = true;
// noinspection JSUnusedGlobalSymbols
this.isNpmRebuildRequired = true;
}
getDefaultIcon(platform) {
if (platform === index_1.Platform.LINUX) {
return path.join(pathManager_1.getTemplatePath("icons"), "electron-linux");
}
else {
// default icon is embedded into app skeleton
return null;
}
}
prepareApplicationStageDirectory(options) {
return unpack(options, createDownloadOpts(options.packager.config, options.platformName, options.arch, this.version), this.distMacOsAppName);
}
beforeCopyExtraFiles(options) {
return beforeCopyExtraFiles(options);
}
}
async function createElectronFrameworkSupport(configuration, packager) {
let version = configuration.electronVersion;
if (version == null) {
// for prepacked app asar no dev deps in the app.asar
if (packager.isPrepackedAppAsar) {
version = await electronVersion_1.getElectronVersionFromInstalled(packager.projectDir);
if (version == null) {
throw new Error(`Cannot compute electron version for prepacked asar`);
}
}
else {
version = await electronVersion_1.computeElectronVersion(packager.projectDir, new lazy_val_1.Lazy(() => Promise.resolve(packager.metadata)));
}
configuration.electronVersion = version;
}
const branding = createBrandingOpts(configuration);
return new ElectronFramework(branding.projectName, version, `${branding.productName}.app`);
}
exports.createElectronFrameworkSupport = createElectronFrameworkSupport;
async function unpack(prepareOptions, options, distMacOsAppName) {
const { packager, appOutDir, platformName } = prepareOptions;
const electronDist = packager.config.electronDist;
let dist = typeof electronDist === "function" ? electronDist(prepareOptions) : electronDist;
if (dist != null) {
const zipFile = `electron-v${options.version}-${platformName}-${options.arch}.zip`;
const resolvedDist = path.isAbsolute(dist) ? dist : path.resolve(packager.projectDir, dist);
if ((await fs_1.statOrNull(path.join(resolvedDist, zipFile))) != null) {
builder_util_1.log.info({ resolvedDist, zipFile }, "Resolved electronDist");
options.cache = resolvedDist;
dist = null;
}
}
let isFullCleanup = false;
if (dist == null) {
if (platformPackager_1.isSafeToUnpackElectronOnRemoteBuildServer(packager)) {
return;
}
await builder_util_1.executeAppBuilder(["unpack-electron", "--configuration", JSON.stringify([options]), "--output", appOutDir, "--distMacOsAppName", distMacOsAppName]);
}
else {
isFullCleanup = true;
const source = packager.getElectronSrcDir(dist);
const destination = packager.getElectronDestinationDir(appOutDir);
builder_util_1.log.info({ source, destination }, "copying Electron");
await fs_extra_1.emptyDir(appOutDir);
await fs_1.copyDir(source, destination, {
isUseHardLink: fs_1.DO_NOT_USE_HARD_LINKS,
});
}
await cleanupAfterUnpack(prepareOptions, distMacOsAppName, isFullCleanup);
}
function cleanupAfterUnpack(prepareOptions, distMacOsAppName, isFullCleanup) {
const out = prepareOptions.appOutDir;
const isMac = prepareOptions.packager.platform === index_1.Platform.MAC;
const resourcesPath = isMac ? path.join(out, distMacOsAppName, "Contents", "Resources") : path.join(out, "resources");
return Promise.all([
isFullCleanup ? fs_1.unlinkIfExists(path.join(resourcesPath, "default_app.asar")) : Promise.resolve(),
isFullCleanup ? fs_1.unlinkIfExists(path.join(out, "version")) : Promise.resolve(),
isMac
? Promise.resolve()
: fs_extra_1.rename(path.join(out, "LICENSE"), path.join(out, "LICENSE.electron.txt")).catch(() => {
/* ignore */
}),
]);
}
//# sourceMappingURL=ElectronFramework.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,259 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createMacApp = void 0;
const bluebird_lst_1 = require("bluebird-lst");
const builder_util_1 = require("builder-util");
const fs_1 = require("builder-util/out/fs");
const promises_1 = require("fs/promises");
const path = require("path");
const appInfo_1 = require("../appInfo");
const platformPackager_1 = require("../platformPackager");
const appBuilder_1 = require("../util/appBuilder");
const ElectronFramework_1 = require("./ElectronFramework");
function doRename(basePath, oldName, newName) {
return promises_1.rename(path.join(basePath, oldName), path.join(basePath, newName));
}
function moveHelpers(helperSuffixes, frameworksPath, appName, prefix) {
return bluebird_lst_1.default.map(helperSuffixes, suffix => {
const executableBasePath = path.join(frameworksPath, `${prefix}${suffix}.app`, "Contents", "MacOS");
return doRename(executableBasePath, `${prefix}${suffix}`, appName + suffix).then(() => doRename(frameworksPath, `${prefix}${suffix}.app`, `${appName}${suffix}.app`));
});
}
function getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist) {
const result = [" Helper"];
if (helperEHPlist != null) {
result.push(" Helper EH");
}
if (helperNPPlist != null) {
result.push(" Helper NP");
}
if (helperRendererPlist != null) {
result.push(" Helper (Renderer)");
}
if (helperPluginPlist != null) {
result.push(" Helper (Plugin)");
}
if (helperGPUPlist != null) {
result.push(" Helper (GPU)");
}
return result;
}
/** @internal */
async function createMacApp(packager, appOutDir, asarIntegrity, isMas) {
const appInfo = packager.appInfo;
const appFilename = appInfo.productFilename;
const electronBranding = ElectronFramework_1.createBrandingOpts(packager.config);
const contentsPath = path.join(appOutDir, packager.info.framework.distMacOsAppName, "Contents");
const frameworksPath = path.join(contentsPath, "Frameworks");
const loginItemPath = path.join(contentsPath, "Library", "LoginItems");
const appPlistFilename = path.join(contentsPath, "Info.plist");
const helperPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper.app`, "Contents", "Info.plist");
const helperEHPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper EH.app`, "Contents", "Info.plist");
const helperNPPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper NP.app`, "Contents", "Info.plist");
const helperRendererPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (Renderer).app`, "Contents", "Info.plist");
const helperPluginPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (Plugin).app`, "Contents", "Info.plist");
const helperGPUPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (GPU).app`, "Contents", "Info.plist");
const helperLoginPlistFilename = path.join(loginItemPath, `${electronBranding.productName} Login Helper.app`, "Contents", "Info.plist");
const plistContent = await appBuilder_1.executeAppBuilderAsJson([
"decode-plist",
"-f",
appPlistFilename,
"-f",
helperPlistFilename,
"-f",
helperEHPlistFilename,
"-f",
helperNPPlistFilename,
"-f",
helperRendererPlistFilename,
"-f",
helperPluginPlistFilename,
"-f",
helperGPUPlistFilename,
"-f",
helperLoginPlistFilename,
]);
if (plistContent[0] == null) {
throw new Error("corrupted Electron dist");
}
const appPlist = plistContent[0];
const helperPlist = plistContent[1];
const helperEHPlist = plistContent[2];
const helperNPPlist = plistContent[3];
const helperRendererPlist = plistContent[4];
const helperPluginPlist = plistContent[5];
const helperGPUPlist = plistContent[6];
const helperLoginPlist = plistContent[7];
// if an extend-info file was supplied, copy its contents in first
if (plistContent[8] != null) {
Object.assign(appPlist, plistContent[8]);
}
const buildMetadata = packager.config;
/**
* Configure bundleIdentifier for the generic Electron Helper process
*
* This was the only Helper in Electron 5 and before. Allow users to configure
* the bundleIdentifier for continuity.
*/
const oldHelperBundleId = buildMetadata["helper-bundle-id"];
if (oldHelperBundleId != null) {
builder_util_1.log.warn("build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId");
}
const helperBundleIdentifier = appInfo_1.filterCFBundleIdentifier(packager.platformSpecificBuildOptions.helperBundleId || oldHelperBundleId || `${appInfo.macBundleIdentifier}.helper`);
await packager.applyCommonInfo(appPlist, contentsPath);
// required for electron-updater proxy
if (!isMas) {
configureLocalhostAts(appPlist);
}
helperPlist.CFBundleExecutable = `${appFilename} Helper`;
helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`;
helperPlist.CFBundleIdentifier = helperBundleIdentifier;
helperPlist.CFBundleVersion = appPlist.CFBundleVersion;
/**
* Configure bundleIdentifier for Electron 5+ Helper processes
*
* In Electron 6, parts of the generic Electron Helper process were split into
* individual helper processes. Allow users to configure the bundleIdentifiers
* for continuity, specifically because macOS keychain access relies on
* bundleIdentifiers not changing (i.e. across versions of Electron).
*/
function configureHelper(helper, postfix, userProvidedBundleIdentifier) {
helper.CFBundleExecutable = `${appFilename} Helper ${postfix}`;
helper.CFBundleDisplayName = `${appInfo.productName} Helper ${postfix}`;
helper.CFBundleIdentifier = userProvidedBundleIdentifier
? appInfo_1.filterCFBundleIdentifier(userProvidedBundleIdentifier)
: appInfo_1.filterCFBundleIdentifier(`${helperBundleIdentifier}.${postfix}`);
helper.CFBundleVersion = appPlist.CFBundleVersion;
}
if (helperRendererPlist != null) {
configureHelper(helperRendererPlist, "(Renderer)", packager.platformSpecificBuildOptions.helperRendererBundleId);
}
if (helperPluginPlist != null) {
configureHelper(helperPluginPlist, "(Plugin)", packager.platformSpecificBuildOptions.helperPluginBundleId);
}
if (helperGPUPlist != null) {
configureHelper(helperGPUPlist, "(GPU)", packager.platformSpecificBuildOptions.helperGPUBundleId);
}
if (helperEHPlist != null) {
configureHelper(helperEHPlist, "EH", packager.platformSpecificBuildOptions.helperEHBundleId);
}
if (helperNPPlist != null) {
configureHelper(helperNPPlist, "NP", packager.platformSpecificBuildOptions.helperNPBundleId);
}
if (helperLoginPlist != null) {
helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`;
helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`;
// noinspection SpellCheckingInspection
helperLoginPlist.CFBundleIdentifier = `${appInfo.macBundleIdentifier}.loginhelper`;
helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion;
}
const protocols = builder_util_1.asArray(buildMetadata.protocols).concat(builder_util_1.asArray(packager.platformSpecificBuildOptions.protocols));
if (protocols.length > 0) {
appPlist.CFBundleURLTypes = protocols.map(protocol => {
const schemes = builder_util_1.asArray(protocol.schemes);
if (schemes.length === 0) {
throw new builder_util_1.InvalidConfigurationError(`Protocol "${protocol.name}": must be at least one scheme specified`);
}
return {
CFBundleURLName: protocol.name,
CFBundleTypeRole: protocol.role || "Editor",
CFBundleURLSchemes: schemes.slice(),
};
});
}
const fileAssociations = packager.fileAssociations;
if (fileAssociations.length > 0) {
appPlist.CFBundleDocumentTypes = await bluebird_lst_1.default.map(fileAssociations, async (fileAssociation) => {
const extensions = builder_util_1.asArray(fileAssociation.ext).map(platformPackager_1.normalizeExt);
const customIcon = await packager.getResource(builder_util_1.getPlatformIconFileName(fileAssociation.icon, true), `${extensions[0]}.icns`);
let iconFile = appPlist.CFBundleIconFile;
if (customIcon != null) {
iconFile = path.basename(customIcon);
await fs_1.copyOrLinkFile(customIcon, path.join(path.join(contentsPath, "Resources"), iconFile));
}
const result = {
CFBundleTypeExtensions: extensions,
CFBundleTypeName: fileAssociation.name || extensions[0],
CFBundleTypeRole: fileAssociation.role || "Editor",
LSHandlerRank: fileAssociation.rank || "Default",
CFBundleTypeIconFile: iconFile,
};
if (fileAssociation.isPackage) {
result.LSTypeIsPackage = true;
}
return result;
});
}
if (asarIntegrity != null) {
appPlist.ElectronAsarIntegrity = asarIntegrity;
}
const plistDataToWrite = {
[appPlistFilename]: appPlist,
[helperPlistFilename]: helperPlist,
};
if (helperEHPlist != null) {
plistDataToWrite[helperEHPlistFilename] = helperEHPlist;
}
if (helperNPPlist != null) {
plistDataToWrite[helperNPPlistFilename] = helperNPPlist;
}
if (helperRendererPlist != null) {
plistDataToWrite[helperRendererPlistFilename] = helperRendererPlist;
}
if (helperPluginPlist != null) {
plistDataToWrite[helperPluginPlistFilename] = helperPluginPlist;
}
if (helperGPUPlist != null) {
plistDataToWrite[helperGPUPlistFilename] = helperGPUPlist;
}
if (helperLoginPlist != null) {
plistDataToWrite[helperLoginPlistFilename] = helperLoginPlist;
}
await Promise.all([
appBuilder_1.executeAppBuilderAndWriteJson(["encode-plist"], plistDataToWrite),
doRename(path.join(contentsPath, "MacOS"), electronBranding.productName, appPlist.CFBundleExecutable),
fs_1.unlinkIfExists(path.join(appOutDir, "LICENSE")),
fs_1.unlinkIfExists(path.join(appOutDir, "LICENSES.chromium.html")),
]);
await moveHelpers(getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist), frameworksPath, appFilename, electronBranding.productName);
if (helperLoginPlist != null) {
const prefix = electronBranding.productName;
const suffix = " Login Helper";
const executableBasePath = path.join(loginItemPath, `${prefix}${suffix}.app`, "Contents", "MacOS");
await doRename(executableBasePath, `${prefix}${suffix}`, appFilename + suffix).then(() => doRename(loginItemPath, `${prefix}${suffix}.app`, `${appFilename}${suffix}.app`));
}
const appPath = path.join(appOutDir, `${appFilename}.app`);
await promises_1.rename(path.dirname(contentsPath), appPath);
// https://github.com/electron-userland/electron-builder/issues/840
const now = Date.now() / 1000;
await promises_1.utimes(appPath, now, now);
}
exports.createMacApp = createMacApp;
function configureLocalhostAts(appPlist) {
// https://bencoding.com/2015/07/20/app-transport-security-and-localhost/
let ats = appPlist.NSAppTransportSecurity;
if (ats == null) {
ats = {};
appPlist.NSAppTransportSecurity = ats;
}
ats.NSAllowsLocalNetworking = true;
// https://github.com/electron-userland/electron-builder/issues/3377#issuecomment-446035814
ats.NSAllowsArbitraryLoads = true;
let exceptionDomains = ats.NSExceptionDomains;
if (exceptionDomains == null) {
exceptionDomains = {};
ats.NSExceptionDomains = exceptionDomains;
}
if (exceptionDomains.localhost == null) {
const allowHttp = {
NSTemporaryExceptionAllowsInsecureHTTPSLoads: false,
NSIncludesSubdomains: false,
NSTemporaryExceptionAllowsInsecureHTTPLoads: true,
NSTemporaryExceptionMinimumTLSVersion: "1.0",
NSTemporaryExceptionRequiresForwardSecrecy: false,
};
exceptionDomains.localhost = allowHttp;
exceptionDomains["127.0.0.1"] = allowHttp;
}
}
//# sourceMappingURL=electronMac.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,8 @@
import { Lazy } from "lazy-val";
import { Configuration } from "../configuration";
export declare type MetadataValue = Lazy<{
[key: string]: any;
} | null>;
export declare function getElectronVersion(projectDir: string, config?: Configuration, projectMetadata?: MetadataValue): Promise<string>;
export declare function getElectronVersionFromInstalled(projectDir: string): Promise<any>;
export declare function getElectronPackage(projectDir: string): Promise<any>;

View file

@ -0,0 +1,114 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.computeElectronVersion = exports.getElectronPackage = exports.getElectronVersionFromInstalled = exports.getElectronVersion = void 0;
const builder_util_1 = require("builder-util");
const builder_util_runtime_1 = require("builder-util-runtime");
const nodeHttpExecutor_1 = require("builder-util/out/nodeHttpExecutor");
const fs_extra_1 = require("fs-extra");
const lazy_val_1 = require("lazy-val");
const path = require("path");
const read_config_file_1 = require("read-config-file");
const semver = require("semver");
const config_1 = require("../util/config");
const electronPackages = ["electron", "electron-prebuilt", "electron-prebuilt-compile", "electron-nightly"];
async function getElectronVersion(projectDir, config, projectMetadata = new lazy_val_1.Lazy(() => read_config_file_1.orNullIfFileNotExist(fs_extra_1.readJson(path.join(projectDir, "package.json"))))) {
if (config == null) {
config = await config_1.getConfig(projectDir, null, null);
}
if (config.electronVersion != null) {
return config.electronVersion;
}
return await computeElectronVersion(projectDir, projectMetadata);
}
exports.getElectronVersion = getElectronVersion;
async function getElectronVersionFromInstalled(projectDir) {
for (const name of electronPackages) {
try {
return (await fs_extra_1.readJson(path.join(projectDir, "node_modules", name, "package.json"))).version;
}
catch (e) {
if (e.code !== "ENOENT") {
builder_util_1.log.warn({ name, error: e }, `cannot read electron version package.json`);
}
}
}
return null;
}
exports.getElectronVersionFromInstalled = getElectronVersionFromInstalled;
async function getElectronPackage(projectDir) {
for (const name of electronPackages) {
try {
return await fs_extra_1.readJson(path.join(projectDir, "node_modules", name, "package.json"));
}
catch (e) {
if (e.code !== "ENOENT") {
builder_util_1.log.warn({ name, error: e }, `cannot find electron in package.json`);
}
}
}
return null;
}
exports.getElectronPackage = getElectronPackage;
/** @internal */
async function computeElectronVersion(projectDir, projectMetadata) {
const result = await getElectronVersionFromInstalled(projectDir);
if (result != null) {
return result;
}
const dependency = findFromPackageMetadata(await projectMetadata.value);
if ((dependency === null || dependency === void 0 ? void 0 : dependency.name) === "electron-nightly") {
builder_util_1.log.info("You are using a nightly version of electron, be warned that those builds are highly unstable.");
const feedXml = await nodeHttpExecutor_1.httpExecutor.request({
hostname: "github.com",
path: `/electron/nightlies/releases.atom`,
headers: {
accept: "application/xml, application/atom+xml, text/xml, */*",
},
});
const feed = builder_util_runtime_1.parseXml(feedXml);
const latestRelease = feed.element("entry", false, `No published versions on GitHub`);
const v = /\/tag\/v?([^/]+)$/.exec(latestRelease.element("link").attribute("href"))[1];
return v.startsWith("v") ? v.substring(1) : v;
}
else if ((dependency === null || dependency === void 0 ? void 0 : dependency.version) === "latest") {
builder_util_1.log.warn('Electron version is set to "latest", but it is recommended to set it to some more restricted version range.');
try {
const releaseInfo = JSON.parse((await nodeHttpExecutor_1.httpExecutor.request({
hostname: "github.com",
path: `/electron/${dependency.name === "electron-nightly" ? "nightlies" : "electron"}/releases/latest`,
headers: {
accept: "application/json",
},
})));
const version = releaseInfo.tag_name.startsWith("v") ? releaseInfo.tag_name.substring(1) : releaseInfo.tag_name;
builder_util_1.log.info({ version }, `resolve ${dependency.name}@${dependency.version}`);
return version;
}
catch (e) {
builder_util_1.log.warn(e);
}
throw new builder_util_1.InvalidConfigurationError(`Cannot find electron dependency to get electron version in the '${path.join(projectDir, "package.json")}'`);
}
const version = dependency === null || dependency === void 0 ? void 0 : dependency.version;
if (version == null || !/^\d/.test(version)) {
const versionMessage = version == null ? "" : ` and version ("${version}") is not fixed in project`;
throw new builder_util_1.InvalidConfigurationError(`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`);
}
return semver.coerce(version).toString();
}
exports.computeElectronVersion = computeElectronVersion;
function findFromPackageMetadata(packageData) {
for (const name of electronPackages) {
const devDependencies = packageData.devDependencies;
let dep = devDependencies == null ? null : devDependencies[name];
if (dep == null) {
const dependencies = packageData.dependencies;
dep = dependencies == null ? null : dependencies[name];
}
if (dep != null) {
return { name, version: dep };
}
}
return null;
}
//# sourceMappingURL=electronVersion.js.map

File diff suppressed because one or more lines are too long