app-builder-lib 26.15.7 → 26.16.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 (40) hide show
  1. package/out/configuration.d.ts +32 -0
  2. package/out/configuration.js.map +1 -1
  3. package/out/macPackager.d.ts +7 -2
  4. package/out/macPackager.js +40 -11
  5. package/out/macPackager.js.map +1 -1
  6. package/out/node-module-collector/nodeModulesCollector.d.ts +11 -1
  7. package/out/node-module-collector/nodeModulesCollector.js +16 -2
  8. package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
  9. package/out/node-module-collector/pnpmNodeModulesCollector.js +3 -1
  10. package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
  11. package/out/targets/AppxTarget.js +5 -5
  12. package/out/targets/AppxTarget.js.map +1 -1
  13. package/out/targets/MsiTarget.js +8 -11
  14. package/out/targets/MsiTarget.js.map +1 -1
  15. package/out/targets/appimage/appImageUtil.d.ts +1 -1
  16. package/out/targets/appimage/appImageUtil.js +3 -3
  17. package/out/targets/appimage/appImageUtil.js.map +1 -1
  18. package/out/targets/appimage/appLauncher.js +3 -9
  19. package/out/targets/appimage/appLauncher.js.map +1 -1
  20. package/out/targets/blockmap/blockmap.js +2 -2
  21. package/out/targets/blockmap/blockmap.js.map +1 -1
  22. package/out/targets/nsis/nsisOptions.d.ts +2 -0
  23. package/out/targets/nsis/nsisOptions.js.map +1 -1
  24. package/out/toolsets/icons.js +2 -2
  25. package/out/toolsets/icons.js.map +1 -1
  26. package/out/toolsets/linux.js +3 -3
  27. package/out/toolsets/linux.js.map +1 -1
  28. package/out/util/appFileCopier.d.ts +21 -0
  29. package/out/util/appFileCopier.js +58 -0
  30. package/out/util/appFileCopier.js.map +1 -1
  31. package/out/util/electronGet.d.ts +46 -0
  32. package/out/util/electronGet.js +174 -24
  33. package/out/util/electronGet.js.map +1 -1
  34. package/out/version.d.ts +1 -1
  35. package/out/version.js +1 -1
  36. package/out/version.js.map +1 -1
  37. package/package.json +8 -8
  38. package/scheme.json +20 -1
  39. package/templates/appx/appxmanifest.xml +1 -2
  40. package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"nsisOptions.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { CommonWindowsInstallerConfiguration } from \"../..\"\nimport { TargetSpecificOptions } from \"../../core\"\n\nexport interface CustomNsisBinary {\n /**\n * @default https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.4.1/nsis-3.0.4.1.7z\n */\n readonly url: string | null\n\n /**\n * @default VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q==\n */\n readonly checksum?: string | null\n\n /**\n * @default 3.0.4.1\n */\n readonly version?: string | null\n\n /**\n * Whether or not to enable NSIS logging for debugging.\n * Note: Requires a debug-enabled NSIS build.\n * electron-builder's included `makensis` does not natively support debug-enabled NSIS installers currently, you must supply your own via `customNsisBinary?: CustomNsisBinary`\n * In your custom nsis scripts, you can leverage this functionality via `LogSet` and `LogText`\n */\n readonly debugLogging?: boolean | null\n}\nexport interface CustomNsisResources {\n /**\n * @default https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-resources-3.4.1/nsis-resources-3.4.1.7z\n */\n readonly url: string\n\n /**\n * @default Dqd6g+2buwwvoG1Vyf6BHR1b+25QMmPcwZx40atOT57gH27rkjOei1L0JTldxZu4NFoEmW4kJgZ3DlSWVON3+Q==\n */\n readonly checksum: string\n\n /**\n * @default 3.4.1\n */\n readonly version: string\n}\nexport interface CommonNsisOptions {\n /**\n * Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode).\n * @default true\n */\n readonly unicode?: boolean\n\n /**\n * The GUID for the installer. Used to identify the application for upgrade and uninstall operations.\n * If not specified, a deterministic GUID is generated from the app ID (`appId`) — but this means\n * changing your `appId` will break silent upgrades of existing installs.\n *\n * @see [GUID vs Application Name](https://www.electron.build/docs/nsis#guid-vs-application-name)\n */\n readonly guid?: string | null\n\n /**\n * If `warningsAsErrors` is `true` (default): NSIS will treat warnings as errors. If `warningsAsErrors` is `false`: NSIS will allow warnings.\n * @default true\n */\n readonly warningsAsErrors?: boolean\n\n /**\n * Forces zip compression format instead of LZMA. Used internally for differential update packages.\n * @default false\n */\n readonly useZip?: boolean\n\n /**\n * Allows you to provide your own `makensis`, such as one with support for debug logging via LogSet and LogText. (Logging also requires option `debugLogging = true`)\n */\n readonly customNsisBinary?: CustomNsisBinary | null\n\n /**\n * Allows you to provide your own `nsis-resources`\n */\n readonly customNsisResources?: CustomNsisResources | null\n}\n\nexport interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerConfiguration, TargetSpecificOptions {\n /**\n * Whether to create one-click installer or assisted.\n * @default true\n */\n readonly oneClick?: boolean\n\n /**\n * Whether to show install mode installer page (choice per-machine or per-user) for assisted installer. Or whether installation always per all users (per-machine).\n *\n * If `oneClick` is `true` (default): Whether to install per all users (per-machine).\n *\n * If `oneClick` is `false` and `perMachine` is `true`: no install mode installer page, always install per-machine.\n *\n * If `oneClick` is `false` and `perMachine` is `false` (default): install mode installer page.\n * @default false\n */\n readonly perMachine?: boolean\n\n /**\n * Whether to set per-machine or per-user installation as default selection on the install mode installer page.\n *\n * @default false\n */\n readonly selectPerMachineByDefault?: boolean\n\n /**\n * *assisted installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions.\n * @default true\n */\n readonly allowElevation?: boolean\n\n /**\n * *assisted installer only.* Whether to allow user to change installation directory.\n * @default false\n */\n readonly allowToChangeInstallationDirectory?: boolean\n\n /**\n * *assisted installer only.* remove the default uninstall welcome page.\n * @default false\n */\n readonly removeDefaultUninstallWelcomePage?: boolean\n\n /**\n * The path to installer icon, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/installerIcon.ico` or application icon.\n */\n readonly installerIcon?: string | null\n /**\n * The path to uninstaller icon, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/uninstallerIcon.ico` or application icon.\n */\n readonly uninstallerIcon?: string | null\n /**\n * *assisted installer only.* `MUI_HEADERIMAGE`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * @default build/installerHeader.bmp\n */\n readonly installerHeader?: string | null\n /**\n * *one-click installer only.* The path to header icon (above the progress bar), relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/installerHeaderIcon.ico` or application icon.\n */\n readonly installerHeaderIcon?: string | null\n /**\n * *assisted installer only.* `MUI_WELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/installerSidebar.bmp` or `${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp`. Image size 164 × 314 pixels.\n */\n readonly installerSidebar?: string | null\n /**\n * *assisted installer only.* `MUI_UNWELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `installerSidebar` option or `build/uninstallerSidebar.bmp` or `build/installerSidebar.bmp` or `${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp`\n */\n readonly uninstallerSidebar?: string | null\n /**\n * The uninstaller display name in the control panel.\n * @default ${productName} ${version}\n */\n readonly uninstallDisplayName?: string | null\n /**\n * The URL to the uninstaller help page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlHelp?: string | null\n /**\n * The URL to the uninstaller info about page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlInfoAbout?: string | null\n /**\n * The URL to the uninstaller update info page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlUpdateInfo?: string | null\n /**\n * The URL to the uninstaller readme page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlReadme?: string | null\n\n /**\n * The path to NSIS include script to customize installer. Defaults to `build/installer.nsh`. See [Custom NSIS script](#custom-nsis-script).\n */\n readonly include?: string | null\n /**\n * The path to NSIS script to customize installer. Defaults to `build/installer.nsi`. See [Custom NSIS script](#custom-nsis-script).\n */\n readonly script?: string | null\n\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). In addition to `txt`, `rtf` and `html` supported (don't forget to use `target=\"_blank\"` for links).\n *\n * Multiple license files in different languages are supported — use lang postfix (e.g. `_de`, `_ru`). For example, create files `license_de.txt` and `license_en.txt` in the build resources.\n * If OS language is german, `license_de.txt` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js).\n *\n * Appropriate license file will be selected by user OS language.\n */\n readonly license?: string | null\n\n /**\n * The [artifact file name template](https://www.electron.build/docs/configuration#artifact-file-name-template). Defaults to `${productName} Setup ${version}.${ext}`.\n */\n readonly artifactName?: string | null\n\n /**\n * *one-click installer only.* Whether to delete app data on uninstall.\n * @default false\n */\n readonly deleteAppDataOnUninstall?: boolean\n\n /**\n * Marks the package as built with differential download support for the update server.\n */\n readonly differentialPackage?: boolean\n\n /**\n * Whether to display a language selection dialog. Not recommended (by default will be detected using OS language).\n * @default false\n */\n readonly displayLanguageSelector?: boolean\n /**\n * The installer languages (e.g. `en_US`, `de_DE`). Change only if you understand what do you do and for what.\n */\n readonly installerLanguages?: Array<string> | string | null\n /**\n * [LCID Dec](https://msdn.microsoft.com/en-au/goglobal/bb964664.aspx), defaults to `1033`(`English - United States`).\n */\n readonly language?: string | null\n /**\n * Whether to create multi-language installer. Defaults to `unicode` option value.\n */\n readonly multiLanguageInstaller?: boolean\n /**\n * Whether to pack the elevate executable (required for electron-updater if per-machine installer used or can be used in the future). Ignored if `perMachine` is set to `true`.\n * @default true\n */\n readonly packElevateHelper?: boolean\n\n /**\n * The file extension of files that will be not compressed. Applicable only for `extraResources` and `extraFiles` files.\n * @default [\".avi\", \".mov\", \".m4v\", \".mp4\", \".m4p\", \".qt\", \".mkv\", \".webm\", \".vmdk\"]\n */\n readonly preCompressedFileExtensions?: Array<string> | string | null\n\n /**\n * Disable building an universal installer of the archs specified in the target configuration\n * *Not supported for nsis-web*\n * @default true\n */\n readonly buildUniversalInstaller?: boolean\n}\n\n/**\n * Portable options.\n */\nexport interface PortableOptions extends TargetSpecificOptions, CommonNsisOptions {\n /**\n * The [requested execution level](http://nsis.sourceforge.net/Reference/RequestExecutionLevel) for Windows.\n * @default user\n */\n readonly requestExecutionLevel?: \"user\" | \"highest\" | \"admin\"\n\n /**\n * The unpack directory for the portable app resources.\n *\n * If set to a string, it will be the name in [TEMP](https://www.askvg.com/where-does-windows-store-temporary-files-and-how-to-change-temp-folder-location/) directory\n * If set explicitly to `false`, it will use the Windows temp directory ($PLUGINSDIR) that is unique to each launch of the portable application.\n *\n * Defaults to [uuid](https://github.com/segmentio/ksuid) of build (changed on each build of portable executable).\n */\n readonly unpackDirName?: string | boolean\n\n /**\n * The image to show while the portable executable is extracting. This image must be a bitmap (`.bmp`) image.\n */\n readonly splashImage?: string | null\n\n /**\n * Disable building an universal installer of the archs specified in the target configuration\n * @default true\n */\n readonly buildUniversalInstaller?: boolean\n}\n\n/**\n * Web Installer options.\n */\nexport interface NsisWebOptions extends NsisOptions {\n /**\n * The application package download URL. Optional — by default computed using publish configuration.\n *\n * URL like `https://example.com/download/latest` allows web installer to be version independent (installer will download latest application package).\n * Please note — it is [full URL](https://github.com/electron-userland/electron-builder/issues/1810#issuecomment-317650878).\n *\n * Custom `X-Arch` http header is set to `32` or `64`.\n */\n readonly appPackageUrl?: string | null\n\n /**\n * The [artifact file name template](https://www.electron.build/docs/configuration#artifact-file-name-template). Defaults to `${productName} Web Setup ${version}.${ext}`.\n */\n readonly artifactName?: string | null\n\n /**\n * Override for `NsisOptions.buildUniversalInstaller`. nsis-web requires universal installer\n * @default true\n */\n readonly buildUniversalInstaller?: true\n}\n"]}
