app-builder-lib 27.0.0-alpha.1 → 27.0.0-alpha.11
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.map +1 -1
- package/dist/asar/asarAlign.d.ts +35 -0
- package/dist/asar/asarAlign.d.ts.map +1 -0
- package/dist/asar/asarAlign.js +149 -0
- package/dist/asar/asarAlign.js.map +1 -0
- 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.d.ts +15 -1
- package/dist/asar/asarUtil.d.ts.map +1 -1
- package/dist/asar/asarUtil.js +132 -72
- 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 +233 -166
- 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 +55 -3
- package/dist/fileMatcher.d.ts.map +1 -1
- package/dist/fileMatcher.js +274 -28
- package/dist/fileMatcher.js.map +1 -1
- package/dist/index.d.ts +13 -7
- 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 +20 -8
- package/dist/indexInternal.d.ts.map +1 -1
- package/dist/indexInternal.js +19 -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 +147 -12
- package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/options/SnapOptions.d.ts +59 -32
- 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 +61 -30
- 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 +123 -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 +55 -4
- package/dist/platformPackager.d.ts.map +1 -1
- package/dist/platformPackager.js +160 -22
- package/dist/platformPackager.js.map +1 -1
- package/dist/presets/rectCra.js +3 -1
- package/dist/presets/rectCra.js.map +1 -1
- package/dist/publish/PublishManager.d.ts +40 -2
- package/dist/publish/PublishManager.d.ts.map +1 -1
- package/dist/publish/PublishManager.js +365 -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 +108 -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 +13 -4
- package/dist/targets/ArchiveTarget.js.map +1 -1
- package/dist/targets/archive.d.ts +39 -2
- package/dist/targets/archive.d.ts.map +1 -1
- package/dist/targets/archive.js +114 -30
- package/dist/targets/archive.js.map +1 -1
- package/dist/targets/blockmap/blockmap.d.ts +44 -3
- package/dist/targets/blockmap/blockmap.d.ts.map +1 -1
- package/dist/targets/blockmap/blockmap.js +142 -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 +17 -0
- package/dist/targets/linux/FlatpakTarget.d.ts.map +1 -1
- package/dist/targets/linux/FlatpakTarget.js +245 -45
- 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 +92 -12
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.d.ts +13 -0
- package/dist/targets/linux/LinuxTargetHelper.d.ts.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.js +81 -61
- 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 +20 -15
- package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.d.ts +8 -2
- package/dist/targets/linux/appimage/appImageUtil.d.ts.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.js +16 -9
- package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
- package/dist/targets/linux/appimage/appLauncher.d.ts +6 -0
- package/dist/targets/linux/appimage/appLauncher.d.ts.map +1 -1
- package/dist/targets/linux/appimage/appLauncher.js +18 -20
- package/dist/targets/linux/appimage/appLauncher.js.map +1 -1
- package/dist/targets/linux/flatpakBundle.d.ts +43 -0
- package/dist/targets/linux/flatpakBundle.d.ts.map +1 -0
- package/dist/targets/linux/flatpakBundle.js +210 -0
- package/dist/targets/linux/flatpakBundle.js.map +1 -0
- 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 +13 -2
- package/dist/targets/linux/snap/core24.d.ts.map +1 -1
- package/dist/targets/linux/snap/core24.js +107 -95
- 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 +10 -3
- package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.js +37 -18
- 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/snapPlugs.d.ts +76 -0
- package/dist/targets/linux/snap/snapPlugs.d.ts.map +1 -0
- package/dist/targets/linux/snap/snapPlugs.js +242 -0
- package/dist/targets/linux/snap/snapPlugs.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 +4 -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 +64 -3
- package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.js +277 -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 +58 -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 +148 -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 +409 -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 +24 -21
- 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/AppFileWalker.js +9 -1
- package/dist/util/AppFileWalker.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 +67 -2
- package/dist/util/appFileCopier.d.ts.map +1 -1
- package/dist/util/appFileCopier.js +244 -32
- 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 +2 -1
- package/dist/util/config/config.d.ts.map +1 -1
- package/dist/util/config/config.js +42 -20
- package/dist/util/config/config.js.map +1 -1
- package/dist/util/config/fileOptions.d.ts +30 -0
- package/dist/util/config/fileOptions.d.ts.map +1 -0
- package/dist/util/config/fileOptions.js +120 -0
- package/dist/util/config/fileOptions.js.map +1 -0
- 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 +214 -0
- package/dist/util/config/legacyConfigGuard.js.map +1 -0
- package/dist/util/config/legacyOptions.d.ts +86 -0
- package/dist/util/config/legacyOptions.d.ts.map +1 -0
- package/dist/util/config/legacyOptions.js +413 -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 +43 -32
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +390 -137
- 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 +40 -58
- 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 +5 -0
- 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/removedEnvVars.d.ts +25 -0
- package/dist/util/removedEnvVars.d.ts.map +1 -0
- package/dist/util/removedEnvVars.js +54 -0
- package/dist/util/removedEnvVars.js.map +1 -0
- 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/util/trustedSourceRoots.d.ts +59 -0
- package/dist/util/trustedSourceRoots.d.ts.map +1 -0
- package/dist/util/trustedSourceRoots.js +127 -0
- package/dist/util/trustedSourceRoots.js.map +1 -0
- 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 +20 -20
- package/scheme.json +2112 -1495
- 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 +94 -53
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"7zip.js","sourceRoot":"","sources":["../../src/toolsets/7zip.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"7zip.js","sourceRoot":"","sources":["../../src/toolsets/7zip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAEpD,6EAA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AAe,EAAE,QAAQ;QACzB,SAAS,EAAE,iBAAiB,CAAC,QAAQ,CAAC;QACtC,aAAa,EAAE,6CAA6C;KAC7D,CAAC,CAAA;IAEF,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IACvF,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,MAAM,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACzB,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import { Nullish } from \"builder-util-runtime\"\nimport { chmod } from \"node:fs/promises\"\nimport * as path from \"path\"\nimport { downloadBuilderToolset } from \"../util/electronGet.js\"\nimport { resolveToolsetVersion } from \"./version.js\"\n\n// Newest 7-Zip bundle — selected when the config is unset / null / \"latest\".\nconst SEVEN_ZIP_LATEST = \"1.0.1\"\n\nconst sevenZipChecksums = {\n // shipped the 32-bit 7za.exe for every Windows arch — 1.75 GiB memory cap, no LZMA2 multithreading on x64/arm64 (electron-builder-binaries#222)\n \"1.0.0\": {\n \"7zip-linux-ia32.tar.gz\": \"24a5d5bfe81506d0bfe21a812588119ae3deb757e8ba084b2339d8e899543686\",\n \"7zip-darwin-arm64.tar.gz\": \"496a341abe210aae1a25bc202ee97f6de6c76a3dc80f91d96616be05502d72c1\",\n \"7zip-darwin-x86_64.tar.gz\": \"496a341abe210aae1a25bc202ee97f6de6c76a3dc80f91d96616be05502d72c1\",\n \"7zip-linux-arm64.tar.gz\": \"5aff5034206b78f8261249ceb922b5c7e04c9bdb733784d8f5b6df9732cf1f79\",\n \"7zip-win-arm64.tar.gz\": \"ac3f38f96ce7498096a123bb0862dd6db863a7353c9e9e1c15f73c183adf6620\",\n \"7zip-win-ia32.tar.gz\": \"ac3f38f96ce7498096a123bb0862dd6db863a7353c9e9e1c15f73c183adf6620\",\n \"7zip-win-x64.tar.gz\": \"be071f15bd6da2f78fe81c6ddef2009b0c4d8a51f36b780cb806c7e6df95e1b3\",\n \"7zip-linux-x64.tar.gz\": \"d151bb44b2a9d9bfc52813ce4cac042916394a0ab8a56bd5d221a5dc9ef8d5d7\",\n },\n // correct per-arch Windows binaries (x64, ia32, arm64)\n \"1.0.1\": {\n \"7zip-linux-ia32.tar.gz\": \"f9e4084ef21d790bfe6147f0306118b0136b0824a7113f053b712824db19988f\",\n \"7zip-darwin-arm64.tar.gz\": \"8e307a68bb75a7d1b7366a4e34cb4b442fa678d01b421d6db2314567010d2876\",\n \"7zip-darwin-x86_64.tar.gz\": \"8e307a68bb75a7d1b7366a4e34cb4b442fa678d01b421d6db2314567010d2876\",\n \"7zip-linux-arm64.tar.gz\": \"9ac9acd3f8fe1d9175dd279e715e36e188373581db320d9e520f2aaafa360ce5\",\n \"7zip-win-arm64.tar.gz\": \"1b6273d377d5ef7e2a9bb7f9b64b5cb7678ba7d0e503aa5c93305012ffa299d2\",\n \"7zip-win-ia32.tar.gz\": \"2beef271bd1b3eb42021acfb24f47d268d03139e794f41628b89e728fa58bed6\",\n \"7zip-win-x64.tar.gz\": \"db50b64348d9560b875a00bd7e02f02b5f7f4b54ff5efa5908c38858c89c9f33\",\n \"7zip-linux-x64.tar.gz\": \"c6c2d744f5e71f100e7631786bca78b6f1738734454e8dd4bf6078d4895765f7\",\n },\n} as const\n\nexport type SevenZipVersion = keyof typeof sevenZipChecksums\n\nfunction getFilename(): keyof (typeof sevenZipChecksums)[SevenZipVersion] {\n const { platform, arch } = process\n if (platform === \"darwin\") {\n return arch === \"arm64\" ? \"7zip-darwin-arm64.tar.gz\" : \"7zip-darwin-x86_64.tar.gz\"\n }\n if (platform === \"linux\") {\n if (arch === \"arm64\") {\n return \"7zip-linux-arm64.tar.gz\"\n }\n if (arch === \"ia32\") {\n return \"7zip-linux-ia32.tar.gz\"\n }\n return \"7zip-linux-x64.tar.gz\"\n }\n if (platform === \"win32\") {\n if (arch === \"arm64\") {\n return \"7zip-win-arm64.tar.gz\"\n }\n if (arch === \"ia32\") {\n return \"7zip-win-ia32.tar.gz\"\n }\n return \"7zip-win-x64.tar.gz\"\n }\n throw new Error(`Unsupported platform for 7zip toolset: ${platform}/${arch}`)\n}\n\nlet _customPath: string | null = null\nlet _version: SevenZipVersion = SEVEN_ZIP_LATEST\nlet _resolvedPath: Promise<string> | null = null\n\n/**\n * Override the 7za binary path with a pre-resolved absolute path.\n * Called by the packager when `toolsets.sevenZip` is a `ToolsetCustom` config.\n * Resets the resolution cache so the next `getPath7za()` call uses this path.\n */\nexport function setSevenZipPath(customPath: string): void {\n _customPath = customPath\n _resolvedPath = null\n}\n\n/**\n * Pin the 7-Zip bundle version.\n * Called by the packager when `toolsets.sevenZip` is a version string (unset / null / `\"latest\"`\n * resolve to the newest bundle). Resets the resolution cache so the next `getPath7za()` call\n * downloads the pinned version.\n */\nexport function setSevenZipVersion(version: SevenZipVersion | \"latest\" | Nullish): void {\n _version = resolveToolsetVersion(version, SEVEN_ZIP_LATEST)\n _resolvedPath = null\n}\n\n/** Returns the path to the 7za executable, downloading it on first call. Resets on failure so callers can retry. */\nexport function getPath7za(): Promise<string> {\n if (_resolvedPath == null) {\n _resolvedPath = resolve().catch(err => {\n _resolvedPath = null\n throw err\n })\n }\n return _resolvedPath\n}\n\nasync function resolve(): Promise<string> {\n if (_customPath != null) {\n if (process.platform !== \"win32\") {\n await chmod(_customPath, 0o755)\n }\n return _customPath\n }\n\n const filename = getFilename()\n const toolDir = await downloadBuilderToolset({\n releaseName: `7zip@${_version}`,\n filenameWithExt: filename,\n checksums: sevenZipChecksums[_version],\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n\n const bin = path.join(toolDir, \"bin\", process.platform === \"win32\" ? \"7za.exe\" : \"7za\")\n if (process.platform !== \"win32\") {\n await chmod(bin, 0o755)\n }\n return bin\n}\n"]}
|
|
@@ -4,12 +4,12 @@ export declare const appimageChecksums: {
|
|
|
4
4
|
readonly "0.0.0": {
|
|
5
5
|
readonly "appimage-12.0.1.7z": "d12ff7eb8f1d1ec4652ca5237a7fbdca33acc0c758045636feca62dc6ecb8ec4";
|
|
6
6
|
};
|
|
7
|
-
readonly "1.0.2": {
|
|
8
|
-
readonly "appimage-tools-runtime-20251108.tar.gz": "a784a8c26331ec2e945c23d6bdb14af5c9df27f5939825d84b8709c61dc81eb0";
|
|
9
|
-
};
|
|
10
7
|
readonly "1.0.3": {
|
|
11
8
|
readonly "appimage-tools-runtime-20251108.tar.gz": "84021a78ee214ae6fd33a2d62a92ba25542dd10bc86bf117a9b2d0bba44e7665";
|
|
12
9
|
};
|
|
10
|
+
readonly "1.1.0": {
|
|
11
|
+
readonly "appimage-tools-runtime-20251108.tar.gz": "098182ab8d3bb93db8a23691671f665ff92316249ace850aec63b9d010ec7fe0";
|
|
12
|
+
};
|
|
13
13
|
};
|
|
14
14
|
export declare function getAppImageTools(toolset: ToolsetConfig["appimage"], targetArch: Arch, resourcesDir: string): Promise<{
|
|
15
15
|
mksquashfs: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appimage.d.ts","sourceRoot":"","sources":["../../src/toolsets/appimage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"appimage.d.ts","sourceRoot":"","sources":["../../src/toolsets/appimage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA6B,MAAM,cAAc,CAAA;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAQnD,eAAO,MAAM,iBAAiB;;;;;;;;;;CAUpB,CAAA;AAEV,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM;;;;;GAwDhH"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { Arch } from "builder-util";
|
|
1
|
+
import { Arch, 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";
|
|
6
|
+
// Newest AppImage bundle — selected when the config is unset / null / "latest".
|
|
7
|
+
const APPIMAGE_LATEST = "1.1.0";
|
|
5
8
|
export const appimageChecksums = {
|
|
6
9
|
"0.0.0": {
|
|
7
10
|
"appimage-12.0.1.7z": "d12ff7eb8f1d1ec4652ca5237a7fbdca33acc0c758045636feca62dc6ecb8ec4",
|
|
8
11
|
},
|
|
9
|
-
"1.0.2": {
|
|
10
|
-
"appimage-tools-runtime-20251108.tar.gz": "a784a8c26331ec2e945c23d6bdb14af5c9df27f5939825d84b8709c61dc81eb0",
|
|
11
|
-
},
|
|
12
12
|
"1.0.3": {
|
|
13
13
|
"appimage-tools-runtime-20251108.tar.gz": "84021a78ee214ae6fd33a2d62a92ba25542dd10bc86bf117a9b2d0bba44e7665",
|
|
14
14
|
},
|
|
15
|
+
"1.1.0": {
|
|
16
|
+
"appimage-tools-runtime-20251108.tar.gz": "098182ab8d3bb93db8a23691671f665ff92316249ace850aec63b9d010ec7fe0",
|
|
17
|
+
},
|
|
15
18
|
};
|
|
16
19
|
export async function getAppImageTools(toolset, targetArch, resourcesDir) {
|
|
17
20
|
const runtimeArch = targetArch === Arch.armv7l ? "arm32" : targetArch === Arch.arm64 ? "arm64" : targetArch === Arch.ia32 ? "ia32" : "x64";
|
|
@@ -38,30 +41,30 @@ export async function getAppImageTools(toolset, targetArch, resourcesDir) {
|
|
|
38
41
|
runtimeLibraries: path.resolve(artifactPath, "lib", libArch),
|
|
39
42
|
};
|
|
40
43
|
};
|
|
41
|
-
// null → modern default "1.0.3"
|
|
42
|
-
const isFuse2 = (toolset ?? "1.0.3") === "0.0.0";
|
|
43
|
-
if (isFuse2) {
|
|
44
|
-
const filenameWithExt = "appimage-12.0.1.7z";
|
|
45
|
-
const artifactPath = await downloadBuilderToolset({
|
|
46
|
-
releaseName: "appimage-12.0.1",
|
|
47
|
-
filenameWithExt,
|
|
48
|
-
checksums: { [filenameWithExt]: appimageChecksums["0.0.0"][filenameWithExt] },
|
|
49
|
-
githubOrgRepo: "electron-userland/electron-builder-binaries",
|
|
50
|
-
});
|
|
51
|
-
return getFuse2Paths(artifactPath);
|
|
52
|
-
}
|
|
53
44
|
if (typeof toolset === "object" && toolset != null) {
|
|
54
45
|
const vendorPath = await getCustomToolsetPath(toolset, resourcesDir);
|
|
55
46
|
return getPaths(vendorPath);
|
|
56
47
|
}
|
|
57
|
-
|
|
58
|
-
const
|
|
48
|
+
// Unset / null / "latest" → newest; an explicit pin selects exactly that release.
|
|
49
|
+
const version = resolveToolsetVersion(toolset, APPIMAGE_LATEST);
|
|
50
|
+
// The `toolsets.appimage` type and scheme.json only admit known versions, but a programmatic config
|
|
51
|
+
// bypasses both. Never forward an unknown version: without a checksum entry the downloader would run
|
|
52
|
+
// with integrity verification disabled.
|
|
53
|
+
if (!Object.prototype.hasOwnProperty.call(appimageChecksums, version)) {
|
|
54
|
+
throw new InvalidConfigurationError(`Unknown toolsets.appimage version "${version}". Known versions: ${Object.keys(appimageChecksums).join(", ")} (or "latest"). ` +
|
|
55
|
+
`To use a custom bundle, set toolsets.appimage to a ToolsetCustom object (url + checksum) instead.`);
|
|
56
|
+
}
|
|
57
|
+
const checksums = appimageChecksums[version];
|
|
58
|
+
// Each release ships a single archive: its checksum entry's key.
|
|
59
|
+
const filenameWithExt = Object.keys(checksums)[0];
|
|
60
|
+
// Only the explicit legacy pin selects the FUSE2 runtime, published under the pre-v27 release name.
|
|
61
|
+
const isFuse2 = version === "0.0.0";
|
|
59
62
|
const artifactPath = await downloadBuilderToolset({
|
|
60
|
-
releaseName: `appimage@${
|
|
63
|
+
releaseName: isFuse2 ? "appimage-12.0.1" : `appimage@${version}`,
|
|
61
64
|
filenameWithExt,
|
|
62
|
-
checksums
|
|
65
|
+
checksums,
|
|
63
66
|
githubOrgRepo: "electron-userland/electron-builder-binaries",
|
|
64
67
|
});
|
|
65
|
-
return getPaths(artifactPath);
|
|
68
|
+
return isFuse2 ? getFuse2Paths(artifactPath) : getPaths(artifactPath);
|
|
66
69
|
}
|
|
67
70
|
//# sourceMappingURL=appimage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appimage.js","sourceRoot":"","sources":["../../src/toolsets/appimage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"appimage.js","sourceRoot":"","sources":["../../src/toolsets/appimage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AAC9D,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,gFAAgF;AAChF,MAAM,eAAe,GAAG,OAAO,CAAA;AAE/B,MAAM,CAAC,MAAM,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,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAkC,EAAE,UAAgB,EAAE,YAAoB;IAC/G,MAAM,WAAW,GAAG,UAAU,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC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AC,CAAC,iBAAiB,CAAC,CAAC,CAAC,YAAY,OAAO,EAAE;QAChE,eAAe;QACf,SAAS;QACT,aAAa,EAAE,6CAA6C;KAC7D,CAAC,CAAA;IACF,OAAO,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;AACvE,CAAC","sourcesContent":["import { Arch, 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 AppImage bundle — selected when the config is unset / null / \"latest\".\nconst APPIMAGE_LATEST = \"1.1.0\"\n\nexport const appimageChecksums = {\n \"0.0.0\": {\n \"appimage-12.0.1.7z\": \"d12ff7eb8f1d1ec4652ca5237a7fbdca33acc0c758045636feca62dc6ecb8ec4\",\n },\n \"1.0.3\": {\n \"appimage-tools-runtime-20251108.tar.gz\": \"84021a78ee214ae6fd33a2d62a92ba25542dd10bc86bf117a9b2d0bba44e7665\",\n },\n \"1.1.0\": {\n \"appimage-tools-runtime-20251108.tar.gz\": \"098182ab8d3bb93db8a23691671f665ff92316249ace850aec63b9d010ec7fe0\",\n },\n} as const\n\nexport async function getAppImageTools(toolset: ToolsetConfig[\"appimage\"], targetArch: Arch, resourcesDir: string) {\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 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 if (typeof toolset === \"object\" && toolset != null) {\n const vendorPath = await getCustomToolsetPath(toolset, resourcesDir)\n return getPaths(vendorPath)\n }\n\n // Unset / null / \"latest\" → newest; an explicit pin selects exactly that release.\n const version = resolveToolsetVersion(toolset, APPIMAGE_LATEST)\n // The `toolsets.appimage` type and scheme.json only admit known versions, but a programmatic config\n // bypasses both. Never forward an unknown version: without a checksum entry the downloader would run\n // with integrity verification disabled.\n if (!Object.prototype.hasOwnProperty.call(appimageChecksums, version)) {\n throw new InvalidConfigurationError(\n `Unknown toolsets.appimage version \"${version}\". Known versions: ${Object.keys(appimageChecksums).join(\", \")} (or \"latest\"). ` +\n `To use a custom bundle, set toolsets.appimage to a ToolsetCustom object (url + checksum) instead.`\n )\n }\n const checksums: Record<string, string> = appimageChecksums[version]\n // Each release ships a single archive: its checksum entry's key.\n const filenameWithExt = Object.keys(checksums)[0]\n // Only the explicit legacy pin selects the FUSE2 runtime, published under the pre-v27 release name.\n const isFuse2 = version === \"0.0.0\"\n const artifactPath = await downloadBuilderToolset({\n releaseName: isFuse2 ? \"appimage-12.0.1\" : `appimage@${version}`,\n filenameWithExt,\n checksums,\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n return isFuse2 ? getFuse2Paths(artifactPath) : getPaths(artifactPath)\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ToolsetCustom } from "../configuration.js";
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function extractArchive(file: string, dir: string): Promise<void>;
|
|
2
|
+
export declare function clearCustomToolsetCache(): void;
|
|
3
|
+
export declare function getCustomToolsetPath(custom: ToolsetCustom, resourcesDir?: string): Promise<string>;
|
|
5
4
|
//# sourceMappingURL=custom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/toolsets/custom.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/toolsets/custom.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAwCnD,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQlG"}
|
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,EAAE,MAAM,IAAI,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,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,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,MAAM,CAAC;QACP,4DAA4D;IAC9D,CAAC;IACD,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,MAAM,CAAC,GAAG,GA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;QAC3H,yHAAyH;QACzH,kDAAkD;QAClD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,kBAAkB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAA;QAC3E,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,yBAAyB,CACjC,GAAG,uBAAuB,CAAC,6BAA6B,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG;gBACzF,yIAAyI,iBAAiB,EAAE,CAC/J,CAAA;QACH,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,6BAA6B,CAAC,KAAK,CAAA;QAC1D,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAA;QAC/D,MAAM,KAAK,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QAElD,+FAA+F;QAC/F,uGAAuG;QACvG,yFAAyF;QACzF,MAAM,aAAa,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,EAAE,gBAAgB,CAAC,CAAA;QACjG,IAAI,MAAM,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;YAChC,MAAM,EAAE,CAAC,aAAa,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QAC9C,CAAC;QACD,MAAM,cAAc,CAAC,WAAW,EAAE,aAAa,CAAC,CAAA;QAChD,OAAO,aAAa,CAAA;IACtB,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;AAC7D,CAAC","sourcesContent":["import { exists, InvalidConfigurationError, sanitizeDirPath, validateSecuredUrl } from \"builder-util\"\nimport { mkdir, rm, stat } 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"}
|