app-builder-lib 27.0.0-alpha.13 → 27.0.0-alpha.15

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.
Files changed (203) hide show
  1. package/dist/codeSign/win/hsmSignManager.d.ts.map +1 -1
  2. package/dist/codeSign/win/hsmSignManager.js +3 -2
  3. package/dist/codeSign/win/hsmSignManager.js.map +1 -1
  4. package/dist/codeSign/win/pkcs11SignManager.d.ts.map +1 -1
  5. package/dist/codeSign/win/pkcs11SignManager.js +2 -1
  6. package/dist/codeSign/win/pkcs11SignManager.js.map +1 -1
  7. package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
  8. package/dist/codeSign/win/signtoolBaseSignManager.js +15 -5
  9. package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
  10. package/dist/configuration.d.ts +78 -20
  11. package/dist/configuration.d.ts.map +1 -1
  12. package/dist/configuration.js.map +1 -1
  13. package/dist/indexInternal.d.ts +5 -3
  14. package/dist/indexInternal.d.ts.map +1 -1
  15. package/dist/indexInternal.js +4 -3
  16. package/dist/indexInternal.js.map +1 -1
  17. package/dist/options/FileAssociation.d.ts +1 -1
  18. package/dist/options/FileAssociation.js.map +1 -1
  19. package/dist/options/PlatformSpecificBuildOptions.d.ts +4 -1
  20. package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
  21. package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
  22. package/dist/options/SnapOptions.d.ts +13 -3
  23. package/dist/options/SnapOptions.d.ts.map +1 -1
  24. package/dist/options/SnapOptions.js.map +1 -1
  25. package/dist/options/macOptions.d.ts +9 -6
  26. package/dist/options/macOptions.d.ts.map +1 -1
  27. package/dist/options/macOptions.js.map +1 -1
  28. package/dist/options/winOptions.d.ts +2 -2
  29. package/dist/options/winOptions.js.map +1 -1
  30. package/dist/packager.d.ts +22 -0
  31. package/dist/packager.d.ts.map +1 -1
  32. package/dist/packager.js +115 -66
  33. package/dist/packager.js.map +1 -1
  34. package/dist/platformPackager.d.ts.map +1 -1
  35. package/dist/platformPackager.js +10 -8
  36. package/dist/platformPackager.js.map +1 -1
  37. package/dist/publish/PublishManager.d.ts +5 -0
  38. package/dist/publish/PublishManager.d.ts.map +1 -1
  39. package/dist/publish/PublishManager.js +102 -24
  40. package/dist/publish/PublishManager.js.map +1 -1
  41. package/dist/publish/manifestUploadCheck.d.ts +12 -0
  42. package/dist/publish/manifestUploadCheck.d.ts.map +1 -1
  43. package/dist/publish/manifestUploadCheck.js +84 -12
  44. package/dist/publish/manifestUploadCheck.js.map +1 -1
  45. package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
  46. package/dist/publish/updateInfoBuilder.js +12 -7
  47. package/dist/publish/updateInfoBuilder.js.map +1 -1
  48. package/dist/publish/updateManifestVerifier.d.ts +54 -0
  49. package/dist/publish/updateManifestVerifier.d.ts.map +1 -1
  50. package/dist/publish/updateManifestVerifier.js +121 -1
  51. package/dist/publish/updateManifestVerifier.js.map +1 -1
  52. package/dist/publish/updaterSettingsCheck.d.ts +8 -0
  53. package/dist/publish/updaterSettingsCheck.d.ts.map +1 -0
  54. package/dist/publish/updaterSettingsCheck.js +136 -0
  55. package/dist/publish/updaterSettingsCheck.js.map +1 -0
  56. package/dist/targets/ArchiveTarget.js +1 -1
  57. package/dist/targets/ArchiveTarget.js.map +1 -1
  58. package/dist/targets/archive.d.ts.map +1 -1
  59. package/dist/targets/archive.js +4 -3
  60. package/dist/targets/archive.js.map +1 -1
  61. package/dist/targets/blockmap/blockmap.d.ts +30 -0
  62. package/dist/targets/blockmap/blockmap.d.ts.map +1 -1
  63. package/dist/targets/blockmap/blockmap.js +99 -31
  64. package/dist/targets/blockmap/blockmap.js.map +1 -1
  65. package/dist/targets/blockmap/blockmapV3.d.ts +36 -0
  66. package/dist/targets/blockmap/blockmapV3.d.ts.map +1 -0
  67. package/dist/targets/blockmap/blockmapV3.js +41 -0
  68. package/dist/targets/blockmap/blockmapV3.js.map +1 -0
  69. package/dist/targets/blockmap/verbatimRange.d.ts +6 -0
  70. package/dist/targets/blockmap/verbatimRange.d.ts.map +1 -1
  71. package/dist/targets/blockmap/verbatimRange.js +11 -0
  72. package/dist/targets/blockmap/verbatimRange.js.map +1 -1
  73. package/dist/targets/differentialUpdateInfoBuilder.d.ts +92 -4
  74. package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
  75. package/dist/targets/differentialUpdateInfoBuilder.js +266 -10
  76. package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
  77. package/dist/targets/linux/FlatpakTarget.js +1 -1
  78. package/dist/targets/linux/FlatpakTarget.js.map +1 -1
  79. package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
  80. package/dist/targets/linux/FpmTarget.js +23 -31
  81. package/dist/targets/linux/FpmTarget.js.map +1 -1
  82. package/dist/targets/linux/LinuxTargetHelper.d.ts.map +1 -1
  83. package/dist/targets/linux/LinuxTargetHelper.js +6 -14
  84. package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
  85. package/dist/targets/linux/appimage/appLauncher.d.ts +4 -3
  86. package/dist/targets/linux/appimage/appLauncher.d.ts.map +1 -1
  87. package/dist/targets/linux/appimage/appLauncher.js +10 -6
  88. package/dist/targets/linux/appimage/appLauncher.js.map +1 -1
  89. package/dist/targets/linux/snap/coreLegacy.d.ts +8 -0
  90. package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
  91. package/dist/targets/linux/snap/coreLegacy.js +42 -9
  92. package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
  93. package/dist/targets/mac/pkg.d.ts.map +1 -1
  94. package/dist/targets/mac/pkg.js +13 -9
  95. package/dist/targets/mac/pkg.js.map +1 -1
  96. package/dist/targets/targetFactory.d.ts +22 -3
  97. package/dist/targets/targetFactory.d.ts.map +1 -1
  98. package/dist/targets/targetFactory.js +70 -29
  99. package/dist/targets/targetFactory.js.map +1 -1
  100. package/dist/targets/win/MsiTarget.d.ts +7 -0
  101. package/dist/targets/win/MsiTarget.d.ts.map +1 -1
  102. package/dist/targets/win/MsiTarget.js +140 -21
  103. package/dist/targets/win/MsiTarget.js.map +1 -1
  104. package/dist/targets/win/nsis/Defines.d.ts +1 -0
  105. package/dist/targets/win/nsis/Defines.d.ts.map +1 -1
  106. package/dist/targets/win/nsis/Defines.js.map +1 -1
  107. package/dist/targets/win/nsis/NsisTarget.d.ts +3 -0
  108. package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
  109. package/dist/targets/win/nsis/NsisTarget.js +33 -12
  110. package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
  111. package/dist/targets/win/nsis/nsisLicense.d.ts.map +1 -1
  112. package/dist/targets/win/nsis/nsisLicense.js +8 -5
  113. package/dist/targets/win/nsis/nsisLicense.js.map +1 -1
  114. package/dist/targets/win/nsis/nsisOptions.d.ts +31 -3
  115. package/dist/targets/win/nsis/nsisOptions.d.ts.map +1 -1
  116. package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
  117. package/dist/targets/win/nsis/nsisScriptGenerator.d.ts +6 -0
  118. package/dist/targets/win/nsis/nsisScriptGenerator.d.ts.map +1 -1
  119. package/dist/targets/win/nsis/nsisScriptGenerator.js +16 -5
  120. package/dist/targets/win/nsis/nsisScriptGenerator.js.map +1 -1
  121. package/dist/targets/win/nsis/nsisUtil.d.ts.map +1 -1
  122. package/dist/targets/win/nsis/nsisUtil.js +11 -29
  123. package/dist/targets/win/nsis/nsisUtil.js.map +1 -1
  124. package/dist/toolsets/7zip.d.ts +10 -0
  125. package/dist/toolsets/7zip.d.ts.map +1 -1
  126. package/dist/toolsets/7zip.js +12 -1
  127. package/dist/toolsets/7zip.js.map +1 -1
  128. package/dist/toolsets/appimage.d.ts +3 -0
  129. package/dist/toolsets/appimage.d.ts.map +1 -1
  130. package/dist/toolsets/appimage.js +4 -1
  131. package/dist/toolsets/appimage.js.map +1 -1
  132. package/dist/toolsets/archive.d.ts +13 -0
  133. package/dist/toolsets/archive.d.ts.map +1 -0
  134. package/dist/toolsets/archive.js +55 -0
  135. package/dist/toolsets/archive.js.map +1 -0
  136. package/dist/toolsets/custom.d.ts.map +1 -1
  137. package/dist/toolsets/custom.js +19 -2
  138. package/dist/toolsets/custom.js.map +1 -1
  139. package/dist/toolsets/fpm.d.ts +23 -0
  140. package/dist/toolsets/fpm.d.ts.map +1 -1
  141. package/dist/toolsets/fpm.js +52 -19
  142. package/dist/toolsets/fpm.js.map +1 -1
  143. package/dist/toolsets/nsis.d.ts +23 -4
  144. package/dist/toolsets/nsis.d.ts.map +1 -1
  145. package/dist/toolsets/nsis.js +49 -14
  146. package/dist/toolsets/nsis.js.map +1 -1
  147. package/dist/toolsets/winCodeSign.d.ts +20 -1
  148. package/dist/toolsets/winCodeSign.d.ts.map +1 -1
  149. package/dist/toolsets/winCodeSign.js +32 -5
  150. package/dist/toolsets/winCodeSign.js.map +1 -1
  151. package/dist/toolsets/wix.d.ts +44 -0
  152. package/dist/toolsets/wix.d.ts.map +1 -0
  153. package/dist/toolsets/wix.js +91 -0
  154. package/dist/toolsets/wix.js.map +1 -0
  155. package/dist/util/buildOutputVerifier.d.ts +2 -1
  156. package/dist/util/buildOutputVerifier.d.ts.map +1 -1
  157. package/dist/util/buildOutputVerifier.js +41 -63
  158. package/dist/util/buildOutputVerifier.js.map +1 -1
  159. package/dist/util/bundledTool.d.ts +8 -0
  160. package/dist/util/bundledTool.d.ts.map +1 -1
  161. package/dist/util/bundledTool.js +34 -0
  162. package/dist/util/bundledTool.js.map +1 -1
  163. package/dist/util/electronGet.d.ts.map +1 -1
  164. package/dist/util/electronGet.js +107 -10
  165. package/dist/util/electronGet.js.map +1 -1
  166. package/dist/util/electronUpdaterCompatibility.d.ts +64 -0
  167. package/dist/util/electronUpdaterCompatibility.d.ts.map +1 -0
  168. package/dist/util/electronUpdaterCompatibility.js +82 -0
  169. package/dist/util/electronUpdaterCompatibility.js.map +1 -0
  170. package/dist/util/flags.d.ts +5 -0
  171. package/dist/util/flags.d.ts.map +1 -1
  172. package/dist/util/flags.js +8 -2
  173. package/dist/util/flags.js.map +1 -1
  174. package/dist/util/mac/macosVersion.d.ts +0 -1
  175. package/dist/util/mac/macosVersion.d.ts.map +1 -1
  176. package/dist/util/mac/macosVersion.js +0 -21
  177. package/dist/util/mac/macosVersion.js.map +1 -1
  178. package/dist/util/packageMetadata.d.ts +14 -1
  179. package/dist/util/packageMetadata.d.ts.map +1 -1
  180. package/dist/util/packageMetadata.js +115 -51
  181. package/dist/util/packageMetadata.js.map +1 -1
  182. package/dist/util/removedEnvVars.js +1 -1
  183. package/dist/util/removedEnvVars.js.map +1 -1
  184. package/dist/version.d.ts +1 -1
  185. package/dist/version.js +1 -1
  186. package/dist/version.js.map +1 -1
  187. package/package.json +8 -8
  188. package/scheme.json +182 -49
  189. package/templates/msi/template.xml +5 -5
  190. package/templates/msiWrapped/template.xml +1 -1
  191. package/templates/nsis/assistedInstaller.nsh +37 -1
  192. package/templates/nsis/common.nsh +142 -1
  193. package/templates/nsis/include/installUtil.nsh +12 -0
  194. package/templates/nsis/include/installer.nsh +12 -0
  195. package/templates/nsis/installSection.nsh +3 -0
  196. package/templates/nsis/installer.nsi +25 -13
  197. package/templates/nsis/multiUser.nsh +50 -10
  198. package/templates/nsis/portable.nsi +1 -1
  199. package/templates/nsis/uninstaller.nsh +6 -0
  200. package/dist/toolsets/linuxToolsMac.d.ts +0 -8
  201. package/dist/toolsets/linuxToolsMac.d.ts.map +0 -1
  202. package/dist/toolsets/linuxToolsMac.js +0 -44
  203. package/dist/toolsets/linuxToolsMac.js.map +0 -1
@@ -3,6 +3,7 @@ import * as fs from "fs";
3
3
  import * as path from "path";
4
4
  import { lcid } from "../../../util/langs.js";
5
5
  import { getLicenseFiles, getNotLocalizedLicenseFile } from "../../../util/license.js";
6
+ import { nsisQuotePath } from "./nsisScriptGenerator.js";
6
7
  import { nsisTemplatesDir } from "./nsisUtil.js";
