app-builder-lib 27.0.0-alpha.0 → 27.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Framework.d.ts +2 -0
- package/dist/Framework.d.ts.map +1 -1
- package/dist/Framework.js.map +1 -1
- package/dist/appInfo.d.ts +1 -1
- package/dist/appInfo.d.ts.map +1 -1
- package/dist/appInfo.js +3 -3
- package/dist/appInfo.js.map +1 -1
- package/dist/asar/asar.js +1 -1
- package/dist/asar/asar.js.map +1 -1
- package/dist/asar/asarFileChecker.d.ts +4 -2
- package/dist/asar/asarFileChecker.d.ts.map +1 -1
- package/dist/asar/asarFileChecker.js +2 -3
- package/dist/asar/asarFileChecker.js.map +1 -1
- package/dist/asar/asarUtil.js +21 -11
- package/dist/asar/asarUtil.js.map +1 -1
- package/dist/codeSign/certInfo.d.ts +14 -0
- package/dist/codeSign/certInfo.d.ts.map +1 -1
- package/dist/codeSign/certInfo.js +49 -0
- package/dist/codeSign/certInfo.js.map +1 -1
- package/dist/codeSign/mac/macCodeSign.d.ts +3 -3
- package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
- package/dist/codeSign/mac/macCodeSign.js +50 -25
- package/dist/codeSign/mac/macCodeSign.js.map +1 -1
- package/dist/codeSign/signResult.d.ts +26 -0
- package/dist/codeSign/signResult.d.ts.map +1 -0
- package/dist/codeSign/signResult.js +12 -0
- package/dist/codeSign/signResult.js.map +1 -0
- package/dist/codeSign/win/hsmSignManager.d.ts +10 -0
- package/dist/codeSign/win/hsmSignManager.d.ts.map +1 -0
- package/dist/codeSign/win/hsmSignManager.js +50 -0
- package/dist/codeSign/win/hsmSignManager.js.map +1 -0
- package/dist/codeSign/win/pkcs11SignManager.d.ts +14 -0
- package/dist/codeSign/win/pkcs11SignManager.d.ts.map +1 -0
- package/dist/codeSign/win/pkcs11SignManager.js +82 -0
- package/dist/codeSign/win/pkcs11SignManager.js.map +1 -0
- package/dist/codeSign/win/signManager.d.ts +17 -0
- package/dist/codeSign/win/signManager.d.ts.map +1 -0
- package/dist/codeSign/win/signManager.js +19 -0
- package/dist/codeSign/win/signManager.js.map +1 -0
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts +95 -0
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -0
- package/dist/codeSign/win/signtoolBaseSignManager.js +507 -0
- package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -0
- package/dist/codeSign/win/windowsCodeSign.d.ts +2 -1
- package/dist/codeSign/win/windowsCodeSign.d.ts.map +1 -1
- package/dist/codeSign/win/windowsCodeSign.js +22 -8
- package/dist/codeSign/win/windowsCodeSign.js.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.d.ts +11 -4
- package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.js +142 -37
- package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
- package/dist/codeSign/win/windowsSignToolManager.d.ts +1 -58
- package/dist/codeSign/win/windowsSignToolManager.d.ts.map +1 -1
- package/dist/codeSign/win/windowsSignToolManager.js +3 -363
- package/dist/codeSign/win/windowsSignToolManager.js.map +1 -1
- package/dist/configuration.d.ts +228 -163
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js +11 -1
- package/dist/configuration.js.map +1 -1
- package/dist/core.d.ts +14 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +11 -0
- package/dist/core.js.map +1 -1
- package/dist/electron/ElectronFramework.d.ts +3 -3
- package/dist/electron/ElectronFramework.d.ts.map +1 -1
- package/dist/electron/ElectronFramework.js +60 -61
- package/dist/electron/ElectronFramework.js.map +1 -1
- package/dist/electron/electronArchSupport.d.ts +12 -0
- package/dist/electron/electronArchSupport.d.ts.map +1 -0
- package/dist/electron/electronArchSupport.js +58 -0
- package/dist/electron/electronArchSupport.js.map +1 -0
- package/dist/electron/electronVersion.d.ts.map +1 -1
- package/dist/electron/electronVersion.js +1 -11
- package/dist/electron/electronVersion.js.map +1 -1
- package/dist/electron/injectFFMPEG.js +2 -2
- package/dist/electron/injectFFMPEG.js.map +1 -1
- package/dist/electron/mac/electronMac.js +24 -35
- package/dist/electron/mac/electronMac.js.map +1 -1
- package/dist/electron/mac/electronMacUtils.d.ts +24 -0
- package/dist/electron/mac/electronMacUtils.d.ts.map +1 -0
- package/dist/electron/mac/electronMacUtils.js +42 -0
- package/dist/electron/mac/electronMacUtils.js.map +1 -0
- package/dist/electron/win/electronWin.js +2 -2
- package/dist/electron/win/electronWin.js.map +1 -1
- package/dist/fileMatcher.d.ts +42 -2
- package/dist/fileMatcher.d.ts.map +1 -1
- package/dist/fileMatcher.js +246 -18
- package/dist/fileMatcher.js.map +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/indexInternal.d.ts +19 -8
- package/dist/indexInternal.d.ts.map +1 -1
- package/dist/indexInternal.js +18 -7
- package/dist/indexInternal.js.map +1 -1
- package/dist/linuxPackager.d.ts.map +1 -1
- package/dist/linuxPackager.js +19 -1
- package/dist/linuxPackager.js.map +1 -1
- package/dist/macPackager.d.ts +31 -14
- package/dist/macPackager.d.ts.map +1 -1
- package/dist/macPackager.js +236 -147
- package/dist/macPackager.js.map +1 -1
- package/dist/node-module-collector/index.d.ts.map +1 -1
- package/dist/node-module-collector/index.js +47 -16
- package/dist/node-module-collector/index.js.map +1 -1
- package/dist/node-module-collector/moduleManager.d.ts +11 -2
- package/dist/node-module-collector/moduleManager.d.ts.map +1 -1
- package/dist/node-module-collector/moduleManager.js +34 -14
- package/dist/node-module-collector/moduleManager.js.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.d.ts +47 -26
- package/dist/node-module-collector/nodeModulesCollector.d.ts.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.js +157 -142
- package/dist/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/dist/node-module-collector/packageManager.js +1 -1
- package/dist/node-module-collector/packageManager.js.map +1 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts +90 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts.map +1 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.js +325 -25
- package/dist/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
- package/dist/node-module-collector/types.d.ts +4 -0
- package/dist/node-module-collector/types.d.ts.map +1 -1
- package/dist/node-module-collector/types.js.map +1 -1
- package/dist/options/FuseOptionsV1.d.ts +137 -0
- package/dist/options/FuseOptionsV1.d.ts.map +1 -0
- package/dist/options/FuseOptionsV1.js +2 -0
- package/dist/options/FuseOptionsV1.js.map +1 -0
- package/dist/options/MsixOptions.d.ts +126 -0
- package/dist/options/MsixOptions.d.ts.map +1 -0
- package/dist/options/MsixOptions.js +2 -0
- package/dist/options/MsixOptions.js.map +1 -0
- package/dist/options/PlatformSpecificBuildOptions.d.ts +55 -9
- package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/options/SnapOptions.d.ts +23 -17
- package/dist/options/SnapOptions.d.ts.map +1 -1
- package/dist/options/SnapOptions.js.map +1 -1
- package/dist/options/SquirrelWindowsOptions.d.ts +0 -5
- package/dist/options/SquirrelWindowsOptions.d.ts.map +1 -1
- package/dist/options/SquirrelWindowsOptions.js.map +1 -1
- package/dist/options/linuxOptions.d.ts +8 -12
- package/dist/options/linuxOptions.d.ts.map +1 -1
- package/dist/options/linuxOptions.js.map +1 -1
- package/dist/options/macOptions.d.ts +113 -131
- package/dist/options/macOptions.d.ts.map +1 -1
- package/dist/options/macOptions.js.map +1 -1
- package/dist/options/pkgOptions.d.ts +1 -1
- package/dist/options/pkgOptions.js.map +1 -1
- package/dist/options/winOptions.d.ts +282 -70
- package/dist/options/winOptions.d.ts.map +1 -1
- package/dist/options/winOptions.js +12 -1
- package/dist/options/winOptions.js.map +1 -1
- package/dist/packager.d.ts +6 -1
- package/dist/packager.d.ts.map +1 -1
- package/dist/packager.js +121 -40
- package/dist/packager.js.map +1 -1
- package/dist/packagerApi.d.ts +10 -1
- package/dist/packagerApi.d.ts.map +1 -1
- package/dist/packagerApi.js.map +1 -1
- package/dist/platformPackager.d.ts +49 -3
- package/dist/platformPackager.d.ts.map +1 -1
- package/dist/platformPackager.js +130 -17
- package/dist/platformPackager.js.map +1 -1
- package/dist/publish/PublishManager.d.ts +36 -2
- package/dist/publish/PublishManager.d.ts.map +1 -1
- package/dist/publish/PublishManager.js +387 -23
- package/dist/publish/PublishManager.js.map +1 -1
- package/dist/publish/updateInfoBuilder.d.ts +1 -1
- package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
- package/dist/publish/updateInfoBuilder.js +110 -32
- package/dist/publish/updateInfoBuilder.js.map +1 -1
- package/dist/targets/ArchiveTarget.d.ts +1 -0
- package/dist/targets/ArchiveTarget.d.ts.map +1 -1
- package/dist/targets/ArchiveTarget.js +6 -3
- package/dist/targets/ArchiveTarget.js.map +1 -1
- package/dist/targets/archive.d.ts +33 -2
- package/dist/targets/archive.d.ts.map +1 -1
- package/dist/targets/archive.js +109 -29
- package/dist/targets/archive.js.map +1 -1
- package/dist/targets/blockmap/blockmap.d.ts +43 -3
- package/dist/targets/blockmap/blockmap.d.ts.map +1 -1
- package/dist/targets/blockmap/blockmap.js +141 -15
- package/dist/targets/blockmap/blockmap.js.map +1 -1
- package/dist/targets/blockmap/verbatimRange.d.ts +44 -0
- package/dist/targets/blockmap/verbatimRange.d.ts.map +1 -0
- package/dist/targets/blockmap/verbatimRange.js +117 -0
- package/dist/targets/blockmap/verbatimRange.js.map +1 -0
- package/dist/targets/differentialUpdateInfoBuilder.d.ts +28 -2
- package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
- package/dist/targets/differentialUpdateInfoBuilder.js +75 -6
- package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
- package/dist/targets/linux/FlatpakTarget.d.ts.map +1 -1
- package/dist/targets/linux/FlatpakTarget.js +13 -3
- package/dist/targets/linux/FlatpakTarget.js.map +1 -1
- package/dist/targets/linux/FpmTarget.d.ts +14 -0
- package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
- package/dist/targets/linux/FpmTarget.js +86 -10
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.d.ts +15 -0
- package/dist/targets/linux/LinuxTargetHelper.d.ts.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.js +54 -59
- package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.d.ts +2 -0
- package/dist/targets/linux/appimage/AppImageTarget.d.ts.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.js +16 -15
- package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.d.ts +5 -1
- package/dist/targets/linux/appimage/appImageUtil.d.ts.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.js +14 -7
- package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
- package/dist/targets/linux/appimage/appLauncher.d.ts.map +1 -1
- package/dist/targets/linux/appimage/appLauncher.js +5 -11
- package/dist/targets/linux/appimage/appLauncher.js.map +1 -1
- package/dist/targets/linux/launcherScript.d.ts +32 -0
- package/dist/targets/linux/launcherScript.d.ts.map +1 -0
- package/dist/targets/linux/launcherScript.js +24 -0
- package/dist/targets/linux/launcherScript.js.map +1 -0
- package/dist/targets/linux/snap/SnapTarget.d.ts +1 -1
- package/dist/targets/linux/snap/SnapTarget.d.ts.map +1 -1
- package/dist/targets/linux/snap/SnapTarget.js +23 -1
- package/dist/targets/linux/snap/SnapTarget.js.map +1 -1
- package/dist/targets/linux/snap/core24.d.ts +30 -1
- package/dist/targets/linux/snap/core24.d.ts.map +1 -1
- package/dist/targets/linux/snap/core24.js +146 -70
- package/dist/targets/linux/snap/core24.js.map +1 -1
- package/dist/targets/linux/snap/coreCustom.d.ts +1 -1
- package/dist/targets/linux/snap/coreCustom.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreCustom.js +2 -2
- package/dist/targets/linux/snap/coreCustom.js.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.d.ts +3 -3
- package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.js +12 -12
- package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
- package/dist/targets/linux/snap/snapCommand.d.ts +13 -0
- package/dist/targets/linux/snap/snapCommand.d.ts.map +1 -0
- package/dist/targets/linux/snap/snapCommand.js +21 -0
- package/dist/targets/linux/snap/snapCommand.js.map +1 -0
- package/dist/targets/linux/snap/snapcraft.d.ts +190 -0
- package/dist/targets/linux/snap/snapcraft.d.ts.map +1 -0
- package/dist/targets/linux/snap/snapcraft.js +11 -0
- package/dist/targets/linux/snap/snapcraft.js.map +1 -0
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts +7 -1
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts.map +1 -1
- package/dist/targets/linux/snap/snapcraftBuilder.js +57 -20
- package/dist/targets/linux/snap/snapcraftBuilder.js.map +1 -1
- package/dist/targets/mac/MacTargetHelper.d.ts +146 -14
- package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
- package/dist/targets/mac/MacTargetHelper.js +485 -91
- package/dist/targets/mac/MacTargetHelper.js.map +1 -1
- package/dist/targets/mac/pkg.d.ts +16 -0
- package/dist/targets/mac/pkg.d.ts.map +1 -1
- package/dist/targets/mac/pkg.js +31 -5
- package/dist/targets/mac/pkg.js.map +1 -1
- package/dist/targets/targetFactory.d.ts +7 -0
- package/dist/targets/targetFactory.d.ts.map +1 -1
- package/dist/targets/targetFactory.js +28 -0
- package/dist/targets/targetFactory.js.map +1 -1
- package/dist/targets/win/AppxTarget.d.ts +1 -2
- package/dist/targets/win/AppxTarget.d.ts.map +1 -1
- package/dist/targets/win/AppxTarget.js +37 -314
- package/dist/targets/win/AppxTarget.js.map +1 -1
- package/dist/targets/win/MsiTarget.d.ts.map +1 -1
- package/dist/targets/win/MsiTarget.js +13 -13
- package/dist/targets/win/MsiTarget.js.map +1 -1
- package/dist/targets/win/MsixTarget.d.ts +22 -0
- package/dist/targets/win/MsixTarget.d.ts.map +1 -0
- package/dist/targets/win/MsixTarget.js +214 -0
- package/dist/targets/win/MsixTarget.js.map +1 -0
- package/dist/targets/win/nsis/Defines.d.ts +3 -0
- package/dist/targets/win/nsis/Defines.d.ts.map +1 -1
- package/dist/targets/win/nsis/Defines.js.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.d.ts +57 -3
- package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.js +252 -113
- package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
- package/dist/targets/win/nsis/WebInstallerTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/WebInstallerTarget.js +23 -12
- package/dist/targets/win/nsis/WebInstallerTarget.js.map +1 -1
- package/dist/targets/win/nsis/nsisOptions.d.ts +56 -48
- package/dist/targets/win/nsis/nsisOptions.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.js +4 -3
- package/dist/targets/win/nsis/nsisScriptGenerator.js.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.d.ts +17 -2
- package/dist/targets/win/nsis/nsisUtil.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.js +143 -41
- package/dist/targets/win/nsis/nsisUtil.js.map +1 -1
- package/dist/targets/win/nsis/progId.d.ts +21 -0
- package/dist/targets/win/nsis/progId.d.ts.map +1 -0
- package/dist/targets/win/nsis/progId.js +60 -0
- package/dist/targets/win/nsis/progId.js.map +1 -0
- package/dist/targets/win/winAppUtil.d.ts +115 -0
- package/dist/targets/win/winAppUtil.d.ts.map +1 -0
- package/dist/targets/win/winAppUtil.js +407 -0
- package/dist/targets/win/winAppUtil.js.map +1 -0
- package/dist/toolsets/7zip.d.ts +32 -0
- package/dist/toolsets/7zip.d.ts.map +1 -1
- package/dist/toolsets/7zip.js +39 -11
- package/dist/toolsets/7zip.js.map +1 -1
- package/dist/toolsets/appimage.d.ts +3 -3
- package/dist/toolsets/appimage.d.ts.map +1 -1
- package/dist/toolsets/appimage.js +9 -6
- package/dist/toolsets/appimage.js.map +1 -1
- package/dist/toolsets/custom.d.ts +2 -3
- package/dist/toolsets/custom.d.ts.map +1 -1
- package/dist/toolsets/custom.js +67 -149
- package/dist/toolsets/custom.js.map +1 -1
- package/dist/toolsets/fpm.d.ts.map +1 -1
- package/dist/toolsets/fpm.js +11 -5
- package/dist/toolsets/fpm.js.map +1 -1
- package/dist/toolsets/icons.d.ts.map +1 -1
- package/dist/toolsets/icons.js +17 -3
- package/dist/toolsets/icons.js.map +1 -1
- package/dist/toolsets/linuxToolsMac.d.ts.map +1 -1
- package/dist/toolsets/linuxToolsMac.js +17 -4
- package/dist/toolsets/linuxToolsMac.js.map +1 -1
- package/dist/toolsets/nsis.d.ts +5 -0
- package/dist/toolsets/nsis.d.ts.map +1 -1
- package/dist/toolsets/nsis.js +20 -4
- package/dist/toolsets/nsis.js.map +1 -1
- package/dist/toolsets/version.d.ts +12 -0
- package/dist/toolsets/version.d.ts.map +1 -0
- package/dist/toolsets/version.js +13 -0
- package/dist/toolsets/version.js.map +1 -0
- package/dist/toolsets/winCodeSign.d.ts +56 -3
- package/dist/toolsets/winCodeSign.d.ts.map +1 -1
- package/dist/toolsets/winCodeSign.js +125 -42
- package/dist/toolsets/winCodeSign.js.map +1 -1
- package/dist/toolsets/wine.d.ts +2 -1
- package/dist/toolsets/wine.d.ts.map +1 -1
- package/dist/toolsets/wine.js +31 -15
- package/dist/toolsets/wine.js.map +1 -1
- package/dist/util/NodeModuleCopyHelper.js +14 -6
- package/dist/util/NodeModuleCopyHelper.js.map +1 -1
- package/dist/util/appFileCopier.d.ts +52 -0
- package/dist/util/appFileCopier.d.ts.map +1 -1
- package/dist/util/appFileCopier.js +221 -21
- package/dist/util/appFileCopier.js.map +1 -1
- package/dist/util/archCompatibility.d.ts +42 -0
- package/dist/util/archCompatibility.d.ts.map +1 -0
- package/dist/util/archCompatibility.js +202 -0
- package/dist/util/archCompatibility.js.map +1 -0
- package/dist/util/checksum.d.ts +36 -0
- package/dist/util/checksum.d.ts.map +1 -0
- package/dist/util/checksum.js +48 -0
- package/dist/util/checksum.js.map +1 -0
- package/dist/util/config/config.d.ts +1 -0
- package/dist/util/config/config.d.ts.map +1 -1
- package/dist/util/config/config.js +8 -1
- package/dist/util/config/config.js.map +1 -1
- package/dist/util/config/legacyConfigGuard.d.ts +7 -0
- package/dist/util/config/legacyConfigGuard.d.ts.map +1 -0
- package/dist/util/config/legacyConfigGuard.js +187 -0
- package/dist/util/config/legacyConfigGuard.js.map +1 -0
- package/dist/util/config/legacyOptions.d.ts +75 -0
- package/dist/util/config/legacyOptions.d.ts.map +1 -0
- package/dist/util/config/legacyOptions.js +399 -0
- package/dist/util/config/legacyOptions.js.map +1 -0
- package/dist/util/config/load.d.ts +2 -2
- package/dist/util/config/load.d.ts.map +1 -1
- package/dist/util/config/load.js +3 -12
- package/dist/util/config/load.js.map +1 -1
- package/dist/util/config/schemaValidator.d.ts.map +1 -1
- package/dist/util/config/schemaValidator.js +26 -3
- package/dist/util/config/schemaValidator.js.map +1 -1
- package/dist/util/electronGet.d.ts +30 -32
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +359 -129
- package/dist/util/electronGet.js.map +1 -1
- package/dist/util/flags.d.ts +5 -5
- package/dist/util/flags.d.ts.map +1 -1
- package/dist/util/flags.js +124 -16
- package/dist/util/flags.js.map +1 -1
- package/dist/util/hash.d.ts +1 -1
- package/dist/util/hash.d.ts.map +1 -1
- package/dist/util/hash.js +1 -15
- package/dist/util/hash.js.map +1 -1
- package/dist/util/installOrRebuild.d.ts +44 -0
- package/dist/util/installOrRebuild.d.ts.map +1 -0
- package/dist/util/installOrRebuild.js +276 -0
- package/dist/util/installOrRebuild.js.map +1 -0
- package/dist/util/langs.d.ts.map +1 -1
- package/dist/util/langs.js +1 -0
- package/dist/util/langs.js.map +1 -1
- package/dist/util/license.d.ts.map +1 -1
- package/dist/util/license.js +4 -1
- package/dist/util/license.js.map +1 -1
- package/dist/util/mac/macosIconComposer.d.ts +2 -1
- package/dist/util/mac/macosIconComposer.d.ts.map +1 -1
- package/dist/util/mac/macosIconComposer.js +41 -59
- package/dist/util/mac/macosIconComposer.js.map +1 -1
- package/dist/util/mac/macosVersion.d.ts +0 -1
- package/dist/util/mac/macosVersion.d.ts.map +1 -1
- package/dist/util/mac/macosVersion.js +0 -3
- package/dist/util/mac/macosVersion.js.map +1 -1
- package/dist/util/mac/plist.d.ts +1 -1
- package/dist/util/mac/plist.d.ts.map +1 -1
- package/dist/util/mac/plist.js +6 -1
- package/dist/util/mac/plist.js.map +1 -1
- package/dist/util/nativeBinaryVerifier.d.ts +40 -0
- package/dist/util/nativeBinaryVerifier.d.ts.map +1 -0
- package/dist/util/nativeBinaryVerifier.js +381 -0
- package/dist/util/nativeBinaryVerifier.js.map +1 -0
- package/dist/util/packageMetadata.js +57 -31
- package/dist/util/packageMetadata.js.map +1 -1
- package/dist/util/repositoryInfo.js +6 -3
- package/dist/util/repositoryInfo.js.map +1 -1
- package/dist/util/resolve.js +1 -1
- package/dist/util/resolve.js.map +1 -1
- package/dist/util/streamSpawnToFile.d.ts +47 -0
- package/dist/util/streamSpawnToFile.d.ts.map +1 -0
- package/dist/util/streamSpawnToFile.js +110 -0
- package/dist/util/streamSpawnToFile.js.map +1 -0
- package/dist/util/toolsetLock.d.ts +2 -0
- package/dist/util/toolsetLock.d.ts.map +1 -1
- package/dist/util/toolsetLock.js +31 -5
- package/dist/util/toolsetLock.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/vm/ParallelsVm.d.ts.map +1 -1
- package/dist/vm/ParallelsVm.js +29 -3
- package/dist/vm/ParallelsVm.js.map +1 -1
- package/dist/vm/vm.d.ts +2 -0
- package/dist/vm/vm.d.ts.map +1 -1
- package/dist/vm/vm.js +29 -6
- package/dist/vm/vm.js.map +1 -1
- package/dist/winPackager.d.ts +6 -5
- package/dist/winPackager.d.ts.map +1 -1
- package/dist/winPackager.js +45 -39
- package/dist/winPackager.js.map +1 -1
- package/package.json +19 -18
- package/scheme.json +1731 -961
- package/templates/appx/appxmanifest.xml +2 -3
- package/templates/entitlements.mac.adhoc.plist +15 -0
- package/templates/entitlements.mac.plist +9 -6
- package/templates/msix/appxmanifest.xml +45 -0
- package/templates/nsis/assistedMessages.yml +17 -0
- package/templates/nsis/common.nsh +2 -2
- package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +96 -13
- package/templates/nsis/include/extractAppPackage.nsh +5 -2
- package/templates/nsis/include/installUtil.nsh +2 -2
- package/templates/nsis/include/installer.nsh +88 -50
- package/templates/nsis/include/webPackage.nsh +52 -27
- package/templates/nsis/installSection.nsh +29 -0
- package/templates/nsis/installer.nsi +1 -1
- package/templates/nsis/messages.yml +5 -0
- package/templates/nsis/multiUserUi.nsh +1 -1
- package/dist/codeSign/signManager.d.ts +0 -14
- package/dist/codeSign/signManager.d.ts.map +0 -1
- package/dist/codeSign/signManager.js +0 -2
- package/dist/codeSign/signManager.js.map +0 -1
- package/dist/util/yarn.d.ts +0 -23
- package/dist/util/yarn.d.ts.map +0 -1
- package/dist/util/yarn.js +0 -153
- package/dist/util/yarn.js.map +0 -1
package/dist/toolsets/custom.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import * as fs from "fs/promises";
|
|
4
|
-
import { mkdir, rmdir, stat } from "fs/promises";
|
|
1
|
+
import { exists, InvalidConfigurationError, sanitizeDirPath, validateSecuredUrl } from "builder-util";
|
|
2
|
+
import { mkdir, rm, stat } from "fs/promises";
|
|
5
3
|
import * as path from "path";
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import * as tar from "tar";
|
|
9
|
-
import * as unzipper from "unzipper";
|
|
10
|
-
import { downloadBuilderToolset, getCacheDirectory } from "../util/electronGet.js";
|
|
11
|
-
import { getPath7za } from "./7zip.js";
|
|
4
|
+
import { ACCEPTED_CHECKSUM_FORMATS, checksumCacheKey, checksumMismatchMessage, parseChecksum, verifyFileChecksum } from "../util/checksum.js";
|
|
5
|
+
import { cacheDirectoryOverrideAllowed, downloadBuilderToolset, extractArchive, hashUrlSafe } from "../util/electronGet.js";
|
|
12
6
|
async function validateCustomToolset(custom, resourcesDir) {
|
|
13
7
|
const url = custom.url.trim();
|
|
14
8
|
try {
|
|
@@ -23,7 +17,7 @@ async function validateCustomToolset(custom, resourcesDir) {
|
|
|
23
17
|
}
|
|
24
18
|
if (url.startsWith("file://")) {
|
|
25
19
|
const p = url.slice("file://".length);
|
|
26
|
-
const isWithinResources = path.normalize(p).startsWith(path.normalize(resourcesDir + path.sep));
|
|
20
|
+
const isWithinResources = resourcesDir ? path.normalize(p).startsWith(path.normalize(resourcesDir + path.sep)) : false;
|
|
27
21
|
const isValid = path.isAbsolute(p) || isWithinResources;
|
|
28
22
|
const type = isValid &&
|
|
29
23
|
(await exists(p)) &&
|
|
@@ -41,160 +35,84 @@ function resolveFilePath(url, resourcesDir) {
|
|
|
41
35
|
const p = url.startsWith("file://") ? url.slice("file://".length) : url;
|
|
42
36
|
return path.isAbsolute(p) ? sanitizeDirPath(p) : sanitizeDirPath(p, resourcesDir);
|
|
43
37
|
}
|
|
44
|
-
|
|
38
|
+
const _customToolsetCache = new Map();
|
|
39
|
+
export function clearCustomToolsetCache() {
|
|
40
|
+
_customToolsetCache.clear();
|
|
41
|
+
}
|
|
42
|
+
export function getCustomToolsetPath(custom, resourcesDir) {
|
|
43
|
+
const key = JSON.stringify({ url: custom.url, checksum: memoChecksumKey(custom.checksum), resourcesDir });
|
|
44
|
+
let cached = _customToolsetCache.get(key);
|
|
45
|
+
if (cached == null) {
|
|
46
|
+
cached = _resolveCustomToolsetPath(custom, resourcesDir);
|
|
47
|
+
_customToolsetCache.set(key, cached);
|
|
48
|
+
}
|
|
49
|
+
return cached;
|
|
50
|
+
}
|
|
51
|
+
// Equivalent spellings of one checksum (uppercase hex, surrounding whitespace) share a memo entry; an invalid value is
|
|
52
|
+
// keyed verbatim and fails in _resolveCustomToolsetPath with the configuration error.
|
|
53
|
+
function memoChecksumKey(checksum) {
|
|
54
|
+
if (!checksum) {
|
|
55
|
+
return "";
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
return checksumCacheKey(parseChecksum(checksum, "ToolsetCustom.checksum"));
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return checksum;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const CHECKSUM_DOCS_URL = "https://www.electron.build/docs/toolsets#custom-toolset-checksum";
|
|
65
|
+
/**
|
|
66
|
+
* Classifies the checksum of a downloaded or archive toolset up front, so a value in an unsupported format fails before
|
|
67
|
+
* anything is downloaded or extracted, without echoing the value. A SHA-256 hex value is verified by `@electron/get` for a
|
|
68
|
+
* download; a base64 SHA-512 (the format v26 used for all toolset checksums) is verified by electron-builder.
|
|
69
|
+
*/
|
|
70
|
+
function normalizeChecksum(checksum, type, url) {
|
|
71
|
+
if (!checksum) {
|
|
72
|
+
throw new InvalidConfigurationError(`ToolsetCustom.checksum is required for ${type} toolsets (url: ${url}): ${ACCEPTED_CHECKSUM_FORMATS}. See ${CHECKSUM_DOCS_URL}`);
|
|
73
|
+
}
|
|
74
|
+
return parseChecksum(checksum, `ToolsetCustom.checksum for ${type} toolset ${url}`, CHECKSUM_DOCS_URL);
|
|
75
|
+
}
|
|
76
|
+
async function _resolveCustomToolsetPath(custom, resourcesDir) {
|
|
45
77
|
const { type, toolset } = await validateCustomToolset(custom, resourcesDir);
|
|
46
|
-
if (type
|
|
47
|
-
|
|
78
|
+
if (type === "directory") {
|
|
79
|
+
return resolveFilePath(toolset.url, resourcesDir);
|
|
48
80
|
}
|
|
49
|
-
const
|
|
81
|
+
const checksum = normalizeChecksum(toolset.checksum, String(type), toolset.url);
|
|
82
|
+
// hex form of the digest: a base64 SHA-512 may contain "/" or "+", which must not reach the cache directory name
|
|
83
|
+
const binaryVersion = toolset.version ?? checksumCacheKey(checksum).substring(0, 8);
|
|
50
84
|
const releaseName = `${binaryVersion}-${hashUrlSafe(toolset.url)}`;
|
|
51
85
|
if (type === "url") {
|
|
52
86
|
return downloadBuilderToolset({
|
|
53
87
|
releaseName: releaseName,
|
|
54
88
|
filenameWithExt: path.basename(toolset.url),
|
|
55
|
-
checksums: { [path.basename(toolset.url)]:
|
|
89
|
+
checksums: { [path.basename(toolset.url)]: checksum.value },
|
|
56
90
|
overrideUrl: toolset.url,
|
|
57
91
|
});
|
|
58
92
|
}
|
|
59
93
|
else if (type === "file") {
|
|
60
|
-
const
|
|
94
|
+
const archivePath = resolveFilePath(toolset.url, resourcesDir);
|
|
95
|
+
// Verify the local archive on every resolution, before anything is extracted: the archive is re-extracted each time anyway
|
|
96
|
+
// (see below), so hashing it adds little, and a stale extraction can never outlive a changed archive. The user's file is
|
|
97
|
+
// never modified or removed, whatever the result.
|
|
98
|
+
const { matches, actual } = await verifyFileChecksum(archivePath, checksum);
|
|
99
|
+
if (!matches) {
|
|
100
|
+
throw new InvalidConfigurationError(`${checksumMismatchMessage(`the local toolset archive ${archivePath}`, checksum, actual)} ` +
|
|
101
|
+
`The archive was not extracted and has been left in place. Update ToolsetCustom.checksum if the archive was changed intentionally. See ${CHECKSUM_DOCS_URL}`);
|
|
102
|
+
}
|
|
103
|
+
const cacheDir = await cacheDirectoryOverrideAllowed.value;
|
|
61
104
|
const customToolsetDir = path.join(cacheDir, "custom-toolsets");
|
|
62
105
|
await mkdir(customToolsetDir, { recursive: true });
|
|
63
|
-
// wipe first to ensure idempotent extraction if the source file changed since last extraction
|
|
64
|
-
|
|
106
|
+
// wipe first to ensure idempotent extraction if the source file changed since last extraction.
|
|
107
|
+
// Contain the destination within customToolsetDir (mirrors the `url` branch): `version` is a free-form
|
|
108
|
+
// config field, so a `../…` value must not let rmdir/extract escape the cache directory.
|
|
109
|
+
const toolsetTarget = sanitizeDirPath(path.join(customToolsetDir, releaseName), customToolsetDir);
|
|
65
110
|
if (await exists(toolsetTarget)) {
|
|
66
|
-
await
|
|
111
|
+
await rm(toolsetTarget, { recursive: true });
|
|
67
112
|
}
|
|
68
|
-
await extractArchive(
|
|
113
|
+
await extractArchive(archivePath, toolsetTarget);
|
|
69
114
|
return toolsetTarget;
|
|
70
115
|
}
|
|
71
|
-
|
|
72
|
-
return resolveFilePath(toolset.url, resourcesDir);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
throw new Error(`Unsupported custom toolset type: ${type}`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
export function hashUrlSafe(input, length = 6) {
|
|
79
|
-
let hash = 5381;
|
|
80
|
-
for (let i = 0; i < input.length; i++) {
|
|
81
|
-
hash = ((hash << 5) + hash) ^ input.charCodeAt(i);
|
|
82
|
-
}
|
|
83
|
-
hash >>>= 0;
|
|
84
|
-
const out = hash.toString(36);
|
|
85
|
-
return out.length >= length ? out.slice(0, length) : out.padStart(length, "0");
|
|
86
|
-
}
|
|
87
|
-
async function extractZipStreaming(file, dir) {
|
|
88
|
-
// Pass 1: read central directory once to collect Unix modes (one seek to EOF)
|
|
89
|
-
const zipDir = await unzipper.Open.file(file);
|
|
90
|
-
const entryModes = new Map();
|
|
91
|
-
for (const entry of zipDir.files) {
|
|
92
|
-
const mode = (entry.externalFileAttributes >> 16) & 0xffff;
|
|
93
|
-
if (mode > 0) {
|
|
94
|
-
entryModes.set(entry.path, mode);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
const isSymlink = (mode) => (mode & 0o170000) === 0o120000;
|
|
98
|
-
// Pass 2: stream from byte 0 — no per-entry seeks, no Docker hang
|
|
99
|
-
const entries = createReadStream(file).pipe(unzipper.Parse({ forceStream: true }));
|
|
100
|
-
for await (const entry of entries) {
|
|
101
|
-
const destPath = path.resolve(dir, entry.path);
|
|
102
|
-
if (!destPath.startsWith(dir + path.sep) && destPath !== dir) {
|
|
103
|
-
throw new Error(`Path traversal blocked: ${entry.path}`);
|
|
104
|
-
}
|
|
105
|
-
const mode = entryModes.get(entry.path) ?? 0;
|
|
106
|
-
if (mode > 0 && isSymlink(mode)) {
|
|
107
|
-
const target = (await entry.buffer()).toString();
|
|
108
|
-
if (path.isAbsolute(target)) {
|
|
109
|
-
throw new Error(`Absolute symlink target blocked: ${target}`);
|
|
110
|
-
}
|
|
111
|
-
const resolvedTarget = path.resolve(path.dirname(destPath), target);
|
|
112
|
-
if (!resolvedTarget.startsWith(dir + path.sep) && resolvedTarget !== dir) {
|
|
113
|
-
throw new Error(`Symlink target escapes extraction dir: ${target}`);
|
|
114
|
-
}
|
|
115
|
-
await fs.mkdir(path.dirname(destPath), { recursive: true });
|
|
116
|
-
await fs.symlink(target, destPath);
|
|
117
|
-
}
|
|
118
|
-
else if (entry.type === "Directory") {
|
|
119
|
-
await fs.mkdir(destPath, { recursive: true });
|
|
120
|
-
entry.autodrain();
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
await fs.mkdir(path.dirname(destPath), { recursive: true });
|
|
124
|
-
await pipeline(entry, createWriteStream(destPath));
|
|
125
|
-
if (mode > 0) {
|
|
126
|
-
await fs.chmod(destPath, mode & 0o7777);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
export async function extractArchive(file, dir) {
|
|
132
|
-
const tmpDir = `${dir}.tmp`;
|
|
133
|
-
await fs.mkdir(tmpDir, { recursive: true });
|
|
134
|
-
const release = await lockfile.lock(tmpDir, {
|
|
135
|
-
retries: { retries: 100, minTimeout: 1000, maxTimeout: 5000 },
|
|
136
|
-
stale: 120000,
|
|
137
|
-
});
|
|
138
|
-
try {
|
|
139
|
-
await fs.rm(tmpDir, { recursive: true, force: true });
|
|
140
|
-
await fs.mkdir(tmpDir, { recursive: true });
|
|
141
|
-
// Guard against transient window in @electron/get's non-atomic putFileInCache (remove → move).
|
|
142
|
-
for (let i = 0; !(await exists(file)); i++) {
|
|
143
|
-
if (i >= 4) {
|
|
144
|
-
throw Object.assign(new Error(`Source archive not found after retries: ${file}`), { code: "ENOENT", path: file });
|
|
145
|
-
}
|
|
146
|
-
log.warn({ file, attempt: i + 1 }, "source archive transiently missing, retrying");
|
|
147
|
-
await new Promise(r => setTimeout(r, 300 * (i + 1)));
|
|
148
|
-
}
|
|
149
|
-
if (file.endsWith(".tar.gz") || file.endsWith(".tgz")) {
|
|
150
|
-
await tar.extract({ file, cwd: tmpDir, strip: 1 });
|
|
151
|
-
}
|
|
152
|
-
else if (file.endsWith(".tar.xz") || file.endsWith(".txz")) {
|
|
153
|
-
const cmd7za = await getPath7za();
|
|
154
|
-
const xzOutDir = `${tmpDir}.xz`;
|
|
155
|
-
await fs.rm(xzOutDir, { recursive: true, force: true });
|
|
156
|
-
await fs.mkdir(xzOutDir, { recursive: true });
|
|
157
|
-
try {
|
|
158
|
-
await exec(cmd7za, ["x", "-bd", file, to7zaOutputSwitch(sanitizeDirPath(xzOutDir)), "-y"]);
|
|
159
|
-
const innerTar = (await fs.readdir(xzOutDir)).find(f => f.endsWith(".tar"));
|
|
160
|
-
if (innerTar == null) {
|
|
161
|
-
throw new Error(`xz decompression of ${path.basename(file)} produced no .tar archive`);
|
|
162
|
-
}
|
|
163
|
-
await tar.extract({ file: path.join(xzOutDir, innerTar), cwd: tmpDir, strip: 1 });
|
|
164
|
-
}
|
|
165
|
-
finally {
|
|
166
|
-
await fs.rm(xzOutDir, { recursive: true, force: true });
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
else if (file.endsWith(".zip")) {
|
|
170
|
-
await extractZipStreaming(file, tmpDir);
|
|
171
|
-
}
|
|
172
|
-
else if (file.endsWith(".7z")) {
|
|
173
|
-
const cmd7za = await getPath7za();
|
|
174
|
-
try {
|
|
175
|
-
await exec(cmd7za, ["x", "-bd", file, to7zaOutputSwitch(sanitizeDirPath(tmpDir)), "-y"]);
|
|
176
|
-
}
|
|
177
|
-
catch (e) {
|
|
178
|
-
const files = await fs.readdir(tmpDir);
|
|
179
|
-
if (files.length === 0) {
|
|
180
|
-
log.warn({ file, tmpDir, error: e.message }, "7z extraction produced no output");
|
|
181
|
-
throw new Error(`7z extraction failed for ${file}: ${e.message}`);
|
|
182
|
-
}
|
|
183
|
-
log.warn({ error: e.message, filesExtracted: files.length }, "7z reported error but extracted files");
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
throw new Error(`Unsupported archive format: ${path.basename(file)}`);
|
|
188
|
-
}
|
|
189
|
-
const extractedFiles = await fs.readdir(tmpDir);
|
|
190
|
-
if (extractedFiles.length === 0) {
|
|
191
|
-
throw new Error(`Extraction of ${path.basename(file)} produced no files`);
|
|
192
|
-
}
|
|
193
|
-
await fs.rm(dir, { recursive: true, force: true });
|
|
194
|
-
await fs.rename(tmpDir, dir);
|
|
195
|
-
}
|
|
196
|
-
finally {
|
|
197
|
-
await release().catch(err => log.warn({ err }, "failed to release lockfile"));
|
|
198
|
-
}
|
|
116
|
+
throw new Error(`Unsupported custom toolset type: ${type}`);
|
|
199
117
|
}
|
|
200
118
|
//# sourceMappingURL=custom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.js","sourceRoot":"","sources":["../../src/toolsets/custom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACxG,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,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GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAC/C,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;QAC3E,CAAC;QAED,MAAM,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QAClD,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9B,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,4BAA4B,CAAC,CAAC,CAAA;IAC/E,CAAC;AACH,CAAC","sourcesContent":["import { exec, exists, log, sanitizeDirPath, to7zaOutputSwitch, validateSecuredUrl } from \"builder-util\"\nimport { createReadStream, createWriteStream } from \"fs\"\nimport * as fs from \"fs/promises\"\nimport { mkdir, rmdir, stat } from \"fs/promises\"\nimport * as path from \"path\"\nimport * as lockfile from \"proper-lockfile\"\nimport { pipeline } from \"stream/promises\"\nimport * as tar from \"tar\"\nimport * as unzipper from \"unzipper\"\nimport { ToolsetCustom } from \"../configuration.js\"\nimport { downloadBuilderToolset, getCacheDirectory } from \"../util/electronGet.js\"\nimport { getPath7za } from \"./7zip.js\"\n\nasync function validateCustomToolset(custom: ToolsetCustom, resourcesDir: string) {\n const url = custom.url.trim()\n try {\n const parsed = validateSecuredUrl(url)\n if (parsed.pathname.endsWith(\"/\")) {\n throw new Error(`URL must point to a file, but got ${parsed.href}`)\n }\n return { toolset: custom, type: \"url\" }\n } catch {\n // Ignore. If the URL is invalid, validate it as a file path\n }\n if (url.startsWith(\"file://\")) {\n const p = url.slice(\"file://\".length)\n const isWithinResources = path.normalize(p).startsWith(path.normalize(resourcesDir + path.sep))\n const isValid = path.isAbsolute(p) || isWithinResources\n const type =\n isValid &&\n (await exists(p)) &&\n (await stat(p)\n .then(s => (s.isDirectory() ? \"directory\" : s.isFile() ? \"file\" : false))\n .catch(() => false))\n if (type) {\n return { toolset: custom, type }\n }\n }\n throw new Error(`Invalid custom toolset: ${url}. Must be a valid https:// URL or a file:// path.`)\n}\n\n// Strip the file:// prefix and sanitize the path against resourcesDir (relative paths must be within it)\nfunction resolveFilePath(url: string, resourcesDir: string): string {\n const p = url.startsWith(\"file://\") ? url.slice(\"file://\".length) : url\n return path.isAbsolute(p) ? sanitizeDirPath(p) : sanitizeDirPath(p, resourcesDir)\n}\n\nexport async function getCustomToolsetPath(custom: ToolsetCustom, resourcesDir: string): Promise<string> {\n const { type, toolset } = await validateCustomToolset(custom, resourcesDir)\n\n if (type !== \"directory\" && !toolset.checksum) {\n throw new Error(`ToolsetCustom.checksum is required for ${type} toolsets (url: ${toolset.url})`)\n }\n\n const binaryVersion = toolset.version ?? toolset.checksum!.substring(0, 8)\n const releaseName = `${binaryVersion}-${hashUrlSafe(toolset.url)}`\n\n if (type === \"url\") {\n return downloadBuilderToolset({\n releaseName: releaseName,\n filenameWithExt: path.basename(toolset.url),\n checksums: { [path.basename(toolset.url)]: toolset.checksum! },\n overrideUrl: toolset.url,\n })\n } else if (type === \"file\") {\n const cacheDir = getCacheDirectory({ isAvoidSystemOnWindows: true, allowEnvVarOverride: true })\n const customToolsetDir = path.join(cacheDir, \"custom-toolsets\")\n await mkdir(customToolsetDir, { recursive: true })\n\n // wipe first to ensure idempotent extraction if the source file changed since last extraction\n const toolsetTarget = path.join(customToolsetDir, releaseName)\n if (await exists(toolsetTarget)) {\n await rmdir(toolsetTarget, { recursive: true })\n }\n await extractArchive(resolveFilePath(toolset.url, resourcesDir), toolsetTarget)\n return toolsetTarget\n } else if (type === \"directory\") {\n return resolveFilePath(toolset.url, resourcesDir)\n } else {\n throw new Error(`Unsupported custom toolset type: ${type}`)\n }\n}\n\nexport function hashUrlSafe(input: string, length = 6): string {\n let hash = 5381\n for (let i = 0; i < input.length; i++) {\n hash = ((hash << 5) + hash) ^ input.charCodeAt(i)\n }\n hash >>>= 0\n const out = hash.toString(36)\n return out.length >= length ? out.slice(0, length) : out.padStart(length, \"0\")\n}\n\nasync function extractZipStreaming(file: string, dir: string): Promise<void> {\n // Pass 1: read central directory once to collect Unix modes (one seek to EOF)\n const zipDir = await unzipper.Open.file(file)\n const entryModes = new Map<string, number>()\n for (const entry of zipDir.files) {\n const mode = (entry.externalFileAttributes >> 16) & 0xffff\n if (mode > 0) {\n entryModes.set(entry.path, mode)\n }\n }\n const isSymlink = (mode: number) => (mode & 0o170000) === 0o120000\n\n // Pass 2: stream from byte 0 — no per-entry seeks, no Docker hang\n const entries = createReadStream(file).pipe(unzipper.Parse({ forceStream: true }))\n for await (const entry of entries as AsyncIterable<unzipper.Entry>) {\n const destPath = path.resolve(dir, entry.path)\n if (!destPath.startsWith(dir + path.sep) && destPath !== dir) {\n throw new Error(`Path traversal blocked: ${entry.path}`)\n }\n const mode = entryModes.get(entry.path) ?? 0\n if (mode > 0 && isSymlink(mode)) {\n const target = (await entry.buffer()).toString()\n if (path.isAbsolute(target)) {\n throw new Error(`Absolute symlink target blocked: ${target}`)\n }\n const resolvedTarget = path.resolve(path.dirname(destPath), target)\n if (!resolvedTarget.startsWith(dir + path.sep) && resolvedTarget !== dir) {\n throw new Error(`Symlink target escapes extraction dir: ${target}`)\n }\n await fs.mkdir(path.dirname(destPath), { recursive: true })\n await fs.symlink(target, destPath)\n } else if (entry.type === \"Directory\") {\n await fs.mkdir(destPath, { recursive: true })\n entry.autodrain()\n } else {\n await fs.mkdir(path.dirname(destPath), { recursive: true })\n await pipeline(entry, createWriteStream(destPath))\n if (mode > 0) {\n await fs.chmod(destPath, mode & 0o7777)\n }\n }\n }\n}\n\nexport async function extractArchive(file: string, dir: string) {\n const tmpDir = `${dir}.tmp`\n await fs.mkdir(tmpDir, { recursive: true })\n\n const release = await lockfile.lock(tmpDir, {\n retries: { retries: 100, minTimeout: 1000, maxTimeout: 5000 },\n stale: 120000,\n })\n\n try {\n await fs.rm(tmpDir, { recursive: true, force: true })\n await fs.mkdir(tmpDir, { recursive: true })\n\n // Guard against transient window in @electron/get's non-atomic putFileInCache (remove → move).\n for (let i = 0; !(await exists(file)); i++) {\n if (i >= 4) {\n throw Object.assign(new Error(`Source archive not found after retries: ${file}`), { code: \"ENOENT\", path: file })\n }\n log.warn({ file, attempt: i + 1 }, \"source archive transiently missing, retrying\")\n await new Promise(r => setTimeout(r, 300 * (i + 1)))\n }\n\n if (file.endsWith(\".tar.gz\") || file.endsWith(\".tgz\")) {\n await tar.extract({ file, cwd: tmpDir, strip: 1 })\n } else if (file.endsWith(\".tar.xz\") || file.endsWith(\".txz\")) {\n const cmd7za = await getPath7za()\n const xzOutDir = `${tmpDir}.xz`\n await fs.rm(xzOutDir, { recursive: true, force: true })\n await fs.mkdir(xzOutDir, { recursive: true })\n try {\n await exec(cmd7za, [\"x\", \"-bd\", file, to7zaOutputSwitch(sanitizeDirPath(xzOutDir)), \"-y\"])\n const innerTar = (await fs.readdir(xzOutDir)).find(f => f.endsWith(\".tar\"))\n if (innerTar == null) {\n throw new Error(`xz decompression of ${path.basename(file)} produced no .tar archive`)\n }\n await tar.extract({ file: path.join(xzOutDir, innerTar), cwd: tmpDir, strip: 1 })\n } finally {\n await fs.rm(xzOutDir, { recursive: true, force: true })\n }\n } else if (file.endsWith(\".zip\")) {\n await extractZipStreaming(file, tmpDir)\n } else if (file.endsWith(\".7z\")) {\n const cmd7za = await getPath7za()\n try {\n await exec(cmd7za, [\"x\", \"-bd\", file, to7zaOutputSwitch(sanitizeDirPath(tmpDir)), \"-y\"])\n } catch (e: any) {\n const files = await fs.readdir(tmpDir)\n if (files.length === 0) {\n log.warn({ file, tmpDir, error: e.message }, \"7z extraction produced no output\")\n throw new Error(`7z extraction failed for ${file}: ${e.message}`)\n }\n log.warn({ error: e.message, filesExtracted: files.length }, \"7z reported error but extracted files\")\n }\n } else {\n throw new Error(`Unsupported archive format: ${path.basename(file)}`)\n }\n\n const extractedFiles = await fs.readdir(tmpDir)\n if (extractedFiles.length === 0) {\n throw new Error(`Extraction of ${path.basename(file)} produced no files`)\n }\n\n await fs.rm(dir, { recursive: true, force: true })\n await fs.rename(tmpDir, dir)\n } finally {\n await release().catch(err => log.warn({ err }, \"failed to release lockfile\"))\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"custom.js","sourceRoot":"","sources":["../../src/toolsets/custom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,yBAAyB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACrG,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,uBAAuB,EAAoB,aAAa,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC/J,OAAO,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAE3H,KAAK,UAAU,qBAAqB,CAAC,MAAqB,EAAE,YAAqB;IAC/E,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;IAC7B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA;QACtC,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,qCAAqC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;QACrE,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;IACzC,CAAC;IAAC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from \"fs/promises\"\nimport * as path from \"path\"\nimport { ToolsetCustom } from \"../configuration.js\"\nimport { ACCEPTED_CHECKSUM_FORMATS, checksumCacheKey, checksumMismatchMessage, ExpectedChecksum, parseChecksum, verifyFileChecksum } from \"../util/checksum.js\"\nimport { cacheDirectoryOverrideAllowed, downloadBuilderToolset, extractArchive, hashUrlSafe } from \"../util/electronGet.js\"\n\nasync function validateCustomToolset(custom: ToolsetCustom, resourcesDir?: string) {\n const url = custom.url.trim()\n try {\n const parsed = validateSecuredUrl(url)\n if (parsed.pathname.endsWith(\"/\")) {\n throw new Error(`URL must point to a file, but got ${parsed.href}`)\n }\n return { toolset: custom, type: \"url\" }\n } catch {\n // Ignore. If the URL is invalid, validate it as a file path\n }\n if (url.startsWith(\"file://\")) {\n const p = url.slice(\"file://\".length)\n const isWithinResources = resourcesDir ? path.normalize(p).startsWith(path.normalize(resourcesDir + path.sep)) : false\n const isValid = path.isAbsolute(p) || isWithinResources\n const type =\n isValid &&\n (await exists(p)) &&\n (await stat(p)\n .then(s => (s.isDirectory() ? \"directory\" : s.isFile() ? \"file\" : false))\n .catch(() => false))\n if (type) {\n return { toolset: custom, type }\n }\n }\n throw new Error(`Invalid custom toolset: ${url}. Must be a valid https:// URL or a file:// path.`)\n}\n\n// Strip the file:// prefix and sanitize the path against resourcesDir (relative paths must be within it)\nfunction resolveFilePath(url: string, resourcesDir?: string): string {\n const p = url.startsWith(\"file://\") ? url.slice(\"file://\".length) : url\n return path.isAbsolute(p) ? sanitizeDirPath(p) : sanitizeDirPath(p, resourcesDir)\n}\n\nconst _customToolsetCache = new Map<string, Promise<string>>()\n\nexport function clearCustomToolsetCache(): void {\n _customToolsetCache.clear()\n}\n\nexport function getCustomToolsetPath(custom: ToolsetCustom, resourcesDir?: string): Promise<string> {\n const key = JSON.stringify({ url: custom.url, checksum: memoChecksumKey(custom.checksum), resourcesDir })\n let cached = _customToolsetCache.get(key)\n if (cached == null) {\n cached = _resolveCustomToolsetPath(custom, resourcesDir)\n _customToolsetCache.set(key, cached)\n }\n return cached\n}\n\n// Equivalent spellings of one checksum (uppercase hex, surrounding whitespace) share a memo entry; an invalid value is\n// keyed verbatim and fails in _resolveCustomToolsetPath with the configuration error.\nfunction memoChecksumKey(checksum: string | undefined): string {\n if (!checksum) {\n return \"\"\n }\n try {\n return checksumCacheKey(parseChecksum(checksum, \"ToolsetCustom.checksum\"))\n } catch {\n return checksum\n }\n}\n\nconst CHECKSUM_DOCS_URL = \"https://www.electron.build/docs/toolsets#custom-toolset-checksum\"\n\n/**\n * Classifies the checksum of a downloaded or archive toolset up front, so a value in an unsupported format fails before\n * anything is downloaded or extracted, without echoing the value. A SHA-256 hex value is verified by `@electron/get` for a\n * download; a base64 SHA-512 (the format v26 used for all toolset checksums) is verified by electron-builder.\n */\nfunction normalizeChecksum(checksum: string | undefined, type: string, url: string): ExpectedChecksum {\n if (!checksum) {\n throw new InvalidConfigurationError(`ToolsetCustom.checksum is required for ${type} toolsets (url: ${url}): ${ACCEPTED_CHECKSUM_FORMATS}. See ${CHECKSUM_DOCS_URL}`)\n }\n return parseChecksum(checksum, `ToolsetCustom.checksum for ${type} toolset ${url}`, CHECKSUM_DOCS_URL)\n}\n\nasync function _resolveCustomToolsetPath(custom: ToolsetCustom, resourcesDir?: string): Promise<string> {\n const { type, toolset } = await validateCustomToolset(custom, resourcesDir)\n\n if (type === \"directory\") {\n return resolveFilePath(toolset.url, resourcesDir)\n }\n\n const checksum = normalizeChecksum(toolset.checksum, String(type), toolset.url)\n // hex form of the digest: a base64 SHA-512 may contain \"/\" or \"+\", which must not reach the cache directory name\n const binaryVersion = toolset.version ?? checksumCacheKey(checksum).substring(0, 8)\n const releaseName = `${binaryVersion}-${hashUrlSafe(toolset.url)}`\n\n if (type === \"url\") {\n return downloadBuilderToolset({\n releaseName: releaseName,\n filenameWithExt: path.basename(toolset.url),\n checksums: { [path.basename(toolset.url)]: checksum.value },\n overrideUrl: toolset.url,\n })\n } else if (type === \"file\") {\n const archivePath = resolveFilePath(toolset.url, resourcesDir)\n // Verify the local archive on every resolution, before anything is extracted: the archive is re-extracted each time anyway\n // (see below), so hashing it adds little, and a stale extraction can never outlive a changed archive. The user's file is\n // never modified or removed, whatever the result.\n const { matches, actual } = await verifyFileChecksum(archivePath, checksum)\n if (!matches) {\n throw new InvalidConfigurationError(\n `${checksumMismatchMessage(`the local toolset archive ${archivePath}`, checksum, actual)} ` +\n `The archive was not extracted and has been left in place. Update ToolsetCustom.checksum if the archive was changed intentionally. See ${CHECKSUM_DOCS_URL}`\n )\n }\n\n const cacheDir = await cacheDirectoryOverrideAllowed.value\n const customToolsetDir = path.join(cacheDir, \"custom-toolsets\")\n await mkdir(customToolsetDir, { recursive: true })\n\n // wipe first to ensure idempotent extraction if the source file changed since last extraction.\n // Contain the destination within customToolsetDir (mirrors the `url` branch): `version` is a free-form\n // config field, so a `../…` value must not let rmdir/extract escape the cache directory.\n const toolsetTarget = sanitizeDirPath(path.join(customToolsetDir, releaseName), customToolsetDir)\n if (await exists(toolsetTarget)) {\n await rm(toolsetTarget, { recursive: true })\n }\n await extractArchive(archivePath, toolsetTarget)\n return toolsetTarget\n }\n\n throw new Error(`Unsupported custom toolset type: ${type}`)\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fpm.d.ts","sourceRoot":"","sources":["../../src/toolsets/fpm.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fpm.d.ts","sourceRoot":"","sources":["../../src/toolsets/fpm.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAkBnD,wBAAsB,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,YAAY,EAAE,MAAM,mBAyCnF"}
|
package/dist/toolsets/fpm.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { InvalidConfigurationError } from "builder-util";
|
|
1
2
|
import * as path from "path";
|
|
2
3
|
import { downloadBuilderToolset } from "../util/electronGet.js";
|
|
3
|
-
import { isUseSystemFpm } from "../util/flags.js";
|
|
4
4
|
import { getCustomToolsetPath } from "./custom.js";
|
|
5
|
+
import { resolveToolsetVersion } from "./version.js";
|
|
6
|
+
// Newest FPM bundle — selected when the config is unset / null / "latest".
|
|
7
|
+
const FPM_LATEST = "2.2.1";
|
|
5
8
|
const fpmChecksums = {
|
|
6
9
|
"2.2.1": {
|
|
7
10
|
"fpm-1.17.0-ruby-3.4.3-linux-amd64.7z": "2ef73acbcbfd26503369cb3a9b0345aa7fae251d69130537ee6ff47b402f828e",
|
|
@@ -13,13 +16,16 @@ const fpmChecksums = {
|
|
|
13
16
|
};
|
|
14
17
|
export async function getFpmPath(toolset, resourcesDir) {
|
|
15
18
|
const exec = "fpm";
|
|
16
|
-
|
|
17
|
-
return exec;
|
|
18
|
-
}
|
|
19
|
+
// A custom toolset is an explicit user override — honored on every platform, before any platform default/fallback.
|
|
19
20
|
if (typeof toolset === "object" && toolset != null) {
|
|
20
21
|
const vendorPath = await getCustomToolsetPath(toolset, resourcesDir);
|
|
21
22
|
return path.resolve(vendorPath, exec);
|
|
22
23
|
}
|
|
24
|
+
if (process.platform === "win32") {
|
|
25
|
+
// No fpm binary is bundled for Windows. Rather than resolving a bare `fpm` from $PATH (a binary-hijack
|
|
26
|
+
// vector), require an explicit custom toolset pointing at the directory that contains the fpm executable.
|
|
27
|
+
throw new InvalidConfigurationError(`fpm is not bundled for Windows. Configure a custom toolset pointing at the directory containing your fpm executable, e.g. toolsets: { fpm: { url: "file:///absolute/path/to/fpm/dir" } }`);
|
|
28
|
+
}
|
|
23
29
|
const getKey = () => {
|
|
24
30
|
if (process.platform === "linux") {
|
|
25
31
|
if (process.arch == "x64") {
|
|
@@ -37,7 +43,7 @@ export async function getFpmPath(toolset, resourcesDir) {
|
|
|
37
43
|
return "fpm-1.17.0-ruby-3.4.3-darwin-x86_64.7z";
|
|
38
44
|
};
|
|
39
45
|
const filename = getKey();
|
|
40
|
-
const version = toolset
|
|
46
|
+
const version = resolveToolsetVersion(toolset, FPM_LATEST);
|
|
41
47
|
const fpmPath = await downloadBuilderToolset({
|
|
42
48
|
releaseName: `fpm@${version}`,
|
|
43
49
|
filenameWithExt: filename,
|
package/dist/toolsets/fpm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fpm.js","sourceRoot":"","sources":["../../src/toolsets/fpm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"fpm.js","sourceRoot":"","sources":["../../src/toolsets/fpm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAEpD,2EAA2E;AAC3E,MAAM,UAAU,GAAG,OAAO,CAAA;AAE1B,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE;QACP,sCAAsC,EAAE,kEAAkE;QAC1G,wCAAwC,EAAE,kEAAkE;QAC5G,wCAAwC,EAAE,kEAAkE;QAC5G,uCAAuC,EAAE,kEAAkE;QAC3G,qCAAqC,EAAE,kEAAkE;KAC1G;CACO,CAAA;AAEV,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAA6B,EAAE,YAAoB;IAClF,MAAM,IAAI,GAAG,KAAK,CAAA;IAClB,mHAAmH;IACnH,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACnD,MAAM,UAAU,GAAG,MAAM,oBAAoB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;QACpE,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IACvC,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,uGAAuG;QACvG,0GAA0G;QAC1G,MAAM,IAAI,yBAAyB,CACjC,0LAA0L,CAC3L,CAAA;IACH,CAAC;IAED,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YACjC,IAAI,OAAO,CAAC,IAAI,IAAI,KAAK,EAAE,CAAC;gBAC1B,OAAO,sCAAsC,CAAA;YAC/C,CAAC;iBAAM,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBACpC,OAAO,wCAAwC,CAAA;YACjD,CAAC;YACD,OAAO,qCAAqC,CAAA;QAC9C,CAAC;QACD,eAAe;QACf,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC7B,OAAO,uCAAuC,CAAA;QAChD,CAAC;QACD,OAAO,wCAAwC,CAAA;IACjD,CAAC,CAAA;IAED,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAA;IACzB,MAAM,OAAO,GAAG,qBAAqB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;IAC1D,MAAM,OAAO,GAAG,MAAM,sBAAsB,CAAC;QAC3C,WAAW,EAAE,OAAO,OAAO,EAAE;QAC7B,eAAe,EAAE,QAAQ;QACzB,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC;QAChC,aAAa,EAAE,6CAA6C;KAC7D,CAAC,CAAA;IACF,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACpC,CAAC","sourcesContent":["import { InvalidConfigurationError } from \"builder-util\"\nimport * as path from \"path\"\nimport { ToolsetConfig } from \"../configuration.js\"\nimport { downloadBuilderToolset } from \"../util/electronGet.js\"\nimport { getCustomToolsetPath } from \"./custom.js\"\nimport { resolveToolsetVersion } from \"./version.js\"\n\n// Newest FPM bundle — selected when the config is unset / null / \"latest\".\nconst FPM_LATEST = \"2.2.1\"\n\nconst fpmChecksums = {\n \"2.2.1\": {\n \"fpm-1.17.0-ruby-3.4.3-linux-amd64.7z\": \"2ef73acbcbfd26503369cb3a9b0345aa7fae251d69130537ee6ff47b402f828e\",\n \"fpm-1.17.0-ruby-3.4.3-darwin-x86_64.7z\": \"50eff4214e3e30e2a8bbc35854f80acabb3260ea9e87f5835c60f898eedb320e\",\n \"fpm-1.17.0-ruby-3.4.3-linux-arm64v8.7z\": \"553f047eacbc63423bae1eca5958bcdc720c1f6f4135cb815f5ec99f48d3bd55\",\n \"fpm-1.17.0-ruby-3.4.3-darwin-arm64.7z\": \"e44b60765367cd11b0b9fa5f1966762137ee45ec02d49a3e9668475031e97873\",\n \"fpm-1.17.0-ruby-3.4.3-linux-i386.7z\": \"f4091110728de8259dcab181761e74141b4b65d409a26e642c7271bd0b61eab4\",\n },\n} as const\n\nexport async function getFpmPath(toolset: ToolsetConfig[\"fpm\"], resourcesDir: string) {\n const exec = \"fpm\"\n // A custom toolset is an explicit user override — honored on every platform, before any platform default/fallback.\n if (typeof toolset === \"object\" && toolset != null) {\n const vendorPath = await getCustomToolsetPath(toolset, resourcesDir)\n return path.resolve(vendorPath, exec)\n }\n\n if (process.platform === \"win32\") {\n // No fpm binary is bundled for Windows. Rather than resolving a bare `fpm` from $PATH (a binary-hijack\n // vector), require an explicit custom toolset pointing at the directory that contains the fpm executable.\n throw new InvalidConfigurationError(\n `fpm is not bundled for Windows. Configure a custom toolset pointing at the directory containing your fpm executable, e.g. toolsets: { fpm: { url: \"file:///absolute/path/to/fpm/dir\" } }`\n )\n }\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 version = resolveToolsetVersion(toolset, FPM_LATEST)\n const fpmPath = await downloadBuilderToolset({\n releaseName: `fpm@${version}`,\n filenameWithExt: filename,\n checksums: fpmChecksums[version],\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n return path.resolve(fpmPath, exec)\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/toolsets/icons.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/toolsets/icons.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAwBnD,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAW9G;AAED,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAA;IACpC,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;IACpC,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAID,wBAAsB,YAAY,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAcxI"}
|
package/dist/toolsets/icons.js
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
import { exec, exists, InvalidConfigurationError, sanitizeDirPath } from "builder-util";
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import { downloadBuilderToolset } from "../util/electronGet.js";
|
|
4
|
+
import { withIconsLock } from "../util/toolsetLock.js";
|
|
4
5
|
import { getCustomToolsetPath } from "./custom.js";
|
|
6
|
+
import { resolveToolsetVersion } from "./version.js";
|
|
7
|
+
// Newest icons-conversion bundle — selected when the config is unset / null / "latest".
|
|
8
|
+
const ICONS_LATEST = "1.2.3";
|
|
5
9
|
const iconsToolsChecksums = {
|
|
6
10
|
"1.1.0": {
|
|
7
11
|
"icons-bundle.tar.gz": "2241c9501aa5ddd19317956449f50a1bc311df2c34058aae9bf8bfe62081eaec",
|
|
8
12
|
},
|
|
13
|
+
"1.2.0": {
|
|
14
|
+
"icons-bundle.tar.gz": "788add2400487fe00d5ceac4a8347bd71fc43c8c988fde879f929992ea0c03ea",
|
|
15
|
+
},
|
|
16
|
+
"1.2.1": {
|
|
17
|
+
"icons-bundle.tar.gz": "193241afc7c81ab165fa0af15ef0af88f796eb69e8e5bb4249a49310d8be242a",
|
|
18
|
+
},
|
|
19
|
+
"1.2.3": {
|
|
20
|
+
"icons-bundle.tar.gz": "4e5bb546c9d3ab0c2bbacc22857467bf415f742a34c2be9dd138779d2fc066f9",
|
|
21
|
+
},
|
|
9
22
|
};
|
|
10
23
|
export async function getIconsToolsetPath(icons, resourcesDir) {
|
|
11
24
|
if (typeof icons === "object" && icons != null) {
|
|
12
25
|
return getCustomToolsetPath(icons, resourcesDir);
|
|
13
26
|
}
|
|
14
|
-
const version = icons
|
|
27
|
+
const version = resolveToolsetVersion(icons, ICONS_LATEST);
|
|
15
28
|
return downloadBuilderToolset({
|
|
16
29
|
releaseName: `icons@${version}`,
|
|
17
30
|
filenameWithExt: "icons-bundle.tar.gz",
|
|
@@ -27,10 +40,11 @@ export async function runIconsTool({ inputFile, outputFormat, outDir, iconsTools
|
|
|
27
40
|
const safeInput = sanitizeDirPath(inputFile);
|
|
28
41
|
const safeOutDir = sanitizeDirPath(outDir);
|
|
29
42
|
const toolsetPath = await getIconsToolsetPath(iconsToolset, resourcesDir);
|
|
30
|
-
const scriptPath = path.resolve(toolsetPath, "icon-tool.js");
|
|
43
|
+
const scriptPath = sanitizeDirPath(path.resolve(toolsetPath, "icon-tool.js"), toolsetPath);
|
|
31
44
|
if (!(await exists(scriptPath))) {
|
|
32
45
|
throw new InvalidConfigurationError(`Icons tool not found at expected path: ${scriptPath}`);
|
|
33
46
|
}
|
|
34
|
-
|
|
47
|
+
// Serialize icon-tool spawns across processes: each reserves a large WebAssembly.Memory, andrunning many in parallel (e.g. across vitest workers) exhausts memory. See withIconsLock.
|
|
48
|
+
await withIconsLock(() => exec(process.execPath, [scriptPath, `--input`, safeInput, `--format`, outputFormat, `--out`, safeOutDir], { shell: false }));
|
|
35
49
|
}
|
|
36
50
|
//# sourceMappingURL=icons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/toolsets/icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACvF,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/toolsets/icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACvF,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,C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eAAe,CAAC,SAAS,CAAC,CAAA;IAC5C,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IAE1C,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;IACzE,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE,WAAW,CAAC,CAAA;IAC1F,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,yBAAyB,CAAC,0CAA0C,UAAU,EAAE,CAAC,CAAA;IAC7F,CAAC;IACD,sLAAsL;IACtL,MAAM,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;AACxJ,CAAC","sourcesContent":["import { exec, exists, InvalidConfigurationError, sanitizeDirPath } from \"builder-util\"\nimport * as path from \"path\"\nimport { ToolsetConfig } from \"../configuration.js\"\nimport { downloadBuilderToolset } from \"../util/electronGet.js\"\nimport { withIconsLock } from \"../util/toolsetLock.js\"\nimport { getCustomToolsetPath } from \"./custom.js\"\nimport { resolveToolsetVersion } from \"./version.js\"\n\n// Newest icons-conversion bundle — selected when the config is unset / null / \"latest\".\nconst ICONS_LATEST = \"1.2.3\"\n\nconst iconsToolsChecksums = {\n \"1.1.0\": {\n \"icons-bundle.tar.gz\": \"2241c9501aa5ddd19317956449f50a1bc311df2c34058aae9bf8bfe62081eaec\",\n },\n \"1.2.0\": {\n \"icons-bundle.tar.gz\": \"788add2400487fe00d5ceac4a8347bd71fc43c8c988fde879f929992ea0c03ea\",\n },\n \"1.2.1\": {\n \"icons-bundle.tar.gz\": \"193241afc7c81ab165fa0af15ef0af88f796eb69e8e5bb4249a49310d8be242a\",\n },\n \"1.2.3\": {\n \"icons-bundle.tar.gz\": \"4e5bb546c9d3ab0c2bbacc22857467bf415f742a34c2be9dd138779d2fc066f9\",\n },\n} as const\n\nexport async function getIconsToolsetPath(icons: ToolsetConfig[\"icons\"], resourcesDir: string): Promise<string> {\n if (typeof icons === \"object\" && icons != null) {\n return getCustomToolsetPath(icons, resourcesDir)\n }\n const version = resolveToolsetVersion(icons, ICONS_LATEST)\n return downloadBuilderToolset({\n releaseName: `icons@${version}`,\n filenameWithExt: \"icons-bundle.tar.gz\",\n checksums: iconsToolsChecksums[version],\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n}\n\ntype IconConversionOptions = {\n inputFile: string\n outputFormat: \"icns\" | \"ico\" | \"set\"\n outDir: string\n iconsToolset: ToolsetConfig[\"icons\"]\n resourcesDir: string\n}\n\nconst VALID_OUTPUT_FORMATS = [\"icns\", \"ico\", \"set\"] as const\n\nexport async function runIconsTool({ inputFile, outputFormat, outDir, iconsToolset, resourcesDir }: 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(iconsToolset, resourcesDir)\n const scriptPath = sanitizeDirPath(path.resolve(toolsetPath, \"icon-tool.js\"), toolsetPath)\n if (!(await exists(scriptPath))) {\n throw new InvalidConfigurationError(`Icons tool not found at expected path: ${scriptPath}`)\n }\n // Serialize icon-tool spawns across processes: each reserves a large WebAssembly.Memory, andrunning many in parallel (e.g. across vitest workers) exhausts memory. See withIconsLock.\n await withIconsLock(() => exec(process.execPath, [scriptPath, `--input`, safeInput, `--format`, outputFormat, `--out`, safeOutDir], { shell: false }))\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linuxToolsMac.d.ts","sourceRoot":"","sources":["../../src/toolsets/linuxToolsMac.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"linuxToolsMac.d.ts","sourceRoot":"","sources":["../../src/toolsets/linuxToolsMac.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAsBnD,wBAAsB,iBAAiB,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAcxH;AAED,wBAAsB,uBAAuB,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM;;;;GAQ5G"}
|
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
import * as path from "path";
|
|
2
2
|
import { downloadBuilderToolset } from "../util/electronGet.js";
|
|
3
3
|
import { getCustomToolsetPath } from "./custom.js";
|
|
4
|
+
import { resolveToolsetVersion } from "./version.js";
|
|
5
|
+
// Newest linux-tools-mac bundle — selected when the config is unset / null / "latest".
|
|
6
|
+
const LINUX_TOOLS_MAC_LATEST = "1.0.1";
|
|
4
7
|
// 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
|
|
5
8
|
const linuxToolsMacChecksums = {
|
|
6
|
-
|
|
7
|
-
"
|
|
9
|
+
// built against macOS 26 — binaries abort on older hosts (see https://github.com/electron-userland/electron-builder/issues/10084)
|
|
10
|
+
"1.0.0": {
|
|
11
|
+
"linux-tools-mac-darwin-arm64.tar.gz": "204e76f08364352edb28a6a4be87e8f9bd9340213865d9a0d1c664aa46fcf053",
|
|
12
|
+
"linux-tools-mac-darwin-x86_64.tar.gz": "7ee26dfbd0d2a4c2c83b55a9416a30cc84876eef01c6497ca49bb016a190c726",
|
|
13
|
+
},
|
|
14
|
+
// rebuilt on macOS 15 runners — binaries run on macOS 15+
|
|
15
|
+
"1.0.1": {
|
|
16
|
+
"linux-tools-mac-darwin-arm64.tar.gz": "3dcb43a12b8630919b8d5cc9045be102108b0edd9b0354e0a7409ee5b53141ac",
|
|
17
|
+
"linux-tools-mac-darwin-x86_64.tar.gz": "d62f5e2f6949c6420fdda8b18d2e70b0e14eeb959128c0cea11acada2c105ad9",
|
|
18
|
+
},
|
|
8
19
|
};
|
|
9
20
|
export async function getLinuxToolsPath(toolset, resourcesDir) {
|
|
10
21
|
if (typeof toolset === "object" && toolset != null) {
|
|
11
22
|
return getCustomToolsetPath(toolset, resourcesDir ?? "");
|
|
12
23
|
}
|
|
13
24
|
const arch = process.arch === "arm64" ? "arm64" : "x86_64";
|
|
25
|
+
const version = resolveToolsetVersion(toolset, LINUX_TOOLS_MAC_LATEST);
|
|
26
|
+
const checksums = linuxToolsMacChecksums[version];
|
|
14
27
|
const filename = `linux-tools-mac-darwin-${arch}.tar.gz`;
|
|
15
28
|
return downloadBuilderToolset({
|
|
16
|
-
releaseName: `linux-tools-mac@${
|
|
29
|
+
releaseName: `linux-tools-mac@${version}`,
|
|
17
30
|
filenameWithExt: filename,
|
|
18
|
-
checksums
|
|
31
|
+
checksums,
|
|
19
32
|
githubOrgRepo: "electron-userland/electron-builder-binaries",
|
|
20
33
|
});
|
|
21
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linuxToolsMac.js","sourceRoot":"","sources":["../../src/toolsets/linuxToolsMac.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"linuxToolsMac.js","sourceRoot":"","sources":["../../src/toolsets/linuxToolsMac.ts"],"names":[],"mappings":"AAAA,OAAO,KAA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,cAAc,GAAG,MAAM,iBAAiB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;IACrE,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;IAClE,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC;QACb,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC;QACjB,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC;KAClB,CAAA;AACH,CAAC","sourcesContent":["import * as path from \"path\"\nimport { ToolsetConfig } from \"../configuration.js\"\nimport { downloadBuilderToolset } from \"../util/electronGet.js\"\nimport { getCustomToolsetPath } from \"./custom.js\"\nimport { resolveToolsetVersion } from \"./version.js\"\n\n// Newest linux-tools-mac bundle — selected when the config is unset / null / \"latest\".\nconst LINUX_TOOLS_MAC_LATEST = \"1.0.1\"\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 // built against macOS 26 — binaries abort on older hosts (see https://github.com/electron-userland/electron-builder/issues/10084)\n \"1.0.0\": {\n \"linux-tools-mac-darwin-arm64.tar.gz\": \"204e76f08364352edb28a6a4be87e8f9bd9340213865d9a0d1c664aa46fcf053\",\n \"linux-tools-mac-darwin-x86_64.tar.gz\": \"7ee26dfbd0d2a4c2c83b55a9416a30cc84876eef01c6497ca49bb016a190c726\",\n },\n // rebuilt on macOS 15 runners — binaries run on macOS 15+\n \"1.0.1\": {\n \"linux-tools-mac-darwin-arm64.tar.gz\": \"3dcb43a12b8630919b8d5cc9045be102108b0edd9b0354e0a7409ee5b53141ac\",\n \"linux-tools-mac-darwin-x86_64.tar.gz\": \"d62f5e2f6949c6420fdda8b18d2e70b0e14eeb959128c0cea11acada2c105ad9\",\n },\n} as const\n\nexport async function getLinuxToolsPath(toolset?: ToolsetConfig[\"linuxToolsMac\"], resourcesDir?: string): Promise<string> {\n if (typeof toolset === \"object\" && toolset != null) {\n return getCustomToolsetPath(toolset, resourcesDir ?? \"\")\n }\n const arch = process.arch === \"arm64\" ? \"arm64\" : \"x86_64\"\n const version = resolveToolsetVersion(toolset, LINUX_TOOLS_MAC_LATEST)\n const checksums = linuxToolsMacChecksums[version]\n const filename: keyof typeof checksums = `linux-tools-mac-darwin-${arch}.tar.gz`\n return downloadBuilderToolset({\n releaseName: `linux-tools-mac@${version}`,\n filenameWithExt: filename,\n checksums,\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n}\n\nexport async function getLinuxToolsMacToolset(toolset?: ToolsetConfig[\"linuxToolsMac\"], resourcesDir?: string) {\n const linuxToolsPath = await getLinuxToolsPath(toolset, resourcesDir)\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"]}
|
package/dist/toolsets/nsis.d.ts
CHANGED
|
@@ -7,6 +7,11 @@ export declare const nsisChecksums: {
|
|
|
7
7
|
readonly "nsis-bundle-3.12.tar.gz": "56997fdefe25e7928a1a68b4583d08b240b66cf660234053b20131a74cc082f4";
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* `installerDebugLogging` emits `LogSet`, which only a `makensis` compiled with `NSIS_CONFIG_LOG=yes` accepts ("LogSet specified,
|
|
12
|
+
* NSIS_CONFIG_LOG not defined" otherwise). The bundled NSIS toolsets are not log-enabled, so only a custom bundle can support it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function assertInstallerDebugLoggingSupported(nsis: ToolsetConfig["nsis"] | Nullish, targetName: string): void;
|
|
10
15
|
export declare function getMakeNsisPath(nsis: ToolsetConfig["nsis"] | Nullish, resourcesDir: string): Promise<ToolInfo>;
|
|
11
16
|
export declare function getNsisPluginsPath(nsis: ToolsetConfig["nsis"] | Nullish, resourcesDir: string): Promise<string>;
|
|
12
17
|
export declare function getNsisElevatePath(nsis: ToolsetConfig["nsis"] | Nullish, resourcesDir: string): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nsis.d.ts","sourceRoot":"","sources":["../../src/toolsets/nsis.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"nsis.d.ts","sourceRoot":"","sources":["../../src/toolsets/nsis.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AA2BjD,eAAO,MAAM,aAAa;;;;;CAQhB,CAAA;AAEV;;;GAGG;AACH,wBAAgB,oCAAoC,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAUpH;AAkBD,wBAAsB,eAAe,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CA4BpH;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAcrH;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CASrH"}
|
package/dist/toolsets/nsis.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { exists } from "builder-util";
|
|
1
|
+
import { exists, InvalidConfigurationError } from "builder-util";
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import { downloadBuilderToolset } from "../util/electronGet.js";
|
|
4
4
|
import { getCustomToolsetPath } from "./custom.js";
|
|
5
|
+
import { resolveToolsetVersion } from "./version.js";
|
|
5
6
|
import _fsExtra from "fs-extra";
|
|
6
7
|
const { stat } = _fsExtra;
|
|
8
|
+
// Newest NSIS bundle — selected when the config is unset / null / "latest".
|
|
9
|
+
const NSIS_LATEST = "1.2.1";
|
|
7
10
|
function getLegacyNsisBin() {
|
|
8
11
|
// Warning: Don't use v3.0.4.2 - https://github.com/electron-userland/electron-builder/issues/6334
|
|
9
12
|
return downloadBuilderToolset({
|
|
@@ -28,11 +31,24 @@ export const nsisChecksums = {
|
|
|
28
31
|
"nsis-bundle-3.12.tar.gz": "56997fdefe25e7928a1a68b4583d08b240b66cf660234053b20131a74cc082f4",
|
|
29
32
|
},
|
|
30
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* `installerDebugLogging` emits `LogSet`, which only a `makensis` compiled with `NSIS_CONFIG_LOG=yes` accepts ("LogSet specified,
|
|
36
|
+
* NSIS_CONFIG_LOG not defined" otherwise). The bundled NSIS toolsets are not log-enabled, so only a custom bundle can support it.
|
|
37
|
+
*/
|
|
38
|
+
export function assertInstallerDebugLoggingSupported(nsis, targetName) {
|
|
39
|
+
if (typeof nsis === "object" && nsis != null) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
throw new InvalidConfigurationError(`\`installerDebugLogging\` (${targetName} target) needs a log-enabled NSIS (makensis and stubs compiled with NSIS_CONFIG_LOG=yes), ` +
|
|
43
|
+
`but \`toolsets.nsis\` is ${nsis == null ? "unset" : `"${nsis}"`}, which selects a bundled NSIS that is not log-enabled.\n` +
|
|
44
|
+
" Supply a log-enabled NSIS bundle as a custom `toolsets.nsis: { url, checksum, version }`, or remove `installerDebugLogging`.\n" +
|
|
45
|
+
" https://www.electron.build/docs/migration/v27-breaking-changes#nsiscustomnsisbinary-toolsetsnsis");
|
|
46
|
+
}
|
|
31
47
|
async function getNsisBundlePath(nsis, resourcesDir) {
|
|
32
48
|
if (typeof nsis === "object" && nsis != null) {
|
|
33
49
|
return getCustomToolsetPath(nsis, resourcesDir);
|
|
34
50
|
}
|
|
35
|
-
const resolved = nsis
|
|
51
|
+
const resolved = resolveToolsetVersion(nsis, NSIS_LATEST);
|
|
36
52
|
if (resolved === "0.0.0") {
|
|
37
53
|
return getLegacyNsisBin();
|
|
38
54
|
}
|
|
@@ -60,7 +76,7 @@ export async function getMakeNsisPath(nsis, resourcesDir) {
|
|
|
60
76
|
return { path: path.resolve(bundlePath, process.platform === "win32" ? "makensis.cmd" : "makensis") };
|
|
61
77
|
};
|
|
62
78
|
const bundlePath = await getNsisBundlePath(nsis, resourcesDir);
|
|
63
|
-
if (
|
|
79
|
+
if (nsis === "0.0.0") {
|
|
64
80
|
return legacyBundle(bundlePath);
|
|
65
81
|
}
|
|
66
82
|
if (typeof nsis === "object") {
|
|
@@ -82,7 +98,7 @@ export async function getNsisPluginsPath(nsis, resourcesDir) {
|
|
|
82
98
|
}
|
|
83
99
|
throw new Error(`Plugins directory not found in NSIS bundle at: ${bundlePath}. Expected one of: ${potentialPaths.join(", ")}`);
|
|
84
100
|
};
|
|
85
|
-
if (
|
|
101
|
+
if (nsis === "0.0.0") {
|
|
86
102
|
return path.resolve(await getLegacyNsisResourcesBin(), "plugins");
|
|
87
103
|
}
|
|
88
104
|
return resolvePluginsDir(await getNsisBundlePath(nsis, resourcesDir));
|