app-builder-lib 26.14.0 → 26.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/configuration.d.ts +11 -0
- package/out/configuration.js.map +1 -1
- package/out/electron/ElectronFramework.js +1 -5
- package/out/electron/ElectronFramework.js.map +1 -1
- package/out/frameworks/LibUiFramework.d.ts +25 -0
- package/out/frameworks/LibUiFramework.js +107 -19
- package/out/frameworks/LibUiFramework.js.map +1 -1
- package/out/mac/MacTargetHelper.d.ts +7 -2
- package/out/mac/MacTargetHelper.js +13 -10
- package/out/mac/MacTargetHelper.js.map +1 -1
- package/out/macPackager.js +2 -3
- package/out/macPackager.js.map +1 -1
- package/out/node-module-collector/nodeModulesCollector.d.ts +17 -8
- package/out/node-module-collector/nodeModulesCollector.js +86 -60
- package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/out/options/linuxOptions.d.ts +10 -0
- package/out/options/linuxOptions.js.map +1 -1
- package/out/options/macOptions.d.ts +12 -2
- package/out/options/macOptions.js.map +1 -1
- package/out/packager.d.ts +0 -4
- package/out/packager.js +0 -19
- package/out/packager.js.map +1 -1
- package/out/targets/FpmTarget.js +6 -5
- package/out/targets/FpmTarget.js.map +1 -1
- package/out/targets/LinuxTargetHelper.d.ts +1 -0
- package/out/targets/LinuxTargetHelper.js +23 -0
- package/out/targets/LinuxTargetHelper.js.map +1 -1
- package/out/targets/MsiTarget.js +2 -1
- package/out/targets/MsiTarget.js.map +1 -1
- package/out/targets/appimage/AppImageTarget.js +6 -1
- package/out/targets/appimage/AppImageTarget.js.map +1 -1
- package/out/targets/appimage/appImageUtil.d.ts +2 -0
- package/out/targets/appimage/appImageUtil.js +2 -2
- package/out/targets/appimage/appImageUtil.js.map +1 -1
- package/out/targets/archive.d.ts +0 -1
- package/out/targets/archive.js +60 -88
- package/out/targets/archive.js.map +1 -1
- package/out/targets/blockmap/blockmap.js +8 -4
- package/out/targets/blockmap/blockmap.js.map +1 -1
- package/out/targets/nsis/NsisTarget.js +6 -12
- package/out/targets/nsis/NsisTarget.js.map +1 -1
- package/out/targets/pkg.d.ts +13 -0
- package/out/targets/pkg.js +34 -9
- package/out/targets/pkg.js.map +1 -1
- package/out/targets/snap/core24.js +4 -3
- package/out/targets/snap/core24.js.map +1 -1
- package/out/targets/snap/coreLegacy.d.ts +23 -0
- package/out/targets/snap/coreLegacy.js +161 -23
- package/out/targets/snap/coreLegacy.js.map +1 -1
- package/out/toolsets/7zip.d.ts +2 -0
- package/out/toolsets/7zip.js +72 -0
- package/out/toolsets/7zip.js.map +1 -0
- package/out/toolsets/wine.d.ts +5 -0
- package/out/toolsets/wine.js +100 -0
- package/out/toolsets/wine.js.map +1 -0
- package/out/util/electronGet.js +36 -5
- package/out/util/electronGet.js.map +1 -1
- package/out/util/packageDependencies.d.ts +0 -6
- package/out/util/packageDependencies.js +0 -17
- package/out/util/packageDependencies.js.map +1 -1
- package/out/util/yarn.d.ts +0 -3
- package/out/util/yarn.js +3 -15
- package/out/util/yarn.js.map +1 -1
- package/out/version.d.ts +1 -1
- package/out/version.js +1 -1
- package/out/version.js.map +1 -1
- package/out/vm/WineVm.d.ts +5 -2
- package/out/vm/WineVm.js +19 -5
- package/out/vm/WineVm.js.map +1 -1
- package/out/vm/vm.js.map +1 -1
- package/package.json +9 -9
- package/scheme.json +25 -4
- package/templates/snap/desktop-common.sh +444 -0
- package/templates/snap/desktop-gnome-specific.sh +31 -0
- package/templates/snap/desktop-init.sh +52 -0
- package/out/util/appBuilder.d.ts +0 -4
- package/out/util/appBuilder.js +0 -36
- package/out/util/appBuilder.js.map +0 -1
- package/out/wine.d.ts +0 -5
- package/out/wine.js +0 -31
- package/out/wine.js.map +0 -1
package/out/configuration.d.ts
CHANGED
|
@@ -345,6 +345,17 @@ export interface ToolsetConfig {
|
|
|
345
345
|
* @default "0.0.0"
|
|
346
346
|
*/
|
|
347
347
|
readonly nsis?: "0.0.0" | "1.2.1" | null;
|
|
348
|
+
/**
|
|
349
|
+
* `wine` bundle version to use for running Windows tools on non-Windows platforms.
|
|
350
|
+
* Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=wine&expanded=true
|
|
351
|
+
* 0.0.0 - legacy toolset (wine 4.0.1 portable; mac-only support)
|
|
352
|
+
*
|
|
353
|
+
* Beta:
|
|
354
|
+
* 1.0.1 - Wine 11 bundle (unified wine binary, ia32 via WoW64)
|
|
355
|
+
*
|
|
356
|
+
* @default "0.0.0"
|
|
357
|
+
*/
|
|
358
|
+
readonly wine?: "0.0.0" | "1.0.1" | null;
|
|
348
359
|
}
|
|
349
360
|
export interface Hooks {
|
|
350
361
|
/**
|
package/out/configuration.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":"","sourcesContent":["import { Arch } from \"builder-util\"\nimport { BeforeBuildContext, Target } from \"./core\"\nimport { ElectronBrandingOptions } from \"./electron/ElectronFramework\"\nimport { PrepareApplicationStageDirectoryOptions } from \"./Framework\"\nimport { AppXOptions } from \"./options/AppXOptions\"\nimport { AppImageOptions, DebOptions, FlatpakOptions, LinuxConfiguration, LinuxTargetSpecificOptions, PacmanOptions, RpmOptions } from \"./options/linuxOptions\"\nimport { DmgOptions, MacConfiguration, MasConfiguration } from \"./options/macOptions\"\nimport { MsiOptions } from \"./options/MsiOptions\"\nimport { MsiWrappedOptions } from \"./options/MsiWrappedOptions\"\nimport { PkgOptions } from \"./options/pkgOptions\"\nimport { PlatformSpecificBuildOptions } from \"./options/PlatformSpecificBuildOptions\"\nimport { SnapcraftOptions, SnapOptions } from \"./options/SnapOptions\"\nimport { SquirrelWindowsOptions } from \"./options/SquirrelWindowsOptions\"\nimport { WindowsConfiguration } from \"./options/winOptions\"\nimport { BuildResult } from \"./packager\"\nimport { ArtifactBuildStarted, ArtifactCreated } from \"./packagerApi\"\nimport { PlatformPackager } from \"./platformPackager\"\nimport { NsisOptions, NsisWebOptions, PortableOptions } from \"./targets/nsis/nsisOptions\"\nimport { ElectronDownloadOptions, ElectronGetOptions } from \"./util/electronGet\"\n\n// duplicate appId here because it is important\n/**\n * Configuration Options\n */\nexport interface CommonConfiguration {\n /**\n * The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n * [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.\n * @default com.electron.${name}\n */\n readonly appId?: string | null\n\n /**\n * As [name](#metadata), but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the [name property](https://docs.npmjs.com/files/package.json#name).\n * If not specified inside of the `build` configuration, `productName` property defined at the top level of `package.json` is used. If not specified at the top level of `package.json`, [name property](https://docs.npmjs.com/files/package.json#name) is used.\n */\n readonly productName?: string | null\n\n /**\n * The human-readable copyright line for the app.\n * @default Copyright © year ${author}\n */\n readonly copyright?: string | null\n\n /**\n * Directories for build resources\n */\n readonly directories?: MetadataDirectories | null\n\n /**\n * Configuration of toolsets utilized by electron-builder\n */\n readonly toolsets?: ToolsetConfig | null\n\n /**\n * Options related to how build macOS targets.\n */\n readonly mac?: MacConfiguration | null\n /**\n * MAS (Mac Application Store) options.\n */\n readonly mas?: MasConfiguration | null\n /**\n * MAS (Mac Application Store) development options (`mas-dev` target).\n */\n readonly masDev?: MasConfiguration | null\n /**\n * macOS DMG options.\n */\n readonly dmg?: DmgOptions | null\n /**\n * macOS PKG options.\n */\n readonly pkg?: PkgOptions | null\n\n /**\n * Options related to how build Windows targets.\n */\n readonly win?: WindowsConfiguration | null\n /** NSIS installer options. */\n readonly nsis?: NsisOptions | null\n /** NSIS web installer options (downloads app package at install time). */\n readonly nsisWeb?: NsisWebOptions | null\n /** Portable executable options (no installation required). */\n readonly portable?: PortableOptions | null\n /** Windows Store (AppX) package options. */\n readonly appx?: AppXOptions | null\n /**\n * MSI package options.\n */\n readonly msi?: MsiOptions | null\n /**\n * MSI-wrapped installer options.\n */\n readonly msiWrapped?: MsiWrappedOptions | null\n /**\n * Squirrel.Windows installer options. Requires the `electron-builder-squirrel-windows` dependency.\n */\n readonly squirrelWindows?: SquirrelWindowsOptions | null\n /**\n * General Linux build options shared across all Linux targets (icon, category, desktop entry,\n * executable name, etc.). Target-specific compression and packaging options live in the\n * per-format interfaces (`DebOptions`, `RpmOptions`, `PacmanOptions`, etc.).\n */\n readonly linux?: LinuxConfiguration | null\n /**\n * Debian package options. Targets Debian, Ubuntu, and Debian-based distributions.\n * Produces a `.deb` archive installable via `dpkg -i` or `apt install`.\n */\n readonly deb?: DebOptions | null\n /**\n * Flat snap configuration targeting core22 and older snap bases.\n *\n * @deprecated Use `snapcraft` instead — it supersedes `snap` when both are present and supports\n * all snap bases including core24. `snap` will be removed in a future major release.\n * See {@link SnapOptions} for available properties.\n */\n readonly snap?: SnapOptions | null\n /**\n * Snapcraft configuration. Prefer this over the deprecated `snap` field.\n *\n * Selects the snapcraft base and provides per-core options:\n * - `base: \"core18\" | \"core20\" | \"core22\"` — legacy builds; accepts the same options as `snap`\n * - `base: \"core24\"` — modern builds with the GNOME extension (recommended for new apps, requires Electron 25+)\n * - `base: \"custom\"` — pass an existing `snapcraft.yaml` through unchanged; no plugs, extensions,\n * or desktop files are injected\n *\n * When both `snapcraft` and `snap` are set, `snapcraft` takes precedence.\n *\n * @example\n * ```json\n * { \"snapcraft\": { \"base\": \"core24\", \"core24\": { \"useLXD\": true } } }\n * ```\n *\n * See {@link SnapcraftOptions} for all available properties.\n */\n readonly snapcraft?: SnapcraftOptions | null\n /**\n * AppImage options. AppImage is a portable application format that bundles the app\n * and its dependencies into a single self-contained executable that runs on most\n * Linux distributions without installation.\n */\n readonly appImage?: AppImageOptions | null\n /**\n * Flatpak options. Flatpak is a sandboxed application distribution format for Linux\n * that runs in a controlled environment and is distributed via [Flathub](https://flathub.org/)\n * or other Flatpak repositories.\n */\n readonly flatpak?: FlatpakOptions | null\n /**\n * Pacman package options. Targets Arch Linux and Arch-based distributions\n * (Manjaro, EndeavourOS, etc.). Produces a `.pacman` archive installable via `pacman -U`.\n */\n readonly pacman?: PacmanOptions | null\n /**\n * RPM package options. Targets Fedora, Red Hat Enterprise Linux, SUSE, and related\n * distributions. Produces a `.rpm` archive installable via `rpm` or `dnf`.\n */\n readonly rpm?: RpmOptions | null\n /**\n * FreeBSD package options. Produces a `.pkg` archive for the FreeBSD `pkg` package manager.\n */\n readonly freebsd?: LinuxTargetSpecificOptions | null\n /**\n * Solaris IPS package options. Produces a `.p5p` archive for the Solaris Image Packaging\n * System (`pkg`).\n */\n readonly p5p?: LinuxTargetSpecificOptions | null\n /**\n * Alpine Linux APK package options. Produces an `.apk` archive installable via `apk add`.\n */\n readonly apk?: LinuxTargetSpecificOptions | null\n\n /**\n * Whether to build the application native dependencies from source.\n * @default false\n */\n buildDependenciesFromSource?: boolean\n /**\n * Whether to execute `node-gyp rebuild` before starting to package the app.\n *\n * Don't [use](https://github.com/electron-userland/electron-builder/issues/683#issuecomment-241214075) [npm](http://electron.atom.io/docs/tutorial/using-native-node-modules/#using-npm) (neither `.npmrc`) for configuring electron headers. Use `electron-builder node-gyp-rebuild` instead.\n * @default false\n */\n readonly nodeGypRebuild?: boolean\n /**\n * Additional command line arguments to use when installing app native deps.\n */\n readonly npmArgs?: Array<string> | string | null\n /**\n * Whether to [rebuild](https://docs.npmjs.com/cli/rebuild) native dependencies before starting to package the app.\n * @default true\n */\n readonly npmRebuild?: boolean\n /**\n * Use `legacy` app-builder binary for installing native dependencies, or `@electron/rebuild` in `sequential` or `parallel` compilation modes.\n * @default sequential\n */\n readonly nativeRebuilder?: \"legacy\" | \"sequential\" | \"parallel\" | null\n\n /**\n * The build number. Maps to the `--iteration` flag for builds using FPM on Linux.\n * If not defined, then it will fallback to `BUILD_NUMBER` or `TRAVIS_BUILD_NUMBER` or `APPVEYOR_BUILD_NUMBER` or `CIRCLE_BUILD_NUM` or `BUILD_BUILDNUMBER` or `CI_PIPELINE_IID` env.\n */\n readonly buildNumber?: string | null\n\n /**\n * The build version. Maps to the `CFBundleVersion` on macOS, and `FileVersion` metadata property on Windows. Defaults to the `version`.\n * If `buildVersion` is not defined and `buildNumber` (or one of the `buildNumber` envs) is defined, it will be used as a build version (`version.buildNumber`).\n */\n readonly buildVersion?: string | null\n\n /**\n * Whether to download the alternate FFmpeg library from Electron's release assets and replace the default FFmpeg library prior to signing\n */\n readonly downloadAlternateFFmpeg?: boolean\n\n /**\n * Inject properties to `package.json`.\n */\n readonly extraMetadata?: any\n\n /**\n * Whether to fail if the application is not signed (to prevent unsigned app if code signing configuration is not correct).\n * @default false\n */\n readonly forceCodeSigning?: boolean\n\n /**\n * Whether to include PDB files.\n * @default false\n */\n readonly includePdb?: boolean\n\n /**\n * Whether to remove `scripts` field from `package.json` files.\n *\n * @default true\n */\n readonly removePackageScripts?: boolean\n\n /**\n * Whether to remove `keywords` field from `package.json` files.\n *\n * @default true\n */\n readonly removePackageKeywords?: boolean\n\n /**\n * Options to pass to `@electron/fuses`\n * Ref: https://github.com/electron/fuses\n */\n readonly electronFuses?: FuseOptionsV1 | null\n\n /**\n * [Experimental] Configuration for concurrent builds.\n */\n readonly concurrency?: Concurrency | null\n}\n\nexport interface Configuration extends CommonConfiguration, PlatformSpecificBuildOptions, Hooks {\n /**\n * Whether to use [electron-compile](http://github.com/electron/electron-compile) to compile app. Defaults to `true` if `electron-compile` in the dependencies. And `false` if in the `devDependencies` or doesn't specified.\n * @deprecated `electron-compile` is no longer maintained. Compile your app with a modern bundler (webpack, vite, etc.) instead.\n */\n readonly electronCompile?: boolean\n\n /**\n * The [electron-download](https://github.com/electron-userland/electron-download#usage) options. (legacy)\n * Alternatively, you can use [electron/get](https://github.com/electron/get#usage) options.\n */\n readonly electronDownload?: ElectronDownloadOptions | ElectronGetOptions | null\n\n /**\n * The branding used by Electron's distributables. This is needed if a fork has modified Electron's BRANDING.json file.\n */\n readonly electronBranding?: ElectronBrandingOptions\n\n /**\n * The version of electron you are packaging for. Defaults to version of `electron`, `electron-prebuilt` or `electron-prebuilt-compile` dependency.\n */\n electronVersion?: string | null\n\n /**\n * The name of a built-in configuration preset (currently, only `react-cra` is supported) or any number of paths to config files (relative to project dir).\n *\n * The latter allows to mixin a config from multiple other configs, as if you `Object.assign` them, but properly combine `files` glob patterns.\n *\n * If `react-scripts` in the app dependencies, `react-cra` will be set automatically. Set to `null` to disable automatic detection.\n */\n extends?: Array<string> | string | null\n\n /**\n * *libui-based frameworks only* The version of NodeJS you are packaging for.\n * You can set it to `current` to set the Node.js version that you use to run.\n * @deprecated libui-based frameworks (proton-native, etc.) are no longer actively maintained. This option has no effect when using Electron.\n */\n readonly nodeVersion?: string | null\n\n /**\n * *libui-based frameworks only* The version of LaunchUI you are packaging for. Applicable for Windows only. Defaults to version suitable for used framework version.\n * @deprecated libui-based frameworks (proton-native, etc.) are no longer actively maintained. This option has no effect when using Electron.\n */\n readonly launchUiVersion?: boolean | string | null\n\n /**\n * The framework name. One of `electron`, `proton`, `libui`. Defaults to `electron`.\n * @deprecated `proton` and `libui` framework support is no longer actively maintained. Use `electron` (the default).\n */\n readonly framework?: string | null\n\n /**\n * Whether to disable sanity check asar package (useful for custom electron forks that implement their own encrypted integrity validation)\n * @default false\n */\n readonly disableSanityCheckAsar?: boolean\n\n /**\n * Whether to skip ASAR integrity hash computation. Useful for custom electron forks with encrypted ASAR support where the header is not readable by standard tools.\n * @default false\n */\n readonly disableAsarIntegrity?: boolean\n}\n\nexport type Hook<T, V> = (contextOrPath: T) => Promise<V> | V\n\nexport interface PackContext {\n readonly outDir: string\n readonly appOutDir: string\n readonly packager: PlatformPackager<any>\n readonly electronPlatformName: string\n readonly arch: Arch\n readonly targets: Array<Target>\n}\nexport type AfterPackContext = PackContext\nexport type BeforePackContext = PackContext\nexport type AfterExtractContext = PackContext\n\n/**\n * Configuration of toolsets utilized by electron-builder\n */\nexport interface ToolsetConfig {\n /**\n * `win-codesign` version to use for signing Windows artifacts.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=win-codesign&expanded=true\n *\n * Stable:\n * v0.0.0 (winCodeSign)\n *\n * Beta:\n * Windows Kits 10.0.26100.0\n * v1.0.0, v1.1.0\n *\n * @default \"0.0.0\"\n */\n readonly winCodeSign?: \"0.0.0\" | \"1.0.0\" | \"1.1.0\" | null\n\n /**\n * `appimage` bundle version to use for Appimage packaging and runtime.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=appimage&expanded=true\n * 0.0.0 - legacy toolset (appimage)\n *\n * Betas:\n * 1.0.2 - Runtime 20251108\n * 1.0.3 - Runtime 20251108 (Resolves GH issue #9598)\n *\n * @default \"0.0.0\"\n */\n readonly appimage?: \"0.0.0\" | \"1.0.2\" | \"1.0.3\" | null\n\n /**\n * `nsis` bundle version to use for NSIS installer compilation.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=nsis&expanded=true\n * 0.0.0 - legacy toolset (nsis-3.0.4.1 + nsis-resources-3.4.1)\n *\n * Betas:\n * 1.2.1 - unified bundle (makensis 3.12 + plugins in one archive, entrypoint scripts auto-set NSISDIR)\n *\n * @default \"0.0.0\"\n */\n readonly nsis?: \"0.0.0\" | \"1.2.1\" | null\n}\n\nexport interface Hooks {\n /**\n * The function (or path to file or module id) to be run before pack.\n * Receives a {@link BeforePackContext}.\n *\n * Can be specified inline as a function in JavaScript configs:\n * ```js\n * // electron-builder.config.js\n * module.exports = {\n * beforePack: async (context) => {\n * // your code\n * }\n * }\n * ```\n *\n * Or as a path to a module that exports the function as its default export:\n * ```json\n * { \"build\": { \"beforePack\": \"./myBeforePackHook.js\" } }\n * ```\n * ```js\n * // myBeforePackHook.js\n * exports.default = async function(context) {\n * // your custom code\n * }\n * ```\n */\n readonly beforePack?: Hook<BeforePackContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run after the prebuilt Electron binary has been extracted to the output directory.\n * Receives an {@link AfterExtractContext}. For file/module setup, see {@link beforePack}.\n */\n readonly afterExtract?: Hook<AfterExtractContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run after pack but before pack into distributable format and sign.\n * Receives an {@link AfterPackContext}. For file/module setup, see {@link beforePack}.\n */\n readonly afterPack?: Hook<AfterPackContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run after pack and sign but before pack into distributable format.\n * Receives an {@link AfterPackContext}. For file/module setup, see {@link beforePack}.\n */\n readonly afterSign?: Hook<AfterPackContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run when an individual artifact build starts.\n * Receives an {@link ArtifactBuildStarted}. For file/module setup, see {@link beforePack}.\n */\n readonly artifactBuildStarted?: Hook<ArtifactBuildStarted, void> | string | null\n /**\n * The function (or path to file or module id) to be run when an individual artifact build completes.\n * Receives an {@link ArtifactCreated}. For file/module setup, see {@link beforePack}.\n */\n readonly artifactBuildCompleted?: Hook<ArtifactCreated, void> | string | null\n /**\n * The function (or path to file or module id) to be run after all artifacts are built.\n * Receives a {@link BuildResult}. May return an array of additional file paths to publish.\n *\n * For file/module setup, see {@link beforePack}.\n *\n * @example\n * ```js\n * exports.default = function () {\n * // return additional files to publish\n * return [\"/path/to/additional/result/file\"]\n * }\n * ```\n */\n readonly afterAllArtifactBuild?: Hook<BuildResult, Array<string>> | string | null\n /**\n * The function (or path to file or module id) to be run after MSI project created on disk - not packed into .msi package yet.\n */\n readonly msiProjectCreated?: Hook<string, void> | string | null\n /**\n * The function (or path to file or module id) to be run after Appx manifest created on disk - not packed into .appx package yet.\n */\n readonly appxManifestCreated?: Hook<string, void> | string | null\n /**\n * The function (or path to file or module id) to be [run on each node module](#onnodemodulefile) file. Returning `true`/`false` will determine whether to force include or to use the default copier logic\n */\n readonly onNodeModuleFile?: Hook<string, void | boolean> | string | null\n /**\n * The function (or path to file or module id) to be run before dependencies are installed or rebuilt. Works when `npmRebuild` is set to `true`. Resolving to `false` will skip dependencies install or rebuild.\n *\n * If provided and `node_modules` are missing, it will not invoke production dependencies check.\n */\n readonly beforeBuild?: Hook<BeforeBuildContext, boolean | void> | string | null\n /**\n * The function (or path to file or module id) to be run when staging the electron artifact environment.\n * Returns the path to custom Electron build (e.g. `~/electron/out/R`) or folder of electron zips.\n *\n * Zip files must follow the pattern `electron-v${version}-${platformName}-${arch}.zip`, otherwise it will be assumed to be an unpacked Electron app directory\n */\n readonly electronDist?: Hook<PrepareApplicationStageDirectoryOptions, string> | string | null\n}\n\nexport interface MetadataDirectories {\n /**\n * The path to build resources.\n *\n * Please note — build resources are not packed into the app. If you need to use some files, e.g. as tray icon, please include required files explicitly: `\"files\": [\"**\\/*\", \"build/icon.*\"]`\n * @default build\n */\n readonly buildResources?: string | null\n\n /**\n * The output directory. [File macros](https://www.electron.build/file-patterns#file-macros) are supported.\n * @default dist\n */\n readonly output?: string | null\n\n /**\n * The application directory (containing the application package.json), defaults to `app`, `www` or working directory.\n */\n readonly app?: string | null\n}\n\n/**\n * All options come from [@electron/fuses](https://github.com/electron/fuses)\n * Ref: https://raw.githubusercontent.com/electron/electron/refs/heads/main/docs/tutorial/fuses.md\n */\nexport interface FuseOptionsV1 {\n /**\n *The runAsNode fuse toggles whether the `ELECTRON_RUN_AS_NODE` environment variable is respected or not. Please note that if this fuse is disabled then `process.fork` in the main process will not function as expected as it depends on this environment variable to function. Instead, we recommend that you use [Utility Processes](https://github.com/electron/electron/blob/main/docs/api/utility-process.md), which work for many use cases where you need a standalone Node.js process (like a Sqlite server process or similar scenarios).\n */\n runAsNode?: boolean\n /**\n * The cookieEncryption fuse toggles whether the cookie store on disk is encrypted using OS level cryptography keys. By default the sqlite database that Chromium uses to store cookies stores the values in plaintext. If you wish to ensure your apps cookies are encrypted in the same way Chrome does then you should enable this fuse. Please note it is a one-way transition, if you enable this fuse existing unencrypted cookies will be encrypted-on-write but if you then disable the fuse again your cookie store will effectively be corrupt and useless. Most apps can safely enable this fuse.\n */\n enableCookieEncryption?: boolean\n /**\n * The nodeOptions fuse toggles whether the [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#node_optionsoptions) and [`NODE_EXTRA_CA_CERTS`](https://github.com/nodejs/node/blob/main/doc/api/cli.md#node_extra_ca_certsfile) environment variables are respected. The `NODE_OPTIONS` environment variable can be used to pass all kinds of custom options to the Node.js runtime and isn't typically used by apps in production. Most apps can safely disable this fuse.\n */\n enableNodeOptionsEnvironmentVariable?: boolean\n /**\n * The nodeCliInspect fuse toggles whether the `--inspect`, `--inspect-brk`, etc. flags are respected or not. When disabled it also ensures that `SIGUSR1` signal does not initialize the main process inspector. Most apps can safely disable this fuse.\n */\n enableNodeCliInspectArguments?: boolean\n /**\n * The embeddedAsarIntegrityValidation fuse toggles an experimental feature on macOS that validates the content of the `app.asar` file when it is loaded. This feature is designed to have a minimal performance impact but may marginally slow down file reads from inside the `app.asar` archive.\n * Currently, ASAR integrity checking is supported on:\n *\n * - macOS as of electron>=16.0.0\n * - Windows as of electron>=30.0.0\n *\n * For more information on how to use asar integrity validation please read the [Asar Integrity](https://github.com/electron/electron/blob/main/docs/tutorial/asar-integrity.md) documentation.\n */\n enableEmbeddedAsarIntegrityValidation?: boolean\n /**\n * The onlyLoadAppFromAsar fuse changes the search system that Electron uses to locate your app code. By default Electron will search in the following order `app.asar` -> `app` -> `default_app.asar`. When this fuse is enabled the search order becomes a single entry `app.asar` thus ensuring that when combined with the `embeddedAsarIntegrityValidation` fuse it is impossible to load non-validated code.\n */\n onlyLoadAppFromAsar?: boolean\n /**\n * The loadBrowserProcessSpecificV8Snapshot fuse changes which V8 snapshot file is used for the browser process. By default Electron's processes will all use the same V8 snapshot file. When this fuse is enabled the browser process uses the file called `browser_v8_context_snapshot.bin` for its V8 snapshot. The other processes will use the V8 snapshot file that they normally do.\n */\n loadBrowserProcessSpecificV8Snapshot?: boolean\n /**\n * The grantFileProtocolExtraPrivileges fuse changes whether pages loaded from the `file://` protocol are given privileges beyond what they would receive in a traditional web browser. This behavior was core to Electron apps in original versions of Electron but is no longer required as apps should be [serving local files from custom protocols](https://github.com/electron/electron/blob/main/docs/tutorial/security.md#18-avoid-usage-of-the-file-protocol-and-prefer-usage-of-custom-protocols) now instead. If you aren't serving pages from `file://` you should disable this fuse.\n * The extra privileges granted to the `file://` protocol by this fuse are incompletely documented below:\n *\n * - `file://` protocol pages can use `fetch` to load other assets over `file://`\n * - `file://` protocol pages can use service workers\n * - `file://` protocol pages have universal access granted to child frames also running on `file://` protocols regardless of sandbox settings\n */\n grantFileProtocolExtraPrivileges?: boolean\n /**\n * Resets the app signature, specifically used for macOS.\n * Note: This should be unneeded since electron-builder signs the app directly after flipping the fuses.\n * Ref: https://github.com/electron/fuses?tab=readme-ov-file#apple-silicon\n */\n resetAdHocDarwinSignature?: boolean\n}\n\nexport interface Concurrency {\n /**\n * The maximum number of concurrent jobs to run.\n * @default 1\n */\n jobs: number\n}\n"]}
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":"","sourcesContent":["import { Arch } from \"builder-util\"\nimport { BeforeBuildContext, Target } from \"./core\"\nimport { ElectronBrandingOptions } from \"./electron/ElectronFramework\"\nimport { PrepareApplicationStageDirectoryOptions } from \"./Framework\"\nimport { AppXOptions } from \"./options/AppXOptions\"\nimport { AppImageOptions, DebOptions, FlatpakOptions, LinuxConfiguration, LinuxTargetSpecificOptions, PacmanOptions, RpmOptions } from \"./options/linuxOptions\"\nimport { DmgOptions, MacConfiguration, MasConfiguration } from \"./options/macOptions\"\nimport { MsiOptions } from \"./options/MsiOptions\"\nimport { MsiWrappedOptions } from \"./options/MsiWrappedOptions\"\nimport { PkgOptions } from \"./options/pkgOptions\"\nimport { PlatformSpecificBuildOptions } from \"./options/PlatformSpecificBuildOptions\"\nimport { SnapcraftOptions, SnapOptions } from \"./options/SnapOptions\"\nimport { SquirrelWindowsOptions } from \"./options/SquirrelWindowsOptions\"\nimport { WindowsConfiguration } from \"./options/winOptions\"\nimport { BuildResult } from \"./packager\"\nimport { ArtifactBuildStarted, ArtifactCreated } from \"./packagerApi\"\nimport { PlatformPackager } from \"./platformPackager\"\nimport { NsisOptions, NsisWebOptions, PortableOptions } from \"./targets/nsis/nsisOptions\"\nimport { ElectronDownloadOptions, ElectronGetOptions } from \"./util/electronGet\"\n\n// duplicate appId here because it is important\n/**\n * Configuration Options\n */\nexport interface CommonConfiguration {\n /**\n * The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n * [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.\n * @default com.electron.${name}\n */\n readonly appId?: string | null\n\n /**\n * As [name](#metadata), but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the [name property](https://docs.npmjs.com/files/package.json#name).\n * If not specified inside of the `build` configuration, `productName` property defined at the top level of `package.json` is used. If not specified at the top level of `package.json`, [name property](https://docs.npmjs.com/files/package.json#name) is used.\n */\n readonly productName?: string | null\n\n /**\n * The human-readable copyright line for the app.\n * @default Copyright © year ${author}\n */\n readonly copyright?: string | null\n\n /**\n * Directories for build resources\n */\n readonly directories?: MetadataDirectories | null\n\n /**\n * Configuration of toolsets utilized by electron-builder\n */\n readonly toolsets?: ToolsetConfig | null\n\n /**\n * Options related to how build macOS targets.\n */\n readonly mac?: MacConfiguration | null\n /**\n * MAS (Mac Application Store) options.\n */\n readonly mas?: MasConfiguration | null\n /**\n * MAS (Mac Application Store) development options (`mas-dev` target).\n */\n readonly masDev?: MasConfiguration | null\n /**\n * macOS DMG options.\n */\n readonly dmg?: DmgOptions | null\n /**\n * macOS PKG options.\n */\n readonly pkg?: PkgOptions | null\n\n /**\n * Options related to how build Windows targets.\n */\n readonly win?: WindowsConfiguration | null\n /** NSIS installer options. */\n readonly nsis?: NsisOptions | null\n /** NSIS web installer options (downloads app package at install time). */\n readonly nsisWeb?: NsisWebOptions | null\n /** Portable executable options (no installation required). */\n readonly portable?: PortableOptions | null\n /** Windows Store (AppX) package options. */\n readonly appx?: AppXOptions | null\n /**\n * MSI package options.\n */\n readonly msi?: MsiOptions | null\n /**\n * MSI-wrapped installer options.\n */\n readonly msiWrapped?: MsiWrappedOptions | null\n /**\n * Squirrel.Windows installer options. Requires the `electron-builder-squirrel-windows` dependency.\n */\n readonly squirrelWindows?: SquirrelWindowsOptions | null\n /**\n * General Linux build options shared across all Linux targets (icon, category, desktop entry,\n * executable name, etc.). Target-specific compression and packaging options live in the\n * per-format interfaces (`DebOptions`, `RpmOptions`, `PacmanOptions`, etc.).\n */\n readonly linux?: LinuxConfiguration | null\n /**\n * Debian package options. Targets Debian, Ubuntu, and Debian-based distributions.\n * Produces a `.deb` archive installable via `dpkg -i` or `apt install`.\n */\n readonly deb?: DebOptions | null\n /**\n * Flat snap configuration targeting core22 and older snap bases.\n *\n * @deprecated Use `snapcraft` instead — it supersedes `snap` when both are present and supports\n * all snap bases including core24. `snap` will be removed in a future major release.\n * See {@link SnapOptions} for available properties.\n */\n readonly snap?: SnapOptions | null\n /**\n * Snapcraft configuration. Prefer this over the deprecated `snap` field.\n *\n * Selects the snapcraft base and provides per-core options:\n * - `base: \"core18\" | \"core20\" | \"core22\"` — legacy builds; accepts the same options as `snap`\n * - `base: \"core24\"` — modern builds with the GNOME extension (recommended for new apps, requires Electron 25+)\n * - `base: \"custom\"` — pass an existing `snapcraft.yaml` through unchanged; no plugs, extensions,\n * or desktop files are injected\n *\n * When both `snapcraft` and `snap` are set, `snapcraft` takes precedence.\n *\n * @example\n * ```json\n * { \"snapcraft\": { \"base\": \"core24\", \"core24\": { \"useLXD\": true } } }\n * ```\n *\n * See {@link SnapcraftOptions} for all available properties.\n */\n readonly snapcraft?: SnapcraftOptions | null\n /**\n * AppImage options. AppImage is a portable application format that bundles the app\n * and its dependencies into a single self-contained executable that runs on most\n * Linux distributions without installation.\n */\n readonly appImage?: AppImageOptions | null\n /**\n * Flatpak options. Flatpak is a sandboxed application distribution format for Linux\n * that runs in a controlled environment and is distributed via [Flathub](https://flathub.org/)\n * or other Flatpak repositories.\n */\n readonly flatpak?: FlatpakOptions | null\n /**\n * Pacman package options. Targets Arch Linux and Arch-based distributions\n * (Manjaro, EndeavourOS, etc.). Produces a `.pacman` archive installable via `pacman -U`.\n */\n readonly pacman?: PacmanOptions | null\n /**\n * RPM package options. Targets Fedora, Red Hat Enterprise Linux, SUSE, and related\n * distributions. Produces a `.rpm` archive installable via `rpm` or `dnf`.\n */\n readonly rpm?: RpmOptions | null\n /**\n * FreeBSD package options. Produces a `.pkg` archive for the FreeBSD `pkg` package manager.\n */\n readonly freebsd?: LinuxTargetSpecificOptions | null\n /**\n * Solaris IPS package options. Produces a `.p5p` archive for the Solaris Image Packaging\n * System (`pkg`).\n */\n readonly p5p?: LinuxTargetSpecificOptions | null\n /**\n * Alpine Linux APK package options. Produces an `.apk` archive installable via `apk add`.\n */\n readonly apk?: LinuxTargetSpecificOptions | null\n\n /**\n * Whether to build the application native dependencies from source.\n * @default false\n */\n buildDependenciesFromSource?: boolean\n /**\n * Whether to execute `node-gyp rebuild` before starting to package the app.\n *\n * Don't [use](https://github.com/electron-userland/electron-builder/issues/683#issuecomment-241214075) [npm](http://electron.atom.io/docs/tutorial/using-native-node-modules/#using-npm) (neither `.npmrc`) for configuring electron headers. Use `electron-builder node-gyp-rebuild` instead.\n * @default false\n */\n readonly nodeGypRebuild?: boolean\n /**\n * Additional command line arguments to use when installing app native deps.\n */\n readonly npmArgs?: Array<string> | string | null\n /**\n * Whether to [rebuild](https://docs.npmjs.com/cli/rebuild) native dependencies before starting to package the app.\n * @default true\n */\n readonly npmRebuild?: boolean\n /**\n * Use `legacy` app-builder binary for installing native dependencies, or `@electron/rebuild` in `sequential` or `parallel` compilation modes.\n * @default sequential\n */\n readonly nativeRebuilder?: \"legacy\" | \"sequential\" | \"parallel\" | null\n\n /**\n * The build number. Maps to the `--iteration` flag for builds using FPM on Linux.\n * If not defined, then it will fallback to `BUILD_NUMBER` or `TRAVIS_BUILD_NUMBER` or `APPVEYOR_BUILD_NUMBER` or `CIRCLE_BUILD_NUM` or `BUILD_BUILDNUMBER` or `CI_PIPELINE_IID` env.\n */\n readonly buildNumber?: string | null\n\n /**\n * The build version. Maps to the `CFBundleVersion` on macOS, and `FileVersion` metadata property on Windows. Defaults to the `version`.\n * If `buildVersion` is not defined and `buildNumber` (or one of the `buildNumber` envs) is defined, it will be used as a build version (`version.buildNumber`).\n */\n readonly buildVersion?: string | null\n\n /**\n * Whether to download the alternate FFmpeg library from Electron's release assets and replace the default FFmpeg library prior to signing\n */\n readonly downloadAlternateFFmpeg?: boolean\n\n /**\n * Inject properties to `package.json`.\n */\n readonly extraMetadata?: any\n\n /**\n * Whether to fail if the application is not signed (to prevent unsigned app if code signing configuration is not correct).\n * @default false\n */\n readonly forceCodeSigning?: boolean\n\n /**\n * Whether to include PDB files.\n * @default false\n */\n readonly includePdb?: boolean\n\n /**\n * Whether to remove `scripts` field from `package.json` files.\n *\n * @default true\n */\n readonly removePackageScripts?: boolean\n\n /**\n * Whether to remove `keywords` field from `package.json` files.\n *\n * @default true\n */\n readonly removePackageKeywords?: boolean\n\n /**\n * Options to pass to `@electron/fuses`\n * Ref: https://github.com/electron/fuses\n */\n readonly electronFuses?: FuseOptionsV1 | null\n\n /**\n * [Experimental] Configuration for concurrent builds.\n */\n readonly concurrency?: Concurrency | null\n}\n\nexport interface Configuration extends CommonConfiguration, PlatformSpecificBuildOptions, Hooks {\n /**\n * Whether to use [electron-compile](http://github.com/electron/electron-compile) to compile app. Defaults to `true` if `electron-compile` in the dependencies. And `false` if in the `devDependencies` or doesn't specified.\n * @deprecated `electron-compile` is no longer maintained. Compile your app with a modern bundler (webpack, vite, etc.) instead.\n */\n readonly electronCompile?: boolean\n\n /**\n * The [electron-download](https://github.com/electron-userland/electron-download#usage) options. (legacy)\n * Alternatively, you can use [electron/get](https://github.com/electron/get#usage) options.\n */\n readonly electronDownload?: ElectronDownloadOptions | ElectronGetOptions | null\n\n /**\n * The branding used by Electron's distributables. This is needed if a fork has modified Electron's BRANDING.json file.\n */\n readonly electronBranding?: ElectronBrandingOptions\n\n /**\n * The version of electron you are packaging for. Defaults to version of `electron`, `electron-prebuilt` or `electron-prebuilt-compile` dependency.\n */\n electronVersion?: string | null\n\n /**\n * The name of a built-in configuration preset (currently, only `react-cra` is supported) or any number of paths to config files (relative to project dir).\n *\n * The latter allows to mixin a config from multiple other configs, as if you `Object.assign` them, but properly combine `files` glob patterns.\n *\n * If `react-scripts` in the app dependencies, `react-cra` will be set automatically. Set to `null` to disable automatic detection.\n */\n extends?: Array<string> | string | null\n\n /**\n * *libui-based frameworks only* The version of NodeJS you are packaging for.\n * You can set it to `current` to set the Node.js version that you use to run.\n * @deprecated libui-based frameworks (proton-native, etc.) are no longer actively maintained. This option has no effect when using Electron.\n */\n readonly nodeVersion?: string | null\n\n /**\n * *libui-based frameworks only* The version of LaunchUI you are packaging for. Applicable for Windows only. Defaults to version suitable for used framework version.\n * @deprecated libui-based frameworks (proton-native, etc.) are no longer actively maintained. This option has no effect when using Electron.\n */\n readonly launchUiVersion?: boolean | string | null\n\n /**\n * The framework name. One of `electron`, `proton`, `libui`. Defaults to `electron`.\n * @deprecated `proton` and `libui` framework support is no longer actively maintained. Use `electron` (the default).\n */\n readonly framework?: string | null\n\n /**\n * Whether to disable sanity check asar package (useful for custom electron forks that implement their own encrypted integrity validation)\n * @default false\n */\n readonly disableSanityCheckAsar?: boolean\n\n /**\n * Whether to skip ASAR integrity hash computation. Useful for custom electron forks with encrypted ASAR support where the header is not readable by standard tools.\n * @default false\n */\n readonly disableAsarIntegrity?: boolean\n}\n\nexport type Hook<T, V> = (contextOrPath: T) => Promise<V> | V\n\nexport interface PackContext {\n readonly outDir: string\n readonly appOutDir: string\n readonly packager: PlatformPackager<any>\n readonly electronPlatformName: string\n readonly arch: Arch\n readonly targets: Array<Target>\n}\nexport type AfterPackContext = PackContext\nexport type BeforePackContext = PackContext\nexport type AfterExtractContext = PackContext\n\n/**\n * Configuration of toolsets utilized by electron-builder\n */\nexport interface ToolsetConfig {\n /**\n * `win-codesign` version to use for signing Windows artifacts.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=win-codesign&expanded=true\n *\n * Stable:\n * v0.0.0 (winCodeSign)\n *\n * Beta:\n * Windows Kits 10.0.26100.0\n * v1.0.0, v1.1.0\n *\n * @default \"0.0.0\"\n */\n readonly winCodeSign?: \"0.0.0\" | \"1.0.0\" | \"1.1.0\" | null\n\n /**\n * `appimage` bundle version to use for Appimage packaging and runtime.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=appimage&expanded=true\n * 0.0.0 - legacy toolset (appimage)\n *\n * Betas:\n * 1.0.2 - Runtime 20251108\n * 1.0.3 - Runtime 20251108 (Resolves GH issue #9598)\n *\n * @default \"0.0.0\"\n */\n readonly appimage?: \"0.0.0\" | \"1.0.2\" | \"1.0.3\" | null\n\n /**\n * `nsis` bundle version to use for NSIS installer compilation.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=nsis&expanded=true\n * 0.0.0 - legacy toolset (nsis-3.0.4.1 + nsis-resources-3.4.1)\n *\n * Betas:\n * 1.2.1 - unified bundle (makensis 3.12 + plugins in one archive, entrypoint scripts auto-set NSISDIR)\n *\n * @default \"0.0.0\"\n */\n readonly nsis?: \"0.0.0\" | \"1.2.1\" | null\n\n /**\n * `wine` bundle version to use for running Windows tools on non-Windows platforms.\n * Located at https://github.com/electron-userland/electron-builder-binaries/releases?q=wine&expanded=true\n * 0.0.0 - legacy toolset (wine 4.0.1 portable; mac-only support)\n *\n * Beta:\n * 1.0.1 - Wine 11 bundle (unified wine binary, ia32 via WoW64)\n *\n * @default \"0.0.0\"\n */\n readonly wine?: \"0.0.0\" | \"1.0.1\" | null\n}\n\nexport interface Hooks {\n /**\n * The function (or path to file or module id) to be run before pack.\n * Receives a {@link BeforePackContext}.\n *\n * Can be specified inline as a function in JavaScript configs:\n * ```js\n * // electron-builder.config.js\n * module.exports = {\n * beforePack: async (context) => {\n * // your code\n * }\n * }\n * ```\n *\n * Or as a path to a module that exports the function as its default export:\n * ```json\n * { \"build\": { \"beforePack\": \"./myBeforePackHook.js\" } }\n * ```\n * ```js\n * // myBeforePackHook.js\n * exports.default = async function(context) {\n * // your custom code\n * }\n * ```\n */\n readonly beforePack?: Hook<BeforePackContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run after the prebuilt Electron binary has been extracted to the output directory.\n * Receives an {@link AfterExtractContext}. For file/module setup, see {@link beforePack}.\n */\n readonly afterExtract?: Hook<AfterExtractContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run after pack but before pack into distributable format and sign.\n * Receives an {@link AfterPackContext}. For file/module setup, see {@link beforePack}.\n */\n readonly afterPack?: Hook<AfterPackContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run after pack and sign but before pack into distributable format.\n * Receives an {@link AfterPackContext}. For file/module setup, see {@link beforePack}.\n */\n readonly afterSign?: Hook<AfterPackContext, void> | string | null\n\n /**\n * The function (or path to file or module id) to be run when an individual artifact build starts.\n * Receives an {@link ArtifactBuildStarted}. For file/module setup, see {@link beforePack}.\n */\n readonly artifactBuildStarted?: Hook<ArtifactBuildStarted, void> | string | null\n /**\n * The function (or path to file or module id) to be run when an individual artifact build completes.\n * Receives an {@link ArtifactCreated}. For file/module setup, see {@link beforePack}.\n */\n readonly artifactBuildCompleted?: Hook<ArtifactCreated, void> | string | null\n /**\n * The function (or path to file or module id) to be run after all artifacts are built.\n * Receives a {@link BuildResult}. May return an array of additional file paths to publish.\n *\n * For file/module setup, see {@link beforePack}.\n *\n * @example\n * ```js\n * exports.default = function () {\n * // return additional files to publish\n * return [\"/path/to/additional/result/file\"]\n * }\n * ```\n */\n readonly afterAllArtifactBuild?: Hook<BuildResult, Array<string>> | string | null\n /**\n * The function (or path to file or module id) to be run after MSI project created on disk - not packed into .msi package yet.\n */\n readonly msiProjectCreated?: Hook<string, void> | string | null\n /**\n * The function (or path to file or module id) to be run after Appx manifest created on disk - not packed into .appx package yet.\n */\n readonly appxManifestCreated?: Hook<string, void> | string | null\n /**\n * The function (or path to file or module id) to be [run on each node module](#onnodemodulefile) file. Returning `true`/`false` will determine whether to force include or to use the default copier logic\n */\n readonly onNodeModuleFile?: Hook<string, void | boolean> | string | null\n /**\n * The function (or path to file or module id) to be run before dependencies are installed or rebuilt. Works when `npmRebuild` is set to `true`. Resolving to `false` will skip dependencies install or rebuild.\n *\n * If provided and `node_modules` are missing, it will not invoke production dependencies check.\n */\n readonly beforeBuild?: Hook<BeforeBuildContext, boolean | void> | string | null\n /**\n * The function (or path to file or module id) to be run when staging the electron artifact environment.\n * Returns the path to custom Electron build (e.g. `~/electron/out/R`) or folder of electron zips.\n *\n * Zip files must follow the pattern `electron-v${version}-${platformName}-${arch}.zip`, otherwise it will be assumed to be an unpacked Electron app directory\n */\n readonly electronDist?: Hook<PrepareApplicationStageDirectoryOptions, string> | string | null\n}\n\nexport interface MetadataDirectories {\n /**\n * The path to build resources.\n *\n * Please note — build resources are not packed into the app. If you need to use some files, e.g. as tray icon, please include required files explicitly: `\"files\": [\"**\\/*\", \"build/icon.*\"]`\n * @default build\n */\n readonly buildResources?: string | null\n\n /**\n * The output directory. [File macros](https://www.electron.build/file-patterns#file-macros) are supported.\n * @default dist\n */\n readonly output?: string | null\n\n /**\n * The application directory (containing the application package.json), defaults to `app`, `www` or working directory.\n */\n readonly app?: string | null\n}\n\n/**\n * All options come from [@electron/fuses](https://github.com/electron/fuses)\n * Ref: https://raw.githubusercontent.com/electron/electron/refs/heads/main/docs/tutorial/fuses.md\n */\nexport interface FuseOptionsV1 {\n /**\n *The runAsNode fuse toggles whether the `ELECTRON_RUN_AS_NODE` environment variable is respected or not. Please note that if this fuse is disabled then `process.fork` in the main process will not function as expected as it depends on this environment variable to function. Instead, we recommend that you use [Utility Processes](https://github.com/electron/electron/blob/main/docs/api/utility-process.md), which work for many use cases where you need a standalone Node.js process (like a Sqlite server process or similar scenarios).\n */\n runAsNode?: boolean\n /**\n * The cookieEncryption fuse toggles whether the cookie store on disk is encrypted using OS level cryptography keys. By default the sqlite database that Chromium uses to store cookies stores the values in plaintext. If you wish to ensure your apps cookies are encrypted in the same way Chrome does then you should enable this fuse. Please note it is a one-way transition, if you enable this fuse existing unencrypted cookies will be encrypted-on-write but if you then disable the fuse again your cookie store will effectively be corrupt and useless. Most apps can safely enable this fuse.\n */\n enableCookieEncryption?: boolean\n /**\n * The nodeOptions fuse toggles whether the [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#node_optionsoptions) and [`NODE_EXTRA_CA_CERTS`](https://github.com/nodejs/node/blob/main/doc/api/cli.md#node_extra_ca_certsfile) environment variables are respected. The `NODE_OPTIONS` environment variable can be used to pass all kinds of custom options to the Node.js runtime and isn't typically used by apps in production. Most apps can safely disable this fuse.\n */\n enableNodeOptionsEnvironmentVariable?: boolean\n /**\n * The nodeCliInspect fuse toggles whether the `--inspect`, `--inspect-brk`, etc. flags are respected or not. When disabled it also ensures that `SIGUSR1` signal does not initialize the main process inspector. Most apps can safely disable this fuse.\n */\n enableNodeCliInspectArguments?: boolean\n /**\n * The embeddedAsarIntegrityValidation fuse toggles an experimental feature on macOS that validates the content of the `app.asar` file when it is loaded. This feature is designed to have a minimal performance impact but may marginally slow down file reads from inside the `app.asar` archive.\n * Currently, ASAR integrity checking is supported on:\n *\n * - macOS as of electron>=16.0.0\n * - Windows as of electron>=30.0.0\n *\n * For more information on how to use asar integrity validation please read the [Asar Integrity](https://github.com/electron/electron/blob/main/docs/tutorial/asar-integrity.md) documentation.\n */\n enableEmbeddedAsarIntegrityValidation?: boolean\n /**\n * The onlyLoadAppFromAsar fuse changes the search system that Electron uses to locate your app code. By default Electron will search in the following order `app.asar` -> `app` -> `default_app.asar`. When this fuse is enabled the search order becomes a single entry `app.asar` thus ensuring that when combined with the `embeddedAsarIntegrityValidation` fuse it is impossible to load non-validated code.\n */\n onlyLoadAppFromAsar?: boolean\n /**\n * The loadBrowserProcessSpecificV8Snapshot fuse changes which V8 snapshot file is used for the browser process. By default Electron's processes will all use the same V8 snapshot file. When this fuse is enabled the browser process uses the file called `browser_v8_context_snapshot.bin` for its V8 snapshot. The other processes will use the V8 snapshot file that they normally do.\n */\n loadBrowserProcessSpecificV8Snapshot?: boolean\n /**\n * The grantFileProtocolExtraPrivileges fuse changes whether pages loaded from the `file://` protocol are given privileges beyond what they would receive in a traditional web browser. This behavior was core to Electron apps in original versions of Electron but is no longer required as apps should be [serving local files from custom protocols](https://github.com/electron/electron/blob/main/docs/tutorial/security.md#18-avoid-usage-of-the-file-protocol-and-prefer-usage-of-custom-protocols) now instead. If you aren't serving pages from `file://` you should disable this fuse.\n * The extra privileges granted to the `file://` protocol by this fuse are incompletely documented below:\n *\n * - `file://` protocol pages can use `fetch` to load other assets over `file://`\n * - `file://` protocol pages can use service workers\n * - `file://` protocol pages have universal access granted to child frames also running on `file://` protocols regardless of sandbox settings\n */\n grantFileProtocolExtraPrivileges?: boolean\n /**\n * Resets the app signature, specifically used for macOS.\n * Note: This should be unneeded since electron-builder signs the app directly after flipping the fuses.\n * Ref: https://github.com/electron/fuses?tab=readme-ov-file#apple-silicon\n */\n resetAdHocDarwinSignature?: boolean\n}\n\nexport interface Concurrency {\n /**\n * The maximum number of concurrent jobs to run.\n * @default 1\n */\n jobs: number\n}\n"]}
|
|
@@ -169,11 +169,7 @@ async function unpack(prepareOptions, downloadOptions, distMacOsAppName) {
|
|
|
169
169
|
}
|
|
170
170
|
if (resolvedDist.endsWith(".zip")) {
|
|
171
171
|
builder_util_1.log.info({ zipFile: resolvedDist }, "using custom electronDist zip file");
|
|
172
|
-
await (0,
|
|
173
|
-
const safeZipPath = (0, builder_util_1.sanitizeDirPath)(resolvedDist);
|
|
174
|
-
const safeAppOutDir = (0, builder_util_1.sanitizeDirPath)(appOutDir);
|
|
175
|
-
const outputSwitch = (0, builder_util_1.to7zaOutputSwitch)(safeAppOutDir);
|
|
176
|
-
await (0, builder_util_1.exec)(await (0, builder_util_1.getPath7za)(), ["x", "-bd", safeZipPath, outputSwitch, "-y"]);
|
|
172
|
+
await (0, electronGet_1.extractArchive)(resolvedDist, appOutDir);
|
|
177
173
|
return false; // do not clean up after unpacking, it's a custom bundle and we should respect its configuration/contents as required
|
|
178
174
|
}
|
|
179
175
|
if (electronDistStats.isDirectory()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElectronFramework.js","sourceRoot":"","sources":["../../src/electron/ElectronFramework.ts"],"names":[],"mappings":";;AA0CA,gDAKC;AAkID,wEAiBC;AAlMD,+CAaqB;AACrB,uCAAwD;AACxD,6BAA4B;AAC5B,qDAAuC;AAGvC,oCAA6C;AAG7C,qDAAqD;AACrD,6CAAiD;AACjD,qDAA8H;AAE9H,+CAA4C;AAC5C,uDAA2F;AAC3F,+CAAmD;AACnD,iDAA+C;AAa/C,SAAgB,kBAAkB,CAAC,IAAmB;;IACpD,OAAO;QACL,WAAW,EAAE,CAAA,MAAA,IAAI,CAAC,gBAAgB,0CAAE,WAAW,KAAI,UAAU;QAC7D,WAAW,EAAE,CAAA,MAAA,IAAI,CAAC,gBAAgB,0CAAE,WAAW,KAAI,UAAU;KAC9D,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAmB,EAAE,QAA8B,EAAE,IAAY,EAAE,eAAuB;;IACpH,MAAM,IAAI,GAA4B,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,CAAA;IAClF,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAA;IAChC,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;QACf,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC;QAC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n} from \"builder-util\"\nimport { emptyDir, readdir, rename, rm } from \"fs-extra\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { Configuration } from \"../configuration\"\nimport { BeforeCopyExtraFilesOptions, Framework, PrepareApplicationStageDirectoryOptions } from \"../Framework\"\nimport { Packager, Platform } from \"../index\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { MacPackager } from \"../macPackager\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { resolveFunction } from \"../util/resolve\"\nimport { downloadElectronArtifactZip, ElectronDownloadOptions, ElectronGetOptions, extractArchive } from \"../util/electronGet\"\nexport { ElectronDownloadOptions }\nimport { createMacApp } from \"./electronMac\"\nimport { computeElectronVersion, getElectronVersionFromInstalled } from \"./electronVersion\"\nimport { addWinAsarIntegrity } from \"./electronWin\"\nimport { FFMPEGInjector } from \"./injectFFMPEG\"\n\nexport type ElectronPlatformName = \"darwin\" | \"linux\" | \"win32\" | \"mas\"\n\n/**\n * Electron distributables branding options.\n * @see [Electron BRANDING.json](https://github.com/electron/electron/blob/master/shell/app/BRANDING.json).\n */\nexport interface ElectronBrandingOptions {\n projectName?: string\n productName?: string\n}\n\nexport function createBrandingOpts(opts: Configuration): Required<ElectronBrandingOptions> {\n return {\n projectName: opts.electronBranding?.projectName || \"electron\",\n productName: opts.electronBranding?.productName || \"Electron\",\n }\n}\n\nfunction createDownloadOpts(opts: Configuration, platform: ElectronPlatformName, arch: string, electronVersion: string): ElectronDownloadOptions {\n const base: ElectronDownloadOptions = { platform, arch, version: electronVersion }\n const dl = opts.electronDownload\n if (dl == null) {\n return base\n }\n if (Object.hasOwnProperty.call(dl, \"mirrorOptions\")) {\n // ElectronGetOptions: flatten mirrorOptions.mirror for the app-builder binary\n const { mirrorOptions } = dl as ElectronGetOptions\n return { ...base, mirror: mirrorOptions?.mirror ?? undefined }\n }\n return { ...base, ...dl }\n}\n\nasync function beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n const { appOutDir, packager } = options\n const electronBranding = createBrandingOpts(packager.config)\n if (packager.platform === Platform.LINUX) {\n const linuxPackager = packager as LinuxPackager\n const executable = path.join(appOutDir, linuxPackager.executableName)\n await rename(path.join(appOutDir, electronBranding.projectName), executable)\n } else if (packager.platform === Platform.WINDOWS) {\n const executable = path.join(appOutDir, `${packager.appInfo.productFilename}.exe`)\n await rename(path.join(appOutDir, `${electronBranding.projectName}.exe`), executable)\n if (options.asarIntegrity) {\n await addWinAsarIntegrity(executable, options.asarIntegrity)\n }\n } else {\n await createMacApp(packager as MacPackager, appOutDir, options.asarIntegrity, (options.platformName as ElectronPlatformName) === \"mas\")\n }\n await removeUnusedLanguagesIfNeeded(options)\n}\n\nasync function removeUnusedLanguagesIfNeeded(options: BeforeCopyExtraFilesOptions) {\n const { packager, appOutDir } = options\n const { config, platformSpecificBuildOptions, platform } = packager\n\n const getLocalesConfig = () => {\n if (platform === Platform.MAC) {\n return { dirs: [packager.getResourcesDir(appOutDir), packager.getMacOsElectronFrameworkResourcesDir(appOutDir)], langFileExt: \".lproj\" }\n }\n return { dirs: [path.join(packager.getResourcesDir(appOutDir), \"..\", \"locales\")], langFileExt: \".pak\" }\n }\n\n const wantedLanguages = asArray(platformSpecificBuildOptions.electronLanguages || config.electronLanguages)\n .map(it => it.trim().toLowerCase())\n .filter(it => it.length > 0)\n if (!wantedLanguages.length) {\n return\n }\n\n const { dirs, langFileExt } = getLocalesConfig()\n // noinspection SpellCheckingInspection\n const deleteNonMatchedLanguages: (dir: string) => Promise<Promise<void>[] | undefined> = async (dir: string) => {\n const files = await readdir(dir)\n return files.map(async file => {\n if (path.extname(file) !== langFileExt) {\n return\n }\n\n const language = path.basename(file, langFileExt).toLowerCase()\n const isWantedLocale = wantedLanguages.some(\n wantedLanguage =>\n // exact file\n wantedLanguage === language ||\n // prefix (e.g. \"en\" matches \"en-US\")\n wantedLanguage.startsWith(`${language}-`) ||\n // prefix (e.g. \"en\" matches \"en_US\")\n wantedLanguage.startsWith(`${language}_`)\n )\n if (isWantedLocale) {\n return undefined\n }\n return rm(path.join(dir, file), { recursive: true, force: true })\n })\n }\n const allDeletedFiles = (await Promise.all(dirs.map(deleteNonMatchedLanguages))).flat().filter((it): it is Promise<void> => it != null)\n if (allDeletedFiles.length === 0) {\n log.warn({ electronLanguages: wantedLanguages }, \"no locales found matching wanted languages, skipping cleanup\")\n return\n }\n await asyncPool(MAX_FILE_REQUESTS, allDeletedFiles, it => it)\n}\n\nclass ElectronFramework implements Framework {\n // noinspection JSUnusedGlobalSymbols\n readonly macOsDefaultTargets = [\"zip\", \"dmg\"]\n // noinspection JSUnusedGlobalSymbols\n readonly defaultAppIdPrefix = \"com.electron.\"\n // noinspection JSUnusedGlobalSymbols\n readonly isCopyElevateHelper = true\n // noinspection JSUnusedGlobalSymbols\n readonly isNpmRebuildRequired = true\n\n constructor(\n readonly name: string,\n readonly version: string,\n readonly macOsProductName: string\n ) {}\n\n get distMacOsAppName(): string {\n return `${this.macOsProductName}.app`\n }\n\n getDefaultIcon(platform: Platform) {\n if (platform === Platform.LINUX) {\n return path.join(getTemplatePath(\"icons\"), \"electron-linux\")\n } else {\n // default icon is embedded into app skeleton\n return null\n }\n }\n\n async prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n const downloadOptions = createDownloadOpts(options.packager.config, options.platformName, options.arch, this.version)\n const shouldCleanup = await unpack(options, downloadOptions, this.distMacOsAppName)\n await cleanupAfterUnpack(options, this.distMacOsAppName, shouldCleanup)\n if (options.packager.config.downloadAlternateFFmpeg) {\n const injector = new FFMPEGInjector(options, this.version, createBrandingOpts(options.packager.config))\n await injector.inject()\n }\n }\n\n beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n return beforeCopyExtraFiles(options)\n }\n}\n\nexport async function createElectronFrameworkSupport(configuration: Configuration, packager: Packager): Promise<Framework> {\n let version = configuration.electronVersion\n if (version == null) {\n // for prepacked app asar no dev deps in the app.asar\n if (packager.isPrepackedAppAsar) {\n version = await getElectronVersionFromInstalled(packager.projectDir)\n if (version == null) {\n throw new Error(`Cannot compute electron version for prepacked asar`)\n }\n } else {\n version = await computeElectronVersion(packager.projectDir)\n }\n configuration.electronVersion = version\n }\n\n const branding = createBrandingOpts(configuration)\n return new ElectronFramework(branding.projectName, version, branding.productName)\n}\n\n/**\n * Unpacks a custom or default Electron distribution into the app output directory.\n */\nasync function unpack(prepareOptions: PrepareApplicationStageDirectoryOptions, downloadOptions: ElectronDownloadOptions, distMacOsAppName: string): Promise<boolean> {\n async function selectElectron(filepath: string) {\n const resolvedDist = path.isAbsolute(filepath) ? filepath : path.resolve(packager.projectDir, filepath)\n\n const electronDistStats = await statOrNull(resolvedDist)\n if (!electronDistStats) {\n throw new Error(\n `The specified electronDist does not exist: ${resolvedDist}. Please provide a valid path to the Electron zip file, cache directory, or electron build directory.`\n )\n }\n\n if (resolvedDist.endsWith(\".zip\")) {\n log.info({ zipFile: resolvedDist }, \"using custom electronDist zip file\")\n await emptyDir(appOutDir)\n const safeZipPath = sanitizeDirPath(resolvedDist)\n const safeAppOutDir = sanitizeDirPath(appOutDir)\n const outputSwitch = to7zaOutputSwitch(safeAppOutDir)\n await exec(await getPath7za(), [\"x\", \"-bd\", safeZipPath, outputSwitch, \"-y\"])\n return false // do not clean up after unpacking, it's a custom bundle and we should respect its configuration/contents as required\n }\n\n if (electronDistStats.isDirectory()) {\n // backward compatibility: if electronDist is a directory, check for the default zip file inside it\n const files = await readdir(resolvedDist)\n if (files.includes(defaultZipName)) {\n log.info({ electronDist: log.filePath(resolvedDist) }, \"using custom electronDist directory\")\n await extractArchive(path.join(resolvedDist, defaultZipName), appOutDir)\n return false // do not clean up after unpacking, it's a custom bundle and we should respect its configuration/contents as required\n }\n // if we reach here, it means the provided electronDist is neither a zip file nor a directory with the default zip file\n // e.g. we treat it as a custom already-unpacked Electron distribution\n log.info({ electronDist: log.filePath(resolvedDist) }, \"using custom unpacked Electron distribution\")\n const source = packager.getElectronSrcDir(resolvedDist)\n const destination = packager.getElectronDestinationDir(prepareOptions.appOutDir)\n log.info({ source, destination }, \"copying unpacked Electron\")\n await emptyDir(prepareOptions.appOutDir)\n await copyDir(source, destination, {\n isUseHardLink: DO_NOT_USE_HARD_LINKS,\n })\n return false\n }\n throw new Error(`The specified electronDist is neither a zip file nor a directory: ${resolvedDist}. Please provide a valid path to the Electron zip file or cache directory.`)\n }\n\n const { packager, appOutDir, platformName } = prepareOptions\n const { version, arch } = downloadOptions\n const defaultZipName = `electron-v${version}-${platformName}-${arch}.zip`\n\n const electronDist = packager.config.electronDist\n if (typeof electronDist === \"string\" && !isEmptyOrSpaces(electronDist)) {\n return selectElectron(electronDist)\n }\n\n let resolvedDist: string | null = null\n try {\n const electronDistHook: any = await resolveFunction(packager.appInfo.type, electronDist, \"electronDist\", await packager.info.getWorkspaceRoot())\n resolvedDist = typeof electronDistHook === \"function\" ? await Promise.resolve(electronDistHook(prepareOptions)) : electronDistHook\n } catch (error: any) {\n log.warn({ error }, \"Failed to resolve electronDist, using default unpack logic\")\n }\n\n if (resolvedDist == null) {\n // if no custom electronDist is provided, use the default unpack logic\n log.debug(null, \"no custom electronDist provided, unpacking default Electron distribution\")\n const zipPath = await downloadElectronArtifactZip({\n electronDownload: downloadOptions,\n artifactName: \"electron\",\n platformName: downloadOptions.platform ?? prepareOptions.platformName,\n arch: downloadOptions.arch ?? prepareOptions.arch,\n version: downloadOptions.version ?? prepareOptions.version,\n })\n await extractArchive(zipPath, appOutDir)\n log.info({ output: appOutDir }, \"downloaded electron zip extracted successfully\")\n return true // indicates that we should clean up after unpacking\n }\n return selectElectron(resolvedDist)\n}\n\nfunction cleanupAfterUnpack(prepareOptions: PrepareApplicationStageDirectoryOptions, distMacOsAppName: string, isFullCleanup: boolean) {\n const out = prepareOptions.appOutDir\n const isMac = prepareOptions.packager.platform === Platform.MAC\n const resourcesPath = isMac ? path.join(out, distMacOsAppName, \"Contents\", \"Resources\") : path.join(out, \"resources\")\n\n return Promise.all([\n isFullCleanup ? unlinkIfExists(path.join(resourcesPath, \"default_app.asar\")) : Promise.resolve(),\n isFullCleanup ? unlinkIfExists(path.join(out, \"version\")) : Promise.resolve(),\n isMac\n ? Promise.resolve()\n : rename(path.join(out, \"LICENSE\"), path.join(out, \"LICENSE.electron.txt\")).catch(() => {\n /* ignore */\n }),\n ])\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ElectronFramework.js","sourceRoot":"","sources":["../../src/electron/ElectronFramework.ts"],"names":[],"mappings":";;AA6BA,gDAKC;AAkID,wEAiBC;AArLD,+CAA2I;AAC3I,uCAAwD;AACxD,6BAA4B;AAC5B,qDAAuC;AAGvC,oCAA6C;AAG7C,qDAAqD;AACrD,6CAAiD;AACjD,qDAA8H;AAE9H,+CAA4C;AAC5C,uDAA2F;AAC3F,+CAAmD;AACnD,iDAA+C;AAa/C,SAAgB,kBAAkB,CAAC,IAAmB;;IACpD,OAAO;QACL,WAAW,EAAE,CAAA,MAAA,IAAI,CAAC,gBAAgB,0CAAE,WAAW,KAAI,UAAU;QAC7D,WAAW,EAAE,CAAA,MAAA,IAAI,CAAC,gBAAgB,0CAAE,WAAW,KAAI,UAAU;KAC9D,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAmB,EAAE,QAA8B,EAAE,IAAY,EAAE,eAAuB;;IACpH,MAAM,IAAI,GAA4B,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,CAAA;IAClF,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAA;IAChC,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;QACf,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC;QACpD,8EAA8E;QAC9E,MAAM,EAAE,aAAa,EAAE,GAAG,EAAwB,CAAA;QAClD,OAAO,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,MAAA,aAAa,aAA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AA;IAErH,OAAO,OAAO,CAAC,GAAG,CAAC;QACjB,aAAa,CAAC,CAAC,CAAC,IAAA,6BAAc,EAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;QAChG,aAAa,CAAC,CAAC,CAAC,IAAA,6BAAc,EAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;QAC7E,KAAK;YACH,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;YACnB,CAAC,CAAC,IAAA,iBAAM,EAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;gBACnF,YAAY;YACd,CAAC,CAAC;KACP,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { asArray, copyDir, DO_NOT_USE_HARD_LINKS, isEmptyOrSpaces, log, MAX_FILE_REQUESTS, statOrNull, unlinkIfExists } from \"builder-util\"\nimport { emptyDir, readdir, rename, rm } from \"fs-extra\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { Configuration } from \"../configuration\"\nimport { BeforeCopyExtraFilesOptions, Framework, PrepareApplicationStageDirectoryOptions } from \"../Framework\"\nimport { Packager, Platform } from \"../index\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { MacPackager } from \"../macPackager\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { resolveFunction } from \"../util/resolve\"\nimport { downloadElectronArtifactZip, ElectronDownloadOptions, ElectronGetOptions, extractArchive } from \"../util/electronGet\"\nexport { ElectronDownloadOptions }\nimport { createMacApp } from \"./electronMac\"\nimport { computeElectronVersion, getElectronVersionFromInstalled } from \"./electronVersion\"\nimport { addWinAsarIntegrity } from \"./electronWin\"\nimport { FFMPEGInjector } from \"./injectFFMPEG\"\n\nexport type ElectronPlatformName = \"darwin\" | \"linux\" | \"win32\" | \"mas\"\n\n/**\n * Electron distributables branding options.\n * @see [Electron BRANDING.json](https://github.com/electron/electron/blob/master/shell/app/BRANDING.json).\n */\nexport interface ElectronBrandingOptions {\n projectName?: string\n productName?: string\n}\n\nexport function createBrandingOpts(opts: Configuration): Required<ElectronBrandingOptions> {\n return {\n projectName: opts.electronBranding?.projectName || \"electron\",\n productName: opts.electronBranding?.productName || \"Electron\",\n }\n}\n\nfunction createDownloadOpts(opts: Configuration, platform: ElectronPlatformName, arch: string, electronVersion: string): ElectronDownloadOptions {\n const base: ElectronDownloadOptions = { platform, arch, version: electronVersion }\n const dl = opts.electronDownload\n if (dl == null) {\n return base\n }\n if (Object.hasOwnProperty.call(dl, \"mirrorOptions\")) {\n // ElectronGetOptions: flatten mirrorOptions.mirror for the app-builder binary\n const { mirrorOptions } = dl as ElectronGetOptions\n return { ...base, mirror: mirrorOptions?.mirror ?? undefined }\n }\n return { ...base, ...dl }\n}\n\nasync function beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n const { appOutDir, packager } = options\n const electronBranding = createBrandingOpts(packager.config)\n if (packager.platform === Platform.LINUX) {\n const linuxPackager = packager as LinuxPackager\n const executable = path.join(appOutDir, linuxPackager.executableName)\n await rename(path.join(appOutDir, electronBranding.projectName), executable)\n } else if (packager.platform === Platform.WINDOWS) {\n const executable = path.join(appOutDir, `${packager.appInfo.productFilename}.exe`)\n await rename(path.join(appOutDir, `${electronBranding.projectName}.exe`), executable)\n if (options.asarIntegrity) {\n await addWinAsarIntegrity(executable, options.asarIntegrity)\n }\n } else {\n await createMacApp(packager as MacPackager, appOutDir, options.asarIntegrity, (options.platformName as ElectronPlatformName) === \"mas\")\n }\n await removeUnusedLanguagesIfNeeded(options)\n}\n\nasync function removeUnusedLanguagesIfNeeded(options: BeforeCopyExtraFilesOptions) {\n const { packager, appOutDir } = options\n const { config, platformSpecificBuildOptions, platform } = packager\n\n const getLocalesConfig = () => {\n if (platform === Platform.MAC) {\n return { dirs: [packager.getResourcesDir(appOutDir), packager.getMacOsElectronFrameworkResourcesDir(appOutDir)], langFileExt: \".lproj\" }\n }\n return { dirs: [path.join(packager.getResourcesDir(appOutDir), \"..\", \"locales\")], langFileExt: \".pak\" }\n }\n\n const wantedLanguages = asArray(platformSpecificBuildOptions.electronLanguages || config.electronLanguages)\n .map(it => it.trim().toLowerCase())\n .filter(it => it.length > 0)\n if (!wantedLanguages.length) {\n return\n }\n\n const { dirs, langFileExt } = getLocalesConfig()\n // noinspection SpellCheckingInspection\n const deleteNonMatchedLanguages: (dir: string) => Promise<Promise<void>[] | undefined> = async (dir: string) => {\n const files = await readdir(dir)\n return files.map(async file => {\n if (path.extname(file) !== langFileExt) {\n return\n }\n\n const language = path.basename(file, langFileExt).toLowerCase()\n const isWantedLocale = wantedLanguages.some(\n wantedLanguage =>\n // exact file\n wantedLanguage === language ||\n // prefix (e.g. \"en\" matches \"en-US\")\n wantedLanguage.startsWith(`${language}-`) ||\n // prefix (e.g. \"en\" matches \"en_US\")\n wantedLanguage.startsWith(`${language}_`)\n )\n if (isWantedLocale) {\n return undefined\n }\n return rm(path.join(dir, file), { recursive: true, force: true })\n })\n }\n const allDeletedFiles = (await Promise.all(dirs.map(deleteNonMatchedLanguages))).flat().filter((it): it is Promise<void> => it != null)\n if (allDeletedFiles.length === 0) {\n log.warn({ electronLanguages: wantedLanguages }, \"no locales found matching wanted languages, skipping cleanup\")\n return\n }\n await asyncPool(MAX_FILE_REQUESTS, allDeletedFiles, it => it)\n}\n\nclass ElectronFramework implements Framework {\n // noinspection JSUnusedGlobalSymbols\n readonly macOsDefaultTargets = [\"zip\", \"dmg\"]\n // noinspection JSUnusedGlobalSymbols\n readonly defaultAppIdPrefix = \"com.electron.\"\n // noinspection JSUnusedGlobalSymbols\n readonly isCopyElevateHelper = true\n // noinspection JSUnusedGlobalSymbols\n readonly isNpmRebuildRequired = true\n\n constructor(\n readonly name: string,\n readonly version: string,\n readonly macOsProductName: string\n ) {}\n\n get distMacOsAppName(): string {\n return `${this.macOsProductName}.app`\n }\n\n getDefaultIcon(platform: Platform) {\n if (platform === Platform.LINUX) {\n return path.join(getTemplatePath(\"icons\"), \"electron-linux\")\n } else {\n // default icon is embedded into app skeleton\n return null\n }\n }\n\n async prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n const downloadOptions = createDownloadOpts(options.packager.config, options.platformName, options.arch, this.version)\n const shouldCleanup = await unpack(options, downloadOptions, this.distMacOsAppName)\n await cleanupAfterUnpack(options, this.distMacOsAppName, shouldCleanup)\n if (options.packager.config.downloadAlternateFFmpeg) {\n const injector = new FFMPEGInjector(options, this.version, createBrandingOpts(options.packager.config))\n await injector.inject()\n }\n }\n\n beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n return beforeCopyExtraFiles(options)\n }\n}\n\nexport async function createElectronFrameworkSupport(configuration: Configuration, packager: Packager): Promise<Framework> {\n let version = configuration.electronVersion\n if (version == null) {\n // for prepacked app asar no dev deps in the app.asar\n if (packager.isPrepackedAppAsar) {\n version = await getElectronVersionFromInstalled(packager.projectDir)\n if (version == null) {\n throw new Error(`Cannot compute electron version for prepacked asar`)\n }\n } else {\n version = await computeElectronVersion(packager.projectDir)\n }\n configuration.electronVersion = version\n }\n\n const branding = createBrandingOpts(configuration)\n return new ElectronFramework(branding.projectName, version, branding.productName)\n}\n\n/**\n * Unpacks a custom or default Electron distribution into the app output directory.\n */\nasync function unpack(prepareOptions: PrepareApplicationStageDirectoryOptions, downloadOptions: ElectronDownloadOptions, distMacOsAppName: string): Promise<boolean> {\n async function selectElectron(filepath: string) {\n const resolvedDist = path.isAbsolute(filepath) ? filepath : path.resolve(packager.projectDir, filepath)\n\n const electronDistStats = await statOrNull(resolvedDist)\n if (!electronDistStats) {\n throw new Error(\n `The specified electronDist does not exist: ${resolvedDist}. Please provide a valid path to the Electron zip file, cache directory, or electron build directory.`\n )\n }\n\n if (resolvedDist.endsWith(\".zip\")) {\n log.info({ zipFile: resolvedDist }, \"using custom electronDist zip file\")\n await extractArchive(resolvedDist, appOutDir)\n return false // do not clean up after unpacking, it's a custom bundle and we should respect its configuration/contents as required\n }\n\n if (electronDistStats.isDirectory()) {\n // backward compatibility: if electronDist is a directory, check for the default zip file inside it\n const files = await readdir(resolvedDist)\n if (files.includes(defaultZipName)) {\n log.info({ electronDist: log.filePath(resolvedDist) }, \"using custom electronDist directory\")\n await extractArchive(path.join(resolvedDist, defaultZipName), appOutDir)\n return false // do not clean up after unpacking, it's a custom bundle and we should respect its configuration/contents as required\n }\n // if we reach here, it means the provided electronDist is neither a zip file nor a directory with the default zip file\n // e.g. we treat it as a custom already-unpacked Electron distribution\n log.info({ electronDist: log.filePath(resolvedDist) }, \"using custom unpacked Electron distribution\")\n const source = packager.getElectronSrcDir(resolvedDist)\n const destination = packager.getElectronDestinationDir(prepareOptions.appOutDir)\n log.info({ source, destination }, \"copying unpacked Electron\")\n await emptyDir(prepareOptions.appOutDir)\n await copyDir(source, destination, {\n isUseHardLink: DO_NOT_USE_HARD_LINKS,\n })\n return false\n }\n throw new Error(`The specified electronDist is neither a zip file nor a directory: ${resolvedDist}. Please provide a valid path to the Electron zip file or cache directory.`)\n }\n\n const { packager, appOutDir, platformName } = prepareOptions\n const { version, arch } = downloadOptions\n const defaultZipName = `electron-v${version}-${platformName}-${arch}.zip`\n\n const electronDist = packager.config.electronDist\n if (typeof electronDist === \"string\" && !isEmptyOrSpaces(electronDist)) {\n return selectElectron(electronDist)\n }\n\n let resolvedDist: string | null = null\n try {\n const electronDistHook: any = await resolveFunction(packager.appInfo.type, electronDist, \"electronDist\", await packager.info.getWorkspaceRoot())\n resolvedDist = typeof electronDistHook === \"function\" ? await Promise.resolve(electronDistHook(prepareOptions)) : electronDistHook\n } catch (error: any) {\n log.warn({ error }, \"Failed to resolve electronDist, using default unpack logic\")\n }\n\n if (resolvedDist == null) {\n // if no custom electronDist is provided, use the default unpack logic\n log.debug(null, \"no custom electronDist provided, unpacking default Electron distribution\")\n const zipPath = await downloadElectronArtifactZip({\n electronDownload: downloadOptions,\n artifactName: \"electron\",\n platformName: downloadOptions.platform ?? prepareOptions.platformName,\n arch: downloadOptions.arch ?? prepareOptions.arch,\n version: downloadOptions.version ?? prepareOptions.version,\n })\n await extractArchive(zipPath, appOutDir)\n log.info({ output: appOutDir }, \"downloaded electron zip extracted successfully\")\n return true // indicates that we should clean up after unpacking\n }\n return selectElectron(resolvedDist)\n}\n\nfunction cleanupAfterUnpack(prepareOptions: PrepareApplicationStageDirectoryOptions, distMacOsAppName: string, isFullCleanup: boolean) {\n const out = prepareOptions.appOutDir\n const isMac = prepareOptions.packager.platform === Platform.MAC\n const resourcesPath = isMac ? path.join(out, distMacOsAppName, \"Contents\", \"Resources\") : path.join(out, \"resources\")\n\n return Promise.all([\n isFullCleanup ? unlinkIfExists(path.join(resourcesPath, \"default_app.asar\")) : Promise.resolve(),\n isFullCleanup ? unlinkIfExists(path.join(out, \"version\")) : Promise.resolve(),\n isMac\n ? Promise.resolve()\n : rename(path.join(out, \"LICENSE\"), path.join(out, \"LICENSE.electron.txt\")).catch(() => {\n /* ignore */\n }),\n ])\n}\n"]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { AfterPackContext } from "../configuration";
|
|
2
2
|
import { Platform } from "../core";
|
|
3
3
|
import { Framework, PrepareApplicationStageDirectoryOptions } from "../Framework";
|
|
4
|
+
/** Validates that a value is safe to embed in a double-quoted shell string (no metacharacters). */
|
|
5
|
+
export declare function validateShellEmbeddable(value: string, fieldName: string): void;
|
|
6
|
+
export declare const LAUNCHUI_DEFAULT_VERSION = "0.1.4-10.13.0";
|
|
4
7
|
export declare class LibUiFramework implements Framework {
|
|
5
8
|
readonly version: string;
|
|
6
9
|
readonly macOsProductName: string;
|
|
@@ -10,6 +13,7 @@ export declare class LibUiFramework implements Framework {
|
|
|
10
13
|
readonly defaultAppIdPrefix: string;
|
|
11
14
|
readonly isCopyElevateHelper = false;
|
|
12
15
|
readonly isNpmRebuildRequired = false;
|
|
16
|
+
readonly launchUiVersion: string;
|
|
13
17
|
constructor(version: string, macOsProductName: string, isUseLaunchUi: boolean);
|
|
14
18
|
get distMacOsAppName(): string;
|
|
15
19
|
prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions): Promise<void>;
|
|
@@ -20,3 +24,24 @@ export declare class LibUiFramework implements Framework {
|
|
|
20
24
|
private isUseLaunchUiForPlatform;
|
|
21
25
|
getExcludedDependencies(platform: Platform): Array<string> | null;
|
|
22
26
|
}
|
|
27
|
+
export type NodeJsDownloadParams = {
|
|
28
|
+
releaseName: string;
|
|
29
|
+
filenameWithExt: string;
|
|
30
|
+
overrideUrl: string;
|
|
31
|
+
binaryRelPath: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function getNodeJsDownloadParams(version: string, platform: Platform, arch: string): NodeJsDownloadParams;
|
|
34
|
+
export declare function downloadNodeJsBinary(version: string, platform: Platform, arch: string): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Fetches the SHA-256 hex digest for a specific Node.js distribution file from
|
|
37
|
+
* the official nodejs.org SHASUMS256.txt, preventing MITM substitution attacks.
|
|
38
|
+
*/
|
|
39
|
+
export declare function fetchNodeJsChecksum(version: string, filename: string): Promise<string>;
|
|
40
|
+
export type LaunchUiDownloadParams = {
|
|
41
|
+
releaseName: string;
|
|
42
|
+
filenameWithExt: string;
|
|
43
|
+
githubOrgRepo: string;
|
|
44
|
+
checksums: Record<string, string>;
|
|
45
|
+
};
|
|
46
|
+
export declare function getLaunchUiDownloadParams(version: string, platform: Platform, arch: string): LaunchUiDownloadParams;
|
|
47
|
+
export declare function downloadLaunchUiDir(version: string, platform: Platform, arch: string): Promise<string>;
|
|
@@ -1,12 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LibUiFramework = void 0;
|
|
3
|
+
exports.LibUiFramework = exports.LAUNCHUI_DEFAULT_VERSION = void 0;
|
|
4
|
+
exports.validateShellEmbeddable = validateShellEmbeddable;
|
|
5
|
+
exports.getNodeJsDownloadParams = getNodeJsDownloadParams;
|
|
6
|
+
exports.downloadNodeJsBinary = downloadNodeJsBinary;
|
|
7
|
+
exports.fetchNodeJsChecksum = fetchNodeJsChecksum;
|
|
8
|
+
exports.getLaunchUiDownloadParams = getLaunchUiDownloadParams;
|
|
9
|
+
exports.downloadLaunchUiDir = downloadLaunchUiDir;
|
|
4
10
|
const builder_util_1 = require("builder-util");
|
|
5
11
|
const fs_extra_1 = require("fs-extra");
|
|
6
12
|
const promises_1 = require("fs/promises");
|
|
13
|
+
const https = require("https");
|
|
7
14
|
const path = require("path");
|
|
8
15
|
const core_1 = require("../core");
|
|
16
|
+
const electronGet_1 = require("../util/electronGet");
|
|
9
17
|
const plist_1 = require("../util/plist");
|
|
18
|
+
/** Validates that a value is safe to embed in a double-quoted shell string (no metacharacters). */
|
|
19
|
+
function validateShellEmbeddable(value, fieldName) {
|
|
20
|
+
// Allow letters, digits, dots, underscores, hyphens, forward slashes, and spaces.
|
|
21
|
+
// Reject anything that could be interpreted as a shell metacharacter when embedded
|
|
22
|
+
// inside a double-quoted string: $, `, ", \, and newlines.
|
|
23
|
+
if (/[$`"\\\n]/.test(value)) {
|
|
24
|
+
throw new builder_util_1.InvalidConfigurationError(`${fieldName} contains characters that are not safe in shell scripts: ${JSON.stringify(value)}. ` + `Avoid $, backtick, double-quote, backslash, and newline characters.`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// LaunchUI version is independent of the Node.js version; this was the hardcoded default in the Go binary.
|
|
28
|
+
// https://github.com/develar/app-builder/blob/master/pkg/package-format/proton-native/protonNative.go#L105-L136
|
|
29
|
+
exports.LAUNCHUI_DEFAULT_VERSION = "0.1.4-10.13.0";
|
|
30
|
+
// https://github.com/develar/launchui/releases/tag/v0.1.4-10.13.0
|
|
31
|
+
const launchUiChecksums = {
|
|
32
|
+
"launchui-v0.1.4-10.13.0-linux-x64.7z": "4fb5cd8ed79e1e24e0f5cf4b26107f2fa6f6fd8dc48ecd18fb6f48f3ccfe9ee6",
|
|
33
|
+
"launchui-v0.1.4-10.13.0-win32-ia32.7z": "682734da3d817ac365093c6c8ef3d9a70cc3f2a809e4588cb12a311358a68a2d",
|
|
34
|
+
"launchui-v0.1.4-10.13.0-win32-x64.7z": "2f26629c5f5c12baeff272ac7855a1df7f27621cce782b79965f9a9b5eccc359",
|
|
35
|
+
};
|
|
10
36
|
class LibUiFramework {
|
|
11
37
|
constructor(version, macOsProductName, isUseLaunchUi) {
|
|
12
38
|
this.version = version;
|
|
@@ -20,6 +46,7 @@ class LibUiFramework {
|
|
|
20
46
|
this.isCopyElevateHelper = false;
|
|
21
47
|
// noinspection JSUnusedGlobalSymbols
|
|
22
48
|
this.isNpmRebuildRequired = false;
|
|
49
|
+
this.launchUiVersion = exports.LAUNCHUI_DEFAULT_VERSION;
|
|
23
50
|
}
|
|
24
51
|
get distMacOsAppName() {
|
|
25
52
|
return `${this.macOsProductName}.app`;
|
|
@@ -30,20 +57,11 @@ class LibUiFramework {
|
|
|
30
57
|
const platform = packager.platform;
|
|
31
58
|
if (this.isUseLaunchUiForPlatform(platform)) {
|
|
32
59
|
const appOutDir = options.appOutDir;
|
|
33
|
-
await (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"--platform",
|
|
39
|
-
platform.nodeName,
|
|
40
|
-
"--arch",
|
|
41
|
-
options.arch,
|
|
42
|
-
"--stage",
|
|
43
|
-
appOutDir,
|
|
44
|
-
"--executable",
|
|
45
|
-
`${packager.appInfo.productFilename}${platform === core_1.Platform.WINDOWS ? ".exe" : ""}`,
|
|
46
|
-
]);
|
|
60
|
+
const launchUiDir = await downloadLaunchUiDir(this.launchUiVersion, platform, options.arch);
|
|
61
|
+
await (0, fs_extra_1.copy)(launchUiDir, appOutDir);
|
|
62
|
+
const skeletonExe = `launchui${platform === core_1.Platform.WINDOWS ? ".exe" : ""}`;
|
|
63
|
+
const executableName = `${packager.appInfo.productFilename}${platform === core_1.Platform.WINDOWS ? ".exe" : ""}`;
|
|
64
|
+
await (0, promises_1.rename)(path.join(appOutDir, skeletonExe), path.join(appOutDir, executableName));
|
|
47
65
|
return;
|
|
48
66
|
}
|
|
49
67
|
if (platform === core_1.Platform.MAC) {
|
|
@@ -57,25 +75,33 @@ class LibUiFramework {
|
|
|
57
75
|
const appContentsDir = path.join(options.appOutDir, this.distMacOsAppName, "Contents");
|
|
58
76
|
await (0, promises_1.mkdir)(path.join(appContentsDir, "Resources"), { recursive: true });
|
|
59
77
|
await (0, promises_1.mkdir)(path.join(appContentsDir, "MacOS"), { recursive: true });
|
|
60
|
-
|
|
78
|
+
const nodeBinaryMac = await downloadNodeJsBinary(this.version, core_1.Platform.MAC, "x64");
|
|
79
|
+
await (0, promises_1.copyFile)(nodeBinaryMac, path.join(appContentsDir, "MacOS", "node"));
|
|
80
|
+
await (0, promises_1.chmod)(path.join(appContentsDir, "MacOS", "node"), 0o755);
|
|
61
81
|
const appPlist = {
|
|
62
82
|
// https://github.com/albe-rosado/create-proton-app/issues/13
|
|
63
83
|
NSHighResolutionCapable: true,
|
|
64
84
|
};
|
|
65
85
|
await packager.applyCommonInfo(appPlist, appContentsDir);
|
|
66
86
|
await (0, plist_1.savePlistFile)(path.join(appContentsDir, "Info.plist"), appPlist);
|
|
87
|
+
const macMain = options.packager.info.metadata.main || "index.js";
|
|
88
|
+
validateShellEmbeddable(macMain, "package.json main");
|
|
67
89
|
await writeExecutableMain(path.join(appContentsDir, "MacOS", appPlist.CFBundleExecutable), `#!/bin/sh
|
|
68
90
|
DIR=$(dirname "$0")
|
|
69
|
-
"$DIR/node" "$DIR/../Resources/app/${
|
|
91
|
+
"$DIR/node" "$DIR/../Resources/app/${macMain}"
|
|
70
92
|
`);
|
|
71
93
|
}
|
|
72
94
|
async prepareLinuxApplicationStageDirectory(options) {
|
|
73
95
|
const appOutDir = options.appOutDir;
|
|
74
|
-
|
|
96
|
+
const nodeBinaryLinux = await downloadNodeJsBinary(this.version, core_1.Platform.LINUX, options.arch);
|
|
97
|
+
await (0, promises_1.copyFile)(nodeBinaryLinux, path.join(appOutDir, "node"));
|
|
98
|
+
await (0, promises_1.chmod)(path.join(appOutDir, "node"), 0o755);
|
|
75
99
|
const mainPath = path.join(appOutDir, options.packager.executableName);
|
|
100
|
+
const linuxMain = options.packager.info.metadata.main || "index.js";
|
|
101
|
+
validateShellEmbeddable(linuxMain, "package.json main");
|
|
76
102
|
await writeExecutableMain(mainPath, `#!/bin/sh
|
|
77
103
|
DIR=$(dirname "$0")
|
|
78
|
-
"$DIR/node" "$DIR/app/${
|
|
104
|
+
"$DIR/node" "$DIR/app/${linuxMain}"
|
|
79
105
|
`);
|
|
80
106
|
}
|
|
81
107
|
async afterPack(context) {
|
|
@@ -106,4 +132,66 @@ async function writeExecutableMain(file, content) {
|
|
|
106
132
|
await (0, promises_1.writeFile)(file, content, { mode: 0o755 });
|
|
107
133
|
await (0, promises_1.chmod)(file, 0o755);
|
|
108
134
|
}
|
|
135
|
+
function getNodeJsDownloadParams(version, platform, arch) {
|
|
136
|
+
const isWindows = platform === core_1.Platform.WINDOWS;
|
|
137
|
+
const nodePlatform = isWindows ? "win" : platform === core_1.Platform.MAC ? "darwin" : "linux";
|
|
138
|
+
const nodeArch = isWindows && arch === "ia32" ? "x86" : arch;
|
|
139
|
+
const format = isWindows ? "zip" : "tar.gz";
|
|
140
|
+
const filenameWithExt = `node-v${version}-${nodePlatform}-${nodeArch}.${format}`;
|
|
141
|
+
// tar.gz: strip:1 moves node-v.../bin/node → bin/node in extractDir
|
|
142
|
+
// zip: no strip, node.exe lives under the top-level dir node-v{version}-win-{arch}/
|
|
143
|
+
const binaryRelPath = isWindows ? path.join(`node-v${version}-win-${nodeArch}`, "node.exe") : path.join("bin", "node");
|
|
144
|
+
return { releaseName: `nodejs-v${version}`, filenameWithExt, overrideUrl: `https://nodejs.org/dist/v${version}`, binaryRelPath };
|
|
145
|
+
}
|
|
146
|
+
async function downloadNodeJsBinary(version, platform, arch) {
|
|
147
|
+
const { releaseName, filenameWithExt, overrideUrl, binaryRelPath } = getNodeJsDownloadParams(version, platform, arch);
|
|
148
|
+
const sha256 = await fetchNodeJsChecksum(version, filenameWithExt);
|
|
149
|
+
const checksums = { [filenameWithExt]: sha256 };
|
|
150
|
+
const extractDir = await (0, electronGet_1.downloadBuilderToolset)({ releaseName, filenameWithExt, overrideUrl, checksums });
|
|
151
|
+
return path.join(extractDir, binaryRelPath);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Fetches the SHA-256 hex digest for a specific Node.js distribution file from
|
|
155
|
+
* the official nodejs.org SHASUMS256.txt, preventing MITM substitution attacks.
|
|
156
|
+
*/
|
|
157
|
+
async function fetchNodeJsChecksum(version, filename) {
|
|
158
|
+
const url = `https://nodejs.org/dist/v${version}/SHASUMS256.txt`;
|
|
159
|
+
return new Promise((resolve, reject) => {
|
|
160
|
+
https
|
|
161
|
+
.get(url, { headers: { "User-Agent": "electron-builder" } }, res => {
|
|
162
|
+
if (res.statusCode !== 200) {
|
|
163
|
+
res.resume();
|
|
164
|
+
reject(new Error(`HTTP ${res.statusCode} fetching Node.js SHASUMS256.txt for v${version}`));
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const chunks = [];
|
|
168
|
+
res.on("data", (c) => chunks.push(c));
|
|
169
|
+
res.on("end", () => {
|
|
170
|
+
const text = Buffer.concat(chunks).toString("utf8");
|
|
171
|
+
for (const line of text.split("\n")) {
|
|
172
|
+
const m = line.match(/^([0-9a-f]{64})\s+(.+)$/);
|
|
173
|
+
if (m != null && m[2].trim() === filename) {
|
|
174
|
+
resolve(m[1]);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
reject(new Error(`No checksum for ${filename} in Node.js v${version} SHASUMS256.txt`));
|
|
179
|
+
});
|
|
180
|
+
res.on("error", reject);
|
|
181
|
+
})
|
|
182
|
+
.on("error", reject);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function getLaunchUiDownloadParams(version, platform, arch) {
|
|
186
|
+
const launchPlatform = platform === core_1.Platform.MAC ? "mac" : platform === core_1.Platform.WINDOWS ? "win32" : "linux";
|
|
187
|
+
return {
|
|
188
|
+
releaseName: `v${version}`,
|
|
189
|
+
filenameWithExt: `launchui-v${version}-${launchPlatform}-${arch}.7z`,
|
|
190
|
+
githubOrgRepo: "develar/launchui",
|
|
191
|
+
checksums: launchUiChecksums,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
async function downloadLaunchUiDir(version, platform, arch) {
|
|
195
|
+
return (0, electronGet_1.downloadBuilderToolset)(getLaunchUiDownloadParams(version, platform, arch));
|
|
196
|
+
}
|
|
109
197
|
//# sourceMappingURL=LibUiFramework.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibUiFramework.js","sourceRoot":"","sources":["../../src/frameworks/LibUiFramework.ts"],"names":[],"mappings":";;;AAAA,+CAAgD;AAChD,uCAAmC;AACnC,0CAA6D;AAC7D,6BAA4B;AAE5B,kCAAkC;AAIlC,yCAA6C;AAE7C,MAAa,cAAc;IAazB,YACW,OAAe,EACf,gBAAwB,EACd,aAAsB;QAFhC,YAAO,GAAP,OAAO,CAAQ;QACf,qBAAgB,GAAhB,gBAAgB,CAAQ;QACd,kBAAa,GAAb,aAAa,CAAS;QAflC,SAAI,GAAW,OAAO,CAAA;QAC/B,qCAAqC;QAC5B,wBAAmB,GAAG,CAAC,KAAK,CAAC,CAAA;QAE7B,uBAAkB,GAAW,YAAY,CAAA;QAElD,qCAAqC;QAC5B,wBAAmB,GAAG,KAAK,CAAA;QAEpC,qCAAqC;QAC5B,yBAAoB,GAAG,KAAK,CAAA;IAMlC,CAAC;IAEJ,IAAI,gBAAgB;QAClB,OAAO,GAAG,I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F;AApHD,wCAoHC;AAED,KAAK,UAAU,mBAAmB,CAAC,IAAY,EAAE,OAAe;IAC9D,MAAM,IAAA,oBAAS,EAAC,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IAC/C,MAAM,IAAA,gBAAK,EAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC","sourcesContent":["import { executeAppBuilder } from \"builder-util\"\nimport { emptyDir } from \"fs-extra\"\nimport { chmod, mkdir, rename, writeFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { AfterPackContext } from \"../configuration\"\nimport { Platform } from \"../core\"\nimport { Framework, PrepareApplicationStageDirectoryOptions } from \"../Framework\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { MacPackager } from \"../macPackager\"\nimport { savePlistFile } from \"../util/plist\"\n\nexport class LibUiFramework implements Framework {\n readonly name: string = \"libui\"\n // noinspection JSUnusedGlobalSymbols\n readonly macOsDefaultTargets = [\"dmg\"]\n\n readonly defaultAppIdPrefix: string = \"com.libui.\"\n\n // noinspection JSUnusedGlobalSymbols\n readonly isCopyElevateHelper = false\n\n // noinspection JSUnusedGlobalSymbols\n readonly isNpmRebuildRequired = false\n\n constructor(\n readonly version: string,\n readonly macOsProductName: string,\n protected readonly isUseLaunchUi: boolean\n ) {}\n\n get distMacOsAppName(): string {\n return `${this.macOsProductName}.app`\n }\n\n async prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n await emptyDir(options.appOutDir)\n\n const packager = options.packager\n const platform = packager.platform\n\n if (this.isUseLaunchUiForPlatform(platform)) {\n const appOutDir = options.appOutDir\n await executeAppBuilder([\n \"proton-native\",\n \"--node-version\",\n this.version,\n \"--use-launch-ui\",\n \"--platform\",\n platform.nodeName,\n \"--arch\",\n options.arch,\n \"--stage\",\n appOutDir,\n \"--executable\",\n `${packager.appInfo.productFilename}${platform === Platform.WINDOWS ? \".exe\" : \"\"}`,\n ])\n return\n }\n\n if (platform === Platform.MAC) {\n await this.prepareMacosApplicationStageDirectory(packager as MacPackager, options)\n } else if (platform === Platform.LINUX) {\n await this.prepareLinuxApplicationStageDirectory(options)\n }\n }\n\n private async prepareMacosApplicationStageDirectory(packager: MacPackager, options: PrepareApplicationStageDirectoryOptions) {\n const appContentsDir = path.join(options.appOutDir, this.distMacOsAppName, \"Contents\")\n await mkdir(path.join(appContentsDir, \"Resources\"), { recursive: true })\n await mkdir(path.join(appContentsDir, \"MacOS\"), { recursive: true })\n await executeAppBuilder([\"proton-native\", \"--node-version\", this.version, \"--platform\", \"darwin\", \"--stage\", path.join(appContentsDir, \"MacOS\")])\n\n const appPlist: any = {\n // https://github.com/albe-rosado/create-proton-app/issues/13\n NSHighResolutionCapable: true,\n }\n await packager.applyCommonInfo(appPlist, appContentsDir)\n await savePlistFile(path.join(appContentsDir, \"Info.plist\"), appPlist)\n await writeExecutableMain(\n path.join(appContentsDir, \"MacOS\", appPlist.CFBundleExecutable),\n `#!/bin/sh\n DIR=$(dirname \"$0\")\n \"$DIR/node\" \"$DIR/../Resources/app/${options.packager.info.metadata.main || \"index.js\"}\"\n `\n )\n }\n\n private async prepareLinuxApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n const appOutDir = options.appOutDir\n await executeAppBuilder([\"proton-native\", \"--node-version\", this.version, \"--platform\", \"linux\", \"--arch\", options.arch, \"--stage\", appOutDir])\n const mainPath = path.join(appOutDir, (options.packager as LinuxPackager).executableName)\n await writeExecutableMain(\n mainPath,\n `#!/bin/sh\n DIR=$(dirname \"$0\")\n \"$DIR/node\" \"$DIR/app/${options.packager.info.metadata.main || \"index.js\"}\"\n `\n )\n }\n\n async afterPack(context: AfterPackContext) {\n const packager = context.packager\n if (!this.isUseLaunchUiForPlatform(packager.platform)) {\n return\n }\n\n // LaunchUI requires main.js, rename if need\n const userMain = packager.info.metadata.main || \"index.js\"\n if (userMain === \"main.js\") {\n return\n }\n\n await rename(path.join(context.appOutDir, \"app\", userMain), path.join(context.appOutDir, \"app\", \"main.js\"))\n }\n\n getMainFile(platform: Platform): string | null {\n return this.isUseLaunchUiForPlatform(platform) ? \"main.js\" : null\n }\n\n private isUseLaunchUiForPlatform(platform: Platform) {\n return platform === Platform.WINDOWS || (this.isUseLaunchUi && platform === Platform.LINUX)\n }\n\n getExcludedDependencies(platform: Platform): Array<string> | null {\n // part of launchui\n return this.isUseLaunchUiForPlatform(platform) ? [\"libui-node\"] : null\n }\n}\n\nasync function writeExecutableMain(file: string, content: string) {\n await writeFile(file, content, { mode: 0o755 })\n await chmod(file, 0o755)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"LibUiFramework.js","sourceRoot":"","sources":["../../src/frameworks/LibUiFramework.ts"],"names":[],"mappings":";;;AAcA,0DASC;AA+ID,0DAUC;AAED,oDAMC;AAMD,kDA2BC;AASD,8DAQC;AAED,kDAEC;AA9OD,+CAAwD;AACxD,uCAAyC;AACzC,0CAAuE;AACvE,+BAA8B;AAC9B,6BAA4B;AAE5B,kCAAkC;AAIlC,qDAA4D;AAC5D,yCAA6C;AAE7C,mGAAmG;AACnG,SAAgB,uBAAuB,CAAC,KAAa,EAAE,SAAiB;IACtE,kFAAkF;IAClF,mFAAmF;IACnF,2DAA2D;IAC3D,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,wCAAyB,CACjC,GAAG,SAAS,4DAA4D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,GAAG,qEAAqE,CAC1K,CAAA;IACH,CAAC;AACH,CAAC;AAED,2GAA2G;AAC3G,gHAAgH;AACnG,QAAA,wBAAwB,GAAG,eAAe,CAAA;AACvD,kEAAkE;AAClE,MAAM,iBAAiB,GAAG;IACxB,sCAAsC,EAAE,kEAAkE;IAC1G,uCAAuC,EAAE,kEAAkE;IAC3G,sCAAsC,EAAE,kEAAkE;CAC3G,CAAA;AAED,MAAa,cAAc;IAezB,YACW,OAAe,EACf,gBAAwB,EAC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\"\nimport { copy, emptyDir } from \"fs-extra\"\nimport { chmod, copyFile, mkdir, rename, writeFile } from \"fs/promises\"\nimport * as https from \"https\"\nimport * as path from \"path\"\nimport { AfterPackContext } from \"../configuration\"\nimport { Platform } from \"../core\"\nimport { Framework, PrepareApplicationStageDirectoryOptions } from \"../Framework\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { MacPackager } from \"../macPackager\"\nimport { downloadBuilderToolset } from \"../util/electronGet\"\nimport { savePlistFile } from \"../util/plist\"\n\n/** Validates that a value is safe to embed in a double-quoted shell string (no metacharacters). */\nexport function validateShellEmbeddable(value: string, fieldName: string): void {\n // Allow letters, digits, dots, underscores, hyphens, forward slashes, and spaces.\n // Reject anything that could be interpreted as a shell metacharacter when embedded\n // inside a double-quoted string: $, `, \", \\, and newlines.\n if (/[$`\"\\\\\\n]/.test(value)) {\n throw new InvalidConfigurationError(\n `${fieldName} contains characters that are not safe in shell scripts: ${JSON.stringify(value)}. ` + `Avoid $, backtick, double-quote, backslash, and newline characters.`\n )\n }\n}\n\n// LaunchUI version is independent of the Node.js version; this was the hardcoded default in the Go binary.\n// https://github.com/develar/app-builder/blob/master/pkg/package-format/proton-native/protonNative.go#L105-L136\nexport const LAUNCHUI_DEFAULT_VERSION = \"0.1.4-10.13.0\"\n// https://github.com/develar/launchui/releases/tag/v0.1.4-10.13.0\nconst launchUiChecksums = {\n \"launchui-v0.1.4-10.13.0-linux-x64.7z\": \"4fb5cd8ed79e1e24e0f5cf4b26107f2fa6f6fd8dc48ecd18fb6f48f3ccfe9ee6\",\n \"launchui-v0.1.4-10.13.0-win32-ia32.7z\": \"682734da3d817ac365093c6c8ef3d9a70cc3f2a809e4588cb12a311358a68a2d\",\n \"launchui-v0.1.4-10.13.0-win32-x64.7z\": \"2f26629c5f5c12baeff272ac7855a1df7f27621cce782b79965f9a9b5eccc359\",\n}\n\nexport class LibUiFramework implements Framework {\n readonly name: string = \"libui\"\n // noinspection JSUnusedGlobalSymbols\n readonly macOsDefaultTargets = [\"dmg\"]\n\n readonly defaultAppIdPrefix: string = \"com.libui.\"\n\n // noinspection JSUnusedGlobalSymbols\n readonly isCopyElevateHelper = false\n\n // noinspection JSUnusedGlobalSymbols\n readonly isNpmRebuildRequired = false\n\n readonly launchUiVersion: string = LAUNCHUI_DEFAULT_VERSION\n\n constructor(\n readonly version: string,\n readonly macOsProductName: string,\n protected readonly isUseLaunchUi: boolean\n ) {}\n\n get distMacOsAppName(): string {\n return `${this.macOsProductName}.app`\n }\n\n async prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n await emptyDir(options.appOutDir)\n\n const packager = options.packager\n const platform = packager.platform\n\n if (this.isUseLaunchUiForPlatform(platform)) {\n const appOutDir = options.appOutDir\n const launchUiDir = await downloadLaunchUiDir(this.launchUiVersion, platform, options.arch)\n await copy(launchUiDir, appOutDir)\n const skeletonExe = `launchui${platform === Platform.WINDOWS ? \".exe\" : \"\"}`\n const executableName = `${packager.appInfo.productFilename}${platform === Platform.WINDOWS ? \".exe\" : \"\"}`\n await rename(path.join(appOutDir, skeletonExe), path.join(appOutDir, executableName))\n return\n }\n\n if (platform === Platform.MAC) {\n await this.prepareMacosApplicationStageDirectory(packager as MacPackager, options)\n } else if (platform === Platform.LINUX) {\n await this.prepareLinuxApplicationStageDirectory(options)\n }\n }\n\n private async prepareMacosApplicationStageDirectory(packager: MacPackager, options: PrepareApplicationStageDirectoryOptions) {\n const appContentsDir = path.join(options.appOutDir, this.distMacOsAppName, \"Contents\")\n await mkdir(path.join(appContentsDir, \"Resources\"), { recursive: true })\n await mkdir(path.join(appContentsDir, \"MacOS\"), { recursive: true })\n const nodeBinaryMac = await downloadNodeJsBinary(this.version, Platform.MAC, \"x64\")\n await copyFile(nodeBinaryMac, path.join(appContentsDir, \"MacOS\", \"node\"))\n await chmod(path.join(appContentsDir, \"MacOS\", \"node\"), 0o755)\n\n const appPlist: any = {\n // https://github.com/albe-rosado/create-proton-app/issues/13\n NSHighResolutionCapable: true,\n }\n await packager.applyCommonInfo(appPlist, appContentsDir)\n await savePlistFile(path.join(appContentsDir, \"Info.plist\"), appPlist)\n const macMain = options.packager.info.metadata.main || \"index.js\"\n validateShellEmbeddable(macMain, \"package.json main\")\n await writeExecutableMain(\n path.join(appContentsDir, \"MacOS\", appPlist.CFBundleExecutable),\n `#!/bin/sh\n DIR=$(dirname \"$0\")\n \"$DIR/node\" \"$DIR/../Resources/app/${macMain}\"\n `\n )\n }\n\n private async prepareLinuxApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n const appOutDir = options.appOutDir\n const nodeBinaryLinux = await downloadNodeJsBinary(this.version, Platform.LINUX, options.arch)\n await copyFile(nodeBinaryLinux, path.join(appOutDir, \"node\"))\n await chmod(path.join(appOutDir, \"node\"), 0o755)\n const mainPath = path.join(appOutDir, (options.packager as LinuxPackager).executableName)\n const linuxMain = options.packager.info.metadata.main || \"index.js\"\n validateShellEmbeddable(linuxMain, \"package.json main\")\n await writeExecutableMain(\n mainPath,\n `#!/bin/sh\n DIR=$(dirname \"$0\")\n \"$DIR/node\" \"$DIR/app/${linuxMain}\"\n `\n )\n }\n\n async afterPack(context: AfterPackContext) {\n const packager = context.packager\n if (!this.isUseLaunchUiForPlatform(packager.platform)) {\n return\n }\n\n // LaunchUI requires main.js, rename if need\n const userMain = packager.info.metadata.main || \"index.js\"\n if (userMain === \"main.js\") {\n return\n }\n\n await rename(path.join(context.appOutDir, \"app\", userMain), path.join(context.appOutDir, \"app\", \"main.js\"))\n }\n\n getMainFile(platform: Platform): string | null {\n return this.isUseLaunchUiForPlatform(platform) ? \"main.js\" : null\n }\n\n private isUseLaunchUiForPlatform(platform: Platform) {\n return platform === Platform.WINDOWS || (this.isUseLaunchUi && platform === Platform.LINUX)\n }\n\n getExcludedDependencies(platform: Platform): Array<string> | null {\n // part of launchui\n return this.isUseLaunchUiForPlatform(platform) ? [\"libui-node\"] : null\n }\n}\n\nasync function writeExecutableMain(file: string, content: string) {\n await writeFile(file, content, { mode: 0o755 })\n await chmod(file, 0o755)\n}\n\nexport type NodeJsDownloadParams = {\n releaseName: string\n filenameWithExt: string\n overrideUrl: string\n binaryRelPath: string\n}\n\nexport function getNodeJsDownloadParams(version: string, platform: Platform, arch: string): NodeJsDownloadParams {\n const isWindows = platform === Platform.WINDOWS\n const nodePlatform = isWindows ? \"win\" : platform === Platform.MAC ? \"darwin\" : \"linux\"\n const nodeArch = isWindows && arch === \"ia32\" ? \"x86\" : arch\n const format = isWindows ? \"zip\" : \"tar.gz\"\n const filenameWithExt = `node-v${version}-${nodePlatform}-${nodeArch}.${format}`\n // tar.gz: strip:1 moves node-v.../bin/node → bin/node in extractDir\n // zip: no strip, node.exe lives under the top-level dir node-v{version}-win-{arch}/\n const binaryRelPath = isWindows ? path.join(`node-v${version}-win-${nodeArch}`, \"node.exe\") : path.join(\"bin\", \"node\")\n return { releaseName: `nodejs-v${version}`, filenameWithExt, overrideUrl: `https://nodejs.org/dist/v${version}`, binaryRelPath }\n}\n\nexport async function downloadNodeJsBinary(version: string, platform: Platform, arch: string): Promise<string> {\n const { releaseName, filenameWithExt, overrideUrl, binaryRelPath } = getNodeJsDownloadParams(version, platform, arch)\n const sha256 = await fetchNodeJsChecksum(version, filenameWithExt)\n const checksums = { [filenameWithExt]: sha256 }\n const extractDir = await downloadBuilderToolset({ releaseName, filenameWithExt, overrideUrl, checksums })\n return path.join(extractDir, binaryRelPath)\n}\n\n/**\n * Fetches the SHA-256 hex digest for a specific Node.js distribution file from\n * the official nodejs.org SHASUMS256.txt, preventing MITM substitution attacks.\n */\nexport async function fetchNodeJsChecksum(version: string, filename: string): Promise<string> {\n const url = `https://nodejs.org/dist/v${version}/SHASUMS256.txt`\n return new Promise((resolve, reject) => {\n https\n .get(url, { headers: { \"User-Agent\": \"electron-builder\" } }, res => {\n if (res.statusCode !== 200) {\n res.resume()\n reject(new Error(`HTTP ${res.statusCode} fetching Node.js SHASUMS256.txt for v${version}`))\n return\n }\n const chunks: Buffer[] = []\n res.on(\"data\", (c: Buffer) => chunks.push(c))\n res.on(\"end\", () => {\n const text = Buffer.concat(chunks).toString(\"utf8\")\n for (const line of text.split(\"\\n\")) {\n const m = line.match(/^([0-9a-f]{64})\\s+(.+)$/)\n if (m != null && m[2].trim() === filename) {\n resolve(m[1])\n return\n }\n }\n reject(new Error(`No checksum for ${filename} in Node.js v${version} SHASUMS256.txt`))\n })\n res.on(\"error\", reject)\n })\n .on(\"error\", reject)\n })\n}\n\nexport type LaunchUiDownloadParams = {\n releaseName: string\n filenameWithExt: string\n githubOrgRepo: string\n checksums: Record<string, string>\n}\n\nexport function getLaunchUiDownloadParams(version: string, platform: Platform, arch: string): LaunchUiDownloadParams {\n const launchPlatform = platform === Platform.MAC ? \"mac\" : platform === Platform.WINDOWS ? \"win32\" : \"linux\"\n return {\n releaseName: `v${version}`,\n filenameWithExt: `launchui-v${version}-${launchPlatform}-${arch}.7z`,\n githubOrgRepo: \"develar/launchui\",\n checksums: launchUiChecksums,\n }\n}\n\nexport async function downloadLaunchUiDir(version: string, platform: Platform, arch: string): Promise<string> {\n return downloadBuilderToolset(getLaunchUiDownloadParams(version, platform, arch))\n}\n"]}
|
|
@@ -10,14 +10,19 @@ export type PlatformType = "mas" | "mas-dev" | "mac";
|
|
|
10
10
|
export declare class MacTargetHelper {
|
|
11
11
|
private packager;
|
|
12
12
|
constructor(packager: MacPackager);
|
|
13
|
-
handleNullIdentity(
|
|
14
|
-
findSigningIdentity(isMas: boolean, isDevelopment: boolean, qualifier: string | undefined, keychainFile: string | Nullish, config: MacConfiguration | MasConfiguration
|
|
13
|
+
handleNullIdentity(): boolean;
|
|
14
|
+
findSigningIdentity(isMas: boolean, isDevelopment: boolean, qualifier: string | undefined, keychainFile: string | Nullish, config: MacConfiguration | MasConfiguration): Promise<Identity | null>;
|
|
15
15
|
buildSignOptions(appPath: string, identity: Identity, type: SigningDistributionType, isMas: boolean, config: MacConfiguration | MasConfiguration, keychainFile: string | Nullish, arch: Arch): Promise<SignOptions>;
|
|
16
16
|
createMasInstaller(appPath: string, outDir: string, masOptions: MasConfiguration, keychainFile: string | Nullish, isDevelopment: boolean, arch: Arch): Promise<void>;
|
|
17
17
|
getOptionsForFile(appPath: string, isMas: boolean, customSignOptions: MacConfiguration | MasConfiguration): Promise<(filePath: string) => PerFileSignOptions>;
|
|
18
18
|
static getCertificateTypes(isMas: boolean, isDevelopment: boolean): CertType[];
|
|
19
19
|
static isMasTarget(targetName: string): boolean;
|
|
20
20
|
static getPlatformTypeFromTarget(targetName: string): PlatformType;
|
|
21
|
+
/**
|
|
22
|
+
* Returns true when hardened runtime will be active for signing.
|
|
23
|
+
* For non-MAS builds it defaults to on; for MAS it defaults to off.
|
|
24
|
+
*/
|
|
25
|
+
static isHardenedRuntimeEnabledForSigning(isMas: boolean, config: Pick<MacConfiguration | MasConfiguration, "hardenedRuntime">): boolean;
|
|
21
26
|
static assertSafePathForCommandUsage(pathValue: string, description: string): void;
|
|
22
27
|
static getNotarizeOptions(appPath: string): NotarizeOptionsNotaryTool | undefined;
|
|
23
28
|
notarizeIfProvided(appPath: string): Promise<void>;
|