app-builder-lib 27.0.0-alpha.1 → 27.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Framework.d.ts +2 -0
- package/dist/Framework.d.ts.map +1 -1
- package/dist/Framework.js.map +1 -1
- package/dist/appInfo.d.ts +1 -1
- package/dist/appInfo.d.ts.map +1 -1
- package/dist/appInfo.js +3 -3
- package/dist/appInfo.js.map +1 -1
- package/dist/asar/asar.js.map +1 -1
- package/dist/asar/asarAlign.d.ts +35 -0
- package/dist/asar/asarAlign.d.ts.map +1 -0
- package/dist/asar/asarAlign.js +149 -0
- package/dist/asar/asarAlign.js.map +1 -0
- package/dist/asar/asarFileChecker.d.ts +4 -2
- package/dist/asar/asarFileChecker.d.ts.map +1 -1
- package/dist/asar/asarFileChecker.js +2 -3
- package/dist/asar/asarFileChecker.js.map +1 -1
- package/dist/asar/asarUtil.d.ts +15 -1
- package/dist/asar/asarUtil.d.ts.map +1 -1
- package/dist/asar/asarUtil.js +132 -72
- package/dist/asar/asarUtil.js.map +1 -1
- package/dist/codeSign/certInfo.d.ts +14 -0
- package/dist/codeSign/certInfo.d.ts.map +1 -1
- package/dist/codeSign/certInfo.js +49 -0
- package/dist/codeSign/certInfo.js.map +1 -1
- package/dist/codeSign/mac/macCodeSign.d.ts +3 -3
- package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
- package/dist/codeSign/mac/macCodeSign.js +50 -25
- package/dist/codeSign/mac/macCodeSign.js.map +1 -1
- package/dist/codeSign/signResult.d.ts +26 -0
- package/dist/codeSign/signResult.d.ts.map +1 -0
- package/dist/codeSign/signResult.js +12 -0
- package/dist/codeSign/signResult.js.map +1 -0
- package/dist/codeSign/win/hsmSignManager.d.ts +10 -0
- package/dist/codeSign/win/hsmSignManager.d.ts.map +1 -0
- package/dist/codeSign/win/hsmSignManager.js +50 -0
- package/dist/codeSign/win/hsmSignManager.js.map +1 -0
- package/dist/codeSign/win/pkcs11SignManager.d.ts +14 -0
- package/dist/codeSign/win/pkcs11SignManager.d.ts.map +1 -0
- package/dist/codeSign/win/pkcs11SignManager.js +82 -0
- package/dist/codeSign/win/pkcs11SignManager.js.map +1 -0
- package/dist/codeSign/win/signManager.d.ts +17 -0
- package/dist/codeSign/win/signManager.d.ts.map +1 -0
- package/dist/codeSign/win/signManager.js +19 -0
- package/dist/codeSign/win/signManager.js.map +1 -0
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts +95 -0
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -0
- package/dist/codeSign/win/signtoolBaseSignManager.js +507 -0
- package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -0
- package/dist/codeSign/win/windowsCodeSign.d.ts +2 -1
- package/dist/codeSign/win/windowsCodeSign.d.ts.map +1 -1
- package/dist/codeSign/win/windowsCodeSign.js +22 -8
- package/dist/codeSign/win/windowsCodeSign.js.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.d.ts +11 -4
- package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.js +142 -37
- package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
- package/dist/codeSign/win/windowsSignToolManager.d.ts +1 -58
- package/dist/codeSign/win/windowsSignToolManager.d.ts.map +1 -1
- package/dist/codeSign/win/windowsSignToolManager.js +3 -363
- package/dist/codeSign/win/windowsSignToolManager.js.map +1 -1
- package/dist/configuration.d.ts +233 -166
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js +11 -1
- package/dist/configuration.js.map +1 -1
- package/dist/core.d.ts +14 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +11 -0
- package/dist/core.js.map +1 -1
- package/dist/electron/ElectronFramework.d.ts +3 -3
- package/dist/electron/ElectronFramework.d.ts.map +1 -1
- package/dist/electron/ElectronFramework.js +60 -61
- package/dist/electron/ElectronFramework.js.map +1 -1
- package/dist/electron/electronArchSupport.d.ts +12 -0
- package/dist/electron/electronArchSupport.d.ts.map +1 -0
- package/dist/electron/electronArchSupport.js +58 -0
- package/dist/electron/electronArchSupport.js.map +1 -0
- package/dist/electron/electronVersion.d.ts.map +1 -1
- package/dist/electron/electronVersion.js +1 -11
- package/dist/electron/electronVersion.js.map +1 -1
- package/dist/electron/injectFFMPEG.js +2 -2
- package/dist/electron/injectFFMPEG.js.map +1 -1
- package/dist/electron/mac/electronMac.js +24 -35
- package/dist/electron/mac/electronMac.js.map +1 -1
- package/dist/electron/mac/electronMacUtils.d.ts +24 -0
- package/dist/electron/mac/electronMacUtils.d.ts.map +1 -0
- package/dist/electron/mac/electronMacUtils.js +42 -0
- package/dist/electron/mac/electronMacUtils.js.map +1 -0
- package/dist/electron/win/electronWin.js +2 -2
- package/dist/electron/win/electronWin.js.map +1 -1
- package/dist/fileMatcher.d.ts +55 -3
- package/dist/fileMatcher.d.ts.map +1 -1
- package/dist/fileMatcher.js +274 -28
- package/dist/fileMatcher.js.map +1 -1
- package/dist/index.d.ts +13 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/indexInternal.d.ts +20 -8
- package/dist/indexInternal.d.ts.map +1 -1
- package/dist/indexInternal.js +19 -7
- package/dist/indexInternal.js.map +1 -1
- package/dist/linuxPackager.d.ts.map +1 -1
- package/dist/linuxPackager.js +19 -1
- package/dist/linuxPackager.js.map +1 -1
- package/dist/macPackager.d.ts +31 -14
- package/dist/macPackager.d.ts.map +1 -1
- package/dist/macPackager.js +236 -147
- package/dist/macPackager.js.map +1 -1
- package/dist/node-module-collector/index.d.ts.map +1 -1
- package/dist/node-module-collector/index.js +47 -16
- package/dist/node-module-collector/index.js.map +1 -1
- package/dist/node-module-collector/moduleManager.d.ts +11 -2
- package/dist/node-module-collector/moduleManager.d.ts.map +1 -1
- package/dist/node-module-collector/moduleManager.js +34 -14
- package/dist/node-module-collector/moduleManager.js.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.d.ts +47 -26
- package/dist/node-module-collector/nodeModulesCollector.d.ts.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.js +157 -142
- package/dist/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/dist/node-module-collector/packageManager.js +1 -1
- package/dist/node-module-collector/packageManager.js.map +1 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts +90 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts.map +1 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.js +325 -25
- package/dist/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
- package/dist/node-module-collector/types.d.ts +4 -0
- package/dist/node-module-collector/types.d.ts.map +1 -1
- package/dist/node-module-collector/types.js.map +1 -1
- package/dist/options/FuseOptionsV1.d.ts +137 -0
- package/dist/options/FuseOptionsV1.d.ts.map +1 -0
- package/dist/options/FuseOptionsV1.js +2 -0
- package/dist/options/FuseOptionsV1.js.map +1 -0
- package/dist/options/MsixOptions.d.ts +126 -0
- package/dist/options/MsixOptions.d.ts.map +1 -0
- package/dist/options/MsixOptions.js +2 -0
- package/dist/options/MsixOptions.js.map +1 -0
- package/dist/options/PlatformSpecificBuildOptions.d.ts +147 -12
- package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/options/SnapOptions.d.ts +59 -32
- package/dist/options/SnapOptions.d.ts.map +1 -1
- package/dist/options/SnapOptions.js.map +1 -1
- package/dist/options/SquirrelWindowsOptions.d.ts +0 -5
- package/dist/options/SquirrelWindowsOptions.d.ts.map +1 -1
- package/dist/options/SquirrelWindowsOptions.js.map +1 -1
- package/dist/options/linuxOptions.d.ts +61 -30
- package/dist/options/linuxOptions.d.ts.map +1 -1
- package/dist/options/linuxOptions.js.map +1 -1
- package/dist/options/macOptions.d.ts +113 -131
- package/dist/options/macOptions.d.ts.map +1 -1
- package/dist/options/macOptions.js.map +1 -1
- package/dist/options/pkgOptions.d.ts +1 -1
- package/dist/options/pkgOptions.js.map +1 -1
- package/dist/options/winOptions.d.ts +282 -70
- package/dist/options/winOptions.d.ts.map +1 -1
- package/dist/options/winOptions.js +12 -1
- package/dist/options/winOptions.js.map +1 -1
- package/dist/packager.d.ts +6 -1
- package/dist/packager.d.ts.map +1 -1
- package/dist/packager.js +123 -40
- package/dist/packager.js.map +1 -1
- package/dist/packagerApi.d.ts +10 -1
- package/dist/packagerApi.d.ts.map +1 -1
- package/dist/packagerApi.js.map +1 -1
- package/dist/platformPackager.d.ts +55 -4
- package/dist/platformPackager.d.ts.map +1 -1
- package/dist/platformPackager.js +160 -22
- package/dist/platformPackager.js.map +1 -1
- package/dist/presets/rectCra.js +3 -1
- package/dist/presets/rectCra.js.map +1 -1
- package/dist/publish/PublishManager.d.ts +40 -2
- package/dist/publish/PublishManager.d.ts.map +1 -1
- package/dist/publish/PublishManager.js +365 -23
- package/dist/publish/PublishManager.js.map +1 -1
- package/dist/publish/updateInfoBuilder.d.ts +1 -1
- package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
- package/dist/publish/updateInfoBuilder.js +108 -32
- package/dist/publish/updateInfoBuilder.js.map +1 -1
- package/dist/targets/ArchiveTarget.d.ts +1 -0
- package/dist/targets/ArchiveTarget.d.ts.map +1 -1
- package/dist/targets/ArchiveTarget.js +13 -4
- package/dist/targets/ArchiveTarget.js.map +1 -1
- package/dist/targets/archive.d.ts +39 -2
- package/dist/targets/archive.d.ts.map +1 -1
- package/dist/targets/archive.js +114 -30
- package/dist/targets/archive.js.map +1 -1
- package/dist/targets/blockmap/blockmap.d.ts +44 -3
- package/dist/targets/blockmap/blockmap.d.ts.map +1 -1
- package/dist/targets/blockmap/blockmap.js +142 -15
- package/dist/targets/blockmap/blockmap.js.map +1 -1
- package/dist/targets/blockmap/verbatimRange.d.ts +44 -0
- package/dist/targets/blockmap/verbatimRange.d.ts.map +1 -0
- package/dist/targets/blockmap/verbatimRange.js +117 -0
- package/dist/targets/blockmap/verbatimRange.js.map +1 -0
- package/dist/targets/differentialUpdateInfoBuilder.d.ts +28 -2
- package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
- package/dist/targets/differentialUpdateInfoBuilder.js +75 -6
- package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
- package/dist/targets/linux/FlatpakTarget.d.ts +17 -0
- package/dist/targets/linux/FlatpakTarget.d.ts.map +1 -1
- package/dist/targets/linux/FlatpakTarget.js +245 -45
- package/dist/targets/linux/FlatpakTarget.js.map +1 -1
- package/dist/targets/linux/FpmTarget.d.ts +14 -0
- package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
- package/dist/targets/linux/FpmTarget.js +92 -12
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.d.ts +13 -0
- package/dist/targets/linux/LinuxTargetHelper.d.ts.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.js +81 -61
- package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.d.ts +2 -0
- package/dist/targets/linux/appimage/AppImageTarget.d.ts.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.js +20 -15
- package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.d.ts +8 -2
- package/dist/targets/linux/appimage/appImageUtil.d.ts.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.js +16 -9
- package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
- package/dist/targets/linux/appimage/appLauncher.d.ts +6 -0
- package/dist/targets/linux/appimage/appLauncher.d.ts.map +1 -1
- package/dist/targets/linux/appimage/appLauncher.js +18 -20
- package/dist/targets/linux/appimage/appLauncher.js.map +1 -1
- package/dist/targets/linux/flatpakBundle.d.ts +43 -0
- package/dist/targets/linux/flatpakBundle.d.ts.map +1 -0
- package/dist/targets/linux/flatpakBundle.js +210 -0
- package/dist/targets/linux/flatpakBundle.js.map +1 -0
- package/dist/targets/linux/launcherScript.d.ts +32 -0
- package/dist/targets/linux/launcherScript.d.ts.map +1 -0
- package/dist/targets/linux/launcherScript.js +24 -0
- package/dist/targets/linux/launcherScript.js.map +1 -0
- package/dist/targets/linux/snap/SnapTarget.d.ts +1 -1
- package/dist/targets/linux/snap/SnapTarget.d.ts.map +1 -1
- package/dist/targets/linux/snap/SnapTarget.js +23 -1
- package/dist/targets/linux/snap/SnapTarget.js.map +1 -1
- package/dist/targets/linux/snap/core24.d.ts +13 -2
- package/dist/targets/linux/snap/core24.d.ts.map +1 -1
- package/dist/targets/linux/snap/core24.js +107 -95
- package/dist/targets/linux/snap/core24.js.map +1 -1
- package/dist/targets/linux/snap/coreCustom.d.ts +1 -1
- package/dist/targets/linux/snap/coreCustom.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreCustom.js +2 -2
- package/dist/targets/linux/snap/coreCustom.js.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.d.ts +10 -3
- package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.js +37 -18
- package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
- package/dist/targets/linux/snap/snapCommand.d.ts +13 -0
- package/dist/targets/linux/snap/snapCommand.d.ts.map +1 -0
- package/dist/targets/linux/snap/snapCommand.js +21 -0
- package/dist/targets/linux/snap/snapCommand.js.map +1 -0
- package/dist/targets/linux/snap/snapPlugs.d.ts +76 -0
- package/dist/targets/linux/snap/snapPlugs.d.ts.map +1 -0
- package/dist/targets/linux/snap/snapPlugs.js +242 -0
- package/dist/targets/linux/snap/snapPlugs.js.map +1 -0
- package/dist/targets/linux/snap/snapcraft.d.ts +190 -0
- package/dist/targets/linux/snap/snapcraft.d.ts.map +1 -0
- package/dist/targets/linux/snap/snapcraft.js +11 -0
- package/dist/targets/linux/snap/snapcraft.js.map +1 -0
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts +7 -1
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts.map +1 -1
- package/dist/targets/linux/snap/snapcraftBuilder.js +57 -20
- package/dist/targets/linux/snap/snapcraftBuilder.js.map +1 -1
- package/dist/targets/mac/MacTargetHelper.d.ts +146 -14
- package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
- package/dist/targets/mac/MacTargetHelper.js +485 -91
- package/dist/targets/mac/MacTargetHelper.js.map +1 -1
- package/dist/targets/mac/pkg.d.ts +16 -0
- package/dist/targets/mac/pkg.d.ts.map +1 -1
- package/dist/targets/mac/pkg.js +31 -5
- package/dist/targets/mac/pkg.js.map +1 -1
- package/dist/targets/targetFactory.d.ts +7 -0
- package/dist/targets/targetFactory.d.ts.map +1 -1
- package/dist/targets/targetFactory.js +28 -0
- package/dist/targets/targetFactory.js.map +1 -1
- package/dist/targets/win/AppxTarget.d.ts +1 -2
- package/dist/targets/win/AppxTarget.d.ts.map +1 -1
- package/dist/targets/win/AppxTarget.js +37 -314
- package/dist/targets/win/AppxTarget.js.map +1 -1
- package/dist/targets/win/MsiTarget.d.ts.map +1 -1
- package/dist/targets/win/MsiTarget.js +13 -13
- package/dist/targets/win/MsiTarget.js.map +1 -1
- package/dist/targets/win/MsixTarget.d.ts +22 -0
- package/dist/targets/win/MsixTarget.d.ts.map +1 -0
- package/dist/targets/win/MsixTarget.js +214 -0
- package/dist/targets/win/MsixTarget.js.map +1 -0
- package/dist/targets/win/nsis/Defines.d.ts +4 -0
- package/dist/targets/win/nsis/Defines.d.ts.map +1 -1
- package/dist/targets/win/nsis/Defines.js.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.d.ts +64 -3
- package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.js +277 -113
- package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
- package/dist/targets/win/nsis/WebInstallerTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/WebInstallerTarget.js +23 -12
- package/dist/targets/win/nsis/WebInstallerTarget.js.map +1 -1
- package/dist/targets/win/nsis/nsisOptions.d.ts +58 -48
- package/dist/targets/win/nsis/nsisOptions.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.js +4 -3
- package/dist/targets/win/nsis/nsisScriptGenerator.js.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.d.ts +17 -2
- package/dist/targets/win/nsis/nsisUtil.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.js +148 -41
- package/dist/targets/win/nsis/nsisUtil.js.map +1 -1
- package/dist/targets/win/nsis/progId.d.ts +21 -0
- package/dist/targets/win/nsis/progId.d.ts.map +1 -0
- package/dist/targets/win/nsis/progId.js +60 -0
- package/dist/targets/win/nsis/progId.js.map +1 -0
- package/dist/targets/win/winAppUtil.d.ts +115 -0
- package/dist/targets/win/winAppUtil.d.ts.map +1 -0
- package/dist/targets/win/winAppUtil.js +409 -0
- package/dist/targets/win/winAppUtil.js.map +1 -0
- package/dist/toolsets/7zip.d.ts +32 -0
- package/dist/toolsets/7zip.d.ts.map +1 -1
- package/dist/toolsets/7zip.js +39 -11
- package/dist/toolsets/7zip.js.map +1 -1
- package/dist/toolsets/appimage.d.ts +3 -3
- package/dist/toolsets/appimage.d.ts.map +1 -1
- package/dist/toolsets/appimage.js +24 -21
- package/dist/toolsets/appimage.js.map +1 -1
- package/dist/toolsets/custom.d.ts +2 -3
- package/dist/toolsets/custom.d.ts.map +1 -1
- package/dist/toolsets/custom.js +67 -149
- package/dist/toolsets/custom.js.map +1 -1
- package/dist/toolsets/fpm.d.ts.map +1 -1
- package/dist/toolsets/fpm.js +11 -5
- package/dist/toolsets/fpm.js.map +1 -1
- package/dist/toolsets/icons.d.ts.map +1 -1
- package/dist/toolsets/icons.js +17 -3
- package/dist/toolsets/icons.js.map +1 -1
- package/dist/toolsets/linuxToolsMac.d.ts.map +1 -1
- package/dist/toolsets/linuxToolsMac.js +17 -4
- package/dist/toolsets/linuxToolsMac.js.map +1 -1
- package/dist/toolsets/nsis.d.ts +5 -0
- package/dist/toolsets/nsis.d.ts.map +1 -1
- package/dist/toolsets/nsis.js +20 -4
- package/dist/toolsets/nsis.js.map +1 -1
- package/dist/toolsets/version.d.ts +12 -0
- package/dist/toolsets/version.d.ts.map +1 -0
- package/dist/toolsets/version.js +13 -0
- package/dist/toolsets/version.js.map +1 -0
- package/dist/toolsets/winCodeSign.d.ts +56 -3
- package/dist/toolsets/winCodeSign.d.ts.map +1 -1
- package/dist/toolsets/winCodeSign.js +125 -42
- package/dist/toolsets/winCodeSign.js.map +1 -1
- package/dist/toolsets/wine.d.ts +2 -1
- package/dist/toolsets/wine.d.ts.map +1 -1
- package/dist/toolsets/wine.js +31 -15
- package/dist/toolsets/wine.js.map +1 -1
- package/dist/util/AppFileWalker.js +9 -1
- package/dist/util/AppFileWalker.js.map +1 -1
- package/dist/util/NodeModuleCopyHelper.js +14 -6
- package/dist/util/NodeModuleCopyHelper.js.map +1 -1
- package/dist/util/appFileCopier.d.ts +67 -2
- package/dist/util/appFileCopier.d.ts.map +1 -1
- package/dist/util/appFileCopier.js +244 -32
- package/dist/util/appFileCopier.js.map +1 -1
- package/dist/util/archCompatibility.d.ts +42 -0
- package/dist/util/archCompatibility.d.ts.map +1 -0
- package/dist/util/archCompatibility.js +202 -0
- package/dist/util/archCompatibility.js.map +1 -0
- package/dist/util/checksum.d.ts +36 -0
- package/dist/util/checksum.d.ts.map +1 -0
- package/dist/util/checksum.js +48 -0
- package/dist/util/checksum.js.map +1 -0
- package/dist/util/config/config.d.ts +2 -1
- package/dist/util/config/config.d.ts.map +1 -1
- package/dist/util/config/config.js +42 -20
- package/dist/util/config/config.js.map +1 -1
- package/dist/util/config/fileOptions.d.ts +30 -0
- package/dist/util/config/fileOptions.d.ts.map +1 -0
- package/dist/util/config/fileOptions.js +120 -0
- package/dist/util/config/fileOptions.js.map +1 -0
- package/dist/util/config/legacyConfigGuard.d.ts +7 -0
- package/dist/util/config/legacyConfigGuard.d.ts.map +1 -0
- package/dist/util/config/legacyConfigGuard.js +214 -0
- package/dist/util/config/legacyConfigGuard.js.map +1 -0
- package/dist/util/config/legacyOptions.d.ts +86 -0
- package/dist/util/config/legacyOptions.d.ts.map +1 -0
- package/dist/util/config/legacyOptions.js +413 -0
- package/dist/util/config/legacyOptions.js.map +1 -0
- package/dist/util/config/load.d.ts +2 -2
- package/dist/util/config/load.d.ts.map +1 -1
- package/dist/util/config/load.js +3 -12
- package/dist/util/config/load.js.map +1 -1
- package/dist/util/config/schemaValidator.d.ts.map +1 -1
- package/dist/util/config/schemaValidator.js +26 -3
- package/dist/util/config/schemaValidator.js.map +1 -1
- package/dist/util/electronGet.d.ts +43 -32
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +390 -137
- package/dist/util/electronGet.js.map +1 -1
- package/dist/util/flags.d.ts +5 -5
- package/dist/util/flags.d.ts.map +1 -1
- package/dist/util/flags.js +124 -16
- package/dist/util/flags.js.map +1 -1
- package/dist/util/hash.d.ts +1 -1
- package/dist/util/hash.d.ts.map +1 -1
- package/dist/util/hash.js +1 -15
- package/dist/util/hash.js.map +1 -1
- package/dist/util/installOrRebuild.d.ts +44 -0
- package/dist/util/installOrRebuild.d.ts.map +1 -0
- package/dist/util/installOrRebuild.js +276 -0
- package/dist/util/installOrRebuild.js.map +1 -0
- package/dist/util/langs.d.ts.map +1 -1
- package/dist/util/langs.js +1 -0
- package/dist/util/langs.js.map +1 -1
- package/dist/util/license.d.ts.map +1 -1
- package/dist/util/license.js +4 -1
- package/dist/util/license.js.map +1 -1
- package/dist/util/mac/macosIconComposer.d.ts +2 -1
- package/dist/util/mac/macosIconComposer.d.ts.map +1 -1
- package/dist/util/mac/macosIconComposer.js +40 -58
- package/dist/util/mac/macosIconComposer.js.map +1 -1
- package/dist/util/mac/macosVersion.d.ts +0 -1
- package/dist/util/mac/macosVersion.d.ts.map +1 -1
- package/dist/util/mac/macosVersion.js +0 -3
- package/dist/util/mac/macosVersion.js.map +1 -1
- package/dist/util/mac/plist.d.ts +1 -1
- package/dist/util/mac/plist.d.ts.map +1 -1
- package/dist/util/mac/plist.js +5 -0
- package/dist/util/mac/plist.js.map +1 -1
- package/dist/util/nativeBinaryVerifier.d.ts +40 -0
- package/dist/util/nativeBinaryVerifier.d.ts.map +1 -0
- package/dist/util/nativeBinaryVerifier.js +381 -0
- package/dist/util/nativeBinaryVerifier.js.map +1 -0
- package/dist/util/packageMetadata.js +57 -31
- package/dist/util/packageMetadata.js.map +1 -1
- package/dist/util/removedEnvVars.d.ts +25 -0
- package/dist/util/removedEnvVars.d.ts.map +1 -0
- package/dist/util/removedEnvVars.js +54 -0
- package/dist/util/removedEnvVars.js.map +1 -0
- package/dist/util/repositoryInfo.js +6 -3
- package/dist/util/repositoryInfo.js.map +1 -1
- package/dist/util/resolve.js +1 -1
- package/dist/util/resolve.js.map +1 -1
- package/dist/util/streamSpawnToFile.d.ts +47 -0
- package/dist/util/streamSpawnToFile.d.ts.map +1 -0
- package/dist/util/streamSpawnToFile.js +110 -0
- package/dist/util/streamSpawnToFile.js.map +1 -0
- package/dist/util/toolsetLock.d.ts +2 -0
- package/dist/util/toolsetLock.d.ts.map +1 -1
- package/dist/util/toolsetLock.js +31 -5
- package/dist/util/toolsetLock.js.map +1 -1
- package/dist/util/trustedSourceRoots.d.ts +59 -0
- package/dist/util/trustedSourceRoots.d.ts.map +1 -0
- package/dist/util/trustedSourceRoots.js +127 -0
- package/dist/util/trustedSourceRoots.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/vm/ParallelsVm.d.ts.map +1 -1
- package/dist/vm/ParallelsVm.js +29 -3
- package/dist/vm/ParallelsVm.js.map +1 -1
- package/dist/vm/vm.d.ts +2 -0
- package/dist/vm/vm.d.ts.map +1 -1
- package/dist/vm/vm.js +29 -6
- package/dist/vm/vm.js.map +1 -1
- package/dist/winPackager.d.ts +6 -5
- package/dist/winPackager.d.ts.map +1 -1
- package/dist/winPackager.js +45 -39
- package/dist/winPackager.js.map +1 -1
- package/package.json +20 -20
- package/scheme.json +2112 -1495
- package/templates/appx/appxmanifest.xml +2 -3
- package/templates/entitlements.mac.adhoc.plist +15 -0
- package/templates/entitlements.mac.plist +9 -6
- package/templates/msix/appxmanifest.xml +45 -0
- package/templates/nsis/assistedMessages.yml +17 -0
- package/templates/nsis/common.nsh +2 -2
- package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +96 -13
- package/templates/nsis/include/extractAppPackage.nsh +5 -2
- package/templates/nsis/include/installUtil.nsh +2 -2
- package/templates/nsis/include/installer.nsh +94 -53
- package/templates/nsis/include/webPackage.nsh +52 -27
- package/templates/nsis/installSection.nsh +29 -0
- package/templates/nsis/installer.nsi +1 -1
- package/templates/nsis/messages.yml +5 -0
- package/templates/nsis/multiUserUi.nsh +1 -1
- package/dist/codeSign/signManager.d.ts +0 -14
- package/dist/codeSign/signManager.d.ts.map +0 -1
- package/dist/codeSign/signManager.js +0 -2
- package/dist/codeSign/signManager.js.map +0 -1
- package/dist/util/yarn.d.ts +0 -23
- package/dist/util/yarn.d.ts.map +0 -1
- package/dist/util/yarn.js +0 -153
- package/dist/util/yarn.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeModuleCopyHelper.js","sourceRoot":"","sources":["../../src/util/NodeModuleCopyHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACjC,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAe,MAAM,mBAAmB,CAAA;AAE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;gBAC/C,MAAM,CAAC,KAAK,CAAC,GAAG,SAAS,CAAA;YAC3B,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAgB,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC,CAAA;IAC9D,CAAC;CACF","sourcesContent":["import { FilterStats, MAX_FILE_REQUESTS } from \"builder-util\"\nimport { realpathSync } from \"fs\"\nimport fsExtra from \"fs-extra\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { excludedNames, FileMatcher } from \"../fileMatcher.js\"\nimport { PlatformPackager } from \"../platformPackager.js\"\nimport { FileCopyHelper } from \"./AppFileWalker.js\"\nimport { NodeModuleInfo } from \"../node-module-collector/types.js\"\nimport { resolveFunction } from \"./resolve.js\"\n\nconst excludedFiles = new Set(\n [\n \".DS_Store\",\n \"node_modules\" /* already in the queue */,\n \"CHANGELOG.md\",\n \"ChangeLog\",\n \"changelog.md\",\n \"Changelog.md\",\n \"Changelog\",\n \"binding.gyp\",\n \".npmignore\",\n \"node_gyp_bins\",\n ].concat(excludedNames.split(\",\"))\n)\n\nconst topLevelExcludedFiles = new Set([\n \"karma.conf.js\",\n \".coveralls.yml\",\n \"README.md\",\n \"readme.markdown\",\n \"README\",\n \"readme.md\",\n \"Readme.md\",\n \"Readme\",\n \"readme\",\n \"test\",\n \"tests\",\n \"__tests__\",\n \"powered-test\",\n \"example\",\n \"examples\",\n \".bin\",\n])\n\n/** @internal */\nexport class NodeModuleCopyHelper extends FileCopyHelper {\n constructor(matcher: FileMatcher, packager: PlatformPackager<any>) {\n super(matcher, matcher.isEmpty() ? null : matcher.createFilter(), packager)\n }\n\n async collectNodeModules(moduleInfo: NodeModuleInfo, nodeModuleExcludedExts: Array<string>, destination: string): Promise<Array<string>> {\n const filter = this.filter\n const metadata = this.metadata\n\n const onNodeModuleFile = await resolveFunction(this.packager.appInfo.type, this.packager.config.onNodeModuleFile, \"onNodeModuleFile\", await this.packager.getWorkspaceRoot())\n\n const result: Array<string | undefined> = []\n const queue: Array<string> = []\n const emptyDirs: Set<string> = new Set()\n const symlinkFiles: Map<string, number> = new Map()\n const tmpPath = moduleInfo.dir\n const moduleName = moduleInfo.name\n queue.length = 1\n // The path should be corrected in Windows that when the moduleName is Scoped packages named.\n const depPath = path.normalize(tmpPath)\n queue[0] = depPath\n\n while (queue.length > 0) {\n const dirPath = queue.pop()!\n\n const childNames = await fsExtra.readdir(dirPath)\n childNames.sort()\n\n const isTopLevel = dirPath === depPath\n const dirs: Array<string> = []\n // our handler is async, but we should add sorted files, so, we add file to result not in the mapper, but after map\n const sortedFilePaths = await asyncPool(MAX_FILE_REQUESTS, childNames, async name => {\n const filePath = path.join(dirPath, name)\n\n const forceIncluded = onNodeModuleFile != null && !!onNodeModuleFile(filePath)\n\n if (excludedFiles.has(name) || name.startsWith(\"._\")) {\n return null\n }\n\n // check if filematcher matches the files array as more important than the default excluded files.\n const fileMatched = filter != null && filter(dirPath, fsExtra.lstatSync(dirPath))\n if (!fileMatched || !forceIncluded || !!this.packager.config.disableDefaultIgnoredFiles) {\n for (const ext of nodeModuleExcludedExts) {\n if (name.endsWith(ext)) {\n return null\n }\n }\n\n // noinspection SpellCheckingInspection\n if (isTopLevel && (topLevelExcludedFiles.has(name) || (moduleName === \"libui-node\" && (name === \"build\" || name === \"docs\" || name === \"src\")))) {\n return null\n }\n\n if (dirPath.endsWith(\"build\")) {\n if (name === \"gyp-mac-tool\" || name === \"Makefile\" || name.endsWith(\".mk\") || name.endsWith(\".gypi\") || name.endsWith(\".Makefile\")) {\n return null\n }\n } else if (dirPath.endsWith(\"Release\") && (name === \".deps\" || name === \"obj.target\")) {\n return null\n } else if (name === \"src\" && (dirPath.endsWith(\"keytar\") || dirPath.endsWith(\"keytar-prebuild\"))) {\n return null\n } else if (dirPath.endsWith(\"lzma-native\") && (name === \"build\" || name === \"deps\")) {\n return null\n }\n }\n\n return fsExtra.lstat(filePath).then((stat: FilterStats) => {\n stat.moduleName = moduleName\n stat.moduleRootPath = destination\n stat.moduleFullFilePath = path.join(destination, path.relative(depPath, filePath))\n if (filter != null && !filter(filePath, stat)) {\n return null\n }\n\n if (!stat.isDirectory()) {\n metadata.set(filePath, stat)\n }\n const consumerResult = this.handleFile(filePath, dirPath, stat)\n if (consumerResult == null) {\n if (stat.isDirectory()) {\n dirs.push(name)\n return null\n } else {\n return filePath\n }\n } else {\n return consumerResult.then(it => {\n // asarUtil can return modified stat (symlink handling)\n if ((it == null ? stat : it).isDirectory()) {\n dirs.push(name)\n return null\n } else {\n return filePath\n }\n })\n }\n })\n })\n\n let isEmpty = true\n for (const child of sortedFilePaths) {\n if (child != null) {\n result.push(child)\n if (this.metadata.get(child)?.isSymbolicLink()) {\n symlinkFiles.set(child, result.length - 1)\n }\n isEmpty = false\n }\n }\n\n if (isEmpty) {\n emptyDirs.add(dirPath)\n }\n\n dirs.sort()\n for (const child of dirs) {\n queue.push(dirPath + path.sep + child)\n }\n }\n\n for (const [file, index] of symlinkFiles) {\n const resolvedPath = realpathSync(file)\n if (emptyDirs.has(resolvedPath)) {\n // delete symlink file if target is a empty dir\n result[index] = undefined\n }\n }\n return result.filter((it): it is string => it !== undefined)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"NodeModuleCopyHelper.js","sourceRoot":"","sources":["../../src/util/NodeModuleCopyHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACjC,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,sBAAsB,EAAe,MAAM,mBAAmB,CAAA;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AA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AM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,YAAY,EAAE,CAAC;YACzC,MAAM,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;YACvC,IAAI,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;gBAChC,+CAA+C;gBAC/C,MAAM,CAAC,KAAK,CAAC,GAAG,SAAS,CAAA;YAC3B,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAgB,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC,CAAA;IAC9D,CAAC;CACF","sourcesContent":["import { FilterStats, MAX_FILE_REQUESTS } from \"builder-util\"\nimport { realpathSync } from \"fs\"\nimport fsExtra from \"fs-extra\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { DEFAULT_EXCLUDED_NAMES, FileMatcher } from \"../fileMatcher.js\"\nimport { PlatformPackager } from \"../platformPackager.js\"\nimport { FileCopyHelper } from \"./AppFileWalker.js\"\nimport { NodeModuleInfo } from \"../node-module-collector/types.js\"\nimport { resolveFunction } from \"./resolve.js\"\n\nconst excludedFiles = new Set(\n [\n \".DS_Store\",\n \"node_modules\" /* already in the queue */,\n \"CHANGELOG.md\",\n \"ChangeLog\",\n \"changelog.md\",\n \"Changelog.md\",\n \"Changelog\",\n \"binding.gyp\",\n \".npmignore\",\n \"node_gyp_bins\",\n ].concat(DEFAULT_EXCLUDED_NAMES)\n)\n\nconst topLevelExcludedFiles = new Set([\n \"karma.conf.js\",\n \".coveralls.yml\",\n \"README.md\",\n \"readme.markdown\",\n \"README\",\n \"readme.md\",\n \"Readme.md\",\n \"Readme\",\n \"readme\",\n \"test\",\n \"tests\",\n \"__tests__\",\n \"powered-test\",\n \"example\",\n \"examples\",\n \".bin\",\n])\n\n/** @internal */\nexport class NodeModuleCopyHelper extends FileCopyHelper {\n constructor(matcher: FileMatcher, packager: PlatformPackager<any>) {\n super(matcher, matcher.isEmpty() ? null : matcher.createFilter(), packager)\n }\n\n async collectNodeModules(moduleInfo: NodeModuleInfo, nodeModuleExcludedExts: Array<string>, destination: string): Promise<Array<string>> {\n const filter = this.filter\n const metadata = this.metadata\n\n const onNodeModuleFile = await resolveFunction(this.packager.appInfo.type, this.packager.config.onNodeModuleFile, \"onNodeModuleFile\", await this.packager.getWorkspaceRoot())\n\n const result: Array<string | undefined> = []\n const queue: Array<string> = []\n const emptyDirs: Set<string> = new Set()\n const symlinkFiles: Map<string, number> = new Map()\n const tmpPath = moduleInfo.dir\n const moduleName = moduleInfo.name\n queue.length = 1\n // The path should be corrected in Windows that when the moduleName is Scoped packages named.\n const depPath = path.normalize(tmpPath)\n queue[0] = depPath\n\n while (queue.length > 0) {\n const dirPath = queue.pop()!\n\n const childNames = await fsExtra.readdir(dirPath)\n childNames.sort()\n\n const isTopLevel = dirPath === depPath\n const dirs: Array<string> = []\n // check if filematcher matches the files array as more important than the default excluded files.\n // Evaluated lazily and at most once per directory (memoized promise shared by the concurrent pool callbacks):\n // it is only needed when a child is force-included by the `onNodeModuleFile` hook.\n let dirMatched: Promise<boolean> | undefined\n const isDirMatched = () => {\n if (dirMatched === undefined) {\n dirMatched = filter == null ? Promise.resolve(false) : fsExtra.lstat(dirPath).then(stat => filter(dirPath, stat))\n }\n return dirMatched\n }\n // our handler is async, but we should add sorted files, so, we add file to result not in the mapper, but after map\n const sortedFilePaths = await asyncPool(MAX_FILE_REQUESTS, childNames, async name => {\n const filePath = path.join(dirPath, name)\n\n const forceIncluded = onNodeModuleFile != null && !!(await Promise.resolve(onNodeModuleFile(filePath)))\n\n if (excludedFiles.has(name) || name.startsWith(\"._\")) {\n return null\n }\n\n if (!forceIncluded || !(await isDirMatched())) {\n for (const ext of nodeModuleExcludedExts) {\n if (name.endsWith(ext)) {\n return null\n }\n }\n\n // noinspection SpellCheckingInspection\n if (isTopLevel && (topLevelExcludedFiles.has(name) || (moduleName === \"libui-node\" && (name === \"build\" || name === \"docs\" || name === \"src\")))) {\n return null\n }\n\n if (dirPath.endsWith(\"build\")) {\n if (name === \"gyp-mac-tool\" || name === \"Makefile\" || name.endsWith(\".mk\") || name.endsWith(\".gypi\") || name.endsWith(\".Makefile\")) {\n return null\n }\n } else if (dirPath.endsWith(\"Release\") && (name === \".deps\" || name === \"obj.target\")) {\n return null\n } else if (name === \"src\" && (dirPath.endsWith(\"keytar\") || dirPath.endsWith(\"keytar-prebuild\"))) {\n return null\n } else if (dirPath.endsWith(\"lzma-native\") && (name === \"build\" || name === \"deps\")) {\n return null\n }\n }\n\n return fsExtra.lstat(filePath).then((stat: FilterStats) => {\n stat.moduleName = moduleName\n stat.moduleRootPath = destination\n stat.moduleFullFilePath = path.join(destination, path.relative(depPath, filePath))\n if (filter != null && !filter(filePath, stat)) {\n return null\n }\n\n if (!stat.isDirectory()) {\n metadata.set(filePath, stat)\n }\n const consumerResult = this.handleFile(filePath, dirPath, stat)\n if (consumerResult == null) {\n if (stat.isDirectory()) {\n dirs.push(name)\n return null\n } else {\n return filePath\n }\n } else {\n return consumerResult.then(it => {\n // asarUtil can return modified stat (symlink handling)\n if ((it == null ? stat : it).isDirectory()) {\n dirs.push(name)\n return null\n } else {\n return filePath\n }\n })\n }\n })\n })\n\n let isEmpty = true\n for (const child of sortedFilePaths) {\n if (child != null) {\n result.push(child)\n if (this.metadata.get(child)?.isSymbolicLink()) {\n symlinkFiles.set(child, result.length - 1)\n }\n isEmpty = false\n }\n }\n\n if (isEmpty) {\n emptyDirs.add(dirPath)\n }\n\n dirs.sort()\n for (const child of dirs) {\n queue.push(dirPath + path.sep + child)\n }\n }\n\n for (const [file, index] of symlinkFiles) {\n const resolvedPath = realpathSync(file)\n if (emptyDirs.has(resolvedPath)) {\n // delete symlink file if target is a empty dir\n result[index] = undefined\n }\n }\n return result.filter((it): it is string => it !== undefined)\n }\n}\n"]}
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
import { FileTransformer } from "builder-util";
|
|
1
|
+
import { ExternalLinkPolicy, FileTransformer } from "builder-util";
|
|
2
2
|
import { Stats } from "fs";
|
|
3
3
|
import { FileMatcher } from "../fileMatcher.js";
|
|
4
|
+
import { PM } from "../node-module-collector/index.js";
|
|
5
|
+
import { ModuleManager } from "../node-module-collector/moduleManager.js";
|
|
4
6
|
import { Packager } from "../packager.js";
|
|
5
7
|
import { PlatformPackager } from "../platformPackager.js";
|
|
8
|
+
import { NodeModuleInfo } from "../node-module-collector/types.js";
|
|
6
9
|
export declare function getDestinationPath(file: string, fileSet: ResolvedFileSet): string;
|
|
7
|
-
export
|
|
10
|
+
export interface CopyAppFilesOptions {
|
|
11
|
+
/** Every file, directory and symlink is written inside it, checked by its real path: the resources directory of the app. */
|
|
12
|
+
readonly containmentRoot: string;
|
|
13
|
+
/** The real paths files may be copied from, see `getTrustedSourceRoots`. Each file is checked when given. */
|
|
14
|
+
readonly trustedSourceRoots?: ReadonlyArray<string> | null;
|
|
15
|
+
/** The `fileOptions.allowExternalLinks` build option: allows a file outside the trusted source roots, or a kept symlink that leaves the containment root. */
|
|
16
|
+
readonly externalLinks?: ExternalLinkPolicy | null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Copies the files of the app when they are not packed into an asar archive. Like the asar packer, it refuses a file whose real path is
|
|
20
|
+
* outside the trusted source roots, writes only inside the containment root, checked by real path, and recreates a symlink only when it
|
|
21
|
+
* stays inside the containment root.
|
|
22
|
+
*/
|
|
23
|
+
export declare function copyAppFiles(fileSet: ResolvedFileSet, packager: Pick<Packager, "cancellationToken">, transformer: FileTransformer, options?: CopyAppFilesOptions | null): Promise<void>;
|
|
8
24
|
export interface ResolvedFileSet {
|
|
9
25
|
src: string;
|
|
10
26
|
destination: string;
|
|
@@ -14,4 +30,53 @@ export interface ResolvedFileSet {
|
|
|
14
30
|
}
|
|
15
31
|
export declare function transformFiles(transformer: FileTransformer, fileSet: ResolvedFileSet): Promise<void>;
|
|
16
32
|
export declare function computeFileSets(matchers: Array<FileMatcher>, transformer: FileTransformer | null, platformPackager: PlatformPackager<any>): Promise<Array<ResolvedFileSet>>;
|
|
33
|
+
type CollectedNodeModules = {
|
|
34
|
+
nodeModules: NodeModuleInfo[];
|
|
35
|
+
logSummary: ModuleManager["logSummary"];
|
|
36
|
+
};
|
|
37
|
+
/** Runs a single package-manager collector against a single directory. */
|
|
38
|
+
type CollectorRunner = (pm: PM, dir: string) => Promise<CollectedNodeModules>;
|
|
39
|
+
/**
|
|
40
|
+
* Determines whether a collected module tree actually describes the package being built.
|
|
41
|
+
*
|
|
42
|
+
* A package-manager `list` invocation can resolve to the wrong project root — most notably when
|
|
43
|
+
* electron-builder is run from a workspace sub-package whose dependencies are hoisted to the
|
|
44
|
+
* workspace root (#9945) — or a collector can resolve the root node to the wrong package (e.g. an
|
|
45
|
+
* app named like one of its own dependencies, #10277). In both cases the collector returns a
|
|
46
|
+
* non-empty but wrong tree. Accepting it would suppress the manual-traversal fallback that resolves
|
|
47
|
+
* the correct modules, so we need to tell a matching collection from a mismatched one.
|
|
48
|
+
*
|
|
49
|
+
* Only the package's declared external (registry-installed, non-`workspace:`/`file:`/`link:`/`portal:`)
|
|
50
|
+
* production `dependencies` are checked; they are always placed at the top level of a correct
|
|
51
|
+
* collection. A collection matches when:
|
|
52
|
+
* - at least one of them is present at the top level, and
|
|
53
|
+
* - every one of them is either present at the top level (including modules flagged `excluded` by
|
|
54
|
+
* `ignoredProductionDependencies`) or reported in the collection's own `logSummary` as
|
|
55
|
+
* legitimately absent: dropped by the arch/platform filter, missing on disk (enforced later by
|
|
56
|
+
* `allowMissingDependencies`), a missing optional/platform-specific package, excluded as ignored,
|
|
57
|
+
* or a self-reference.
|
|
58
|
+
*
|
|
59
|
+
* When the package declares no external production dependencies there is nothing to validate
|
|
60
|
+
* against, so any non-empty collection is accepted.
|
|
61
|
+
*/
|
|
62
|
+
export declare function collectionMatchesAppDependencies(nodeModules: NodeModuleInfo[], dependencies: Record<string, string> | undefined, logSummary?: ModuleManager["logSummary"]): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Walks the candidate (package-manager, directory) combinations and returns the first collection
|
|
65
|
+
* that both contains modules and matches the package being built (see
|
|
66
|
+
* {@link collectionMatchesAppDependencies}). A non-empty collection that does NOT match — e.g. a
|
|
67
|
+
* workspace-root tree returned for a sub-package — is retained only as a last-resort fallback so a
|
|
68
|
+
* later approach (notably {@link PM.TRAVERSAL}) can supply the correct modules.
|
|
69
|
+
*
|
|
70
|
+
* An approach that throws (e.g. the package manager exited without producing its dependency tree,
|
|
71
|
+
* issue #10208) is logged as a warning and skipped so the remaining approaches still run. If every
|
|
72
|
+
* approach fails to produce a collection and at least one threw, the first error is rethrown rather
|
|
73
|
+
* than silently reporting "no node modules".
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolveFirstMatchingCollection(options: {
|
|
76
|
+
pmApproaches: PM[];
|
|
77
|
+
searchDirectories: string[];
|
|
78
|
+
dependencies: Record<string, string> | undefined;
|
|
79
|
+
run: CollectorRunner;
|
|
80
|
+
}): Promise<CollectedNodeModules | undefined>;
|
|
81
|
+
export {};
|
|
17
82
|
//# sourceMappingURL=appFileCopier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appFileCopier.d.ts","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"appFileCopier.d.ts","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,kBAAkB,EAElB,eAAe,EAUhB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAA;AAO1B,OAAO,EAA+B,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAAgC,EAAE,EAAE,MAAM,mCAAmC,CAAA;AACpF,OAAO,EAAyC,aAAa,EAAE,MAAM,2CAA2C,CAAA;AAChH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACz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,CAAC,CAkBjL;AAkED,KAAK,oBAAoB,GAAG;IAAE,WAAW,EAAE,cAAc,EAAE,CAAC;IAAC,UAAU,EAAE,aAAa,CAAC,YAAY,CAAC,CAAA;CAAE,CAAA;AAEtG,0EAA0E;AAC1E,KAAK,eAAe,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAA;AA0B7E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,cAAc,EAAE,EAC7B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAChD,UAAU,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,GACvC,OAAO,CAaT;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,8BAA8B,CAAC,OAAO,EAAE;IAC5D,YAAY,EAAE,EAAE,EAAE,CAAA;IAClB,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAC3B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAA;IAChD,GAAG,EAAE,eAAe,CAAA;CACrB,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAgC5C"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { AsyncTaskManager, FileCopier, isEmptyOrSpaces, log, MAX_FILE_REQUESTS, statOrNull, walk } from "builder-util";
|
|
1
|
+
import { assertCopiedSymlinksContained, AsyncTaskManager, FileCopier, InvalidConfigurationError, isEmptyOrSpaces, log, MAX_FILE_REQUESTS, rebaseCopiedSymlinkTarget, statOrNull, walk, WriteContainment, } from "builder-util";
|
|
2
|
+
import { DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES } from "../configuration.js";
|
|
2
3
|
import fsExtra from "fs-extra";
|
|
3
|
-
import {
|
|
4
|
+
import { readlink } from "fs/promises";
|
|
4
5
|
import * as path from "path";
|
|
5
6
|
import asyncPool from "tiny-async-pool";
|
|
6
7
|
import { isLibOrExe } from "../asar/unpackDetector.js";
|
|
7
8
|
import { Platform } from "../core.js";
|
|
8
|
-
import {
|
|
9
|
+
import { DEFAULT_EXCLUDED_EXTENSIONS, FileMatcher } from "../fileMatcher.js";
|
|
9
10
|
import { getCollectorByPackageManager, PM } from "../node-module-collector/index.js";
|
|
10
|
-
import { logMessageLevelByKey } from "../node-module-collector/moduleManager.js";
|
|
11
|
+
import { LogMessageByKey, logMessageLevelByKey } from "../node-module-collector/moduleManager.js";
|
|
11
12
|
import { AppFileWalker } from "./AppFileWalker.js";
|
|
12
13
|
import { NodeModuleCopyHelper } from "./NodeModuleCopyHelper.js";
|
|
14
|
+
import { archToNodeCpu } from "./archCompatibility.js";
|
|
15
|
+
import { assertSourceFileInTrustedRoots } from "./trustedSourceRoots.js";
|
|
13
16
|
export function getDestinationPath(file, fileSet) {
|
|
14
17
|
if (file === fileSet.src) {
|
|
15
18
|
return fileSet.destination;
|
|
@@ -17,16 +20,22 @@ export function getDestinationPath(file, fileSet) {
|
|
|
17
20
|
const src = fileSet.src;
|
|
18
21
|
const dest = fileSet.destination;
|
|
19
22
|
// get node_modules path relative to src and then append to dest
|
|
20
|
-
if (file.startsWith(src)) {
|
|
23
|
+
if (file.startsWith(src + path.sep)) {
|
|
21
24
|
return path.join(dest, path.relative(src, file));
|
|
22
25
|
}
|
|
23
26
|
return dest;
|
|
24
27
|
}
|
|
25
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Copies the files of the app when they are not packed into an asar archive. Like the asar packer, it refuses a file whose real path is
|
|
30
|
+
* outside the trusted source roots, writes only inside the containment root, checked by real path, and recreates a symlink only when it
|
|
31
|
+
* stays inside the containment root.
|
|
32
|
+
*/
|
|
33
|
+
export async function copyAppFiles(fileSet, packager, transformer, options) {
|
|
26
34
|
const metadata = fileSet.metadata;
|
|
27
35
|
// search auto unpacked dir
|
|
28
36
|
const taskManager = new AsyncTaskManager(packager.cancellationToken);
|
|
29
|
-
const
|
|
37
|
+
const containment = new WriteContainment(options?.containmentRoot ?? fileSet.destination, "app file");
|
|
38
|
+
const trustedSourceRoots = options?.trustedSourceRoots;
|
|
30
39
|
const fileCopier = new FileCopier(file => {
|
|
31
40
|
return !isLibOrExe(file);
|
|
32
41
|
}, transformer);
|
|
@@ -38,16 +47,16 @@ export async function copyAppFiles(fileSet, packager, transformer) {
|
|
|
38
47
|
// dir
|
|
39
48
|
continue;
|
|
40
49
|
}
|
|
50
|
+
if (trustedSourceRoots != null) {
|
|
51
|
+
await assertSourceFileInTrustedRoots(sourceFile, trustedSourceRoots, options?.externalLinks);
|
|
52
|
+
}
|
|
41
53
|
const destinationFile = getDestinationPath(sourceFile, fileSet);
|
|
42
54
|
if (stat.isSymbolicLink()) {
|
|
43
|
-
links.push({ file: destinationFile, link: await readlink(sourceFile) });
|
|
55
|
+
links.push({ file: destinationFile, link: rebaseCopiedSymlinkTarget(fileSet.src, sourceFile, await readlink(sourceFile)), source: sourceFile });
|
|
44
56
|
continue;
|
|
45
57
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
createdParentDirs.add(fileParent);
|
|
49
|
-
await mkdir(fileParent, { recursive: true });
|
|
50
|
-
}
|
|
58
|
+
// creates the directory once, checked by its real path, and removes a symlink planted at the destination
|
|
59
|
+
await containment.prepareFile(destinationFile);
|
|
51
60
|
taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat));
|
|
52
61
|
if (taskManager.tasks.length > MAX_FILE_REQUESTS) {
|
|
53
62
|
await taskManager.awaitTasks();
|
|
@@ -56,7 +65,12 @@ export async function copyAppFiles(fileSet, packager, transformer) {
|
|
|
56
65
|
if (taskManager.tasks.length > 0) {
|
|
57
66
|
await taskManager.awaitTasks();
|
|
58
67
|
}
|
|
59
|
-
await asyncPool(MAX_FILE_REQUESTS, links, it =>
|
|
68
|
+
await asyncPool(MAX_FILE_REQUESTS, links, async (it) => {
|
|
69
|
+
await containment.prepareFile(it.file);
|
|
70
|
+
await fsExtra.ensureSymlink(it.link, it.file);
|
|
71
|
+
});
|
|
72
|
+
// the walker follows a symlink that leaves the app directory and copies what it points to, so a symlink kept as it is has to stay inside
|
|
73
|
+
await assertCopiedSymlinksContained(containment, links, [], "app file", options?.externalLinks);
|
|
60
74
|
}
|
|
61
75
|
// used only for ASAR, if no asar, file transformed on the fly
|
|
62
76
|
export async function transformFiles(transformer, fileSet) {
|
|
@@ -109,7 +123,7 @@ export async function computeFileSets(matchers, transformer, platformPackager) {
|
|
|
109
123
|
}
|
|
110
124
|
function getNodeModuleExcludedExts(platformPackager) {
|
|
111
125
|
// do not exclude *.h files (https://github.com/electron-userland/electron-builder/issues/2852)
|
|
112
|
-
const result =
|
|
126
|
+
const result = DEFAULT_EXCLUDED_EXTENSIONS.map(it => `.${it}`);
|
|
113
127
|
if (platformPackager.config.includePdb !== true) {
|
|
114
128
|
result.push(".pdb");
|
|
115
129
|
}
|
|
@@ -127,14 +141,18 @@ function validateFileSet(fileSet) {
|
|
|
127
141
|
return fileSet;
|
|
128
142
|
}
|
|
129
143
|
/** @internal */
|
|
130
|
-
export async function computeNodeModuleFileSets(platformPackager, mainMatcher) {
|
|
131
|
-
const deps = await collectNodeModulesWithLogging(platformPackager);
|
|
144
|
+
export async function computeNodeModuleFileSets(platformPackager, mainMatcher, arch, applyArchFilter = true) {
|
|
145
|
+
const deps = await collectNodeModulesWithLogging(platformPackager, applyArchFilter ? arch : null);
|
|
132
146
|
const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager);
|
|
133
147
|
// serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure
|
|
134
148
|
const result = new Array();
|
|
135
149
|
let index = 0;
|
|
136
150
|
const NODE_MODULES = "node_modules";
|
|
137
151
|
const collectNodeModules = async (dep, destination) => {
|
|
152
|
+
// Ignore excluded dependencies.
|
|
153
|
+
if (dep.excluded) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
138
156
|
const source = dep.dir;
|
|
139
157
|
const matcher = new FileMatcher(source, destination, mainMatcher.macroExpander, mainMatcher.patterns);
|
|
140
158
|
const copier = new NodeModuleCopyHelper(matcher, platformPackager);
|
|
@@ -153,29 +171,191 @@ export async function computeNodeModuleFileSets(platformPackager, mainMatcher) {
|
|
|
153
171
|
}
|
|
154
172
|
return result;
|
|
155
173
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
174
|
+
// `workspace:`/`file:`/`link:`/`portal:` dependencies are symlinked into place rather than
|
|
175
|
+
// installed as standalone, hoistable packages, so they may legitimately be absent from a
|
|
176
|
+
// collected tree and cannot be used to validate it.
|
|
177
|
+
const LOCAL_DEPENDENCY_SPEC = /^(?:workspace|file|link|portal):/;
|
|
178
|
+
// Log-summary buckets in which a collector reports a declared dependency it deliberately or
|
|
179
|
+
// unavoidably left out of the collected tree. A direct dependency recorded in one of these is
|
|
180
|
+
// accounted for even though it is absent from the top level of an otherwise correct collection.
|
|
181
|
+
const ACCOUNTED_ABSENT_DEPENDENCY_KEYS = [
|
|
182
|
+
// dropped by the target arch/platform filter (`archFilter`, package.json `cpu`/`os`)
|
|
183
|
+
LogMessageByKey.PKG_INCOMPATIBLE_PLATFORM,
|
|
184
|
+
// not installed / not resolvable on disk — whether that is fatal is decided afterwards by
|
|
185
|
+
// `allowMissingDependencies` (see enforceAllowMissingDependencies), not by collection matching
|
|
186
|
+
LogMessageByKey.PKG_NOT_FOUND,
|
|
187
|
+
LogMessageByKey.PKG_NOT_ON_DISK,
|
|
188
|
+
LogMessageByKey.PKG_OPTIONAL_NOT_INSTALLED,
|
|
189
|
+
LogMessageByKey.PKG_OPTIONAL_PLATFORM_NOT_INSTALLED,
|
|
190
|
+
// excluded via `ignoredProductionDependencies` (such modules normally stay in the tree flagged
|
|
191
|
+
// `excluded`, so this only matters if a collector ever drops them instead)
|
|
192
|
+
LogMessageByKey.PKG_EXCLUDED_IGNORED,
|
|
193
|
+
// a dependency that resolves to the package itself is skipped rather than collected
|
|
194
|
+
LogMessageByKey.PKG_SELF_REF,
|
|
195
|
+
];
|
|
196
|
+
/**
|
|
197
|
+
* Determines whether a collected module tree actually describes the package being built.
|
|
198
|
+
*
|
|
199
|
+
* A package-manager `list` invocation can resolve to the wrong project root — most notably when
|
|
200
|
+
* electron-builder is run from a workspace sub-package whose dependencies are hoisted to the
|
|
201
|
+
* workspace root (#9945) — or a collector can resolve the root node to the wrong package (e.g. an
|
|
202
|
+
* app named like one of its own dependencies, #10277). In both cases the collector returns a
|
|
203
|
+
* non-empty but wrong tree. Accepting it would suppress the manual-traversal fallback that resolves
|
|
204
|
+
* the correct modules, so we need to tell a matching collection from a mismatched one.
|
|
205
|
+
*
|
|
206
|
+
* Only the package's declared external (registry-installed, non-`workspace:`/`file:`/`link:`/`portal:`)
|
|
207
|
+
* production `dependencies` are checked; they are always placed at the top level of a correct
|
|
208
|
+
* collection. A collection matches when:
|
|
209
|
+
* - at least one of them is present at the top level, and
|
|
210
|
+
* - every one of them is either present at the top level (including modules flagged `excluded` by
|
|
211
|
+
* `ignoredProductionDependencies`) or reported in the collection's own `logSummary` as
|
|
212
|
+
* legitimately absent: dropped by the arch/platform filter, missing on disk (enforced later by
|
|
213
|
+
* `allowMissingDependencies`), a missing optional/platform-specific package, excluded as ignored,
|
|
214
|
+
* or a self-reference.
|
|
215
|
+
*
|
|
216
|
+
* When the package declares no external production dependencies there is nothing to validate
|
|
217
|
+
* against, so any non-empty collection is accepted.
|
|
218
|
+
*/
|
|
219
|
+
export function collectionMatchesAppDependencies(nodeModules, dependencies, logSummary) {
|
|
220
|
+
const requiredExternalDeps = Object.entries(dependencies ?? {})
|
|
221
|
+
.filter(([, spec]) => !LOCAL_DEPENDENCY_SPEC.test(spec))
|
|
222
|
+
.map(([name]) => name);
|
|
223
|
+
if (requiredExternalDeps.length === 0) {
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
const collected = new Set(nodeModules.map(it => it.name));
|
|
227
|
+
if (!requiredExternalDeps.some(name => collected.has(name))) {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
const accountedAbsent = new Set(ACCOUNTED_ABSENT_DEPENDENCY_KEYS.flatMap(key => logSummary?.[key] ?? []).map(dependencyNameFromSummaryId));
|
|
231
|
+
return requiredExternalDeps.every(name => collected.has(name) || accountedAbsent.has(name));
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Walks the candidate (package-manager, directory) combinations and returns the first collection
|
|
235
|
+
* that both contains modules and matches the package being built (see
|
|
236
|
+
* {@link collectionMatchesAppDependencies}). A non-empty collection that does NOT match — e.g. a
|
|
237
|
+
* workspace-root tree returned for a sub-package — is retained only as a last-resort fallback so a
|
|
238
|
+
* later approach (notably {@link PM.TRAVERSAL}) can supply the correct modules.
|
|
239
|
+
*
|
|
240
|
+
* An approach that throws (e.g. the package manager exited without producing its dependency tree,
|
|
241
|
+
* issue #10208) is logged as a warning and skipped so the remaining approaches still run. If every
|
|
242
|
+
* approach fails to produce a collection and at least one threw, the first error is rethrown rather
|
|
243
|
+
* than silently reporting "no node modules".
|
|
244
|
+
*/
|
|
245
|
+
export async function resolveFirstMatchingCollection(options) {
|
|
246
|
+
const { pmApproaches, searchDirectories, dependencies, run } = options;
|
|
247
|
+
let fallback;
|
|
248
|
+
let firstError;
|
|
161
249
|
for (const pm of pmApproaches) {
|
|
162
250
|
for (const dir of searchDirectories) {
|
|
163
251
|
log.info({ pm, searchDir: dir }, "searching for node modules");
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
252
|
+
let deps;
|
|
253
|
+
try {
|
|
254
|
+
deps = await run(pm, dir);
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
log.warn({ pm, searchDir: dir, error: error?.message ?? String(error) }, "node module collection failed, trying next search directory/approach");
|
|
258
|
+
firstError ??= error instanceof Error ? error : new Error(String(error));
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
if (deps.nodeModules.length === 0) {
|
|
262
|
+
log.info({ pm, searchDir: dir }, "no node modules found in collection, trying next search directory");
|
|
263
|
+
continue;
|
|
168
264
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
265
|
+
if (collectionMatchesAppDependencies(deps.nodeModules, dependencies, deps.logSummary)) {
|
|
266
|
+
log.debug({ pm, searchDir: dir, depCount: deps.nodeModules.length }, "collected node modules");
|
|
267
|
+
return deps;
|
|
172
268
|
}
|
|
269
|
+
log.info({ pm, searchDir: dir }, "collected node modules do not match the target package, trying next search directory/approach");
|
|
270
|
+
fallback ??= deps;
|
|
173
271
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
272
|
+
}
|
|
273
|
+
if (fallback == null && firstError != null) {
|
|
274
|
+
throw firstError;
|
|
275
|
+
}
|
|
276
|
+
return fallback;
|
|
277
|
+
}
|
|
278
|
+
/** Extracts the package name from a `name@version` log-summary entry, handling `@scope/name@version`. */
|
|
279
|
+
function dependencyNameFromSummaryId(id) {
|
|
280
|
+
let at;
|
|
281
|
+
if (id.startsWith("@")) {
|
|
282
|
+
// Scoped package: the version separator is the first `@` after the scope's `/`
|
|
283
|
+
const slashIndex = id.indexOf("/");
|
|
284
|
+
if (slashIndex === -1) {
|
|
285
|
+
return id;
|
|
177
286
|
}
|
|
287
|
+
at = id.indexOf("@", slashIndex + 1);
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
at = id.indexOf("@");
|
|
178
291
|
}
|
|
292
|
+
return at > 0 ? id.slice(0, at) : id;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Enforces {@link CommonConfiguration.allowMissingDependencies} against the finished collection
|
|
296
|
+
* summary (issue #10058). Runs only after collection completes, so the error reports the COMPLETE
|
|
297
|
+
* set of missing production dependencies at once instead of failing on the first one.
|
|
298
|
+
*
|
|
299
|
+
* Fail-closed by default: `false`, `null` and omitted all fail the build when a production
|
|
300
|
+
* dependency is missing; `true` restores the historical warn-only behavior. When the option is a
|
|
301
|
+
* `string[]`, only the listed dependency names are allowed to be missing — matched against the
|
|
302
|
+
* package name parsed from the summary's `name@version` entries (scoped names included), with an
|
|
303
|
+
* exact-entry match accepted as well.
|
|
304
|
+
*
|
|
305
|
+
* Only genuinely missing production dependencies (`PKG_NOT_FOUND` / `PKG_NOT_ON_DISK`) are fatal;
|
|
306
|
+
* missing optional dependencies (`PKG_OPTIONAL_NOT_INSTALLED` / `PKG_OPTIONAL_PLATFORM_NOT_INSTALLED`)
|
|
307
|
+
* never fail the build.
|
|
308
|
+
*
|
|
309
|
+
* @internal exported for tests
|
|
310
|
+
*/
|
|
311
|
+
export function enforceAllowMissingDependencies(allowMissingDependencies, logSummary) {
|
|
312
|
+
if (allowMissingDependencies === true) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const missing = new Set([...(logSummary?.[LogMessageByKey.PKG_NOT_FOUND] ?? []), ...(logSummary?.[LogMessageByKey.PKG_NOT_ON_DISK] ?? [])]);
|
|
316
|
+
const allowed = new Set(Array.isArray(allowMissingDependencies) ? allowMissingDependencies : []);
|
|
317
|
+
const fatal = Array.from(missing)
|
|
318
|
+
.filter(id => !allowed.has(dependencyNameFromSummaryId(id)) && !allowed.has(id))
|
|
319
|
+
.sort();
|
|
320
|
+
if (fatal.length === 0) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
throw new InvalidConfigurationError(`The following production dependencies could not be resolved during node-module collection:\n` +
|
|
324
|
+
fatal.map(id => ` - ${id}`).join("\n") +
|
|
325
|
+
`\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).`);
|
|
326
|
+
}
|
|
327
|
+
/** @internal */
|
|
328
|
+
export async function collectNodeModulesWithLogging(platformPackager, arch) {
|
|
329
|
+
const { tempDirManager, appDir, projectDir } = platformPackager;
|
|
330
|
+
// Drop packages whose `package.json` `cpu`/`os` is incompatible with the target arch/platform while
|
|
331
|
+
// collecting (e.g. exclude `@esbuild/darwin-arm64` from the x64 slice). See NodeModulesCollector.
|
|
332
|
+
// `null` arch (universal slices) disables the filter so both slices stay symmetric for the merge.
|
|
333
|
+
const archFilter = arch == null ? undefined : { cpu: archToNodeCpu(arch), os: platformPackager.platform.nodeName };
|
|
334
|
+
const searchDirectories = Array.from(new Set([appDir, projectDir, await platformPackager.getWorkspaceRoot()])).filter((it) => isEmptyOrSpaces(it) === false);
|
|
335
|
+
const pmApproaches = [await platformPackager.getPackageManager(), PM.TRAVERSAL];
|
|
336
|
+
// The default-ignored packages are excluded from the copied `node_modules` — together with any
|
|
337
|
+
// transitive dependency they alone require — because electron-builder already provides them another
|
|
338
|
+
// way (the Electron runtime is embedded separately), so copying them would be redundant. They remain
|
|
339
|
+
// valid production dependencies for tooling such as SBOM generation. See NodeModulesCollector.getNodeModules.
|
|
340
|
+
const configuredIgnored = platformPackager.config.ignoredProductionDependencies;
|
|
341
|
+
const ignoredDependencies = configuredIgnored == null ? DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES : configuredIgnored;
|
|
342
|
+
// An app that declares no production dependencies at all (neither as-installed nor via
|
|
343
|
+
// `extraMetadata`) has nothing to bundle. Without this guard the search would skip the app's
|
|
344
|
+
// empty `node_modules`, climb to the workspace root, and the vacuous match in
|
|
345
|
+
// `collectionMatchesAppDependencies` would accept the entire hoisted workspace tree (#10033).
|
|
346
|
+
const declaredDependencies = Object.keys({ ...platformPackager.originalMetadata.dependencies, ...platformPackager.metadata.dependencies });
|
|
347
|
+
if (declaredDependencies.length === 0) {
|
|
348
|
+
log.info(null, "app has no production dependencies, skipping node_modules bundling");
|
|
349
|
+
return [];
|
|
350
|
+
}
|
|
351
|
+
// Validate against the as-declared (pre-extraMetadata) production dependencies so a configured
|
|
352
|
+
// `extraMetadata.dependencies` entry that isn't installed cannot reject a correct collection.
|
|
353
|
+
const deps = await resolveFirstMatchingCollection({
|
|
354
|
+
pmApproaches,
|
|
355
|
+
searchDirectories,
|
|
356
|
+
dependencies: platformPackager.originalMetadata.dependencies,
|
|
357
|
+
run: (pm, dir) => getCollectorByPackageManager(pm, dir, tempDirManager).getNodeModules({ packageName: platformPackager.nodePackageName, archFilter, ignoredDependencies }),
|
|
358
|
+
});
|
|
179
359
|
if (!deps?.nodeModules?.length) {
|
|
180
360
|
log.warn({ searchDirectories: searchDirectories.map(it => log.filePath(it)) }, "no node modules returned while searching directories");
|
|
181
361
|
return [];
|
|
@@ -185,6 +365,38 @@ async function collectNodeModulesWithLogging(platformPackager) {
|
|
|
185
365
|
const logLevel = logMessageLevelByKey[errorMessage] || "debug";
|
|
186
366
|
log[logLevel]({ dependencies }, errorMessage);
|
|
187
367
|
}
|
|
368
|
+
// Fail-closed enforcement (issue #10058): collection is complete and the summary above has reached
|
|
369
|
+
// the log, so failing here reports every missing production dependency at once.
|
|
370
|
+
enforceAllowMissingDependencies(platformPackager.config.allowMissingDependencies, deps.logSummary);
|
|
371
|
+
// Tripwire: the default-ignored packages are excluded because electron-builder already provides them
|
|
372
|
+
// (e.g. the embedded Electron runtime), so a copy in `node_modules` is redundant. They only reach this
|
|
373
|
+
// point unflagged when a user has removed them from `ignoredProductionDependencies`; record any that
|
|
374
|
+
// are therefore about to be copied (present but not marked `excluded`) so the summary below warns.
|
|
375
|
+
const bundledDefaultIgnored = deps.nodeModules.filter(it => !it.excluded && DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES.includes(it.name)).map(it => it.name);
|
|
376
|
+
if (bundledDefaultIgnored.length > 0) {
|
|
377
|
+
log.warn({ dependencies: bundledDefaultIgnored }, "copied dependencies that shouldn't be needed, see ignoredProductionDependencies");
|
|
378
|
+
}
|
|
379
|
+
warnAboutDeprecatedElectronPackages(deps.nodeModules);
|
|
188
380
|
return deps.nodeModules;
|
|
189
381
|
}
|
|
382
|
+
/**
|
|
383
|
+
* Long-deprecated Electron packages that v26 rejected outright as production dependencies.
|
|
384
|
+
*
|
|
385
|
+
* v27 dropped that guard without adding them to the default ignore list, so they are now copied into
|
|
386
|
+
* the app instead of failing the build — and `electron-prebuilt` drags a full second Electron binary
|
|
387
|
+
* (hundreds of MB) into app.asar with nothing in the log to explain the size jump.
|
|
388
|
+
*/
|
|
389
|
+
const DEPRECATED_ELECTRON_PACKAGES = {
|
|
390
|
+
"electron-prebuilt": "renamed to `electron` in 2016 — replace it with `electron`",
|
|
391
|
+
"electron-rebuild": "moved to `@electron/rebuild` — replace it and move it to devDependencies",
|
|
392
|
+
"electron-nightly": "a full Electron distribution — move it to devDependencies if it is not meant to ship",
|
|
393
|
+
};
|
|
394
|
+
function warnAboutDeprecatedElectronPackages(nodeModules) {
|
|
395
|
+
const bundled = nodeModules.filter(it => !it.excluded && it.name in DEPRECATED_ELECTRON_PACKAGES);
|
|
396
|
+
for (const { name } of bundled) {
|
|
397
|
+
log.warn({ dependency: name, solution: `add "${name}" to ignoredProductionDependencies, or move it to devDependencies` }, `${name} is declared in dependencies and is being packaged into your app (${DEPRECATED_ELECTRON_PACKAGES[name]}). ` +
|
|
398
|
+
"electron-builder <= 26 rejected this outright; v27 removed that guard and does not exclude it by default. " +
|
|
399
|
+
"See https://www.electron.build/docs/migration/v27-breaking-changes#electron-prebuilt-electron-rebuild-no-longer-error-and-are-not-excluded");
|
|
400
|
+
}
|
|
401
|
+
}
|
|
190
402
|
//# sourceMappingURL=appFileCopier.js.map
|