1
+ {"version":3,"file":"nsisOptions.js","sourceRoot":"","sources":["../../../src/targets/nsis/nsisOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { CommonWindowsInstallerConfiguration } from \"../..\"\nimport { TargetSpecificOptions } from \"../../core\"\n\nexport interface CustomNsisBinary {\n /**\n * URL to a 7z archive containing the NSIS toolset to use.\n * Note: do not use the `nsis-3.0.4.2` bundle — it is known to be broken (see https://github.com/electron-userland/electron-builder/issues/6334). Use `nsis-3.0.4.1` instead.\n * @default https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.4.1/nsis-3.0.4.1.7z\n */\n readonly url: string | null\n\n /**\n * @default VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q==\n */\n readonly checksum?: string | null\n\n /**\n * @default 3.0.4.1\n */\n readonly version?: string | null\n\n /**\n * Whether or not to enable NSIS logging for debugging.\n * Note: Requires a debug-enabled NSIS build.\n * electron-builder's included `makensis` does not natively support debug-enabled NSIS installers currently, you must supply your own via `customNsisBinary?: CustomNsisBinary`\n * In your custom nsis scripts, you can leverage this functionality via `LogSet` and `LogText`\n */\n readonly debugLogging?: boolean | null\n}\nexport interface CustomNsisResources {\n /**\n * @default https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-resources-3.4.1/nsis-resources-3.4.1.7z\n */\n readonly url: string\n\n /**\n * @default Dqd6g+2buwwvoG1Vyf6BHR1b+25QMmPcwZx40atOT57gH27rkjOei1L0JTldxZu4NFoEmW4kJgZ3DlSWVON3+Q==\n */\n readonly checksum: string\n\n /**\n * @default 3.4.1\n */\n readonly version: string\n}\nexport interface CommonNsisOptions {\n /**\n * Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode).\n * @default true\n */\n readonly unicode?: boolean\n\n /**\n * The GUID for the installer. Used to identify the application for upgrade and uninstall operations.\n * If not specified, a deterministic GUID is generated from the app ID (`appId`) — but this means\n * changing your `appId` will break silent upgrades of existing installs.\n *\n * @see [GUID vs Application Name](https://www.electron.build/docs/nsis#guid-vs-application-name)\n */\n readonly guid?: string | null\n\n /**\n * If `warningsAsErrors` is `true` (default): NSIS will treat warnings as errors. If `warningsAsErrors` is `false`: NSIS will allow warnings.\n * @default true\n */\n readonly warningsAsErrors?: boolean\n\n /**\n * Forces zip compression format instead of LZMA. Used internally for differential update packages.\n * @default false\n */\n readonly useZip?: boolean\n\n /**\n * Allows you to provide your own `makensis`, such as one with support for debug logging via LogSet and LogText. (Logging also requires option `debugLogging = true`)\n */\n readonly customNsisBinary?: CustomNsisBinary | null\n\n /**\n * Allows you to provide your own `nsis-resources`\n */\n readonly customNsisResources?: CustomNsisResources | null\n}\n\nexport interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerConfiguration, TargetSpecificOptions {\n /**\n * Whether to create one-click installer or assisted.\n * @default true\n */\n readonly oneClick?: boolean\n\n /**\n * Whether to show install mode installer page (choice per-machine or per-user) for assisted installer. Or whether installation always per all users (per-machine).\n *\n * If `oneClick` is `true` (default): Whether to install per all users (per-machine).\n *\n * If `oneClick` is `false` and `perMachine` is `true`: no install mode installer page, always install per-machine.\n *\n * If `oneClick` is `false` and `perMachine` is `false` (default): install mode installer page.\n * @default false\n */\n readonly perMachine?: boolean\n\n /**\n * Whether to set per-machine or per-user installation as default selection on the install mode installer page.\n *\n * @default false\n */\n readonly selectPerMachineByDefault?: boolean\n\n /**\n * *assisted installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions.\n * @default true\n */\n readonly allowElevation?: boolean\n\n /**\n * *assisted installer only.* Whether to allow user to change installation directory.\n * @default false\n */\n readonly allowToChangeInstallationDirectory?: boolean\n\n /**\n * *assisted installer only.* remove the default uninstall welcome page.\n * @default false\n */\n readonly removeDefaultUninstallWelcomePage?: boolean\n\n /**\n * The path to installer icon, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/installerIcon.ico` or application icon.\n */\n readonly installerIcon?: string | null\n /**\n * The path to uninstaller icon, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/uninstallerIcon.ico` or application icon.\n */\n readonly uninstallerIcon?: string | null\n /**\n * *assisted installer only.* `MUI_HEADERIMAGE`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * @default build/installerHeader.bmp\n */\n readonly installerHeader?: string | null\n /**\n * *one-click installer only.* The path to header icon (above the progress bar), relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/installerHeaderIcon.ico` or application icon.\n */\n readonly installerHeaderIcon?: string | null\n /**\n * *assisted installer only.* `MUI_WELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/installerSidebar.bmp` or `${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp`. Image size 164 × 314 pixels.\n */\n readonly installerSidebar?: string | null\n /**\n * *assisted installer only.* `MUI_UNWELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `installerSidebar` option or `build/uninstallerSidebar.bmp` or `build/installerSidebar.bmp` or `${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp`\n */\n readonly uninstallerSidebar?: string | null\n /**\n * The uninstaller display name in the control panel.\n * @default ${productName} ${version}\n */\n readonly uninstallDisplayName?: string | null\n /**\n * The URL to the uninstaller help page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlHelp?: string | null\n /**\n * The URL to the uninstaller info about page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlInfoAbout?: string | null\n /**\n * The URL to the uninstaller update info page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlUpdateInfo?: string | null\n /**\n * The URL to the uninstaller readme page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlReadme?: string | null\n\n /**\n * The path to NSIS include script to customize installer. Defaults to `build/installer.nsh`. See [Custom NSIS script](#custom-nsis-script).\n */\n readonly include?: string | null\n /**\n * The path to NSIS script to customize installer. Defaults to `build/installer.nsi`. See [Custom NSIS script](#custom-nsis-script).\n */\n readonly script?: string | null\n\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). In addition to `txt`, `rtf` and `html` supported (don't forget to use `target=\"_blank\"` for links).\n *\n * Multiple license files in different languages are supported — use lang postfix (e.g. `_de`, `_ru`). For example, create files `license_de.txt` and `license_en.txt` in the build resources.\n * If OS language is german, `license_de.txt` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js).\n *\n * Appropriate license file will be selected by user OS language.\n */\n readonly license?: string | null\n\n /**\n * The [artifact file name template](https://www.electron.build/docs/configuration#artifact-file-name-template). Defaults to `${productName} Setup ${version}.${ext}`.\n */\n readonly artifactName?: string | null\n\n /**\n * *one-click installer only.* Whether to delete app data on uninstall.\n * @default false\n */\n readonly deleteAppDataOnUninstall?: boolean\n\n /**\n * Marks the package as built with differential download support for the update server.\n */\n readonly differentialPackage?: boolean\n\n /**\n * Whether to display a language selection dialog. Not recommended (by default will be detected using OS language).\n * @default false\n */\n readonly displayLanguageSelector?: boolean\n /**\n * The installer languages (e.g. `en_US`, `de_DE`). Change only if you understand what do you do and for what.\n */\n readonly installerLanguages?: Array<string> | string | null\n /**\n * [LCID Dec](https://msdn.microsoft.com/en-au/goglobal/bb964664.aspx), defaults to `1033`(`English - United States`).\n */\n readonly language?: string | null\n /**\n * Whether to create multi-language installer. Defaults to `unicode` option value.\n */\n readonly multiLanguageInstaller?: boolean\n /**\n * Whether to pack the elevate executable (required for electron-updater if per-machine installer used or can be used in the future). Ignored if `perMachine` is set to `true`.\n * @default true\n */\n readonly packElevateHelper?: boolean\n\n /**\n * The file extension of files that will be not compressed. Applicable only for `extraResources` and `extraFiles` files.\n * @default [\".avi\", \".mov\", \".m4v\", \".mp4\", \".m4p\", \".qt\", \".mkv\", \".webm\", \".vmdk\"]\n */\n readonly preCompressedFileExtensions?: Array<string> | string | null\n\n /**\n * Disable building an universal installer of the archs specified in the target configuration\n * *Not supported for nsis-web*\n * @default true\n */\n readonly buildUniversalInstaller?: boolean\n}\n\n/**\n * Portable options.\n */\nexport interface PortableOptions extends TargetSpecificOptions, CommonNsisOptions {\n /**\n * The [requested execution level](http://nsis.sourceforge.net/Reference/RequestExecutionLevel) for Windows.\n * @default user\n */\n readonly requestExecutionLevel?: \"user\" | \"highest\" | \"admin\"\n\n /**\n * The unpack directory for the portable app resources.\n *\n * If set to a string, it will be the name in [TEMP](https://www.askvg.com/where-does-windows-store-temporary-files-and-how-to-change-temp-folder-location/) directory\n * If set explicitly to `false`, it will use the Windows temp directory ($PLUGINSDIR) that is unique to each launch of the portable application.\n *\n * Defaults to [uuid](https://github.com/segmentio/ksuid) of build (changed on each build of portable executable).\n */\n readonly unpackDirName?: string | boolean\n\n /**\n * The image to show while the portable executable is extracting. This image must be a bitmap (`.bmp`) image.\n */\n readonly splashImage?: string | null\n\n /**\n * Disable building an universal installer of the archs specified in the target configuration\n * @default true\n */\n readonly buildUniversalInstaller?: boolean\n}\n\n/**\n * Web Installer options.\n */\nexport interface NsisWebOptions extends NsisOptions {\n /**\n * The application package download URL. Optional — by default computed using publish configuration.\n *\n * URL like `https://example.com/download/latest` allows web installer to be version independent (installer will download latest application package).\n * Please note — it is [full URL](https://github.com/electron-userland/electron-builder/issues/1810#issuecomment-317650878).\n *\n * Custom `X-Arch` http header is set to `32` or `64`.\n */\n readonly appPackageUrl?: string | null\n\n /**\n * The [artifact file name template](https://www.electron.build/docs/configuration#artifact-file-name-template). Defaults to `${productName} Web Setup ${version}.${ext}`.\n */\n readonly artifactName?: string | null\n\n /**\n * Override for `NsisOptions.buildUniversalInstaller`. nsis-web requires universal installer\n * @default true\n */\n readonly buildUniversalInstaller?: true\n}\n"]}
@@ -6,7 +6,7 @@ const builder_util_1 = require("builder-util");
6
6
  const path = require("path");
7
7
  const electronGet_1 = require("../util/electronGet");
8
8
  const iconsToolsChecksums = {
9
- "icons-bundle.tar.gz": "193241afc7c81ab165fa0af15ef0af88f796eb69e8e5bb4249a49310d8be242a",
9
+ "icons-bundle.tar.gz": "4e5bb546c9d3ab0c2bbacc22857467bf415f742a34c2be9dd138779d2fc066f9",
10
10
  };
