app-builder-lib 26.1.0 → 26.3.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.
Files changed (86) hide show
  1. package/out/asar/asarUtil.js +78 -10
  2. package/out/asar/asarUtil.js.map +1 -1
  3. package/out/codeSign/macCodeSign.js +2 -1
  4. package/out/codeSign/macCodeSign.js.map +1 -1
  5. package/out/codeSign/windowsCodeSign.js +1 -1
  6. package/out/codeSign/windowsCodeSign.js.map +1 -1
  7. package/out/electron/search-module.js +1 -1
  8. package/out/electron/search-module.js.map +1 -1
  9. package/out/fileMatcher.js +1 -1
  10. package/out/fileMatcher.js.map +1 -1
  11. package/out/linuxPackager.js +1 -1
  12. package/out/linuxPackager.js.map +1 -1
  13. package/out/macPackager.js +31 -6
  14. package/out/macPackager.js.map +1 -1
  15. package/out/node-module-collector/bunNodeModulesCollector.d.ts +11 -0
  16. package/out/node-module-collector/bunNodeModulesCollector.js +22 -0
  17. package/out/node-module-collector/bunNodeModulesCollector.js.map +1 -0
  18. package/out/node-module-collector/index.d.ts +18 -6
  19. package/out/node-module-collector/index.js +102 -28
  20. package/out/node-module-collector/index.js.map +1 -1
  21. package/out/node-module-collector/moduleCache.d.ts +21 -0
  22. package/out/node-module-collector/moduleCache.js +16 -0
  23. package/out/node-module-collector/moduleCache.js.map +1 -0
  24. package/out/node-module-collector/nodeModulesCollector.d.ts +48 -13
  25. package/out/node-module-collector/nodeModulesCollector.js +184 -59
  26. package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
  27. package/out/node-module-collector/npmNodeModulesCollector.d.ts +10 -3
  28. package/out/node-module-collector/npmNodeModulesCollector.js +95 -13
  29. package/out/node-module-collector/npmNodeModulesCollector.js.map +1 -1
  30. package/out/node-module-collector/packageManager.d.ts +2 -2
  31. package/out/node-module-collector/packageManager.js +44 -22
  32. package/out/node-module-collector/packageManager.js.map +1 -1
  33. package/out/node-module-collector/pnpmNodeModulesCollector.d.ts +4 -4
  34. package/out/node-module-collector/pnpmNodeModulesCollector.js +43 -23
  35. package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
  36. package/out/node-module-collector/types.d.ts +25 -1
  37. package/out/node-module-collector/types.js.map +1 -1
  38. package/out/node-module-collector/yarnBerryNodeModulesCollector.d.ts +15 -0
  39. package/out/node-module-collector/yarnBerryNodeModulesCollector.js +83 -0
  40. package/out/node-module-collector/yarnBerryNodeModulesCollector.js.map +1 -0
  41. package/out/node-module-collector/yarnNodeModulesCollector.d.ts +12 -2
  42. package/out/node-module-collector/yarnNodeModulesCollector.js +234 -5
  43. package/out/node-module-collector/yarnNodeModulesCollector.js.map +1 -1
  44. package/out/options/PlatformSpecificBuildOptions.d.ts +2 -1
  45. package/out/options/PlatformSpecificBuildOptions.js.map +1 -1
  46. package/out/options/macOptions.d.ts +2 -0
  47. package/out/options/macOptions.js.map +1 -1
  48. package/out/options/winOptions.d.ts +3 -2
  49. package/out/options/winOptions.js.map +1 -1
  50. package/out/packager.d.ts +6 -1
  51. package/out/packager.js +27 -2
  52. package/out/packager.js.map +1 -1
  53. package/out/platformPackager.d.ts +5 -0
  54. package/out/platformPackager.js +50 -0
  55. package/out/platformPackager.js.map +1 -1
  56. package/out/publish/PublishManager.js +2 -2
  57. package/out/publish/PublishManager.js.map +1 -1
  58. package/out/targets/AppxTarget.js +1 -1
  59. package/out/targets/AppxTarget.js.map +1 -1
  60. package/out/targets/LinuxTargetHelper.js +2 -1
  61. package/out/targets/LinuxTargetHelper.js.map +1 -1
  62. package/out/targets/MsiTarget.js +1 -1
  63. package/out/targets/MsiTarget.js.map +1 -1
  64. package/out/targets/nsis/NsisTarget.js +2 -2
  65. package/out/targets/nsis/NsisTarget.js.map +1 -1
  66. package/out/targets/nsis/nsisUtil.js +7 -1
  67. package/out/targets/nsis/nsisUtil.js.map +1 -1
  68. package/out/targets/snap.js +13 -2
  69. package/out/targets/snap.js.map +1 -1
  70. package/out/util/appFileCopier.js +17 -10
  71. package/out/util/appFileCopier.js.map +1 -1
  72. package/out/util/macosIconComposer.d.ts +10 -0
  73. package/out/util/macosIconComposer.js +95 -0
  74. package/out/util/macosIconComposer.js.map +1 -0
  75. package/out/util/yarn.d.ts +3 -2
  76. package/out/util/yarn.js +16 -12
  77. package/out/util/yarn.js.map +1 -1
  78. package/out/version.d.ts +1 -1
  79. package/out/version.js +1 -1
  80. package/out/version.js.map +1 -1
  81. package/out/winPackager.d.ts +1 -1
  82. package/out/winPackager.js +26 -9
  83. package/out/winPackager.js.map +1 -1
  84. package/package.json +9 -9
  85. package/scheme.json +9 -9
  86. package/templates/nsis/uninstaller.nsh +7 -0
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.YarnBerryNodeModulesCollector = void 0;
4
+ const builder_util_1 = require("builder-util");
5
+ const lazy_val_1 = require("lazy-val");
6
+ const npmNodeModulesCollector_1 = require("./npmNodeModulesCollector");
7
+ const packageManager_1 = require("./packageManager");
8
+ // Only Yarn v1 uses CLI. We should use pnp.cjs for PnP, but we can't access the files due to virtual file paths within zipped modules.
9
+ // We fallback to npm node module collection (since Yarn Berry could have npm-like structure OR pnpm-like structure, depending on `nmHoistingLimits` configuration).
10
+ // In the latter case, we still can't assume `pnpm` is installed, so we still try to use npm collection as a best-effort attempt.
11
+ // If those fail, such as if using corepack, we attempt to manually build the tree.
12
+ class YarnBerryNodeModulesCollector extends npmNodeModulesCollector_1.NpmNodeModulesCollector {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.installOptions = {
16
+ manager: packageManager_1.PM.YARN_BERRY,
17
+ lockfile: "yarn.lock",
18
+ };
19
+ this.yarnSetupInfo = new lazy_val_1.Lazy(async () => this.detectYarnSetup(this.rootDir));
20
+ this.isHoisted = new lazy_val_1.Lazy(async () => this.yarnSetupInfo.value.then(info => info.isHoisted));
21
+ }
22
+ async getDependenciesTree(_pm) {
23
+ const isPnp = await this.yarnSetupInfo.value.then(info => !!info.isPnP);
24
+ if (isPnp) {
25
+ builder_util_1.log.warn(null, "Yarn PnP extraction not supported directly due to virtual file paths (<package_name>.zip/<file_path>), falling back to NPM node module collector");
26
+ }
27
+ return super.getDependenciesTree(packageManager_1.PM.NPM);
28
+ }
29
+ isProdDependency(packageName, tree) {
30
+ var _a, _b;
31
+ return ((_a = tree.dependencies) === null || _a === void 0 ? void 0 : _a[packageName]) != null || ((_b = tree.optionalDependencies) === null || _b === void 0 ? void 0 : _b[packageName]) != null;
32
+ }
33
+ async detectYarnSetup(rootDir) {
34
+ var _a, _b, _c, _d, _e, _f;
35
+ let yarnVersion = null;
36
+ let nodeLinker = null;
37
+ let nmHoistingLimits = null;
38
+ const output = await this.asyncExec("yarn", ["config", "list", "--json"], rootDir);
39
+ if (output.stdout == null) {
40
+ builder_util_1.log.debug({ stderr: output.stderr }, "there was no config output, falling back to hoisted mode");
41
+ return {
42
+ yarnVersion,
43
+ nodeLinker,
44
+ nmHoistingLimits,
45
+ isPnP: false,
46
+ isHoisted: true,
47
+ };
48
+ }
49
+ // Yarn prints multiple JSON lines; find the one with type: 'inspect'
50
+ const parsed = output.stdout
51
+ .split("\n")
52
+ .map(l => l.trim())
53
+ .filter(Boolean)
54
+ .map(l => {
55
+ try {
56
+ return JSON.parse(l);
57
+ }
58
+ catch {
59
+ return undefined;
60
+ }
61
+ })
62
+ .filter(Boolean)
63
+ .find(l => l.type === "inspect");
64
+ if (parsed) {
65
+ const data = ((_a = parsed.data) === null || _a === void 0 ? void 0 : _a["rc"]) || parsed.data || {};
66
+ yarnVersion = (_d = (_c = (_b = parsed.data) === null || _b === void 0 ? void 0 : _b["manifest"]) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : null;
67
+ nodeLinker = (_e = data["nodeLinker"]) !== null && _e !== void 0 ? _e : null;
68
+ nmHoistingLimits = (_f = data["nmHoistingLimits"]) !== null && _f !== void 0 ? _f : null;
69
+ }
70
+ // Determine if using PnP
71
+ const isPnP = nodeLinker === "pnp";
72
+ const isHoisted = isPnP ? false : nmHoistingLimits === "dependencies" || nmHoistingLimits === "workspaces";
73
+ return {
74
+ yarnVersion,
75
+ nodeLinker,
76
+ nmHoistingLimits,
77
+ isPnP,
78
+ isHoisted,
79
+ };
80
+ }
81
+ }
82
+ exports.YarnBerryNodeModulesCollector = YarnBerryNodeModulesCollector;
83
+ //# sourceMappingURL=yarnBerryNodeModulesCollector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yarnBerryNodeModulesCollector.js","sourceRoot":"","sources":["../../src/node-module-collector/yarnBerryNodeModulesCollector.ts"],"names":[],"mappings":";;;AAAA,+CAAkC;AAClC,uCAA+B;AAC/B,uEAAmE;AACnE,qDAAqC;AAWrC,uIAAuI;AACvI,oKAAoK;AACpK,iIAAiI;AACjI,mFAAmF;AACnF,MAAa,6BAA8B,SAAQ,iDAAuB;IAA1E;;QACkB,mBAAc,GAAG;YAC/B,OAAO,EAAE,mBAAE,CAAC,UAAU;YACtB,QAAQ,EAAE,WAAW;SACtB,CAAA;QAEO,kBAAa,GAAwB,IAAI,eAAI,CAAgB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;QAE1G,cAAS,GAAkB,IAAI,eAAI,CAAU,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAA;IAoE3H,CAAC;IAlEW,KAAK,CAAC,mBAAmB,CAAC,GAAO;QACzC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACvE,IAAI,KAAK,EAAE,CAAC;YACV,kBAAG,CAAC,IAAI,CAAC,IAAI,EAAE,kJAAkJ,CAAC,CAAA;QACpK,CAA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D,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAA;QAElC,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,IAAI,GAAG,CAAA,MAAA,MAAM,CAAC,IAAI,0CAAG,IAAI,CAAC,KAAI,MAAM,CAAC,IAAI,IAAI,EAAE,CAAA;YAErD,WAAW,GAAG,MAAA,MAAA,MAAA,MAAM,CAAC,IAAI,0CAAG,UAAU,CAAC,0CAAE,OAAO,mCAAI,IAAI,CAAA;YACxD,UAAU,GAAG,MAAA,IAAI,CAAC,YAAY,CAAC,mCAAI,IAAI,CAAA;YACvC,gBAAgB,GAAG,MAAA,IAAI,CAAC,kBAAkB,CAAC,mCAAI,IAAI,CAAA;QACrD,CAAC;QAED,yBAAyB;QACzB,MAAM,KAAK,GAAG,UAAU,KAAK,KAAK,CAAA;QAClC,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAgB,KAAK,cAAc,IAAI,gBAAgB,KAAK,YAAY,CAAA;QAE1G,OAAO;YACL,WAAW;YACX,UAAU;YACV,gBAAgB;YAChB,KAAK;YACL,SAAS;SACV,CAAA;IACH,CAAC;CACF;AA5ED,sEA4EC","sourcesContent":["import { log } from \"builder-util\"\nimport { Lazy } from \"lazy-val\"\nimport { NpmNodeModulesCollector } from \"./npmNodeModulesCollector\"\nimport { PM } from \"./packageManager\"\nimport { NpmDependency } from \"./types\"\n\ntype YarnSetupInfo = {\n yarnVersion: string | null\n nodeLinker: \"pnp\" | \"node-modules\" | null\n nmHoistingLimits: \"workspaces\" | \"dependencies\" | \"none\" | null\n isPnP: boolean\n isHoisted: boolean\n}\n\n// Only Yarn v1 uses CLI. We should use pnp.cjs for PnP, but we can't access the files due to virtual file paths within zipped modules.\n// We fallback to npm node module collection (since Yarn Berry could have npm-like structure OR pnpm-like structure, depending on `nmHoistingLimits` configuration).\n// In the latter case, we still can't assume `pnpm` is installed, so we still try to use npm collection as a best-effort attempt.\n// If those fail, such as if using corepack, we attempt to manually build the tree.\nexport class YarnBerryNodeModulesCollector extends NpmNodeModulesCollector {\n public readonly installOptions = {\n manager: PM.YARN_BERRY,\n lockfile: \"yarn.lock\",\n }\n\n private yarnSetupInfo: Lazy<YarnSetupInfo> = new Lazy<YarnSetupInfo>(async () => this.detectYarnSetup(this.rootDir))\n\n protected isHoisted: Lazy<boolean> = new Lazy<boolean>(async () => this.yarnSetupInfo.value.then(info => info.isHoisted))\n\n protected async getDependenciesTree(_pm: PM): Promise<NpmDependency> {\n const isPnp = await this.yarnSetupInfo.value.then(info => !!info.isPnP)\n if (isPnp) {\n log.warn(null, \"Yarn PnP extraction not supported directly due to virtual file paths (<package_name>.zip/<file_path>), falling back to NPM node module collector\")\n }\n\n return super.getDependenciesTree(PM.NPM)\n }\n\n protected isProdDependency(packageName: string, tree: NpmDependency): boolean {\n return tree.dependencies?.[packageName] != null || tree.optionalDependencies?.[packageName] != null\n }\n\n private async detectYarnSetup(rootDir: string): Promise<YarnSetupInfo> {\n let yarnVersion: YarnSetupInfo[\"yarnVersion\"] = null\n let nodeLinker: YarnSetupInfo[\"nodeLinker\"] = null\n let nmHoistingLimits: YarnSetupInfo[\"nmHoistingLimits\"] = null\n\n const output = await this.asyncExec(\"yarn\", [\"config\", \"list\", \"--json\"], rootDir)\n\n if (output.stdout == null) {\n log.debug({ stderr: output.stderr }, \"there was no config output, falling back to hoisted mode\")\n return {\n yarnVersion,\n nodeLinker,\n nmHoistingLimits,\n isPnP: false,\n isHoisted: true,\n }\n }\n\n // Yarn prints multiple JSON lines; find the one with type: 'inspect'\n const parsed = output.stdout\n .split(\"\\n\")\n .map(l => l.trim())\n .filter(Boolean)\n .map(l => {\n try {\n return JSON.parse(l)\n } catch {\n return undefined\n }\n })\n .filter(Boolean)\n .find(l => l.type === \"inspect\")\n\n if (parsed) {\n const data = parsed.data?.[\"rc\"] || parsed.data || {}\n\n yarnVersion = parsed.data?.[\"manifest\"]?.version ?? null\n nodeLinker = data[\"nodeLinker\"] ?? null\n nmHoistingLimits = data[\"nmHoistingLimits\"] ?? null\n }\n\n // Determine if using PnP\n const isPnP = nodeLinker === \"pnp\"\n const isHoisted = isPnP ? false : nmHoistingLimits === \"dependencies\" || nmHoistingLimits === \"workspaces\"\n\n return {\n yarnVersion,\n nodeLinker,\n nmHoistingLimits,\n isPnP,\n isHoisted,\n }\n }\n}\n"]}
@@ -1,8 +1,18 @@
1
- import { NpmNodeModulesCollector } from "./npmNodeModulesCollector";
1
+ import { Lazy } from "lazy-val";
2
+ import { NodeModulesCollector } from "./nodeModulesCollector";
2
3
  import { PM } from "./packageManager";
