update electron to v43
This commit is contained in:
parent
68ac0beedf
commit
fb6c8b6ee9
5385 changed files with 513060 additions and 123058 deletions
2
electron/node_modules/app-builder-lib/out/targets/nsis/Commands.d.ts
generated
vendored
2
electron/node_modules/app-builder-lib/out/targets/nsis/Commands.d.ts
generated
vendored
|
|
@ -1,4 +1,4 @@
|
|||
export declare type Commands = {
|
||||
export type Commands = {
|
||||
OutFile: string;
|
||||
VIProductVersion?: string;
|
||||
VIAddVersionKey: Array<string>;
|
||||
|
|
|
|||
14
electron/node_modules/app-builder-lib/out/targets/nsis/Defines.d.ts
generated
vendored
14
electron/node_modules/app-builder-lib/out/targets/nsis/Defines.d.ts
generated
vendored
|
|
@ -1,12 +1,10 @@
|
|||
/// <reference types="node" />
|
||||
import { PortableOptions } from "./nsisOptions";
|
||||
import { PathLike } from "fs";
|
||||
/**
|
||||
* Parameters declared as environment variables in NSIS scripts.
|
||||
* The documentation vaguely explains "All other electron-builder specific flags (e.g. ONE_CLICK) are still defined."
|
||||
* Parameters with null values in TypeScript can be treated as Boolean values using "!Ifdef" in NSIS Script.
|
||||
*/
|
||||
export declare type Defines = {
|
||||
export type Defines = {
|
||||
APP_ID: string;
|
||||
APP_GUID: unknown;
|
||||
UNINSTALL_APP_KEY: unknown;
|
||||
|
|
@ -35,13 +33,16 @@ export declare type Defines = {
|
|||
APP_64_HASH?: string;
|
||||
APP_ARM64_HASH?: string;
|
||||
APP_32_HASH?: string;
|
||||
APP_64_UNPACKED_SIZE?: string;
|
||||
APP_ARM64_UNPACKED_SIZE?: string;
|
||||
APP_32_UNPACKED_SIZE?: string;
|
||||
REQUEST_EXECUTION_LEVEL?: PortableOptions["requestExecutionLevel"];
|
||||
UNPACK_DIR_NAME?: string | false;
|
||||
SPLASH_IMAGE?: unknown;
|
||||
ESTIMATED_SIZE?: number;
|
||||
COMPRESS?: "auto";
|
||||
BUILD_UNINSTALLER?: null;
|
||||
UNINSTALLER_OUT_FILE?: PathLike;
|
||||
UNINSTALLER_OUT_FILE?: string;
|
||||
ONE_CLICK?: null;
|
||||
RUN_AFTER_FINISH?: null;
|
||||
HEADER_ICO?: string;
|
||||
|
|
@ -53,6 +54,7 @@ export declare type Defines = {
|
|||
MUI_UNWELCOMEFINISHPAGE_BITMAP?: string;
|
||||
MULTIUSER_INSTALLMODE_ALLOW_ELEVATION?: null;
|
||||
INSTALL_MODE_PER_ALL_USERS?: null;
|
||||
INSTALL_MODE_PER_ALL_USERS_DEFAULT?: null;
|
||||
INSTALL_MODE_PER_ALL_USERS_REQUIRED?: null;
|
||||
allowToChangeInstallationDirectory?: null;
|
||||
removeDefaultUninstallWelcomePage?: null;
|
||||
|
|
@ -61,6 +63,10 @@ export declare type Defines = {
|
|||
DELETE_APP_DATA_ON_UNINSTALL?: null;
|
||||
UNINSTALLER_ICON?: string;
|
||||
UNINSTALL_DISPLAY_NAME?: string;
|
||||
UNINSTALL_URL_HELP?: string;
|
||||
UNINSTALL_URL_INFO_ABOUT?: string;
|
||||
UNINSTALL_URL_UPDATE_INFO?: string;
|
||||
UNINSTALL_URL_README?: string;
|
||||
RECREATE_DESKTOP_SHORTCUT?: null;
|
||||
DO_NOT_CREATE_DESKTOP_SHORTCUT?: null;
|
||||
DO_NOT_CREATE_START_MENU_SHORTCUT?: null;
|
||||
|
|
|
|||
2
electron/node_modules/app-builder-lib/out/targets/nsis/Defines.js.map
generated
vendored
2
electron/node_modules/app-builder-lib/out/targets/nsis/Defines.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"Defines.js","sourceRoot":"","sources":["../../../src/targets/nsis/Defines.ts"],"names":[],"mappings":"","sourcesContent":["import { PortableOptions } from \"./nsisOptions\"\nimport { PathLike } from \"fs\"\n/**\n * Parameters declared as environment variables in NSIS scripts.\n * The documentation vaguely explains \"All other electron-builder specific flags (e.g. ONE_CLICK) are still defined.\"\n * Parameters with null values in TypeScript can be treated as Boolean values using \"!Ifdef\" in NSIS Script.\n */\nexport type Defines = {\n APP_ID: string\n APP_GUID: unknown\n UNINSTALL_APP_KEY: unknown\n PRODUCT_NAME: string\n PRODUCT_FILENAME: string\n APP_FILENAME: string\n APP_DESCRIPTION: string\n VERSION: string\n\n PROJECT_DIR: string\n BUILD_RESOURCES_DIR: string\n\n APP_PACKAGE_NAME: string\n\n ENABLE_LOGGING_ELECTRON_BUILDER?: null\n UNINSTALL_REGISTRY_KEY_2?: string\n\n MUI_ICON?: unknown\n MUI_UNICON?: unknown\n\n APP_DIR_64?: string\n APP_DIR_ARM64?: string\n APP_DIR_32?: string\n\n APP_BUILD_DIR?: string\n\n APP_64?: string\n APP_ARM64?: string\n APP_32?: string\n\n APP_64_NAME?: string\n APP_ARM64_NAME?: string\n APP_32_NAME?: string\n\n APP_64_HASH?: string\n APP_ARM64_HASH?: string\n APP_32_HASH?: string\n\n REQUEST_EXECUTION_LEVEL?: PortableOptions[\"requestExecutionLevel\"]\n\n UNPACK_DIR_NAME?: string | false\n\n SPLASH_IMAGE?: unknown\n\n ESTIMATED_SIZE?: number\n\n COMPRESS?: \"auto\"\n\n BUILD_UNINSTALLER?: null\n UNINSTALLER_OUT_FILE?: PathLike\n\n ONE_CLICK?: null\n RUN_AFTER_FINISH?: null\n HEADER_ICO?: string\n HIDE_RUN_AFTER_FINISH?: null\n\n MUI_HEADERIMAGE?: null\n MUI_HEADERIMAGE_RIGHT?: null\n MUI_HEADERIMAGE_BITMAP?: string\n\n MUI_WELCOMEFINISHPAGE_BITMAP?: string\n MUI_UNWELCOMEFINISHPAGE_BITMAP?: string\n\n MULTIUSER_INSTALLMODE_ALLOW_ELEVATION?: null\n\n INSTALL_MODE_PER_ALL_USERS?: null\n INSTALL_MODE_PER_ALL_USERS_REQUIRED?: null\n\n allowToChangeInstallationDirectory?: null\n\n removeDefaultUninstallWelcomePage?: null\n\n MENU_FILENAME?: string\n\n SHORTCUT_NAME?: string\n\n DELETE_APP_DATA_ON_UNINSTALL?: null\n\n UNINSTALLER_ICON?: string\n UNINSTALL_DISPLAY_NAME?: string\n\n RECREATE_DESKTOP_SHORTCUT?: null\n\n DO_NOT_CREATE_DESKTOP_SHORTCUT?: null\n\n DO_NOT_CREATE_START_MENU_SHORTCUT?: null\n\n DISPLAY_LANG_SELECTOR?: null\n\n COMPANY_NAME?: string\n\n APP_PRODUCT_FILENAME?: string\n\n APP_PACKAGE_STORE_FILE?: string\n\n APP_INSTALLER_STORE_FILE?: string\n\n ZIP_COMPRESSION?: null\n\n COMPRESSION_METHOD?: \"zip\" | \"7z\"\n}\n"]}
|
||||
{"version":3,"file":"Defines.js","sourceRoot":"","sources":["../../../src/targets/nsis/Defines.ts"],"names":[],"mappings":"","sourcesContent":["import { PortableOptions } from \"./nsisOptions\"\n/**\n * Parameters declared as environment variables in NSIS scripts.\n * The documentation vaguely explains \"All other electron-builder specific flags (e.g. ONE_CLICK) are still defined.\"\n * Parameters with null values in TypeScript can be treated as Boolean values using \"!Ifdef\" in NSIS Script.\n */\nexport type Defines = {\n APP_ID: string\n APP_GUID: unknown\n UNINSTALL_APP_KEY: unknown\n PRODUCT_NAME: string\n PRODUCT_FILENAME: string\n APP_FILENAME: string\n APP_DESCRIPTION: string\n VERSION: string\n\n PROJECT_DIR: string\n BUILD_RESOURCES_DIR: string\n\n APP_PACKAGE_NAME: string\n\n ENABLE_LOGGING_ELECTRON_BUILDER?: null\n UNINSTALL_REGISTRY_KEY_2?: string\n\n MUI_ICON?: unknown\n MUI_UNICON?: unknown\n\n APP_DIR_64?: string\n APP_DIR_ARM64?: string\n APP_DIR_32?: string\n\n APP_BUILD_DIR?: string\n\n APP_64?: string\n APP_ARM64?: string\n APP_32?: string\n\n APP_64_NAME?: string\n APP_ARM64_NAME?: string\n APP_32_NAME?: string\n\n APP_64_HASH?: string\n APP_ARM64_HASH?: string\n APP_32_HASH?: string\n\n APP_64_UNPACKED_SIZE?: string\n APP_ARM64_UNPACKED_SIZE?: string\n APP_32_UNPACKED_SIZE?: string\n\n REQUEST_EXECUTION_LEVEL?: PortableOptions[\"requestExecutionLevel\"]\n\n UNPACK_DIR_NAME?: string | false\n\n SPLASH_IMAGE?: unknown\n\n ESTIMATED_SIZE?: number\n\n COMPRESS?: \"auto\"\n\n BUILD_UNINSTALLER?: null\n UNINSTALLER_OUT_FILE?: string\n\n ONE_CLICK?: null\n RUN_AFTER_FINISH?: null\n HEADER_ICO?: string\n HIDE_RUN_AFTER_FINISH?: null\n\n MUI_HEADERIMAGE?: null\n MUI_HEADERIMAGE_RIGHT?: null\n MUI_HEADERIMAGE_BITMAP?: string\n\n MUI_WELCOMEFINISHPAGE_BITMAP?: string\n MUI_UNWELCOMEFINISHPAGE_BITMAP?: string\n\n MULTIUSER_INSTALLMODE_ALLOW_ELEVATION?: null\n\n INSTALL_MODE_PER_ALL_USERS?: null\n INSTALL_MODE_PER_ALL_USERS_DEFAULT?: null\n INSTALL_MODE_PER_ALL_USERS_REQUIRED?: null\n\n allowToChangeInstallationDirectory?: null\n\n removeDefaultUninstallWelcomePage?: null\n\n MENU_FILENAME?: string\n\n SHORTCUT_NAME?: string\n\n DELETE_APP_DATA_ON_UNINSTALL?: null\n\n UNINSTALLER_ICON?: string\n UNINSTALL_DISPLAY_NAME?: string\n UNINSTALL_URL_HELP?: string\n UNINSTALL_URL_INFO_ABOUT?: string\n UNINSTALL_URL_UPDATE_INFO?: string\n UNINSTALL_URL_README?: string\n\n RECREATE_DESKTOP_SHORTCUT?: null\n\n DO_NOT_CREATE_DESKTOP_SHORTCUT?: null\n\n DO_NOT_CREATE_START_MENU_SHORTCUT?: null\n\n DISPLAY_LANG_SELECTOR?: null\n\n COMPANY_NAME?: string\n\n APP_PRODUCT_FILENAME?: string\n\n APP_PACKAGE_STORE_FILE?: string\n\n APP_INSTALLER_STORE_FILE?: string\n\n ZIP_COMPRESSION?: null\n\n COMPRESSION_METHOD?: \"zip\" | \"7z\"\n}\n"]}
|
||||
8
electron/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.d.ts
generated
vendored
8
electron/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.d.ts
generated
vendored
|
|
@ -12,17 +12,19 @@ export declare class NsisTarget extends Target {
|
|||
readonly options: NsisOptions;
|
||||
/** @private */
|
||||
readonly archs: Map<Arch, string>;
|
||||
readonly isAsyncSupported = false;
|
||||
constructor(packager: WinPackager, outDir: string, targetName: string, packageHelper: AppPackageHelper);
|
||||
build(appOutDir: string, arch: Arch): Promise<void>;
|
||||
get shouldBuildUniversalInstaller(): boolean;
|
||||
build(appOutDir: string, arch: Arch): Promise<any>;
|
||||
get isBuildDifferentialAware(): boolean;
|
||||
private getPreCompressedFileExtensions;
|
||||
/** @private */
|
||||
buildAppPackage(appOutDir: string, arch: Arch): Promise<PackageFileInfo>;
|
||||
protected get installerFilenamePattern(): string;
|
||||
protected installerFilenamePattern(primaryArch?: Arch | null, defaultArch?: string): string;
|
||||
private get isPortable();
|
||||
finishBuild(): Promise<any>;
|
||||
private buildInstaller;
|
||||
protected generateGitHubInstallerName(): string;
|
||||
protected generateGitHubInstallerName(primaryArch: Arch | null, defaultArch: string | undefined): string;
|
||||
private get isUnicodeEnabled();
|
||||
get isWebInstaller(): boolean;
|
||||
private computeScriptAndSignUninstaller;
|
||||
|
|
|
|||
291
electron/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js
generated
vendored
291
electron/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js
generated
vendored
|
|
@ -1,35 +1,31 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NsisTarget = void 0;
|
||||
const _7zip_bin_1 = require("7zip-bin");
|
||||
const bluebird_lst_1 = require("bluebird-lst");
|
||||
const builder_util_1 = require("builder-util");
|
||||
const builder_util_runtime_1 = require("builder-util-runtime");
|
||||
const fs_1 = require("builder-util/out/fs");
|
||||
const debug_1 = require("debug");
|
||||
const fs = require("fs");
|
||||
const fs_extra_1 = require("fs-extra");
|
||||
const path = require("path");
|
||||
const binDownload_1 = require("../../binDownload");
|
||||
const core_1 = require("../../core");
|
||||
const CommonWindowsInstallerConfiguration_1 = require("../../options/CommonWindowsInstallerConfiguration");
|
||||
const platformPackager_1 = require("../../platformPackager");
|
||||
const hash_1 = require("../../util/hash");
|
||||
const macosVersion_1 = require("../../util/macosVersion");
|
||||
const timer_1 = require("../../util/timer");
|
||||
const wine_1 = require("../../wine");
|
||||
const archive_1 = require("../archive");
|
||||
const differentialUpdateInfoBuilder_1 = require("../differentialUpdateInfoBuilder");
|
||||
const targetUtil_1 = require("../targetUtil");
|
||||
const nsisLang_1 = require("./nsisLang");
|
||||
const nsisLicense_1 = require("./nsisLicense");
|
||||
const nsisScriptGenerator_1 = require("./nsisScriptGenerator");
|
||||
const windows_1 = require("../../toolsets/windows");
|
||||
const nsisUtil_1 = require("./nsisUtil");
|
||||
const debug = debug_1.default("electron-builder:nsis");
|
||||
const nsisValidation_1 = require("./nsisValidation");
|
||||
const WineVm_1 = require("../../vm/WineVm");
|
||||
const debug = (0, debug_1.default)("electron-builder:nsis");
|
||||
// noinspection SpellCheckingInspection
|
||||
const ELECTRON_BUILDER_NS_UUID = builder_util_runtime_1.UUID.parse("50e065bc-3134-11e6-9bab-38c9862bdaf3");
|
||||
// noinspection SpellCheckingInspection
|
||||
const nsisResourcePathPromise = () => binDownload_1.getBinFromUrl("nsis-resources", "3.4.1", "Dqd6g+2buwwvoG1Vyf6BHR1b+25QMmPcwZx40atOT57gH27rkjOei1L0JTldxZu4NFoEmW4kJgZ3DlSWVON3+Q==");
|
||||
const USE_NSIS_BUILT_IN_COMPRESSOR = false;
|
||||
class NsisTarget extends core_1.Target {
|
||||
constructor(packager, outDir, targetName, packageHelper) {
|
||||
|
|
@ -39,6 +35,7 @@ class NsisTarget extends core_1.Target {
|
|||
this.packageHelper = packageHelper;
|
||||
/** @private */
|
||||
this.archs = new Map();
|
||||
this.isAsyncSupported = false;
|
||||
this.packageHelper.refCount++;
|
||||
this.options =
|
||||
targetName === "portable"
|
||||
|
|
@ -48,16 +45,22 @@ class NsisTarget extends core_1.Target {
|
|||
...this.packager.config.nsis,
|
||||
};
|
||||
if (targetName !== "nsis") {
|
||||
Object.assign(this.options, this.packager.config[targetName === "nsis-web" ? "nsisWeb" : targetName]);
|
||||
(0, builder_util_runtime_1.deepAssign)(this.options, this.packager.config[targetName === "nsis-web" ? "nsisWeb" : targetName]);
|
||||
}
|
||||
const deps = packager.info.metadata.dependencies;
|
||||
if (deps != null && deps["electron-squirrel-startup"] != null) {
|
||||
builder_util_1.log.warn('"electron-squirrel-startup" dependency is not required for NSIS');
|
||||
}
|
||||
nsisUtil_1.NsisTargetOptions.resolve(this.options);
|
||||
}
|
||||
get shouldBuildUniversalInstaller() {
|
||||
const buildSeparateInstallers = this.options.buildUniversalInstaller === false;
|
||||
return !buildSeparateInstallers;
|
||||
}
|
||||
build(appOutDir, arch) {
|
||||
this.archs.set(arch, appOutDir);
|
||||
if (!this.shouldBuildUniversalInstaller) {
|
||||
return this.buildInstaller(new Map().set(arch, appOutDir));
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
get isBuildDifferentialAware() {
|
||||
|
|
@ -65,7 +68,7 @@ class NsisTarget extends core_1.Target {
|
|||
}
|
||||
getPreCompressedFileExtensions() {
|
||||
const result = this.isWebInstaller ? null : this.options.preCompressedFileExtensions;
|
||||
return result == null ? null : builder_util_1.asArray(result).map(it => (it.startsWith(".") ? it : `.${it}`));
|
||||
return result == null ? null : (0, builder_util_1.asArray)(result).map(it => (it.startsWith(".") ? it : `.${it}`));
|
||||
}
|
||||
/** @private */
|
||||
async buildAppPackage(appOutDir, arch) {
|
||||
|
|
@ -80,11 +83,11 @@ class NsisTarget extends core_1.Target {
|
|||
compression: packager.compression,
|
||||
excluded: preCompressedFileExtensions == null ? null : preCompressedFileExtensions.map(it => `*${it}`),
|
||||
};
|
||||
const timer = timer_1.time(`nsis package, ${builder_util_1.Arch[arch]}`);
|
||||
await archive_1.archive(format, archiveFile, appOutDir, isBuildDifferentialAware ? differentialUpdateInfoBuilder_1.configureDifferentialAwareArchiveOptions(archiveOptions) : archiveOptions);
|
||||
const timer = (0, timer_1.time)(`nsis package, ${builder_util_1.Arch[arch]}`);
|
||||
await (0, archive_1.archive)(format, archiveFile, appOutDir, isBuildDifferentialAware ? (0, differentialUpdateInfoBuilder_1.configureDifferentialAwareArchiveOptions)(archiveOptions) : archiveOptions);
|
||||
timer.end();
|
||||
if (isBuildDifferentialAware && this.isWebInstaller) {
|
||||
const data = await differentialUpdateInfoBuilder_1.appendBlockmap(archiveFile);
|
||||
const data = await (0, differentialUpdateInfoBuilder_1.appendBlockmap)(archiveFile);
|
||||
return {
|
||||
...data,
|
||||
path: archiveFile,
|
||||
|
|
@ -94,16 +97,21 @@ class NsisTarget extends core_1.Target {
|
|||
return await createPackageFileInfo(archiveFile);
|
||||
}
|
||||
}
|
||||
get installerFilenamePattern() {
|
||||
// tslint:disable:no-invalid-template-strings
|
||||
return "${productName} " + (this.isPortable ? "" : "Setup ") + "${version}.${ext}";
|
||||
installerFilenamePattern(primaryArch, defaultArch) {
|
||||
const setupText = this.isPortable ? "" : "Setup ";
|
||||
const archSuffix = !this.shouldBuildUniversalInstaller && primaryArch != null ? (0, builder_util_1.getArchSuffix)(primaryArch, defaultArch) : "";
|
||||
return "${productName} " + setupText + "${version}" + archSuffix + ".${ext}";
|
||||
}
|
||||
get isPortable() {
|
||||
return this.name === "portable";
|
||||
}
|
||||
async finishBuild() {
|
||||
if (!this.shouldBuildUniversalInstaller) {
|
||||
await super.finishBuild();
|
||||
return this.packageHelper.finishBuild();
|
||||
}
|
||||
try {
|
||||
const { pattern } = this.packager.artifactPatternConfig(this.options, this.installerFilenamePattern);
|
||||
const { pattern } = this.packager.artifactPatternConfig(this.options, this.installerFilenamePattern());
|
||||
const builds = new Set([this.archs]);
|
||||
if (pattern.includes("${arch}") && this.archs.size > 1) {
|
||||
;
|
||||
|
|
@ -115,16 +123,18 @@ class NsisTarget extends core_1.Target {
|
|||
}
|
||||
}
|
||||
finally {
|
||||
await super.finishBuild();
|
||||
await this.packageHelper.finishBuild();
|
||||
}
|
||||
}
|
||||
async buildInstaller(archs) {
|
||||
var _a;
|
||||
const primaryArch = archs.size === 1 ? archs.keys().next().value : null;
|
||||
var _a, _b, _c;
|
||||
const primaryArch = archs.size === 1 ? ((_a = archs.keys().next().value) !== null && _a !== void 0 ? _a : null) : null;
|
||||
const packager = this.packager;
|
||||
const appInfo = packager.appInfo;
|
||||
const options = this.options;
|
||||
const installerFilename = packager.expandArtifactNamePattern(options, "exe", primaryArch, this.installerFilenamePattern, false, this.packager.platformSpecificBuildOptions.defaultArch);
|
||||
const defaultArch = (_b = (0, platformPackager_1.chooseNotNull)(this.packager.platformSpecificBuildOptions.defaultArch, this.packager.config.defaultArch)) !== null && _b !== void 0 ? _b : undefined;
|
||||
const installerFilename = packager.expandArtifactNamePattern(options, "exe", primaryArch, this.installerFilenamePattern(primaryArch, defaultArch), false, defaultArch);
|
||||
const oneClick = options.oneClick !== false;
|
||||
const installerPath = path.join(this.outDir, installerFilename);
|
||||
const logFields = {
|
||||
|
|
@ -139,7 +149,7 @@ class NsisTarget extends core_1.Target {
|
|||
logFields.oneClick = oneClick;
|
||||
logFields.perMachine = isPerMachine;
|
||||
}
|
||||
await packager.info.callArtifactBuildStarted({
|
||||
await packager.info.emitArtifactBuildStarted({
|
||||
targetPresentableName: this.name,
|
||||
file: installerPath,
|
||||
arch: primaryArch,
|
||||
|
|
@ -153,19 +163,24 @@ class NsisTarget extends core_1.Target {
|
|||
UNINSTALL_APP_KEY: uninstallAppKey,
|
||||
PRODUCT_NAME: appInfo.productName,
|
||||
PRODUCT_FILENAME: appInfo.productFilename,
|
||||
APP_FILENAME: targetUtil_1.getWindowsInstallationDirName(appInfo, !oneClick || isPerMachine),
|
||||
APP_FILENAME: (0, targetUtil_1.getWindowsInstallationDirName)(appInfo, !oneClick || isPerMachine),
|
||||
APP_DESCRIPTION: appInfo.description,
|
||||
VERSION: appInfo.version,
|
||||
PROJECT_DIR: packager.projectDir,
|
||||
BUILD_RESOURCES_DIR: packager.info.buildResourcesDir,
|
||||
APP_PACKAGE_NAME: targetUtil_1.getWindowsInstallationAppPackageName(appInfo.name),
|
||||
APP_PACKAGE_NAME: (0, targetUtil_1.getWindowsInstallationAppPackageName)(appInfo.name),
|
||||
};
|
||||
if ((_a = options.customNsisBinary) === null || _a === void 0 ? void 0 : _a.debugLogging) {
|
||||
if ((_c = options.customNsisBinary) === null || _c === void 0 ? void 0 : _c.debugLogging) {
|
||||
defines.ENABLE_LOGGING_ELECTRON_BUILDER = null;
|
||||
}
|
||||
if (uninstallAppKey !== guid) {
|
||||
defines.UNINSTALL_REGISTRY_KEY_2 = `Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${guid}`;
|
||||
}
|
||||
const { homepage } = this.packager.info.metadata;
|
||||
(0, builder_util_1.use)(options.uninstallUrlHelp || homepage, it => (defines.UNINSTALL_URL_HELP = it));
|
||||
(0, builder_util_1.use)(options.uninstallUrlInfoAbout || homepage, it => (defines.UNINSTALL_URL_INFO_ABOUT = it));
|
||||
(0, builder_util_1.use)(options.uninstallUrlUpdateInfo || homepage, it => (defines.UNINSTALL_URL_UPDATE_INFO = it));
|
||||
(0, builder_util_1.use)(options.uninstallUrlReadme || homepage, it => (defines.UNINSTALL_URL_README = it));
|
||||
const commands = {
|
||||
OutFile: `"${installerPath}"`,
|
||||
VIProductVersion: appInfo.getVersionInWeirdWindowsForm(),
|
||||
|
|
@ -191,11 +206,12 @@ class NsisTarget extends core_1.Target {
|
|||
}
|
||||
}
|
||||
else if (USE_NSIS_BUILT_IN_COMPRESSOR && archs.size === 1) {
|
||||
defines.APP_BUILD_DIR = archs.get(archs.keys().next().value);
|
||||
const value = archs.keys().next().value;
|
||||
(0, builder_util_1.use)(value, v => (defines.APP_BUILD_DIR = archs.get(v)));
|
||||
}
|
||||
else {
|
||||
await bluebird_lst_1.default.map(archs.keys(), async (arch) => {
|
||||
const fileInfo = await this.packageHelper.packArch(arch, this);
|
||||
await Promise.all(Array.from(archs.keys()).map(async (arch) => {
|
||||
const { fileInfo, unpackedSize } = await this.packageHelper.packArch(arch, this);
|
||||
const file = fileInfo.path;
|
||||
const defineKey = arch === builder_util_1.Arch.x64 ? "APP_64" : arch === builder_util_1.Arch.arm64 ? "APP_ARM64" : "APP_32";
|
||||
defines[defineKey] = file;
|
||||
|
|
@ -206,20 +222,21 @@ class NsisTarget extends core_1.Target {
|
|||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
const defineHashKey = `${defineKey}_HASH`;
|
||||
defines[defineHashKey] = Buffer.from(fileInfo.sha512, "base64").toString("hex").toUpperCase();
|
||||
// NSIS accepts size in KiloBytes and supports only whole numbers
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
const defineUnpackedSizeKey = `${defineKey}_UNPACKED_SIZE`;
|
||||
defines[defineUnpackedSizeKey] = Math.ceil(unpackedSize / 1024).toString();
|
||||
if (this.isWebInstaller) {
|
||||
await packager.dispatchArtifactCreated(file, this, arch);
|
||||
await packager.info.emitArtifactBuildCompleted({
|
||||
file,
|
||||
target: this,
|
||||
arch,
|
||||
packager,
|
||||
});
|
||||
packageFiles[builder_util_1.Arch[arch]] = fileInfo;
|
||||
}
|
||||
const archiveInfo = (await builder_util_1.exec(_7zip_bin_1.path7za, ["l", file])).trim();
|
||||
// after adding blockmap data will be "Warnings: 1" in the end of output
|
||||
const match = /(\d+)\s+\d+\s+\d+\s+files/.exec(archiveInfo);
|
||||
if (match == null) {
|
||||
builder_util_1.log.warn({ output: archiveInfo }, "cannot compute size of app package");
|
||||
}
|
||||
else {
|
||||
estimatedSize += parseInt(match[1], 10);
|
||||
}
|
||||
});
|
||||
estimatedSize += unpackedSize;
|
||||
}));
|
||||
}
|
||||
this.configureDefinesForAllTypeOfInstaller(defines);
|
||||
if (isPortable) {
|
||||
|
|
@ -227,7 +244,7 @@ class NsisTarget extends core_1.Target {
|
|||
defines.REQUEST_EXECUTION_LEVEL = requestExecutionLevel || "user";
|
||||
// https://github.com/electron-userland/electron-builder/issues/5764
|
||||
if (typeof unpackDirName === "string" || !unpackDirName) {
|
||||
defines.UNPACK_DIR_NAME = unpackDirName || (await builder_util_1.executeAppBuilder(["ksuid"]));
|
||||
defines.UNPACK_DIR_NAME = unpackDirName || (0, builder_util_1.generateKsuid)();
|
||||
}
|
||||
if (splashImage != null) {
|
||||
defines.SPLASH_IMAGE = path.resolve(packager.projectDir, splashImage);
|
||||
|
|
@ -265,39 +282,51 @@ class NsisTarget extends core_1.Target {
|
|||
commandsUninstaller.VIProductVersion = appInfo.shortVersionWindows;
|
||||
commandsUninstaller.VIAddVersionKey = this.computeVersionKey(true);
|
||||
}
|
||||
const sharedHeader = await this.computeCommonInstallerScriptHeader();
|
||||
const script = isPortable
|
||||
? await fs_extra_1.readFile(path.join(nsisUtil_1.nsisTemplatesDir, "portable.nsi"), "utf8")
|
||||
: await this.computeScriptAndSignUninstaller(definesUninstaller, commandsUninstaller, installerPath, sharedHeader, archs);
|
||||
// copy outfile name into main options, as the computeScriptAndSignUninstaller function was kind enough to add important data to temporary defines.
|
||||
defines.UNINSTALLER_OUT_FILE = definesUninstaller.UNINSTALLER_OUT_FILE;
|
||||
await this.executeMakensis(defines, commands, sharedHeader + (await this.computeFinalScript(script, true, archs)));
|
||||
await Promise.all([packager.sign(installerPath), defines.UNINSTALLER_OUT_FILE == null ? Promise.resolve() : fs_extra_1.unlink(defines.UNINSTALLER_OUT_FILE)]);
|
||||
const safeArtifactName = platformPackager_1.computeSafeArtifactNameIfNeeded(installerFilename, () => this.generateGitHubInstallerName());
|
||||
let updateInfo;
|
||||
if (this.isWebInstaller) {
|
||||
updateInfo = differentialUpdateInfoBuilder_1.createNsisWebDifferentialUpdateInfo(installerPath, packageFiles);
|
||||
}
|
||||
else if (this.isBuildDifferentialAware) {
|
||||
updateInfo = await differentialUpdateInfoBuilder_1.createBlockmap(installerPath, this, packager, safeArtifactName);
|
||||
}
|
||||
if (updateInfo != null && isPerMachine && (oneClick || options.packElevateHelper)) {
|
||||
updateInfo.isAdminRightsRequired = true;
|
||||
}
|
||||
await packager.info.callArtifactBuildCompleted({
|
||||
file: installerPath,
|
||||
updateInfo,
|
||||
target: this,
|
||||
packager,
|
||||
arch: primaryArch,
|
||||
safeArtifactName,
|
||||
isWriteUpdateInfo: !this.isPortable,
|
||||
this.buildQueueManager.add(async () => {
|
||||
const sharedHeader = await this.computeCommonInstallerScriptHeader();
|
||||
let rawScript;
|
||||
let isCustomScript = false;
|
||||
if (isPortable) {
|
||||
rawScript = await (0, fs_extra_1.readFile)(path.join(nsisUtil_1.nsisTemplatesDir, "portable.nsi"), "utf8");
|
||||
}
|
||||
else {
|
||||
const result = await this.computeScriptAndSignUninstaller(definesUninstaller, commandsUninstaller, installerPath, sharedHeader, archs);
|
||||
rawScript = result.script;
|
||||
isCustomScript = result.isCustomScript;
|
||||
}
|
||||
// copy outfile name into main options, as the computeScriptAndSignUninstaller function was kind enough to add important data to temporary defines.
|
||||
defines.UNINSTALLER_OUT_FILE = definesUninstaller.UNINSTALLER_OUT_FILE;
|
||||
// Skip size verification for portable (NSIS recompresses the archive, installer < archive is normal)
|
||||
// and for custom scripts (may not embed archives).
|
||||
await this.executeMakensis(defines, commands, sharedHeader + (await this.computeFinalScript(rawScript, true, archs)), { skipSizeVerification: isPortable || isCustomScript });
|
||||
await Promise.all([packager.signIf(installerPath), defines.UNINSTALLER_OUT_FILE == null ? Promise.resolve() : (0, fs_extra_1.unlink)(defines.UNINSTALLER_OUT_FILE)]);
|
||||
const safeArtifactName = (0, platformPackager_1.computeSafeArtifactNameIfNeeded)(installerFilename, () => this.generateGitHubInstallerName(primaryArch, defaultArch));
|
||||
let updateInfo;
|
||||
if (this.isWebInstaller) {
|
||||
updateInfo = (0, differentialUpdateInfoBuilder_1.createNsisWebDifferentialUpdateInfo)(installerPath, packageFiles);
|
||||
}
|
||||
else if (this.isBuildDifferentialAware) {
|
||||
updateInfo = await (0, differentialUpdateInfoBuilder_1.createBlockmap)(installerPath, this, packager, safeArtifactName);
|
||||
}
|
||||
if (updateInfo != null && isPerMachine && (oneClick || options.packElevateHelper)) {
|
||||
updateInfo.isAdminRightsRequired = true;
|
||||
}
|
||||
await packager.info.emitArtifactBuildCompleted({
|
||||
file: installerPath,
|
||||
updateInfo,
|
||||
target: this,
|
||||
packager,
|
||||
arch: primaryArch,
|
||||
safeArtifactName,
|
||||
isWriteUpdateInfo: !this.isPortable,
|
||||
});
|
||||
});
|
||||
}
|
||||
generateGitHubInstallerName() {
|
||||
generateGitHubInstallerName(primaryArch, defaultArch) {
|
||||
const appInfo = this.packager.appInfo;
|
||||
const classifier = appInfo.name.toLowerCase() === appInfo.name ? "setup-" : "Setup-";
|
||||
return `${appInfo.name}-${this.isPortable ? "" : classifier}${appInfo.version}.exe`;
|
||||
const archSuffix = !this.shouldBuildUniversalInstaller && primaryArch != null ? (0, builder_util_1.getArchSuffix)(primaryArch, defaultArch) : "";
|
||||
return `${appInfo.name}-${this.isPortable ? "" : classifier}${appInfo.version}${archSuffix}.exe`;
|
||||
}
|
||||
get isUnicodeEnabled() {
|
||||
return this.options.unicode !== false;
|
||||
|
|
@ -306,22 +335,25 @@ class NsisTarget extends core_1.Target {
|
|||
return false;
|
||||
}
|
||||
async computeScriptAndSignUninstaller(defines, commands, installerPath, sharedHeader, archs) {
|
||||
var _a;
|
||||
const packager = this.packager;
|
||||
const customScriptPath = await packager.getResource(this.options.script, "installer.nsi");
|
||||
const script = await fs_extra_1.readFile(customScriptPath || path.join(nsisUtil_1.nsisTemplatesDir, "installer.nsi"), "utf8");
|
||||
const script = await (0, fs_extra_1.readFile)(customScriptPath || path.join(nsisUtil_1.nsisTemplatesDir, "installer.nsi"), "utf8");
|
||||
if (customScriptPath != null) {
|
||||
builder_util_1.log.info({ reason: "custom NSIS script is used" }, "uninstaller is not signed by electron-builder");
|
||||
return script;
|
||||
return { script, isCustomScript: true };
|
||||
}
|
||||
// https://github.com/electron-userland/electron-builder/issues/2103
|
||||
// it is more safe and reliable to write uninstaller to our out dir
|
||||
const uninstallerPath = path.join(this.outDir, `__uninstaller-${this.name}-${this.packager.appInfo.sanitizedName}.exe`);
|
||||
// to support parallel builds, the uninstaller path must be unique to each target and arch combination
|
||||
const uninstallerPath = path.join(this.outDir, `${path.basename(installerPath, "exe")}__uninstaller.exe`);
|
||||
const isWin = process.platform === "win32";
|
||||
defines.BUILD_UNINSTALLER = null;
|
||||
defines.UNINSTALLER_OUT_FILE = isWin ? uninstallerPath : path.win32.join("Z:", uninstallerPath);
|
||||
await this.executeMakensis(defines, commands, sharedHeader + (await this.computeFinalScript(script, false, archs)));
|
||||
// http://forums.winamp.com/showthread.php?p=3078545
|
||||
if (macosVersion_1.isMacOsCatalina()) {
|
||||
// TODO: remove workaround when wine is fully upgraded to 11
|
||||
if ((0, macosVersion_1.isMacOsCatalina)()) {
|
||||
try {
|
||||
await nsisUtil_1.UninstallerReader.exec(installerPath, uninstallerPath);
|
||||
}
|
||||
|
|
@ -331,21 +363,21 @@ class NsisTarget extends core_1.Target {
|
|||
await vm.exec(installerPath, []);
|
||||
// Parallels VM can exit after command execution, but NSIS continue to be running
|
||||
let i = 0;
|
||||
while (!(await fs_1.exists(uninstallerPath)) && i++ < 100) {
|
||||
while (!(await (0, builder_util_1.exists)(uninstallerPath)) && i++ < 100) {
|
||||
// noinspection JSUnusedLocalSymbols
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
await new Promise((resolve, _reject) => setTimeout(resolve, 300));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
await wine_1.execWine(installerPath, null, [], { env: { __COMPAT_LAYER: "RunAsInvoker" } });
|
||||
const wineVm = new WineVm_1.WineVmManager((_a = packager.config.toolsets) === null || _a === void 0 ? void 0 : _a.wine);
|
||||
await wineVm.exec(installerPath, [], { env: { __COMPAT_LAYER: "RunAsInvoker" } });
|
||||
}
|
||||
await packager.sign(uninstallerPath, " Signing NSIS uninstaller");
|
||||
await packager.signIf(uninstallerPath);
|
||||
delete defines.BUILD_UNINSTALLER;
|
||||
// platform-specific path, not wine
|
||||
defines.UNINSTALLER_OUT_FILE = uninstallerPath;
|
||||
return script;
|
||||
return { script, isCustomScript: false };
|
||||
}
|
||||
computeVersionKey(short = false) {
|
||||
// Error: invalid VIProductVersion format, should be X.X.X.X
|
||||
|
|
@ -353,18 +385,18 @@ class NsisTarget extends core_1.Target {
|
|||
const localeId = this.options.language || "1033";
|
||||
const appInfo = this.packager.appInfo;
|
||||
const versionKey = [
|
||||
`/LANG=${localeId} ProductName "${appInfo.productName}"`,
|
||||
`/LANG=${localeId} ProductVersion "${appInfo.version}"`,
|
||||
`/LANG=${localeId} LegalCopyright "${appInfo.copyright}"`,
|
||||
`/LANG=${localeId} FileDescription "${appInfo.description}"`,
|
||||
`/LANG=${localeId} FileVersion "${appInfo.buildVersion}"`,
|
||||
`/LANG=${localeId} ProductName "${(0, nsisScriptGenerator_1.nsisEscapeString)(appInfo.productName)}"`,
|
||||
`/LANG=${localeId} ProductVersion "${(0, nsisScriptGenerator_1.nsisEscapeString)(appInfo.version)}"`,
|
||||
`/LANG=${localeId} LegalCopyright "${(0, nsisScriptGenerator_1.nsisEscapeString)(appInfo.copyright)}"`,
|
||||
`/LANG=${localeId} FileDescription "${(0, nsisScriptGenerator_1.nsisEscapeString)(appInfo.description)}"`,
|
||||
`/LANG=${localeId} FileVersion "${(0, nsisScriptGenerator_1.nsisEscapeString)(appInfo.buildVersion)}"`,
|
||||
];
|
||||
if (short) {
|
||||
versionKey[1] = `/LANG=${localeId} ProductVersion "${appInfo.shortVersion}"`;
|
||||
versionKey[4] = `/LANG=${localeId} FileVersion "${appInfo.shortVersion}"`;
|
||||
versionKey[1] = `/LANG=${localeId} ProductVersion "${(0, nsisScriptGenerator_1.nsisEscapeString)(appInfo.shortVersion)}"`;
|
||||
versionKey[4] = `/LANG=${localeId} FileVersion "${(0, nsisScriptGenerator_1.nsisEscapeString)(appInfo.shortVersion)}"`;
|
||||
}
|
||||
builder_util_1.use(this.packager.platformSpecificBuildOptions.legalTrademarks, it => versionKey.push(`/LANG=${localeId} LegalTrademarks "${it}"`));
|
||||
builder_util_1.use(appInfo.companyName, it => versionKey.push(`/LANG=${localeId} CompanyName "${it}"`));
|
||||
(0, builder_util_1.use)(this.packager.platformSpecificBuildOptions.legalTrademarks, it => versionKey.push(`/LANG=${localeId} LegalTrademarks "${(0, nsisScriptGenerator_1.nsisEscapeString)(it)}"`));
|
||||
(0, builder_util_1.use)(appInfo.companyName, it => versionKey.push(`/LANG=${localeId} CompanyName "${(0, nsisScriptGenerator_1.nsisEscapeString)(it)}"`));
|
||||
return versionKey;
|
||||
}
|
||||
configureDefines(oneClick, defines) {
|
||||
|
|
@ -407,6 +439,9 @@ class NsisTarget extends core_1.Target {
|
|||
if (options.perMachine === true) {
|
||||
defines.INSTALL_MODE_PER_ALL_USERS = null;
|
||||
}
|
||||
if (options.selectPerMachineByDefault === true) {
|
||||
defines.INSTALL_MODE_PER_ALL_USERS_DEFAULT = null;
|
||||
}
|
||||
if (!oneClick || options.perMachine === true) {
|
||||
defines.INSTALL_MODE_PER_ALL_USERS_REQUIRED = null;
|
||||
}
|
||||
|
|
@ -419,7 +454,7 @@ class NsisTarget extends core_1.Target {
|
|||
if (options.removeDefaultUninstallWelcomePage) {
|
||||
defines.removeDefaultUninstallWelcomePage = null;
|
||||
}
|
||||
const commonOptions = CommonWindowsInstallerConfiguration_1.getEffectiveOptions(options, packager);
|
||||
const commonOptions = (0, CommonWindowsInstallerConfiguration_1.getEffectiveOptions)(options, packager);
|
||||
if (commonOptions.menuCategory != null) {
|
||||
defines.MENU_FILENAME = commonOptions.menuCategory;
|
||||
}
|
||||
|
|
@ -474,7 +509,8 @@ class NsisTarget extends core_1.Target {
|
|||
defines.COMPRESSION_METHOD = options.useZip ? "zip" : "7z";
|
||||
}
|
||||
}
|
||||
async executeMakensis(defines, commands, script) {
|
||||
async executeMakensis(defines, commands, script, opts = {}) {
|
||||
var _a, _b;
|
||||
const args = this.options.warningsAsErrors === false ? [] : ["-WX"];
|
||||
args.push("-INPUTCHARSET", "UTF8");
|
||||
for (const name of Object.keys(defines)) {
|
||||
|
|
@ -483,7 +519,17 @@ class NsisTarget extends core_1.Target {
|
|||
args.push(`-D${name}`);
|
||||
}
|
||||
else {
|
||||
args.push(`-D${name}=${value}`);
|
||||
// nsisEscapeString prevents three classes of injection:
|
||||
// 1. Newlines → replaced with spaces; a bare \n in a define value
|
||||
// would terminate the current script line and let whatever follows
|
||||
// be parsed as a new preprocessor directive (e.g. !system, !include).
|
||||
// 2. bare $ → escaped to $$; unescaped $ in a define value would cause
|
||||
// NSIS to expand an unintended variable reference. ${...} references
|
||||
// are left intact so NSIS compile-time defines like ${NSISDIR} still
|
||||
// expand correctly.
|
||||
// 3. " chars → escaped to $\"; an unescaped " would break out of
|
||||
// double-quoted NSIS string literals where ${DEFINE} is expanded.
|
||||
args.push(`-D${name}=${(0, nsisScriptGenerator_1.nsisEscapeString)(String(value))}`);
|
||||
}
|
||||
}
|
||||
for (const name of Object.keys(commands)) {
|
||||
|
|
@ -501,18 +547,26 @@ class NsisTarget extends core_1.Target {
|
|||
if (this.packager.debugLogger.isEnabled) {
|
||||
this.packager.debugLogger.add("nsis.script", script);
|
||||
}
|
||||
const nsisPath = await nsisUtil_1.NSIS_PATH();
|
||||
const command = path.join(nsisPath, process.platform === "darwin" ? "mac" : process.platform === "win32" ? "Bin" : "linux", process.platform === "win32" ? "makensis.exe" : "makensis");
|
||||
// if (process.platform === "win32") {
|
||||
// fix for an issue caused by virus scanners, locking the file during write
|
||||
// https://github.com/electron-userland/electron-builder/issues/5005
|
||||
await ensureNotBusy(commands["OutFile"].replace(/"/g, ""));
|
||||
// }
|
||||
await builder_util_1.spawnAndWrite(command, args, script, {
|
||||
// we use NSIS_CONFIG_CONST_DATA_PATH=no to build makensis on Linux, but in any case it doesn't use stubs as MacOS/Windows version, so, we explicitly set NSISDIR
|
||||
env: { ...process.env, NSISDIR: nsisPath },
|
||||
if (process.platform === "win32") {
|
||||
// fix for an issue caused by virus scanners, locking the file during write
|
||||
// https://github.com/electron-userland/electron-builder/issues/5005
|
||||
await ensureNotBusy(commands["OutFile"].replace(/"/g, ""));
|
||||
}
|
||||
const makensis = await (0, windows_1.getMakeNsisPath)((_a = this.packager.config.toolsets) === null || _a === void 0 ? void 0 : _a.nsis, this.options.customNsisBinary);
|
||||
const { stdout, stderr } = await (0, builder_util_1.spawnAndWriteWithOutput)(makensis.path, args, script, {
|
||||
env: { ...process.env, ...((_b = makensis.env) !== null && _b !== void 0 ? _b : {}) },
|
||||
cwd: nsisUtil_1.nsisTemplatesDir,
|
||||
});
|
||||
(0, nsisValidation_1.checkMakensisOutput)(stdout, stderr);
|
||||
// Only verify output size for the final, non-web installer.
|
||||
// BUILD_UNINSTALLER: intermediate uninstaller build — no embedded archives.
|
||||
// APP_PACKAGE_STORE_FILE: nsis-web — archives downloaded at install-time.
|
||||
// skipSizeVerification: portable builds (NSIS recompresses the archive, so
|
||||
// installer < archive_size is normal) and custom scripts (may not embed archives).
|
||||
if (!("BUILD_UNINSTALLER" in defines) && !("APP_PACKAGE_STORE_FILE" in defines) && !opts.skipSizeVerification) {
|
||||
const outFile = commands["OutFile"].replace(/^"|"$/g, "");
|
||||
await (0, nsisValidation_1.verifyInstallerSize)(outFile, defines);
|
||||
}
|
||||
}
|
||||
async computeCommonInstallerScriptHeader() {
|
||||
const packager = this.packager;
|
||||
|
|
@ -523,23 +577,24 @@ class NsisTarget extends core_1.Target {
|
|||
const includeDir = path.join(nsisUtil_1.nsisTemplatesDir, "include");
|
||||
scriptGenerator.addIncludeDir(includeDir);
|
||||
scriptGenerator.flags(["updated", "force-run", "keep-shortcuts", "no-desktop-shortcut", "delete-app-data", "allusers", "currentuser"]);
|
||||
nsisLang_1.createAddLangsMacro(scriptGenerator, langConfigurator);
|
||||
(0, nsisLang_1.createAddLangsMacro)(scriptGenerator, langConfigurator);
|
||||
const taskManager = new builder_util_1.AsyncTaskManager(packager.info.cancellationToken);
|
||||
const pluginArch = this.isUnicodeEnabled ? "x86-unicode" : "x86-ansi";
|
||||
taskManager.add(async () => {
|
||||
scriptGenerator.addPluginDir(pluginArch, path.join(await nsisResourcePathPromise(), "plugins", pluginArch));
|
||||
var _a;
|
||||
scriptGenerator.addPluginDir(pluginArch, path.join(await (0, windows_1.getNsisPluginsPath)((_a = this.packager.config.toolsets) === null || _a === void 0 ? void 0 : _a.nsis, this.options.customNsisResources), pluginArch));
|
||||
});
|
||||
taskManager.add(async () => {
|
||||
const userPluginDir = path.join(packager.info.buildResourcesDir, pluginArch);
|
||||
const stat = await fs_1.statOrNull(userPluginDir);
|
||||
const stat = await (0, builder_util_1.statOrNull)(userPluginDir);
|
||||
if (stat != null && stat.isDirectory()) {
|
||||
scriptGenerator.addPluginDir(pluginArch, userPluginDir);
|
||||
}
|
||||
});
|
||||
taskManager.addTask(nsisLang_1.addCustomMessageFileInclude("messages.yml", packager, scriptGenerator, langConfigurator));
|
||||
taskManager.addTask((0, nsisLang_1.addCustomMessageFileInclude)("messages.yml", packager, scriptGenerator, langConfigurator));
|
||||
if (!this.isPortable) {
|
||||
if (options.oneClick === false) {
|
||||
taskManager.addTask(nsisLang_1.addCustomMessageFileInclude("assistedMessages.yml", packager, scriptGenerator, langConfigurator));
|
||||
taskManager.addTask((0, nsisLang_1.addCustomMessageFileInclude)("assistedMessages.yml", packager, scriptGenerator, langConfigurator));
|
||||
}
|
||||
taskManager.add(async () => {
|
||||
const customInclude = await packager.getResource(this.options.include, "installer.nsh");
|
||||
|
|
@ -560,7 +615,7 @@ class NsisTarget extends core_1.Target {
|
|||
const taskManager = new builder_util_1.AsyncTaskManager(packager.info.cancellationToken);
|
||||
if (isInstaller) {
|
||||
// http://stackoverflow.com/questions/997456/nsis-license-file-based-on-language-selection
|
||||
taskManager.add(() => nsisLicense_1.computeLicensePage(packager, options, scriptGenerator, langConfigurator.langs));
|
||||
taskManager.add(() => (0, nsisLicense_1.computeLicensePage)(packager, options, scriptGenerator, langConfigurator.langs));
|
||||
}
|
||||
await taskManager.awaitTasks();
|
||||
if (this.isPortable) {
|
||||
|
|
@ -578,18 +633,18 @@ class NsisTarget extends core_1.Target {
|
|||
if (isInstaller) {
|
||||
const registerFileAssociationsScript = new nsisScriptGenerator_1.NsisScriptGenerator();
|
||||
for (const item of fileAssociations) {
|
||||
const extensions = builder_util_1.asArray(item.ext).map(platformPackager_1.normalizeExt);
|
||||
const extensions = (0, builder_util_1.asArray)(item.ext).map(platformPackager_1.normalizeExt);
|
||||
for (const ext of extensions) {
|
||||
const customIcon = await packager.getResource(builder_util_1.getPlatformIconFileName(item.icon, false), `${extensions[0]}.ico`);
|
||||
const customIcon = await packager.getResource((0, builder_util_1.getPlatformIconFileName)(item.icon, false), `${extensions[0]}.ico`);
|
||||
let installedIconPath = "$appExe,0";
|
||||
if (customIcon != null) {
|
||||
installedIconPath = `$INSTDIR\\resources\\${path.basename(customIcon)}`;
|
||||
installedIconPath = `$INSTDIR\\resources\\${(0, nsisScriptGenerator_1.nsisEscapeString)(path.basename(customIcon))}`;
|
||||
registerFileAssociationsScript.file(installedIconPath, customIcon);
|
||||
}
|
||||
const icon = `"${installedIconPath}"`;
|
||||
const commandText = `"Open with ${packager.appInfo.productName}"`;
|
||||
const commandText = `"Open with ${(0, nsisScriptGenerator_1.nsisEscapeString)(packager.appInfo.productName)}"`;
|
||||
const command = '"$appExe $\\"%1$\\""';
|
||||
registerFileAssociationsScript.insertMacro("APP_ASSOCIATE", `"${ext}" "${item.name || ext}" "${item.description || ""}" ${icon} ${commandText} ${command}`);
|
||||
registerFileAssociationsScript.insertMacro("APP_ASSOCIATE", `"${(0, nsisScriptGenerator_1.nsisEscapeString)(ext)}" "${(0, nsisScriptGenerator_1.nsisEscapeString)(item.name || ext)}" "${(0, nsisScriptGenerator_1.nsisEscapeString)(item.description || "")}" ${icon} ${commandText} ${command}`);
|
||||
}
|
||||
}
|
||||
scriptGenerator.macro("registerFileAssociations", registerFileAssociationsScript);
|
||||
|
|
@ -597,8 +652,8 @@ class NsisTarget extends core_1.Target {
|
|||
else {
|
||||
const unregisterFileAssociationsScript = new nsisScriptGenerator_1.NsisScriptGenerator();
|
||||
for (const item of fileAssociations) {
|
||||
for (const ext of builder_util_1.asArray(item.ext)) {
|
||||
unregisterFileAssociationsScript.insertMacro("APP_UNASSOCIATE", `"${platformPackager_1.normalizeExt(ext)}" "${item.name || ext}"`);
|
||||
for (const ext of (0, builder_util_1.asArray)(item.ext)) {
|
||||
unregisterFileAssociationsScript.insertMacro("APP_UNASSOCIATE", `"${(0, platformPackager_1.normalizeExt)(ext)}" "${item.name || ext}"`);
|
||||
}
|
||||
}
|
||||
scriptGenerator.macro("unregisterFileAssociations", unregisterFileAssociationsScript);
|
||||
|
|
@ -610,12 +665,12 @@ class NsisTarget extends core_1.Target {
|
|||
exports.NsisTarget = NsisTarget;
|
||||
async function generateForPreCompressed(preCompressedFileExtensions, dir, arch, scriptGenerator) {
|
||||
const resourcesDir = path.join(dir, "resources");
|
||||
const dirInfo = await fs_1.statOrNull(resourcesDir);
|
||||
const dirInfo = await (0, builder_util_1.statOrNull)(resourcesDir);
|
||||
if (dirInfo == null || !dirInfo.isDirectory()) {
|
||||
return;
|
||||
}
|
||||
const nodeModules = `${path.sep}node_modules`;
|
||||
const preCompressedAssets = await fs_1.walk(resourcesDir, (file, stat) => {
|
||||
const preCompressedAssets = await (0, builder_util_1.walk)(resourcesDir, (file, stat) => {
|
||||
if (stat.isDirectory()) {
|
||||
return !file.endsWith(nodeModules);
|
||||
}
|
||||
|
|
@ -626,7 +681,7 @@ async function generateForPreCompressed(preCompressedFileExtensions, dir, arch,
|
|||
if (preCompressedAssets.length !== 0) {
|
||||
const macro = new nsisScriptGenerator_1.NsisScriptGenerator();
|
||||
for (const file of preCompressedAssets) {
|
||||
macro.file(`$INSTDIR\\${path.relative(dir, file).replace(/\//g, "\\")}`, file);
|
||||
macro.file(`$INSTDIR\\${(0, nsisScriptGenerator_1.nsisEscapeString)(path.relative(dir, file).replace(/\//g, "\\"))}`, file);
|
||||
}
|
||||
scriptGenerator.macro(`customFiles_${builder_util_1.Arch[arch]}`, macro);
|
||||
}
|
||||
|
|
@ -667,8 +722,8 @@ async function ensureNotBusy(outFile) {
|
|||
async function createPackageFileInfo(file) {
|
||||
return {
|
||||
path: file,
|
||||
size: (await fs_extra_1.stat(file)).size,
|
||||
sha512: await hash_1.hashFile(file),
|
||||
size: (await (0, fs_extra_1.stat)(file)).size,
|
||||
sha512: await (0, hash_1.hashFile)(file),
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=NsisTarget.js.map
|
||||
2
electron/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js.map
generated
vendored
2
electron/node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js.map
generated
vendored
File diff suppressed because one or more lines are too long
4
electron/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.d.ts
generated
vendored
4
electron/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.d.ts
generated
vendored
|
|
@ -1,3 +1,4 @@
|
|||
import { Arch } from "builder-util";
|
||||
import { WinPackager } from "../../winPackager";
|
||||
import { NsisTarget } from "./NsisTarget";
|
||||
import { AppPackageHelper } from "./nsisUtil";
|
||||
|
|
@ -6,6 +7,7 @@ export declare class WebInstallerTarget extends NsisTarget {
|
|||
constructor(packager: WinPackager, outDir: string, targetName: string, packageHelper: AppPackageHelper);
|
||||
get isWebInstaller(): boolean;
|
||||
protected configureDefines(oneClick: boolean, defines: any): Promise<any>;
|
||||
protected get installerFilenamePattern(): string;
|
||||
get shouldBuildUniversalInstaller(): boolean;
|
||||
protected installerFilenamePattern(_primaryArch?: Arch | null, _defaultArch?: string): string;
|
||||
protected generateGitHubInstallerName(): string;
|
||||
}
|
||||
|
|
|
|||
16
electron/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.js
generated
vendored
16
electron/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.js
generated
vendored
|
|
@ -1,6 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.WebInstallerTarget = void 0;
|
||||
const builder_util_1 = require("builder-util");
|
||||
const PublishManager_1 = require("../../publish/PublishManager");
|
||||
const NsisTarget_1 = require("./NsisTarget");
|
||||
/** @private */
|
||||
|
|
@ -18,17 +19,22 @@ class WebInstallerTarget extends NsisTarget_1.NsisTarget {
|
|||
const options = this.options;
|
||||
let appPackageUrl = options.appPackageUrl;
|
||||
if (appPackageUrl == null) {
|
||||
const publishConfigs = await PublishManager_1.getPublishConfigsForUpdateInfo(packager, await PublishManager_1.getPublishConfigs(packager, packager.info.config, null, false), null);
|
||||
const publishConfigs = await (0, PublishManager_1.getPublishConfigsForUpdateInfo)(packager, await (0, PublishManager_1.getPublishConfigs)(packager, this.options, null, false), null);
|
||||
if (publishConfigs == null || publishConfigs.length === 0) {
|
||||
throw new Error("Cannot compute app package download URL");
|
||||
}
|
||||
appPackageUrl = PublishManager_1.computeDownloadUrl(publishConfigs[0], null, packager);
|
||||
appPackageUrl = (0, PublishManager_1.computeDownloadUrl)(publishConfigs[0], null, packager);
|
||||
defines.APP_PACKAGE_URL_IS_INCOMPLETE = null;
|
||||
}
|
||||
defines.APP_PACKAGE_URL_IS_INCOMPLETE = null;
|
||||
defines.APP_PACKAGE_URL = appPackageUrl;
|
||||
}
|
||||
get installerFilenamePattern() {
|
||||
// tslint:disable:no-invalid-template-strings
|
||||
get shouldBuildUniversalInstaller() {
|
||||
if (this.options.buildUniversalInstaller === false) {
|
||||
builder_util_1.log.warn({ buildUniversalInstaller: true }, "only universal builds are supported for nsis-web installers, overriding setting");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
installerFilenamePattern(_primaryArch, _defaultArch) {
|
||||
return "${productName} Web Setup ${version}.${ext}";
|
||||
}
|
||||
generateGitHubInstallerName() {
|
||||
|
|
|
|||
2
electron/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.js.map
generated
vendored
2
electron/node_modules/app-builder-lib/out/targets/nsis/WebInstallerTarget.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"WebInstallerTarget.js","sourceRoot":"","sources":["../../../src/targets/nsis/WebInstallerTarget.ts"],"names":[],"mappings":";;;AAAA,iEAAoH;AAGpH,6CAAyC;AAGzC,eAAe;AACf,MAAa,kBAAmB,SAAQ,uBAAU;IAChD,YAAY,QAAqB,EAAE,MAAc,EAAE,UAAkB,EAAE,aAA+B;QACpG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,CAAA;IACpD,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAA;IACb,CAAC;IAES,KAAK,CAAC,gBAAgB,CAAC,QAAiB,EAAE,OAAY;QAC9D,8BAA8B;QAC9B,MAAO,uBAAU,CAAC,SAAgC,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;QAEjG,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAyB,CAAA;QAE9C,IAAI,aAAa,GAAG,OAAO,CAAC,aAAa,CAAA;QACzC,IAAI,aAAa,IAAI,IAAI,EAAE;YACzB,MAAM,cAAc,GAAG,MAAM,+CAA8B,CAAC,QAAQ,EAAE,MAAM,kCAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,CAAA;YACjJ,IAAI,cAAc,IAAI,IAAI,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;gBACzD,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;aAC3D;YAED,aAAa,GAAG,mCAAkB,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;SACtE;QAED,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAA;QAC5C,OAAO,CAAC,eAAe,GAAG,aAAa,CAAA;IACzC,CAAC;IAED,IAAc,wBAAwB;QACpC,6CAA6C;QAC7C,OAAO,4CAA4C,CAAA;IACrD,CAAC;IAES,2BAA2B;QACnC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAA;QACrC,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAA;QACzF,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,UAAU,IAAI,OAAO,CAAC,OAAO,MAAM,CAAA;IAC/D,CAAC;CACF;AAxCD,gDAwCC","sourcesContent":["import { computeDownloadUrl, getPublishConfigs, getPublishConfigsForUpdateInfo } from \"../../publish/PublishManager\"\nimport { WinPackager } from \"../../winPackager\"\nimport { NsisWebOptions } from \"./nsisOptions\"\nimport { NsisTarget } from \"./NsisTarget\"\nimport { AppPackageHelper } from \"./nsisUtil\"\n\n/** @private */\nexport class WebInstallerTarget extends NsisTarget {\n constructor(packager: WinPackager, outDir: string, targetName: string, packageHelper: AppPackageHelper) {\n super(packager, outDir, targetName, packageHelper)\n }\n\n get isWebInstaller(): boolean {\n return true\n }\n\n protected async configureDefines(oneClick: boolean, defines: any): Promise<any> {\n //noinspection ES6MissingAwait\n await (NsisTarget.prototype as WebInstallerTarget).configureDefines.call(this, oneClick, defines)\n\n const packager = this.packager\n const options = this.options as NsisWebOptions\n\n let appPackageUrl = options.appPackageUrl\n if (appPackageUrl == null) {\n const publishConfigs = await getPublishConfigsForUpdateInfo(packager, await getPublishConfigs(packager, packager.info.config, null, false), null)\n if (publishConfigs == null || publishConfigs.length === 0) {\n throw new Error(\"Cannot compute app package download URL\")\n }\n\n appPackageUrl = computeDownloadUrl(publishConfigs[0], null, packager)\n }\n\n defines.APP_PACKAGE_URL_IS_INCOMPLETE = null\n defines.APP_PACKAGE_URL = appPackageUrl\n }\n\n protected get installerFilenamePattern(): string {\n // tslint:disable:no-invalid-template-strings\n return \"${productName} Web Setup ${version}.${ext}\"\n }\n\n protected generateGitHubInstallerName(): string {\n const appInfo = this.packager.appInfo\n const classifier = appInfo.name.toLowerCase() === appInfo.name ? \"web-setup\" : \"WebSetup\"\n return `${appInfo.name}-${classifier}-${appInfo.version}.exe`\n }\n}\n"]}
|
||||
{"version":3,"file":"WebInstallerTarget.js","sourceRoot":"","sources":["../../../src/targets/nsis/WebInstallerTarget.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,iEAAoH;AAGpH,6CAAyC;AAGzC,eAAe;AACf,MAAa,kBAAmB,SAAQ,uBAAU;IAChD,YAAY,QAAqB,EAAE,MAAc,EAAE,UAAkB,EAAE,aAA+B;QACpG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,CAAA;IACpD,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAA;IACb,CAAC;IAES,KAAK,CAAC,gBAAgB,CAAC,QAAiB,EAAE,OAAY;QAC9D,8BAA8B;QAC9B,MAAO,uBAAU,CAAC,SAAgC,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;QAEjG,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAyB,CAAA;QAE9C,IAAI,aAAa,GAAG,OAAO,CAAC,aAAa,CAAA;QACzC,IAAI,aAAa,IAAI,IAAI,EAAE,CAAC;YAC1B,MAAM,cAAc,GAAG,MAAM,IAAA,+CAA8B,EAAC,QAAQ,EAAE,MAAM,IAAA,kCAAiB,EAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,CAAA;YACzI,IAAI,cAAc,IAAI,IAAI,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC1D,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;YAC5D,CAAC;YAED,aAAa,GAAG,IAAA,mCAAkB,EAAC,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;YACrE,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAA;QAC9C,CAAC;QAED,OAAO,CAAC,eAAe,GAAG,aAAa,CAAA;IACzC,CAAC;IAED,IAAI,6BAA6B;QAC/B,IAAI,IAAI,CAAC,OAAO,CAAC,uBAAuB,KAAK,KAAK,EAAE,CAAC;YACnD,kBAAG,CAAC,IAAI,CAAC,EAAE,uBAAuB,EAAE,IAAI,EAAE,EAAE,iFAAiF,CAAC,CAAA;QAChI,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAES,wBAAwB,CAAC,YAA0B,EAAE,YAAqB;QAClF,OAAO,4CAA4C,CAAA;IACrD,CAAC;IAES,2BAA2B;QACnC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAA;QACrC,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAA;QACzF,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,UAAU,IAAI,OAAO,CAAC,OAAO,MAAM,CAAA;IAC/D,CAAC;CACF;AA9CD,gDA8CC","sourcesContent":["import { Arch, log } from \"builder-util\"\nimport { computeDownloadUrl, getPublishConfigs, getPublishConfigsForUpdateInfo } from \"../../publish/PublishManager\"\nimport { WinPackager } from \"../../winPackager\"\nimport { NsisWebOptions } from \"./nsisOptions\"\nimport { NsisTarget } from \"./NsisTarget\"\nimport { AppPackageHelper } from \"./nsisUtil\"\n\n/** @private */\nexport class WebInstallerTarget extends NsisTarget {\n constructor(packager: WinPackager, outDir: string, targetName: string, packageHelper: AppPackageHelper) {\n super(packager, outDir, targetName, packageHelper)\n }\n\n get isWebInstaller(): boolean {\n return true\n }\n\n protected async configureDefines(oneClick: boolean, defines: any): Promise<any> {\n //noinspection ES6MissingAwait\n await (NsisTarget.prototype as WebInstallerTarget).configureDefines.call(this, oneClick, defines)\n\n const packager = this.packager\n const options = this.options as NsisWebOptions\n\n let appPackageUrl = options.appPackageUrl\n if (appPackageUrl == null) {\n const publishConfigs = await getPublishConfigsForUpdateInfo(packager, await getPublishConfigs(packager, this.options, null, false), null)\n if (publishConfigs == null || publishConfigs.length === 0) {\n throw new Error(\"Cannot compute app package download URL\")\n }\n\n appPackageUrl = computeDownloadUrl(publishConfigs[0], null, packager)\n defines.APP_PACKAGE_URL_IS_INCOMPLETE = null\n }\n\n defines.APP_PACKAGE_URL = appPackageUrl\n }\n\n get shouldBuildUniversalInstaller() {\n if (this.options.buildUniversalInstaller === false) {\n log.warn({ buildUniversalInstaller: true }, \"only universal builds are supported for nsis-web installers, overriding setting\")\n }\n return true\n }\n\n protected installerFilenamePattern(_primaryArch?: Arch | null, _defaultArch?: string): string {\n return \"${productName} Web Setup ${version}.${ext}\"\n }\n\n protected generateGitHubInstallerName(): string {\n const appInfo = this.packager.appInfo\n const classifier = appInfo.name.toLowerCase() === appInfo.name ? \"web-setup\" : \"WebSetup\"\n return `${appInfo.name}-${classifier}-${appInfo.version}.exe`\n }\n}\n"]}
|
||||
18
electron/node_modules/app-builder-lib/out/targets/nsis/nsisLang.js
generated
vendored
18
electron/node_modules/app-builder-lib/out/targets/nsis/nsisLang.js
generated
vendored
|
|
@ -1,14 +1,16 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.addCustomMessageFileInclude = exports.createAddLangsMacro = exports.LangConfigurator = void 0;
|
||||
exports.LangConfigurator = void 0;
|
||||
exports.createAddLangsMacro = createAddLangsMacro;
|
||||
exports.addCustomMessageFileInclude = addCustomMessageFileInclude;
|
||||
const builder_util_1 = require("builder-util");
|
||||
const langs_1 = require("../../util/langs");
|
||||
const debug_1 = require("debug");
|
||||
const fs_extra_1 = require("fs-extra");
|
||||
const js_yaml_1 = require("js-yaml");
|
||||
const path = require("path");
|
||||
const langs_1 = require("../../util/langs");
|
||||
const nsisUtil_1 = require("./nsisUtil");
|
||||
const debug = debug_1.default("electron-builder:nsis");
|
||||
const debug = (0, debug_1.default)("electron-builder:nsis");
|
||||
class LangConfigurator {
|
||||
constructor(options) {
|
||||
const rawList = options.installerLanguages;
|
||||
|
|
@ -19,7 +21,7 @@ class LangConfigurator {
|
|||
this.isMultiLang = options.multiLanguageInstaller !== false;
|
||||
}
|
||||
if (this.isMultiLang) {
|
||||
this.langs = rawList == null ? langs_1.bundledLanguages.slice() : builder_util_1.asArray(rawList).map(it => langs_1.toLangWithRegion(it.replace("-", "_")));
|
||||
this.langs = rawList == null ? langs_1.bundledLanguages.slice() : (0, builder_util_1.asArray)(rawList).map(it => (0, langs_1.toLangWithRegion)(it.replace("-", "_")));
|
||||
}
|
||||
else {
|
||||
this.langs = ["en_US"];
|
||||
|
|
@ -57,19 +59,17 @@ function createAddLangsMacro(scriptGenerator, langConfigurator) {
|
|||
}
|
||||
scriptGenerator.macro("addLangs", result);
|
||||
}
|
||||
exports.createAddLangsMacro = createAddLangsMacro;
|
||||
async function writeCustomLangFile(data, packager) {
|
||||
const file = await packager.getTempFile("messages.nsh");
|
||||
await fs_extra_1.outputFile(file, data);
|
||||
await (0, fs_extra_1.outputFile)(file, data);
|
||||
return file;
|
||||
}
|
||||
async function addCustomMessageFileInclude(input, packager, scriptGenerator, langConfigurator) {
|
||||
const data = js_yaml_1.load(await fs_extra_1.readFile(path.join(nsisUtil_1.nsisTemplatesDir, input), "utf-8"));
|
||||
const data = (0, js_yaml_1.load)(await (0, fs_extra_1.readFile)(path.join(nsisUtil_1.nsisTemplatesDir, input), "utf-8"));
|
||||
const instructions = computeCustomMessageTranslations(data, langConfigurator).join("\n");
|
||||
debug(instructions);
|
||||
scriptGenerator.include(await writeCustomLangFile(instructions, packager));
|
||||
}
|
||||
exports.addCustomMessageFileInclude = addCustomMessageFileInclude;
|
||||
function computeCustomMessageTranslations(messages, langConfigurator) {
|
||||
const result = [];
|
||||
const includedLangs = new Set(langConfigurator.langs);
|
||||
|
|
@ -77,7 +77,7 @@ function computeCustomMessageTranslations(messages, langConfigurator) {
|
|||
const langToTranslations = messages[messageId];
|
||||
const unspecifiedLangs = new Set(langConfigurator.langs);
|
||||
for (const lang of Object.keys(langToTranslations)) {
|
||||
const langWithRegion = langs_1.toLangWithRegion(lang);
|
||||
const langWithRegion = (0, langs_1.toLangWithRegion)(lang);
|
||||
if (!includedLangs.has(langWithRegion)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
2
electron/node_modules/app-builder-lib/out/targets/nsis/nsisLang.js.map
generated
vendored
2
electron/node_modules/app-builder-lib/out/targets/nsis/nsisLang.js.map
generated
vendored
File diff suppressed because one or more lines are too long
34
electron/node_modules/app-builder-lib/out/targets/nsis/nsisLicense.js
generated
vendored
34
electron/node_modules/app-builder-lib/out/targets/nsis/nsisLicense.js
generated
vendored
|
|
@ -1,12 +1,36 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.computeLicensePage = void 0;
|
||||
exports.computeLicensePage = computeLicensePage;
|
||||
const builder_util_1 = require("builder-util");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const langs_1 = require("../../util/langs");
|
||||
const license_1 = require("../../util/license");
|
||||
const path = require("path");
|
||||
const nsisUtil_1 = require("./nsisUtil");
|
||||
function convertFileToUtf8WithBOMSync(filePath) {
|
||||
var _a;
|
||||
try {
|
||||
const UTF8_BOM_HEADER = Buffer.from([0xef, 0xbb, 0xbf]);
|
||||
const data = fs.readFileSync(filePath);
|
||||
// Check if the file already starts with a UTF-8 BOM
|
||||
builder_util_1.log.debug({ file: builder_util_1.log.filePath(filePath) }, "checking file for BOM header");
|
||||
if (data.length >= UTF8_BOM_HEADER.length && data.subarray(0, UTF8_BOM_HEADER.length).equals(UTF8_BOM_HEADER)) {
|
||||
builder_util_1.log.debug({ file: builder_util_1.log.filePath(filePath) }, "file is already in BOM format, skipping conversion.");
|
||||
return true;
|
||||
}
|
||||
// If not, add the BOM
|
||||
const dataWithBOM = Buffer.concat([UTF8_BOM_HEADER, data]);
|
||||
fs.writeFileSync(filePath, dataWithBOM);
|
||||
builder_util_1.log.debug({ file: builder_util_1.log.filePath(filePath) }, "file successfully converted to UTF-8 with BOM");
|
||||
return true;
|
||||
}
|
||||
catch (err) {
|
||||
builder_util_1.log.error({ file: builder_util_1.log.filePath(filePath), message: (_a = err.message) !== null && _a !== void 0 ? _a : err.stack }, "unable to convert file to UTF-8 with BOM");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
async function computeLicensePage(packager, options, scriptGenerator, languages) {
|
||||
const license = await license_1.getNotLocalizedLicenseFile(options.license, packager);
|
||||
const license = await (0, license_1.getNotLocalizedLicenseFile)(options.license, packager);
|
||||
if (license != null) {
|
||||
let licensePage;
|
||||
if (license.endsWith(".html")) {
|
||||
|
|
@ -29,7 +53,7 @@ async function computeLicensePage(packager, options, scriptGenerator, languages)
|
|||
}
|
||||
return;
|
||||
}
|
||||
const licenseFiles = await license_1.getLicenseFiles(packager);
|
||||
const licenseFiles = await (0, license_1.getLicenseFiles)(packager);
|
||||
if (licenseFiles.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -38,6 +62,7 @@ async function computeLicensePage(packager, options, scriptGenerator, languages)
|
|||
let defaultFile = null;
|
||||
for (const item of licenseFiles) {
|
||||
unspecifiedLangs.delete(item.langWithRegion);
|
||||
convertFileToUtf8WithBOMSync(item.file);
|
||||
if (defaultFile == null) {
|
||||
defaultFile = item.file;
|
||||
}
|
||||
|
|
@ -49,5 +74,4 @@ async function computeLicensePage(packager, options, scriptGenerator, languages)
|
|||
licensePage.push('!insertmacro MUI_PAGE_LICENSE "$(MUILicense)"');
|
||||
scriptGenerator.macro("licensePage", licensePage);
|
||||
}
|
||||
exports.computeLicensePage = computeLicensePage;
|
||||
//# sourceMappingURL=nsisLicense.js.map
|
||||
2
electron/node_modules/app-builder-lib/out/targets/nsis/nsisLicense.js.map
generated
vendored
2
electron/node_modules/app-builder-lib/out/targets/nsis/nsisLicense.js.map
generated
vendored
File diff suppressed because one or more lines are too long
93
electron/node_modules/app-builder-lib/out/targets/nsis/nsisOptions.d.ts
generated
vendored
93
electron/node_modules/app-builder-lib/out/targets/nsis/nsisOptions.d.ts
generated
vendored
|
|
@ -1,8 +1,8 @@
|
|||
import { TargetSpecificOptions } from "../../core";
|
||||
import { CommonWindowsInstallerConfiguration } from "../..";
|
||||
interface CustomNsisBinary {
|
||||
import { TargetSpecificOptions } from "../../core";
|
||||
export interface CustomNsisBinary {
|
||||
/**
|
||||
* @default https://github.com/electron-userland/electron-builder-binaries/releases/download
|
||||
* @default https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.4.1/nsis-3.0.4.1.7z
|
||||
*/
|
||||
readonly url: string | null;
|
||||
/**
|
||||
|
|
@ -21,6 +21,20 @@ interface CustomNsisBinary {
|
|||
*/
|
||||
readonly debugLogging?: boolean | null;
|
||||
}
|
||||
export interface CustomNsisResources {
|
||||
/**
|
||||
* @default https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-resources-3.4.1/nsis-resources-3.4.1.7z
|
||||
*/
|
||||
readonly url: string;
|
||||
/**
|
||||
* @default Dqd6g+2buwwvoG1Vyf6BHR1b+25QMmPcwZx40atOT57gH27rkjOei1L0JTldxZu4NFoEmW4kJgZ3DlSWVON3+Q==
|
||||
*/
|
||||
readonly checksum: string;
|
||||
/**
|
||||
* @default 3.4.1
|
||||
*/
|
||||
readonly version: string;
|
||||
}
|
||||
export interface CommonNsisOptions {
|
||||
/**
|
||||
* Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode).
|
||||
|
|
@ -28,7 +42,11 @@ export interface CommonNsisOptions {
|
|||
*/
|
||||
readonly unicode?: boolean;
|
||||
/**
|
||||
* See [GUID vs Application Name](../configuration/nsis#guid-vs-application-name).
|
||||
* The GUID for the installer. Used to identify the application for upgrade and uninstall operations.
|
||||
* If not specified, a deterministic GUID is generated from the app ID (`appId`) — but this means
|
||||
* changing your `appId` will break silent upgrades of existing installs.
|
||||
*
|
||||
* @see [GUID vs Application Name](https://www.electron.build/docs/nsis#guid-vs-application-name)
|
||||
*/
|
||||
readonly guid?: string | null;
|
||||
/**
|
||||
|
|
@ -37,7 +55,7 @@ export interface CommonNsisOptions {
|
|||
*/
|
||||
readonly warningsAsErrors?: boolean;
|
||||
/**
|
||||
* @private
|
||||
* Forces zip compression format instead of LZMA. Used internally for differential update packages.
|
||||
* @default false
|
||||
*/
|
||||
readonly useZip?: boolean;
|
||||
|
|
@ -45,6 +63,10 @@ export interface CommonNsisOptions {
|
|||
* Allows you to provide your own `makensis`, such as one with support for debug logging via LogSet and LogText. (Logging also requires option `debugLogging = true`)
|
||||
*/
|
||||
readonly customNsisBinary?: CustomNsisBinary | null;
|
||||
/**
|
||||
* Allows you to provide your own `nsis-resources`
|
||||
*/
|
||||
readonly customNsisResources?: CustomNsisResources | null;
|
||||
}
|
||||
export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerConfiguration, TargetSpecificOptions {
|
||||
/**
|
||||
|
|
@ -63,6 +85,12 @@ export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerCo
|
|||
* @default false
|
||||
*/
|
||||
readonly perMachine?: boolean;
|
||||
/**
|
||||
* Whether to set per-machine or per-user installation as default selection on the install mode installer page.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
readonly selectPerMachineByDefault?: boolean;
|
||||
/**
|
||||
* *assisted installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions.
|
||||
* @default true
|
||||
|
|
@ -79,32 +107,32 @@ export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerCo
|
|||
*/
|
||||
readonly removeDefaultUninstallWelcomePage?: boolean;
|
||||
/**
|
||||
* The path to installer icon, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
|
||||
* The path to installer icon, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.
|
||||
* Defaults to `build/installerIcon.ico` or application icon.
|
||||
*/
|
||||
readonly installerIcon?: string | null;
|
||||
/**
|
||||
* The path to uninstaller icon, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
|
||||
* The path to uninstaller icon, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.
|
||||
* Defaults to `build/uninstallerIcon.ico` or application icon.
|
||||
*/
|
||||
readonly uninstallerIcon?: string | null;
|
||||
/**
|
||||
* *assisted installer only.* `MUI_HEADERIMAGE`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
|
||||
* *assisted installer only.* `MUI_HEADERIMAGE`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.
|
||||
* @default build/installerHeader.bmp
|
||||
*/
|
||||
readonly installerHeader?: string | null;
|
||||
/**
|
||||
* *one-click installer only.* The path to header icon (above the progress bar), relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
|
||||
* *one-click installer only.* The path to header icon (above the progress bar), relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.
|
||||
* Defaults to `build/installerHeaderIcon.ico` or application icon.
|
||||
*/
|
||||
readonly installerHeaderIcon?: string | null;
|
||||
/**
|
||||
* *assisted installer only.* `MUI_WELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
|
||||
* *assisted installer only.* `MUI_WELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.
|
||||
* Defaults to `build/installerSidebar.bmp` or `${NSISDIR}\\Contrib\\Graphics\\Wizard\\nsis3-metro.bmp`. Image size 164 × 314 pixels.
|
||||
*/
|
||||
readonly installerSidebar?: string | null;
|
||||
/**
|
||||
* *assisted installer only.* `MUI_UNWELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](/configuration/configuration#MetadataDirectories-buildResources) or to the project directory.
|
||||
* *assisted installer only.* `MUI_UNWELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.
|
||||
* Defaults to `installerSidebar` option or `build/uninstallerSidebar.bmp` or `build/installerSidebar.bmp` or `${NSISDIR}\\Contrib\\Graphics\\Wizard\\nsis3-metro.bmp`
|
||||
*/
|
||||
readonly uninstallerSidebar?: string | null;
|
||||
|
|
@ -112,7 +140,23 @@ export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerCo
|
|||
* The uninstaller display name in the control panel.
|
||||
* @default ${productName} ${version}
|
||||
*/
|
||||
readonly uninstallDisplayName?: string;
|
||||
readonly uninstallDisplayName?: string | null;
|
||||
/**
|
||||
* The URL to the uninstaller help page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.
|
||||
*/
|
||||
readonly uninstallUrlHelp?: string | null;
|
||||
/**
|
||||
* The URL to the uninstaller info about page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.
|
||||
*/
|
||||
readonly uninstallUrlInfoAbout?: string | null;
|
||||
/**
|
||||
* The URL to the uninstaller update info page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.
|
||||
*/
|
||||
readonly uninstallUrlUpdateInfo?: string | null;
|
||||
/**
|
||||
* The URL to the uninstaller readme page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.
|
||||
*/
|
||||
readonly uninstallUrlReadme?: string | null;
|
||||
/**
|
||||
* The path to NSIS include script to customize installer. Defaults to `build/installer.nsh`. See [Custom NSIS script](#custom-nsis-script).
|
||||
*/
|
||||
|
|
@ -131,7 +175,7 @@ export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerCo
|
|||
*/
|
||||
readonly license?: string | null;
|
||||
/**
|
||||
* The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName} Setup ${version}.${ext}`.
|
||||
* The [artifact file name template](https://www.electron.build/docs/configuration#artifact-file-name-template). Defaults to `${productName} Setup ${version}.${ext}`.
|
||||
*/
|
||||
readonly artifactName?: string | null;
|
||||
/**
|
||||
|
|
@ -140,9 +184,9 @@ export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerCo
|
|||
*/
|
||||
readonly deleteAppDataOnUninstall?: boolean;
|
||||
/**
|
||||
* @private
|
||||
* Marks the package as built with differential download support for the update server.
|
||||
*/
|
||||
differentialPackage?: boolean;
|
||||
readonly differentialPackage?: boolean;
|
||||
/**
|
||||
* Whether to display a language selection dialog. Not recommended (by default will be detected using OS language).
|
||||
* @default false
|
||||
|
|
@ -170,6 +214,12 @@ export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerCo
|
|||
* @default [".avi", ".mov", ".m4v", ".mp4", ".m4p", ".qt", ".mkv", ".webm", ".vmdk"]
|
||||
*/
|
||||
readonly preCompressedFileExtensions?: Array<string> | string | null;
|
||||
/**
|
||||
* Disable building an universal installer of the archs specified in the target configuration
|
||||
* *Not supported for nsis-web*
|
||||
* @default true
|
||||
*/
|
||||
readonly buildUniversalInstaller?: boolean;
|
||||
}
|
||||
/**
|
||||
* Portable options.
|
||||
|
|
@ -193,6 +243,11 @@ export interface PortableOptions extends TargetSpecificOptions, CommonNsisOption
|
|||
* The image to show while the portable executable is extracting. This image must be a bitmap (`.bmp`) image.
|
||||
*/
|
||||
readonly splashImage?: string | null;
|
||||
/**
|
||||
* Disable building an universal installer of the archs specified in the target configuration
|
||||
* @default true
|
||||
*/
|
||||
readonly buildUniversalInstaller?: boolean;
|
||||
}
|
||||
/**
|
||||
* Web Installer options.
|
||||
|
|
@ -208,8 +263,12 @@ export interface NsisWebOptions extends NsisOptions {
|
|||
*/
|
||||
readonly appPackageUrl?: string | null;
|
||||
/**
|
||||
* The [artifact file name template](/configuration/configuration#artifact-file-name-template). Defaults to `${productName} Web Setup ${version}.${ext}`.
|
||||
* The [artifact file name template](https://www.electron.build/docs/configuration#artifact-file-name-template). Defaults to `${productName} Web Setup ${version}.${ext}`.
|
||||
*/
|
||||
readonly artifactName?: string | null;
|
||||
/**
|
||||
* Override for `NsisOptions.buildUniversalInstaller`. nsis-web requires universal installer
|
||||
* @default true
|
||||
*/
|
||||
readonly buildUniversalInstaller?: true;
|
||||
}
|
||||
export {};
|
||||
|
|
|
|||
2
electron/node_modules/app-builder-lib/out/targets/nsis/nsisOptions.js.map
generated
vendored
2
electron/node_modules/app-builder-lib/out/targets/nsis/nsisOptions.js.map
generated
vendored
File diff suppressed because one or more lines are too long
1
electron/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.d.ts
generated
vendored
1
electron/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.d.ts
generated
vendored
|
|
@ -9,3 +9,4 @@ export declare class NsisScriptGenerator {
|
|||
flags(flags: Array<string>): void;
|
||||
build(): string;
|
||||
}
|
||||
export declare function nsisEscapeString(s: string): string;
|
||||
|
|
|
|||
12
electron/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.js
generated
vendored
12
electron/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.js
generated
vendored
|
|
@ -1,6 +1,8 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NsisScriptGenerator = void 0;
|
||||
exports.nsisEscapeString = nsisEscapeString;
|
||||
const builder_util_1 = require("builder-util");
|
||||
class NsisScriptGenerator {
|
||||
constructor() {
|
||||
this.lines = [];
|
||||
|
|
@ -40,6 +42,16 @@ class NsisScriptGenerator {
|
|||
}
|
||||
}
|
||||
exports.NsisScriptGenerator = NsisScriptGenerator;
|
||||
function nsisEscapeString(s) {
|
||||
const escaped = s
|
||||
.replace(/\r\n|\r|\n/g, " ") // newlines break NSIS string literals
|
||||
.replace(/\$(?!\{)/g, "$$$$") // bare $ → $$ (prevents NSIS variable expansion); ${...} references are left intact
|
||||
.replace(/"/g, '$\\"'); // " → $\" (NSIS escape for double-quote)
|
||||
if (escaped !== s) {
|
||||
builder_util_1.log.debug({ original: s, final: escaped }, "nsis was escaped");
|
||||
}
|
||||
return escaped;
|
||||
}
|
||||
function getVarNameForFlag(flagName) {
|
||||
if (flagName === "allusers") {
|
||||
return "isForAllUsers";
|
||||
|
|
|
|||
2
electron/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.js.map
generated
vendored
2
electron/node_modules/app-builder-lib/out/targets/nsis/nsisScriptGenerator.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"nsisScriptGenerator.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisScriptGenerator.ts"],"names":[],"mappings":";;;AAAA,MAAa,mBAAmB;IAAhC;QACmB,UAAK,GAAkB,EAAE,CAAA;IA0C5C,CAAC;IAxCC,aAAa,CAAC,IAAY;QACxB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,IAAI,GAAG,CAAC,CAAA;IAC7C,CAAC;IAED,YAAY,CAAC,UAAkB,EAAE,GAAW;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,UAAU,KAAK,GAAG,GAAG,CAAC,CAAA;IAC1D,CAAC;IAED,OAAO,CAAC,IAAY;QAClB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,GAAG,CAAC,CAAA;IACvC,CAAC;IAED,KAAK,CAAC,IAAY,EAAE,KAA0C;QAC5D,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,CAAC,CAAA;IACpH,CAAC;IAED,IAAI,CAAC,UAAyB,EAAE,IAAY;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,UAAU,GAAG,KAAK,IAAI,GAAG,CAAC,CAAA;IACzF,CAAC;IAED,WAAW,CAAC,IAAY,EAAE,UAAkB;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,UAAU,EAAE,CAAC,CAAA;IACvD,CAAC;IAED,iBAAiB;IACjB,KAAK,CAAC,KAAoB;QACxB,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE;YAC5B,MAAM,YAAY,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;YACpG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,YAAY;oCACT,QAAQ;;;UAGlC,YAAY,SAAS,YAAY;CAC1C,CAAC,CAAA;SACG;IACH,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACrC,CAAC;CACF;AA3CD,kDA2CC;AAED,SAAS,iBAAiB,CAAC,QAAgB;IACzC,IAAI,QAAQ,KAAK,UAAU,EAAE;QAC3B,OAAO,eAAe,CAAA;KACvB;IACD,IAAI,QAAQ,KAAK,aAAa,EAAE;QAC9B,OAAO,kBAAkB,CAAA;KAC1B;IACD,OAAO,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;AACjE,CAAC","sourcesContent":["export class NsisScriptGenerator {\n private readonly lines: Array<string> = []\n\n addIncludeDir(file: string) {\n this.lines.push(`!addincludedir \"${file}\"`)\n }\n\n addPluginDir(pluginArch: string, dir: string) {\n this.lines.push(`!addplugindir /${pluginArch} \"${dir}\"`)\n }\n\n include(file: string) {\n this.lines.push(`!include \"${file}\"`)\n }\n\n macro(name: string, lines: Array<string> | NsisScriptGenerator) {\n this.lines.push(`!macro ${name}`, ` ${(Array.isArray(lines) ? lines : lines.lines).join(\"\\n \")}`, `!macroend\\n`)\n }\n\n file(outputName: string | null, file: string) {\n this.lines.push(`File${outputName == null ? \"\" : ` \"/oname=${outputName}\"`} \"${file}\"`)\n }\n\n insertMacro(name: string, parameters: string) {\n this.lines.push(`!insertmacro ${name} ${parameters}`)\n }\n\n // without -- !!!\n flags(flags: Array<string>) {\n for (const flagName of flags) {\n const variableName = getVarNameForFlag(flagName).replace(/[-]+(\\w|$)/g, (m, p1) => p1.toUpperCase())\n this.lines.push(`!macro _${variableName} _a _b _t _f\n $\\{StdUtils.TestParameter} $R9 \"${flagName}\"\n StrCmp \"$R9\" \"true\" \\`$\\{_t}\\` \\`$\\{_f}\\`\n!macroend\n!define ${variableName} \\`\"\" ${variableName} \"\"\\`\n`)\n }\n }\n\n build() {\n return this.lines.join(\"\\n\") + \"\\n\"\n }\n}\n\nfunction getVarNameForFlag(flagName: string): string {\n if (flagName === \"allusers\") {\n return \"isForAllUsers\"\n }\n if (flagName === \"currentuser\") {\n return \"isForCurrentUser\"\n }\n return \"is\" + flagName[0].toUpperCase() + flagName.substring(1)\n}\n"]}
|
||||
{"version":3,"file":"nsisScriptGenerator.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisScriptGenerator.ts"],"names":[],"mappings":";;;AA+CA,4CASC;AAxDD,+CAAkC;AAElC,MAAa,mBAAmB;IAAhC;QACmB,UAAK,GAAkB,EAAE,CAAA;IA0C5C,CAAC;IAxCC,aAAa,CAAC,IAAY;QACxB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,IAAI,GAAG,CAAC,CAAA;IAC7C,CAAC;IAED,YAAY,CAAC,UAAkB,EAAE,GAAW;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,UAAU,KAAK,GAAG,GAAG,CAAC,CAAA;IAC1D,CAAC;IAED,OAAO,CAAC,IAAY;QAClB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,GAAG,CAAC,CAAA;IACvC,CAAC;IAED,KAAK,CAAC,IAAY,EAAE,KAA0C;QAC5D,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,CAAC,CAAA;IACpH,CAAC;IAED,IAAI,CAAC,UAAyB,EAAE,IAAY;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,UAAU,GAAG,KAAK,IAAI,GAAG,CAAC,CAAA;IACzF,CAAC;IAED,WAAW,CAAC,IAAY,EAAE,UAAkB;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,UAAU,EAAE,CAAC,CAAA;IACvD,CAAC;IAED,iBAAiB;IACjB,KAAK,CAAC,KAAoB;QACxB,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;YAC7B,MAAM,YAAY,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;YACpG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,YAAY;oCACT,QAAQ;;;UAGlC,YAAY,SAAS,YAAY;CAC1C,CAAC,CAAA;QACE,CAAC;IACH,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACrC,CAAC;CACF;AA3CD,kDA2CC;AAED,SAAgB,gBAAgB,CAAC,CAAS;IACxC,MAAM,OAAO,GAAG,CAAC;SACd,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,sCAAsC;SAClE,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,oFAAoF;SACjH,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA,CAAC,yCAAyC;IAClE,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAClB,kBAAG,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,kBAAkB,CAAC,CAAA;IAChE,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB;IACzC,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC5B,OAAO,eAAe,CAAA;IACxB,CAAC;IACD,IAAI,QAAQ,KAAK,aAAa,EAAE,CAAC;QAC/B,OAAO,kBAAkB,CAAA;IAC3B,CAAC;IACD,OAAO,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;AACjE,CAAC","sourcesContent":["import { log } from \"builder-util\"\n\nexport class NsisScriptGenerator {\n private readonly lines: Array<string> = []\n\n addIncludeDir(file: string) {\n this.lines.push(`!addincludedir \"${file}\"`)\n }\n\n addPluginDir(pluginArch: string, dir: string) {\n this.lines.push(`!addplugindir /${pluginArch} \"${dir}\"`)\n }\n\n include(file: string) {\n this.lines.push(`!include \"${file}\"`)\n }\n\n macro(name: string, lines: Array<string> | NsisScriptGenerator) {\n this.lines.push(`!macro ${name}`, ` ${(Array.isArray(lines) ? lines : lines.lines).join(\"\\n \")}`, `!macroend\\n`)\n }\n\n file(outputName: string | null, file: string) {\n this.lines.push(`File${outputName == null ? \"\" : ` \"/oname=${outputName}\"`} \"${file}\"`)\n }\n\n insertMacro(name: string, parameters: string) {\n this.lines.push(`!insertmacro ${name} ${parameters}`)\n }\n\n // without -- !!!\n flags(flags: Array<string>) {\n for (const flagName of flags) {\n const variableName = getVarNameForFlag(flagName).replace(/[-]+(\\w|$)/g, (m, p1) => p1.toUpperCase())\n this.lines.push(`!macro _${variableName} _a _b _t _f\n $\\{StdUtils.TestParameter} $R9 \"${flagName}\"\n StrCmp \"$R9\" \"true\" \\`$\\{_t}\\` \\`$\\{_f}\\`\n!macroend\n!define ${variableName} \\`\"\" ${variableName} \"\"\\`\n`)\n }\n }\n\n build() {\n return this.lines.join(\"\\n\") + \"\\n\"\n }\n}\n\nexport function nsisEscapeString(s: string): string {\n const escaped = s\n .replace(/\\r\\n|\\r|\\n/g, \" \") // newlines break NSIS string literals\n .replace(/\\$(?!\\{)/g, \"$$$$\") // bare $ → $$ (prevents NSIS variable expansion); ${...} references are left intact\n .replace(/\"/g, '$\\\\\"') // \" → $\\\" (NSIS escape for double-quote)\n if (escaped !== s) {\n log.debug({ original: s, final: escaped }, \"nsis was escaped\")\n }\n return escaped\n}\n\nfunction getVarNameForFlag(flagName: string): string {\n if (flagName === \"allusers\") {\n return \"isForAllUsers\"\n }\n if (flagName === \"currentuser\") {\n return \"isForCurrentUser\"\n }\n return \"is\" + flagName[0].toUpperCase() + flagName.substring(1)\n}\n"]}
|
||||
14
electron/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.d.ts
generated
vendored
14
electron/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.d.ts
generated
vendored
|
|
@ -1,21 +1,19 @@
|
|||
import { Arch } from "builder-util";
|
||||
import { PackageFileInfo } from "builder-util-runtime";
|
||||
import { NsisTarget } from "./NsisTarget";
|
||||
import { NsisOptions } from "./nsisOptions";
|
||||
export declare const nsisTemplatesDir: string;
|
||||
export declare const NsisTargetOptions: {
|
||||
then: (callback: (options: NsisOptions) => any) => Promise<string>;
|
||||
resolve: (options: NsisOptions) => any;
|
||||
};
|
||||
export declare const NSIS_PATH: () => Promise<string>;
|
||||
export interface PackArchResult {
|
||||
fileInfo: PackageFileInfo;
|
||||
unpackedSize: number;
|
||||
}
|
||||
export declare class AppPackageHelper {
|
||||
private readonly elevateHelper;
|
||||
private readonly archToFileInfo;
|
||||
private readonly archToResult;
|
||||
private readonly infoToIsDelete;
|
||||
/** @private */
|
||||
refCount: number;
|
||||
constructor(elevateHelper: CopyElevateHelper);
|
||||
packArch(arch: Arch, target: NsisTarget): Promise<PackageFileInfo>;
|
||||
packArch(arch: Arch, target: NsisTarget): Promise<PackArchResult>;
|
||||
finishBuild(): Promise<any>;
|
||||
}
|
||||
export declare class CopyElevateHelper {
|
||||
|
|
|
|||
69
electron/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.js
generated
vendored
69
electron/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.js
generated
vendored
|
|
@ -1,64 +1,43 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.UninstallerReader = exports.CopyElevateHelper = exports.AppPackageHelper = exports.NSIS_PATH = exports.NsisTargetOptions = exports.nsisTemplatesDir = void 0;
|
||||
exports.UninstallerReader = exports.CopyElevateHelper = exports.AppPackageHelper = exports.nsisTemplatesDir = void 0;
|
||||
const builder_util_1 = require("builder-util");
|
||||
const binDownload_1 = require("../../binDownload");
|
||||
const fs_1 = require("builder-util/out/fs");
|
||||
const path = require("path");
|
||||
const pathManager_1 = require("../../util/pathManager");
|
||||
const fs = require("fs/promises");
|
||||
const path = require("path");
|
||||
const zlib = require("zlib");
|
||||
exports.nsisTemplatesDir = pathManager_1.getTemplatePath("nsis");
|
||||
exports.NsisTargetOptions = (() => {
|
||||
let _resolve;
|
||||
const promise = new Promise(resolve => (_resolve = resolve));
|
||||
return {
|
||||
then: (callback) => promise.then(callback),
|
||||
resolve: (options) => _resolve(options),
|
||||
};
|
||||
})();
|
||||
const NSIS_PATH = () => {
|
||||
const custom = process.env.ELECTRON_BUILDER_NSIS_DIR;
|
||||
if (custom != null && custom.length > 0) {
|
||||
return Promise.resolve(custom.trim());
|
||||
}
|
||||
return exports.NsisTargetOptions.then((options) => {
|
||||
if (options.customNsisBinary) {
|
||||
const { checksum, url, version } = options.customNsisBinary;
|
||||
if (checksum && url) {
|
||||
const binaryVersion = version || checksum.substr(0, 8);
|
||||
return binDownload_1.getBinFromCustomLoc("nsis", binaryVersion, url, checksum);
|
||||
}
|
||||
}
|
||||
// Warning: Don't use v3.0.4.2 - https://github.com/electron-userland/electron-builder/issues/6334
|
||||
// noinspection SpellCheckingInspection
|
||||
return binDownload_1.getBinFromUrl("nsis", "3.0.4.1", "VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q==");
|
||||
});
|
||||
};
|
||||
exports.NSIS_PATH = NSIS_PATH;
|
||||
const windows_1 = require("../../toolsets/windows");
|
||||
const pathManager_1 = require("../../util/pathManager");
|
||||
exports.nsisTemplatesDir = (0, pathManager_1.getTemplatePath)("nsis");
|
||||
class AppPackageHelper {
|
||||
constructor(elevateHelper) {
|
||||
this.elevateHelper = elevateHelper;
|
||||
this.archToFileInfo = new Map();
|
||||
this.archToResult = new Map();
|
||||
this.infoToIsDelete = new Map();
|
||||
/** @private */
|
||||
this.refCount = 0;
|
||||
}
|
||||
async packArch(arch, target) {
|
||||
let infoPromise = this.archToFileInfo.get(arch);
|
||||
if (infoPromise == null) {
|
||||
let resultPromise = this.archToResult.get(arch);
|
||||
if (resultPromise == null) {
|
||||
const appOutDir = target.archs.get(arch);
|
||||
infoPromise = this.elevateHelper.copy(appOutDir, target).then(() => target.buildAppPackage(appOutDir, arch));
|
||||
this.archToFileInfo.set(arch, infoPromise);
|
||||
resultPromise = this.elevateHelper
|
||||
.copy(appOutDir, target)
|
||||
.then(() => target.buildAppPackage(appOutDir, arch))
|
||||
.then(async (fileInfo) => ({
|
||||
fileInfo,
|
||||
unpackedSize: await (0, builder_util_1.dirSize)(appOutDir),
|
||||
}));
|
||||
this.archToResult.set(arch, resultPromise);
|
||||
}
|
||||
const info = await infoPromise;
|
||||
const result = await resultPromise;
|
||||
const { fileInfo: info } = result;
|
||||
if (target.isWebInstaller) {
|
||||
this.infoToIsDelete.set(info, false);
|
||||
}
|
||||
else if (!this.infoToIsDelete.has(info)) {
|
||||
this.infoToIsDelete.set(info, true);
|
||||
}
|
||||
return info;
|
||||
return result;
|
||||
}
|
||||
async finishBuild() {
|
||||
if (--this.refCount > 0) {
|
||||
|
|
@ -79,6 +58,7 @@ class CopyElevateHelper {
|
|||
this.copied = new Map();
|
||||
}
|
||||
copy(appOutDir, target) {
|
||||
var _a;
|
||||
if (!target.packager.info.framework.isCopyElevateHelper) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
|
@ -94,11 +74,12 @@ class CopyElevateHelper {
|
|||
if (promise != null) {
|
||||
return promise;
|
||||
}
|
||||
promise = exports.NSIS_PATH().then(it => {
|
||||
promise = (0, windows_1.getNsisElevatePath)((_a = target.packager.config.toolsets) === null || _a === void 0 ? void 0 : _a.nsis, target.options.customNsisBinary).then(elevatePath => {
|
||||
const outFile = path.join(appOutDir, "resources", "elevate.exe");
|
||||
const promise = fs_1.copyFile(path.join(it, "elevate.exe"), outFile, false);
|
||||
if (target.packager.platformSpecificBuildOptions.signAndEditExecutable !== false) {
|
||||
return promise.then(() => target.packager.sign(outFile));
|
||||
const promise = (0, builder_util_1.copyFile)(elevatePath, outFile, false);
|
||||
const { signAndEditExecutable, signExecutable } = target.packager.platformSpecificBuildOptions;
|
||||
if (signAndEditExecutable !== false && signExecutable !== false) {
|
||||
return promise.then(() => target.packager.signIf(outFile));
|
||||
}
|
||||
return promise;
|
||||
});
|
||||
|
|
|
|||
2
electron/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.js.map
generated
vendored
2
electron/node_modules/app-builder-lib/out/targets/nsis/nsisUtil.js.map
generated
vendored
File diff suppressed because one or more lines are too long
18
electron/node_modules/app-builder-lib/out/targets/nsis/nsisValidation.d.ts
generated
vendored
Normal file
18
electron/node_modules/app-builder-lib/out/targets/nsis/nsisValidation.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import type { Defines } from "./Defines";
|
||||
/**
|
||||
* Validates makensis stdout/stderr after a zero-exit run.
|
||||
*
|
||||
* NSIS can emit "Error:" lines on stderr and still exit 0 (e.g. disk-full
|
||||
* scenarios where the OS silently drops writes). Also checks the
|
||||
* "Install data: <written> / <expected> bytes" progress line for truncation.
|
||||
*/
|
||||
export declare function checkMakensisOutput(stdout: string, stderr: string): void;
|
||||
/**
|
||||
* Verifies the generated installer is at least as large as the sum of the
|
||||
* embedded archive(s). An installer smaller than its payload is definitively
|
||||
* truncated regardless of the makensis exit code.
|
||||
*
|
||||
* Only runs when APP_64/APP_32/APP_ARM64 defines are present (i.e. normal,
|
||||
* non-portable installers). Skipped for the intermediate uninstaller build.
|
||||
*/
|
||||
export declare function verifyInstallerSize(outFile: string, defines: Defines): Promise<void>;
|
||||
53
electron/node_modules/app-builder-lib/out/targets/nsis/nsisValidation.js
generated
vendored
Normal file
53
electron/node_modules/app-builder-lib/out/targets/nsis/nsisValidation.js
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.checkMakensisOutput = checkMakensisOutput;
|
||||
exports.verifyInstallerSize = verifyInstallerSize;
|
||||
const builder_util_1 = require("builder-util");
|
||||
/**
|
||||
* Validates makensis stdout/stderr after a zero-exit run.
|
||||
*
|
||||
* NSIS can emit "Error:" lines on stderr and still exit 0 (e.g. disk-full
|
||||
* scenarios where the OS silently drops writes). Also checks the
|
||||
* "Install data: <written> / <expected> bytes" progress line for truncation.
|
||||
*/
|
||||
function checkMakensisOutput(stdout, stderr) {
|
||||
const errorLines = stderr
|
||||
.split("\n")
|
||||
.map(l => l.trim())
|
||||
.filter(l => /^Error:/i.test(l));
|
||||
if (errorLines.length > 0) {
|
||||
throw new builder_util_1.ExecError("makensis", 0, stdout, stderr);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Verifies the generated installer is at least as large as the sum of the
|
||||
* embedded archive(s). An installer smaller than its payload is definitively
|
||||
* truncated regardless of the makensis exit code.
|
||||
*
|
||||
* Only runs when APP_64/APP_32/APP_ARM64 defines are present (i.e. normal,
|
||||
* non-portable installers). Skipped for the intermediate uninstaller build.
|
||||
*/
|
||||
async function verifyInstallerSize(outFile, defines) {
|
||||
let archiveSize = 0;
|
||||
for (const key of ["APP_64", "APP_32", "APP_ARM64"]) {
|
||||
const p = defines[key];
|
||||
if (typeof p === "string") {
|
||||
const s = await (0, builder_util_1.statOrNull)(p);
|
||||
if (s != null) {
|
||||
archiveSize += s.size;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (archiveSize === 0) {
|
||||
return;
|
||||
}
|
||||
const outStat = await (0, builder_util_1.statOrNull)(outFile);
|
||||
if (outStat == null) {
|
||||
throw new Error(`Generated installer was not created at "${outFile}" — output may be incomplete. Check available disk space and try again.`);
|
||||
}
|
||||
if (outStat.size < archiveSize) {
|
||||
throw new Error(`Generated installer (${outStat.size} bytes) is smaller than the embedded archive(s) (${archiveSize} bytes) — ` +
|
||||
`output may be incomplete. Check available disk space and try again.`);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=nsisValidation.js.map
|
||||
1
electron/node_modules/app-builder-lib/out/targets/nsis/nsisValidation.js.map
generated
vendored
Normal file
1
electron/node_modules/app-builder-lib/out/targets/nsis/nsisValidation.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"nsisValidation.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisValidation.ts"],"names":[],"mappings":";;AAUA,kDASC;AAUD,kDA0BC;AAvDD,+CAAoD;AAGpD;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAC,MAAc,EAAE,MAAc;IAChE,MAAM,UAAU,GAAG,MAAM;SACtB,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SAClB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;IAElC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,wBAAS,CAAC,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACpD,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CAAC,OAAe,EAAE,OAAgB;IACzE,IAAI,WAAW,GAAG,CAAC,CAAA;IACnB,KAAK,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAU,EAAE,CAAC;QAC7D,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QACtB,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC1B,MAAM,CAAC,GAAG,MAAM,IAAA,yBAAU,EAAC,CAAC,CAAC,CAAA;YAC7B,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;gBACd,WAAW,IAAI,CAAC,CAAC,IAAI,CAAA;YACvB,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,WAAW,KAAK,CAAC,EAAE,CAAC;QACtB,OAAM;IACR,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,IAAA,yBAAU,EAAC,OAAO,CAAC,CAAA;IACzC,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,2CAA2C,OAAO,yEAAyE,CAAC,CAAA;IAC9I,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,GAAG,WAAW,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,wBAAwB,OAAO,CAAC,IAAI,oDAAoD,WAAW,YAAY;YAC7G,qEAAqE,CACxE,CAAA;IACH,CAAC;AACH,CAAC","sourcesContent":["import { ExecError, statOrNull } from \"builder-util\"\nimport type { Defines } from \"./Defines\"\n\n/**\n * Validates makensis stdout/stderr after a zero-exit run.\n *\n * NSIS can emit \"Error:\" lines on stderr and still exit 0 (e.g. disk-full\n * scenarios where the OS silently drops writes). Also checks the\n * \"Install data: <written> / <expected> bytes\" progress line for truncation.\n */\nexport function checkMakensisOutput(stdout: string, stderr: string): void {\n const errorLines = stderr\n .split(\"\\n\")\n .map(l => l.trim())\n .filter(l => /^Error:/i.test(l))\n\n if (errorLines.length > 0) {\n throw new ExecError(\"makensis\", 0, stdout, stderr)\n }\n}\n\n/**\n * Verifies the generated installer is at least as large as the sum of the\n * embedded archive(s). An installer smaller than its payload is definitively\n * truncated regardless of the makensis exit code.\n *\n * Only runs when APP_64/APP_32/APP_ARM64 defines are present (i.e. normal,\n * non-portable installers). Skipped for the intermediate uninstaller build.\n */\nexport async function verifyInstallerSize(outFile: string, defines: Defines): Promise<void> {\n let archiveSize = 0\n for (const key of [\"APP_64\", \"APP_32\", \"APP_ARM64\"] as const) {\n const p = defines[key]\n if (typeof p === \"string\") {\n const s = await statOrNull(p)\n if (s != null) {\n archiveSize += s.size\n }\n }\n }\n\n if (archiveSize === 0) {\n return\n }\n\n const outStat = await statOrNull(outFile)\n if (outStat == null) {\n throw new Error(`Generated installer was not created at \"${outFile}\" — output may be incomplete. Check available disk space and try again.`)\n }\n if (outStat.size < archiveSize) {\n throw new Error(\n `Generated installer (${outStat.size} bytes) is smaller than the embedded archive(s) (${archiveSize} bytes) — ` +\n `output may be incomplete. Check available disk space and try again.`\n )\n }\n}\n"]}
|
||||
Loading…
Add table
Add a link
Reference in a new issue