11
11
  async function getIconsToolsetPath() {
12
12
  const envPath = await (0, builder_util_1.resolveEnvToolsetPath)("ELECTRON_BUILDER_ICONS_TOOLSET_DIR", "directory");
@@ -14,7 +14,7 @@ async function getIconsToolsetPath() {
14
14
  return envPath;
15
15
  }
16
16
  return (0, electronGet_1.downloadBuilderToolset)({
17
- releaseName: "icons@1.2.1",
17
+ releaseName: "icons@1.2.3",
18
18
  filenameWithExt: "icons-bundle.tar.gz",
19
19
  checksums: iconsToolsChecksums,
20
20
  githubOrgRepo: "electron-userland/electron-builder-binaries",
@@ -1 +1 @@
1
- {"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/toolsets/icons.ts"],"names":[],"mappings":";;AAQA,kDAWC;AAUD,oCAaC;AA1CD,+CAA8G;AAC9G,6BAA4B;AAC5B,qDAA4D;AAE5D,MAAM,mBAAmB,GAAG;IAC1B,qBAAqB,EAAE,kEAAkE;CACjF,CAAA;AAEH,KAAK,UAAU,mBAAmB;IACvC,MAAM,OAAO,GAAG,MAAM,IAAA,oCAAqB,EAAC,oCAAoC,EAAE,WAAW,CAAC,CAAA;IAC9F,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,OAAO,IAAA,oCAAsB,EAAC;QAC5B,WAAW,EAAE,aAAa;QAC1B,eAAe,EAAE,qBAAqB;QACtC,SAAS,EAAE,mBAAmB;QAC9B,aAAa,EAAE,6CAA6C;KAC7D,CAAC,CAAA;AACJ,CAAC;AAQD,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAU,CAAA;AAErD,KAAK,UAAU,YAAY,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAyB;IAC3F,IAAI,CAAE,oBAA0C,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,wCAAyB,CAAC,+BAA+B,YAAY,EAAE,CAAC,CAAA;IACpF,CAAC;IACD,MAAM,SAAS,GAAG,IAAA,8BAAe,EAAC,SAAS,CAAC,CAAA;IAC5C,MAAM,UAAU,GAAG,IAAA,8BAAe,EAAC,MAAM,CAAC,CAAA;IAE1C,MAAM,WAAW,GAAG,MAAM,mBAAmB,EAAE,CAAA;IAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,CAAA;IAC5D,IAAI,CAAC,CAAC,MAAM,IAAA,qBAAM,EAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,wCAAyB,CAAC,0CAA0C,UAAU,EAAE,CAAC,CAAA;IAC7F,CAAC;IACD,MAAM,IAAA,mBAAI,EAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,SAAS,EAAE,EAAE,YAAY,YAAY,EAAE,EAAE,SAAS,UAAU,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;AACzI,CAAC","sourcesContent":["import { exec, exists, InvalidConfigurationError, resolveEnvToolsetPath, sanitizeDirPath } from \"builder-util\"\nimport * as path from \"path\"\nimport { downloadBuilderToolset } from \"../util/electronGet\"\n\nconst iconsToolsChecksums = {\n \"icons-bundle.tar.gz\": \"193241afc7c81ab165fa0af15ef0af88f796eb69e8e5bb4249a49310d8be242a\",\n} as const\n\nexport async function getIconsToolsetPath(): Promise<string> {\n const envPath = await resolveEnvToolsetPath(\"ELECTRON_BUILDER_ICONS_TOOLSET_DIR\", \"directory\")\n if (envPath != null) {\n return envPath\n }\n return downloadBuilderToolset({\n releaseName: \"icons@1.2.1\",\n filenameWithExt: \"icons-bundle.tar.gz\",\n checksums: iconsToolsChecksums,\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n}\n\ntype IconConversionOptions = {\n inputFile: string\n outputFormat: \"icns\" | \"ico\" | \"set\"\n outDir: string\n}\n\nconst VALID_OUTPUT_FORMATS = [\"icns\", \"ico\", \"set\"] as const\n\nexport async function runIconsTool({ inputFile, outputFormat, outDir }: IconConversionOptions): Promise<void> {\n if (!(VALID_OUTPUT_FORMATS as readonly string[]).includes(outputFormat)) {\n throw new InvalidConfigurationError(`Invalid icon output format: ${outputFormat}`)\n }\n const safeInput = sanitizeDirPath(inputFile)\n const safeOutDir = sanitizeDirPath(outDir)\n\n const toolsetPath = await getIconsToolsetPath()\n const scriptPath = path.resolve(toolsetPath, \"icon-tool.js\")\n if (!(await exists(scriptPath))) {\n throw new InvalidConfigurationError(`Icons tool not found at expected path: ${scriptPath}`)\n }\n await exec(process.execPath, [scriptPath, `--input=${safeInput}`, `--format=${outputFormat}`, `--out=${safeOutDir}`], { shell: false })\n}\n"]}
1
+ {"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/toolsets/icons.ts"],"names":[],"mappings":";;AAQA,kDAWC;AAUD,oCAaC;AA1CD,+CAA8G;AAC9G,6BAA4B;AAC5B,qDAA4D;AAE5D,MAAM,mBAAmB,GAAG;IAC1B,qBAAqB,EAAE,kEAAkE;CACjF,CAAA;AAEH,KAAK,UAAU,mBAAmB;IACvC,MAAM,OAAO,GAAG,MAAM,IAAA,oCAAqB,EAAC,oCAAoC,EAAE,WAAW,CAAC,CAAA;IAC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nimport * as path from \"path\"\nimport { downloadBuilderToolset } from \"../util/electronGet\"\n\nconst iconsToolsChecksums = {\n \"icons-bundle.tar.gz\": \"4e5bb546c9d3ab0c2bbacc22857467bf415f742a34c2be9dd138779d2fc066f9\",\n} as const\n\nexport async function getIconsToolsetPath(): Promise<string> {\n const envPath = await resolveEnvToolsetPath(\"ELECTRON_BUILDER_ICONS_TOOLSET_DIR\", \"directory\")\n if (envPath != null) {\n return envPath\n }\n return downloadBuilderToolset({\n releaseName: \"icons@1.2.3\",\n filenameWithExt: \"icons-bundle.tar.gz\",\n checksums: iconsToolsChecksums,\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n}\n\ntype IconConversionOptions = {\n inputFile: string\n outputFormat: \"icns\" | \"ico\" | \"set\"\n outDir: string\n}\n\nconst VALID_OUTPUT_FORMATS = [\"icns\", \"ico\", \"set\"] as const\n\nexport async function runIconsTool({ inputFile, outputFormat, outDir }: IconConversionOptions): Promise<void> {\n if (!(VALID_OUTPUT_FORMATS as readonly string[]).includes(outputFormat)) {\n throw new InvalidConfigurationError(`Invalid icon output format: ${outputFormat}`)\n }\n const safeInput = sanitizeDirPath(inputFile)\n const safeOutDir = sanitizeDirPath(outDir)\n\n const toolsetPath = await getIconsToolsetPath()\n const scriptPath = path.resolve(toolsetPath, \"icon-tool.js\")\n if (!(await exists(scriptPath))) {\n throw new InvalidConfigurationError(`Icons tool not found at expected path: ${scriptPath}`)\n }\n await exec(process.execPath, [scriptPath, `--input=${safeInput}`, `--format=${outputFormat}`, `--out=${safeOutDir}`], { shell: false })\n}\n"]}
@@ -29,8 +29,8 @@ exports.appimageChecksums = {
29
29
  };
30
30
  // no legacy toolset as macos arm64 BSD gtar/ar/lzip are not compatible with linux targets, so we always use newer toolset on macos for linux archives
31
31
  const linuxToolsMacChecksums = {
32
- "linux-tools-mac-darwin-arm64.tar.gz": "204e76f08364352edb28a6a4be87e8f9bd9340213865d9a0d1c664aa46fcf053",
33
- "linux-tools-mac-darwin-x86_64.tar.gz": "7ee26dfbd0d2a4c2c83b55a9416a30cc84876eef01c6497ca49bb016a190c726",
32
+ "linux-tools-mac-darwin-arm64.tar.gz": "3dcb43a12b8630919b8d5cc9045be102108b0edd9b0354e0a7409ee5b53141ac",
33
+ "linux-tools-mac-darwin-x86_64.tar.gz": "d62f5e2f6949c6420fdda8b18d2e70b0e14eeb959128c0cea11acada2c105ad9",
34
34
  };
