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.
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts +23 -0
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.js +71 -0
- package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
- package/dist/configuration.d.ts +42 -5
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js.map +1 -1
- package/dist/fileMatcher.d.ts +15 -0
- package/dist/fileMatcher.d.ts.map +1 -1
- package/dist/fileMatcher.js +41 -2
- package/dist/fileMatcher.js.map +1 -1
- package/dist/indexInternal.d.ts +2 -1
- package/dist/indexInternal.d.ts.map +1 -1
- package/dist/indexInternal.js +2 -1
- package/dist/indexInternal.js.map +1 -1
- package/dist/macPackager.d.ts.map +1 -1
- package/dist/macPackager.js +2 -3
- package/dist/macPackager.js.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.d.ts +11 -1
- package/dist/node-module-collector/nodeModulesCollector.d.ts.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.js +28 -5
- package/dist/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts.map +1 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.js +3 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
- package/dist/options/SnapOptions.d.ts +8 -4
- package/dist/options/SnapOptions.d.ts.map +1 -1
- package/dist/options/SnapOptions.js.map +1 -1
- package/dist/options/macOptions.d.ts +17 -7
- package/dist/options/macOptions.d.ts.map +1 -1
- package/dist/options/macOptions.js.map +1 -1
- package/dist/options/winOptions.d.ts +5 -4
- package/dist/options/winOptions.d.ts.map +1 -1
- package/dist/options/winOptions.js.map +1 -1
- package/dist/packager.js +1 -1
- package/dist/packager.js.map +1 -1
- package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
- package/dist/publish/updateInfoBuilder.js +3 -1
- package/dist/publish/updateInfoBuilder.js.map +1 -1
- package/dist/targets/linux/FlatpakTarget.d.ts.map +1 -1
- package/dist/targets/linux/FlatpakTarget.js +4 -1
- package/dist/targets/linux/FlatpakTarget.js.map +1 -1
- package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
- package/dist/targets/linux/FpmTarget.js +9 -0
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.d.ts +1 -1
- package/dist/targets/linux/appimage/appImageUtil.js +3 -3
- package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
- package/dist/targets/linux/snap/core24.d.ts +27 -0
- package/dist/targets/linux/snap/core24.d.ts.map +1 -1
- package/dist/targets/linux/snap/core24.js +92 -57
- package/dist/targets/linux/snap/core24.js.map +1 -1
- package/dist/targets/mac/MacTargetHelper.d.ts +12 -2
- package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
- package/dist/targets/mac/MacTargetHelper.js +20 -11
- package/dist/targets/mac/MacTargetHelper.js.map +1 -1
- package/dist/targets/win/MsiTarget.js +2 -2
- package/dist/targets/win/MsiTarget.js.map +1 -1
- package/dist/toolsets/custom.js +4 -2
- package/dist/toolsets/custom.js.map +1 -1
- package/dist/toolsets/icons.d.ts.map +1 -1
- package/dist/toolsets/icons.js +4 -1
- package/dist/toolsets/icons.js.map +1 -1
- package/dist/util/appFileCopier.d.ts.map +1 -1
- package/dist/util/appFileCopier.js +63 -2
- package/dist/util/appFileCopier.js.map +1 -1
- package/dist/util/electronGet.d.ts +5 -0
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +107 -7
- package/dist/util/electronGet.js.map +1 -1
- package/dist/util/packageMetadata.js +46 -21
- package/dist/util/packageMetadata.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +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A;IACtB,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;AAC7D,CAAC","sourcesContent":["import { exists, sanitizeDirPath, validateSecuredUrl } from \"builder-util\"\nimport { mkdir, rmdir, stat } from \"fs/promises\"\nimport * as path from \"path\"\nimport { ToolsetCustom } from \"../configuration.js\"\nimport { cacheDirectoryOverrideAllowed, downloadBuilderToolset, extractArchive, hashUrlSafe } from \"../util/electronGet.js\"\n\nasync function validateCustomToolset(custom: ToolsetCustom, resourcesDir?: string) {\n const url = custom.url.trim()\n try {\n const parsed = validateSecuredUrl(url)\n if (parsed.pathname.endsWith(\"/\")) {\n throw new Error(`URL must point to a file, but got ${parsed.href}`)\n }\n return { toolset: custom, type: \"url\" }\n } catch {\n // Ignore. If the URL is invalid, validate it as a file path\n }\n if (url.startsWith(\"file://\")) {\n const p = url.slice(\"file://\".length)\n const isWithinResources = resourcesDir ? path.normalize(p).startsWith(path.normalize(resourcesDir + path.sep)) : false\n const isValid = path.isAbsolute(p) || isWithinResources\n const type =\n isValid &&\n (await exists(p)) &&\n (await stat(p)\n .then(s => (s.isDirectory() ? \"directory\" : s.isFile() ? \"file\" : false))\n .catch(() => false))\n if (type) {\n return { toolset: custom, type }\n }\n }\n throw new Error(`Invalid custom toolset: ${url}. Must be a valid https:// URL or a file:// path.`)\n}\n\n// Strip the file:// prefix and sanitize the path against resourcesDir (relative paths must be within it)\nfunction resolveFilePath(url: string, resourcesDir?: string): string {\n const p = url.startsWith(\"file://\") ? url.slice(\"file://\".length) : url\n return path.isAbsolute(p) ? sanitizeDirPath(p) : sanitizeDirPath(p, resourcesDir)\n}\n\nconst _customToolsetCache = new Map<string, Promise<string>>()\n\nexport function clearCustomToolsetCache(): void {\n _customToolsetCache.clear()\n}\n\nexport function getCustomToolsetPath(custom: ToolsetCustom, resourcesDir?: string): Promise<string> {\n const key = JSON.stringify({ url: custom.url, checksum: custom.checksum ?? \"\", resourcesDir })\n let cached = _customToolsetCache.get(key)\n if (cached == null) {\n cached = _resolveCustomToolsetPath(custom, resourcesDir)\n _customToolsetCache.set(key, cached)\n }\n return cached\n}\n\nasync function _resolveCustomToolsetPath(custom: ToolsetCustom, resourcesDir?: string): Promise<string> {\n const { type, toolset } = await validateCustomToolset(custom, resourcesDir)\n\n if (type === \"directory\") {\n return resolveFilePath(toolset.url, resourcesDir)\n }\n\n if (!toolset.checksum) {\n throw new Error(`ToolsetCustom.checksum is required for ${type} toolsets (url: ${toolset.url})`)\n }\n\n const binaryVersion = toolset.version ?? toolset.checksum.substring(0, 8)\n const releaseName = `${binaryVersion}-${hashUrlSafe(toolset.url)}`\n\n if (type === \"url\") {\n return downloadBuilderToolset({\n releaseName: releaseName,\n filenameWithExt: path.basename(toolset.url),\n checksums: { [path.basename(toolset.url)]: toolset.checksum },\n overrideUrl: toolset.url,\n })\n } else if (type === \"file\") {\n const cacheDir = await cacheDirectoryOverrideAllowed.value\n const customToolsetDir = path.join(cacheDir, \"custom-toolsets\")\n await mkdir(customToolsetDir, { recursive: true })\n\n // wipe first to ensure idempotent extraction if the source file changed since last extraction.\n // Contain the destination within customToolsetDir (mirrors the `url` branch): `version` is a free-form\n // config field, so a `../…` value must not let rmdir/extract escape the cache directory.\n const toolsetTarget = sanitizeDirPath(path.join(customToolsetDir, releaseName), customToolsetDir)\n if (await exists(toolsetTarget)) {\n await rmdir(toolsetTarget, { recursive: true })\n }\n await extractArchive(resolveFilePath(toolset.url, resourcesDir), toolsetTarget)\n return toolsetTarget\n }\n\n throw new Error(`Unsupported custom toolset type: ${type}`)\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/toolsets/icons.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/toolsets/icons.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAwBnD,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAW9G;AAED,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAA;IACpC,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;IACpC,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAID,wBAAsB,YAAY,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAcxI"}
|
package/dist/toolsets/icons.js
CHANGED
|
@@ -5,7 +5,7 @@ import { withIconsLock } from "../util/toolsetLock.js";
|
|
|
5
5
|
import { getCustomToolsetPath } from "./custom.js";
|
|
6
6
|
import { resolveToolsetVersion } from "./version.js";
|
|
7
7
|
// Newest icons-conversion bundle — selected when the config is unset / null / "latest".
|
|
8
|
-
const ICONS_LATEST = "1.2.
|
|
8
|
+
const ICONS_LATEST = "1.2.3";
|
|
9
9
|
const iconsToolsChecksums = {
|
|
10
10
|
"1.1.0": {
|
|
11
11
|
"icons-bundle.tar.gz": "2241c9501aa5ddd19317956449f50a1bc311df2c34058aae9bf8bfe62081eaec",
|
|
@@ -16,6 +16,9 @@ const iconsToolsChecksums = {
|
|
|
16
16
|
"1.2.1": {
|
|
17
17
|
"icons-bundle.tar.gz": "193241afc7c81ab165fa0af15ef0af88f796eb69e8e5bb4249a49310d8be242a",
|
|
18
18
|
},
|
|
19
|
+
"1.2.3": {
|
|
20
|
+
"icons-bundle.tar.gz": "4e5bb546c9d3ab0c2bbacc22857467bf415f742a34c2be9dd138779d2fc066f9",
|
|
21
|
+
},
|
|
19
22
|
};
|
|
20
23
|
export async function getIconsToolsetPath(icons, resourcesDir) {
|
|
21
24
|
if (typeof icons === "object" && icons != null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/toolsets/icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACvF,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAEpD,wFAAwF;AACxF,MAAM,YAAY,GAAG,OAAO,CAAA;AAE5B,MAAM,mBAAmB,GAAG;IAC1B,OAAO,EAAE;QACP,qBAAqB,EAAE,kEAAkE;KAC1F;IACD,OAAO,EAAE;QACP,qBAAqB,EAAE,kEAAkE;KAC1F;IACD,OAAO,EAAE;QACP,qBAAqB,EAAE,kEAAkE;KAC1F;CACO,CAAA;AAEV,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,KAA6B,EAAE,YAAoB;IAC3F,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAC/C,OAAO,oBAAoB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;IAClD,CAAC;IACD,MAAM,OAAO,GAAG,qBAAqB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;IAC1D,OAAO,sBAAsB,CAAC;QAC5B,WAAW,EAAE,SAAS,OAAO,EAAE;QAC/B,eAAe,EAAE,qBAAqB;QACtC,SAAS,EAAE,mBAAmB,CAAC,OAAO,CAAC;QACvC,aAAa,EAAE,6CAA6C;KAC7D,CAAC,CAAA;AACJ,CAAC;AAUD,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAU,CAAA;AAE5D,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAyB;IACvH,IAAI,CAAE,oBAA0C,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,yBAAyB,CAAC,+BAA+B,YAAY,EAAE,CAAC,CAAA;IACpF,CAAC;IACD,MAAM,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC,CAAA;IAC5C,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IAE1C,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;IACzE,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE,WAAW,CAAC,CAAA;IAC1F,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,yBAAyB,CAAC,0CAA0C,UAAU,EAAE,CAAC,CAAA;IAC7F,CAAC;IACD,sLAAsL;IACtL,MAAM,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;AACxJ,CAAC","sourcesContent":["import { exec, exists, InvalidConfigurationError, sanitizeDirPath } from \"builder-util\"\nimport * as path from \"path\"\nimport { ToolsetConfig } from \"../configuration.js\"\nimport { downloadBuilderToolset } from \"../util/electronGet.js\"\nimport { withIconsLock } from \"../util/toolsetLock.js\"\nimport { getCustomToolsetPath } from \"./custom.js\"\nimport { resolveToolsetVersion } from \"./version.js\"\n\n// Newest icons-conversion bundle — selected when the config is unset / null / \"latest\".\nconst ICONS_LATEST = \"1.2.
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/toolsets/icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACvF,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAE5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAEpD,wFAAwF;AACxF,MAAM,YAAY,GAAG,OAAO,CAAA;AAE5B,MAAM,mBAAmB,GAAG;IAC1B,OAAO,EAAE;QACP,qBAAqB,EAAE,kEAAkE;KAC1F;IACD,OAAO,EAAE;QACP,qBAAqB,EAAE,kEAAkE;KAC1F;IACD,OAAO,EAAE;QACP,qBAAqB,EAAE,kEAAkE;KAC1F;IACD,OAAO,EAAE;QACP,qBAAqB,EAAE,kEAAkE;KAC1F;CACO,CAAA;AAEV,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,KAA6B,EAAE,YAAoB;IAC3F,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAC/C,OAAO,oBAAoB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;IAClD,CAAC;IACD,MAAM,OAAO,GAAG,qBAAqB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;IAC1D,OAAO,sBAAsB,CAAC;QAC5B,WAAW,EAAE,SAAS,OAAO,EAAE;QAC/B,eAAe,EAAE,qBAAqB;QACtC,SAAS,EAAE,mBAAmB,CAAC,OAAO,CAAC;QACvC,aAAa,EAAE,6CAA6C;KAC7D,CAAC,CAAA;AACJ,CAAC;AAUD,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAU,CAAA;AAE5D,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAyB;IACvH,IAAI,CAAE,oBAA0C,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,yBAAyB,CAAC,+BAA+B,YAAY,EAAE,CAAC,CAAA;IACpF,CAAC;IACD,MAAM,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC,CAAA;IAC5C,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IAE1C,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;IACzE,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE,WAAW,CAAC,CAAA;IAC1F,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,yBAAyB,CAAC,0CAA0C,UAAU,EAAE,CAAC,CAAA;IAC7F,CAAC;IACD,sLAAsL;IACtL,MAAM,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;AACxJ,CAAC","sourcesContent":["import { exec, exists, InvalidConfigurationError, sanitizeDirPath } from \"builder-util\"\nimport * as path from \"path\"\nimport { ToolsetConfig } from \"../configuration.js\"\nimport { downloadBuilderToolset } from \"../util/electronGet.js\"\nimport { withIconsLock } from \"../util/toolsetLock.js\"\nimport { getCustomToolsetPath } from \"./custom.js\"\nimport { resolveToolsetVersion } from \"./version.js\"\n\n// Newest icons-conversion bundle — selected when the config is unset / null / \"latest\".\nconst ICONS_LATEST = \"1.2.3\"\n\nconst iconsToolsChecksums = {\n \"1.1.0\": {\n \"icons-bundle.tar.gz\": \"2241c9501aa5ddd19317956449f50a1bc311df2c34058aae9bf8bfe62081eaec\",\n },\n \"1.2.0\": {\n \"icons-bundle.tar.gz\": \"788add2400487fe00d5ceac4a8347bd71fc43c8c988fde879f929992ea0c03ea\",\n },\n \"1.2.1\": {\n \"icons-bundle.tar.gz\": \"193241afc7c81ab165fa0af15ef0af88f796eb69e8e5bb4249a49310d8be242a\",\n },\n \"1.2.3\": {\n \"icons-bundle.tar.gz\": \"4e5bb546c9d3ab0c2bbacc22857467bf415f742a34c2be9dd138779d2fc066f9\",\n },\n} as const\n\nexport async function getIconsToolsetPath(icons: ToolsetConfig[\"icons\"], resourcesDir: string): Promise<string> {\n if (typeof icons === \"object\" && icons != null) {\n return getCustomToolsetPath(icons, resourcesDir)\n }\n const version = resolveToolsetVersion(icons, ICONS_LATEST)\n return downloadBuilderToolset({\n releaseName: `icons@${version}`,\n filenameWithExt: \"icons-bundle.tar.gz\",\n checksums: iconsToolsChecksums[version],\n githubOrgRepo: \"electron-userland/electron-builder-binaries\",\n })\n}\n\ntype IconConversionOptions = {\n inputFile: string\n outputFormat: \"icns\" | \"ico\" | \"set\"\n outDir: string\n iconsToolset: ToolsetConfig[\"icons\"]\n resourcesDir: string\n}\n\nconst VALID_OUTPUT_FORMATS = [\"icns\", \"ico\", \"set\"] as const\n\nexport async function runIconsTool({ inputFile, outputFormat, outDir, iconsToolset, resourcesDir }: IconConversionOptions): Promise<void> {\n if (!(VALID_OUTPUT_FORMATS as readonly string[]).includes(outputFormat)) {\n throw new InvalidConfigurationError(`Invalid icon output format: ${outputFormat}`)\n }\n const safeInput = sanitizeDirPath(inputFile)\n const safeOutDir = sanitizeDirPath(outDir)\n\n const toolsetPath = await getIconsToolsetPath(iconsToolset, resourcesDir)\n const scriptPath = sanitizeDirPath(path.resolve(toolsetPath, \"icon-tool.js\"), toolsetPath)\n if (!(await exists(scriptPath))) {\n throw new InvalidConfigurationError(`Icons tool not found at expected path: ${scriptPath}`)\n }\n // Serialize icon-tool spawns across processes: each reserves a large WebAssembly.Memory, andrunning many in parallel (e.g. across vitest workers) exhausts memory. See withIconsLock.\n await withIconsLock(() => exec(process.execPath, [scriptPath, `--input`, safeInput, `--format`, outputFormat, `--out`, safeOutDir], { shell: false }))\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appFileCopier.d.ts","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,eAAe,
|
|
1
|
+
{"version":3,"file":"appFileCopier.d.ts","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,eAAe,EAA8F,MAAM,cAAc,CAAA;AAE9K,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAA;AAO1B,OAAO,EAA+B,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAAgC,EAAE,EAAE,MAAM,mCAAmC,CAAA;AACpF,OAAO,EAAyC,aAAa,EAAE,MAAM,2CAA2C,CAAA;AAChH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAGzD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAGlE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,UAYxE;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,iBAyC5G;AAGD,MAAM,WAAW,eAAe;IAC9B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AAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAqB5C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsyncTaskManager, FileCopier, isEmptyOrSpaces, log, MAX_FILE_REQUESTS, statOrNull, walk } from "builder-util";
|
|
1
|
+
import { AsyncTaskManager, FileCopier, InvalidConfigurationError, isEmptyOrSpaces, log, MAX_FILE_REQUESTS, statOrNull, walk } from "builder-util";
|
|
2
2
|
import { DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES } from "../configuration.js";
|
|
3
3
|
import fsExtra from "fs-extra";
|
|
4
4
|
import { mkdir, readlink } from "fs/promises";
|
|
@@ -8,7 +8,7 @@ import { isLibOrExe } from "../asar/unpackDetector.js";
|
|
|
8
8
|
import { Platform } from "../core.js";
|
|
9
9
|
import { DEFAULT_EXCLUDED_EXTENSIONS, FileMatcher } from "../fileMatcher.js";
|
|
10
10
|
import { getCollectorByPackageManager, PM } from "../node-module-collector/index.js";
|
|
11
|
-
import { logMessageLevelByKey } from "../node-module-collector/moduleManager.js";
|
|
11
|
+
import { LogMessageByKey, logMessageLevelByKey } from "../node-module-collector/moduleManager.js";
|
|
12
12
|
import { AppFileWalker } from "./AppFileWalker.js";
|
|
13
13
|
import { NodeModuleCopyHelper } from "./NodeModuleCopyHelper.js";
|
|
14
14
|
import { archToNodeCpu } from "./archCompatibility.js";
|
|
@@ -216,6 +216,55 @@ export async function resolveFirstMatchingCollection(options) {
|
|
|
216
216
|
}
|
|
217
217
|
return fallback;
|
|
218
218
|
}
|
|
219
|
+
/** Extracts the package name from a `name@version` log-summary entry, handling `@scope/name@version`. */
|
|
220
|
+
function dependencyNameFromSummaryId(id) {
|
|
221
|
+
let at;
|
|
222
|
+
if (id.startsWith("@")) {
|
|
223
|
+
// Scoped package: the version separator is the first `@` after the scope's `/`
|
|
224
|
+
const slashIndex = id.indexOf("/");
|
|
225
|
+
if (slashIndex === -1) {
|
|
226
|
+
return id;
|
|
227
|
+
}
|
|
228
|
+
at = id.indexOf("@", slashIndex + 1);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
at = id.indexOf("@");
|
|
232
|
+
}
|
|
233
|
+
return at > 0 ? id.slice(0, at) : id;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Enforces {@link CommonConfiguration.allowMissingDependencies} against the finished collection
|
|
237
|
+
* summary (issue #10058). Runs only after collection completes, so the error reports the COMPLETE
|
|
238
|
+
* set of missing production dependencies at once instead of failing on the first one.
|
|
239
|
+
*
|
|
240
|
+
* Fail-closed by default: `false`, `null` and omitted all fail the build when a production
|
|
241
|
+
* dependency is missing; `true` restores the historical warn-only behavior. When the option is a
|
|
242
|
+
* `string[]`, only the listed dependency names are allowed to be missing — matched against the
|
|
243
|
+
* package name parsed from the summary's `name@version` entries (scoped names included), with an
|
|
244
|
+
* exact-entry match accepted as well.
|
|
245
|
+
*
|
|
246
|
+
* Only genuinely missing production dependencies (`PKG_NOT_FOUND` / `PKG_NOT_ON_DISK`) are fatal;
|
|
247
|
+
* missing optional dependencies (`PKG_OPTIONAL_NOT_INSTALLED` / `PKG_OPTIONAL_PLATFORM_NOT_INSTALLED`)
|
|
248
|
+
* never fail the build.
|
|
249
|
+
*
|
|
250
|
+
* @internal exported for tests
|
|
251
|
+
*/
|
|
252
|
+
export function enforceAllowMissingDependencies(allowMissingDependencies, logSummary) {
|
|
253
|
+
if (allowMissingDependencies === true) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
const missing = new Set([...(logSummary?.[LogMessageByKey.PKG_NOT_FOUND] ?? []), ...(logSummary?.[LogMessageByKey.PKG_NOT_ON_DISK] ?? [])]);
|
|
257
|
+
const allowed = new Set(Array.isArray(allowMissingDependencies) ? allowMissingDependencies : []);
|
|
258
|
+
const fatal = Array.from(missing)
|
|
259
|
+
.filter(id => !allowed.has(dependencyNameFromSummaryId(id)) && !allowed.has(id))
|
|
260
|
+
.sort();
|
|
261
|
+
if (fatal.length === 0) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
throw new InvalidConfigurationError(`The following production dependencies could not be resolved during node-module collection:\n` +
|
|
265
|
+
fatal.map(id => ` - ${id}`).join("\n") +
|
|
266
|
+
`\nInstall the missing dependencies, list names in \`allowMissingDependencies\` to allow specific ones to be missing, or set \`allowMissingDependencies\` to true to only warn (electron-builder <= 26 behavior).`);
|
|
267
|
+
}
|
|
219
268
|
/** @internal */
|
|
220
269
|
export async function collectNodeModulesWithLogging(platformPackager, arch) {
|
|
221
270
|
const { tempDirManager, appDir, projectDir } = platformPackager;
|
|
@@ -231,6 +280,15 @@ export async function collectNodeModulesWithLogging(platformPackager, arch) {
|
|
|
231
280
|
// valid production dependencies for tooling such as SBOM generation. See NodeModulesCollector.getNodeModules.
|
|
232
281
|
const configuredIgnored = platformPackager.config.ignoredProductionDependencies;
|
|
233
282
|
const ignoredDependencies = configuredIgnored == null ? DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES : configuredIgnored;
|
|
283
|
+
// An app that declares no production dependencies at all (neither as-installed nor via
|
|
284
|
+
// `extraMetadata`) has nothing to bundle. Without this guard the search would skip the app's
|
|
285
|
+
// empty `node_modules`, climb to the workspace root, and the vacuous match in
|
|
286
|
+
// `collectionMatchesAppDependencies` would accept the entire hoisted workspace tree (#10033).
|
|
287
|
+
const declaredDependencies = Object.keys({ ...platformPackager.originalMetadata.dependencies, ...platformPackager.metadata.dependencies });
|
|
288
|
+
if (declaredDependencies.length === 0) {
|
|
289
|
+
log.info(null, "app has no production dependencies, skipping node_modules bundling");
|
|
290
|
+
return [];
|
|
291
|
+
}
|
|
234
292
|
// Validate against the as-declared (pre-extraMetadata) production dependencies so a configured
|
|
235
293
|
// `extraMetadata.dependencies` entry that isn't installed cannot reject a correct collection.
|
|
236
294
|
const deps = await resolveFirstMatchingCollection({
|
|
@@ -248,6 +306,9 @@ export async function collectNodeModulesWithLogging(platformPackager, arch) {
|
|
|
248
306
|
const logLevel = logMessageLevelByKey[errorMessage] || "debug";
|
|
249
307
|
log[logLevel]({ dependencies }, errorMessage);
|
|
250
308
|
}
|
|
309
|
+
// Fail-closed enforcement (issue #10058): collection is complete and the summary above has reached
|
|
310
|
+
// the log, so failing here reports every missing production dependency at once.
|
|
311
|
+
enforceAllowMissingDependencies(platformPackager.config.allowMissingDependencies, deps.logSummary);
|
|
251
312
|
// Tripwire: the default-ignored packages are excluded because electron-builder already provides them
|
|
252
313
|
// (e.g. the embedded Electron runtime), so a copy in `node_modules` is redundant. They only reach this
|
|
253
314
|
// point unflagged when a user has removed them from `ignoredProductionDependencies`; record any that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appFileCopier.js","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,gBAAgB,EAAE,UAAU,EAAmB,eAAe,EAAQ,GAAG,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnJ,OAAO,EAAE,uCAAuC,EAAE,MAAM,qBAAqB,CAAA;AAE7E,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAAE,4BAA4B,EAAE,EAAE,EAAE,MAAM,mCAAmC,CAAA;AACpF,OAAO,EAAmB,oBAAoB,EAAiB,MAAM,2CAA2C,CAAA;AAGhH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CA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CAAC;QACnD,MAAM,QAAQ,GAAG,oBAAoB,CAAC,YAA+B,CAAC,IAAI,OAAO,CAAA;QACjF,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,YAAY,CAAC,CAAA;IAC/C,CAAC;IAED,qGAAqG;IACrG,uGAAuG;IACvG,qGAAqG;IACrG,mGAAmG;IACnG,MAAM,qBAAqB,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,IAAI,uCAAuC,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;IACzJ,IAAI,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrC,GAAG,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,qBAAqB,EAAE,EAAE,iFAAiF,CAAC,CAAA;IACtI,CAAC;IAED,OAAO,IAAI,CAAC,WAAW,CAAA;AACzB,CAAC","sourcesContent":["import { Arch, AsyncTaskManager, FileCopier, FileTransformer, isEmptyOrSpaces, Link, log, MAX_FILE_REQUESTS, statOrNull, walk } from \"builder-util\"\nimport { DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES } from \"../configuration.js\"\nimport { Stats } from \"fs\"\nimport fsExtra 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.js\"\nimport { Platform } from \"../core.js\"\nimport { DEFAULT_EXCLUDED_EXTENSIONS, FileMatcher } from \"../fileMatcher.js\"\nimport { getCollectorByPackageManager, PM } from \"../node-module-collector/index.js\"\nimport { LogMessageByKey, logMessageLevelByKey, ModuleManager } from \"../node-module-collector/moduleManager.js\"\nimport { Packager } from \"../packager.js\"\nimport { PlatformPackager } from \"../platformPackager.js\"\nimport { AppFileWalker } from \"./AppFileWalker.js\"\nimport { NodeModuleCopyHelper } from \"./NodeModuleCopyHelper.js\"\nimport { NodeModuleInfo } from \"../node-module-collector/types.js\"\nimport { archToNodeCpu } from \"./archCompatibility.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 => fsExtra.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(matchers: Array<FileMatcher>, transformer: FileTransformer | null, platformPackager: PlatformPackager<any>): Promise<Array<ResolvedFileSet>> {\n const fileSets: Array<ResolvedFileSet> = []\n\n for (const matcher of matchers) {\n const fileWalker = new AppFileWalker(matcher, platformPackager)\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 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 = DEFAULT_EXCLUDED_EXTENSIONS.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(\n platformPackager: PlatformPackager<any>,\n mainMatcher: FileMatcher,\n arch: Arch,\n applyArchFilter = true\n): Promise<Array<ResolvedFileSet>> {\n const deps = await collectNodeModulesWithLogging(platformPackager, applyArchFilter ? arch : null)\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 // Ignore excluded dependencies.\n if (dep.excluded) {\n return\n }\n\n const source = dep.dir\n const matcher = new FileMatcher(source, destination, mainMatcher.macroExpander, mainMatcher.patterns)\n const copier = new NodeModuleCopyHelper(matcher, platformPackager)\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/** @internal */\nexport async function collectNodeModulesWithLogging(platformPackager: PlatformPackager<any>, arch: Arch | null) {\n const { tempDirManager, appDir, projectDir } = platformPackager\n\n // Drop packages whose `package.json` `cpu`/`os` is incompatible with the target arch/platform while\n // collecting (e.g. exclude `@esbuild/darwin-arm64` from the x64 slice). See NodeModulesCollector.\n // `null` arch (universal slices) disables the filter so both slices stay symmetric for the merge.\n const archFilter = arch == null ? undefined : { cpu: archToNodeCpu(arch), os: platformPackager.platform.nodeName }\n\n const searchDirectories = Array.from(new Set([appDir, projectDir, await platformPackager.getWorkspaceRoot()])).filter((it): it is string => isEmptyOrSpaces(it) === false)\n const pmApproaches = [await platformPackager.getPackageManager(), PM.TRAVERSAL]\n\n // The default-ignored packages are excluded from the copied `node_modules` — together with any\n // transitive dependency they alone require — because electron-builder already provides them another\n // way (the Electron runtime is embedded separately), so copying them would be redundant. They remain\n // valid production dependencies for tooling such as SBOM generation. See NodeModulesCollector.getNodeModules.\n const configuredIgnored = platformPackager.config.ignoredProductionDependencies\n const ignoredDependencies = configuredIgnored == null ? DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES : configuredIgnored\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: platformPackager.originalMetadata.dependencies,\n run: (pm, dir) => getCollectorByPackageManager(pm, dir, tempDirManager).getNodeModules({ packageName: platformPackager.nodePackageName, archFilter, ignoredDependencies }),\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 // Tripwire: the default-ignored packages are excluded because electron-builder already provides them\n // (e.g. the embedded Electron runtime), so a copy in `node_modules` is redundant. They only reach this\n // point unflagged when a user has removed them from `ignoredProductionDependencies`; record any that\n // are therefore about to be copied (present but not marked `excluded`) so the summary below warns.\n const bundledDefaultIgnored = deps.nodeModules.filter(it => !it.excluded && DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES.includes(it.name)).map(it => it.name)\n if (bundledDefaultIgnored.length > 0) {\n log.warn({ dependencies: bundledDefaultIgnored }, \"copied dependencies that shouldn't be needed, see ignoredProductionDependencies\")\n }\n\n return deps.nodeModules\n}\n"]}
|
|
1
|
+
{"version":3,"file":"appFileCopier.js","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,gBAAgB,EAAE,UAAU,EAAmB,yBAAyB,EAAE,eAAe,EAAQ,GAAG,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC9K,OAAO,EAAE,uCAAuC,EAAE,MAAM,qBAAqB,CAAA;AAE7E,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAAE,4BAA4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,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;IAElG,qGAAqG;IACrG,uGAAuG;IACvG,qGAAqG;IACrG,mGAAmG;IACnG,MAAM,qBAAqB,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,IAAI,uCAAuC,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;IACzJ,IAAI,qBAAqB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrC,GAAG,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,qBAAqB,EAAE,EAAE,iFAAiF,CAAC,CAAA;IACtI,CAAC;IAED,OAAO,IAAI,CAAC,WAAW,CAAA;AACzB,CAAC","sourcesContent":["import { Arch, AsyncTaskManager, FileCopier, FileTransformer, InvalidConfigurationError, isEmptyOrSpaces, Link, log, MAX_FILE_REQUESTS, statOrNull, walk } from \"builder-util\"\nimport { DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES } from \"../configuration.js\"\nimport { Stats } from \"fs\"\nimport fsExtra 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.js\"\nimport { Platform } from \"../core.js\"\nimport { DEFAULT_EXCLUDED_EXTENSIONS, FileMatcher } from \"../fileMatcher.js\"\nimport { getCollectorByPackageManager, PM } from \"../node-module-collector/index.js\"\nimport { LogMessageByKey, logMessageLevelByKey, ModuleManager } from \"../node-module-collector/moduleManager.js\"\nimport { Packager } from \"../packager.js\"\nimport { PlatformPackager } from \"../platformPackager.js\"\nimport { AppFileWalker } from \"./AppFileWalker.js\"\nimport { NodeModuleCopyHelper } from \"./NodeModuleCopyHelper.js\"\nimport { NodeModuleInfo } from \"../node-module-collector/types.js\"\nimport { archToNodeCpu } from \"./archCompatibility.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 => fsExtra.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(matchers: Array<FileMatcher>, transformer: FileTransformer | null, platformPackager: PlatformPackager<any>): Promise<Array<ResolvedFileSet>> {\n const fileSets: Array<ResolvedFileSet> = []\n\n for (const matcher of matchers) {\n const fileWalker = new AppFileWalker(matcher, platformPackager)\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 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 = DEFAULT_EXCLUDED_EXTENSIONS.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(\n platformPackager: PlatformPackager<any>,\n mainMatcher: FileMatcher,\n arch: Arch,\n applyArchFilter = true\n): Promise<Array<ResolvedFileSet>> {\n const deps = await collectNodeModulesWithLogging(platformPackager, applyArchFilter ? arch : null)\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 // Ignore excluded dependencies.\n if (dep.excluded) {\n return\n }\n\n const source = dep.dir\n const matcher = new FileMatcher(source, destination, mainMatcher.macroExpander, mainMatcher.patterns)\n const copier = new NodeModuleCopyHelper(matcher, platformPackager)\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 {@link CommonConfiguration.allowMissingDependencies} against the finished collection\n * summary (issue #10058). Runs only after collection completes, so the error reports the COMPLETE\n * set of missing production dependencies at once instead of failing on the first one.\n *\n * Fail-closed by default: `false`, `null` and omitted all fail the build when a production\n * dependency is missing; `true` restores the historical warn-only behavior. When the option is a\n * `string[]`, only the listed dependency names are allowed to be missing — matched against the\n * package name parsed from the summary's `name@version` entries (scoped names included), with an\n * 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 * @internal exported for tests\n */\nexport function enforceAllowMissingDependencies(allowMissingDependencies: boolean | Array<string> | null | undefined, logSummary: ModuleManager[\"logSummary\"] | undefined): void {\n if (allowMissingDependencies === true) {\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 (electron-builder <= 26 behavior).`\n )\n}\n\n/** @internal */\nexport async function collectNodeModulesWithLogging(platformPackager: PlatformPackager<any>, arch: Arch | null) {\n const { tempDirManager, appDir, projectDir } = platformPackager\n\n // Drop packages whose `package.json` `cpu`/`os` is incompatible with the target arch/platform while\n // collecting (e.g. exclude `@esbuild/darwin-arm64` from the x64 slice). See NodeModulesCollector.\n // `null` arch (universal slices) disables the filter so both slices stay symmetric for the merge.\n const archFilter = arch == null ? undefined : { cpu: archToNodeCpu(arch), os: platformPackager.platform.nodeName }\n\n const searchDirectories = Array.from(new Set([appDir, projectDir, await platformPackager.getWorkspaceRoot()])).filter((it): it is string => isEmptyOrSpaces(it) === false)\n const pmApproaches = [await platformPackager.getPackageManager(), PM.TRAVERSAL]\n\n // The default-ignored packages are excluded from the copied `node_modules` — together with any\n // transitive dependency they alone require — because electron-builder already provides them another\n // way (the Electron runtime is embedded separately), so copying them would be redundant. They remain\n // valid production dependencies for tooling such as SBOM generation. See NodeModulesCollector.getNodeModules.\n const configuredIgnored = platformPackager.config.ignoredProductionDependencies\n const ignoredDependencies = configuredIgnored == null ? DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES : configuredIgnored\n\n // An app that declares no production dependencies at all (neither as-installed nor via\n // `extraMetadata`) has nothing to bundle. Without this guard the search would skip the app's\n // empty `node_modules`, climb to the workspace root, and the vacuous match in\n // `collectionMatchesAppDependencies` would accept the entire hoisted workspace tree (#10033).\n const declaredDependencies = Object.keys({ ...platformPackager.originalMetadata.dependencies, ...platformPackager.metadata.dependencies })\n if (declaredDependencies.length === 0) {\n log.info(null, \"app has no production dependencies, skipping node_modules bundling\")\n return []\n }\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: platformPackager.originalMetadata.dependencies,\n run: (pm, dir) => getCollectorByPackageManager(pm, dir, tempDirManager).getNodeModules({ packageName: platformPackager.nodePackageName, archFilter, ignoredDependencies }),\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 // Fail-closed enforcement (issue #10058): collection is complete and the summary above has reached\n // the log, so failing here reports every missing production dependency at once.\n enforceAllowMissingDependencies(platformPackager.config.allowMissingDependencies, deps.logSummary)\n\n // Tripwire: the default-ignored packages are excluded because electron-builder already provides them\n // (e.g. the embedded Electron runtime), so a copy in `node_modules` is redundant. They only reach this\n // point unflagged when a user has removed them from `ignoredProductionDependencies`; record any that\n // are therefore about to be copied (present but not marked `excluded`) so the summary below warns.\n const bundledDefaultIgnored = deps.nodeModules.filter(it => !it.excluded && DEFAULT_IGNORED_PRODUCTION_DEPENDENCIES.includes(it.name)).map(it => it.name)\n if (bundledDefaultIgnored.length > 0) {\n log.warn({ dependencies: bundledDefaultIgnored }, \"copied dependencies that shouldn't be needed, see ignoredProductionDependencies\")\n }\n\n return deps.nodeModules\n}\n"]}
|
|
@@ -45,6 +45,11 @@ export declare function downloadBuilderToolset(options: {
|
|
|
45
45
|
* Use when you need to extract the zip yourself (e.g. directly to appOutDir to preserve empty dirs and symlinks).
|
|
46
46
|
*/
|
|
47
47
|
export declare function downloadElectronArtifactZip(options: ArtifactDownloadOptions): Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Downloads an electron platform artifact (e.g. ffmpeg) via `@electron/get` and extracts it into a
|
|
50
|
+
* content-addressed cache directory (keyed on a hash of the resolved artifact config), returning the
|
|
51
|
+
* extraction path.
|
|
52
|
+
*/
|
|
48
53
|
export declare function downloadElectronArtifact(options: ArtifactDownloadOptions): Promise<string>;
|
|
49
54
|
/**
|
|
50
55
|
* Get the binaries mirror URL from environment variables.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electronGet.d.ts","sourceRoot":"","sources":["../../src/util/electronGet.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,+BAA+B,EAE/B,aAAa,EACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAa,QAAQ,EAAgB,MAAM,sBAAsB,CAAA;AAexE,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAC9C,+BAA+B,EAC7B,UAAU,GACV,MAAM,GACN,SAAS,GACT,cAAc,GACd,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,GACf,YAAY,GACZ,WAAW,GACX,WAAW,GACX,iBAAiB,GACjB,WAAW,GACX,eAAe,CAClB;IACC,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,WAAW,GAAG,gBAAgB,GAAG,eAAe,CAAC,CAAA;CACtF;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAA;IACnC,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,MAAM,CAQ7D;AAMD,eAAO,MAAM,6BAA6B,sCAOzC,CAAA;AAKD,wBAAsB,yBAAyB,CAAC,OAAO,EAAE;IAAE,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAAC,mBAAmB,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM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MAAM,EAAE,GAAG,EAAE,MAAM,iBAgFhE;AAUD;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAmPD;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBnG;AA0CD;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE;IACpD,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAClC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuClB;AA+GD;;;GAGG;AACH,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CAGnG;AAED;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CAShG;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAclE"}
|
package/dist/util/electronGet.js
CHANGED
|
@@ -328,6 +328,12 @@ async function downloadArtifactToFile(config, label) {
|
|
|
328
328
|
* Checks electron-builder's own archive cache for a previously downloaded archive.
|
|
329
329
|
* Validates the SHA-256 checksum when one is known. Returns the cached path on hit,
|
|
330
330
|
* null on miss or checksum mismatch (mismatch also deletes the stale file).
|
|
331
|
+
*
|
|
332
|
+
* Air-gapped seeding contract: placing the archive at
|
|
333
|
+
* `<cacheDir>/<releaseName>/<archive>` (e.g. `$ELECTRON_BUILDER_CACHE/appimage@1.0.3/appimage-tools-runtime-20251108.tar.gz`)
|
|
334
|
+
* is sufficient for a fully offline toolset resolution — the checksum here is computed locally
|
|
335
|
+
* against the value hardcoded in the toolset module, and extraction happens locally too. No
|
|
336
|
+
* `.state` file needs to be seeded. See https://www.electron.build/tutorials/offline-air-gapped-builds.
|
|
331
337
|
*/
|
|
332
338
|
async function resolveFromArchiveCache(archiveCachePath, label, expectedSha256) {
|
|
333
339
|
if (!(await exists(archiveCachePath))) {
|
|
@@ -551,28 +557,122 @@ export async function downloadBuilderToolset(options) {
|
|
|
551
557
|
return downloadAndExtract(config, extractDir, filenameWithExt, archiveCachePath);
|
|
552
558
|
}
|
|
553
559
|
/**
|
|
554
|
-
*
|
|
555
|
-
*
|
|
560
|
+
* Mirrors @electron/get's default cache root (`env-paths("electron", { suffix: "" }).cache`).
|
|
561
|
+
* @electron/get does not export it and its package `exports` map blocks deep imports, so the
|
|
562
|
+
* (deliberately tiny) platform switch is replicated here. Must stay in sync with the
|
|
563
|
+
* `cacheRoot` default documented in @electron/get's `ElectronDownloadRequestOptions`.
|
|
564
|
+
* @internal exported for unit testing
|
|
565
|
+
*/
|
|
566
|
+
export function defaultElectronGetCacheRoot() {
|
|
567
|
+
const name = "electron";
|
|
568
|
+
const homeDir = os.homedir();
|
|
569
|
+
switch (os.platform()) {
|
|
570
|
+
case "darwin":
|
|
571
|
+
return path.join(homeDir, "Library", "Caches", name);
|
|
572
|
+
case "win32":
|
|
573
|
+
return path.join(process.env.LOCALAPPDATA || path.join(homeDir, "AppData", "Local"), name, "Cache");
|
|
574
|
+
default:
|
|
575
|
+
return path.join(process.env.XDG_CACHE_HOME || path.join(homeDir, ".cache"), name);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Parses the upstream `SHASUMS256.txt` format into the `Record<filename, sha256-hex>` shape that
|
|
580
|
+
* @electron/get accepts as inline `checksums`. Each line is `<sha256-hex> *<filename>` (binary
|
|
581
|
+
* mode) or `<sha256-hex> <filename>` (text mode); malformed lines are ignored.
|
|
582
|
+
* @internal exported for unit testing
|
|
583
|
+
*/
|
|
584
|
+
export function parseChecksumFile(content) {
|
|
585
|
+
const checksums = {};
|
|
586
|
+
for (const rawLine of content.split("\n")) {
|
|
587
|
+
const match = /^([a-fA-F0-9]{64})\s+\*?(.+)$/.exec(rawLine.trim());
|
|
588
|
+
if (match != null) {
|
|
589
|
+
checksums[match[2]] = match[1].toLowerCase();
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
return checksums;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Looks for a locally seeded SHASUMS256 file at the root of the @electron/get cache and returns
|
|
596
|
+
* its contents as inline `checksums`, or null when nothing usable is seeded.
|
|
597
|
+
*
|
|
598
|
+
* Why: without inline `checksums`, @electron/get re-downloads `SHASUMS256.txt` with a hardcoded
|
|
599
|
+
* `cacheMode: Bypass` on EVERY build — even when the artifact itself is a cache hit — so a fully
|
|
600
|
+
* seeded cache still requires network access and air-gapped builds fail (#10039). Cache-seeding
|
|
601
|
+
* tools (e.g. flatpak-node-generator) already place `SHASUMS256.txt-<version>` flat at the cache
|
|
602
|
+
* root; feeding it back as inline `checksums` keeps checksum validation enabled while making it
|
|
603
|
+
* fully offline. A plain `SHASUMS256.txt` at the cache root is accepted as a manual-seeding
|
|
604
|
+
* fallback. A candidate file is only used when it actually contains an entry for the requested
|
|
605
|
+
* artifact, so a stale file for another version can never break an online build.
|
|
606
|
+
* See https://www.electron.build/tutorials/offline-air-gapped-builds for the seeding contract.
|
|
607
|
+
* @internal exported for unit testing
|
|
608
|
+
*/
|
|
609
|
+
export async function resolveSeededChecksums(cacheRoot, version, artifactFileName) {
|
|
610
|
+
const candidates = [path.join(cacheRoot, `SHASUMS256.txt-${version}`), path.join(cacheRoot, "SHASUMS256.txt")];
|
|
611
|
+
for (const candidate of candidates) {
|
|
612
|
+
if (!(await exists(candidate))) {
|
|
613
|
+
continue;
|
|
614
|
+
}
|
|
615
|
+
let content;
|
|
616
|
+
try {
|
|
617
|
+
content = await fs.readFile(candidate, "utf-8");
|
|
618
|
+
}
|
|
619
|
+
catch (err) {
|
|
620
|
+
log.warn({ file: log.filePath(candidate), err: err.message }, "failed to read seeded SHASUMS file — ignoring it");
|
|
621
|
+
continue;
|
|
622
|
+
}
|
|
623
|
+
const checksums = parseChecksumFile(content);
|
|
624
|
+
if (checksums[artifactFileName] == null) {
|
|
625
|
+
log.warn({ file: log.filePath(candidate), artifactFileName }, "seeded SHASUMS file has no entry for the requested artifact — ignoring it");
|
|
626
|
+
continue;
|
|
627
|
+
}
|
|
628
|
+
log.debug({ file: log.filePath(candidate), artifactFileName }, "using locally seeded SHASUMS256 checksums — checksum validation can run offline");
|
|
629
|
+
return checksums;
|
|
630
|
+
}
|
|
631
|
+
return null;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Assembles the `@electron/get` artifact config (`ElectronPlatformArtifactDetails`) from
|
|
635
|
+
* `ArtifactDownloadOptions`: spreads the caller's options and pins `cacheRoot`/`platform`/`arch`/
|
|
636
|
+
* `version`/`artifactName` and the resolved cache mode, warning when checksum verification is
|
|
637
|
+
* disabled. When the caller provides no `checksums` (user-provided `electronGet.checksums` always
|
|
638
|
+
* wins) and verification is not disabled, a locally seeded `SHASUMS256.txt-<version>` at the cache
|
|
639
|
+
* root is picked up as inline `checksums` so validation works offline (see resolveSeededChecksums).
|
|
640
|
+
* Callers pass the result to `downloadArtifactToFile` / `downloadAndExtract`.
|
|
641
|
+
* @internal exported for unit testing
|
|
556
642
|
*/
|
|
557
|
-
function buildElectronArtifactConfig(artifactOptions) {
|
|
643
|
+
export async function buildElectronArtifactConfig(artifactOptions) {
|
|
558
644
|
const { options, arch, version, platformName: platform, artifactName, cacheDir: cacheRoot } = artifactOptions;
|
|
559
645
|
if (options?.unsafelyDisableChecksums) {
|
|
560
|
-
log.warn({ artifactName }, "electronGet.unsafelyDisableChecksums is enabled — downloaded artifacts will NOT be verified
|
|
646
|
+
log.warn({ artifactName }, "electronGet.unsafelyDisableChecksums is enabled — downloaded artifacts will NOT be verified; a compromised mirror can serve malicious binaries undetected");
|
|
561
647
|
}
|
|
562
648
|
const artifactConfig = { ...options, cacheRoot, platform, arch, version, artifactName, cacheMode: resolveCacheMode() };
|
|
649
|
+
if (artifactConfig.checksums == null && !artifactConfig.unsafelyDisableChecksums) {
|
|
650
|
+
// Matches @electron/get's getArtifactFileName for non-generic artifacts; `artifactSuffix` and
|
|
651
|
+
// `customFilename` cannot diverge here — both are excluded from ElectronGetOptions.
|
|
652
|
+
const artifactFileName = `${artifactName}-v${version}-${platform}-${arch}.zip`;
|
|
653
|
+
const seededChecksums = await resolveSeededChecksums(cacheRoot ?? defaultElectronGetCacheRoot(), version, artifactFileName);
|
|
654
|
+
if (seededChecksums != null) {
|
|
655
|
+
artifactConfig.checksums = seededChecksums;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
563
658
|
return artifactConfig;
|
|
564
659
|
}
|
|
565
660
|
/**
|
|
566
661
|
* Downloads the electron artifact zip via @electron/get (with caching) and returns the zip file path.
|
|
567
662
|
* Use when you need to extract the zip yourself (e.g. directly to appOutDir to preserve empty dirs and symlinks).
|
|
568
663
|
*/
|
|
569
|
-
export function downloadElectronArtifactZip(options) {
|
|
570
|
-
const config = buildElectronArtifactConfig(options);
|
|
664
|
+
export async function downloadElectronArtifactZip(options) {
|
|
665
|
+
const config = await buildElectronArtifactConfig(options);
|
|
571
666
|
return downloadArtifactToFile(config, config.artifactName);
|
|
572
667
|
}
|
|
668
|
+
/**
|
|
669
|
+
* Downloads an electron platform artifact (e.g. ffmpeg) via `@electron/get` and extracts it into a
|
|
670
|
+
* content-addressed cache directory (keyed on a hash of the resolved artifact config), returning the
|
|
671
|
+
* extraction path.
|
|
672
|
+
*/
|
|
573
673
|
export async function downloadElectronArtifact(options) {
|
|
574
674
|
const { arch, version, platformName: platform, artifactName } = options;
|
|
575
|
-
const artifactConfig = buildElectronArtifactConfig(options);
|
|
675
|
+
const artifactConfig = await buildElectronArtifactConfig(options);
|
|
576
676
|
const suffix = hashUrlSafe(JSON.stringify(artifactConfig), 5);
|
|
577
677
|
const folderName = `${artifactName}-v${version}-${platform}-${arch}-${suffix}`;
|
|
578
678
|
const extractDir = path.join(await cacheDirectoryOverrideAllowed.value, `${artifactName}-v${version}`, folderName);
|