app-builder-lib 27.0.0-alpha.5 → 27.0.0-alpha.7

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 (154) hide show
  1. package/dist/appInfo.d.ts +1 -1
  2. package/dist/appInfo.d.ts.map +1 -1
  3. package/dist/appInfo.js +3 -3
  4. package/dist/appInfo.js.map +1 -1
  5. package/dist/codeSign/win/signtoolBaseSignManager.d.ts +23 -0
  6. package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
  7. package/dist/codeSign/win/signtoolBaseSignManager.js +75 -3
  8. package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
  9. package/dist/configuration.d.ts +89 -5
  10. package/dist/configuration.d.ts.map +1 -1
  11. package/dist/configuration.js +11 -1
  12. package/dist/configuration.js.map +1 -1
  13. package/dist/electron/ElectronFramework.d.ts +2 -1
  14. package/dist/electron/ElectronFramework.d.ts.map +1 -1
  15. package/dist/electron/ElectronFramework.js +30 -26
  16. package/dist/electron/ElectronFramework.js.map +1 -1
  17. package/dist/electron/electronArchSupport.d.ts +12 -0
  18. package/dist/electron/electronArchSupport.d.ts.map +1 -0
  19. package/dist/electron/electronArchSupport.js +58 -0
  20. package/dist/electron/electronArchSupport.js.map +1 -0
  21. package/dist/electron/mac/electronMac.js +12 -21
  22. package/dist/electron/mac/electronMac.js.map +1 -1
  23. package/dist/electron/mac/electronMacUtils.d.ts +24 -0
  24. package/dist/electron/mac/electronMacUtils.d.ts.map +1 -0
  25. package/dist/electron/mac/electronMacUtils.js +42 -0
  26. package/dist/electron/mac/electronMacUtils.js.map +1 -0
  27. package/dist/fileMatcher.d.ts +15 -0
  28. package/dist/fileMatcher.d.ts.map +1 -1
  29. package/dist/fileMatcher.js +41 -2
  30. package/dist/fileMatcher.js.map +1 -1
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js.map +1 -1
  34. package/dist/indexInternal.d.ts +5 -2
  35. package/dist/indexInternal.d.ts.map +1 -1
  36. package/dist/indexInternal.js +5 -1
  37. package/dist/indexInternal.js.map +1 -1
  38. package/dist/macPackager.d.ts.map +1 -1
  39. package/dist/macPackager.js +17 -6
  40. package/dist/macPackager.js.map +1 -1
  41. package/dist/node-module-collector/moduleManager.d.ts +2 -1
  42. package/dist/node-module-collector/moduleManager.d.ts.map +1 -1
  43. package/dist/node-module-collector/moduleManager.js +2 -0
  44. package/dist/node-module-collector/moduleManager.js.map +1 -1
  45. package/dist/node-module-collector/nodeModulesCollector.d.ts +28 -2
  46. package/dist/node-module-collector/nodeModulesCollector.d.ts.map +1 -1
  47. package/dist/node-module-collector/nodeModulesCollector.js +95 -6
  48. package/dist/node-module-collector/nodeModulesCollector.js.map +1 -1
  49. package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts.map +1 -1
  50. package/dist/node-module-collector/pnpmNodeModulesCollector.js +3 -1
  51. package/dist/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
  52. package/dist/node-module-collector/types.d.ts +2 -0
  53. package/dist/node-module-collector/types.d.ts.map +1 -1
  54. package/dist/node-module-collector/types.js.map +1 -1
  55. package/dist/options/MsixOptions.d.ts +126 -0
  56. package/dist/options/MsixOptions.d.ts.map +1 -0
  57. package/dist/options/MsixOptions.js +2 -0
  58. package/dist/options/MsixOptions.js.map +1 -0
  59. package/dist/options/SnapOptions.d.ts +8 -4
  60. package/dist/options/SnapOptions.d.ts.map +1 -1
  61. package/dist/options/SnapOptions.js.map +1 -1
  62. package/dist/options/macOptions.d.ts +21 -11
  63. package/dist/options/macOptions.d.ts.map +1 -1
  64. package/dist/options/macOptions.js.map +1 -1
  65. package/dist/options/winOptions.d.ts +7 -6
  66. package/dist/options/winOptions.d.ts.map +1 -1
  67. package/dist/options/winOptions.js.map +1 -1
  68. package/dist/packager.d.ts.map +1 -1
  69. package/dist/packager.js +8 -1
  70. package/dist/packager.js.map +1 -1
  71. package/dist/publish/PublishManager.d.ts.map +1 -1
  72. package/dist/publish/PublishManager.js +13 -4
  73. package/dist/publish/PublishManager.js.map +1 -1
  74. package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
  75. package/dist/publish/updateInfoBuilder.js +23 -23
  76. package/dist/publish/updateInfoBuilder.js.map +1 -1
  77. package/dist/targets/archive.d.ts +11 -0
  78. package/dist/targets/archive.d.ts.map +1 -1
  79. package/dist/targets/archive.js +40 -22
  80. package/dist/targets/archive.js.map +1 -1
  81. package/dist/targets/linux/FlatpakTarget.d.ts.map +1 -1
  82. package/dist/targets/linux/FlatpakTarget.js +4 -1
  83. package/dist/targets/linux/FlatpakTarget.js.map +1 -1
  84. package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
  85. package/dist/targets/linux/FpmTarget.js +9 -0
  86. package/dist/targets/linux/FpmTarget.js.map +1 -1
  87. package/dist/targets/linux/appimage/appImageUtil.d.ts +1 -1
  88. package/dist/targets/linux/appimage/appImageUtil.js +3 -3
  89. package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
  90. package/dist/targets/linux/snap/core24.d.ts +27 -0
  91. package/dist/targets/linux/snap/core24.d.ts.map +1 -1
  92. package/dist/targets/linux/snap/core24.js +92 -57
  93. package/dist/targets/linux/snap/core24.js.map +1 -1
  94. package/dist/targets/linux/snap/snapcraft.d.ts +190 -0
  95. package/dist/targets/linux/snap/snapcraft.d.ts.map +1 -0
  96. package/dist/targets/linux/snap/snapcraft.js +11 -0
  97. package/dist/targets/linux/snap/snapcraft.js.map +1 -0
  98. package/dist/targets/mac/MacTargetHelper.d.ts +18 -2
  99. package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
  100. package/dist/targets/mac/MacTargetHelper.js +42 -12
  101. package/dist/targets/mac/MacTargetHelper.js.map +1 -1
  102. package/dist/targets/win/AppxTarget.d.ts +0 -2
  103. package/dist/targets/win/AppxTarget.d.ts.map +1 -1
  104. package/dist/targets/win/AppxTarget.js +37 -325
  105. package/dist/targets/win/AppxTarget.js.map +1 -1
  106. package/dist/targets/win/MsiTarget.js +2 -2
  107. package/dist/targets/win/MsiTarget.js.map +1 -1
  108. package/dist/targets/win/MsixTarget.d.ts +22 -0
  109. package/dist/targets/win/MsixTarget.d.ts.map +1 -0
  110. package/dist/targets/win/MsixTarget.js +214 -0
  111. package/dist/targets/win/MsixTarget.js.map +1 -0
  112. package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
  113. package/dist/targets/win/nsis/NsisTarget.js +5 -0
  114. package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
  115. package/dist/targets/win/winAppUtil.d.ts +115 -0
  116. package/dist/targets/win/winAppUtil.d.ts.map +1 -0
  117. package/dist/targets/win/winAppUtil.js +407 -0
  118. package/dist/targets/win/winAppUtil.js.map +1 -0
  119. package/dist/toolsets/custom.js +4 -2
  120. package/dist/toolsets/custom.js.map +1 -1
  121. package/dist/toolsets/icons.d.ts.map +1 -1
  122. package/dist/toolsets/icons.js +4 -1
  123. package/dist/toolsets/icons.js.map +1 -1
  124. package/dist/toolsets/winCodeSign.d.ts +9 -0
  125. package/dist/toolsets/winCodeSign.d.ts.map +1 -1
  126. package/dist/toolsets/winCodeSign.js +11 -0
  127. package/dist/toolsets/winCodeSign.js.map +1 -1
  128. package/dist/util/appFileCopier.d.ts.map +1 -1
  129. package/dist/util/appFileCopier.js +85 -4
  130. package/dist/util/appFileCopier.js.map +1 -1
  131. package/dist/util/electronGet.d.ts +5 -0
  132. package/dist/util/electronGet.d.ts.map +1 -1
  133. package/dist/util/electronGet.js +124 -18
  134. package/dist/util/electronGet.js.map +1 -1
  135. package/dist/util/flags.d.ts +0 -1
  136. package/dist/util/flags.d.ts.map +1 -1
  137. package/dist/util/flags.js +0 -3
  138. package/dist/util/flags.js.map +1 -1
  139. package/dist/util/packageMetadata.js +46 -31
  140. package/dist/util/packageMetadata.js.map +1 -1
  141. package/dist/version.d.ts +1 -1
  142. package/dist/version.js +1 -1
  143. package/dist/version.js.map +1 -1
  144. package/dist/vm/ParallelsVm.d.ts.map +1 -1
  145. package/dist/vm/ParallelsVm.js +18 -5
  146. package/dist/vm/ParallelsVm.js.map +1 -1
  147. package/dist/winPackager.d.ts.map +1 -1
  148. package/dist/winPackager.js +3 -0
  149. package/dist/winPackager.js.map +1 -1
  150. package/package.json +8 -8
  151. package/scheme.json +498 -18
  152. package/templates/appx/appxmanifest.xml +1 -1
  153. package/templates/msix/appxmanifest.xml +45 -0
  154. package/templates/nsis/installSection.nsh +14 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ElectronFramework.js","sourceRoot":"","sources":["../../src/electron/ElectronFramework.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,GAAG,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC5J,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,SAAS,MAAM,iBAAiB,CAAA;AAGvC,OAAO,EAAY,QAAQ,EAAE,MAAM,aAAa,CAAA;AAIhD,OAAO,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAA;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAA;AAalD,MAAM,UAAU,kBAAkB,CAAC,IAAmB;IACpD,OAA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,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;QAC7E,KAAK;YACH,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;YACnB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;gBACnF,YAAY;YACd,CAAC,CAAC;KACP,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { asArray, copyDir, DO_NOT_USE_HARD_LINKS, isEmptyOrSpaces, log, MAX_FILE_REQUESTS, sanitizeDirPath, statOrNull, unlinkIfExists } from \"builder-util\"\nimport _fsExtra from \"fs-extra\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { Configuration } from \"../configuration.js\"\nimport { BeforeCopyExtraFilesOptions, Framework, PrepareApplicationStageDirectoryOptions } from \"../Framework.js\"\nimport { Packager, Platform } from \"../index.js\"\nimport { LinuxPackager } from \"../linuxPackager.js\"\nimport { MacPackager } from \"../macPackager.js\"\nimport { PlatformType } from \"../targets/mac/MacTargetHelper.js\"\nimport { downloadElectronArtifactZip, extractArchive } from \"../util/electronGet.js\"\nimport { getTemplatePath } from \"../util/pathManager.js\"\nimport { resolveFunction } from \"../util/resolve.js\"\nimport { computeElectronVersion, getElectronVersionFromInstalled } from \"./electronVersion.js\"\nimport { FFMPEGInjector } from \"./injectFFMPEG.js\"\nimport { createMacApp } from \"./mac/electronMac.js\"\nimport { addWinAsarIntegrity } from \"./win/electronWin.js\"\nconst { emptyDir, readdir, rename, rm } = _fsExtra\n\nexport type ElectronPlatformName = \"darwin\" | \"linux\" | \"win32\" | \"mas\"\n\n/**\n * Electron distributables branding options.\n * @see [Electron BRANDING.json](https://github.com/electron/electron/blob/master/shell/app/BRANDING.json).\n */\nexport interface ElectronBrandingOptions {\n projectName?: string\n productName?: string\n}\n\nexport function createBrandingOpts(opts: Configuration): Required<ElectronBrandingOptions> {\n return {\n projectName: opts.electronBranding?.projectName || \"electron\",\n productName: opts.electronBranding?.productName || \"Electron\",\n }\n}\n\nasync function beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n const { appOutDir, packager } = options\n const electronBranding = createBrandingOpts(packager.config)\n if (packager.platform === Platform.LINUX) {\n const linuxPackager = packager as LinuxPackager\n const executable = path.join(appOutDir, linuxPackager.executableName)\n await rename(path.join(appOutDir, electronBranding.projectName), executable)\n } else if (packager.platform === Platform.WINDOWS) {\n const executable = path.join(appOutDir, `${packager.appInfo.productFilename}.exe`)\n await rename(path.join(appOutDir, `${electronBranding.projectName}.exe`), executable)\n if (options.asarIntegrity) {\n await addWinAsarIntegrity(executable, options.asarIntegrity)\n }\n } else {\n // Prefer the threaded 3-way flavor; fall back to the lossy platformName only if it wasn't provided.\n const targetPlatform: PlatformType = options.platformType ?? (options.platformName === \"mas\" ? \"mas\" : \"mac\")\n await createMacApp(packager as MacPackager, appOutDir, options.asarIntegrity, targetPlatform)\n }\n await removeUnusedLanguagesIfNeeded(options)\n}\n\nasync function removeUnusedLanguagesIfNeeded(options: BeforeCopyExtraFilesOptions) {\n const { packager, appOutDir } = options\n const { config, platform } = packager\n\n const getLocalesConfig = () => {\n if (platform === Platform.MAC) {\n return { dirs: [packager.getResourcesDir(appOutDir), packager.getMacOsElectronFrameworkResourcesDir(appOutDir)], langFileExt: \".lproj\" }\n }\n return { dirs: [path.join(packager.getResourcesDir(appOutDir), \"..\", \"locales\")], langFileExt: \".pak\" }\n }\n\n const wantedLanguages = asArray(packager.platformOptions.electronLanguages || config.electronLanguages)\n .map(it => it.trim().toLowerCase())\n .filter(it => it.length > 0)\n if (!wantedLanguages.length) {\n return\n }\n\n const { dirs, langFileExt } = getLocalesConfig()\n // noinspection SpellCheckingInspection\n const deleteNonMatchedLanguages: (dir: string) => Promise<Promise<void>[] | undefined> = async (dir: string) => {\n const files = await readdir(dir)\n return files.map(async file => {\n if (path.extname(file) !== langFileExt) {\n return\n }\n\n const language = path.basename(file, langFileExt).toLowerCase()\n const isWantedLocale = wantedLanguages.some(\n wantedLanguage =>\n // exact file\n wantedLanguage === language ||\n // prefix (e.g. \"en\" matches \"en-US\")\n wantedLanguage.startsWith(`${language}-`) ||\n // prefix (e.g. \"en\" matches \"en_US\")\n wantedLanguage.startsWith(`${language}_`)\n )\n if (isWantedLocale) {\n return undefined\n }\n return rm(path.join(dir, file), { recursive: true, force: true })\n })\n }\n const allDeletedFiles = (await Promise.all(dirs.map(deleteNonMatchedLanguages))).flat().filter((it): it is Promise<void> => it != null)\n if (allDeletedFiles.length === 0) {\n log.warn({ electronLanguages: wantedLanguages }, \"no locales found matching wanted languages, skipping cleanup\")\n return\n }\n await asyncPool(MAX_FILE_REQUESTS, allDeletedFiles, it => it)\n}\n\nclass ElectronFramework implements Framework {\n // noinspection JSUnusedGlobalSymbols\n readonly macOsDefaultTargets = [\"zip\", \"dmg\"]\n // noinspection JSUnusedGlobalSymbols\n readonly defaultAppIdPrefix = \"com.electron.\"\n // noinspection JSUnusedGlobalSymbols\n readonly isCopyElevateHelper = true\n // noinspection JSUnusedGlobalSymbols\n readonly isNpmRebuildRequired = true\n\n constructor(\n readonly name: string,\n readonly version: string,\n readonly macOsProductName: string\n ) {}\n\n get distMacOsAppName(): string {\n return `${this.macOsProductName}.app`\n }\n\n getDefaultIcon(platform: Platform) {\n if (platform === Platform.LINUX) {\n return path.join(getTemplatePath(\"icons\"), \"electron-linux\")\n } else {\n // default icon is embedded into app skeleton\n return null\n }\n }\n\n async prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n const shouldCleanup = await unpack(options, this.distMacOsAppName)\n await cleanupAfterUnpack(options, this.distMacOsAppName, shouldCleanup)\n if (options.packager.config.downloadAlternateFFmpeg) {\n const injector = new FFMPEGInjector(options, this.version, createBrandingOpts(options.packager.config))\n await injector.inject()\n }\n }\n\n beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n return beforeCopyExtraFiles(options)\n }\n}\n\nexport async function createElectronFrameworkSupport(configuration: Configuration, packager: Packager): Promise<Framework> {\n let version = configuration.electronVersion\n if (version == null) {\n // for prepacked app asar no dev deps in the app.asar\n if (packager.isPrepackedAppAsar) {\n version = await getElectronVersionFromInstalled(packager.projectDir)\n if (version == null) {\n throw new Error(`Cannot compute electron version for prepacked asar`)\n }\n } else {\n version = await computeElectronVersion(packager.projectDir)\n }\n configuration.electronVersion = version\n }\n\n const branding = createBrandingOpts(configuration)\n return new ElectronFramework(branding.projectName, version, branding.productName)\n}\n\n/**\n * Unpacks a custom or default Electron distribution into the app output directory.\n */\nasync function unpack(prepareOptions: PrepareApplicationStageDirectoryOptions, _distMacOsAppName: string): Promise<boolean> {\n async function selectElectron(filepath: string) {\n const resolvedDist = sanitizeDirPath(path.isAbsolute(filepath) ? filepath : path.resolve(packager.projectDir, filepath))\n\n const electronDistStats = await statOrNull(resolvedDist)\n if (!electronDistStats) {\n throw new Error(\n `The specified electronDist does not exist: ${resolvedDist}. Please provide a valid path to the Electron zip file, cache directory, or electron build directory.`\n )\n }\n\n if (resolvedDist.endsWith(\".zip\")) {\n log.info({ zipFile: resolvedDist }, \"using custom electronDist zip file\")\n await extractArchive(resolvedDist, appOutDir)\n return false // do not clean up after unpacking, it's a custom bundle and we should respect its configuration/contents as required\n }\n\n if (electronDistStats.isDirectory()) {\n // backward compatibility: if electronDist is a directory, check for the default zip file inside it\n const files = await readdir(resolvedDist)\n if (files.includes(defaultZipName)) {\n log.info({ electronDist: log.filePath(resolvedDist) }, \"using custom electronDist directory\")\n await extractArchive(path.join(resolvedDist, defaultZipName), appOutDir)\n return false // do not clean up after unpacking, it's a custom bundle and we should respect its configuration/contents as required\n }\n // if we reach here, it means the provided electronDist is neither a zip file nor a directory with the default zip file\n // e.g. we treat it as a custom already-unpacked Electron distribution\n log.info({ electronDist: log.filePath(resolvedDist) }, \"using custom unpacked Electron distribution\")\n const source = packager.getElectronSrcDir(resolvedDist)\n const destination = packager.getElectronDestinationDir(prepareOptions.appOutDir)\n log.info({ source, destination }, \"copying unpacked Electron\")\n await emptyDir(prepareOptions.appOutDir)\n await copyDir(source, destination, {\n isUseHardLink: DO_NOT_USE_HARD_LINKS,\n })\n return false\n }\n throw new Error(`The specified electronDist is neither a zip file nor a directory: ${resolvedDist}. Please provide a valid path to the Electron zip file or cache directory.`)\n }\n\n const { packager, appOutDir, platformName, arch, version } = prepareOptions\n const defaultZipName = `electron-v${version}-${platformName}-${arch}.zip`\n\n const electronDist = packager.config.electronDist\n if (typeof electronDist === \"string\" && !isEmptyOrSpaces(electronDist)) {\n return selectElectron(electronDist)\n }\n\n let resolvedDist: string | null = null\n try {\n const electronDistHook: any = await resolveFunction(packager.appInfo.type, electronDist, \"electronDist\", await packager.getWorkspaceRoot())\n resolvedDist = typeof electronDistHook === \"function\" ? await Promise.resolve(electronDistHook(prepareOptions)) : electronDistHook\n } catch (error: any) {\n log.warn({ error }, \"Failed to resolve electronDist, using default unpack logic\")\n }\n\n if (resolvedDist == null) {\n // if no custom electronDist is provided, use the default unpack logic\n log.debug(null, \"no custom electronDist provided, unpacking default Electron distribution\")\n const downloadOptions = packager.config.electronGet\n const zipPath = await downloadElectronArtifactZip({\n options: downloadOptions,\n artifactName: \"electron\",\n platformName: prepareOptions.platformName,\n arch: prepareOptions.arch,\n version: prepareOptions.version,\n })\n await extractArchive(zipPath, appOutDir)\n log.info({ output: appOutDir }, \"downloaded electron zip extracted successfully\")\n return true // indicates that we should clean up after unpacking\n }\n return selectElectron(resolvedDist)\n}\n\nfunction cleanupAfterUnpack(prepareOptions: PrepareApplicationStageDirectoryOptions, distMacOsAppName: string, isFullCleanup: boolean) {\n const out = prepareOptions.appOutDir\n const isMac = prepareOptions.packager.platform === Platform.MAC\n const resourcesPath = isMac ? path.join(out, distMacOsAppName, \"Contents\", \"Resources\") : path.join(out, \"resources\")\n\n return Promise.all([\n isFullCleanup ? unlinkIfExists(path.join(resourcesPath, \"default_app.asar\")) : Promise.resolve(),\n isFullCleanup ? unlinkIfExists(path.join(out, \"version\")) : Promise.resolve(),\n isMac\n ? Promise.resolve()\n : rename(path.join(out, \"LICENSE\"), path.join(out, \"LICENSE.electron.txt\")).catch(() => {\n /* ignore */\n }),\n ])\n}\n"]}