35
35
  async function getLinuxToolsPath() {
36
36
  const envPath = await (0, builder_util_1.resolveEnvToolsetPath)("LINUX_TOOLS_MAC_PATH", "directory");
@@ -38,7 +38,7 @@ async function getLinuxToolsPath() {
38
38
  return envPath;
39
39
  }
40
40
  const arch = process.arch === "arm64" ? "arm64" : "x86_64";
41
- const toolsetVersion = "1.0.0";
41
+ const toolsetVersion = "1.0.1";
42
42
  const filename = `linux-tools-mac-darwin-${arch}.tar.gz`;
43
43
  return await (0, electronGet_1.downloadBuilderToolset)({
44
44
  releaseName: `linux-tools-mac@${toolsetVersion}`,
@@ -1 +1 @@
1
- {"version":3,"file":"linux.js","sourceRoot":"","sources":["../../src/toolsets/linux.ts"],"names":[],"mappings":";;;AAgCA,8CAgBC;AAED,0DAQC;AAED,gCA4BC;AAED,4CA4DC;AAtJD,+CAAuE;AACvE,6BAA4B;AAC5B,gDAA8C;AAE9C,qDAA4D;AAE5D,MAAM,YAAY,GAAG;IACnB,uCAAuC,EAAE,kEAAkE;IAC3G,wCAAwC,EAAE,kEAAkE;IAC5G,sCAAsC,EAAE,kEAAkE;IAC1G,wCAAwC,EAAE,kEAAkE;IAC5G,qCAAqC,EAAE,kEAAkE;CACjG,CAAA;AAEG,QAAA,iBAAiB,GAAG;IAC/B,OAAO,EAAE;QACP,oBAAoB,EAAE,kEAAkE;KACzF;IACD,OAAO,EAAE;QACP,wCAAwC,EAAE,kEAAkE;KAC7G;IACD,OAAO,EAAE;QACP,wCAAwC,EAAE,kEAAkE;KAC7G;CACO,CAAA;AAEV,sJAAsJ;AACtJ,MAAM,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C,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,mCAAI,CAAC,MAAM,QAAQ,EAAE,CAAC,CAAA;IAC/J,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC,CAAC,MAAM,IAAA,qBAAM,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,iBAAiB,KAAK,CAAC,CAAC,CAAC,uBAAuB,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;QAC7E,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["import { Arch, exists, resolveEnvToolsetPath, use } from \"builder-util\"\nimport * as path from \"path\"\nimport { getBinFromUrl } from \"../binDownload\"\nimport { ToolsetConfig } from \"../configuration\"\nimport { downloadBuilderToolset } from \"../util/electronGet\"\n\nconst fpmChecksums = {\n \"fpm-1.17.0-ruby-3.4.3-darwin-arm64.7z\": \"6cc6d4785875bc7d79bdf52ca146080a4c300e1d663376ae79615fb548030ede\",\n \"fpm-1.17.0-ruby-3.4.3-darwin-x86_64.7z\": \"f7cb468c5e64177124c9d3a5f400ac20ffcb411aa5aa0ea224a808ff5a2d3bbf\",\n \"fpm-1.17.0-ruby-3.4.3-linux-amd64.7z\": \"44b0ec6025c14ec137f56180e62675c0eae36233cdce53d0953d9c73ced8989f\",\n \"fpm-1.17.0-ruby-3.4.3-linux-arm64v8.7z\": \"338b50cfa7f12d745a997d1a3d000bcd0410008050fa7d8c4476a78a61c0564e\",\n \"fpm-1.17.0-ruby-3.4.3-linux-i386.7z\": \"181124e2e9856855c21229ea9096bb7006a9e3e712d133ce332597ba878cd7b6\",\n} as const\n\nexport const appimageChecksums = {\n \"0.0.0\": {\n \"appimage-12.0.1.7z\": \"d12ff7eb8f1d1ec4652ca5237a7fbdca33acc0c758045636feca62dc6ecb8ec4\",\n },\n \"1.0.2\": {\n \"appimage-tools-runtime-20251108.tar.gz\": \"a784a8c26331ec2e945c23d6bdb14af5c9df27f5939825d84b8709c61dc81eb0\",\n },\n \"1.0.3\": {\n \"appimage-tools-runtime-20251108.tar.gz\": \"84021a78ee214ae6fd33a2d62a92ba25542dd10bc86bf117a9b2d0bba44e7665\",\n },\n} as const\n\n// no legacy toolset as macos arm64 BSD gtar/ar/lzip are not compatible with linux targets, so we always use newer toolset on macos for linux archives\nconst linuxToolsMacChecksums = {\n \"linux-tools-mac-darwin-arm64.tar.gz\": \"204e76f08364352edb28a6a4be87e8f9bd9340213865d9a0d1c664aa46fcf053\",\n \"linux-tools-mac-darwin-x86_64.tar.gz\": \"7ee26dfbd0d2a4c2c83b55a9416a30cc84876eef01c6497ca49bb016a190c726\",\n} as const\n\nexport async function getLinuxToolsPath(): Promise<string> {\n const envPath = await resolveEnvToolsetPath(\"LINUX_TOOLS_MAC_PATH\", \"directory\")\n if (envPath != null) {\n return envPath\n }\n const arch = process.arch === \"arm64\" ? \"arm64\" : \"x86_64\"\n const toolsetVersion = \"1.0.0\"\n const filename: keyof typeof linuxToolsMacChecksums = `linux-tools-mac-darwin-${arch}.tar.gz`\n return await downloadBuilderToolset({\n releaseName: `linux-tools-mac@${toolsetVersion}`,\n filenameWithExt: filename,\n checksums: {\n [filename]: linuxToolsMacChecksums[filename],\n },\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n}\n\nexport async function getLinuxToolsMacToolset() {\n const linuxToolsPath = await getLinuxToolsPath()\n const bin = (pkg: string) => path.join(linuxToolsPath, \"bin\", pkg)\n return {\n ar: bin(\"ar\"),\n lzip: bin(\"lzip\"),\n gtar: bin(\"gtar\"),\n }\n}\n\nexport async function getFpmPath() {\n const customFpmPath = await resolveEnvToolsetPath(\"CUSTOM_FPM_PATH\", \"file\")\n if (customFpmPath != null) {\n return customFpmPath\n }\n const exec = \"fpm\"\n if (process.platform === \"win32\" || process.env.USE_SYSTEM_FPM === \"true\") {\n return exec\n }\n const getKey = () => {\n if (process.platform === \"linux\") {\n if (process.arch == \"x64\") {\n return \"fpm-1.17.0-ruby-3.4.3-linux-amd64.7z\"\n } else if (process.arch === \"arm64\") {\n return \"fpm-1.17.0-ruby-3.4.3-linux-arm64v8.7z\"\n }\n return \"fpm-1.17.0-ruby-3.4.3-linux-i386.7z\"\n }\n // darwin arm64\n if (process.arch === \"arm64\") {\n return \"fpm-1.17.0-ruby-3.4.3-darwin-arm64.7z\"\n }\n return \"fpm-1.17.0-ruby-3.4.3-darwin-x86_64.7z\"\n }\n\n const filename = getKey()\n const fpmPath = await getBinFromUrl(\"fpm@2.1.4\", filename, fpmChecksums[filename])\n return path.join(fpmPath, exec)\n}\n\nexport async function getAppImageTools(appimageToolVersion: ToolsetConfig[\"appimage\"], targetArch: Arch) {\n const runtimeArch = targetArch === Arch.armv7l ? \"arm32\" : targetArch === Arch.arm64 ? \"arm64\" : targetArch === Arch.ia32 ? \"ia32\" : \"x64\"\n\n // Static-runtime layout: tools at root, runtimes/ subdir, lib/{arch}/ subdir\n const getPaths = (artifactPath: string) => ({\n mksquashfs: path.resolve(artifactPath, \"mksquashfs\"),\n desktopFileValidate: path.resolve(artifactPath, \"desktop-file-validate\"),\n runtime: path.resolve(artifactPath, \"runtimes\", `runtime-${runtimeArch}`),\n runtimeLibraries: path.resolve(artifactPath, \"lib\", runtimeArch),\n })\n\n // FUSE2 layout: tools under a host-platform subdir; runtime files at root with target-arch suffix\n const getFuse2Paths = (artifactPath: string) => {\n // mksquashfs/desktop-file-validate are HOST binaries — use process.arch, not targetArch\n const hostArch = process.arch === \"arm\" ? \"arm32\" : process.arch === \"arm64\" ? \"arm64\" : process.arch === \"ia32\" ? \"ia32\" : \"x64\"\n const toolRoot = process.platform === \"linux\" ? `linux-${hostArch}` : \"darwin\"\n // Runtime files live at root; armv7l target uses \"armv7l\" filename, not the internal \"arm32\" alias\n const runtimeSuffix = targetArch === Arch.armv7l ? \"armv7l\" : runtimeArch\n // FUSE2 tree only ships lib/ia32 and lib/x64; arm targets fall back to x64 here\n // but buildLegacyFuse2AppImage only copies runtimeLibraries for x64/ia32.\n const libArch = targetArch === Arch.ia32 ? \"ia32\" : \"x64\"\n return {\n mksquashfs: path.resolve(artifactPath, toolRoot, \"mksquashfs\"),\n desktopFileValidate: path.resolve(artifactPath, toolRoot, \"desktop-file-validate\"),\n runtime: path.resolve(artifactPath, `runtime-${runtimeSuffix}`),\n runtimeLibraries: path.resolve(artifactPath, \"lib\", libArch),\n }\n }\n\n const isFuse2 = appimageToolVersion === \"0.0.0\" || appimageToolVersion == null\n\n const download = async () => {\n if (isFuse2) {\n const filenameWithExt = \"appimage-12.0.1.7z\"\n const artifactPath = await downloadBuilderToolset({\n releaseName: \"appimage-12.0.1\",\n filenameWithExt,\n checksums: { [filenameWithExt]: appimageChecksums[\"0.0.0\"][filenameWithExt] },\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n return getFuse2Paths(artifactPath)\n }\n\n const filenameWithExt = \"appimage-tools-runtime-20251108.tar.gz\"\n const artifactPath = await downloadBuilderToolset({\n releaseName: `appimage@${appimageToolVersion}`,\n filenameWithExt,\n checksums: { [filenameWithExt]: appimageChecksums[appimageToolVersion][filenameWithExt] },\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n return getPaths(artifactPath)\n }\n\n const artifact = use(await resolveEnvToolsetPath(\"APPIMAGE_TOOLS_PATH\", \"directory\"), it => (isFuse2 ? getFuse2Paths(it) : getPaths(it))) ?? (await download())\n for (const entry of Object.entries(artifact)) {\n if (!(await exists(entry[1]))) {\n throw new Error(`AppImage tool ${entry[0]} not found at path: ${entry[1]}`)\n }\n }\n return artifact\n}\n"]}
1
+ {"version":3,"file":"linux.js","sourceRoot":"","sources":["../../src/toolsets/linux.ts"],"names":[],"mappings":";;;AAgCA,8CAgBC;AAED,0DAQC;AAED,gCA4BC;AAED,4CA4DC;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,CAAA;QAChE,MAAM,YAAY,GAAG,MAAM,IAAA,oCAAsB,EAAC;YAChD,WAAW,EAAE,YAAY,mBAAmB,EAAE;YAC9C,eAAe;YACf,SAAS,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE,yBAAiB,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC,EAAE;YACzF,aAAa,EAAE,6CAA6C;SAC7D,CAAC,CAAA;QACF,OAAO,QAAQ,CAAC,YAAY,CAAC,CAAA;IAC/B,CAAC,CAAA;IAED,MAAM,QAAQ,GAAG,MAAA,IAAA,kBAAG,EAAC,MAAM,IAAA,oCAAqB,EAAC,qBAAqB,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,mCAAI,CAAC,MAAM,QAAQ,EAAE,CAAC,CAAA;IAC/J,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7C,IAAI,CAAC,CAAC,MAAM,IAAA,qBAAM,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,iBAAiB,KAAK,CAAC,CAAC,CAAC,uBAAuB,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;QAC7E,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["import { Arch, exists, resolveEnvToolsetPath, use } from \"builder-util\"\nimport * as path from \"path\"\nimport { getBinFromUrl } from \"../binDownload\"\nimport { ToolsetConfig } from \"../configuration\"\nimport { downloadBuilderToolset } from \"../util/electronGet\"\n\nconst fpmChecksums = {\n \"fpm-1.17.0-ruby-3.4.3-darwin-arm64.7z\": \"6cc6d4785875bc7d79bdf52ca146080a4c300e1d663376ae79615fb548030ede\",\n \"fpm-1.17.0-ruby-3.4.3-darwin-x86_64.7z\": \"f7cb468c5e64177124c9d3a5f400ac20ffcb411aa5aa0ea224a808ff5a2d3bbf\",\n \"fpm-1.17.0-ruby-3.4.3-linux-amd64.7z\": \"44b0ec6025c14ec137f56180e62675c0eae36233cdce53d0953d9c73ced8989f\",\n \"fpm-1.17.0-ruby-3.4.3-linux-arm64v8.7z\": \"338b50cfa7f12d745a997d1a3d000bcd0410008050fa7d8c4476a78a61c0564e\",\n \"fpm-1.17.0-ruby-3.4.3-linux-i386.7z\": \"181124e2e9856855c21229ea9096bb7006a9e3e712d133ce332597ba878cd7b6\",\n} as const\n\nexport const appimageChecksums = {\n \"0.0.0\": {\n \"appimage-12.0.1.7z\": \"d12ff7eb8f1d1ec4652ca5237a7fbdca33acc0c758045636feca62dc6ecb8ec4\",\n },\n \"1.0.2\": {\n \"appimage-tools-runtime-20251108.tar.gz\": \"a784a8c26331ec2e945c23d6bdb14af5c9df27f5939825d84b8709c61dc81eb0\",\n },\n \"1.0.3\": {\n \"appimage-tools-runtime-20251108.tar.gz\": \"84021a78ee214ae6fd33a2d62a92ba25542dd10bc86bf117a9b2d0bba44e7665\",\n },\n} as const\n\n// no legacy toolset as macos arm64 BSD gtar/ar/lzip are not compatible with linux targets, so we always use newer toolset on macos for linux archives\nconst linuxToolsMacChecksums = {\n \"linux-tools-mac-darwin-arm64.tar.gz\": \"3dcb43a12b8630919b8d5cc9045be102108b0edd9b0354e0a7409ee5b53141ac\",\n \"linux-tools-mac-darwin-x86_64.tar.gz\": \"d62f5e2f6949c6420fdda8b18d2e70b0e14eeb959128c0cea11acada2c105ad9\",\n} as const\n\nexport async function getLinuxToolsPath(): Promise<string> {\n const envPath = await resolveEnvToolsetPath(\"LINUX_TOOLS_MAC_PATH\", \"directory\")\n if (envPath != null) {\n return envPath\n }\n const arch = process.arch === \"arm64\" ? \"arm64\" : \"x86_64\"\n const toolsetVersion = \"1.0.1\"\n const filename: keyof typeof linuxToolsMacChecksums = `linux-tools-mac-darwin-${arch}.tar.gz`\n return await downloadBuilderToolset({\n releaseName: `linux-tools-mac@${toolsetVersion}`,\n filenameWithExt: filename,\n checksums: {\n [filename]: linuxToolsMacChecksums[filename],\n },\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n}\n\nexport async function getLinuxToolsMacToolset() {\n const linuxToolsPath = await getLinuxToolsPath()\n const bin = (pkg: string) => path.join(linuxToolsPath, \"bin\", pkg)\n return {\n ar: bin(\"ar\"),\n lzip: bin(\"lzip\"),\n gtar: bin(\"gtar\"),\n }\n}\n\nexport async function getFpmPath() {\n const customFpmPath = await resolveEnvToolsetPath(\"CUSTOM_FPM_PATH\", \"file\")\n if (customFpmPath != null) {\n return customFpmPath\n }\n const exec = \"fpm\"\n if (process.platform === \"win32\" || process.env.USE_SYSTEM_FPM === \"true\") {\n return exec\n }\n const getKey = () => {\n if (process.platform === \"linux\") {\n if (process.arch == \"x64\") {\n return \"fpm-1.17.0-ruby-3.4.3-linux-amd64.7z\"\n } else if (process.arch === \"arm64\") {\n return \"fpm-1.17.0-ruby-3.4.3-linux-arm64v8.7z\"\n }\n return \"fpm-1.17.0-ruby-3.4.3-linux-i386.7z\"\n }\n // darwin arm64\n if (process.arch === \"arm64\") {\n return \"fpm-1.17.0-ruby-3.4.3-darwin-arm64.7z\"\n }\n return \"fpm-1.17.0-ruby-3.4.3-darwin-x86_64.7z\"\n }\n\n const filename = getKey()\n const fpmPath = await getBinFromUrl(\"fpm@2.1.4\", filename, fpmChecksums[filename])\n return path.join(fpmPath, exec)\n}\n\nexport async function getAppImageTools(appimageToolVersion: ToolsetConfig[\"appimage\"], targetArch: Arch) {\n const runtimeArch = targetArch === Arch.armv7l ? \"arm32\" : targetArch === Arch.arm64 ? \"arm64\" : targetArch === Arch.ia32 ? \"ia32\" : \"x64\"\n\n // Static-runtime layout: tools at root, runtimes/ subdir, lib/{arch}/ subdir\n const getPaths = (artifactPath: string) => ({\n mksquashfs: path.resolve(artifactPath, \"mksquashfs\"),\n desktopFileValidate: path.resolve(artifactPath, \"desktop-file-validate\"),\n runtime: path.resolve(artifactPath, \"runtimes\", `runtime-${runtimeArch}`),\n runtimeLibraries: path.resolve(artifactPath, \"lib\", runtimeArch),\n })\n\n // FUSE2 layout: tools under a host-platform subdir; runtime files at root with target-arch suffix\n const getFuse2Paths = (artifactPath: string) => {\n // mksquashfs/desktop-file-validate are HOST binaries — use process.arch, not targetArch\n const hostArch = process.arch === \"arm\" ? \"arm32\" : process.arch === \"arm64\" ? \"arm64\" : process.arch === \"ia32\" ? \"ia32\" : \"x64\"\n const toolRoot = process.platform === \"linux\" ? `linux-${hostArch}` : \"darwin\"\n // Runtime files live at root; armv7l target uses \"armv7l\" filename, not the internal \"arm32\" alias\n const runtimeSuffix = targetArch === Arch.armv7l ? \"armv7l\" : runtimeArch\n // FUSE2 tree only ships lib/ia32 and lib/x64; arm targets fall back to x64 here\n // but buildLegacyFuse2AppImage only copies runtimeLibraries for x64/ia32.\n const libArch = targetArch === Arch.ia32 ? \"ia32\" : \"x64\"\n return {\n mksquashfs: path.resolve(artifactPath, toolRoot, \"mksquashfs\"),\n desktopFileValidate: path.resolve(artifactPath, toolRoot, \"desktop-file-validate\"),\n runtime: path.resolve(artifactPath, `runtime-${runtimeSuffix}`),\n runtimeLibraries: path.resolve(artifactPath, \"lib\", libArch),\n }\n }\n\n const isFuse2 = appimageToolVersion === \"0.0.0\" || appimageToolVersion == null\n\n const download = async () => {\n if (isFuse2) {\n const filenameWithExt = \"appimage-12.0.1.7z\"\n const artifactPath = await downloadBuilderToolset({\n releaseName: \"appimage-12.0.1\",\n filenameWithExt,\n checksums: { [filenameWithExt]: appimageChecksums[\"0.0.0\"][filenameWithExt] },\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n return getFuse2Paths(artifactPath)\n }\n\n const filenameWithExt = \"appimage-tools-runtime-20251108.tar.gz\"\n const artifactPath = await downloadBuilderToolset({\n releaseName: `appimage@${appimageToolVersion}`,\n filenameWithExt,\n checksums: { [filenameWithExt]: appimageChecksums[appimageToolVersion][filenameWithExt] },\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n return getPaths(artifactPath)\n }\n\n const artifact = use(await resolveEnvToolsetPath(\"APPIMAGE_TOOLS_PATH\", \"directory\"), it => (isFuse2 ? getFuse2Paths(it) : getPaths(it))) ?? (await download())\n for (const entry of Object.entries(artifact)) {\n if (!(await exists(entry[1]))) {\n throw new Error(`AppImage tool ${entry[0]} not found at path: ${entry[1]}`)\n }\n }\n return artifact\n}\n"]}
@@ -52,4 +52,25 @@ export declare function resolveFirstMatchingCollection(options: {
52
52
  dependencies: Record<string, string> | undefined;
53
53
  run: CollectorRunner;
54
54
  }): Promise<CollectedNodeModules | undefined>;
55
+ /**
56
+ * Enforces `allowMissingDependencies` against the finished collection summary (issue #10058).
57
+ * Runs only after collection completes, so the error reports the COMPLETE set of missing
58
+ * production dependencies at once instead of failing on the first one.
59
+ *
60
+ * v26 defaults to warn-only: `true` and omitted keep the historical warning behavior of the
61
+ * stable 26.x line, while `false`/`null` fail the build on any missing production dependency
62
+ * (the electron-builder 27+ default). When the option is a `string[]`, only the listed dependency
63
+ * names are allowed to be missing — matched against the package name parsed from the summary's
64
+ * `name@version` entries (scoped names included), with an exact-entry match accepted as well.
65
+ *
66
+ * Only genuinely missing production dependencies (`PKG_NOT_FOUND` / `PKG_NOT_ON_DISK`) are fatal;
67
+ * missing optional dependencies (`PKG_OPTIONAL_NOT_INSTALLED` / `PKG_OPTIONAL_PLATFORM_NOT_INSTALLED`)
68
+ * never fail the build.
69
+ *
70
+ * Exported for tests (an internal-tagged export would be stripped from the declarations the test
71
+ * project consumes).
72
+ */
73
+ export declare function enforceAllowMissingDependencies(allowMissingDependencies: boolean | Array<string> | null | undefined, logSummary: ModuleManager["logSummary"] | undefined): void;
74
+ /** Exported for tests (an internal-tagged export would be stripped from the declarations the test project consumes). */
75
+ export declare function collectNodeModulesWithLogging(platformPackager: PlatformPackager<any>): Promise<NodeModuleInfo[]>;
55
76
  export {};
@@ -8,6 +8,8 @@ exports.computeFileSets = computeFileSets;
8
8
  exports.computeNodeModuleFileSets = computeNodeModuleFileSets;
9
9
  exports.collectionMatchesAppDependencies = collectionMatchesAppDependencies;
10
10
  exports.resolveFirstMatchingCollection = resolveFirstMatchingCollection;
11
+ exports.enforceAllowMissingDependencies = enforceAllowMissingDependencies;
12
+ exports.collectNodeModulesWithLogging = collectNodeModulesWithLogging;
11
13
  const builder_util_1 = require("builder-util");
12
14
  const fs_extra_1 = require("fs-extra");
13
15
  const promises_1 = require("fs/promises");
@@ -229,6 +231,59 @@ async function resolveFirstMatchingCollection(options) {
229
231
  }
230
232
  return fallback;
231
233
  }
