app-builder-lib 26.9.0 → 26.10.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.
Files changed (63) hide show
  1. package/out/binDownload.d.ts +2 -18
  2. package/out/binDownload.js +33 -185
  3. package/out/binDownload.js.map +1 -1
  4. package/out/codeSign/windowsSignAzureManager.d.ts +0 -4
  5. package/out/codeSign/windowsSignAzureManager.js +2 -45
  6. package/out/codeSign/windowsSignAzureManager.js.map +1 -1
  7. package/out/codeSign/windowsSignToolManager.js +1 -1
  8. package/out/codeSign/windowsSignToolManager.js.map +1 -1
  9. package/out/configuration.d.ts +5 -3
  10. package/out/configuration.js.map +1 -1
  11. package/out/electron/ElectronFramework.d.ts +2 -19
  12. package/out/electron/ElectronFramework.js +41 -37
  13. package/out/electron/ElectronFramework.js.map +1 -1
  14. package/out/electron/injectFFMPEG.d.ts +10 -1
  15. package/out/electron/injectFFMPEG.js +48 -34
  16. package/out/electron/injectFFMPEG.js.map +1 -1
  17. package/out/index.d.ts +2 -1
  18. package/out/index.js +1 -1
  19. package/out/index.js.map +1 -1
  20. package/out/macPackager.js +12 -3
  21. package/out/macPackager.js.map +1 -1
  22. package/out/node-module-collector/nodeModulesCollector.js +15 -7
  23. package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
  24. package/out/node-module-collector/pnpmNodeModulesCollector.d.ts +20 -2
  25. package/out/node-module-collector/pnpmNodeModulesCollector.js +59 -11
  26. package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
  27. package/out/packager.d.ts +6 -0
  28. package/out/packager.js +22 -10
  29. package/out/packager.js.map +1 -1
  30. package/out/platformPackager.js +2 -5
  31. package/out/platformPackager.js.map +1 -1
  32. package/out/targets/MsiTarget.js +1 -1
  33. package/out/targets/MsiTarget.js.map +1 -1
  34. package/out/targets/appimage/appImageUtil.d.ts +20 -0
  35. package/out/targets/appimage/appImageUtil.js +24 -19
  36. package/out/targets/appimage/appImageUtil.js.map +1 -1
  37. package/out/targets/appimage/appLauncher.d.ts +1 -1
  38. package/out/targets/appimage/appLauncher.js +7 -3
  39. package/out/targets/appimage/appLauncher.js.map +1 -1
  40. package/out/targets/nsis/nsisUtil.js +2 -2
  41. package/out/targets/nsis/nsisUtil.js.map +1 -1
  42. package/out/toolsets/linux.js +8 -8
  43. package/out/toolsets/linux.js.map +1 -1
  44. package/out/toolsets/windows.d.ts +16 -16
  45. package/out/toolsets/windows.js +29 -21
  46. package/out/toolsets/windows.js.map +1 -1
  47. package/out/util/NodeModuleCopyHelper.js +1 -1
  48. package/out/util/NodeModuleCopyHelper.js.map +1 -1
  49. package/out/util/appFileCopier.js +1 -1
  50. package/out/util/appFileCopier.js.map +1 -1
  51. package/out/util/electronGet.d.ts +56 -0
  52. package/out/util/electronGet.js +330 -0
  53. package/out/util/electronGet.js.map +1 -0
  54. package/out/util/resolve.d.ts +1 -1
  55. package/out/util/resolve.js +6 -1
  56. package/out/util/resolve.js.map +1 -1
  57. package/out/util/yarn.js +2 -1
  58. package/out/util/yarn.js.map +1 -1
  59. package/out/version.d.ts +1 -1
  60. package/out/version.js +1 -1
  61. package/out/version.js.map +1 -1
  62. package/package.json +10 -8
  63. package/scheme.json +61 -2
@@ -1,6 +1,6 @@
1
1
  import { Arch } from "builder-util";
2
2
  import { BeforeBuildContext, Target } from "./core";
3
- import { ElectronBrandingOptions, ElectronDownloadOptions } from "./electron/ElectronFramework";
3
+ import { ElectronBrandingOptions } from "./electron/ElectronFramework";
4
4
  import { PrepareApplicationStageDirectoryOptions } from "./Framework";
5
5
  import { AppXOptions } from "./options/AppXOptions";
6
6
  import { AppImageOptions, DebOptions, FlatpakOptions, LinuxConfiguration, LinuxTargetSpecificOptions } from "./options/linuxOptions";
@@ -16,6 +16,7 @@ import { BuildResult } from "./packager";
16
16
  import { ArtifactBuildStarted, ArtifactCreated } from "./packagerApi";
17
17
  import { PlatformPackager } from "./platformPackager";
18
18
  import { NsisOptions, NsisWebOptions, PortableOptions } from "./targets/nsis/nsisOptions";
19
+ import { ElectronDownloadOptions, ElectronGetOptions } from "./util/electronGet";
19
20
  /**
20
21
  * Configuration Options
21
22
  */
@@ -184,9 +185,10 @@ export interface Configuration extends CommonConfiguration, PlatformSpecificBuil
184
185
  */
185
186
  readonly electronCompile?: boolean;
186
187
  /**
187
- * The [electron-download](https://github.com/electron-userland/electron-download#usage) options.
188
+ * The [electron-download](https://github.com/electron-userland/electron-download#usage) options. (legacy)
189
+ * Alternatively, you can use [electron/get](https://github.com/electron/get#usage) options.
188
190
  */
189
- readonly electronDownload?: ElectronDownloadOptions;
191
+ readonly electronDownload?: ElectronDownloadOptions | ElectronGetOptions | null;
190
192
  /**
191
193
  * The branding used by Electron's distributables. This is needed if a fork has modified Electron's BRANDING.json file.
192
194
  */