3
- export declare class YarnNodeModulesCollector extends NpmNodeModulesCollector {
4
+ import { PackageJson, YarnDependency } from "./types";
5
+ export declare class YarnNodeModulesCollector extends NodeModulesCollector<YarnDependency, YarnDependency> {
4
6
  readonly installOptions: {
5
7
  manager: PM;
6
8
  lockfile: string;
7
9
  };
10
+ protected isHoisted: Lazy<boolean>;
11
+ protected getArgs(): string[];
12
+ protected getTreeFromWorkspaces(tree: YarnDependency): Promise<YarnDependency>;
13
+ protected extractProductionDependencyGraph(tree: YarnDependency, dependencyId: string): Promise<void>;
14
+ protected getDependencyType(pkgName: string, parentPkgJson: PackageJson): "prod" | "dev" | "optional";
15
+ protected parseDependenciesTree(jsonBlob: string): Promise<YarnDependency>;
16
+ private normalizeTree;
17
+ protected collectAllDependencies(tree: YarnDependency, packageToExclude: string): Promise<void>;
8
18
  }
@@ -1,14 +1,243 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.YarnNodeModulesCollector = void 0;
4
- const npmNodeModulesCollector_1 = require("./npmNodeModulesCollector");
4
+ const builder_util_1 = require("builder-util");
5
+ const lazy_val_1 = require("lazy-val");
6
+ const path = require("path");
7
+ const nodeModulesCollector_1 = require("./nodeModulesCollector");
5
8
  const packageManager_1 = require("./packageManager");
6
- class YarnNodeModulesCollector extends npmNodeModulesCollector_1.NpmNodeModulesCollector {
9
+ class YarnNodeModulesCollector extends nodeModulesCollector_1.NodeModulesCollector {
7
10
  constructor() {
8
11
  super(...arguments);
9
- // note: do not override instance-var `pmCommand`. We explicitly use npm for the json payload
10
- // yarn list cannot get the detailed dependencies path info, But we can use npm to get all dependencies path info
11
- this.installOptions = { manager: packageManager_1.PM.NPM, lockfile: "yarn.lock" };
12
+ this.installOptions = {
13
+ manager: packageManager_1.PM.YARN,
14
+ lockfile: "yarn.lock",
15
+ };
16
+ this.isHoisted = new lazy_val_1.Lazy(async () => {
17
+ return Promise.resolve(true); // Yarn Classic always hoists
18
+ });
19
+ }
20
+ getArgs() {
21
+ return ["list", "--production", "--json", "--depth=Infinity", "--no-progress"];
22
+ }
23
+ async getTreeFromWorkspaces(tree) {
24
+ var _a;
25
+ if (!tree.workspaces || !tree.dependencies) {
26
+ return tree;
27
+ }
28
+ const appName = this.packageVersionString(tree);
29
+ if ((_a = tree.dependencies) === null || _a === void 0 ? void 0 : _a[appName]) {
30
+ const { name, path } = tree.dependencies[appName];
31
+ builder_util_1.log.debug({ name, path }, "pruning root app/self package from workspace tree");
32
+ delete tree.dependencies[appName];
33
+ }
34
+ return Promise.resolve(tree);
35
+ }
36
+ async extractProductionDependencyGraph(tree, dependencyId) {
37
+ if (this.productionGraph[dependencyId]) {
38
+ return;
39
+ }
40
+ const productionDeps = Object.entries(tree.dependencies || {}).map(async ([, dependency]) => {
41
+ const dep = {
42
+ ...dependency,
43
+ path: await this.resolvePath(dependency.path),
44
+ };
45
+ const childDependencyId = this.packageVersionString(dep);
46
+ await this.extractProductionDependencyGraph(dep, childDependencyId);
47
+ return childDependencyId;
48
+ });
49
+ this.productionGraph[dependencyId] = { dependencies: await Promise.all(productionDeps) };
50
+ }
51
+ getDependencyType(pkgName, parentPkgJson) {
52
+ var _a, _b, _c;
53
+ if ((_a = parentPkgJson.optionalDependencies) === null || _a === void 0 ? void 0 : _a[pkgName]) {
54
+ return "optional";
55
+ }
56
+ if ((_b = parentPkgJson.devDependencies) === null || _b === void 0 ? void 0 : _b[pkgName]) {
57
+ return "dev";
58
+ }
59
+ if ((_c = parentPkgJson.dependencies) === null || _c === void 0 ? void 0 : _c[pkgName]) {
60
+ return "prod";
61
+ }
62
+ return "prod";
63
+ }
64
+ async parseDependenciesTree(jsonBlob) {
65
+ const lines = jsonBlob
66
+ .split("\n")
67
+ .map(l => l.trim())
68
+ .filter(Boolean)
69
+ .map(l => {
70
+ try {
71
+ return JSON.parse(l);
72
+ }
73
+ catch {
74
+ return undefined;
75
+ }
76
+ })
77
+ .filter(Boolean);
78
+ const parsedTree = lines
79
+ .filter(l => l.type === "tree")
80
+ .map(l => l.data.trees)
81
+ .shift();
82
+ if (!parsedTree) {
83
+ throw new Error('Failed to extract Yarn tree: no "type":"tree" line found in console output');
84
+ }
85
+ const normalizedTree = await this.normalizeTree(parsedTree, new Set(), undefined);
86
+ const dependencies = {};
87
+ for (const [name, dep] of Object.entries(normalizedTree)) {
88
+ dependencies[name] = dep;
89
+ }
90
+ const rootPkgJson = await this.appPkgJson.value;
91
+ return Promise.resolve({
92
+ name: (rootPkgJson === null || rootPkgJson === void 0 ? void 0 : rootPkgJson.name) || ".",
93
+ version: (rootPkgJson === null || rootPkgJson === void 0 ? void 0 : rootPkgJson.version) || "unknown",
94
+ path: this.rootDir,
95
+ dependencies,
96
+ workspaces: rootPkgJson === null || rootPkgJson === void 0 ? void 0 : rootPkgJson.workspaces,
97
+ });
98
+ }
99
+ async normalizeTree(tree, seen = new Set(), appName) {
100
+ const normalized = {};
101
+ for (const node of tree) {
102
+ const match = node.name.match(/^(.*)@([^@]+)$/);
103
+ if (!match) {
104
+ builder_util_1.log.debug({ name: node.name }, "invalid node name format");
105
+ continue;
106
+ }
107
+ const [, pkgName, version] = match;
108
+ const id = `${pkgName}@${version}`;
109
+ const isShadow = node.shadow && node.color === "dim";
110
+ if (isShadow) {
111
+ builder_util_1.log.debug({ pkgName, version }, "skipping shadow node");
112
+ continue;
113
+ }
114
+ if (seen.has(id)) {
115
+ continue;
116
+ }
117
+ seen.add(id);
118
+ // Build the expected path - yarn classic hoists to root node_modules
119
+ const pkgPath = path.join(this.rootDir, "node_modules", pkgName);
120
+ const normalizedDep = {
121
+ name: pkgName,
122
+ version,
123
+ path: pkgPath, // Will be resolved later in collectAllDependencies
124
+ dependencies: {},
125
+ optionalDependencies: {},
126
+ };
127
+ builder_util_1.log.debug({ name: pkgName, version }, "+ normalize");
128
+ if (node.children && node.children.length > 0) {
129
+ for (const child of node.children) {
130
+ const childMatch = child.name.match(/^(.*)@([^@]+)$/);
131
+ if (!childMatch) {
132
+ continue;
133
+ }
134
+ const [, childName, childVersion] = childMatch;
135
+ if (child.shadow && child.color === "dim") {
136
+ continue;
137
+ }
138
+ builder_util_1.log.debug({ parent: pkgName, childName, childVersion }, " + normalize child");
139
+ const childDeps = await this.normalizeTree([child], seen, appName);
140
+ for (const [childDepName, childDep] of Object.entries(childDeps)) {
141
+ normalizedDep.dependencies[childDepName] = childDep;
142
+ }
143
+ }
144
+ }
145
+ normalized[pkgName] = normalizedDep;
146
+ }
147
+ return normalized;
148
+ }
149
+ async collectAllDependencies(tree, packageToExclude) {
150
+ const rootPkgJson = await this.appPkgJson.value;
151
+ const failedPackages = new Set();
152
+ builder_util_1.log.debug({ packageToExclude, hasWorkspaces: !!tree.workspaces }, "collectAllDependencies starting");
153
+ const collect = async (deps = {}, isOptionalDependency, parentIsOptional = false) => {
154
+ var _a, _b, _c, _d;
155
+ for (const [, value] of Object.entries(deps)) {
156
+ // Skip the app package if provided
157
+ if (packageToExclude && value.name === packageToExclude) {
158
+ builder_util_1.log.debug({ name: value.name }, "skipping app package in collectAllDependencies");
159
+ continue;
160
+ }
161
+ const isRootOptional = !!((_a = rootPkgJson.optionalDependencies) === null || _a === void 0 ? void 0 : _a[value.name]);
162
+ const isDirectRootDep = ((_b = rootPkgJson.dependencies) === null || _b === void 0 ? void 0 : _b[value.name]) || ((_c = rootPkgJson.optionalDependencies) === null || _c === void 0 ? void 0 : _c[value.name]) || ((_d = rootPkgJson.devDependencies) === null || _d === void 0 ? void 0 : _d[value.name]);
163
+ const treatAsOptional = isOptionalDependency || parentIsOptional || isRootOptional;
164
+ let p;
165
+ try {
166
+ p = await this.resolvePath(value.path);
167
+ }
168
+ catch (e) {
169
+ if (treatAsOptional) {
170
+ builder_util_1.log.debug({ pkg: this.cacheKey(value), name: value.name }, "failed to resolve optional dependency, skipping");
171
+ failedPackages.add(value.name);
172
+ continue;
173
+ }
174
+ if (!isDirectRootDep) {
175
+ builder_util_1.log.debug({ pkg: this.cacheKey(value), name: value.name }, "failed to resolve transitive dependency, treating as optional");
176
+ failedPackages.add(value.name);
177
+ continue;
178
+ }
179
+ builder_util_1.log.error({ pkg: this.cacheKey(value) }, "failed to resolve module directory");
180
+ throw e;
181
+ }
182
+ if (!p) {
183
+ builder_util_1.log.debug({ pkg: this.cacheKey(value), name: value.name }, "optional dependency not found, skipping");
184
+ failedPackages.add(value.name);
185
+ continue;
186
+ }
187
+ let resolvedVersion = value.version;
188
+ const versionMatch = p.match(/[/\\]node_modules[/\\][^@]+@([^/\\]+)[/\\]/);
189
+ if (versionMatch) {
190
+ resolvedVersion = versionMatch[1];
191
+ if (resolvedVersion !== value.version) {
192
+ builder_util_1.log.debug({ name: value.name, declared: value.version, resolved: resolvedVersion }, "resolved actual version from path");
193
+ }
194
+ }
195
+ const m = {
196
+ ...value,
197
+ version: resolvedVersion,
198
+ path: p,
199
+ };
200
+ const moduleKey = this.packageVersionString(m);
201
+ if (this.allDependencies.has(moduleKey)) {
202
+ continue;
203
+ }
204
+ this.allDependencies.set(moduleKey, m);
205
+ const childIsOptional = treatAsOptional;
206
+ await collect(m.dependencies, false, childIsOptional);
207
+ await collect(m.optionalDependencies, true, true);
208
+ }
209
+ };
210
+ await collect(tree.dependencies, false, false);
211
+ await collect(tree.optionalDependencies, true, true);
212
+ // Final cleanup: remove the app package from allDependencies
213
+ if (packageToExclude) {
214
+ for (const [key, dep] of this.allDependencies.entries()) {
215
+ if (dep.name === packageToExclude) {
216
+ builder_util_1.log.debug({ key, name: dep.name }, "removing app package from allDependencies");
217
+ this.allDependencies.delete(key);
218
+ }
219
+ }
220
+ }
221
+ if (failedPackages.size > 0) {
222
+ const cleanDependencies = (deps = {}) => {
223
+ for (const [key, dep] of Object.entries(deps)) {
224
+ if (failedPackages.has(dep.name)) {
225
+ builder_util_1.log.debug({ name: dep.name }, "removing failed package from tree");
226
+ delete deps[key];
227
+ }
228
+ else {
229
+ if (dep.dependencies) {
230
+ cleanDependencies(dep.dependencies);
231
+ }
232
+ if (dep.optionalDependencies) {
233
+ cleanDependencies(dep.optionalDependencies);
234
+ }
235
+ }
236
+ }
237
+ };
238
+ cleanDependencies(tree.dependencies);
239
+ cleanDependencies(tree.optionalDependencies);
240
+ }
12
241
  }
13
242
  }
14
243
  exports.YarnNodeModulesCollector = YarnNodeModulesCollector;
@@ -1 +1 @@
1
- {"version":3,"file":"yarnNodeModulesCollector.js","sourceRoot":"","sources":["../../src/node-module-collector/yarnNodeModulesCollector.ts"],"names":[],"mappings":";;;AAAA,uEAAmE;AACnE,qDAAqC;AAErC,MAAa,wBAAyB,SAAQ,iDAAuB;IAArE;;QACE,6FAA6F;QAC7F,iHAAiH;QACjG,mBAAc,GAAG,EAAE,OAAO,EAAE,mBAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAA;IAC7E,CAAC;CAAA;AAJD,4DAIC","sourcesContent":["import { NpmNodeModulesCollector } from \"./npmNodeModulesCollector\"\nimport { PM } from \"./packageManager\"\n\nexport class YarnNodeModulesCollector extends NpmNodeModulesCollector {\n // note: do not override instance-var `pmCommand`. We explicitly use npm for the json payload\n // yarn list cannot get the detailed dependencies path info, But we can use npm to get all dependencies path info\n public readonly installOptions = { manager: PM.NPM, lockfile: \"yarn.lock\" }\n}\n"]}
1
+ {"version":3,"file":"yarnNodeModulesC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,CAAA;gBAClC,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,cAAc,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YAC5B,MAAM,iBAAiB,GAAG,CAAC,OAAuC,EAAE,EAAE,EAAE;gBACtE,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC9C,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;wBACjC,kBAAG,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,mCAAmC,CAAC,CAAA;wBAClE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;oBAClB,CAAC;yBAAM,CAAC;wBACN,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;4BACrB,iBAAiB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;wBACrC,CAAC;wBACD,IAAI,GAAG,CAAC,oBAAoB,EAAE,CAAC;4BAC7B,iBAAiB,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;wBAC7C,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC,CAAA;YAED,iBAAiB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;YACpC,iBAAiB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;QAC9C,CAAC;IACH,CAAC;CACF;AAxRD,4DAwRC","sourcesContent":["import { log } from \"builder-util\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { NodeModulesCollector } from \"./nodeModulesCollector\"\nimport { PM } from \"./packageManager\"\nimport { PackageJson, YarnDependency } from \"./types\"\n\ntype YarnListJsonLine =\n | {\n type: \"tree\"\n data: {\n type: \"list\"\n trees: YarnListTree[]\n }\n }\n | {\n type: \"info\" | \"warning\" | \"error\"\n data: string\n }\n\ninterface YarnListTree {\n name: string // e.g. \"lodash@4.17.21\"\n children: YarnListTree[]\n shadow?: boolean\n color?: string\n hint?: any\n depth?: number\n}\n\nexport class YarnNodeModulesCollector extends NodeModulesCollector<YarnDependency, YarnDependency> {\n public readonly installOptions = {\n manager: PM.YARN,\n lockfile: \"yarn.lock\",\n }\n\n protected isHoisted: Lazy<boolean> = new Lazy<boolean>(async () => {\n return Promise.resolve(true) // Yarn Classic always hoists\n })\n\n protected getArgs(): string[] {\n return [\"list\", \"--production\", \"--json\", \"--depth=Infinity\", \"--no-progress\"]\n }\n\n protected async getTreeFromWorkspaces(tree: YarnDependency): Promise<YarnDependency> {\n if (!tree.workspaces || !tree.dependencies) {\n return tree\n }\n\n const appName = this.packageVersionString(tree)\n\n if (tree.dependencies?.[appName]) {\n const { name, path } = tree.dependencies[appName]\n log.debug({ name, path }, \"pruning root app/self package from workspace tree\")\n delete tree.dependencies[appName]\n }\n return Promise.resolve(tree)\n }\n\n protected async extractProductionDependencyGraph(tree: YarnDependency, dependencyId: string): Promise<void> {\n if (this.productionGraph[dependencyId]) {\n return\n }\n\n const productionDeps = Object.entries(tree.dependencies || {}).map(async ([, dependency]) => {\n const dep = {\n ...dependency,\n path: await this.resolvePath(dependency.path),\n }\n\n const childDependencyId = this.packageVersionString(dep)\n await this.extractProductionDependencyGraph(dep, childDependencyId)\n return childDependencyId\n })\n\n this.productionGraph[dependencyId] = { dependencies: await Promise.all(productionDeps) }\n }\n\n protected getDependencyType(pkgName: string, parentPkgJson: PackageJson): \"prod\" | \"dev\" | \"optional\" {\n if (parentPkgJson.optionalDependencies?.[pkgName]) {\n return \"optional\"\n }\n\n if (parentPkgJson.devDependencies?.[pkgName]) {\n return \"dev\"\n }\n\n if (parentPkgJson.dependencies?.[pkgName]) {\n return \"prod\"\n }\n\n return \"prod\"\n }\n\n protected async parseDependenciesTree(jsonBlob: string): Promise<YarnDependency> {\n const lines = jsonBlob\n .split(\"\\n\")\n .map(l => l.trim())\n .filter(Boolean)\n .map(l => {\n try {\n return JSON.parse(l)\n } catch {\n return undefined\n }\n })\n .filter(Boolean) as YarnListJsonLine[]\n\n const parsedTree: YarnListTree[] | undefined = lines\n .filter(l => l.type === \"tree\")\n .map(l => (l.data as any).trees)\n .shift()\n\n if (!parsedTree) {\n throw new Error('Failed to extract Yarn tree: no \"type\":\"tree\" line found in console output')\n }\n\n const normalizedTree = await this.normalizeTree(parsedTree, new Set<string>(), undefined)\n\n const dependencies: Record<string, YarnDependency> = {}\n for (const [name, dep] of Object.entries(normalizedTree)) {\n dependencies[name] = dep\n }\n\n const rootPkgJson = await this.appPkgJson.value\n return Promise.resolve({\n name: rootPkgJson?.name || \".\",\n version: rootPkgJson?.version || \"unknown\",\n path: this.rootDir,\n dependencies,\n workspaces: rootPkgJson?.workspaces,\n })\n }\n\n private async normalizeTree(tree: YarnListTree[], seen = new Set<string>(), appName?: string): Promise<Record<string, YarnDependency>> {\n const normalized: Record<string, YarnDependency> = {}\n\n for (const node of tree) {\n const match = node.name.match(/^(.*)@([^@]+)$/)\n if (!match) {\n log.debug({ name: node.name }, \"invalid node name format\")\n continue\n }\n\n const [, pkgName, version] = match\n const id = `${pkgName}@${version}`\n\n const isShadow = node.shadow && node.color === \"dim\"\n if (isShadow) {\n log.debug({ pkgName, version }, \"skipping shadow node\")\n continue\n }\n\n if (seen.has(id)) {\n continue\n }\n\n seen.add(id)\n\n // Build the expected path - yarn classic hoists to root node_modules\n const pkgPath = path.join(this.rootDir, \"node_modules\", pkgName)\n\n const normalizedDep: YarnDependency = {\n name: pkgName,\n version,\n path: pkgPath, // Will be resolved later in collectAllDependencies\n dependencies: {},\n optionalDependencies: {},\n }\n\n log.debug({ name: pkgName, version }, \"+ normalize\")\n\n if (node.children && node.children.length > 0) {\n for (const child of node.children) {\n const childMatch = child.name.match(/^(.*)@([^@]+)$/)\n if (!childMatch) {\n continue\n }\n\n const [, childName, childVersion] = childMatch\n if (child.shadow && child.color === \"dim\") {\n continue\n }\n\n log.debug({ parent: pkgName, childName, childVersion }, \" + normalize child\")\n const childDeps = await this.normalizeTree([child], seen, appName)\n\n for (const [childDepName, childDep] of Object.entries(childDeps)) {\n normalizedDep.dependencies![childDepName] = childDep\n }\n }\n }\n\n normalized[pkgName] = normalizedDep\n }\n\n return normalized\n }\n\n protected async collectAllDependencies(tree: YarnDependency, packageToExclude: string) {\n const rootPkgJson = await this.appPkgJson.value\n const failedPackages = new Set<string>()\n\n log.debug({ packageToExclude, hasWorkspaces: !!tree.workspaces }, \"collectAllDependencies starting\")\n\n const collect = async (\n deps: YarnDependency[\"dependencies\"] | YarnDependency[\"optionalDependencies\"] = {},\n isOptionalDependency: boolean,\n parentIsOptional: boolean = false\n ) => {\n for (const [, value] of Object.entries(deps)) {\n // Skip the app package if provided\n if (packageToExclude && value.name === packageToExclude) {\n log.debug({ name: value.name }, \"skipping app package in collectAllDependencies\")\n continue\n }\n\n const isRootOptional = !!rootPkgJson.optionalDependencies?.[value.name]\n const isDirectRootDep = rootPkgJson.dependencies?.[value.name] || rootPkgJson.optionalDependencies?.[value.name] || rootPkgJson.devDependencies?.[value.name]\n const treatAsOptional = isOptionalDependency || parentIsOptional || isRootOptional\n\n let p: string | null\n\n try {\n p = await this.resolvePath(value.path)\n } catch (e) {\n if (treatAsOptional) {\n log.debug({ pkg: this.cacheKey(value), name: value.name }, \"failed to resolve optional dependency, skipping\")\n failedPackages.add(value.name)\n continue\n }\n\n if (!isDirectRootDep) {\n log.debug({ pkg: this.cacheKey(value), name: value.name }, \"failed to resolve transitive dependency, treating as optional\")\n failedPackages.add(value.name)\n continue\n }\n\n log.error({ pkg: this.cacheKey(value) }, \"failed to resolve module directory\")\n throw e\n }\n\n if (!p) {\n log.debug({ pkg: this.cacheKey(value), name: value.name }, \"optional dependency not found, skipping\")\n failedPackages.add(value.name)\n continue\n }\n\n let resolvedVersion = value.version\n const versionMatch = p.match(/[/\\\\]node_modules[/\\\\][^@]+@([^/\\\\]+)[/\\\\]/)\n if (versionMatch) {\n resolvedVersion = versionMatch[1]\n if (resolvedVersion !== value.version) {\n log.debug({ name: value.name, declared: value.version, resolved: resolvedVersion }, \"resolved actual version from path\")\n }\n }\n\n const m: YarnDependency = {\n ...value,\n version: resolvedVersion,\n path: p,\n }\n\n const moduleKey = this.packageVersionString(m)\n if (this.allDependencies.has(moduleKey)) {\n continue\n }\n\n this.allDependencies.set(moduleKey, m)\n\n const childIsOptional = treatAsOptional\n await collect(m.dependencies, false, childIsOptional)\n await collect(m.optionalDependencies, true, true)\n }\n }\n\n await collect(tree.dependencies, false, false)\n await collect(tree.optionalDependencies, true, true)\n\n // Final cleanup: remove the app package from allDependencies\n if (packageToExclude) {\n for (const [key, dep] of this.allDependencies.entries()) {\n if (dep.name === packageToExclude) {\n log.debug({ key, name: dep.name }, \"removing app package from allDependencies\")\n this.allDependencies.delete(key)\n }\n }\n }\n\n if (failedPackages.size > 0) {\n const cleanDependencies = (deps: Record<string, YarnDependency> = {}) => {\n for (const [key, dep] of Object.entries(deps)) {\n if (failedPackages.has(dep.name)) {\n log.debug({ name: dep.name }, \"removing failed package from tree\")\n delete deps[key]\n } else {\n if (dep.dependencies) {\n cleanDependencies(dep.dependencies)\n }\n if (dep.optionalDependencies) {\n cleanDependencies(dep.optionalDependencies)\n }\n }\n }\n }\n\n cleanDependencies(tree.dependencies)\n cleanDependencies(tree.optionalDependencies)\n }\n }\n}\n"]}
@@ -97,7 +97,8 @@ export interface PlatformSpecificBuildOptions extends TargetSpecificOptions, Fil
97
97
  */
98
98
  readonly artifactName?: string | null;
99
99
  /**
100
- * The executable name. Defaults to `productName`.
100
+ * The executable name. Defaults to `productName`
101
+ * Note: Except for Linux, where this would constitute a breaking change in previous behavior and lead to both invalid executable names and Desktop files. Ref comments in: https://github.com/electron-userland/electron-builder/pull/9068
101
102
  */
102
103
  readonly executableName?: string | null;
103
104
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"PlatformSpecificBuildOptions.js","sourceRoot":"","sources":["../../src/options/PlatformSpecificBuildOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { CompressionLevel, Publish, TargetConfiguration, TargetSpecificOptions } from \"../core\"\nimport { FileAssociation } from \"./FileAssociation\"\n\nexport interface FileSet {\n /**\n * The source path relative to and defaults to:\n *\n * - the [app directory](configuration.md#directories) for `files`,\n * - the project directory for `extraResources` and `extraFiles`.\n * If you don't use two-package.json structure and don't set custom app directory, app directory equals to project directory.\n */\n from?: string\n /**\n * The destination path relative to and defaults to:\n *\n * - the asar archive root for `files`,\n * - the app's content directory for `extraFiles`,\n * - the app's resource directory for `extraResources`.\n */\n to?: string\n /**\n * The [glob patterns](./file-patterns.md). Defaults to \"**\\/*\"\n */\n filter?: Array<string> | string\n}\n\nexport interface AsarOptions {\n /**\n * Whether to automatically unpack executables files.\n * @default true\n */\n smartUnpack?: boolean\n\n ordering?: string | null\n}\n\nexport interface FilesBuildOptions {\n /**\n * A [glob patterns](./file-patterns.md) relative to the [app directory](configuration.md#directories), which specifies which files to include when copying files to create the package.\n\nDefaults to:\n```json\n[\n \"**\\/*\",\n \"!**\\/node_modules/*\\/{CHANGELOG.md,README.md,README,readme.md,readme}\",\n \"!**\\/node_modules/*\\/{test,__tests__,tests,powered-test,example,examples}\",\n \"!**\\/node_modules/*.d.ts\",\n \"!**\\/node_modules/.bin\",\n \"!**\\/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}\",\n \"!.editorconfig\",\n \"!**\\/._*\",\n \"!**\\/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}\",\n \"!**\\/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}\",\n \"!**\\/{appveyor.yml,.travis.yml,circle.yml}\",\n \"!**\\/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}\"\n]\n```\n\nDevelopment dependencies are never copied in any case. You don't need to ignore it explicitly. Hidden files are not ignored by default, but all files that should be ignored, are ignored by default.\n\nDefault pattern \\`**\\/*\\` **is not added to your custom** if some of your patterns is not ignore (i.e. not starts with `!`). `package.json` and \\`**\\/node_modules/**\\/*` (only production dependencies will be copied) is added to your custom in any case. All default ignores are added in any case — you don't need to repeat it if you configure own patterns.\n\nMay be specified in the platform options (e.g. in the [mac](mac.md)).\n\nYou may also specify custom source and destination directories by using `FileSet` objects instead of simple glob patterns.\n\n```json\n[\n {\n \"from\": \"path/to/source\",\n \"to\": \"path/to/destination\",\n \"filter\": [\"**\\/*\", \"!foo/*.js\"]\n }\n]\n```\n\nYou can use [file macros](./file-patterns.md#file-macros) in the `from` and `to` fields as well. `from` and `to` can be files and you can use this to [rename](https://github.com/electron-userland/electron-builder/issues/1119) a file while packaging.\n */\n files?: Array<FileSet | string> | FileSet | string | null\n\n /**\n * A [glob patterns](./file-patterns.md) relative to the project directory, when specified, copy the file or directory with matching names directly into the app's resources directory (`Contents/Resources` for MacOS, `resources` for Linux and Windows).\n *\n * File patterns (and support for `from` and `to` fields) the same as for [files](#files).\n *\n */\n extraResources?: Array<FileSet | string> | FileSet | string | null\n\n /**\n * The same as [extraResources](#extraresources) but copy into the app's content directory (`Contents` for MacOS, root directory for Linux and Windows).\n */\n extraFiles?: Array<FileSet | string> | FileSet | string | null\n}\n\nexport interface PlatformSpecificBuildOptions extends TargetSpecificOptions, FilesBuildOptions {\n /**\n * The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n * [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.\n * @default com.electron.${name}\n */\n readonly appId?: string | null\n\n /**\n * The [artifact file name template](./configuration.md#artifact-file-name-template). Defaults to `${productName}-${version}.${ext}` (some target can have other defaults, see corresponding options).\n */\n readonly artifactName?: string | null\n\n /**\n * The executable name. Defaults to `productName`.\n */\n readonly executableName?: string | null\n\n /**\n * The compression level. If you want to rapidly test build, `store` can reduce build time significantly. `maximum` doesn't lead to noticeable size difference, but increase build time.\n * @default normal\n */\n readonly compression?: CompressionLevel | null\n\n /**\n * Whether to exclude all default ignored files(https://www.electron.build/contents#files) and options. Defaults to `false`.\n *\n * @default false\n */\n disableDefaultIgnoredFiles?: boolean | null\n\n /**\n * Whether to package the application's source code into an archive, using [Electron's archive format](http://electron.atom.io/docs/tutorial/application-packaging/).\n *\n * Node modules, that must be unpacked, will be detected automatically, you don't need to explicitly set [asarUnpack](#asarUnpack) - please file an issue if this doesn't work.\n * @default true\n */\n readonly asar?: AsarOptions | boolean | null\n\n /**\n * A [glob patterns](./file-patterns.md) relative to the [app directory](#directories), which specifies which files to unpack when creating the [asar](http://electron.atom.io/docs/tutorial/application-packaging/) archive.\n */\n readonly asarUnpack?: Array<string> | string | null\n\n /* - @private */\n readonly icon?: string | null\n\n /**\n * The file associations.\n */\n readonly fileAssociations?: Array<FileAssociation> | FileAssociation\n /**\n * The URL protocol schemes.\n */\n readonly protocols?: Array<Protocol> | Protocol\n\n /**\n * The electron locales to keep. By default, all Electron locales used as-is.\n */\n readonly electronLanguages?: Array<string> | string\n\n /**\n * Whether to fail if app will be not code signed.\n */\n readonly forceCodeSigning?: boolean\n\n /**\n * The [electron-updater compatibility](./auto-update.md#compatibility) semver range.\n */\n readonly electronUpdaterCompatibility?: string | null\n\n /**\n * Publisher configuration. See [Auto Update](./publish.md) for more information.\n */\n publish?: Publish\n\n /**\n * Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`.\n * This does *not* apply to github publishing, which will [never auto-detect the update channel](https://github.com/electron-userland/electron-builder/issues/8589).\n * @default true\n */\n readonly detectUpdateChannel?: boolean\n\n /**\n * Please see [Building and Releasing using Channels](https://github.com/electron-userland/electron-builder/issues/1182#issuecomment-324947139).\n * @default false\n */\n readonly generateUpdatesFilesForAllChannels?: boolean\n\n /**\n * The release info. Intended for command line usage:\n *\n * ```\n * -c.releaseInfo.releaseNotes=\"new features\"\n * ```\n */\n readonly releaseInfo?: ReleaseInfo\n\n readonly target?: Array<string | TargetConfiguration> | string | TargetConfiguration | null\n\n /* - @private */\n cscLink?: string | null\n\n /* - @private */\n cscKeyPassword?: string | null\n\n readonly defaultArch?: string\n}\n\nexport interface ReleaseInfo {\n /**\n * The release name.\n */\n releaseName?: string | null\n\n /**\n * The release notes.\n */\n releaseNotes?: string | null\n\n /**\n * The path to release notes file. Defaults to `release-notes-${platform}.md` (where `platform` it is current platform — `mac`, `linux` or `windows`) or `release-notes.md` in the [build resources](./contents.md#extraresources).\n */\n releaseNotesFile?: string | null\n\n /**\n * The release date.\n */\n releaseDate?: string\n\n /**\n * Vendor specific information.\n */\n vendor?: { [key: string]: any } | null\n}\n\n/**\n * URL Protocol Schemes. Protocols to associate the app with. macOS only.\n *\n * Please note — on macOS [you need to register an `open-url` event handler](http://electron.atom.io/docs/api/app/#event-open-url-macos).\n */\nexport interface Protocol {\n /**\n * The name. e.g. `IRC server URL`.\n */\n readonly name: string\n\n /**\n * The schemes. e.g. `[\"irc\", \"ircs\"]`.\n */\n readonly schemes: Array<string>\n\n /**\n * *macOS-only* The app’s role with respect to the type.\n * @default Editor\n */\n readonly role?: \"Editor\" | \"Viewer\" | \"Shell\" | \"None\"\n}\n"]}
1
+ {"version":3,"file":"PlatformSpecificBuildOptions.js","sourceRoot":"","sources":["../../src/options/PlatformSpecificBuildOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { CompressionLevel, Publish, TargetConfiguration, TargetSpecificOptions } from \"../core\"\nimport { FileAssociation } from \"./FileAssociation\"\n\nexport interface FileSet {\n /**\n * The source path relative to and defaults to:\n *\n * - the [app directory](configuration.md#directories) for `files`,\n * - the project directory for `extraResources` and `extraFiles`.\n * If you don't use two-package.json structure and don't set custom app directory, app directory equals to project directory.\n */\n from?: string\n /**\n * The destination path relative to and defaults to:\n *\n * - the asar archive root for `files`,\n * - the app's content directory for `extraFiles`,\n * - the app's resource directory for `extraResources`.\n */\n to?: string\n /**\n * The [glob patterns](./file-patterns.md). Defaults to \"**\\/*\"\n */\n filter?: Array<string> | string\n}\n\nexport interface AsarOptions {\n /**\n * Whether to automatically unpack executables files.\n * @default true\n */\n smartUnpack?: boolean\n\n ordering?: string | null\n}\n\nexport interface FilesBuildOptions {\n /**\n * A [glob patterns](./file-patterns.md) relative to the [app directory](configuration.md#directories), which specifies which files to include when copying files to create the package.\n\nDefaults to:\n```json\n[\n \"**\\/*\",\n \"!**\\/node_modules/*\\/{CHANGELOG.md,README.md,README,readme.md,readme}\",\n \"!**\\/node_modules/*\\/{test,__tests__,tests,powered-test,example,examples}\",\n \"!**\\/node_modules/*.d.ts\",\n \"!**\\/node_modules/.bin\",\n \"!**\\/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}\",\n \"!.editorconfig\",\n \"!**\\/._*\",\n \"!**\\/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}\",\n \"!**\\/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}\",\n \"!**\\/{appveyor.yml,.travis.yml,circle.yml}\",\n \"!**\\/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}\"\n]\n```\n\nDevelopment dependencies are never copied in any case. You don't need to ignore it explicitly. Hidden files are not ignored by default, but all files that should be ignored, are ignored by default.\n\nDefault pattern \\`**\\/*\\` **is not added to your custom** if some of your patterns is not ignore (i.e. not starts with `!`). `package.json` and \\`**\\/node_modules/**\\/*` (only production dependencies will be copied) is added to your custom in any case. All default ignores are added in any case — you don't need to repeat it if you configure own patterns.\n\nMay be specified in the platform options (e.g. in the [mac](mac.md)).\n\nYou may also specify custom source and destination directories by using `FileSet` objects instead of simple glob patterns.\n\n```json\n[\n {\n \"from\": \"path/to/source\",\n \"to\": \"path/to/destination\",\n \"filter\": [\"**\\/*\", \"!foo/*.js\"]\n }\n]\n```\n\nYou can use [file macros](./file-patterns.md#file-macros) in the `from` and `to` fields as well. `from` and `to` can be files and you can use this to [rename](https://github.com/electron-userland/electron-builder/issues/1119) a file while packaging.\n */\n files?: Array<FileSet | string> | FileSet | string | null\n\n /**\n * A [glob patterns](./file-patterns.md) relative to the project directory, when specified, copy the file or directory with matching names directly into the app's resources directory (`Contents/Resources` for MacOS, `resources` for Linux and Windows).\n *\n * File patterns (and support for `from` and `to` fields) the same as for [files](#files).\n *\n */\n extraResources?: Array<FileSet | string> | FileSet | string | null\n\n /**\n * The same as [extraResources](#extraresources) but copy into the app's content directory (`Contents` for MacOS, root directory for Linux and Windows).\n */\n extraFiles?: Array<FileSet | string> | FileSet | string | null\n}\n\nexport interface PlatformSpecificBuildOptions extends TargetSpecificOptions, FilesBuildOptions {\n /**\n * The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n * [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.\n * @default com.electron.${name}\n */\n readonly appId?: string | null\n\n /**\n * The [artifact file name template](./configuration.md#artifact-file-name-template). Defaults to `${productName}-${version}.${ext}` (some target can have other defaults, see corresponding options).\n */\n readonly artifactName?: string | null\n\n /**\n * The executable name. Defaults to `productName`\n * Note: Except for Linux, where this would constitute a breaking change in previous behavior and lead to both invalid executable names and Desktop files. Ref comments in: https://github.com/electron-userland/electron-builder/pull/9068\n */\n readonly executableName?: string | null\n\n /**\n * The compression level. If you want to rapidly test build, `store` can reduce build time significantly. `maximum` doesn't lead to noticeable size difference, but increase build time.\n * @default normal\n */\n readonly compression?: CompressionLevel | null\n\n /**\n * Whether to exclude all default ignored files(https://www.electron.build/contents#files) and options. Defaults to `false`.\n *\n * @default false\n */\n disableDefaultIgnoredFiles?: boolean | null\n\n /**\n * Whether to package the application's source code into an archive, using [Electron's archive format](http://electron.atom.io/docs/tutorial/application-packaging/).\n *\n * Node modules, that must be unpacked, will be detected automatically, you don't need to explicitly set [asarUnpack](#asarUnpack) - please file an issue if this doesn't work.\n * @default true\n */\n readonly asar?: AsarOptions | boolean | null\n\n /**\n * A [glob patterns](./file-patterns.md) relative to the [app directory](#directories), which specifies which files to unpack when creating the [asar](http://electron.atom.io/docs/tutorial/application-packaging/) archive.\n */\n readonly asarUnpack?: Array<string> | string | null\n\n /* - @private */\n readonly icon?: string | null\n\n /**\n * The file associations.\n */\n readonly fileAssociations?: Array<FileAssociation> | FileAssociation\n /**\n * The URL protocol schemes.\n */\n readonly protocols?: Array<Protocol> | Protocol\n\n /**\n * The electron locales to keep. By default, all Electron locales used as-is.\n */\n readonly electronLanguages?: Array<string> | string\n\n /**\n * Whether to fail if app will be not code signed.\n */\n readonly forceCodeSigning?: boolean\n\n /**\n * The [electron-updater compatibility](./auto-update.md#compatibility) semver range.\n */\n readonly electronUpdaterCompatibility?: string | null\n\n /**\n * Publisher configuration. See [Auto Update](./publish.md) for more information.\n */\n publish?: Publish\n\n /**\n * Whether to infer update channel from application version pre-release components. e.g. if version `0.12.1-alpha.1`, channel will be set to `alpha`. Otherwise to `latest`.\n * This does *not* apply to github publishing, which will [never auto-detect the update channel](https://github.com/electron-userland/electron-builder/issues/8589).\n * @default true\n */\n readonly detectUpdateChannel?: boolean\n\n /**\n * Please see [Building and Releasing using Channels](https://github.com/electron-userland/electron-builder/issues/1182#issuecomment-324947139).\n * @default false\n */\n readonly generateUpdatesFilesForAllChannels?: boolean\n\n /**\n * The release info. Intended for command line usage:\n *\n * ```\n * -c.releaseInfo.releaseNotes=\"new features\"\n * ```\n */\n readonly releaseInfo?: ReleaseInfo\n\n readonly target?: Array<string | TargetConfiguration> | string | TargetConfiguration | null\n\n /* - @private */\n cscLink?: string | null\n\n /* - @private */\n cscKeyPassword?: string | null\n\n readonly defaultArch?: string\n}\n\nexport interface ReleaseInfo {\n /**\n * The release name.\n */\n releaseName?: string | null\n\n /**\n * The release notes.\n */\n releaseNotes?: string | null\n\n /**\n * The path to release notes file. Defaults to `release-notes-${platform}.md` (where `platform` it is current platform — `mac`, `linux` or `windows`) or `release-notes.md` in the [build resources](./contents.md#extraresources).\n */\n releaseNotesFile?: string | null\n\n /**\n * The release date.\n */\n releaseDate?: string\n\n /**\n * Vendor specific information.\n */\n vendor?: { [key: string]: any } | null\n}\n\n/**\n * URL Protocol Schemes. Protocols to associate the app with. macOS only.\n *\n * Please note — on macOS [you need to register an `open-url` event handler](http://electron.atom.io/docs/api/app/#event-open-url-macos).\n */\nexport interface Protocol {\n /**\n * The name. e.g. `IRC server URL`.\n */\n readonly name: string\n\n /**\n * The schemes. e.g. `[\"irc\", \"ircs\"]`.\n */\n readonly schemes: Array<string>\n\n /**\n * *macOS-only* The app’s role with respect to the type.\n * @default Editor\n */\n readonly role?: \"Editor\" | \"Viewer\" | \"Shell\" | \"None\"\n}\n"]}
@@ -23,6 +23,8 @@ export interface MacConfiguration extends PlatformSpecificBuildOptions {
23
23
  readonly identity?: string | null;
24
24
  /**
25
25
  * The path to application icon.
26
+ * Accepts `.icns` (legacy) or `.icon` (Icon Composer asset).
27
+ * If a `.icon` asset is provided, it will be preferred and compiled to an asset catalog.
26
28
  * @default build/icon.icns
27
29
  */
28
30
  readonly icon?: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"macOptions.js","sourceRoot":"","sources":["../../src/options/macOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { PlatformSpecificBuildOptions, TargetConfiguration, TargetSpecificOptions } from \"../index\"\nimport { CustomMacSign } from \"../macPackager\"\n\nexport type MacOsTargetName = \"default\" | \"dmg\" | \"mas\" | \"mas-dev\" | \"pkg\" | \"7z\" | \"zip\" | \"tar.xz\" | \"tar.lz\" | \"tar.gz\" | \"tar.bz2\" | \"dir\"\n\nexport interface MacConfiguration extends PlatformSpecificBuildOptions {\n /**\n * The application category type, as shown in the Finder via *View -> Arrange by Application Category* when viewing the Applications directory.\n *\n * For example, `\"category\": \"public.app-category.developer-tools\"` will set the application category to *Developer Tools*.\n *\n * Valid values are listed in [Apple's documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).\n */\n readonly category?: string | null\n\n /**\n * The target package type: list of `default`, `dmg`, `mas`, `mas-dev`, `pkg`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. Defaults to `default` (`dmg` and `zip` for Squirrel.Mac). Note: Squirrel.Mac auto update mechanism requires both `dmg` and `zip` to be enabled, even when only `dmg` is used. Disabling `zip` will break auto update in `dmg` packages.\n */\n readonly target?: Array<MacOsTargetName | TargetConfiguration> | MacOsTargetName | TargetConfiguration | null\n\n /**\n * The name of certificate to use when signing. Consider using environment variables [CSC_LINK or CSC_NAME](./code-signing.md) instead of specifying this option.\n * MAS installer identity is specified in the [mas](./mas.md).\n *\n * Set to `-` to use an ad-hoc identity for signing. Set to `null` to skip signing entirely.\n */\n readonly identity?: string | null\n\n /**\n * The path to application icon.\n * @default build/icon.icns\n */\n readonly icon?: string | null\n\n /**\n * The path to entitlements file for signing the app. `build/entitlements.mac.plist` will be used if exists (it is a recommended way to set).\n * MAS entitlements is specified in the [mas](./mas.md).\n * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\n * Be aware that your app may crash if the right entitlements are not set like `com.apple.security.cs.allow-jit` for example on arm64 builds with Electron 20+.\n * See [Signing and Notarizing macOS Builds from the Electron documentation](https://www.electronjs.org/docs/latest/tutorial/code-signing#signing--notarizing-macos-builds) for more information.\n */\n readonly entitlements?: string | null\n\n /**\n * The path to child entitlements which inherit the security settings for signing frameworks and bundles of a distribution. `build/entitlements.mac.inherit.plist` will be used if exists (it is a recommended way to set).\n * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\n *\n * This option only applies when signing with `entitlements` provided.\n */\n readonly entitlementsInherit?: string | null\n\n /**\n * Path to login helper entitlement file.\n * When using App Sandbox, the the `com.apple.security.inherit` key that is normally in the inherited entitlements cannot be inherited since the login helper is a standalone executable.\n * Defaults to the value provided for `entitlements`. This option only applies when signing with `entitlements` provided.\n */\n readonly entitlementsLoginHelper?: string | null\n\n /**\n * The path to the provisioning profile to use when signing, absolute or relative to the app root.\n */\n readonly provisioningProfile?: string | null\n\n /**\n * The `CFBundleVersion`. Do not use it unless [you need to](https://github.com/electron-userland/electron-builder/issues/565#issuecomment-230678643).\n */\n readonly bundleVersion?: string | null\n\n /**\n * The `CFBundleShortVersionString`. Do not use it unless you need to.\n */\n readonly bundleShortVersion?: string | null\n\n /**\n * Whether a dark mode is supported. If your app does have a dark mode, you can make your app follow the system-wide dark mode setting.\n * @default false\n */\n readonly darkModeSupport?: boolean\n\n /**\n * The bundle identifier to use in the application helper's plist.\n * @default ${appBundleIdentifier}.helper\n */\n readonly helperBundleId?: string | null\n\n /**\n * The bundle identifier to use in the Renderer helper's plist.\n * @default ${appBundleIdentifier}.helper.Renderer\n */\n readonly helperRendererBundleId?: string | null\n\n /**\n * The bundle identifier to use in the Plugin helper's plist.\n * @default ${appBundleIdentifier}.helper.Plugin\n */\n readonly helperPluginBundleId?: string | null\n\n /**\n * The bundle identifier to use in the GPU helper's plist.\n * @default ${appBundleIdentifier}.helper.GPU\n */\n readonly helperGPUBundleId?: string | null\n\n /**\n * The bundle identifier to use in the EH helper's plist.\n * @default ${appBundleIdentifier}.helper.EH\n */\n readonly helperEHBundleId?: string | null\n\n /**\n * The bundle identifier to use in the NP helper's plist.\n * @default ${appBundleIdentifier}.helper.NP\n */\n readonly helperNPBundleId?: string | null\n\n /**\n * Whether to sign app for development or for distribution.\n * @default distribution\n */\n readonly type?: \"distribution\" | \"development\" | null\n\n /**\n * The extra entries for `Info.plist`.\n */\n readonly extendInfo?: any\n\n /**\n * Paths of any extra binaries that need to be signed.\n */\n readonly binaries?: Array<string> | null\n\n /**\n * The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.\n */\n readonly minimumSystemVersion?: string | null\n\n /**\n * Path of [requirements file](https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html) used in signing. Not applicable for MAS.\n */\n readonly requirements?: string | null\n\n /** @private */\n readonly cscInstallerLink?: string | null\n /** @private */\n readonly cscInstallerKeyPassword?: string | null\n\n /**\n * Extra files to put in archive. Not applicable for `tar.*`.\n */\n readonly extraDistFiles?: Array<string> | string | null\n\n /**\n * Whether your app has to be signed with hardened runtime.\n * @default true\n */\n readonly hardenedRuntime?: boolean\n\n /**\n * Whether to let `@electron/osx-sign` validate the signing or not.\n * @default false\n */\n readonly gatekeeperAssess?: boolean\n\n /**\n * Whether to let `@electron/osx-sign` verify the contents or not.\n * @default true\n */\n readonly strictVerify?: boolean\n\n /**\n * Whether to enable entitlements automation from `@electron/osx-sign`.\n * @default true\n */\n readonly preAutoEntitlements?: boolean\n\n /**\n * Regex or an array of regex's that signal skipping signing a file.\n */\n readonly signIgnore?: Array<string> | string | null\n\n /**\n * The custom function (or path to file or module id) to sign an app bundle.\n */\n readonly sign?: CustomMacSign | string | null\n\n /**\n * Specify the URL of the timestamp authority server\n */\n readonly timestamp?: string | null\n\n /**\n * Whether to merge ASAR files for different architectures or not.\n *\n * This option has no effect unless building for \"universal\" arch.\n * @default true\n */\n readonly mergeASARs?: boolean\n\n /**\n * Minimatch pattern of paths that are allowed to be present in one of the\n * ASAR files, but not in the other.\n *\n * This option has no effect unless building for \"universal\" arch and applies\n * only if `mergeASARs` is `true`.\n */\n readonly singleArchFiles?: string | null\n\n /**\n * Minimatch pattern of paths that are allowed to be x64 binaries in both\n * ASAR files\n *\n * This option has no effect unless building for \"universal\" arch and applies\n * only if `mergeASARs` is `true`.\n */\n readonly x64ArchFiles?: string | null\n\n /**\n * Array of strings specifying additional arguments to pass to the `codesign` command used to sign a specific file.\n *\n * Some subresources that you may include in your Electron app may need to be signed with --deep, this is not typically safe to apply to the entire Electron app and therefore should be applied to just your file.\n * Usage Example: `['--deep']`\n */\n readonly additionalArguments?: Array<string> | null\n\n /**\n * Whether to disable electron-builder's [@electron/notarize](https://github.com/electron/notarize) integration.\n *\n * Note: In order to activate the notarization step You MUST specify one of the following via environment variables:\n *\n * 1. `APPLE_API_KEY`, `APPLE_API_KEY_ID` and `APPLE_API_ISSUER`.\n * 2. `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, and `APPLE_TEAM_ID`\n * 3. `APPLE_KEYCHAIN` and `APPLE_KEYCHAIN_PROFILE`\n *\n * For security reasons it is recommended to use the first option (see https://github.com/electron-userland/electron-builder/issues/7859)\n */\n readonly notarize?: boolean\n}\n\nexport interface DmgOptions extends TargetSpecificOptions {\n /**\n * The path to background image (default: `build/background.tiff` or `build/background.png` if exists). The resolution of this file determines the resolution of the installer window.\n * If background is not specified, use `window.size`. Default locations expected background size to be 540x380.\n * @see [DMG with Retina background support](http://stackoverflow.com/a/11204769/1910191).\n */\n background?: string | null\n\n /**\n * The background color (accepts css colors). Defaults to `#ffffff` (white) if no background image.\n */\n backgroundColor?: string | null\n\n /**\n * The path to DMG icon (volume icon), which will be shown when mounted, relative to the [build resources](./contents.md#extraresources) or to the project directory.\n * Defaults to the application icon (`build/icon.icns`).\n */\n icon?: string | null\n\n /**\n * The size of all the icons inside the DMG.\n * @default 80\n */\n readonly iconSize?: number | null\n\n /**\n * The size of all the icon texts inside the DMG.\n * @default 12\n */\n readonly iconTextSize?: number | null\n\n /**\n * The title of the produced DMG, which will be shown when mounted (volume name).\n *\n * Macro `${productName}`, `${version}` and `${name}` are supported.\n * @default ${productName} ${version}\n */\n readonly title?: string | null\n\n /**\n * The content — to customize icon locations. The x and y coordinates refer to the position of the **center** of the icon (at 1x scale), and do not take the label into account.\n */\n contents?: Array<DmgContent>\n\n /**\n * The disk image format. `ULFO` (lzfse-compressed image (OS X 10.11+ only)).\n * @default UDZO\n */\n format?: \"UDRW\" | \"UDRO\" | \"UDCO\" | \"UDZO\" | \"UDBZ\" | \"ULFO\"\n\n /**\n * The DMG window position and size. With y co-ordinates running from bottom to top.\n *\n * The Finder makes sure that the window will be on the user’s display, so if you want your window at the top left of the display you could use `\"x\": 0, \"y\": 100000` as the x, y co-ordinates.\n * It is not to be possible to position the window relative to the [top left](https://github.com/electron-userland/electron-builder/issues/3990#issuecomment-512960957) or relative to the center of the user’s screen.\n */\n window?: DmgWindow\n\n /**\n * Whether to create internet-enabled disk image (when it is downloaded using a browser it will automatically decompress the image, put the application on the desktop, unmount and remove the disk image file).\n * @default false\n */\n readonly internetEnabled?: boolean\n\n /**\n * Whether to sign the DMG or not. Signing is not required and will lead to unwanted errors in combination with notarization requirements.\n * @default false\n */\n readonly sign?: boolean\n\n /**\n * @private\n * @default true\n */\n writeUpdateInfo?: boolean\n}\n\nexport interface DmgWindow {\n /**\n * The X position relative to left of the screen.\n * @default 400\n */\n x?: number\n\n /**\n * The Y position relative to bottom of the screen.\n * @default 100\n */\n y?: number\n\n /**\n * The width. Defaults to background image width or 540.\n */\n width?: number\n\n /**\n * The height. Defaults to background image height or 380.\n */\n height?: number\n}\n\nexport interface DmgContent {\n /**\n * The device-independent pixel offset from the left of the window to the **center** of the icon.\n */\n x: number\n /**\n * The device-independent pixel offset from the top of the window to the **center** of the icon.\n */\n y: number\n type?: \"link\" | \"file\" | \"dir\"\n\n /**\n * The name of the file within the DMG. Defaults to basename of `path`.\n */\n name?: string\n\n /**\n * The path of the file within the DMG.\n */\n path?: string\n}\n\nexport interface MasConfiguration extends MacConfiguration {\n /**\n * The path to entitlements file for signing the app. `build/entitlements.mas.plist` will be used if exists (it is a recommended way to set).\n * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\n * Be aware that your app may crash if the right entitlements are not set like `com.apple.security.cs.allow-jit` for example on arm64 builds with Electron 20+.\n * See [Signing and Notarizing macOS Builds from the Electron documentation](https://www.electronjs.org/docs/latest/tutorial/code-signing#signing--notarizing-macos-builds) for more information.\n */\n readonly entitlements?: string | null\n\n /**\n * The path to child entitlements which inherit the security settings for signing frameworks and bundles of a distribution. `build/entitlements.mas.inherit.plist` will be used if exists (it is a recommended way to set).\n * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\n */\n readonly entitlementsInherit?: string | null\n\n /**\n * Paths of any extra binaries that need to be signed.\n */\n readonly binaries?: Array<string> | null\n}\n"]}
1
+ {"version":3,"file":"macOptions.js","sourceRoot":"","sources":["../../src/options/macOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { PlatformSpecificBuildOptions, TargetConfiguration, TargetSpecificOptions } from \"../index\"\nimport { CustomMacSign } from \"../macPackager\"\n\nexport type MacOsTargetName = \"default\" | \"dmg\" | \"mas\" | \"mas-dev\" | \"pkg\" | \"7z\" | \"zip\" | \"tar.xz\" | \"tar.lz\" | \"tar.gz\" | \"tar.bz2\" | \"dir\"\n\nexport interface MacConfiguration extends PlatformSpecificBuildOptions {\n /**\n * The application category type, as shown in the Finder via *View -> Arrange by Application Category* when viewing the Applications directory.\n *\n * For example, `\"category\": \"public.app-category.developer-tools\"` will set the application category to *Developer Tools*.\n *\n * Valid values are listed in [Apple's documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).\n */\n readonly category?: string | null\n\n /**\n * The target package type: list of `default`, `dmg`, `mas`, `mas-dev`, `pkg`, `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`, `dir`. Defaults to `default` (`dmg` and `zip` for Squirrel.Mac). Note: Squirrel.Mac auto update mechanism requires both `dmg` and `zip` to be enabled, even when only `dmg` is used. Disabling `zip` will break auto update in `dmg` packages.\n */\n readonly target?: Array<MacOsTargetName | TargetConfiguration> | MacOsTargetName | TargetConfiguration | null\n\n /**\n * The name of certificate to use when signing. Consider using environment variables [CSC_LINK or CSC_NAME](./code-signing.md) instead of specifying this option.\n * MAS installer identity is specified in the [mas](./mas.md).\n *\n * Set to `-` to use an ad-hoc identity for signing. Set to `null` to skip signing entirely.\n */\n readonly identity?: string | null\n\n /**\n * The path to application icon.\n * Accepts `.icns` (legacy) or `.icon` (Icon Composer asset).\n * If a `.icon` asset is provided, it will be preferred and compiled to an asset catalog.\n * @default build/icon.icns\n */\n readonly icon?: string | null\n\n /**\n * The path to entitlements file for signing the app. `build/entitlements.mac.plist` will be used if exists (it is a recommended way to set).\n * MAS entitlements is specified in the [mas](./mas.md).\n * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\n * Be aware that your app may crash if the right entitlements are not set like `com.apple.security.cs.allow-jit` for example on arm64 builds with Electron 20+.\n * See [Signing and Notarizing macOS Builds from the Electron documentation](https://www.electronjs.org/docs/latest/tutorial/code-signing#signing--notarizing-macos-builds) for more information.\n */\n readonly entitlements?: string | null\n\n /**\n * The path to child entitlements which inherit the security settings for signing frameworks and bundles of a distribution. `build/entitlements.mac.inherit.plist` will be used if exists (it is a recommended way to set).\n * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\n *\n * This option only applies when signing with `entitlements` provided.\n */\n readonly entitlementsInherit?: string | null\n\n /**\n * Path to login helper entitlement file.\n * When using App Sandbox, the the `com.apple.security.inherit` key that is normally in the inherited entitlements cannot be inherited since the login helper is a standalone executable.\n * Defaults to the value provided for `entitlements`. This option only applies when signing with `entitlements` provided.\n */\n readonly entitlementsLoginHelper?: string | null\n\n /**\n * The path to the provisioning profile to use when signing, absolute or relative to the app root.\n */\n readonly provisioningProfile?: string | null\n\n /**\n * The `CFBundleVersion`. Do not use it unless [you need to](https://github.com/electron-userland/electron-builder/issues/565#issuecomment-230678643).\n */\n readonly bundleVersion?: string | null\n\n /**\n * The `CFBundleShortVersionString`. Do not use it unless you need to.\n */\n readonly bundleShortVersion?: string | null\n\n /**\n * Whether a dark mode is supported. If your app does have a dark mode, you can make your app follow the system-wide dark mode setting.\n * @default false\n */\n readonly darkModeSupport?: boolean\n\n /**\n * The bundle identifier to use in the application helper's plist.\n * @default ${appBundleIdentifier}.helper\n */\n readonly helperBundleId?: string | null\n\n /**\n * The bundle identifier to use in the Renderer helper's plist.\n * @default ${appBundleIdentifier}.helper.Renderer\n */\n readonly helperRendererBundleId?: string | null\n\n /**\n * The bundle identifier to use in the Plugin helper's plist.\n * @default ${appBundleIdentifier}.helper.Plugin\n */\n readonly helperPluginBundleId?: string | null\n\n /**\n * The bundle identifier to use in the GPU helper's plist.\n * @default ${appBundleIdentifier}.helper.GPU\n */\n readonly helperGPUBundleId?: string | null\n\n /**\n * The bundle identifier to use in the EH helper's plist.\n * @default ${appBundleIdentifier}.helper.EH\n */\n readonly helperEHBundleId?: string | null\n\n /**\n * The bundle identifier to use in the NP helper's plist.\n * @default ${appBundleIdentifier}.helper.NP\n */\n readonly helperNPBundleId?: string | null\n\n /**\n * Whether to sign app for development or for distribution.\n * @default distribution\n */\n readonly type?: \"distribution\" | \"development\" | null\n\n /**\n * The extra entries for `Info.plist`.\n */\n readonly extendInfo?: any\n\n /**\n * Paths of any extra binaries that need to be signed.\n */\n readonly binaries?: Array<string> | null\n\n /**\n * The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.\n */\n readonly minimumSystemVersion?: string | null\n\n /**\n * Path of [requirements file](https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html) used in signing. Not applicable for MAS.\n */\n readonly requirements?: string | null\n\n /** @private */\n readonly cscInstallerLink?: string | null\n /** @private */\n readonly cscInstallerKeyPassword?: string | null\n\n /**\n * Extra files to put in archive. Not applicable for `tar.*`.\n */\n readonly extraDistFiles?: Array<string> | string | null\n\n /**\n * Whether your app has to be signed with hardened runtime.\n * @default true\n */\n readonly hardenedRuntime?: boolean\n\n /**\n * Whether to let `@electron/osx-sign` validate the signing or not.\n * @default false\n */\n readonly gatekeeperAssess?: boolean\n\n /**\n * Whether to let `@electron/osx-sign` verify the contents or not.\n * @default true\n */\n readonly strictVerify?: boolean\n\n /**\n * Whether to enable entitlements automation from `@electron/osx-sign`.\n * @default true\n */\n readonly preAutoEntitlements?: boolean\n\n /**\n * Regex or an array of regex's that signal skipping signing a file.\n */\n readonly signIgnore?: Array<string> | string | null\n\n /**\n * The custom function (or path to file or module id) to sign an app bundle.\n */\n readonly sign?: CustomMacSign | string | null\n\n /**\n * Specify the URL of the timestamp authority server\n */\n readonly timestamp?: string | null\n\n /**\n * Whether to merge ASAR files for different architectures or not.\n *\n * This option has no effect unless building for \"universal\" arch.\n * @default true\n */\n readonly mergeASARs?: boolean\n\n /**\n * Minimatch pattern of paths that are allowed to be present in one of the\n * ASAR files, but not in the other.\n *\n * This option has no effect unless building for \"universal\" arch and applies\n * only if `mergeASARs` is `true`.\n */\n readonly singleArchFiles?: string | null\n\n /**\n * Minimatch pattern of paths that are allowed to be x64 binaries in both\n * ASAR files\n *\n * This option has no effect unless building for \"universal\" arch and applies\n * only if `mergeASARs` is `true`.\n */\n readonly x64ArchFiles?: string | null\n\n /**\n * Array of strings specifying additional arguments to pass to the `codesign` command used to sign a specific file.\n *\n * Some subresources that you may include in your Electron app may need to be signed with --deep, this is not typically safe to apply to the entire Electron app and therefore should be applied to just your file.\n * Usage Example: `['--deep']`\n */\n readonly additionalArguments?: Array<string> | null\n\n /**\n * Whether to disable electron-builder's [@electron/notarize](https://github.com/electron/notarize) integration.\n *\n * Note: In order to activate the notarization step You MUST specify one of the following via environment variables:\n *\n * 1. `APPLE_API_KEY`, `APPLE_API_KEY_ID` and `APPLE_API_ISSUER`.\n * 2. `APPLE_ID`, `APPLE_APP_SPECIFIC_PASSWORD`, and `APPLE_TEAM_ID`\n * 3. `APPLE_KEYCHAIN` and `APPLE_KEYCHAIN_PROFILE`\n *\n * For security reasons it is recommended to use the first option (see https://github.com/electron-userland/electron-builder/issues/7859)\n */\n readonly notarize?: boolean\n}\n\nexport interface DmgOptions extends TargetSpecificOptions {\n /**\n * The path to background image (default: `build/background.tiff` or `build/background.png` if exists). The resolution of this file determines the resolution of the installer window.\n * If background is not specified, use `window.size`. Default locations expected background size to be 540x380.\n * @see [DMG with Retina background support](http://stackoverflow.com/a/11204769/1910191).\n */\n background?: string | null\n\n /**\n * The background color (accepts css colors). Defaults to `#ffffff` (white) if no background image.\n */\n backgroundColor?: string | null\n\n /**\n * The path to DMG icon (volume icon), which will be shown when mounted, relative to the [build resources](./contents.md#extraresources) or to the project directory.\n * Defaults to the application icon (`build/icon.icns`).\n */\n icon?: string | null\n\n /**\n * The size of all the icons inside the DMG.\n * @default 80\n */\n readonly iconSize?: number | null\n\n /**\n * The size of all the icon texts inside the DMG.\n * @default 12\n */\n readonly iconTextSize?: number | null\n\n /**\n * The title of the produced DMG, which will be shown when mounted (volume name).\n *\n * Macro `${productName}`, `${version}` and `${name}` are supported.\n * @default ${productName} ${version}\n */\n readonly title?: string | null\n\n /**\n * The content — to customize icon locations. The x and y coordinates refer to the position of the **center** of the icon (at 1x scale), and do not take the label into account.\n */\n contents?: Array<DmgContent>\n\n /**\n * The disk image format. `ULFO` (lzfse-compressed image (OS X 10.11+ only)).\n * @default UDZO\n */\n format?: \"UDRW\" | \"UDRO\" | \"UDCO\" | \"UDZO\" | \"UDBZ\" | \"ULFO\"\n\n /**\n * The DMG window position and size. With y co-ordinates running from bottom to top.\n *\n * The Finder makes sure that the window will be on the user’s display, so if you want your window at the top left of the display you could use `\"x\": 0, \"y\": 100000` as the x, y co-ordinates.\n * It is not to be possible to position the window relative to the [top left](https://github.com/electron-userland/electron-builder/issues/3990#issuecomment-512960957) or relative to the center of the user’s screen.\n */\n window?: DmgWindow\n\n /**\n * Whether to create internet-enabled disk image (when it is downloaded using a browser it will automatically decompress the image, put the application on the desktop, unmount and remove the disk image file).\n * @default false\n */\n readonly internetEnabled?: boolean\n\n /**\n * Whether to sign the DMG or not. Signing is not required and will lead to unwanted errors in combination with notarization requirements.\n * @default false\n */\n readonly sign?: boolean\n\n /**\n * @private\n * @default true\n */\n writeUpdateInfo?: boolean\n}\n\nexport interface DmgWindow {\n /**\n * The X position relative to left of the screen.\n * @default 400\n */\n x?: number\n\n /**\n * The Y position relative to bottom of the screen.\n * @default 100\n */\n y?: number\n\n /**\n * The width. Defaults to background image width or 540.\n */\n width?: number\n\n /**\n * The height. Defaults to background image height or 380.\n */\n height?: number\n}\n\nexport interface DmgContent {\n /**\n * The device-independent pixel offset from the left of the window to the **center** of the icon.\n */\n x: number\n /**\n * The device-independent pixel offset from the top of the window to the **center** of the icon.\n */\n y: number\n type?: \"link\" | \"file\" | \"dir\"\n\n /**\n * The name of the file within the DMG. Defaults to basename of `path`.\n */\n name?: string\n\n /**\n * The path of the file within the DMG.\n */\n path?: string\n}\n\nexport interface MasConfiguration extends MacConfiguration {\n /**\n * The path to entitlements file for signing the app. `build/entitlements.mas.plist` will be used if exists (it is a recommended way to set).\n * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\n * Be aware that your app may crash if the right entitlements are not set like `com.apple.security.cs.allow-jit` for example on arm64 builds with Electron 20+.\n * See [Signing and Notarizing macOS Builds from the Electron documentation](https://www.electronjs.org/docs/latest/tutorial/code-signing#signing--notarizing-macos-builds) for more information.\n */\n readonly entitlements?: string | null\n\n /**\n * The path to child entitlements which inherit the security settings for signing frameworks and bundles of a distribution. `build/entitlements.mas.inherit.plist` will be used if exists (it is a recommended way to set).\n * See [this folder in osx-sign's repository](https://github.com/electron/osx-sign/tree/main/entitlements) for examples.\n */\n readonly entitlementsInherit?: string | null\n\n /**\n * Paths of any extra binaries that need to be signed.\n */\n readonly binaries?: Array<string> | null\n}\n"]}
@@ -26,7 +26,7 @@ export interface WindowsConfiguration extends PlatformSpecificBuildOptions {
26
26
  */
27
27
  readonly signtoolOptions?: WindowsSigntoolConfiguration | null;
28
28
  /**
29
- * Options for usage of Azure Trusted Signing (beta)
29
+ * Options for usage of Azure Trusted Signing service
30
30
  * Cannot be used in conjunction with `signtoolOptions`, signing will default to Azure Trusted Signing
31
31
  */
32
32
  readonly azureSignOptions?: WindowsAzureSigningConfiguration | null;
@@ -52,7 +52,8 @@ export interface WindowsConfiguration extends PlatformSpecificBuildOptions {
52
52
  */
53
53
  readonly signAndEditExecutable?: boolean;
54
54
  /**
55
- * Explicit file extensions to also sign. Advanced option.
55
+ * Explicit file name/extensions (`str.endsWith`) to also sign. Advanced option.
56
+ * Supports negative patterns, e.g. example that excludes `.appx` files: `["somefilename", ".dll", "!.appx"]`.
56
57
  * @see https://github.com/electron-userland/electron-builder/issues/7329
57
58
  * @default null
58
59
  */