234
+ /** Extracts the package name from a `name@version` log-summary entry, handling `@scope/name@version`. */
235
+ function dependencyNameFromSummaryId(id) {
236
+ let at;
237
+ if (id.startsWith("@")) {
238
+ // Scoped package: the version separator is the first `@` after the scope's `/`
239
+ const slashIndex = id.indexOf("/");
240
+ if (slashIndex === -1) {
241
+ return id;
242
+ }
243
+ at = id.indexOf("@", slashIndex + 1);
244
+ }
245
+ else {
246
+ at = id.indexOf("@");
247
+ }
248
+ return at > 0 ? id.slice(0, at) : id;
249
+ }
250
+ /**
251
+ * Enforces `allowMissingDependencies` against the finished collection summary (issue #10058).
252
+ * Runs only after collection completes, so the error reports the COMPLETE set of missing
253
+ * production dependencies at once instead of failing on the first one.
254
+ *
255
+ * v26 defaults to warn-only: `true` and omitted keep the historical warning behavior of the
256
+ * stable 26.x line, while `false`/`null` fail the build on any missing production dependency
257
+ * (the electron-builder 27+ default). When the option is a `string[]`, only the listed dependency
258
+ * names are allowed to be missing — matched against the package name parsed from the summary's
259
+ * `name@version` entries (scoped names included), with an exact-entry match accepted as well.
260
+ *
261
+ * Only genuinely missing production dependencies (`PKG_NOT_FOUND` / `PKG_NOT_ON_DISK`) are fatal;
262
+ * missing optional dependencies (`PKG_OPTIONAL_NOT_INSTALLED` / `PKG_OPTIONAL_PLATFORM_NOT_INSTALLED`)
263
+ * never fail the build.
264
+ *
265
+ * Exported for tests (an internal-tagged export would be stripped from the declarations the test
266
+ * project consumes).
267
+ */
268
+ function enforceAllowMissingDependencies(allowMissingDependencies, logSummary) {
269
+ var _a, _b;
270
+ // v26 default: omitted behaves like `true` (warn-only) so existing 26.x builds keep working.
271
+ if (allowMissingDependencies === true || allowMissingDependencies === undefined) {
272
+ return;
273
+ }
274
+ const missing = new Set([...((_a = logSummary === null || logSummary === void 0 ? void 0 : logSummary[moduleManager_1.LogMessageByKey.PKG_NOT_FOUND]) !== null && _a !== void 0 ? _a : []), ...((_b = logSummary === null || logSummary === void 0 ? void 0 : logSummary[moduleManager_1.LogMessageByKey.PKG_NOT_ON_DISK]) !== null && _b !== void 0 ? _b : [])]);
275
+ const allowed = new Set(Array.isArray(allowMissingDependencies) ? allowMissingDependencies : []);
276
+ const fatal = Array.from(missing)
277
+ .filter(id => !allowed.has(dependencyNameFromSummaryId(id)) && !allowed.has(id))
278
+ .sort();
279
+ if (fatal.length === 0) {
280
+ return;
281
+ }
282
+ throw new builder_util_1.InvalidConfigurationError(`The following production dependencies could not be resolved during node-module collection:\n` +
283
+ fatal.map(id => ` - ${id}`).join("\n") +
284
+ `\nInstall the missing dependencies, list names in \`allowMissingDependencies\` to allow specific ones to be missing, or set \`allowMissingDependencies\` to true to only warn.`);
285
+ }
286
+ /** Exported for tests (an internal-tagged export would be stripped from the declarations the test project consumes). */
232
287
  async function collectNodeModulesWithLogging(platformPackager) {
233
288
  var _a, _b;
234
289
  const packager = platformPackager.info;
@@ -252,6 +307,9 @@ async function collectNodeModulesWithLogging(platformPackager) {
252
307
  const logLevel = moduleManager_1.logMessageLevelByKey[errorMessage] || "debug";
253
308
  builder_util_1.log[logLevel]({ dependencies }, errorMessage);
254
309
  }
310
+ // Enforcement (issue #10058): collection is complete and the summary above has reached the log,
311
+ // so failing here reports every missing production dependency at once.
312
+ enforceAllowMissingDependencies(packager.config.allowMissingDependencies, deps.logSummary);
255
313
  return deps.nodeModules;
256
314
  }
