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,7 +1,6 @@
|
|
|
1
1
|
// Adapted from https://github.com/electron/packager/pull/1806
|
|
2
2
|
import { spawn } from "builder-util";
|
|
3
3
|
import * as fs from "fs/promises";
|
|
4
|
-
import * as os from "node:os";
|
|
5
4
|
import * as path from "node:path";
|
|
6
5
|
import plist from "plist";
|
|
7
6
|
import * as semver from "semver";
|
|
@@ -38,62 +37,45 @@ async function checkActoolVersion(tmpDir) {
|
|
|
38
37
|
* @param inputPath The path to the `.icon` file
|
|
39
38
|
* @returns The asset catalog and extra assets
|
|
40
39
|
*/
|
|
41
|
-
export async function generateAssetCatalogForIcon(inputPath) {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"NO",
|
|
82
|
-
"--development-region",
|
|
83
|
-
"en",
|
|
84
|
-
"--target-device",
|
|
85
|
-
"mac",
|
|
86
|
-
"--minimum-deployment-target",
|
|
87
|
-
"26.0",
|
|
88
|
-
"--platform",
|
|
89
|
-
"macosx",
|
|
90
|
-
]);
|
|
91
|
-
const assetCatalog = await fs.readFile(path.resolve(outputPath, "Assets.car"));
|
|
92
|
-
const icnsFile = await fs.readFile(path.resolve(outputPath, "Icon.icns"));
|
|
93
|
-
return { assetCatalog, icnsFile };
|
|
94
|
-
}
|
|
95
|
-
finally {
|
|
96
|
-
await cleanup();
|
|
97
|
-
}
|
|
40
|
+
export async function generateAssetCatalogForIcon(tmpDir, inputPath) {
|
|
41
|
+
const tmpDirPath = await tmpDir.createTempDir({ prefix: "macos-icon-composer" });
|
|
42
|
+
await checkActoolVersion(tmpDirPath);
|
|
43
|
+
const iconPath = path.resolve(tmpDirPath, "Icon.icon");
|
|
44
|
+
const outputPath = path.resolve(tmpDirPath, "out");
|
|
45
|
+
await fs.cp(inputPath, iconPath, {
|
|
46
|
+
recursive: true,
|
|
47
|
+
});
|
|
48
|
+
await fs.mkdir(outputPath, {
|
|
49
|
+
recursive: true,
|
|
50
|
+
});
|
|
51
|
+
await spawn("actool", [
|
|
52
|
+
iconPath,
|
|
53
|
+
"--compile",
|
|
54
|
+
outputPath,
|
|
55
|
+
"--output-format",
|
|
56
|
+
"human-readable-text",
|
|
57
|
+
"--notices",
|
|
58
|
+
"--warnings",
|
|
59
|
+
"--output-partial-info-plist",
|
|
60
|
+
path.resolve(outputPath, "assetcatalog_generated_info.plist"),
|
|
61
|
+
"--app-icon",
|
|
62
|
+
"Icon",
|
|
63
|
+
"--include-all-app-icons",
|
|
64
|
+
"--accent-color",
|
|
65
|
+
"AccentColor",
|
|
66
|
+
"--enable-on-demand-resources",
|
|
67
|
+
"NO",
|
|
68
|
+
"--development-region",
|
|
69
|
+
"en",
|
|
70
|
+
"--target-device",
|
|
71
|
+
"mac",
|
|
72
|
+
"--minimum-deployment-target",
|
|
73
|
+
"26.0",
|
|
74
|
+
"--platform",
|
|
75
|
+
"macosx",
|
|
76
|
+
]);
|
|
77
|
+
const assetCatalog = await fs.readFile(path.resolve(outputPath, "Assets.car"));
|
|
78
|
+
const icnsFile = await fs.readFile(path.resolve(outputPath, "Icon.icns"));
|
|
79
|
+
return { assetCatalog, icnsFile };
|
|
98
80
|
}
|
|
99
81
|
//# sourceMappingURL=macosIconComposer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macosIconComposer.js","sourceRoot":"","sources":["../../../src/util/mac/macosIconComposer.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAE9D,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"macosIconComposer.js","sourceRoot":"","sources":["../../../src/util/mac/macosIconComposer.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAE9D,OAAO,EAAE,KAAK,EAAU,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAOhC,MAAM,4BAA4B,GAAG,IAAI,KAAK,CAC5C,qIAAqI,CACtI,CAAA;AAED,KAAK,UAAU,kBAAkB,CAAC,MAAc;IAC9C,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAE/D,IAAI,WAAW,GAAuD,SAAS,CAAA;IAE/E,IAAI,gBAAgB,GAAyB,IAAI,CAAA;IACjD,IAAI,WAAW,GAAiB,IAAI,CAAA;IACpC,IAAI,CAAC;QACH,gBAAgB,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAA;QAC3D,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC,EAAE,EAAE,gBAAgB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;QACrG,MAAM,mBAAmB,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAA;QAC3E,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAA2C,CAAA;IAC1F,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,WAAW,GAAG,CAAC,CAAA;IACjB,CAAC;YAAS,CAAC;QACT,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,gBAAgB,CAAC,KAAK,EAAE,CAAA;QAChC,CAAC;IACH,CAAC;IAED,IAAI,WAAW,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC,sBAAsB,CAAC,EAAE,CAAC;QAChJ,MAAM,4BAA4B,CAAA;IACpC,CAAC;IAED,MAAM,aAAa,GAAG,WAAW,CAAC,0BAA0B,CAAC,CAAC,sBAAsB,CAAC,CAAA;IACrF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAE,EAAE,QAAQ,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,4EAA4E,aAAa,oEAAoE,CAAC,CAAA;IAChL,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,MAAc,EAAE,SAAiB;IACjF,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAA;IAEhF,MAAM,kBAAkB,CAAC,UAAU,CAAC,CAAA;IAEpC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,WAAW,CAAC,CAAA;IACtD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAElD,MAAM,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE;QAC/B,SAAS,EAAE,IAAI;KAChB,CAAC,CAAA;IAEF,MAAM,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE;QACzB,SAAS,EAAE,IAAI;KAChB,CAAC,CAAA;IAEF,MAAM,KAAK,CAAC,QAAQ,EAAE;QACpB,QAAQ;QACR,WAAW;QACX,UAAU;QACV,iBAAiB;QACjB,qBAAqB;QACrB,WAAW;QACX,YAAY;QACZ,6BAA6B;QAC7B,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,mCAAmC,CAAC;QAC7D,YAAY;QACZ,MAAM;QACN,yBAAyB;QACzB,gBAAgB;QAChB,aAAa;QACb,8BAA8B;QAC9B,IAAI;QACJ,sBAAsB;QACtB,IAAI;QACJ,iBAAiB;QACjB,KAAK;QACL,6BAA6B;QAC7B,MAAM;QACN,YAAY;QACZ,QAAQ;KACT,CAAC,CAAA;IAEF,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAA;IAC9E,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAA;IAEzE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAA;AACnC,CAAC","sourcesContent":["// Adapted from https://github.com/electron/packager/pull/1806\n\nimport { spawn, TmpDir } from \"builder-util\"\nimport * as fs from \"fs/promises\"\nimport * as path from \"node:path\"\nimport plist from \"plist\"\nimport * as semver from \"semver\"\n\nexport interface AssetCatalogResult {\n assetCatalog: Buffer\n icnsFile: Buffer\n}\n\nconst INVALID_ACTOOL_VERSION_ERROR = new Error(\n \"Failed to check actool version. Is Xcode 26 or higher installed? See output of the `actool --version` CLI command for more details.\"\n)\n\nasync function checkActoolVersion(tmpDir: string) {\n const acToolOutputFileName = path.resolve(tmpDir, \"actool.log\")\n\n let versionInfo: Record<string, Record<string, string>> | undefined = undefined\n\n let acToolOutputFile: fs.FileHandle | null = null\n let errorQueued: Error | null = null\n try {\n acToolOutputFile = await fs.open(acToolOutputFileName, \"w\")\n await spawn(\"actool\", [\"--version\"], { stdio: [\"ignore\", acToolOutputFile.fd, acToolOutputFile.fd] })\n const acToolVersionOutput = await fs.readFile(acToolOutputFileName, \"utf8\")\n versionInfo = plist.parse(acToolVersionOutput) as Record<string, Record<string, string>>\n } catch (e: any) {\n errorQueued = e\n } finally {\n if (acToolOutputFile) {\n await acToolOutputFile.close()\n }\n }\n\n if (errorQueued || !versionInfo || !versionInfo[\"com.apple.actool.version\"] || !versionInfo[\"com.apple.actool.version\"][\"short-bundle-version\"]) {\n throw INVALID_ACTOOL_VERSION_ERROR\n }\n\n const acToolVersion = versionInfo[\"com.apple.actool.version\"][\"short-bundle-version\"]\n if (!semver.gte(semver.coerce(acToolVersion)!, \"26.0.0\")) {\n throw new Error(`Unsupported actool version. Must be on actool 26.0.0 or higher but found ${acToolVersion}. Install Xcode 26 or higher to get a supported version of actool.`)\n }\n}\n\n/**\n * Generates an asset catalog and extra assets that are useful for packaging the app.\n * @param inputPath The path to the `.icon` file\n * @returns The asset catalog and extra assets\n */\nexport async function generateAssetCatalogForIcon(tmpDir: TmpDir, inputPath: string): Promise<AssetCatalogResult> {\n const tmpDirPath = await tmpDir.createTempDir({ prefix: \"macos-icon-composer\" })\n\n await checkActoolVersion(tmpDirPath)\n\n const iconPath = path.resolve(tmpDirPath, \"Icon.icon\")\n const outputPath = path.resolve(tmpDirPath, \"out\")\n\n await fs.cp(inputPath, iconPath, {\n recursive: true,\n })\n\n await fs.mkdir(outputPath, {\n recursive: true,\n })\n\n await spawn(\"actool\", [\n iconPath,\n \"--compile\",\n outputPath,\n \"--output-format\",\n \"human-readable-text\",\n \"--notices\",\n \"--warnings\",\n \"--output-partial-info-plist\",\n path.resolve(outputPath, \"assetcatalog_generated_info.plist\"),\n \"--app-icon\",\n \"Icon\",\n \"--include-all-app-icons\",\n \"--accent-color\",\n \"AccentColor\",\n \"--enable-on-demand-resources\",\n \"NO\",\n \"--development-region\",\n \"en\",\n \"--target-device\",\n \"mac\",\n \"--minimum-deployment-target\",\n \"26.0\",\n \"--platform\",\n \"macosx\",\n ])\n\n const assetCatalog = await fs.readFile(path.resolve(outputPath, \"Assets.car\"))\n const icnsFile = await fs.readFile(path.resolve(outputPath, \"Icon.icns\"))\n\n return { assetCatalog, icnsFile }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macosVersion.d.ts","sourceRoot":"","sources":["../../../src/util/mac/macosVersion.ts"],"names":[],"mappings":"AAwBA,wBAAgB,iBAAiB,IAAI,OAAO,CAG3C;AAED,wBAAsB,aAAa,qBAElC
|
|
1
|
+
{"version":3,"file":"macosVersion.d.ts","sourceRoot":"","sources":["../../../src/util/mac/macosVersion.ts"],"names":[],"mappings":"AAwBA,wBAAgB,iBAAiB,IAAI,OAAO,CAG3C;AAED,wBAAsB,aAAa,qBAElC"}
|
|
@@ -25,7 +25,4 @@ export function isMacOsHighSierra() {
|
|
|
25
25
|
export async function isMacOsSierra() {
|
|
26
26
|
return process.platform === "darwin" && (await isOsVersionGreaterThanOrEqualTo("10.12.0"));
|
|
27
27
|
}
|
|
28
|
-
export function isMacOsCatalina() {
|
|
29
|
-
return process.platform === "darwin" && semver.gte(osRelease(), "19.0.0");
|
|
30
|
-
}
|
|
31
28
|
//# sourceMappingURL=macosVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macosVersion.js","sourceRoot":"","sources":["../../../src/util/mac/macosVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAClC,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,IAAI,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,MAAM,YAAY,GAAG,IAAI,IAAI,CAAS,KAAK,IAAI,EAAE;IAC/C,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,kDAAkD,EAAE,MAAM,CAAC,CAAA;IAC/F,MAAM,OAAO,GAAG,6DAA6D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;IACpD,CAAC;IACD,GAAG,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,eAAe,CAAC,CAAA;IACnD,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;AAC1B,CAAC,CAAC,CAAA;AAEF,SAAS,KAAK,CAAC,OAAe;IAC5B,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAA;AACnE,CAAC;AAED,KAAK,UAAU,+BAA+B,CAAC,KAAa;IAC1D,OAAO,MAAM,CAAC,GAAG,CAAC,MAAM,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;AAC3D,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,qBAAqB;IACrB,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,QAAQ,CAAC,CAAA;AAC3E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,MAAM,+BAA+B,CAAC,SAAS,CAAC,CAAC,CAAA;AAC5F,CAAC
|
|
1
|
+
{"version":3,"file":"macosVersion.js","sourceRoot":"","sources":["../../../src/util/mac/macosVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAClC,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,IAAI,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,MAAM,YAAY,GAAG,IAAI,IAAI,CAAS,KAAK,IAAI,EAAE;IAC/C,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,kDAAkD,EAAE,MAAM,CAAC,CAAA;IAC/F,MAAM,OAAO,GAAG,6DAA6D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;IACpD,CAAC;IACD,GAAG,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,eAAe,CAAC,CAAA;IACnD,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;AAC1B,CAAC,CAAC,CAAA;AAEF,SAAS,KAAK,CAAC,OAAe;IAC5B,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAA;AACnE,CAAC;AAED,KAAK,UAAU,+BAA+B,CAAC,KAAa;IAC1D,OAAO,MAAM,CAAC,GAAG,CAAC,MAAM,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;AAC3D,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,qBAAqB;IACrB,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,QAAQ,CAAC,CAAA;AAC3E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,MAAM,+BAA+B,CAAC,SAAS,CAAC,CAAC,CAAA;AAC5F,CAAC","sourcesContent":["import { log } from \"builder-util\"\nimport fsExtra from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport { release as osRelease } from \"os\"\nimport * as semver from \"semver\"\n\nconst macOsVersion = new Lazy<string>(async () => {\n const file = await fsExtra.readFile(\"/System/Library/CoreServices/SystemVersion.plist\", \"utf8\")\n const matches = /<key>ProductVersion<\\/key>[\\s\\S]*<string>([\\d.]+)<\\/string>/.exec(file)\n if (!matches) {\n throw new Error(\"Couldn't find the macOS version\")\n }\n log.debug({ version: matches[1] }, \"macOS version\")\n return clean(matches[1])\n})\n\nfunction clean(version: string) {\n return version.split(\".\").length === 2 ? `${version}.0` : version\n}\n\nasync function isOsVersionGreaterThanOrEqualTo(input: string) {\n return semver.gte(await macOsVersion.value, clean(input))\n}\n\nexport function isMacOsHighSierra(): boolean {\n // 17.7.0 === 10.13.6\n return process.platform === \"darwin\" && semver.gte(osRelease(), \"17.7.0\")\n}\n\nexport async function isMacOsSierra() {\n return process.platform === \"darwin\" && (await isOsVersionGreaterThanOrEqualTo(\"10.12.0\"))\n}\n"]}
|
package/dist/util/mac/plist.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plist.d.ts","sourceRoot":"","sources":["../../../src/util/mac/plist.ts"],"names":[],"mappings":"AAGA,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,WAAW,GAAG,UAAU,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"plist.d.ts","sourceRoot":"","sources":["../../../src/util/mac/plist.ts"],"names":[],"mappings":"AAGA,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,EAAE,CAAA;AAExF,UAAU,WAAW;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAC1B;AA0BD,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAIjF;AAED,wBAAsB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAGhE;AAED,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA"}
|
package/dist/util/mac/plist.js
CHANGED
|
@@ -4,6 +4,11 @@ function sortObjectKeys(obj) {
|
|
|
4
4
|
if (obj === null || typeof obj !== "object") {
|
|
5
5
|
return obj;
|
|
6
6
|
}
|
|
7
|
+
// `<data>` parses to a Buffer and `<date>` to a Date. Both are objects, so recursing into them rewrites the
|
|
8
|
+
// Buffer as a `<dict>` of byte integers and the Date as an empty `<dict>` — they must be passed through as-is.
|
|
9
|
+
if (Buffer.isBuffer(obj) || obj instanceof Date) {
|
|
10
|
+
return obj;
|
|
11
|
+
}
|
|
7
12
|
if (Array.isArray(obj)) {
|
|
8
13
|
return obj.map(sortObjectKeys);
|
|
9
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plist.js","sourceRoot":"","sources":["../../../src/util/mac/plist.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,OAAO,CAAA;AAC3B,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AAQjC,SAAS,cAAc,CAAC,GAAe;IACrC,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IAChC,CAAC;IAED,MAAM,MAAM,GAAgB,EAAE,CAAA;IAC9B,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;SACb,IAAI,EAAE;SACN,OAAO,CAAC,GAAG,CAAC,EAAE;QACb,MAAM,CAAC,GAAG,CAAC,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"plist.js","sourceRoot":"","sources":["../../../src/util/mac/plist.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,OAAO,CAAA;AAC3B,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AAQjC,SAAS,cAAc,CAAC,GAAe;IACrC,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,4GAA4G;IAC5G,+GAA+G;IAC/G,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,YAAY,IAAI,EAAE,CAAC;QAChD,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IAChC,CAAC;IAED,MAAM,MAAM,GAAgB,EAAE,CAAA;IAC9B,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;SACb,IAAI,EAAE;SACN,OAAO,CAAC,GAAG,CAAC,EAAE;QACb,MAAM,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;IACxC,CAAC,CAAC,CAAA;IACJ,OAAO,MAAM,CAAA;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAY,EAAE,IAAgB;IAChE,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAA;IACvC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IACvC,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACjC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAI,IAAY;IAClD,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC5C,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAM,CAAA;AACjC,CAAC","sourcesContent":["import plist_1 from \"plist\"\nimport * as fs from \"fs/promises\"\n\ntype PlistValue = string | number | boolean | Date | Buffer | PlistObject | PlistValue[]\n\ninterface PlistObject {\n [key: string]: PlistValue\n}\n\nfunction sortObjectKeys(obj: PlistValue): PlistValue {\n if (obj === null || typeof obj !== \"object\") {\n return obj\n }\n\n // `<data>` parses to a Buffer and `<date>` to a Date. Both are objects, so recursing into them rewrites the\n // Buffer as a `<dict>` of byte integers and the Date as an empty `<dict>` — they must be passed through as-is.\n if (Buffer.isBuffer(obj) || obj instanceof Date) {\n return obj\n }\n\n if (Array.isArray(obj)) {\n return obj.map(sortObjectKeys)\n }\n\n const result: PlistObject = {}\n Object.keys(obj)\n .sort()\n .forEach(key => {\n result[key] = sortObjectKeys(obj[key])\n })\n return result\n}\n\nexport async function savePlistFile(path: string, data: PlistValue): Promise<void> {\n const sortedData = sortObjectKeys(data)\n const plist = plist_1.build(sortedData)\n await fs.writeFile(path, plist)\n}\n\nexport async function parsePlistFile<T>(file: string): Promise<T> {\n const data = await fs.readFile(file, \"utf8\")\n return plist_1.parse(data) as T\n}\n\nexport type { PlistValue, PlistObject }\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Arch } from "builder-util";
|
|
2
|
+
/** Container format of a native binary, as identified by its magic bytes. */
|
|
3
|
+
export type NativeBinaryFormat = "elf" | "macho" | "pe";
|
|
4
|
+
/** What a native binary's header says it was built for. `arches` holds Node.js `process.arch` names (`x64`, `arm64`, `ia32`, `arm`) or `unknown(0x…)`. */
|
|
5
|
+
export interface NativeBinaryInfo {
|
|
6
|
+
readonly format: NativeBinaryFormat;
|
|
7
|
+
/** Every architecture the file contains — more than one only for a Mach-O fat/universal binary. */
|
|
8
|
+
readonly arches: ReadonlyArray<string>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Identifies an ELF, Mach-O (thin or fat) or PE binary from the first bytes of a file and reports the
|
|
12
|
+
* architecture(s) it was built for. Returns `null` for anything else — including a truncated header — so
|
|
13
|
+
* callers treat unrecognized files as "not a native binary".
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseNativeBinaryHeader(head: Buffer): NativeBinaryInfo | null;
|
|
16
|
+
/** Whether the binary can be loaded by an app for the given platform (`process.platform`) and cpu (`process.arch`). */
|
|
17
|
+
export declare function isNativeBinaryCompatible(info: NativeBinaryInfo, platform: NodeJS.Platform, cpu: string): boolean;
|
|
18
|
+
export declare function describeNativeBinary(info: NativeBinaryInfo): string;
|
|
19
|
+
export type NativeBinaryKind = "addon" | "library";
|
|
20
|
+
export interface NativeBinaryMismatch {
|
|
21
|
+
/** Path inside the packaged app, e.g. `app.asar.unpacked/node_modules/foo/build/Release/foo.node`. */
|
|
22
|
+
readonly file: string;
|
|
23
|
+
readonly kind: NativeBinaryKind;
|
|
24
|
+
readonly detected: NativeBinaryInfo;
|
|
25
|
+
}
|
|
26
|
+
export interface VerifyNativeBinariesOptions {
|
|
27
|
+
/** `Contents/Resources` (macOS) or `resources` directory of the packed app. */
|
|
28
|
+
readonly resourcesDir: string;
|
|
29
|
+
readonly platform: NodeJS.Platform;
|
|
30
|
+
readonly arch: Arch;
|
|
31
|
+
/** `nativeModules.verifyNativeBinaries` */
|
|
32
|
+
readonly mode: boolean | "warn" | null | undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Checks that the native binaries shipped in the packed app (`app.asar`, `app.asar.unpacked`, or the `app` directory)
|
|
36
|
+
* match the target platform and arch. A mismatched `.node` addon fails the build (unless `mode` is `"warn"`); any other
|
|
37
|
+
* mismatched native file is a warning, since packages legitimately bundle helper binaries for several platforms.
|
|
38
|
+
*/
|
|
39
|
+
export declare function verifyNativeBinaries({ resourcesDir, platform, arch, mode }: VerifyNativeBinariesOptions): Promise<void>;
|
|
40
|
+
//# sourceMappingURL=nativeBinaryVerifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeBinaryVerifier.d.ts","sourceRoot":"","sources":["../../src/util/nativeBinaryVerifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAO,MAAM,cAAc,CAAA;AAMxC,6EAA6E;AAC7E,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,OAAO,GAAG,IAAI,CAAA;AAEvD,0JAA0J;AAC1J,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;IACnC,mGAAmG;IACnG,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CACvC;AA4BD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAkD7E;AAKD,uHAAuH;AACvH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAEhH;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAEnE;AAyFD,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,CAAA;AAElD,MAAM,WAAW,oBAAoB;IACnC,sGAAsG;IACtG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAA;IAC/B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAA;CACpC;AA4LD,MAAM,WAAW,2BAA2B;IAC1C,+EAA+E;IAC/E,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAA;IAClC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CACnD;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAyC7H"}
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import { log } from "builder-util";
|
|
2
|
+
import { open, readdir, readFile } from "fs/promises";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
import { readAsar } from "../asar/asar.js";
|
|
5
|
+
import { archToNodeCpu, isPackageCompatible } from "./archCompatibility.js";
|
|
6
|
+
/** Enough to cover the ELF/Mach-O headers, every `fat_arch` entry and the PE header of any real-world binary. */
|
|
7
|
+
const HEAD_READ_LENGTH = 4096;
|
|
8
|
+
// ELF: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html
|
|
9
|
+
const ELF_EI_DATA = 5;
|
|
10
|
+
const ELF_E_MACHINE = 18;
|
|
11
|
+
const ELF_MACHINES = { 3: "ia32", 40: "arm", 62: "x64", 183: "arm64" };
|
|
12
|
+
// Mach-O: <mach-o/loader.h>, <mach-o/fat.h>, <mach/machine.h>
|
|
13
|
+
const MACHO_THIN_MAGIC_BE = new Set([0xfeedface, 0xfeedfacf]);
|
|
14
|
+
const MACHO_THIN_MAGIC_LE = new Set([0xcefaedfe, 0xcffaedfe]);
|
|
15
|
+
const MACHO_FAT_MAGIC = 0xcafebabe;
|
|
16
|
+
const MACHO_FAT_MAGIC_64 = 0xcafebabf;
|
|
17
|
+
/** A fat header has fewer than 30 slices, whereas a Java class file (same `0xcafebabe` magic) has a `major_version` of at least 45 there. */
|
|
18
|
+
const MACHO_FAT_MAX_ARCH_COUNT = 30;
|
|
19
|
+
const MACHO_CPU_TYPES = { 7: "ia32", 0x01000007: "x64", 12: "arm", 0x0100000c: "arm64" };
|
|
20
|
+
// PE: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format
|
|
21
|
+
const PE_E_LFANEW = 0x3c;
|
|
22
|
+
const PE_SIGNATURE = 0x00004550; // "PE\0\0" read little-endian
|
|
23
|
+
const PE_MACHINES = { 0x14c: "ia32", 0x8664: "x64", 0x1c4: "arm", 0xaa64: "arm64" };
|
|
24
|
+
function machineName(table, value) {
|
|
25
|
+
return table[value] ?? `unknown(0x${value.toString(16)})`;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Identifies an ELF, Mach-O (thin or fat) or PE binary from the first bytes of a file and reports the
|
|
29
|
+
* architecture(s) it was built for. Returns `null` for anything else — including a truncated header — so
|
|
30
|
+
* callers treat unrecognized files as "not a native binary".
|
|
31
|
+
*/
|
|
32
|
+
export function parseNativeBinaryHeader(head) {
|
|
33
|
+
if (head.length < 4) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
if (head[0] === 0x7f && head[1] === 0x45 && head[2] === 0x4c && head[3] === 0x46) {
|
|
37
|
+
if (head.length < ELF_E_MACHINE + 2) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const littleEndian = head[ELF_EI_DATA] !== 2;
|
|
41
|
+
const machine = littleEndian ? head.readUInt16LE(ELF_E_MACHINE) : head.readUInt16BE(ELF_E_MACHINE);
|
|
42
|
+
return { format: "elf", arches: [machineName(ELF_MACHINES, machine)] };
|
|
43
|
+
}
|
|
44
|
+
const magic = head.readUInt32BE(0);
|
|
45
|
+
if (MACHO_THIN_MAGIC_BE.has(magic) || MACHO_THIN_MAGIC_LE.has(magic)) {
|
|
46
|
+
if (head.length < 8) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const cpuType = MACHO_THIN_MAGIC_BE.has(magic) ? head.readUInt32BE(4) : head.readUInt32LE(4);
|
|
50
|
+
return { format: "macho", arches: [machineName(MACHO_CPU_TYPES, cpuType)] };
|
|
51
|
+
}
|
|
52
|
+
if (magic === MACHO_FAT_MAGIC || magic === MACHO_FAT_MAGIC_64) {
|
|
53
|
+
if (head.length < 8) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const count = head.readUInt32BE(4);
|
|
57
|
+
const entrySize = magic === MACHO_FAT_MAGIC_64 ? 32 : 20;
|
|
58
|
+
if (count === 0 || count >= MACHO_FAT_MAX_ARCH_COUNT || head.length < 8 + count * entrySize) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const arches = [];
|
|
62
|
+
for (let i = 0; i < count; i++) {
|
|
63
|
+
arches.push(machineName(MACHO_CPU_TYPES, head.readUInt32BE(8 + i * entrySize)));
|
|
64
|
+
}
|
|
65
|
+
return { format: "macho", arches };
|
|
66
|
+
}
|
|
67
|
+
if (head[0] === 0x4d && head[1] === 0x5a) {
|
|
68
|
+
if (head.length < PE_E_LFANEW + 4) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const peOffset = head.readUInt32LE(PE_E_LFANEW);
|
|
72
|
+
if (peOffset + 6 > head.length || head.readUInt32LE(peOffset) !== PE_SIGNATURE) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return { format: "pe", arches: [machineName(PE_MACHINES, head.readUInt16LE(peOffset + 4))] };
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const PLATFORM_FORMAT = { darwin: "macho", linux: "elf", win32: "pe" };
|
|
80
|
+
const FORMAT_LABEL = { elf: "ELF", macho: "Mach-O", pe: "PE" };
|
|
81
|
+
/** Whether the binary can be loaded by an app for the given platform (`process.platform`) and cpu (`process.arch`). */
|
|
82
|
+
export function isNativeBinaryCompatible(info, platform, cpu) {
|
|
83
|
+
return PLATFORM_FORMAT[platform] === info.format && info.arches.includes(cpu);
|
|
84
|
+
}
|
|
85
|
+
export function describeNativeBinary(info) {
|
|
86
|
+
return `${FORMAT_LABEL[info.format]} ${info.arches.join("+")}`;
|
|
87
|
+
}
|
|
88
|
+
// Path segments that say which platform/arch a file is for: prebuildify `prebuilds/linux-arm64/`, node-pre-gyp
|
|
89
|
+
// `napi-v6-linux-glibc-x64/`, platform packages such as `@img/sharp-darwin-arm64`, or `win/x64/` tool layouts.
|
|
90
|
+
const PLATFORM_TOKENS = {
|
|
91
|
+
darwin: "darwin",
|
|
92
|
+
mac: "darwin",
|
|
93
|
+
macos: "darwin",
|
|
94
|
+
osx: "darwin",
|
|
95
|
+
linux: "linux",
|
|
96
|
+
win32: "win32",
|
|
97
|
+
win: "win32",
|
|
98
|
+
windows: "win32",
|
|
99
|
+
freebsd: "freebsd",
|
|
100
|
+
openbsd: "openbsd",
|
|
101
|
+
android: "android",
|
|
102
|
+
sunos: "sunos",
|
|
103
|
+
aix: "aix",
|
|
104
|
+
};
|
|
105
|
+
const ARCH_TOKENS = {
|
|
106
|
+
x64: "x64",
|
|
107
|
+
amd64: "x64",
|
|
108
|
+
arm64: "arm64",
|
|
109
|
+
aarch64: "arm64",
|
|
110
|
+
ia32: "ia32",
|
|
111
|
+
x86: "ia32",
|
|
112
|
+
i386: "ia32",
|
|
113
|
+
i686: "ia32",
|
|
114
|
+
arm: "arm",
|
|
115
|
+
armv6: "arm",
|
|
116
|
+
armv6l: "arm",
|
|
117
|
+
armv7: "arm",
|
|
118
|
+
armv7l: "arm",
|
|
119
|
+
armhf: "arm",
|
|
120
|
+
universal: "universal",
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* The platform/arch a relative path declares through its directory or package names, if any. A segment only
|
|
124
|
+
* counts when it pairs a platform with an arch (`linux-x64`, `sharp-darwin-arm64`) or is exactly one token
|
|
125
|
+
* (`win`, `x64`), so package names such as `node-mac-permissions` are not mistaken for a platform variant.
|
|
126
|
+
*
|
|
127
|
+
* @internal Exported for tests only.
|
|
128
|
+
*/
|
|
129
|
+
export function platformDeclaredByPath(relativePath) {
|
|
130
|
+
const result = {};
|
|
131
|
+
const segments = relativePath.split(/[\\/]/);
|
|
132
|
+
segments.pop(); // the file name itself (e.g. `node.napi.armv7.node`) is not a directory layout
|
|
133
|
+
for (const segment of segments) {
|
|
134
|
+
const tokens = segment
|
|
135
|
+
.toLowerCase()
|
|
136
|
+
.replace(/x86[-_]64/g, "x64")
|
|
137
|
+
.replace(/x64\+arm64|arm64\+x64/g, "universal") // prebuildify's name for a fat macOS prebuild
|
|
138
|
+
.split(/[-_.]/);
|
|
139
|
+
const platform = tokens.map(t => PLATFORM_TOKENS[t]).find(it => it != null);
|
|
140
|
+
const cpu = tokens.map(t => ARCH_TOKENS[t]).find(it => it != null);
|
|
141
|
+
if (tokens.length === 1 || (platform != null && cpu != null)) {
|
|
142
|
+
result.platform = platform ?? result.platform;
|
|
143
|
+
result.cpu = cpu ?? result.cpu;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* The package directory (relative, `node_modules/<name>` or `node_modules/@scope/<name>`) owning a file, or `null`
|
|
150
|
+
* when the file is not inside `node_modules`.
|
|
151
|
+
*/
|
|
152
|
+
function packageRootOf(relativePath) {
|
|
153
|
+
const segments = relativePath.split(/[\\/]/);
|
|
154
|
+
const index = segments.lastIndexOf("node_modules");
|
|
155
|
+
if (index < 0 || index + 2 >= segments.length) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
const nameLength = segments[index + 1].startsWith("@") ? 2 : 1;
|
|
159
|
+
if (index + 1 + nameLength >= segments.length) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
return segments.slice(0, index + 1 + nameLength).join("/");
|
|
163
|
+
}
|
|
164
|
+
const LIBRARY_EXTENSIONS = new Set([".dll", ".exe", ".dylib", ".so"]);
|
|
165
|
+
/** `.node` addons are what `require()` loads; other native files are classified as libraries/executables, or skipped. */
|
|
166
|
+
function classify(file, allowExtensionless) {
|
|
167
|
+
const base = path.basename(file);
|
|
168
|
+
const ext = path.extname(base).toLowerCase();
|
|
169
|
+
if (ext === ".node") {
|
|
170
|
+
return "addon";
|
|
171
|
+
}
|
|
172
|
+
if (LIBRARY_EXTENSIONS.has(ext) || /\.so(\.\d+)+$/.test(base)) {
|
|
173
|
+
return "library";
|
|
174
|
+
}
|
|
175
|
+
// extensionless files are checked by magic bytes (bundled CLI tools such as esbuild's binary); only on disk,
|
|
176
|
+
// where reading the head of a file is cheap — smart unpack moves such executables out of the asar anyway
|
|
177
|
+
return allowExtensionless && ext === "" && !base.startsWith(".") ? "library" : null;
|
|
178
|
+
}
|
|
179
|
+
async function readFileHead(file) {
|
|
180
|
+
let handle;
|
|
181
|
+
try {
|
|
182
|
+
handle = await open(file, "r");
|
|
183
|
+
const head = Buffer.alloc(HEAD_READ_LENGTH);
|
|
184
|
+
const { bytesRead } = await handle.read(head, 0, HEAD_READ_LENGTH, 0);
|
|
185
|
+
return head.subarray(0, bytesRead);
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
finally {
|
|
191
|
+
await handle?.close();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
async function readJsonOrNull(file) {
|
|
195
|
+
try {
|
|
196
|
+
return JSON.parse(await readFile(file, "utf8"));
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
async function listFiles(dir, prefix = "") {
|
|
203
|
+
let entries;
|
|
204
|
+
try {
|
|
205
|
+
entries = await readdir(path.join(dir, prefix), { withFileTypes: true });
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
return [];
|
|
209
|
+
}
|
|
210
|
+
const result = [];
|
|
211
|
+
for (const entry of entries) {
|
|
212
|
+
const rel = prefix === "" ? entry.name : `${prefix}/${entry.name}`;
|
|
213
|
+
if (entry.isDirectory()) {
|
|
214
|
+
result.push(...(await listFiles(dir, rel)));
|
|
215
|
+
}
|
|
216
|
+
else if (entry.isFile()) {
|
|
217
|
+
result.push(rel);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return result;
|
|
221
|
+
}
|
|
222
|
+
/** @internal Exported for tests only. */
|
|
223
|
+
export function directorySource(dir, label) {
|
|
224
|
+
return {
|
|
225
|
+
label,
|
|
226
|
+
list: () => listFiles(dir),
|
|
227
|
+
readHead: rel => readFileHead(path.join(dir, rel)),
|
|
228
|
+
readPackageJson: root => readJsonOrNull(path.join(dir, root, "package.json")),
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function collectAsarFiles(node, prefix, out) {
|
|
232
|
+
for (const [name, child] of Object.entries(node.files ?? {})) {
|
|
233
|
+
const rel = prefix === "" ? name : `${prefix}/${name}`;
|
|
234
|
+
if (child.files != null) {
|
|
235
|
+
collectAsarFiles(child, rel, out);
|
|
236
|
+
}
|
|
237
|
+
else if (child.link == null && !child.unpacked) {
|
|
238
|
+
out.push(rel); // unpacked files are covered by the `app.asar.unpacked` directory source
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
async function readAsarFileHead(archive, rel) {
|
|
243
|
+
const node = archive.getNode(rel.split("/").join(path.sep));
|
|
244
|
+
if (node == null || node.offset == null || !node.size) {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
let handle;
|
|
248
|
+
try {
|
|
249
|
+
handle = await open(archive.src, "r");
|
|
250
|
+
const head = Buffer.alloc(Math.min(HEAD_READ_LENGTH, node.size));
|
|
251
|
+
const { bytesRead } = await handle.read(head, 0, head.length, 8 + archive.headerSize + parseInt(node.offset, 10));
|
|
252
|
+
return head.subarray(0, bytesRead);
|
|
253
|
+
}
|
|
254
|
+
catch {
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
finally {
|
|
258
|
+
await handle?.close();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
async function asarSource(archivePath, label) {
|
|
262
|
+
let archive;
|
|
263
|
+
try {
|
|
264
|
+
archive = await readAsar(archivePath);
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
label,
|
|
271
|
+
list: () => {
|
|
272
|
+
const files = [];
|
|
273
|
+
collectAsarFiles(archive.header, "", files);
|
|
274
|
+
return Promise.resolve(files);
|
|
275
|
+
},
|
|
276
|
+
readHead: rel => readAsarFileHead(archive, rel),
|
|
277
|
+
readPackageJson: async (root) => {
|
|
278
|
+
const onDisk = await readJsonOrNull(path.join(`${archivePath}.unpacked`, root, "package.json"));
|
|
279
|
+
if (onDisk != null) {
|
|
280
|
+
return onDisk;
|
|
281
|
+
}
|
|
282
|
+
try {
|
|
283
|
+
return await archive.readJson(path.join(...root.split("/"), "package.json"));
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Scans the given sources for native binaries that were not built for `platform`/`cpu`. Files whose package declares
|
|
293
|
+
* another platform (`package.json` `os`/`cpu`) or whose path names another platform/arch are skipped: they are
|
|
294
|
+
* shipped on purpose (multi-platform prebuilds, a universal build's single-arch packages) and never loaded here.
|
|
295
|
+
*
|
|
296
|
+
* @internal Exported for tests only.
|
|
297
|
+
*/
|
|
298
|
+
export async function findNativeBinaryMismatches(sources, platform, cpu, options = { extensionless: sources.map(() => true) }) {
|
|
299
|
+
const mismatches = [];
|
|
300
|
+
for (let i = 0; i < sources.length; i++) {
|
|
301
|
+
const source = sources[i];
|
|
302
|
+
const packageCompatibility = new Map();
|
|
303
|
+
for (const rel of await source.list()) {
|
|
304
|
+
const kind = classify(rel, options.extensionless[i] ?? true);
|
|
305
|
+
if (kind == null) {
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
const head = await source.readHead(rel);
|
|
309
|
+
const info = head == null ? null : parseNativeBinaryHeader(head);
|
|
310
|
+
if (info == null || isNativeBinaryCompatible(info, platform, cpu)) {
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
const declared = platformDeclaredByPath(rel);
|
|
314
|
+
if ((declared.platform != null && declared.platform !== platform) || (declared.cpu != null && declared.cpu !== cpu && declared.cpu !== "universal")) {
|
|
315
|
+
log.debug({ file: rel, detected: describeNativeBinary(info), reason: "path names another platform/arch" }, "skipped native binary check");
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
const root = packageRootOf(rel);
|
|
319
|
+
if (root != null) {
|
|
320
|
+
if (!packageCompatibility.has(root)) {
|
|
321
|
+
packageCompatibility.set(root, source.readPackageJson(root).then(pkg => pkg == null || isPackageCompatible(pkg, cpu, platform)));
|
|
322
|
+
}
|
|
323
|
+
if (!(await packageCompatibility.get(root))) {
|
|
324
|
+
log.debug({ file: rel, detected: describeNativeBinary(info), reason: "package.json os/cpu names another platform/arch" }, "skipped native binary check");
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
mismatches.push({ file: `${source.label}/${rel}`, kind, detected: info });
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return mismatches;
|
|
332
|
+
}
|
|
333
|
+
/** @internal Exported for tests only. */
|
|
334
|
+
export function formatMismatch(mismatch, platform, cpu) {
|
|
335
|
+
const expectedFormat = PLATFORM_FORMAT[platform];
|
|
336
|
+
const expected = expectedFormat == null ? `${platform} ${cpu}` : `${FORMAT_LABEL[expectedFormat]} ${cpu}`;
|
|
337
|
+
return `${mismatch.file}: ${describeNativeBinary(mismatch.detected)}, expected ${expected}`;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Checks that the native binaries shipped in the packed app (`app.asar`, `app.asar.unpacked`, or the `app` directory)
|
|
341
|
+
* match the target platform and arch. A mismatched `.node` addon fails the build (unless `mode` is `"warn"`); any other
|
|
342
|
+
* mismatched native file is a warning, since packages legitimately bundle helper binaries for several platforms.
|
|
343
|
+
*/
|
|
344
|
+
export async function verifyNativeBinaries({ resourcesDir, platform, arch, mode }) {
|
|
345
|
+
if (mode === false) {
|
|
346
|
+
log.debug({ reason: "nativeModules.verifyNativeBinaries is set to false" }, "skipped native binary check");
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
const cpu = archToNodeCpu(arch);
|
|
350
|
+
if (cpu == null || PLATFORM_FORMAT[platform] == null) {
|
|
351
|
+
return; // e.g. `universal`: each slice is checked before the merge
|
|
352
|
+
}
|
|
353
|
+
const sources = [];
|
|
354
|
+
const extensionless = [];
|
|
355
|
+
const archive = await asarSource(path.join(resourcesDir, "app.asar"), "app.asar");
|
|
356
|
+
if (archive != null) {
|
|
357
|
+
sources.push(archive);
|
|
358
|
+
extensionless.push(false);
|
|
359
|
+
}
|
|
360
|
+
sources.push(directorySource(path.join(resourcesDir, "app.asar.unpacked"), "app.asar.unpacked"), directorySource(path.join(resourcesDir, "app"), "app"));
|
|
361
|
+
extensionless.push(true, true);
|
|
362
|
+
const mismatches = await findNativeBinaryMismatches(sources, platform, cpu, { extensionless });
|
|
363
|
+
if (mismatches.length === 0) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
const target = `${platform} ${cpu}`;
|
|
367
|
+
const fatal = mode === "warn" ? [] : mismatches.filter(it => it.kind === "addon");
|
|
368
|
+
for (const mismatch of mismatches) {
|
|
369
|
+
if (!fatal.includes(mismatch)) {
|
|
370
|
+
log.warn({ file: mismatch.file, detected: describeNativeBinary(mismatch.detected), target }, "native binary does not match the target platform/arch");
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (fatal.length > 0) {
|
|
374
|
+
throw new Error(`Native module(s) built for the wrong platform/architecture were found in the packaged app (target: ${target}):\n` +
|
|
375
|
+
fatal.map(it => ` ${formatMismatch(it, platform, cpu)}`).join("\n") +
|
|
376
|
+
"\nThe app would fail to load them at runtime. This usually means a binary built for another target (often the build host) was left in node_modules " +
|
|
377
|
+
"because the native rebuild was skipped or reused a cached result. Rebuild native dependencies for the target, " +
|
|
378
|
+
'or set `nativeModules.verifyNativeBinaries` to "warn" (or false) to package anyway.');
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
//# sourceMappingURL=nativeBinaryVerifier.js.map
|