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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appFileCopier.js","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAmB,eAAe,EAAQ,GAAG,EAAE,i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F,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,YAAY,CAAC,CAAA;IAC/C,CAAC;IAED,OAAO,IAAI,CAAC,WAAW,CAAA;AACzB,CAAC","sourcesContent":["import { AsyncTaskManager, FileCopier, FileTransformer, isEmptyOrSpaces, Link, log, MAX_FILE_REQUESTS, statOrNull, walk } from \"builder-util\"\nimport { Stats } from \"fs\"\nimport fsExtra from \"fs-extra\"\nimport { mkdir, readlink } from \"fs/promises\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { isLibOrExe } from \"../asar/unpackDetector.js\"\nimport { Platform } from \"../core.js\"\nimport { excludedExts, FileMatcher } from \"../fileMatcher.js\"\nimport { getCollectorByPackageManager, PM } from \"../node-module-collector/index.js\"\nimport { LogMessageByKey, logMessageLevelByKey, ModuleManager } from \"../node-module-collector/moduleManager.js\"\nimport { Packager } from \"../packager.js\"\nimport { PlatformPackager } from \"../platformPackager.js\"\nimport { AppFileWalker } from \"./AppFileWalker.js\"\nimport { NodeModuleCopyHelper } from \"./NodeModuleCopyHelper.js\"\nimport { NodeModuleInfo } from \"../node-module-collector/types.js\"\n\nexport function getDestinationPath(file: string, fileSet: ResolvedFileSet) {\n if (file === fileSet.src) {\n return fileSet.destination\n }\n\n const src = fileSet.src\n const dest = fileSet.destination\n // get node_modules path relative to src and then append to dest\n if (file.startsWith(src)) {\n return path.join(dest, path.relative(src, file))\n }\n return dest\n}\n\nexport async function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager, transformer: FileTransformer) {\n const metadata = fileSet.metadata\n // search auto unpacked dir\n const taskManager = new AsyncTaskManager(packager.cancellationToken)\n const createdParentDirs = new Set<string>()\n\n const fileCopier = new FileCopier(file => {\n return !isLibOrExe(file)\n }, transformer)\n const links: Array<Link> = []\n for (let i = 0, n = fileSet.files.length; i < n; i++) {\n const sourceFile = fileSet.files[i]\n const stat = metadata.get(sourceFile)\n if (stat == null) {\n // dir\n continue\n }\n\n const destinationFile = getDestinationPath(sourceFile, fileSet)\n if (stat.isSymbolicLink()) {\n links.push({ file: destinationFile, link: await readlink(sourceFile) })\n continue\n }\n\n const fileParent = path.dirname(destinationFile)\n if (!createdParentDirs.has(fileParent)) {\n createdParentDirs.add(fileParent)\n await mkdir(fileParent, { recursive: true })\n }\n\n taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat))\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n }\n\n if (taskManager.tasks.length > 0) {\n await taskManager.awaitTasks()\n }\n\n await asyncPool(MAX_FILE_REQUESTS, links, it => fsExtra.ensureSymlink(it.link, it.file))\n}\n\n// os path separator is used\nexport interface ResolvedFileSet {\n src: string\n destination: string\n\n files: Array<string>\n metadata: Map<string, Stats>\n transformedFiles?: Map<number, string | Buffer> | null\n}\n\n// used only for ASAR, if no asar, file transformed on the fly\nexport async function transformFiles(transformer: FileTransformer, fileSet: ResolvedFileSet): Promise<void> {\n if (transformer == null) {\n return\n }\n\n let transformedFiles = fileSet.transformedFiles\n if (fileSet.transformedFiles == null) {\n transformedFiles = new Map()\n fileSet.transformedFiles = transformedFiles\n }\n\n const metadata = fileSet.metadata\n const filesPromise = fileSet.files.map(async (it, index) => {\n const fileStat = metadata.get(it)\n if (fileStat == null || !fileStat.isFile()) {\n return\n }\n\n const transformedValue = transformer(it)\n if (transformedValue == null) {\n return\n }\n\n if (typeof transformedValue === \"object\" && \"then\" in transformedValue) {\n return (transformedValue as Promise<any>).then(it => {\n if (it != null) {\n transformedFiles!.set(index, it)\n }\n return\n })\n }\n transformedFiles!.set(index, transformedValue as string | Buffer)\n return\n })\n // `asyncPool` doesn't provide `index` in it's handler, so we `map` first before using it\n await asyncPool(MAX_FILE_REQUESTS, filesPromise, promise => promise)\n}\n\nexport async function computeFileSets(matchers: Array<FileMatcher>, transformer: FileTransformer | null, platformPackager: PlatformPackager<any>): Promise<Array<ResolvedFileSet>> {\n const fileSets: Array<ResolvedFileSet> = []\n\n for (const matcher of matchers) {\n const fileWalker = new AppFileWalker(matcher, platformPackager)\n\n const fromStat = await statOrNull(matcher.from)\n if (fromStat == null) {\n log.debug({ directory: matcher.from, reason: \"doesn't exist\" }, `skipped copying`)\n continue\n }\n\n const files = await walk(matcher.from, fileWalker.filter, fileWalker)\n const metadata = fileWalker.metadata\n fileSets.push(validateFileSet({ src: matcher.from, files, metadata, destination: matcher.to }))\n }\n\n return fileSets\n}\n\nfunction getNodeModuleExcludedExts(platformPackager: PlatformPackager<any>) {\n // do not exclude *.h files (https://github.com/electron-userland/electron-builder/issues/2852)\n const result = [\".o\", \".obj\"].concat(excludedExts.split(\",\").map(it => `.${it}`))\n if (platformPackager.config.includePdb !== true) {\n result.push(\".pdb\")\n }\n if (platformPackager.platform !== Platform.WINDOWS) {\n // https://github.com/electron-userland/electron-builder/issues/1738\n result.push(\".dll\")\n result.push(\".exe\")\n }\n return result\n}\n\nfunction validateFileSet(fileSet: ResolvedFileSet): ResolvedFileSet {\n if (fileSet.src == null || fileSet.src.length === 0) {\n throw new Error(\"fileset src is empty\")\n }\n return fileSet\n}\n\n/** @internal */\nexport async function computeNodeModuleFileSets(platformPackager: PlatformPackager<any>, mainMatcher: FileMatcher): Promise<Array<ResolvedFileSet>> {\n const deps = await collectNodeModulesWithLogging(platformPackager)\n\n const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager)\n // serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure\n const result = new Array<ResolvedFileSet>()\n let index = 0\n const NODE_MODULES = \"node_modules\"\n\n const collectNodeModules = async (dep: NodeModuleInfo, destination: string) => {\n const source = dep.dir\n const matcher = new FileMatcher(source, destination, mainMatcher.macroExpander, mainMatcher.patterns)\n const copier = new NodeModuleCopyHelper(matcher, platformPackager)\n const files = await copier.collectNodeModules(dep, nodeModuleExcludedExts, path.relative(mainMatcher.to, destination))\n result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata })\n\n log.debug({ dep: dep.name, from: log.filePath(source), to: log.filePath(destination), filesCount: files.length }, \"identified module\")\n\n if (dep.dependencies) {\n for (const c of dep.dependencies) {\n await collectNodeModules(c, path.join(destination, NODE_MODULES, c.name))\n }\n }\n }\n\n for (const dep of deps) {\n const destination = path.join(mainMatcher.to, NODE_MODULES, dep.name)\n await collectNodeModules(dep, destination)\n }\n return result\n}\n\nasync function collectNodeModulesWithLogging(platformPackager: PlatformPackager<any>) {\n const { tempDirManager, appDir, projectDir } = platformPackager\n\n let deps: { nodeModules: NodeModuleInfo[]; logSummary: ModuleManager[\"logSummary\"] } | undefined = undefined\n\n const searchDirectories = Array.from(new Set([appDir, projectDir, await platformPackager.getWorkspaceRoot()])).filter((it): it is string => isEmptyOrSpaces(it) === false)\n const pmApproaches = [await platformPackager.getPackageManager(), PM.TRAVERSAL]\n for (const pm of pmApproaches) {\n for (const dir of searchDirectories) {\n log.info({ pm, searchDir: dir }, \"searching for node modules\")\n const collector = getCollectorByPackageManager(pm, dir, tempDirManager)\n deps = await collector.getNodeModules({ packageName: platformPackager.nodePackageName })\n if (deps.nodeModules.length > 0) {\n break\n }\n const attempt = searchDirectories.indexOf(dir)\n if (attempt < searchDirectories.length - 1) {\n log.info({ searchDir: dir, attempt }, \"no node modules found in collection, trying next search directory\")\n }\n }\n if (deps?.nodeModules?.length) {\n log.debug({ pm, nodeModules: deps.nodeModules }, \"collected node modules\")\n break\n }\n }\n if (!deps?.nodeModules?.length) {\n log.warn({ searchDirectories: searchDirectories.map(it => log.filePath(it)) }, \"no node modules returned while searching directories\")\n return []\n }\n\n const summary = Object.entries(deps.logSummary ?? {}).filter(([, dependencies]) => Array.isArray(dependencies) && dependencies.length > 0)\n for (const [errorMessage, dependencies] of summary) {\n const logLevel = logMessageLevelByKey[errorMessage as LogMessageByKey] || \"debug\"\n log[logLevel]({ dependencies }, errorMessage)\n }\n\n return deps.nodeModules\n}\n"]}
|
|
1
|
+
{"version":3,"file":"appFileCopier.js","sourceRoot":"","sources":["../../src/util/appFileC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W,CAAC,CAAA;IAErD,OAAO,IAAI,CAAC,WAAW,CAAA;AACzB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,4BAA4B,GAA2B;IAC3D,mBAAmB,EAAE,4DAA4D;IACjF,kBAAkB,EAAE,0EAA0E;IAC9F,kBAAkB,EAAE,sFAAsF;CAC3G,CAAA;AAED,SAAS,mCAAmC,CAAC,WAAwD;IACnG,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,IAAI,IAAI,4BAA4B,CAAC,CAAA;IACjG,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,OAAO,EAAE,CAAC;QAC/B,GAAG,CAAC,IAAI,CACN,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,IAAI,mEAAmE,EAAE,EAC/G,GAAG,IAAI,qEAAqE,4BAA4B,CAAC,IAAI,CAAC,KAAK;YACjH,4GAA4G;YAC5G,4IAA4I,CAC/I,CAAA;IACH,CAAC;AACH,CAAC","sourcesContent":["import { Arch, AsyncTaskManager, FileCopier, FileTransformer, InvalidConfigurationError, isEmptyOrSpaces, Link, log, MAX_FILE_REQUESTS, statOrNull, walk } from \"builder-util\"\nimport { DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES } from \"../configuration.js\"\nimport { Stats } from \"fs\"\nimport fsExtra from \"fs-extra\"\nimport { mkdir, readlink } from \"fs/promises\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { isLibOrExe } from \"../asar/unpackDetector.js\"\nimport { Platform } from \"../core.js\"\nimport { DEFAULT_EXCLUDED_EXTENSIONS, FileMatcher } from \"../fileMatcher.js\"\nimport { getCollectorByPackageManager, PM } from \"../node-module-collector/index.js\"\nimport { LogMessageByKey, logMessageLevelByKey, ModuleManager } from \"../node-module-collector/moduleManager.js\"\nimport { Packager } from \"../packager.js\"\nimport { PlatformPackager } from \"../platformPackager.js\"\nimport { AppFileWalker } from \"./AppFileWalker.js\"\nimport { NodeModuleCopyHelper } from \"./NodeModuleCopyHelper.js\"\nimport { NodeModuleInfo } from \"../node-module-collector/types.js\"\nimport { archToNodeCpu } from \"./archCompatibility.js\"\n\nexport function getDestinationPath(file: string, fileSet: ResolvedFileSet) {\n if (file === fileSet.src) {\n return fileSet.destination\n }\n\n const src = fileSet.src\n const dest = fileSet.destination\n // get node_modules path relative to src and then append to dest\n if (file.startsWith(src)) {\n return path.join(dest, path.relative(src, file))\n }\n return dest\n}\n\nexport async function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager, transformer: FileTransformer) {\n const metadata = fileSet.metadata\n // search auto unpacked dir\n const taskManager = new AsyncTaskManager(packager.cancellationToken)\n const createdParentDirs = new Set<string>()\n\n const fileCopier = new FileCopier(file => {\n return !isLibOrExe(file)\n }, transformer)\n const links: Array<Link> = []\n for (let i = 0, n = fileSet.files.length; i < n; i++) {\n const sourceFile = fileSet.files[i]\n const stat = metadata.get(sourceFile)\n if (stat == null) {\n // dir\n continue\n }\n\n const destinationFile = getDestinationPath(sourceFile, fileSet)\n if (stat.isSymbolicLink()) {\n links.push({ file: destinationFile, link: await readlink(sourceFile) })\n continue\n }\n\n const fileParent = path.dirname(destinationFile)\n if (!createdParentDirs.has(fileParent)) {\n createdParentDirs.add(fileParent)\n await mkdir(fileParent, { recursive: true })\n }\n\n taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat))\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n }\n\n if (taskManager.tasks.length > 0) {\n await taskManager.awaitTasks()\n }\n\n await asyncPool(MAX_FILE_REQUESTS, links, it => fsExtra.ensureSymlink(it.link, it.file))\n}\n\n// os path separator is used\nexport interface ResolvedFileSet {\n src: string\n destination: string\n\n files: Array<string>\n metadata: Map<string, Stats>\n transformedFiles?: Map<number, string | Buffer> | null\n}\n\n// used only for ASAR, if no asar, file transformed on the fly\nexport async function transformFiles(transformer: FileTransformer, fileSet: ResolvedFileSet): Promise<void> {\n if (transformer == null) {\n return\n }\n\n let transformedFiles = fileSet.transformedFiles\n if (fileSet.transformedFiles == null) {\n transformedFiles = new Map()\n fileSet.transformedFiles = transformedFiles\n }\n\n const metadata = fileSet.metadata\n const filesPromise = fileSet.files.map(async (it, index) => {\n const fileStat = metadata.get(it)\n if (fileStat == null || !fileStat.isFile()) {\n return\n }\n\n const transformedValue = transformer(it)\n if (transformedValue == null) {\n return\n }\n\n if (typeof transformedValue === \"object\" && \"then\" in transformedValue) {\n return (transformedValue as Promise<any>).then(it => {\n if (it != null) {\n transformedFiles!.set(index, it)\n }\n return\n })\n }\n transformedFiles!.set(index, transformedValue as string | Buffer)\n return\n })\n // `asyncPool` doesn't provide `index` in it's handler, so we `map` first before using it\n await asyncPool(MAX_FILE_REQUESTS, filesPromise, promise => promise)\n}\n\nexport async function computeFileSets(matchers: Array<FileMatcher>, transformer: FileTransformer | null, platformPackager: PlatformPackager<any>): Promise<Array<ResolvedFileSet>> {\n const fileSets: Array<ResolvedFileSet> = []\n\n for (const matcher of matchers) {\n const fileWalker = new AppFileWalker(matcher, platformPackager)\n\n const fromStat = await statOrNull(matcher.from)\n if (fromStat == null) {\n log.debug({ directory: matcher.from, reason: \"doesn't exist\" }, `skipped copying`)\n continue\n }\n\n const files = await walk(matcher.from, fileWalker.filter, fileWalker)\n const metadata = fileWalker.metadata\n fileSets.push(validateFileSet({ src: matcher.from, files, metadata, destination: matcher.to }))\n }\n\n return fileSets\n}\n\nfunction getNodeModuleExcludedExts(platformPackager: PlatformPackager<any>) {\n // do not exclude *.h files (https://github.com/electron-userland/electron-builder/issues/2852)\n const result = DEFAULT_EXCLUDED_EXTENSIONS.map(it => `.${it}`)\n if (platformPackager.config.includePdb !== true) {\n result.push(\".pdb\")\n }\n if (platformPackager.platform !== Platform.WINDOWS) {\n // https://github.com/electron-userland/electron-builder/issues/1738\n result.push(\".dll\")\n result.push(\".exe\")\n }\n return result\n}\n\nfunction validateFileSet(fileSet: ResolvedFileSet): ResolvedFileSet {\n if (fileSet.src == null || fileSet.src.length === 0) {\n throw new Error(\"fileset src is empty\")\n }\n return fileSet\n}\n\n/** @internal */\nexport async function computeNodeModuleFileSets(\n platformPackager: PlatformPackager<any>,\n mainMatcher: FileMatcher,\n arch: Arch,\n applyArchFilter = true\n): Promise<Array<ResolvedFileSet>> {\n const deps = await collectNodeModulesWithLogging(platformPackager, applyArchFilter ? arch : null)\n\n const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager)\n // serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure\n const result = new Array<ResolvedFileSet>()\n let index = 0\n const NODE_MODULES = \"node_modules\"\n\n const collectNodeModules = async (dep: NodeModuleInfo, destination: string) => {\n // Ignore excluded dependencies.\n if (dep.excluded) {\n return\n }\n\n const source = dep.dir\n const matcher = new FileMatcher(source, destination, mainMatcher.macroExpander, mainMatcher.patterns)\n const copier = new NodeModuleCopyHelper(matcher, platformPackager)\n const files = await copier.collectNodeModules(dep, nodeModuleExcludedExts, path.relative(mainMatcher.to, destination))\n result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata })\n\n log.debug({ dep: dep.name, from: log.filePath(source), to: log.filePath(destination), filesCount: files.length }, \"identified module\")\n\n if (dep.dependencies) {\n for (const c of dep.dependencies) {\n await collectNodeModules(c, path.join(destination, NODE_MODULES, c.name))\n }\n }\n }\n\n for (const dep of deps) {\n const destination = path.join(mainMatcher.to, NODE_MODULES, dep.name)\n await collectNodeModules(dep, destination)\n }\n return result\n}\n\ntype CollectedNodeModules = { nodeModules: NodeModuleInfo[]; logSummary: ModuleManager[\"logSummary\"] }\n\n/** Runs a single package-manager collector against a single directory. */\ntype CollectorRunner = (pm: PM, dir: string) => Promise<CollectedNodeModules>\n\n// `workspace:`/`file:`/`link:`/`portal:` dependencies are symlinked into place rather than\n// installed as standalone, hoistable packages, so they may legitimately be absent from a\n// collected tree and cannot be used to validate it.\nconst LOCAL_DEPENDENCY_SPEC = /^(?:workspace|file|link|portal):/\n\n// Log-summary buckets in which a collector reports a declared dependency it deliberately or\n// unavoidably left out of the collected tree. A direct dependency recorded in one of these is\n// accounted for even though it is absent from the top level of an otherwise correct collection.\nconst ACCOUNTED_ABSENT_DEPENDENCY_KEYS: ReadonlyArray<LogMessageByKey> = [\n // dropped by the target arch/platform filter (`archFilter`, package.json `cpu`/`os`)\n LogMessageByKey.PKG_INCOMPATIBLE_PLATFORM,\n // not installed / not resolvable on disk — whether that is fatal is decided afterwards by\n // `allowMissingDependencies` (see enforceAllowMissingDependencies), not by collection matching\n LogMessageByKey.PKG_NOT_FOUND,\n LogMessageByKey.PKG_NOT_ON_DISK,\n LogMessageByKey.PKG_OPTIONAL_NOT_INSTALLED,\n LogMessageByKey.PKG_OPTIONAL_PLATFORM_NOT_INSTALLED,\n // excluded via `ignoredProductionDependencies` (such modules normally stay in the tree flagged\n // `excluded`, so this only matters if a collector ever drops them instead)\n LogMessageByKey.PKG_EXCLUDED_IGNORED,\n // a dependency that resolves to the package itself is skipped rather than collected\n LogMessageByKey.PKG_SELF_REF,\n]\n\n/**\n * Determines whether a collected module tree actually describes the package being built.\n *\n * A package-manager `list` invocation can resolve to the wrong project root — most notably when\n * electron-builder is run from a workspace sub-package whose dependencies are hoisted to the\n * workspace root (#9945) — or a collector can resolve the root node to the wrong package (e.g. an\n * app named like one of its own dependencies, #10277). In both cases the collector returns a\n * non-empty but wrong tree. Accepting it would suppress the manual-traversal fallback that resolves\n * the correct modules, so we need to tell a matching collection from a mismatched one.\n *\n * Only the package's declared external (registry-installed, non-`workspace:`/`file:`/`link:`/`portal:`)\n * production `dependencies` are checked; they are always placed at the top level of a correct\n * collection. A collection matches when:\n * - at least one of them is present at the top level, and\n * - every one of them is either present at the top level (including modules flagged `excluded` by\n * `ignoredProductionDependencies`) or reported in the collection's own `logSummary` as\n * legitimately absent: dropped by the arch/platform filter, missing on disk (enforced later by\n * `allowMissingDependencies`), a missing optional/platform-specific package, excluded as ignored,\n * or a self-reference.\n *\n * When the package declares no external production dependencies there is nothing to validate\n * against, so any non-empty collection is accepted.\n */\nexport function collectionMatchesAppDependencies(\n nodeModules: NodeModuleInfo[],\n dependencies: Record<string, string> | undefined,\n logSummary?: ModuleManager[\"logSummary\"]\n): boolean {\n const requiredExternalDeps = Object.entries(dependencies ?? {})\n .filter(([, spec]) => !LOCAL_DEPENDENCY_SPEC.test(spec))\n .map(([name]) => name)\n if (requiredExternalDeps.length === 0) {\n return true\n }\n const collected = new Set(nodeModules.map(it => it.name))\n if (!requiredExternalDeps.some(name => collected.has(name))) {\n return false\n }\n const accountedAbsent = new Set(ACCOUNTED_ABSENT_DEPENDENCY_KEYS.flatMap(key => logSummary?.[key] ?? []).map(dependencyNameFromSummaryId))\n return requiredExternalDeps.every(name => collected.has(name) || accountedAbsent.has(name))\n}\n\n/**\n * Walks the candidate (package-manager, directory) combinations and returns the first collection\n * that both contains modules and matches the package being built (see\n * {@link collectionMatchesAppDependencies}). A non-empty collection that does NOT match — e.g. a\n * workspace-root tree returned for a sub-package — is retained only as a last-resort fallback so a\n * later approach (notably {@link PM.TRAVERSAL}) can supply the correct modules.\n *\n * An approach that throws (e.g. the package manager exited without producing its dependency tree,\n * issue #10208) is logged as a warning and skipped so the remaining approaches still run. If every\n * approach fails to produce a collection and at least one threw, the first error is rethrown rather\n * than silently reporting \"no node modules\".\n */\nexport async function resolveFirstMatchingCollection(options: {\n pmApproaches: PM[]\n searchDirectories: string[]\n dependencies: Record<string, string> | undefined\n run: CollectorRunner\n}): Promise<CollectedNodeModules | undefined> {\n const { pmApproaches, searchDirectories, dependencies, run } = options\n let fallback: CollectedNodeModules | undefined\n let firstError: Error | undefined\n\n for (const pm of pmApproaches) {\n for (const dir of searchDirectories) {\n log.info({ pm, searchDir: dir }, \"searching for node modules\")\n let deps: CollectedNodeModules\n try {\n deps = await run(pm, dir)\n } catch (error: any) {\n log.warn({ pm, searchDir: dir, error: error?.message ?? String(error) }, \"node module collection failed, trying next search directory/approach\")\n firstError ??= error instanceof Error ? error : new Error(String(error))\n continue\n }\n if (deps.nodeModules.length === 0) {\n log.info({ pm, searchDir: dir }, \"no node modules found in collection, trying next search directory\")\n continue\n }\n if (collectionMatchesAppDependencies(deps.nodeModules, dependencies, deps.logSummary)) {\n log.debug({ pm, searchDir: dir, depCount: deps.nodeModules.length }, \"collected node modules\")\n return deps\n }\n log.info({ pm, searchDir: dir }, \"collected node modules do not match the target package, trying next search directory/approach\")\n fallback ??= deps\n }\n }\n if (fallback == null && firstError != null) {\n throw firstError\n }\n return fallback\n}\n\n/** Extracts the package name from a `name@version` log-summary entry, handling `@scope/name@version`. */\nfunction dependencyNameFromSummaryId(id: string): string {\n let at: number\n if (id.startsWith(\"@\")) {\n // Scoped package: the version separator is the first `@` after the scope's `/`\n const slashIndex = id.indexOf(\"/\")\n if (slashIndex === -1) {\n return id\n }\n at = id.indexOf(\"@\", slashIndex + 1)\n } else {\n at = id.indexOf(\"@\")\n }\n return at > 0 ? id.slice(0, at) : id\n}\n\n/**\n * Enforces {@link CommonConfiguration.allowMissingDependencies} against the finished collection\n * summary (issue #10058). Runs only after collection completes, so the error reports the COMPLETE\n * set of missing production dependencies at once instead of failing on the first one.\n *\n * Fail-closed by default: `false`, `null` and omitted all fail the build when a production\n * dependency is missing; `true` restores the historical warn-only behavior. When the option is a\n * `string[]`, only the listed dependency names are allowed to be missing — matched against the\n * package name parsed from the summary's `name@version` entries (scoped names included), with an\n * exact-entry match accepted as well.\n *\n * Only genuinely missing production dependencies (`PKG_NOT_FOUND` / `PKG_NOT_ON_DISK`) are fatal;\n * missing optional dependencies (`PKG_OPTIONAL_NOT_INSTALLED` / `PKG_OPTIONAL_PLATFORM_NOT_INSTALLED`)\n * never fail the build.\n *\n * @internal exported for tests\n */\nexport function enforceAllowMissingDependencies(allowMissingDependencies: boolean | Array<string> | null | undefined, logSummary: ModuleManager[\"logSummary\"] | undefined): void {\n if (allowMissingDependencies === true) {\n return\n }\n const missing = new Set<string>([...(logSummary?.[LogMessageByKey.PKG_NOT_FOUND] ?? []), ...(logSummary?.[LogMessageByKey.PKG_NOT_ON_DISK] ?? [])])\n const allowed = new Set(Array.isArray(allowMissingDependencies) ? allowMissingDependencies : [])\n const fatal = Array.from(missing)\n .filter(id => !allowed.has(dependencyNameFromSummaryId(id)) && !allowed.has(id))\n .sort()\n if (fatal.length === 0) {\n return\n }\n throw new InvalidConfigurationError(\n `The following production dependencies could not be resolved during node-module collection:\\n` +\n fatal.map(id => ` - ${id}`).join(\"\\n\") +\n `\\nInstall the missing dependencies, list names in \\`allowMissingDependencies\\` to allow specific ones to be missing, or set \\`allowMissingDependencies\\` to true to only warn (electron-builder <= 26 behavior).`\n )\n}\n\n/** @internal */\nexport async function collectNodeModulesWithLogging(platformPackager: PlatformPackager<any>, arch: Arch | null) {\n const { tempDirManager, appDir, projectDir } = platformPackager\n\n // Drop packages whose `package.json` `cpu`/`os` is incompatible with the target arch/platform while\n // collecting (e.g. exclude `@esbuild/darwin-arm64` from the x64 slice). See NodeModulesCollector.\n // `null` arch (universal slices) disables the filter so both slices stay symmetric for the merge.\n const archFilter = arch == null ? undefined : { cpu: archToNodeCpu(arch), os: platformPackager.platform.nodeName }\n\n const searchDirectories = Array.from(new Set([appDir, projectDir, await platformPackager.getWorkspaceRoot()])).filter((it): it is string => isEmptyOrSpaces(it) === false)\n const pmApproaches = [await platformPackager.getPackageManager(), PM.TRAVERSAL]\n\n // The default-ignored packages are excluded from the copied `node_modules` — together with any\n // transitive dependency they alone require — because electron-builder already provides them another\n // way (the Electron runtime is embedded separately), so copying them would be redundant. They remain\n // valid production dependencies for tooling such as SBOM generation. See NodeModulesCollector.getNodeModules.\n const configuredIgnored = platformPackager.config.ignoredProductionDependencies\n const ignoredDependencies = configuredIgnored == null ? DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES : configuredIgnored\n\n // An app that declares no production dependencies at all (neither as-installed nor via\n // `extraMetadata`) has nothing to bundle. Without this guard the search would skip the app's\n // empty `node_modules`, climb to the workspace root, and the vacuous match in\n // `collectionMatchesAppDependencies` would accept the entire hoisted workspace tree (#10033).\n const declaredDependencies = Object.keys({ ...platformPackager.originalMetadata.dependencies, ...platformPackager.metadata.dependencies })\n if (declaredDependencies.length === 0) {\n log.info(null, \"app has no production dependencies, skipping node_modules bundling\")\n return []\n }\n\n // Validate against the as-declared (pre-extraMetadata) production dependencies so a configured\n // `extraMetadata.dependencies` entry that isn't installed cannot reject a correct collection.\n const deps = await resolveFirstMatchingCollection({\n pmApproaches,\n searchDirectories,\n dependencies: platformPackager.originalMetadata.dependencies,\n run: (pm, dir) => getCollectorByPackageManager(pm, dir, tempDirManager).getNodeModules({ packageName: platformPackager.nodePackageName, archFilter, ignoredDependencies }),\n })\n\n if (!deps?.nodeModules?.length) {\n log.warn({ searchDirectories: searchDirectories.map(it => log.filePath(it)) }, \"no node modules returned while searching directories\")\n return []\n }\n\n const summary = Object.entries(deps.logSummary ?? {}).filter(([, dependencies]) => Array.isArray(dependencies) && dependencies.length > 0)\n for (const [errorMessage, dependencies] of summary) {\n const logLevel = logMessageLevelByKey[errorMessage as LogMessageByKey] || \"debug\"\n log[logLevel]({ dependencies }, errorMessage)\n }\n\n // Fail-closed enforcement (issue #10058): collection is complete and the summary above has reached\n // the log, so failing here reports every missing production dependency at once.\n enforceAllowMissingDependencies(platformPackager.config.allowMissingDependencies, deps.logSummary)\n\n // Tripwire: the default-ignored packages are excluded because electron-builder already provides them\n // (e.g. the embedded Electron runtime), so a copy in `node_modules` is redundant. They only reach this\n // point unflagged when a user has removed them from `ignoredProductionDependencies`; record any that\n // are therefore about to be copied (present but not marked `excluded`) so the summary below warns.\n const bundledDefaultIgnored = deps.nodeModules.filter(it => !it.excluded && DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES.includes(it.name)).map(it => it.name)\n if (bundledDefaultIgnored.length > 0) {\n log.warn({ dependencies: bundledDefaultIgnored }, \"copied dependencies that shouldn't be needed, see ignoredProductionDependencies\")\n }\n\n warnAboutDeprecatedElectronPackages(deps.nodeModules)\n\n return deps.nodeModules\n}\n\n/**\n * Long-deprecated Electron packages that v26 rejected outright as production dependencies.\n *\n * v27 dropped that guard without adding them to the default ignore list, so they are now copied into\n * the app instead of failing the build — and `electron-prebuilt` drags a full second Electron binary\n * (hundreds of MB) into app.asar with nothing in the log to explain the size jump.\n */\nconst DEPRECATED_ELECTRON_PACKAGES: Record<string, string> = {\n \"electron-prebuilt\": \"renamed to `electron` in 2016 — replace it with `electron`\",\n \"electron-rebuild\": \"moved to `@electron/rebuild` — replace it and move it to devDependencies\",\n \"electron-nightly\": \"a full Electron distribution — move it to devDependencies if it is not meant to ship\",\n}\n\nfunction warnAboutDeprecatedElectronPackages(nodeModules: Array<{ name: string; excluded?: boolean }>): void {\n const bundled = nodeModules.filter(it => !it.excluded && it.name in DEPRECATED_ELECTRON_PACKAGES)\n for (const { name } of bundled) {\n log.warn(\n { dependency: name, solution: `add \"${name}\" to ignoredProductionDependencies, or move it to devDependencies` },\n `${name} is declared in dependencies and is being packaged into your app (${DEPRECATED_ELECTRON_PACKAGES[name]}). ` +\n \"electron-builder <= 26 rejected this outright; v27 removed that guard and does not exclude it by default. \" +\n \"See https://www.electron.build/docs/migration/v27-breaking-changes#electron-prebuilt-electron-rebuild-no-longer-error-and-are-not-excluded\"\n )\n }\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Arch } from "builder-util";
|
|
2
|
+
/**
|
|
3
|
+
* The `cpu`/`os` constraint fields as declared in a package's `package.json`.
|
|
4
|
+
* npm/pnpm only *install* the optional platform package matching the host, but the
|
|
5
|
+
* declared values are what we use to decide whether a package belongs in a given build.
|
|
6
|
+
*/
|
|
7
|
+
export interface PackagePlatformFields {
|
|
8
|
+
os?: string | string[] | null;
|
|
9
|
+
cpu?: string | string[] | null;
|
|
10
|
+
}
|
|
11
|
+
export declare function archToNodeCpu(arch: Arch): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Whether a package may be bundled for the given target `cpu`/`os`, per its declared
|
|
14
|
+
* `package.json` `cpu`/`os` fields. A package with no constraint (plain JS) is always compatible.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isPackageCompatible(pkg: PackagePlatformFields, targetCpu: string | null, targetOs: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether a package is inherently single-architecture — i.e. its `cpu` constraint cannot satisfy
|
|
19
|
+
* *both* slices of a macOS universal build (`x64` and `arm64`). Such packages (e.g. `@esbuild/darwin-arm64`)
|
|
20
|
+
* cannot be merged into a universal Mach-O and must be treated as single-arch by `@electron/universal`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isSingleArchPackage(pkg: PackagePlatformFields): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Recursively walks a `node_modules` directory (handling `@scope` dirs and nested `node_modules`) and
|
|
25
|
+
* collects the `name` of every package whose `package.json` `cpu` marks it as {@link isSingleArchPackage single-arch}.
|
|
26
|
+
* Missing/unreadable directories are treated as empty.
|
|
27
|
+
*/
|
|
28
|
+
export declare function collectSingleArchPackageNames(nodeModulesDir: string, names?: Set<string>): Promise<Set<string>>;
|
|
29
|
+
/**
|
|
30
|
+
* Finds single-arch Mach-O files that are byte-identical in BOTH universal slices — the exact case
|
|
31
|
+
* `@electron/universal` aborts on (`x64Sha === arm64Sha` for a non-fat Mach-O). This catches host binaries
|
|
32
|
+
* placed in packages that declare no `cpu`/`os`, e.g. esbuild's install script overwriting `esbuild/bin/esbuild`
|
|
33
|
+
* with the platform binary. Per-arch binaries (different SHA, e.g. rebuilt `.node` addons) are left for lipo.
|
|
34
|
+
* Returns paths relative to `unpackedDirA`, posix-normalized for matching by `@electron/universal`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function collectIdenticalSingleArchMachOFiles(unpackedDirA: string, unpackedDirB: string): Promise<string[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Combines the given minimatch patterns (as consumed by `@electron/universal`'s `singleArchFiles`) into a
|
|
39
|
+
* single pattern, merged with any user-provided pattern. Returns `userPattern` (possibly undefined) when empty.
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildSingleArchFilesPattern(patterns: Iterable<string>, userPattern: string | undefined): string | undefined;
|
|
42
|
+
//# sourceMappingURL=archCompatibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archCompatibility.d.ts","sourceRoot":"","sources":["../../src/util/archCompatibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAKnC;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAA;IAC7B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAA;CAC/B;AAID,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAavD;AAgCD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAUnH;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAMvE;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,GAAE,GAAG,CAAC,MAAM,CAAqB,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CA8BxI;AAuDD;;;;;;GAMG;AACH,wBAAsB,oCAAoC,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAaxH;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAO3H"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { Arch } from "builder-util";
|
|
2
|
+
import { createHash } from "crypto";
|
|
3
|
+
import { open, readdir, readFile } from "fs/promises";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
// Maps electron-builder's `Arch` to the npm `cpu` token used in `package.json` `cpu` fields.
|
|
6
|
+
// Returns `null` for arches we don't filter on (e.g. `universal`).
|
|
7
|
+
export function archToNodeCpu(arch) {
|
|
8
|
+
switch (arch) {
|
|
9
|
+
case Arch.ia32:
|
|
10
|
+
return "ia32";
|
|
11
|
+
case Arch.x64:
|
|
12
|
+
return "x64";
|
|
13
|
+
case Arch.armv7l:
|
|
14
|
+
return "arm";
|
|
15
|
+
case Arch.arm64:
|
|
16
|
+
return "arm64";
|
|
17
|
+
default:
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function toList(value) {
|
|
22
|
+
if (value == null) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const list = Array.isArray(value) ? value : [value];
|
|
26
|
+
return list.length > 0 ? list : null;
|
|
27
|
+
}
|
|
28
|
+
// Mirrors npm's `checkList` semantics (npm-install-checks): supports `"any"` and `"!"` negation.
|
|
29
|
+
// Returns true when `value` is allowed by `list`.
|
|
30
|
+
function checkList(value, list) {
|
|
31
|
+
if (list.length === 1 && list[0] === "any") {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
let blacklistCount = 0;
|
|
35
|
+
let match = false;
|
|
36
|
+
for (const entry of list) {
|
|
37
|
+
if (entry.startsWith("!")) {
|
|
38
|
+
if (entry.slice(1) === value) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
blacklistCount++;
|
|
42
|
+
}
|
|
43
|
+
else if (entry === value) {
|
|
44
|
+
match = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// allowed if it matched a positive entry, or every entry was a (non-matching) negation
|
|
48
|
+
return match || blacklistCount === list.length;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Whether a package may be bundled for the given target `cpu`/`os`, per its declared
|
|
52
|
+
* `package.json` `cpu`/`os` fields. A package with no constraint (plain JS) is always compatible.
|
|
53
|
+
*/
|
|
54
|
+
export function isPackageCompatible(pkg, targetCpu, targetOs) {
|
|
55
|
+
const os = toList(pkg.os);
|
|
56
|
+
if (os != null && !checkList(targetOs, os)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const cpu = toList(pkg.cpu);
|
|
60
|
+
if (targetCpu != null && cpu != null && !checkList(targetCpu, cpu)) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Whether a package is inherently single-architecture — i.e. its `cpu` constraint cannot satisfy
|
|
67
|
+
* *both* slices of a macOS universal build (`x64` and `arm64`). Such packages (e.g. `@esbuild/darwin-arm64`)
|
|
68
|
+
* cannot be merged into a universal Mach-O and must be treated as single-arch by `@electron/universal`.
|
|
69
|
+
*/
|
|
70
|
+
export function isSingleArchPackage(pkg) {
|
|
71
|
+
const cpu = toList(pkg.cpu);
|
|
72
|
+
if (cpu == null) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
return !(checkList("x64", cpu) && checkList("arm64", cpu));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Recursively walks a `node_modules` directory (handling `@scope` dirs and nested `node_modules`) and
|
|
79
|
+
* collects the `name` of every package whose `package.json` `cpu` marks it as {@link isSingleArchPackage single-arch}.
|
|
80
|
+
* Missing/unreadable directories are treated as empty.
|
|
81
|
+
*/
|
|
82
|
+
export async function collectSingleArchPackageNames(nodeModulesDir, names = new Set()) {
|
|
83
|
+
let entries;
|
|
84
|
+
try {
|
|
85
|
+
entries = await readdir(nodeModulesDir, { withFileTypes: true });
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return names; // directory does not exist (no unpacked node_modules) or is unreadable
|
|
89
|
+
}
|
|
90
|
+
for (const entry of entries) {
|
|
91
|
+
if (!entry.isDirectory() || entry.name === ".bin") {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (entry.name.startsWith("@")) {
|
|
95
|
+
// scope directory: its children are the actual packages
|
|
96
|
+
const scopeDir = path.join(nodeModulesDir, entry.name);
|
|
97
|
+
let scoped;
|
|
98
|
+
try {
|
|
99
|
+
scoped = await readdir(scopeDir, { withFileTypes: true });
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
for (const child of scoped) {
|
|
105
|
+
if (child.isDirectory()) {
|
|
106
|
+
await inspectPackageDir(path.join(scopeDir, child.name), names);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
await inspectPackageDir(path.join(nodeModulesDir, entry.name), names);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return names;
|
|
115
|
+
}
|
|
116
|
+
async function inspectPackageDir(packageDir, names) {
|
|
117
|
+
try {
|
|
118
|
+
const pkg = JSON.parse(await readFile(path.join(packageDir, "package.json"), "utf8"));
|
|
119
|
+
if (pkg.name && isSingleArchPackage(pkg)) {
|
|
120
|
+
names.add(pkg.name);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
// missing/invalid package.json — skip
|
|
125
|
+
}
|
|
126
|
+
await collectSingleArchPackageNames(path.join(packageDir, "node_modules"), names);
|
|
127
|
+
}
|
|
128
|
+
// Single-arch (non-fat) Mach-O magics, read big-endian from the first 4 bytes. The fat/universal magics
|
|
129
|
+
// (`0xcafebabe`/`0xbebafeca`) are intentionally excluded — those are already-merged binaries that lipo handles.
|
|
130
|
+
const SINGLE_ARCH_MACHO_MAGICS = new Set([0xfeedface, 0xfeedfacf, 0xcefaedfe, 0xcffaedfe]);
|
|
131
|
+
async function isSingleArchMachO(file) {
|
|
132
|
+
let fh;
|
|
133
|
+
try {
|
|
134
|
+
fh = await open(file, "r");
|
|
135
|
+
const buf = Buffer.alloc(4);
|
|
136
|
+
const { bytesRead } = await fh.read(buf, 0, 4, 0);
|
|
137
|
+
return bytesRead === 4 && SINGLE_ARCH_MACHO_MAGICS.has(buf.readUInt32BE(0));
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
return false; // missing/unreadable file
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
await fh?.close();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async function sha256(file) {
|
|
147
|
+
return createHash("sha256")
|
|
148
|
+
.update(await readFile(file))
|
|
149
|
+
.digest("hex");
|
|
150
|
+
}
|
|
151
|
+
async function walkFiles(dir, onFile) {
|
|
152
|
+
let entries;
|
|
153
|
+
try {
|
|
154
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
return; // directory does not exist or is unreadable
|
|
158
|
+
}
|
|
159
|
+
for (const entry of entries) {
|
|
160
|
+
const p = path.join(dir, entry.name);
|
|
161
|
+
if (entry.isDirectory()) {
|
|
162
|
+
await walkFiles(p, onFile);
|
|
163
|
+
}
|
|
164
|
+
else if (entry.isFile()) {
|
|
165
|
+
await onFile(p);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Finds single-arch Mach-O files that are byte-identical in BOTH universal slices — the exact case
|
|
171
|
+
* `@electron/universal` aborts on (`x64Sha === arm64Sha` for a non-fat Mach-O). This catches host binaries
|
|
172
|
+
* placed in packages that declare no `cpu`/`os`, e.g. esbuild's install script overwriting `esbuild/bin/esbuild`
|
|
173
|
+
* with the platform binary. Per-arch binaries (different SHA, e.g. rebuilt `.node` addons) are left for lipo.
|
|
174
|
+
* Returns paths relative to `unpackedDirA`, posix-normalized for matching by `@electron/universal`.
|
|
175
|
+
*/
|
|
176
|
+
export async function collectIdenticalSingleArchMachOFiles(unpackedDirA, unpackedDirB) {
|
|
177
|
+
const result = [];
|
|
178
|
+
await walkFiles(unpackedDirA, async (fileA) => {
|
|
179
|
+
if (!(await isSingleArchMachO(fileA))) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const rel = path.relative(unpackedDirA, fileA);
|
|
183
|
+
const fileB = path.join(unpackedDirB, rel);
|
|
184
|
+
if ((await isSingleArchMachO(fileB)) && (await sha256(fileA)) === (await sha256(fileB))) {
|
|
185
|
+
result.push(rel.split(path.sep).join("/"));
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Combines the given minimatch patterns (as consumed by `@electron/universal`'s `singleArchFiles`) into a
|
|
192
|
+
* single pattern, merged with any user-provided pattern. Returns `userPattern` (possibly undefined) when empty.
|
|
193
|
+
*/
|
|
194
|
+
export function buildSingleArchFilesPattern(patterns, userPattern) {
|
|
195
|
+
const sorted = Array.from(new Set(patterns)).sort();
|
|
196
|
+
if (sorted.length === 0) {
|
|
197
|
+
return userPattern;
|
|
198
|
+
}
|
|
199
|
+
const detected = sorted.length === 1 ? sorted[0] : `{${sorted.join(",")}}`;
|
|
200
|
+
return userPattern ? `{${userPattern},${detected}}` : detected;
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=archCompatibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archCompatibility.js","sourceRoot":"","sources":["../../src/util/archCompatibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAY5B,6FAA6F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AE,CAAC;YACxF,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QAC5C,CAAC;IACH,CAAC,CAAC,CAAA;IACF,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,QAA0B,EAAE,WAA+B;IACrG,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IACnD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,WAAW,CAAA;IACpB,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAA;IAC1E,OAAO,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAA;AAChE,CAAC","sourcesContent":["import { Arch } from \"builder-util\"\nimport { createHash } from \"crypto\"\nimport { open, readdir, readFile } from \"fs/promises\"\nimport * as path from \"path\"\n\n/**\n * The `cpu`/`os` constraint fields as declared in a package's `package.json`.\n * npm/pnpm only *install* the optional platform package matching the host, but the\n * declared values are what we use to decide whether a package belongs in a given build.\n */\nexport interface PackagePlatformFields {\n os?: string | string[] | null\n cpu?: string | string[] | null\n}\n\n// Maps electron-builder's `Arch` to the npm `cpu` token used in `package.json` `cpu` fields.\n// Returns `null` for arches we don't filter on (e.g. `universal`).\nexport function archToNodeCpu(arch: Arch): string | null {\n switch (arch) {\n case Arch.ia32:\n return \"ia32\"\n case Arch.x64:\n return \"x64\"\n case Arch.armv7l:\n return \"arm\"\n case Arch.arm64:\n return \"arm64\"\n default:\n return null\n }\n}\n\nfunction toList(value: string | string[] | null | undefined): string[] | null {\n if (value == null) {\n return null\n }\n const list = Array.isArray(value) ? value : [value]\n return list.length > 0 ? list : null\n}\n\n// Mirrors npm's `checkList` semantics (npm-install-checks): supports `\"any\"` and `\"!\"` negation.\n// Returns true when `value` is allowed by `list`.\nfunction checkList(value: string, list: string[]): boolean {\n if (list.length === 1 && list[0] === \"any\") {\n return true\n }\n let blacklistCount = 0\n let match = false\n for (const entry of list) {\n if (entry.startsWith(\"!\")) {\n if (entry.slice(1) === value) {\n return false\n }\n blacklistCount++\n } else if (entry === value) {\n match = true\n }\n }\n // allowed if it matched a positive entry, or every entry was a (non-matching) negation\n return match || blacklistCount === list.length\n}\n\n/**\n * Whether a package may be bundled for the given target `cpu`/`os`, per its declared\n * `package.json` `cpu`/`os` fields. A package with no constraint (plain JS) is always compatible.\n */\nexport function isPackageCompatible(pkg: PackagePlatformFields, targetCpu: string | null, targetOs: string): boolean {\n const os = toList(pkg.os)\n if (os != null && !checkList(targetOs, os)) {\n return false\n }\n const cpu = toList(pkg.cpu)\n if (targetCpu != null && cpu != null && !checkList(targetCpu, cpu)) {\n return false\n }\n return true\n}\n\n/**\n * Whether a package is inherently single-architecture — i.e. its `cpu` constraint cannot satisfy\n * *both* slices of a macOS universal build (`x64` and `arm64`). Such packages (e.g. `@esbuild/darwin-arm64`)\n * cannot be merged into a universal Mach-O and must be treated as single-arch by `@electron/universal`.\n */\nexport function isSingleArchPackage(pkg: PackagePlatformFields): boolean {\n const cpu = toList(pkg.cpu)\n if (cpu == null) {\n return false\n }\n return !(checkList(\"x64\", cpu) && checkList(\"arm64\", cpu))\n}\n\n/**\n * Recursively walks a `node_modules` directory (handling `@scope` dirs and nested `node_modules`) and\n * collects the `name` of every package whose `package.json` `cpu` marks it as {@link isSingleArchPackage single-arch}.\n * Missing/unreadable directories are treated as empty.\n */\nexport async function collectSingleArchPackageNames(nodeModulesDir: string, names: Set<string> = new Set<string>()): Promise<Set<string>> {\n let entries\n try {\n entries = await readdir(nodeModulesDir, { withFileTypes: true })\n } catch {\n return names // directory does not exist (no unpacked node_modules) or is unreadable\n }\n for (const entry of entries) {\n if (!entry.isDirectory() || entry.name === \".bin\") {\n continue\n }\n if (entry.name.startsWith(\"@\")) {\n // scope directory: its children are the actual packages\n const scopeDir = path.join(nodeModulesDir, entry.name)\n let scoped\n try {\n scoped = await readdir(scopeDir, { withFileTypes: true })\n } catch {\n continue\n }\n for (const child of scoped) {\n if (child.isDirectory()) {\n await inspectPackageDir(path.join(scopeDir, child.name), names)\n }\n }\n } else {\n await inspectPackageDir(path.join(nodeModulesDir, entry.name), names)\n }\n }\n return names\n}\n\nasync function inspectPackageDir(packageDir: string, names: Set<string>): Promise<void> {\n try {\n const pkg: PackagePlatformFields & { name?: string } = JSON.parse(await readFile(path.join(packageDir, \"package.json\"), \"utf8\"))\n if (pkg.name && isSingleArchPackage(pkg)) {\n names.add(pkg.name)\n }\n } catch {\n // missing/invalid package.json — skip\n }\n await collectSingleArchPackageNames(path.join(packageDir, \"node_modules\"), names)\n}\n\n// Single-arch (non-fat) Mach-O magics, read big-endian from the first 4 bytes. The fat/universal magics\n// (`0xcafebabe`/`0xbebafeca`) are intentionally excluded — those are already-merged binaries that lipo handles.\nconst SINGLE_ARCH_MACHO_MAGICS = new Set([0xfeedface, 0xfeedfacf, 0xcefaedfe, 0xcffaedfe])\n\nasync function isSingleArchMachO(file: string): Promise<boolean> {\n let fh\n try {\n fh = await open(file, \"r\")\n const buf = Buffer.alloc(4)\n const { bytesRead } = await fh.read(buf, 0, 4, 0)\n return bytesRead === 4 && SINGLE_ARCH_MACHO_MAGICS.has(buf.readUInt32BE(0))\n } catch {\n return false // missing/unreadable file\n } finally {\n await fh?.close()\n }\n}\n\nasync function sha256(file: string): Promise<string> {\n return createHash(\"sha256\")\n .update(await readFile(file))\n .digest(\"hex\")\n}\n\nasync function walkFiles(dir: string, onFile: (absolutePath: string) => Promise<void>): Promise<void> {\n let entries\n try {\n entries = await readdir(dir, { withFileTypes: true })\n } catch {\n return // directory does not exist or is unreadable\n }\n for (const entry of entries) {\n const p = path.join(dir, entry.name)\n if (entry.isDirectory()) {\n await walkFiles(p, onFile)\n } else if (entry.isFile()) {\n await onFile(p)\n }\n }\n}\n\n/**\n * Finds single-arch Mach-O files that are byte-identical in BOTH universal slices — the exact case\n * `@electron/universal` aborts on (`x64Sha === arm64Sha` for a non-fat Mach-O). This catches host binaries\n * placed in packages that declare no `cpu`/`os`, e.g. esbuild's install script overwriting `esbuild/bin/esbuild`\n * with the platform binary. Per-arch binaries (different SHA, e.g. rebuilt `.node` addons) are left for lipo.\n * Returns paths relative to `unpackedDirA`, posix-normalized for matching by `@electron/universal`.\n */\nexport async function collectIdenticalSingleArchMachOFiles(unpackedDirA: string, unpackedDirB: string): Promise<string[]> {\n const result: string[] = []\n await walkFiles(unpackedDirA, async fileA => {\n if (!(await isSingleArchMachO(fileA))) {\n return\n }\n const rel = path.relative(unpackedDirA, fileA)\n const fileB = path.join(unpackedDirB, rel)\n if ((await isSingleArchMachO(fileB)) && (await sha256(fileA)) === (await sha256(fileB))) {\n result.push(rel.split(path.sep).join(\"/\"))\n }\n })\n return result\n}\n\n/**\n * Combines the given minimatch patterns (as consumed by `@electron/universal`'s `singleArchFiles`) into a\n * single pattern, merged with any user-provided pattern. Returns `userPattern` (possibly undefined) when empty.\n */\nexport function buildSingleArchFilesPattern(patterns: Iterable<string>, userPattern: string | undefined): string | undefined {\n const sorted = Array.from(new Set(patterns)).sort()\n if (sorted.length === 0) {\n return userPattern\n }\n const detected = sorted.length === 1 ? sorted[0] : `{${sorted.join(\",\")}}`\n return userPattern ? `{${userPattern},${detected}}` : detected\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A toolset archive checksum in one of the two accepted formats:
|
|
3
|
+
* - SHA-256 as 64 hex characters (what `@electron/get` verifies itself), normalized to lowercase;
|
|
4
|
+
* - SHA-512 as 88-character padded standard base64 (the format v26 used for all toolset checksums), case preserved.
|
|
5
|
+
*/
|
|
6
|
+
export interface ExpectedChecksum {
|
|
7
|
+
readonly algorithm: "sha256" | "sha512";
|
|
8
|
+
readonly encoding: "hex" | "base64";
|
|
9
|
+
readonly value: string;
|
|
10
|
+
}
|
|
11
|
+
/** Human-readable description of the accepted formats, with the commands that produce them. */
|
|
12
|
+
export declare const ACCEPTED_CHECKSUM_FORMATS: string;
|
|
13
|
+
/**
|
|
14
|
+
* Classifies a checksum. Throws an {@link InvalidConfigurationError} for any other format (including prefixed forms such as
|
|
15
|
+
* `sha256:…` / `sha512-…` and hex-encoded SHA-512) without echoing the value.
|
|
16
|
+
*
|
|
17
|
+
* @param label names the setting in the error, e.g. `ToolsetCustom.checksum for url toolset https://…`
|
|
18
|
+
* @param docsUrl appended to the error as a `See …` link when given
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseChecksum(value: string, label: string, docsUrl?: string): ExpectedChecksum;
|
|
21
|
+
/**
|
|
22
|
+
* Hashes `file` with the algorithm and encoding of `expected` and compares the result. Never modifies or removes the file:
|
|
23
|
+
* a caller verifying a download removes it itself, a caller verifying a user-supplied archive must leave it in place.
|
|
24
|
+
*/
|
|
25
|
+
export declare function verifyFileChecksum(file: string, expected: ExpectedChecksum): Promise<{
|
|
26
|
+
matches: boolean;
|
|
27
|
+
actual: string;
|
|
28
|
+
}>;
|
|
29
|
+
export declare function checksumMismatchMessage(label: string, expected: ExpectedChecksum, actual: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Filesystem-safe identifier of a checksum: its digest as lowercase hex. A base64 value may contain `/` and `+`, which must
|
|
32
|
+
* not end up in a cache directory name. For a SHA-256 this is the (already lowercase) value itself, so existing cache keys
|
|
33
|
+
* derived from SHA-256 checksums are unchanged.
|
|
34
|
+
*/
|
|
35
|
+
export declare function checksumCacheKey(checksum: ExpectedChecksum): string;
|
|
36
|
+
//# sourceMappingURL=checksum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checksum.d.ts","sourceRoot":"","sources":["../../src/util/checksum.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;IACvC,QAAQ,CAAC,QAAQ,EAAE,KAAK,GAAG,QAAQ,CAAA;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAMD,+FAA+F;AAC/F,eAAO,MAAM,yBAAyB,QAEiC,CAAA;AAEvE;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAa9F;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAIhI;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEzG;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAEnE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { InvalidConfigurationError } from "builder-util";
|
|
2
|
+
import { hashFile } from "./hash.js";
|
|
3
|
+
const SHA256_HEX = /^[0-9a-f]{64}$/i;
|
|
4
|
+
// 64 raw bytes → 86 significant base64 characters + "==" padding
|
|
5
|
+
const SHA512_BASE64 = /^[A-Za-z0-9+/]{86}==$/;
|
|
6
|
+
/** Human-readable description of the accepted formats, with the commands that produce them. */
|
|
7
|
+
export const ACCEPTED_CHECKSUM_FORMATS = "the SHA-256 of the archive as 64 hex characters (e.g. `shasum -a 256 <archive>`) or its SHA-512 as 88 base64 characters " +
|
|
8
|
+
"(e.g. `openssl dgst -sha512 -binary <archive> | openssl base64 -A`)";
|
|
9
|
+
/**
|
|
10
|
+
* Classifies a checksum. Throws an {@link InvalidConfigurationError} for any other format (including prefixed forms such as
|
|
11
|
+
* `sha256:…` / `sha512-…` and hex-encoded SHA-512) without echoing the value.
|
|
12
|
+
*
|
|
13
|
+
* @param label names the setting in the error, e.g. `ToolsetCustom.checksum for url toolset https://…`
|
|
14
|
+
* @param docsUrl appended to the error as a `See …` link when given
|
|
15
|
+
*/
|
|
16
|
+
export function parseChecksum(value, label, docsUrl) {
|
|
17
|
+
// a JS config (or a toolset table lookup that misses) can hand over a non-string; treat it as an unrecognized format
|
|
18
|
+
const trimmed = typeof value === "string" ? value.trim() : "";
|
|
19
|
+
if (SHA256_HEX.test(trimmed)) {
|
|
20
|
+
return { algorithm: "sha256", encoding: "hex", value: trimmed.toLowerCase() };
|
|
21
|
+
}
|
|
22
|
+
if (SHA512_BASE64.test(trimmed)) {
|
|
23
|
+
return { algorithm: "sha512", encoding: "base64", value: trimmed };
|
|
24
|
+
}
|
|
25
|
+
throw new InvalidConfigurationError(`${label} must be ${ACCEPTED_CHECKSUM_FORMATS}. A prefixed value such as "sha256:…" or "sha512-…", or a hex-encoded SHA-512, is not accepted.` +
|
|
26
|
+
(docsUrl == null ? "" : ` See ${docsUrl}`));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Hashes `file` with the algorithm and encoding of `expected` and compares the result. Never modifies or removes the file:
|
|
30
|
+
* a caller verifying a download removes it itself, a caller verifying a user-supplied archive must leave it in place.
|
|
31
|
+
*/
|
|
32
|
+
export async function verifyFileChecksum(file, expected) {
|
|
33
|
+
const digest = await hashFile(file, expected.algorithm, expected.encoding);
|
|
34
|
+
const actual = expected.encoding === "hex" ? digest.toLowerCase() : digest;
|
|
35
|
+
return { matches: actual === expected.value, actual };
|
|
36
|
+
}
|
|
37
|
+
export function checksumMismatchMessage(label, expected, actual) {
|
|
38
|
+
return `${expected.algorithm} checksum mismatch for ${label}: expected "${expected.value}" but the file is "${actual}".`;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Filesystem-safe identifier of a checksum: its digest as lowercase hex. A base64 value may contain `/` and `+`, which must
|
|
42
|
+
* not end up in a cache directory name. For a SHA-256 this is the (already lowercase) value itself, so existing cache keys
|
|
43
|
+
* derived from SHA-256 checksums are unchanged.
|
|
44
|
+
*/
|
|
45
|
+
export function checksumCacheKey(checksum) {
|
|
46
|
+
return checksum.encoding === "hex" ? checksum.value : Buffer.from(checksum.value, "base64").toString("hex");
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=checksum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checksum.js","sourceRoot":"","sources":["../../src/util/checksum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAapC,MAAM,UAAU,GAAG,iBAAiB,CAAA;AACpC,iEAAiE;AACjE,MAAM,aAAa,GAAG,uBAAuB,CAAA;AAE7C,+FAA+F;AAC/F,MAAM,CAAC,MAAM,yBAAyB,GACpC,0HAA0H;IAC1H,qEAAqE,CAAA;AAEvE;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,KAAa,EAAE,OAAgB;IAC1E,qHAAqH;IACrH,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAC7D,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,CAAA;IAC/E,CAA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Content":["import { InvalidConfigurationError } from \"builder-util\"\nimport { hashFile } from \"./hash.js\"\n\n/**\n * A toolset archive checksum in one of the two accepted formats:\n * - SHA-256 as 64 hex characters (what `@electron/get` verifies itself), normalized to lowercase;\n * - SHA-512 as 88-character padded standard base64 (the format v26 used for all toolset checksums), case preserved.\n */\nexport interface ExpectedChecksum {\n readonly algorithm: \"sha256\" | \"sha512\"\n readonly encoding: \"hex\" | \"base64\"\n readonly value: string\n}\n\nconst SHA256_HEX = /^[0-9a-f]{64}$/i\n// 64 raw bytes → 86 significant base64 characters + \"==\" padding\nconst SHA512_BASE64 = /^[A-Za-z0-9+/]{86}==$/\n\n/** Human-readable description of the accepted formats, with the commands that produce them. */\nexport const ACCEPTED_CHECKSUM_FORMATS =\n \"the SHA-256 of the archive as 64 hex characters (e.g. `shasum -a 256 <archive>`) or its SHA-512 as 88 base64 characters \" +\n \"(e.g. `openssl dgst -sha512 -binary <archive> | openssl base64 -A`)\"\n\n/**\n * Classifies a checksum. Throws an {@link InvalidConfigurationError} for any other format (including prefixed forms such as\n * `sha256:…` / `sha512-…` and hex-encoded SHA-512) without echoing the value.\n *\n * @param label names the setting in the error, e.g. `ToolsetCustom.checksum for url toolset https://…`\n * @param docsUrl appended to the error as a `See …` link when given\n */\nexport function parseChecksum(value: string, label: string, docsUrl?: string): ExpectedChecksum {\n // a JS config (or a toolset table lookup that misses) can hand over a non-string; treat it as an unrecognized format\n const trimmed = typeof value === \"string\" ? value.trim() : \"\"\n if (SHA256_HEX.test(trimmed)) {\n return { algorithm: \"sha256\", encoding: \"hex\", value: trimmed.toLowerCase() }\n }\n if (SHA512_BASE64.test(trimmed)) {\n return { algorithm: \"sha512\", encoding: \"base64\", value: trimmed }\n }\n throw new InvalidConfigurationError(\n `${label} must be ${ACCEPTED_CHECKSUM_FORMATS}. A prefixed value such as \"sha256:…\" or \"sha512-…\", or a hex-encoded SHA-512, is not accepted.` +\n (docsUrl == null ? \"\" : ` See ${docsUrl}`)\n )\n}\n\n/**\n * Hashes `file` with the algorithm and encoding of `expected` and compares the result. Never modifies or removes the file:\n * a caller verifying a download removes it itself, a caller verifying a user-supplied archive must leave it in place.\n */\nexport async function verifyFileChecksum(file: string, expected: ExpectedChecksum): Promise<{ matches: boolean; actual: string }> {\n const digest = await hashFile(file, expected.algorithm, expected.encoding)\n const actual = expected.encoding === \"hex\" ? digest.toLowerCase() : digest\n return { matches: actual === expected.value, actual }\n}\n\nexport function checksumMismatchMessage(label: string, expected: ExpectedChecksum, actual: string): string {\n return `${expected.algorithm} checksum mismatch for ${label}: expected \"${expected.value}\" but the file is \"${actual}\".`\n}\n\n/**\n * Filesystem-safe identifier of a checksum: its digest as lowercase hex. A base64 value may contain `/` and `+`, which must\n * not end up in a cache directory name. For a SHA-256 this is the (already lowercase) value itself, so existing cache keys\n * derived from SHA-256 checksums are unchanged.\n */\nexport function checksumCacheKey(checksum: ExpectedChecksum): string {\n return checksum.encoding === \"hex\" ? checksum.value : Buffer.from(checksum.value, \"base64\").toString(\"hex\")\n}\n"]}
|
|
@@ -2,6 +2,7 @@ import { DebugLogger } from "builder-util";
|
|
|
2
2
|
import { Nullish } from "builder-util-runtime";
|
|
3
3
|
import { Lazy } from "lazy-val";
|
|
4
4
|
import { Configuration } from "../../configuration.js";
|
|
5
|
+
export declare function createProjectMetadataLazy(projectDir: string): Lazy<Record<string, any> | null>;
|
|
5
6
|
export declare function getConfig(projectDir: string, configPath: string | null, configFromOptions: Configuration | Nullish, packageMetadata?: Lazy<Record<string, any> | null>): Promise<Configuration>;
|
|
6
7
|
/**
|
|
7
8
|
* `doMergeConfigs` takes configs in the order you would pass them to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/util/config/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAiE,MAAM,cAAc,CAAA;AAGzG,OAAO,EAAc,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/util/config/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAiE,MAAM,cAAc,CAAA;AAGzG,OAAO,EAAc,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAiCtD,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAE9F;AAED,wBAAsB,SAAS,CAC7B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,iBAAiB,EAAE,aAAa,GAAG,OAAO,EAC1C,eAAe,GAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAyC,GACxF,OAAO,CAAC,aAAa,CAAC,CA0CxB;AAuGD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,aAAa,CAgBtE;AAaD,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,iBA4B1F;AAID,wBAAsB,0BAA0B,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBlH"}
|
|
@@ -7,6 +7,7 @@ import * as path from "path";
|
|
|
7
7
|
import { reactCra } from "../../presets/rectCra.js";
|
|
8
8
|
import { PACKAGE_VERSION } from "../../version.js";
|
|
9
9
|
import { getConfig as _getConfig, loadParentConfig, orNullIfFileNotExist } from "./load.js";
|
|
10
|
+
import { checkLegacyConfiguration } from "./legacyConfigGuard.js";
|
|
10
11
|
import { validateSchema } from "./schemaValidator.js";
|
|
11
12
|
import _fsExtra from "fs-extra";
|
|
12
13
|
const { readJson } = _fsExtra;
|
|
@@ -30,7 +31,10 @@ function mergePublish(config, configFromOptions) {
|
|
|
30
31
|
deepAssign(listOnDisk[0], publish);
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
export
|
|
34
|
+
export function createProjectMetadataLazy(projectDir) {
|
|
35
|
+
return new Lazy(() => orNullIfFileNotExist(readJson(path.join(projectDir, "package.json"))));
|
|
36
|
+
}
|
|
37
|
+
export async function getConfig(projectDir, configPath, configFromOptions, packageMetadata = createProjectMetadataLazy(projectDir)) {
|
|
34
38
|
const configRequest = { packageKey: "build", configFilename: "electron-builder", projectDir, packageMetadata };
|
|
35
39
|
const configAndEffectiveFile = await _getConfig(configRequest, configPath);
|
|
36
40
|
const config = configAndEffectiveFile == null ? {} : configAndEffectiveFile.result;
|
|
@@ -185,6 +189,9 @@ function getDefaultConfig() {
|
|
|
185
189
|
}
|
|
186
190
|
const schemeDataPromise = new Lazy(() => readJson(path.join(import.meta.dirname, "..", "..", "..", "scheme.json")));
|
|
187
191
|
export async function validateConfiguration(config, debugLogger) {
|
|
192
|
+
// Runs first so a v26 option produces a targeted "moved to X" message instead of ajv's generic
|
|
193
|
+
// "has an unknown property" — see util/config/legacyConfigGuard.ts.
|
|
194
|
+
checkLegacyConfiguration(config);
|
|
188
195
|
validateSchema(await schemeDataPromise.value, config, {
|
|
189
196
|
name: `electron-builder ${PACKAGE_VERSION}`,
|
|
190
197
|
postFormatter: (formattedError, error) => {
|