257
315
  async function compileUsingElectronCompile(mainFileSet, packager) {
@@ -1 +1 @@
1
- {"version":3,"file":"appFileCopier.js","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":";;;AAsBA,gDAYC;AAED,oCAyCC;AAaD,wCAoCC;AAED,0CA4BC;AAwBD,8DA8BC;AA2BD,4EASC;AASD,wEA0BC;AAzRD,+CAA6I;AAE7I,uCAAwC;AACxC,0CAA6C;AAC7C,6BAA4B;AAC5B,qDAAuC;AACvC,2DAAmD;AACnD,kCAAkC;AAClC,gDAA0D;AAC1D,wDAAqF;AACrF,oEAA2E;AAC3E,0EAA6G;AAG7G,mDAA+C;AAC/C,iEAA6D;AAG7D,MAAM,wBAAwB,GAAG,GAAG,IAAI,CAAC,GAAG,mBAAmB,IAAI,CAAC,GAAG,EAAE,CAAA;AACzE,gBAAgB;AACH,QAAA,8BAA8B,GAAG,WAAW,CAAA;AAEzD,SAAgB,kBAAkB,CAAC,IAAY,EAAE,OAAwB;IACvE,IAAI,IAAI,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC;QACzB,OAAO,OAAO,CAAC,WAAW,CAAA;IAC5B,CAAC;IAED,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAA;IAChC,gEAAgE;IAChE,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;IAClD,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAEM,KAAK,UAAU,YAAY,CAAC,OAAwB,EAAE,QAAkB,EAAE,WAA4B;IAC3G,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IACjC,2BAA2B;IAC3B,MAAM,WAAW,GAAG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,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK,EAAS,CAAC,CAAA;IACxH,IAAI,WAAW,CAAC,gBAAgB,IAAI,IAAI,EAAE,CAAC;QACzC,WAAW,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAA;IAC1C,CAAC;IACD,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAC9B,WAAW,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAC5B;;kFAE8E,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,OAAO;CAClH,CACE,CAAA;IACD,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,CAAA;AACzG,CAAC","sourcesContent":["import { AsyncTaskManager, FileCopier, FileTransformer, isEmptyOrSpaces, Link, log, MAX_FILE_REQUESTS, statOrNull, walk } from \"builder-util\"\nimport { Stats } from \"fs\"\nimport { ensureSymlink } from \"fs-extra\"\nimport { mkdir, readlink } from \"fs/promises\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { isLibOrExe } from \"../asar/unpackDetector\"\nimport { Platform } from \"../core\"\nimport { excludedExts, FileMatcher } from \"../fileMatcher\"\nimport { createElectronCompilerHost, NODE_MODULES_PATTERN } from \"../fileTransformer\"\nimport { getCollectorByPackageManager, PM } from \"../node-module-collector\"\nimport { LogMessageByKey, logMessageLevelByKey, ModuleManager } from \"../node-module-collector/moduleManager\"\nimport { Packager } from \"../packager\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { AppFileWalker } from \"./AppFileWalker\"\nimport { NodeModuleCopyHelper } from \"./NodeModuleCopyHelper\"\nimport { NodeModuleInfo } from \"./packageDependencies\"\n\nconst BOWER_COMPONENTS_PATTERN = `${path.sep}bower_components${path.sep}`\n/** @internal */\nexport const ELECTRON_COMPILE_SHIM_FILENAME = \"__shim.js\"\n\nexport function getDestinationPath(file: string, fileSet: ResolvedFileSet) {\n if (file === fileSet.src) {\n return fileSet.destination\n }\n\n const src = fileSet.src\n const dest = fileSet.destination\n // get node_modules path relative to src and then append to dest\n if (file.startsWith(src)) {\n return path.join(dest, path.relative(src, file))\n }\n return dest\n}\n\nexport async function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager, transformer: FileTransformer) {\n const metadata = fileSet.metadata\n // search auto unpacked dir\n const taskManager = new AsyncTaskManager(packager.cancellationToken)\n const createdParentDirs = new Set<string>()\n\n const fileCopier = new FileCopier(file => {\n return !isLibOrExe(file)\n }, transformer)\n const links: Array<Link> = []\n for (let i = 0, n = fileSet.files.length; i < n; i++) {\n const sourceFile = fileSet.files[i]\n const stat = metadata.get(sourceFile)\n if (stat == null) {\n // dir\n continue\n }\n\n const destinationFile = getDestinationPath(sourceFile, fileSet)\n if (stat.isSymbolicLink()) {\n links.push({ file: destinationFile, link: await readlink(sourceFile) })\n continue\n }\n\n const fileParent = path.dirname(destinationFile)\n if (!createdParentDirs.has(fileParent)) {\n createdParentDirs.add(fileParent)\n await mkdir(fileParent, { recursive: true })\n }\n\n taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat))\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n }\n\n if (taskManager.tasks.length > 0) {\n await taskManager.awaitTasks()\n }\n\n await asyncPool(MAX_FILE_REQUESTS, links, it => ensureSymlink(it.link, it.file))\n}\n\n// os path separator is used\nexport interface ResolvedFileSet {\n src: string\n destination: string\n\n files: Array<string>\n metadata: Map<string, Stats>\n transformedFiles?: Map<number, string | Buffer> | null\n}\n\n// used only for ASAR, if no asar, file transformed on the fly\nexport async function transformFiles(transformer: FileTransformer, fileSet: ResolvedFileSet): Promise<void> {\n if (transformer == null) {\n return\n }\n\n let transformedFiles = fileSet.transformedFiles\n if (fileSet.transformedFiles == null) {\n transformedFiles = new Map()\n fileSet.transformedFiles = transformedFiles\n }\n\n const metadata = fileSet.metadata\n const filesPromise = fileSet.files.map(async (it, index) => {\n const fileStat = metadata.get(it)\n if (fileStat == null || !fileStat.isFile()) {\n return\n }\n\n const transformedValue = transformer(it)\n if (transformedValue == null) {\n return\n }\n\n if (typeof transformedValue === \"object\" && \"then\" in transformedValue) {\n return (transformedValue as Promise<any>).then(it => {\n if (it != null) {\n transformedFiles!.set(index, it)\n }\n return\n })\n }\n transformedFiles!.set(index, transformedValue as string | Buffer)\n return\n })\n // `asyncPool` doesn't provide `index` in it's handler, so we `map` first before using it\n await asyncPool(MAX_FILE_REQUESTS, filesPromise, promise => promise)\n}\n\nexport async function computeFileSets(\n matchers: Array<FileMatcher>,\n transformer: FileTransformer | null,\n platformPackager: PlatformPackager<any>,\n isElectronCompile: boolean\n): Promise<Array<ResolvedFileSet>> {\n const fileSets: Array<ResolvedFileSet> = []\n const packager = platformPackager.info\n\n for (const matcher of matchers) {\n const fileWalker = new AppFileWalker(matcher, packager)\n\n const fromStat = await statOrNull(matcher.from)\n if (fromStat == null) {\n log.debug({ directory: matcher.from, reason: \"doesn't exist\" }, `skipped copying`)\n continue\n }\n\n const files = await walk(matcher.from, fileWalker.filter, fileWalker)\n const metadata = fileWalker.metadata\n fileSets.push(validateFileSet({ src: matcher.from, files, metadata, destination: matcher.to }))\n }\n\n if (isElectronCompile) {\n // cache files should be first (better IO)\n fileSets.unshift(await compileUsingElectronCompile(fileSets[0], packager))\n }\n return fileSets\n}\n\nfunction getNodeModuleExcludedExts(platformPackager: PlatformPackager<any>) {\n // do not exclude *.h files (https://github.com/electron-userland/electron-builder/issues/2852)\n const result = [\".o\", \".obj\"].concat(excludedExts.split(\",\").map(it => `.${it}`))\n if (platformPackager.config.includePdb !== true) {\n result.push(\".pdb\")\n }\n if (platformPackager.platform !== Platform.WINDOWS) {\n // https://github.com/electron-userland/electron-builder/issues/1738\n result.push(\".dll\")\n result.push(\".exe\")\n }\n return result\n}\n\nfunction validateFileSet(fileSet: ResolvedFileSet): ResolvedFileSet {\n if (fileSet.src == null || fileSet.src.length === 0) {\n throw new Error(\"fileset src is empty\")\n }\n return fileSet\n}\n\n/** @internal */\nexport async function computeNodeModuleFileSets(platformPackager: PlatformPackager<any>, mainMatcher: FileMatcher): Promise<Array<ResolvedFileSet>> {\n const deps = await collectNodeModulesWithLogging(platformPackager)\n\n const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager)\n // serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure\n const result = new Array<ResolvedFileSet>()\n let index = 0\n const NODE_MODULES = \"node_modules\"\n\n const collectNodeModules = async (dep: NodeModuleInfo, destination: string) => {\n const source = dep.dir\n const matcher = new FileMatcher(source, destination, mainMatcher.macroExpander, mainMatcher.patterns)\n const copier = new NodeModuleCopyHelper(matcher, platformPackager.info)\n const files = await copier.collectNodeModules(dep, nodeModuleExcludedExts, path.relative(mainMatcher.to, destination))\n result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata })\n\n log.debug({ dep: dep.name, from: log.filePath(source), to: log.filePath(destination), filesCount: files.length }, \"identified module\")\n\n if (dep.dependencies) {\n for (const c of dep.dependencies) {\n await collectNodeModules(c, path.join(destination, NODE_MODULES, c.name))\n }\n }\n }\n\n for (const dep of deps) {\n const destination = path.join(mainMatcher.to, NODE_MODULES, dep.name)\n await collectNodeModules(dep, destination)\n }\n return result\n}\n\ntype CollectedNodeModules = { nodeModules: NodeModuleInfo[]; logSummary: ModuleManager[\"logSummary\"] }\n\n/** Runs a single package-manager collector against a single directory. */\ntype CollectorRunner = (pm: PM, dir: string) => Promise<CollectedNodeModules>\n\n// `workspace:`/`file:`/`link:`/`portal:` dependencies are symlinked into place rather than\n// installed as standalone, hoistable packages, so they may legitimately be absent from a\n// collected tree and cannot be used to validate it.\nconst LOCAL_DEPENDENCY_SPEC = /^(?:workspace|file|link|portal):/\n\n/**\n * Determines whether a collected module tree actually describes the package being built.\n *\n * A package-manager `list` invocation can resolve to the wrong project root — most notably when\n * electron-builder is run from a workspace sub-package whose dependencies are hoisted to the\n * workspace root. In that case the collector returns a non-empty but unrelated tree. Accepting it\n * would suppress the manual-traversal fallback that resolves the correct modules, so we need to\n * tell a matching collection from a mismatched one.\n *\n * A collection matches when at least one of the package's declared external (registry-installed,\n * non-`workspace:`/`file:`/`link:`/`portal:`) production dependencies is present at the top level —\n * those direct dependencies are always hoisted to the top level of a correct collection. When the\n * package declares no external production dependencies there is nothing to validate against, so any\n * non-empty collection is accepted.\n */\nexport function collectionMatchesAppDependencies(nodeModules: NodeModuleInfo[], dependencies: Record<string, string> | undefined): boolean {\n const requiredExternalDeps = Object.entries(dependencies ?? {})\n .filter(([, spec]) => !LOCAL_DEPENDENCY_SPEC.test(spec))\n .map(([name]) => name)\n if (requiredExternalDeps.length === 0) {\n return true\n }\n const collected = new Set(nodeModules.map(it => it.name))\n return requiredExternalDeps.some(name => collected.has(name))\n}\n\n/**\n * Walks the candidate (package-manager, directory) combinations and returns the first collection\n * that both contains modules and matches the package being built (see\n * {@link collectionMatchesAppDependencies}). A non-empty collection that does NOT match — e.g. a\n * workspace-root tree returned for a sub-package — is retained only as a last-resort fallback so a\n * later approach (notably {@link PM.TRAVERSAL}) can supply the correct modules.\n */\nexport async function resolveFirstMatchingCollection(options: {\n pmApproaches: PM[]\n searchDirectories: string[]\n dependencies: Record<string, string> | undefined\n run: CollectorRunner\n}): Promise<CollectedNodeModules | undefined> {\n const { pmApproaches, searchDirectories, dependencies, run } = options\n let fallback: CollectedNodeModules | undefined\n\n for (const pm of pmApproaches) {\n for (const dir of searchDirectories) {\n log.info({ pm, searchDir: dir }, \"searching for node modules\")\n const deps = await run(pm, dir)\n if (deps.nodeModules.length === 0) {\n log.info({ pm, searchDir: dir }, \"no node modules found in collection, trying next search directory\")\n continue\n }\n if (collectionMatchesAppDependencies(deps.nodeModules, dependencies)) {\n log.debug({ pm, searchDir: dir, depCount: deps.nodeModules.length }, \"collected node modules\")\n return deps\n }\n log.info({ pm, searchDir: dir }, \"collected node modules do not match the target package, trying next search directory/approach\")\n fallback ??= deps\n }\n }\n return fallback\n}\n\nasync function collectNodeModulesWithLogging(platformPackager: PlatformPackager<any>) {\n const packager = platformPackager.info\n const { tempDirManager, appDir, projectDir } = packager\n\n const searchDirectories = Array.from(new Set([appDir, projectDir, await packager.getWorkspaceRoot()])).filter((it): it is string => isEmptyOrSpaces(it) === false)\n const pmApproaches = [await packager.getPackageManager(), PM.TRAVERSAL]\n\n // Validate against the as-declared (pre-extraMetadata) production dependencies so a configured\n // `extraMetadata.dependencies` entry that isn't installed cannot reject a correct collection.\n const deps = await resolveFirstMatchingCollection({\n pmApproaches,\n searchDirectories,\n dependencies: packager.originalMetadata.dependencies,\n run: (pm, dir) => getCollectorByPackageManager(pm, dir, tempDirManager).getNodeModules({ packageName: packager.nodePackageName }),\n })\n\n if (!deps?.nodeModules?.length) {\n log.warn({ searchDirectories: searchDirectories.map(it => log.filePath(it)) }, \"no node modules returned while searching directories\")\n return []\n }\n\n const summary = Object.entries(deps.logSummary ?? {}).filter(([, dependencies]) => Array.isArray(dependencies) && dependencies.length > 0)\n for (const [errorMessage, dependencies] of summary) {\n const logLevel = logMessageLevelByKey[errorMessage as LogMessageByKey] || \"debug\"\n log[logLevel]({ dependencies }, errorMessage)\n }\n\n return deps.nodeModules\n}\n\nasync function compileUsingElectronCompile(mainFileSet: ResolvedFileSet, packager: Packager): Promise<ResolvedFileSet> {\n log.info(\"compiling using electron-compile\")\n\n const electronCompileCache = await packager.tempDirManager.getTempDir({ prefix: \"electron-compile-cache\" })\n const cacheDir = path.join(electronCompileCache, \".cache\")\n // clear and create cache dir\n await mkdir(cacheDir, { recursive: true })\n const compilerHost = await createElectronCompilerHost(mainFileSet.src, cacheDir)\n const nextSlashIndex = mainFileSet.src.length + 1\n // pre-compute electron-compile to cache dir - we need to process only subdirectories, not direct files of app dir\n const filesPromise: Promise<any>[] = mainFileSet.files.map(file => {\n if (\n file.includes(NODE_MODULES_PATTERN) ||\n file.includes(BOWER_COMPONENTS_PATTERN) ||\n !file.includes(path.sep, nextSlashIndex) || // ignore not root files\n !mainFileSet.metadata.get(file)!.isFile()\n ) {\n return\n }\n return compilerHost.compile(file)\n })\n await asyncPool(MAX_FILE_REQUESTS, filesPromise, promise => promise)\n await compilerHost.saveConfiguration()\n\n const metadata = new Map<string, Stats>()\n const cacheFiles = await walk(cacheDir, file => !file.startsWith(\".\"), {\n consume: (file, fileStat) => {\n if (fileStat.isFile()) {\n metadata.set(file, fileStat)\n }\n return null\n },\n })\n\n // add shim\n const shimPath = `${mainFileSet.src}${path.sep}${ELECTRON_COMPILE_SHIM_FILENAME}`\n mainFileSet.files.push(shimPath)\n mainFileSet.metadata.set(shimPath, { isFile: () => true, isDirectory: () => false, isSymbolicLink: () => false } as any)\n if (mainFileSet.transformedFiles == null) {\n mainFileSet.transformedFiles = new Map()\n }\n mainFileSet.transformedFiles.set(\n mainFileSet.files.length - 1,\n `\n'use strict';\nrequire('electron-compile').init(__dirname, require('path').resolve(__dirname, '${packager.metadata.main || \"index\"}'), true);\n`\n )\n return { src: electronCompileCache, files: cacheFiles, metadata, destination: mainFileSet.destination }\n}\n"]}
1
+ {"version":3,"file":"appFileCopier.js","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":";;;AAsBA,gDAYC;AAED,oCAyCC;AAaD,wCAoCC;AAED,0CA4BC;AAwBD,8DA8BC;AA2BD,4EASC;AASD,wEA0BC;AAoCD,0EAkBC;AAGD,sEAgCC;AAlXD,+CAAwK;AAExK,uCAAwC;AACxC,0CAA6C;AAC7C,6BAA4B;AAC5B,qDAAuC;AACvC,2DAAmD;AACnD,kCAAkC;AAClC,gDAA0D;AAC1D,wDAAqF;AACrF,oEAA2E;AAC3E,0EAA6G;AAG7G,mDAA+C;AAC/C,iEAA6D;AAG7D,MAAM,wBAAwB,GAAG,GAAG,IAAI,CAAC,GAAG,mBAAmB,IAAI,CAAC,GAAG,EAAE,CAAA;AACzE,gBAAgB;AACH,QAAA,8BAA8B,GAAG,WAAW,CAAA;AAEzD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,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK,EAAS,CAAC,CAAA;IACxH,IAAI,WAAW,CAAC,gBAAgB,IAAI,IAAI,EAAE,CAAC;QACzC,WAAW,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAA;IAC1C,CAAC;IACD,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAC9B,WAAW,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAC5B;;kFAE8E,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,OAAO;CAClH,CACE,CAAA;IACD,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,CAAA;AACzG,CAAC","sourcesContent":["import { AsyncTaskManager, FileCopier, FileTransformer, InvalidConfigurationError, isEmptyOrSpaces, Link, log, MAX_FILE_REQUESTS, statOrNull, walk } from \"builder-util\"\nimport { Stats } from \"fs\"\nimport { ensureSymlink } from \"fs-extra\"\nimport { mkdir, readlink } from \"fs/promises\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { isLibOrExe } from \"../asar/unpackDetector\"\nimport { Platform } from \"../core\"\nimport { excludedExts, FileMatcher } from \"../fileMatcher\"\nimport { createElectronCompilerHost, NODE_MODULES_PATTERN } from \"../fileTransformer\"\nimport { getCollectorByPackageManager, PM } from \"../node-module-collector\"\nimport { LogMessageByKey, logMessageLevelByKey, ModuleManager } from \"../node-module-collector/moduleManager\"\nimport { Packager } from \"../packager\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { AppFileWalker } from \"./AppFileWalker\"\nimport { NodeModuleCopyHelper } from \"./NodeModuleCopyHelper\"\nimport { NodeModuleInfo } from \"./packageDependencies\"\n\nconst BOWER_COMPONENTS_PATTERN = `${path.sep}bower_components${path.sep}`\n/** @internal */\nexport const ELECTRON_COMPILE_SHIM_FILENAME = \"__shim.js\"\n\nexport function getDestinationPath(file: string, fileSet: ResolvedFileSet) {\n if (file === fileSet.src) {\n return fileSet.destination\n }\n\n const src = fileSet.src\n const dest = fileSet.destination\n // get node_modules path relative to src and then append to dest\n if (file.startsWith(src)) {\n return path.join(dest, path.relative(src, file))\n }\n return dest\n}\n\nexport async function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager, transformer: FileTransformer) {\n const metadata = fileSet.metadata\n // search auto unpacked dir\n const taskManager = new AsyncTaskManager(packager.cancellationToken)\n const createdParentDirs = new Set<string>()\n\n const fileCopier = new FileCopier(file => {\n return !isLibOrExe(file)\n }, transformer)\n const links: Array<Link> = []\n for (let i = 0, n = fileSet.files.length; i < n; i++) {\n const sourceFile = fileSet.files[i]\n const stat = metadata.get(sourceFile)\n if (stat == null) {\n // dir\n continue\n }\n\n const destinationFile = getDestinationPath(sourceFile, fileSet)\n if (stat.isSymbolicLink()) {\n links.push({ file: destinationFile, link: await readlink(sourceFile) })\n continue\n }\n\n const fileParent = path.dirname(destinationFile)\n if (!createdParentDirs.has(fileParent)) {\n createdParentDirs.add(fileParent)\n await mkdir(fileParent, { recursive: true })\n }\n\n taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat))\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n }\n\n if (taskManager.tasks.length > 0) {\n await taskManager.awaitTasks()\n }\n\n await asyncPool(MAX_FILE_REQUESTS, links, it => ensureSymlink(it.link, it.file))\n}\n\n// os path separator is used\nexport interface ResolvedFileSet {\n src: string\n destination: string\n\n files: Array<string>\n metadata: Map<string, Stats>\n transformedFiles?: Map<number, string | Buffer> | null\n}\n\n// used only for ASAR, if no asar, file transformed on the fly\nexport async function transformFiles(transformer: FileTransformer, fileSet: ResolvedFileSet): Promise<void> {\n if (transformer == null) {\n return\n }\n\n let transformedFiles = fileSet.transformedFiles\n if (fileSet.transformedFiles == null) {\n transformedFiles = new Map()\n fileSet.transformedFiles = transformedFiles\n }\n\n const metadata = fileSet.metadata\n const filesPromise = fileSet.files.map(async (it, index) => {\n const fileStat = metadata.get(it)\n if (fileStat == null || !fileStat.isFile()) {\n return\n }\n\n const transformedValue = transformer(it)\n if (transformedValue == null) {\n return\n }\n\n if (typeof transformedValue === \"object\" && \"then\" in transformedValue) {\n return (transformedValue as Promise<any>).then(it => {\n if (it != null) {\n transformedFiles!.set(index, it)\n }\n return\n })\n }\n transformedFiles!.set(index, transformedValue as string | Buffer)\n return\n })\n // `asyncPool` doesn't provide `index` in it's handler, so we `map` first before using it\n await asyncPool(MAX_FILE_REQUESTS, filesPromise, promise => promise)\n}\n\nexport async function computeFileSets(\n matchers: Array<FileMatcher>,\n transformer: FileTransformer | null,\n platformPackager: PlatformPackager<any>,\n isElectronCompile: boolean\n): Promise<Array<ResolvedFileSet>> {\n const fileSets: Array<ResolvedFileSet> = []\n const packager = platformPackager.info\n\n for (const matcher of matchers) {\n const fileWalker = new AppFileWalker(matcher, packager)\n\n const fromStat = await statOrNull(matcher.from)\n if (fromStat == null) {\n log.debug({ directory: matcher.from, reason: \"doesn't exist\" }, `skipped copying`)\n continue\n }\n\n const files = await walk(matcher.from, fileWalker.filter, fileWalker)\n const metadata = fileWalker.metadata\n fileSets.push(validateFileSet({ src: matcher.from, files, metadata, destination: matcher.to }))\n }\n\n if (isElectronCompile) {\n // cache files should be first (better IO)\n fileSets.unshift(await compileUsingElectronCompile(fileSets[0], packager))\n }\n return fileSets\n}\n\nfunction getNodeModuleExcludedExts(platformPackager: PlatformPackager<any>) {\n // do not exclude *.h files (https://github.com/electron-userland/electron-builder/issues/2852)\n const result = [\".o\", \".obj\"].concat(excludedExts.split(\",\").map(it => `.${it}`))\n if (platformPackager.config.includePdb !== true) {\n result.push(\".pdb\")\n }\n if (platformPackager.platform !== Platform.WINDOWS) {\n // https://github.com/electron-userland/electron-builder/issues/1738\n result.push(\".dll\")\n result.push(\".exe\")\n }\n return result\n}\n\nfunction validateFileSet(fileSet: ResolvedFileSet): ResolvedFileSet {\n if (fileSet.src == null || fileSet.src.length === 0) {\n throw new Error(\"fileset src is empty\")\n }\n return fileSet\n}\n\n/** @internal */\nexport async function computeNodeModuleFileSets(platformPackager: PlatformPackager<any>, mainMatcher: FileMatcher): Promise<Array<ResolvedFileSet>> {\n const deps = await collectNodeModulesWithLogging(platformPackager)\n\n const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager)\n // serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure\n const result = new Array<ResolvedFileSet>()\n let index = 0\n const NODE_MODULES = \"node_modules\"\n\n const collectNodeModules = async (dep: NodeModuleInfo, destination: string) => {\n const source = dep.dir\n const matcher = new FileMatcher(source, destination, mainMatcher.macroExpander, mainMatcher.patterns)\n const copier = new NodeModuleCopyHelper(matcher, platformPackager.info)\n const files = await copier.collectNodeModules(dep, nodeModuleExcludedExts, path.relative(mainMatcher.to, destination))\n result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata })\n\n log.debug({ dep: dep.name, from: log.filePath(source), to: log.filePath(destination), filesCount: files.length }, \"identified module\")\n\n if (dep.dependencies) {\n for (const c of dep.dependencies) {\n await collectNodeModules(c, path.join(destination, NODE_MODULES, c.name))\n }\n }\n }\n\n for (const dep of deps) {\n const destination = path.join(mainMatcher.to, NODE_MODULES, dep.name)\n await collectNodeModules(dep, destination)\n }\n return result\n}\n\ntype CollectedNodeModules = { nodeModules: NodeModuleInfo[]; logSummary: ModuleManager[\"logSummary\"] }\n\n/** Runs a single package-manager collector against a single directory. */\ntype CollectorRunner = (pm: PM, dir: string) => Promise<CollectedNodeModules>\n\n// `workspace:`/`file:`/`link:`/`portal:` dependencies are symlinked into place rather than\n// installed as standalone, hoistable packages, so they may legitimately be absent from a\n// collected tree and cannot be used to validate it.\nconst LOCAL_DEPENDENCY_SPEC = /^(?:workspace|file|link|portal):/\n\n/**\n * Determines whether a collected module tree actually describes the package being built.\n *\n * A package-manager `list` invocation can resolve to the wrong project root — most notably when\n * electron-builder is run from a workspace sub-package whose dependencies are hoisted to the\n * workspace root. In that case the collector returns a non-empty but unrelated tree. Accepting it\n * would suppress the manual-traversal fallback that resolves the correct modules, so we need to\n * tell a matching collection from a mismatched one.\n *\n * A collection matches when at least one of the package's declared external (registry-installed,\n * non-`workspace:`/`file:`/`link:`/`portal:`) production dependencies is present at the top level —\n * those direct dependencies are always hoisted to the top level of a correct collection. When the\n * package declares no external production dependencies there is nothing to validate against, so any\n * non-empty collection is accepted.\n */\nexport function collectionMatchesAppDependencies(nodeModules: NodeModuleInfo[], dependencies: Record<string, string> | undefined): boolean {\n const requiredExternalDeps = Object.entries(dependencies ?? {})\n .filter(([, spec]) => !LOCAL_DEPENDENCY_SPEC.test(spec))\n .map(([name]) => name)\n if (requiredExternalDeps.length === 0) {\n return true\n }\n const collected = new Set(nodeModules.map(it => it.name))\n return requiredExternalDeps.some(name => collected.has(name))\n}\n\n/**\n * Walks the candidate (package-manager, directory) combinations and returns the first collection\n * that both contains modules and matches the package being built (see\n * {@link collectionMatchesAppDependencies}). A non-empty collection that does NOT match — e.g. a\n * workspace-root tree returned for a sub-package — is retained only as a last-resort fallback so a\n * later approach (notably {@link PM.TRAVERSAL}) can supply the correct modules.\n */\nexport async function resolveFirstMatchingCollection(options: {\n pmApproaches: PM[]\n searchDirectories: string[]\n dependencies: Record<string, string> | undefined\n run: CollectorRunner\n}): Promise<CollectedNodeModules | undefined> {\n const { pmApproaches, searchDirectories, dependencies, run } = options\n let fallback: CollectedNodeModules | undefined\n\n for (const pm of pmApproaches) {\n for (const dir of searchDirectories) {\n log.info({ pm, searchDir: dir }, \"searching for node modules\")\n const deps = await run(pm, dir)\n if (deps.nodeModules.length === 0) {\n log.info({ pm, searchDir: dir }, \"no node modules found in collection, trying next search directory\")\n continue\n }\n if (collectionMatchesAppDependencies(deps.nodeModules, dependencies)) {\n log.debug({ pm, searchDir: dir, depCount: deps.nodeModules.length }, \"collected node modules\")\n return deps\n }\n log.info({ pm, searchDir: dir }, \"collected node modules do not match the target package, trying next search directory/approach\")\n fallback ??= deps\n }\n }\n return fallback\n}\n\n/** Extracts the package name from a `name@version` log-summary entry, handling `@scope/name@version`. */\nfunction dependencyNameFromSummaryId(id: string): string {\n let at: number\n if (id.startsWith(\"@\")) {\n // Scoped package: the version separator is the first `@` after the scope's `/`\n const slashIndex = id.indexOf(\"/\")\n if (slashIndex === -1) {\n return id\n }\n at = id.indexOf(\"@\", slashIndex + 1)\n } else {\n at = id.indexOf(\"@\")\n }\n return at > 0 ? id.slice(0, at) : id\n}\n\n/**\n * Enforces `allowMissingDependencies` against the finished collection summary (issue #10058).\n * Runs only after collection completes, so the error reports the COMPLETE set of missing\n * production dependencies at once instead of failing on the first one.\n *\n * v26 defaults to warn-only: `true` and omitted keep the historical warning behavior of the\n * stable 26.x line, while `false`/`null` fail the build on any missing production dependency\n * (the electron-builder 27+ default). When the option is a `string[]`, only the listed dependency\n * names are allowed to be missing — matched against the package name parsed from the summary's\n * `name@version` entries (scoped names included), with an exact-entry match accepted as well.\n *\n * Only genuinely missing production dependencies (`PKG_NOT_FOUND` / `PKG_NOT_ON_DISK`) are fatal;\n * missing optional dependencies (`PKG_OPTIONAL_NOT_INSTALLED` / `PKG_OPTIONAL_PLATFORM_NOT_INSTALLED`)\n * never fail the build.\n *\n * Exported for tests (an internal-tagged export would be stripped from the declarations the test\n * project consumes).\n */\nexport function enforceAllowMissingDependencies(allowMissingDependencies: boolean | Array<string> | null | undefined, logSummary: ModuleManager[\"logSummary\"] | undefined): void {\n // v26 default: omitted behaves like `true` (warn-only) so existing 26.x builds keep working.\n if (allowMissingDependencies === true || allowMissingDependencies === undefined) {\n return\n }\n const missing = new Set<string>([...(logSummary?.[LogMessageByKey.PKG_NOT_FOUND] ?? []), ...(logSummary?.[LogMessageByKey.PKG_NOT_ON_DISK] ?? [])])\n const allowed = new Set(Array.isArray(allowMissingDependencies) ? allowMissingDependencies : [])\n const fatal = Array.from(missing)\n .filter(id => !allowed.has(dependencyNameFromSummaryId(id)) && !allowed.has(id))\n .sort()\n if (fatal.length === 0) {\n return\n }\n throw new InvalidConfigurationError(\n `The following production dependencies could not be resolved during node-module collection:\\n` +\n fatal.map(id => ` - ${id}`).join(\"\\n\") +\n `\\nInstall the missing dependencies, list names in \\`allowMissingDependencies\\` to allow specific ones to be missing, or set \\`allowMissingDependencies\\` to true to only warn.`\n )\n}\n\n/** Exported for tests (an internal-tagged export would be stripped from the declarations the test project consumes). */\nexport async function collectNodeModulesWithLogging(platformPackager: PlatformPackager<any>) {\n const packager = platformPackager.info\n const { tempDirManager, appDir, projectDir } = packager\n\n const searchDirectories = Array.from(new Set([appDir, projectDir, await packager.getWorkspaceRoot()])).filter((it): it is string => isEmptyOrSpaces(it) === false)\n const pmApproaches = [await packager.getPackageManager(), PM.TRAVERSAL]\n\n // Validate against the as-declared (pre-extraMetadata) production dependencies so a configured\n // `extraMetadata.dependencies` entry that isn't installed cannot reject a correct collection.\n const deps = await resolveFirstMatchingCollection({\n pmApproaches,\n searchDirectories,\n dependencies: packager.originalMetadata.dependencies,\n run: (pm, dir) => getCollectorByPackageManager(pm, dir, tempDirManager).getNodeModules({ packageName: packager.nodePackageName }),\n })\n\n if (!deps?.nodeModules?.length) {\n log.warn({ searchDirectories: searchDirectories.map(it => log.filePath(it)) }, \"no node modules returned while searching directories\")\n return []\n }\n\n const summary = Object.entries(deps.logSummary ?? {}).filter(([, dependencies]) => Array.isArray(dependencies) && dependencies.length > 0)\n for (const [errorMessage, dependencies] of summary) {\n const logLevel = logMessageLevelByKey[errorMessage as LogMessageByKey] || \"debug\"\n log[logLevel]({ dependencies }, errorMessage)\n }\n\n // Enforcement (issue #10058): collection is complete and the summary above has reached the log,\n // so failing here reports every missing production dependency at once.\n enforceAllowMissingDependencies(packager.config.allowMissingDependencies, deps.logSummary)\n\n return deps.nodeModules\n}\n\nasync function compileUsingElectronCompile(mainFileSet: ResolvedFileSet, packager: Packager): Promise<ResolvedFileSet> {\n log.info(\"compiling using electron-compile\")\n\n const electronCompileCache = await packager.tempDirManager.getTempDir({ prefix: \"electron-compile-cache\" })\n const cacheDir = path.join(electronCompileCache, \".cache\")\n // clear and create cache dir\n await mkdir(cacheDir, { recursive: true })\n const compilerHost = await createElectronCompilerHost(mainFileSet.src, cacheDir)\n const nextSlashIndex = mainFileSet.src.length + 1\n // pre-compute electron-compile to cache dir - we need to process only subdirectories, not direct files of app dir\n const filesPromise: Promise<any>[] = mainFileSet.files.map(file => {\n if (\n file.includes(NODE_MODULES_PATTERN) ||\n file.includes(BOWER_COMPONENTS_PATTERN) ||\n !file.includes(path.sep, nextSlashIndex) || // ignore not root files\n !mainFileSet.metadata.get(file)!.isFile()\n ) {\n return\n }\n return compilerHost.compile(file)\n })\n await asyncPool(MAX_FILE_REQUESTS, filesPromise, promise => promise)\n await compilerHost.saveConfiguration()\n\n const metadata = new Map<string, Stats>()\n const cacheFiles = await walk(cacheDir, file => !file.startsWith(\".\"), {\n consume: (file, fileStat) => {\n if (fileStat.isFile()) {\n metadata.set(file, fileStat)\n }\n return null\n },\n })\n\n // add shim\n const shimPath = `${mainFileSet.src}${path.sep}${ELECTRON_COMPILE_SHIM_FILENAME}`\n mainFileSet.files.push(shimPath)\n mainFileSet.metadata.set(shimPath, { isFile: () => true, isDirectory: () => false, isSymbolicLink: () => false } as any)\n if (mainFileSet.transformedFiles == null) {\n mainFileSet.transformedFiles = new Map()\n }\n mainFileSet.transformedFiles.set(\n mainFileSet.files.length - 1,\n `\n'use strict';\nrequire('electron-compile').init(__dirname, require('path').resolve(__dirname, '${packager.metadata.main || \"index\"}'), true);\n`\n )\n return { src: electronCompileCache, files: cacheFiles, metadata, destination: mainFileSet.destination }\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { ElectronPlatformArtifactDetails, MirrorOptions } from "@electron/get";
2
+ import * as crypto from "crypto";
2
3
  import { ElectronPlatformName } from "../electron/ElectronFramework";
3
4
  export type ElectronGetOptions = Omit<ElectronPlatformArtifactDetails, "platform" | "arch" | "version" | "artifactName" | "artifactSuffix" | "customFilename" | "tempDirectory" | "downloader" | "cacheMode" | "cacheRoot" | "downloadOptions" | "isGeneric" | "mirrorOptions"> & {
4
5
  mirrorOptions?: Omit<MirrorOptions, "customDir" | "customFilename" | "customVersion">;
@@ -37,6 +38,11 @@ export declare function getCacheDirectory(options: {
37
38
  allowEnvVarOverride: boolean;
38
39
  }): string;
39
40
  export declare function extractArchive(file: string, dir: string): Promise<void>;
41
+ export type ExpectedChecksum = {
42
+ algorithm: "sha256" | "sha512";
43
+ encoding: crypto.BinaryToTextEncoding;
44
+ value: string;
45
+ };
40
46
  /**
41
47
  * Downloads a generic artifact (.tar.gz or .zip) from a GitHub release.
42
48
  * Used for electron-builder-binaries tools (appimage, etc.).
@@ -48,6 +54,46 @@ export declare function downloadBuilderToolset(options: {
48
54
  githubOrgRepo?: string;
49
55
  overrideUrl?: string;
50
56
  }): Promise<string>;
57
+ /**
58
+ * Mirrors @electron/get's default cache root (`env-paths("electron", { suffix: "" }).cache`).
59
+ * @electron/get does not export it, so the (deliberately tiny) platform switch is replicated here.
60
+ * Must stay in sync with the `cacheRoot` default documented in @electron/get's
61
+ * `ElectronDownloadRequestOptions`.
62
+ * Exposed for unit testing; not part of the public API.
63
+ */
64
+ export declare function defaultElectronGetCacheRoot(): string;
65
+ /**
66
+ * Parses the upstream `SHASUMS256.txt` format into the `Record<filename, sha256-hex>` shape that
67
+ * @electron/get accepts as inline `checksums`. Each line is `<sha256-hex> *<filename>` (binary
68
+ * mode) or `<sha256-hex> <filename>` (text mode); malformed lines are ignored.
69
+ * Exposed for unit testing; not part of the public API.
70
+ */
71
+ export declare function parseChecksumFile(content: string): Record<string, string>;
72
+ /**
73
+ * Looks for a locally seeded SHASUMS256 file at the root of the @electron/get cache and returns
74
+ * its contents as inline `checksums`, or null when nothing usable is seeded.
75
+ *
76
+ * Why: without inline `checksums`, @electron/get re-downloads `SHASUMS256.txt` with a hardcoded
77
+ * `cacheMode: Bypass` on EVERY build — even when the artifact itself is a cache hit — so a fully
78
+ * seeded cache still requires network access and air-gapped builds fail (#10039). Cache-seeding
79
+ * tools (e.g. flatpak-node-generator) already place `SHASUMS256.txt-<version>` flat at the cache
80
+ * root; feeding it back as inline `checksums` keeps checksum validation enabled while making it
81
+ * fully offline. A plain `SHASUMS256.txt` at the cache root is accepted as a manual-seeding
82
+ * fallback. A candidate file is only used when it actually contains an entry for the requested
83
+ * artifact, so a stale file for another version can never break an online build.
84
+ * See https://www.electron.build/tutorials/offline-air-gapped-builds for the seeding contract.
85
+ * Exposed for unit testing; not part of the public API.
86
+ */
87
+ export declare function resolveSeededChecksums(cacheRoot: string, version: string, artifactFileName: string): Promise<Record<string, string> | null>;
88
+ /**
89
+ * Assembles the `@electron/get` artifact config from `ArtifactDownloadOptions`, accepting both the
90
+ * legacy `ElectronDownloadOptions` and the modern `ElectronGetOptions` config shapes. When the
91
+ * resolved config has no `checksums` (user-provided `electronDownload.checksums` always wins) and
92
+ * checksum verification is not disabled, a locally seeded `SHASUMS256.txt-<version>` at the cache
93
+ * root is picked up as inline `checksums` so validation works offline (see resolveSeededChecksums).
94
+ * Exposed for unit testing; not part of the public API.
95
+ */
96
+ export declare function buildElectronArtifactConfig(options: ArtifactDownloadOptions): Promise<ElectronPlatformArtifactDetails>;
51
97
  /**
52
98
  * Downloads the electron artifact zip via @electron/get (with caching) and returns the zip file path.
53
99
  * Use when you need to extract the zip yourself (e.g. directly to appOutDir to preserve empty dirs and symlinks).