1
+ {"version":3,"file":"ElectronFramework.js","sourceRoot":"","sources":["../../src/electron/ElectronFramework.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,GAAG,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC5J,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,SAAS,MAAM,iBAAiB,CAAA;AAGvC,OAAO,EAAY,QAAQ,EAAE,MAAM,aAAa,CAAA;AAIhD,OAAO,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAA;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAA;AAalD,MAAM,UAAU,kBAAkB,CAAC,IAAmB;IACpD,OAAO;QACL,WAAW,EAAE,IAAI,CAAC,gBAAgB,EAAE,WAAW,IAAI,UAAU;QAC7D,WAAW,EAAE,IAAI,CAAC,gBAAgB,EAAE,W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GAAG,cAAc,CAAC,QAAQ,CAAC,QAAQ,KAAK,QAAQ,CAAC,GAAG,CAAA;IAC/D,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IAErH,OAAO,OAAO,CAAC,GAAG,CAAC;QACjB,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;QAChG,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;QAC7E,KAAK;YACH,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;YACnB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;gBACnF,YAAY;YACd,CAAC,CAAC;KACP,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { asArray, copyDir, DO_NOT_USE_HARD_LINKS, isEmptyOrSpaces, log, MAX_FILE_REQUESTS, sanitizeDirPath, statOrNull, unlinkIfExists } from \"builder-util\"\nimport _fsExtra from \"fs-extra\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { Configuration } from \"../configuration.js\"\nimport { BeforeCopyExtraFilesOptions, Framework, PrepareApplicationStageDirectoryOptions } from \"../Framework.js\"\nimport { Packager, Platform } from \"../index.js\"\nimport { LinuxPackager } from \"../linuxPackager.js\"\nimport { MacPackager } from \"../macPackager.js\"\nimport { PlatformType } from \"../targets/mac/MacTargetHelper.js\"\nimport { downloadElectronArtifactZip, extractArchive } from \"../util/electronGet.js\"\nimport { getTemplatePath } from \"../util/pathManager.js\"\nimport { resolveFunction } from \"../util/resolve.js\"\nimport { computeElectronVersion, getElectronVersionFromInstalled } from \"./electronVersion.js\"\nimport { FFMPEGInjector } from \"./injectFFMPEG.js\"\nimport { createMacApp } from \"./mac/electronMac.js\"\nimport { addWinAsarIntegrity } from \"./win/electronWin.js\"\nconst { emptyDir, readdir, rename, rm } = _fsExtra\n\nexport type ElectronPlatformName = \"darwin\" | \"linux\" | \"win32\" | \"mas\"\n\n/**\n * Electron distributables branding options.\n * @see [Electron BRANDING.json](https://github.com/electron/electron/blob/master/shell/app/BRANDING.json).\n */\nexport interface ElectronBrandingOptions {\n projectName?: string\n productName?: string\n}\n\nexport function createBrandingOpts(opts: Configuration): Required<ElectronBrandingOptions> {\n return {\n projectName: opts.electronBranding?.projectName || \"electron\",\n productName: opts.electronBranding?.productName || \"Electron\",\n }\n}\n\nasync function beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n const { appOutDir, packager } = options\n const electronBranding = createBrandingOpts(packager.config)\n if (packager.platform === Platform.LINUX) {\n const linuxPackager = packager as LinuxPackager\n const executable = path.join(appOutDir, linuxPackager.executableName)\n await rename(path.join(appOutDir, electronBranding.projectName), executable)\n } else if (packager.platform === Platform.WINDOWS) {\n const executable = path.join(appOutDir, `${packager.appInfo.productFilename}.exe`)\n await rename(path.join(appOutDir, `${electronBranding.projectName}.exe`), executable)\n if (options.asarIntegrity) {\n await addWinAsarIntegrity(executable, options.asarIntegrity)\n }\n } else {\n // Prefer the threaded 3-way flavor; fall back to the lossy platformName only if it wasn't provided.\n const targetPlatform: PlatformType = options.platformType ?? (options.platformName === \"mas\" ? \"mas\" : \"mac\")\n await createMacApp(packager as MacPackager, appOutDir, options.asarIntegrity, targetPlatform)\n }\n await removeUnusedLanguagesIfNeeded(options)\n}\n\nexport async function removeUnusedLanguagesIfNeeded(options: BeforeCopyExtraFilesOptions) {\n const { packager, appOutDir } = options\n const { config, platform } = packager\n\n const getLocalesConfig = () => {\n if (platform === Platform.MAC) {\n return { dirs: [packager.getResourcesDir(appOutDir), packager.getMacOsElectronFrameworkResourcesDir(appOutDir)], langFileExt: \".lproj\" }\n }\n return { dirs: [path.join(packager.getResourcesDir(appOutDir), \"..\", \"locales\")], langFileExt: \".pak\" }\n }\n\n // case-insensitive, treating \"-\" and \"_\" as the same separator\n const normalizeLocale = (locale: string) => locale.trim().toLowerCase().replace(/_/g, \"-\")\n const wantedLanguages = asArray(packager.platformOptions.electronLanguages || config.electronLanguages)\n .map(normalizeLocale)\n .filter(it => it.length > 0)\n if (!wantedLanguages.length) {\n return\n }\n\n // bare wanted \"en\" keeps \"en-US.pak\"; region-qualified wanted \"en-US\" keeps mac's bare \"en.lproj\"\n const isLocaleMatch = (wanted: string, language: string) => wanted === language || language.startsWith(`${wanted}-`) || wanted.startsWith(`${language}-`)\n\n const { dirs, langFileExt } = getLocalesConfig()\n const matchedWantedLanguages = new Set<string>()\n const filesToDelete: string[] = []\n for (const dir of dirs) {\n const localeFiles = (await readdir(dir)).filter(file => path.extname(file) === langFileExt)\n const unwantedFiles: string[] = []\n for (const file of localeFiles) {\n const language = normalizeLocale(path.basename(file, langFileExt))\n const matches = wantedLanguages.filter(wanted => isLocaleMatch(wanted, language))\n if (matches.length === 0) {\n unwantedFiles.push(path.join(dir, file))\n } else {\n matches.forEach(it => matchedWantedLanguages.add(it))\n }\n }\n if (localeFiles.length > 0 && unwantedFiles.length === localeFiles.length) {\n // an empty locales dir produces an app that crashes at startup (https://github.com/electron/electron/issues/52307)\n log.warn(\n { electronLanguages: wantedLanguages, dir },\n \"electronLanguages doesn't match any locale in this directory, skipping cleanup to avoid packaging an app without locales\"\n )\n continue\n }\n filesToDelete.push(...unwantedFiles)\n }\n\n const unmatchedLanguages = wantedLanguages.filter(it => !matchedWantedLanguages.has(it))\n if (unmatchedLanguages.length > 0) {\n log.warn({ electronLanguages: unmatchedLanguages }, \"some electronLanguages don't match any locale, they may be misspelled or unavailable on this platform\")\n }\n await asyncPool(MAX_FILE_REQUESTS, filesToDelete, file => rm(file, { recursive: true, force: true }))\n}\n\nclass ElectronFramework implements Framework {\n // noinspection JSUnusedGlobalSymbols\n readonly macOsDefaultTargets = [\"zip\", \"dmg\"]\n // noinspection JSUnusedGlobalSymbols\n readonly defaultAppIdPrefix = \"com.electron.\"\n // noinspection JSUnusedGlobalSymbols\n readonly isCopyElevateHelper = true\n // noinspection JSUnusedGlobalSymbols\n readonly isNpmRebuildRequired = true\n\n constructor(\n readonly name: string,\n readonly version: string,\n readonly macOsProductName: string\n ) {}\n\n get distMacOsAppName(): string {\n return `${this.macOsProductName}.app`\n }\n\n getDefaultIcon(platform: Platform) {\n if (platform === Platform.LINUX) {\n return path.join(getTemplatePath(\"icons\"), \"electron-linux\")\n } else {\n // default icon is embedded into app skeleton\n return null\n }\n }\n\n async prepareApplicationStageDirectory(options: PrepareApplicationStageDirectoryOptions) {\n const shouldCleanup = await unpack(options, this.distMacOsAppName)\n await cleanupAfterUnpack(options, this.distMacOsAppName, shouldCleanup)\n if (options.packager.config.downloadAlternateFFmpeg) {\n const injector = new FFMPEGInjector(options, this.version, createBrandingOpts(options.packager.config))\n await injector.inject()\n }\n }\n\n beforeCopyExtraFiles(options: BeforeCopyExtraFilesOptions) {\n return beforeCopyExtraFiles(options)\n }\n}\n\nexport async function createElectronFrameworkSupport(configuration: Configuration, packager: Packager): Promise<Framework> {\n let version = configuration.electronVersion\n if (version == null) {\n // for prepacked app asar no dev deps in the app.asar\n if (packager.isPrepackedAppAsar) {\n version = await getElectronVersionFromInstalled(packager.projectDir)\n if (version == null) {\n throw new Error(`Cannot compute electron version for prepacked asar`)\n }\n } else {\n version = await computeElectronVersion(packager.projectDir)\n }\n configuration.electronVersion = version\n }\n\n const branding = createBrandingOpts(configuration)\n return new ElectronFramework(branding.projectName, version, branding.productName)\n}\n\n/**\n * Unpacks a custom or default Electron distribution into the app output directory.\n */\nasync function unpack(prepareOptions: PrepareApplicationStageDirectoryOptions, _distMacOsAppName: string): Promise<boolean> {\n async function selectElectron(filepath: string) {\n const resolvedDist = sanitizeDirPath(path.isAbsolute(filepath) ? filepath : path.resolve(packager.projectDir, filepath))\n\n const electronDistStats = await statOrNull(resolvedDist)\n if (!electronDistStats) {\n throw new Error(\n `The specified electronDist does not exist: ${resolvedDist}. Please provide a valid path to the Electron zip file, cache directory, or electron build directory.`\n )\n }\n\n if (resolvedDist.endsWith(\".zip\")) {\n log.info({ zipFile: resolvedDist }, \"using custom electronDist zip file\")\n await extractArchive(resolvedDist, appOutDir)\n return false // do not clean up after unpacking, it's a custom bundle and we should respect its configuration/contents as required\n }\n\n if (electronDistStats.isDirectory()) {\n // backward compatibility: if electronDist is a directory, check for the default zip file inside it\n const files = await readdir(resolvedDist)\n if (files.includes(defaultZipName)) {\n log.info({ electronDist: log.filePath(resolvedDist) }, \"using custom electronDist directory\")\n await extractArchive(path.join(resolvedDist, defaultZipName), appOutDir)\n return false // do not clean up after unpacking, it's a custom bundle and we should respect its configuration/contents as required\n }\n // if we reach here, it means the provided electronDist is neither a zip file nor a directory with the default zip file\n // e.g. we treat it as a custom already-unpacked Electron distribution\n log.info({ electronDist: log.filePath(resolvedDist) }, \"using custom unpacked Electron distribution\")\n const source = packager.getElectronSrcDir(resolvedDist)\n const destination = packager.getElectronDestinationDir(prepareOptions.appOutDir)\n log.info({ source, destination }, \"copying unpacked Electron\")\n await emptyDir(prepareOptions.appOutDir)\n await copyDir(source, destination, {\n isUseHardLink: DO_NOT_USE_HARD_LINKS,\n })\n return false\n }\n throw new Error(`The specified electronDist is neither a zip file nor a directory: ${resolvedDist}. Please provide a valid path to the Electron zip file or cache directory.`)\n }\n\n const { packager, appOutDir, platformName, arch, version } = prepareOptions\n const defaultZipName = `electron-v${version}-${platformName}-${arch}.zip`\n\n const electronDist = packager.config.electronDist\n if (typeof electronDist === \"string\" && !isEmptyOrSpaces(electronDist)) {\n return selectElectron(electronDist)\n }\n\n let resolvedDist: string | null = null\n try {\n const electronDistHook: any = await resolveFunction(packager.appInfo.type, electronDist, \"electronDist\", await packager.getWorkspaceRoot())\n resolvedDist = typeof electronDistHook === \"function\" ? await Promise.resolve(electronDistHook(prepareOptions)) : electronDistHook\n } catch (error: any) {\n log.warn({ error }, \"Failed to resolve electronDist, using default unpack logic\")\n }\n\n if (resolvedDist == null) {\n // if no custom electronDist is provided, use the default unpack logic\n log.debug(null, \"no custom electronDist provided, unpacking default Electron distribution\")\n const downloadOptions = packager.config.electronGet\n const zipPath = await downloadElectronArtifactZip({\n options: downloadOptions,\n artifactName: \"electron\",\n platformName: prepareOptions.platformName,\n arch: prepareOptions.arch,\n version: prepareOptions.version,\n })\n await extractArchive(zipPath, appOutDir)\n log.info({ output: appOutDir }, \"downloaded electron zip extracted successfully\")\n return true // indicates that we should clean up after unpacking\n }\n return selectElectron(resolvedDist)\n}\n\nfunction cleanupAfterUnpack(prepareOptions: PrepareApplicationStageDirectoryOptions, distMacOsAppName: string, isFullCleanup: boolean) {\n const out = prepareOptions.appOutDir\n const isMac = prepareOptions.packager.platform === Platform.MAC\n const resourcesPath = isMac ? path.join(out, distMacOsAppName, \"Contents\", \"Resources\") : path.join(out, \"resources\")\n\n return Promise.all([\n isFullCleanup ? unlinkIfExists(path.join(resourcesPath, \"default_app.asar\")) : Promise.resolve(),\n isFullCleanup ? unlinkIfExists(path.join(out, \"version\")) : Promise.resolve(),\n isMac\n ? Promise.resolve()\n : rename(path.join(out, \"LICENSE\"), path.join(out, \"LICENSE.electron.txt\")).catch(() => {\n /* ignore */\n }),\n ])\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import { Arch } from "builder-util";
2
+ import { Configuration } from "../configuration.js";
3
+ import { Platform } from "../core.js";
4
+ /**
5
+ * Fails fast with a clear configuration error when the requested platform+arch combination has no official
6
+ * Electron build anymore (instead of an opaque 404 at download time). Downgraded to a warning when a custom
7
+ * Electron distribution or mirror is configured, since it may still provide 32-bit builds.
8
+ *
9
+ * Exported for unit testing; called from the Packager before packing each arch.
10
+ */
11
+ export declare function assertElectronArchSupported(platform: Platform, arch: Arch, electronVersion: string, config: Configuration): void;
12
+ //# sourceMappingURL=electronArchSupport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"electronArchSupport.d.ts","sourceRoot":"","sources":["../../src/electron/electronArchSupport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmD,MAAM,cAAc,CAAA;AAEpF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAkCrC;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAwBhI"}
@@ -0,0 +1,58 @@
1
+ import { Arch, InvalidConfigurationError, isEmptyOrSpaces, log } from "builder-util";
2
+ import * as semver from "semver";
3
+ import { Platform } from "../core.js";
4
+ /**
5
+ * Electron 44 removed Windows ia32 and Linux armv7l builds (https://github.com/electron/electron/pull/51816).
6
+ * The removal applies to the entire 44 line: it was backported to the 44-x-y branch during the alpha phase,
7
+ * so the first releases without the artifacts are v44.0.0-alpha.4 and v45.0.0-nightly.20260714. The
8
+ * 44.0.0-alpha.1–3 artifacts that did ship are not a supported combination going forward, which is why the
9
+ * check is on the semver major (a plain `semver.gte(version, "44.0.0")` would let 44.0.0-alpha.x through).
10
+ */
11
+ const FIRST_ELECTRON_MAJOR_WITHOUT_32BIT = 44;
12
+ function isArchRemovedFromElectron(platform, arch) {
13
+ return (platform === Platform.WINDOWS && arch === Arch.ia32) || (platform === Platform.LINUX && arch === Arch.armv7l);
14
+ }
15
+ // Mirror env vars honoured by @electron/get (see mirrorVar in @electron/get's artifact-utils).
16
+ const ELECTRON_MIRROR_ENV_VARS = ["NPM_CONFIG_ELECTRON_MIRROR", "npm_config_electron_mirror", "npm_package_config_electron_mirror", "ELECTRON_MIRROR"];
17
+ /**
18
+ * True when the build does not download the official Electron distribution: a custom `electronDist`
19
+ * (path or hook), custom `electronGet.mirrorOptions`, or an @electron/get mirror env var is configured.
20
+ * In that case the user may provide their own 32-bit builds, so the arch guard only warns.
21
+ */
22
+ function hasCustomElectronDistribution(config) {
23
+ const electronDist = config.electronDist;
24
+ if (electronDist != null && (typeof electronDist !== "string" || !isEmptyOrSpaces(electronDist))) {
25
+ return true;
26
+ }
27
+ if (config.electronGet?.mirrorOptions != null) {
28
+ return true;
29
+ }
30
+ return ELECTRON_MIRROR_ENV_VARS.some(name => !isEmptyOrSpaces(process.env[name]));
31
+ }
32
+ /**
33
+ * Fails fast with a clear configuration error when the requested platform+arch combination has no official
34
+ * Electron build anymore (instead of an opaque 404 at download time). Downgraded to a warning when a custom
35
+ * Electron distribution or mirror is configured, since it may still provide 32-bit builds.
36
+ *
37
+ * Exported for unit testing; called from the Packager before packing each arch.
38
+ */
39
+ export function assertElectronArchSupported(platform, arch, electronVersion, config) {
40
+ if (!isArchRemovedFromElectron(platform, arch)) {
41
+ return;
42
+ }
43
+ // don't second-guess unparseable versions (e.g. custom forks) — the download step will produce its own error
44
+ const coerced = semver.coerce(electronVersion);
45
+ if (coerced == null || semver.major(coerced) < FIRST_ELECTRON_MAJOR_WITHOUT_32BIT) {
46
+ return;
47
+ }
48
+ const archName = Arch[arch];
49
+ const message = `Electron ${electronVersion} does not provide ${platform.name} ${archName} builds — ` +
50
+ `Electron 44 removed Windows ia32 and Linux armv7l support (https://github.com/electron/electron/pull/51816). ` +
51
+ `Use electronVersion <= 43.x to keep building for ${archName} (32-bit is supported until the v43 series reaches end-of-life in January 2027), or drop the ${archName} target.`;
52
+ if (hasCustomElectronDistribution(config)) {
53
+ log.warn({ platform: platform.name, arch: archName, electronVersion }, `${message} Proceeding anyway because a custom electronDist or Electron mirror is configured — ensure it actually provides a ${platform.name} ${archName} build.`);
54
+ return;
55
+ }
56
+ throw new InvalidConfigurationError(message);
57
+ }
58
+ //# sourceMappingURL=electronArchSupport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"electronArchSupport.js","sourceRoot":"","sources":["../../src/electron/electronArchSupport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,yBAAyB,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AACpF,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC;;;;;;GAMG;AACH,MAAM,kCAAkC,GAAG,EAAE,CAAA;AAE7C,SAAS,yBAAyB,CAAC,QAAkB,EAAE,IAAU;IAC/D,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,OAAO,IAAI,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,KAAK,IAAI,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,CAAA;AACvH,CAAC;AAED,+FAA+F;AAC/F,MAAM,wBAAwB,GAAG,CAAC,4BAA4B,EAAE,4BAA4B,EAAE,oCAAoC,EAAE,iBAAiB,CAAU,CAAA;AAE/J;;;;GAIG;AACH,SAAS,6BAA6B,CAAC,MAAqB;IAC1D,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAA;IACxC,IAAI,YAAY,IAAI,IAAI,IAAI,CAAC,OAAO,YAAY,KAAK,QAAQ,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;QACjG,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,MAAM,CAAC,WAAW,EAAE,aAAa,IAAI,IAAI,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACnF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CAAC,QAAkB,EAAE,IAAU,EAAE,eAAuB,EAAE,MAAqB;IACxH,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC;QAC/C,OAAM;IACR,CAAC;IACD,6GAA6G;IAC7G,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAA;IAC9C,IAAI,OAAO,IAAI,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,kCAAkC,EAAE,CAAC;QAClF,OAAM;IACR,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,MAAM,OAAO,GACX,YAAY,eAAe,qBAAqB,QAAQ,CAAC,IAAI,IAAI,QAAQ,YAAY;QACrF,+GAA+G;QAC/G,oDAAoD,QAAQ,gGAAgG,QAAQ,UAAU,CAAA;IAEhL,IAAI,6BAA6B,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1C,GAAG,CAAC,IAAI,CACN,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,EAC5D,GAAG,OAAO,qHAAqH,QAAQ,CAAC,IAAI,IAAI,QAAQ,SAAS,CAClK,CAAA;QACD,OAAM;IACR,CAAC;IACD,MAAM,IAAI,yBAAyB,CAAC,OAAO,CAAC,CAAA;AAC9C,CAAC","sourcesContent":["import { Arch, InvalidConfigurationError, isEmptyOrSpaces, log } from \"builder-util\"\nimport * as semver from \"semver\"\nimport { Configuration } from \"../configuration.js\"\nimport { Platform } from \"../core.js\"\n\n/**\n * Electron 44 removed Windows ia32 and Linux armv7l builds (https://github.com/electron/electron/pull/51816).\n * The removal applies to the entire 44 line: it was backported to the 44-x-y branch during the alpha phase,\n * so the first releases without the artifacts are v44.0.0-alpha.4 and v45.0.0-nightly.20260714. The\n * 44.0.0-alpha.1–3 artifacts that did ship are not a supported combination going forward, which is why the\n * check is on the semver major (a plain `semver.gte(version, \"44.0.0\")` would let 44.0.0-alpha.x through).\n */\nconst FIRST_ELECTRON_MAJOR_WITHOUT_32BIT = 44\n\nfunction isArchRemovedFromElectron(platform: Platform, arch: Arch): boolean {\n return (platform === Platform.WINDOWS && arch === Arch.ia32) || (platform === Platform.LINUX && arch === Arch.armv7l)\n}\n\n// Mirror env vars honoured by @electron/get (see mirrorVar in @electron/get's artifact-utils).\nconst ELECTRON_MIRROR_ENV_VARS = [\"NPM_CONFIG_ELECTRON_MIRROR\", \"npm_config_electron_mirror\", \"npm_package_config_electron_mirror\", \"ELECTRON_MIRROR\"] as const\n\n/**\n * True when the build does not download the official Electron distribution: a custom `electronDist`\n * (path or hook), custom `electronGet.mirrorOptions`, or an @electron/get mirror env var is configured.\n * In that case the user may provide their own 32-bit builds, so the arch guard only warns.\n */\nfunction hasCustomElectronDistribution(config: Configuration): boolean {\n const electronDist = config.electronDist\n if (electronDist != null && (typeof electronDist !== \"string\" || !isEmptyOrSpaces(electronDist))) {\n return true\n }\n if (config.electronGet?.mirrorOptions != null) {\n return true\n }\n return ELECTRON_MIRROR_ENV_VARS.some(name => !isEmptyOrSpaces(process.env[name]))\n}\n\n/**\n * Fails fast with a clear configuration error when the requested platform+arch combination has no official\n * Electron build anymore (instead of an opaque 404 at download time). Downgraded to a warning when a custom\n * Electron distribution or mirror is configured, since it may still provide 32-bit builds.\n *\n * Exported for unit testing; called from the Packager before packing each arch.\n */\nexport function assertElectronArchSupported(platform: Platform, arch: Arch, electronVersion: string, config: Configuration): void {\n if (!isArchRemovedFromElectron(platform, arch)) {\n return\n }\n // don't second-guess unparseable versions (e.g. custom forks) — the download step will produce its own error\n const coerced = semver.coerce(electronVersion)\n if (coerced == null || semver.major(coerced) < FIRST_ELECTRON_MAJOR_WITHOUT_32BIT) {\n return\n }\n\n const archName = Arch[arch]\n const message =\n `Electron ${electronVersion} does not provide ${platform.name} ${archName} builds — ` +\n `Electron 44 removed Windows ia32 and Linux armv7l support (https://github.com/electron/electron/pull/51816). ` +\n `Use electronVersion <= 43.x to keep building for ${archName} (32-bit is supported until the v43 series reaches end-of-life in January 2027), or drop the ${archName} target.`\n\n if (hasCustomElectronDistribution(config)) {\n log.warn(\n { platform: platform.name, arch: archName, electronVersion },\n `${message} Proceeding anyway because a custom electronDist or Electron mirror is configured — ensure it actually provides a ${platform.name} ${archName} build.`\n )\n return\n }\n throw new InvalidConfigurationError(message)\n}\n"]}
@@ -7,6 +7,7 @@ import { normalizeExt } from "../../platformPackager.js";
7
7
  import { savePlistFile, parsePlistFile } from "../../util/mac/plist.js";
8
8
  import { createBrandingOpts } from "../ElectronFramework.js";
9
9
  import { MacTargetHelper } from "../../targets/mac/MacTargetHelper.js";
10
+ import { assertSafeHelperName, getAvailableHelperSuffixes } from "./electronMacUtils.js";
10
11
  function doRename(basePath, oldName, newName) {
11
12
  return rename(path.join(basePath, oldName), path.join(basePath, newName));
12
13
  }
@@ -16,25 +17,6 @@ function moveHelpers(helperSuffixes, frameworksPath, appName, prefix) {
16
17
  return doRename(executableBasePath, `${prefix}${suffix}`, appName + suffix).then(() => doRename(frameworksPath, `${prefix}${suffix}.app`, `${appName}${suffix}.app`));
17
18
  }));
