app-builder-lib 26.14.0 → 26.15.1

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 (83) hide show
  1. package/out/configuration.d.ts +11 -0
  2. package/out/configuration.js.map +1 -1
  3. package/out/electron/ElectronFramework.js +2 -6
  4. package/out/electron/ElectronFramework.js.map +1 -1
  5. package/out/frameworks/LibUiFramework.d.ts +25 -0
  6. package/out/frameworks/LibUiFramework.js +107 -19
  7. package/out/frameworks/LibUiFramework.js.map +1 -1
  8. package/out/mac/MacTargetHelper.d.ts +7 -2
  9. package/out/mac/MacTargetHelper.js +18 -14
  10. package/out/mac/MacTargetHelper.js.map +1 -1
  11. package/out/macPackager.js +2 -3
  12. package/out/macPackager.js.map +1 -1
  13. package/out/node-module-collector/nodeModulesCollector.d.ts +17 -8
  14. package/out/node-module-collector/nodeModulesCollector.js +86 -60
  15. package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
  16. package/out/options/linuxOptions.d.ts +10 -0
  17. package/out/options/linuxOptions.js.map +1 -1
  18. package/out/options/macOptions.d.ts +12 -2
  19. package/out/options/macOptions.js.map +1 -1
  20. package/out/packager.d.ts +0 -4
  21. package/out/packager.js +0 -19
  22. package/out/packager.js.map +1 -1
  23. package/out/targets/FpmTarget.js +6 -5
  24. package/out/targets/FpmTarget.js.map +1 -1
  25. package/out/targets/LinuxTargetHelper.d.ts +1 -0
  26. package/out/targets/LinuxTargetHelper.js +23 -1
  27. package/out/targets/LinuxTargetHelper.js.map +1 -1
  28. package/out/targets/MsiTarget.js +2 -1
  29. package/out/targets/MsiTarget.js.map +1 -1
  30. package/out/targets/appimage/AppImageTarget.js +6 -1
  31. package/out/targets/appimage/AppImageTarget.js.map +1 -1
  32. package/out/targets/appimage/appImageUtil.d.ts +2 -0
  33. package/out/targets/appimage/appImageUtil.js +2 -2
  34. package/out/targets/appimage/appImageUtil.js.map +1 -1
  35. package/out/targets/archive.d.ts +0 -1
  36. package/out/targets/archive.js +60 -88
  37. package/out/targets/archive.js.map +1 -1
  38. package/out/targets/blockmap/blockmap.js +8 -4
  39. package/out/targets/blockmap/blockmap.js.map +1 -1
  40. package/out/targets/nsis/NsisTarget.js +6 -12
  41. package/out/targets/nsis/NsisTarget.js.map +1 -1
  42. package/out/targets/pkg.d.ts +13 -0
  43. package/out/targets/pkg.js +34 -9
  44. package/out/targets/pkg.js.map +1 -1
  45. package/out/targets/snap/core24.js +4 -3
  46. package/out/targets/snap/core24.js.map +1 -1
  47. package/out/targets/snap/coreLegacy.d.ts +23 -0
  48. package/out/targets/snap/coreLegacy.js +161 -23
  49. package/out/targets/snap/coreLegacy.js.map +1 -1
  50. package/out/toolsets/7zip.d.ts +2 -0
  51. package/out/toolsets/7zip.js +72 -0
  52. package/out/toolsets/7zip.js.map +1 -0
  53. package/out/toolsets/wine.d.ts +5 -0
  54. package/out/toolsets/wine.js +100 -0
  55. package/out/toolsets/wine.js.map +1 -0
  56. package/out/util/dynamicImport.js +0 -2
  57. package/out/util/dynamicImport.js.map +1 -1
  58. package/out/util/electronGet.js +36 -5
  59. package/out/util/electronGet.js.map +1 -1
  60. package/out/util/packageDependencies.d.ts +0 -6
  61. package/out/util/packageDependencies.js +0 -17
  62. package/out/util/packageDependencies.js.map +1 -1
  63. package/out/util/yarn.d.ts +0 -3
  64. package/out/util/yarn.js +3 -15
  65. package/out/util/yarn.js.map +1 -1
  66. package/out/version.d.ts +1 -1
  67. package/out/version.js +1 -1
  68. package/out/version.js.map +1 -1
  69. package/out/vm/WineVm.d.ts +5 -2
  70. package/out/vm/WineVm.js +19 -5
  71. package/out/vm/WineVm.js.map +1 -1
  72. package/out/vm/vm.js.map +1 -1
  73. package/package.json +10 -10
  74. package/scheme.json +25 -4
  75. package/templates/snap/desktop-common.sh +444 -0
  76. package/templates/snap/desktop-gnome-specific.sh +31 -0
  77. package/templates/snap/desktop-init.sh +52 -0
  78. package/out/util/appBuilder.d.ts +0 -4
  79. package/out/util/appBuilder.js +0 -36
  80. package/out/util/appBuilder.js.map +0 -1
  81. package/out/wine.d.ts +0 -5
  82. package/out/wine.js +0 -31
  83. package/out/wine.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"LinuxTargetHelper.js","sourceRoot":"","sources":["../../src/targets/LinuxTargetHelper.ts"],"names":[],"mappings":";;;AAAA,+CAA+F;AAC/F,+DAAiD;AACjD,uCAAqC;AACrC,uCAA+B;AAC/B,+BAA2B;AAC3B,iCAAgC;AAKhC,0CAA0C;AAC1C,kDAAkD;AAClD,kDAAkD;AAGlD;;;;;;;;;;;;;;;;GAgBG;AACH,SAAS,mBAAmB,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACvG,CAAC;AAED;;;;;;GAMG;AACH,MAAM,gBAAgB,GAAG,uBAAuB,CAAA;AAEhD;;;;;;;;;;;;;;GAcG;AACH,SAAS,oBAAoB,CAAC,GAAW;IACvC,oEAAoE;IACpE,IAAI,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,CAAA;IACZ,CAAC;IACD,qEAAqE;IACrE,IAAI,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAA;IAC/D,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAS,yBAAyB,CAAC,KAA0C;IAC3E,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;QACtB,OAAO,KAAK,CAAA;IACd,CAAC;IACD,IAAI,KAAK,KAAK,SAAS,EAAE,C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AAuC,EAAE,cAAc;IACvD,6BAA6B,EAAE,gBAAgB;IAC/C,2BAA2B,EAAE,kBAAkB;CAChD,CAAA","sourcesContent":["import { asArray, exists, InvalidConfigurationError, isEmptyOrSpaces, log } from \"builder-util\"\nimport { deepAssign } from \"builder-util-runtime\"\nimport { outputFile } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport { join } from \"path\"\nimport * as semver from \"semver\"\nimport { CompressionLevel } from \"../core\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { CommonLinuxOptions } from \"../options/linuxOptions\"\nimport { SnapCore } from \"./snap/SnapTarget\"\nimport { SnapCore24 } from \"./snap/core24\"\nimport { SnapCoreCustom } from \"./snap/coreCustom\"\nimport { SnapCoreLegacy } from \"./snap/coreLegacy\"\nimport { IconInfo } from \"../util/iconConverter\"\n\n/**\n * Escape a string value for use in a freedesktop .desktop file string field\n * (Name, Comment, StartupWMClass, etc.).\n *\n * The freedesktop Desktop Entry Specification requires that the following\n * characters be escaped in string / localestring values:\n * \\n → \\\\n (newline — would inject new key=value lines otherwise)\n * \\r → \\\\r\n * \\t → \\\\t\n * \\\\ → \\\\\\\\\n *\n * Without escaping, a productName or description containing a literal newline\n * can inject arbitrary key=value pairs into the generated .desktop file,\n * potentially overriding the Exec key.\n *\n * @see https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#value-types\n */\nfunction desktopStringEscape(value: string): string {\n return value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\\n/g, \"\\\\n\").replace(/\\r/g, \"\\\\r\").replace(/\\t/g, \"\\\\t\")\n}\n\n/**\n * Characters that require an Exec argument to be double-quoted per the\n * freedesktop Desktop Entry Specification. Plain alphanumeric args and\n * field codes must NOT be wrapped in quotes.\n *\n * @see https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables\n */\nconst EXEC_RESERVED_RE = /[\\s\"'`\\\\<>~|&;$*?#()]/\n\n/**\n * Quote a single argument for use in a .desktop file Exec key.\n *\n * Field codes (`%f`, `%u`, `%F`, `%U`, etc.) MUST be left unquoted — the\n * desktop launcher only expands them in unquoted token positions. Wrapping\n * them in `\"…\"` causes the launcher to treat them as literal strings, which\n * breaks file-association / drag-and-drop functionality.\n *\n * For all other arguments, double-quoting is used when the argument contains\n * any character that would be misinterpreted by the launcher without quoting\n * (spaces, shell metacharacters, etc.). Safe plain-word args are passed\n * through unchanged to keep the Exec line readable.\n *\n * @see https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables\n */\nfunction desktopExecArgEscape(arg: string): string {\n // Field codes (%f, %u, %F, %U, %i, %c, %k, …) must never be quoted.\n if (/^%[a-zA-Z]$/.test(arg)) {\n return arg\n }\n // Only quote when the arg actually contains characters that need it.\n if (EXEC_RESERVED_RE.test(arg)) {\n return `\"${arg.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"')}\"`\n }\n return arg\n}\n\nfunction mapLinuxCompressionToSnap(level: CompressionLevel | null | undefined): \"xz\" | \"lzo\" | undefined {\n if (level === \"store\") {\n return \"lzo\"\n }\n if (level === \"maximum\") {\n return \"xz\"\n }\n return undefined\n}\n\nexport const installPrefix = \"/opt\"\n\nexport class LinuxTargetHelper {\n private readonly iconPromise = new Lazy(() => this.computeDesktopIcons())\n\n private readonly mimeTypeFilesPromise = new Lazy(() => this.computeMimeTypeFiles())\n\n maxIconPath: string | null = null\n\n constructor(private packager: LinuxPackager) {}\n\n get icons(): Promise<Array<IconInfo>> {\n return this.iconPromise.value\n }\n\n get mimeTypeFiles(): Promise<string | null> {\n return this.mimeTypeFilesPromise.value\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getSnapCore(): SnapCore<any> {\n const { snapcraft, snap: legacySnap } = this.packager.config\n if (snapcraft != null && legacySnap != null) {\n log.warn(\"Both `snapcraft` and `snap` configurations are present. `snapcraft` takes precedence; please remove the `snap` key to silence this warning.\")\n }\n\n // Merge linux-level options (category, description, mimeTypes, etc.) as the base so they\n // propagate into the generated snapcraft.yaml and .desktop file without requiring users to\n // duplicate them under core24/core18/etc. Per-core options always win for conflicts.\n // linux.compression is a CompressionLevel (\"store\"/\"normal\"/\"maximum\"); snap compression is an\n // algorithm (\"xz\"/\"lzo\"). Map the level to the nearest algorithm; per-core options override.\n const { compression: linuxCompression, ...linuxOptions } = this.packager.platformSpecificBuildOptions\n const snapLinuxOptions = { ...linuxOptions, compression: mapLinuxCompressionToSnap(linuxCompression) }\n\n if (snapcraft != null) {\n const core = snapcraft.base\n const options = snapcraft[core] || {}\n switch (core) {\n case \"core18\":\n case \"core20\":\n case \"core22\":\n if (!this.isElectronVersionGreaterOrEqualThan(\"4.0.0\")) {\n if (!this.isElectronVersionGreaterOrEqualThan(\"2.0.0-beta.1\")) {\n throw new InvalidConfigurationError(\"Electron 2 and higher is required to build Snap with core18/core20/core22\")\n }\n log.warn(null, \"electron 4 and higher is highly recommended for Snap with core18/core20/core22\")\n }\n return new SnapCoreLegacy(this.packager, this, deepAssign({}, snapLinuxOptions, { base: core, ...options }))\n case \"core24\":\n if (!this.isElectronVersionGreaterOrEqualThan(\"28.0.0\")) {\n if (!this.isElectronVersionGreaterOrEqualThan(\"25.0.0\")) {\n throw new InvalidConfigurationError(\"Electron 25 and higher is required to build Snap with core24\")\n }\n log.warn(null, \"electron 28 and higher is highly recommended for Snap with core24\")\n }\n return new SnapCore24(this.packager, this, deepAssign({}, snapLinuxOptions, options))\n case \"custom\":\n // Pass-through: do not inject linux options into user-supplied yaml\n return new SnapCoreCustom(this.packager, this, snapcraft.custom || {})\n }\n }\n\n if (legacySnap != null) {\n log.warn(\n {\n reason: \"`snap` configuration is deprecated\",\n docs: \"https://www.electron.build/snapcraft\",\n },\n \"please consider migrating `snap` configuration to `snapcraft.<core>` and remove `snap` configuration\"\n )\n }\n return new SnapCoreLegacy(this.packager, this, deepAssign({}, snapLinuxOptions, legacySnap ?? {}))\n }\n\n isElectronVersionGreaterOrEqualThan(version: string, fallback?: string): boolean {\n const electronVersion = this.packager.config.electronVersion\n if (!electronVersion) {\n return fallback ? semver.gte(fallback, version) : true\n }\n return semver.gte(electronVersion, version)\n }\n\n private async computeMimeTypeFiles(): Promise<string | null> {\n const items: Array<string> = []\n for (const fileAssociation of this.packager.fileAssociations) {\n if (!fileAssociation.mimeType) {\n continue\n }\n\n const data = `<mime-type type=\"${fileAssociation.mimeType}\">\n <glob pattern=\"*.${fileAssociation.ext}\"/>\n ${fileAssociation.description ? `<comment>${fileAssociation.description}</comment>` : \"\"}\n <icon name=\"x-office-document\" />\n</mime-type>`\n items.push(data)\n }\n\n if (items.length === 0) {\n return null\n }\n\n const file = await this.packager.getTempFile(\".xml\")\n await outputFile(\n file,\n '<?xml version=\"1.0\" encoding=\"utf-8\"?>\\n<mime-info xmlns=\"http://www.freedesktop.org/standards/shared-mime-info\">\\n' + items.join(\"\\n\") + \"\\n</mime-info>\"\n )\n return file\n }\n\n // must be name without spaces and other special characters, but not product name used\n private async computeDesktopIcons(): Promise<Array<IconInfo>> {\n const packager = this.packager\n const { platformSpecificBuildOptions, config } = packager\n\n const sources = [platformSpecificBuildOptions.icon, config.mac?.icon ?? config.icon].filter(str => !!str) as string[]\n\n // If no explicit sources are defined, fallback to buildResources directory, then default framework icon\n let fallbackSources = [...asArray(packager.getDefaultFrameworkIcon())]\n const buildResources = config.directories?.buildResources\n if (buildResources && (await exists(join(buildResources, \"icons\")))) {\n fallbackSources = [buildResources, ...fallbackSources]\n }\n\n // need to put here and not as default because need to resolve image size\n const result = await packager.resolveIcon(sources, fallbackSources, \"set\")\n this.maxIconPath = result[result.length - 1].file\n\n // Ignore .icon files for linux (they are exclusive for macOS)\n return result.filter(icon => !icon.file.endsWith(\".icon\"))\n }\n\n getDescription(options: CommonLinuxOptions) {\n return options.description || this.packager.appInfo.description\n }\n\n getSanitizedVersion(target: string) {\n const {\n appInfo: { version },\n } = this.packager\n switch (target) {\n case \"pacman\":\n return version.replace(/-/g, \"_\")\n case \"rpm\":\n case \"deb\":\n return version.replace(/-/g, \"~\")\n default:\n return version\n }\n }\n\n async writeDesktopEntry(targetSpecificOptions: CommonLinuxOptions, exec?: string, destination?: string | null, extra?: Record<string, string>): Promise<string> {\n const data = await this.computeDesktopEntry(targetSpecificOptions, exec, extra)\n const file = destination || (await this.packager.getTempFile(`${this.packager.appInfo.productFilename}.desktop`))\n await outputFile(file, data)\n return file\n }\n\n computeDesktopEntry(targetSpecificOptions: CommonLinuxOptions, exec?: string, extra?: Record<string, string>): Promise<string> {\n if (exec != null && exec.length === 0) {\n throw new Error(\"Specified exec is empty\")\n }\n // https://github.com/electron-userland/electron-builder/issues/3418\n if (targetSpecificOptions.desktop?.entry?.Exec) {\n throw new Error(\"Please specify executable name as linux.executableName instead of linux.desktop.Exec\")\n }\n\n const packager = this.packager\n const appInfo = packager.appInfo\n\n const executableArgs = targetSpecificOptions.executableArgs\n if (exec == null) {\n exec = `${installPrefix}/${appInfo.sanitizedProductName}/${packager.executableName}`\n if (!/^[/0-9A-Za-z._-]+$/.test(exec)) {\n exec = `\"${exec}\"`\n }\n if (executableArgs) {\n exec += \" \"\n // Each arg is double-quoted per the freedesktop Exec key spec so that\n // spaces, $, ;, & and other reserved characters are not misinterpreted.\n exec += executableArgs.map(desktopExecArgEscape).join(\" \")\n }\n // https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables\n const execCodes = [\"%f\", \"%u\", \"%F\", \"%U\"]\n if (executableArgs == null || executableArgs.findIndex(arg => execCodes.includes(arg)) === -1) {\n exec += \" %U\"\n }\n }\n\n // https://github.com/electron-userland/electron-builder/issues/9103\n // Electron derives app_id from desktopName in package.json; StartupWMClass must match.\n // https://github.com/electron/electron/blob/9a7b73b5334f1d72c08e2d5e94106706ed751186/lib/browser/init.ts#L128-L133\n const trimmedDesktopName = packager.info.metadata.desktopName?.trim()\n const wmClass = !isEmptyOrSpaces(trimmedDesktopName) ? trimmedDesktopName.replace(/\\.desktop$/, \"\") : appInfo.productName\n\n const desktopMeta = deepAssign<any>(\n {\n // String values are escaped per the freedesktop spec (\\\\, \\n, \\r, \\t)\n // so that a product name containing a newline cannot inject new key=value\n // pairs into the .desktop file (e.g. overriding the Exec key).\n Name: desktopStringEscape(appInfo.productName),\n Exec: exec,\n Terminal: \"false\",\n Type: \"Application\",\n Icon: packager.executableName,\n // https://askubuntu.com/questions/367396/what-represent-the-startupwmclass-field-of-a-desktop-file\n // Set to desktopName (minus .desktop suffix) when provided, so it matches Electron's\n // app_id and desktop environments can associate running windows with this entry.\n // Falls back to productName for apps that don't set desktopName.\n // to get WM_CLASS of running window: xprop WM_CLASS\n // StartupWMClass doesn't work for unicode\n // https://github.com/electron/electron/blob/2-0-x/atom/browser/native_window_views.cc#L226\n StartupWMClass: desktopStringEscape(wmClass),\n },\n extra,\n targetSpecificOptions.desktop?.entry ?? {}\n )\n\n const description = this.getDescription(targetSpecificOptions)\n if (!isEmptyOrSpaces(description)) {\n desktopMeta.Comment = desktopStringEscape(description)\n }\n\n const mimeTypes: Array<string> = asArray(targetSpecificOptions.mimeTypes)\n for (const fileAssociation of packager.fileAssociations) {\n if (fileAssociation.mimeType != null) {\n mimeTypes.push(fileAssociation.mimeType)\n }\n }\n\n for (const protocol of asArray(packager.config.protocols).concat(asArray(packager.platformSpecificBuildOptions.protocols))) {\n for (const scheme of asArray(protocol.schemes)) {\n mimeTypes.push(`x-scheme-handler/${scheme}`)\n }\n }\n\n if (mimeTypes.length !== 0) {\n desktopMeta.MimeType = mimeTypes.join(\";\") + \";\"\n }\n\n let category = targetSpecificOptions.category\n if (isEmptyOrSpaces(category)) {\n const macCategory = (packager.config.mac || {}).category\n if (macCategory != null) {\n category = macToLinuxCategory[macCategory]\n }\n\n if (category == null) {\n // https://github.com/develar/onshape-desktop-shell/issues/48\n if (macCategory != null) {\n log.warn({ macCategory }, \"cannot map macOS category to Linux. If possible mapping is known for you, please file issue to add it.\")\n }\n log.warn(\n {\n reason: \"linux.category is not set and cannot map from macOS\",\n docs: \"https://www.electron.build/linux\",\n },\n 'application Linux category is set to default \"Utility\"'\n )\n category = \"Utility\"\n }\n }\n desktopMeta.Categories = `${category}${category.endsWith(\";\") ? \"\" : \";\"}`\n\n let data = `[Desktop Entry]`\n for (const name of Object.keys(desktopMeta)) {\n data += `\\n${name}=${desktopMeta[name]}`\n }\n data += \"\\n\"\n const desktopActions = targetSpecificOptions.desktop?.desktopActions ?? {}\n for (const [actionName, config] of Object.entries(desktopActions)) {\n if (!Object.keys(config ?? {}).length) {\n continue\n }\n data += `\\n[Desktop Action ${actionName}]`\n for (const [key, value] of Object.entries(config ?? {})) {\n data += `\\n${key}=${value}`\n }\n data += \"\\n\"\n }\n return Promise.resolve(data)\n }\n}\n\nconst macToLinuxCategory: any = {\n \"public.app-category.graphics-design\": \"Graphics\",\n \"public.app-category.developer-tools\": \"Development\",\n \"public.app-category.education\": \"Education\",\n \"public.app-category.games\": \"Game\",\n \"public.app-category.video\": \"Video;AudioVideo\",\n \"public.app-category.utilities\": \"Utility\",\n \"public.app-category.social-networking\": \"Network;Chat\",\n \"public.app-category.finance\": \"Office;Finance\",\n \"public.app-category.music\": \"Audio;AudioVideo\",\n}\n"]}
