app-builder-lib 27.0.0-alpha.11 → 27.0.0-alpha.13

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 (254) hide show
  1. package/dist/asar/asarUtil.js +1 -1
  2. package/dist/asar/asarUtil.js.map +1 -1
  3. package/dist/codeSign/certInfo.d.ts +4 -1
  4. package/dist/codeSign/certInfo.d.ts.map +1 -1
  5. package/dist/codeSign/certInfo.js +5 -3
  6. package/dist/codeSign/certInfo.js.map +1 -1
  7. package/dist/codeSign/forceCodeSigning.d.ts +22 -0
  8. package/dist/codeSign/forceCodeSigning.d.ts.map +1 -0
  9. package/dist/codeSign/forceCodeSigning.js +18 -0
  10. package/dist/codeSign/forceCodeSigning.js.map +1 -0
  11. package/dist/codeSign/mac/macCodeSign.d.ts +13 -1
  12. package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
  13. package/dist/codeSign/mac/macCodeSign.js +29 -2
  14. package/dist/codeSign/mac/macCodeSign.js.map +1 -1
  15. package/dist/codeSign/mac/macSignatureVerifier.d.ts +23 -0
  16. package/dist/codeSign/mac/macSignatureVerifier.d.ts.map +1 -0
  17. package/dist/codeSign/mac/macSignatureVerifier.js +96 -0
  18. package/dist/codeSign/mac/macSignatureVerifier.js.map +1 -0
  19. package/dist/codeSign/win/authenticodeSignature.d.ts +83 -0
  20. package/dist/codeSign/win/authenticodeSignature.d.ts.map +1 -0
  21. package/dist/codeSign/win/authenticodeSignature.js +289 -0
  22. package/dist/codeSign/win/authenticodeSignature.js.map +1 -0
  23. package/dist/codeSign/win/pkcs11SignManager.d.ts.map +1 -1
  24. package/dist/codeSign/win/pkcs11SignManager.js +4 -3
  25. package/dist/codeSign/win/pkcs11SignManager.js.map +1 -1
  26. package/dist/codeSign/win/publisherName.d.ts +31 -0
  27. package/dist/codeSign/win/publisherName.d.ts.map +1 -0
  28. package/dist/codeSign/win/publisherName.js +78 -0
  29. package/dist/codeSign/win/publisherName.js.map +1 -0
  30. package/dist/codeSign/win/signtoolBaseSignManager.d.ts +27 -9
  31. package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
  32. package/dist/codeSign/win/signtoolBaseSignManager.js +80 -49
  33. package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
  34. package/dist/codeSign/win/verifyUpdatePublisher.d.ts +25 -0
  35. package/dist/codeSign/win/verifyUpdatePublisher.d.ts.map +1 -0
  36. package/dist/codeSign/win/verifyUpdatePublisher.js +101 -0
  37. package/dist/codeSign/win/verifyUpdatePublisher.js.map +1 -0
  38. package/dist/codeSign/win/windowsSignAzureManager.d.ts +1 -1
  39. package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
  40. package/dist/codeSign/win/windowsSignAzureManager.js +24 -6
  41. package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
  42. package/dist/configuration.d.ts +56 -12
  43. package/dist/configuration.d.ts.map +1 -1
  44. package/dist/configuration.js.map +1 -1
  45. package/dist/electron/ElectronFramework.d.ts +15 -0
  46. package/dist/electron/ElectronFramework.d.ts.map +1 -1
  47. package/dist/electron/ElectronFramework.js +33 -2
  48. package/dist/electron/ElectronFramework.js.map +1 -1
  49. package/dist/electron/mac/asarIntegrityDigest.d.ts +10 -0
  50. package/dist/electron/mac/asarIntegrityDigest.d.ts.map +1 -0
  51. package/dist/electron/mac/asarIntegrityDigest.js +122 -0
  52. package/dist/electron/mac/asarIntegrityDigest.js.map +1 -0
  53. package/dist/electron/mac/electronMac.js +1 -28
  54. package/dist/electron/mac/electronMac.js.map +1 -1
  55. package/dist/electron/mac/electronMacUtils.d.ts +9 -0
  56. package/dist/electron/mac/electronMacUtils.d.ts.map +1 -1
  57. package/dist/electron/mac/electronMacUtils.js +37 -0
  58. package/dist/electron/mac/electronMacUtils.js.map +1 -1
  59. package/dist/fileMatcher.d.ts +34 -11
  60. package/dist/fileMatcher.d.ts.map +1 -1
  61. package/dist/fileMatcher.js +125 -36
  62. package/dist/fileMatcher.js.map +1 -1
  63. package/dist/forge-maker.d.ts +64 -0
  64. package/dist/forge-maker.d.ts.map +1 -1
  65. package/dist/forge-maker.js +104 -2
  66. package/dist/forge-maker.js.map +1 -1
  67. package/dist/index.d.ts +2 -2
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +5 -4
  70. package/dist/index.js.map +1 -1
  71. package/dist/indexInternal.d.ts +9 -3
  72. package/dist/indexInternal.d.ts.map +1 -1
  73. package/dist/indexInternal.js +8 -3
  74. package/dist/indexInternal.js.map +1 -1
  75. package/dist/linuxPackager.js +1 -1
  76. package/dist/linuxPackager.js.map +1 -1
  77. package/dist/macPackager.d.ts +32 -0
  78. package/dist/macPackager.d.ts.map +1 -1
  79. package/dist/macPackager.js +215 -13
  80. package/dist/macPackager.js.map +1 -1
  81. package/dist/options/FuseOptionsV1.d.ts +4 -0
  82. package/dist/options/FuseOptionsV1.d.ts.map +1 -1
  83. package/dist/options/FuseOptionsV1.js.map +1 -1
  84. package/dist/options/PlatformSpecificBuildOptions.d.ts +93 -21
  85. package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
  86. package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
  87. package/dist/options/SquirrelWindowsOptions.d.ts +3 -0
  88. package/dist/options/SquirrelWindowsOptions.d.ts.map +1 -1
  89. package/dist/options/SquirrelWindowsOptions.js.map +1 -1
  90. package/dist/options/macOptions.d.ts +22 -3
  91. package/dist/options/macOptions.d.ts.map +1 -1
  92. package/dist/options/macOptions.js.map +1 -1
  93. package/dist/options/winOptions.d.ts +68 -19
  94. package/dist/options/winOptions.d.ts.map +1 -1
  95. package/dist/options/winOptions.js +20 -0
  96. package/dist/options/winOptions.js.map +1 -1
  97. package/dist/packager.d.ts +3 -0
  98. package/dist/packager.d.ts.map +1 -1
  99. package/dist/packager.js +11 -2
  100. package/dist/packager.js.map +1 -1
  101. package/dist/platformPackager.d.ts +18 -7
  102. package/dist/platformPackager.d.ts.map +1 -1
  103. package/dist/platformPackager.js +56 -15
  104. package/dist/platformPackager.js.map +1 -1
  105. package/dist/publish/PublishManager.d.ts +4 -0
  106. package/dist/publish/PublishManager.d.ts.map +1 -1
  107. package/dist/publish/PublishManager.js +106 -28
  108. package/dist/publish/PublishManager.js.map +1 -1
  109. package/dist/publish/manifestUploadCheck.d.ts +10 -0
  110. package/dist/publish/manifestUploadCheck.d.ts.map +1 -0
  111. package/dist/publish/manifestUploadCheck.js +75 -0
  112. package/dist/publish/manifestUploadCheck.js.map +1 -0
  113. package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
  114. package/dist/publish/updateInfoBuilder.js +51 -17
  115. package/dist/publish/updateInfoBuilder.js.map +1 -1
  116. package/dist/publish/updateManifestVerifier.d.ts +22 -0
  117. package/dist/publish/updateManifestVerifier.d.ts.map +1 -0
  118. package/dist/publish/updateManifestVerifier.js +65 -0
  119. package/dist/publish/updateManifestVerifier.js.map +1 -0
  120. package/dist/targets/ArchiveTarget.d.ts.map +1 -1
  121. package/dist/targets/ArchiveTarget.js +6 -2
  122. package/dist/targets/ArchiveTarget.js.map +1 -1
  123. package/dist/targets/archive.d.ts +6 -0
  124. package/dist/targets/archive.d.ts.map +1 -1
  125. package/dist/targets/archive.js +15 -5
  126. package/dist/targets/archive.js.map +1 -1
  127. package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
  128. package/dist/targets/differentialUpdateInfoBuilder.js +4 -0
  129. package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
  130. package/dist/targets/linux/FlatpakTarget.js +5 -5
  131. package/dist/targets/linux/FlatpakTarget.js.map +1 -1
  132. package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
  133. package/dist/targets/linux/FpmTarget.js +12 -17
  134. package/dist/targets/linux/FpmTarget.js.map +1 -1
  135. package/dist/targets/linux/LinuxTargetHelper.js +1 -1
  136. package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
  137. package/dist/targets/linux/appimage/AppImageTarget.d.ts.map +1 -1
  138. package/dist/targets/linux/appimage/AppImageTarget.js +6 -1
  139. package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
  140. package/dist/targets/linux/appimage/appImageUtil.js +9 -9
  141. package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
  142. package/dist/targets/linux/flatpakBundle.d.ts.map +1 -1
  143. package/dist/targets/linux/flatpakBundle.js +25 -20
  144. package/dist/targets/linux/flatpakBundle.js.map +1 -1
  145. package/dist/targets/linux/snap/core24.d.ts.map +1 -1
  146. package/dist/targets/linux/snap/core24.js +2 -9
  147. package/dist/targets/linux/snap/core24.js.map +1 -1
  148. package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
  149. package/dist/targets/linux/snap/coreLegacy.js +22 -6
  150. package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
  151. package/dist/targets/linux/snap/snapPlugs.d.ts +2 -2
  152. package/dist/targets/linux/snap/snapPlugs.d.ts.map +1 -1
  153. package/dist/targets/linux/snap/snapPlugs.js +1 -1
  154. package/dist/targets/linux/snap/snapPlugs.js.map +1 -1
  155. package/dist/targets/linux/snap/snapcraftBuilder.d.ts.map +1 -1
  156. package/dist/targets/linux/snap/snapcraftBuilder.js +19 -17
  157. package/dist/targets/linux/snap/snapcraftBuilder.js.map +1 -1
  158. package/dist/targets/mac/MacTargetHelper.d.ts +21 -3
  159. package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
  160. package/dist/targets/mac/MacTargetHelper.js +140 -13
  161. package/dist/targets/mac/MacTargetHelper.js.map +1 -1
  162. package/dist/targets/mac/pkg.d.ts.map +1 -1
  163. package/dist/targets/mac/pkg.js +8 -5
  164. package/dist/targets/mac/pkg.js.map +1 -1
  165. package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
  166. package/dist/targets/win/nsis/NsisTarget.js +15 -3
  167. package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
  168. package/dist/targets/win/nsis/nsisOptions.d.ts +1 -1
  169. package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
  170. package/dist/toolsets/nsis.js +1 -1
  171. package/dist/toolsets/nsis.js.map +1 -1
  172. package/dist/toolsets/winCodeSign.d.ts +14 -1
  173. package/dist/toolsets/winCodeSign.d.ts.map +1 -1
  174. package/dist/toolsets/winCodeSign.js +14 -1
  175. package/dist/toolsets/winCodeSign.js.map +1 -1
  176. package/dist/toolsets/wine.d.ts +3 -0
  177. package/dist/toolsets/wine.d.ts.map +1 -1
  178. package/dist/toolsets/wine.js +14 -5
  179. package/dist/toolsets/wine.js.map +1 -1
  180. package/dist/util/appFileCopier.d.ts.map +1 -1
  181. package/dist/util/appFileCopier.js +15 -11
  182. package/dist/util/appFileCopier.js.map +1 -1
  183. package/dist/util/buildOutputVerifier.d.ts +40 -0
  184. package/dist/util/buildOutputVerifier.d.ts.map +1 -0
  185. package/dist/util/buildOutputVerifier.js +420 -0
  186. package/dist/util/buildOutputVerifier.js.map +1 -0
  187. package/dist/util/config/config.d.ts.map +1 -1
  188. package/dist/util/config/config.js +9 -1
  189. package/dist/util/config/config.js.map +1 -1
  190. package/dist/util/config/fileOptions.d.ts +22 -0
  191. package/dist/util/config/fileOptions.d.ts.map +1 -1
  192. package/dist/util/config/fileOptions.js +92 -2
  193. package/dist/util/config/fileOptions.js.map +1 -1
  194. package/dist/util/config/legacyConfigGuard.d.ts.map +1 -1
  195. package/dist/util/config/legacyConfigGuard.js +2 -2
  196. package/dist/util/config/legacyConfigGuard.js.map +1 -1
  197. package/dist/util/config/legacyOptions.d.ts +9 -2
  198. package/dist/util/config/legacyOptions.d.ts.map +1 -1
  199. package/dist/util/config/legacyOptions.js +20 -2
  200. package/dist/util/config/legacyOptions.js.map +1 -1
  201. package/dist/util/electronGet.d.ts.map +1 -1
  202. package/dist/util/electronGet.js +3 -1
  203. package/dist/util/electronGet.js.map +1 -1
  204. package/dist/util/flags.d.ts.map +1 -1
  205. package/dist/util/flags.js +3 -9
  206. package/dist/util/flags.js.map +1 -1
  207. package/dist/util/mac/macosIconComposer.d.ts.map +1 -1
  208. package/dist/util/mac/macosIconComposer.js +6 -5
  209. package/dist/util/mac/macosIconComposer.js.map +1 -1
  210. package/dist/util/macroExpander.js +1 -1
  211. package/dist/util/macroExpander.js.map +1 -1
  212. package/dist/util/nativeBinaryVerifier.d.ts.map +1 -1
  213. package/dist/util/nativeBinaryVerifier.js +3 -1
  214. package/dist/util/nativeBinaryVerifier.js.map +1 -1
  215. package/dist/util/packageMetadata.js +1 -1
  216. package/dist/util/packageMetadata.js.map +1 -1
  217. package/dist/util/removedEnvVars.d.ts +2 -0
  218. package/dist/util/removedEnvVars.d.ts.map +1 -1
  219. package/dist/util/removedEnvVars.js +15 -1
  220. package/dist/util/removedEnvVars.js.map +1 -1
  221. package/dist/util/streamSpawnToFile.d.ts +3 -1
  222. package/dist/util/streamSpawnToFile.d.ts.map +1 -1
  223. package/dist/util/streamSpawnToFile.js +6 -2
  224. package/dist/util/streamSpawnToFile.js.map +1 -1
  225. package/dist/version.d.ts +1 -1
  226. package/dist/version.js +1 -1
  227. package/dist/version.js.map +1 -1
  228. package/dist/vm/ParallelsVm.d.ts +10 -0
  229. package/dist/vm/ParallelsVm.d.ts.map +1 -1
  230. package/dist/vm/ParallelsVm.js +22 -8
  231. package/dist/vm/ParallelsVm.js.map +1 -1
  232. package/dist/vm/PwshVm.d.ts +0 -1
  233. package/dist/vm/PwshVm.d.ts.map +1 -1
  234. package/dist/vm/PwshVm.js +10 -15
  235. package/dist/vm/PwshVm.js.map +1 -1
  236. package/dist/vm/WineVm.d.ts.map +1 -1
  237. package/dist/vm/WineVm.js +4 -4
  238. package/dist/vm/WineVm.js.map +1 -1
  239. package/dist/vm/vm.d.ts +9 -3
  240. package/dist/vm/vm.d.ts.map +1 -1
  241. package/dist/vm/vm.js +40 -32
  242. package/dist/vm/vm.js.map +1 -1
  243. package/dist/winPackager.d.ts +16 -1
  244. package/dist/winPackager.d.ts.map +1 -1
  245. package/dist/winPackager.js +77 -19
  246. package/dist/winPackager.js.map +1 -1
  247. package/package.json +12 -10
  248. package/scheme.json +662 -50
  249. package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +14 -9
  250. package/templates/nsis/installSection.nsh +5 -0
  251. package/dist/vm/MonoVm.d.ts +0 -9
  252. package/dist/vm/MonoVm.d.ts.map +0 -1
  253. package/dist/vm/MonoVm.js +0 -16
  254. package/dist/vm/MonoVm.js.map +0 -1