@@ -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, ElectronDownloadOptions } from \"./electron/ElectronFramework\"\nimport { PrepareApplicationStageDirectoryOptions } from \"./Framework\"\nimport { AppXOptions } from \"./options/AppXOptions\"\nimport { AppImageOptions, DebOptions, FlatpakOptions, LinuxConfiguration, LinuxTargetSpecificOptions } 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 { 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\"\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 readonly nsis?: NsisOptions | null\n readonly nsisWeb?: NsisWebOptions | null\n readonly portable?: PortableOptions | null\n readonly appx?: AppXOptions | null\n /** @private */\n readonly msi?: MsiOptions | null\n /** @private */\n readonly msiWrapped?: MsiWrappedOptions | null\n readonly squirrelWindows?: SquirrelWindowsOptions | null\n\n /**\n * Options related to how build Linux targets.\n */\n readonly linux?: LinuxConfiguration | null\n /**\n * Debian package options.\n */\n readonly deb?: DebOptions | null\n /**\n * Snap options.\n */\n readonly snap?: SnapOptions | null\n /**\n * AppImage options.\n */\n readonly appImage?: AppImageOptions | null\n /**\n * Flatpak options.\n */\n readonly flatpak?: FlatpakOptions | null\n readonly pacman?: LinuxTargetSpecificOptions | null\n readonly rpm?: LinuxTargetSpecificOptions | null\n readonly freebsd?: LinuxTargetSpecificOptions | null\n readonly p5p?: LinuxTargetSpecificOptions | null\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 */\n readonly electronCompile?: boolean\n\n /**\n * The [electron-download](https://github.com/electron-userland/electron-download#usage) options.\n */\n readonly electronDownload?: ElectronDownloadOptions\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 */\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 */\n readonly launchUiVersion?: boolean | string | null\n\n /**\n * The framework name. One of `electron`, `proton`, `libui`. Defaults to `electron`.\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\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\nexport interface Hooks {\n /**\nThe function (or path to file or module id) to be run before pack.\n\n```typescript\n(context: BeforePackContext): Promise<any> | any\n```\n\n!!! example \"As function\"\n\n ```js\n beforePack: async (context) => {\n // your code\n }\n ```\n\nBecause in a configuration file you cannot use JavaScript, can be specified as a path to file or module id. Function must be exported as default export.\n\n```json\n\"build\": {\n \"beforePack\": \"./myBeforePackHook.js\"\n}\n```\n\nFile `myBeforePackHook.js` in the project root directory:\n\n!!! example \"myBeforePackHook.js\"\n ```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](#afterextract)\n * Same setup as {@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](#afterpack) (but before pack into distributable format and sign).\n * Same setup as {@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](#aftersign) (but before pack into distributable format).\n * Same setup as {@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 on artifact build start.\n * Same setup as {@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 on artifact build completed.\n * Same setup as {@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\n```typescript\n(buildResult: BuildResult): Promise<Array<string>> | Array<string>\n```\n\nConfiguration in the same way as `afterPack` (see above).\n\n!!! example \"myAfterAllArtifactBuild.js\"\n ```js\n exports.default = function () {\n // you can 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](./file-patterns.md#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 } 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 { 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 readonly nsis?: NsisOptions | null\n readonly nsisWeb?: NsisWebOptions | null\n readonly portable?: PortableOptions | null\n readonly appx?: AppXOptions | null\n /** @private */\n readonly msi?: MsiOptions | null\n /** @private */\n readonly msiWrapped?: MsiWrappedOptions | null\n readonly squirrelWindows?: SquirrelWindowsOptions | null\n\n /**\n * Options related to how build Linux targets.\n */\n readonly linux?: LinuxConfiguration | null\n /**\n * Debian package options.\n */\n readonly deb?: DebOptions | null\n /**\n * Snap options.\n */\n readonly snap?: SnapOptions | null\n /**\n * AppImage options.\n */\n readonly appImage?: AppImageOptions | null\n /**\n * Flatpak options.\n */\n readonly flatpak?: FlatpakOptions | null\n readonly pacman?: LinuxTargetSpecificOptions | null\n readonly rpm?: LinuxTargetSpecificOptions | null\n readonly freebsd?: LinuxTargetSpecificOptions | null\n readonly p5p?: LinuxTargetSpecificOptions | null\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 */\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 */\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 */\n readonly launchUiVersion?: boolean | string | null\n\n /**\n * The framework name. One of `electron`, `proton`, `libui`. Defaults to `electron`.\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\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\nexport interface Hooks {\n /**\nThe function (or path to file or module id) to be run before pack.\n\n```typescript\n(context: BeforePackContext): Promise<any> | any\n```\n\n!!! example \"As function\"\n\n ```js\n beforePack: async (context) => {\n // your code\n }\n ```\n\nBecause in a configuration file you cannot use JavaScript, can be specified as a path to file or module id. Function must be exported as default export.\n\n```json\n\"build\": {\n \"beforePack\": \"./myBeforePackHook.js\"\n}\n```\n\nFile `myBeforePackHook.js` in the project root directory:\n\n!!! example \"myBeforePackHook.js\"\n ```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](#afterextract)\n * Same setup as {@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](#afterpack) (but before pack into distributable format and sign).\n * Same setup as {@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](#aftersign) (but before pack into distributable format).\n * Same setup as {@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 on artifact build start.\n * Same setup as {@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 on artifact build completed.\n * Same setup as {@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\n```typescript\n(buildResult: BuildResult): Promise<Array<string>> | Array<string>\n```\n\nConfiguration in the same way as `afterPack` (see above).\n\n!!! example \"myAfterAllArtifactBuild.js\"\n ```js\n exports.default = function () {\n // you can 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](./file-patterns.md#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,6 +1,8 @@
1
1
  import { Configuration } from "../configuration";
2
2
  import { Framework } from "../Framework";
3
3
  import { Packager } from "../index";