1
+ {"version":3,"file":"LinuxTargetHelper.js","sourceRoot":"","sources":["../../src/targets/LinuxTargetHelper.ts"],"names":[],"mappings":";;;AAAA,+CAA+F;AAC/F,+DAAiD;AACjD,uCAAqC;AACrC,uCAA+B;AAC/B,+BAA2B;AAC3B,iCAAgC;AAKhC,0CAA0C;AAC1C,kDAAkD;AAClD,kDAAkD;AAGlD;;;;;;;;;;;;;;;;GAgBG;AACH,SAAS,mBAAmB,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACvG,CAAC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KAAK,EAAE,CAAA;YAC7B,CAAC;YACD,IAAI,IAAI,IAAI,CAAA;QACd,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9B,CAAC;CACF;AAhTD,8CAgTC;AAED,MAAM,kBAAkB,GAAQ;IAC9B,qCAAqC,EAAE,UAAU;IACjD,qCAAqC,EAAE,aAAa;IACpD,+BAA+B,EAAE,WAAW;IAC5C,2BAA2B,EAAE,MAAM;IACnC,2BAA2B,EAAE,kBAAkB;IAC/C,+BAA+B,EAAE,SAAS;IAC1C,uCAAuC,EAAE,cAAc;IACvD,6BAA6B,EAAE,gBAAgB;IAC/C,2BAA2B,EAAE,kBAAkB;CAChD,CAAA","sourcesContent":["import { asArray, exists, InvalidConfigurationError, isEmptyOrSpaces, log } from \"builder-util\"\nimport { deepAssign } from \"builder-util-runtime\"\nimport { outputFile } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport { join } from \"path\"\nimport * as semver from \"semver\"\nimport { CompressionLevel } from \"../core\"\nimport { LinuxPackager } from \"../linuxPackager\"\nimport { CommonLinuxOptions } from \"../options/linuxOptions\"\nimport { SnapCore } from \"./snap/SnapTarget\"\nimport { SnapCore24 } from \"./snap/core24\"\nimport { SnapCoreCustom } from \"./snap/coreCustom\"\nimport { SnapCoreLegacy } from \"./snap/coreLegacy\"\nimport { IconInfo } from \"../util/iconConverter\"\n\n/**\n * Escape a string value for use in a freedesktop .desktop file string field\n * (Name, Comment, StartupWMClass, etc.).\n *\n * The freedesktop Desktop Entry Specification requires that the following\n * characters be escaped in string / localestring values:\n * \\n → \\\\n (newline — would inject new key=value lines otherwise)\n * \\r → \\\\r\n * \\t → \\\\t\n * \\\\ → \\\\\\\\\n *\n * Without escaping, a productName or description containing a literal newline\n * can inject arbitrary key=value pairs into the generated .desktop file,\n * potentially overriding the Exec key.\n *\n * @see https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#value-types\n */\nfunction desktopStringEscape(value: string): string {\n return value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\\n/g, \"\\\\n\").replace(/\\r/g, \"\\\\r\").replace(/\\t/g, \"\\\\t\")\n}\n\n/**\n * Characters that require an Exec argument to be double-quoted per the\n * freedesktop Desktop Entry Specification. Plain alphanumeric args and\n * field codes must NOT be wrapped in quotes.\n *\n * @see https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables\n */\nconst EXEC_RESERVED_RE = /[\\s\"'`\\\\<>~|&;$*?#()]/\n\n/**\n * Quote a single argument for use in a .desktop file Exec key.\n *\n * Field codes (`%f`, `%u`, `%F`, `%U`, etc.) MUST be left unquoted — the\n * desktop launcher only expands them in unquoted token positions. Wrapping\n * them in `\"…\"` causes the launcher to treat them as literal strings, which\n * breaks file-association / drag-and-drop functionality.\n *\n * For all other arguments, double-quoting is used when the argument contains\n * any character that would be misinterpreted by the launcher without quoting\n * (spaces, shell metacharacters, etc.). Safe plain-word args are passed\n * through unchanged to keep the Exec line readable.\n *\n * @see https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables\n */\nfunction desktopExecArgEscape(arg: string): string {\n // Field codes (%f, %u, %F, %U, %i, %c, %k, …) must never be quoted.\n if (/^%[a-zA-Z]$/.test(arg)) {\n return arg\n }\n // Only quote when the arg actually contains characters that need it.\n if (EXEC_RESERVED_RE.test(arg)) {\n return `\"${arg.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"')}\"`\n }\n return arg\n}\n\nfunction mapLinuxCompressionToSnap(level: CompressionLevel | null | undefined): \"xz\" | \"lzo\" | undefined {\n if (level === \"store\") {\n return \"lzo\"\n }\n if (level === \"maximum\") {\n return \"xz\"\n }\n return undefined\n}\n\nexport const installPrefix = \"/opt\"\n\nexport class LinuxTargetHelper {\n private readonly iconPromise = new Lazy(() => this.computeDesktopIcons())\n\n private readonly mimeTypeFilesPromise = new Lazy(() => this.computeMimeTypeFiles())\n\n maxIconPath: string | null = null\n\n constructor(private packager: LinuxPackager) {}\n\n get icons(): Promise<Array<IconInfo>> {\n return this.iconPromise.value\n }\n\n get mimeTypeFiles(): Promise<string | null> {\n return this.mimeTypeFilesPromise.value\n }\n\n getSnapCore(): SnapCore<any> {\n const { snapcraft, snap: legacySnap } = this.packager.config\n if (snapcraft != null && legacySnap != null) {\n log.warn(\"Both `snapcraft` and `snap` configurations are present. `snapcraft` takes precedence; please remove the `snap` key to silence this warning.\")\n }\n\n // Merge linux-level options (category, description, mimeTypes, etc.) as the base so they\n // propagate into the generated snapcraft.yaml and .desktop file without requiring users to\n // duplicate them under core24/core18/etc. Per-core options always win for conflicts.\n // linux.compression is a CompressionLevel (\"store\"/\"normal\"/\"maximum\"); snap compression is an\n // algorithm (\"xz\"/\"lzo\"). Map the level to the nearest algorithm; per-core options override.\n const { compression: linuxCompression, ...linuxOptions } = this.packager.platformSpecificBuildOptions\n const snapLinuxOptions = { ...linuxOptions, compression: mapLinuxCompressionToSnap(linuxCompression) }\n\n if (snapcraft != null) {\n const core = snapcraft.base\n const options = snapcraft[core] || {}\n switch (core) {\n case \"core18\":\n case \"core20\":\n case \"core22\":\n if (!this.isElectronVersionGreaterOrEqualThan(\"4.0.0\")) {\n if (!this.isElectronVersionGreaterOrEqualThan(\"2.0.0-beta.1\")) {\n throw new InvalidConfigurationError(\"Electron 2 and higher is required to build Snap with core18/core20/core22\")\n }\n log.warn(null, \"electron 4 and higher is highly recommended for Snap with core18/core20/core22\")\n }\n return new SnapCoreLegacy(this.packager, this, deepAssign({}, snapLinuxOptions, { base: core, ...options }))\n case \"core24\":\n if (!this.isElectronVersionGreaterOrEqualThan(\"28.0.0\")) {\n if (!this.isElectronVersionGreaterOrEqualThan(\"25.0.0\")) {\n throw new InvalidConfigurationError(\"Electron 25 and higher is required to build Snap with core24\")\n }\n log.warn(null, \"electron 28 and higher is highly recommended for Snap with core24\")\n }\n return new SnapCore24(this.packager, this, deepAssign({}, snapLinuxOptions, options))\n case \"custom\":\n // Pass-through: do not inject linux options into user-supplied yaml\n return new SnapCoreCustom(this.packager, this, snapcraft.custom || {})\n }\n }\n\n if (legacySnap != null) {\n log.warn(\n {\n reason: \"`snap` configuration is deprecated\",\n docs: \"https://www.electron.build/snapcraft\",\n },\n \"please consider migrating `snap` configuration to `snapcraft.<core>` and remove `snap` configuration\"\n )\n }\n return new SnapCoreLegacy(this.packager, this, deepAssign({}, snapLinuxOptions, legacySnap ?? {}))\n }\n\n isElectronVersionGreaterOrEqualThan(version: string, fallback?: string): boolean {\n const electronVersion = this.packager.config.electronVersion\n if (!electronVersion) {\n return fallback ? semver.gte(fallback, version) : true\n }\n return semver.gte(electronVersion, version)\n }\n\n private async computeMimeTypeFiles(): Promise<string | null> {\n const items: Array<string> = []\n for (const fileAssociation of this.packager.fileAssociations) {\n if (!fileAssociation.mimeType) {\n continue\n }\n\n const data = `<mime-type type=\"${fileAssociation.mimeType}\">\n <glob pattern=\"*.${fileAssociation.ext}\"/>\n ${fileAssociation.description ? `<comment>${fileAssociation.description}</comment>` : \"\"}\n <icon name=\"x-office-document\" />\n</mime-type>`\n items.push(data)\n }\n\n if (items.length === 0) {\n return null\n }\n\n const file = await this.packager.getTempFile(\".xml\")\n await outputFile(\n file,\n '<?xml version=\"1.0\" encoding=\"utf-8\"?>\\n<mime-info xmlns=\"http://www.freedesktop.org/standards/shared-mime-info\">\\n' + items.join(\"\\n\") + \"\\n</mime-info>\"\n )\n return file\n }\n\n // must be name without spaces and other special characters, but not product name used\n private async computeDesktopIcons(): Promise<Array<IconInfo>> {\n const packager = this.packager\n const { platformSpecificBuildOptions, config } = packager\n\n const sources = [platformSpecificBuildOptions.icon, config.mac?.icon ?? config.icon].filter(str => !!str) as string[]\n\n // If no explicit sources are defined, fallback to buildResources directory, then default framework icon\n let fallbackSources = [...asArray(packager.getDefaultFrameworkIcon())]\n const buildResources = config.directories?.buildResources\n if (buildResources && (await exists(join(buildResources, \"icons\")))) {\n fallbackSources = [buildResources, ...fallbackSources]\n }\n\n // need to put here and not as default because need to resolve image size\n const result = await packager.resolveIcon(sources, fallbackSources, \"set\")\n this.maxIconPath = result[result.length - 1].file\n\n // Ignore .icon files for linux (they are exclusive for macOS)\n return result.filter(icon => !icon.file.endsWith(\".icon\"))\n }\n\n getDescription(options: CommonLinuxOptions) {\n return options.description || this.packager.appInfo.description\n }\n\n getSanitizedVersion(target: string) {\n const {\n appInfo: { version },\n } = this.packager\n switch (target) {\n case \"pacman\":\n return version.replace(/-/g, \"_\")\n case \"rpm\":\n case \"deb\":\n return version.replace(/-/g, \"~\")\n default:\n return version\n }\n }\n\n async writeDesktopEntry(targetSpecificOptions: CommonLinuxOptions, exec?: string, destination?: string | null, extra?: Record<string, string>): Promise<string> {\n const data = await this.computeDesktopEntry(targetSpecificOptions, exec, extra)\n const file = destination || (await this.packager.getTempFile(`${this.packager.appInfo.productFilename}.desktop`))\n await outputFile(file, data)\n return file\n }\n\n getDesktopFileName(fallback: string = this.packager.executableName): string {\n if (!this.packager.platformSpecificBuildOptions.syncDesktopName) {\n return fallback\n }\n const trimmedDesktopName = this.packager.info.metadata.desktopName?.trim()\n if (isEmptyOrSpaces(trimmedDesktopName)) {\n return fallback\n }\n const basename = trimmedDesktopName.replace(/\\.desktop$/, \"\")\n // Guard against path traversal: desktopName flows into filesystem paths\n // (snap/gui/<name>.desktop, /usr/share/applications/<name>.desktop, etc.).\n if (/[/\\\\]/.test(basename) || [...basename].some(c => c.charCodeAt(0) === 0)) {\n throw new InvalidConfigurationError(`desktopName \"${trimmedDesktopName}\" produces an invalid .desktop filename — remove any path separators or NUL characters`)\n }\n return basename\n }\n\n computeDesktopEntry(targetSpecificOptions: CommonLinuxOptions, exec?: string, extra?: Record<string, string>): Promise<string> {\n if (exec != null && exec.length === 0) {\n throw new Error(\"Specified exec is empty\")\n }\n // https://github.com/electron-userland/electron-builder/issues/3418\n if (targetSpecificOptions.desktop?.entry?.Exec) {\n throw new Error(\"Please specify executable name as linux.executableName instead of linux.desktop.Exec\")\n }\n\n const packager = this.packager\n const appInfo = packager.appInfo\n\n const executableArgs = targetSpecificOptions.executableArgs\n if (exec == null) {\n exec = `${installPrefix}/${appInfo.sanitizedProductName}/${packager.executableName}`\n if (!/^[/0-9A-Za-z._-]+$/.test(exec)) {\n exec = `\"${exec}\"`\n }\n if (executableArgs) {\n exec += \" \"\n // Each arg is double-quoted per the freedesktop Exec key spec so that\n // spaces, $, ;, & and other reserved characters are not misinterpreted.\n exec += executableArgs.map(desktopExecArgEscape).join(\" \")\n }\n // https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables\n const execCodes = [\"%f\", \"%u\", \"%F\", \"%U\"]\n if (executableArgs == null || executableArgs.findIndex(arg => execCodes.includes(arg)) === -1) {\n exec += \" %U\"\n }\n }\n\n // https://github.com/electron-userland/electron-builder/issues/9103\n // Electron derives app_id from desktopName in package.json; StartupWMClass must match.\n // https://github.com/electron/electron/blob/9a7b73b5334f1d72c08e2d5e94106706ed751186/lib/browser/init.ts#L128-L133\n const trimmedDesktopName = packager.info.metadata.desktopName?.trim()\n if (isEmptyOrSpaces(trimmedDesktopName)) {\n log.warn(\n {\n reason: \"desktopName is not set in package.json\",\n docs: \"https://www.electron.build/linux#window-association-desktopname--syncdesktopname\",\n },\n \"electron uses desktopName as app_id / WM_CLASS for window association. Without it desktop environments may not link running windows to this .desktop entry. Set desktopName in package.json and linux.syncDesktopName: true to fix.\"\n )\n }\n const wmClass = !isEmptyOrSpaces(trimmedDesktopName) ? trimmedDesktopName.replace(/\\.desktop$/, \"\") : appInfo.productName\n\n const desktopMeta = deepAssign<any>(\n {\n // String values are escaped per the freedesktop spec (\\\\, \\n, \\r, \\t)\n // so that a product name containing a newline cannot inject new key=value\n // pairs into the .desktop file (e.g. overriding the Exec key).\n Name: desktopStringEscape(appInfo.productName),\n Exec: exec,\n Terminal: \"false\",\n Type: \"Application\",\n Icon: packager.executableName,\n // https://askubuntu.com/questions/367396/what-represent-the-startupwmclass-field-of-a-desktop-file\n // Set to desktopName (minus .desktop suffix) when provided, so it matches Electron's\n // app_id and desktop environments can associate running windows with this entry.\n // Falls back to productName for apps that don't set desktopName.\n // to get WM_CLASS of running window: xprop WM_CLASS\n // StartupWMClass doesn't work for unicode\n // https://github.com/electron/electron/blob/2-0-x/atom/browser/native_window_views.cc#L226\n StartupWMClass: desktopStringEscape(wmClass),\n },\n extra,\n targetSpecificOptions.desktop?.entry ?? {}\n )\n\n const description = this.getDescription(targetSpecificOptions)\n if (!isEmptyOrSpaces(description)) {\n desktopMeta.Comment = desktopStringEscape(description)\n }\n\n const mimeTypes: Array<string> = asArray(targetSpecificOptions.mimeTypes)\n for (const fileAssociation of packager.fileAssociations) {\n if (fileAssociation.mimeType != null) {\n mimeTypes.push(fileAssociation.mimeType)\n }\n }\n\n for (const protocol of asArray(packager.config.protocols).concat(asArray(packager.platformSpecificBuildOptions.protocols))) {\n for (const scheme of asArray(protocol.schemes)) {\n mimeTypes.push(`x-scheme-handler/${scheme}`)\n }\n }\n\n if (mimeTypes.length !== 0) {\n desktopMeta.MimeType = mimeTypes.join(\";\") + \";\"\n }\n\n let category = targetSpecificOptions.category\n if (isEmptyOrSpaces(category)) {\n const macCategory = (packager.config.mac || {}).category\n if (macCategory != null) {\n category = macToLinuxCategory[macCategory]\n }\n\n if (category == null) {\n // https://github.com/develar/onshape-desktop-shell/issues/48\n if (macCategory != null) {\n log.warn({ macCategory }, \"cannot map macOS category to Linux. If possible mapping is known for you, please file issue to add it.\")\n }\n log.warn(\n {\n reason: \"linux.category is not set and cannot map from macOS\",\n docs: \"https://www.electron.build/linux\",\n },\n 'application Linux category is set to default \"Utility\"'\n )\n category = \"Utility\"\n }\n }\n desktopMeta.Categories = `${category}${category.endsWith(\";\") ? \"\" : \";\"}`\n\n let data = `[Desktop Entry]`\n for (const name of Object.keys(desktopMeta)) {\n data += `\\n${name}=${desktopMeta[name]}`\n }\n data += \"\\n\"\n const desktopActions = targetSpecificOptions.desktop?.desktopActions ?? {}\n for (const [actionName, config] of Object.entries(desktopActions)) {\n if (!Object.keys(config ?? {}).length) {\n continue\n }\n data += `\\n[Desktop Action ${actionName}]`\n for (const [key, value] of Object.entries(config ?? {})) {\n data += `\\n${key}=${value}`\n }\n data += \"\\n\"\n }\n return Promise.resolve(data)\n }\n}\n\nconst macToLinuxCategory: any = {\n \"public.app-category.graphics-design\": \"Graphics\",\n \"public.app-category.developer-tools\": \"Development\",\n \"public.app-category.education\": \"Education\",\n \"public.app-category.games\": \"Game\",\n \"public.app-category.video\": \"Video;AudioVideo\",\n \"public.app-category.utilities\": \"Utility\",\n \"public.app-category.social-networking\": \"Network;Chat\",\n \"public.app-category.finance\": \"Office;Finance\",\n \"public.app-category.music\": \"Audio;AudioVideo\",\n}\n"]}
@@ -21,10 +21,11 @@ const ROOT_DIR_ID = "APPLICATIONFOLDER";
21
21
  // WiX doesn't support Mono, so, dontnet462 is required to be installed for wine (preinstalled in our bundled wine)
