app-builder-lib 26.16.1 → 26.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/node-module-collector/index.js +48 -15
- package/out/node-module-collector/index.js.map +1 -1
- package/out/node-module-collector/moduleManager.d.ts +7 -1
- package/out/node-module-collector/moduleManager.js +2 -2
- package/out/node-module-collector/moduleManager.js.map +1 -1
- package/out/node-module-collector/nodeModulesCollector.d.ts +7 -3
- package/out/node-module-collector/nodeModulesCollector.js +14 -5
- package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/out/node-module-collector/pnpmNodeModulesCollector.d.ts +42 -0
- package/out/node-module-collector/pnpmNodeModulesCollector.js +146 -0
- package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
- package/out/targets/FlatpakTarget.js +6 -1
- package/out/targets/FlatpakTarget.js.map +1 -1
- package/out/targets/archive.d.ts +12 -0
- package/out/targets/archive.js +45 -1
- package/out/targets/archive.js.map +1 -1
- package/out/targets/nsis/NsisTarget.js +4 -0
- package/out/targets/nsis/NsisTarget.js.map +1 -1
- package/out/targets/nsis/nsisOptions.d.ts +15 -2
- package/out/targets/nsis/nsisOptions.js.map +1 -1
- package/out/targets/pkg.d.ts +16 -0
- package/out/targets/pkg.js +27 -0
- package/out/targets/pkg.js.map +1 -1
- package/out/util/appFileCopier.d.ts +5 -0
- package/out/util/appFileCopier.js +19 -1
- package/out/util/appFileCopier.js.map +1 -1
- package/out/version.d.ts +1 -1
- package/out/version.js +1 -1
- package/out/version.js.map +1 -1
- package/package.json +7 -7
- package/scheme.json +16 -4
package/out/targets/pkg.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.PkgTarget = void 0;
|
|
|
4
4
|
exports.prepareProductBuildArgs = prepareProductBuildArgs;
|
|
5
5
|
exports.resolvePkgBuildVersion = resolvePkgBuildVersion;
|
|
6
6
|
exports.resolveScriptsDir = resolveScriptsDir;
|
|
7
|
+
exports.applyRootVolumeOnly = applyRootVolumeOnly;
|
|
7
8
|
const builder_util_1 = require("builder-util");
|
|
8
9
|
const fs_1 = require("fs");
|
|
9
10
|
const promises_1 = require("fs/promises");
|
|
@@ -152,6 +153,9 @@ class PkgTarget extends core_1.Target {
|
|
|
152
153
|
});
|
|
153
154
|
distInfo = distInfo.replace("</installer-gui-script>", `${startContent}${mustCloseContent}${endContent}`);
|
|
154
155
|
}
|
|
156
|
+
// Must run before the insertion index is computed below: rewriting <options> changes the string length, and every
|
|
157
|
+
// later insertion (background/welcome/license/conclusion) reuses that index.
|
|
158
|
+
distInfo = applyRootVolumeOnly(distInfo, options);
|
|
155
159
|
const insertIndex = distInfo.lastIndexOf("</installer-gui-script>");
|
|
156
160
|
distInfo =
|
|
157
161
|
distInfo.substring(0, insertIndex) +
|
|
@@ -276,4 +280,27 @@ function resolveScriptsDir(buildResourcesDir, scripts) {
|
|
|
276
280
|
}
|
|
277
281
|
return scripts != null ? path.resolve(buildResourcesDir, scripts) : path.join(buildResourcesDir, "pkg-scripts");
|
|
278
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* Adds `rootVolumeOnly="true"` to the `<options>` element of a synthesized `distribution.xml`.
|
|
285
|
+
*
|
|
286
|
+
* `<domains>` is a deprecated Distribution element. On macOS 26 the Installer probes the current-user-home domain while
|
|
287
|
+
* parsing it — even with `enable_currentUserHome="false"` — which trips `kTCCServiceSystemPolicyAppData` and makes
|
|
288
|
+
* Installer.app ask for "data from other apps" before any file is written. `rootVolumeOnly` is the current spelling of
|
|
289
|
+
* the same restriction and leaves the install-domain decision unchanged.
|
|
290
|
+
*
|
|
291
|
+
* Only applied when both user-home install domains are disabled, which is exactly when `<domains>` and
|
|
292
|
+
* `rootVolumeOnly` express the same thing. The `<domains>` element is left byte-for-byte as generated, so
|
|
293
|
+
* distributions that rely on it keep working as before.
|
|
294
|
+
*
|
|
295
|
+
* Assumes the document contains the `<options …>` element emitted by `productbuild --synthesize`, which is always the
|
|
296
|
+
* case for a component-based distribution.
|
|
297
|
+
*/
|
|
298
|
+
function applyRootVolumeOnly(distInfo, options) {
|
|
299
|
+
if (options.allowAnywhere !== false || options.allowCurrentUserHome !== false) {
|
|
300
|
+
return distInfo;
|
|
301
|
+
}
|
|
302
|
+
// `String.replace` with a string pattern substitutes the first occurrence only, which is the installer-gui-script's
|
|
303
|
+
// own <options> element.
|
|
304
|
+
return distInfo.replace("<options ", '<options rootVolumeOnly="true" ');
|
|
305
|
+
}
|
|
279
306
|
//# sourceMappingURL=pkg.js.map
|
package/out/targets/pkg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pkg.js","sourceRoot":"","sources":["../../src/targets/pkg.ts"],"names":[],"mappings":";;;AA2RA,0DASC;AAOD,wDASC;AAQD,8CAKC;AAjUD,+CAAiE;AAEjE,2BAAgC;AAChC,0CAAyD;AACzD,6BAA4B;AAC5B,wCAAqD;AACrD,yDAAgE;AAChE,kCAAgC;AAGhC,yCAA0E;AAC1E,6CAA4D;AAE5D,MAAM,QAAQ,GAAG,wBAAwB,CAAA;AAEzC,+FAA+F;AAC/F,SAAS,wBAAwB,CAAC,IAAU;IAC1C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,mBAAI,CAAC,KAAK;YACb,OAAO,CAAC,OAAO,CAAC,CAAA;QAClB,KAAK,mBAAI,CAAC,GAAG;YACX,OAAO,CAAC,QAAQ,CAAC,CAAA;QACnB,KAAK,mBAAI,CAAC,SAAS;YACjB,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;QAC5B,KAAK,mBAAI,CAAC,IAAI;YACZ,OAAO,CAAC,MAAM,CAAC,CAAA;QACjB;YACE,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;IAC9B,CAAC;AACH,CAAC;AAOD,kEAAkE;AAClE,wEAAwE;AACxE,8FAA8F;AAC9F,2FAA2F;AAC3F,MAAa,SAAU,SAAQ,aAAM;IAQnC,YACmB,QAAqB,EAC7B,MAAc;QAEv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AA;IAC/E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAA;IACjB,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,iBAAyB,EAAE,OAAkC;IAC7F,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAA;AACjH,CAAC","sourcesContent":["import { Arch, debug, exec, statOrNull, use } from \"builder-util\"\nimport { Nullish } from \"builder-util-runtime\"\nimport { readdirSync } from \"fs\"\nimport { readFile, unlink, writeFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { filterCFBundleIdentifier } from \"../appInfo\"\nimport { findIdentity, Identity } from \"../codeSign/macCodeSign\"\nimport { Target } from \"../core\"\nimport { MacPackager } from \"../macPackager\"\nimport { PkgOptions } from \"../options/pkgOptions\"\nimport { savePlistFile, parsePlistFile, PlistObject } from \"../util/plist\"\nimport { getNotLocalizedLicenseFile } from \"../util/license\"\n\nconst certType = \"Developer ID Installer\"\n\n// Maps electron-builder Arch to Apple's architecture names for productbuild requirements plist\nfunction archToAppleArchitectures(arch: Arch): string[] {\n switch (arch) {\n case Arch.arm64:\n return [\"arm64\"]\n case Arch.x64:\n return [\"x86_64\"]\n case Arch.universal:\n return [\"arm64\", \"x86_64\"]\n case Arch.ia32:\n return [\"i386\"]\n default:\n return [\"arm64\", \"x86_64\"]\n }\n}\n\ntype ExtraPackages = {\n packagePath: string\n packages: string[]\n}\n\n// http://www.shanekirk.com/2013/10/creating-flat-packages-in-osx/\n// to use --scripts, we must build .app bundle separately using pkgbuild\n// productbuild --scripts doesn't work (because scripts in this case not added to our package)\n// https://github.com/electron-userland/@electron/osx-sign/issues/96#issuecomment-274986942\nexport class PkgTarget extends Target {\n readonly options: PkgOptions = {\n allowAnywhere: true,\n allowCurrentUserHome: true,\n allowRootDirectory: true,\n ...this.packager.config.pkg,\n }\n\n constructor(\n private readonly packager: MacPackager,\n readonly outDir: string\n ) {\n super(\"pkg\")\n }\n\n async build(appPath: string, arch: Arch): Promise<any> {\n const packager = this.packager\n const options = this.options\n const appInfo = packager.appInfo\n\n // pkg doesn't like not ASCII symbols (Could not open package to list files: /Volumes/test/t-gIjdGK/test-project-0/dist/Test App ßW-1.1.0.pkg)\n const artifactName = packager.expandArtifactNamePattern(options, \"pkg\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"pkg\",\n file: artifactPath,\n arch,\n })\n\n const keychainFile = (await packager.codeSigningInfo.value).keychainFile\n\n const appOutDir = this.outDir\n // https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html\n const distInfoFile = path.join(appOutDir, \"distribution.xml\")\n\n const extraPackages = this.getExtraPackages()\n\n const innerPackageFile = path.join(appOutDir, `${filterCFBundleIdentifier(appInfo.id)}.pkg`)\n const componentPropertyListFile = path.join(appOutDir, `${filterCFBundleIdentifier(appInfo.id)}.plist`)\n const identity = (\n await Promise.all([\n findIdentity(certType, options.identity || packager.platformSpecificBuildOptions.identity, keychainFile),\n this.customizeDistributionConfiguration(distInfoFile, appPath, extraPackages, arch),\n this.buildComponentPackage(appPath, componentPropertyListFile, innerPackageFile),\n ])\n )[0]\n\n if (identity == null && packager.forceCodeSigning) {\n throw new Error(`Cannot find valid \"${certType}\" to sign standalone installer, please see https://electron.build/code-signing`)\n }\n\n const args = prepareProductBuildArgs(identity, keychainFile)\n args.push(\"--distribution\", distInfoFile)\n if (extraPackages) {\n args.push(\"--package-path\", extraPackages.packagePath)\n }\n args.push(artifactPath)\n use(options.productbuild, it => args.push(...(it as any)))\n await exec(\"productbuild\", args, {\n cwd: appOutDir,\n })\n await Promise.all([unlink(innerPackageFile), unlink(distInfoFile)])\n await packager.helper.notarizeIfProvided(artifactPath)\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n target: this,\n arch,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"pkg\", arch),\n packager,\n })\n }\n\n private getExtraPackages(): ExtraPackages | null {\n const extraPkgsDir = this.options.extraPkgsDir\n if (extraPkgsDir == null) {\n return null\n }\n const packagePath = path.join(this.packager.info.buildResourcesDir, extraPkgsDir)\n let files: Array<string>\n try {\n files = readdirSync(packagePath)\n } catch (e: any) {\n if (e.code === \"ENOENT\") {\n return null\n } else {\n throw e\n }\n }\n const packages = files.filter(file => file.endsWith(\".pkg\"))\n if (packages.length === 0) {\n return null\n }\n return { packagePath, packages }\n }\n\n private async customizeDistributionConfiguration(distInfoFile: string, appPath: string, extraPackages: ExtraPackages | null, arch: Arch) {\n const options = this.options\n\n // Build requirements plist for productbuild to generate correct hostArchitectures and allowed-os-versions\n // This is the Apple-recommended way to specify architecture and OS requirements\n // See: man productbuild, section \"PRE-INSTALL REQUIREMENTS PROPERTY LIST\"\n const requirements: Record<string, any> = {}\n\n // Set architecture based on build target - productbuild will generate correct hostArchitectures in distribution XML\n // On macOS Big Sur+, productbuild defaults to both arm64 and x86_64 unless we specify otherwise\n requirements.arch = archToAppleArchitectures(arch)\n\n // Set minimum OS version - productbuild will generate allowed-os-versions in distribution XML\n const minimumSystemVersion = this.packager.platformSpecificBuildOptions.minimumSystemVersion\n if (minimumSystemVersion != null) {\n requirements.os = [minimumSystemVersion]\n }\n\n const requirementsPlistFile = await this.packager.info.tempDirManager.getTempFile({ suffix: \".plist\", prefix: \"productbuild-requirements\" })\n await savePlistFile(requirementsPlistFile, requirements)\n\n const args = [\"--synthesize\", \"--product\", requirementsPlistFile, \"--component\", appPath]\n if (extraPackages) {\n extraPackages.packages.forEach(pkg => {\n args.push(\"--package\", path.join(extraPackages.packagePath, pkg))\n })\n }\n args.push(distInfoFile)\n await exec(\"productbuild\", args, {\n cwd: this.outDir,\n })\n\n let distInfo = await readFile(distInfoFile, \"utf-8\")\n\n if (options.mustClose != null && options.mustClose.length !== 0) {\n const startContent = ` <pkg-ref id=\"${this.packager.appInfo.id}\">\\n <must-close>\\n`\n const endContent = \" </must-close>\\n </pkg-ref>\\n</installer-gui-script>\"\n let mustCloseContent = \"\"\n options.mustClose.forEach(appId => {\n mustCloseContent += ` <app id=\"${appId}\"/>\\n`\n })\n distInfo = distInfo.replace(\"</installer-gui-script>\", `${startContent}${mustCloseContent}${endContent}`)\n }\n\n const insertIndex = distInfo.lastIndexOf(\"</installer-gui-script>\")\n distInfo =\n distInfo.substring(0, insertIndex) +\n ` <domains enable_anywhere=\"${options.allowAnywhere}\" enable_currentUserHome=\"${options.allowCurrentUserHome}\" enable_localSystem=\"${options.allowRootDirectory}\" />\\n` +\n distInfo.substring(insertIndex)\n\n if (options.background != null) {\n const background = await this.packager.getResource(options.background.file)\n if (background != null) {\n const alignment = options.background.alignment || \"center\"\n // noinspection SpellCheckingInspection\n const scaling = options.background.scaling || \"tofit\"\n distInfo = distInfo.substring(0, insertIndex) + ` <background file=\"${background}\" alignment=\"${alignment}\" scaling=\"${scaling}\"/>\\n` + distInfo.substring(insertIndex)\n distInfo =\n distInfo.substring(0, insertIndex) + ` <background-darkAqua file=\"${background}\" alignment=\"${alignment}\" scaling=\"${scaling}\"/>\\n` + distInfo.substring(insertIndex)\n }\n }\n\n const welcome = await this.packager.getResource(options.welcome)\n if (welcome != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <welcome file=\"${welcome}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n const license = await getNotLocalizedLicenseFile(options.license, this.packager)\n if (license != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <license file=\"${license}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n const conclusion = await this.packager.getResource(options.conclusion)\n if (conclusion != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <conclusion file=\"${conclusion}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n debug(distInfo)\n await writeFile(distInfoFile, distInfo)\n }\n\n private async buildComponentPackage(appPath: string, propertyListOutputFile: string, packageOutputFile: string) {\n const options = this.options\n const rootPath = path.dirname(appPath)\n\n // first produce a component plist template\n await exec(\"pkgbuild\", [\"--analyze\", \"--root\", rootPath, propertyListOutputFile])\n\n // process the template plist\n const plistInfo = (await parsePlistFile<PlistObject[]>(propertyListOutputFile)).filter((it: PlistObject) => it.RootRelativeBundlePath !== \"Electron.dSYM\")\n let packageInfo: any = {}\n if (plistInfo.length > 0) {\n packageInfo = plistInfo[0]\n\n // ChildBundles lists all of electron binaries within the .app.\n // There is no particular reason for removing that key, except to be as close as possible to\n // the PackageInfo generated by previous versions of electron-builder.\n delete packageInfo.ChildBundles\n\n if (options.isRelocatable != null) {\n packageInfo.BundleIsRelocatable = options.isRelocatable\n }\n\n if (options.isVersionChecked != null) {\n packageInfo.BundleIsVersionChecked = options.isVersionChecked\n }\n\n if (options.hasStrictIdentifier != null) {\n packageInfo.BundleHasStrictIdentifier = options.hasStrictIdentifier\n }\n\n if (options.overwriteAction != null) {\n packageInfo.BundleOverwriteAction = options.overwriteAction\n }\n }\n\n // now build the package\n const args = [\"--root\", rootPath, \"--identifier\", this.packager.appInfo.id, \"--component-plist\", propertyListOutputFile]\n\n use(this.options.installLocation || \"/Applications\", it => args.push(\"--install-location\", it))\n\n // Pass the version explicitly — macOS 15+ pkgbuild no longer infers it from the bundle\n const pkgVersion = await resolvePkgBuildVersion(appPath, this.packager.appInfo.version)\n args.push(\"--version\", pkgVersion)\n\n const scriptsDir = resolveScriptsDir(this.packager.info.buildResourcesDir, options.scripts)\n if (scriptsDir && (await statOrNull(scriptsDir))?.isDirectory()) {\n const dirContents = readdirSync(scriptsDir)\n dirContents.forEach(name => {\n if (name.includes(\"preinstall\")) {\n packageInfo.BundlePreInstallScriptPath = name\n } else if (name.includes(\"postinstall\")) {\n packageInfo.BundlePostInstallScriptPath = name\n }\n })\n args.push(\"--scripts\", scriptsDir)\n }\n if (plistInfo.length > 0) {\n await savePlistFile(propertyListOutputFile, plistInfo)\n }\n\n args.push(packageOutputFile)\n\n await exec(\"pkgbuild\", args)\n }\n}\n\nexport function prepareProductBuildArgs(identity: Identity | null, keychain: string | Nullish): Array<string> {\n const args: Array<string> = []\n if (identity != null) {\n args.push(\"--sign\", identity.hash!)\n if (keychain != null) {\n args.push(\"--keychain\", keychain)\n }\n }\n return args\n}\n\n/**\n * Resolves the version string to pass as `--version` to pkgbuild.\n * Reads CFBundleShortVersionString from the app bundle's Info.plist (what pkgbuild\n * previously inferred automatically), falling back to the appInfo version.\n */\nexport async function resolvePkgBuildVersion(appPath: string, fallback: string): Promise<string> {\n const infoPlistPath = path.join(appPath, \"Contents\", \"Info.plist\")\n try {\n const plist = await parsePlistFile<PlistObject>(infoPlistPath)\n const version = plist.CFBundleShortVersionString\n return typeof version === \"string\" && version.length > 0 ? version : fallback\n } catch {\n return fallback\n }\n}\n\n/**\n * Resolves the scripts directory path for pkgbuild.\n * Returns null when scripts is explicitly set to null (disabled).\n * Returns a custom path when scripts is a non-empty string.\n * Falls back to the default \"pkg-scripts\" directory otherwise.\n */\nexport function resolveScriptsDir(buildResourcesDir: string, scripts: string | null | undefined): string | null {\n if (scripts === null) {\n return null\n }\n return scripts != null ? path.resolve(buildResourcesDir, scripts) : path.join(buildResourcesDir, \"pkg-scripts\")\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pkg.js","sourceRoot":"","sources":["../../src/targets/pkg.ts"],"names":[],"mappings":";;;AA+RA,0DASC;AAOD,wDASC;AAQD,8CAKC;AAiBD,kDAOC;AA7VD,+CAAiE;AAEjE,2BAAgC;AAChC,0CAAyD;AACzD,6BAA4B;AAC5B,wCAAqD;AACrD,yDAAgE;AAChE,kCAAgC;AAGhC,yCAA0E;AAC1E,6CAA4D;AAE5D,MAAM,QAAQ,GAAG,wBAAwB,CAAA;AAEzC,+FAA+F;AA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AO,QAAQ,CAAA;IACjB,CAAC;IACD,oHAAoH;IACpH,yBAAyB;IACzB,OAAO,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,iCAAiC,CAAC,CAAA;AACzE,CAAC","sourcesContent":["import { Arch, debug, exec, statOrNull, use } from \"builder-util\"\nimport { Nullish } from \"builder-util-runtime\"\nimport { readdirSync } from \"fs\"\nimport { readFile, unlink, writeFile } from \"fs/promises\"\nimport * as path from \"path\"\nimport { filterCFBundleIdentifier } from \"../appInfo\"\nimport { findIdentity, Identity } from \"../codeSign/macCodeSign\"\nimport { Target } from \"../core\"\nimport { MacPackager } from \"../macPackager\"\nimport { PkgOptions } from \"../options/pkgOptions\"\nimport { savePlistFile, parsePlistFile, PlistObject } from \"../util/plist\"\nimport { getNotLocalizedLicenseFile } from \"../util/license\"\n\nconst certType = \"Developer ID Installer\"\n\n// Maps electron-builder Arch to Apple's architecture names for productbuild requirements plist\nfunction archToAppleArchitectures(arch: Arch): string[] {\n switch (arch) {\n case Arch.arm64:\n return [\"arm64\"]\n case Arch.x64:\n return [\"x86_64\"]\n case Arch.universal:\n return [\"arm64\", \"x86_64\"]\n case Arch.ia32:\n return [\"i386\"]\n default:\n return [\"arm64\", \"x86_64\"]\n }\n}\n\ntype ExtraPackages = {\n packagePath: string\n packages: string[]\n}\n\n// http://www.shanekirk.com/2013/10/creating-flat-packages-in-osx/\n// to use --scripts, we must build .app bundle separately using pkgbuild\n// productbuild --scripts doesn't work (because scripts in this case not added to our package)\n// https://github.com/electron-userland/@electron/osx-sign/issues/96#issuecomment-274986942\nexport class PkgTarget extends Target {\n readonly options: PkgOptions = {\n allowAnywhere: true,\n allowCurrentUserHome: true,\n allowRootDirectory: true,\n ...this.packager.config.pkg,\n }\n\n constructor(\n private readonly packager: MacPackager,\n readonly outDir: string\n ) {\n super(\"pkg\")\n }\n\n async build(appPath: string, arch: Arch): Promise<any> {\n const packager = this.packager\n const options = this.options\n const appInfo = packager.appInfo\n\n // pkg doesn't like not ASCII symbols (Could not open package to list files: /Volumes/test/t-gIjdGK/test-project-0/dist/Test App ßW-1.1.0.pkg)\n const artifactName = packager.expandArtifactNamePattern(options, \"pkg\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"pkg\",\n file: artifactPath,\n arch,\n })\n\n const keychainFile = (await packager.codeSigningInfo.value).keychainFile\n\n const appOutDir = this.outDir\n // https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html\n const distInfoFile = path.join(appOutDir, \"distribution.xml\")\n\n const extraPackages = this.getExtraPackages()\n\n const innerPackageFile = path.join(appOutDir, `${filterCFBundleIdentifier(appInfo.id)}.pkg`)\n const componentPropertyListFile = path.join(appOutDir, `${filterCFBundleIdentifier(appInfo.id)}.plist`)\n const identity = (\n await Promise.all([\n findIdentity(certType, options.identity || packager.platformSpecificBuildOptions.identity, keychainFile),\n this.customizeDistributionConfiguration(distInfoFile, appPath, extraPackages, arch),\n this.buildComponentPackage(appPath, componentPropertyListFile, innerPackageFile),\n ])\n )[0]\n\n if (identity == null && packager.forceCodeSigning) {\n throw new Error(`Cannot find valid \"${certType}\" to sign standalone installer, please see https://electron.build/code-signing`)\n }\n\n const args = prepareProductBuildArgs(identity, keychainFile)\n args.push(\"--distribution\", distInfoFile)\n if (extraPackages) {\n args.push(\"--package-path\", extraPackages.packagePath)\n }\n args.push(artifactPath)\n use(options.productbuild, it => args.push(...(it as any)))\n await exec(\"productbuild\", args, {\n cwd: appOutDir,\n })\n await Promise.all([unlink(innerPackageFile), unlink(distInfoFile)])\n await packager.helper.notarizeIfProvided(artifactPath)\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n target: this,\n arch,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"pkg\", arch),\n packager,\n })\n }\n\n private getExtraPackages(): ExtraPackages | null {\n const extraPkgsDir = this.options.extraPkgsDir\n if (extraPkgsDir == null) {\n return null\n }\n const packagePath = path.join(this.packager.info.buildResourcesDir, extraPkgsDir)\n let files: Array<string>\n try {\n files = readdirSync(packagePath)\n } catch (e: any) {\n if (e.code === \"ENOENT\") {\n return null\n } else {\n throw e\n }\n }\n const packages = files.filter(file => file.endsWith(\".pkg\"))\n if (packages.length === 0) {\n return null\n }\n return { packagePath, packages }\n }\n\n private async customizeDistributionConfiguration(distInfoFile: string, appPath: string, extraPackages: ExtraPackages | null, arch: Arch) {\n const options = this.options\n\n // Build requirements plist for productbuild to generate correct hostArchitectures and allowed-os-versions\n // This is the Apple-recommended way to specify architecture and OS requirements\n // See: man productbuild, section \"PRE-INSTALL REQUIREMENTS PROPERTY LIST\"\n const requirements: Record<string, any> = {}\n\n // Set architecture based on build target - productbuild will generate correct hostArchitectures in distribution XML\n // On macOS Big Sur+, productbuild defaults to both arm64 and x86_64 unless we specify otherwise\n requirements.arch = archToAppleArchitectures(arch)\n\n // Set minimum OS version - productbuild will generate allowed-os-versions in distribution XML\n const minimumSystemVersion = this.packager.platformSpecificBuildOptions.minimumSystemVersion\n if (minimumSystemVersion != null) {\n requirements.os = [minimumSystemVersion]\n }\n\n const requirementsPlistFile = await this.packager.info.tempDirManager.getTempFile({ suffix: \".plist\", prefix: \"productbuild-requirements\" })\n await savePlistFile(requirementsPlistFile, requirements)\n\n const args = [\"--synthesize\", \"--product\", requirementsPlistFile, \"--component\", appPath]\n if (extraPackages) {\n extraPackages.packages.forEach(pkg => {\n args.push(\"--package\", path.join(extraPackages.packagePath, pkg))\n })\n }\n args.push(distInfoFile)\n await exec(\"productbuild\", args, {\n cwd: this.outDir,\n })\n\n let distInfo = await readFile(distInfoFile, \"utf-8\")\n\n if (options.mustClose != null && options.mustClose.length !== 0) {\n const startContent = ` <pkg-ref id=\"${this.packager.appInfo.id}\">\\n <must-close>\\n`\n const endContent = \" </must-close>\\n </pkg-ref>\\n</installer-gui-script>\"\n let mustCloseContent = \"\"\n options.mustClose.forEach(appId => {\n mustCloseContent += ` <app id=\"${appId}\"/>\\n`\n })\n distInfo = distInfo.replace(\"</installer-gui-script>\", `${startContent}${mustCloseContent}${endContent}`)\n }\n\n // Must run before the insertion index is computed below: rewriting <options> changes the string length, and every\n // later insertion (background/welcome/license/conclusion) reuses that index.\n distInfo = applyRootVolumeOnly(distInfo, options)\n\n const insertIndex = distInfo.lastIndexOf(\"</installer-gui-script>\")\n distInfo =\n distInfo.substring(0, insertIndex) +\n ` <domains enable_anywhere=\"${options.allowAnywhere}\" enable_currentUserHome=\"${options.allowCurrentUserHome}\" enable_localSystem=\"${options.allowRootDirectory}\" />\\n` +\n distInfo.substring(insertIndex)\n\n if (options.background != null) {\n const background = await this.packager.getResource(options.background.file)\n if (background != null) {\n const alignment = options.background.alignment || \"center\"\n // noinspection SpellCheckingInspection\n const scaling = options.background.scaling || \"tofit\"\n distInfo = distInfo.substring(0, insertIndex) + ` <background file=\"${background}\" alignment=\"${alignment}\" scaling=\"${scaling}\"/>\\n` + distInfo.substring(insertIndex)\n distInfo =\n distInfo.substring(0, insertIndex) + ` <background-darkAqua file=\"${background}\" alignment=\"${alignment}\" scaling=\"${scaling}\"/>\\n` + distInfo.substring(insertIndex)\n }\n }\n\n const welcome = await this.packager.getResource(options.welcome)\n if (welcome != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <welcome file=\"${welcome}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n const license = await getNotLocalizedLicenseFile(options.license, this.packager)\n if (license != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <license file=\"${license}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n const conclusion = await this.packager.getResource(options.conclusion)\n if (conclusion != null) {\n distInfo = distInfo.substring(0, insertIndex) + ` <conclusion file=\"${conclusion}\"/>\\n` + distInfo.substring(insertIndex)\n }\n\n debug(distInfo)\n await writeFile(distInfoFile, distInfo)\n }\n\n private async buildComponentPackage(appPath: string, propertyListOutputFile: string, packageOutputFile: string) {\n const options = this.options\n const rootPath = path.dirname(appPath)\n\n // first produce a component plist template\n await exec(\"pkgbuild\", [\"--analyze\", \"--root\", rootPath, propertyListOutputFile])\n\n // process the template plist\n const plistInfo = (await parsePlistFile<PlistObject[]>(propertyListOutputFile)).filter((it: PlistObject) => it.RootRelativeBundlePath !== \"Electron.dSYM\")\n let packageInfo: any = {}\n if (plistInfo.length > 0) {\n packageInfo = plistInfo[0]\n\n // ChildBundles lists all of electron binaries within the .app.\n // There is no particular reason for removing that key, except to be as close as possible to\n // the PackageInfo generated by previous versions of electron-builder.\n delete packageInfo.ChildBundles\n\n if (options.isRelocatable != null) {\n packageInfo.BundleIsRelocatable = options.isRelocatable\n }\n\n if (options.isVersionChecked != null) {\n packageInfo.BundleIsVersionChecked = options.isVersionChecked\n }\n\n if (options.hasStrictIdentifier != null) {\n packageInfo.BundleHasStrictIdentifier = options.hasStrictIdentifier\n }\n\n if (options.overwriteAction != null) {\n packageInfo.BundleOverwriteAction = options.overwriteAction\n }\n }\n\n // now build the package\n const args = [\"--root\", rootPath, \"--identifier\", this.packager.appInfo.id, \"--component-plist\", propertyListOutputFile]\n\n use(this.options.installLocation || \"/Applications\", it => args.push(\"--install-location\", it))\n\n // Pass the version explicitly — macOS 15+ pkgbuild no longer infers it from the bundle\n const pkgVersion = await resolvePkgBuildVersion(appPath, this.packager.appInfo.version)\n args.push(\"--version\", pkgVersion)\n\n const scriptsDir = resolveScriptsDir(this.packager.info.buildResourcesDir, options.scripts)\n if (scriptsDir && (await statOrNull(scriptsDir))?.isDirectory()) {\n const dirContents = readdirSync(scriptsDir)\n dirContents.forEach(name => {\n if (name.includes(\"preinstall\")) {\n packageInfo.BundlePreInstallScriptPath = name\n } else if (name.includes(\"postinstall\")) {\n packageInfo.BundlePostInstallScriptPath = name\n }\n })\n args.push(\"--scripts\", scriptsDir)\n }\n if (plistInfo.length > 0) {\n await savePlistFile(propertyListOutputFile, plistInfo)\n }\n\n args.push(packageOutputFile)\n\n await exec(\"pkgbuild\", args)\n }\n}\n\nexport function prepareProductBuildArgs(identity: Identity | null, keychain: string | Nullish): Array<string> {\n const args: Array<string> = []\n if (identity != null) {\n args.push(\"--sign\", identity.hash!)\n if (keychain != null) {\n args.push(\"--keychain\", keychain)\n }\n }\n return args\n}\n\n/**\n * Resolves the version string to pass as `--version` to pkgbuild.\n * Reads CFBundleShortVersionString from the app bundle's Info.plist (what pkgbuild\n * previously inferred automatically), falling back to the appInfo version.\n */\nexport async function resolvePkgBuildVersion(appPath: string, fallback: string): Promise<string> {\n const infoPlistPath = path.join(appPath, \"Contents\", \"Info.plist\")\n try {\n const plist = await parsePlistFile<PlistObject>(infoPlistPath)\n const version = plist.CFBundleShortVersionString\n return typeof version === \"string\" && version.length > 0 ? version : fallback\n } catch {\n return fallback\n }\n}\n\n/**\n * Resolves the scripts directory path for pkgbuild.\n * Returns null when scripts is explicitly set to null (disabled).\n * Returns a custom path when scripts is a non-empty string.\n * Falls back to the default \"pkg-scripts\" directory otherwise.\n */\nexport function resolveScriptsDir(buildResourcesDir: string, scripts: string | null | undefined): string | null {\n if (scripts === null) {\n return null\n }\n return scripts != null ? path.resolve(buildResourcesDir, scripts) : path.join(buildResourcesDir, \"pkg-scripts\")\n}\n\n/**\n * Adds `rootVolumeOnly=\"true\"` to the `<options>` element of a synthesized `distribution.xml`.\n *\n * `<domains>` is a deprecated Distribution element. On macOS 26 the Installer probes the current-user-home domain while\n * parsing it — even with `enable_currentUserHome=\"false\"` — which trips `kTCCServiceSystemPolicyAppData` and makes\n * Installer.app ask for \"data from other apps\" before any file is written. `rootVolumeOnly` is the current spelling of\n * the same restriction and leaves the install-domain decision unchanged.\n *\n * Only applied when both user-home install domains are disabled, which is exactly when `<domains>` and\n * `rootVolumeOnly` express the same thing. The `<domains>` element is left byte-for-byte as generated, so\n * distributions that rely on it keep working as before.\n *\n * Assumes the document contains the `<options …>` element emitted by `productbuild --synthesize`, which is always the\n * case for a component-based distribution.\n */\nexport function applyRootVolumeOnly(distInfo: string, options: Pick<PkgOptions, \"allowAnywhere\" | \"allowCurrentUserHome\">): string {\n if (options.allowAnywhere !== false || options.allowCurrentUserHome !== false) {\n return distInfo\n }\n // `String.replace` with a string pattern substitutes the first occurrence only, which is the installer-gui-script's\n // own <options> element.\n return distInfo.replace(\"<options \", '<options rootVolumeOnly=\"true\" ')\n}\n"]}
|
|
@@ -45,6 +45,11 @@ export declare function collectionMatchesAppDependencies(nodeModules: NodeModule
|
|
|
45
45
|
* {@link collectionMatchesAppDependencies}). A non-empty collection that does NOT match — e.g. a
|
|
46
46
|
* workspace-root tree returned for a sub-package — is retained only as a last-resort fallback so a
|
|
47
47
|
* later approach (notably {@link PM.TRAVERSAL}) can supply the correct modules.
|
|
48
|
+
*
|
|
49
|
+
* An approach that throws (e.g. the package manager exited without producing its dependency tree,
|
|
50
|
+
* issue #10208) is logged as a warning and skipped so the remaining approaches still run. If every
|
|
51
|
+
* approach fails to produce a collection and at least one threw, the first error is rethrown rather
|
|
52
|
+
* than silently reporting "no node modules".
|
|
48
53
|
*/
|
|
49
54
|
export declare function resolveFirstMatchingCollection(options: {
|
|
50
55
|
pmApproaches: PM[];
|
|
@@ -209,14 +209,29 @@ function collectionMatchesAppDependencies(nodeModules, dependencies) {
|
|
|
209
209
|
* {@link collectionMatchesAppDependencies}). A non-empty collection that does NOT match — e.g. a
|
|
210
210
|
* workspace-root tree returned for a sub-package — is retained only as a last-resort fallback so a
|
|
211
211
|
* later approach (notably {@link PM.TRAVERSAL}) can supply the correct modules.
|
|
212
|
+
*
|
|
213
|
+
* An approach that throws (e.g. the package manager exited without producing its dependency tree,
|
|
214
|
+
* issue #10208) is logged as a warning and skipped so the remaining approaches still run. If every
|
|
215
|
+
* approach fails to produce a collection and at least one threw, the first error is rethrown rather
|
|
216
|
+
* than silently reporting "no node modules".
|
|
212
217
|
*/
|
|
213
218
|
async function resolveFirstMatchingCollection(options) {
|
|
219
|
+
var _a;
|
|
214
220
|
const { pmApproaches, searchDirectories, dependencies, run } = options;
|
|
215
221
|
let fallback;
|
|
222
|
+
let firstError;
|
|
216
223
|
for (const pm of pmApproaches) {
|
|
217
224
|
for (const dir of searchDirectories) {
|
|
218
225
|
builder_util_1.log.info({ pm, searchDir: dir }, "searching for node modules");
|
|
219
|
-
|
|
226
|
+
let deps;
|
|
227
|
+
try {
|
|
228
|
+
deps = await run(pm, dir);
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
builder_util_1.log.warn({ pm, searchDir: dir, error: (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : String(error) }, "node module collection failed, trying next search directory/approach");
|
|
232
|
+
firstError !== null && firstError !== void 0 ? firstError : (firstError = error instanceof Error ? error : new Error(String(error)));
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
220
235
|
if (deps.nodeModules.length === 0) {
|
|
221
236
|
builder_util_1.log.info({ pm, searchDir: dir }, "no node modules found in collection, trying next search directory");
|
|
222
237
|
continue;
|
|
@@ -229,6 +244,9 @@ async function resolveFirstMatchingCollection(options) {
|
|
|
229
244
|
fallback !== null && fallback !== void 0 ? fallback : (fallback = deps);
|
|
230
245
|
}
|
|
231
246
|
}
|
|
247
|
+
if (fallback == null && firstError != null) {
|
|
248
|
+
throw firstError;
|
|
249
|
+
}
|
|
232
250
|
return fallback;
|
|
233
251
|
}
|
|
234
252
|
/** Extracts the package name from a `name@version` log-summary entry, handling `@scope/name@version`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appFileCopier.js","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":";;;AAsBA,gDAYC;AAED,oCAyCC;AAaD,wCAoCC;AAED,0CA4BC;AAwBD,8DA8BC;AA2BD,4EASC;AASD,wEA0BC;AAoCD,0EAkBC;AAGD,sEAgCC;AAlXD,+CAAwK;AAExK,uCAAwC;AACxC,0CAA6C;AAC7C,6BAA4B;AAC5B,qDAAuC;AACvC,2DAAmD;AACnD,kCAAkC;AAClC,gDAA0D;AAC1D,wDAAqF;AAC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AG,sCAA8B,EAAE,CAAA;IACjF,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAChC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK,EAAS,CAAC,CAAA;IACxH,IAAI,WAAW,CAAC,gBAAgB,IAAI,IAAI,EAAE,CAAC;QACzC,WAAW,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAA;IAC1C,CAAC;IACD,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAC9B,WAAW,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAC5B;;kFAE8E,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,OAAO;CAClH,CACE,CAAA;IACD,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,CAAA;AACzG,CAAC","sourcesContent":["import { AsyncTaskManager, FileCopier, FileTransformer, InvalidConfigurationError, isEmptyOrSpaces, Link, log, MAX_FILE_REQUESTS, statOrNull, walk } from \"builder-util\"\nimport { Stats } from \"fs\"\nimport { ensureSymlink } from \"fs-extra\"\nimport { mkdir, readlink } from \"fs/promises\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { isLibOrExe } from \"../asar/unpackDetector\"\nimport { Platform } from \"../core\"\nimport { excludedExts, FileMatcher } from \"../fileMatcher\"\nimport { createElectronCompilerHost, NODE_MODULES_PATTERN } from \"../fileTransformer\"\nimport { getCollectorByPackageManager, PM } from \"../node-module-collector\"\nimport { LogMessageByKey, logMessageLevelByKey, ModuleManager } from \"../node-module-collector/moduleManager\"\nimport { Packager } from \"../packager\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { AppFileWalker } from \"./AppFileWalker\"\nimport { NodeModuleCopyHelper } from \"./NodeModuleCopyHelper\"\nimport { NodeModuleInfo } from \"./packageDependencies\"\n\nconst BOWER_COMPONENTS_PATTERN = `${path.sep}bower_components${path.sep}`\n/** @internal */\nexport const ELECTRON_COMPILE_SHIM_FILENAME = \"__shim.js\"\n\nexport function getDestinationPath(file: string, fileSet: ResolvedFileSet) {\n if (file === fileSet.src) {\n return fileSet.destination\n }\n\n const src = fileSet.src\n const dest = fileSet.destination\n // get node_modules path relative to src and then append to dest\n if (file.startsWith(src)) {\n return path.join(dest, path.relative(src, file))\n }\n return dest\n}\n\nexport async function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager, transformer: FileTransformer) {\n const metadata = fileSet.metadata\n // search auto unpacked dir\n const taskManager = new AsyncTaskManager(packager.cancellationToken)\n const createdParentDirs = new Set<string>()\n\n const fileCopier = new FileCopier(file => {\n return !isLibOrExe(file)\n }, transformer)\n const links: Array<Link> = []\n for (let i = 0, n = fileSet.files.length; i < n; i++) {\n const sourceFile = fileSet.files[i]\n const stat = metadata.get(sourceFile)\n if (stat == null) {\n // dir\n continue\n }\n\n const destinationFile = getDestinationPath(sourceFile, fileSet)\n if (stat.isSymbolicLink()) {\n links.push({ file: destinationFile, link: await readlink(sourceFile) })\n continue\n }\n\n const fileParent = path.dirname(destinationFile)\n if (!createdParentDirs.has(fileParent)) {\n createdParentDirs.add(fileParent)\n await mkdir(fileParent, { recursive: true })\n }\n\n taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat))\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n }\n\n if (taskManager.tasks.length > 0) {\n await taskManager.awaitTasks()\n }\n\n await asyncPool(MAX_FILE_REQUESTS, links, it => ensureSymlink(it.link, it.file))\n}\n\n// os path separator is used\nexport interface ResolvedFileSet {\n src: string\n destination: string\n\n files: Array<string>\n metadata: Map<string, Stats>\n transformedFiles?: Map<number, string | Buffer> | null\n}\n\n// used only for ASAR, if no asar, file transformed on the fly\nexport async function transformFiles(transformer: FileTransformer, fileSet: ResolvedFileSet): Promise<void> {\n if (transformer == null) {\n return\n }\n\n let transformedFiles = fileSet.transformedFiles\n if (fileSet.transformedFiles == null) {\n transformedFiles = new Map()\n fileSet.transformedFiles = transformedFiles\n }\n\n const metadata = fileSet.metadata\n const filesPromise = fileSet.files.map(async (it, index) => {\n const fileStat = metadata.get(it)\n if (fileStat == null || !fileStat.isFile()) {\n return\n }\n\n const transformedValue = transformer(it)\n if (transformedValue == null) {\n return\n }\n\n if (typeof transformedValue === \"object\" && \"then\" in transformedValue) {\n return (transformedValue as Promise<any>).then(it => {\n if (it != null) {\n transformedFiles!.set(index, it)\n }\n return\n })\n }\n transformedFiles!.set(index, transformedValue as string | Buffer)\n return\n })\n // `asyncPool` doesn't provide `index` in it's handler, so we `map` first before using it\n await asyncPool(MAX_FILE_REQUESTS, filesPromise, promise => promise)\n}\n\nexport async function computeFileSets(\n matchers: Array<FileMatcher>,\n transformer: FileTransformer | null,\n platformPackager: PlatformPackager<any>,\n isElectronCompile: boolean\n): Promise<Array<ResolvedFileSet>> {\n const fileSets: Array<ResolvedFileSet> = []\n const packager = platformPackager.info\n\n for (const matcher of matchers) {\n const fileWalker = new AppFileWalker(matcher, packager)\n\n const fromStat = await statOrNull(matcher.from)\n if (fromStat == null) {\n log.debug({ directory: matcher.from, reason: \"doesn't exist\" }, `skipped copying`)\n continue\n }\n\n const files = await walk(matcher.from, fileWalker.filter, fileWalker)\n const metadata = fileWalker.metadata\n fileSets.push(validateFileSet({ src: matcher.from, files, metadata, destination: matcher.to }))\n }\n\n if (isElectronCompile) {\n // cache files should be first (better IO)\n fileSets.unshift(await compileUsingElectronCompile(fileSets[0], packager))\n }\n return fileSets\n}\n\nfunction getNodeModuleExcludedExts(platformPackager: PlatformPackager<any>) {\n // do not exclude *.h files (https://github.com/electron-userland/electron-builder/issues/2852)\n const result = [\".o\", \".obj\"].concat(excludedExts.split(\",\").map(it => `.${it}`))\n if (platformPackager.config.includePdb !== true) {\n result.push(\".pdb\")\n }\n if (platformPackager.platform !== Platform.WINDOWS) {\n // https://github.com/electron-userland/electron-builder/issues/1738\n result.push(\".dll\")\n result.push(\".exe\")\n }\n return result\n}\n\nfunction validateFileSet(fileSet: ResolvedFileSet): ResolvedFileSet {\n if (fileSet.src == null || fileSet.src.length === 0) {\n throw new Error(\"fileset src is empty\")\n }\n return fileSet\n}\n\n/** @internal */\nexport async function computeNodeModuleFileSets(platformPackager: PlatformPackager<any>, mainMatcher: FileMatcher): Promise<Array<ResolvedFileSet>> {\n const deps = await collectNodeModulesWithLogging(platformPackager)\n\n const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager)\n // serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure\n const result = new Array<ResolvedFileSet>()\n let index = 0\n const NODE_MODULES = \"node_modules\"\n\n const collectNodeModules = async (dep: NodeModuleInfo, destination: string) => {\n const source = dep.dir\n const matcher = new FileMatcher(source, destination, mainMatcher.macroExpander, mainMatcher.patterns)\n const copier = new NodeModuleCopyHelper(matcher, platformPackager.info)\n const files = await copier.collectNodeModules(dep, nodeModuleExcludedExts, path.relative(mainMatcher.to, destination))\n result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata })\n\n log.debug({ dep: dep.name, from: log.filePath(source), to: log.filePath(destination), filesCount: files.length }, \"identified module\")\n\n if (dep.dependencies) {\n for (const c of dep.dependencies) {\n await collectNodeModules(c, path.join(destination, NODE_MODULES, c.name))\n }\n }\n }\n\n for (const dep of deps) {\n const destination = path.join(mainMatcher.to, NODE_MODULES, dep.name)\n await collectNodeModules(dep, destination)\n }\n return result\n}\n\ntype CollectedNodeModules = { nodeModules: NodeModuleInfo[]; logSummary: ModuleManager[\"logSummary\"] }\n\n/** Runs a single package-manager collector against a single directory. */\ntype CollectorRunner = (pm: PM, dir: string) => Promise<CollectedNodeModules>\n\n// `workspace:`/`file:`/`link:`/`portal:` dependencies are symlinked into place rather than\n// installed as standalone, hoistable packages, so they may legitimately be absent from a\n// collected tree and cannot be used to validate it.\nconst LOCAL_DEPENDENCY_SPEC = /^(?:workspace|file|link|portal):/\n\n/**\n * Determines whether a collected module tree actually describes the package being built.\n *\n * A package-manager `list` invocation can resolve to the wrong project root — most notably when\n * electron-builder is run from a workspace sub-package whose dependencies are hoisted to the\n * workspace root. In that case the collector returns a non-empty but unrelated tree. Accepting it\n * would suppress the manual-traversal fallback that resolves the correct modules, so we need to\n * tell a matching collection from a mismatched one.\n *\n * A collection matches when at least one of the package's declared external (registry-installed,\n * non-`workspace:`/`file:`/`link:`/`portal:`) production dependencies is present at the top level —\n * those direct dependencies are always hoisted to the top level of a correct collection. When the\n * package declares no external production dependencies there is nothing to validate against, so any\n * non-empty collection is accepted.\n */\nexport function collectionMatchesAppDependencies(nodeModules: NodeModuleInfo[], dependencies: Record<string, string> | undefined): boolean {\n const requiredExternalDeps = Object.entries(dependencies ?? {})\n .filter(([, spec]) => !LOCAL_DEPENDENCY_SPEC.test(spec))\n .map(([name]) => name)\n if (requiredExternalDeps.length === 0) {\n return true\n }\n const collected = new Set(nodeModules.map(it => it.name))\n return requiredExternalDeps.some(name => collected.has(name))\n}\n\n/**\n * Walks the candidate (package-manager, directory) combinations and returns the first collection\n * that both contains modules and matches the package being built (see\n * {@link collectionMatchesAppDependencies}). A non-empty collection that does NOT match — e.g. a\n * workspace-root tree returned for a sub-package — is retained only as a last-resort fallback so a\n * later approach (notably {@link PM.TRAVERSAL}) can supply the correct modules.\n */\nexport async function resolveFirstMatchingCollection(options: {\n pmApproaches: PM[]\n searchDirectories: string[]\n dependencies: Record<string, string> | undefined\n run: CollectorRunner\n}): Promise<CollectedNodeModules | undefined> {\n const { pmApproaches, searchDirectories, dependencies, run } = options\n let fallback: CollectedNodeModules | undefined\n\n for (const pm of pmApproaches) {\n for (const dir of searchDirectories) {\n log.info({ pm, searchDir: dir }, \"searching for node modules\")\n const deps = await run(pm, dir)\n if (deps.nodeModules.length === 0) {\n log.info({ pm, searchDir: dir }, \"no node modules found in collection, trying next search directory\")\n continue\n }\n if (collectionMatchesAppDependencies(deps.nodeModules, dependencies)) {\n log.debug({ pm, searchDir: dir, depCount: deps.nodeModules.length }, \"collected node modules\")\n return deps\n }\n log.info({ pm, searchDir: dir }, \"collected node modules do not match the target package, trying next search directory/approach\")\n fallback ??= deps\n }\n }\n return fallback\n}\n\n/** Extracts the package name from a `name@version` log-summary entry, handling `@scope/name@version`. */\nfunction dependencyNameFromSummaryId(id: string): string {\n let at: number\n if (id.startsWith(\"@\")) {\n // Scoped package: the version separator is the first `@` after the scope's `/`\n const slashIndex = id.indexOf(\"/\")\n if (slashIndex === -1) {\n return id\n }\n at = id.indexOf(\"@\", slashIndex + 1)\n } else {\n at = id.indexOf(\"@\")\n }\n return at > 0 ? id.slice(0, at) : id\n}\n\n/**\n * Enforces `allowMissingDependencies` against the finished collection summary (issue #10058).\n * Runs only after collection completes, so the error reports the COMPLETE set of missing\n * production dependencies at once instead of failing on the first one.\n *\n * v26 defaults to warn-only: `true` and omitted keep the historical warning behavior of the\n * stable 26.x line, while `false`/`null` fail the build on any missing production dependency\n * (the electron-builder 27+ default). When the option is a `string[]`, only the listed dependency\n * names are allowed to be missing — matched against the package name parsed from the summary's\n * `name@version` entries (scoped names included), with an exact-entry match accepted as well.\n *\n * Only genuinely missing production dependencies (`PKG_NOT_FOUND` / `PKG_NOT_ON_DISK`) are fatal;\n * missing optional dependencies (`PKG_OPTIONAL_NOT_INSTALLED` / `PKG_OPTIONAL_PLATFORM_NOT_INSTALLED`)\n * never fail the build.\n *\n * Exported for tests (an internal-tagged export would be stripped from the declarations the test\n * project consumes).\n */\nexport function enforceAllowMissingDependencies(allowMissingDependencies: boolean | Array<string> | null | undefined, logSummary: ModuleManager[\"logSummary\"] | undefined): void {\n // v26 default: omitted behaves like `true` (warn-only) so existing 26.x builds keep working.\n if (allowMissingDependencies === true || allowMissingDependencies === undefined) {\n return\n }\n const missing = new Set<string>([...(logSummary?.[LogMessageByKey.PKG_NOT_FOUND] ?? []), ...(logSummary?.[LogMessageByKey.PKG_NOT_ON_DISK] ?? [])])\n const allowed = new Set(Array.isArray(allowMissingDependencies) ? allowMissingDependencies : [])\n const fatal = Array.from(missing)\n .filter(id => !allowed.has(dependencyNameFromSummaryId(id)) && !allowed.has(id))\n .sort()\n if (fatal.length === 0) {\n return\n }\n throw new InvalidConfigurationError(\n `The following production dependencies could not be resolved during node-module collection:\\n` +\n fatal.map(id => ` - ${id}`).join(\"\\n\") +\n `\\nInstall the missing dependencies, list names in \\`allowMissingDependencies\\` to allow specific ones to be missing, or set \\`allowMissingDependencies\\` to true to only warn.`\n )\n}\n\n/** Exported for tests (an internal-tagged export would be stripped from the declarations the test project consumes). */\nexport async function collectNodeModulesWithLogging(platformPackager: PlatformPackager<any>) {\n const packager = platformPackager.info\n const { tempDirManager, appDir, projectDir } = packager\n\n const searchDirectories = Array.from(new Set([appDir, projectDir, await packager.getWorkspaceRoot()])).filter((it): it is string => isEmptyOrSpaces(it) === false)\n const pmApproaches = [await packager.getPackageManager(), PM.TRAVERSAL]\n\n // Validate against the as-declared (pre-extraMetadata) production dependencies so a configured\n // `extraMetadata.dependencies` entry that isn't installed cannot reject a correct collection.\n const deps = await resolveFirstMatchingCollection({\n pmApproaches,\n searchDirectories,\n dependencies: packager.originalMetadata.dependencies,\n run: (pm, dir) => getCollectorByPackageManager(pm, dir, tempDirManager).getNodeModules({ packageName: packager.nodePackageName }),\n })\n\n if (!deps?.nodeModules?.length) {\n log.warn({ searchDirectories: searchDirectories.map(it => log.filePath(it)) }, \"no node modules returned while searching directories\")\n return []\n }\n\n const summary = Object.entries(deps.logSummary ?? {}).filter(([, dependencies]) => Array.isArray(dependencies) && dependencies.length > 0)\n for (const [errorMessage, dependencies] of summary) {\n const logLevel = logMessageLevelByKey[errorMessage as LogMessageByKey] || \"debug\"\n log[logLevel]({ dependencies }, errorMessage)\n }\n\n // Enforcement (issue #10058): collection is complete and the summary above has reached the log,\n // so failing here reports every missing production dependency at once.\n enforceAllowMissingDependencies(packager.config.allowMissingDependencies, deps.logSummary)\n\n return deps.nodeModules\n}\n\nasync function compileUsingElectronCompile(mainFileSet: ResolvedFileSet, packager: Packager): Promise<ResolvedFileSet> {\n log.info(\"compiling using electron-compile\")\n\n const electronCompileCache = await packager.tempDirManager.getTempDir({ prefix: \"electron-compile-cache\" })\n const cacheDir = path.join(electronCompileCache, \".cache\")\n // clear and create cache dir\n await mkdir(cacheDir, { recursive: true })\n const compilerHost = await createElectronCompilerHost(mainFileSet.src, cacheDir)\n const nextSlashIndex = mainFileSet.src.length + 1\n // pre-compute electron-compile to cache dir - we need to process only subdirectories, not direct files of app dir\n const filesPromise: Promise<any>[] = mainFileSet.files.map(file => {\n if (\n file.includes(NODE_MODULES_PATTERN) ||\n file.includes(BOWER_COMPONENTS_PATTERN) ||\n !file.includes(path.sep, nextSlashIndex) || // ignore not root files\n !mainFileSet.metadata.get(file)!.isFile()\n ) {\n return\n }\n return compilerHost.compile(file)\n })\n await asyncPool(MAX_FILE_REQUESTS, filesPromise, promise => promise)\n await compilerHost.saveConfiguration()\n\n const metadata = new Map<string, Stats>()\n const cacheFiles = await walk(cacheDir, file => !file.startsWith(\".\"), {\n consume: (file, fileStat) => {\n if (fileStat.isFile()) {\n metadata.set(file, fileStat)\n }\n return null\n },\n })\n\n // add shim\n const shimPath = `${mainFileSet.src}${path.sep}${ELECTRON_COMPILE_SHIM_FILENAME}`\n mainFileSet.files.push(shimPath)\n mainFileSet.metadata.set(shimPath, { isFile: () => true, isDirectory: () => false, isSymbolicLink: () => false } as any)\n if (mainFileSet.transformedFiles == null) {\n mainFileSet.transformedFiles = new Map()\n }\n mainFileSet.transformedFiles.set(\n mainFileSet.files.length - 1,\n `\n'use strict';\nrequire('electron-compile').init(__dirname, require('path').resolve(__dirname, '${packager.metadata.main || \"index\"}'), true);\n`\n )\n return { src: electronCompileCache, files: cacheFiles, metadata, destination: mainFile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,EAAE,CAAC,KAAK,EAAS,CAAC,CAAA;IACxH,IAAI,WAAW,CAAC,gBAAgB,IAAI,IAAI,EAAE,CAAC;QACzC,WAAW,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAA;IAC1C,CAAC;IACD,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAC9B,WAAW,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAC5B;;kFAE8E,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,OAAO;CAClH,CACE,CAAA;IACD,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,CAAA;AACzG,CAAC","sourcesContent":["import { AsyncTaskManager, FileCopier, FileTransformer, InvalidConfigurationError, isEmptyOrSpaces, Link, log, MAX_FILE_REQUESTS, statOrNull, walk } from \"builder-util\"\nimport { Stats } from \"fs\"\nimport { ensureSymlink } from \"fs-extra\"\nimport { mkdir, readlink } from \"fs/promises\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { isLibOrExe } from \"../asar/unpackDetector\"\nimport { Platform } from \"../core\"\nimport { excludedExts, FileMatcher } from \"../fileMatcher\"\nimport { createElectronCompilerHost, NODE_MODULES_PATTERN } from \"../fileTransformer\"\nimport { getCollectorByPackageManager, PM } from \"../node-module-collector\"\nimport { LogMessageByKey, logMessageLevelByKey, ModuleManager } from \"../node-module-collector/moduleManager\"\nimport { Packager } from \"../packager\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { AppFileWalker } from \"./AppFileWalker\"\nimport { NodeModuleCopyHelper } from \"./NodeModuleCopyHelper\"\nimport { NodeModuleInfo } from \"./packageDependencies\"\n\nconst BOWER_COMPONENTS_PATTERN = `${path.sep}bower_components${path.sep}`\n/** @internal */\nexport const ELECTRON_COMPILE_SHIM_FILENAME = \"__shim.js\"\n\nexport function getDestinationPath(file: string, fileSet: ResolvedFileSet) {\n if (file === fileSet.src) {\n return fileSet.destination\n }\n\n const src = fileSet.src\n const dest = fileSet.destination\n // get node_modules path relative to src and then append to dest\n if (file.startsWith(src)) {\n return path.join(dest, path.relative(src, file))\n }\n return dest\n}\n\nexport async function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager, transformer: FileTransformer) {\n const metadata = fileSet.metadata\n // search auto unpacked dir\n const taskManager = new AsyncTaskManager(packager.cancellationToken)\n const createdParentDirs = new Set<string>()\n\n const fileCopier = new FileCopier(file => {\n return !isLibOrExe(file)\n }, transformer)\n const links: Array<Link> = []\n for (let i = 0, n = fileSet.files.length; i < n; i++) {\n const sourceFile = fileSet.files[i]\n const stat = metadata.get(sourceFile)\n if (stat == null) {\n // dir\n continue\n }\n\n const destinationFile = getDestinationPath(sourceFile, fileSet)\n if (stat.isSymbolicLink()) {\n links.push({ file: destinationFile, link: await readlink(sourceFile) })\n continue\n }\n\n const fileParent = path.dirname(destinationFile)\n if (!createdParentDirs.has(fileParent)) {\n createdParentDirs.add(fileParent)\n await mkdir(fileParent, { recursive: true })\n }\n\n taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat))\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n }\n\n if (taskManager.tasks.length > 0) {\n await taskManager.awaitTasks()\n }\n\n await asyncPool(MAX_FILE_REQUESTS, links, it => ensureSymlink(it.link, it.file))\n}\n\n// os path separator is used\nexport interface ResolvedFileSet {\n src: string\n destination: string\n\n files: Array<string>\n metadata: Map<string, Stats>\n transformedFiles?: Map<number, string | Buffer> | null\n}\n\n// used only for ASAR, if no asar, file transformed on the fly\nexport async function transformFiles(transformer: FileTransformer, fileSet: ResolvedFileSet): Promise<void> {\n if (transformer == null) {\n return\n }\n\n let transformedFiles = fileSet.transformedFiles\n if (fileSet.transformedFiles == null) {\n transformedFiles = new Map()\n fileSet.transformedFiles = transformedFiles\n }\n\n const metadata = fileSet.metadata\n const filesPromise = fileSet.files.map(async (it, index) => {\n const fileStat = metadata.get(it)\n if (fileStat == null || !fileStat.isFile()) {\n return\n }\n\n const transformedValue = transformer(it)\n if (transformedValue == null) {\n return\n }\n\n if (typeof transformedValue === \"object\" && \"then\" in transformedValue) {\n return (transformedValue as Promise<any>).then(it => {\n if (it != null) {\n transformedFiles!.set(index, it)\n }\n return\n })\n }\n transformedFiles!.set(index, transformedValue as string | Buffer)\n return\n })\n // `asyncPool` doesn't provide `index` in it's handler, so we `map` first before using it\n await asyncPool(MAX_FILE_REQUESTS, filesPromise, promise => promise)\n}\n\nexport async function computeFileSets(\n matchers: Array<FileMatcher>,\n transformer: FileTransformer | null,\n platformPackager: PlatformPackager<any>,\n isElectronCompile: boolean\n): Promise<Array<ResolvedFileSet>> {\n const fileSets: Array<ResolvedFileSet> = []\n const packager = platformPackager.info\n\n for (const matcher of matchers) {\n const fileWalker = new AppFileWalker(matcher, packager)\n\n const fromStat = await statOrNull(matcher.from)\n if (fromStat == null) {\n log.debug({ directory: matcher.from, reason: \"doesn't exist\" }, `skipped copying`)\n continue\n }\n\n const files = await walk(matcher.from, fileWalker.filter, fileWalker)\n const metadata = fileWalker.metadata\n fileSets.push(validateFileSet({ src: matcher.from, files, metadata, destination: matcher.to }))\n }\n\n if (isElectronCompile) {\n // cache files should be first (better IO)\n fileSets.unshift(await compileUsingElectronCompile(fileSets[0], packager))\n }\n return fileSets\n}\n\nfunction getNodeModuleExcludedExts(platformPackager: PlatformPackager<any>) {\n // do not exclude *.h files (https://github.com/electron-userland/electron-builder/issues/2852)\n const result = [\".o\", \".obj\"].concat(excludedExts.split(\",\").map(it => `.${it}`))\n if (platformPackager.config.includePdb !== true) {\n result.push(\".pdb\")\n }\n if (platformPackager.platform !== Platform.WINDOWS) {\n // https://github.com/electron-userland/electron-builder/issues/1738\n result.push(\".dll\")\n result.push(\".exe\")\n }\n return result\n}\n\nfunction validateFileSet(fileSet: ResolvedFileSet): ResolvedFileSet {\n if (fileSet.src == null || fileSet.src.length === 0) {\n throw new Error(\"fileset src is empty\")\n }\n return fileSet\n}\n\n/** @internal */\nexport async function computeNodeModuleFileSets(platformPackager: PlatformPackager<any>, mainMatcher: FileMatcher): Promise<Array<ResolvedFileSet>> {\n const deps = await collectNodeModulesWithLogging(platformPackager)\n\n const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager)\n // serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure\n const result = new Array<ResolvedFileSet>()\n let index = 0\n const NODE_MODULES = \"node_modules\"\n\n const collectNodeModules = async (dep: NodeModuleInfo, destination: string) => {\n const source = dep.dir\n const matcher = new FileMatcher(source, destination, mainMatcher.macroExpander, mainMatcher.patterns)\n const copier = new NodeModuleCopyHelper(matcher, platformPackager.info)\n const files = await copier.collectNodeModules(dep, nodeModuleExcludedExts, path.relative(mainMatcher.to, destination))\n result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata })\n\n log.debug({ dep: dep.name, from: log.filePath(source), to: log.filePath(destination), filesCount: files.length }, \"identified module\")\n\n if (dep.dependencies) {\n for (const c of dep.dependencies) {\n await collectNodeModules(c, path.join(destination, NODE_MODULES, c.name))\n }\n }\n }\n\n for (const dep of deps) {\n const destination = path.join(mainMatcher.to, NODE_MODULES, dep.name)\n await collectNodeModules(dep, destination)\n }\n return result\n}\n\ntype CollectedNodeModules = { nodeModules: NodeModuleInfo[]; logSummary: ModuleManager[\"logSummary\"] }\n\n/** Runs a single package-manager collector against a single directory. */\ntype CollectorRunner = (pm: PM, dir: string) => Promise<CollectedNodeModules>\n\n// `workspace:`/`file:`/`link:`/`portal:` dependencies are symlinked into place rather than\n// installed as standalone, hoistable packages, so they may legitimately be absent from a\n// collected tree and cannot be used to validate it.\nconst LOCAL_DEPENDENCY_SPEC = /^(?:workspace|file|link|portal):/\n\n/**\n * Determines whether a collected module tree actually describes the package being built.\n *\n * A package-manager `list` invocation can resolve to the wrong project root — most notably when\n * electron-builder is run from a workspace sub-package whose dependencies are hoisted to the\n * workspace root. In that case the collector returns a non-empty but unrelated tree. Accepting it\n * would suppress the manual-traversal fallback that resolves the correct modules, so we need to\n * tell a matching collection from a mismatched one.\n *\n * A collection matches when at least one of the package's declared external (registry-installed,\n * non-`workspace:`/`file:`/`link:`/`portal:`) production dependencies is present at the top level —\n * those direct dependencies are always hoisted to the top level of a correct collection. When the\n * package declares no external production dependencies there is nothing to validate against, so any\n * non-empty collection is accepted.\n */\nexport function collectionMatchesAppDependencies(nodeModules: NodeModuleInfo[], dependencies: Record<string, string> | undefined): boolean {\n const requiredExternalDeps = Object.entries(dependencies ?? {})\n .filter(([, spec]) => !LOCAL_DEPENDENCY_SPEC.test(spec))\n .map(([name]) => name)\n if (requiredExternalDeps.length === 0) {\n return true\n }\n const collected = new Set(nodeModules.map(it => it.name))\n return requiredExternalDeps.some(name => collected.has(name))\n}\n\n/**\n * Walks the candidate (package-manager, directory) combinations and returns the first collection\n * that both contains modules and matches the package being built (see\n * {@link collectionMatchesAppDependencies}). A non-empty collection that does NOT match — e.g. a\n * workspace-root tree returned for a sub-package — is retained only as a last-resort fallback so a\n * later approach (notably {@link PM.TRAVERSAL}) can supply the correct modules.\n *\n * An approach that throws (e.g. the package manager exited without producing its dependency tree,\n * issue #10208) is logged as a warning and skipped so the remaining approaches still run. If every\n * approach fails to produce a collection and at least one threw, the first error is rethrown rather\n * than silently reporting \"no node modules\".\n */\nexport async function resolveFirstMatchingCollection(options: {\n pmApproaches: PM[]\n searchDirectories: string[]\n dependencies: Record<string, string> | undefined\n run: CollectorRunner\n}): Promise<CollectedNodeModules | undefined> {\n const { pmApproaches, searchDirectories, dependencies, run } = options\n let fallback: CollectedNodeModules | undefined\n let firstError: Error | undefined\n\n for (const pm of pmApproaches) {\n for (const dir of searchDirectories) {\n log.info({ pm, searchDir: dir }, \"searching for node modules\")\n let deps: CollectedNodeModules\n try {\n deps = await run(pm, dir)\n } catch (error: any) {\n log.warn({ pm, searchDir: dir, error: error?.message ?? String(error) }, \"node module collection failed, trying next search directory/approach\")\n firstError ??= error instanceof Error ? error : new Error(String(error))\n continue\n }\n if (deps.nodeModules.length === 0) {\n log.info({ pm, searchDir: dir }, \"no node modules found in collection, trying next search directory\")\n continue\n }\n if (collectionMatchesAppDependencies(deps.nodeModules, dependencies)) {\n log.debug({ pm, searchDir: dir, depCount: deps.nodeModules.length }, \"collected node modules\")\n return deps\n }\n log.info({ pm, searchDir: dir }, \"collected node modules do not match the target package, trying next search directory/approach\")\n fallback ??= deps\n }\n }\n if (fallback == null && firstError != null) {\n throw firstError\n }\n return fallback\n}\n\n/** Extracts the package name from a `name@version` log-summary entry, handling `@scope/name@version`. */\nfunction dependencyNameFromSummaryId(id: string): string {\n let at: number\n if (id.startsWith(\"@\")) {\n // Scoped package: the version separator is the first `@` after the scope's `/`\n const slashIndex = id.indexOf(\"/\")\n if (slashIndex === -1) {\n return id\n }\n at = id.indexOf(\"@\", slashIndex + 1)\n } else {\n at = id.indexOf(\"@\")\n }\n return at > 0 ? id.slice(0, at) : id\n}\n\n/**\n * Enforces `allowMissingDependencies` against the finished collection summary (issue #10058).\n * Runs only after collection completes, so the error reports the COMPLETE set of missing\n * production dependencies at once instead of failing on the first one.\n *\n * v26 defaults to warn-only: `true` and omitted keep the historical warning behavior of the\n * stable 26.x line, while `false`/`null` fail the build on any missing production dependency\n * (the electron-builder 27+ default). When the option is a `string[]`, only the listed dependency\n * names are allowed to be missing — matched against the package name parsed from the summary's\n * `name@version` entries (scoped names included), with an exact-entry match accepted as well.\n *\n * Only genuinely missing production dependencies (`PKG_NOT_FOUND` / `PKG_NOT_ON_DISK`) are fatal;\n * missing optional dependencies (`PKG_OPTIONAL_NOT_INSTALLED` / `PKG_OPTIONAL_PLATFORM_NOT_INSTALLED`)\n * never fail the build.\n *\n * Exported for tests (an internal-tagged export would be stripped from the declarations the test\n * project consumes).\n */\nexport function enforceAllowMissingDependencies(allowMissingDependencies: boolean | Array<string> | null | undefined, logSummary: ModuleManager[\"logSummary\"] | undefined): void {\n // v26 default: omitted behaves like `true` (warn-only) so existing 26.x builds keep working.\n if (allowMissingDependencies === true || allowMissingDependencies === undefined) {\n return\n }\n const missing = new Set<string>([...(logSummary?.[LogMessageByKey.PKG_NOT_FOUND] ?? []), ...(logSummary?.[LogMessageByKey.PKG_NOT_ON_DISK] ?? [])])\n const allowed = new Set(Array.isArray(allowMissingDependencies) ? allowMissingDependencies : [])\n const fatal = Array.from(missing)\n .filter(id => !allowed.has(dependencyNameFromSummaryId(id)) && !allowed.has(id))\n .sort()\n if (fatal.length === 0) {\n return\n }\n throw new InvalidConfigurationError(\n `The following production dependencies could not be resolved during node-module collection:\\n` +\n fatal.map(id => ` - ${id}`).join(\"\\n\") +\n `\\nInstall the missing dependencies, list names in \\`allowMissingDependencies\\` to allow specific ones to be missing, or set \\`allowMissingDependencies\\` to true to only warn.`\n )\n}\n\n/** Exported for tests (an internal-tagged export would be stripped from the declarations the test project consumes). */\nexport async function collectNodeModulesWithLogging(platformPackager: PlatformPackager<any>) {\n const packager = platformPackager.info\n const { tempDirManager, appDir, projectDir } = packager\n\n const searchDirectories = Array.from(new Set([appDir, projectDir, await packager.getWorkspaceRoot()])).filter((it): it is string => isEmptyOrSpaces(it) === false)\n const pmApproaches = [await packager.getPackageManager(), PM.TRAVERSAL]\n\n // Validate against the as-declared (pre-extraMetadata) production dependencies so a configured\n // `extraMetadata.dependencies` entry that isn't installed cannot reject a correct collection.\n const deps = await resolveFirstMatchingCollection({\n pmApproaches,\n searchDirectories,\n dependencies: packager.originalMetadata.dependencies,\n run: (pm, dir) => getCollectorByPackageManager(pm, dir, tempDirManager).getNodeModules({ packageName: packager.nodePackageName }),\n })\n\n if (!deps?.nodeModules?.length) {\n log.warn({ searchDirectories: searchDirectories.map(it => log.filePath(it)) }, \"no node modules returned while searching directories\")\n return []\n }\n\n const summary = Object.entries(deps.logSummary ?? {}).filter(([, dependencies]) => Array.isArray(dependencies) && dependencies.length > 0)\n for (const [errorMessage, dependencies] of summary) {\n const logLevel = logMessageLevelByKey[errorMessage as LogMessageByKey] || \"debug\"\n log[logLevel]({ dependencies }, errorMessage)\n }\n\n // Enforcement (issue #10058): collection is complete and the summary above has reached the log,\n // so failing here reports every missing production dependency at once.\n enforceAllowMissingDependencies(packager.config.allowMissingDependencies, deps.logSummary)\n\n return deps.nodeModules\n}\n\nasync function compileUsingElectronCompile(mainFileSet: ResolvedFileSet, packager: Packager): Promise<ResolvedFileSet> {\n log.info(\"compiling using electron-compile\")\n\n const electronCompileCache = await packager.tempDirManager.getTempDir({ prefix: \"electron-compile-cache\" })\n const cacheDir = path.join(electronCompileCache, \".cache\")\n // clear and create cache dir\n await mkdir(cacheDir, { recursive: true })\n const compilerHost = await createElectronCompilerHost(mainFileSet.src, cacheDir)\n const nextSlashIndex = mainFileSet.src.length + 1\n // pre-compute electron-compile to cache dir - we need to process only subdirectories, not direct files of app dir\n const filesPromise: Promise<any>[] = mainFileSet.files.map(file => {\n if (\n file.includes(NODE_MODULES_PATTERN) ||\n file.includes(BOWER_COMPONENTS_PATTERN) ||\n !file.includes(path.sep, nextSlashIndex) || // ignore not root files\n !mainFileSet.metadata.get(file)!.isFile()\n ) {\n return\n }\n return compilerHost.compile(file)\n })\n await asyncPool(MAX_FILE_REQUESTS, filesPromise, promise => promise)\n await compilerHost.saveConfiguration()\n\n const metadata = new Map<string, Stats>()\n const cacheFiles = await walk(cacheDir, file => !file.startsWith(\".\"), {\n consume: (file, fileStat) => {\n if (fileStat.isFile()) {\n metadata.set(file, fileStat)\n }\n return null\n },\n })\n\n // add shim\n const shimPath = `${mainFileSet.src}${path.sep}${ELECTRON_COMPILE_SHIM_FILENAME}`\n mainFileSet.files.push(shimPath)\n mainFileSet.metadata.set(shimPath, { isFile: () => true, isDirectory: () => false, isSymbolicLink: () => false } as any)\n if (mainFileSet.transformedFiles == null) {\n mainFileSet.transformedFiles = new Map()\n }\n mainFileSet.transformedFiles.set(\n mainFileSet.files.length - 1,\n `\n'use strict';\nrequire('electron-compile').init(__dirname, require('path').resolve(__dirname, '${packager.metadata.main || \"index\"}'), true);\n`\n )\n return { src: electronCompileCache, files: cacheFiles, metadata, destination: mainFileSet.destination }\n}\n"]}
|
package/out/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "26.
|
|
1
|
+
export declare const PACKAGE_VERSION = "26.17.0";
|
package/out/version.js
CHANGED
package/out/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"26.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,SAAS,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"26.17.0\"\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "app-builder-lib",
|
|
3
3
|
"description": "electron-builder lib",
|
|
4
|
-
"version": "26.
|
|
4
|
+
"version": "26.17.0",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"out",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"unzipper": "^0.12.3",
|
|
87
87
|
"which": "^5.0.0",
|
|
88
88
|
"builder-util": "26.16.0",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
89
|
+
"electron-publish": "26.16.0",
|
|
90
|
+
"builder-util-runtime": "9.7.0"
|
|
91
91
|
},
|
|
92
92
|
"///": "babel in devDependencies for proton tests",
|
|
93
93
|
"devDependencies": {
|
|
@@ -121,12 +121,12 @@
|
|
|
121
121
|
"@types/unzipper": "^0.10.11",
|
|
122
122
|
"@types/which": "^3.0.4",
|
|
123
123
|
"toml": "^3.0.0",
|
|
124
|
-
"
|
|
125
|
-
"
|
|
124
|
+
"electron-builder-squirrel-windows": "26.17.0",
|
|
125
|
+
"dmg-builder": "26.17.0"
|
|
126
126
|
},
|
|
127
127
|
"peerDependencies": {
|
|
128
|
-
"
|
|
129
|
-
"
|
|
128
|
+
"electron-builder-squirrel-windows": "26.17.0",
|
|
129
|
+
"dmg-builder": "26.17.0"
|
|
130
130
|
},
|
|
131
131
|
"//": "electron-builder-squirrel-windows and dmg-builder added as dev dep for tests (as otherwise `require` doesn't work using Yarn 2)",
|
|
132
132
|
"typings": "./out/index.d.ts"
|
package/scheme.json
CHANGED
|
@@ -4274,8 +4274,14 @@
|
|
|
4274
4274
|
"type": "boolean"
|
|
4275
4275
|
},
|
|
4276
4276
|
"differentialPackage": {
|
|
4277
|
-
"
|
|
4278
|
-
"
|
|
4277
|
+
"default": true,
|
|
4278
|
+
"description": "Marks the package as built with differential download support for the update server, and selects how the\napp package is compressed:\n\n- `false` — no differential download support.\n- `\"store-asar\"` — differential-aware, with the app's `resources/app.asar` stored uncompressed (7-Zip\n `Copy`) inside the package. The differential updater diffs the *compressed* package with a\n content-defined blockmap, and the asar is a single compressed member — so any change to app code\n re-downloads the entire compressed asar (~100% of the member; its header rewrite alone diverges every\n block). Storing it keeps unchanged regions byte-identical between releases, making the delta\n proportional to what actually changed (measured on a ~32 MB asar: a one-line source change cost 0.2%\n instead of 100%). Trade-off: the installer and full package grow by roughly what compressing the asar\n saved.\n- anything else (`true`, `\"compressed\"`, unset) — differential-aware, whole package compressed.",
|
|
4279
|
+
"enum": [
|
|
4280
|
+
"compressed",
|
|
4281
|
+
false,
|
|
4282
|
+
"store-asar",
|
|
4283
|
+
true
|
|
4284
|
+
]
|
|
4279
4285
|
},
|
|
4280
4286
|
"displayLanguageSelector": {
|
|
4281
4287
|
"default": false,
|
|
@@ -4627,8 +4633,14 @@
|
|
|
4627
4633
|
"type": "boolean"
|
|
4628
4634
|
},
|
|
4629
4635
|
"differentialPackage": {
|
|
4630
|
-
"
|
|
4631
|
-
"
|
|
4636
|
+
"default": true,
|
|
4637
|
+
"description": "Marks the package as built with differential download support for the update server, and selects how the\napp package is compressed:\n\n- `false` — no differential download support.\n- `\"store-asar\"` — differential-aware, with the app's `resources/app.asar` stored uncompressed (7-Zip\n `Copy`) inside the package. The differential updater diffs the *compressed* package with a\n content-defined blockmap, and the asar is a single compressed member — so any change to app code\n re-downloads the entire compressed asar (~100% of the member; its header rewrite alone diverges every\n block). Storing it keeps unchanged regions byte-identical between releases, making the delta\n proportional to what actually changed (measured on a ~32 MB asar: a one-line source change cost 0.2%\n instead of 100%). Trade-off: the installer and full package grow by roughly what compressing the asar\n saved.\n- anything else (`true`, `\"compressed\"`, unset) — differential-aware, whole package compressed.",
|
|
4638
|
+
"enum": [
|
|
4639
|
+
"compressed",
|
|
4640
|
+
false,
|
|
4641
|
+
"store-asar",
|
|
4642
|
+
true
|
|
4643
|
+
]
|
|
4632
4644
|
},
|
|
4633
4645
|
"displayLanguageSelector": {
|
|
4634
4646
|
"default": false,
|