4
+ import { ElectronDownloadOptions } from "../util/electronGet";
5
+ export { ElectronDownloadOptions };
4
6
  export type ElectronPlatformName = "darwin" | "linux" | "win32" | "mas";
5
7
  /**
6
8
  * Electron distributables branding options.
@@ -11,23 +13,4 @@ export interface ElectronBrandingOptions {
11
13
  productName?: string;
12
14
  }
13
15
  export declare function createBrandingOpts(opts: Configuration): Required<ElectronBrandingOptions>;
14
- export interface ElectronDownloadOptions {
15
- version?: string;
16
- /**
17
- * The [cache location](https://github.com/electron-userland/electron-download#cache-location).
18
- */
19
- cache?: string | null;
20
- /**
21
- * The mirror.
22
- */
23
- mirror?: string | null;
24
- /** @private */
25
- customDir?: string | null;
26
- /** @private */
27
- customFilename?: string | null;
28
- strictSSL?: boolean;
29
- isVerifyChecksum?: boolean;
30
- platform?: ElectronPlatformName;
31
- arch?: string;
32
- }
33
16
  export declare function createElectronFrameworkSupport(configuration: Configuration, packager: Packager): Promise<Framework>;
@@ -9,6 +9,7 @@ const tiny_async_pool_1 = require("tiny-async-pool");
9
9
  const index_1 = require("../index");
10
10
  const pathManager_1 = require("../util/pathManager");
11
11
  const resolve_1 = require("../util/resolve");
12
+ const electronGet_1 = require("../util/electronGet");
12
13
  const electronMac_1 = require("./electronMac");
13
14
  const electronVersion_1 = require("./electronVersion");
14
15
  const electronWin_1 = require("./electronWin");
@@ -21,12 +22,18 @@ function createBrandingOpts(opts) {
21
22
  };
22
23
  }
23
24
  function createDownloadOpts(opts, platform, arch, electronVersion) {
24
- return {
25
- platform,
26
- arch,
27
- version: electronVersion,
28
- ...opts.electronDownload,
29
- };
25
+ var _a;
26
+ const base = { platform, arch, version: electronVersion };
27
+ const dl = opts.electronDownload;
28
+ if (dl == null) {
29
+ return base;
30
+ }
31
+ if (Object.hasOwnProperty.call(dl, "mirrorOptions")) {
32
+ // ElectronGetOptions: flatten mirrorOptions.mirror for the app-builder binary
33
+ const { mirrorOptions } = dl;
34
+ return { ...base, mirror: (_a = mirrorOptions === null || mirrorOptions === void 0 ? void 0 : mirrorOptions.mirror) !== null && _a !== void 0 ? _a : undefined };
35
+ }
36
+ return { ...base, ...dl };
30
37
  }