7
8
  function convertFileToUtf8WithBOMSync(filePath) {
8
9
  try {
@@ -41,11 +42,11 @@ export async function computeLicensePage(packager, options, scriptGenerator, lan
41
42
  ];
42
43
  }
43
44
  else {
44
- licensePage = [`!insertmacro MUI_PAGE_LICENSE "${license}"`];
45
+ licensePage = [`!insertmacro MUI_PAGE_LICENSE ${nsisQuotePath(license)}`];
45
46
  }
46
47
  scriptGenerator.macro("licensePage", licensePage);
47
48
  if (license.endsWith(".html")) {
48
- scriptGenerator.macro("addLicenseFiles", [`File /oname=$PLUGINSDIR\\license.html "${license}"`]);
49
+ scriptGenerator.macro("addLicenseFiles", [`File /oname=$PLUGINSDIR\\license.html ${nsisQuotePath(license)}`]);
49
50
  }
50
51
  return;
51
52
  }
@@ -57,15 +58,17 @@ export async function computeLicensePage(packager, options, scriptGenerator, lan
57
58
  const unspecifiedLangs = new Set(languages);
58
59
  let defaultFile = null;
59
60
  for (const item of licenseFiles) {
61
+ // checked before the file is rewritten with a BOM
62
+ const file = nsisQuotePath(item.file);
60
63
  unspecifiedLangs.delete(item.langWithRegion);
61
64
  convertFileToUtf8WithBOMSync(item.file);
62
65
  if (defaultFile == null) {
63
- defaultFile = item.file;
66
+ defaultFile = file;
64
67
  }
65
- licensePage.push(`LicenseLangString MUILicense ${lcid[item.langWithRegion] || item.lang} "${item.file}"`);
68
+ licensePage.push(`LicenseLangString MUILicense ${lcid[item.langWithRegion] || item.lang} ${file}`);
66
69
  }
67
70
  for (const l of unspecifiedLangs) {
68
- licensePage.push(`LicenseLangString MUILicense ${lcid[l]} "${defaultFile}"`);
71
+ licensePage.push(`LicenseLangString MUILicense ${lcid[l]} ${defaultFile}`);
69
72
  }
70
73
  licensePage.push('!insertmacro MUI_PAGE_LICENSE "$(MUILicense)"');
71
74
  scriptGenerator.macro("licensePage", licensePage);
@@ -1 +1 @@
1
- {"version":3,"file":"nsisLicense.js","sourceRoot":"","sources":["../../../../src/targets/win/nsis/nsisLicense.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAClC,OAAO,KAA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M;IACR,CAAC;IAED,MAAM,WAAW,GAAkB,EAAE,CAAA;IACrC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAA;IAE3C,IAAI,WAAW,GAAkB,IAAI,CAAA;IACrC,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;QAChC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;QAC5C,4BAA4B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACvC,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;YACxB,WAAW,GAAG,IAAI,CAAC,IAAI,CAAA;QACzB,CAAC;QACD,WAAW,CAAC,IAAI,CAAC,gCAAgC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC,CAAA;IAC3G,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,gBAAgB,EAAE,CAAC;QACjC,WAAW,CAAC,IAAI,CAAC,gCAAgC,IAAI,CAAC,CAAC,CAAC,KAAK,WAAW,GAAG,CAAC,CAAA;IAC9E,CAAC;IAED,WAAW,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAA;IACjE,eAAe,CAAC,KAAK,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;AACnD,CAAC","sourcesContent":["import { log } from \"builder-util\"\nimport * as fs from \"fs\"\nimport * as path from \"path\"\nimport { lcid } from \"../../../util/langs.js\"\nimport { getLicenseFiles, getNotLocalizedLicenseFile } from \"../../../util/license.js\"\nimport { WinPackager } from \"../../../winPackager.js\"\nimport { NsisOptions } from \"./nsisOptions.js\"\nimport { NsisScriptGenerator } from \"./nsisScriptGenerator.js\"\nimport { nsisTemplatesDir } from \"./nsisUtil.js\"\n\nfunction convertFileToUtf8WithBOMSync(filePath: string): boolean {\n try {\n const UTF8_BOM_HEADER = Buffer.from([0xef, 0xbb, 0xbf])\n const data = fs.readFileSync(filePath)\n\n // Check if the file already starts with a UTF-8 BOM\n log.debug({ file: log.filePath(filePath) }, \"checking file for BOM header\")\n if (data.length >= UTF8_BOM_HEADER.length && data.subarray(0, UTF8_BOM_HEADER.length).equals(UTF8_BOM_HEADER)) {\n log.debug({ file: log.filePath(filePath) }, \"file is already in BOM format, skipping conversion.\")\n return true\n }\n\n // If not, add the BOM\n const dataWithBOM = Buffer.concat([UTF8_BOM_HEADER, data])\n fs.writeFileSync(filePath, dataWithBOM)\n log.debug({ file: log.filePath(filePath) }, \"file successfully converted to UTF-8 with BOM\")\n return true\n } catch (err: any) {\n log.error({ file: log.filePath(filePath), message: err.message ?? err.stack }, \"unable to convert file to UTF-8 with BOM\")\n return false\n }\n}\n\nexport async function computeLicensePage(packager: WinPackager, options: NsisOptions, scriptGenerator: NsisScriptGenerator, languages: Array<string>): Promise<void> {\n const license = await getNotLocalizedLicenseFile(options.license, packager)\n if (license != null) {\n let licensePage: Array<string>\n if (license.endsWith(\".html\")) {\n licensePage = [\n \"!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicenseShow\",\n \"Function LicenseShow\",\n \" FindWindow $R0 `#32770` `` $HWNDPARENT\",\n \" GetDlgItem $R0 $R0 1000\",\n \"EmbedHTML::Load /replace $R0 file://$PLUGINSDIR\\\\license.html\",\n \"FunctionEnd\",\n\n `!insertmacro MUI_PAGE_LICENSE \"${path.join(nsisTemplatesDir, \"empty-license.txt\")}\"`,\n ]\n } else {\n licensePage = [`!insertmacro MUI_PAGE_LICENSE \"${license}\"`]\n }\n\n scriptGenerator.macro(\"licensePage\", licensePage)\n if (license.endsWith(\".html\")) {\n scriptGenerator.macro(\"addLicenseFiles\", [`File /oname=$PLUGINSDIR\\\\license.html \"${license}\"`])\n }\n return\n }\n\n const licenseFiles = await getLicenseFiles(packager)\n if (licenseFiles.length === 0) {\n return\n }\n\n const licensePage: Array<string> = []\n const unspecifiedLangs = new Set(languages)\n\n let defaultFile: string | null = null\n for (const item of licenseFiles) {\n unspecifiedLangs.delete(item.langWithRegion)\n convertFileToUtf8WithBOMSync(item.file)\n if (defaultFile == null) {\n defaultFile = item.file\n }\n licensePage.push(`LicenseLangString MUILicense ${lcid[item.langWithRegion] || item.lang} \"${item.file}\"`)\n }\n\n for (const l of unspecifiedLangs) {\n licensePage.push(`LicenseLangString MUILicense ${lcid[l]} \"${defaultFile}\"`)\n }\n\n licensePage.push('!insertmacro MUI_PAGE_LICENSE \"$(MUILicense)\"')\n scriptGenerator.macro(\"licensePage\", licensePage)\n}\n"]}
1
+ {"version":3,"file":"nsisLicense.js","sourceRoot":"","sources":["../../../../src/targets/win/nsis/nsisLicense.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAClC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAA;AAGtF,OAAO,EAAuB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,SAAS,4BAA4B,CAAC,QAAgB;IACpD,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;QACvD,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAA;QAEtC,oDAAoD;QACpD,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,8BAA8B,CAAC,CAAA;QAC3E,IAAI,IAAI,CAAC,MAAM,IAAI,eAAe,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,eAAe,CAAC,MA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jC,WAAW,CAAC,IAAI,CAAC,gCAAgC,IAAI,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAA;IAC5E,CAAC;IAED,WAAW,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAA;IACjE,eAAe,CAAC,KAAK,CAAC,aAAa,EAAE,WAAW,CAAC,CAAA;AACnD,CAAC","sourcesContent":["import { log } from \"builder-util\"\nimport * as fs from \"fs\"\nimport * as path from \"path\"\nimport { lcid } from \"../../../util/langs.js\"\nimport { getLicenseFiles, getNotLocalizedLicenseFile } from \"../../../util/license.js\"\nimport { WinPackager } from \"../../../winPackager.js\"\nimport { NsisOptions } from \"./nsisOptions.js\"\nimport { NsisScriptGenerator, nsisQuotePath } from \"./nsisScriptGenerator.js\"\nimport { nsisTemplatesDir } from \"./nsisUtil.js\"\n\nfunction convertFileToUtf8WithBOMSync(filePath: string): boolean {\n try {\n const UTF8_BOM_HEADER = Buffer.from([0xef, 0xbb, 0xbf])\n const data = fs.readFileSync(filePath)\n\n // Check if the file already starts with a UTF-8 BOM\n log.debug({ file: log.filePath(filePath) }, \"checking file for BOM header\")\n if (data.length >= UTF8_BOM_HEADER.length && data.subarray(0, UTF8_BOM_HEADER.length).equals(UTF8_BOM_HEADER)) {\n log.debug({ file: log.filePath(filePath) }, \"file is already in BOM format, skipping conversion.\")\n return true\n }\n\n // If not, add the BOM\n const dataWithBOM = Buffer.concat([UTF8_BOM_HEADER, data])\n fs.writeFileSync(filePath, dataWithBOM)\n log.debug({ file: log.filePath(filePath) }, \"file successfully converted to UTF-8 with BOM\")\n return true\n } catch (err: any) {\n log.error({ file: log.filePath(filePath), message: err.message ?? err.stack }, \"unable to convert file to UTF-8 with BOM\")\n return false\n }\n}\n\nexport async function computeLicensePage(packager: WinPackager, options: NsisOptions, scriptGenerator: NsisScriptGenerator, languages: Array<string>): Promise<void> {\n const license = await getNotLocalizedLicenseFile(options.license, packager)\n if (license != null) {\n let licensePage: Array<string>\n if (license.endsWith(\".html\")) {\n licensePage = [\n \"!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicenseShow\",\n \"Function LicenseShow\",\n \" FindWindow $R0 `#32770` `` $HWNDPARENT\",\n \" GetDlgItem $R0 $R0 1000\",\n \"EmbedHTML::Load /replace $R0 file://$PLUGINSDIR\\\\license.html\",\n \"FunctionEnd\",\n\n `!insertmacro MUI_PAGE_LICENSE \"${path.join(nsisTemplatesDir, \"empty-license.txt\")}\"`,\n ]\n } else {\n licensePage = [`!insertmacro MUI_PAGE_LICENSE ${nsisQuotePath(license)}`]\n }\n\n scriptGenerator.macro(\"licensePage\", licensePage)\n if (license.endsWith(\".html\")) {\n scriptGenerator.macro(\"addLicenseFiles\", [`File /oname=$PLUGINSDIR\\\\license.html ${nsisQuotePath(license)}`])\n }\n return\n }\n\n const licenseFiles = await getLicenseFiles(packager)\n if (licenseFiles.length === 0) {\n return\n }\n\n const licensePage: Array<string> = []\n const unspecifiedLangs = new Set(languages)\n\n let defaultFile: string | null = null\n for (const item of licenseFiles) {\n // checked before the file is rewritten with a BOM\n const file = nsisQuotePath(item.file)\n unspecifiedLangs.delete(item.langWithRegion)\n convertFileToUtf8WithBOMSync(item.file)\n if (defaultFile == null) {\n defaultFile = file\n }\n licensePage.push(`LicenseLangString MUILicense ${lcid[item.langWithRegion] || item.lang} ${file}`)\n }\n\n for (const l of unspecifiedLangs) {\n licensePage.push(`LicenseLangString MUILicense ${lcid[l]} ${defaultFile}`)\n }\n\n licensePage.push('!insertmacro MUI_PAGE_LICENSE \"$(MUILicense)\"')\n scriptGenerator.macro(\"licensePage\", licensePage)\n}\n"]}
@@ -33,10 +33,15 @@ export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerCo
33
33
  readonly oneClick?: boolean;
34
34
  /**
35
35
  * Whether to enable NSIS logging in the installer and uninstaller (`LogSet on`, which writes `install.log` to the installation
36
- * directory). In your custom NSIS scripts, write to the log via `${LogText}`.
36
+ * directory). The installer logs from the install of the files on (once the previous version is uninstalled); the uninstaller logs
37
+ * from its start and leaves the open `install.log` in place when an update moves the installation directory aside. In your custom
38
+ * NSIS scripts, write to the log via `${LogText}`; in `customInit` / `preInit` nothing is logged yet.
37
39
  *
38
- * Requires a log-enabled NSIS: `makensis` and its stubs compiled with `NSIS_CONFIG_LOG=yes`. The default `toolsets.nsis` bundle
39
- * is not log-enabled, so supply one as a custom `toolsets.nsis` bundle; the build fails otherwise.
40
+ * Requires a log-enabled NSIS: `makensis` and its stubs compiled with `NSIS_CONFIG_LOG=yes`. From `toolsets.nsis` `"2.0.4"` (the
41
+ * default) on, each NSIS release publishes a log-enabled bundle next to the default one, and electron-builder downloads it when this
42
+ * option is `true` (the default bundle otherwise). Its stubs make the installer and uninstaller up to about 8 KB larger, and they
43
+ * write a log only once `LogSet on` runs, which this option adds. The older pinned bundles (`"0.0.0"`, `"1.2.1"`) have no
44
+ * log-enabled variant, and the build fails with one of them. A custom `toolsets.nsis` bundle must be log-enabled itself.
40
45
  * Replaces the v26 `customNsisBinary.debugLogging`.
41
46
  * @see https://www.electron.build/docs/migration/v27-config-changes#customnsisbinary-and-customnsisresources-replaced-by-toolsetsnsis
42
47
  * @default false
@@ -64,6 +69,29 @@ export interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerCo
64
69
  * @default true
65
70
  */
66
71
  readonly allowElevation?: boolean;
72
+ /**
73
+ * *assisted installer only, with `perMachine` not set.* Let a silent update (`--updated`) of a per-machine installation run without a UAC
74
+ * prompt when the user already holds every access right the update uses. Off by default: the update elevates, as before.
75
+ *
76
+ * An update removes and re-creates the installation folder, the app's `HKLM` registration and the all-users shortcuts, so this applies
77
+ * only where an administrator granted standard users those rights: on the folder and its files, its parent folder, the
78
+ * `INSTALL_REGISTRY_KEY` and Uninstall keys and their parent keys (`HKLM\Software`,
79
+ * `HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall`), and the Start Menu folder and Public Desktop. The installer and
80
+ * the uninstaller check each right without changing anything, and elevate when one is missing, when a per-user installation exists too,
81
+ * and for an interactive install or uninstall.
82
+ *
83
+ * electron-builder does not recommend granting these rights: an unelevated process could then change the `UninstallString` that the
84
+ * elevated uninstaller, and deployment tools running as SYSTEM, later execute. The option is for machines whose administrators already
85
+ * did.
86
+ *
87
+ * An update runs the uninstaller of the installed version, so the first update to a build with this option still elevates.
88
+ *
89
+ * Not checked: `HKLM\Software\Classes` (file associations and protocols), writes made by `customInstall` or `customUnInstall`, and
90
+ * shortcuts or a Start Menu folder that an earlier version created under another name. Without elevation, a write there that is
91
+ * denied fails without an error, so leave this option off if the update needs one.
92
+ * @default false
93
+ */
94
+ readonly allowUnelevatedPerMachineUpdate?: boolean;
67
95
  /**
68
96
  * *assisted installer only.* Whether to allow user to change installation directory.
69
97
  * @default false
@@ -1 +1 @@
1
- {"version":3,"file":"nsisOptions.d.ts","sourceRoot":"","sources":["../../../../src/targets/win/nsis/nsisOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,yDAAyD,CAAA;AAC7G,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAExD,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAE1B;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAE7B;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAEnC;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,MAAM,WAAW,WAAY,SAAQ,iBAAiB,EAAE,mCAAmC,EAAE,qBAAqB;IAChH;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAE3B;;;;;;;;;OASG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAExC;;;;;;;;;OASG;IACH,QAAQ,CAAC,UAAU,CAA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;IAC/E;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;IAE7D;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAEzC;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAEpC;;;OAGG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAA;IAE1C;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;CACjD;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD;;;;;;;;;OASG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAEtC;;;;;;OAMG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAA;IAE5C;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAErC;;;OAGG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,IAAI,CAAA;CACxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"nsisOptions.js","sourceRoot":"","sources":["../../../../src/targets/win/nsis/nsisOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { CommonWindowsInstallerConfiguration } from \"../../../options/CommonWindowsInstallerConfiguration.js\"\nimport { TargetSpecificOptions } from \"../../../core.js\"\n\nexport interface CommonNsisOptions {\n /**\n * Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode).\n * @default true\n */\n readonly unicode?: boolean\n\n /**\n * The GUID for the installer. Used to identify the application for upgrade and uninstall operations.\n * If not specified, a deterministic GUID is generated from the app ID (`appId`) — but this means\n * changing your `appId` will break silent upgrades of existing installs.\n *\n * @see [GUID vs Application Name](https://www.electron.build/docs/nsis#guid-vs-application-name)\n */\n readonly guid?: string | null\n\n /**\n * If `warningsAsErrors` is `true` (default): NSIS will treat warnings as errors. If `warningsAsErrors` is `false`: NSIS will allow warnings.\n * @default true\n */\n readonly warningsAsErrors?: boolean\n\n /**\n * Use zip instead of 7z (LZMA) for the embedded app package. Only applies to portable targets and to installers built with `differentialPackage: false`; ignored (with a warning) when `differentialPackage` is enabled and for `nsis-web`, which always use 7z.\n * @default false\n */\n readonly useZip?: boolean\n}\n\nexport interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerConfiguration, TargetSpecificOptions {\n /**\n * Whether to create one-click installer or assisted.\n * @default true\n */\n readonly oneClick?: boolean\n\n /**\n * Whether to enable NSIS logging in the installer and uninstaller (`LogSet on`, which writes `install.log` to the installation\n * directory). In your custom NSIS scripts, write to the log via `${LogText}`.\n *\n * Requires a log-enabled NSIS: `makensis` and its stubs compiled with `NSIS_CONFIG_LOG=yes`. The default `toolsets.nsis` bundle\n * is not log-enabled, so supply one as a custom `toolsets.nsis` bundle; the build fails otherwise.\n * Replaces the v26 `customNsisBinary.debugLogging`.\n * @see https://www.electron.build/docs/migration/v27-config-changes#customnsisbinary-and-customnsisresources-replaced-by-toolsetsnsis\n * @default false\n */\n readonly installerDebugLogging?: boolean\n\n /**\n * Whether to show install mode installer page (choice per-machine or per-user) for assisted installer. Or whether installation always per all users (per-machine).\n *\n * If `oneClick` is `true` (default): Whether to install per all users (per-machine).\n *\n * If `oneClick` is `false` and `perMachine` is `true`: no install mode installer page, always install per-machine.\n *\n * If `oneClick` is `false` and `perMachine` is `false` (default): install mode installer page.\n * @default false\n */\n readonly perMachine?: boolean\n\n /**\n * Whether to set per-machine or per-user installation as default selection on the install mode installer page.\n *\n * @default false\n */\n readonly selectPerMachineByDefault?: boolean\n\n /**\n * *assisted installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions.\n * @default true\n */\n readonly allowElevation?: boolean\n\n /**\n * *assisted installer only.* Whether to allow user to change installation directory.\n * @default false\n */\n readonly allowToChangeInstallationDirectory?: boolean\n\n /**\n * *assisted installer only.* remove the default uninstall welcome page.\n * @default false\n */\n readonly removeDefaultUninstallWelcomePage?: boolean\n\n /**\n * The path to installer icon, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/installerIcon.ico` or application icon.\n */\n readonly installerIcon?: string | null\n /**\n * The path to uninstaller icon, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/uninstallerIcon.ico` or application icon.\n */\n readonly uninstallerIcon?: string | null\n /**\n * *assisted installer only.* `MUI_HEADERIMAGE`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * @default build/installerHeader.bmp\n */\n readonly installerHeader?: string | null\n /**\n * *one-click installer only.* The path to header icon (above the progress bar), relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/installerHeaderIcon.ico` or application icon.\n */\n readonly installerHeaderIcon?: string | null\n /**\n * *assisted installer only.* `MUI_WELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/installerSidebar.bmp` or `${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp`. Image size 164 × 314 pixels.\n */\n readonly installerSidebar?: string | null\n /**\n * *assisted installer only.* `MUI_UNWELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `installerSidebar` option or `build/uninstallerSidebar.bmp` or `build/installerSidebar.bmp` or `${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp`\n */\n readonly uninstallerSidebar?: string | null\n /**\n * The uninstaller display name in the control panel.\n * @default ${productName} ${version}\n */\n readonly uninstallDisplayName?: string | null\n /**\n * The URL to the uninstaller help page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlHelp?: string | null\n /**\n * The URL to the uninstaller info about page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlInfoAbout?: string | null\n /**\n * The URL to the uninstaller update info page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlUpdateInfo?: string | null\n /**\n * The URL to the uninstaller readme page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlReadme?: string | null\n\n /**\n * The path to NSIS include script to customize installer, or an array of such paths to include multiple scripts. Defaults to `build/installer.nsh`. See [Custom NSIS script](#custom-nsis-script).\n *\n * Each path is resolved relative to the [build resources directory](https://www.electron.build/docs/configuration#directories) first and then relative to the project directory.\n * When an array is provided, all scripts are included in the specified order.\n */\n readonly include?: string | Array<string> | null\n /**\n * The path to NSIS script to customize installer. Defaults to `build/installer.nsi`. See [Custom NSIS script](#custom-nsis-script).\n */\n readonly script?: string | null\n\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). In addition to `txt`, `rtf` and `html` supported (don't forget to use `target=\"_blank\"` for links).\n *\n * Multiple license files in different languages are supported — use lang postfix (e.g. `_de`, `_ru`). For example, create files `license_de.txt` and `license_en.txt` in the build resources.\n * If OS language is german, `license_de.txt` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js).\n *\n * Appropriate license file will be selected by user OS language.\n */\n readonly license?: string | null\n\n /**\n * The [artifact file name template](https://www.electron.build/docs/configuration#artifact-file-name-template). Defaults to `${productName} Setup ${version}.${ext}`.\n */\n readonly artifactName?: string | null\n\n /**\n * *one-click installer only.* Whether to delete app data on uninstall.\n * @default false\n */\n readonly deleteAppDataOnUninstall?: boolean\n\n /**\n * Marks the package as built with differential download support for the update server, and selects how the\n * app package is compressed:\n *\n * - `false` — no differential download support.\n * - `\"store-asar\"` — differential-aware, with the app's `resources/app.asar` stored uncompressed (7-Zip\n * `Copy`) inside the package. The differential updater diffs the *compressed* package with a\n * content-defined blockmap, and the asar is a single compressed member — so any change to app code\n * re-downloads the entire compressed asar (~100% of the member; its header rewrite alone diverges every\n * block). Storing it keeps unchanged regions byte-identical between releases, making the delta\n * proportional to what actually changed (measured on a ~32 MB asar: a one-line source change cost 0.2%\n * instead of 100%). The stored asar's byte range is also chunked with finer content-defined blocks\n * (4/8/16 KiB instead of the 8/16/32 KiB used for the rest of the installer), so a small change costs\n * proportionally fewer bytes still. Trade-off: the installer and full package grow by roughly what\n * compressing the asar saved. Without an `app.asar` (e.g. `asar` is disabled) there is nothing to store,\n * so it behaves like `true`. Upgrading from an electron-builder without the finer chunking changes the\n * block boundaries once: the first differential update from an installer built before it re-downloads\n * close to the whole asar, and updates between installers built with it are proportional again. Pair it\n * with `asar.contentAlignment` (e.g. `512`) so that a change which grows a file does not shift every\n * later file's offset in the asar header.\n * - anything else (`true`, `\"compressed\"`, unset) — differential-aware, whole package compressed.\n * @default true\n */\n readonly differentialPackage?: boolean | \"compressed\" | \"store-asar\"\n\n /**\n * Whether to display a language selection dialog. Not recommended (by default will be detected using OS language).\n * @default false\n */\n readonly displayLanguageSelector?: boolean\n /**\n * The installer languages (e.g. `en_US`, `de_DE`). Change only if you understand what do you do and for what.\n */\n readonly installerLanguages?: Array<string> | string | null\n /**\n * [LCID Dec](https://msdn.microsoft.com/en-au/goglobal/bb964664.aspx), defaults to `1033`(`English - United States`).\n */\n readonly language?: string | null\n /**\n * Whether to create multi-language installer. Defaults to `unicode` option value.\n */\n readonly multiLanguageInstaller?: boolean\n /**\n * Whether to pack the elevate executable (required for electron-updater if per-machine installer used or can be used in the future). Ignored if `perMachine` is set to `true`.\n * @default true\n */\n readonly packElevateHelper?: boolean\n\n /**\n * The file extension of files that will be not compressed. Applicable only for `extraResources` and `extraFiles` files.\n * @default [\".avi\", \".mov\", \".m4v\", \".mp4\", \".m4p\", \".qt\", \".mkv\", \".webm\", \".vmdk\"]\n */\n readonly preCompressedFileExtensions?: Array<string> | string | null\n\n /**\n * Disable building an universal installer of the archs specified in the target configuration\n * *Not supported for nsis-web*\n * @default true\n */\n readonly buildUniversalInstaller?: boolean\n}\n\n/**\n * Portable options.\n */\nexport interface PortableOptions extends TargetSpecificOptions, CommonNsisOptions {\n /**\n * The [requested execution level](http://nsis.sourceforge.net/Reference/RequestExecutionLevel) for Windows.\n * @default user\n */\n readonly requestExecutionLevel?: \"user\" | \"highest\" | \"admin\"\n\n /**\n * The unpack directory for the portable app resources.\n *\n * If set to a string, it will be the name in [TEMP](https://www.askvg.com/where-does-windows-store-temporary-files-and-how-to-change-temp-folder-location/) directory\n * If set explicitly to `false`, it will use the Windows temp directory ($PLUGINSDIR) that is unique to each launch of the portable application.\n *\n * Defaults to [uuid](https://github.com/segmentio/ksuid) of build (changed on each build of portable executable).\n */\n readonly unpackDirName?: string | boolean\n\n /**\n * The image to show while the portable executable is extracting. This image must be a bitmap (`.bmp`) image.\n */\n readonly splashImage?: string | null\n\n /**\n * Disable building an universal installer of the archs specified in the target configuration\n * @default true\n */\n readonly buildUniversalInstaller?: boolean\n\n /**\n * The path to NSIS include script to customize the portable launcher, or an array of such paths to include multiple scripts. See [Custom NSIS script](#custom-nsis-script).\n *\n * Each path is resolved relative to the [build resources directory](https://www.electron.build/docs/configuration#directories) first and then relative to the project directory.\n * When an array is provided, all scripts are included in the specified order.\n *\n * Unlike the installer targets, the portable target does **not** fall back to `build/installer.nsh` — a custom script is only included when this option is explicitly set.\n */\n readonly include?: string | Array<string> | null\n}\n\n/**\n * Web Installer options.\n */\nexport interface NsisWebOptions extends NsisOptions {\n /**\n * The application package download URL. Optional — by default computed using publish configuration.\n *\n * URL like `https://example.com/download/latest` allows web installer to be version independent (installer will download latest application package).\n * Please note — it is [full URL](https://github.com/electron-userland/electron-builder/issues/1810#issuecomment-317650878).\n *\n * Custom `X-Arch` http header is set to `32` or `64`.\n *\n * The installer does not checksum-verify a package downloaded from an explicit `appPackageUrl`; a package downloaded from the default (publish-derived) URL is verified against the packages built with the installer.\n */\n readonly appPackageUrl?: string | null\n\n /**\n * Whether the web installer may install an app package that doesn't match any package built with it: a package passed via `--package-file`,\n * or (when `appPackageUrl` is not set) the downloaded package. By default such a package aborts the installation.\n *\n * Enable only if you intentionally run one web installer with packages of other builds (e.g. a version-independent installer with `--package-file`).\n * @default false\n */\n readonly allowUnverifiedAppPackage?: boolean\n\n /**\n * The [artifact file name template](https://www.electron.build/docs/configuration#artifact-file-name-template). Defaults to `${productName} Web Setup ${version}.${ext}`.\n */\n readonly artifactName?: string | null\n\n /**\n * Override for `NsisOptions.buildUniversalInstaller`. nsis-web requires universal installer\n * @default true\n */\n readonly buildUniversalInstaller?: true\n}\n"]}
1
+ {"version":3,"file":"nsisOptions.js","sourceRoot":"","sources":["../../../../src/targets/win/nsis/nsisOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { CommonWindowsInstallerConfiguration } from \"../../../options/CommonWindowsInstallerConfiguration.js\"\nimport { TargetSpecificOptions } from \"../../../core.js\"\n\nexport interface CommonNsisOptions {\n /**\n * Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode).\n * @default true\n */\n readonly unicode?: boolean\n\n /**\n * The GUID for the installer. Used to identify the application for upgrade and uninstall operations.\n * If not specified, a deterministic GUID is generated from the app ID (`appId`) — but this means\n * changing your `appId` will break silent upgrades of existing installs.\n *\n * @see [GUID vs Application Name](https://www.electron.build/docs/nsis#guid-vs-application-name)\n */\n readonly guid?: string | null\n\n /**\n * If `warningsAsErrors` is `true` (default): NSIS will treat warnings as errors. If `warningsAsErrors` is `false`: NSIS will allow warnings.\n * @default true\n */\n readonly warningsAsErrors?: boolean\n\n /**\n * Use zip instead of 7z (LZMA) for the embedded app package. Only applies to portable targets and to installers built with `differentialPackage: false`; ignored (with a warning) when `differentialPackage` is enabled and for `nsis-web`, which always use 7z.\n * @default false\n */\n readonly useZip?: boolean\n}\n\nexport interface NsisOptions extends CommonNsisOptions, CommonWindowsInstallerConfiguration, TargetSpecificOptions {\n /**\n * Whether to create one-click installer or assisted.\n * @default true\n */\n readonly oneClick?: boolean\n\n /**\n * Whether to enable NSIS logging in the installer and uninstaller (`LogSet on`, which writes `install.log` to the installation\n * directory). The installer logs from the install of the files on (once the previous version is uninstalled); the uninstaller logs\n * from its start and leaves the open `install.log` in place when an update moves the installation directory aside. In your custom\n * NSIS scripts, write to the log via `${LogText}`; in `customInit` / `preInit` nothing is logged yet.\n *\n * Requires a log-enabled NSIS: `makensis` and its stubs compiled with `NSIS_CONFIG_LOG=yes`. From `toolsets.nsis` `\"2.0.4\"` (the\n * default) on, each NSIS release publishes a log-enabled bundle next to the default one, and electron-builder downloads it when this\n * option is `true` (the default bundle otherwise). Its stubs make the installer and uninstaller up to about 8 KB larger, and they\n * write a log only once `LogSet on` runs, which this option adds. The older pinned bundles (`\"0.0.0\"`, `\"1.2.1\"`) have no\n * log-enabled variant, and the build fails with one of them. A custom `toolsets.nsis` bundle must be log-enabled itself.\n * Replaces the v26 `customNsisBinary.debugLogging`.\n * @see https://www.electron.build/docs/migration/v27-config-changes#customnsisbinary-and-customnsisresources-replaced-by-toolsetsnsis\n * @default false\n */\n readonly installerDebugLogging?: boolean\n\n /**\n * Whether to show install mode installer page (choice per-machine or per-user) for assisted installer. Or whether installation always per all users (per-machine).\n *\n * If `oneClick` is `true` (default): Whether to install per all users (per-machine).\n *\n * If `oneClick` is `false` and `perMachine` is `true`: no install mode installer page, always install per-machine.\n *\n * If `oneClick` is `false` and `perMachine` is `false` (default): install mode installer page.\n * @default false\n */\n readonly perMachine?: boolean\n\n /**\n * Whether to set per-machine or per-user installation as default selection on the install mode installer page.\n *\n * @default false\n */\n readonly selectPerMachineByDefault?: boolean\n\n /**\n * *assisted installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions.\n * @default true\n */\n readonly allowElevation?: boolean\n\n /**\n * *assisted installer only, with `perMachine` not set.* Let a silent update (`--updated`) of a per-machine installation run without a UAC\n * prompt when the user already holds every access right the update uses. Off by default: the update elevates, as before.\n *\n * An update removes and re-creates the installation folder, the app's `HKLM` registration and the all-users shortcuts, so this applies\n * only where an administrator granted standard users those rights: on the folder and its files, its parent folder, the\n * `INSTALL_REGISTRY_KEY` and Uninstall keys and their parent keys (`HKLM\\Software`,\n * `HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall`), and the Start Menu folder and Public Desktop. The installer and\n * the uninstaller check each right without changing anything, and elevate when one is missing, when a per-user installation exists too,\n * and for an interactive install or uninstall.\n *\n * electron-builder does not recommend granting these rights: an unelevated process could then change the `UninstallString` that the\n * elevated uninstaller, and deployment tools running as SYSTEM, later execute. The option is for machines whose administrators already\n * did.\n *\n * An update runs the uninstaller of the installed version, so the first update to a build with this option still elevates.\n *\n * Not checked: `HKLM\\Software\\Classes` (file associations and protocols), writes made by `customInstall` or `customUnInstall`, and\n * shortcuts or a Start Menu folder that an earlier version created under another name. Without elevation, a write there that is\n * denied fails without an error, so leave this option off if the update needs one.\n * @default false\n */\n readonly allowUnelevatedPerMachineUpdate?: boolean\n\n /**\n * *assisted installer only.* Whether to allow user to change installation directory.\n * @default false\n */\n readonly allowToChangeInstallationDirectory?: boolean\n\n /**\n * *assisted installer only.* remove the default uninstall welcome page.\n * @default false\n */\n readonly removeDefaultUninstallWelcomePage?: boolean\n\n /**\n * The path to installer icon, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/installerIcon.ico` or application icon.\n */\n readonly installerIcon?: string | null\n /**\n * The path to uninstaller icon, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/uninstallerIcon.ico` or application icon.\n */\n readonly uninstallerIcon?: string | null\n /**\n * *assisted installer only.* `MUI_HEADERIMAGE`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * @default build/installerHeader.bmp\n */\n readonly installerHeader?: string | null\n /**\n * *one-click installer only.* The path to header icon (above the progress bar), relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/installerHeaderIcon.ico` or application icon.\n */\n readonly installerHeaderIcon?: string | null\n /**\n * *assisted installer only.* `MUI_WELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `build/installerSidebar.bmp` or `${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp`. Image size 164 × 314 pixels.\n */\n readonly installerSidebar?: string | null\n /**\n * *assisted installer only.* `MUI_UNWELCOMEFINISHPAGE_BITMAP`, relative to the [build resources](https://www.electron.build/docs/contents#extraresources) or to the project directory.\n * Defaults to `installerSidebar` option or `build/uninstallerSidebar.bmp` or `build/installerSidebar.bmp` or `${NSISDIR}\\\\Contrib\\\\Graphics\\\\Wizard\\\\nsis3-metro.bmp`\n */\n readonly uninstallerSidebar?: string | null\n /**\n * The uninstaller display name in the control panel.\n * @default ${productName} ${version}\n */\n readonly uninstallDisplayName?: string | null\n /**\n * The URL to the uninstaller help page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlHelp?: string | null\n /**\n * The URL to the uninstaller info about page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlInfoAbout?: string | null\n /**\n * The URL to the uninstaller update info page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlUpdateInfo?: string | null\n /**\n * The URL to the uninstaller readme page in the control panel. Defaults to [homepage](https://www.electron.build/docs/configuration#homepage) from application package.json.\n */\n readonly uninstallUrlReadme?: string | null\n\n /**\n * The path to NSIS include script to customize installer, or an array of such paths to include multiple scripts. Defaults to `build/installer.nsh`. See [Custom NSIS script](#custom-nsis-script).\n *\n * Each path is resolved relative to the [build resources directory](https://www.electron.build/docs/configuration#directories) first and then relative to the project directory.\n * When an array is provided, all scripts are included in the specified order.\n */\n readonly include?: string | Array<string> | null\n /**\n * The path to NSIS script to customize installer. Defaults to `build/installer.nsi`. See [Custom NSIS script](#custom-nsis-script).\n */\n readonly script?: string | null\n\n /**\n * The path to EULA license file. Defaults to `license.txt` or `eula.txt` (or uppercase variants). In addition to `txt`, `rtf` and `html` supported (don't forget to use `target=\"_blank\"` for links).\n *\n * Multiple license files in different languages are supported — use lang postfix (e.g. `_de`, `_ru`). For example, create files `license_de.txt` and `license_en.txt` in the build resources.\n * If OS language is german, `license_de.txt` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js).\n *\n * Appropriate license file will be selected by user OS language.\n */\n readonly license?: string | null\n\n /**\n * The [artifact file name template](https://www.electron.build/docs/configuration#artifact-file-name-template). Defaults to `${productName} Setup ${version}.${ext}`.\n */\n readonly artifactName?: string | null\n\n /**\n * *one-click installer only.* Whether to delete app data on uninstall.\n * @default false\n */\n readonly deleteAppDataOnUninstall?: boolean\n\n /**\n * Marks the package as built with differential download support for the update server, and selects how the\n * app package is compressed:\n *\n * - `false` — no differential download support.\n * - `\"store-asar\"` — differential-aware, with the app's `resources/app.asar` stored uncompressed (7-Zip\n * `Copy`) inside the package. The differential updater diffs the *compressed* package with a\n * content-defined blockmap, and the asar is a single compressed member — so any change to app code\n * re-downloads the entire compressed asar (~100% of the member; its header rewrite alone diverges every\n * block). Storing it keeps unchanged regions byte-identical between releases, making the delta\n * proportional to what actually changed (measured on a ~32 MB asar: a one-line source change cost 0.2%\n * instead of 100%). The stored asar's byte range is also chunked with finer content-defined blocks\n * (4/8/16 KiB instead of the 8/16/32 KiB used for the rest of the installer), so a small change costs\n * proportionally fewer bytes still. Trade-off: the installer and full package grow by roughly what\n * compressing the asar saved. Without an `app.asar` (e.g. `asar` is disabled) there is nothing to store,\n * so it behaves like `true`. Upgrading from an electron-builder without the finer chunking changes the\n * block boundaries once: the first differential update from an installer built before it re-downloads\n * close to the whole asar, and updates between installers built with it are proportional again. Pair it\n * with `asar.contentAlignment` (e.g. `512`) so that a change which grows a file does not shift every\n * later file's offset in the asar header.\n * - anything else (`true`, `\"compressed\"`, unset) — differential-aware, whole package compressed.\n * @default true\n */\n readonly differentialPackage?: boolean | \"compressed\" | \"store-asar\"\n\n /**\n * Whether to display a language selection dialog. Not recommended (by default will be detected using OS language).\n * @default false\n */\n readonly displayLanguageSelector?: boolean\n /**\n * The installer languages (e.g. `en_US`, `de_DE`). Change only if you understand what do you do and for what.\n */\n readonly installerLanguages?: Array<string> | string | null\n /**\n * [LCID Dec](https://msdn.microsoft.com/en-au/goglobal/bb964664.aspx), defaults to `1033`(`English - United States`).\n */\n readonly language?: string | null\n /**\n * Whether to create multi-language installer. Defaults to `unicode` option value.\n */\n readonly multiLanguageInstaller?: boolean\n /**\n * Whether to pack the elevate executable (required for electron-updater if per-machine installer used or can be used in the future). Ignored if `perMachine` is set to `true`.\n * @default true\n */\n readonly packElevateHelper?: boolean\n\n /**\n * The file extension of files that will be not compressed. Applicable only for `extraResources` and `extraFiles` files.\n * @default [\".avi\", \".mov\", \".m4v\", \".mp4\", \".m4p\", \".qt\", \".mkv\", \".webm\", \".vmdk\"]\n */\n readonly preCompressedFileExtensions?: Array<string> | string | null\n\n /**\n * Disable building an universal installer of the archs specified in the target configuration\n * *Not supported for nsis-web*\n * @default true\n */\n readonly buildUniversalInstaller?: boolean\n}\n\n/**\n * Portable options.\n */\nexport interface PortableOptions extends TargetSpecificOptions, CommonNsisOptions {\n /**\n * The [requested execution level](http://nsis.sourceforge.net/Reference/RequestExecutionLevel) for Windows.\n * @default user\n */\n readonly requestExecutionLevel?: \"user\" | \"highest\" | \"admin\"\n\n /**\n * The unpack directory for the portable app resources.\n *\n * If set to a string, it will be the name in [TEMP](https://www.askvg.com/where-does-windows-store-temporary-files-and-how-to-change-temp-folder-location/) directory\n * If set explicitly to `false`, it will use the Windows temp directory ($PLUGINSDIR) that is unique to each launch of the portable application.\n *\n * Defaults to [uuid](https://github.com/segmentio/ksuid) of build (changed on each build of portable executable).\n */\n readonly unpackDirName?: string | boolean\n\n /**\n * The image to show while the portable executable is extracting. This image must be a bitmap (`.bmp`) image.\n */\n readonly splashImage?: string | null\n\n /**\n * Disable building an universal installer of the archs specified in the target configuration\n * @default true\n */\n readonly buildUniversalInstaller?: boolean\n\n /**\n * The path to NSIS include script to customize the portable launcher, or an array of such paths to include multiple scripts. See [Custom NSIS script](#custom-nsis-script).\n *\n * Each path is resolved relative to the [build resources directory](https://www.electron.build/docs/configuration#directories) first and then relative to the project directory.\n * When an array is provided, all scripts are included in the specified order.\n *\n * Unlike the installer targets, the portable target does **not** fall back to `build/installer.nsh` — a custom script is only included when this option is explicitly set.\n */\n readonly include?: string | Array<string> | null\n}\n\n/**\n * Web Installer options.\n */\nexport interface NsisWebOptions extends NsisOptions {\n /**\n * The application package download URL. Optional — by default computed using publish configuration.\n *\n * URL like `https://example.com/download/latest` allows web installer to be version independent (installer will download latest application package).\n * Please note — it is [full URL](https://github.com/electron-userland/electron-builder/issues/1810#issuecomment-317650878).\n *\n * Custom `X-Arch` http header is set to `32` or `64`.\n *\n * The installer does not checksum-verify a package downloaded from an explicit `appPackageUrl`; a package downloaded from the default (publish-derived) URL is verified against the packages built with the installer.\n */\n readonly appPackageUrl?: string | null\n\n /**\n * Whether the web installer may install an app package that doesn't match any package built with it: a package passed via `--package-file`,\n * or (when `appPackageUrl` is not set) the downloaded package. By default such a package aborts the installation.\n *\n * Enable only if you intentionally run one web installer with packages of other builds (e.g. a version-independent installer with `--package-file`).\n * @default false\n */\n readonly allowUnverifiedAppPackage?: boolean\n\n /**\n * The [artifact file name template](https://www.electron.build/docs/configuration#artifact-file-name-template). Defaults to `${productName} Web Setup ${version}.${ext}`.\n */\n readonly artifactName?: string | null\n\n /**\n * Override for `NsisOptions.buildUniversalInstaller`. nsis-web requires universal installer\n * @default true\n */\n readonly buildUniversalInstaller?: true\n}\n"]}
@@ -9,5 +9,11 @@ export declare class NsisScriptGenerator {
9
9
  flags(flags: Array<string>): void;
10
10
  build(): string;
11
11
  }
12
+ /**
13
+ * Quotes a file path for the generated NSIS script. A double quote, line break or NUL in the path would end the quoted string
14
+ * and the rest of the path would be read as script, so such a path fails the build instead of being escaped. Backticks and
15
+ * single quotes are literal inside a double-quoted NSIS string and are kept.
16
+ */
17
+ export declare function nsisQuotePath(file: string): string;
12
18
  export declare function nsisEscapeString(s: string): string;
13
19
  //# sourceMappingURL=nsisScriptGenerator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nsisScriptGenerator.d.ts","sourceRoot":"","sources":["../../../../src/targets/win/nsis/nsisScriptGenerator.ts"],"names":[],"mappings":"AAEA,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAE1C,aAAa,CAAC,IAAI,EAAE,MAAM;IAI1B,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAI5C,OAAO,CAAC,IAAI,EAAE,MAAM;IAIpB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,mBAAmB;IAI9D,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM;IAI5C,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAK5C,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC;IAY1B,KAAK;CAGN;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAUlD"}
1
+ {"version":3,"file":"nsisScriptGenerator.d.ts","sourceRoot":"","sources":["../../../../src/targets/win/nsis/nsisScriptGenerator.ts"],"names":[],"mappings":"AAEA,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAE1C,aAAa,CAAC,IAAI,EAAE,MAAM;IAI1B,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAI5C,OAAO,CAAC,IAAI,EAAE,MAAM;IAIpB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,mBAAmB;IAI9D,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM;IAI5C,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAK5C,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC;IAY1B,KAAK;CAGN;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOlD;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAUlD"}
@@ -1,22 +1,22 @@
1
- import { log } from "builder-util";
1
+ import { InvalidConfigurationError, log } from "builder-util";
2
2
  export class NsisScriptGenerator {
3
3
  constructor() {
4
4
  this.lines = [];
5
5
  }
6
6
  addIncludeDir(file) {
7
- this.lines.push(`!addincludedir "${file}"`);
7
+ this.lines.push(`!addincludedir ${nsisQuotePath(file)}`);
8
8
  }
9
9
  addPluginDir(pluginArch, dir) {
10
- this.lines.push(`!addplugindir /${pluginArch} "${dir}"`);
10
+ this.lines.push(`!addplugindir /${pluginArch} ${nsisQuotePath(dir)}`);
11
11
  }
12
12
  include(file) {
13
- this.lines.push(`!include "${file}"`);
13
+ this.lines.push(`!include ${nsisQuotePath(file)}`);
14
14
  }
15
15
  macro(name, lines) {
16
16
  this.lines.push(`!macro ${name}`, ` ${(Array.isArray(lines) ? lines : lines.lines).join("\n ")}`, `!macroend\n`);
17
17
  }
18
18
  file(outputName, file) {
19
- this.lines.push(`File${outputName == null ? "" : ` "/oname=${outputName}"`} "${file}"`);
19
+ this.lines.push(`File${outputName == null ? "" : ` "/oname=${outputName}"`} ${nsisQuotePath(file)}`);
20
20
  }
21
21
  insertMacro(name, parameters) {
22
22
  this.lines.push(`!insertmacro ${name} ${parameters}`);
@@ -37,6 +37,17 @@ export class NsisScriptGenerator {
37
37
  return this.lines.join("\n") + "\n";
38
38
  }
39
39
  }
40
+ /**
41
+ * Quotes a file path for the generated NSIS script. A double quote, line break or NUL in the path would end the quoted string
42
+ * and the rest of the path would be read as script, so such a path fails the build instead of being escaped. Backticks and
43
+ * single quotes are literal inside a double-quoted NSIS string and are kept.
44
+ */
45
+ export function nsisQuotePath(file) {
46
+ if (/["\r\n\0]/.test(file)) {
47
+ throw new InvalidConfigurationError(`Cannot write ${JSON.stringify(file)} into the NSIS script: the path contains a double quote, line break or NUL character. Rename the file or directory.`);
48
+ }
49
+ return `"${file}"`;
50
+ }
40
51
  export function nsisEscapeString(s) {
41
52
  const escaped = s
42
53
  .replace(/\r\n|\r|\n/g, " ") // newlines break NSIS string literals
@@ -1 +1 @@
1
- {"version":3,"file":"nsisScriptGenerator.js","sourceRoot":"","sources":["../../../../src/targets/win/nsis/nsisScriptGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAElC,MAAM,OAAO,mBAAmB;IAAhC;QACmB,UAAK,GAAkB,EAAE,CAAA;IA0C5C,CAAC;IAxCC,aAAa,CAAC,IAAY;QACxB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,IAAI,GAAG,CAAC,CAAA;IAC7C,CAAC;IAED,YAAY,CAAC,UAAkB,EAAE,GAAW;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,UAAU,KAAK,GAAG,GAAG,CAAC,CAAA;IAC1D,CAAC;IAED,OAAO,CAAC,IAAY;QAClB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,GAAG,CAAC,CAAA;IACvC,CAAC;IAED,KAAK,CAAC,IAAY,EAAE,KAA0C;QAC5D,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,EAAE,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O,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,yCAAyC;SAC/D,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA,CAAC,yGAAyG;IAClI,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAClB,GAAG,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,kBAAkB,CAAC,CAAA;IAChE,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB;IACzC,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC5B,OAAO,eAAe,CAAA;IACxB,CAAC;IACD,IAAI,QAAQ,KAAK,aAAa,EAAE,CAAC;QAC/B,OAAO,kBAAkB,CAAA;IAC3B,CAAC;IACD,OAAO,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;AACjE,CAAC","sourcesContent":["import { log } from \"builder-util\"\n\nexport class NsisScriptGenerator {\n private readonly lines: Array<string> = []\n\n addIncludeDir(file: string) {\n this.lines.push(`!addincludedir \"${file}\"`)\n }\n\n addPluginDir(pluginArch: string, dir: string) {\n this.lines.push(`!addplugindir /${pluginArch} \"${dir}\"`)\n }\n\n include(file: string) {\n this.lines.push(`!include \"${file}\"`)\n }\n\n macro(name: string, lines: Array<string> | NsisScriptGenerator) {\n this.lines.push(`!macro ${name}`, ` ${(Array.isArray(lines) ? lines : lines.lines).join(\"\\n \")}`, `!macroend\\n`)\n }\n\n file(outputName: string | null, file: string) {\n this.lines.push(`File${outputName == null ? \"\" : ` \"/oname=${outputName}\"`} \"${file}\"`)\n }\n\n insertMacro(name: string, parameters: string) {\n this.lines.push(`!insertmacro ${name} ${parameters}`)\n }\n\n // without -- !!!\n flags(flags: Array<string>) {\n for (const flagName of flags) {\n const variableName = getVarNameForFlag(flagName).replace(/-+(\\w)?/g, (m, p1) => (p1 ?? \"\").toUpperCase())\n this.lines.push(`!macro _${variableName} _a _b _t _f\n $\\{StdUtils.TestParameter} $R9 \"${flagName}\"\n StrCmp \"$R9\" \"true\" \\`$\\{_t}\\` \\`$\\{_f}\\`\n!macroend\n!define ${variableName} \\`\"\" ${variableName} \"\"\\`\n`)\n }\n }\n\n build() {\n return this.lines.join(\"\\n\") + \"\\n\"\n }\n}\n\nexport function nsisEscapeString(s: string): string {\n const escaped = s\n .replace(/\\r\\n|\\r|\\n/g, \" \") // newlines break NSIS string literals\n .replace(/\\$(?![{(])/g, \"$$$$\") // bare $ → $$ (prevents NSIS variable expansion); ${...} define and $(...) LangString references are left intact\n .replace(/\"/g, '$\\\\\"') // \" → $\\\" (NSIS escape for double-quote)\n .replace(/`/g, \"$\\\\`\") // ` → $\\` (NSIS escape for backtick, which delimits strings in macro bodies such as FileAssociation.nsh)\n if (escaped !== s) {\n log.debug({ original: s, final: escaped }, \"nsis was escaped\")\n }\n return escaped\n}\n\nfunction getVarNameForFlag(flagName: string): string {\n if (flagName === \"allusers\") {\n return \"isForAllUsers\"\n }\n if (flagName === \"currentuser\") {\n return \"isForCurrentUser\"\n }\n return \"is\" + flagName[0].toUpperCase() + flagName.substring(1)\n}\n"]}
1
+ {"version":3,"file":"nsisScriptGenerator.js","sourceRoot":"","sources":["../../../../src/targets/win/nsis/nsisScriptGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAE7D,MAAM,OAAO,mBAAmB;IAAhC;QACmB,UAAK,GAAkB,EAAE,CAAA;IA0C5C,CAAC;IAxCC,aAAa,CAAC,IAAY;QACxB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC1D,CAAC;IAED,YAAY,CAAC,UAAkB,EAAE,GAAW;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,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["import { InvalidConfigurationError, log } from \"builder-util\"\n\nexport class NsisScriptGenerator {\n private readonly lines: Array<string> = []\n\n addIncludeDir(file: string) {\n this.lines.push(`!addincludedir ${nsisQuotePath(file)}`)\n }\n\n addPluginDir(pluginArch: string, dir: string) {\n this.lines.push(`!addplugindir /${pluginArch} ${nsisQuotePath(dir)}`)\n }\n\n include(file: string) {\n this.lines.push(`!include ${nsisQuotePath(file)}`)\n }\n\n macro(name: string, lines: Array<string> | NsisScriptGenerator) {\n this.lines.push(`!macro ${name}`, ` ${(Array.isArray(lines) ? lines : lines.lines).join(\"\\n \")}`, `!macroend\\n`)\n }\n\n file(outputName: string | null, file: string) {\n this.lines.push(`File${outputName == null ? \"\" : ` \"/oname=${outputName}\"`} ${nsisQuotePath(file)}`)\n }\n\n insertMacro(name: string, parameters: string) {\n this.lines.push(`!insertmacro ${name} ${parameters}`)\n }\n\n // without -- !!!\n flags(flags: Array<string>) {\n for (const flagName of flags) {\n const variableName = getVarNameForFlag(flagName).replace(/-+(\\w)?/g, (m, p1) => (p1 ?? \"\").toUpperCase())\n this.lines.push(`!macro _${variableName} _a _b _t _f\n $\\{StdUtils.TestParameter} $R9 \"${flagName}\"\n StrCmp \"$R9\" \"true\" \\`$\\{_t}\\` \\`$\\{_f}\\`\n!macroend\n!define ${variableName} \\`\"\" ${variableName} \"\"\\`\n`)\n }\n }\n\n build() {\n return this.lines.join(\"\\n\") + \"\\n\"\n }\n}\n\n/**\n * Quotes a file path for the generated NSIS script. A double quote, line break or NUL in the path would end the quoted string\n * and the rest of the path would be read as script, so such a path fails the build instead of being escaped. Backticks and\n * single quotes are literal inside a double-quoted NSIS string and are kept.\n */\nexport function nsisQuotePath(file: string): string {\n if (/[\"\\r\\n\\0]/.test(file)) {\n throw new InvalidConfigurationError(\n `Cannot write ${JSON.stringify(file)} into the NSIS script: the path contains a double quote, line break or NUL character. Rename the file or directory.`\n )\n }\n return `\"${file}\"`\n}\n\nexport function nsisEscapeString(s: string): string {\n const escaped = s\n .replace(/\\r\\n|\\r|\\n/g, \" \") // newlines break NSIS string literals\n .replace(/\\$(?![{(])/g, \"$$$$\") // bare $ → $$ (prevents NSIS variable expansion); ${...} define and $(...) LangString references are left intact\n .replace(/\"/g, '$\\\\\"') // \" → $\\\" (NSIS escape for double-quote)\n .replace(/`/g, \"$\\\\`\") // ` → $\\` (NSIS escape for backtick, which delimits strings in macro bodies such as FileAssociation.nsh)\n if (escaped !== s) {\n log.debug({ original: s, final: escaped }, \"nsis was escaped\")\n }\n return escaped\n}\n\nfunction getVarNameForFlag(flagName: string): string {\n if (flagName === \"allusers\") {\n return \"isForAllUsers\"\n }\n if (flagName === \"currentuser\") {\n return \"isForCurrentUser\"\n }\n return \"is\" + flagName[0].toUpperCase() + flagName.substring(1)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"nsisUtil.d.ts","sourceRoot":"","sources":["../../../../src/targets/win/nsis/nsisUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgE,MAAM,cAAc,CAAA;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAQtD,OAAO,EAAE,cAAc,EAAyB,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,eAAO,MAAM,gBAAgB,QAA0B,CAAA;AAEvD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,eAAe,CAAA;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CACjC;AAED,qBAAa,gBAAgB;IAUf,OAAO,CAAC,QAAQ,CAAC,aAAa;IAP1C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6C;IAC1E,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA0B;IAC7D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAsC;IAErE,eAAe;IACf,QAAQ,SAAI;gBAEiB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A6C;IAC1E,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA0B;IAC7D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAsC;IAErE,eAAe;IACf,QAAQ,SAAI;gBAEiB,aAAa,EAAE,iBAAiB;IAEvD,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IA4BjE,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;CAclC;AAED,qBAAa,iBAAiB;IAE5B,OAAO,CAAC,WAAW,CAAsC;IAIzD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAoB;IAEzD,OAAO,CAAC,OAAO;IA0BT,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAoC9I;AAgDD,qBAAa,iBAAiB;WAEf,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;CAoFjE;AAyCD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAwBtD"}
@@ -80,7 +80,7 @@ export class CopyElevateHelper {
80
80
  return Promise.resolve(null);
81
81
  }
82
82
  if (this.elevatePath == null) {
83
- this.elevatePath = getNsisElevatePath(target.packager.config.toolsets?.nsis, target.packager.buildResourcesDir);
83
+ this.elevatePath = getNsisElevatePath(target.packager.config.toolsets?.nsis, target.packager.buildResourcesDir, target.nsisToolsetOptions);
84
84
  }
85
85
  return this.elevatePath;
86
86
  }
@@ -155,18 +155,6 @@ class BinaryReader {
155
155
  uint32() {
156
156
  return this.uint16() | (this.uint16() << 16);
157
157
  }
158
- string(length) {
159
- let value = "";
160
- for (let i = 0; i < length; i++) {
161
- const c = this._buffer[this._position + i];
162
- if (c === 0x00) {
163
- break;
164
- }
165
- value += String.fromCharCode(c);
166
- }
167
- this._position += length;
168
- return value;
169
- }
170
158
  }
171
159
  export class UninstallerReader {
172
160
  // noinspection SpellCheckingInspection
@@ -191,29 +179,23 @@ export class UninstallerReader {
191
179
  reader.skip(2);
192
180
  reader.skip(sizeOfOptionalHeader);
193
181
  // IMAGE_SECTION_HEADER
182
+ // makensis appends the NSIS data right after the exehead stub, so it starts where the last section's raw data ends. Which sections
183
+ // a stub has depends on the toolchain that built it: the MSVC stubs of nsis@1.2.1 have .text/.rdata/.data/.rsrc (and an empty
184
+ // .ndata), the MinGW stubs of nsis@2.0.4 and later also have raw data in .idata and .ndata. The firstheader check below and the
185
+ // NSIS CRC check of the result reject a wrong offset.
194
186
  let nsisOffset = 0;
195
187
  for (let i = 0; i < numberOfSections; i++) {
196
- const name = reader.string(8);
197
- reader.skip(8);
188
+ reader.skip(16); // Name, VirtualSize, VirtualAddress
198
189
  const rawSize = reader.uint32();
199
190
  const rawPointer = reader.uint32();
200
191
  reader.skip(16);
201
- switch (name) {
202
- case ".text":
203
- case ".rdata":
204
- case ".data":
205
- case ".rsrc": {
206
- nsisOffset = Math.max(rawPointer + rawSize, nsisOffset);
207
- break;
208
- }
209
- default: {
210
- if (rawPointer !== 0 && rawSize !== 0) {
211
- throw new Error("Unsupported section '" + name + "'.");
212
- }
213
- break;
214
- }
192
+ if (rawPointer !== 0 && rawSize !== 0) {
193
+ nsisOffset = Math.max(rawPointer + rawSize, nsisOffset);
215
194
  }
216
195
  }
196
+ if (nsisOffset === 0 || nsisOffset >= buffer.length) {
197
+ throw new Error("No NSIS data after the executable sections.");
198
+ }
217
199
  // copied, because the uninstaller icon is patched into it below
218
200
  const executable = Buffer.from(buffer.subarray(0, nsisOffset));
219
201
  const nsisSize = buffer.length - nsisOffset;
@@ -1 +1 @@
1
- {"version":3,"file":"nsisUtil.js","sourceRoot":"","sources":["../../../../src/targets/win/nsis/nsisUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,OAAO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D,MAAM,wBAAwB,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;QAC/D,IAAI,wBAAwB,GAAG,sBAAsB,GAAG,CAAC,IAAI,wBAAwB,GAAG,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;YAC7G,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;QACvE,CAAC;QACD,6FAA6F;QAC7F,MAAM,SAAS,GAAG,MAAM,GAAG,wBAAwB,GAAG,CAAC,CAAA;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAA;QAC3E,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAA;QAC7C,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,2CAA2C,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,gBAAgB,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAA;QACzH,CAAC;QACD,OAAM;IACR,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAA;AACxE,CAAC","sourcesContent":["import { Arch, copyFile, debug7z, dirSize, exec, log, prepareFixedNameWrite } from \"builder-util\"\nimport { PackageFileInfo } from \"builder-util-runtime\"\nimport * as fs from \"fs/promises\"\nimport * as path from \"path\"\nimport * as zlib from \"zlib\"\nimport { isWindowsSigningDisabled } from \"../../../options/winOptions.js\"\nimport { getNsisElevatePath } from \"../../../toolsets/nsis.js\"\nimport { getPath7za } from \"../../../toolsets/7zip.js\"\nimport { getTemplatePath } from \"../../../util/pathManager.js\"\nimport { ArchiveOptions, compute7zCompressArgs } from \"../../archive.js\"\nimport { NsisTarget } from \"./NsisTarget.js\"\n\nexport const nsisTemplatesDir = getTemplatePath(\"nsis\")\n\nexport interface PackArchResult {\n fileInfo: PackageFileInfo\n unpackedSize: number\n /**\n * Absolute source paths of the members stored verbatim (`Copy`) in the app package — see\n * `ArchiveOptions.storedPaths`. The package is embedded verbatim in the installer, so these are\n * located again in the final installer to give the block map its finer-chunked regions.\n */\n storedMemberFiles: Array<string>\n}\n\nexport class AppPackageHelper {\n // keyed by arch + the requesting target's appPackageCacheKey: targets only share an app package\n // when packaging it for them would produce the same archive\n private readonly archToResult = new Map<string, Promise<PackArchResult>>()\n private readonly archToPackageCount = new Map<Arch, number>()\n private readonly infoToIsDelete = new Map<PackageFileInfo, boolean>()\n\n /** @private */\n refCount = 0\n\n constructor(private readonly elevateHelper: CopyElevateHelper) {}\n\n async packArch(arch: Arch, target: NsisTarget): Promise<PackArchResult> {\n const cacheKey = `${arch}:${target.appPackageCacheKey}`\n let resultPromise = this.archToResult.get(cacheKey)\n if (resultPromise == null) {\n const appOutDir = target.archs.get(arch)!\n // the first package of an arch keeps the usual file name; any further one (a target with\n // different packaging settings) gets a distinct name so it never overwrites the other\n const packageCount = (this.archToPackageCount.get(arch) ?? 0) + 1\n this.archToPackageCount.set(arch, packageCount)\n const fileNameSuffix = packageCount === 1 ? \"\" : `-${packageCount}`\n resultPromise = target.buildAppPackage(appOutDir, arch, this.elevateHelper, fileNameSuffix).then(async ({ fileInfo, storedMemberFiles }) => ({\n fileInfo,\n storedMemberFiles,\n unpackedSize: await dirSize(appOutDir),\n }))\n this.archToResult.set(cacheKey, resultPromise)\n }\n\n const result = await resultPromise\n const { fileInfo: info } = result\n if (target.isWebInstaller) {\n this.infoToIsDelete.set(info, false)\n } else if (!this.infoToIsDelete.has(info)) {\n this.infoToIsDelete.set(info, true)\n }\n return result\n }\n\n async finishBuild(): Promise<any> {\n if (--this.refCount > 0) {\n return\n }\n\n const filesToDelete: Array<string> = []\n for (const [info, isDelete] of this.infoToIsDelete.entries()) {\n if (isDelete) {\n filesToDelete.push(info.path)\n }\n }\n\n await Promise.all(filesToDelete.map(it => fs.unlink(it)))\n }\n}\n\nexport class CopyElevateHelper {\n // Cached path resolution — shared across all arches since the source never changes per build.\n private elevatePath: Promise<string | null> | null = null\n\n // appOutDirs whose win-unpacked copy of elevate.exe has already been deferred, so the same\n // directory isn't queued twice when multiple NSIS targets (e.g. nsis + nsis-web) share an arch.\n private readonly stagedUnpackedCopies = new Set<string>()\n\n private resolve(target: NsisTarget): Promise<string | null> {\n if (!target.packager.framework.isCopyElevateHelper) {\n return Promise.resolve(null)\n }\n\n let isPackElevateHelper = target.options.packElevateHelper\n if (isPackElevateHelper === false && target.options.perMachine === true) {\n isPackElevateHelper = true\n log.warn(\"`packElevateHelper = false` is ignored, because `perMachine` is set to `true`\")\n }\n\n if (isPackElevateHelper === false) {\n return Promise.resolve(null)\n }\n\n if (this.elevatePath == null) {\n this.elevatePath = getNsisElevatePath(target.packager.config.toolsets?.nsis, target.packager.buildResourcesDir)\n }\n\n return this.elevatePath\n }\n\n // Injects elevate.exe directly into the already-built NSIS archive via a temp staging dir, and\n // defers copying it into win-unpacked until every target has finished reading the shared\n // appOutDir. This keeps elevate.exe in the dir-target output while guaranteeing concurrent\n // targets (Squirrel, ZIP, appx, …) never capture it mid-build (fixes the #9852 race).\n async addToArchive(archiveFile: string, target: NsisTarget, format: string, archiveOptions: ArchiveOptions, appOutDir: string): Promise<void> {\n const elevatePath = await this.resolve(target)\n if (!elevatePath) {\n return\n }\n\n const stagingDir = await target.packager.tempDirManager.getTempDir({ prefix: \"elevate-staging\" })\n const resourcesDir = path.join(stagingDir, \"resources\")\n await fs.mkdir(resourcesDir, { recursive: true })\n const stagedElevate = path.join(resourcesDir, \"elevate.exe\")\n await copyFile(elevatePath, stagedElevate, false)\n\n if (!isWindowsSigningDisabled(target.packager.platformOptions)) {\n await target.packager.signIf(stagedElevate)\n }\n\n // Reuse the parent archive's compression args so the appended entry is consistent with the\n // rest of the archive (notably `store` and differential-aware builds, where bare `7za a`\n // defaults — solid on, -mx=9, NTFS timestamps — would diverge from the original entries).\n const args = compute7zCompressArgs(format, archiveOptions)\n args.push(archiveFile, \"resources/elevate.exe\")\n await exec(await getPath7za(), args, { cwd: stagingDir }, debug7z.enabled)\n\n // Defer the win-unpacked copy: it must land after every concurrent target has packaged\n // appOutDir, so it is never captured by Squirrel/zip/etc. The staged (and possibly signed)\n // binary lives in tempDirManager, which is cleaned up only after the build finishes.\n if (!this.stagedUnpackedCopies.has(appOutDir)) {\n this.stagedUnpackedCopies.add(appOutDir)\n target.packager.addBuildFinalizeTask(async () => {\n // into a directory that extraResources were copied into: replace, never follow, a symlink at the name\n const unpackedElevate = path.join(appOutDir, \"resources\", \"elevate.exe\")\n await prepareFixedNameWrite(appOutDir, unpackedElevate, \"elevate.exe helper\")\n await copyFile(stagedElevate, unpackedElevate, false)\n })\n }\n }\n}\n\nclass BinaryReader {\n private readonly _buffer: Buffer\n private _position: number\n\n constructor(buffer: Buffer) {\n this._buffer = buffer\n this._position = 0\n }\n\n get length(): number {\n return this._buffer.length\n }\n\n get position(): number {\n return this._position\n }\n\n match(signature: Array<number>): boolean {\n if (signature.every((v, i) => this._buffer[this._position + i] === v)) {\n this._position += signature.length\n return true\n }\n return false\n }\n\n skip(offset: number) {\n this._position += offset\n }\n\n bytes(size: number): Buffer {\n const value = this._buffer.subarray(this._position, this._position + size)\n this._position += size\n return value\n }\n\n uint16(): number {\n const value = this._buffer[this._position] | (this._buffer[this._position + 1] << 8)\n this._position += 2\n return value\n }\n\n uint32(): number {\n return this.uint16() | (this.uint16() << 16)\n }\n\n string(length: number): string {\n let value = \"\"\n for (let i = 0; i < length; i++) {\n const c = this._buffer[this._position + i]\n if (c === 0x00) {\n break\n }\n value += String.fromCharCode(c)\n }\n this._position += length\n return value\n }\n}\n\nexport class UninstallerReader {\n // noinspection SpellCheckingInspection\n static async exec(installerPath: string, uninstallerPath: string) {\n const buffer = await fs.readFile(installerPath)\n const reader = new BinaryReader(buffer)\n // IMAGE_DOS_HEADER\n if (!reader.match([0x4d, 0x5a])) {\n throw new Error(\"Invalid 'MZ' signature.\")\n }\n reader.skip(58)\n // e_lfanew\n reader.skip(reader.uint32() - reader.position)\n // IMAGE_FILE_HEADER\n if (!reader.match([0x50, 0x45, 0x00, 0x00])) {\n throw new Error(\"Invalid 'PE' signature.\")\n }\n reader.skip(2)\n const numberOfSections = reader.uint16()\n reader.skip(12)\n const sizeOfOptionalHeader = reader.uint16()\n reader.skip(2)\n reader.skip(sizeOfOptionalHeader)\n // IMAGE_SECTION_HEADER\n let nsisOffset = 0\n for (let i = 0; i < numberOfSections; i++) {\n const name = reader.string(8)\n reader.skip(8)\n const rawSize = reader.uint32()\n const rawPointer = reader.uint32()\n reader.skip(16)\n switch (name) {\n case \".text\":\n case \".rdata\":\n case \".data\":\n case \".rsrc\": {\n nsisOffset = Math.max(rawPointer + rawSize, nsisOffset)\n break\n }\n default: {\n if (rawPointer !== 0 && rawSize !== 0) {\n throw new Error(\"Unsupported section '\" + name + \"'.\")\n }\n break\n }\n }\n }\n // copied, because the uninstaller icon is patched into it below\n const executable = Buffer.from(buffer.subarray(0, nsisOffset))\n const nsisSize = buffer.length - nsisOffset\n const nsisReader = new BinaryReader(buffer.subarray(nsisOffset, nsisOffset + nsisSize))\n if (!isNsisFirstHeader(buffer, nsisOffset)) {\n throw new Error(\"Invalid signature.\")\n }\n nsisReader.skip(NSIS_FIRST_HEADER_SIZE - 4)\n if (nsisSize !== nsisReader.uint32()) {\n throw new Error(\"Size mismatch.\")\n }\n\n // The data block is a sequence of [size | compressed flag][data] entries (non-solid compression only).\n // makensis stores the uninstaller icon patch and then the uninstaller data as two consecutive entries (build.cpp uninstall_generate)\n let iconData: Buffer | null = null\n let innerBuffer: Buffer | null = null\n let previousBlock: Buffer | null = null\n while (true) {\n let size = nsisReader.uint32()\n const compressed = (size & 0x80000000) !== 0\n size = size & 0x7fffffff\n if (size === 0 || nsisReader.position + size > nsisReader.length || nsisReader.position >= nsisReader.length) {\n break\n }\n let block = nsisReader.bytes(size)\n if (compressed) {\n block = zlib.inflateRawSync(block)\n }\n if (isNsisFirstHeader(block, 0) && (block.readUInt32LE(0) & FH_FLAGS_UNINSTALL) !== 0) {\n if (innerBuffer) {\n throw new Error(\"Multiple inner blocks.\")\n }\n innerBuffer = block\n iconData = previousBlock\n }\n previousBlock = block\n }\n if (!innerBuffer || !iconData) {\n throw new Error(\"Inner block not found.\")\n }\n applyUninstallerIconData(executable, iconData)\n\n const uninstaller = Buffer.concat([executable, innerBuffer])\n verifyNsisIntegrity(uninstaller)\n await fs.writeFile(uninstallerPath, uninstaller)\n }\n}\n\nconst NSIS_FIRST_HEADER_SIZE = 28\n// siginfo (0xDEADBEEF) followed by \"NullsoftInst\"; the preceding 4 bytes of the firstheader are its flags\nconst NSIS_SIGNATURE = Buffer.from([0xef, 0xbe, 0xad, 0xde, 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x49, 0x6e, 0x73, 0x74])\nconst FH_FLAGS_MASK = 15\nconst FH_FLAGS_UNINSTALL = 1\nconst FH_FLAGS_NO_CRC = 4\nconst FH_FLAGS_FORCE_CRC = 8\n\nfunction isNsisFirstHeader(data: Buffer, offset: number): boolean {\n return (\n offset + NSIS_FIRST_HEADER_SIZE <= data.length &&\n (data.readUInt32LE(offset) & ~FH_FLAGS_MASK) === 0 &&\n data.subarray(offset + 4, offset + 4 + NSIS_SIGNATURE.length).equals(NSIS_SIGNATURE)\n )\n}\n\n// WriteUninstaller (exehead/exec.c) patches the uninstaller icon into a copy of the installer's exehead before writing it out,\n// and makensis computes the uninstaller CRC over that patched exehead. The icon data is a list of [size][offset][bytes] records.\nfunction applyUninstallerIconData(executable: Buffer, iconData: Buffer) {\n let position = 0\n // exec.c stops at the first zero byte (not a zero dword), so mirror that exactly\n while (position < iconData.length && iconData[position] !== 0) {\n if (position + 8 > iconData.length) {\n throw new Error(\"Truncated uninstaller icon data.\")\n }\n const size = iconData.readUInt32LE(position)\n const offset = iconData.readUInt32LE(position + 4)\n position += 8\n if (position + size > iconData.length || offset + size > executable.length) {\n throw new Error(\"Invalid uninstaller icon data.\")\n }\n iconData.copy(executable, offset, position, position + size)\n position += size\n }\n if (position >= iconData.length) {\n throw new Error(\"Uninstaller icon data is not terminated.\")\n }\n}\n\n/**\n * Performs the same integrity check that the NSIS exehead runs on startup (loadHeaders in exehead/fileform.c),\n * so a broken uninstaller fails the build instead of showing \"Installer integrity check has failed\" to the end user.\n */\nexport function verifyNsisIntegrity(data: Buffer): void {\n // the exehead looks for the firstheader at 512-byte boundaries\n for (let offset = 0; offset < data.length; offset += 512) {\n if (!isNsisFirstHeader(data, offset)) {\n continue\n }\n const flags = data.readUInt32LE(offset)\n if ((flags & FH_FLAGS_FORCE_CRC) === 0 && (flags & FH_FLAGS_NO_CRC) !== 0) {\n return\n }\n const lengthOfAllFollowingData = data.readUInt32LE(offset + 24)\n if (lengthOfAllFollowingData < NSIS_FIRST_HEADER_SIZE + 4 || lengthOfAllFollowingData > data.length - offset) {\n throw new Error(\"NSIS integrity check failed: data length mismatch.\")\n }\n // the first 512 bytes are not covered, the CRC itself is stored right after the checked data\n const crcOffset = offset + lengthOfAllFollowingData - 4\n const actual = zlib.crc32(data.subarray(offset === 0 ? 0 : 512, crcOffset))\n const expected = data.readUInt32LE(crcOffset)\n if (actual !== expected) {\n throw new Error(`NSIS integrity check failed: CRC32 is 0x${actual.toString(16)}, expected 0x${expected.toString(16)}.`)\n }\n return\n }\n throw new Error(\"NSIS integrity check failed: NSIS header not found.\")\n}\n"]}
1
+ {"version":3,"file":"nsisUtil.js","sourceRoot":"","sources":["../../../../src/targets/win/nsis/nsisUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAEjG,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,I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EAAE,CAAC,GAAG,CAAC,CAAA;QACzH,CAAC;QACD,OAAM;IACR,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAA;AACxE,CAAC","sourcesContent":["import { Arch, copyFile, debug7z, dirSize, exec, log, prepareFixedNameWrite } from \"builder-util\"\nimport { PackageFileInfo } from \"builder-util-runtime\"\nimport * as fs from \"fs/promises\"\nimport * as path from \"path\"\nimport * as zlib from \"zlib\"\nimport { isWindowsSigningDisabled } from \"../../../options/winOptions.js\"\nimport { getNsisElevatePath } from \"../../../toolsets/nsis.js\"\nimport { getPath7za } from \"../../../toolsets/7zip.js\"\nimport { getTemplatePath } from \"../../../util/pathManager.js\"\nimport { ArchiveOptions, compute7zCompressArgs } from \"../../archive.js\"\nimport { NsisTarget } from \"./NsisTarget.js\"\n\nexport const nsisTemplatesDir = getTemplatePath(\"nsis\")\n\nexport interface PackArchResult {\n fileInfo: PackageFileInfo\n unpackedSize: number\n /**\n * Absolute source paths of the members stored verbatim (`Copy`) in the app package — see\n * `ArchiveOptions.storedPaths`. The package is embedded verbatim in the installer, so these are\n * located again in the final installer to give the block map its finer-chunked regions.\n */\n storedMemberFiles: Array<string>\n}\n\nexport class AppPackageHelper {\n // keyed by arch + the requesting target's appPackageCacheKey: targets only share an app package\n // when packaging it for them would produce the same archive\n private readonly archToResult = new Map<string, Promise<PackArchResult>>()\n private readonly archToPackageCount = new Map<Arch, number>()\n private readonly infoToIsDelete = new Map<PackageFileInfo, boolean>()\n\n /** @private */\n refCount = 0\n\n constructor(private readonly elevateHelper: CopyElevateHelper) {}\n\n async packArch(arch: Arch, target: NsisTarget): Promise<PackArchResult> {\n const cacheKey = `${arch}:${target.appPackageCacheKey}`\n let resultPromise = this.archToResult.get(cacheKey)\n if (resultPromise == null) {\n const appOutDir = target.archs.get(arch)!\n // the first package of an arch keeps the usual file name; any further one (a target with\n // different packaging settings) gets a distinct name so it never overwrites the other\n const packageCount = (this.archToPackageCount.get(arch) ?? 0) + 1\n this.archToPackageCount.set(arch, packageCount)\n const fileNameSuffix = packageCount === 1 ? \"\" : `-${packageCount}`\n resultPromise = target.buildAppPackage(appOutDir, arch, this.elevateHelper, fileNameSuffix).then(async ({ fileInfo, storedMemberFiles }) => ({\n fileInfo,\n storedMemberFiles,\n unpackedSize: await dirSize(appOutDir),\n }))\n this.archToResult.set(cacheKey, resultPromise)\n }\n\n const result = await resultPromise\n const { fileInfo: info } = result\n if (target.isWebInstaller) {\n this.infoToIsDelete.set(info, false)\n } else if (!this.infoToIsDelete.has(info)) {\n this.infoToIsDelete.set(info, true)\n }\n return result\n }\n\n async finishBuild(): Promise<any> {\n if (--this.refCount > 0) {\n return\n }\n\n const filesToDelete: Array<string> = []\n for (const [info, isDelete] of this.infoToIsDelete.entries()) {\n if (isDelete) {\n filesToDelete.push(info.path)\n }\n }\n\n await Promise.all(filesToDelete.map(it => fs.unlink(it)))\n }\n}\n\nexport class CopyElevateHelper {\n // Cached path resolution — shared across all arches since the source never changes per build.\n private elevatePath: Promise<string | null> | null = null\n\n // appOutDirs whose win-unpacked copy of elevate.exe has already been deferred, so the same\n // directory isn't queued twice when multiple NSIS targets (e.g. nsis + nsis-web) share an arch.\n private readonly stagedUnpackedCopies = new Set<string>()\n\n private resolve(target: NsisTarget): Promise<string | null> {\n if (!target.packager.framework.isCopyElevateHelper) {\n return Promise.resolve(null)\n }\n\n let isPackElevateHelper = target.options.packElevateHelper\n if (isPackElevateHelper === false && target.options.perMachine === true) {\n isPackElevateHelper = true\n log.warn(\"`packElevateHelper = false` is ignored, because `perMachine` is set to `true`\")\n }\n\n if (isPackElevateHelper === false) {\n return Promise.resolve(null)\n }\n\n if (this.elevatePath == null) {\n this.elevatePath = getNsisElevatePath(target.packager.config.toolsets?.nsis, target.packager.buildResourcesDir, target.nsisToolsetOptions)\n }\n\n return this.elevatePath\n }\n\n // Injects elevate.exe directly into the already-built NSIS archive via a temp staging dir, and\n // defers copying it into win-unpacked until every target has finished reading the shared\n // appOutDir. This keeps elevate.exe in the dir-target output while guaranteeing concurrent\n // targets (Squirrel, ZIP, appx, …) never capture it mid-build (fixes the #9852 race).\n async addToArchive(archiveFile: string, target: NsisTarget, format: string, archiveOptions: ArchiveOptions, appOutDir: string): Promise<void> {\n const elevatePath = await this.resolve(target)\n if (!elevatePath) {\n return\n }\n\n const stagingDir = await target.packager.tempDirManager.getTempDir({ prefix: \"elevate-staging\" })\n const resourcesDir = path.join(stagingDir, \"resources\")\n await fs.mkdir(resourcesDir, { recursive: true })\n const stagedElevate = path.join(resourcesDir, \"elevate.exe\")\n await copyFile(elevatePath, stagedElevate, false)\n\n if (!isWindowsSigningDisabled(target.packager.platformOptions)) {\n await target.packager.signIf(stagedElevate)\n }\n\n // Reuse the parent archive's compression args so the appended entry is consistent with the\n // rest of the archive (notably `store` and differential-aware builds, where bare `7za a`\n // defaults — solid on, -mx=9, NTFS timestamps — would diverge from the original entries).\n const args = compute7zCompressArgs(format, archiveOptions)\n args.push(archiveFile, \"resources/elevate.exe\")\n await exec(await getPath7za(), args, { cwd: stagingDir }, debug7z.enabled)\n\n // Defer the win-unpacked copy: it must land after every concurrent target has packaged\n // appOutDir, so it is never captured by Squirrel/zip/etc. The staged (and possibly signed)\n // binary lives in tempDirManager, which is cleaned up only after the build finishes.\n if (!this.stagedUnpackedCopies.has(appOutDir)) {\n this.stagedUnpackedCopies.add(appOutDir)\n target.packager.addBuildFinalizeTask(async () => {\n // into a directory that extraResources were copied into: replace, never follow, a symlink at the name\n const unpackedElevate = path.join(appOutDir, \"resources\", \"elevate.exe\")\n await prepareFixedNameWrite(appOutDir, unpackedElevate, \"elevate.exe helper\")\n await copyFile(stagedElevate, unpackedElevate, false)\n })\n }\n }\n}\n\nclass BinaryReader {\n private readonly _buffer: Buffer\n private _position: number\n\n constructor(buffer: Buffer) {\n this._buffer = buffer\n this._position = 0\n }\n\n get length(): number {\n return this._buffer.length\n }\n\n get position(): number {\n return this._position\n }\n\n match(signature: Array<number>): boolean {\n if (signature.every((v, i) => this._buffer[this._position + i] === v)) {\n this._position += signature.length\n return true\n }\n return false\n }\n\n skip(offset: number) {\n this._position += offset\n }\n\n bytes(size: number): Buffer {\n const value = this._buffer.subarray(this._position, this._position + size)\n this._position += size\n return value\n }\n\n uint16(): number {\n const value = this._buffer[this._position] | (this._buffer[this._position + 1] << 8)\n this._position += 2\n return value\n }\n\n uint32(): number {\n return this.uint16() | (this.uint16() << 16)\n }\n}\n\nexport class UninstallerReader {\n // noinspection SpellCheckingInspection\n static async exec(installerPath: string, uninstallerPath: string) {\n const buffer = await fs.readFile(installerPath)\n const reader = new BinaryReader(buffer)\n // IMAGE_DOS_HEADER\n if (!reader.match([0x4d, 0x5a])) {\n throw new Error(\"Invalid 'MZ' signature.\")\n }\n reader.skip(58)\n // e_lfanew\n reader.skip(reader.uint32() - reader.position)\n // IMAGE_FILE_HEADER\n if (!reader.match([0x50, 0x45, 0x00, 0x00])) {\n throw new Error(\"Invalid 'PE' signature.\")\n }\n reader.skip(2)\n const numberOfSections = reader.uint16()\n reader.skip(12)\n const sizeOfOptionalHeader = reader.uint16()\n reader.skip(2)\n reader.skip(sizeOfOptionalHeader)\n // IMAGE_SECTION_HEADER\n // makensis appends the NSIS data right after the exehead stub, so it starts where the last section's raw data ends. Which sections\n // a stub has depends on the toolchain that built it: the MSVC stubs of nsis@1.2.1 have .text/.rdata/.data/.rsrc (and an empty\n // .ndata), the MinGW stubs of nsis@2.0.4 and later also have raw data in .idata and .ndata. The firstheader check below and the\n // NSIS CRC check of the result reject a wrong offset.\n let nsisOffset = 0\n for (let i = 0; i < numberOfSections; i++) {\n reader.skip(16) // Name, VirtualSize, VirtualAddress\n const rawSize = reader.uint32()\n const rawPointer = reader.uint32()\n reader.skip(16)\n if (rawPointer !== 0 && rawSize !== 0) {\n nsisOffset = Math.max(rawPointer + rawSize, nsisOffset)\n }\n }\n if (nsisOffset === 0 || nsisOffset >= buffer.length) {\n throw new Error(\"No NSIS data after the executable sections.\")\n }\n // copied, because the uninstaller icon is patched into it below\n const executable = Buffer.from(buffer.subarray(0, nsisOffset))\n const nsisSize = buffer.length - nsisOffset\n const nsisReader = new BinaryReader(buffer.subarray(nsisOffset, nsisOffset + nsisSize))\n if (!isNsisFirstHeader(buffer, nsisOffset)) {\n throw new Error(\"Invalid signature.\")\n }\n nsisReader.skip(NSIS_FIRST_HEADER_SIZE - 4)\n if (nsisSize !== nsisReader.uint32()) {\n throw new Error(\"Size mismatch.\")\n }\n\n // The data block is a sequence of [size | compressed flag][data] entries (non-solid compression only).\n // makensis stores the uninstaller icon patch and then the uninstaller data as two consecutive entries (build.cpp uninstall_generate)\n let iconData: Buffer | null = null\n let innerBuffer: Buffer | null = null\n let previousBlock: Buffer | null = null\n while (true) {\n let size = nsisReader.uint32()\n const compressed = (size & 0x80000000) !== 0\n size = size & 0x7fffffff\n if (size === 0 || nsisReader.position + size > nsisReader.length || nsisReader.position >= nsisReader.length) {\n break\n }\n let block = nsisReader.bytes(size)\n if (compressed) {\n block = zlib.inflateRawSync(block)\n }\n if (isNsisFirstHeader(block, 0) && (block.readUInt32LE(0) & FH_FLAGS_UNINSTALL) !== 0) {\n if (innerBuffer) {\n throw new Error(\"Multiple inner blocks.\")\n }\n innerBuffer = block\n iconData = previousBlock\n }\n previousBlock = block\n }\n if (!innerBuffer || !iconData) {\n throw new Error(\"Inner block not found.\")\n }\n applyUninstallerIconData(executable, iconData)\n\n const uninstaller = Buffer.concat([executable, innerBuffer])\n verifyNsisIntegrity(uninstaller)\n await fs.writeFile(uninstallerPath, uninstaller)\n }\n}\n\nconst NSIS_FIRST_HEADER_SIZE = 28\n// siginfo (0xDEADBEEF) followed by \"NullsoftInst\"; the preceding 4 bytes of the firstheader are its flags\nconst NSIS_SIGNATURE = Buffer.from([0xef, 0xbe, 0xad, 0xde, 0x4e, 0x75, 0x6c, 0x6c, 0x73, 0x6f, 0x66, 0x74, 0x49, 0x6e, 0x73, 0x74])\nconst FH_FLAGS_MASK = 15\nconst FH_FLAGS_UNINSTALL = 1\nconst FH_FLAGS_NO_CRC = 4\nconst FH_FLAGS_FORCE_CRC = 8\n\nfunction isNsisFirstHeader(data: Buffer, offset: number): boolean {\n return (\n offset + NSIS_FIRST_HEADER_SIZE <= data.length &&\n (data.readUInt32LE(offset) & ~FH_FLAGS_MASK) === 0 &&\n data.subarray(offset + 4, offset + 4 + NSIS_SIGNATURE.length).equals(NSIS_SIGNATURE)\n )\n}\n\n// WriteUninstaller (exehead/exec.c) patches the uninstaller icon into a copy of the installer's exehead before writing it out,\n// and makensis computes the uninstaller CRC over that patched exehead. The icon data is a list of [size][offset][bytes] records.\nfunction applyUninstallerIconData(executable: Buffer, iconData: Buffer) {\n let position = 0\n // exec.c stops at the first zero byte (not a zero dword), so mirror that exactly\n while (position < iconData.length && iconData[position] !== 0) {\n if (position + 8 > iconData.length) {\n throw new Error(\"Truncated uninstaller icon data.\")\n }\n const size = iconData.readUInt32LE(position)\n const offset = iconData.readUInt32LE(position + 4)\n position += 8\n if (position + size > iconData.length || offset + size > executable.length) {\n throw new Error(\"Invalid uninstaller icon data.\")\n }\n iconData.copy(executable, offset, position, position + size)\n position += size\n }\n if (position >= iconData.length) {\n throw new Error(\"Uninstaller icon data is not terminated.\")\n }\n}\n\n/**\n * Performs the same integrity check that the NSIS exehead runs on startup (loadHeaders in exehead/fileform.c),\n * so a broken uninstaller fails the build instead of showing \"Installer integrity check has failed\" to the end user.\n */\nexport function verifyNsisIntegrity(data: Buffer): void {\n // the exehead looks for the firstheader at 512-byte boundaries\n for (let offset = 0; offset < data.length; offset += 512) {\n if (!isNsisFirstHeader(data, offset)) {\n continue\n }\n const flags = data.readUInt32LE(offset)\n if ((flags & FH_FLAGS_FORCE_CRC) === 0 && (flags & FH_FLAGS_NO_CRC) !== 0) {\n return\n }\n const lengthOfAllFollowingData = data.readUInt32LE(offset + 24)\n if (lengthOfAllFollowingData < NSIS_FIRST_HEADER_SIZE + 4 || lengthOfAllFollowingData > data.length - offset) {\n throw new Error(\"NSIS integrity check failed: data length mismatch.\")\n }\n // the first 512 bytes are not covered, the CRC itself is stored right after the checked data\n const crcOffset = offset + lengthOfAllFollowingData - 4\n const actual = zlib.crc32(data.subarray(offset === 0 ? 0 : 512, crcOffset))\n const expected = data.readUInt32LE(crcOffset)\n if (actual !== expected) {\n throw new Error(`NSIS integrity check failed: CRC32 is 0x${actual.toString(16)}, expected 0x${expected.toString(16)}.`)\n }\n return\n }\n throw new Error(\"NSIS integrity check failed: NSIS header not found.\")\n}\n"]}
@@ -20,6 +20,16 @@ declare const sevenZipChecksums: {
20
20
  readonly "7zip-win-x64.tar.gz": "db50b64348d9560b875a00bd7e02f02b5f7f4b54ff5efa5908c38858c89c9f33";
21
21
  readonly "7zip-linux-x64.tar.gz": "c6c2d744f5e71f100e7631786bca78b6f1738734454e8dd4bf6078d4895765f7";
22
22
  };
23
+ readonly "1.1.0": {
24
+ readonly "7zip-linux-ia32.tar.gz": "cd5d5255fc2f5a65f8d248f42ed5cbe5f9f6f701a12a26f40631740ef400794f";
25
+ readonly "7zip-darwin-arm64.tar.gz": "4d04c3a7c4c10b4b70cf25ab4e5ed6be7a141e98aefc536a87174ddb0bc3c050";
26
+ readonly "7zip-darwin-x86_64.tar.gz": "4d04c3a7c4c10b4b70cf25ab4e5ed6be7a141e98aefc536a87174ddb0bc3c050";
27
+ readonly "7zip-linux-arm64.tar.gz": "6250e76fe2c0af4247cc9ad41f6f9365ae95deae23a2592f42ba005cc20d8939";
28
+ readonly "7zip-win-arm64.tar.gz": "25aabfe776ffcd7dc172479beb06dd0505fd0b4e89451ceedb99efbd255ef829";
29
+ readonly "7zip-win-ia32.tar.gz": "020186756c2b370c7f840fb90a78e0b2e556fdcd6d356bc4f412021bd78cda5d";
30
+ readonly "7zip-win-x64.tar.gz": "032e591acc4c0eb3f2e1fc05ff3ec867e57f63369c74d13c0c73f973cae5fd6a";
31
+ readonly "7zip-linux-x64.tar.gz": "98ac470cf076f19241b5ee259e135de0adc3c3b8076c41682d6468c2a9990845";
32
+ };
23
33
  };
24
34
  export type SevenZipVersion = keyof typeof sevenZipChecksums;
25
35
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"7zip.d.ts","sourceRoot":"","sources":["../../src/toolsets/7zip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAS9C,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;CAuBb,CAAA;AAEV,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,iBAAiB,CAAA;AAgC5D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAGxD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAGtF;AAED,oHAAoH;AACpH,wBAAgB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAQ5C"}
1
+ {"version":3,"file":"7zip.d.ts","sourceRoot":"","sources":["../../src/toolsets/7zip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAS9C,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCb,CAAA;AAEV,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,iBAAiB,CAAA;AAgC5D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAGxD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAGtF;AAED,oHAAoH;AACpH,wBAAgB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAQ5C"}
@@ -3,7 +3,7 @@ import * as path from "path";
3
3
  import { downloadBuilderToolset } from "../util/electronGet.js";
4
4
  import { resolveToolsetVersion } from "./version.js";
5
5
  // Newest 7-Zip bundle — selected when the config is unset / null / "latest".
6
- const SEVEN_ZIP_LATEST = "1.0.1";
6
+ const SEVEN_ZIP_LATEST = "1.1.0";
7
7
  const sevenZipChecksums = {
8
8
  // shipped the 32-bit 7za.exe for every Windows arch — 1.75 GiB memory cap, no LZMA2 multithreading on x64/arm64 (electron-builder-binaries#222)
9
9
  "1.0.0": {
@@ -27,6 +27,17 @@ const sevenZipChecksums = {
27
27
  "7zip-win-x64.tar.gz": "db50b64348d9560b875a00bd7e02f02b5f7f4b54ff5efa5908c38858c89c9f33",
28
28
  "7zip-linux-x64.tar.gz": "c6c2d744f5e71f100e7631786bca78b6f1738734454e8dd4bf6078d4895765f7",
29
29
  },
30
+ // 7-Zip 26.05 (was 24.09) — upstream security fixes incl. CVE-2025-11001 / CVE-2025-11002, CVE-2025-55188, CVE-2026-14266
31
+ "1.1.0": {
32
+ "7zip-linux-ia32.tar.gz": "cd5d5255fc2f5a65f8d248f42ed5cbe5f9f6f701a12a26f40631740ef400794f",
33
+ "7zip-darwin-arm64.tar.gz": "4d04c3a7c4c10b4b70cf25ab4e5ed6be7a141e98aefc536a87174ddb0bc3c050",
34
+ "7zip-darwin-x86_64.tar.gz": "4d04c3a7c4c10b4b70cf25ab4e5ed6be7a141e98aefc536a87174ddb0bc3c050",
35
+ "7zip-linux-arm64.tar.gz": "6250e76fe2c0af4247cc9ad41f6f9365ae95deae23a2592f42ba005cc20d8939",
36
+ "7zip-win-arm64.tar.gz": "25aabfe776ffcd7dc172479beb06dd0505fd0b4e89451ceedb99efbd255ef829",
37
+ "7zip-win-ia32.tar.gz": "020186756c2b370c7f840fb90a78e0b2e556fdcd6d356bc4f412021bd78cda5d",
38
+ "7zip-win-x64.tar.gz": "032e591acc4c0eb3f2e1fc05ff3ec867e57f63369c74d13c0c73f973cae5fd6a",
39
+ "7zip-linux-x64.tar.gz": "98ac470cf076f19241b5ee259e135de0adc3c3b8076c41682d6468c2a9990845",
40
+ },
30
41
  };
31
42
  function getFilename() {
32
43
  const { platform, arch } = process;