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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/codeSign/win/signtoolBaseSignManager.d.ts +23 -0
  2. package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
  3. package/dist/codeSign/win/signtoolBaseSignManager.js +71 -0
  4. package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
  5. package/dist/configuration.d.ts +42 -5
  6. package/dist/configuration.d.ts.map +1 -1
  7. package/dist/configuration.js.map +1 -1
  8. package/dist/fileMatcher.d.ts +15 -0
  9. package/dist/fileMatcher.d.ts.map +1 -1
  10. package/dist/fileMatcher.js +41 -2
  11. package/dist/fileMatcher.js.map +1 -1
  12. package/dist/indexInternal.d.ts +2 -1
  13. package/dist/indexInternal.d.ts.map +1 -1
  14. package/dist/indexInternal.js +2 -1
  15. package/dist/indexInternal.js.map +1 -1
  16. package/dist/macPackager.d.ts.map +1 -1
  17. package/dist/macPackager.js +2 -3
  18. package/dist/macPackager.js.map +1 -1
  19. package/dist/node-module-collector/nodeModulesCollector.d.ts +11 -1
  20. package/dist/node-module-collector/nodeModulesCollector.d.ts.map +1 -1
  21. package/dist/node-module-collector/nodeModulesCollector.js +28 -5
  22. package/dist/node-module-collector/nodeModulesCollector.js.map +1 -1
  23. package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts.map +1 -1
  24. package/dist/node-module-collector/pnpmNodeModulesCollector.js +3 -1
  25. package/dist/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
  26. package/dist/options/SnapOptions.d.ts +8 -4
  27. package/dist/options/SnapOptions.d.ts.map +1 -1
  28. package/dist/options/SnapOptions.js.map +1 -1
  29. package/dist/options/macOptions.d.ts +17 -7
  30. package/dist/options/macOptions.d.ts.map +1 -1
  31. package/dist/options/macOptions.js.map +1 -1
  32. package/dist/options/winOptions.d.ts +5 -4
  33. package/dist/options/winOptions.d.ts.map +1 -1
  34. package/dist/options/winOptions.js.map +1 -1
  35. package/dist/packager.js +1 -1
  36. package/dist/packager.js.map +1 -1
  37. package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
  38. package/dist/publish/updateInfoBuilder.js +3 -1
  39. package/dist/publish/updateInfoBuilder.js.map +1 -1
  40. package/dist/targets/linux/FlatpakTarget.d.ts.map +1 -1
  41. package/dist/targets/linux/FlatpakTarget.js +4 -1
  42. package/dist/targets/linux/FlatpakTarget.js.map +1 -1
  43. package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
  44. package/dist/targets/linux/FpmTarget.js +9 -0
  45. package/dist/targets/linux/FpmTarget.js.map +1 -1
  46. package/dist/targets/linux/appimage/appImageUtil.d.ts +1 -1
  47. package/dist/targets/linux/appimage/appImageUtil.js +3 -3
  48. package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
  49. package/dist/targets/linux/snap/core24.d.ts +27 -0
  50. package/dist/targets/linux/snap/core24.d.ts.map +1 -1
  51. package/dist/targets/linux/snap/core24.js +92 -57
  52. package/dist/targets/linux/snap/core24.js.map +1 -1
  53. package/dist/targets/mac/MacTargetHelper.d.ts +12 -2
  54. package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
  55. package/dist/targets/mac/MacTargetHelper.js +20 -11
  56. package/dist/targets/mac/MacTargetHelper.js.map +1 -1
  57. package/dist/targets/win/MsiTarget.js +2 -2
  58. package/dist/targets/win/MsiTarget.js.map +1 -1
  59. package/dist/toolsets/custom.js +4 -2
  60. package/dist/toolsets/custom.js.map +1 -1
  61. package/dist/toolsets/icons.d.ts.map +1 -1
  62. package/dist/toolsets/icons.js +4 -1
  63. package/dist/toolsets/icons.js.map +1 -1
  64. package/dist/util/appFileCopier.d.ts.map +1 -1
  65. package/dist/util/appFileCopier.js +63 -2
  66. package/dist/util/appFileCopier.js.map +1 -1
  67. package/dist/util/electronGet.d.ts +5 -0
  68. package/dist/util/electronGet.d.ts.map +1 -1
  69. package/dist/util/electronGet.js +107 -7
  70. package/dist/util/electronGet.js.map +1 -1
  71. package/dist/util/packageMetadata.js +46 -21
  72. package/dist/util/packageMetadata.js.map +1 -1
  73. package/dist/version.d.ts +1 -1
  74. package/dist/version.js +1 -1
  75. package/dist/version.js.map +1 -1
  76. package/package.json +8 -8
  77. package/scheme.json +36 -10