18
19
  }
19
- function getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist) {
20
- const result = [" Helper"];
21
- if (helperEHPlist != null) {
22
- result.push(" Helper EH");
23
- }
24
- if (helperNPPlist != null) {
25
- result.push(" Helper NP");
26
- }
27
- if (helperRendererPlist != null) {
28
- result.push(" Helper (Renderer)");
29
- }
30
- if (helperPluginPlist != null) {
31
- result.push(" Helper (Plugin)");
32
- }
33
- if (helperGPUPlist != null) {
34
- result.push(" Helper (GPU)");
35
- }
36
- return result;
37
- }
38
20
  /** @internal */
39
21
  export async function createMacApp(packager, appOutDir, asarIntegrity, targetPlatform) {
40
22
  const appInfo = packager.appInfo;
@@ -43,6 +25,9 @@ export async function createMacApp(packager, appOutDir, asarIntegrity, targetPla
43
25
  // https://github.com/electron-userland/electron-builder/issues/6962
44
26
  const appFilename = appInfo.sanitizedProductName;
45
27
  const electronBranding = createBrandingOpts(packager.config);
28
+ // The branding name is the on-disk prefix of every helper bundle we read from the Electron dist,
29
+ // so reject values that could escape the Frameworks directory.
30
+ assertSafeHelperName(electronBranding.productName, "electronBranding.productName");
46
31
  const contentsPath = path.join(appOutDir, packager.framework.distMacOsAppName, "Contents");
47
32
  const frameworksPath = path.join(contentsPath, "Frameworks");
48
33
  const loginItemPath = path.join(contentsPath, "Library", "LoginItems");
@@ -64,7 +49,7 @@ export async function createMacApp(packager, appOutDir, asarIntegrity, targetPla
64
49
  if (appPlist == null) {
65
50
  throw new Error("corrupted Electron dist");
66
51
  }
67
- // Replace the multiple parsePlistFile calls with:
52
+ // Parse each helper plist; variants absent from the current Electron dist resolve to null.
68
53
  const helperPlist = await safeParsePlistFile(helperPlistFilename);
69
54
  const helperEHPlist = await safeParsePlistFile(helperEHPlistFilename);
70
55
  const helperNPPlist = await safeParsePlistFile(helperNPPlistFilename);
@@ -213,7 +198,13 @@ export async function createMacApp(packager, appOutDir, asarIntegrity, targetPla
213
198
  unlinkIfExists(path.join(appOutDir, "LICENSE")),
214
199
  unlinkIfExists(path.join(appOutDir, "LICENSES.chromium.html")),
215
200
  ]);
216
- await moveHelpers(getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist), frameworksPath, appFilename, electronBranding.productName);
201
+ await moveHelpers(getAvailableHelperSuffixes({
202
+ EH: helperEHPlist != null,
203
+ NP: helperNPPlist != null,
204
+ Renderer: helperRendererPlist != null,
205
+ Plugin: helperPluginPlist != null,
206
+ GPU: helperGPUPlist != null,
207
+ }), frameworksPath, appFilename, electronBranding.productName);
217
208
  if (helperLoginPlist != null) {
218
209
  const prefix = electronBranding.productName;
219
210
  const suffix = " Login Helper";
@@ -1 +1 @@
1
- {"version":3,"file":"electronMac.js","sourceRoot":"","sources":["../../../src/electron/mac/electronMac.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC1H,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,cAAc,EAA2B,MAAM,yBAAyB,CAAA;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAgB,MAAM,sCAAsC,CAAA;AAEpF,SAAS,QAAQ,CAAC,QAAgB,EAAE,OAAe,EAAE,OAAe;IAClE,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAA;AAC3E,CAAC;AAED,SAAS,WAAW,CAAC,cAA6B,EAAE,cAAsB,EAAE,OAAe,EAAE,MAAc;IACzG,OAAO,OAAO,CAAC,GAAG,CAChB,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QAC1B,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,MAAM,GAAG,MAAM,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;QACnG,OAAO,QAAQ,CAAC,kBAAkB,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,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,GAAG,gBAAgB,CAAA;IAC3C,CAAC;IAED,IAAI,gBAAgB,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;QACvC,MAAM,SAAS,GAAG;YAChB,4CAA4C,EAAE,KAAK;YACnD,oBAAoB,EAAE,KAAK;YAC3B,2CAA2C,EAAE,IAAI;YACjD,qCAAqC,EAAE,KAAK;YAC5C,0CAA0C,EAAE,KAAK;SAClD,CAAA;QACD,gBAAgB,CAAC,SAAS,GAAG,SAAS,CAAA;QACtC,gBAAgB,CAAC,WAAW,CAAC,GAAG,SAAS,CAAA;IAC3C,CAAC;AACH,CAAC","sourcesContent":["import { asArray, copyOrLinkFile, getPlatformIconFileName, InvalidConfigurationError, unlinkIfExists } from \"builder-util\"\nimport { rename, utimes } from \"fs/promises\"\nimport * as path from \"path\"\nimport * as fs from \"fs\"\nimport { filterCFBundleIdentifier } from \"../../appInfo.js\"\nimport { AsarIntegrity } from \"../../asar/integrity.js\"\nimport { MacPackager } from \"../../macPackager.js\"\nimport { normalizeExt } from \"../../platformPackager.js\"\nimport { savePlistFile, parsePlistFile, PlistObject, PlistValue } from \"../../util/mac/plist.js\"\nimport { createBrandingOpts } from \"../ElectronFramework.js\"\nimport { MacTargetHelper, PlatformType } from \"../../targets/mac/MacTargetHelper.js\"\n\nfunction doRename(basePath: string, oldName: string, newName: string) {\n return rename(path.join(basePath, oldName), path.join(basePath, newName))\n}\n\nfunction moveHelpers(helperSuffixes: Array<string>, frameworksPath: string, appName: string, prefix: string): Promise<any> {\n return Promise.all(\n helperSuffixes.map(suffix => {\n const executableBasePath = path.join(frameworksPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n return doRename(executableBasePath, `${prefix}${suffix}`, appName + suffix).then(() => doRename(frameworksPath, `${prefix}${suffix}.app`, `${appName}${suffix}.app`))\n })\n )\n}\n\nfunction getAvailableHelperSuffixes(\n helperEHPlist: PlistObject | null,\n helperNPPlist: PlistObject | null,\n helperRendererPlist: PlistObject | null,\n helperPluginPlist: PlistObject | null,\n helperGPUPlist: PlistObject | null\n) {\n const result = [\" Helper\"]\n if (helperEHPlist != null) {\n result.push(\" Helper EH\")\n }\n if (helperNPPlist != null) {\n result.push(\" Helper NP\")\n }\n if (helperRendererPlist != null) {\n result.push(\" Helper (Renderer)\")\n }\n if (helperPluginPlist != null) {\n result.push(\" Helper (Plugin)\")\n }\n if (helperGPUPlist != null) {\n result.push(\" Helper (GPU)\")\n }\n return result\n}\n\n/** @internal */\nexport async function createMacApp(packager: MacPackager, appOutDir: string, asarIntegrity: AsarIntegrity | null, targetPlatform: PlatformType) {\n const appInfo = packager.appInfo\n // Electon uses the application name (CFBundleName) to resolve helper apps\n // https://github.com/electron/electron/blob/main/shell/app/electron_main_delegate_mac.mm\n // https://github.com/electron-userland/electron-builder/issues/6962\n const appFilename = appInfo.sanitizedProductName\n const electronBranding = createBrandingOpts(packager.config)\n\n const contentsPath = path.join(appOutDir, packager.framework.distMacOsAppName, \"Contents\")\n const frameworksPath = path.join(contentsPath, \"Frameworks\")\n const loginItemPath = path.join(contentsPath, \"Library\", \"LoginItems\")\n\n const appPlistFilename = path.join(contentsPath, \"Info.plist\")\n const helperPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper.app`, \"Contents\", \"Info.plist\")\n const helperEHPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper EH.app`, \"Contents\", \"Info.plist\")\n const helperNPPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper NP.app`, \"Contents\", \"Info.plist\")\n const helperRendererPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (Renderer).app`, \"Contents\", \"Info.plist\")\n const helperPluginPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (Plugin).app`, \"Contents\", \"Info.plist\")\n const helperGPUPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (GPU).app`, \"Contents\", \"Info.plist\")\n const helperLoginPlistFilename = path.join(loginItemPath, `${electronBranding.productName} Login Helper.app`, \"Contents\", \"Info.plist\")\n\n const safeParsePlistFile = async (filePath: string): Promise<PlistObject | null> => {\n if (!fs.existsSync(filePath)) {\n return null\n }\n return await parsePlistFile(filePath)\n }\n\n const appPlist = (await safeParsePlistFile(appPlistFilename))!\n if (appPlist == null) {\n throw new Error(\"corrupted Electron dist\")\n }\n\n // Replace the multiple parsePlistFile calls with:\n const helperPlist = await safeParsePlistFile(helperPlistFilename)\n const helperEHPlist = await safeParsePlistFile(helperEHPlistFilename)\n const helperNPPlist = await safeParsePlistFile(helperNPPlistFilename)\n const helperRendererPlist = await safeParsePlistFile(helperRendererPlistFilename)\n const helperPluginPlist = await safeParsePlistFile(helperPluginPlistFilename)\n const helperGPUPlist = await safeParsePlistFile(helperGPUPlistFilename)\n const helperLoginPlist = await safeParsePlistFile(helperLoginPlistFilename)\n\n const buildMetadata = packager.config\n\n /**\n * Configure bundleIdentifier for the generic Electron Helper process\n *\n * This was the only Helper in Electron 5 and before. Allow users to configure\n * the bundleIdentifier for continuity.\n */\n\n // `targetPlatform` is the authoritative 3-way flavor, so the cascaded config (incl. masDev overrides) is correct for mas-dev too.\n const cascadedOptions = packager.getPlatformConfig(targetPlatform).config\n const cfBundleIdentifier = filterCFBundleIdentifier(cascadedOptions?.appId || appInfo.macBundleIdentifier)\n const helperBundleIdentifier = filterCFBundleIdentifier(cascadedOptions?.helperBundleId || `${cfBundleIdentifier}.helper`)\n\n appPlist.CFBundleIdentifier = cfBundleIdentifier\n\n await packager.applyCommonInfo(appPlist, contentsPath, cascadedOptions)\n\n // required for electron-updater proxy. Both mas and mas-dev are sandboxed App Store flavors, so skip ATS for either.\n const isMasFlavor = MacTargetHelper.isMasTarget(targetPlatform)\n if (!isMasFlavor) {\n configureLocalhostAts(appPlist)\n }\n\n if (helperPlist != null) {\n helperPlist.CFBundleExecutable = `${appFilename} Helper`\n helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`\n helperPlist.CFBundleIdentifier = helperBundleIdentifier\n helperPlist.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n /**\n * Configure bundleIdentifier for Electron 5+ Helper processes\n *\n * In Electron 6, parts of the generic Electron Helper process were split into\n * individual helper processes. Allow users to configure the bundleIdentifiers\n * for continuity, specifically because macOS keychain access relies on\n * bundleIdentifiers not changing (i.e. across versions of Electron).\n */\n\n function configureHelper(helper: any, postfix: string, userProvidedBundleIdentifier?: string | null) {\n helper.CFBundleExecutable = `${appFilename} Helper ${postfix}`\n helper.CFBundleDisplayName = `${appInfo.productName} Helper ${postfix}`\n helper.CFBundleIdentifier = userProvidedBundleIdentifier\n ? filterCFBundleIdentifier(userProvidedBundleIdentifier)\n : filterCFBundleIdentifier(`${helperBundleIdentifier}.${postfix}`)\n helper.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n if (helperRendererPlist != null) {\n configureHelper(helperRendererPlist, \"(Renderer)\", packager.platformOptions.helperRendererBundleId)\n }\n if (helperPluginPlist != null) {\n configureHelper(helperPluginPlist, \"(Plugin)\", packager.platformOptions.helperPluginBundleId)\n }\n if (helperGPUPlist != null) {\n configureHelper(helperGPUPlist, \"(GPU)\", packager.platformOptions.helperGPUBundleId)\n }\n if (helperEHPlist != null) {\n configureHelper(helperEHPlist, \"EH\", packager.platformOptions.helperEHBundleId)\n }\n if (helperNPPlist != null) {\n configureHelper(helperNPPlist, \"NP\", packager.platformOptions.helperNPBundleId)\n }\n if (helperLoginPlist != null) {\n helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`\n helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`\n // noinspection SpellCheckingInspection\n helperLoginPlist.CFBundleIdentifier = `${cfBundleIdentifier}.loginhelper`\n helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n const protocols = asArray(buildMetadata.protocols).concat(asArray(packager.platformOptions.protocols))\n if (protocols.length > 0) {\n appPlist.CFBundleURLTypes = protocols.map(protocol => {\n const schemes = asArray(protocol.schemes)\n if (schemes.length === 0) {\n throw new InvalidConfigurationError(`Protocol \"${protocol.name}\": must be at least one scheme specified`)\n }\n return {\n CFBundleURLName: protocol.name,\n CFBundleTypeRole: protocol.role || \"Editor\",\n CFBundleURLSchemes: schemes.slice(),\n }\n })\n }\n\n const fileAssociations = packager.fileAssociations\n if (fileAssociations.length > 0) {\n const documentTypes = await Promise.all(\n fileAssociations.map(async fileAssociation => {\n const extensions = asArray(fileAssociation.ext).map(normalizeExt)\n const customIcon = await packager.getResource(getPlatformIconFileName(fileAssociation.icon, true), `${extensions[0]}.icns`)\n let iconFile = appPlist.CFBundleIconFile\n if (customIcon != null) {\n iconFile = path.basename(customIcon)\n await copyOrLinkFile(customIcon, path.join(path.join(contentsPath, \"Resources\"), iconFile))\n }\n\n const result = {\n CFBundleTypeExtensions: extensions,\n CFBundleTypeName: fileAssociation.name || extensions[0],\n CFBundleTypeRole: fileAssociation.role || \"Editor\",\n LSHandlerRank: fileAssociation.rank || \"Default\",\n CFBundleTypeIconFile: iconFile,\n } as any\n\n if (fileAssociation.isPackage) {\n result.LSTypeIsPackage = true\n }\n return result\n })\n )\n\n // `CFBundleDocumentTypes` may be defined in `mac.extendInfo`, so we need to merge it in that case\n appPlist.CFBundleDocumentTypes = [...((appPlist.CFBundleDocumentTypes as PlistValue[]) || []), ...documentTypes]\n }\n\n const toPlistObject = (asarIntegrity: AsarIntegrity): PlistObject => {\n const result: PlistObject = {}\n for (const [filePath, headerHash] of Object.entries(asarIntegrity)) {\n result[filePath] = {\n algorithm: headerHash.algorithm,\n hash: headerHash.hash,\n }\n }\n return result\n }\n\n if (asarIntegrity != null) {\n appPlist.ElectronAsarIntegrity = toPlistObject(asarIntegrity)\n }\n\n if (helperEHPlist != null) {\n await savePlistFile(helperEHPlistFilename, helperEHPlist)\n }\n\n if (helperNPPlist != null) {\n await savePlistFile(helperNPPlistFilename, helperNPPlist)\n }\n\n if (helperRendererPlist != null) {\n await savePlistFile(helperRendererPlistFilename, helperRendererPlist)\n }\n\n if (helperPluginPlist != null) {\n await savePlistFile(helperPluginPlistFilename, helperPluginPlist)\n }\n\n if (helperGPUPlist != null) {\n await savePlistFile(helperGPUPlistFilename, helperGPUPlist)\n }\n\n if (helperLoginPlist != null) {\n await savePlistFile(helperLoginPlistFilename, helperLoginPlist)\n }\n\n await savePlistFile(appPlistFilename, appPlist)\n if (helperPlist != null) {\n await savePlistFile(helperPlistFilename, helperPlist)\n }\n\n await Promise.all([\n doRename(path.join(contentsPath, \"MacOS\"), electronBranding.productName, appPlist.CFBundleExecutable as string),\n unlinkIfExists(path.join(appOutDir, \"LICENSE\")),\n unlinkIfExists(path.join(appOutDir, \"LICENSES.chromium.html\")),\n ])\n\n await moveHelpers(\n getAvailableHelperSuffixes(helperEHPlist, helperNPPlist, helperRendererPlist, helperPluginPlist, helperGPUPlist),\n frameworksPath,\n appFilename,\n electronBranding.productName\n )\n\n if (helperLoginPlist != null) {\n const prefix = electronBranding.productName\n const suffix = \" Login Helper\"\n const executableBasePath = path.join(loginItemPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n await doRename(executableBasePath, `${prefix}${suffix}`, appFilename + suffix).then(() => doRename(loginItemPath, `${prefix}${suffix}.app`, `${appFilename}${suffix}.app`))\n }\n\n const appPath = path.join(appOutDir, `${appInfo.productFilename}.app`)\n await rename(path.dirname(contentsPath), appPath)\n // https://github.com/electron-userland/electron-builder/issues/840\n const now = Date.now() / 1000\n await utimes(appPath, now, now)\n}\n\nfunction configureLocalhostAts(appPlist: any) {\n // https://bencoding.com/2015/07/20/app-transport-security-and-localhost/\n let ats = appPlist.NSAppTransportSecurity\n if (ats == null) {\n ats = {}\n appPlist.NSAppTransportSecurity = ats\n }\n\n ats.NSAllowsLocalNetworking = true\n // https://github.com/electron-userland/electron-builder/issues/3377#issuecomment-446035814\n ats.NSAllowsArbitraryLoads = true\n\n let exceptionDomains = ats.NSExceptionDomains\n if (exceptionDomains == null) {\n exceptionDomains = {}\n ats.NSExceptionDomains = exceptionDomains\n }\n\n if (exceptionDomains.localhost == null) {\n const allowHttp = {\n NSTemporaryExceptionAllowsInsecureHTTPSLoads: false,\n NSIncludesSubdomains: false,\n NSTemporaryExceptionAllowsInsecureHTTPLoads: true,\n NSTemporaryExceptionMinimumTLSVersion: \"1.0\",\n NSTemporaryExceptionRequiresForwardSecrecy: false,\n }\n exceptionDomains.localhost = allowHttp\n exceptionDomains[\"127.0.0.1\"] = allowHttp\n }\n}\n"]}
1
+ {"version":3,"file":"electronMac.js","sourceRoot":"","sources":["../../../src/electron/mac/electronMac.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC1H,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,cAAc,EAA2B,MAAM,yBAAyB,CAAA;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAgB,MAAM,sCAAsC,CAAA;AACpF,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAA;AAExF,SAAS,QAAQ,CAAC,QAAgB,EAAE,OAAe,EAAE,OAAe;IAClE,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAA;AAC3E,CAAC;AAED,SAAS,WAAW,CAAC,cAA6B,EAAE,cAAsB,EAAE,OAAe,EAAE,MAAc;IACzG,OAAO,OAAO,CAAC,GAAG,CAChB,cAA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5C,0CAA0C,EAAE,KAAK;SAClD,CAAA;QACD,gBAAgB,CAAC,SAAS,GAAG,SAAS,CAAA;QACtC,gBAAgB,CAAC,WAAW,CAAC,GAAG,SAAS,CAAA;IAC3C,CAAC;AACH,CAAC","sourcesContent":["import { asArray, copyOrLinkFile, getPlatformIconFileName, InvalidConfigurationError, unlinkIfExists } from \"builder-util\"\nimport { rename, utimes } from \"fs/promises\"\nimport * as path from \"path\"\nimport * as fs from \"fs\"\nimport { filterCFBundleIdentifier } from \"../../appInfo.js\"\nimport { AsarIntegrity } from \"../../asar/integrity.js\"\nimport { MacPackager } from \"../../macPackager.js\"\nimport { normalizeExt } from \"../../platformPackager.js\"\nimport { savePlistFile, parsePlistFile, PlistObject, PlistValue } from \"../../util/mac/plist.js\"\nimport { createBrandingOpts } from \"../ElectronFramework.js\"\nimport { MacTargetHelper, PlatformType } from \"../../targets/mac/MacTargetHelper.js\"\nimport { assertSafeHelperName, getAvailableHelperSuffixes } from \"./electronMacUtils.js\"\n\nfunction doRename(basePath: string, oldName: string, newName: string) {\n return rename(path.join(basePath, oldName), path.join(basePath, newName))\n}\n\nfunction moveHelpers(helperSuffixes: Array<string>, frameworksPath: string, appName: string, prefix: string): Promise<any> {\n return Promise.all(\n helperSuffixes.map(suffix => {\n const executableBasePath = path.join(frameworksPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n return doRename(executableBasePath, `${prefix}${suffix}`, appName + suffix).then(() => doRename(frameworksPath, `${prefix}${suffix}.app`, `${appName}${suffix}.app`))\n })\n )\n}\n\n/** @internal */\nexport async function createMacApp(packager: MacPackager, appOutDir: string, asarIntegrity: AsarIntegrity | null, targetPlatform: PlatformType) {\n const appInfo = packager.appInfo\n // Electon uses the application name (CFBundleName) to resolve helper apps\n // https://github.com/electron/electron/blob/main/shell/app/electron_main_delegate_mac.mm\n // https://github.com/electron-userland/electron-builder/issues/6962\n const appFilename = appInfo.sanitizedProductName\n const electronBranding = createBrandingOpts(packager.config)\n // The branding name is the on-disk prefix of every helper bundle we read from the Electron dist,\n // so reject values that could escape the Frameworks directory.\n assertSafeHelperName(electronBranding.productName, \"electronBranding.productName\")\n\n const contentsPath = path.join(appOutDir, packager.framework.distMacOsAppName, \"Contents\")\n const frameworksPath = path.join(contentsPath, \"Frameworks\")\n const loginItemPath = path.join(contentsPath, \"Library\", \"LoginItems\")\n\n const appPlistFilename = path.join(contentsPath, \"Info.plist\")\n const helperPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper.app`, \"Contents\", \"Info.plist\")\n const helperEHPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper EH.app`, \"Contents\", \"Info.plist\")\n const helperNPPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper NP.app`, \"Contents\", \"Info.plist\")\n const helperRendererPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (Renderer).app`, \"Contents\", \"Info.plist\")\n const helperPluginPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (Plugin).app`, \"Contents\", \"Info.plist\")\n const helperGPUPlistFilename = path.join(frameworksPath, `${electronBranding.productName} Helper (GPU).app`, \"Contents\", \"Info.plist\")\n const helperLoginPlistFilename = path.join(loginItemPath, `${electronBranding.productName} Login Helper.app`, \"Contents\", \"Info.plist\")\n\n const safeParsePlistFile = async (filePath: string): Promise<PlistObject | null> => {\n if (!fs.existsSync(filePath)) {\n return null\n }\n return await parsePlistFile(filePath)\n }\n\n const appPlist = (await safeParsePlistFile(appPlistFilename))!\n if (appPlist == null) {\n throw new Error(\"corrupted Electron dist\")\n }\n\n // Parse each helper plist; variants absent from the current Electron dist resolve to null.\n const helperPlist = await safeParsePlistFile(helperPlistFilename)\n const helperEHPlist = await safeParsePlistFile(helperEHPlistFilename)\n const helperNPPlist = await safeParsePlistFile(helperNPPlistFilename)\n const helperRendererPlist = await safeParsePlistFile(helperRendererPlistFilename)\n const helperPluginPlist = await safeParsePlistFile(helperPluginPlistFilename)\n const helperGPUPlist = await safeParsePlistFile(helperGPUPlistFilename)\n const helperLoginPlist = await safeParsePlistFile(helperLoginPlistFilename)\n\n const buildMetadata = packager.config\n\n /**\n * Configure bundleIdentifier for the generic Electron Helper process\n *\n * This was the only Helper in Electron 5 and before. Allow users to configure\n * the bundleIdentifier for continuity.\n */\n\n // `targetPlatform` is the authoritative 3-way flavor, so the cascaded config (incl. masDev overrides) is correct for mas-dev too.\n const cascadedOptions = packager.getPlatformConfig(targetPlatform).config\n const cfBundleIdentifier = filterCFBundleIdentifier(cascadedOptions?.appId || appInfo.macBundleIdentifier)\n const helperBundleIdentifier = filterCFBundleIdentifier(cascadedOptions?.helperBundleId || `${cfBundleIdentifier}.helper`)\n\n appPlist.CFBundleIdentifier = cfBundleIdentifier\n\n await packager.applyCommonInfo(appPlist, contentsPath, cascadedOptions)\n\n // required for electron-updater proxy. Both mas and mas-dev are sandboxed App Store flavors, so skip ATS for either.\n const isMasFlavor = MacTargetHelper.isMasTarget(targetPlatform)\n if (!isMasFlavor) {\n configureLocalhostAts(appPlist)\n }\n\n if (helperPlist != null) {\n helperPlist.CFBundleExecutable = `${appFilename} Helper`\n helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`\n helperPlist.CFBundleIdentifier = helperBundleIdentifier\n helperPlist.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n /**\n * Configure bundleIdentifier for Electron 5+ Helper processes\n *\n * In Electron 6, parts of the generic Electron Helper process were split into\n * individual helper processes. Allow users to configure the bundleIdentifiers\n * for continuity, specifically because macOS keychain access relies on\n * bundleIdentifiers not changing (i.e. across versions of Electron).\n */\n\n function configureHelper(helper: any, postfix: string, userProvidedBundleIdentifier?: string | null) {\n helper.CFBundleExecutable = `${appFilename} Helper ${postfix}`\n helper.CFBundleDisplayName = `${appInfo.productName} Helper ${postfix}`\n helper.CFBundleIdentifier = userProvidedBundleIdentifier\n ? filterCFBundleIdentifier(userProvidedBundleIdentifier)\n : filterCFBundleIdentifier(`${helperBundleIdentifier}.${postfix}`)\n helper.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n if (helperRendererPlist != null) {\n configureHelper(helperRendererPlist, \"(Renderer)\", packager.platformOptions.helperRendererBundleId)\n }\n if (helperPluginPlist != null) {\n configureHelper(helperPluginPlist, \"(Plugin)\", packager.platformOptions.helperPluginBundleId)\n }\n if (helperGPUPlist != null) {\n configureHelper(helperGPUPlist, \"(GPU)\", packager.platformOptions.helperGPUBundleId)\n }\n if (helperEHPlist != null) {\n configureHelper(helperEHPlist, \"EH\", packager.platformOptions.helperEHBundleId)\n }\n if (helperNPPlist != null) {\n configureHelper(helperNPPlist, \"NP\", packager.platformOptions.helperNPBundleId)\n }\n if (helperLoginPlist != null) {\n helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`\n helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`\n // noinspection SpellCheckingInspection\n helperLoginPlist.CFBundleIdentifier = `${cfBundleIdentifier}.loginhelper`\n helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n const protocols = asArray(buildMetadata.protocols).concat(asArray(packager.platformOptions.protocols))\n if (protocols.length > 0) {\n appPlist.CFBundleURLTypes = protocols.map(protocol => {\n const schemes = asArray(protocol.schemes)\n if (schemes.length === 0) {\n throw new InvalidConfigurationError(`Protocol \"${protocol.name}\": must be at least one scheme specified`)\n }\n return {\n CFBundleURLName: protocol.name,\n CFBundleTypeRole: protocol.role || \"Editor\",\n CFBundleURLSchemes: schemes.slice(),\n }\n })\n }\n\n const fileAssociations = packager.fileAssociations\n if (fileAssociations.length > 0) {\n const documentTypes = await Promise.all(\n fileAssociations.map(async fileAssociation => {\n const extensions = asArray(fileAssociation.ext).map(normalizeExt)\n const customIcon = await packager.getResource(getPlatformIconFileName(fileAssociation.icon, true), `${extensions[0]}.icns`)\n let iconFile = appPlist.CFBundleIconFile\n if (customIcon != null) {\n iconFile = path.basename(customIcon)\n await copyOrLinkFile(customIcon, path.join(path.join(contentsPath, \"Resources\"), iconFile))\n }\n\n const result = {\n CFBundleTypeExtensions: extensions,\n CFBundleTypeName: fileAssociation.name || extensions[0],\n CFBundleTypeRole: fileAssociation.role || \"Editor\",\n LSHandlerRank: fileAssociation.rank || \"Default\",\n CFBundleTypeIconFile: iconFile,\n } as any\n\n if (fileAssociation.isPackage) {\n result.LSTypeIsPackage = true\n }\n return result\n })\n )\n\n // `CFBundleDocumentTypes` may be defined in `mac.extendInfo`, so we need to merge it in that case\n appPlist.CFBundleDocumentTypes = [...((appPlist.CFBundleDocumentTypes as PlistValue[]) || []), ...documentTypes]\n }\n\n const toPlistObject = (asarIntegrity: AsarIntegrity): PlistObject => {\n const result: PlistObject = {}\n for (const [filePath, headerHash] of Object.entries(asarIntegrity)) {\n result[filePath] = {\n algorithm: headerHash.algorithm,\n hash: headerHash.hash,\n }\n }\n return result\n }\n\n if (asarIntegrity != null) {\n appPlist.ElectronAsarIntegrity = toPlistObject(asarIntegrity)\n }\n\n if (helperEHPlist != null) {\n await savePlistFile(helperEHPlistFilename, helperEHPlist)\n }\n\n if (helperNPPlist != null) {\n await savePlistFile(helperNPPlistFilename, helperNPPlist)\n }\n\n if (helperRendererPlist != null) {\n await savePlistFile(helperRendererPlistFilename, helperRendererPlist)\n }\n\n if (helperPluginPlist != null) {\n await savePlistFile(helperPluginPlistFilename, helperPluginPlist)\n }\n\n if (helperGPUPlist != null) {\n await savePlistFile(helperGPUPlistFilename, helperGPUPlist)\n }\n\n if (helperLoginPlist != null) {\n await savePlistFile(helperLoginPlistFilename, helperLoginPlist)\n }\n\n await savePlistFile(appPlistFilename, appPlist)\n if (helperPlist != null) {\n await savePlistFile(helperPlistFilename, helperPlist)\n }\n\n await Promise.all([\n doRename(path.join(contentsPath, \"MacOS\"), electronBranding.productName, appPlist.CFBundleExecutable as string),\n unlinkIfExists(path.join(appOutDir, \"LICENSE\")),\n unlinkIfExists(path.join(appOutDir, \"LICENSES.chromium.html\")),\n ])\n\n await moveHelpers(\n getAvailableHelperSuffixes({\n EH: helperEHPlist != null,\n NP: helperNPPlist != null,\n Renderer: helperRendererPlist != null,\n Plugin: helperPluginPlist != null,\n GPU: helperGPUPlist != null,\n }),\n frameworksPath,\n appFilename,\n electronBranding.productName\n )\n\n if (helperLoginPlist != null) {\n const prefix = electronBranding.productName\n const suffix = \" Login Helper\"\n const executableBasePath = path.join(loginItemPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n await doRename(executableBasePath, `${prefix}${suffix}`, appFilename + suffix).then(() => doRename(loginItemPath, `${prefix}${suffix}.app`, `${appFilename}${suffix}.app`))\n }\n\n const appPath = path.join(appOutDir, `${appInfo.productFilename}.app`)\n await rename(path.dirname(contentsPath), appPath)\n // https://github.com/electron-userland/electron-builder/issues/840\n const now = Date.now() / 1000\n await utimes(appPath, now, now)\n}\n\nfunction configureLocalhostAts(appPlist: any) {\n // https://bencoding.com/2015/07/20/app-transport-security-and-localhost/\n let ats = appPlist.NSAppTransportSecurity\n if (ats == null) {\n ats = {}\n appPlist.NSAppTransportSecurity = ats\n }\n\n ats.NSAllowsLocalNetworking = true\n // https://github.com/electron-userland/electron-builder/issues/3377#issuecomment-446035814\n ats.NSAllowsArbitraryLoads = true\n\n let exceptionDomains = ats.NSExceptionDomains\n if (exceptionDomains == null) {\n exceptionDomains = {}\n ats.NSExceptionDomains = exceptionDomains\n }\n\n if (exceptionDomains.localhost == null) {\n const allowHttp = {\n NSTemporaryExceptionAllowsInsecureHTTPSLoads: false,\n NSIncludesSubdomains: false,\n NSTemporaryExceptionAllowsInsecureHTTPLoads: true,\n NSTemporaryExceptionMinimumTLSVersion: \"1.0\",\n NSTemporaryExceptionRequiresForwardSecrecy: false,\n }\n exceptionDomains.localhost = allowHttp\n exceptionDomains[\"127.0.0.1\"] = allowHttp\n }\n}\n"]}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * At runtime Electron locates its helper apps relative to the main application name, resolving each
3
+ * one as `${CFBundleName} Helper.app` (see `electron_main_delegate_mac.mm`). electron-builder uses
4
+ * the product name verbatim for both `CFBundleName` and the on-disk helper/app bundle names, so the
5
+ * name must be usable as a filename without modification.
6
+ *
7
+ * If the name would be altered by filename sanitization, the on-disk bundle (sanitized) and
8
+ * `CFBundleName` (verbatim) would diverge and break helper discovery. Reject such names up front with
9
+ * a clear error so the user can choose a valid name, rather than silently changing it for them.
10
+ */
11
+ export declare function assertSafeHelperName(name: string, field: string): void;
12
+ export interface AvailableHelpers {
13
+ EH?: boolean;
14
+ NP?: boolean;
15
+ Renderer?: boolean;
16
+ Plugin?: boolean;
17
+ GPU?: boolean;
18
+ }
19
+ /**
20
+ * Returns the helper bundle suffixes present in the current Electron distribution. The generic
21
+ * `" Helper"` bundle is always present; the remaining variants vary by Electron version.
22
+ */
23
+ export declare function getAvailableHelperSuffixes(present: AvailableHelpers): string[];
24
+ //# sourceMappingURL=electronMacUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"electronMacUtils.d.ts","sourceRoot":"","sources":["../../../src/electron/mac/electronMacUtils.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAOtE;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,OAAO,CAAA;IACZ,EAAE,CAAC,EAAE,OAAO,CAAA;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,OAAO,CAAA;CACd;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAkB9E"}
@@ -0,0 +1,42 @@
1
+ import { InvalidConfigurationError } from "builder-util";
2
+ import { sanitizeFileName } from "builder-util/internal";
3
+ /**
4
+ * At runtime Electron locates its helper apps relative to the main application name, resolving each
5
+ * one as `${CFBundleName} Helper.app` (see `electron_main_delegate_mac.mm`). electron-builder uses
6
+ * the product name verbatim for both `CFBundleName` and the on-disk helper/app bundle names, so the
7
+ * name must be usable as a filename without modification.
8
+ *
9
+ * If the name would be altered by filename sanitization, the on-disk bundle (sanitized) and
10
+ * `CFBundleName` (verbatim) would diverge and break helper discovery. Reject such names up front with
11
+ * a clear error so the user can choose a valid name, rather than silently changing it for them.
12
+ */
13
+ export function assertSafeHelperName(name, field) {
14
+ const sanitized = sanitizeFileName(name);
15
+ if (sanitized !== name) {
16
+ throw new InvalidConfigurationError(`${field} "${name}" is not a valid macOS app bundle name (it would be sanitized to "${sanitized}"). Set a ${field} that requires no filename sanitization.`);
17
+ }
18
+ }
19
+ /**
20
+ * Returns the helper bundle suffixes present in the current Electron distribution. The generic
21
+ * `" Helper"` bundle is always present; the remaining variants vary by Electron version.
22
+ */
23
+ export function getAvailableHelperSuffixes(present) {
24
+ const result = [" Helper"];
25
+ if (present.EH) {
26
+ result.push(" Helper EH");
27
+ }
28
+ if (present.NP) {
29
+ result.push(" Helper NP");
30
+ }
31
+ if (present.Renderer) {
32
+ result.push(" Helper (Renderer)");
33
+ }
34
+ if (present.Plugin) {
35
+ result.push(" Helper (Plugin)");
36
+ }
37
+ if (present.GPU) {
38
+ result.push(" Helper (GPU)");
39
+ }
40
+ return result;
41
+ }
42
+ //# sourceMappingURL=electronMacUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"electronMacUtils.js","sourceRoot":"","sources":["../../../src/electron/mac/electronMacUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAE,KAAa;IAC9D,MAAM,SAAS,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAA;IACxC,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,MAAM,IAAI,yBAAyB,CACjC,GAAG,KAAK,KAAK,IAAI,qEAAqE,SAAS,aAAa,KAAK,0CAA0C,CAC5J,CAAA;IACH,CAAC;AACH,CAAC;AAUD;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,OAAyB;IAClE,MAAM,MAAM,GAAG,CAAC,SAAS,CAAC,CAAA;IAC1B,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IAC3B,CAAC;IACD,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IAC3B,CAAC;IACD,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;IACnC,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;IACjC,CAAC;IACD,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;IAC9B,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { InvalidConfigurationError } from \"builder-util\"\nimport { sanitizeFileName } from \"builder-util/internal\"\n\n/**\n * At runtime Electron locates its helper apps relative to the main application name, resolving each\n * one as `${CFBundleName} Helper.app` (see `electron_main_delegate_mac.mm`). electron-builder uses\n * the product name verbatim for both `CFBundleName` and the on-disk helper/app bundle names, so the\n * name must be usable as a filename without modification.\n *\n * If the name would be altered by filename sanitization, the on-disk bundle (sanitized) and\n * `CFBundleName` (verbatim) would diverge and break helper discovery. Reject such names up front with\n * a clear error so the user can choose a valid name, rather than silently changing it for them.\n */\nexport function assertSafeHelperName(name: string, field: string): void {\n const sanitized = sanitizeFileName(name)\n if (sanitized !== name) {\n throw new InvalidConfigurationError(\n `${field} \"${name}\" is not a valid macOS app bundle name (it would be sanitized to \"${sanitized}\"). Set a ${field} that requires no filename sanitization.`\n )\n }\n}\n\nexport interface AvailableHelpers {\n EH?: boolean\n NP?: boolean\n Renderer?: boolean\n Plugin?: boolean\n GPU?: boolean\n}\n\n/**\n * Returns the helper bundle suffixes present in the current Electron distribution. The generic\n * `\" Helper\"` bundle is always present; the remaining variants vary by Electron version.\n */\nexport function getAvailableHelperSuffixes(present: AvailableHelpers): string[] {\n const result = [\" Helper\"]\n if (present.EH) {\n result.push(\" Helper EH\")\n }\n if (present.NP) {\n result.push(\" Helper NP\")\n }\n if (present.Renderer) {\n result.push(\" Helper (Renderer)\")\n }\n if (present.Plugin) {\n result.push(\" Helper (Plugin)\")\n }\n if (present.GPU) {\n result.push(\" Helper (GPU)\")\n }\n return result\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { Filter } from "builder-util";
2
+ import { Nullish } from "builder-util-runtime";
2
3
  import { Minimatch } from "minimatch";
3
4
  import type { Configuration } from "./configuration.js";
4
5
  import { PlatformSpecificBuildOptions } from "./options/PlatformSpecificBuildOptions.js";
@@ -52,5 +53,19 @@ export interface GetFileMatchersOptions {
52
53
  readonly globalOutDir: string;
53
54
  readonly defaultSrc: string;
54
55
  }
56
+ /**
57
+ * Resolves a file set `to` to the destination a FileMatcher should copy into.
58
+ *
59
+ * - A missing `to` falls back to `defaultDestination`.
60
+ * - For file sets that are physically copied into the build output directory
61
+ * (see {@link VALIDATED_DESTINATION_NAMES}), the result is validated to stay inside it:
62
+ * absolute `to` values (POSIX, Windows drive-letter, or UNC — files would be copied to that
63
+ * literal path on the build machine) and relative values that escape `globalOutDir`
64
+ * (e.g. `../../usr/share`) throw. Relative hops that stay inside the build output directory
65
+ * (e.g. `to: "../Frameworks"` from `Contents/Resources` on macOS) remain valid.
66
+ * - `files` sets are exempt from validation: their `to` only participates in in-package (asar)
67
+ * relative math, so it is plainly resolved against `defaultDestination`.
68
+ */
69
+ export declare function resolveFileSetDestination(name: string, to: string | Nullish, defaultDestination: string, globalOutDir: string): string;
55
70
  export declare function getFileMatchers(config: Configuration, name: "files" | "extraFiles" | "extraResources" | "extraDistFiles", defaultDestination: string, options: GetFileMatchersOptions): Array<FileMatcher> | null;
56
71
  //# sourceMappingURL=fileMatcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fileMatcher.d.ts","sourceRoot":"","sources":["../src/fileMatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqD,MAAM,EAAmC,MAAM,cAAc,CAAA;AAGzH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EAAW,4BAA4B,EAAE,MAAM,2CAA2C,CAAA;AAUjG,eAAO,MAAM,sBAAsB,EAAE,aAAa,CAAC,MAAM,CAoCxD,CAAA;AAGD,eAAO,MAAM,2BAA2B,EAAE,aAAa,CAAC,MAAM,CAoB7D,CAAA;AAiED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG;IAAE,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAmB1H;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CA8BjH;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAG7F;AAiBD,qBAAa,WAAW;IAapB,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM;IAZrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IAEnB,QAAQ,CAAC,QA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,MAAM,EACnD,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI;IAQ1C,gBAAgB,CAAC,OAAO,EAAE,MAAM;IAOhC,UAAU,CAAC,OAAO,EAAE,MAAM;IAI1B,cAAc,CAAC,OAAO,EAAE,MAAM;IAI9B,OAAO;IAIP,kBAAkB,IAAI,OAAO;IAI7B,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IA0BvE,YAAY,IAAI,MAAM;IAMtB,QAAQ;CAGT;AAyJD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;IACnD,QAAQ,CAAC,kBAAkB,EAAE,4BAA4B,CAAA;IACzD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAE7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAUD;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CA2BtI;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,OAAO,GAAG,YAAY,GAAG,gBAAgB,GAAG,gBAAgB,EAClE,kBAAkB,EAAE,MAAM,EAC1B,OAAO,EAAE,sBAAsB,GAC9B,KAAK,CAAC,WAAW,CAAC,GAAG,IAAI,CA4C3B"}
@@ -1,4 +1,4 @@
1
- import { asArray, copyDir, copyOrLinkFile, log, statOrNull, USE_HARD_LINKS } from "builder-util";
1
+ import { asArray, copyDir, copyOrLinkFile, InvalidConfigurationError, log, statOrNull, USE_HARD_LINKS } from "builder-util";
2
2
  import { mkdir } from "fs/promises";
3
3
  import { Minimatch } from "minimatch";
4
4
  import * as path from "path";
@@ -394,6 +394,45 @@ export function getNodeModuleFileMatcher(appDir, destination, macroExpander, pla
394
394
  }
395
395
  return matcher;
396
396
  }
397
+ // The names whose file sets are physically copied into the build output directory, so a `to` that
398
+ // resolves outside of it writes onto the build machine itself (https://github.com/electron-userland/electron-builder/issues/1993).
399
+ // `files` is excluded: its `to` is only used for in-package (asar) relative math.
400
+ const VALIDATED_DESTINATION_NAMES = ["extraFiles", "extraResources", "extraDistFiles"];
401
+ const FPM_MAPPING_HINT = 'To install a file at an absolute path inside a deb/rpm package, use the fpm file-mapping syntax instead, e.g. "deb": { "fpm": ["build/file.xml=/usr/share/metainfo/file.xml"] }.';
402
+ /**
403
+ * Resolves a file set `to` to the destination a FileMatcher should copy into.
404
+ *
405
+ * - A missing `to` falls back to `defaultDestination`.
406
+ * - For file sets that are physically copied into the build output directory
407
+ * (see {@link VALIDATED_DESTINATION_NAMES}), the result is validated to stay inside it:
408
+ * absolute `to` values (POSIX, Windows drive-letter, or UNC — files would be copied to that
409
+ * literal path on the build machine) and relative values that escape `globalOutDir`
410
+ * (e.g. `../../usr/share`) throw. Relative hops that stay inside the build output directory
411
+ * (e.g. `to: "../Frameworks"` from `Contents/Resources` on macOS) remain valid.
412
+ * - `files` sets are exempt from validation: their `to` only participates in in-package (asar)
413
+ * relative math, so it is plainly resolved against `defaultDestination`.
414
+ */
415
+ export function resolveFileSetDestination(name, to, defaultDestination, globalOutDir) {
416
+ if (to == null) {
417
+ return defaultDestination;
418
+ }
419
+ if (!VALIDATED_DESTINATION_NAMES.includes(name)) {
420
+ return path.resolve(defaultDestination, to);
421
+ }
422
+ // path.win32.isAbsolute also covers POSIX absolute paths, and treats drive-letter (C:\) and
423
+ // UNC (\\server\share) paths as absolute no matter which OS the build runs on
424
+ if (path.win32.isAbsolute(to) || path.posix.isAbsolute(to)) {
425
+ throw new InvalidConfigurationError(`The "to" path "${to}" in "${name}" is absolute. Absolute destinations are not copied into the packaged app — they would be written to that literal path on the build machine. Use a relative path instead. ${FPM_MAPPING_HINT}`);
426
+ }
427
+ // FileMatcher later converts all separators to path.sep, so normalize before resolving to make
428
+ // sure `..\\..` segments written with backslashes are seen as parent hops here too
429
+ const resolved = path.resolve(defaultDestination, to.replace(/[/\\]/g, path.sep));
430
+ const relativeToOutDir = path.relative(path.resolve(globalOutDir), resolved);
431
+ if (relativeToOutDir.startsWith(`..${path.sep}`) || relativeToOutDir === ".." || path.isAbsolute(relativeToOutDir)) {
432
+ throw new InvalidConfigurationError(`The "to" path "${to}" in "${name}" resolves to "${resolved}", which is outside the build output directory "${path.resolve(globalOutDir)}". The files would be copied onto the build machine instead of into the packaged app. Use a relative path that stays within the package. ${FPM_MAPPING_HINT}`);
433
+ }
434
+ return resolved;
435
+ }
397
436
  export function getFileMatchers(config, name, defaultDestination, options) {
398
437
  const defaultMatcher = new FileMatcher(options.defaultSrc, defaultDestination, options.macroExpander);
399
438
  const fileMatchers = [];
@@ -415,7 +454,7 @@ export function getFileMatchers(config, name, defaultDestination, options) {
415
454
  }
416
455
  else {
417
456
  const from = pattern.from == null ? options.defaultSrc : path.resolve(options.defaultSrc, pattern.from);
418
- const to = pattern.to == null ? defaultDestination : path.resolve(defaultDestination, pattern.to);
457
+ const to = resolveFileSetDestination(name, pattern.to, defaultDestination, options.globalOutDir);
419
458
  fileMatchers.push(new FileMatcher(from, to, options.macroExpander, pattern.filter));
420
459
  }
421
460
  }