31
38
  async function beforeCopyExtraFiles(options) {
32
39
  const { appOutDir, packager } = options;
@@ -120,7 +127,8 @@ class ElectronFramework {
120
127
  const shouldCleanup = await unpack(options, downloadOptions, this.distMacOsAppName);
121
128
  await cleanupAfterUnpack(options, this.distMacOsAppName, shouldCleanup);
122
129
  if (options.packager.config.downloadAlternateFFmpeg) {
123
- await (0, injectFFMPEG_1.default)(options, this.version);
130
+ const injector = new injectFFMPEG_1.FFMPEGInjector(options, this.version, createBrandingOpts(options.packager.config));
131
+ await injector.inject();
124
132
  }
125
133
  }
126
134
  beforeCopyExtraFiles(options) {
@@ -149,21 +157,8 @@ async function createElectronFrameworkSupport(configuration, packager) {
149
157
  * Unpacks a custom or default Electron distribution into the app output directory.
150
158
  */
151
159
  async function unpack(prepareOptions, downloadOptions, distMacOsAppName) {
152
- const downloadUsingAdjustedConfig = (options) => {
153
- return (0, builder_util_1.executeAppBuilder)(["unpack-electron", "--configuration", JSON.stringify([options]), "--output", appOutDir, "--distMacOsAppName", distMacOsAppName]);
154
- };
155
- const copyUnpackedElectronDistribution = async (folderPath) => {
156
- builder_util_1.log.info({ electronDist: builder_util_1.log.filePath(folderPath) }, "using custom unpacked Electron distribution");
157
- const source = packager.getElectronSrcDir(folderPath);
158
- const destination = packager.getElectronDestinationDir(appOutDir);
159
- builder_util_1.log.info({ source, destination }, "copying unpacked Electron");
160
- await (0, fs_extra_1.emptyDir)(appOutDir);
161
- await (0, builder_util_1.copyDir)(source, destination, {
162
- isUseHardLink: builder_util_1.DO_NOT_USE_HARD_LINKS,
163
- });
164
- return false;
165
- };
166
- const selectElectron = async (filepath) => {
160
+ var _a, _b, _c;
161
+ async function selectElectron(filepath) {
167
162
  const resolvedDist = path.isAbsolute(filepath) ? filepath : path.resolve(packager.projectDir, filepath);
168
163
  const electronDistStats = await (0, builder_util_1.statOrNull)(resolvedDist);
169
164
  if (!electronDistStats) {
@@ -171,11 +166,8 @@ async function unpack(prepareOptions, downloadOptions, distMacOsAppName) {
171
166
  }
172
167
  if (resolvedDist.endsWith(".zip")) {
173
168
  builder_util_1.log.info({ zipFile: resolvedDist }, "using custom electronDist zip file");
174
- await downloadUsingAdjustedConfig({
175
- ...downloadOptions,
176
- cache: path.dirname(resolvedDist), // set custom directory to the zip file's directory
177
- customFilename: path.basename(resolvedDist), // set custom filename to the zip file's name
178
- });
169
+ await (0, fs_extra_1.emptyDir)(appOutDir);
170
+ await (0, builder_util_1.exec)(await (0, builder_util_1.getPath7za)(), ["x", "-bd", resolvedDist, `-o${appOutDir}`, "-y"]);
179
171
  return false; // do not clean up after unpacking, it's a custom bundle and we should respect its configuration/contents as required
180
172
  }
181
173
  if (electronDistStats.isDirectory()) {
@@ -183,19 +175,23 @@ async function unpack(prepareOptions, downloadOptions, distMacOsAppName) {
183
175
  const files = await (0, fs_extra_1.readdir)(resolvedDist);
184
176
  if (files.includes(defaultZipName)) {
185
177
  builder_util_1.log.info({ electronDist: builder_util_1.log.filePath(resolvedDist) }, "using custom electronDist directory");
186
- await downloadUsingAdjustedConfig({
187
- ...downloadOptions,
188
- cache: resolvedDist,
189
- customFilename: defaultZipName,
190
- });
191
- return false;
178
+ await (0, electronGet_1.extractArchive)(path.join(resolvedDist, defaultZipName), appOutDir);
179
+ return false; // do not clean up after unpacking, it's a custom bundle and we should respect its configuration/contents as required
192
180
  }
193
181
  // if we reach here, it means the provided electronDist is neither a zip file nor a directory with the default zip file
194
182
  // e.g. we treat it as a custom already-unpacked Electron distribution
195
- return await copyUnpackedElectronDistribution(resolvedDist);
183
+ builder_util_1.log.info({ electronDist: builder_util_1.log.filePath(resolvedDist) }, "using custom unpacked Electron distribution");
184
+ const source = packager.getElectronSrcDir(resolvedDist);
185
+ const destination = packager.getElectronDestinationDir(prepareOptions.appOutDir);
186
+ builder_util_1.log.info({ source, destination }, "copying unpacked Electron");
187
+ await (0, fs_extra_1.emptyDir)(prepareOptions.appOutDir);
188
+ await (0, builder_util_1.copyDir)(source, destination, {
189
+ isUseHardLink: builder_util_1.DO_NOT_USE_HARD_LINKS,
190
+ });
191
+ return false;
196
192
  }
197
193
  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.`);
198
- };
194
+ }
199
195
  const { packager, appOutDir, platformName } = prepareOptions;
200
196
  const { version, arch } = downloadOptions;
201
197
  const defaultZipName = `electron-v${version}-${platformName}-${arch}.zip`;
@@ -205,7 +201,7 @@ async function unpack(prepareOptions, downloadOptions, distMacOsAppName) {
205
201
  }
206
202
  let resolvedDist = null;
207
203
  try {
208
- const electronDistHook = await (0, resolve_1.resolveFunction)(packager.appInfo.type, electronDist, "electronDist");
204
+ const electronDistHook = await (0, resolve_1.resolveFunction)(packager.appInfo.type, electronDist, "electronDist", await packager.info.getWorkspaceRoot());
209
205
  resolvedDist = typeof electronDistHook === "function" ? await Promise.resolve(electronDistHook(prepareOptions)) : electronDistHook;
210
206
  }
211
207
  catch (error) {
@@ -214,7 +210,15 @@ async function unpack(prepareOptions, downloadOptions, distMacOsAppName) {
214
210
  if (resolvedDist == null) {
215
211
  // if no custom electronDist is provided, use the default unpack logic
216
212
  builder_util_1.log.debug(null, "no custom electronDist provided, unpacking default Electron distribution");
217
- await downloadUsingAdjustedConfig(downloadOptions);
213
+ const zipPath = await (0, electronGet_1.downloadElectronArtifactZip)({
214
+ electronDownload: downloadOptions,
215
+ artifactName: "electron",
216
+ platformName: (_a = downloadOptions.platform) !== null && _a !== void 0 ? _a : prepareOptions.platformName,
217
+ arch: (_b = downloadOptions.arch) !== null && _b !== void 0 ? _b : prepareOptions.arch,
218
+ version: (_c = downloadOptions.version) !== null && _c !== void 0 ? _c : prepareOptions.version,
219
+ });
220
+ await (0, electronGet_1.extractArchive)(zipPath, appOutDir);
221
+ builder_util_1.log.info({ output: appOutDir }, "downloaded electron zip extracted successfully");
218
222
  return true; // indicates that we should clean up after unpacking
219
223
  }
220
224
  return selectElectron(resolvedDist);
@@ -1 +1 @@
1
- {"version":3,"file":"ElectronFramework.js","sourceRoot":"","sources":["../../src/electron/ElectronFramework.ts"],"names":[],"mappings":";;AA2BA,gDAKC;AAmJD,wEAiBC;AApMD,+CAA8J;AAC9J,uCAAwD;AACxD,6BAA4B;AAC5B,qDAAuC;AAGvC,oCAA6C;AAG7C,qDAAqD;AACrD,6CAAiD;AACjD,+CAA4C;AAC5C,uDAA2F;AAC3F,+CAAmD;AACnD,iDAAyC;AAazC,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;AA6BD,SAAS,kBAAkB,CAAC,IAAmB,EAAE,QAA8B,EAAE,IAAY,EAAE,eAAuB;IACpH,OAAO;QACL,QAAQ;QACR,IAAI;QACJ,OAAO,EAAE,eAAe;QACxB,GAAG,IAAI,CAAC,gBAAgB;KACzB,CAAA;AACH,CAAC;AAED,KAAK,UAAU,oBAAoB,CAAC,OAAoC;IACtE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;IACvC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC5D,IAAI,QAAQ,CAAC,QAAQ,KAAK,gBAAQ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AG,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;gBACnF,YAAY;YACd,CAAC,CAAC;KACP,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { asArray, copyDir, DO_NOT_USE_HARD_LINKS, executeAppBuilder, 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 { createMacApp } from \"./electronMac\"\nimport { computeElectronVersion, getElectronVersionFromInstalled } from \"./electronVersion\"\nimport { addWinAsarIntegrity } from \"./electronWin\"\nimport injectFFMPEG from \"./injectFFMPEG\"\n\nexport type ElectronPlatformName = \"darwin\" | \"linux\" | \"win32\" | \"mas\"\n\n/**\n * Electron distributables branding options.\n * @see [Electron BRANDING.json](https://github.com/electron/electron/blob/master/shell/app/BRANDING.json).\n */\nexport interface ElectronBrandingOptions {\n projectName?: string\n productName?: string\n}\n\nexport function createBrandingOpts(opts: Configuration): Required<ElectronBrandingOptions> {\n return {\n projectName: opts.electronBranding?.projectName || \"electron\",\n productName: opts.electronBranding?.productName || \"Electron\",\n }\n}\n\nexport interface ElectronDownloadOptions {\n // https://github.com/electron-userland/electron-builder/issues/3077\n // must be optional\n version?: string\n\n /**\n * The [cache location](https://github.com/electron-userland/electron-download#cache-location).\n */\n cache?: string | null\n\n /**\n * The mirror.\n */\n mirror?: string | null\n\n /** @private */\n customDir?: string | null\n /** @private */\n customFilename?: string | null\n\n strictSSL?: boolean\n isVerifyChecksum?: boolean\n\n platform?: ElectronPlatformName\n arch?: string\n}\n\nfunction createDownloadOpts(opts: Configuration, platform: ElectronPlatformName, arch: string, electronVersion: string): ElectronDownloadOptions {\n return {\n platform,\n arch,\n version: electronVersion,\n ...opts.electronDownload,\n }\n}\n\nasync function beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n const { appOutDir, packager } = options\n const electronBranding = createBrandingOpts(packager.config)\n if (packager.platform === Platform.LINUX) {\n const linuxPackager = packager as LinuxPackager\n const executable = path.join(appOutDir, linuxPackager.executableName)\n await rename(path.join(appOutDir, electronBranding.projectName), executable)\n } else if (packager.platform === Platform.WINDOWS) {\n const executable = path.join(appOutDir, `${packager.appInfo.productFilename}.exe`)\n await rename(path.join(appOutDir, `${electronBranding.projectName}.exe`), executable)\n if (options.asarIntegrity) {\n await addWinAsarIntegrity(executable, options.asarIntegrity)\n }\n } else {\n await createMacApp(packager as MacPackager, appOutDir, options.asarIntegrity, (options.platformName as ElectronPlatformName) === \"mas\")\n }\n await removeUnusedLanguagesIfNeeded(options)\n}\n\nasync function removeUnusedLanguagesIfNeeded(options: BeforeCopyExtraFilesOptions) {\n const { 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 distMacOsAppName: string\n ) {}\n\n getDefaultIcon(platform: Platform) {\n if (platform === Platform.LINUX) {\n return path.join(getTemplatePath(\"icons\"), \"electron-linux\")\n } else {\n // default icon is embedded into app skeleton\n return null\n }\n }\n\n async prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n 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 await injectFFMPEG(options, this.version)\n }\n }\n\n beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n return beforeCopyExtraFiles(options)\n }\n}\n\nexport async function createElectronFrameworkSupport(configuration: Configuration, packager: Packager): Promise<Framework> {\n let version = configuration.electronVersion\n if (version == null) {\n // for prepacked app asar no dev deps in the app.asar\n if (packager.isPrepackedAppAsar) {\n version = await getElectronVersionFromInstalled(packager.projectDir)\n if (version == null) {\n throw new Error(`Cannot compute electron version for prepacked asar`)\n }\n } else {\n version = await computeElectronVersion(packager.projectDir)\n }\n configuration.electronVersion = version\n }\n\n const branding = createBrandingOpts(configuration)\n return new ElectronFramework(branding.projectName, version, `${branding.productName}.app`)\n}\n\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 const downloadUsingAdjustedConfig = (options: ElectronDownloadOptions) => {\n return executeAppBuilder([\"unpack-electron\", \"--configuration\", JSON.stringify([options]), \"--output\", appOutDir, \"--distMacOsAppName\", distMacOsAppName])\n }\n\n const copyUnpackedElectronDistribution = async (folderPath: string) => {\n log.info({ electronDist: log.filePath(folderPath) }, \"using custom unpacked Electron distribution\")\n const source = packager.getElectronSrcDir(folderPath)\n const destination = packager.getElectronDestinationDir(appOutDir)\n log.info({ source, destination }, \"copying unpacked Electron\")\n await emptyDir(appOutDir)\n await copyDir(source, destination, {\n isUseHardLink: DO_NOT_USE_HARD_LINKS,\n })\n return false\n }\n\n const selectElectron = async (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 downloadUsingAdjustedConfig({\n ...downloadOptions,\n cache: path.dirname(resolvedDist), // set custom directory to the zip file's directory\n customFilename: path.basename(resolvedDist), // set custom filename to the zip file's name\n })\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 downloadUsingAdjustedConfig({\n ...downloadOptions,\n cache: resolvedDist,\n customFilename: defaultZipName,\n })\n return false\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 return await copyUnpackedElectronDistribution(resolvedDist)\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\")\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 await downloadUsingAdjustedConfig(downloadOptions)\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;AA8HD,wEAiBC;AAjLD,+CAA6J;AAC7J,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,IAA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,gBAAgB,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IAErH,OAAO,OAAO,CAAC,GAAG,CAAC;QACjB,aAAa,CAAC,CAAC,CAAC,IAAA,6BAAc,EAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;QAChG,aAAa,CAAC,CAAC,CAAC,IAAA,6BAAc,EAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;QAC7E,KAAK;YACH,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;YACnB,CAAC,CAAC,IAAA,iBAAM,EAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;gBACnF,YAAY;YACd,CAAC,CAAC;KACP,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { asArray, copyDir, DO_NOT_USE_HARD_LINKS, exec, getPath7za, 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 distMacOsAppName: string\n ) {}\n\n getDefaultIcon(platform: Platform) {\n if (platform === Platform.LINUX) {\n return path.join(getTemplatePath(\"icons\"), \"electron-linux\")\n } else {\n // default icon is embedded into app skeleton\n return null\n }\n }\n\n async prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n 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}.app`)\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 await exec(await getPath7za(), [\"x\", \"-bd\", resolvedDist, `-o${appOutDir}`, \"-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,2 +1,11 @@
1
1
  import { PrepareApplicationStageDirectoryOptions } from "../Framework";
2
- export default function injectFFMPEG(options: PrepareApplicationStageDirectoryOptions, electrionVersion: string): Promise<string>;
2
+ import { ElectronBrandingOptions } from "./ElectronFramework";
3
+ export declare class FFMPEGInjector {
4
+ private readonly options;
5
+ private readonly electronVersion;
6
+ private readonly branding;
7
+ constructor(options: PrepareApplicationStageDirectoryOptions, electronVersion: string, branding: Required<ElectronBrandingOptions>);
8
+ inject(): Promise<string>;
9
+ private downloadFFMPEG;
10
+ private copyFFMPEG;
11
+ }
@@ -1,43 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = injectFFMPEG;
4
- const fs = require("fs");
5
- const path = require("path");
3
+ exports.FFMPEGInjector = void 0;
6
4
  const builder_util_1 = require("builder-util");
7
- const binDownload_1 = require("../binDownload");
8
- // NOTE: Adapted from https://github.com/MarshallOfSound/electron-packager-plugin-non-proprietary-codecs-ffmpeg to resolve dependency vulnerabilities
9
- const downloadFFMPEG = async (electronVersion, platform, arch) => {
10
- const ffmpegFileName = `ffmpeg-v${electronVersion}-${platform}-${arch}.zip`;
11
- const url = `https://github.com/electron/electron/releases/download/v${electronVersion}/${ffmpegFileName}`;
12
- builder_util_1.log.info({ file: ffmpegFileName }, "downloading non-proprietary FFMPEG");
13
- return (0, binDownload_1.getBin)(ffmpegFileName, url);
14
- };
15
- const copyFFMPEG = (targetPath, platform) => (sourcePath) => {
16
- let fileName = "ffmpeg.dll";
17
- if (["darwin", "mas"].includes(platform)) {
18
- fileName = "libffmpeg.dylib";
19
- }
20
- else if (platform === "linux") {
21
- fileName = "libffmpeg.so";
5
+ const fs = require("fs-extra");
6
+ const path = require("path");
7
+ const core_1 = require("../core");
8
+ const electronGet_1 = require("../util/electronGet");
9
+ class FFMPEGInjector {
10
+ constructor(options, electronVersion, branding) {
11
+ this.options = options;
12
+ this.electronVersion = electronVersion;
13
+ this.branding = branding;
22
14
  }
23
- const libPath = path.resolve(sourcePath, fileName);
24
- const libTargetPath = path.resolve(targetPath, fileName);
25
- builder_util_1.log.info({ lib: builder_util_1.log.filePath(libPath), target: builder_util_1.log.filePath(libTargetPath) }, "copying non-proprietary FFMPEG");
26
- // If the source doesn't exist we have a problem
27
- if (!fs.existsSync(libPath)) {
28
- throw new Error(`Failed to find FFMPEG library file at path: ${libPath}`);
15
+ async inject() {
16
+ const libPath = this.options.platformName === core_1.Platform.MAC.nodeName
17
+ ? path.join(this.options.appOutDir, `${this.branding.productName}.app`, "Contents", "Frameworks", `${this.branding.productName} Framework.framework`, "Versions", "A", "Libraries")
18
+ : this.options.appOutDir;
19
+ const ffmpegDir = await this.downloadFFMPEG();
20
+ return this.copyFFMPEG(libPath, ffmpegDir);
29
21
  }
30
- // If we are copying to the source we can stop immediately
31
- if (libPath !== libTargetPath) {
32
- fs.copyFileSync(libPath, libTargetPath);
22
+ async downloadFFMPEG() {
23
+ const ffmpegFileName = `ffmpeg-v${this.electronVersion}-${this.options.platformName}-${this.options.arch}`;
24
+ builder_util_1.log.info({ ffmpegFileName }, "downloading");
25
+ const { packager: { config: { electronDownload }, }, platformName, arch, } = this.options;
26
+ return (0, electronGet_1.downloadElectronArtifact)({
27
+ electronDownload,
28
+ artifactName: "ffmpeg",
29
+ platformName,
30
+ arch,
31
+ version: this.electronVersion,
32
+ });
33
33
  }
34
- return libTargetPath;
35
- };
36
- function injectFFMPEG(options, electrionVersion) {
37
- let libPath = options.appOutDir;
38
- if (options.platformName === "darwin") {
39
- libPath = path.resolve(options.appOutDir, "Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries");
34
+ async copyFFMPEG(targetPath, sourcePath) {
35
+ let fileName = "ffmpeg.dll";
36
+ if (["darwin", "mas"].includes(this.options.platformName)) {
37
+ fileName = "libffmpeg.dylib";
38
+ }
39
+ else if (this.options.platformName === "linux") {
40
+ fileName = "libffmpeg.so";
41
+ }
42
+ const libPath = path.resolve(sourcePath, fileName);
43
+ const libTargetPath = path.resolve(targetPath, fileName);
44
+ builder_util_1.log.info({ lib: builder_util_1.log.filePath(libPath), target: libTargetPath }, "copying non-proprietary FFMPEG");
45
+ // If the source doesn't exist we have a problem
46
+ if (!fs.existsSync(libPath)) {
47
+ throw new Error(`Failed to find FFMPEG library file at path: ${libPath}`);
48
+ }
49
+ // If we are copying to the source we can stop immediately
50
+ if (libPath !== libTargetPath) {
51
+ await fs.copyFile(libPath, libTargetPath);
52
+ }
53
+ return libTargetPath;
40
54
  }
41
- return downloadFFMPEG(electrionVersion, options.platformName, options.arch).then(copyFFMPEG(libPath, options.platformName));
42
55
  }
56
+ exports.FFMPEGInjector = FFMPEGInjector;
43
57
  //# sourceMappingURL=injectFFMPEG.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"injectFFMPEG.js","sourceRoot":"","sources":["../../src/electron/injectFFMPEG.ts"],"names":[],"mappings":";;AAyCA,+BAOC;AAhDD,yBAAwB;AACxB,6BAA4B;AAG5B,+CAAkC;AAClC,gDAAuC;AAGvC,qJAAqJ;AACrJ,MAAM,cAAc,GAAG,KAAK,EAAE,eAAuB,EAAE,QAA8B,EAAE,IAAY,EAAE,EAAE;IACrG,MAAM,cAAc,GAAG,WAAW,eAAe,IAAI,QAAQ,IAAI,IAAI,MAAM,CAAA;IAC3E,MAAM,GAAG,GAAG,2DAA2D,eAAe,IAAI,cAAc,EAAE,CAAA;IAE1G,kBAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,oCAAoC,CAAC,CAAA;IACxE,OAAO,IAAA,oBAAM,EAAC,cAAc,EAAE,GAAG,CAAC,CAAA;AACpC,CAAC,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,UAAkB,EAAE,QAA8B,EAAE,EAAE,CAAC,CAAC,UAAkB,EAAE,EAAE;IAChG,IAAI,QAAQ,GAAG,YAAY,CAAA;IAC3B,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzC,QAAQ,GAAG,iBAAiB,CAAA;IAC9B,CAAC;SAAM,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QAChC,QAAQ,GAAG,cAAc,CAAA;IAC3B,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IAClD,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IACxD,kBAAG,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,kBAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,kBAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,EAAE,gCAAgC,CAAC,CAAA;IAE/G,gDAAgD;IAChD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,+CAA+C,OAAO,EAAE,CAAC,CAAA;IAC3E,CAAC;IAED,0DAA0D;IAC1D,IAAI,OAAO,KAAK,aAAa,EAAE,CAAC;QAC9B,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;IACzC,CAAC;IACD,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA;AAED,SAAwB,YAAY,CAAC,OAAgD,EAAE,gBAAwB;IAC7G,IAAI,OAAO,GAAG,OAAO,CAAC,SAAS,CAAA;IAC/B,IAAI,OAAO,CAAC,YAAY,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,oFAAoF,CAAC,CAAA;IACjI,CAAC;IAED,OAAO,cAAc,CAAC,gBAAgB,EAAE,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAA;AAC7H,CAAC","sourcesContent":["import * as fs from \"fs\"\nimport * as path from \"path\"\nimport { ElectronPlatformName } from \"./ElectronFramework\"\n\nimport { log } from \"builder-util\"\nimport { getBin } from \"../binDownload\"\nimport { PrepareApplicationStageDirectoryOptions } from \"../Framework\"\n\n// NOTE: Adapted from https://github.com/MarshallOfSound/electron-packager-plugin-non-proprietary-codecs-ffmpeg to resolve dependency vulnerabilities\nconst downloadFFMPEG = async (electronVersion: string, platform: ElectronPlatformName, arch: string) => {\n const ffmpegFileName = `ffmpeg-v${electronVersion}-${platform}-${arch}.zip`\n const url = `https://github.com/electron/electron/releases/download/v${electronVersion}/${ffmpegFileName}`\n\n log.info({ file: ffmpegFileName }, \"downloading non-proprietary FFMPEG\")\n return getBin(ffmpegFileName, url)\n}\n\nconst copyFFMPEG = (targetPath: string, platform: ElectronPlatformName) => (sourcePath: string) => {\n let fileName = \"ffmpeg.dll\"\n if ([\"darwin\", \"mas\"].includes(platform)) {\n fileName = \"libffmpeg.dylib\"\n } else if (platform === \"linux\") {\n fileName = \"libffmpeg.so\"\n }\n\n const libPath = path.resolve(sourcePath, fileName)\n const libTargetPath = path.resolve(targetPath, fileName)\n log.info({ lib: log.filePath(libPath), target: log.filePath(libTargetPath) }, \"copying non-proprietary FFMPEG\")\n\n // If the source doesn't exist we have a problem\n if (!fs.existsSync(libPath)) {\n throw new Error(`Failed to find FFMPEG library file at path: ${libPath}`)\n }\n\n // If we are copying to the source we can stop immediately\n if (libPath !== libTargetPath) {\n fs.copyFileSync(libPath, libTargetPath)\n }\n return libTargetPath\n}\n\nexport default function injectFFMPEG(options: PrepareApplicationStageDirectoryOptions, electrionVersion: string) {\n let libPath = options.appOutDir\n if (options.platformName === \"darwin\") {\n libPath = path.resolve(options.appOutDir, \"Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries\")\n }\n\n return downloadFFMPEG(electrionVersion, options.platformName, options.arch).then(copyFFMPEG(libPath, options.platformName))\n}\n"]}
1
+ {"version":3,"file":"injectFFMPEG.js","sourceRoot":"","sources":["../../src/electron/injectFFMPEG.ts"],"names":[],"mappings":";;;AAAA,+CAAkC;AAClC,+BAA8B;AAC9B,6BAA4B;AAC5B,kCAAkC;AAElC,qDAA8D;AAG9D,MAAa,cAAc;IACzB,YACmB,OAAgD,EAChD,eAAuB,EACvB,QAA2C;QAF3C,YAAO,GAAP,OAAO,CAAyC;QAChD,oBAAe,GAAf,eAAe,CAAQ;QACvB,aAAQ,GAAR,QAAQ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C,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YAC1D,QAAQ,GAAG,iBAAiB,CAAA;QAC9B,CAAC;aAAM,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,KAAK,OAAO,EAAE,CAAC;YACjD,QAAQ,GAAG,cAAc,CAAA;QAC3B,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;QAClD,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;QACxD,kBAAG,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,kBAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,gCAAgC,CAAC,CAAA;QAEjG,gDAAgD;QAChD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,+CAA+C,OAAO,EAAE,CAAC,CAAA;QAC3E,CAAC;QAED,0DAA0D;QAC1D,IAAI,OAAO,KAAK,aAAa,EAAE,CAAC;YAC9B,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;QAC3C,CAAC;QACD,OAAO,aAAa,CAAA;IACtB,CAAC;CACF;AAvED,wCAuEC","sourcesContent":["import { log } from \"builder-util\"\nimport * as fs from \"fs-extra\"\nimport * as path from \"path\"\nimport { Platform } from \"../core\"\nimport { PrepareApplicationStageDirectoryOptions } from \"../Framework\"\nimport { downloadElectronArtifact } from \"../util/electronGet\"\nimport { ElectronBrandingOptions } from \"./ElectronFramework\"\n\nexport class FFMPEGInjector {\n constructor(\n private readonly options: PrepareApplicationStageDirectoryOptions,\n private readonly electronVersion: string,\n private readonly branding: Required<ElectronBrandingOptions>\n ) {}\n\n async inject() {\n const libPath =\n this.options.platformName === Platform.MAC.nodeName\n ? path.join(\n this.options.appOutDir,\n `${this.branding.productName}.app`,\n \"Contents\",\n \"Frameworks\",\n `${this.branding.productName} Framework.framework`,\n \"Versions\",\n \"A\",\n \"Libraries\"\n )\n : this.options.appOutDir\n\n const ffmpegDir = await this.downloadFFMPEG()\n return this.copyFFMPEG(libPath, ffmpegDir)\n }\n\n private async downloadFFMPEG(): Promise<string> {\n const ffmpegFileName = `ffmpeg-v${this.electronVersion}-${this.options.platformName}-${this.options.arch}`\n\n log.info({ ffmpegFileName }, \"downloading\")\n\n const {\n packager: {\n config: { electronDownload },\n },\n platformName,\n arch,\n } = this.options\n\n return downloadElectronArtifact({\n electronDownload,\n artifactName: \"ffmpeg\",\n platformName,\n arch,\n version: this.electronVersion,\n })\n }\n\n private async copyFFMPEG(targetPath: string, sourcePath: string) {\n let fileName = \"ffmpeg.dll\"\n if ([\"darwin\", \"mas\"].includes(this.options.platformName)) {\n fileName = \"libffmpeg.dylib\"\n } else if (this.options.platformName === \"linux\") {\n fileName = \"libffmpeg.so\"\n }\n\n const libPath = path.resolve(sourcePath, fileName)\n const libTargetPath = path.resolve(targetPath, fileName)\n log.info({ lib: log.filePath(libPath), target: libTargetPath }, \"copying non-proprietary FFMPEG\")\n\n // If the source doesn't exist we have a problem\n if (!fs.existsSync(libPath)) {\n throw new Error(`Failed to find FFMPEG library file at path: ${libPath}`)\n }\n\n // If we are copying to the source we can stop immediately\n if (libPath !== libTargetPath) {\n await fs.copyFile(libPath, libTargetPath)\n }\n return libTargetPath\n }\n}\n"]}
package/out/index.d.ts CHANGED
@@ -5,7 +5,8 @@ export { Arch, archFromString, getArchSuffix } from "builder-util";
5
5
  export { AppInfo } from "./appInfo";
6
6
  export { AfterExtractContext, AfterPackContext, BeforePackContext, CommonConfiguration, Configuration, FuseOptionsV1, Hook, Hooks, MetadataDirectories, PackContext, ToolsetConfig, } from "./configuration";
7
7
  export { BeforeBuildContext, CompressionLevel, DEFAULT_TARGET, DIR_TARGET, Platform, SourceRepositoryInfo, Target, TargetConfigType, TargetConfiguration, TargetSpecificOptions, } from "./core";
8
- export { ElectronBrandingOptions, ElectronDownloadOptions, ElectronPlatformName } from "./electron/ElectronFramework";
8
+ export { ElectronBrandingOptions, ElectronPlatformName } from "./electron/ElectronFramework";
9
+ export { ElectronDownloadOptions } from "./util/electronGet";
9
10
  export { AppXOptions } from "./options/AppXOptions";
10
11
  export { CommonWindowsInstallerConfiguration } from "./options/CommonWindowsInstallerConfiguration";
11
12
  export { FileAssociation } from "./options/FileAssociation";
package/out/index.js CHANGED
@@ -53,7 +53,7 @@ function build(options, packager = new packager_1.Packager(options)) {
53
53
  };
54
54
  process.once("SIGINT", sigIntHandler);
55
55
  const promise = packager.build().then(async (buildResult) => {
56
- const afterAllArtifactBuild = await (0, resolve_1.resolveFunction)(packager.appInfo.type, buildResult.configuration.afterAllArtifactBuild, "afterAllArtifactBuild");
56
+ const afterAllArtifactBuild = await (0, resolve_1.resolveFunction)(packager.appInfo.type, buildResult.configuration.afterAllArtifactBuild, "afterAllArtifactBuild", await packager.getWorkspaceRoot());
57
57
  if (afterAllArtifactBuild != null) {
58
58
  const newArtifacts = (0, builder_util_runtime_1.asArray)(await Promise.resolve(afterAllArtifactBuild(buildResult)));
59
59
  if (newArtifacts.length === 0 || !publishManager.isPublish) {