@@ -1 +1 @@
1
- {"version":3,"file":"winOptions.js","sourceRoot":"","sources":["../../src/options/winOptions.ts"],"names":[],"mappings":"AA8ZA;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAAC,MAA4B;IAC7E,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;IACvB,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,wBAAwB,CAAC,MAA4B;IACnE,OAAO,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,CAAA;AACtD,CAAC","sourcesContent":["import { CustomWindowsSign } from \"../codeSign/win/windowsSignToolManager.js\"\nimport { TargetConfigType } from \"../core.js\"\nimport { PlatformSpecificBuildOptions } from \"./PlatformSpecificBuildOptions.js\"\n\nexport interface WindowsConfiguration extends PlatformSpecificBuildOptions {\n /**\n * The target package type: list of `nsis`, `nsis-web` (Web installer), `portable` ([portable app](https://www.electron.build/nsis#portable) without installation), `appx`, `msix`, `msi`, `msi-wrapped`, `squirrel`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n * AppX and MSIX packages can be built on Windows 10 or Windows Server 2012 R2 (version 6.3+) or later, and on macOS via Parallels Desktop.\n *\n * To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.\n *\n * @default nsis\n */\n readonly target?: TargetConfigType\n\n /**\n * The path to application icon.\n * @default build/icon.ico\n */\n readonly icon?: string | null\n\n /**\n * The trademarks and registered trademarks.\n */\n readonly legalTrademarks?: string | null\n\n /**\n * Code signing configuration. Code signing stamps every installer and executable\n * electron-builder produces with an Authenticode signature, so that Windows (SmartScreen / UAC)\n * and your auto-updater can verify the publisher and that the files were not tampered with.\n *\n * How this option behaves:\n * - Leave **unset** to sign using credentials discovered from the environment — primarily a\n * certificate supplied via `WIN_CSC_LINK` (or `CSC_LINK`) with its password in\n * `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`). `WIN_CSC_LINK` accepts a file path, an\n * `https://` URL, or a base64-encoded certificate. This is the recommended setup for CI.\n * - Set to `false` or `null` to **disable** code signing entirely (executable resources such as\n * the icon and metadata are still edited).\n * - Set to an **object** to configure signing explicitly. The `type` field selects the signing\n * backend (`signtool` is the implicit default) and dispatches to a dedicated sign manager;\n * provide exactly one of the modes below. Each output artifact is signed individually, and by\n * default executables are dual-signed (see `signingHashAlgorithms`).\n *\n * - `{ type: \"signtool\", ... }` — Sign with a local certificate file (.pfx/.p12) or a\n * certificate from the Windows certificate store. Uses Microsoft `signtool.exe` on Windows and\n * `osslsigncode` on macOS/Linux.\n * - `{ type: \"hsm\", ... }` — Sign using a Hardware Security Module (HSM) or FIPS-compliant\n * hardware token via signtool's `/csp` (cryptographic service provider) and `/kc` (key\n * container) flags. Requires a modern `winCodeSign` toolset (the default — only the legacy\n * `\"0.0.0\"` pin is unsupported). Windows-only.\n * - `{ type: \"pkcs11\", ... }` — Sign using a PKCS#11 hardware token via osslsigncode.\n * Available on macOS and Linux CI without a Windows VM.\n * - `{ type: \"azure\", ... }` — Sign via Azure Trusted Signing (cloud service). Requires\n * Azure Entra ID environment variables for authentication.\n *\n * See [Code Signing](https://www.electron.build/code-signing).\n */\n readonly sign?: WindowsSigningConfiguration | false | null\n\n /**\n * Whether the NSIS auto-updater should verify the Authenticode signature of a downloaded update\n * before installing it. This is a **runtime** check performed by your app via electron-updater,\n * not a build-time check.\n *\n * When enabled (the default), the resolved [publisher name](#publisherName) is embedded into\n * `app-update.yml` at build time. At update time electron-updater inspects the certificate that\n * signed the downloaded installer and compares its subject (Distinguished Name / Common Name)\n * against that publisher name, refusing to install on a mismatch. This prevents a tampered or\n * maliciously substituted update from being installed.\n *\n * Set to `false` to skip verification — in which case the publisher name is **not** embedded.\n * Disable this only if your updates are not Authenticode-signed.\n *\n * @default true\n */\n readonly verifyUpdateCodeSignature?: boolean\n\n /**\n * The [security level](https://msdn.microsoft.com/en-us/library/6ad1fshk.aspx#Anchor_9) at which the application requests to be executed.\n * Cannot be specified per target, allowed only in the `win`.\n * @default asInvoker\n */\n readonly requestedExecutionLevel?: RequestedExecutionLevel | null\n\n /**\n * Additional file name suffixes to code sign, beyond the default. By default electron-builder\n * only signs `.exe` files; list extra suffixes here to also sign e.g. `.dll`, `.node`, or\n * specific file names. Advanced option — most apps do not need it.\n *\n * Each entry is matched with `String.endsWith`, so both bare extensions (`\".dll\"`) and full file\n * names (`\"mybinary.dll\"`) work. Prefix a pattern with `!` to *exclude* a suffix that would\n * otherwise be signed. Positive patterns are evaluated first, then negative ones. For example,\n * `[\"somefilename\", \".dll\", \"!.appx\"]` signs `.dll` files (and anything ending in `somefilename`)\n * but never signs `.appx` files.\n *\n * @see https://github.com/electron-userland/electron-builder/issues/7329\n * @default null\n */\n readonly signExts?: string[] | null\n}\n\nexport type RequestedExecutionLevel = \"asInvoker\" | \"highestAvailable\" | \"requireAdministrator\"\n\n// ─── Shared base for signtool-family signing modes ───────────────────────────\n\n/**\n * Options shared by every certificate-based signing mode (`signtool`, `hsm`, `pkcs11`). These\n * control the signature itself — publisher identity, digest algorithms, timestamping, and the\n * extra certificates added to the signature block — independently of where the private key lives.\n */\ninterface WindowsSigningSharedOptions {\n /**\n * The publisher name(s) to associate with the signature, written exactly as the subject appears\n * in your code signing certificate. May be a single string or an array — an array is useful when\n * rotating certificates, so updates signed by either the old or the new certificate still verify.\n *\n * This value is not a `signtool` argument; it is consumed in two places:\n * - **Update verification** — when [verifyUpdateCodeSignature](#verifyUpdateCodeSignature) is\n * enabled, it is written into `app-update.yml` and electron-updater checks it against the\n * certificate that signed each downloaded update.\n * - **AppX / MSIX identity** — the package `Publisher` attribute must equal the certificate\n * subject, so electron-builder derives it from this value (or the certificate) to keep them\n * in sync; a mismatch makes packaging fail with `ERROR_BAD_FORMAT`.\n *\n * Defaults to the Common Name (CN) extracted from your code signing certificate. Set to `null`\n * to opt out.\n *\n * @see https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073\n */\n readonly publisherName?: string | Array<string> | null\n\n /**\n * The digest (hash) algorithms to sign with, applied via signtool's `/fd` flag (or\n * osslsigncode's `-h`). One signing pass runs per entry, in order; listing more than one\n * **dual-signs** the file, with each additional signature appended as a nested signature\n * (signtool `/as`). Signing with both `sha1` and `sha256` lets a single binary validate on\n * legacy (pre-SHA-2) Windows as well as modern Windows.\n *\n * Some targets override this: `.msi` cannot be dual-signed (a single hash is used) and AppX/MSIX\n * is always `sha256` only.\n *\n * @default ['sha1', 'sha256']\n */\n readonly signingHashAlgorithms?: Array<\"sha1\" | \"sha256\"> | null\n\n /**\n * The URL of the [RFC 3161](https://www.ietf.org/rfc/rfc3161.txt) timestamp server, used for\n * SHA-256 and nested/appended signatures (signtool's `/tr` flag). Timestamping records *when*\n * the file was signed so the signature stays valid after the signing certificate expires.\n * Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE=true`.\n *\n * @default http://timestamp.digicert.com\n */\n readonly rfc3161TimeStampServer?: string | null\n\n /**\n * The URL of the legacy Authenticode timestamp server, used for SHA-1 signatures (signtool's\n * `/t` flag). This is also the timestamp server used by `osslsigncode` (`-t`) when signing on\n * macOS/Linux. See [rfc3161TimeStampServer](#rfc3161TimeStampServer) for SHA-256 / nested\n * signatures. Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE=true`.\n *\n * @default http://timestamp.digicert.com\n */\n readonly timeStampServer?: string | null\n\n /**\n * Path to an additional certificate file (typically an intermediate / cross-signing CA\n * certificate) whose contents are added to the signature block via signtool's `/ac` flag. Use\n * this when the signing certificate's full chain is not already present on target machines and\n * you want it embedded in the signature so the chain can be validated.\n */\n readonly additionalCertificateFile?: string | null\n\n /**\n * A custom signing hook that **replaces** electron-builder's built-in `signtool` /\n * `osslsigncode` invocation. Provide a function, or the path / module id of a file that exports\n * a `sign` function (resolved relative to the project, then as a module).\n *\n * The hook is invoked once per signing pass (i.e. once per entry in\n * [signingHashAlgorithms](#signingHashAlgorithms)) and receives a configuration object describing\n * the file to sign (`path`), the resolved certificate info (`cscInfo`), the current `hash`, and\n * whether this pass is a nested signature (`isNest`), plus a `computeSignToolArgs(isWin)` helper\n * that returns the default arguments electron-builder would otherwise have used. Use this to\n * integrate an external or cloud signing service. See\n * [Code Signing](https://www.electron.build/code-signing).\n */\n readonly sign?: CustomWindowsSign | string | null\n}\n\n// ─── Signing mode: signtool (file or Windows certificate store) ──────────────\n\n/**\n * Sign with a certificate file (`.pfx` / `.p12`) or with a certificate from the Windows\n * certificate store, using Microsoft `signtool.exe` on Windows and `osslsigncode` on macOS/Linux.\n * This is the default mode when `win.sign` is unset. Supply the certificate one of four ways:\n * a file via `certificateFile` (or the `WIN_CSC_LINK` env var), or a store lookup via\n * `certificateSubjectName` or `certificateSha1`.\n */\nexport interface WindowsSigntoolSigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting the default file/store signing mode. */\n readonly type: \"signtool\"\n\n /**\n * Path to the PKCS#12 certificate file (`.pfx` or `.p12`) holding both the signing certificate\n * and its private key. Passed to signtool via `/f` (or osslsigncode via `-pkcs12`).\n *\n * Prefer supplying this out-of-band via the `WIN_CSC_LINK` (or `CSC_LINK`) environment variable\n * instead of hardcoding a path — that variable also accepts an `https://` URL or a base64-encoded\n * certificate, which is safer and more convenient on CI. See\n * [Code Signing](https://www.electron.build/code-signing).\n */\n readonly certificateFile?: string | null\n\n /**\n * The password protecting the private key in `certificateFile`. Passed to signtool via `/p`\n * (or osslsigncode via `-pass`).\n *\n * Prefer the `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`) environment variable so the secret\n * never lands in your build configuration.\n */\n readonly certificatePassword?: string | null\n\n /**\n * Select the signing certificate from the Windows certificate store by (a substring of) its\n * subject name, instead of pointing at a `.pfx` file. electron-builder enumerates the installed\n * code-signing certificates, picks the match, and signs by its thumbprint\n * (`/sha1 <thumbprint> /s <store>`). **Required for EV (Extended Validation) certificates**,\n * whose private keys live on a hardware token and cannot be exported to a file.\n *\n * Works only on Windows (or macOS with Parallels Desktop, via the bundled Windows VM).\n */\n readonly certificateSubjectName?: string | null\n\n /**\n * Select the signing certificate from the Windows certificate store by its SHA-1 thumbprint,\n * instead of pointing at a `.pfx` file. electron-builder looks the certificate up in the store\n * and signs with `/sha1 <thumbprint> /s <store>`. Like\n * [certificateSubjectName](#certificateSubjectName), this suits EV certificates backed by a\n * hardware token; if both are set, both must resolve to the same certificate.\n *\n * Works only on Windows (or macOS with Parallels Desktop, via the bundled Windows VM).\n */\n readonly certificateSha1?: string | null\n}\n\n// ─── Signing mode: hsm (Hardware Security Module via signtool /csp /kc) ──────\n\n/**\n * @beta HSM signing is available in v27 as a beta feature. The interface is stable but\n * real-hardware test coverage is limited.\n */\nexport interface WindowsHsmSigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting HSM / hardware-token signing via signtool's `/csp` and `/kc` flags. */\n readonly type: \"hsm\"\n\n /**\n * The name of the cryptographic service provider (CSP) that holds the private key.\n * Maps to signtool's `/csp` flag. Examples:\n * - Google Cloud KMS: `\"Google Cloud KMS Provider\"`\n * - Smart card / FIPS token: `\"Microsoft Base Smart Card Crypto Provider\"`\n *\n * Requires a modern `winCodeSign` toolset (the default; only the legacy `\"0.0.0\"` pin is\n * unsupported). Windows-only — use `type: \"pkcs11\"` on macOS/Linux.\n */\n readonly cryptoServiceProvider: string\n\n /**\n * The key container name within the CSP. Maps to signtool's `/kc` flag.\n *\n * Example for Google Cloud KMS:\n * `\"projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME/cryptoKeyVersions/1\"`\n */\n readonly keyContainer: string\n\n /**\n * Path to the certificate file containing the public certificate chain (.crt / .cer / .pfx).\n * The private key is NOT read from this file — it is provided by the HSM via `cryptoServiceProvider`.\n */\n readonly certificateFile?: string | null\n\n /**\n * Alternative to `certificateFile`: locate the public certificate in the Windows certificate\n * store by its SHA-1 thumbprint. The private key still comes from the HSM via\n * `cryptoServiceProvider` / `keyContainer`; this only identifies which public certificate to sign\n * with.\n */\n readonly certificateSha1?: string | null\n\n /**\n * Alternative to `certificateFile`: locate the public certificate in the Windows certificate\n * store by (a substring of) its subject name. The private key still comes from the HSM via\n * `cryptoServiceProvider` / `keyContainer`; this only identifies which public certificate to sign\n * with.\n */\n readonly certificateSubjectName?: string | null\n}\n\n// ─── Signing mode: pkcs11 (cross-platform PKCS#11 via osslsigncode) ──────────\n\n/**\n * Sign with a PKCS#11 hardware token (smart card, USB HSM, cloud KMS exposed via a PKCS#11\n * provider) using `osslsigncode`. Unlike `hsm`, this mode does **not** require Windows or a\n * Windows VM, so it can sign Windows binaries directly from macOS/Linux CI. The token PIN is read\n * from the `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`) environment variable.\n *\n * @beta PKCS#11 signing is available in v27 as a beta feature. The interface is stable but\n * real-hardware test coverage is limited.\n */\nexport interface WindowsPkcs11SigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting cross-platform PKCS#11 token signing via `osslsigncode`. */\n readonly type: \"pkcs11\"\n\n /**\n * Path to the PKCS#11 shared library (`.so` on Linux, `.dylib` on macOS).\n * The library must be installed separately — electron-builder does not bundle it.\n *\n * Example: `\"/usr/lib/x86_64-linux-gnu/opensc-pkcs11.so\"`\n *\n * Must be paired with `pkcs11KeyUri`.\n */\n readonly pkcs11Module: string\n\n /**\n * RFC 7512 PKCS#11 URI identifying the private key within the module.\n * Maps to osslsigncode's `-key` parameter.\n *\n * Example: `\"pkcs11:token=MyToken;object=MyKey;type=private\"`\n *\n * Must be paired with `pkcs11Module`.\n */\n readonly pkcs11KeyUri: string\n\n /**\n * Optional path to a certificate chain file to accompany the PKCS#11 key.\n * If omitted the certificate embedded in the token is used.\n */\n readonly certificateFile?: string | null\n}\n\n// ─── Signing mode: azure (Azure Trusted Signing) ──────────────────────────────\n\n/**\n * The `signtool /dlib` Azure Trusted Signing integration was introduced in `toolsets.winCodeSign: 1.3.0`.\n * The legacy PowerShell integration is deprecated, but leverages the same underlying Azure APIs, so both interfaces share the same config shape.\n */\nexport interface WindowsAzureSigningConfig {\n /** Discriminator selecting Azure Trusted Signing (cloud signing — no local certificate). */\n readonly type: \"azure\"\n\n /**\n * The publisher name to associate with the signature, exactly as it appears in the certificate\n * issued by your Trusted Signing certificate profile. Required. Used for\n * [update verification](#verifyUpdateCodeSignature) (embedded in `app-update.yml` and checked by\n * electron-updater) and must match the certificate subject.\n *\n * @see https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073\n */\n readonly publisherName: string\n\n /**\n * The Trusted Signing Account endpoint. The URI value must align to the region your Trusted\n * Signing Account and Certificate Profile were created in.\n *\n * Requires Azure Entra ID environment variables per\n * [Microsoft's documentation](https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition).\n */\n readonly endpoint: string\n\n /**\n * The name of the Trusted Signing Certificate Profile to sign with, as created in your Azure\n * Code Signing Account. Maps to the DLib metadata field `CertificateProfileName`.\n */\n readonly certificateProfileName: string\n\n /**\n * The name of the Azure Trusted Signing (Code Signing) Account that owns the certificate profile.\n * Maps to the DLib metadata field `CodeSigningAccountName`.\n */\n readonly codeSigningAccountName: string\n\n /**\n * The digest algorithm used to hash the files being signed. Maps to the DLib metadata field\n * `FileDigest`.\n * @default SHA256\n */\n readonly fileDigest?: string\n\n /**\n * The RFC3161 timestamp server. Translates to field: TimestampRfc3161.\n * @default http://timestamp.acs.microsoft.com\n */\n readonly timestampRfc3161?: string\n\n /**\n * The timestamp digest algorithm. Translates to field: TimestampDigest.\n * @default SHA256\n */\n readonly timestampDigest?: string\n\n /**\n * Additional fields to include verbatim in the `metadata.json` file passed to\n * `Azure.CodeSigning.Dlib.dll` via `signtool /dmdf`. Use this for DLib-specific options\n * not covered by the typed fields above (e.g. `ExcludeCredentials`, `CorrelationId`).\n */\n readonly additionalMetadata?: Record<string, string>\n}\n\n// ─── Discriminated union ──────────────────────────────────────────────────────\n\nexport type WindowsSigningConfiguration = WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | WindowsPkcs11SigningConfig | WindowsAzureSigningConfig\n\n/** Signing modes that use signtool.exe or osslsigncode (not Azure). */\nexport type WindowsSigntoolFamilyConfig = WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | WindowsPkcs11SigningConfig\n\n/**\n * Resolves the active signing configuration object. `false`, `null`, and unset all mean\n * \"no explicit signing config object\" (env-based discovery still applies when unset).\n */\nexport function resolveWindowsSigningConfiguration(config: WindowsConfiguration): WindowsSigningConfiguration | null {\n const { sign } = config\n return sign == null || sign === false ? null : sign\n}\n\n/** Whether Windows code signing has been explicitly disabled via `sign: false | null`. */\nexport function isWindowsSigningDisabled(config: WindowsConfiguration): boolean {\n return config.sign === false || config.sign === null\n}\n"]}
1
+ {"version":3,"file":"winOptions.js","sourceRoot":"","sources":["../../src/options/winOptions.ts"],"names":[],"mappings":"AA+ZA;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAAC,MAA4B;IAC7E,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;IACvB,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,wBAAwB,CAAC,MAA4B;IACnE,OAAO,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,CAAA;AACtD,CAAC","sourcesContent":["import { CustomWindowsSign } from \"../codeSign/win/windowsSignToolManager.js\"\nimport { TargetConfigType } from \"../core.js\"\nimport { PlatformSpecificBuildOptions } from \"./PlatformSpecificBuildOptions.js\"\n\nexport interface WindowsConfiguration extends PlatformSpecificBuildOptions {\n /**\n * The target package type: list of `nsis`, `nsis-web` (Web installer), `portable` ([portable app](https://www.electron.build/nsis#portable) without installation), `appx`, `msix`, `msi`, `msi-wrapped`, `squirrel`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`.\n * AppX and MSIX packages can be built on Windows 10 or Windows Server 2012 R2 (version 6.3+) or later, and on macOS via Parallels Desktop.\n *\n * To use Squirrel.Windows please install `electron-builder-squirrel-windows` dependency.\n *\n * @default nsis\n */\n readonly target?: TargetConfigType\n\n /**\n * The path to application icon.\n * @default build/icon.ico\n */\n readonly icon?: string | null\n\n /**\n * The trademarks and registered trademarks.\n */\n readonly legalTrademarks?: string | null\n\n /**\n * Code signing configuration. Code signing stamps every installer and executable\n * electron-builder produces with an Authenticode signature, so that Windows (SmartScreen / UAC)\n * and your auto-updater can verify the publisher and that the files were not tampered with.\n *\n * How this option behaves:\n * - Leave **unset** to sign using credentials discovered from the environment — primarily a\n * certificate supplied via `WIN_CSC_LINK` (or `CSC_LINK`) with its password in\n * `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`). `WIN_CSC_LINK` accepts a file path, an\n * `https://` URL, or a base64-encoded certificate. This is the recommended setup for CI.\n * - Set to `false` or `null` to **disable** code signing entirely (executable resources such as\n * the icon and metadata are still edited).\n * - Set to an **object** to configure signing explicitly. The **required** `type` field selects the\n * signing backend (`signtool`, `hsm`, `pkcs11`, or `azure`) and dispatches to a dedicated sign\n * manager; provide exactly one of the modes below. When `win.sign` is left unset, the `signtool`\n * backend is used with env-discovered credentials. Each output artifact is signed individually,\n * and by default executables are dual-signed (see `signingHashAlgorithms`).\n *\n * - `{ type: \"signtool\", ... }` — Sign with a local certificate file (.pfx/.p12) or a\n * certificate from the Windows certificate store. Uses Microsoft `signtool.exe` on Windows and\n * `osslsigncode` on macOS/Linux.\n * - `{ type: \"hsm\", ... }` — Sign using a Hardware Security Module (HSM) or FIPS-compliant\n * hardware token via signtool's `/csp` (cryptographic service provider) and `/kc` (key\n * container) flags. Requires a modern `winCodeSign` toolset (the default — only the legacy\n * `\"0.0.0\"` pin is unsupported). Windows-only.\n * - `{ type: \"pkcs11\", ... }` — Sign using a PKCS#11 hardware token via osslsigncode.\n * Available on macOS and Linux CI without a Windows VM.\n * - `{ type: \"azure\", ... }` — Sign via Azure Trusted Signing (cloud service). Requires\n * Azure Entra ID environment variables for authentication.\n *\n * See [Code Signing](https://www.electron.build/code-signing).\n */\n readonly sign?: WindowsSigningConfiguration | false | null\n\n /**\n * Whether the NSIS auto-updater should verify the Authenticode signature of a downloaded update\n * before installing it. This is a **runtime** check performed by your app via electron-updater,\n * not a build-time check.\n *\n * When enabled (the default), the resolved [publisher name](#publisherName) is embedded into\n * `app-update.yml` at build time. At update time electron-updater inspects the certificate that\n * signed the downloaded installer and compares its subject (Distinguished Name / Common Name)\n * against that publisher name, refusing to install on a mismatch. This prevents a tampered or\n * maliciously substituted update from being installed.\n *\n * Set to `false` to skip verification — in which case the publisher name is **not** embedded.\n * Disable this only if your updates are not Authenticode-signed.\n *\n * @default true\n */\n readonly verifyUpdateCodeSignature?: boolean\n\n /**\n * The [security level](https://msdn.microsoft.com/en-us/library/6ad1fshk.aspx#Anchor_9) at which the application requests to be executed.\n * Cannot be specified per target, allowed only in the `win`.\n * @default asInvoker\n */\n readonly requestedExecutionLevel?: RequestedExecutionLevel | null\n\n /**\n * Additional file name suffixes to code sign, beyond the default. By default electron-builder\n * only signs `.exe` files; list extra suffixes here to also sign e.g. `.dll`, `.node`, or\n * specific file names. Advanced option — most apps do not need it.\n *\n * Each entry is matched with `String.endsWith`, so both bare extensions (`\".dll\"`) and full file\n * names (`\"mybinary.dll\"`) work. Prefix a pattern with `!` to *exclude* a suffix that would\n * otherwise be signed. Positive patterns are evaluated first, then negative ones. For example,\n * `[\"somefilename\", \".dll\", \"!.appx\"]` signs `.dll` files (and anything ending in `somefilename`)\n * but never signs `.appx` files.\n *\n * @see https://github.com/electron-userland/electron-builder/issues/7329\n * @default null\n */\n readonly signExts?: string[] | null\n}\n\nexport type RequestedExecutionLevel = \"asInvoker\" | \"highestAvailable\" | \"requireAdministrator\"\n\n// ─── Shared base for signtool-family signing modes ───────────────────────────\n\n/**\n * Options shared by every certificate-based signing mode (`signtool`, `hsm`, `pkcs11`). These\n * control the signature itself — publisher identity, digest algorithms, timestamping, and the\n * extra certificates added to the signature block — independently of where the private key lives.\n */\ninterface WindowsSigningSharedOptions {\n /**\n * The publisher name(s) to associate with the signature, written exactly as the subject appears\n * in your code signing certificate. May be a single string or an array — an array is useful when\n * rotating certificates, so updates signed by either the old or the new certificate still verify.\n *\n * This value is not a `signtool` argument; it is consumed in two places:\n * - **Update verification** — when [verifyUpdateCodeSignature](#verifyUpdateCodeSignature) is\n * enabled, it is written into `app-update.yml` and electron-updater checks it against the\n * certificate that signed each downloaded update.\n * - **AppX / MSIX identity** — the package `Publisher` attribute must equal the certificate\n * subject, so electron-builder derives it from this value (or the certificate) to keep them\n * in sync; a mismatch makes packaging fail with `ERROR_BAD_FORMAT`.\n *\n * Defaults to the Common Name (CN) extracted from your code signing certificate. Set to `null`\n * to opt out.\n *\n * @see https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073\n */\n readonly publisherName?: string | Array<string> | null\n\n /**\n * The digest (hash) algorithms to sign with, applied via signtool's `/fd` flag (or\n * osslsigncode's `-h`). One signing pass runs per entry, in order; listing more than one\n * **dual-signs** the file, with each additional signature appended as a nested signature\n * (signtool `/as`). Signing with both `sha1` and `sha256` lets a single binary validate on\n * legacy (pre-SHA-2) Windows as well as modern Windows.\n *\n * Some targets override this: `.msi` cannot be dual-signed (a single hash is used) and AppX/MSIX\n * is always `sha256` only.\n *\n * @default ['sha1', 'sha256']\n */\n readonly signingHashAlgorithms?: Array<\"sha1\" | \"sha256\"> | null\n\n /**\n * The URL of the [RFC 3161](https://www.ietf.org/rfc/rfc3161.txt) timestamp server, used for\n * SHA-256 and nested/appended signatures (signtool's `/tr` flag). Timestamping records *when*\n * the file was signed so the signature stays valid after the signing certificate expires.\n * Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE=true`.\n *\n * @default http://timestamp.digicert.com\n */\n readonly rfc3161TimeStampServer?: string | null\n\n /**\n * The URL of the legacy Authenticode timestamp server, used for SHA-1 signatures (signtool's\n * `/t` flag). This is also the timestamp server used by `osslsigncode` (`-t`) when signing on\n * macOS/Linux. See [rfc3161TimeStampServer](#rfc3161TimeStampServer) for SHA-256 / nested\n * signatures. Ignored when the build runs with `ELECTRON_BUILDER_OFFLINE=true`.\n *\n * @default http://timestamp.digicert.com\n */\n readonly timeStampServer?: string | null\n\n /**\n * Path to an additional certificate file (typically an intermediate / cross-signing CA\n * certificate) whose contents are added to the signature block via signtool's `/ac` flag. Use\n * this when the signing certificate's full chain is not already present on target machines and\n * you want it embedded in the signature so the chain can be validated.\n */\n readonly additionalCertificateFile?: string | null\n\n /**\n * A custom signing hook that **replaces** electron-builder's built-in `signtool` /\n * `osslsigncode` invocation. Provide a function, or the path / module id of a file that exports\n * a `sign` function (resolved relative to the project, then as a module).\n *\n * The hook is invoked once per signing pass (i.e. once per entry in\n * [signingHashAlgorithms](#signingHashAlgorithms)) and receives a configuration object describing\n * the file to sign (`path`), the resolved certificate info (`cscInfo`), the current `hash`, and\n * whether this pass is a nested signature (`isNest`), plus a `computeSignToolArgs(isWin)` helper\n * that returns the default arguments electron-builder would otherwise have used. Use this to\n * integrate an external or cloud signing service. See\n * [Code Signing](https://www.electron.build/code-signing).\n */\n readonly sign?: CustomWindowsSign | string | null\n}\n\n// ─── Signing mode: signtool (file or Windows certificate store) ──────────────\n\n/**\n * Sign with a certificate file (`.pfx` / `.p12`) or with a certificate from the Windows\n * certificate store, using Microsoft `signtool.exe` on Windows and `osslsigncode` on macOS/Linux.\n * This is the default mode when `win.sign` is unset. Supply the certificate one of four ways:\n * a file via `certificateFile` (or the `WIN_CSC_LINK` env var), or a store lookup via\n * `certificateSubjectName` or `certificateSha1`.\n */\nexport interface WindowsSigntoolSigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting the default file/store signing mode. */\n readonly type: \"signtool\"\n\n /**\n * Path to the PKCS#12 certificate file (`.pfx` or `.p12`) holding both the signing certificate\n * and its private key. Passed to signtool via `/f` (or osslsigncode via `-pkcs12`).\n *\n * Prefer supplying this out-of-band via the `WIN_CSC_LINK` (or `CSC_LINK`) environment variable\n * instead of hardcoding a path — that variable also accepts an `https://` URL or a base64-encoded\n * certificate, which is safer and more convenient on CI. See\n * [Code Signing](https://www.electron.build/code-signing).\n */\n readonly certificateFile?: string | null\n\n /**\n * The password protecting the private key in `certificateFile`. Passed to signtool via `/p`\n * (or osslsigncode via `-pass`).\n *\n * Prefer the `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`) environment variable so the secret\n * never lands in your build configuration.\n */\n readonly certificatePassword?: string | null\n\n /**\n * Select the signing certificate from the Windows certificate store by (a substring of) its\n * subject name, instead of pointing at a `.pfx` file. electron-builder enumerates the installed\n * code-signing certificates, picks the match, and signs by its thumbprint\n * (`/sha1 <thumbprint> /s <store>`). **Required for EV (Extended Validation) certificates**,\n * whose private keys live on a hardware token and cannot be exported to a file.\n *\n * Works only on Windows (or macOS with Parallels Desktop, via the bundled Windows VM).\n */\n readonly certificateSubjectName?: string | null\n\n /**\n * Select the signing certificate from the Windows certificate store by its SHA-1 thumbprint,\n * instead of pointing at a `.pfx` file. electron-builder looks the certificate up in the store\n * and signs with `/sha1 <thumbprint> /s <store>`. Like\n * [certificateSubjectName](#certificateSubjectName), this suits EV certificates backed by a\n * hardware token; if both are set, both must resolve to the same certificate.\n *\n * Works only on Windows (or macOS with Parallels Desktop, via the bundled Windows VM).\n */\n readonly certificateSha1?: string | null\n}\n\n// ─── Signing mode: hsm (Hardware Security Module via signtool /csp /kc) ──────\n\n/**\n * @beta HSM signing is available in v27 as a beta feature. The interface is stable but\n * real-hardware test coverage is limited.\n */\nexport interface WindowsHsmSigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting HSM / hardware-token signing via signtool's `/csp` and `/kc` flags. */\n readonly type: \"hsm\"\n\n /**\n * The name of the cryptographic service provider (CSP) that holds the private key.\n * Maps to signtool's `/csp` flag. Examples:\n * - Google Cloud KMS: `\"Google Cloud KMS Provider\"`\n * - Smart card / FIPS token: `\"Microsoft Base Smart Card Crypto Provider\"`\n *\n * Requires a modern `winCodeSign` toolset (the default; only the legacy `\"0.0.0\"` pin is\n * unsupported). Windows-only — use `type: \"pkcs11\"` on macOS/Linux.\n */\n readonly cryptoServiceProvider: string\n\n /**\n * The key container name within the CSP. Maps to signtool's `/kc` flag.\n *\n * Example for Google Cloud KMS:\n * `\"projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME/cryptoKeyVersions/1\"`\n */\n readonly keyContainer: string\n\n /**\n * Path to the certificate file containing the public certificate chain (.crt / .cer / .pfx).\n * The private key is NOT read from this file — it is provided by the HSM via `cryptoServiceProvider`.\n */\n readonly certificateFile?: string | null\n\n /**\n * Alternative to `certificateFile`: locate the public certificate in the Windows certificate\n * store by its SHA-1 thumbprint. The private key still comes from the HSM via\n * `cryptoServiceProvider` / `keyContainer`; this only identifies which public certificate to sign\n * with.\n */\n readonly certificateSha1?: string | null\n\n /**\n * Alternative to `certificateFile`: locate the public certificate in the Windows certificate\n * store by (a substring of) its subject name. The private key still comes from the HSM via\n * `cryptoServiceProvider` / `keyContainer`; this only identifies which public certificate to sign\n * with.\n */\n readonly certificateSubjectName?: string | null\n}\n\n// ─── Signing mode: pkcs11 (cross-platform PKCS#11 via osslsigncode) ──────────\n\n/**\n * Sign with a PKCS#11 hardware token (smart card, USB HSM, cloud KMS exposed via a PKCS#11\n * provider) using `osslsigncode`. Unlike `hsm`, this mode does **not** require Windows or a\n * Windows VM, so it can sign Windows binaries directly from macOS/Linux CI. The token PIN is read\n * from the `WIN_CSC_KEY_PASSWORD` (or `CSC_KEY_PASSWORD`) environment variable.\n *\n * @beta PKCS#11 signing is available in v27 as a beta feature. The interface is stable but\n * real-hardware test coverage is limited.\n */\nexport interface WindowsPkcs11SigningConfig extends WindowsSigningSharedOptions {\n /** Discriminator selecting cross-platform PKCS#11 token signing via `osslsigncode`. */\n readonly type: \"pkcs11\"\n\n /**\n * Path to the PKCS#11 shared library (`.so` on Linux, `.dylib` on macOS).\n * The library must be installed separately — electron-builder does not bundle it.\n *\n * Example: `\"/usr/lib/x86_64-linux-gnu/opensc-pkcs11.so\"`\n *\n * Must be paired with `pkcs11KeyUri`.\n */\n readonly pkcs11Module: string\n\n /**\n * RFC 7512 PKCS#11 URI identifying the private key within the module.\n * Maps to osslsigncode's `-key` parameter.\n *\n * Example: `\"pkcs11:token=MyToken;object=MyKey;type=private\"`\n *\n * Must be paired with `pkcs11Module`.\n */\n readonly pkcs11KeyUri: string\n\n /**\n * Optional path to a certificate chain file to accompany the PKCS#11 key.\n * If omitted the certificate embedded in the token is used.\n */\n readonly certificateFile?: string | null\n}\n\n// ─── Signing mode: azure (Azure Trusted Signing) ──────────────────────────────\n\n/**\n * The `signtool /dlib` Azure Trusted Signing integration was introduced in `toolsets.winCodeSign: 1.3.0`.\n * The legacy PowerShell integration is deprecated, but leverages the same underlying Azure APIs, so both interfaces share the same config shape.\n */\nexport interface WindowsAzureSigningConfig {\n /** Discriminator selecting Azure Trusted Signing (cloud signing — no local certificate). */\n readonly type: \"azure\"\n\n /**\n * The publisher name to associate with the signature, exactly as it appears in the certificate\n * issued by your Trusted Signing certificate profile. Required. Used for\n * [update verification](#verifyUpdateCodeSignature) (embedded in `app-update.yml` and checked by\n * electron-updater) and must match the certificate subject.\n *\n * @see https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073\n */\n readonly publisherName: string\n\n /**\n * The Trusted Signing Account endpoint. The URI value must align to the region your Trusted\n * Signing Account and Certificate Profile were created in.\n *\n * Requires Azure Entra ID environment variables per\n * [Microsoft's documentation](https://learn.microsoft.com/en-us/dotnet/api/azure.identity.environmentcredential?view=azure-dotnet#definition).\n */\n readonly endpoint: string\n\n /**\n * The name of the Trusted Signing Certificate Profile to sign with, as created in your Azure\n * Code Signing Account. Maps to the DLib metadata field `CertificateProfileName`.\n */\n readonly certificateProfileName: string\n\n /**\n * The name of the Azure Trusted Signing (Code Signing) Account that owns the certificate profile.\n * Maps to the DLib metadata field `CodeSigningAccountName`.\n */\n readonly codeSigningAccountName: string\n\n /**\n * The digest algorithm used to hash the files being signed. Maps to the DLib metadata field\n * `FileDigest`.\n * @default SHA256\n */\n readonly fileDigest?: string\n\n /**\n * The RFC3161 timestamp server. Translates to field: TimestampRfc3161.\n * @default http://timestamp.acs.microsoft.com\n */\n readonly timestampRfc3161?: string\n\n /**\n * The timestamp digest algorithm. Translates to field: TimestampDigest.\n * @default SHA256\n */\n readonly timestampDigest?: string\n\n /**\n * Additional fields to include verbatim in the `metadata.json` file passed to\n * `Azure.CodeSigning.Dlib.dll` via `signtool /dmdf`. Use this for DLib-specific options\n * not covered by the typed fields above (e.g. `ExcludeCredentials`, `CorrelationId`).\n */\n readonly additionalMetadata?: Record<string, string>\n}\n\n// ─── Discriminated union ──────────────────────────────────────────────────────\n\nexport type WindowsSigningConfiguration = WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | WindowsPkcs11SigningConfig | WindowsAzureSigningConfig\n\n/** Signing modes that use signtool.exe or osslsigncode (not Azure). */\nexport type WindowsSigntoolFamilyConfig = WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | WindowsPkcs11SigningConfig\n\n/**\n * Resolves the active signing configuration object. `false`, `null`, and unset all mean\n * \"no explicit signing config object\" (env-based discovery still applies when unset).\n */\nexport function resolveWindowsSigningConfiguration(config: WindowsConfiguration): WindowsSigningConfiguration | null {\n const { sign } = config\n return sign == null || sign === false ? null : sign\n}\n\n/** Whether Windows code signing has been explicitly disabled via `sign: false | null`. */\nexport function isWindowsSigningDisabled(config: WindowsConfiguration): boolean {\n return config.sign === false || config.sign === null\n}\n"]}
package/dist/packager.js CHANGED
@@ -239,7 +239,7 @@ export class Packager {
239
239
  if (this.isTwoPackageJsonProjectLayoutUsed) {
240
240
  log.debug({ devPackageFile, appPackageFile }, "two package.json structure is used");
241
241
  }
242
- checkMetadata(this.metadata, this.devMetadata, appPackageFile, devPackageFile);
242
+ checkMetadata(this.metadata, this.devMetadata, appPackageFile, devPackageFile, projectDir);
243
243
  await validateConfiguration(configuration, this.debugLogger);
244
244
  this._configuration = configuration;
245
245
  this._devMetadata = devMetadata;
@@ -1 +1 @@
1
- {"version":3,"file":"packager.js","sourceRoot":"","sources":["../src/packager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,yBAAyB,EACzB,GAAG,EACH,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,MAAM,GACP,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAE3E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,IAAI,CAAA;AAC5C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,QAAQ,EAAgC,MAAM,WAAW,CAAA;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,iCAAiC,CAAA;AAChF,OAAO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,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAChB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;SAChB,IAAI,EAAE;SACN,GAAG,CAAC,GAAG,CAAC,EAAE;QACT,OAAO,MAAM,CAAC,GAAG,CAAC;aACf,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,oBAAoB,CAAC;aAClD,IAAI,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;IACxC,CAAC,CAAC,CACL,CAAA;AACH,CAAC;AASD,SAAS,sBAAsB,CAAC,aAA4B;IAC1D,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC,CAAA;IACtD,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;QACtB,CAAC,CAAC,OAAO,GAAG,qBAAqB,CAAA;IACnC,CAAC;IACD,OAAO,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;AACjC,CAAC","sourcesContent":["import {\n Arch,\n archFromString,\n AsyncTaskManager,\n DebugLogger,\n executeFinally,\n getArtifactArchName,\n InvalidConfigurationError,\n log,\n MAX_FILE_REQUESTS,\n orNullIfFileNotExist,\n sanitizeDirPath,\n safeStringifyJson,\n serializeToYaml,\n TmpDir,\n} from \"builder-util\"\nimport { CancellationToken, deepAssign, retry } from \"builder-util-runtime\"\n\nimport { isCI } from \"ci-info\"\nimport { Lazy } from \"lazy-val\"\nimport { release as getOsRelease } from \"os\"\nimport * as path from \"path\"\nimport { AppInfo } from \"./appInfo.js\"\nimport { readAsarJson } from \"./asar/asar.js\"\nimport { AfterExtractContext, AfterPackContext, BeforePackContext, Configuration, Hook } from \"./configuration.js\"\nimport { Platform, SourceRepositoryInfo, Target } from \"./core.js\"\nimport { createElectronFrameworkSupport } from \"./electron/ElectronFramework.js\"\nimport { assertElectronArchSupported } from \"./electron/electronArchSupport.js\"\nimport { Framework, isElectronBased } from \"./Framework.js\"\nimport { Metadata } from \"./options/metadata.js\"\nimport { ArtifactBuildStarted, ArtifactCreated, PackagerOptions } from \"./packagerApi.js\"\nimport { PlatformPackager } from \"./platformPackager.js\"\nimport { addTargetsForPlatform, computeArchToTargetNamesMap, createTargets, NoOpTarget } from \"./targets/targetFactory.js\"\nimport { computeDefaultAppDirectory, getConfig, validateConfiguration } from \"./util/config/config.js\"\nimport { expandMacro } from \"./util/macroExpander.js\"\nimport { checkMetadata, readPackageJson } from \"./util/packageMetadata.js\"\nimport { getRepositoryInfo } from \"./util/repositoryInfo.js\"\nimport { resolveFunction } from \"./util/resolve.js\"\nimport { installOrRebuild, nodeGypRebuild } from \"./util/installOrRebuild.js\"\nimport { PACKAGE_VERSION } from \"./version.js\"\nimport { AsyncEventEmitter, HandlerType } from \"./util/asyncEventEmitter.js\"\nimport asyncPool from \"tiny-async-pool\"\nimport { determinePackageManagerEnv, PM } from \"./node-module-collector/index.js\"\nimport _fsExtra from \"fs-extra\"\nconst { chmod, mkdirs, outputFile } = _fsExtra\nimport { setSevenZipPath } from \"./toolsets/7zip.js\"\nimport { getCustomToolsetPath } from \"./toolsets/custom.js\"\n\ntype PackagerEvents = {\n artifactBuildStarted: Hook<ArtifactBuildStarted, void>\n\n beforePack: Hook<BeforePackContext, void>\n afterExtract: Hook<AfterExtractContext, void>\n afterPack: Hook<AfterPackContext, void>\n afterSign: Hook<AfterPackContext, void>\n\n artifactBuildCompleted: Hook<ArtifactCreated, void>\n\n msiProjectCreated: Hook<string, void>\n appxManifestCreated: Hook<string, void>\n\n // internal-use only, prefer usage of `artifactBuildCompleted`\n artifactCreated: Hook<ArtifactCreated, void>\n}\n\nexport class Packager {\n readonly projectDir: string\n\n private _appDir: string\n get appDir(): string {\n return this._appDir\n }\n\n private readonly _packageManager: Lazy<{ pm: PM; workspaceRoot: Promise<string | undefined> }>\n async getPackageManager(): Promise<PM> {\n return (await this._packageManager.value).pm\n }\n async getWorkspaceRoot(): Promise<string> {\n return (await (await this._packageManager.value).workspaceRoot) || this.projectDir\n }\n\n /** Stores original metadata merged with extraMetadata from configuration. */\n private _metadata: Metadata | null = null\n get metadata(): Metadata {\n return this._metadata!\n }\n\n /** Stores original metadata from package.json before merging with extraMetadata. */\n private _originalMetadata: Metadata | null = null\n get originalMetadata(): Metadata {\n return this._originalMetadata!\n }\n\n /** The \"name\" field from package.json. */\n get nodePackageName() {\n return this.originalMetadata.name!\n }\n\n private _nodeModulesHandledExternally = false\n\n get areNodeModulesHandledExternally(): boolean {\n return this._nodeModulesHandledExternally\n }\n\n private _isPrepackedAppAsar = false\n\n get isPrepackedAppAsar(): boolean {\n return this._isPrepackedAppAsar\n }\n\n private _devMetadata: Metadata | null = null\n get devMetadata(): Metadata | null {\n return this._devMetadata\n }\n\n private _configuration: Configuration | null = null\n\n get config(): Configuration {\n return this._configuration!\n }\n\n isTwoPackageJsonProjectLayoutUsed = false\n\n private readonly eventEmitter = new AsyncEventEmitter<PackagerEvents>()\n\n _appInfo: AppInfo | null = null\n get appInfo(): AppInfo {\n return this._appInfo!\n }\n\n readonly tempDirManager = new TmpDir(\"packager\")\n\n // Tasks that must run after EVERY target has finished building — the only point at which the\n // shared appOutDir can be mutated without racing a concurrent target that reads it. Used by NSIS\n // to write elevate.exe into win-unpacked without it leaking into Squirrel/zip/etc. (see #9852).\n private readonly buildFinalizeTasks: Array<() => Promise<void>> = []\n\n addBuildFinalizeTask(task: () => Promise<void>): void {\n this.buildFinalizeTasks.push(task)\n }\n\n private _repositoryInfo = new Lazy<SourceRepositoryInfo | null>(() => getRepositoryInfo(this.projectDir, this.metadata, this.devMetadata))\n\n readonly options: PackagerOptions\n\n readonly debugLogger = new DebugLogger(log.isDebugEnabled)\n\n get repositoryInfo(): Promise<SourceRepositoryInfo | null> {\n return this._repositoryInfo.value\n }\n\n private runtimeEnvironmentVariables: NodeJS.ProcessEnv = {}\n\n stageDirPathCustomizer: (target: Target, packager: PlatformPackager<any>, arch: Arch) => string = (target, packager, arch) => {\n return path.join(target.outDir, `__${target.name}-${getArtifactArchName(arch, target.name)}`)\n }\n\n private _buildResourcesDir: string | null = null\n\n get buildResourcesDir(): string {\n let result = this._buildResourcesDir\n if (result == null) {\n result = path.resolve(this.projectDir, this.relativeBuildResourcesDirname)\n this._buildResourcesDir = result\n }\n return result\n }\n\n get relativeBuildResourcesDirname(): string {\n return this.config.directories!.buildResources!\n }\n\n private _framework: Framework | null = null\n get framework(): Framework {\n return this._framework!\n }\n\n private readonly toDispose: Array<() => Promise<void>> = []\n\n disposeOnBuildFinish(disposer: () => Promise<void>) {\n this.toDispose.push(disposer)\n }\n\n //noinspection JSUnusedGlobalSymbols\n constructor(\n options: PackagerOptions,\n readonly cancellationToken = new CancellationToken()\n ) {\n const targets = options.targets || new Map<Platform, Map<Arch, Array<string>>>()\n if (options.targets == null) {\n options.targets = targets\n }\n\n function processTargets(platform: Platform, types: Array<string>) {\n function commonArch(currentIfNotSpecified: boolean): Array<Arch> {\n const result = Array<Arch>()\n return result.length === 0 && currentIfNotSpecified ? [archFromString(process.arch)] : result\n }\n\n addTargetsForPlatform(targets, platform, types, commonArch, archToType => {\n for (const arch of commonArch(false)) {\n archToType.set(arch, [])\n }\n })\n }\n\n if (options.mac != null) {\n processTargets(Platform.MAC, options.mac)\n }\n if (options.linux != null) {\n processTargets(Platform.LINUX, options.linux)\n }\n if (options.win != null) {\n processTargets(Platform.WINDOWS, options.win)\n }\n\n this.projectDir = sanitizeDirPath(options.projectDir == null ? process.cwd() : options.projectDir)\n this._appDir = this.projectDir\n this._packageManager = determinePackageManagerEnv({ projectDir: this.projectDir, appDir: this.appDir, workspaceRoot: undefined })\n\n this.options = {\n ...options,\n prepackaged: options.prepackaged == null ? null : sanitizeDirPath(path.resolve(this.projectDir, options.prepackaged)),\n }\n\n log.info({ version: PACKAGE_VERSION, os: getOsRelease() }, \"electron-builder\")\n }\n\n private async addPackagerEventHandlers() {\n const { type } = this.appInfo\n const root = await this.getWorkspaceRoot()\n this.eventEmitter.on(\"artifactBuildStarted\", await resolveFunction(type, this.config.artifactBuildStarted, \"artifactBuildStarted\", root), \"user\")\n this.eventEmitter.on(\"artifactBuildCompleted\", await resolveFunction(type, this.config.artifactBuildCompleted, \"artifactBuildCompleted\", root), \"user\")\n\n this.eventEmitter.on(\"appxManifestCreated\", await resolveFunction(type, this.config.appxManifestCreated, \"appxManifestCreated\", root), \"user\")\n this.eventEmitter.on(\"msiProjectCreated\", await resolveFunction(type, this.config.msiProjectCreated, \"msiProjectCreated\", root), \"user\")\n\n this.eventEmitter.on(\"beforePack\", await resolveFunction(type, this.config.beforePack, \"beforePack\", root), \"user\")\n this.eventEmitter.on(\"afterExtract\", await resolveFunction(type, this.config.afterExtract, \"afterExtract\", root), \"user\")\n this.eventEmitter.on(\"afterPack\", await resolveFunction(type, this.config.afterPack, \"afterPack\", root), \"user\")\n this.eventEmitter.on(\"afterSign\", await resolveFunction(type, this.config.afterSign, \"afterSign\", root), \"user\")\n }\n\n onAfterPack(handler: PackagerEvents[\"afterPack\"]): Packager {\n this.eventEmitter.on(\"afterPack\", handler)\n return this\n }\n\n onArtifactCreated(handler: PackagerEvents[\"artifactCreated\"]): Packager {\n this.eventEmitter.on(\"artifactCreated\", handler)\n return this\n }\n\n filterPackagerEventListeners(event: keyof PackagerEvents, type: HandlerType | undefined) {\n return this.eventEmitter.filterListeners(event, type)\n }\n\n clearPackagerEventListeners() {\n this.eventEmitter.clear()\n }\n\n async emitArtifactBuildStarted(event: ArtifactBuildStarted, logFields?: any) {\n log.info(\n logFields || {\n target: event.targetPresentableName,\n arch: event.arch == null ? null : Arch[event.arch],\n file: log.filePath(event.file),\n },\n \"building\"\n )\n await this.eventEmitter.emit(\"artifactBuildStarted\", event)\n }\n\n /**\n * Only for sub artifacts (update info), for main artifacts use `callArtifactBuildCompleted`.\n */\n async emitArtifactCreated(event: ArtifactCreated) {\n await this.eventEmitter.emit(\"artifactCreated\", event)\n }\n\n async emitArtifactBuildCompleted(event: ArtifactCreated) {\n await this.eventEmitter.emit(\"artifactBuildCompleted\", event)\n await this.emitArtifactCreated(event)\n }\n\n async emitAppxManifestCreated(path: string) {\n await this.eventEmitter.emit(\"appxManifestCreated\", path)\n }\n\n async emitMsiProjectCreated(path: string) {\n await this.eventEmitter.emit(\"msiProjectCreated\", path)\n }\n\n async emitBeforePack(context: BeforePackContext) {\n await this.eventEmitter.emit(\"beforePack\", context)\n }\n\n async emitAfterPack(context: AfterPackContext) {\n await this.eventEmitter.emit(\"afterPack\", context)\n }\n\n async emitAfterSign(context: AfterPackContext) {\n await this.eventEmitter.emit(\"afterSign\", context)\n }\n\n async emitAfterExtract(context: AfterPackContext) {\n await this.eventEmitter.emit(\"afterExtract\", context)\n }\n\n async validateConfig(): Promise<void> {\n let configPath: string | null = null\n let configFromOptions = this.options.config\n if (typeof configFromOptions === \"string\") {\n // it is a path to config file\n configPath = configFromOptions\n configFromOptions = null\n } else if (configFromOptions != null && typeof configFromOptions.extends === \"string\" && configFromOptions.extends.includes(\".\")) {\n configPath = configFromOptions.extends\n delete configFromOptions.extends\n }\n\n const projectDir = this.projectDir\n\n const devPackageFile = path.join(projectDir, \"package.json\")\n this._devMetadata = await orNullIfFileNotExist(readPackageJson(devPackageFile))\n\n const devMetadata = this.devMetadata\n const configuration = await getConfig(projectDir, configPath, configFromOptions, new Lazy(() => Promise.resolve(devMetadata)))\n\n log.debug({ config: getSafeEffectiveConfig(configuration) }, \"effective config\")\n\n this._appDir = await computeDefaultAppDirectory(projectDir, configuration.directories!.app)\n this.isTwoPackageJsonProjectLayoutUsed = this._appDir !== projectDir\n\n const appPackageFile = this.isTwoPackageJsonProjectLayoutUsed ? path.join(this.appDir, \"package.json\") : devPackageFile\n\n // tslint:disable:prefer-conditional-expression\n if (this.devMetadata != null && !this.isTwoPackageJsonProjectLayoutUsed) {\n this._metadata = this.devMetadata\n } else {\n this._metadata = await this.readProjectMetadataIfTwoPackageStructureOrPrepacked(appPackageFile)\n }\n this._originalMetadata = deepAssign({}, this._metadata)\n deepAssign(this._metadata, configuration.extraMetadata)\n\n if (this.isTwoPackageJsonProjectLayoutUsed) {\n log.debug({ devPackageFile, appPackageFile }, \"two package.json structure is used\")\n }\n checkMetadata(this.metadata, this.devMetadata, appPackageFile, devPackageFile)\n\n await validateConfiguration(configuration, this.debugLogger)\n\n this._configuration = configuration\n this._devMetadata = devMetadata\n }\n\n // external caller of this method always uses isTwoPackageJsonProjectLayoutUsed=false and appDir=projectDir, no way (and need) to use another values\n async build(repositoryInfo?: SourceRepositoryInfo): Promise<BuildResult> {\n await this.validateConfig()\n\n if (repositoryInfo != null) {\n this._repositoryInfo.value = Promise.resolve(repositoryInfo)\n }\n\n this._appInfo = new AppInfo(this, null)\n await this.addPackagerEventHandlers()\n\n this._framework = await createElectronFrameworkSupport(this.config, this)\n\n const commonOutDirWithoutPossibleOsMacro = path.resolve(\n this.projectDir,\n expandMacro(this.config.directories!.output!, null, this._appInfo, {\n os: \"\",\n })\n )\n\n if (!isCI && (process.stdout as any).isTTY) {\n const effectiveConfigFile = path.join(commonOutDirWithoutPossibleOsMacro, \"builder-effective-config.yaml\")\n log.info({ file: log.filePath(effectiveConfigFile) }, \"writing effective config\")\n await outputFile(effectiveConfigFile, getSafeEffectiveConfig(this.config))\n }\n\n // because artifact event maybe dispatched several times for different publish providers\n const artifactPaths = new Set<string>()\n this.onArtifactCreated(event => {\n if (event.file != null) {\n artifactPaths.add(event.file)\n }\n })\n\n this.disposeOnBuildFinish(() =>\n retry(() => this.tempDirManager.cleanup(), {\n retries: 2,\n interval: 2000,\n backoff: 2000,\n cancellationToken: this.cancellationToken,\n shouldRetry: e => {\n const message: string = e?.message || \"\"\n const code = e?.code\n // windows file locks\n const resourceIsBusy = message.includes(\"EBUSY\") || code === \"EBUSY\"\n if (resourceIsBusy) {\n log.debug({ error: message || code }, \"retrying temporary directory cleanup\")\n return true\n }\n return false\n },\n })\n )\n\n const platformToTargets = await executeFinally(this.doBuild(), async () => {\n if (this.debugLogger.isEnabled) {\n await this.debugLogger.save(path.join(commonOutDirWithoutPossibleOsMacro, \"builder-debug.yml\"))\n }\n\n const toDispose = this.toDispose.slice()\n this.toDispose.length = 0\n for (const disposer of toDispose) {\n await disposer().catch((e: any) => {\n log.warn({ error: e }, \"cannot dispose\")\n })\n }\n })\n\n return {\n outDir: commonOutDirWithoutPossibleOsMacro,\n artifactPaths: Array.from(artifactPaths),\n platformToTargets,\n configuration: this.config,\n }\n }\n\n private async readProjectMetadataIfTwoPackageStructureOrPrepacked(appPackageFile: string): Promise<Metadata> {\n let data = await orNullIfFileNotExist(readPackageJson(appPackageFile))\n if (data != null) {\n return data\n }\n\n data = await orNullIfFileNotExist(readAsarJson(path.join(this.projectDir, \"app.asar\"), \"package.json\"))\n if (data != null) {\n this._isPrepackedAppAsar = true\n return data\n }\n\n throw new Error(`Cannot find package.json in the ${path.dirname(appPackageFile)}`)\n }\n\n private async doBuild(): Promise<Map<Platform, Map<string, Target>>> {\n const sevenZipConfig = this.config.toolsets?.sevenZip\n if (typeof sevenZipConfig === \"object\" && sevenZipConfig != null) {\n const toolDir = await getCustomToolsetPath(sevenZipConfig, this.buildResourcesDir)\n const bin = path.join(toolDir, \"bin\", process.platform === \"win32\" ? \"7za.exe\" : \"7za\")\n if (process.platform !== \"win32\") {\n await chmod(bin, 0o755)\n }\n setSevenZipPath(bin)\n }\n\n const taskManager = new AsyncTaskManager(this.cancellationToken)\n const syncTargetsIfAny = [] as Target[]\n\n const platformToTarget = new Map<Platform, Map<string, Target>>()\n const createdOutDirs = new Set<string>()\n\n for (const [platform, archToType] of this.options.targets!) {\n if (this.cancellationToken.cancelled) {\n break\n }\n\n if (platform === Platform.MAC && process.platform === Platform.WINDOWS.nodeName) {\n throw new InvalidConfigurationError(\"Build for macOS is supported only on macOS, please see https://electron.build/multi-platform-build\")\n }\n\n const packager = await this.createHelper(platform)\n const nameToTarget: Map<string, Target> = new Map()\n platformToTarget.set(platform, nameToTarget)\n\n let poolCount = Math.floor(packager.config.concurrency?.jobs || 1)\n if (poolCount < 1) {\n log.warn({ concurrency: poolCount }, \"concurrency is invalid, overriding with job count: 1\")\n poolCount = 1\n } else if (poolCount > MAX_FILE_REQUESTS) {\n log.warn(\n { concurrency: poolCount, MAX_FILE_REQUESTS },\n `job concurrency is greater than recommended MAX_FILE_REQUESTS, this may lead to File Descriptor errors (too many files open). Proceed with caution (e.g. this is an experimental feature)`\n )\n }\n const packPromises: Promise<any>[] = []\n\n for (const [arch, targetNames] of computeArchToTargetNamesMap(archToType, packager, platform)) {\n if (this.cancellationToken.cancelled) {\n break\n }\n\n // fail fast when the requested arch has no official Electron build anymore (Electron 44 removed win32-ia32 and linux-armv7l);\n // skipped for prepackaged apps since nothing is downloaded then\n if (this.options.prepackaged == null && isElectronBased(this.framework)) {\n assertElectronArchSupported(platform, arch, this.framework.version, this.config)\n }\n\n // support os and arch macro in output value\n const outDir = path.resolve(this.projectDir, packager.expandMacro(this.config.directories!.output!, Arch[arch]))\n const targetList = createTargets(nameToTarget, targetNames.length === 0 ? packager.defaultTarget : targetNames, outDir, packager)\n await createOutDirIfNeed(targetList, createdOutDirs)\n const promise = packager.pack(outDir, arch, targetList, taskManager)\n if (poolCount < 2) {\n await promise\n } else {\n packPromises.push(promise)\n }\n }\n\n await asyncPool(poolCount, packPromises, async it => {\n if (this.cancellationToken.cancelled) {\n return\n }\n await it\n })\n\n if (this.cancellationToken.cancelled) {\n break\n }\n\n for (const target of nameToTarget.values()) {\n if (target.isAsyncSupported) {\n taskManager.addTask(target.finishBuild())\n } else {\n syncTargetsIfAny.push(target)\n }\n }\n }\n\n await taskManager.awaitTasks()\n\n for (const target of syncTargetsIfAny) {\n if (this.cancellationToken.cancelled) {\n break\n }\n await target.finishBuild()\n }\n\n // Every target has now finished reading the shared appOutDir(s), so finalize tasks may safely\n // mutate them (e.g. NSIS copying elevate.exe into win-unpacked — see #9852).\n for (const task of this.buildFinalizeTasks) {\n if (this.cancellationToken.cancelled) {\n break\n }\n await task()\n }\n return platformToTarget\n }\n\n private async createHelper(platform: Platform): Promise<PlatformPackager<any>> {\n if (this.options.platformPackagerFactory != null) {\n return this.options.platformPackagerFactory(this, platform)\n }\n\n switch (platform) {\n case Platform.MAC: {\n const helperClass = (await import(\"./macPackager.js\")).MacPackager\n return new helperClass(this)\n }\n\n case Platform.WINDOWS: {\n const helperClass = (await import(\"./winPackager.js\")).WinPackager\n return new helperClass(this)\n }\n\n case Platform.LINUX:\n return new (await import(\"./linuxPackager.js\")).LinuxPackager(this)\n\n default:\n throw new Error(`Unknown platform: ${platform}`)\n }\n }\n\n public async installAppDependencies(platform: Platform, arch: Arch): Promise<any> {\n if (this.options.prepackaged != null || !this.framework.isNpmRebuildRequired) {\n return\n }\n\n const frameworkInfo = { version: this.framework.version, useCustomDist: true }\n const config = this.config\n if (config.nativeModules?.nodeGypRebuild === true) {\n await nodeGypRebuild(platform.nodeName, Arch[arch], frameworkInfo)\n }\n\n if (config.nativeModules?.npmRebuild === false) {\n log.info({ reason: \"nativeModules.npmRebuild is set to false\" }, \"skipped dependencies rebuild\")\n return\n }\n\n const beforeBuild = await resolveFunction(this.appInfo.type, config.beforeBuild, \"beforeBuild\", await this.getWorkspaceRoot())\n if (beforeBuild != null) {\n const performDependenciesInstallOrRebuild = await beforeBuild({\n appDir: this.appDir,\n electronVersion: this.config.electronVersion!,\n platform,\n arch: Arch[arch],\n })\n\n // If beforeBuild resolves to false, it means that handling node_modules is done outside of electron-builder.\n this._nodeModulesHandledExternally = !performDependenciesInstallOrRebuild\n if (!performDependenciesInstallOrRebuild) {\n return\n }\n }\n\n if (config.nativeModules?.buildDependenciesFromSource === true && platform.nodeName !== process.platform) {\n log.info({ reason: \"platform is different and nativeModules.buildDependenciesFromSource is set to true\" }, \"skipped dependencies rebuild\")\n } else {\n await installOrRebuild(\n config,\n { appDir: this.appDir, projectDir: this.projectDir, workspaceRoot: await this.getWorkspaceRoot() },\n {\n frameworkInfo,\n platform: platform.nodeName,\n arch: Arch[arch],\n },\n false,\n this.runtimeEnvironmentVariables\n )\n }\n }\n}\n\nfunction createOutDirIfNeed(targetList: Array<Target>, createdOutDirs: Set<string>): Promise<any> {\n const ourDirs = new Set<string>()\n for (const target of targetList) {\n // noinspection SuspiciousInstanceOfGuard\n if (target instanceof NoOpTarget) {\n continue\n }\n\n const outDir = target.outDir\n if (!createdOutDirs.has(outDir)) {\n ourDirs.add(outDir)\n }\n }\n\n if (ourDirs.size === 0) {\n return Promise.resolve()\n }\n\n return Promise.all(\n Array.from(ourDirs)\n .sort()\n .map(dir => {\n return mkdirs(dir)\n .then(() => chmod(dir, 0o755) /* set explicitly */)\n .then(() => createdOutDirs.add(dir))\n })\n )\n}\n\nexport interface BuildResult {\n readonly outDir: string\n readonly artifactPaths: Array<string>\n readonly platformToTargets: Map<Platform, Map<string, Target>>\n readonly configuration: Configuration\n}\n\nfunction getSafeEffectiveConfig(configuration: Configuration): string {\n const o = JSON.parse(safeStringifyJson(configuration))\n if (o.cscLink != null) {\n o.cscLink = \"<hidden by builder>\"\n }\n return serializeToYaml(o, true)\n}\n"]}
1
+ {"version":3,"file":"packager.js","sourceRoot":"","sources":["../src/packager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,yBAAyB,EACzB,GAAG,EACH,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,MAAM,GACP,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAE3E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC/B,OAAO,EA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AAI,UAAU,EAAE,CAAC;QAChC,yCAAyC;QACzC,IAAI,MAAM,YAAY,UAAU,EAAE,CAAC;YACjC,SAAQ;QACV,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QACrB,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAChB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;SAChB,IAAI,EAAE;SACN,GAAG,CAAC,GAAG,CAAC,EAAE;QACT,OAAO,MAAM,CAAC,GAAG,CAAC;aACf,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,oBAAoB,CAAC;aAClD,IAAI,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;IACxC,CAAC,CAAC,CACL,CAAA;AACH,CAAC;AASD,SAAS,sBAAsB,CAAC,aAA4B;IAC1D,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC,CAAA;IACtD,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;QACtB,CAAC,CAAC,OAAO,GAAG,qBAAqB,CAAA;IACnC,CAAC;IACD,OAAO,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;AACjC,CAAC","sourcesContent":["import {\n Arch,\n archFromString,\n AsyncTaskManager,\n DebugLogger,\n executeFinally,\n getArtifactArchName,\n InvalidConfigurationError,\n log,\n MAX_FILE_REQUESTS,\n orNullIfFileNotExist,\n sanitizeDirPath,\n safeStringifyJson,\n serializeToYaml,\n TmpDir,\n} from \"builder-util\"\nimport { CancellationToken, deepAssign, retry } from \"builder-util-runtime\"\n\nimport { isCI } from \"ci-info\"\nimport { Lazy } from \"lazy-val\"\nimport { release as getOsRelease } from \"os\"\nimport * as path from \"path\"\nimport { AppInfo } from \"./appInfo.js\"\nimport { readAsarJson } from \"./asar/asar.js\"\nimport { AfterExtractContext, AfterPackContext, BeforePackContext, Configuration, Hook } from \"./configuration.js\"\nimport { Platform, SourceRepositoryInfo, Target } from \"./core.js\"\nimport { createElectronFrameworkSupport } from \"./electron/ElectronFramework.js\"\nimport { assertElectronArchSupported } from \"./electron/electronArchSupport.js\"\nimport { Framework, isElectronBased } from \"./Framework.js\"\nimport { Metadata } from \"./options/metadata.js\"\nimport { ArtifactBuildStarted, ArtifactCreated, PackagerOptions } from \"./packagerApi.js\"\nimport { PlatformPackager } from \"./platformPackager.js\"\nimport { addTargetsForPlatform, computeArchToTargetNamesMap, createTargets, NoOpTarget } from \"./targets/targetFactory.js\"\nimport { computeDefaultAppDirectory, getConfig, validateConfiguration } from \"./util/config/config.js\"\nimport { expandMacro } from \"./util/macroExpander.js\"\nimport { checkMetadata, readPackageJson } from \"./util/packageMetadata.js\"\nimport { getRepositoryInfo } from \"./util/repositoryInfo.js\"\nimport { resolveFunction } from \"./util/resolve.js\"\nimport { installOrRebuild, nodeGypRebuild } from \"./util/installOrRebuild.js\"\nimport { PACKAGE_VERSION } from \"./version.js\"\nimport { AsyncEventEmitter, HandlerType } from \"./util/asyncEventEmitter.js\"\nimport asyncPool from \"tiny-async-pool\"\nimport { determinePackageManagerEnv, PM } from \"./node-module-collector/index.js\"\nimport _fsExtra from \"fs-extra\"\nconst { chmod, mkdirs, outputFile } = _fsExtra\nimport { setSevenZipPath } from \"./toolsets/7zip.js\"\nimport { getCustomToolsetPath } from \"./toolsets/custom.js\"\n\ntype PackagerEvents = {\n artifactBuildStarted: Hook<ArtifactBuildStarted, void>\n\n beforePack: Hook<BeforePackContext, void>\n afterExtract: Hook<AfterExtractContext, void>\n afterPack: Hook<AfterPackContext, void>\n afterSign: Hook<AfterPackContext, void>\n\n artifactBuildCompleted: Hook<ArtifactCreated, void>\n\n msiProjectCreated: Hook<string, void>\n appxManifestCreated: Hook<string, void>\n\n // internal-use only, prefer usage of `artifactBuildCompleted`\n artifactCreated: Hook<ArtifactCreated, void>\n}\n\nexport class Packager {\n readonly projectDir: string\n\n private _appDir: string\n get appDir(): string {\n return this._appDir\n }\n\n private readonly _packageManager: Lazy<{ pm: PM; workspaceRoot: Promise<string | undefined> }>\n async getPackageManager(): Promise<PM> {\n return (await this._packageManager.value).pm\n }\n async getWorkspaceRoot(): Promise<string> {\n return (await (await this._packageManager.value).workspaceRoot) || this.projectDir\n }\n\n /** Stores original metadata merged with extraMetadata from configuration. */\n private _metadata: Metadata | null = null\n get metadata(): Metadata {\n return this._metadata!\n }\n\n /** Stores original metadata from package.json before merging with extraMetadata. */\n private _originalMetadata: Metadata | null = null\n get originalMetadata(): Metadata {\n return this._originalMetadata!\n }\n\n /** The \"name\" field from package.json. */\n get nodePackageName() {\n return this.originalMetadata.name!\n }\n\n private _nodeModulesHandledExternally = false\n\n get areNodeModulesHandledExternally(): boolean {\n return this._nodeModulesHandledExternally\n }\n\n private _isPrepackedAppAsar = false\n\n get isPrepackedAppAsar(): boolean {\n return this._isPrepackedAppAsar\n }\n\n private _devMetadata: Metadata | null = null\n get devMetadata(): Metadata | null {\n return this._devMetadata\n }\n\n private _configuration: Configuration | null = null\n\n get config(): Configuration {\n return this._configuration!\n }\n\n isTwoPackageJsonProjectLayoutUsed = false\n\n private readonly eventEmitter = new AsyncEventEmitter<PackagerEvents>()\n\n _appInfo: AppInfo | null = null\n get appInfo(): AppInfo {\n return this._appInfo!\n }\n\n readonly tempDirManager = new TmpDir(\"packager\")\n\n // Tasks that must run after EVERY target has finished building — the only point at which the\n // shared appOutDir can be mutated without racing a concurrent target that reads it. Used by NSIS\n // to write elevate.exe into win-unpacked without it leaking into Squirrel/zip/etc. (see #9852).\n private readonly buildFinalizeTasks: Array<() => Promise<void>> = []\n\n addBuildFinalizeTask(task: () => Promise<void>): void {\n this.buildFinalizeTasks.push(task)\n }\n\n private _repositoryInfo = new Lazy<SourceRepositoryInfo | null>(() => getRepositoryInfo(this.projectDir, this.metadata, this.devMetadata))\n\n readonly options: PackagerOptions\n\n readonly debugLogger = new DebugLogger(log.isDebugEnabled)\n\n get repositoryInfo(): Promise<SourceRepositoryInfo | null> {\n return this._repositoryInfo.value\n }\n\n private runtimeEnvironmentVariables: NodeJS.ProcessEnv = {}\n\n stageDirPathCustomizer: (target: Target, packager: PlatformPackager<any>, arch: Arch) => string = (target, packager, arch) => {\n return path.join(target.outDir, `__${target.name}-${getArtifactArchName(arch, target.name)}`)\n }\n\n private _buildResourcesDir: string | null = null\n\n get buildResourcesDir(): string {\n let result = this._buildResourcesDir\n if (result == null) {\n result = path.resolve(this.projectDir, this.relativeBuildResourcesDirname)\n this._buildResourcesDir = result\n }\n return result\n }\n\n get relativeBuildResourcesDirname(): string {\n return this.config.directories!.buildResources!\n }\n\n private _framework: Framework | null = null\n get framework(): Framework {\n return this._framework!\n }\n\n private readonly toDispose: Array<() => Promise<void>> = []\n\n disposeOnBuildFinish(disposer: () => Promise<void>) {\n this.toDispose.push(disposer)\n }\n\n //noinspection JSUnusedGlobalSymbols\n constructor(\n options: PackagerOptions,\n readonly cancellationToken = new CancellationToken()\n ) {\n const targets = options.targets || new Map<Platform, Map<Arch, Array<string>>>()\n if (options.targets == null) {\n options.targets = targets\n }\n\n function processTargets(platform: Platform, types: Array<string>) {\n function commonArch(currentIfNotSpecified: boolean): Array<Arch> {\n const result = Array<Arch>()\n return result.length === 0 && currentIfNotSpecified ? [archFromString(process.arch)] : result\n }\n\n addTargetsForPlatform(targets, platform, types, commonArch, archToType => {\n for (const arch of commonArch(false)) {\n archToType.set(arch, [])\n }\n })\n }\n\n if (options.mac != null) {\n processTargets(Platform.MAC, options.mac)\n }\n if (options.linux != null) {\n processTargets(Platform.LINUX, options.linux)\n }\n if (options.win != null) {\n processTargets(Platform.WINDOWS, options.win)\n }\n\n this.projectDir = sanitizeDirPath(options.projectDir == null ? process.cwd() : options.projectDir)\n this._appDir = this.projectDir\n this._packageManager = determinePackageManagerEnv({ projectDir: this.projectDir, appDir: this.appDir, workspaceRoot: undefined })\n\n this.options = {\n ...options,\n prepackaged: options.prepackaged == null ? null : sanitizeDirPath(path.resolve(this.projectDir, options.prepackaged)),\n }\n\n log.info({ version: PACKAGE_VERSION, os: getOsRelease() }, \"electron-builder\")\n }\n\n private async addPackagerEventHandlers() {\n const { type } = this.appInfo\n const root = await this.getWorkspaceRoot()\n this.eventEmitter.on(\"artifactBuildStarted\", await resolveFunction(type, this.config.artifactBuildStarted, \"artifactBuildStarted\", root), \"user\")\n this.eventEmitter.on(\"artifactBuildCompleted\", await resolveFunction(type, this.config.artifactBuildCompleted, \"artifactBuildCompleted\", root), \"user\")\n\n this.eventEmitter.on(\"appxManifestCreated\", await resolveFunction(type, this.config.appxManifestCreated, \"appxManifestCreated\", root), \"user\")\n this.eventEmitter.on(\"msiProjectCreated\", await resolveFunction(type, this.config.msiProjectCreated, \"msiProjectCreated\", root), \"user\")\n\n this.eventEmitter.on(\"beforePack\", await resolveFunction(type, this.config.beforePack, \"beforePack\", root), \"user\")\n this.eventEmitter.on(\"afterExtract\", await resolveFunction(type, this.config.afterExtract, \"afterExtract\", root), \"user\")\n this.eventEmitter.on(\"afterPack\", await resolveFunction(type, this.config.afterPack, \"afterPack\", root), \"user\")\n this.eventEmitter.on(\"afterSign\", await resolveFunction(type, this.config.afterSign, \"afterSign\", root), \"user\")\n }\n\n onAfterPack(handler: PackagerEvents[\"afterPack\"]): Packager {\n this.eventEmitter.on(\"afterPack\", handler)\n return this\n }\n\n onArtifactCreated(handler: PackagerEvents[\"artifactCreated\"]): Packager {\n this.eventEmitter.on(\"artifactCreated\", handler)\n return this\n }\n\n filterPackagerEventListeners(event: keyof PackagerEvents, type: HandlerType | undefined) {\n return this.eventEmitter.filterListeners(event, type)\n }\n\n clearPackagerEventListeners() {\n this.eventEmitter.clear()\n }\n\n async emitArtifactBuildStarted(event: ArtifactBuildStarted, logFields?: any) {\n log.info(\n logFields || {\n target: event.targetPresentableName,\n arch: event.arch == null ? null : Arch[event.arch],\n file: log.filePath(event.file),\n },\n \"building\"\n )\n await this.eventEmitter.emit(\"artifactBuildStarted\", event)\n }\n\n /**\n * Only for sub artifacts (update info), for main artifacts use `callArtifactBuildCompleted`.\n */\n async emitArtifactCreated(event: ArtifactCreated) {\n await this.eventEmitter.emit(\"artifactCreated\", event)\n }\n\n async emitArtifactBuildCompleted(event: ArtifactCreated) {\n await this.eventEmitter.emit(\"artifactBuildCompleted\", event)\n await this.emitArtifactCreated(event)\n }\n\n async emitAppxManifestCreated(path: string) {\n await this.eventEmitter.emit(\"appxManifestCreated\", path)\n }\n\n async emitMsiProjectCreated(path: string) {\n await this.eventEmitter.emit(\"msiProjectCreated\", path)\n }\n\n async emitBeforePack(context: BeforePackContext) {\n await this.eventEmitter.emit(\"beforePack\", context)\n }\n\n async emitAfterPack(context: AfterPackContext) {\n await this.eventEmitter.emit(\"afterPack\", context)\n }\n\n async emitAfterSign(context: AfterPackContext) {\n await this.eventEmitter.emit(\"afterSign\", context)\n }\n\n async emitAfterExtract(context: AfterPackContext) {\n await this.eventEmitter.emit(\"afterExtract\", context)\n }\n\n async validateConfig(): Promise<void> {\n let configPath: string | null = null\n let configFromOptions = this.options.config\n if (typeof configFromOptions === \"string\") {\n // it is a path to config file\n configPath = configFromOptions\n configFromOptions = null\n } else if (configFromOptions != null && typeof configFromOptions.extends === \"string\" && configFromOptions.extends.includes(\".\")) {\n configPath = configFromOptions.extends\n delete configFromOptions.extends\n }\n\n const projectDir = this.projectDir\n\n const devPackageFile = path.join(projectDir, \"package.json\")\n this._devMetadata = await orNullIfFileNotExist(readPackageJson(devPackageFile))\n\n const devMetadata = this.devMetadata\n const configuration = await getConfig(projectDir, configPath, configFromOptions, new Lazy(() => Promise.resolve(devMetadata)))\n\n log.debug({ config: getSafeEffectiveConfig(configuration) }, \"effective config\")\n\n this._appDir = await computeDefaultAppDirectory(projectDir, configuration.directories!.app)\n this.isTwoPackageJsonProjectLayoutUsed = this._appDir !== projectDir\n\n const appPackageFile = this.isTwoPackageJsonProjectLayoutUsed ? path.join(this.appDir, \"package.json\") : devPackageFile\n\n // tslint:disable:prefer-conditional-expression\n if (this.devMetadata != null && !this.isTwoPackageJsonProjectLayoutUsed) {\n this._metadata = this.devMetadata\n } else {\n this._metadata = await this.readProjectMetadataIfTwoPackageStructureOrPrepacked(appPackageFile)\n }\n this._originalMetadata = deepAssign({}, this._metadata)\n deepAssign(this._metadata, configuration.extraMetadata)\n\n if (this.isTwoPackageJsonProjectLayoutUsed) {\n log.debug({ devPackageFile, appPackageFile }, \"two package.json structure is used\")\n }\n checkMetadata(this.metadata, this.devMetadata, appPackageFile, devPackageFile, projectDir)\n\n await validateConfiguration(configuration, this.debugLogger)\n\n this._configuration = configuration\n this._devMetadata = devMetadata\n }\n\n // external caller of this method always uses isTwoPackageJsonProjectLayoutUsed=false and appDir=projectDir, no way (and need) to use another values\n async build(repositoryInfo?: SourceRepositoryInfo): Promise<BuildResult> {\n await this.validateConfig()\n\n if (repositoryInfo != null) {\n this._repositoryInfo.value = Promise.resolve(repositoryInfo)\n }\n\n this._appInfo = new AppInfo(this, null)\n await this.addPackagerEventHandlers()\n\n this._framework = await createElectronFrameworkSupport(this.config, this)\n\n const commonOutDirWithoutPossibleOsMacro = path.resolve(\n this.projectDir,\n expandMacro(this.config.directories!.output!, null, this._appInfo, {\n os: \"\",\n })\n )\n\n if (!isCI && (process.stdout as any).isTTY) {\n const effectiveConfigFile = path.join(commonOutDirWithoutPossibleOsMacro, \"builder-effective-config.yaml\")\n log.info({ file: log.filePath(effectiveConfigFile) }, \"writing effective config\")\n await outputFile(effectiveConfigFile, getSafeEffectiveConfig(this.config))\n }\n\n // because artifact event maybe dispatched several times for different publish providers\n const artifactPaths = new Set<string>()\n this.onArtifactCreated(event => {\n if (event.file != null) {\n artifactPaths.add(event.file)\n }\n })\n\n this.disposeOnBuildFinish(() =>\n retry(() => this.tempDirManager.cleanup(), {\n retries: 2,\n interval: 2000,\n backoff: 2000,\n cancellationToken: this.cancellationToken,\n shouldRetry: e => {\n const message: string = e?.message || \"\"\n const code = e?.code\n // windows file locks\n const resourceIsBusy = message.includes(\"EBUSY\") || code === \"EBUSY\"\n if (resourceIsBusy) {\n log.debug({ error: message || code }, \"retrying temporary directory cleanup\")\n return true\n }\n return false\n },\n })\n )\n\n const platformToTargets = await executeFinally(this.doBuild(), async () => {\n if (this.debugLogger.isEnabled) {\n await this.debugLogger.save(path.join(commonOutDirWithoutPossibleOsMacro, \"builder-debug.yml\"))\n }\n\n const toDispose = this.toDispose.slice()\n this.toDispose.length = 0\n for (const disposer of toDispose) {\n await disposer().catch((e: any) => {\n log.warn({ error: e }, \"cannot dispose\")\n })\n }\n })\n\n return {\n outDir: commonOutDirWithoutPossibleOsMacro,\n artifactPaths: Array.from(artifactPaths),\n platformToTargets,\n configuration: this.config,\n }\n }\n\n private async readProjectMetadataIfTwoPackageStructureOrPrepacked(appPackageFile: string): Promise<Metadata> {\n let data = await orNullIfFileNotExist(readPackageJson(appPackageFile))\n if (data != null) {\n return data\n }\n\n data = await orNullIfFileNotExist(readAsarJson(path.join(this.projectDir, \"app.asar\"), \"package.json\"))\n if (data != null) {\n this._isPrepackedAppAsar = true\n return data\n }\n\n throw new Error(`Cannot find package.json in the ${path.dirname(appPackageFile)}`)\n }\n\n private async doBuild(): Promise<Map<Platform, Map<string, Target>>> {\n const sevenZipConfig = this.config.toolsets?.sevenZip\n if (typeof sevenZipConfig === \"object\" && sevenZipConfig != null) {\n const toolDir = await getCustomToolsetPath(sevenZipConfig, this.buildResourcesDir)\n const bin = path.join(toolDir, \"bin\", process.platform === \"win32\" ? \"7za.exe\" : \"7za\")\n if (process.platform !== \"win32\") {\n await chmod(bin, 0o755)\n }\n setSevenZipPath(bin)\n }\n\n const taskManager = new AsyncTaskManager(this.cancellationToken)\n const syncTargetsIfAny = [] as Target[]\n\n const platformToTarget = new Map<Platform, Map<string, Target>>()\n const createdOutDirs = new Set<string>()\n\n for (const [platform, archToType] of this.options.targets!) {\n if (this.cancellationToken.cancelled) {\n break\n }\n\n if (platform === Platform.MAC && process.platform === Platform.WINDOWS.nodeName) {\n throw new InvalidConfigurationError(\"Build for macOS is supported only on macOS, please see https://electron.build/multi-platform-build\")\n }\n\n const packager = await this.createHelper(platform)\n const nameToTarget: Map<string, Target> = new Map()\n platformToTarget.set(platform, nameToTarget)\n\n let poolCount = Math.floor(packager.config.concurrency?.jobs || 1)\n if (poolCount < 1) {\n log.warn({ concurrency: poolCount }, \"concurrency is invalid, overriding with job count: 1\")\n poolCount = 1\n } else if (poolCount > MAX_FILE_REQUESTS) {\n log.warn(\n { concurrency: poolCount, MAX_FILE_REQUESTS },\n `job concurrency is greater than recommended MAX_FILE_REQUESTS, this may lead to File Descriptor errors (too many files open). Proceed with caution (e.g. this is an experimental feature)`\n )\n }\n const packPromises: Promise<any>[] = []\n\n for (const [arch, targetNames] of computeArchToTargetNamesMap(archToType, packager, platform)) {\n if (this.cancellationToken.cancelled) {\n break\n }\n\n // fail fast when the requested arch has no official Electron build anymore (Electron 44 removed win32-ia32 and linux-armv7l);\n // skipped for prepackaged apps since nothing is downloaded then\n if (this.options.prepackaged == null && isElectronBased(this.framework)) {\n assertElectronArchSupported(platform, arch, this.framework.version, this.config)\n }\n\n // support os and arch macro in output value\n const outDir = path.resolve(this.projectDir, packager.expandMacro(this.config.directories!.output!, Arch[arch]))\n const targetList = createTargets(nameToTarget, targetNames.length === 0 ? packager.defaultTarget : targetNames, outDir, packager)\n await createOutDirIfNeed(targetList, createdOutDirs)\n const promise = packager.pack(outDir, arch, targetList, taskManager)\n if (poolCount < 2) {\n await promise\n } else {\n packPromises.push(promise)\n }\n }\n\n await asyncPool(poolCount, packPromises, async it => {\n if (this.cancellationToken.cancelled) {\n return\n }\n await it\n })\n\n if (this.cancellationToken.cancelled) {\n break\n }\n\n for (const target of nameToTarget.values()) {\n if (target.isAsyncSupported) {\n taskManager.addTask(target.finishBuild())\n } else {\n syncTargetsIfAny.push(target)\n }\n }\n }\n\n await taskManager.awaitTasks()\n\n for (const target of syncTargetsIfAny) {\n if (this.cancellationToken.cancelled) {\n break\n }\n await target.finishBuild()\n }\n\n // Every target has now finished reading the shared appOutDir(s), so finalize tasks may safely\n // mutate them (e.g. NSIS copying elevate.exe into win-unpacked — see #9852).\n for (const task of this.buildFinalizeTasks) {\n if (this.cancellationToken.cancelled) {\n break\n }\n await task()\n }\n return platformToTarget\n }\n\n private async createHelper(platform: Platform): Promise<PlatformPackager<any>> {\n if (this.options.platformPackagerFactory != null) {\n return this.options.platformPackagerFactory(this, platform)\n }\n\n switch (platform) {\n case Platform.MAC: {\n const helperClass = (await import(\"./macPackager.js\")).MacPackager\n return new helperClass(this)\n }\n\n case Platform.WINDOWS: {\n const helperClass = (await import(\"./winPackager.js\")).WinPackager\n return new helperClass(this)\n }\n\n case Platform.LINUX:\n return new (await import(\"./linuxPackager.js\")).LinuxPackager(this)\n\n default:\n throw new Error(`Unknown platform: ${platform}`)\n }\n }\n\n public async installAppDependencies(platform: Platform, arch: Arch): Promise<any> {\n if (this.options.prepackaged != null || !this.framework.isNpmRebuildRequired) {\n return\n }\n\n const frameworkInfo = { version: this.framework.version, useCustomDist: true }\n const config = this.config\n if (config.nativeModules?.nodeGypRebuild === true) {\n await nodeGypRebuild(platform.nodeName, Arch[arch], frameworkInfo)\n }\n\n if (config.nativeModules?.npmRebuild === false) {\n log.info({ reason: \"nativeModules.npmRebuild is set to false\" }, \"skipped dependencies rebuild\")\n return\n }\n\n const beforeBuild = await resolveFunction(this.appInfo.type, config.beforeBuild, \"beforeBuild\", await this.getWorkspaceRoot())\n if (beforeBuild != null) {\n const performDependenciesInstallOrRebuild = await beforeBuild({\n appDir: this.appDir,\n electronVersion: this.config.electronVersion!,\n platform,\n arch: Arch[arch],\n })\n\n // If beforeBuild resolves to false, it means that handling node_modules is done outside of electron-builder.\n this._nodeModulesHandledExternally = !performDependenciesInstallOrRebuild\n if (!performDependenciesInstallOrRebuild) {\n return\n }\n }\n\n if (config.nativeModules?.buildDependenciesFromSource === true && platform.nodeName !== process.platform) {\n log.info({ reason: \"platform is different and nativeModules.buildDependenciesFromSource is set to true\" }, \"skipped dependencies rebuild\")\n } else {\n await installOrRebuild(\n config,\n { appDir: this.appDir, projectDir: this.projectDir, workspaceRoot: await this.getWorkspaceRoot() },\n {\n frameworkInfo,\n platform: platform.nodeName,\n arch: Arch[arch],\n },\n false,\n this.runtimeEnvironmentVariables\n )\n }\n }\n}\n\nfunction createOutDirIfNeed(targetList: Array<Target>, createdOutDirs: Set<string>): Promise<any> {\n const ourDirs = new Set<string>()\n for (const target of targetList) {\n // noinspection SuspiciousInstanceOfGuard\n if (target instanceof NoOpTarget) {\n continue\n }\n\n const outDir = target.outDir\n if (!createdOutDirs.has(outDir)) {\n ourDirs.add(outDir)\n }\n }\n\n if (ourDirs.size === 0) {\n return Promise.resolve()\n }\n\n return Promise.all(\n Array.from(ourDirs)\n .sort()\n .map(dir => {\n return mkdirs(dir)\n .then(() => chmod(dir, 0o755) /* set explicitly */)\n .then(() => createdOutDirs.add(dir))\n })\n )\n}\n\nexport interface BuildResult {\n readonly outDir: string\n readonly artifactPaths: Array<string>\n readonly platformToTargets: Map<Platform, Map<string, Target>>\n readonly configuration: Configuration\n}\n\nfunction getSafeEffectiveConfig(configuration: Configuration): string {\n const o = JSON.parse(safeStringifyJson(configuration))\n if (o.cscLink != null) {\n o.cscLink = \"<hidden by builder>\"\n }\n return serializeToYaml(o, true)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"updateInfoBuilder.d.ts","sourceRoot":"","sources":["../../src/publish/updateInfoBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAA2C,MAAM,cAA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AAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAA;IACnD,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAA;IACxC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CAC5B;AAED,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,KAAK,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAiFpJ;AAsBD,wBAAsB,oBAAoB,CAAC,mBAAmB,EAAE,KAAK,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,QAAQ,iBA0D5G"}
@@ -95,7 +95,9 @@ export async function createUpdateInfoTasks(event, _publishConfigs) {
95
95
  }
96
96
  }
97
97
  if (event.safeArtifactName != null && publishConfiguration.provider === "github") {
98
- const newFiles = info.files.slice();
98
+ // copy the file entries (not just the array) — `info` is shared across publish configurations,
99
+ // so mutating an entry here would leak the GitHub-safe artifact name into other providers' update info
100
+ const newFiles = info.files.map(file => ({ ...file }));
99
101
  newFiles[0].url = event.safeArtifactName;
100
102
  info = {
101
103
  ...info,
@@ -1 +1 @@
1
- {"version":3,"file":"updateInfoBuilder.js","sourceRoot":"","sources":["../../src/publish/updateInfoBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE5E,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAKrC,O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Aa,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;SACjG,EACD,EAAE,MAAM,EAAE,CAAC,EAAE,CACd,CAAA;QAED,MAAM,QAAQ,CAAC,mBAAmB,CAAC;YACjC,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,IAAI;YACV,QAAQ;YACR,MAAM,EAAE,IAAI;YACZ,aAAa;SACd,CAAC,CAAA;IACJ,CAAC;AACH,CAAC","sourcesContent":["import asyncPool from \"tiny-async-pool\"\nimport { Arch, log, safeStringifyJson, serializeToYaml } from \"builder-util\"\nimport { GenericServerOptions, PublishConfiguration, UpdateInfo, WindowsUpdateInfo } from \"builder-util-runtime\"\nimport fsExtra from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport * as semver from \"semver\"\nimport { Platform } from \"../core.js\"\nimport { ReleaseInfo } from \"../options/PlatformSpecificBuildOptions.js\"\nimport { Packager } from \"../packager.js\"\nimport { ArtifactCreated } from \"../packagerApi.js\"\nimport { PlatformPackager } from \"../platformPackager.js\"\nimport { hashFile } from \"../util/hash.js\"\nimport { computeDownloadUrl, getPublishConfigsForUpdateInfo } from \"./PublishManager.js\"\n\nasync function getReleaseInfo(packager: PlatformPackager<any>) {\n const releaseInfo: ReleaseInfo = { ...(packager.platformOptions.releaseInfo || packager.config.releaseInfo) }\n if (releaseInfo.releaseNotes == null) {\n const releaseNotesFile = await packager.getResource(\n releaseInfo.releaseNotesFile,\n `release-notes-${packager.platform.buildConfigurationKey}.md`,\n `release-notes-${packager.platform.name}.md`,\n `release-notes-${packager.platform.nodeName}.md`,\n \"release-notes.md\"\n )\n const releaseNotes = releaseNotesFile == null ? null : await fsExtra.readFile(releaseNotesFile, \"utf-8\")\n // to avoid undefined in the file, check for null\n if (releaseNotes != null) {\n releaseInfo.releaseNotes = releaseNotes\n }\n }\n delete releaseInfo.releaseNotesFile\n return releaseInfo\n}\n\nfunction isGenerateUpdatesFilesForAllChannels(packager: PlatformPackager<any>) {\n const value = packager.platformOptions.generateUpdatesFilesForAllChannels\n return value == null ? packager.config.generateUpdatesFilesForAllChannels : value\n}\n\n/**\n if this is an \"alpha\" version, we need to generate only the \"alpha\" .yml file\n if this is a \"beta\" version, we need to generate both the \"alpha\" and \"beta\" .yml file\n if this is a \"stable\" version, we need to generate all the \"alpha\", \"beta\" and \"stable\" .yml file\n */\nfunction computeChannelNames(packager: PlatformPackager<any>, publishConfig: PublishConfiguration): Array<string> {\n const currentChannel: string = (publishConfig as GenericServerOptions).channel || \"latest\"\n // for GitHub should be pre-release way be used\n if (currentChannel === \"alpha\" || publishConfig.provider === \"github\" || !isGenerateUpdatesFilesForAllChannels(packager)) {\n return [currentChannel]\n }\n\n switch (currentChannel) {\n case \"beta\":\n return [currentChannel, \"alpha\"]\n\n case \"latest\":\n return [currentChannel, \"alpha\", \"beta\"]\n\n default:\n return [currentChannel]\n }\n}\n\nfunction getUpdateInfoFileName(channel: string, packager: PlatformPackager<any>, arch: Arch | null): string {\n const osSuffix = packager.platform === Platform.WINDOWS ? \"\" : `-${packager.platform.buildConfigurationKey}`\n return `${channel}${osSuffix}${getArchPrefixForUpdateFile(arch, packager)}.yml`\n}\n\nfunction getArchPrefixForUpdateFile(arch: Arch | null, packager: PlatformPackager<any>) {\n if (arch == null || arch === Arch.x64 || packager.platform !== Platform.LINUX) {\n return \"\"\n }\n return arch === Arch.armv7l ? \"-arm\" : `-${Arch[arch]}`\n}\n\nexport interface UpdateInfoFileTask {\n readonly file: string\n readonly info: UpdateInfo\n readonly publishConfiguration: PublishConfiguration\n readonly packager: PlatformPackager<any>\n readonly arch?: Arch | null\n}\n\nexport async function createUpdateInfoTasks(event: ArtifactCreated, _publishConfigs: Array<PublishConfiguration>): Promise<Array<UpdateInfoFileTask>> {\n const packager = event.packager\n const publishConfigs = await getPublishConfigsForUpdateInfo(packager, _publishConfigs, event.arch)\n if (publishConfigs == null || publishConfigs.length === 0) {\n return []\n }\n\n const outDir = event.target!.outDir\n const version = packager.appInfo.version\n const sha2 = new Lazy<string>(() => hashFile(event.file, \"sha256\", \"hex\"))\n const isMac = packager.platform === Platform.MAC\n const createdFiles = new Set<string>()\n const sharedInfo = await createUpdateInfo(version, event, await getReleaseInfo(packager))\n const tasks: Array<UpdateInfoFileTask> = []\n const electronUpdaterCompatibility = packager.platformOptions.electronUpdaterCompatibility || packager.config.electronUpdaterCompatibility || \">=2.16\"\n // electron-updater < 2.16.0 predates the files[] array and reads the top-level path/sha512 (and Windows sha2) fields instead\n // (do not pass includePrerelease — it would make the default \">=2.16\" intersect \"<2.16.0\" at the 2.16.0-0 prerelease point)\n const needsLegacyPathSha512 = semver.intersects(electronUpdaterCompatibility, \"<2.16.0\")\n // electron-updater < 2.0.0 on macOS reads the legacy <channel>-mac.json instead of <channel>-mac.yml\n const needsLegacyMacJsonCompatibility = semver.intersects(electronUpdaterCompatibility, \"<2.0.0\")\n for (const publishConfiguration of publishConfigs) {\n let dir = outDir\n if (publishConfigs.length > 1 && publishConfiguration !== publishConfigs[0]) {\n dir = path.join(outDir, publishConfiguration.provider)\n }\n\n let needsLegacyMacJson = needsLegacyMacJsonCompatibility\n\n let info = sharedInfo\n // noinspection JSDeprecatedSymbols\n if (needsLegacyPathSha512) {\n // legacy top-level path/sha512 (and Windows sha2) for electron-updater 1.x – 2.15.0; modern clients read files[]\n info = {\n ...info,\n path: info.files[0].url,\n sha512: info.files[0].sha512,\n }\n if (packager.platform === Platform.WINDOWS) {\n // noinspection JSDeprecatedSymbols\n ;(info as WindowsUpdateInfo).sha2 = await sha2.value\n }\n }\n\n if (event.safeArtifactName != null && publishConfiguration.provider === \"github\") {\n const newFiles = info.files.slice()\n newFiles[0].url = event.safeArtifactName\n info = {\n ...info,\n files: newFiles,\n // legacy top-level path mirrors files[0].url; only emitted for pre-2.16 compatibility\n ...(needsLegacyPathSha512 ? { path: event.safeArtifactName } : {}),\n }\n }\n\n for (const channel of computeChannelNames(packager, publishConfiguration)) {\n if (isMac && needsLegacyMacJson && event.file.endsWith(\".zip\")) {\n // write only for first channel (generateUpdatesFilesForAllChannels is a new functionality, no need to generate old mac update info file)\n needsLegacyMacJson = false\n await writeOldMacInfo(publishConfiguration, outDir, dir, channel, createdFiles, version, packager)\n }\n\n const updateInfoFile = path.join(dir, getUpdateInfoFileName(channel, packager, event.arch))\n if (createdFiles.has(updateInfoFile)) {\n continue\n }\n\n createdFiles.add(updateInfoFile)\n\n // artifact should be uploaded only to designated publish provider\n tasks.push({\n file: updateInfoFile,\n info,\n publishConfiguration,\n packager,\n arch: event.arch,\n })\n }\n }\n return tasks\n}\n\nasync function createUpdateInfo(version: string, event: ArtifactCreated, releaseInfo: ReleaseInfo): Promise<UpdateInfo> {\n const customUpdateInfo = event.updateInfo\n const url = path.basename(event.file)\n const sha512 = (customUpdateInfo == null ? null : customUpdateInfo.sha512) || (await hashFile(event.file))\n const files = [{ url, sha512 }]\n const result: UpdateInfo = {\n // @ts-ignore\n version,\n // @ts-ignore\n files,\n ...(releaseInfo as UpdateInfo),\n }\n\n if (customUpdateInfo != null) {\n // file info or nsis web installer packages info\n Object.assign(\"sha512\" in customUpdateInfo ? files[0] : result, customUpdateInfo)\n }\n return result\n}\n\nexport async function writeUpdateInfoFiles(updateInfoFileTasks: Array<UpdateInfoFileTask>, packager: Packager) {\n // zip must be first and zip info must be used for old path/sha512 properties in the update info\n // universal installer (arch === null) must precede arch-specific ones so path:/sha512: point to the right artifact\n updateInfoFileTasks.sort((a, b) => {\n const zipDiff = (a.info.files[0].url.endsWith(\".zip\") ? 0 : 100) - (b.info.files[0].url.endsWith(\".zip\") ? 0 : 100)\n if (zipDiff !== 0) {\n return zipDiff\n }\n // universal (arch === null) before arch-specific; tie-break by Arch enum value for full determinism\n // undefined arch (external callers predating this field) treated as arch-specific via strict === null check\n const aArch = a.arch === null ? -1 : (a.arch ?? Number.MAX_SAFE_INTEGER)\n const bArch = b.arch === null ? -1 : (b.arch ?? Number.MAX_SAFE_INTEGER)\n return aArch - bArch\n })\n\n const updateChannelFileToInfo = new Map<string, UpdateInfoFileTask>()\n for (const task of updateInfoFileTasks) {\n // https://github.com/electron-userland/electron-builder/pull/2994\n const key = `${task.file}@${safeStringifyJson(task.publishConfiguration, new Set([\"releaseType\"]))}`\n const existingTask = updateChannelFileToInfo.get(key)\n if (existingTask == null) {\n updateChannelFileToInfo.set(key, task)\n continue\n }\n\n existingTask.info.files.push(...task.info.files)\n }\n\n const releaseDate = new Date().toISOString()\n const concurrency = 4\n await asyncPool<UpdateInfoFileTask, void>(concurrency, Array.from(updateChannelFileToInfo.values()), async task => {\n const publishConfig = task.publishConfiguration\n if (publishConfig.publishAutoUpdate === false) {\n log.debug(\n {\n provider: publishConfig.provider,\n reason: \"publishAutoUpdate is set to false\",\n },\n \"auto update metadata file not published\"\n )\n return\n }\n\n if (task.info.releaseDate == null) {\n task.info.releaseDate = releaseDate\n }\n\n const fileContent = Buffer.from(serializeToYaml(task.info, false, true))\n await fsExtra.outputFile(task.file, fileContent)\n await packager.emitArtifactCreated({\n file: task.file,\n fileContent,\n arch: null,\n packager: task.packager,\n target: null,\n publishConfig,\n })\n })\n}\n\n// backward compatibility - write json file\nasync function writeOldMacInfo(\n publishConfig: PublishConfiguration,\n outDir: string,\n dir: string,\n channel: string,\n createdFiles: Set<string>,\n version: string,\n packager: PlatformPackager<any>\n) {\n const isGitHub = publishConfig.provider === \"github\"\n const updateInfoFile = isGitHub && outDir === dir ? path.join(dir, \"github\", `${channel}-mac.json`) : path.join(dir, `${channel}-mac.json`)\n if (!createdFiles.has(updateInfoFile)) {\n createdFiles.add(updateInfoFile)\n await fsExtra.outputJson(\n updateInfoFile,\n {\n version,\n releaseDate: new Date().toISOString(),\n url: computeDownloadUrl(publishConfig, packager.generateName2(\"zip\", \"mac\", isGitHub), packager),\n },\n { spaces: 2 }\n )\n\n await packager.emitArtifactCreated({\n file: updateInfoFile,\n arch: null,\n packager,\n target: null,\n publishConfig,\n })\n }\n}\n"]}
1
+ {"version":3,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Q,CAAA;IACpD,MAAM,cAAc,GAAG,QAAQ,IAAI,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,WAAW,CAAC,CAAA;IAC3I,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;QACtC,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;QAChC,MAAM,OAAO,CAAC,UAAU,CACtB,cAAc,EACd;YACE,OAAO;YACP,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACrC,GAAG,EAAE,kBAAkB,CAAC,aAAa,EAAE,QAAQ,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;SACjG,EACD,EAAE,MAAM,EAAE,CAAC,EAAE,CACd,CAAA;QAED,MAAM,QAAQ,CAAC,mBAAmB,CAAC;YACjC,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,IAAI;YACV,QAAQ;YACR,MAAM,EAAE,IAAI;YACZ,aAAa;SACd,CAAC,CAAA;IACJ,CAAC;AACH,CAAC","sourcesContent":["import asyncPool from \"tiny-async-pool\"\nimport { Arch, log, safeStringifyJson, serializeToYaml } from \"builder-util\"\nimport { GenericServerOptions, PublishConfiguration, UpdateInfo, WindowsUpdateInfo } from \"builder-util-runtime\"\nimport fsExtra from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport * as semver from \"semver\"\nimport { Platform } from \"../core.js\"\nimport { ReleaseInfo } from \"../options/PlatformSpecificBuildOptions.js\"\nimport { Packager } from \"../packager.js\"\nimport { ArtifactCreated } from \"../packagerApi.js\"\nimport { PlatformPackager } from \"../platformPackager.js\"\nimport { hashFile } from \"../util/hash.js\"\nimport { computeDownloadUrl, getPublishConfigsForUpdateInfo } from \"./PublishManager.js\"\n\nasync function getReleaseInfo(packager: PlatformPackager<any>) {\n const releaseInfo: ReleaseInfo = { ...(packager.platformOptions.releaseInfo || packager.config.releaseInfo) }\n if (releaseInfo.releaseNotes == null) {\n const releaseNotesFile = await packager.getResource(\n releaseInfo.releaseNotesFile,\n `release-notes-${packager.platform.buildConfigurationKey}.md`,\n `release-notes-${packager.platform.name}.md`,\n `release-notes-${packager.platform.nodeName}.md`,\n \"release-notes.md\"\n )\n const releaseNotes = releaseNotesFile == null ? null : await fsExtra.readFile(releaseNotesFile, \"utf-8\")\n // to avoid undefined in the file, check for null\n if (releaseNotes != null) {\n releaseInfo.releaseNotes = releaseNotes\n }\n }\n delete releaseInfo.releaseNotesFile\n return releaseInfo\n}\n\nfunction isGenerateUpdatesFilesForAllChannels(packager: PlatformPackager<any>) {\n const value = packager.platformOptions.generateUpdatesFilesForAllChannels\n return value == null ? packager.config.generateUpdatesFilesForAllChannels : value\n}\n\n/**\n if this is an \"alpha\" version, we need to generate only the \"alpha\" .yml file\n if this is a \"beta\" version, we need to generate both the \"alpha\" and \"beta\" .yml file\n if this is a \"stable\" version, we need to generate all the \"alpha\", \"beta\" and \"stable\" .yml file\n */\nfunction computeChannelNames(packager: PlatformPackager<any>, publishConfig: PublishConfiguration): Array<string> {\n const currentChannel: string = (publishConfig as GenericServerOptions).channel || \"latest\"\n // for GitHub should be pre-release way be used\n if (currentChannel === \"alpha\" || publishConfig.provider === \"github\" || !isGenerateUpdatesFilesForAllChannels(packager)) {\n return [currentChannel]\n }\n\n switch (currentChannel) {\n case \"beta\":\n return [currentChannel, \"alpha\"]\n\n case \"latest\":\n return [currentChannel, \"alpha\", \"beta\"]\n\n default:\n return [currentChannel]\n }\n}\n\nfunction getUpdateInfoFileName(channel: string, packager: PlatformPackager<any>, arch: Arch | null): string {\n const osSuffix = packager.platform === Platform.WINDOWS ? \"\" : `-${packager.platform.buildConfigurationKey}`\n return `${channel}${osSuffix}${getArchPrefixForUpdateFile(arch, packager)}.yml`\n}\n\nfunction getArchPrefixForUpdateFile(arch: Arch | null, packager: PlatformPackager<any>) {\n if (arch == null || arch === Arch.x64 || packager.platform !== Platform.LINUX) {\n return \"\"\n }\n return arch === Arch.armv7l ? \"-arm\" : `-${Arch[arch]}`\n}\n\nexport interface UpdateInfoFileTask {\n readonly file: string\n readonly info: UpdateInfo\n readonly publishConfiguration: PublishConfiguration\n readonly packager: PlatformPackager<any>\n readonly arch?: Arch | null\n}\n\nexport async function createUpdateInfoTasks(event: ArtifactCreated, _publishConfigs: Array<PublishConfiguration>): Promise<Array<UpdateInfoFileTask>> {\n const packager = event.packager\n const publishConfigs = await getPublishConfigsForUpdateInfo(packager, _publishConfigs, event.arch)\n if (publishConfigs == null || publishConfigs.length === 0) {\n return []\n }\n\n const outDir = event.target!.outDir\n const version = packager.appInfo.version\n const sha2 = new Lazy<string>(() => hashFile(event.file, \"sha256\", \"hex\"))\n const isMac = packager.platform === Platform.MAC\n const createdFiles = new Set<string>()\n const sharedInfo = await createUpdateInfo(version, event, await getReleaseInfo(packager))\n const tasks: Array<UpdateInfoFileTask> = []\n const electronUpdaterCompatibility = packager.platformOptions.electronUpdaterCompatibility || packager.config.electronUpdaterCompatibility || \">=2.16\"\n // electron-updater < 2.16.0 predates the files[] array and reads the top-level path/sha512 (and Windows sha2) fields instead\n // (do not pass includePrerelease — it would make the default \">=2.16\" intersect \"<2.16.0\" at the 2.16.0-0 prerelease point)\n const needsLegacyPathSha512 = semver.intersects(electronUpdaterCompatibility, \"<2.16.0\")\n // electron-updater < 2.0.0 on macOS reads the legacy <channel>-mac.json instead of <channel>-mac.yml\n const needsLegacyMacJsonCompatibility = semver.intersects(electronUpdaterCompatibility, \"<2.0.0\")\n for (const publishConfiguration of publishConfigs) {\n let dir = outDir\n if (publishConfigs.length > 1 && publishConfiguration !== publishConfigs[0]) {\n dir = path.join(outDir, publishConfiguration.provider)\n }\n\n let needsLegacyMacJson = needsLegacyMacJsonCompatibility\n\n let info = sharedInfo\n // noinspection JSDeprecatedSymbols\n if (needsLegacyPathSha512) {\n // legacy top-level path/sha512 (and Windows sha2) for electron-updater 1.x – 2.15.0; modern clients read files[]\n info = {\n ...info,\n path: info.files[0].url,\n sha512: info.files[0].sha512,\n }\n if (packager.platform === Platform.WINDOWS) {\n // noinspection JSDeprecatedSymbols\n ;(info as WindowsUpdateInfo).sha2 = await sha2.value\n }\n }\n\n if (event.safeArtifactName != null && publishConfiguration.provider === \"github\") {\n // copy the file entries (not just the array) — `info` is shared across publish configurations,\n // so mutating an entry here would leak the GitHub-safe artifact name into other providers' update info\n const newFiles = info.files.map(file => ({ ...file }))\n newFiles[0].url = event.safeArtifactName\n info = {\n ...info,\n files: newFiles,\n // legacy top-level path mirrors files[0].url; only emitted for pre-2.16 compatibility\n ...(needsLegacyPathSha512 ? { path: event.safeArtifactName } : {}),\n }\n }\n\n for (const channel of computeChannelNames(packager, publishConfiguration)) {\n if (isMac && needsLegacyMacJson && event.file.endsWith(\".zip\")) {\n // write only for first channel (generateUpdatesFilesForAllChannels is a new functionality, no need to generate old mac update info file)\n needsLegacyMacJson = false\n await writeOldMacInfo(publishConfiguration, outDir, dir, channel, createdFiles, version, packager)\n }\n\n const updateInfoFile = path.join(dir, getUpdateInfoFileName(channel, packager, event.arch))\n if (createdFiles.has(updateInfoFile)) {\n continue\n }\n\n createdFiles.add(updateInfoFile)\n\n // artifact should be uploaded only to designated publish provider\n tasks.push({\n file: updateInfoFile,\n info,\n publishConfiguration,\n packager,\n arch: event.arch,\n })\n }\n }\n return tasks\n}\n\nasync function createUpdateInfo(version: string, event: ArtifactCreated, releaseInfo: ReleaseInfo): Promise<UpdateInfo> {\n const customUpdateInfo = event.updateInfo\n const url = path.basename(event.file)\n const sha512 = (customUpdateInfo == null ? null : customUpdateInfo.sha512) || (await hashFile(event.file))\n const files = [{ url, sha512 }]\n const result: UpdateInfo = {\n // @ts-ignore\n version,\n // @ts-ignore\n files,\n ...(releaseInfo as UpdateInfo),\n }\n\n if (customUpdateInfo != null) {\n // file info or nsis web installer packages info\n Object.assign(\"sha512\" in customUpdateInfo ? files[0] : result, customUpdateInfo)\n }\n return result\n}\n\nexport async function writeUpdateInfoFiles(updateInfoFileTasks: Array<UpdateInfoFileTask>, packager: Packager) {\n // zip must be first and zip info must be used for old path/sha512 properties in the update info\n // universal installer (arch === null) must precede arch-specific ones so path:/sha512: point to the right artifact\n updateInfoFileTasks.sort((a, b) => {\n const zipDiff = (a.info.files[0].url.endsWith(\".zip\") ? 0 : 100) - (b.info.files[0].url.endsWith(\".zip\") ? 0 : 100)\n if (zipDiff !== 0) {\n return zipDiff\n }\n // universal (arch === null) before arch-specific; tie-break by Arch enum value for full determinism\n // undefined arch (external callers predating this field) treated as arch-specific via strict === null check\n const aArch = a.arch === null ? -1 : (a.arch ?? Number.MAX_SAFE_INTEGER)\n const bArch = b.arch === null ? -1 : (b.arch ?? Number.MAX_SAFE_INTEGER)\n return aArch - bArch\n })\n\n const updateChannelFileToInfo = new Map<string, UpdateInfoFileTask>()\n for (const task of updateInfoFileTasks) {\n // https://github.com/electron-userland/electron-builder/pull/2994\n const key = `${task.file}@${safeStringifyJson(task.publishConfiguration, new Set([\"releaseType\"]))}`\n const existingTask = updateChannelFileToInfo.get(key)\n if (existingTask == null) {\n updateChannelFileToInfo.set(key, task)\n continue\n }\n\n existingTask.info.files.push(...task.info.files)\n }\n\n const releaseDate = new Date().toISOString()\n const concurrency = 4\n await asyncPool<UpdateInfoFileTask, void>(concurrency, Array.from(updateChannelFileToInfo.values()), async task => {\n const publishConfig = task.publishConfiguration\n if (publishConfig.publishAutoUpdate === false) {\n log.debug(\n {\n provider: publishConfig.provider,\n reason: \"publishAutoUpdate is set to false\",\n },\n \"auto update metadata file not published\"\n )\n return\n }\n\n if (task.info.releaseDate == null) {\n task.info.releaseDate = releaseDate\n }\n\n const fileContent = Buffer.from(serializeToYaml(task.info, false, true))\n await fsExtra.outputFile(task.file, fileContent)\n await packager.emitArtifactCreated({\n file: task.file,\n fileContent,\n arch: null,\n packager: task.packager,\n target: null,\n publishConfig,\n })\n })\n}\n\n// backward compatibility - write json file\nasync function writeOldMacInfo(\n publishConfig: PublishConfiguration,\n outDir: string,\n dir: string,\n channel: string,\n createdFiles: Set<string>,\n version: string,\n packager: PlatformPackager<any>\n) {\n const isGitHub = publishConfig.provider === \"github\"\n const updateInfoFile = isGitHub && outDir === dir ? path.join(dir, \"github\", `${channel}-mac.json`) : path.join(dir, `${channel}-mac.json`)\n if (!createdFiles.has(updateInfoFile)) {\n createdFiles.add(updateInfoFile)\n await fsExtra.outputJson(\n updateInfoFile,\n {\n version,\n releaseDate: new Date().toISOString(),\n url: computeDownloadUrl(publishConfig, packager.generateName2(\"zip\", \"mac\", isGitHub), packager),\n },\n { spaces: 2 }\n )\n\n await packager.emitArtifactCreated({\n file: updateInfoFile,\n arch: null,\n packager,\n target: null,\n publishConfig,\n })\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FlatpakTarget.d.ts","sourceRoot":"","sources":["../../../src/targets/linux/FlatpakTarget.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAA+B,MAAM,cAAc,CAAA;AAGhE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAO1D,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,MAAM;IAK7C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,MAAM;IACd,QAAQ,CAAC,MAAM,EAAE,MAAM;IANzB,QAAQ,CAAC,OAAO,EAAE,cAAc,CAA+D;gBAG7F,IAAI,EAAE,MAAM,EACK,QAAQ,EAAE,aAAa,EAChC,MAAM,EAAE,iBAAiB,EACxB,MAAM,EAAE,MAAM;IAKzB,IAAI,KAAK,IAAI,MAAM,CAElB;IAEK,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;YA2B1C,eAAe;YAQf,uBAAuB;YAOvB,iBAAiB;YAMjB,eAAe;YAQf,SAAS;IAiBvB,OAAO,CAAC,wBAAwB;CA8BjC"}
1
+ {"version":3,"file":"FlatpakTarget.d.ts","sourceRoot":"","sources":["../../../src/targets/linux/FlatpakTarget.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAwD,MAAM,cAAc,CAAA;AAGzF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAO1D,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,MAAM;IAK7C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,MAAM;IACd,QAAQ,CAAC,MAAM,EAAE,MAAM;IANzB,QAAQ,CAAC,OAAO,EAAE,cAAc,CAA+D;gBAG7F,IAAI,EAAE,MAAM,EACK,QAAQ,EAAE,aAAa,EAChC,MAAM,EAAE,iBAAiB,EACxB,MAAM,EAAE,MAAM;IAKzB,IAAI,KAAK,IAAI,MAAM,CAElB;IAEK,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;YA2B1C,eAAe;YAQf,uBAAuB;YAOvB,iBAAiB;YAMjB,eAAe;YAQf,SAAS;IAiBvB,OAAO,CAAC,wBAAwB;CA8BjC"}
@@ -1,5 +1,5 @@
1
1
  import { bundle as bundleFlatpak } from "@malept/flatpak-bundler";
2
- import { copyFile, toLinuxArchString } from "builder-util";
2
+ import { copyFile, toLinuxArchString, validateShellEmbeddable } from "builder-util";
3
3
  import * as path from "path";
4
4
  import { Target } from "../../core.js";
5
5
  import { getNotLocalizedLicenseFile } from "../../util/license.js";
@@ -129,6 +129,9 @@ const flatpakBuilderDefaults = {
129
129
  ],
130
130
  };
131
131
  function getElectronWrapperScript(executableName, executableArgs, useWaylandFlags) {
132
+ // executableName is interpolated into the generated POSIX wrapper script below; reject shell
133
+ // metacharacters (matches the snap and AppImage targets) so it cannot inject shell commands.
134
+ validateShellEmbeddable(executableName, "executableName");
132
135
  // Single-quote each arg so embedded characters (spaces, =, quotes) are passed literally,
133
136
  // consistent with the other Linux launcher entrypoints.
134
137
  const stringifiedExecutableArgs = (executableArgs ?? []).map(shellQuote).join(" ");
@@ -1 +1 @@
1
- {"version":3,"file":"FlatpakTarget.js","sourceRoot":"","sources":["../../../src/targets/linux/FlatpakTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,aAAa,EAA+C,MAAM,yBAAyB,CAAA;AAC9G,OAAO,EAAQ,QAAQ,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAEhE,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAGtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAA;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAY,MAAM,kBAAkB,CAAA;AAE3D,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAA;AAEtC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,MAAM;IAG/C,YACE,IAAY,EACK,QAAuB,EAChC,MAAyB,EACxB,MAAc;QAEvB,KAAK,CAAC,IAAI,CAAC,CAAA;QAJM,aAAQ,GAAR,QAAQ,CAAe;QAChC,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AAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAClF,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO;;;;;qBAKU,cAAc,KAAK,yBAAyB;;qBAE5C,cAAc,KAAK,yBAAyB;;CAEhE,CAAA;IACC,CAAC;IACD,OAAO;;;;iBAIQ,cAAc,KAAK,yBAAyB;CAC5D,CAAA;AACD,CAAC;AAED,SAAS,0BAA0B,CAAC,UAAkB;IACpD,sGAAsG;IACtG,6FAA6F;IAC7F,OAAO,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAA;AACrE,CAAC","sourcesContent":["import { bundle as bundleFlatpak, FlatpakBundlerBuildOptions, FlatpakManifest } from \"@malept/flatpak-bundler\"\nimport { Arch, copyFile, toLinuxArchString } from \"builder-util\"\n\nimport * as path from \"path\"\nimport { Target } from \"../../core.js\"\nimport { LinuxPackager } from \"../../linuxPackager.js\"\nimport { FlatpakOptions } from \"../../options/linuxOptions.js\"\nimport { getNotLocalizedLicenseFile } from \"../../util/license.js\"\nimport { LinuxTargetHelper } from \"./LinuxTargetHelper.js\"\nimport { shellQuote } from \"./launcherScript.js\"\nimport { createStageDir, StageDir } from \"../targetUtil.js\"\nimport { Nullish } from \"builder-util-runtime\"\nimport _fsExtra from \"fs-extra\"\nconst { chmod, outputFile } = _fsExtra\n\nexport default class FlatpakTarget extends Target {\n readonly options: FlatpakOptions = this.packager.getOptionsForTarget<FlatpakOptions>(this.name)\n\n constructor(\n name: string,\n private readonly packager: LinuxPackager,\n private helper: LinuxTargetHelper,\n readonly outDir: string\n ) {\n super(name)\n }\n\n get appId(): string {\n return filterFlatpakAppIdentifier(this.packager.appInfo.id)\n }\n\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const { packager, options } = this\n const artifactName = packager.expandArtifactNamePattern(options, \"flatpak\", arch, undefined, false)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.emitArtifactBuildStarted({\n targetPresentableName: \"flatpak\",\n file: artifactPath,\n arch,\n })\n\n const stageDir = await this.prepareStageDir(arch)\n\n const { manifest, buildOptions } = this.getFlatpakBuilderOptions(appOutDir, stageDir.dir, artifactName, arch)\n await bundleFlatpak(manifest, buildOptions)\n\n await stageDir.cleanup()\n\n await packager.emitArtifactBuildCompleted({\n file: artifactPath,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"flatpak\", arch, false),\n target: this,\n arch,\n packager,\n isWriteUpdateInfo: false,\n })\n }\n\n private async prepareStageDir(arch: Arch): Promise<StageDir> {\n const stageDir = await createStageDir(this, this.packager, arch)\n\n await Promise.all([this.createSandboxBinWrapper(stageDir), this.createDesktopFile(stageDir), this.copyLicenseFile(stageDir), this.copyIcons(stageDir)])\n\n return stageDir\n }\n\n private async createSandboxBinWrapper(stageDir: StageDir) {\n const useWaylandFlags = !!this.options.useWaylandFlags\n const electronWrapperPath = stageDir.getTempFile(path.join(\"bin\", \"electron-wrapper\"))\n await outputFile(electronWrapperPath, getElectronWrapperScript(this.packager.executableName, this.options.executableArgs, useWaylandFlags))\n await chmod(electronWrapperPath, 0o755)\n }\n\n private async createDesktopFile(stageDir: StageDir) {\n const appIdentifier = this.appId\n const desktopFile = stageDir.getTempFile(path.join(\"share\", \"applications\", `${appIdentifier}.desktop`))\n await this.helper.writeDesktopEntry(this.options, \"electron-wrapper %U\", desktopFile, { Icon: appIdentifier })\n }\n\n private async copyLicenseFile(stageDir: StageDir) {\n const licenseSrc = await getNotLocalizedLicenseFile(this.options.license, this.packager, [\"txt\", \"html\"])\n if (licenseSrc) {\n const licenseDst = stageDir.getTempFile(path.join(\"share\", \"doc\", this.appId, \"copyright\"))\n await copyFile(licenseSrc, licenseDst)\n }\n }\n\n private async copyIcons(stageDir: StageDir) {\n const icons = await this.helper.icons\n const copyIcons = icons.map(async icon => {\n if (icon.size > 512) {\n // Flatpak does not allow icons larger than 512 pixels\n return Promise.resolve()\n }\n const extWithDot = path.extname(icon.file)\n const sizeName = extWithDot === \".svg\" ? \"scalable\" : `${icon.size}x${icon.size}`\n const iconDst = stageDir.getTempFile(path.join(\"share\", \"icons\", \"hicolor\", sizeName, \"apps\", `${this.appId}${extWithDot}`))\n\n return copyFile(icon.file, iconDst)\n })\n\n await Promise.all(copyIcons)\n }\n\n private getFlatpakBuilderOptions(appOutDir: string, stageDir: string, artifactName: string, arch: Arch): { manifest: FlatpakManifest; buildOptions: FlatpakBundlerBuildOptions } {\n const appIdentifier = this.appId\n const { executableName } = this.packager\n const flatpakArch = toLinuxArchString(arch, \"flatpak\")\n\n const manifest: FlatpakManifest = {\n id: appIdentifier,\n command: \"electron-wrapper\",\n runtime: this.options.runtime || flatpakBuilderDefaults.runtime,\n runtimeVersion: this.options.runtimeVersion || flatpakBuilderDefaults.runtimeVersion,\n sdk: this.options.sdk || flatpakBuilderDefaults.sdk,\n base: this.options.base || flatpakBuilderDefaults.base,\n baseVersion: this.options.baseVersion || flatpakBuilderDefaults.baseVersion,\n finishArgs: this.options.finishArgs || flatpakBuilderDefaults.finishArgs,\n branch: this.options.branch,\n modules: this.options.modules,\n }\n\n const buildOptions: FlatpakBundlerBuildOptions = {\n baseFlatpakref: `app/${manifest.base}/${flatpakArch}/${manifest.baseVersion}`,\n runtimeFlatpakref: `runtime/${manifest.runtime}/${flatpakArch}/${manifest.runtimeVersion}`,\n sdkFlatpakref: `runtime/${manifest.sdk}/${flatpakArch}/${manifest.runtimeVersion}`,\n arch: flatpakArch as any,\n bundlePath: path.join(this.outDir, artifactName),\n files: [[stageDir, \"/\"], [appOutDir, path.join(\"/lib\", appIdentifier)], ...(this.options.files || [])],\n symlinks: [[path.join(\"/lib\", appIdentifier, executableName), path.join(\"/bin\", executableName)], ...(this.options.symlinks || [])],\n }\n\n return { manifest, buildOptions }\n }\n}\n\nconst flatpakBuilderDefaults: Omit<FlatpakManifest, \"id\" | \"command\"> = {\n runtime: \"org.freedesktop.Platform\",\n runtimeVersion: \"20.08\",\n sdk: \"org.freedesktop.Sdk\",\n base: \"org.electronjs.Electron2.BaseApp\",\n baseVersion: \"20.08\",\n finishArgs: [\n // Wayland/X11 Rendering\n \"--socket=wayland\",\n \"--socket=x11\",\n \"--share=ipc\",\n // Open GL\n \"--device=dri\",\n // Audio output\n \"--socket=pulseaudio\",\n // Read/write home directory access\n \"--filesystem=home\",\n // Allow communication with network\n \"--share=network\",\n // System notifications with libnotify\n \"--talk-name=org.freedesktop.Notifications\",\n ],\n}\n\nfunction getElectronWrapperScript(executableName: string, executableArgs: string[] | Nullish, useWaylandFlags: boolean): string {\n // Single-quote each arg so embedded characters (spaces, =, quotes) are passed literally,\n // consistent with the other Linux launcher entrypoints.\n const stringifiedExecutableArgs = (executableArgs ?? []).map(shellQuote).join(\" \")\n if (useWaylandFlags) {\n return `#!/bin/sh\n\nexport TMPDIR=\"$XDG_RUNTIME_DIR/app/$FLATPAK_ID\"\n\nif [ \"\\${XDG_SESSION_TYPE}\" == \"wayland\" ]; then\n zypak-wrapper \"${executableName}\" ${stringifiedExecutableArgs} --enable-features=UseOzonePlatform --ozone-platform=wayland \"$@\"\nelse\n zypak-wrapper \"${executableName}\" ${stringifiedExecutableArgs} \"$@\"\nfi\n`\n }\n return `#!/bin/sh\n\nexport TMPDIR=\"$XDG_RUNTIME_DIR/app/$FLATPAK_ID\"\n\nzypak-wrapper \"${executableName}\" ${stringifiedExecutableArgs} \"$@\"\n`\n}\n\nfunction filterFlatpakAppIdentifier(identifier: string) {\n // Remove special characters and allow only alphanumeric (A-Z,a-z,0-9), underscore (_), and period (.)\n // Flatpak documentation: https://docs.flatpak.org/en/latest/conventions.html#application-ids\n return identifier.replace(/-/g, \"_\").replace(/[^a-zA-Z0-9._]/g, \"\")\n}\n"]}
1
+ {"version":3,"file":"FlatpakTarget.js","sourceRoot":"","sources":["../../../src/targets/linux/FlatpakTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,aAAa,EAA+C,MAAM,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AAI,EAAE,CAAC,CAAC;SACpI,CAAA;QAED,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAA;IACnC,CAAC;CACF;AAED,MAAM,sBAAsB,GAA4C;IACtE,OAAO,EAAE,0BAA0B;IACnC,cAAc,EAAE,OAAO;IACvB,GAAG,EAAE,qBAAqB;IAC1B,IAAI,EAAE,kCAAkC;IACxC,WAAW,EAAE,OAAO;IACpB,UAAU,EAAE;QACV,wBAAwB;QACxB,kBAAkB;QAClB,cAAc;QACd,aAAa;QACb,UAAU;QACV,cAAc;QACd,eAAe;QACf,qBAAqB;QACrB,mCAAmC;QACnC,mBAAmB;QACnB,mCAAmC;QACnC,iBAAiB;QACjB,sCAAsC;QACtC,2CAA2C;KAC5C;CACF,CAAA;AAED,SAAS,wBAAwB,CAAC,cAAsB,EAAE,cAAkC,EAAE,eAAwB;IACpH,6FAA6F;IAC7F,6FAA6F;IAC7F,uBAAuB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAA;IACzD,yFAAyF;IACzF,wDAAwD;IACxD,MAAM,yBAAyB,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAClF,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO;;;;;qBAKU,cAAc,KAAK,yBAAyB;;qBAE5C,cAAc,KAAK,yBAAyB;;CAEhE,CAAA;IACC,CAAC;IACD,OAAO;;;;iBAIQ,cAAc,KAAK,yBAAyB;CAC5D,CAAA;AACD,CAAC;AAED,SAAS,0BAA0B,CAAC,UAAkB;IACpD,sGAAsG;IACtG,6FAA6F;IAC7F,OAAO,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAA;AACrE,CAAC","sourcesContent":["import { bundle as bundleFlatpak, FlatpakBundlerBuildOptions, FlatpakManifest } from \"@malept/flatpak-bundler\"\nimport { Arch, copyFile, toLinuxArchString, validateShellEmbeddable } from \"builder-util\"\n\nimport * as path from \"path\"\nimport { Target } from \"../../core.js\"\nimport { LinuxPackager } from \"../../linuxPackager.js\"\nimport { FlatpakOptions } from \"../../options/linuxOptions.js\"\nimport { getNotLocalizedLicenseFile } from \"../../util/license.js\"\nimport { LinuxTargetHelper } from \"./LinuxTargetHelper.js\"\nimport { shellQuote } from \"./launcherScript.js\"\nimport { createStageDir, StageDir } from \"../targetUtil.js\"\nimport { Nullish } from \"builder-util-runtime\"\nimport _fsExtra from \"fs-extra\"\nconst { chmod, outputFile } = _fsExtra\n\nexport default class FlatpakTarget extends Target {\n readonly options: FlatpakOptions = this.packager.getOptionsForTarget<FlatpakOptions>(this.name)\n\n constructor(\n name: string,\n private readonly packager: LinuxPackager,\n private helper: LinuxTargetHelper,\n readonly outDir: string\n ) {\n super(name)\n }\n\n get appId(): string {\n return filterFlatpakAppIdentifier(this.packager.appInfo.id)\n }\n\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const { packager, options } = this\n const artifactName = packager.expandArtifactNamePattern(options, \"flatpak\", arch, undefined, false)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.emitArtifactBuildStarted({\n targetPresentableName: \"flatpak\",\n file: artifactPath,\n arch,\n })\n\n const stageDir = await this.prepareStageDir(arch)\n\n const { manifest, buildOptions } = this.getFlatpakBuilderOptions(appOutDir, stageDir.dir, artifactName, arch)\n await bundleFlatpak(manifest, buildOptions)\n\n await stageDir.cleanup()\n\n await packager.emitArtifactBuildCompleted({\n file: artifactPath,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"flatpak\", arch, false),\n target: this,\n arch,\n packager,\n isWriteUpdateInfo: false,\n })\n }\n\n private async prepareStageDir(arch: Arch): Promise<StageDir> {\n const stageDir = await createStageDir(this, this.packager, arch)\n\n await Promise.all([this.createSandboxBinWrapper(stageDir), this.createDesktopFile(stageDir), this.copyLicenseFile(stageDir), this.copyIcons(stageDir)])\n\n return stageDir\n }\n\n private async createSandboxBinWrapper(stageDir: StageDir) {\n const useWaylandFlags = !!this.options.useWaylandFlags\n const electronWrapperPath = stageDir.getTempFile(path.join(\"bin\", \"electron-wrapper\"))\n await outputFile(electronWrapperPath, getElectronWrapperScript(this.packager.executableName, this.options.executableArgs, useWaylandFlags))\n await chmod(electronWrapperPath, 0o755)\n }\n\n private async createDesktopFile(stageDir: StageDir) {\n const appIdentifier = this.appId\n const desktopFile = stageDir.getTempFile(path.join(\"share\", \"applications\", `${appIdentifier}.desktop`))\n await this.helper.writeDesktopEntry(this.options, \"electron-wrapper %U\", desktopFile, { Icon: appIdentifier })\n }\n\n private async copyLicenseFile(stageDir: StageDir) {\n const licenseSrc = await getNotLocalizedLicenseFile(this.options.license, this.packager, [\"txt\", \"html\"])\n if (licenseSrc) {\n const licenseDst = stageDir.getTempFile(path.join(\"share\", \"doc\", this.appId, \"copyright\"))\n await copyFile(licenseSrc, licenseDst)\n }\n }\n\n private async copyIcons(stageDir: StageDir) {\n const icons = await this.helper.icons\n const copyIcons = icons.map(async icon => {\n if (icon.size > 512) {\n // Flatpak does not allow icons larger than 512 pixels\n return Promise.resolve()\n }\n const extWithDot = path.extname(icon.file)\n const sizeName = extWithDot === \".svg\" ? \"scalable\" : `${icon.size}x${icon.size}`\n const iconDst = stageDir.getTempFile(path.join(\"share\", \"icons\", \"hicolor\", sizeName, \"apps\", `${this.appId}${extWithDot}`))\n\n return copyFile(icon.file, iconDst)\n })\n\n await Promise.all(copyIcons)\n }\n\n private getFlatpakBuilderOptions(appOutDir: string, stageDir: string, artifactName: string, arch: Arch): { manifest: FlatpakManifest; buildOptions: FlatpakBundlerBuildOptions } {\n const appIdentifier = this.appId\n const { executableName } = this.packager\n const flatpakArch = toLinuxArchString(arch, \"flatpak\")\n\n const manifest: FlatpakManifest = {\n id: appIdentifier,\n command: \"electron-wrapper\",\n runtime: this.options.runtime || flatpakBuilderDefaults.runtime,\n runtimeVersion: this.options.runtimeVersion || flatpakBuilderDefaults.runtimeVersion,\n sdk: this.options.sdk || flatpakBuilderDefaults.sdk,\n base: this.options.base || flatpakBuilderDefaults.base,\n baseVersion: this.options.baseVersion || flatpakBuilderDefaults.baseVersion,\n finishArgs: this.options.finishArgs || flatpakBuilderDefaults.finishArgs,\n branch: this.options.branch,\n modules: this.options.modules,\n }\n\n const buildOptions: FlatpakBundlerBuildOptions = {\n baseFlatpakref: `app/${manifest.base}/${flatpakArch}/${manifest.baseVersion}`,\n runtimeFlatpakref: `runtime/${manifest.runtime}/${flatpakArch}/${manifest.runtimeVersion}`,\n sdkFlatpakref: `runtime/${manifest.sdk}/${flatpakArch}/${manifest.runtimeVersion}`,\n arch: flatpakArch as any,\n bundlePath: path.join(this.outDir, artifactName),\n files: [[stageDir, \"/\"], [appOutDir, path.join(\"/lib\", appIdentifier)], ...(this.options.files || [])],\n symlinks: [[path.join(\"/lib\", appIdentifier, executableName), path.join(\"/bin\", executableName)], ...(this.options.symlinks || [])],\n }\n\n return { manifest, buildOptions }\n }\n}\n\nconst flatpakBuilderDefaults: Omit<FlatpakManifest, \"id\" | \"command\"> = {\n runtime: \"org.freedesktop.Platform\",\n runtimeVersion: \"20.08\",\n sdk: \"org.freedesktop.Sdk\",\n base: \"org.electronjs.Electron2.BaseApp\",\n baseVersion: \"20.08\",\n finishArgs: [\n // Wayland/X11 Rendering\n \"--socket=wayland\",\n \"--socket=x11\",\n \"--share=ipc\",\n // Open GL\n \"--device=dri\",\n // Audio output\n \"--socket=pulseaudio\",\n // Read/write home directory access\n \"--filesystem=home\",\n // Allow communication with network\n \"--share=network\",\n // System notifications with libnotify\n \"--talk-name=org.freedesktop.Notifications\",\n ],\n}\n\nfunction getElectronWrapperScript(executableName: string, executableArgs: string[] | Nullish, useWaylandFlags: boolean): string {\n // executableName is interpolated into the generated POSIX wrapper script below; reject shell\n // metacharacters (matches the snap and AppImage targets) so it cannot inject shell commands.\n validateShellEmbeddable(executableName, \"executableName\")\n // Single-quote each arg so embedded characters (spaces, =, quotes) are passed literally,\n // consistent with the other Linux launcher entrypoints.\n const stringifiedExecutableArgs = (executableArgs ?? []).map(shellQuote).join(\" \")\n if (useWaylandFlags) {\n return `#!/bin/sh\n\nexport TMPDIR=\"$XDG_RUNTIME_DIR/app/$FLATPAK_ID\"\n\nif [ \"\\${XDG_SESSION_TYPE}\" == \"wayland\" ]; then\n zypak-wrapper \"${executableName}\" ${stringifiedExecutableArgs} --enable-features=UseOzonePlatform --ozone-platform=wayland \"$@\"\nelse\n zypak-wrapper \"${executableName}\" ${stringifiedExecutableArgs} \"$@\"\nfi\n`\n }\n return `#!/bin/sh\n\nexport TMPDIR=\"$XDG_RUNTIME_DIR/app/$FLATPAK_ID\"\n\nzypak-wrapper \"${executableName}\" ${stringifiedExecutableArgs} \"$@\"\n`\n}\n\nfunction filterFlatpakAppIdentifier(identifier: string) {\n // Remove special characters and allow only alphanumeric (A-Z,a-z,0-9), underscore (_), and period (.)\n // Flatpak documentation: https://docs.flatpak.org/en/latest/conventions.html#application-ids\n return identifier.replace(/-/g, \"_\").replace(/[^a-zA-Z0-9._]/g, \"\")\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FpmTarget.d.ts","sourceRoot":"","sources":["../../../src/targets/linux/FpmTarget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA4G,MAAM,cAAc,CAAA;AAQ7I,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAc,0BAA0B,EAAE,MAAM,+BAA+B,CAAA;AAWtF,OAAO,EAAiB,iBAAiB,EAAwB,MAAM,wBAAwB,CAAA;AAgB/F,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,MAAM;IAOzC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM;IARzB,QAAQ,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oD3B,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC;YAId,yBAAyB;IA+BjC,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;IAmMxD;;;;OAIG;YACW,oBAAoB;YAcpB,UAAU;IAmDxB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,iBAAiB;IAyBzB,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,8BAA8B;CAWvC"}
@@ -233,6 +233,15 @@ export default class FpmTarget extends Target {
233
233
  const env = {
234
234
  ...stripSensitiveEnvVars(process.env),
235
235
  };
236
+ // fpm compresses the deb data.tar by piping GNU tar -J, which exports only
237
+ // XZ_OPT=-<level> — so xz runs single-threaded regardless of the machine,
238
+ // while rpm already defaults to multithreaded "xzmt" (measured on one
239
+ // 6.4 GiB tree in one run: deb 1059s vs rpm 171s). xz parses XZ_DEFAULTS
240
+ // before XZ_OPT, so -T0 multithreads the deb pack at the unchanged
241
+ // compression level; an operator-provided XZ_DEFAULTS wins. Fixes #10045.
242
+ if (target === "deb" && process.env.XZ_DEFAULTS == null) {
243
+ env.XZ_DEFAULTS = "-T0";
244
+ }
236
245
  // rpmbuild wants directory rpm with some default config files. Even if we can use dylibbundler, path to such config files are not changed (we need to replace in the binary)
237
246
  // so, for now, brew install rpm is still required.
238
247
  if (target !== "rpm" && (await isMacOsSierra())) {