@@ -1,7 +1,10 @@
1
1
  import { asArray, copyDir, copyOrLinkFile, InvalidConfigurationError, isPathWithin, log, statOrNull, USE_HARD_LINKS, WriteContainment, } from "builder-util";
2
+ import { DEFAULT_KEYWORD, resolveDefaultKeywordList } from "builder-util/internal";
2
3
  import { Minimatch } from "minimatch";
3
4
  import * as path from "path";
5
+ import { normalizeExcludedExtensions } from "./util/config/fileOptions.js";
4
6
  import { createFilter, hasMagic } from "./util/filter.js";
7
+ import { BUILD_CHANGES_URL } from "./util/config/legacyOptions.js";
5
8
  // https://github.com/electron-userland/electron-builder/issues/733
6
9
  const minimatchOptions = { dot: true };
7
10
  // noinspection SpellCheckingInspection
@@ -44,7 +47,7 @@ export const DEFAULT_EXCLUDED_NAMES = [
44
47
  ".github",
45
48
  "electron-builder.env",
46
49
  ];
47
- // File extensions (without leading dot) excluded by default from the packaged app.
50
+ // File extensions (without leading dot) excluded by default from the packaged app, the `"default"` entry of `fileOptions.excludedExts`.
48
51
  export const DEFAULT_EXCLUDED_EXTENSIONS = [
49
52
  "iml",
50
53
  "hprof",
@@ -66,7 +69,18 @@ export const DEFAULT_EXCLUDED_EXTENSIONS = [
66
69
  "o",
67
70
  "obj",
68
71
  "forge-meta",
72
+ "pdb",
69
73
  ];
74
+ /**
75
+ * The file extensions (without leading dot) excluded from the app files and the copied `node_modules`, from the
76
+ * `fileOptions.excludedExts` build option: the platform-level value (`mac.fileOptions.excludedExts`, ...) when it is set,
77
+ * otherwise the root one, otherwise `["default"]`. See `FilesBuildOptions.excludedExts`.
78
+ */
79
+ export function resolveExcludedExtensions(config, platformOptions) {
80
+ const entries = platformOptions?.fileOptions?.excludedExts ?? config.fileOptions?.excludedExts ?? [DEFAULT_KEYWORD];
81
+ // a "!ext" that removes nothing is reported by validateConfiguration, naming the section
82
+ return resolveDefaultKeywordList(normalizeExcludedExtensions(entries), DEFAULT_EXCLUDED_EXTENSIONS).result;
83
+ }
70
84
  // Hard cap on the number of strings a single pattern may expand to. Real opt-in patterns expand to a
71
85
  // handful (`{obj,gltf,glb}`); this bound makes the expansion provably finite so a pathological pattern
72
86
  // (e.g. nested or many large `{...}` groups whose product is huge) degrades to "treated literally"
@@ -130,17 +144,19 @@ function splitTopLevel(value) {
130
144
  return parts;
131
145
  }
132
146
  /**
133
- * Determines which default-excluded extensions and names a user has explicitly opted back in to via
134
- * their `files` patterns, so the corresponding defaults are not re-applied.
147
+ * Determines which excluded extensions (`excludedExtensions`, see {@link resolveExcludedExtensions}) and default-excluded
148
+ * names a user has explicitly opted back in to via their `files` patterns: the extensions for the warning (the files a pattern
149
+ * names are let through by {@link FileMatcher.extensionReincludes}), the names to leave out of the name exclusion glob.
135
150
  *
136
- * A default is treated as opted back in only when a non-negated pattern references it concretely:
151
+ * An exclusion is treated as opted back in only when a non-negated pattern references it concretely:
137
152
  * an extension when a pattern's basename ends with `.<ext>` (e.g. `**\/*.obj`, `assets/*.{obj,gltf}`,
138
- * `**\/*.d.ts`); a name when any path segment equals it (e.g. `**\/.github/**`, `**\/yarn.lock`).
153
+ * `**\/*.d.ts`), only the longest such extension counting (`*.d.ts` names `d.ts`, not also a listed `ts`);
154
+ * a name when any path segment equals it (e.g. `**\/.github/**`, `**\/yarn.lock`).
139
155
  * Broad patterns such as `**\/*` reference nothing concrete and therefore opt nothing in.
140
156
  */
141
- export function collectExplicitReincludes(patterns) {
157
+ export function collectExplicitReincludes(patterns, excludedExtensions = DEFAULT_EXCLUDED_EXTENSIONS) {
142
158
  const segments = new Set();
143
- const basenames = [];
159
+ const namedExtensions = new Set();
144
160
  for (const pattern of patterns) {
145
161
  if (pattern.startsWith("!")) {
146
162
  continue;
@@ -150,36 +166,34 @@ export function collectExplicitReincludes(patterns) {
150
166
  for (const part of parts) {
151
167
  segments.add(part);
152
168
  }
153
- basenames.push(parts[parts.length - 1]);
169
+ const named = longestExcludedExtension(parts[parts.length - 1], excludedExtensions);
170
+ if (named != null) {
171
+ namedExtensions.add(named);
172
+ }
154
173
  }
155
174
  }
156
- const extensions = new Set(DEFAULT_EXCLUDED_EXTENSIONS.filter(ext => basenames.some(name => name.endsWith(`.${ext}`))));
175
+ const extensions = new Set(excludedExtensions.filter(ext => namedExtensions.has(ext)));
157
176
  const names = new Set(DEFAULT_EXCLUDED_NAMES.filter(name => segments.has(name)));
158
177
  return { extensions, names };
159
178
  }
160
179
  /**
161
- * Builds the trailing list of default ignore globs appended to the main app file matcher. Extensions
162
- * and names the user has explicitly re-included (see {@link collectExplicitReincludes}) are omitted,
163
- * so a `files` entry like `**\/*.obj` overrides the matching built-in exclusion.
180
+ * Builds the trailing list of default ignore globs appended to the main app file matcher: a glob that excludes every one of
181
+ * `excludedExtensions` (see {@link resolveExcludedExtensions}), then the default-excluded names except those a `files` entry
182
+ * re-includes (see {@link collectExplicitReincludes}) and the fixed ignores. The files a `files` entry names despite their
183
+ * excluded extension are let through by {@link FileMatcher.extensionReincludes}, not by these patterns.
164
184
  */
165
- export function getDefaultIgnoredPatterns(userPatterns, includePdb) {
166
- const reincluded = collectExplicitReincludes(userPatterns);
167
- const extensions = DEFAULT_EXCLUDED_EXTENSIONS.filter(ext => !reincluded.extensions.has(ext));
168
- if (!includePdb) {
169
- extensions.push("pdb");
170
- }
171
- const names = DEFAULT_EXCLUDED_NAMES.filter(name => !reincluded.names.has(name));
185
+ export function getDefaultIgnoredPatterns(userPatterns, excludedExtensions = DEFAULT_EXCLUDED_EXTENSIONS) {
186
+ const reincludedNames = collectExplicitReincludes(userPatterns, excludedExtensions).names;
187
+ const names = DEFAULT_EXCLUDED_NAMES.filter(name => !reincludedNames.has(name));
172
188
  const patterns = [];
173
- // minimatch does not expand a single-member brace (`{x}` is matched literally), so emit a bare
174
- // glob when only one extension/name survives the opt-in filtering.
175
- if (extensions.length === 1) {
176
- patterns.push(`!**/*.${extensions[0]}`);
177
- }
178
- else if (extensions.length > 1) {
179
- patterns.push(`!**/*.{${extensions.join(",")}}`);
189
+ const extensionGlob = excludedExtensionsGlob(excludedExtensions);
190
+ if (extensionGlob != null) {
191
+ patterns.push(extensionGlob);
180
192
  }
181
193
  patterns.push("!**/._*");
182
194
  patterns.push("!**/electron-builder.{yaml,yml,json,json5,toml,ts}");
195
+ // minimatch does not expand a single-member brace (`{x}` is matched literally), so emit a bare
196
+ // glob when only one name is excluded.
183
197
  if (names.length === 1) {
184
198
  patterns.push(`!**/${names[0]}`);
185
199
  }
@@ -193,13 +207,52 @@ export function getDefaultIgnoredPatterns(userPatterns, includePdb) {
193
207
  patterns.push("!.yarnrc.yml");
194
208
  return patterns;
195
209
  }
210
+ /** The glob that excludes `excludedExtensions` (a bare one for a single extension, since minimatch matches `{x}` literally), or null for none. */
211
+ function excludedExtensionsGlob(excludedExtensions) {
212
+ if (excludedExtensions.length === 0) {
213
+ return null;
214
+ }
215
+ return excludedExtensions.length === 1 ? `!**/*.${excludedExtensions[0]}` : `!**/*.{${excludedExtensions.join(",")}}`;
216
+ }
217
+ /** The longest of `excludedExtensions` that `name` ends with (`index.d.ts` → `d.ts`, not also a listed `ts`), or null. */
218
+ function longestExcludedExtension(name, excludedExtensions) {
219
+ let result = null;
220
+ for (const ext of excludedExtensions) {
221
+ if (name.endsWith(`.${ext}`) && (result == null || ext.length > result.length)) {
222
+ result = ext;
223
+ }
224
+ }
225
+ return result;
226
+ }
227
+ /**
228
+ * Per excluded extension, the `files` patterns that name it: each brace-expanded alternative of a non-negated pattern whose basename
229
+ * ends with that extension (the longest one, see {@link longestExcludedExtension}). An alternative of `native/{**\/*,addon.pdb}`
230
+ * without such an extension names nothing. An alternative that still holds braces (a pattern too large to expand, or a literal brace)
231
+ * is recorded whole: an extension cannot hold a brace, so the extension it ends with follows its last brace and every alternative minimatch
232
+ * expands it to ends with it.
233
+ */
234
+ function collectExtensionReincludes(patterns, excludedExtensions) {
235
+ const result = new Map();
236
+ for (const pattern of patterns) {
237
+ if (pattern.startsWith("!")) {
238
+ continue;
239
+ }
240
+ for (const expanded of expandBraces(pattern)) {
241
+ const extension = longestExcludedExtension(expanded.substring(expanded.lastIndexOf("/") + 1), excludedExtensions);
242
+ if (extension != null) {
243
+ result.set(extension, [...(result.get(extension) ?? []), expanded]);
244
+ }
245
+ }
246
+ }
247
+ return result;
248
+ }
196
249
  /**
197
250
  * Returns the default-excluded names/extensions that the given `files` patterns opt back in, formatted
198
251
  * for display (extensions as `*.<ext>`, names verbatim). Empty when nothing default-excluded is
199
252
  * re-included. Used to warn that files normally kept out of the package will now be included.
200
253
  */
201
- export function getReincludedDefaultExclusions(patterns) {
202
- const reincluded = collectExplicitReincludes(patterns);
254
+ export function getReincludedDefaultExclusions(patterns, excludedExtensions = DEFAULT_EXCLUDED_EXTENSIONS) {
255
+ const reincluded = collectExplicitReincludes(patterns, excludedExtensions);
203
256
  return [...[...reincluded.extensions].map(ext => `*.${ext}`), ...reincluded.names];
204
257
  }
205
258
  function ensureNoEndSlash(file) {
@@ -220,6 +273,8 @@ export class FileMatcher {
220
273
  constructor(from, to, macroExpander, patterns) {
221
274
  this.macroExpander = macroExpander;
222
275
  this.excludePatterns = null;
276
+ /** The files a `files` pattern names despite their excluded extension, which the filter lets through the extension glob. */
277
+ this.extensionReincludes = null;
223
278
  this.from = ensureNoEndSlash(macroExpander(from));
224
279
  this.to = ensureNoEndSlash(macroExpander(to));
225
280
  this.patterns = asArray(patterns).map(it => this.normalizePattern(it));
@@ -243,14 +298,14 @@ export class FileMatcher {
243
298
  containsOnlyIgnore() {
244
299
  return !this.isEmpty() && this.patterns.find(it => !it.startsWith("!")) == null;
245
300
  }
246
- computeParsedPatterns(result, fromDir) {
301
+ computeParsedPatterns(result, fromDir, patterns = this.patterns) {
247
302
  const relativeFrom = fromDir == null ? null : path.relative(fromDir, this.from);
248
- if (this.patterns.length === 0 && relativeFrom != null) {
303
+ if (patterns.length === 0 && relativeFrom != null) {
249
304
  // file mappings, from here is a file
250
305
  result.push(new Minimatch(relativeFrom, minimatchOptions));
251
306
  return;
252
307
  }
253
- for (let pattern of this.patterns) {
308
+ for (let pattern of patterns) {
254
309
  if (relativeFrom != null) {
255
310
  pattern = path.join(relativeFrom, pattern);
256
311
  }
@@ -267,7 +322,34 @@ export class FileMatcher {
267
322
  createFilter() {
268
323
  const parsedPatterns = [];
269
324
  this.computeParsedPatterns(parsedPatterns);
270
- return createFilter(this.from, parsedPatterns, this.excludePatterns);
325
+ const filter = createFilter(this.from, parsedPatterns, this.excludePatterns);
326
+ const reincludes = this.extensionReincludes;
327
+ if (reincludes == null) {
328
+ return filter;
329
+ }
330
+ // only the glob getMainFileMatchers appended (the last one): a `files` negation with the same text still applies
331
+ const globIndex = this.patterns.lastIndexOf(reincludes.glob);
332
+ const withoutGlob = this.patterns.filter((_, index) => index !== globIndex);
333
+ const otherPatterns = [];
334
+ this.computeParsedPatterns(otherPatterns, undefined, withoutGlob);
335
+ const withoutExtensionGlob = createFilter(this.from, otherPatterns, this.excludePatterns);
336
+ const namedBy = new Map([...reincludes.namedBy].map(([extension, patterns]) => [extension, patterns.map(it => new Minimatch(it, minimatchOptions))]));
337
+ return (file, stat) => {
338
+ if (filter(file, stat)) {
339
+ return true;
340
+ }
341
+ // a directory named with an excluded extension stays excluded
342
+ if (stat.isDirectory()) {
343
+ return false;
344
+ }
345
+ const extension = longestExcludedExtension(path.basename(file), reincludes.extensions);
346
+ const named = extension == null ? undefined : namedBy.get(extension);
347
+ if (named == null) {
348
+ return false;
349
+ }
350
+ const relative = path.relative(this.from, file).split(path.sep).join("/");
351
+ return named.some(it => it.match(relative)) && withoutExtensionGlob(file, stat);
352
+ };
271
353
  }
272
354
  toString() {
273
355
  return `from: ${this.from}, to: ${this.to}, patterns: ${this.patterns.join(", ")}`;
@@ -336,12 +418,18 @@ export function getMainFileMatchers(appDir, destination, macroExpander, platform
336
418
  }
337
419
  }
338
420
  patterns.splice(insertIndex, 0, ...customFirstPatterns);
339
- const reincludedDefaults = getReincludedDefaultExclusions(userSpecifiedPatterns);
421
+ const excludedExtensions = resolveExcludedExtensions(platformPackager.config, platformSpecificBuildOptions);
422
+ const reincludedDefaults = getReincludedDefaultExclusions(userSpecifiedPatterns, excludedExtensions);
340
423
  if (reincludedDefaults.length > 0) {
341
424
  // These files are kept out of the package by default; a user `files` pattern is opting them back in.
342
425
  log.warn({ files: reincludedDefaults.join(", ") }, "`files` configuration re-includes files that are excluded by default — verify this is intentional");
343
426
  }
344
- patterns.push(...getDefaultIgnoredPatterns(userSpecifiedPatterns, platformPackager.config.includePdb === true));
427
+ patterns.push(...getDefaultIgnoredPatterns(userSpecifiedPatterns, excludedExtensions));
428
+ const extensionGlob = excludedExtensionsGlob(excludedExtensions);
429
+ const namedBy = collectExtensionReincludes(userSpecifiedPatterns, excludedExtensions);
430
+ if (extensionGlob != null && namedBy.size > 0) {
431
+ matcher.extensionReincludes = { glob: extensionGlob, extensions: excludedExtensions, namedBy };
432
+ }
345
433
  const debugLogger = platformPackager.debugLogger;
346
434
  if (debugLogger.isEnabled) {
347
435
  //tslint:disable-next-line:no-invalid-template-strings
@@ -399,6 +487,7 @@ export function getNodeModuleFileMatcher(appDir, destination, macroExpander, pla
399
487
  // `files` is excluded: its `to` is only used for in-package (asar) relative math.
400
488
  const VALIDATED_DESTINATION_NAMES = ["extraFiles", "extraResources", "extraDistFiles"];
401
489
  const FPM_MAPPING_HINT = 'To install a file at an absolute path inside a deb/rpm package, use the fpm file-mapping syntax instead, e.g. "deb": { "fpm": ["build/file.xml=/usr/share/metainfo/file.xml"] }.';
490
+ const DESTINATION_DOCS = `See ${BUILD_CHANGES_URL}#extrafiles--extraresources-destinations-are-validated`;
402
491
  /**
403
492
  * Resolves a file set `to` to the destination a FileMatcher should copy into.
404
493
  *
@@ -422,14 +511,14 @@ export function resolveFileSetDestination(name, to, defaultDestination, globalOu
422
511
  // path.win32.isAbsolute also covers POSIX absolute paths, and treats drive-letter (C:\) and
423
512
  // UNC (\\server\share) paths as absolute no matter which OS the build runs on
424
513
  if (path.win32.isAbsolute(to) || path.posix.isAbsolute(to)) {
425
- throw new InvalidConfigurationError(`The "to" path "${to}" in "${name}" is absolute. Absolute destinations are not copied into the packaged app — they would be written to that literal path on the build machine. Use a relative path instead. ${FPM_MAPPING_HINT}`);
514
+ throw new InvalidConfigurationError(`The "to" path "${to}" in "${name}" is absolute. Absolute destinations are not copied into the packaged app — they would be written to that literal path on the build machine. Use a relative path instead. ${FPM_MAPPING_HINT} ${DESTINATION_DOCS}`);
426
515
  }
427
516
  // FileMatcher later converts all separators to path.sep, so normalize before resolving to make
428
517
  // sure `..\\..` segments written with backslashes are seen as parent hops here too
429
518
  const resolved = path.resolve(defaultDestination, to.replace(/[/\\]/g, path.sep));
430
519
  const relativeToOutDir = path.relative(path.resolve(globalOutDir), resolved);
431
520
  if (relativeToOutDir.startsWith(`..${path.sep}`) || relativeToOutDir === ".." || path.isAbsolute(relativeToOutDir)) {
432
- throw new InvalidConfigurationError(`The "to" path "${to}" in "${name}" resolves to "${resolved}", which is outside the build output directory "${path.resolve(globalOutDir)}". The files would be copied onto the build machine instead of into the packaged app. Use a relative path that stays within the package. ${FPM_MAPPING_HINT}`);
521
+ throw new InvalidConfigurationError(`The "to" path "${to}" in "${name}" resolves to "${resolved}", which is outside the build output directory "${path.resolve(globalOutDir)}". The files would be copied onto the build machine instead of into the packaged app. Use a relative path that stays within the package. ${FPM_MAPPING_HINT} ${DESTINATION_DOCS}`);
433
522
  }
434
523
  return resolved;
435
524
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fileMatcher.js","sourceRoot":"","sources":["../src/fileMatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,OAAO,EACP,cAAc,EAId,yBAAyB,EACzB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,CAAC,CAAA;gBAC/D,MAAM,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;gBAC9B,OAAO,MAAM,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAA;YAC1E,CAAC;YAED,MAAM,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;YACpC,OAAO,MAAM,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAA;QACjE,CAAC;QAED,IAAI,OAAO,CAAC,OAAO,EAAE,IAAI,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;YACtD,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;QAChC,CAAC;QACD,GAAG,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,EAAE,6BAA6B,CAAC,CAAA;QACrD,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE;YAC7C,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE;YAC9B,WAAW;YACX,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI;YACpD,eAAe;YACf,mBAAmB,EAAE,WAAW,EAAE,mBAAmB;YACrD,aAAa,EAAE,WAAW,EAAE,aAAa;SAC1C,CAAC,CAAA;IACJ,CAAC,CAAC,CACH,CAAA;AACH,CAAC","sourcesContent":["import {\n asArray,\n copyDir,\n copyOrLinkFile,\n ExternalLinkPolicy,\n FileTransformer,\n Filter,\n InvalidConfigurationError,\n isPathWithin,\n log,\n statOrNull,\n USE_HARD_LINKS,\n WriteContainment,\n} from \"builder-util\"\nimport { Nullish } from \"builder-util-runtime\"\nimport { Minimatch } from \"minimatch\"\nimport * as path from \"path\"\nimport type { Configuration } from \"./configuration.js\"\nimport type { Packager } from \"./packager.js\"\nimport { FileSet, PlatformSpecificBuildOptions } from \"./options/PlatformSpecificBuildOptions.js\"\nimport { PlatformPackager } from \"./platformPackager.js\"\nimport { createFilter, hasMagic } from \"./util/filter.js\"\n\n// https://github.com/electron-userland/electron-builder/issues/733\nconst minimatchOptions = { dot: true }\n\n// noinspection SpellCheckingInspection\n// File/dir names excluded by default from the packaged app. A `files` entry may opt any of these\n// back in (see collectExplicitReincludes / getDefaultIgnoredPatterns).\nexport const DEFAULT_EXCLUDED_NAMES: ReadonlyArray<string> = [\n \".git\",\n \".hg\",\n \".svn\",\n \"CVS\",\n \"RCS\",\n \"SCCS\",\n \"__pycache__\",\n \".DS_Store\",\n \"thumbs.db\",\n \".gitignore\",\n \".gitkeep\",\n \".gitattributes\",\n \".npmignore\",\n \".idea\",\n \".vs\",\n \".flowconfig\",\n \".jshintrc\",\n \".eslintrc\",\n \".circleci\",\n \".yarn-integrity\",\n \".yarn-metadata.json\",\n \"yarn-error.log\",\n \"yarn.lock\",\n \"package-lock.json\",\n \"npm-debug.log\",\n \"pnpm-lock.yaml\",\n \"bun.lock\",\n \"bun.lockb\",\n \"appveyor.yml\",\n \".travis.yml\",\n \"circle.yml\",\n \".nyc_output\",\n \".husky\",\n \".github\",\n \"electron-builder.env\",\n]\n\n// File extensions (without leading dot) excluded by default from the packaged app.\nexport const DEFAULT_EXCLUDED_EXTENSIONS: ReadonlyArray<string> = [\n \"iml\",\n \"hprof\",\n \"orig\",\n \"pyc\",\n \"pyo\",\n \"rbc\",\n \"swp\",\n \"csproj\",\n \"sln\",\n \"slnx\",\n \"suo\",\n \"xproj\",\n \"cc\",\n \"d.ts\",\n // https://github.com/electron-userland/electron-builder/issues/7512\n \"mk\",\n \"a\",\n \"o\",\n \"obj\",\n \"forge-meta\",\n]\n\n// Hard cap on the number of strings a single pattern may expand to. Real opt-in patterns expand to a\n// handful (`{obj,gltf,glb}`); this bound makes the expansion provably finite so a pathological pattern\n// (e.g. nested or many large `{...}` groups whose product is huge) degrades to \"treated literally\"\n// rather than hanging/OOM-ing the build. minimatch performs the authoritative expansion downstream.\nconst MAX_BRACE_EXPANSIONS = 64\n\n// Expands `{a,b,c}` brace alternations in a pattern, honoring nesting. Returns the value unchanged\n// when it has no braces or would expand beyond MAX_BRACE_EXPANSIONS. Used only to detect which\n// extensions/names a `files` entry references — not for matching.\nfunction expandBraces(value: string): Array<string> {\n const open = value.indexOf(\"{\")\n if (open === -1) {\n return [value]\n }\n // Find the `}` that closes the first `{`, accounting for nested braces.\n let depth = 0\n let close = -1\n for (let i = open; i < value.length; i++) {\n if (value[i] === \"{\") {\n depth++\n } else if (value[i] === \"}\" && --depth === 0) {\n close = i\n break\n }\n }\n if (close === -1) {\n return [value]\n }\n\n const prefix = value.slice(0, open)\n const suffix = value.slice(close + 1)\n const result: Array<string> = []\n for (const alternative of splitTopLevel(value.slice(open + 1, close))) {\n for (const expanded of expandBraces(`${prefix}${alternative}${suffix}`)) {\n if (result.length >= MAX_BRACE_EXPANSIONS) {\n return [value]\n }\n result.push(expanded)\n }\n }\n return result\n}\n\n// Splits on commas that are not inside a nested brace group, so `a,{b,c}` yields [\"a\", \"{b,c}\"].\nfunction splitTopLevel(value: string): Array<string> {\n const parts: Array<string> = []\n let depth = 0\n let start = 0\n for (let i = 0; i < value.length; i++) {\n const ch = value[i]\n if (ch === \"{\") {\n depth++\n } else if (ch === \"}\") {\n depth--\n } else if (ch === \",\" && depth === 0) {\n parts.push(value.slice(start, i))\n start = i + 1\n }\n }\n parts.push(value.slice(start))\n return parts\n}\n\n/**\n * Determines which default-excluded extensions and names a user has explicitly opted back in to via\n * their `files` patterns, so the corresponding defaults are not re-applied.\n *\n * A default is treated as opted back in only when a non-negated pattern references it concretely:\n * an extension when a pattern's basename ends with `.<ext>` (e.g. `**\\/*.obj`, `assets/*.{obj,gltf}`,\n * `**\\/*.d.ts`); a name when any path segment equals it (e.g. `**\\/.github/**`, `**\\/yarn.lock`).\n * Broad patterns such as `**\\/*` reference nothing concrete and therefore opt nothing in.\n */\nexport function collectExplicitReincludes(patterns: ReadonlyArray<string>): { extensions: Set<string>; names: Set<string> } {\n const segments = new Set<string>()\n const basenames: Array<string> = []\n for (const pattern of patterns) {\n if (pattern.startsWith(\"!\")) {\n continue\n }\n for (const expanded of expandBraces(pattern)) {\n const parts = expanded.split(\"/\")\n for (const part of parts) {\n segments.add(part)\n }\n basenames.push(parts[parts.length - 1])\n }\n }\n\n const extensions = new Set(DEFAULT_EXCLUDED_EXTENSIONS.filter(ext => basenames.some(name => name.endsWith(`.${ext}`))))\n const names = new Set(DEFAULT_EXCLUDED_NAMES.filter(name => segments.has(name)))\n return { extensions, names }\n}\n\n/**\n * Builds the trailing list of default ignore globs appended to the main app file matcher. Extensions\n * and names the user has explicitly re-included (see {@link collectExplicitReincludes}) are omitted,\n * so a `files` entry like `**\\/*.obj` overrides the matching built-in exclusion.\n */\nexport function getDefaultIgnoredPatterns(userPatterns: ReadonlyArray<string>, includePdb: boolean): Array<string> {\n const reincluded = collectExplicitReincludes(userPatterns)\n\n const extensions = DEFAULT_EXCLUDED_EXTENSIONS.filter(ext => !reincluded.extensions.has(ext))\n if (!includePdb) {\n extensions.push(\"pdb\")\n }\n const names = DEFAULT_EXCLUDED_NAMES.filter(name => !reincluded.names.has(name))\n\n const patterns: Array<string> = []\n // minimatch does not expand a single-member brace (`{x}` is matched literally), so emit a bare\n // glob when only one extension/name survives the opt-in filtering.\n if (extensions.length === 1) {\n patterns.push(`!**/*.${extensions[0]}`)\n } else if (extensions.length > 1) {\n patterns.push(`!**/*.{${extensions.join(\",\")}}`)\n }\n patterns.push(\"!**/._*\")\n patterns.push(\"!**/electron-builder.{yaml,yml,json,json5,toml,ts}\")\n if (names.length === 1) {\n patterns.push(`!**/${names[0]}`)\n } else if (names.length > 1) {\n patterns.push(`!**/{${names.join(\",\")}}`)\n }\n patterns.push(\"!.yarn{,/**/*}\")\n // https://github.com/electron-userland/electron-builder/issues/1969\n // exclude only for app root, use .yarnclean to clean node_modules\n patterns.push(\"!.editorconfig\")\n patterns.push(\"!.yarnrc.yml\")\n return patterns\n}\n\n/**\n * Returns the default-excluded names/extensions that the given `files` patterns opt back in, formatted\n * for display (extensions as `*.<ext>`, names verbatim). Empty when nothing default-excluded is\n * re-included. Used to warn that files normally kept out of the package will now be included.\n */\nexport function getReincludedDefaultExclusions(patterns: ReadonlyArray<string>): Array<string> {\n const reincluded = collectExplicitReincludes(patterns)\n return [...[...reincluded.extensions].map(ext => `*.${ext}`), ...reincluded.names]\n}\n\nfunction ensureNoEndSlash(file: string): string {\n if (path.sep !== \"/\") {\n file = file.replace(/\\//g, path.sep)\n }\n if (path.sep !== \"\\\\\") {\n file = file.replace(/\\\\/g, path.sep)\n }\n\n if (file.endsWith(path.sep)) {\n return file.substring(0, file.length - 1)\n } else {\n return file\n }\n}\n\nexport class FileMatcher {\n readonly from: string\n readonly to: string\n\n readonly patterns: Array<string>\n\n excludePatterns: Array<Minimatch> | null = null\n\n readonly isSpecifiedAsEmptyArray: boolean\n\n constructor(\n from: string,\n to: string,\n readonly macroExpander: (pattern: string) => string,\n patterns?: Array<string> | string | null\n ) {\n this.from = ensureNoEndSlash(macroExpander(from))\n this.to = ensureNoEndSlash(macroExpander(to))\n this.patterns = asArray(patterns).map(it => this.normalizePattern(it))\n this.isSpecifiedAsEmptyArray = Array.isArray(patterns) && patterns.length === 0\n }\n\n normalizePattern(pattern: string) {\n if (pattern.startsWith(\"./\")) {\n pattern = pattern.substring(\"./\".length)\n }\n return path.posix.normalize(this.macroExpander(pattern.replace(/\\\\/g, \"/\")))\n }\n\n addPattern(pattern: string) {\n this.patterns.push(this.normalizePattern(pattern))\n }\n\n prependPattern(pattern: string) {\n this.patterns.unshift(this.normalizePattern(pattern))\n }\n\n isEmpty() {\n return this.patterns.length === 0\n }\n\n containsOnlyIgnore(): boolean {\n return !this.isEmpty() && this.patterns.find(it => !it.startsWith(\"!\")) == null\n }\n\n computeParsedPatterns(result: Array<Minimatch>, fromDir?: string): void {\n const relativeFrom = fromDir == null ? null : path.relative(fromDir, this.from)\n\n if (this.patterns.length === 0 && relativeFrom != null) {\n // file mappings, from here is a file\n result.push(new Minimatch(relativeFrom, minimatchOptions))\n return\n }\n\n for (let pattern of this.patterns) {\n if (relativeFrom != null) {\n pattern = path.join(relativeFrom, pattern)\n }\n\n const parsedPattern = new Minimatch(pattern, minimatchOptions)\n result.push(parsedPattern)\n\n // do not add if contains dot (possibly file if has extension)\n if (!pattern.includes(\".\") && !hasMagic(parsedPattern)) {\n // https://github.com/electron-userland/electron-builder/issues/545\n // add **/*\n result.push(new Minimatch(`${pattern}/**/*`, minimatchOptions))\n }\n }\n }\n\n createFilter(): Filter {\n const parsedPatterns: Array<Minimatch> = []\n this.computeParsedPatterns(parsedPatterns)\n return createFilter(this.from, parsedPatterns, this.excludePatterns)\n }\n\n toString() {\n return `from: ${this.from}, to: ${this.to}, patterns: ${this.patterns.join(\", \")}`\n }\n}\n\n/** @internal */\nexport function getMainFileMatchers(\n appDir: string,\n destination: string,\n macroExpander: (pattern: string) => string,\n platformSpecificBuildOptions: PlatformSpecificBuildOptions,\n platformPackager: PlatformPackager<any>,\n outDir: string\n): Array<FileMatcher> {\n const buildResourceDir = path.resolve(platformPackager.projectDir, platformPackager.buildResourcesDir)\n\n let matchers = platformPackager.isPrepackedAppAsar\n ? null\n : getFileMatchers(platformPackager.config, \"files\", destination, {\n macroExpander,\n customBuildOptions: platformSpecificBuildOptions,\n globalOutDir: outDir,\n defaultSrc: appDir,\n })\n if (matchers == null) {\n matchers = [new FileMatcher(appDir, destination, macroExpander)]\n }\n\n const matcher = matchers[0]\n // add default patterns, but only if from equals to app dir\n if (matcher.from !== appDir) {\n return matchers\n }\n\n // https://github.com/electron-userland/electron-builder/issues/1741#issuecomment-311111418 so, do not use inclusive patterns\n const patterns = matcher.patterns\n\n // Snapshot the user-specified patterns before the default/auto patterns are injected so a `files`\n // entry can opt back in to a default-excluded extension/name (see getDefaultIgnoredPatterns).\n const userSpecifiedPatterns = patterns.slice()\n\n const customFirstPatterns: Array<string> = []\n // electron-webpack - we need to copy only package.json and node_modules from root dir (and these files are added by default), so, explicit empty array is specified\n if (!matcher.isSpecifiedAsEmptyArray && (matcher.isEmpty() || matcher.containsOnlyIgnore())) {\n customFirstPatterns.push(\"**/*\")\n } else if (!patterns.includes(\"package.json\")) {\n patterns.push(\"package.json\")\n }\n\n let insertExculdeNodeModulesIndex = -1\n for (let i = 0; i < patterns.length; i++) {\n if (!patterns[i].startsWith(\"!\") && (patterns[i].includes(\"/node_modules\") || patterns[i].includes(\"node_modules/\"))) {\n insertExculdeNodeModulesIndex = i\n break\n }\n }\n\n if (insertExculdeNodeModulesIndex !== -1) {\n patterns.splice(insertExculdeNodeModulesIndex, 0, ...[\"!**/node_modules/**\"])\n } else {\n customFirstPatterns.push(\"!**/node_modules/**\")\n }\n\n // https://github.com/electron-userland/electron-builder/issues/1482\n const relativeBuildResourceDir = path.relative(matcher.from, buildResourceDir)\n if (relativeBuildResourceDir.length !== 0 && !relativeBuildResourceDir.startsWith(\".\")) {\n customFirstPatterns.push(`!${relativeBuildResourceDir}{,/**/*}`)\n }\n\n const relativeOutDir = matcher.normalizePattern(path.relative(platformPackager.projectDir, outDir))\n if (!relativeOutDir.startsWith(\".\")) {\n customFirstPatterns.push(`!${relativeOutDir}{,/**/*}`)\n }\n\n // add our default exclusions after last user possibly defined \"all\"/permissive pattern\n let insertIndex = 0\n for (let i = patterns.length - 1; i >= 0; i--) {\n if (patterns[i].startsWith(\"**/\")) {\n insertIndex = i + 1\n break\n }\n }\n patterns.splice(insertIndex, 0, ...customFirstPatterns)\n\n const reincludedDefaults = getReincludedDefaultExclusions(userSpecifiedPatterns)\n if (reincludedDefaults.length > 0) {\n // These files are kept out of the package by default; a user `files` pattern is opting them back in.\n log.warn({ files: reincludedDefaults.join(\", \") }, \"`files` configuration re-includes files that are excluded by default — verify this is intentional\")\n }\n\n patterns.push(...getDefaultIgnoredPatterns(userSpecifiedPatterns, platformPackager.config.includePdb === true))\n\n const debugLogger = platformPackager.debugLogger\n if (debugLogger.isEnabled) {\n //tslint:disable-next-line:no-invalid-template-strings\n debugLogger.add(`${macroExpander(\"${arch}\")}.firstOrDefaultFilePatterns`, patterns)\n }\n return matchers\n}\n\n/** @internal */\nexport function getNodeModuleFileMatcher(\n appDir: string,\n destination: string,\n macroExpander: (pattern: string) => string,\n platformSpecificBuildOptions: PlatformSpecificBuildOptions,\n packager: Packager\n): FileMatcher {\n // https://github.com/electron-userland/electron-builder/pull/2948#issuecomment-392241632\n // grab only excludes\n const matcher = new FileMatcher(appDir, destination, macroExpander)\n\n function addPatterns(patterns: Array<string | FileSet> | string | Nullish | FileSet) {\n if (patterns == null) {\n return\n } else if (!Array.isArray(patterns)) {\n if (typeof patterns === \"string\" && patterns.startsWith(\"!\")) {\n matcher.addPattern(patterns)\n return\n }\n // ignore object form\n return\n }\n\n for (const pattern of patterns) {\n if (typeof pattern === \"string\") {\n if (pattern.startsWith(\"!\")) {\n matcher.addPattern(pattern)\n }\n } else {\n const fileSet = pattern\n if (fileSet.from == null || fileSet.from === \".\") {\n for (const p of asArray(fileSet.filter)) {\n matcher.addPattern(p)\n }\n }\n }\n }\n }\n\n addPatterns(packager.config.fileOptions?.files)\n addPatterns(platformSpecificBuildOptions.fileOptions?.files)\n\n if (!matcher.isEmpty()) {\n matcher.prependPattern(\"**/*\")\n }\n\n const debugLogger = packager.debugLogger\n if (debugLogger.isEnabled) {\n //tslint:disable-next-line:no-invalid-template-strings\n debugLogger.add(`${macroExpander(\"${arch}\")}.nodeModuleFilePatterns`, matcher.patterns)\n }\n\n return matcher\n}\n\nexport interface GetFileMatchersOptions {\n readonly macroExpander: (pattern: string) => string\n readonly customBuildOptions: PlatformSpecificBuildOptions\n readonly globalOutDir: string\n\n readonly defaultSrc: string\n}\n\n// The names whose file sets are physically copied into the build output directory, so a `to` that\n// resolves outside of it writes onto the build machine itself (https://github.com/electron-userland/electron-builder/issues/1993).\n// `files` is excluded: its `to` is only used for in-package (asar) relative math.\nconst VALIDATED_DESTINATION_NAMES: ReadonlyArray<string> = [\"extraFiles\", \"extraResources\", \"extraDistFiles\"]\n\nconst FPM_MAPPING_HINT =\n 'To install a file at an absolute path inside a deb/rpm package, use the fpm file-mapping syntax instead, e.g. \"deb\": { \"fpm\": [\"build/file.xml=/usr/share/metainfo/file.xml\"] }.'\n\n/**\n * Resolves a file set `to` to the destination a FileMatcher should copy into.\n *\n * - A missing `to` falls back to `defaultDestination`.\n * - For file sets that are physically copied into the build output directory\n * (see {@link VALIDATED_DESTINATION_NAMES}), the result is validated to stay inside it:\n * absolute `to` values (POSIX, Windows drive-letter, or UNC — files would be copied to that\n * literal path on the build machine) and relative values that escape `globalOutDir`\n * (e.g. `../../usr/share`) throw. Relative hops that stay inside the build output directory\n * (e.g. `to: \"../Frameworks\"` from `Contents/Resources` on macOS) remain valid.\n * - `files` sets are exempt from validation: their `to` only participates in in-package (asar)\n * relative math, so it is plainly resolved against `defaultDestination`.\n */\nexport function resolveFileSetDestination(name: string, to: string | Nullish, defaultDestination: string, globalOutDir: string): string {\n if (to == null) {\n return defaultDestination\n }\n\n if (!VALIDATED_DESTINATION_NAMES.includes(name)) {\n return path.resolve(defaultDestination, to)\n }\n\n // path.win32.isAbsolute also covers POSIX absolute paths, and treats drive-letter (C:\\) and\n // UNC (\\\\server\\share) paths as absolute no matter which OS the build runs on\n if (path.win32.isAbsolute(to) || path.posix.isAbsolute(to)) {\n throw new InvalidConfigurationError(\n `The \"to\" path \"${to}\" in \"${name}\" is absolute. Absolute destinations are not copied into the packaged app — they would be written to that literal path on the build machine. Use a relative path instead. ${FPM_MAPPING_HINT}`\n )\n }\n\n // FileMatcher later converts all separators to path.sep, so normalize before resolving to make\n // sure `..\\\\..` segments written with backslashes are seen as parent hops here too\n const resolved = path.resolve(defaultDestination, to.replace(/[/\\\\]/g, path.sep))\n const relativeToOutDir = path.relative(path.resolve(globalOutDir), resolved)\n if (relativeToOutDir.startsWith(`..${path.sep}`) || relativeToOutDir === \"..\" || path.isAbsolute(relativeToOutDir)) {\n throw new InvalidConfigurationError(\n `The \"to\" path \"${to}\" in \"${name}\" resolves to \"${resolved}\", which is outside the build output directory \"${path.resolve(globalOutDir)}\". The files would be copied onto the build machine instead of into the packaged app. Use a relative path that stays within the package. ${FPM_MAPPING_HINT}`\n )\n }\n return resolved\n}\n\nexport function getFileMatchers(\n config: Configuration,\n name: \"files\" | \"extraFiles\" | \"extraResources\" | \"extraDistFiles\",\n defaultDestination: string,\n options: GetFileMatchersOptions\n): Array<FileMatcher> | null {\n const defaultMatcher = new FileMatcher(options.defaultSrc, defaultDestination, options.macroExpander)\n const fileMatchers: Array<FileMatcher> = []\n\n function addPatterns(patterns: Array<string | FileSet> | string | Nullish | FileSet) {\n if (patterns == null) {\n return\n } else if (!Array.isArray(patterns)) {\n if (typeof patterns === \"string\") {\n defaultMatcher.addPattern(patterns)\n return\n }\n patterns = [patterns]\n }\n\n for (const pattern of patterns) {\n if (typeof pattern === \"string\") {\n // use normalize to transform ./foo to foo\n defaultMatcher.addPattern(pattern)\n } else {\n const from = pattern.from == null ? options.defaultSrc : path.resolve(options.defaultSrc, pattern.from)\n const to = resolveFileSetDestination(name, pattern.to, defaultDestination, options.globalOutDir)\n fileMatchers.push(new FileMatcher(from, to, options.macroExpander, pattern.filter))\n }\n }\n }\n\n // `extraDistFiles` is a mac option of its own; the others are read from `fileOptions`, into which flat keys are\n // normalized when the configuration is loaded (see util/config/fileOptions.ts)\n if (name === \"extraDistFiles\") {\n addPatterns((options.customBuildOptions as any).extraDistFiles)\n } else {\n addPatterns(config.fileOptions?.[name])\n addPatterns(options.customBuildOptions.fileOptions?.[name])\n }\n\n if (!defaultMatcher.isEmpty()) {\n // default matcher should be first in the array\n fileMatchers.unshift(defaultMatcher)\n }\n\n // we cannot exclude the whole out dir, because sometimes users want to use some file in the out dir in the patterns\n const relativeOutDir = defaultMatcher.normalizePattern(path.relative(options.defaultSrc, options.globalOutDir))\n if (!relativeOutDir.startsWith(\".\")) {\n defaultMatcher.addPattern(`!${relativeOutDir}/*-unpacked{,/**/*}`)\n }\n\n return fileMatchers.length === 0 ? null : fileMatchers\n}\n\n/** Where {@link copyFiles} may write, and where a copied symlink may lead. */\nexport interface CopyFilesContainment {\n /**\n * The output directories the matchers copy into, most specific first (e.g. the app output directory, then the output directory).\n * Each matcher is confined, by real path, to the first one its destination is in.\n */\n readonly roots: ReadonlyArray<string>\n /** Besides the root, the directories a copied symlink may lead into, such as the workspace root and the package-manager store. */\n readonly allowedSymlinkRoots?: ReadonlyArray<string> | null\n /** The `fileOptions.allowExternalLinks` build option: a copied symlink that leads anywhere else is kept when it allows it. */\n readonly externalLinks?: ExternalLinkPolicy | null\n}\n\nfunction containmentRootFor(destination: string, containment: CopyFilesContainment | Nullish): string {\n return containment?.roots.find(root => isPathWithin(path.resolve(root), path.resolve(destination))) ?? destination\n}\n\n/** @internal */\nexport function copyFiles(\n matchers: Array<FileMatcher> | null,\n transformer: FileTransformer | null,\n isUseHardLink?: boolean,\n containment?: CopyFilesContainment | null\n): Promise<any> {\n if (matchers == null || matchers.length === 0) {\n return Promise.resolve()\n }\n\n return Promise.all(\n matchers.map(async (matcher: FileMatcher) => {\n const fromStat = await statOrNull(matcher.from)\n if (fromStat == null) {\n log.warn({ from: matcher.from }, `file source doesn't exist`)\n return\n }\n\n const containmentRoot = containmentRootFor(matcher.to, containment)\n if (fromStat.isFile()) {\n const writes = new WriteContainment(containmentRoot, \"copied file\")\n const toStat = await statOrNull(matcher.to)\n // https://github.com/electron-userland/electron-builder/issues/1245\n if (toStat != null && toStat.isDirectory()) {\n const dest = path.join(matcher.to, path.basename(matcher.from))\n await writes.prepareFile(dest)\n return await copyOrLinkFile(matcher.from, dest, fromStat, isUseHardLink)\n }\n\n await writes.prepareFile(matcher.to)\n return await copyOrLinkFile(matcher.from, matcher.to, fromStat)\n }\n\n if (matcher.isEmpty() || matcher.containsOnlyIgnore()) {\n matcher.prependPattern(\"**/*\")\n }\n log.debug({ matcher }, \"copying files using pattern\")\n return await copyDir(matcher.from, matcher.to, {\n filter: matcher.createFilter(),\n transformer,\n isUseHardLink: isUseHardLink ? USE_HARD_LINKS : null,\n containmentRoot,\n allowedSymlinkRoots: containment?.allowedSymlinkRoots,\n externalLinks: containment?.externalLinks,\n })\n })\n )\n}\n"]}
1
+ {"version":3,"file":"fileMatcher.js","sourceRoot":"","sources":["../src/fileMatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,OAAO,EACP,cAAc,EAId,yBAAyB,EACzB,YAAY,EACZ,GAAG,EACH,UAAU,EACV,cAAc,EACd,gBAAgB,GACjB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAElF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAI5B,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAA;AAE1E,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAElE,mEAAmE;AACnE,MAAM,gBAAgB,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAA;AAEtC,uCAAuC;AACvC,iGAAiG;AACjG,uEAAuE;AACvE,MAAM,CAAC,MAAM,sBAAsB,GAA0B;IAC3D,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,MAAM;IACN,aAAa;IACb,WAAW;IACX,WAAW;IACX,YAAY;IACZ,UAAU;IACV,gBAAgB;IAChB,YAAY;IACZ,OAAO;IACP,KAAK;IACL,aAAa;IACb,WAAW;IACX,WAAW;IACX,WAAW;IACX,iBAAiB;IACjB,qBAAqB;IACrB,gBAAgB;IAChB,WAAW;IACX,mBAAmB;IACnB,eAAe;IACf,gBAAgB;IAChB,UAAU;IACV,WAAW;IACX,cAAc;IACd,aAAa;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A;QACrD,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE;YAC7C,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE;YAC9B,WAAW;YACX,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI;YACpD,eAAe;YACf,mBAAmB,EAAE,WAAW,EAAE,mBAAmB;YACrD,aAAa,EAAE,WAAW,EAAE,aAAa;SAC1C,CAAC,CAAA;IACJ,CAAC,CAAC,CACH,CAAA;AACH,CAAC","sourcesContent":["import {\n asArray,\n copyDir,\n copyOrLinkFile,\n ExternalLinkPolicy,\n FileTransformer,\n Filter,\n InvalidConfigurationError,\n isPathWithin,\n log,\n statOrNull,\n USE_HARD_LINKS,\n WriteContainment,\n} from \"builder-util\"\nimport { DEFAULT_KEYWORD, resolveDefaultKeywordList } from \"builder-util/internal\"\nimport { Nullish } from \"builder-util-runtime\"\nimport { Minimatch } from \"minimatch\"\nimport * as path from \"path\"\nimport type { Configuration } from \"./configuration.js\"\nimport type { Packager } from \"./packager.js\"\nimport { FileSet, PlatformSpecificBuildOptions } from \"./options/PlatformSpecificBuildOptions.js\"\nimport { normalizeExcludedExtensions } from \"./util/config/fileOptions.js\"\nimport { PlatformPackager } from \"./platformPackager.js\"\nimport { createFilter, hasMagic } from \"./util/filter.js\"\nimport { BUILD_CHANGES_URL } from \"./util/config/legacyOptions.js\"\n\n// https://github.com/electron-userland/electron-builder/issues/733\nconst minimatchOptions = { dot: true }\n\n// noinspection SpellCheckingInspection\n// File/dir names excluded by default from the packaged app. A `files` entry may opt any of these\n// back in (see collectExplicitReincludes / getDefaultIgnoredPatterns).\nexport const DEFAULT_EXCLUDED_NAMES: ReadonlyArray<string> = [\n \".git\",\n \".hg\",\n \".svn\",\n \"CVS\",\n \"RCS\",\n \"SCCS\",\n \"__pycache__\",\n \".DS_Store\",\n \"thumbs.db\",\n \".gitignore\",\n \".gitkeep\",\n \".gitattributes\",\n \".npmignore\",\n \".idea\",\n \".vs\",\n \".flowconfig\",\n \".jshintrc\",\n \".eslintrc\",\n \".circleci\",\n \".yarn-integrity\",\n \".yarn-metadata.json\",\n \"yarn-error.log\",\n \"yarn.lock\",\n \"package-lock.json\",\n \"npm-debug.log\",\n \"pnpm-lock.yaml\",\n \"bun.lock\",\n \"bun.lockb\",\n \"appveyor.yml\",\n \".travis.yml\",\n \"circle.yml\",\n \".nyc_output\",\n \".husky\",\n \".github\",\n \"electron-builder.env\",\n]\n\n// File extensions (without leading dot) excluded by default from the packaged app, the `\"default\"` entry of `fileOptions.excludedExts`.\nexport const DEFAULT_EXCLUDED_EXTENSIONS: ReadonlyArray<string> = [\n \"iml\",\n \"hprof\",\n \"orig\",\n \"pyc\",\n \"pyo\",\n \"rbc\",\n \"swp\",\n \"csproj\",\n \"sln\",\n \"slnx\",\n \"suo\",\n \"xproj\",\n \"cc\",\n \"d.ts\",\n // https://github.com/electron-userland/electron-builder/issues/7512\n \"mk\",\n \"a\",\n \"o\",\n \"obj\",\n \"forge-meta\",\n \"pdb\",\n]\n\n/**\n * The file extensions (without leading dot) excluded from the app files and the copied `node_modules`, from the\n * `fileOptions.excludedExts` build option: the platform-level value (`mac.fileOptions.excludedExts`, ...) when it is set,\n * otherwise the root one, otherwise `[\"default\"]`. See `FilesBuildOptions.excludedExts`.\n */\nexport function resolveExcludedExtensions(config: Pick<Configuration, \"fileOptions\">, platformOptions: PlatformSpecificBuildOptions | Nullish): Array<string> {\n const entries = platformOptions?.fileOptions?.excludedExts ?? config.fileOptions?.excludedExts ?? [DEFAULT_KEYWORD]\n // a \"!ext\" that removes nothing is reported by validateConfiguration, naming the section\n return resolveDefaultKeywordList(normalizeExcludedExtensions(entries), DEFAULT_EXCLUDED_EXTENSIONS).result\n}\n\n// Hard cap on the number of strings a single pattern may expand to. Real opt-in patterns expand to a\n// handful (`{obj,gltf,glb}`); this bound makes the expansion provably finite so a pathological pattern\n// (e.g. nested or many large `{...}` groups whose product is huge) degrades to \"treated literally\"\n// rather than hanging/OOM-ing the build. minimatch performs the authoritative expansion downstream.\nconst MAX_BRACE_EXPANSIONS = 64\n\n// Expands `{a,b,c}` brace alternations in a pattern, honoring nesting. Returns the value unchanged\n// when it has no braces or would expand beyond MAX_BRACE_EXPANSIONS. Used only to detect which\n// extensions/names a `files` entry references — not for matching.\nfunction expandBraces(value: string): Array<string> {\n const open = value.indexOf(\"{\")\n if (open === -1) {\n return [value]\n }\n // Find the `}` that closes the first `{`, accounting for nested braces.\n let depth = 0\n let close = -1\n for (let i = open; i < value.length; i++) {\n if (value[i] === \"{\") {\n depth++\n } else if (value[i] === \"}\" && --depth === 0) {\n close = i\n break\n }\n }\n if (close === -1) {\n return [value]\n }\n\n const prefix = value.slice(0, open)\n const suffix = value.slice(close + 1)\n const result: Array<string> = []\n for (const alternative of splitTopLevel(value.slice(open + 1, close))) {\n for (const expanded of expandBraces(`${prefix}${alternative}${suffix}`)) {\n if (result.length >= MAX_BRACE_EXPANSIONS) {\n return [value]\n }\n result.push(expanded)\n }\n }\n return result\n}\n\n// Splits on commas that are not inside a nested brace group, so `a,{b,c}` yields [\"a\", \"{b,c}\"].\nfunction splitTopLevel(value: string): Array<string> {\n const parts: Array<string> = []\n let depth = 0\n let start = 0\n for (let i = 0; i < value.length; i++) {\n const ch = value[i]\n if (ch === \"{\") {\n depth++\n } else if (ch === \"}\") {\n depth--\n } else if (ch === \",\" && depth === 0) {\n parts.push(value.slice(start, i))\n start = i + 1\n }\n }\n parts.push(value.slice(start))\n return parts\n}\n\n/**\n * Determines which excluded extensions (`excludedExtensions`, see {@link resolveExcludedExtensions}) and default-excluded\n * names a user has explicitly opted back in to via their `files` patterns: the extensions for the warning (the files a pattern\n * names are let through by {@link FileMatcher.extensionReincludes}), the names to leave out of the name exclusion glob.\n *\n * An exclusion is treated as opted back in only when a non-negated pattern references it concretely:\n * an extension when a pattern's basename ends with `.<ext>` (e.g. `**\\/*.obj`, `assets/*.{obj,gltf}`,\n * `**\\/*.d.ts`), only the longest such extension counting (`*.d.ts` names `d.ts`, not also a listed `ts`);\n * a name when any path segment equals it (e.g. `**\\/.github/**`, `**\\/yarn.lock`).\n * Broad patterns such as `**\\/*` reference nothing concrete and therefore opt nothing in.\n */\nexport function collectExplicitReincludes(\n patterns: ReadonlyArray<string>,\n excludedExtensions: ReadonlyArray<string> = DEFAULT_EXCLUDED_EXTENSIONS\n): { extensions: Set<string>; names: Set<string> } {\n const segments = new Set<string>()\n const namedExtensions = new Set<string>()\n for (const pattern of patterns) {\n if (pattern.startsWith(\"!\")) {\n continue\n }\n for (const expanded of expandBraces(pattern)) {\n const parts = expanded.split(\"/\")\n for (const part of parts) {\n segments.add(part)\n }\n const named = longestExcludedExtension(parts[parts.length - 1], excludedExtensions)\n if (named != null) {\n namedExtensions.add(named)\n }\n }\n }\n\n const extensions = new Set(excludedExtensions.filter(ext => namedExtensions.has(ext)))\n const names = new Set(DEFAULT_EXCLUDED_NAMES.filter(name => segments.has(name)))\n return { extensions, names }\n}\n\n/**\n * Builds the trailing list of default ignore globs appended to the main app file matcher: a glob that excludes every one of\n * `excludedExtensions` (see {@link resolveExcludedExtensions}), then the default-excluded names except those a `files` entry\n * re-includes (see {@link collectExplicitReincludes}) and the fixed ignores. The files a `files` entry names despite their\n * excluded extension are let through by {@link FileMatcher.extensionReincludes}, not by these patterns.\n */\nexport function getDefaultIgnoredPatterns(userPatterns: ReadonlyArray<string>, excludedExtensions: ReadonlyArray<string> = DEFAULT_EXCLUDED_EXTENSIONS): Array<string> {\n const reincludedNames = collectExplicitReincludes(userPatterns, excludedExtensions).names\n const names = DEFAULT_EXCLUDED_NAMES.filter(name => !reincludedNames.has(name))\n\n const patterns: Array<string> = []\n const extensionGlob = excludedExtensionsGlob(excludedExtensions)\n if (extensionGlob != null) {\n patterns.push(extensionGlob)\n }\n patterns.push(\"!**/._*\")\n patterns.push(\"!**/electron-builder.{yaml,yml,json,json5,toml,ts}\")\n // minimatch does not expand a single-member brace (`{x}` is matched literally), so emit a bare\n // glob when only one name is excluded.\n if (names.length === 1) {\n patterns.push(`!**/${names[0]}`)\n } else if (names.length > 1) {\n patterns.push(`!**/{${names.join(\",\")}}`)\n }\n patterns.push(\"!.yarn{,/**/*}\")\n // https://github.com/electron-userland/electron-builder/issues/1969\n // exclude only for app root, use .yarnclean to clean node_modules\n patterns.push(\"!.editorconfig\")\n patterns.push(\"!.yarnrc.yml\")\n return patterns\n}\n\n/** The glob that excludes `excludedExtensions` (a bare one for a single extension, since minimatch matches `{x}` literally), or null for none. */\nfunction excludedExtensionsGlob(excludedExtensions: ReadonlyArray<string>): string | null {\n if (excludedExtensions.length === 0) {\n return null\n }\n return excludedExtensions.length === 1 ? `!**/*.${excludedExtensions[0]}` : `!**/*.{${excludedExtensions.join(\",\")}}`\n}\n\n/** The longest of `excludedExtensions` that `name` ends with (`index.d.ts` → `d.ts`, not also a listed `ts`), or null. */\nfunction longestExcludedExtension(name: string, excludedExtensions: ReadonlyArray<string>): string | null {\n let result: string | null = null\n for (const ext of excludedExtensions) {\n if (name.endsWith(`.${ext}`) && (result == null || ext.length > result.length)) {\n result = ext\n }\n }\n return result\n}\n\n/**\n * Per excluded extension, the `files` patterns that name it: each brace-expanded alternative of a non-negated pattern whose basename\n * ends with that extension (the longest one, see {@link longestExcludedExtension}). An alternative of `native/{**\\/*,addon.pdb}`\n * without such an extension names nothing. An alternative that still holds braces (a pattern too large to expand, or a literal brace)\n * is recorded whole: an extension cannot hold a brace, so the extension it ends with follows its last brace and every alternative minimatch\n * expands it to ends with it.\n */\nfunction collectExtensionReincludes(patterns: ReadonlyArray<string>, excludedExtensions: ReadonlyArray<string>): Map<string, Array<string>> {\n const result = new Map<string, Array<string>>()\n for (const pattern of patterns) {\n if (pattern.startsWith(\"!\")) {\n continue\n }\n for (const expanded of expandBraces(pattern)) {\n const extension = longestExcludedExtension(expanded.substring(expanded.lastIndexOf(\"/\") + 1), excludedExtensions)\n if (extension != null) {\n result.set(extension, [...(result.get(extension) ?? []), expanded])\n }\n }\n }\n return result\n}\n\n/**\n * Lets through the files a `files` pattern names despite their excluded extension (see getMainFileMatchers): the extension glob\n * excludes every file with an excluded extension, and such a file is included only when a pattern that names its extension matches\n * it and the matcher's other patterns (`node_modules` and the build resources and output directories, `files` negations) include it.\n */\nexport interface ExtensionReincludes {\n /** The pattern of the matcher that excludes the extensions. */\n readonly glob: string\n readonly extensions: ReadonlyArray<string>\n /** Per excluded extension, the `files` patterns that name it (see {@link collectExtensionReincludes}). */\n readonly namedBy: ReadonlyMap<string, ReadonlyArray<string>>\n}\n\n/**\n * Returns the default-excluded names/extensions that the given `files` patterns opt back in, formatted\n * for display (extensions as `*.<ext>`, names verbatim). Empty when nothing default-excluded is\n * re-included. Used to warn that files normally kept out of the package will now be included.\n */\nexport function getReincludedDefaultExclusions(patterns: ReadonlyArray<string>, excludedExtensions: ReadonlyArray<string> = DEFAULT_EXCLUDED_EXTENSIONS): Array<string> {\n const reincluded = collectExplicitReincludes(patterns, excludedExtensions)\n return [...[...reincluded.extensions].map(ext => `*.${ext}`), ...reincluded.names]\n}\n\nfunction ensureNoEndSlash(file: string): string {\n if (path.sep !== \"/\") {\n file = file.replace(/\\//g, path.sep)\n }\n if (path.sep !== \"\\\\\") {\n file = file.replace(/\\\\/g, path.sep)\n }\n\n if (file.endsWith(path.sep)) {\n return file.substring(0, file.length - 1)\n } else {\n return file\n }\n}\n\nexport class FileMatcher {\n readonly from: string\n readonly to: string\n\n readonly patterns: Array<string>\n\n excludePatterns: Array<Minimatch> | null = null\n\n /** The files a `files` pattern names despite their excluded extension, which the filter lets through the extension glob. */\n extensionReincludes: ExtensionReincludes | null = null\n\n readonly isSpecifiedAsEmptyArray: boolean\n\n constructor(\n from: string,\n to: string,\n readonly macroExpander: (pattern: string) => string,\n patterns?: Array<string> | string | null\n ) {\n this.from = ensureNoEndSlash(macroExpander(from))\n this.to = ensureNoEndSlash(macroExpander(to))\n this.patterns = asArray(patterns).map(it => this.normalizePattern(it))\n this.isSpecifiedAsEmptyArray = Array.isArray(patterns) && patterns.length === 0\n }\n\n normalizePattern(pattern: string) {\n if (pattern.startsWith(\"./\")) {\n pattern = pattern.substring(\"./\".length)\n }\n return path.posix.normalize(this.macroExpander(pattern.replace(/\\\\/g, \"/\")))\n }\n\n addPattern(pattern: string) {\n this.patterns.push(this.normalizePattern(pattern))\n }\n\n prependPattern(pattern: string) {\n this.patterns.unshift(this.normalizePattern(pattern))\n }\n\n isEmpty() {\n return this.patterns.length === 0\n }\n\n containsOnlyIgnore(): boolean {\n return !this.isEmpty() && this.patterns.find(it => !it.startsWith(\"!\")) == null\n }\n\n computeParsedPatterns(result: Array<Minimatch>, fromDir?: string, patterns: ReadonlyArray<string> = this.patterns): void {\n const relativeFrom = fromDir == null ? null : path.relative(fromDir, this.from)\n\n if (patterns.length === 0 && relativeFrom != null) {\n // file mappings, from here is a file\n result.push(new Minimatch(relativeFrom, minimatchOptions))\n return\n }\n\n for (let pattern of patterns) {\n if (relativeFrom != null) {\n pattern = path.join(relativeFrom, pattern)\n }\n\n const parsedPattern = new Minimatch(pattern, minimatchOptions)\n result.push(parsedPattern)\n\n // do not add if contains dot (possibly file if has extension)\n if (!pattern.includes(\".\") && !hasMagic(parsedPattern)) {\n // https://github.com/electron-userland/electron-builder/issues/545\n // add **/*\n result.push(new Minimatch(`${pattern}/**/*`, minimatchOptions))\n }\n }\n }\n\n createFilter(): Filter {\n const parsedPatterns: Array<Minimatch> = []\n this.computeParsedPatterns(parsedPatterns)\n const filter = createFilter(this.from, parsedPatterns, this.excludePatterns)\n const reincludes = this.extensionReincludes\n if (reincludes == null) {\n return filter\n }\n\n // only the glob getMainFileMatchers appended (the last one): a `files` negation with the same text still applies\n const globIndex = this.patterns.lastIndexOf(reincludes.glob)\n const withoutGlob = this.patterns.filter((_, index) => index !== globIndex)\n const otherPatterns: Array<Minimatch> = []\n this.computeParsedPatterns(otherPatterns, undefined, withoutGlob)\n const withoutExtensionGlob = createFilter(this.from, otherPatterns, this.excludePatterns)\n const namedBy = new Map([...reincludes.namedBy].map(([extension, patterns]) => [extension, patterns.map(it => new Minimatch(it, minimatchOptions))]))\n return (file, stat) => {\n if (filter(file, stat)) {\n return true\n }\n // a directory named with an excluded extension stays excluded\n if (stat.isDirectory()) {\n return false\n }\n const extension = longestExcludedExtension(path.basename(file), reincludes.extensions)\n const named = extension == null ? undefined : namedBy.get(extension)\n if (named == null) {\n return false\n }\n const relative = path.relative(this.from, file).split(path.sep).join(\"/\")\n return named.some(it => it.match(relative)) && withoutExtensionGlob(file, stat)\n }\n }\n\n toString() {\n return `from: ${this.from}, to: ${this.to}, patterns: ${this.patterns.join(\", \")}`\n }\n}\n\n/** @internal */\nexport function getMainFileMatchers(\n appDir: string,\n destination: string,\n macroExpander: (pattern: string) => string,\n platformSpecificBuildOptions: PlatformSpecificBuildOptions,\n platformPackager: PlatformPackager<any>,\n outDir: string\n): Array<FileMatcher> {\n const buildResourceDir = path.resolve(platformPackager.projectDir, platformPackager.buildResourcesDir)\n\n let matchers = platformPackager.isPrepackedAppAsar\n ? null\n : getFileMatchers(platformPackager.config, \"files\", destination, {\n macroExpander,\n customBuildOptions: platformSpecificBuildOptions,\n globalOutDir: outDir,\n defaultSrc: appDir,\n })\n if (matchers == null) {\n matchers = [new FileMatcher(appDir, destination, macroExpander)]\n }\n\n const matcher = matchers[0]\n // add default patterns, but only if from equals to app dir\n if (matcher.from !== appDir) {\n return matchers\n }\n\n // https://github.com/electron-userland/electron-builder/issues/1741#issuecomment-311111418 so, do not use inclusive patterns\n const patterns = matcher.patterns\n\n // Snapshot the user-specified patterns before the default/auto patterns are injected so a `files`\n // entry can opt back in to a default-excluded extension/name (see getDefaultIgnoredPatterns).\n const userSpecifiedPatterns = patterns.slice()\n\n const customFirstPatterns: Array<string> = []\n // electron-webpack - we need to copy only package.json and node_modules from root dir (and these files are added by default), so, explicit empty array is specified\n if (!matcher.isSpecifiedAsEmptyArray && (matcher.isEmpty() || matcher.containsOnlyIgnore())) {\n customFirstPatterns.push(\"**/*\")\n } else if (!patterns.includes(\"package.json\")) {\n patterns.push(\"package.json\")\n }\n\n let insertExculdeNodeModulesIndex = -1\n for (let i = 0; i < patterns.length; i++) {\n if (!patterns[i].startsWith(\"!\") && (patterns[i].includes(\"/node_modules\") || patterns[i].includes(\"node_modules/\"))) {\n insertExculdeNodeModulesIndex = i\n break\n }\n }\n\n if (insertExculdeNodeModulesIndex !== -1) {\n patterns.splice(insertExculdeNodeModulesIndex, 0, ...[\"!**/node_modules/**\"])\n } else {\n customFirstPatterns.push(\"!**/node_modules/**\")\n }\n\n // https://github.com/electron-userland/electron-builder/issues/1482\n const relativeBuildResourceDir = path.relative(matcher.from, buildResourceDir)\n if (relativeBuildResourceDir.length !== 0 && !relativeBuildResourceDir.startsWith(\".\")) {\n customFirstPatterns.push(`!${relativeBuildResourceDir}{,/**/*}`)\n }\n\n const relativeOutDir = matcher.normalizePattern(path.relative(platformPackager.projectDir, outDir))\n if (!relativeOutDir.startsWith(\".\")) {\n customFirstPatterns.push(`!${relativeOutDir}{,/**/*}`)\n }\n\n // add our default exclusions after last user possibly defined \"all\"/permissive pattern\n let insertIndex = 0\n for (let i = patterns.length - 1; i >= 0; i--) {\n if (patterns[i].startsWith(\"**/\")) {\n insertIndex = i + 1\n break\n }\n }\n patterns.splice(insertIndex, 0, ...customFirstPatterns)\n\n const excludedExtensions = resolveExcludedExtensions(platformPackager.config, platformSpecificBuildOptions)\n const reincludedDefaults = getReincludedDefaultExclusions(userSpecifiedPatterns, excludedExtensions)\n if (reincludedDefaults.length > 0) {\n // These files are kept out of the package by default; a user `files` pattern is opting them back in.\n log.warn({ files: reincludedDefaults.join(\", \") }, \"`files` configuration re-includes files that are excluded by default — verify this is intentional\")\n }\n\n patterns.push(...getDefaultIgnoredPatterns(userSpecifiedPatterns, excludedExtensions))\n const extensionGlob = excludedExtensionsGlob(excludedExtensions)\n const namedBy = collectExtensionReincludes(userSpecifiedPatterns, excludedExtensions)\n if (extensionGlob != null && namedBy.size > 0) {\n matcher.extensionReincludes = { glob: extensionGlob, extensions: excludedExtensions, namedBy }\n }\n\n const debugLogger = platformPackager.debugLogger\n if (debugLogger.isEnabled) {\n //tslint:disable-next-line:no-invalid-template-strings\n debugLogger.add(`${macroExpander(\"${arch}\")}.firstOrDefaultFilePatterns`, patterns)\n }\n return matchers\n}\n\n/** @internal */\nexport function getNodeModuleFileMatcher(\n appDir: string,\n destination: string,\n macroExpander: (pattern: string) => string,\n platformSpecificBuildOptions: PlatformSpecificBuildOptions,\n packager: Packager\n): FileMatcher {\n // https://github.com/electron-userland/electron-builder/pull/2948#issuecomment-392241632\n // grab only excludes\n const matcher = new FileMatcher(appDir, destination, macroExpander)\n\n function addPatterns(patterns: Array<string | FileSet> | string | Nullish | FileSet) {\n if (patterns == null) {\n return\n } else if (!Array.isArray(patterns)) {\n if (typeof patterns === \"string\" && patterns.startsWith(\"!\")) {\n matcher.addPattern(patterns)\n return\n }\n // ignore object form\n return\n }\n\n for (const pattern of patterns) {\n if (typeof pattern === \"string\") {\n if (pattern.startsWith(\"!\")) {\n matcher.addPattern(pattern)\n }\n } else {\n const fileSet = pattern\n if (fileSet.from == null || fileSet.from === \".\") {\n for (const p of asArray(fileSet.filter)) {\n matcher.addPattern(p)\n }\n }\n }\n }\n }\n\n addPatterns(packager.config.fileOptions?.files)\n addPatterns(platformSpecificBuildOptions.fileOptions?.files)\n\n if (!matcher.isEmpty()) {\n matcher.prependPattern(\"**/*\")\n }\n\n const debugLogger = packager.debugLogger\n if (debugLogger.isEnabled) {\n //tslint:disable-next-line:no-invalid-template-strings\n debugLogger.add(`${macroExpander(\"${arch}\")}.nodeModuleFilePatterns`, matcher.patterns)\n }\n\n return matcher\n}\n\nexport interface GetFileMatchersOptions {\n readonly macroExpander: (pattern: string) => string\n readonly customBuildOptions: PlatformSpecificBuildOptions\n readonly globalOutDir: string\n\n readonly defaultSrc: string\n}\n\n// The names whose file sets are physically copied into the build output directory, so a `to` that\n// resolves outside of it writes onto the build machine itself (https://github.com/electron-userland/electron-builder/issues/1993).\n// `files` is excluded: its `to` is only used for in-package (asar) relative math.\nconst VALIDATED_DESTINATION_NAMES: ReadonlyArray<string> = [\"extraFiles\", \"extraResources\", \"extraDistFiles\"]\n\nconst FPM_MAPPING_HINT =\n 'To install a file at an absolute path inside a deb/rpm package, use the fpm file-mapping syntax instead, e.g. \"deb\": { \"fpm\": [\"build/file.xml=/usr/share/metainfo/file.xml\"] }.'\nconst DESTINATION_DOCS = `See ${BUILD_CHANGES_URL}#extrafiles--extraresources-destinations-are-validated`\n\n/**\n * Resolves a file set `to` to the destination a FileMatcher should copy into.\n *\n * - A missing `to` falls back to `defaultDestination`.\n * - For file sets that are physically copied into the build output directory\n * (see {@link VALIDATED_DESTINATION_NAMES}), the result is validated to stay inside it:\n * absolute `to` values (POSIX, Windows drive-letter, or UNC — files would be copied to that\n * literal path on the build machine) and relative values that escape `globalOutDir`\n * (e.g. `../../usr/share`) throw. Relative hops that stay inside the build output directory\n * (e.g. `to: \"../Frameworks\"` from `Contents/Resources` on macOS) remain valid.\n * - `files` sets are exempt from validation: their `to` only participates in in-package (asar)\n * relative math, so it is plainly resolved against `defaultDestination`.\n */\nexport function resolveFileSetDestination(name: string, to: string | Nullish, defaultDestination: string, globalOutDir: string): string {\n if (to == null) {\n return defaultDestination\n }\n\n if (!VALIDATED_DESTINATION_NAMES.includes(name)) {\n return path.resolve(defaultDestination, to)\n }\n\n // path.win32.isAbsolute also covers POSIX absolute paths, and treats drive-letter (C:\\) and\n // UNC (\\\\server\\share) paths as absolute no matter which OS the build runs on\n if (path.win32.isAbsolute(to) || path.posix.isAbsolute(to)) {\n throw new InvalidConfigurationError(\n `The \"to\" path \"${to}\" in \"${name}\" is absolute. Absolute destinations are not copied into the packaged app — they would be written to that literal path on the build machine. Use a relative path instead. ${FPM_MAPPING_HINT} ${DESTINATION_DOCS}`\n )\n }\n\n // FileMatcher later converts all separators to path.sep, so normalize before resolving to make\n // sure `..\\\\..` segments written with backslashes are seen as parent hops here too\n const resolved = path.resolve(defaultDestination, to.replace(/[/\\\\]/g, path.sep))\n const relativeToOutDir = path.relative(path.resolve(globalOutDir), resolved)\n if (relativeToOutDir.startsWith(`..${path.sep}`) || relativeToOutDir === \"..\" || path.isAbsolute(relativeToOutDir)) {\n throw new InvalidConfigurationError(\n `The \"to\" path \"${to}\" in \"${name}\" resolves to \"${resolved}\", which is outside the build output directory \"${path.resolve(globalOutDir)}\". The files would be copied onto the build machine instead of into the packaged app. Use a relative path that stays within the package. ${FPM_MAPPING_HINT} ${DESTINATION_DOCS}`\n )\n }\n return resolved\n}\n\nexport function getFileMatchers(\n config: Configuration,\n name: \"files\" | \"extraFiles\" | \"extraResources\" | \"extraDistFiles\",\n defaultDestination: string,\n options: GetFileMatchersOptions\n): Array<FileMatcher> | null {\n const defaultMatcher = new FileMatcher(options.defaultSrc, defaultDestination, options.macroExpander)\n const fileMatchers: Array<FileMatcher> = []\n\n function addPatterns(patterns: Array<string | FileSet> | string | Nullish | FileSet) {\n if (patterns == null) {\n return\n } else if (!Array.isArray(patterns)) {\n if (typeof patterns === \"string\") {\n defaultMatcher.addPattern(patterns)\n return\n }\n patterns = [patterns]\n }\n\n for (const pattern of patterns) {\n if (typeof pattern === \"string\") {\n // use normalize to transform ./foo to foo\n defaultMatcher.addPattern(pattern)\n } else {\n const from = pattern.from == null ? options.defaultSrc : path.resolve(options.defaultSrc, pattern.from)\n const to = resolveFileSetDestination(name, pattern.to, defaultDestination, options.globalOutDir)\n fileMatchers.push(new FileMatcher(from, to, options.macroExpander, pattern.filter))\n }\n }\n }\n\n // `extraDistFiles` is a mac option of its own; the others are read from `fileOptions`, into which flat keys are\n // normalized when the configuration is loaded (see util/config/fileOptions.ts)\n if (name === \"extraDistFiles\") {\n addPatterns((options.customBuildOptions as any).extraDistFiles)\n } else {\n addPatterns(config.fileOptions?.[name])\n addPatterns(options.customBuildOptions.fileOptions?.[name])\n }\n\n if (!defaultMatcher.isEmpty()) {\n // default matcher should be first in the array\n fileMatchers.unshift(defaultMatcher)\n }\n\n // we cannot exclude the whole out dir, because sometimes users want to use some file in the out dir in the patterns\n const relativeOutDir = defaultMatcher.normalizePattern(path.relative(options.defaultSrc, options.globalOutDir))\n if (!relativeOutDir.startsWith(\".\")) {\n defaultMatcher.addPattern(`!${relativeOutDir}/*-unpacked{,/**/*}`)\n }\n\n return fileMatchers.length === 0 ? null : fileMatchers\n}\n\n/** Where {@link copyFiles} may write, and where a copied symlink may lead. */\nexport interface CopyFilesContainment {\n /**\n * The output directories the matchers copy into, most specific first (e.g. the app output directory, then the output directory).\n * Each matcher is confined, by real path, to the first one its destination is in.\n */\n readonly roots: ReadonlyArray<string>\n /** Besides the root, the directories a copied symlink may lead into, such as the workspace root and the package-manager store. */\n readonly allowedSymlinkRoots?: ReadonlyArray<string> | null\n /** The `fileOptions.allowExternalLinks` build option: a copied symlink that leads anywhere else is kept when it allows it. */\n readonly externalLinks?: ExternalLinkPolicy | null\n}\n\nfunction containmentRootFor(destination: string, containment: CopyFilesContainment | Nullish): string {\n return containment?.roots.find(root => isPathWithin(path.resolve(root), path.resolve(destination))) ?? destination\n}\n\n/** @internal */\nexport function copyFiles(\n matchers: Array<FileMatcher> | null,\n transformer: FileTransformer | null,\n isUseHardLink?: boolean,\n containment?: CopyFilesContainment | null\n): Promise<any> {\n if (matchers == null || matchers.length === 0) {\n return Promise.resolve()\n }\n\n return Promise.all(\n matchers.map(async (matcher: FileMatcher) => {\n const fromStat = await statOrNull(matcher.from)\n if (fromStat == null) {\n log.warn({ from: matcher.from }, `file source doesn't exist`)\n return\n }\n\n const containmentRoot = containmentRootFor(matcher.to, containment)\n if (fromStat.isFile()) {\n const writes = new WriteContainment(containmentRoot, \"copied file\")\n const toStat = await statOrNull(matcher.to)\n // https://github.com/electron-userland/electron-builder/issues/1245\n if (toStat != null && toStat.isDirectory()) {\n const dest = path.join(matcher.to, path.basename(matcher.from))\n await writes.prepareFile(dest)\n return await copyOrLinkFile(matcher.from, dest, fromStat, isUseHardLink)\n }\n\n await writes.prepareFile(matcher.to)\n return await copyOrLinkFile(matcher.from, matcher.to, fromStat)\n }\n\n if (matcher.isEmpty() || matcher.containsOnlyIgnore()) {\n matcher.prependPattern(\"**/*\")\n }\n log.debug({ matcher }, \"copying files using pattern\")\n return await copyDir(matcher.from, matcher.to, {\n filter: matcher.createFilter(),\n transformer,\n isUseHardLink: isUseHardLink ? USE_HARD_LINKS : null,\n containmentRoot,\n allowedSymlinkRoots: containment?.allowedSymlinkRoots,\n externalLinks: containment?.externalLinks,\n })\n })\n )\n}\n"]}
@@ -1,6 +1,70 @@
1
+ import type { Configuration } from "./configuration.js";
1
2
  import { PackagerOptions } from "./packagerApi.js";
2
3
  export interface ForgeOptions {
3
4
  readonly dir: string;
4
5
  }
6
+ /** Platforms Electron Forge makes for (`ForgePlatform` in `@electron-forge/shared-types`). */
7
+ export type ForgePlatform = "darwin" | "mas" | "win32" | "linux";
8
+ /**
9
+ * The options Electron Forge passes to a maker's `make()` (`MakerOptions` in `@electron-forge/maker-base`).
10
+ * Only the fields electron-builder reads are declared.
11
+ */
12
+ export interface ForgeMakerOptions extends ForgeOptions {
13
+ /** Where Forge expects artifacts. Defaults to a `make` directory next to `dir`. */
14
+ readonly makeDir?: string;
15
+ /** The sanitized app name Forge packaged the app with. */
16
+ readonly appName?: string;
17
+ readonly targetPlatform?: string;
18
+ readonly targetArch: string;
19
+ readonly forgeConfig?: {
20
+ readonly packagerConfig?: {
21
+ readonly executableName?: string;
22
+ };
23
+ };
24
+ }
25
+ /** A maker config, or a function returning one for the target arch (as accepted by Forge's `MakerBase`). */
26
+ export type ForgeMakerConfig<C> = C | ((targetArch: string) => C | Promise<C>);
27
+ /** The electron-builder targets and target configuration a maker builds for one arch. */
28
+ export interface ForgeMakerTarget {
29
+ readonly win?: Array<string>;
30
+ readonly linux?: Array<string>;
31
+ readonly config: Configuration;
32
+ }
5
33
  export declare function buildForge(forgeOptions: ForgeOptions, options: PackagerOptions): Promise<string[]>;
34
+ /**
35
+ * Base class for electron-builder's Electron Forge makers. Structurally compatible with `MakerBase` from
36
+ * `@electron-forge/maker-base` (Forge 6+), without depending on it: Forge instantiates the package's default export
37
+ * with `new Maker(config, platforms)`, or accepts an instance directly in `makers`.
38
+ */
39
+ export declare abstract class ElectronBuilderForgeMaker<C extends object = object> {
40
+ private readonly configOrConfigFetcher?;
41
+ protected readonly platformsToMakeOn?: (ReadonlyArray<string> | null) | undefined;
42
+ abstract readonly name: string;
43
+ abstract readonly defaultPlatforms: ForgePlatform[];
44
+ readonly requiredExternalBinaries: string[];
45
+ /** The resolved maker config, set by `prepareConfig()`. */
46
+ config: C | undefined;
47
+ private isConfigPrepared;
48
+ constructor(configOrConfigFetcher?: ForgeMakerConfig<C> | undefined, platformsToMakeOn?: (ReadonlyArray<string> | null) | undefined);
49
+ /** Forge identifies maker instances in `makers` by this flag. */
50
+ get __isElectronForgeMaker(): true;
51
+ get platforms(): ForgePlatform[];
52
+ prepareConfig(targetArch: string): Promise<void>;
53
+ isSupportedOnCurrentPlatform(): boolean;
54
+ externalBinariesExist(): boolean;
55
+ ensureExternalBinariesExist(): void;
56
+ clone(): ElectronBuilderForgeMaker<C>;
57
+ make(options: ForgeMakerOptions): Promise<string[]>;
58
+ /** Maps Forge's `make()` options onto the electron-builder `build()` options for this maker's target. */
59
+ getBuildOptions(options: ForgeMakerOptions): PackagerOptions;
60
+ /** The electron-builder targets for `targetArch`, with the maker config applied to the target's configuration key. */
61
+ protected abstract getTarget(targetArch: string, config: C | undefined): ForgeMakerTarget;
62
+ }
63
+ type ForgeMakerClass = new (...args: never[]) => ElectronBuilderForgeMaker;
64
+ /**
65
+ * Lets the maker class also be called as a function, as Electron Forge 5 called a maker module's default export
66
+ * (`maker.default(options)`). Forge 6+ constructs it with `new`, which is passed through unchanged.
67
+ */
68
+ export declare function withLegacyForgeCall<T extends ForgeMakerClass>(MakerClass: T): T;
69
+ export {};
6
70
  //# sourceMappingURL=forge-maker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"forge-maker.d.ts","sourceRoot":"","sources":["../src/forge-maker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,UAAU,CAAC,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,qBAgB9E"}
1
+ {"version":3,"file":"forge-maker.d.ts","sourceRoot":"","sources":["../src/forge-maker.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB;AAED,8FAA8F;AAC9F,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,CAAA;AAEhE;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,mFAAmF;IACnF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE;QAAE,QAAQ,CAAC,cAAc,CAAC,EAAE;YAAE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAC1F;AAED,4GAA4G;AAC5G,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,MAAM,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CA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