22
22
  class MsiTarget extends core_1.Target {
23
23
  constructor(packager, outDir, name = "msi", isAsyncSupported = true) {
24
+ var _a;
24
25
  super(name, isAsyncSupported);
25
26
  this.packager = packager;
26
27
  this.outDir = outDir;
27
- this.vm = process.platform === "win32" ? new vm_1.VmManager() : new WineVm_1.WineVmManager();
28
+ this.vm = process.platform === "win32" ? new vm_1.VmManager() : new WineVm_1.WineVmManager((_a = this.packager.config.toolsets) === null || _a === void 0 ? void 0 : _a.wine);
28
29
  this.options = (0, builder_util_runtime_1.deepAssign)(this.packager.platformSpecificBuildOptions, this.packager.config.msi);
29
30
  this.projectTemplate = new lazy_val_1.Lazy(async () => {
30
31
  const template = (await (0, promises_1.readFile)(path.join((0, pathManager_1.getTemplatePath)(this.name), "template.xml"), "utf8"))
@@ -1 +1 @@
1
- {"version":3,"file":"MsiTarget.js","sourceRoot":"","sources":["../../src/targets/MsiTarget.ts"],"names":[],"mappings":";;AAAA,+CAAuD;AACvD,+DAAuD;AACvD,mCAAmC;AACnC,2BAA0B;A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IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAA;AAChC,CAAC;AAED,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAC/H,CAAC","sourcesContent":["import { Arch, asArray, log, walk } from \"builder-util\"\nimport { deepAssign, UUID } from \"builder-util-runtime\"\nimport { createHash } from \"crypto\"\nimport * as ejs from \"ejs\"\nimport { readFile, writeFile } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { MsiOptions } from \"../\"\nimport { getBinFromUrl } from \"../binDownload\"\nimport { Target } from \"../core\"\nimport { DesktopShortcutCreationPolicy, FinalCommonWindowsInstallerOptions, getEffectiveOptions } from \"../options/CommonWindowsInstallerConfiguration\"\nimport { normalizeExt } from \"../platformPackager\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { VmManager } from \"../vm/vm\"\nimport { WineVmManager } from \"../vm/WineVm\"\nimport { WinPackager } from \"../winPackager\"\nimport { withToolsetLock } from \"../util/toolsetLock\"\nimport { createStageDir, getWindowsInstallationDirName } from \"./targetUtil\"\n\nconst ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID = UUID.parse(\"d752fe43-5d44-44d5-9fc9-6dd1bf19d5cc\")\nconst ROOT_DIR_ID = \"APPLICATIONFOLDER\"\n\n// WiX doesn't support Mono, so, dontnet462 is required to be installed for wine (preinstalled in our bundled wine)\nexport default class MsiTarget extends Target {\n protected readonly vm = process.platform === \"win32\" ? new VmManager() : new WineVmManager()\n\n readonly options: MsiOptions = deepAssign(this.packager.platformSpecificBuildOptions, this.packager.config.msi)\n\n constructor(\n protected readonly packager: WinPackager,\n readonly outDir: string,\n name = \"msi\",\n isAsyncSupported = true\n ) {\n super(name, isAsyncSupported)\n }\n\n protected projectTemplate = new Lazy<(data: any) => string>(async () => {\n const template = (await readFile(path.join(getTemplatePath(this.name), \"template.xml\"), \"utf8\"))\n .replace(/{{/g, \"<%\")\n .replace(/}}/g, \"%>\")\n .replace(/\\${([^}]+)}/g, \"<%=$1%>\")\n return ejs.compile(template)\n })\n\n /**\n * A product-specific string that can be used in an [MSI Identifier](https://docs.microsoft.com/en-us/windows/win32/msi/identifier).\n */\n private get productMsiIdPrefix() {\n const sanitizedId = this.packager.appInfo.productFilename.replace(/[^\\w.]/g, \"\").replace(/^[^A-Za-z_]+/, \"\")\n return sanitizedId.length > 0 ? sanitizedId : \"App\" + this.upgradeCode.replace(/-/g, \"\")\n }\n\n protected get iconId() {\n return `${this.productMsiIdPrefix}Icon.exe`\n }\n\n protected get upgradeCode(): string {\n return (this.options.upgradeCode || UUID.v5(this.packager.appInfo.id, ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID)).toUpperCase()\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const artifactName = packager.expandArtifactBeautyNamePattern(this.options, \"msi\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"MSI\",\n file: artifactPath,\n arch,\n })\n\n const stageDir = await createStageDir(this, packager, arch)\n const vm = this.vm\n\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n\n // wix 4.0.0.5512.2 doesn't support the arm64 architecture so default to x64 when building for arm64.\n // This will result in an x64 MSI installer that installs an arm64 version of the application. This is a\n // stopgap until the electron-builder-binaries wix version is upgraded to a version that supports arm64:\n // https://github.com/electron-userland/electron-builder/issues/6077\n const wixArch = arch == Arch.arm64 ? Arch.x64 : arch\n\n const projectFile = stageDir.getTempFile(\"project.wxs\")\n const objectFiles = [\"project.wixobj\"]\n await writeFile(projectFile, await this.writeManifest(appOutDir, wixArch, commonOptions))\n\n await packager.info.emitMsiProjectCreated(projectFile)\n\n // noinspection SpellCheckingInspection\n const vendorPath = await getBinFromUrl(\"wix-4.0.0.5512.2\", \"wix-4.0.0.5512.2.7z\", \"fe677fcd837b18c9b912985d91636bbd8a1e800c3b3a6a841b6f96e89624e839\")\n\n // noinspection SpellCheckingInspection\n const candleArgs = [\"-arch\", wixArch === Arch.ia32 ? \"x86\" : \"x64\", `-dappDir=${vm.toVmFile(appOutDir)}`].concat(this.getCommonWixArgs())\n candleArgs.push(\"project.wxs\")\n await withToolsetLock(async () => {\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"candle.exe\")), candleArgs, {\n cwd: stageDir.dir,\n })\n await this.light(objectFiles, vm, artifactPath, appOutDir, vendorPath, stageDir.dir)\n })\n\n await stageDir.cleanup()\n\n await packager.signIf(artifactPath)\n\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n packager,\n arch,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"msi\"),\n target: this,\n isWriteUpdateInfo: false,\n })\n }\n\n private async light(objectFiles: Array<string>, vm: VmManager, artifactPath: string, appOutDir: string, vendorPath: string, tempDir: string) {\n // noinspection SpellCheckingInspection\n const lightArgs = [\n \"-out\",\n vm.toVmFile(artifactPath),\n \"-v\",\n // https://github.com/wixtoolset/issues/issues/5169\n \"-spdb\",\n // https://sourceforge.net/p/wix/bugs/2405/\n // error LGHT1076 : ICE61: This product should remove only older versions of itself. The Maximum version is not less than the current product. (1.1.0.42 1.1.0.42)\n \"-sw1076\",\n `-dappDir=${vm.toVmFile(appOutDir)}`,\n // \"-dcl:high\",\n ]\n .concat(this.getCommonWixArgs())\n .concat(this.getAdditionalLightArgs())\n\n // http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Build-3-5-2229-0-give-me-the-following-error-error-LGHT0216-An-unexpected-Win32-exception-with-errorn-td5707443.html\n if (process.platform !== \"win32\") {\n // noinspection SpellCheckingInspection\n lightArgs.push(\"-sval\")\n }\n\n if (this.options.oneClick === false) {\n lightArgs.push(\"-ext\", \"WixUIExtension\")\n }\n\n // objectFiles - only filenames, we set current directory to our temp stage dir\n lightArgs.push(...objectFiles)\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"light.exe\")), lightArgs, {\n cwd: tempDir,\n })\n }\n\n private getAdditionalLightArgs() {\n const args: Array<string> = []\n if (this.options.additionalLightArgs != null) {\n args.push(...this.options.additionalLightArgs)\n }\n return args\n }\n\n private getCommonWixArgs() {\n const args: Array<string> = [\"-pedantic\"]\n if (this.options.warningsAsErrors !== false) {\n args.push(\"-wx\")\n }\n if (this.options.additionalWixArgs != null) {\n args.push(...this.options.additionalWixArgs)\n }\n return args\n }\n\n protected async writeManifest(appOutDir: string, wixArch: Arch, commonOptions: FinalCommonWindowsInstallerOptions) {\n const appInfo = this.packager.appInfo\n const { files, dirs } = await this.computeFileDeclaration(appOutDir)\n const options = this.options\n\n return (await this.projectTemplate.value)({\n ...(await this.getBaseOptions(commonOptions)),\n isCreateDesktopShortcut: commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER,\n isRunAfterFinish: options.runAfterFinish !== false,\n // https://stackoverflow.com/questions/1929038/compilation-error-ice80-the-64bitcomponent-uses-32bitdirectory\n programFilesId: wixArch === Arch.x64 ? \"ProgramFiles64Folder\" : \"ProgramFilesFolder\",\n // wix in the name because special wix format can be used in the name\n installationDirectoryWixName: getWindowsInstallationDirName(appInfo, commonOptions.isAssisted || commonOptions.isPerMachine === true),\n dirs,\n files,\n })\n }\n\n protected async getBaseOptions(commonOptions: FinalCommonWindowsInstallerOptions): Promise<any> {\n const appInfo = this.packager.appInfo\n const iconPath = await this.packager.getIconPath()\n const compression = this.packager.compression\n\n const companyName = appInfo.companyName\n if (!companyName) {\n log.warn(`Manufacturer is not set for MSI — please set \"author\" in the package.json`)\n }\n\n return {\n ...commonOptions,\n iconPath: iconPath == null ? null : this.vm.toVmFile(iconPath),\n iconId: this.iconId,\n compressionLevel: compression === \"store\" ? \"none\" : \"high\",\n version: appInfo.getVersionInWeirdWindowsForm(),\n productName: appInfo.productName,\n upgradeCode: this.upgradeCode,\n manufacturer: companyName || appInfo.productName,\n appDescription: appInfo.description,\n }\n }\n\n private async computeFileDeclaration(appOutDir: string) {\n const appInfo = this.packager.appInfo\n let isRootDirAddedToRemoveTable = false\n const dirNames = new Set<string>()\n const dirs: Array<string> = []\n const fileSpace = \" \".repeat(6)\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n const files = (await walk(appOutDir)).map(file => {\n const packagePath = file.substring(appOutDir.length + 1)\n\n const lastSlash = packagePath.lastIndexOf(path.sep)\n const fileName = lastSlash > 0 ? packagePath.substring(lastSlash + 1) : packagePath\n let directoryId: string | null = null\n let dirName = \"\"\n // Wix Directory.FileSource doesn't work - https://stackoverflow.com/questions/21519388/wix-filesource-confusion\n if (lastSlash > 0) {\n // This Name attribute may also define multiple directories using the inline directory syntax.\n // For example, \"ProgramFilesFolder:\\My Company\\My Product\\bin\" would create a reference to a Directory element with Id=\"ProgramFilesFolder\" then create directories named \"My Company\" then \"My Product\" then \"bin\" nested beneath each other.\n // This syntax is a shortcut to defining each directory in an individual Directory element.\n dirName = packagePath.substring(0, lastSlash)\n // https://github.com/electron-userland/electron-builder/issues/3027\n directoryId = \"d\" + createHash(\"md5\").update(dirName).digest(\"base64\").replace(/\\//g, \"_\").replace(/\\+/g, \".\").replace(/=+$/, \"\")\n if (!dirNames.has(dirName)) {\n dirNames.add(dirName)\n dirs.push(`<Directory Id=\"${directoryId}\" Name=\"${ROOT_DIR_ID}:\\\\${dirName.replace(/\\//g, \"\\\\\")}\\\\\"/>`)\n }\n } else if (!isRootDirAddedToRemoveTable) {\n isRootDirAddedToRemoveTable = true\n }\n\n // since RegistryValue can be part of Component, *** *** *** *** *** *** *** *** *** wix cannot auto generate guid\n // https://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix\n let result = `<Component${directoryId === null ? \"\" : ` Directory=\"${directoryId}\"`}>`\n result += `\\n${fileSpace} <File Name=\"${xmlAttr(fileName)}\" Source=\"$(var.appDir)${path.sep}${xmlAttr(packagePath)}\" ReadOnly=\"yes\" KeyPath=\"yes\"`\n const isMainExecutable = packagePath === `${appInfo.productFilename}.exe`\n if (isMainExecutable) {\n result += ' Id=\"mainExecutable\"'\n } else if (directoryId === null) {\n result += ` Id=\"${path.basename(packagePath)}_f\"`\n }\n\n const isCreateDesktopShortcut = commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER\n if (isMainExecutable && (isCreateDesktopShortcut || commonOptions.isCreateStartMenuShortcut)) {\n result += `>\\n`\n const shortcutName = commonOptions.shortcutName\n if (isCreateDesktopShortcut) {\n result += `${fileSpace} <Shortcut Id=\"desktopShortcut\" Directory=\"DesktopFolder\" Name=\"${xmlAttr(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\" Icon=\"${this.iconId}\"/>\\n`\n }\n\n const hasMenuCategory = commonOptions.menuCategory != null\n const startMenuShortcutDirectoryId = hasMenuCategory ? \"AppProgramMenuDir\" : \"ProgramMenuFolder\"\n if (commonOptions.isCreateStartMenuShortcut) {\n if (hasMenuCategory) {\n dirs.push(`<Directory Id=\"${startMenuShortcutDirectoryId}\" Name=\"ProgramMenuFolder:\\\\${commonOptions.menuCategory}\\\\\"/>`)\n }\n result += `${fileSpace} <Shortcut Id=\"startMenuShortcut\" Directory=\"${startMenuShortcutDirectoryId}\" Name=\"${xmlAttr(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\" Icon=\"${this.iconId}\">\\n`\n result += `${fileSpace} <ShortcutProperty Key=\"System.AppUserModel.ID\" Value=\"${xmlAttr(this.packager.appInfo.id)}\"/>\\n`\n result += `${fileSpace} </Shortcut>\\n`\n }\n result += `${fileSpace}</File>`\n\n if (hasMenuCategory) {\n result += `<RemoveFolder Id=\"${startMenuShortcutDirectoryId}\" Directory=\"${startMenuShortcutDirectoryId}\" On=\"uninstall\"/>\\n`\n }\n } else {\n result += `/>`\n }\n\n const fileAssociations = this.packager.fileAssociations\n if (isMainExecutable && fileAssociations.length !== 0) {\n for (const item of fileAssociations) {\n const extensions = asArray(item.ext).map(normalizeExt)\n for (const ext of extensions) {\n result += `${fileSpace} <ProgId Id=\"${this.productMsiIdPrefix}.${ext}\" Advertise=\"yes\" Icon=\"${this.iconId}\" ${\n item.description ? `Description=\"${item.description}\"` : \"\"\n }>\\n`\n result += `${fileSpace} <Extension Id=\"${ext}\" Advertise=\"yes\">\\n`\n result += `${fileSpace} <Verb Id=\"open\" Command=\"Open with ${xmlAttr(this.packager.appInfo.productName)}\" Argument=\"&quot;%1&quot;\"/>\\n`\n result += `${fileSpace} </Extension>\\n`\n result += `${fileSpace} </ProgId>\\n`\n }\n }\n }\n\n return `${result}\\n${fileSpace}</Component>`\n })\n\n return { dirs: listToString(dirs, 2), files: listToString(files, 3) }\n }\n}\n\nfunction listToString(list: Array<string>, indentLevel: number) {\n const space = \" \".repeat(indentLevel * 2)\n return list.join(`\\n${space}`)\n}\n\nfunction xmlAttr(str: string) {\n return str.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\").replace(/\"/g, \"&quot;\").replace(/'/g, \"&apos;\")\n}\n"]}
1
+ {"version":3,"file":"MsiTarget.js","sourceRoot":"","sources":["../../src/targets/MsiTarget.ts"],"names":[],"mappings":";;AAAA,+CAAuD;AACvD,+DAAuD;AACvD,mCAAmC;AACnC,2BAA0B;AAC1B,0CAAiD;AACjD,uCAA+B;AAC/B,6BAA4B;AAE5B,gDAA8C;AAC9C,kCAAgC;AAChC,wGAAuJ;AACvJ,0DAAkD;AAClD,qDAAqD;AACrD,iCAAoC;AACpC,yCAA4C;AAE5C,qDAAqD;AACrD,6CAA4E;AAE5E,MAAM,qCAAqC,GAAG,2BAAI,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA;AAChG,MAAM,WAAW,GAAG,m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C,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAC/H,CAAC","sourcesContent":["import { Arch, asArray, log, walk } from \"builder-util\"\nimport { deepAssign, UUID } from \"builder-util-runtime\"\nimport { createHash } from \"crypto\"\nimport * as ejs from \"ejs\"\nimport { readFile, writeFile } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { MsiOptions } from \"../\"\nimport { getBinFromUrl } from \"../binDownload\"\nimport { Target } from \"../core\"\nimport { DesktopShortcutCreationPolicy, FinalCommonWindowsInstallerOptions, getEffectiveOptions } from \"../options/CommonWindowsInstallerConfiguration\"\nimport { normalizeExt } from \"../platformPackager\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { VmManager } from \"../vm/vm\"\nimport { WineVmManager } from \"../vm/WineVm\"\nimport { WinPackager } from \"../winPackager\"\nimport { withToolsetLock } from \"../util/toolsetLock\"\nimport { createStageDir, getWindowsInstallationDirName } from \"./targetUtil\"\n\nconst ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID = UUID.parse(\"d752fe43-5d44-44d5-9fc9-6dd1bf19d5cc\")\nconst ROOT_DIR_ID = \"APPLICATIONFOLDER\"\n\n// WiX doesn't support Mono, so, dontnet462 is required to be installed for wine (preinstalled in our bundled wine)\nexport default class MsiTarget extends Target {\n protected readonly vm = process.platform === \"win32\" ? new VmManager() : new WineVmManager(this.packager.config.toolsets?.wine)\n\n readonly options: MsiOptions = deepAssign(this.packager.platformSpecificBuildOptions, this.packager.config.msi)\n\n constructor(\n protected readonly packager: WinPackager,\n readonly outDir: string,\n name = \"msi\",\n isAsyncSupported = true\n ) {\n super(name, isAsyncSupported)\n }\n\n protected projectTemplate = new Lazy<(data: any) => string>(async () => {\n const template = (await readFile(path.join(getTemplatePath(this.name), \"template.xml\"), \"utf8\"))\n .replace(/{{/g, \"<%\")\n .replace(/}}/g, \"%>\")\n .replace(/\\${([^}]+)}/g, \"<%=$1%>\")\n return ejs.compile(template)\n })\n\n /**\n * A product-specific string that can be used in an [MSI Identifier](https://docs.microsoft.com/en-us/windows/win32/msi/identifier).\n */\n private get productMsiIdPrefix() {\n const sanitizedId = this.packager.appInfo.productFilename.replace(/[^\\w.]/g, \"\").replace(/^[^A-Za-z_]+/, \"\")\n return sanitizedId.length > 0 ? sanitizedId : \"App\" + this.upgradeCode.replace(/-/g, \"\")\n }\n\n protected get iconId() {\n return `${this.productMsiIdPrefix}Icon.exe`\n }\n\n protected get upgradeCode(): string {\n return (this.options.upgradeCode || UUID.v5(this.packager.appInfo.id, ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID)).toUpperCase()\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const artifactName = packager.expandArtifactBeautyNamePattern(this.options, \"msi\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"MSI\",\n file: artifactPath,\n arch,\n })\n\n const stageDir = await createStageDir(this, packager, arch)\n const vm = this.vm\n\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n\n // wix 4.0.0.5512.2 doesn't support the arm64 architecture so default to x64 when building for arm64.\n // This will result in an x64 MSI installer that installs an arm64 version of the application. This is a\n // stopgap until the electron-builder-binaries wix version is upgraded to a version that supports arm64:\n // https://github.com/electron-userland/electron-builder/issues/6077\n const wixArch = arch == Arch.arm64 ? Arch.x64 : arch\n\n const projectFile = stageDir.getTempFile(\"project.wxs\")\n const objectFiles = [\"project.wixobj\"]\n await writeFile(projectFile, await this.writeManifest(appOutDir, wixArch, commonOptions))\n\n await packager.info.emitMsiProjectCreated(projectFile)\n\n // noinspection SpellCheckingInspection\n const vendorPath = await getBinFromUrl(\"wix-4.0.0.5512.2\", \"wix-4.0.0.5512.2.7z\", \"fe677fcd837b18c9b912985d91636bbd8a1e800c3b3a6a841b6f96e89624e839\")\n\n // noinspection SpellCheckingInspection\n const candleArgs = [\"-arch\", wixArch === Arch.ia32 ? \"x86\" : \"x64\", `-dappDir=${vm.toVmFile(appOutDir)}`].concat(this.getCommonWixArgs())\n candleArgs.push(\"project.wxs\")\n await withToolsetLock(async () => {\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"candle.exe\")), candleArgs, {\n cwd: stageDir.dir,\n })\n await this.light(objectFiles, vm, artifactPath, appOutDir, vendorPath, stageDir.dir)\n })\n\n await stageDir.cleanup()\n\n await packager.signIf(artifactPath)\n\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n packager,\n arch,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"msi\"),\n target: this,\n isWriteUpdateInfo: false,\n })\n }\n\n private async light(objectFiles: Array<string>, vm: VmManager, artifactPath: string, appOutDir: string, vendorPath: string, tempDir: string) {\n // noinspection SpellCheckingInspection\n const lightArgs = [\n \"-out\",\n vm.toVmFile(artifactPath),\n \"-v\",\n // https://github.com/wixtoolset/issues/issues/5169\n \"-spdb\",\n // https://sourceforge.net/p/wix/bugs/2405/\n // error LGHT1076 : ICE61: This product should remove only older versions of itself. The Maximum version is not less than the current product. (1.1.0.42 1.1.0.42)\n \"-sw1076\",\n `-dappDir=${vm.toVmFile(appOutDir)}`,\n // \"-dcl:high\",\n ]\n .concat(this.getCommonWixArgs())\n .concat(this.getAdditionalLightArgs())\n\n // http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Build-3-5-2229-0-give-me-the-following-error-error-LGHT0216-An-unexpected-Win32-exception-with-errorn-td5707443.html\n if (process.platform !== \"win32\") {\n // noinspection SpellCheckingInspection\n lightArgs.push(\"-sval\")\n }\n\n if (this.options.oneClick === false) {\n lightArgs.push(\"-ext\", \"WixUIExtension\")\n }\n\n // objectFiles - only filenames, we set current directory to our temp stage dir\n lightArgs.push(...objectFiles)\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"light.exe\")), lightArgs, {\n cwd: tempDir,\n })\n }\n\n private getAdditionalLightArgs() {\n const args: Array<string> = []\n if (this.options.additionalLightArgs != null) {\n args.push(...this.options.additionalLightArgs)\n }\n return args\n }\n\n private getCommonWixArgs() {\n const args: Array<string> = [\"-pedantic\"]\n if (this.options.warningsAsErrors !== false) {\n args.push(\"-wx\")\n }\n if (this.options.additionalWixArgs != null) {\n args.push(...this.options.additionalWixArgs)\n }\n return args\n }\n\n protected async writeManifest(appOutDir: string, wixArch: Arch, commonOptions: FinalCommonWindowsInstallerOptions) {\n const appInfo = this.packager.appInfo\n const { files, dirs } = await this.computeFileDeclaration(appOutDir)\n const options = this.options\n\n return (await this.projectTemplate.value)({\n ...(await this.getBaseOptions(commonOptions)),\n isCreateDesktopShortcut: commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER,\n isRunAfterFinish: options.runAfterFinish !== false,\n // https://stackoverflow.com/questions/1929038/compilation-error-ice80-the-64bitcomponent-uses-32bitdirectory\n programFilesId: wixArch === Arch.x64 ? \"ProgramFiles64Folder\" : \"ProgramFilesFolder\",\n // wix in the name because special wix format can be used in the name\n installationDirectoryWixName: getWindowsInstallationDirName(appInfo, commonOptions.isAssisted || commonOptions.isPerMachine === true),\n dirs,\n files,\n })\n }\n\n protected async getBaseOptions(commonOptions: FinalCommonWindowsInstallerOptions): Promise<any> {\n const appInfo = this.packager.appInfo\n const iconPath = await this.packager.getIconPath()\n const compression = this.packager.compression\n\n const companyName = appInfo.companyName\n if (!companyName) {\n log.warn(`Manufacturer is not set for MSI — please set \"author\" in the package.json`)\n }\n\n return {\n ...commonOptions,\n iconPath: iconPath == null ? null : this.vm.toVmFile(iconPath),\n iconId: this.iconId,\n compressionLevel: compression === \"store\" ? \"none\" : \"high\",\n version: appInfo.getVersionInWeirdWindowsForm(),\n productName: appInfo.productName,\n upgradeCode: this.upgradeCode,\n manufacturer: companyName || appInfo.productName,\n appDescription: appInfo.description,\n }\n }\n\n private async computeFileDeclaration(appOutDir: string) {\n const appInfo = this.packager.appInfo\n let isRootDirAddedToRemoveTable = false\n const dirNames = new Set<string>()\n const dirs: Array<string> = []\n const fileSpace = \" \".repeat(6)\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n const files = (await walk(appOutDir)).map(file => {\n const packagePath = file.substring(appOutDir.length + 1)\n\n const lastSlash = packagePath.lastIndexOf(path.sep)\n const fileName = lastSlash > 0 ? packagePath.substring(lastSlash + 1) : packagePath\n let directoryId: string | null = null\n let dirName = \"\"\n // Wix Directory.FileSource doesn't work - https://stackoverflow.com/questions/21519388/wix-filesource-confusion\n if (lastSlash > 0) {\n // This Name attribute may also define multiple directories using the inline directory syntax.\n // For example, \"ProgramFilesFolder:\\My Company\\My Product\\bin\" would create a reference to a Directory element with Id=\"ProgramFilesFolder\" then create directories named \"My Company\" then \"My Product\" then \"bin\" nested beneath each other.\n // This syntax is a shortcut to defining each directory in an individual Directory element.\n dirName = packagePath.substring(0, lastSlash)\n // https://github.com/electron-userland/electron-builder/issues/3027\n directoryId = \"d\" + createHash(\"md5\").update(dirName).digest(\"base64\").replace(/\\//g, \"_\").replace(/\\+/g, \".\").replace(/=+$/, \"\")\n if (!dirNames.has(dirName)) {\n dirNames.add(dirName)\n dirs.push(`<Directory Id=\"${directoryId}\" Name=\"${ROOT_DIR_ID}:\\\\${dirName.replace(/\\//g, \"\\\\\")}\\\\\"/>`)\n }\n } else if (!isRootDirAddedToRemoveTable) {\n isRootDirAddedToRemoveTable = true\n }\n\n // since RegistryValue can be part of Component, *** *** *** *** *** *** *** *** *** wix cannot auto generate guid\n // https://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix\n let result = `<Component${directoryId === null ? \"\" : ` Directory=\"${directoryId}\"`}>`\n result += `\\n${fileSpace} <File Name=\"${xmlAttr(fileName)}\" Source=\"$(var.appDir)${path.sep}${xmlAttr(packagePath)}\" ReadOnly=\"yes\" KeyPath=\"yes\"`\n const isMainExecutable = packagePath === `${appInfo.productFilename}.exe`\n if (isMainExecutable) {\n result += ' Id=\"mainExecutable\"'\n } else if (directoryId === null) {\n result += ` Id=\"${path.basename(packagePath)}_f\"`\n }\n\n const isCreateDesktopShortcut = commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER\n if (isMainExecutable && (isCreateDesktopShortcut || commonOptions.isCreateStartMenuShortcut)) {\n result += `>\\n`\n const shortcutName = commonOptions.shortcutName\n if (isCreateDesktopShortcut) {\n result += `${fileSpace} <Shortcut Id=\"desktopShortcut\" Directory=\"DesktopFolder\" Name=\"${xmlAttr(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\" Icon=\"${this.iconId}\"/>\\n`\n }\n\n const hasMenuCategory = commonOptions.menuCategory != null\n const startMenuShortcutDirectoryId = hasMenuCategory ? \"AppProgramMenuDir\" : \"ProgramMenuFolder\"\n if (commonOptions.isCreateStartMenuShortcut) {\n if (hasMenuCategory) {\n dirs.push(`<Directory Id=\"${startMenuShortcutDirectoryId}\" Name=\"ProgramMenuFolder:\\\\${commonOptions.menuCategory}\\\\\"/>`)\n }\n result += `${fileSpace} <Shortcut Id=\"startMenuShortcut\" Directory=\"${startMenuShortcutDirectoryId}\" Name=\"${xmlAttr(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\" Icon=\"${this.iconId}\">\\n`\n result += `${fileSpace} <ShortcutProperty Key=\"System.AppUserModel.ID\" Value=\"${xmlAttr(this.packager.appInfo.id)}\"/>\\n`\n result += `${fileSpace} </Shortcut>\\n`\n }\n result += `${fileSpace}</File>`\n\n if (hasMenuCategory) {\n result += `<RemoveFolder Id=\"${startMenuShortcutDirectoryId}\" Directory=\"${startMenuShortcutDirectoryId}\" On=\"uninstall\"/>\\n`\n }\n } else {\n result += `/>`\n }\n\n const fileAssociations = this.packager.fileAssociations\n if (isMainExecutable && fileAssociations.length !== 0) {\n for (const item of fileAssociations) {\n const extensions = asArray(item.ext).map(normalizeExt)\n for (const ext of extensions) {\n result += `${fileSpace} <ProgId Id=\"${this.productMsiIdPrefix}.${ext}\" Advertise=\"yes\" Icon=\"${this.iconId}\" ${\n item.description ? `Description=\"${item.description}\"` : \"\"\n }>\\n`\n result += `${fileSpace} <Extension Id=\"${ext}\" Advertise=\"yes\">\\n`\n result += `${fileSpace} <Verb Id=\"open\" Command=\"Open with ${xmlAttr(this.packager.appInfo.productName)}\" Argument=\"&quot;%1&quot;\"/>\\n`\n result += `${fileSpace} </Extension>\\n`\n result += `${fileSpace} </ProgId>\\n`\n }\n }\n }\n\n return `${result}\\n${fileSpace}</Component>`\n })\n\n return { dirs: listToString(dirs, 2), files: listToString(files, 3) }\n }\n}\n\nfunction listToString(list: Array<string>, indentLevel: number) {\n const space = \" \".repeat(indentLevel * 2)\n return list.join(`\\n${space}`)\n}\n\nfunction xmlAttr(str: string) {\n return str.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\").replace(/\"/g, \"&quot;\").replace(/'/g, \"&apos;\")\n}\n"]}
@@ -55,7 +55,10 @@ class AppImageTarget extends core_1.Target {
55
55
  if (publishConfig != null) {
56
56
  await (0, fs_extra_1.outputFile)(path.join(packager.getResourcesDir(appOutDir), "app-update.yml"), (0, builder_util_1.serializeToYaml)(publishConfig));
57
57
  }
58
- if (this.packager.packagerOptions.effectiveOptionComputed != null && (await this.packager.packagerOptions.effectiveOptionComputed({ desktop: desktopEntry }))) {
58
+ // Validated once here; throws InvalidConfigurationError for path traversal / NUL.
59
+ const desktopBaseName = this.helper.getDesktopFileName();
60
+ if (this.packager.packagerOptions.effectiveOptionComputed != null &&
61
+ (await this.packager.packagerOptions.effectiveOptionComputed({ desktop: desktopEntry, desktopFileName: `${desktopBaseName}.desktop` }))) {
59
62
  await stageDir.cleanup();
60
63
  return;
61
64
  }
@@ -76,6 +79,7 @@ class AppImageTarget extends core_1.Target {
76
79
  desktopEntry,
77
80
  icons,
78
81
  fileAssociations: packager.fileAssociations,
82
+ desktopBaseName,
79
83
  compression: (() => {
80
84
  const c = options.compression;
81
85
  if (c === "xz" || c === "gzip") {
@@ -103,6 +107,7 @@ class AppImageTarget extends core_1.Target {
103
107
  desktopEntry,
104
108
  icons,
105
109
  fileAssociations: packager.fileAssociations,
110
+ desktopBaseName,
106
111
  compression: (() => {
107
112
  const c = options.compression;
108
113
  if (c === "gzip" || c === "zstd") {
@@ -1 +1 @@
1
- {"version":3,"file":"AppImageTarget.js","sourceRoot":"","sources":["../../../src/targets/appimage/AppImageTarget.ts"],"names":[],"mappings":";;;AAAA,+CAAyD;AACzD,uCAAqC;AACrC,uCAA+B;AAC/B,6BAA4B;AAC5B,qCAAmC;AAGnC,iEAA+E;AAC/E,gDAA+D;AAE/D,8CAA8C;AAC9C,iDAAqF;AACrF,+DAAqE;AAErE,+FAA+F;AAElF,QAAA,kBAAkB,GAAG,QAAQ,CAAA;AAE1C,MAAqB,cAAe,SAAQ,aAAM;IAKhD,YACE,QAAgB,EACC,QAAuB,EACvB,MAAyB,EACjC,MAAc;QAEvB,KAAK,CAAC,UAAU,CAAC,CAAA;QAJA,aAAQ,GAAR,QAAQ,CAAe;QACvB,WAAM,GAAN,MAAM,CAAmB;QACjC,WAAM,GAAN,MAAM,CAAQ;QARhB,YAAO,GAAoB,IAAA,iCAAU,EAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAG,IAAI,CAAC,QAAQ,CAAC,MAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QAYtI,IAAI,CAAC,YAAY,GAAG,IAAI,eAAI,CAAS,GAAG,EAAE;;YACxC,MAAM,YAAY,GAAG,MAAA,QAAQ,CAAC,MAAM,CAAC,QAAQ,0CAAE,QAAQ,CAAA;YACvD,MAAM,WAAW,GAAG,YAAY,IAAI,IAAI,IAAI,YAAY,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;YAC5F,MAAM,IAAI,GAAG,MAAA,IAAI,C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,EAAE,CAAC;YACpB,kBAAG,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,0BAA0B,CAAC,CAAA;YAC/D,MAAM,KAAK,CAAA;QACb,CAAC;gBAAS,CAAC;YACT,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QAC1C,CAAC;QAED,MAAM,QAAQ,CAAC,IAAI,CAAC,0BAA0B,CAAC;YAC7C,IAAI,EAAE,YAAY;YAClB,gBAAgB,EAAE,QAAQ,CAAC,uBAAuB,CAAC,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC;YACzF,MAAM,EAAE,IAAI;YACZ,IAAI;YACJ,QAAQ;YACR,iBAAiB,EAAE,IAAI;YACvB,UAAU;SACX,CAAC,CAAA;IACJ,CAAC;CACF;AArID,iCAqIC","sourcesContent":["import { Arch, log, serializeToYaml } from \"builder-util\"\nimport { outputFile } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { Target } from \"../../core\"\nimport { LinuxPackager } from \"../../linuxPackager\"\nimport { AppImageOptions } from \"../../options/linuxOptions\"\nimport { getAppUpdatePublishConfiguration } from \"../../publish/PublishManager\"\nimport { getNotLocalizedLicenseFile } from \"../../util/license\"\nimport { LinuxTargetHelper } from \"../LinuxTargetHelper\"\nimport { createStageDir } from \"../targetUtil\"\nimport { buildLegacyFuse2AppImage, buildStaticRuntimeAppImage } from \"./appImageUtil\"\nimport { BlockMapDataHolder, deepAssign } from \"builder-util-runtime\"\n\n// https://unix.stackexchange.com/questions/375191/append-to-sub-directory-inside-squashfs-file\n\nexport const APP_RUN_ENTRYPOINT = \"AppRun\"\n\nexport default class AppImageTarget extends Target {\n readonly options: AppImageOptions = deepAssign({}, this.packager.platformSpecificBuildOptions, (this.packager.config as any)[this.name])\n\n private readonly desktopEntry: Lazy<string>\n\n constructor(\n _ignored: string,\n private readonly packager: LinuxPackager,\n private readonly helper: LinuxTargetHelper,\n readonly outDir: string\n ) {\n super(\"appImage\")\n\n this.desktopEntry = new Lazy<string>(() => {\n const appimageTool = packager.config.toolsets?.appimage\n const defaultArgs = appimageTool == null || appimageTool === \"0.0.0\" ? [\"--no-sandbox\"] : []\n const args = this.options.executableArgs ?? defaultArgs\n const exec = [APP_RUN_ENTRYPOINT, ...args, \"%U\"].join(\" \")\n return helper.computeDesktopEntry(this.options, exec, {\n \"X-AppImage-Version\": `${packager.appInfo.buildVersion}`,\n })\n })\n }\n\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const packager = this.packager\n\n const options = this.options\n // https://github.com/electron-userland/electron-builder/issues/775\n // https://github.com/electron-userland/electron-builder/issues/1726\n const artifactName = packager.expandArtifactNamePattern(options, \"AppImage\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"AppImage\",\n file: artifactPath,\n arch,\n })\n\n // Parallelize independent async operations\n const [publishConfig, stageDir, desktopEntry, icons, license] = await Promise.all([\n getAppUpdatePublishConfiguration(packager, options, arch, false),\n createStageDir(this, packager, arch),\n this.desktopEntry.value,\n this.helper.icons,\n getNotLocalizedLicenseFile(options.license, this.packager, [\"txt\", \"html\"]),\n ])\n\n if (publishConfig != null) {\n await outputFile(path.join(packager.getResourcesDir(appOutDir), \"app-update.yml\"), serializeToYaml(publishConfig))\n }\n\n if (this.packager.packagerOptions.effectiveOptionComputed != null && (await this.packager.packagerOptions.effectiveOptionComputed({ desktop: desktopEntry }))) {\n await stageDir.cleanup()\n return\n }\n\n let updateInfo: BlockMapDataHolder\n try {\n const appimageTool = this.packager.config.toolsets?.appimage\n if (appimageTool == null || appimageTool === \"0.0.0\") {\n updateInfo = await buildLegacyFuse2AppImage({\n appDir: appOutDir,\n stageDir: stageDir.dir,\n arch,\n output: artifactPath,\n options: {\n productName: packager.appInfo.productName,\n productFilename: packager.appInfo.productFilename,\n executableName: packager.executableName,\n license,\n desktopEntry,\n icons,\n fileAssociations: packager.fileAssociations,\n compression: (() => {\n const c = options.compression\n if (c === \"xz\" || c === \"gzip\") {\n return c\n }\n if (packager.compression === \"maximum\") {\n return \"xz\"\n }\n return undefined // normal/store/unset/zstd → mksquashfs defaults to gzip\n })(),\n },\n })\n } else {\n updateInfo = await buildStaticRuntimeAppImage(appimageTool, {\n appDir: appOutDir,\n stageDir: stageDir.dir,\n arch,\n output: artifactPath,\n options: {\n productName: packager.appInfo.productName,\n productFilename: packager.appInfo.productFilename,\n executableName: packager.executableName,\n license,\n desktopEntry,\n icons,\n fileAssociations: packager.fileAssociations,\n compression: (() => {\n const c = options.compression\n if (c === \"gzip\" || c === \"zstd\") {\n return c\n }\n if (c === \"xz\") {\n return \"zstd\" // nearest equivalent; static runtime does not support xz\n }\n if (packager.compression === \"store\") {\n return \"gzip\"\n }\n return \"zstd\" // maximum/normal/unset → zstd for static runtime\n })(),\n },\n })\n }\n } catch (error: any) {\n log.error({ error: error.message }, \"failed to build AppImage\")\n throw error\n } finally {\n await stageDir.cleanup().catch(() => {})\n }\n\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"AppImage\", arch, false),\n target: this,\n arch,\n packager,\n isWriteUpdateInfo: true,\n updateInfo,\n })\n }\n}\n"]}
1
+ {"version":3,"file":"AppImageTarget.js","sourceRoot":"","sources":["../../../src/targets/appimage/AppImageTarget.ts"],"names":[],"mappings":";;;AAAA,+CAAyD;AACzD,uCAAqC;AACrC,uCAA+B;AAC/B,6BAA4B;AAC5B,qCAAmC;AAGnC,iEAA+E;AAC/E,gDAA+D;AAE/D,8CAA8C;AAC9C,iDAAqF;AACrF,+DAAqE;AAErE,+FAA+F;AAElF,QAAA,kBAAkB,GAAG,QAAQ,CAAA;AAE1C,MAAqB,cAAe,SAAQ,aAAM;IAKhD,YACE,QAAgB,EACC,QAAuB,EACvB,MAAyB,EACjC,MAAc;QAEv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Q;YACR,iBAAiB,EAAE,IAAI;YACvB,UAAU;SACX,CAAC,CAAA;IACJ,CAAC;CACF;AA7ID,iCA6IC","sourcesContent":["import { Arch, log, serializeToYaml } from \"builder-util\"\nimport { outputFile } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { Target } from \"../../core\"\nimport { LinuxPackager } from \"../../linuxPackager\"\nimport { AppImageOptions } from \"../../options/linuxOptions\"\nimport { getAppUpdatePublishConfiguration } from \"../../publish/PublishManager\"\nimport { getNotLocalizedLicenseFile } from \"../../util/license\"\nimport { LinuxTargetHelper } from \"../LinuxTargetHelper\"\nimport { createStageDir } from \"../targetUtil\"\nimport { buildLegacyFuse2AppImage, buildStaticRuntimeAppImage } from \"./appImageUtil\"\nimport { BlockMapDataHolder, deepAssign } from \"builder-util-runtime\"\n\n// https://unix.stackexchange.com/questions/375191/append-to-sub-directory-inside-squashfs-file\n\nexport const APP_RUN_ENTRYPOINT = \"AppRun\"\n\nexport default class AppImageTarget extends Target {\n readonly options: AppImageOptions = deepAssign({}, this.packager.platformSpecificBuildOptions, (this.packager.config as any)[this.name])\n\n private readonly desktopEntry: Lazy<string>\n\n constructor(\n _ignored: string,\n private readonly packager: LinuxPackager,\n private readonly helper: LinuxTargetHelper,\n readonly outDir: string\n ) {\n super(\"appImage\")\n\n this.desktopEntry = new Lazy<string>(() => {\n const appimageTool = packager.config.toolsets?.appimage\n const defaultArgs = appimageTool == null || appimageTool === \"0.0.0\" ? [\"--no-sandbox\"] : []\n const args = this.options.executableArgs ?? defaultArgs\n const exec = [APP_RUN_ENTRYPOINT, ...args, \"%U\"].join(\" \")\n return helper.computeDesktopEntry(this.options, exec, {\n \"X-AppImage-Version\": `${packager.appInfo.buildVersion}`,\n })\n })\n }\n\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const packager = this.packager\n\n const options = this.options\n // https://github.com/electron-userland/electron-builder/issues/775\n // https://github.com/electron-userland/electron-builder/issues/1726\n const artifactName = packager.expandArtifactNamePattern(options, \"AppImage\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"AppImage\",\n file: artifactPath,\n arch,\n })\n\n // Parallelize independent async operations\n const [publishConfig, stageDir, desktopEntry, icons, license] = await Promise.all([\n getAppUpdatePublishConfiguration(packager, options, arch, false),\n createStageDir(this, packager, arch),\n this.desktopEntry.value,\n this.helper.icons,\n getNotLocalizedLicenseFile(options.license, this.packager, [\"txt\", \"html\"]),\n ])\n\n if (publishConfig != null) {\n await outputFile(path.join(packager.getResourcesDir(appOutDir), \"app-update.yml\"), serializeToYaml(publishConfig))\n }\n\n // Validated once here; throws InvalidConfigurationError for path traversal / NUL.\n const desktopBaseName = this.helper.getDesktopFileName()\n\n if (\n this.packager.packagerOptions.effectiveOptionComputed != null &&\n (await this.packager.packagerOptions.effectiveOptionComputed({ desktop: desktopEntry, desktopFileName: `${desktopBaseName}.desktop` }))\n ) {\n await stageDir.cleanup()\n return\n }\n\n let updateInfo: BlockMapDataHolder\n try {\n const appimageTool = this.packager.config.toolsets?.appimage\n if (appimageTool == null || appimageTool === \"0.0.0\") {\n updateInfo = await buildLegacyFuse2AppImage({\n appDir: appOutDir,\n stageDir: stageDir.dir,\n arch,\n output: artifactPath,\n options: {\n productName: packager.appInfo.productName,\n productFilename: packager.appInfo.productFilename,\n executableName: packager.executableName,\n license,\n desktopEntry,\n icons,\n fileAssociations: packager.fileAssociations,\n desktopBaseName,\n compression: (() => {\n const c = options.compression\n if (c === \"xz\" || c === \"gzip\") {\n return c\n }\n if (packager.compression === \"maximum\") {\n return \"xz\"\n }\n return undefined // normal/store/unset/zstd → mksquashfs defaults to gzip\n })(),\n },\n })\n } else {\n updateInfo = await buildStaticRuntimeAppImage(appimageTool, {\n appDir: appOutDir,\n stageDir: stageDir.dir,\n arch,\n output: artifactPath,\n options: {\n productName: packager.appInfo.productName,\n productFilename: packager.appInfo.productFilename,\n executableName: packager.executableName,\n license,\n desktopEntry,\n icons,\n fileAssociations: packager.fileAssociations,\n desktopBaseName,\n compression: (() => {\n const c = options.compression\n if (c === \"gzip\" || c === \"zstd\") {\n return c\n }\n if (c === \"xz\") {\n return \"zstd\" // nearest equivalent; static runtime does not support xz\n }\n if (packager.compression === \"store\") {\n return \"gzip\"\n }\n return \"zstd\" // maximum/normal/unset → zstd for static runtime\n })(),\n },\n })\n }\n } catch (error: any) {\n log.error({ error: error.message }, \"failed to build AppImage\")\n throw error\n } finally {\n await stageDir.cleanup().catch(() => {})\n }\n\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"AppImage\", arch, false),\n target: this,\n arch,\n packager,\n isWriteUpdateInfo: true,\n updateInfo,\n })\n }\n}\n"]}
@@ -21,6 +21,8 @@ interface Options {
21
21
  *
22
22
  */
23
23
  compression?: "gzip" | "zstd" | "xz";
24
+ /** Pre-computed desktop basename (already validated). When absent, falls back to `executableName`. */
25
+ desktopBaseName?: string;
24
26
  }
25
27
  export interface AppImageBuilderOptions {
26
28
  appDir: string;
@@ -114,14 +114,14 @@ function validateCriticalPathString(str, fieldName) {
114
114
  }
115
115
  }
116
116
  async function writeAppLauncherAndRelatedFiles(opts) {
117
- const { stageDir, options: { license, executableName, productFilename, productName, desktopEntry }, } = opts;
117
+ const { stageDir, options: { license, executableName, productFilename, productName, desktopEntry, desktopBaseName }, } = opts;
118
118
  // executableName and productFilename are embedded directly into double-quoted bash strings
119
119
  // and used as filesystem paths, so they must pass the whitelist.
120
120
  // productName is not validated here because it is only ever passed through escapeShellString().
121
121
  validateCriticalPathString(executableName, "executableName");
122
122
  validateCriticalPathString(productFilename, "productFilename");
123
123
  // Write desktop file
124
- const desktopFileName = `${executableName}.desktop`;
124
+ const desktopFileName = `${desktopBaseName !== null && desktopBaseName !== void 0 ? desktopBaseName : executableName}.desktop`;
125
125
  await fs.writeFile(path.join(stageDir, desktopFileName), desktopEntry, { mode: 0o644 });
126
126
  await (0, appLauncher_1.copyIcons)(opts);
127
127
  const templateConfig = {
@@ -1 +1 @@
1
- {"version":3,"file":"appImageUtil.js","sourceRoot":"","sources":["../../../src/targets/appimage/appImageUtil.ts"],"names":[],"mappings":";;AAwCA,gEAyCC;AAED,4DAqCC;AAiCD,gEAMC;AAqFD,oDA+JC;AAnZD,+CAAoG;AACpG,+BAA8B;AAC9B,6BAA4B;AAE5B,gDAAuD;AACvD,+CAAwD;AACxD,oFAAiE;AAEjE,qDAAqD;AAgC9C,KAAK,UAAU,0BAA0B,CAAC,mBAA8C,EAAE,IAA4B;IAC3H,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IAExD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAEvB,0CAA0C;QAC1C,MAAM,+BAA+B,CAAC,IAAI,CAAC,CAAA;QAE3C,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,IAAA,wBAAgB,EAAC,mBAAmB,EAAE,IAAI,CAAC,CAAA;QAC9G,MAAM,IAAA,sBAAO,EAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;QAE3D,8BAA8B;QAC9B,oEAAoE;QACpE,MAAM,IAAA,sBAAO,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QAE/B,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAE9C,0CAA0C;QAC1C,MAAM,IAAI,GAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,CAAC,CAAA;QACtK,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W,CAAC,uBAAuB,MAAM,CAAC,QAAQ;;;;;sDAKhE,MAAM,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;;GAoBlE;QACC,CAAC,CAAC,EACN;CACC,CAAA;AACD,CAAC","sourcesContent":["import { Arch, copyDir, copyFile, exec, exists, InvalidConfigurationError, log } from \"builder-util\"\nimport * as fs from \"fs-extra\"\nimport * as path from \"path\"\nimport { FileAssociation } from \"../../options/FileAssociation\"\nimport { getAppImageTools } from \"../../toolsets/linux\"\nimport { copyIcons, copyMimeTypes } from \"./appLauncher\"\nimport { appendBlockmap } from \"../differentialUpdateInfoBuilder\"\nimport { BlockMapDataHolder } from \"builder-util-runtime\"\nimport { APP_RUN_ENTRYPOINT } from \"./AppImageTarget\"\nimport { ToolsetConfig } from \"../../configuration\"\nimport { IconInfo } from \"../../util/iconConverter\"\n\ninterface Options {\n productName: string\n productFilename: string\n executableName: string\n desktopEntry: string\n icons: IconInfo[]\n license?: string | null\n fileAssociations: FileAssociation[]\n /**\n * The compression type available for static runtime is limited as it's only compiled with support for gzip and zstd.\n * \"xz\" is only valid for the legacy FUSE2 (0.0.0) toolset.\n *\n * [stderr] Squashfs image uses lzo compression, this version supports only zlib, zstd.\n * Failed to open squashfs image\n * Failed to extract AppImage\n *\n */\n compression?: \"gzip\" | \"zstd\" | \"xz\"\n}\n\nexport interface AppImageBuilderOptions {\n appDir: string\n stageDir: string\n arch: Arch\n output: string\n options: Options\n}\n\nexport async function buildStaticRuntimeAppImage(appimageToolVersion: ToolsetConfig[\"appimage\"], opts: AppImageBuilderOptions): Promise<BlockMapDataHolder> {\n const { stageDir, output, appDir, options, arch } = opts\n\n try {\n await fs.remove(output)\n\n // Write AppRun launcher and related files\n await writeAppLauncherAndRelatedFiles(opts)\n\n const { runtimeLibraries: libraries, runtime, mksquashfs } = await getAppImageTools(appimageToolVersion, arch)\n await copyDir(libraries, path.join(stageDir, \"usr\", \"lib\"))\n\n // Copy app directory to stage\n // mksquashfs doesn't support merging, so we copy the entire app dir\n await copyDir(appDir, stageDir)\n\n const runtimeData = await fs.readFile(runtime)\n\n // Create squashfs with offset for runtime\n const args: string[] = [stageDir, output, \"-offset\", runtimeData.length.toString(), \"-all-root\", \"-noappend\", \"-no-progress\", \"-quiet\", \"-no-xattrs\", \"-no-fragments\"]\n if (options.compression) {\n args.push(\"-comp\", options.compression)\n }\n await exec(mksquashfs, args, {\n cwd: stageDir,\n })\n\n // Write runtime data at the beginning of the file\n await writeRuntimeData(output, runtimeData)\n\n // Make executable\n await fs.chmod(output, 0o755)\n\n // Append blockmap inside try block to ensure cleanup on failure\n const updateInfo = await appendBlockmap(output)\n return updateInfo\n } catch (error) {\n // Clean up partial build on failure\n await fs.remove(output).catch(() => {})\n throw error\n }\n}\n\nexport async function buildLegacyFuse2AppImage(opts: AppImageBuilderOptions): Promise<BlockMapDataHolder> {\n const { stageDir, output, appDir, options, arch } = opts\n\n try {\n await fs.remove(output)\n\n await writeAppLauncherAndRelatedFiles(opts)\n\n const { runtime, mksquashfs, runtimeLibraries } = await getAppImageTools(\"0.0.0\", arch)\n // Mirror the app-builder-lib Go implementation: bundle lib/<arch> into usr/lib for x64 and ia32.\n // arm targets don't have a dedicated lib dir in the FUSE2 toolset.\n if (arch === Arch.x64 || arch === Arch.ia32) {\n await copyDir(runtimeLibraries, path.join(stageDir, \"usr\", \"lib\"))\n }\n await copyDir(appDir, stageDir)\n\n const runtimeData = await fs.readFile(runtime)\n\n const args: string[] = [stageDir, output, \"-offset\", runtimeData.length.toString(), \"-all-root\", \"-noappend\", \"-no-progress\", \"-quiet\", \"-no-xattrs\", \"-no-fragments\"]\n if (options.compression) {\n args.push(\"-comp\", options.compression)\n if (options.compression === \"xz\") {\n // Match the dictionary/block-size settings used by the original app-builder Go implementation\n args.push(\"-Xdict-size\", \"100%\", \"-b\", \"1048576\")\n }\n }\n await exec(mksquashfs, args, { cwd: stageDir })\n\n await writeRuntimeData(output, runtimeData)\n await fs.chmod(output, 0o755)\n\n const updateInfo = await appendBlockmap(output)\n return updateInfo\n } catch (error) {\n await fs.remove(output).catch(() => {})\n throw error\n }\n}\n\nasync function writeRuntimeData(filePath: string, runtimeData: Buffer): Promise<void> {\n const fd = await fs.open(filePath, \"r+\")\n try {\n await fs.write(fd, runtimeData, 0, runtimeData.length, 0)\n } finally {\n try {\n await fs.close(fd)\n } catch (closeError: any) {\n // Log but don't throw - preserve original error if any\n log.warn({ message: closeError.message, file: filePath }, `failed to close file descriptor`)\n }\n }\n}\n\n/**\n * Escapes a string for safe use in shell scripts by wrapping in single quotes\n * and escaping any single quotes within the string.\n *\n * This allows strings with spaces, special characters, etc. to be safely used.\n */\nfunction escapeShellString(str: string): string {\n // Escape single quotes by replacing ' with '\\''\n // Then wrap the whole string in single quotes\n return `'${str.replace(/'/g, \"'\\\\''\")}'`\n}\n\n/**\n * Validates that critical path fields (executable name, product filename, license filename)\n * contain only characters that are safe for use in filesystem paths and embedded bash strings.\n * Allowed: Unicode letters, digits, dots, underscores, hyphens, and spaces.\n */\nexport function validateCriticalPathString(str: string, fieldName: string): void {\n if (!/^[\\p{L}\\p{N}._\\- ]+$/u.test(str)) {\n throw new InvalidConfigurationError(\n `${fieldName} contains characters that cannot be safely used in file paths: ${str}. Please use only letters, digits, hyphens, underscores, dots, and spaces.`\n )\n }\n}\n\nasync function writeAppLauncherAndRelatedFiles(opts: AppImageBuilderOptions): Promise<void> {\n const {\n stageDir,\n options: { license, executableName, productFilename, productName, desktopEntry },\n } = opts\n\n // executableName and productFilename are embedded directly into double-quoted bash strings\n // and used as filesystem paths, so they must pass the whitelist.\n // productName is not validated here because it is only ever passed through escapeShellString().\n validateCriticalPathString(executableName, \"executableName\")\n validateCriticalPathString(productFilename, \"productFilename\")\n\n // Write desktop file\n const desktopFileName = `${executableName}.desktop`\n await fs.writeFile(path.join(stageDir, desktopFileName), desktopEntry, { mode: 0o644 })\n await copyIcons(opts)\n\n const templateConfig: AppRunScriptBase = {\n DesktopFileName: desktopFileName,\n ExecutableName: executableName,\n ProductName: productName,\n ProductFilename: productFilename,\n ResourceName: `appimagekit-${executableName}`,\n }\n\n const mimeTypeFile = await copyMimeTypes(stageDir, opts.options)\n if (mimeTypeFile) {\n templateConfig.MimeTypeFile = mimeTypeFile\n }\n\n let finalConfig: AppRunScript = templateConfig\n\n // Copy license file if provided\n if (license) {\n // Validate license file exists\n if (!(await exists(license))) {\n throw new InvalidConfigurationError(`License file not found: ${license}`)\n }\n\n const licenseBaseName = path.basename(license)\n const ext = path.extname(license).toLowerCase()\n\n // Validate license filename for path safety\n validateCriticalPathString(licenseBaseName, \"licenseBaseName\")\n\n // Validate extension\n if (![\".txt\", \".html\"].includes(ext)) {\n log.warn({ license, expected: \".txt or .html\" }, `license file has unexpected extension`)\n }\n\n await copyFile(license, path.join(stageDir, licenseBaseName))\n\n finalConfig = {\n ...templateConfig,\n EulaFile: licenseBaseName,\n IsHtmlEula: ext === \".html\",\n }\n }\n\n const appRunContent = generateAppRunScript(finalConfig)\n await fs.writeFile(path.join(stageDir, APP_RUN_ENTRYPOINT), appRunContent, { mode: 0o755 })\n}\n\nexport type AppRunScriptBase = {\n ExecutableName: string\n DesktopFileName: string\n ProductFilename: string\n ProductName: string\n ResourceName: string\n MimeTypeFile?: string\n}\n\nexport type AppRunScriptWithEula = AppRunScriptBase & {\n EulaFile: string\n IsHtmlEula: boolean\n}\n\nexport type AppRunScript = AppRunScriptBase | AppRunScriptWithEula\n\nfunction hasEula(config: AppRunScript): config is AppRunScriptWithEula {\n return \"EulaFile\" in config && typeof config.EulaFile === \"string\"\n}\n\nexport function generateAppRunScript(config: AppRunScript): string {\n const eulaEnabled = hasEula(config)\n\n return `#!/usr/bin/env bash\nset -e\n\nTHIS=\"$0\"\n# http://stackoverflow.com/questions/3190818/\nargs=(\"$@\")\nNUMBER_OF_ARGS=\"$#\"\n\nif [ -z \"$APPDIR\" ] ; then\n # Find the AppDir. It is the directory that contains AppRun.\n # This assumes that this script resides inside the AppDir or a subdirectory.\n # If this script is run inside an AppImage, then the AppImage runtime likely has already set $APPDIR\n path=\"$(dirname \"$(readlink -f \"\\${THIS}\")\")\"\n while [[ \"$path\" != \"\" && ! -e \"$path/${APP_RUN_ENTRYPOINT}\" ]]; do\n path=\\${path%/*}\n done\n APPDIR=\"$path\"\nfi\n\nif [ -z \"$APPDIR\" ] ; then\n echo \"ERROR: could not locate the AppDir. Ensure this script is run from within a properly structured AppImage.\" >&2\n exit 1\nfi\n\nexport PATH=\"\\${APPDIR}:\\${APPDIR}/usr/sbin\\${PATH:+:\\${PATH}}\"\nexport XDG_DATA_DIRS=\"\\${APPDIR}/usr/share/\\${XDG_DATA_DIRS:+:\\${XDG_DATA_DIRS}}:/usr/share/gnome:/usr/local/share/:/usr/share/\"\nexport LD_LIBRARY_PATH=\"\\${APPDIR}/usr/lib\\${LD_LIBRARY_PATH:+:\\${LD_LIBRARY_PATH}}\"\nexport GSETTINGS_SCHEMA_DIR=\"\\${APPDIR}/usr/share/glib-2.0/schemas\\${GSETTINGS_SCHEMA_DIR:+:\\${GSETTINGS_SCHEMA_DIR}}\"\n\nBIN=\"$APPDIR/${config.ExecutableName}\"\n\nif [ -z \"$APPIMAGE_EXIT_AFTER_INSTALL\" ] ; then\n trap atexit EXIT\nfi\n\nisEulaAccepted=1\n\nHAVE_NO_SANDBOX=0\nfor arg in \"\\${args[@]}\" ; do\n if [ \"$arg\" = --no-sandbox ] ; then\n HAVE_NO_SANDBOX=1\n break\n fi\ndone\nNO_SANDBOX=()\n# Use 'unshare -Ur true' as a heuristic to detect whether user namespaces are available.\n# Notes:\n# - When running as root, this check will always succeed even if the sandbox configuration\n# actually relies on unprivileged user namespaces. In practice, Chrome/Electron usually\n# disables or adjusts the sandbox separately when running as root, so this probe is mostly\n# a no-op in that scenario.\n# - On minimal systems (e.g. Alpine or stripped-down containers) 'unshare' may not exist.\n# In that case the shell will return exit code 127 (\"command not found\"), which will cause\n# us to add '--no-sandbox'. This is an intentional fail-safe: we prefer the app to start\n# without sandboxing rather than crash on startup.\nif [ $HAVE_NO_SANDBOX -eq 0 ] && ! unshare -Ur true 2>/dev/null ; then\n NO_SANDBOX=(--no-sandbox)\nfi\n\natexit()\n{\n if [ $isEulaAccepted == 1 ] ; then\n if [ $NUMBER_OF_ARGS -eq 0 ] ; then\n exec \"$BIN\" \"\\${NO_SANDBOX[@]}\"\n else\n exec \"$BIN\" \"\\${NO_SANDBOX[@]}\" \"\\${args[@]}\"\n fi\n fi\n}\n\nerror()\n{\n if [ -x /usr/bin/zenity ] ; then\n LD_LIBRARY_PATH=\"\" zenity --error --text \"\\${1}\" 2>/dev/null\n elif [ -x /usr/bin/kdialog ] ; then\n LD_LIBRARY_PATH=\"\" kdialog --msgbox \"\\${1}\" 2>/dev/null\n elif [ -x /usr/bin/Xdialog ] ; then\n LD_LIBRARY_PATH=\"\" Xdialog --msgbox \"\\${1}\" 2>/dev/null\n else\n echo \"\\${1}\"\n fi\n exit 1\n}\n\nyesno()\n{\n TITLE=$1\n TEXT=$2\n if [ -x /usr/bin/zenity ] ; then\n LD_LIBRARY_PATH=\"\" zenity --question --title=\"$TITLE\" --text=\"$TEXT\" 2>/dev/null || exit 0\n elif [ -x /usr/bin/kdialog ] ; then\n LD_LIBRARY_PATH=\"\" kdialog --title \"$TITLE\" --yesno \"$TEXT\" || exit 0\n elif [ -x /usr/bin/Xdialog ] ; then\n LD_LIBRARY_PATH=\"\" Xdialog --title \"$TITLE\" --clear --yesno \"$TEXT\" 10 80 || exit 0\n else\n echo \"zenity, kdialog, Xdialog missing. Skipping \\${THIS}.\"\n exit 0\n fi\n}\n\ncheck_dep()\n{\n DEP=$1\n if ! command -v \"$DEP\" &>/dev/null ; then\n echo \"$DEP is missing. Skipping \\${THIS}.\"\n exit 0\n fi\n}\n\nif [ -z \"$APPIMAGE\" ] ; then\n APPIMAGE=\"$APPDIR/${APP_RUN_ENTRYPOINT}\"\n # not running from within an AppImage; hence using the AppRun for Exec=\nfi\n\n${\n eulaEnabled\n ? `if [ -z \"$APPIMAGE_SILENT_INSTALL\" ] ; then\n EULA_MARK_DIR=\"\\${XDG_CONFIG_HOME:-$HOME/.config}/${config.ProductFilename}\"\n EULA_MARK_FILE=\"$EULA_MARK_DIR/eulaAccepted\"\n # show EULA only if desktop file doesn't exist\n if [ ! -e \"$EULA_MARK_FILE\" ] ; then\n if [ -x /usr/bin/zenity ] ; then\n # on cancel simply exits and our trap handler launches app, so, $isEulaAccepted is set here to 0 and then to 1 if EULA accepted\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" zenity --text-info --title=${escapeShellString(config.ProductName)} --filename=\"$APPDIR/${config.EulaFile}\" --ok-label=Agree --cancel-label=Disagree ${config.IsHtmlEula ? \"--html\" : \"\"}\n elif [ -x /usr/bin/Xdialog ] ; then\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" Xdialog --title ${escapeShellString(config.ProductName)} --textbox \"$APPDIR/${config.EulaFile}\" 30 80 --ok-label Agree --cancel-label Disagree\n elif [ -x /usr/bin/kdialog ] ; then\n # cannot find any option to force Agree/Disagree buttons for kdialog. And official example exactly with OK button https://techbase.kde.org/Development/Tutorials/Shell_Scripting_with_KDE_Dialogs#Example_21._--textbox_dialog_box\n # in any case we pass labels text\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" kdialog --textbox \"$APPDIR/${config.EulaFile}\" --yes-label Agree --cancel-label \"Disagree\"\n fi\n\n case $? in\n 0)\n isEulaAccepted=1\n echo \"License accepted\"\n mkdir -p \"$EULA_MARK_DIR\"\n touch \"$EULA_MARK_FILE\"\n ;;\n 1)\n echo \"License not accepted\"\n exit 0\n ;;\n -1)\n echo \"An unexpected error has occurred.\"\n isEulaAccepted=1\n ;;\n esac\n fi\nfi`\n : \"\"\n}\n`\n}\n"]}
1
+ {"version":3,"file":"appImageUtil.js","sourceRoot":"","sources":["../../../src/targets/appimage/appImageUtil.ts"],"names":[],"mappings":";;AA0CA,gEAyCC;AAED,4DAqCC;AAiCD,gEAMC;AAqFD,oDA+JC;AArZD,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ir, copyFile, exec, exists, InvalidConfigurationError, log } from \"builder-util\"\nimport * as fs from \"fs-extra\"\nimport * as path from \"path\"\nimport { FileAssociation } from \"../../options/FileAssociation\"\nimport { getAppImageTools } from \"../../toolsets/linux\"\nimport { copyIcons, copyMimeTypes } from \"./appLauncher\"\nimport { appendBlockmap } from \"../differentialUpdateInfoBuilder\"\nimport { BlockMapDataHolder } from \"builder-util-runtime\"\nimport { APP_RUN_ENTRYPOINT } from \"./AppImageTarget\"\nimport { ToolsetConfig } from \"../../configuration\"\nimport { IconInfo } from \"../../util/iconConverter\"\n\ninterface Options {\n productName: string\n productFilename: string\n executableName: string\n desktopEntry: string\n icons: IconInfo[]\n license?: string | null\n fileAssociations: FileAssociation[]\n /**\n * The compression type available for static runtime is limited as it's only compiled with support for gzip and zstd.\n * \"xz\" is only valid for the legacy FUSE2 (0.0.0) toolset.\n *\n * [stderr] Squashfs image uses lzo compression, this version supports only zlib, zstd.\n * Failed to open squashfs image\n * Failed to extract AppImage\n *\n */\n compression?: \"gzip\" | \"zstd\" | \"xz\"\n /** Pre-computed desktop basename (already validated). When absent, falls back to `executableName`. */\n desktopBaseName?: string\n}\n\nexport interface AppImageBuilderOptions {\n appDir: string\n stageDir: string\n arch: Arch\n output: string\n options: Options\n}\n\nexport async function buildStaticRuntimeAppImage(appimageToolVersion: ToolsetConfig[\"appimage\"], opts: AppImageBuilderOptions): Promise<BlockMapDataHolder> {\n const { stageDir, output, appDir, options, arch } = opts\n\n try {\n await fs.remove(output)\n\n // Write AppRun launcher and related files\n await writeAppLauncherAndRelatedFiles(opts)\n\n const { runtimeLibraries: libraries, runtime, mksquashfs } = await getAppImageTools(appimageToolVersion, arch)\n await copyDir(libraries, path.join(stageDir, \"usr\", \"lib\"))\n\n // Copy app directory to stage\n // mksquashfs doesn't support merging, so we copy the entire app dir\n await copyDir(appDir, stageDir)\n\n const runtimeData = await fs.readFile(runtime)\n\n // Create squashfs with offset for runtime\n const args: string[] = [stageDir, output, \"-offset\", runtimeData.length.toString(), \"-all-root\", \"-noappend\", \"-no-progress\", \"-quiet\", \"-no-xattrs\", \"-no-fragments\"]\n if (options.compression) {\n args.push(\"-comp\", options.compression)\n }\n await exec(mksquashfs, args, {\n cwd: stageDir,\n })\n\n // Write runtime data at the beginning of the file\n await writeRuntimeData(output, runtimeData)\n\n // Make executable\n await fs.chmod(output, 0o755)\n\n // Append blockmap inside try block to ensure cleanup on failure\n const updateInfo = await appendBlockmap(output)\n return updateInfo\n } catch (error) {\n // Clean up partial build on failure\n await fs.remove(output).catch(() => {})\n throw error\n }\n}\n\nexport async function buildLegacyFuse2AppImage(opts: AppImageBuilderOptions): Promise<BlockMapDataHolder> {\n const { stageDir, output, appDir, options, arch } = opts\n\n try {\n await fs.remove(output)\n\n await writeAppLauncherAndRelatedFiles(opts)\n\n const { runtime, mksquashfs, runtimeLibraries } = await getAppImageTools(\"0.0.0\", arch)\n // Mirror the app-builder-lib Go implementation: bundle lib/<arch> into usr/lib for x64 and ia32.\n // arm targets don't have a dedicated lib dir in the FUSE2 toolset.\n if (arch === Arch.x64 || arch === Arch.ia32) {\n await copyDir(runtimeLibraries, path.join(stageDir, \"usr\", \"lib\"))\n }\n await copyDir(appDir, stageDir)\n\n const runtimeData = await fs.readFile(runtime)\n\n const args: string[] = [stageDir, output, \"-offset\", runtimeData.length.toString(), \"-all-root\", \"-noappend\", \"-no-progress\", \"-quiet\", \"-no-xattrs\", \"-no-fragments\"]\n if (options.compression) {\n args.push(\"-comp\", options.compression)\n if (options.compression === \"xz\") {\n // Match the dictionary/block-size settings used by the original app-builder Go implementation\n args.push(\"-Xdict-size\", \"100%\", \"-b\", \"1048576\")\n }\n }\n await exec(mksquashfs, args, { cwd: stageDir })\n\n await writeRuntimeData(output, runtimeData)\n await fs.chmod(output, 0o755)\n\n const updateInfo = await appendBlockmap(output)\n return updateInfo\n } catch (error) {\n await fs.remove(output).catch(() => {})\n throw error\n }\n}\n\nasync function writeRuntimeData(filePath: string, runtimeData: Buffer): Promise<void> {\n const fd = await fs.open(filePath, \"r+\")\n try {\n await fs.write(fd, runtimeData, 0, runtimeData.length, 0)\n } finally {\n try {\n await fs.close(fd)\n } catch (closeError: any) {\n // Log but don't throw - preserve original error if any\n log.warn({ message: closeError.message, file: filePath }, `failed to close file descriptor`)\n }\n }\n}\n\n/**\n * Escapes a string for safe use in shell scripts by wrapping in single quotes\n * and escaping any single quotes within the string.\n *\n * This allows strings with spaces, special characters, etc. to be safely used.\n */\nfunction escapeShellString(str: string): string {\n // Escape single quotes by replacing ' with '\\''\n // Then wrap the whole string in single quotes\n return `'${str.replace(/'/g, \"'\\\\''\")}'`\n}\n\n/**\n * Validates that critical path fields (executable name, product filename, license filename)\n * contain only characters that are safe for use in filesystem paths and embedded bash strings.\n * Allowed: Unicode letters, digits, dots, underscores, hyphens, and spaces.\n */\nexport function validateCriticalPathString(str: string, fieldName: string): void {\n if (!/^[\\p{L}\\p{N}._\\- ]+$/u.test(str)) {\n throw new InvalidConfigurationError(\n `${fieldName} contains characters that cannot be safely used in file paths: ${str}. Please use only letters, digits, hyphens, underscores, dots, and spaces.`\n )\n }\n}\n\nasync function writeAppLauncherAndRelatedFiles(opts: AppImageBuilderOptions): Promise<void> {\n const {\n stageDir,\n options: { license, executableName, productFilename, productName, desktopEntry, desktopBaseName },\n } = opts\n\n // executableName and productFilename are embedded directly into double-quoted bash strings\n // and used as filesystem paths, so they must pass the whitelist.\n // productName is not validated here because it is only ever passed through escapeShellString().\n validateCriticalPathString(executableName, \"executableName\")\n validateCriticalPathString(productFilename, \"productFilename\")\n\n // Write desktop file\n const desktopFileName = `${desktopBaseName ?? executableName}.desktop`\n await fs.writeFile(path.join(stageDir, desktopFileName), desktopEntry, { mode: 0o644 })\n await copyIcons(opts)\n\n const templateConfig: AppRunScriptBase = {\n DesktopFileName: desktopFileName,\n ExecutableName: executableName,\n ProductName: productName,\n ProductFilename: productFilename,\n ResourceName: `appimagekit-${executableName}`,\n }\n\n const mimeTypeFile = await copyMimeTypes(stageDir, opts.options)\n if (mimeTypeFile) {\n templateConfig.MimeTypeFile = mimeTypeFile\n }\n\n let finalConfig: AppRunScript = templateConfig\n\n // Copy license file if provided\n if (license) {\n // Validate license file exists\n if (!(await exists(license))) {\n throw new InvalidConfigurationError(`License file not found: ${license}`)\n }\n\n const licenseBaseName = path.basename(license)\n const ext = path.extname(license).toLowerCase()\n\n // Validate license filename for path safety\n validateCriticalPathString(licenseBaseName, \"licenseBaseName\")\n\n // Validate extension\n if (![\".txt\", \".html\"].includes(ext)) {\n log.warn({ license, expected: \".txt or .html\" }, `license file has unexpected extension`)\n }\n\n await copyFile(license, path.join(stageDir, licenseBaseName))\n\n finalConfig = {\n ...templateConfig,\n EulaFile: licenseBaseName,\n IsHtmlEula: ext === \".html\",\n }\n }\n\n const appRunContent = generateAppRunScript(finalConfig)\n await fs.writeFile(path.join(stageDir, APP_RUN_ENTRYPOINT), appRunContent, { mode: 0o755 })\n}\n\nexport type AppRunScriptBase = {\n ExecutableName: string\n DesktopFileName: string\n ProductFilename: string\n ProductName: string\n ResourceName: string\n MimeTypeFile?: string\n}\n\nexport type AppRunScriptWithEula = AppRunScriptBase & {\n EulaFile: string\n IsHtmlEula: boolean\n}\n\nexport type AppRunScript = AppRunScriptBase | AppRunScriptWithEula\n\nfunction hasEula(config: AppRunScript): config is AppRunScriptWithEula {\n return \"EulaFile\" in config && typeof config.EulaFile === \"string\"\n}\n\nexport function generateAppRunScript(config: AppRunScript): string {\n const eulaEnabled = hasEula(config)\n\n return `#!/usr/bin/env bash\nset -e\n\nTHIS=\"$0\"\n# http://stackoverflow.com/questions/3190818/\nargs=(\"$@\")\nNUMBER_OF_ARGS=\"$#\"\n\nif [ -z \"$APPDIR\" ] ; then\n # Find the AppDir. It is the directory that contains AppRun.\n # This assumes that this script resides inside the AppDir or a subdirectory.\n # If this script is run inside an AppImage, then the AppImage runtime likely has already set $APPDIR\n path=\"$(dirname \"$(readlink -f \"\\${THIS}\")\")\"\n while [[ \"$path\" != \"\" && ! -e \"$path/${APP_RUN_ENTRYPOINT}\" ]]; do\n path=\\${path%/*}\n done\n APPDIR=\"$path\"\nfi\n\nif [ -z \"$APPDIR\" ] ; then\n echo \"ERROR: could not locate the AppDir. Ensure this script is run from within a properly structured AppImage.\" >&2\n exit 1\nfi\n\nexport PATH=\"\\${APPDIR}:\\${APPDIR}/usr/sbin\\${PATH:+:\\${PATH}}\"\nexport XDG_DATA_DIRS=\"\\${APPDIR}/usr/share/\\${XDG_DATA_DIRS:+:\\${XDG_DATA_DIRS}}:/usr/share/gnome:/usr/local/share/:/usr/share/\"\nexport LD_LIBRARY_PATH=\"\\${APPDIR}/usr/lib\\${LD_LIBRARY_PATH:+:\\${LD_LIBRARY_PATH}}\"\nexport GSETTINGS_SCHEMA_DIR=\"\\${APPDIR}/usr/share/glib-2.0/schemas\\${GSETTINGS_SCHEMA_DIR:+:\\${GSETTINGS_SCHEMA_DIR}}\"\n\nBIN=\"$APPDIR/${config.ExecutableName}\"\n\nif [ -z \"$APPIMAGE_EXIT_AFTER_INSTALL\" ] ; then\n trap atexit EXIT\nfi\n\nisEulaAccepted=1\n\nHAVE_NO_SANDBOX=0\nfor arg in \"\\${args[@]}\" ; do\n if [ \"$arg\" = --no-sandbox ] ; then\n HAVE_NO_SANDBOX=1\n break\n fi\ndone\nNO_SANDBOX=()\n# Use 'unshare -Ur true' as a heuristic to detect whether user namespaces are available.\n# Notes:\n# - When running as root, this check will always succeed even if the sandbox configuration\n# actually relies on unprivileged user namespaces. In practice, Chrome/Electron usually\n# disables or adjusts the sandbox separately when running as root, so this probe is mostly\n# a no-op in that scenario.\n# - On minimal systems (e.g. Alpine or stripped-down containers) 'unshare' may not exist.\n# In that case the shell will return exit code 127 (\"command not found\"), which will cause\n# us to add '--no-sandbox'. This is an intentional fail-safe: we prefer the app to start\n# without sandboxing rather than crash on startup.\nif [ $HAVE_NO_SANDBOX -eq 0 ] && ! unshare -Ur true 2>/dev/null ; then\n NO_SANDBOX=(--no-sandbox)\nfi\n\natexit()\n{\n if [ $isEulaAccepted == 1 ] ; then\n if [ $NUMBER_OF_ARGS -eq 0 ] ; then\n exec \"$BIN\" \"\\${NO_SANDBOX[@]}\"\n else\n exec \"$BIN\" \"\\${NO_SANDBOX[@]}\" \"\\${args[@]}\"\n fi\n fi\n}\n\nerror()\n{\n if [ -x /usr/bin/zenity ] ; then\n LD_LIBRARY_PATH=\"\" zenity --error --text \"\\${1}\" 2>/dev/null\n elif [ -x /usr/bin/kdialog ] ; then\n LD_LIBRARY_PATH=\"\" kdialog --msgbox \"\\${1}\" 2>/dev/null\n elif [ -x /usr/bin/Xdialog ] ; then\n LD_LIBRARY_PATH=\"\" Xdialog --msgbox \"\\${1}\" 2>/dev/null\n else\n echo \"\\${1}\"\n fi\n exit 1\n}\n\nyesno()\n{\n TITLE=$1\n TEXT=$2\n if [ -x /usr/bin/zenity ] ; then\n LD_LIBRARY_PATH=\"\" zenity --question --title=\"$TITLE\" --text=\"$TEXT\" 2>/dev/null || exit 0\n elif [ -x /usr/bin/kdialog ] ; then\n LD_LIBRARY_PATH=\"\" kdialog --title \"$TITLE\" --yesno \"$TEXT\" || exit 0\n elif [ -x /usr/bin/Xdialog ] ; then\n LD_LIBRARY_PATH=\"\" Xdialog --title \"$TITLE\" --clear --yesno \"$TEXT\" 10 80 || exit 0\n else\n echo \"zenity, kdialog, Xdialog missing. Skipping \\${THIS}.\"\n exit 0\n fi\n}\n\ncheck_dep()\n{\n DEP=$1\n if ! command -v \"$DEP\" &>/dev/null ; then\n echo \"$DEP is missing. Skipping \\${THIS}.\"\n exit 0\n fi\n}\n\nif [ -z \"$APPIMAGE\" ] ; then\n APPIMAGE=\"$APPDIR/${APP_RUN_ENTRYPOINT}\"\n # not running from within an AppImage; hence using the AppRun for Exec=\nfi\n\n${\n eulaEnabled\n ? `if [ -z \"$APPIMAGE_SILENT_INSTALL\" ] ; then\n EULA_MARK_DIR=\"\\${XDG_CONFIG_HOME:-$HOME/.config}/${config.ProductFilename}\"\n EULA_MARK_FILE=\"$EULA_MARK_DIR/eulaAccepted\"\n # show EULA only if desktop file doesn't exist\n if [ ! -e \"$EULA_MARK_FILE\" ] ; then\n if [ -x /usr/bin/zenity ] ; then\n # on cancel simply exits and our trap handler launches app, so, $isEulaAccepted is set here to 0 and then to 1 if EULA accepted\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" zenity --text-info --title=${escapeShellString(config.ProductName)} --filename=\"$APPDIR/${config.EulaFile}\" --ok-label=Agree --cancel-label=Disagree ${config.IsHtmlEula ? \"--html\" : \"\"}\n elif [ -x /usr/bin/Xdialog ] ; then\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" Xdialog --title ${escapeShellString(config.ProductName)} --textbox \"$APPDIR/${config.EulaFile}\" 30 80 --ok-label Agree --cancel-label Disagree\n elif [ -x /usr/bin/kdialog ] ; then\n # cannot find any option to force Agree/Disagree buttons for kdialog. And official example exactly with OK button https://techbase.kde.org/Development/Tutorials/Shell_Scripting_with_KDE_Dialogs#Example_21._--textbox_dialog_box\n # in any case we pass labels text\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" kdialog --textbox \"$APPDIR/${config.EulaFile}\" --yes-label Agree --cancel-label \"Disagree\"\n fi\n\n case $? in\n 0)\n isEulaAccepted=1\n echo \"License accepted\"\n mkdir -p \"$EULA_MARK_DIR\"\n touch \"$EULA_MARK_FILE\"\n ;;\n 1)\n echo \"License not accepted\"\n exit 0\n ;;\n -1)\n echo \"An unexpected error has occurred.\"\n isEulaAccepted=1\n ;;\n esac\n fi\nfi`\n : \"\"\n}\n`\n}\n"]}
@@ -19,4 +19,3 @@ export interface ArchiveOptions {
19
19
  isRegularFile?: boolean;
20
20
  }
21
21
  export declare function compute7zCompressArgs(format: string, options?: ArchiveOptions): string[];
22
- export declare function computeZipCompressArgs(options?: ArchiveOptions): string[];