app-builder-lib 27.0.0-alpha.10 → 27.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asar/asarAlign.d.ts +35 -0
- package/dist/asar/asarAlign.d.ts.map +1 -0
- package/dist/asar/asarAlign.js +149 -0
- package/dist/asar/asarAlign.js.map +1 -0
- package/dist/asar/asarUtil.d.ts +15 -1
- package/dist/asar/asarUtil.d.ts.map +1 -1
- package/dist/asar/asarUtil.js +111 -61
- package/dist/asar/asarUtil.js.map +1 -1
- package/dist/codeSign/win/authenticodeSignature.d.ts +71 -0
- package/dist/codeSign/win/authenticodeSignature.d.ts.map +1 -0
- package/dist/codeSign/win/authenticodeSignature.js +241 -0
- package/dist/codeSign/win/authenticodeSignature.js.map +1 -0
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts +11 -0
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.js +36 -16
- package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
- package/dist/codeSign/win/verifyUpdatePublisher.d.ts +25 -0
- package/dist/codeSign/win/verifyUpdatePublisher.d.ts.map +1 -0
- package/dist/codeSign/win/verifyUpdatePublisher.js +98 -0
- package/dist/codeSign/win/verifyUpdatePublisher.js.map +1 -0
- package/dist/configuration.d.ts +16 -13
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js.map +1 -1
- package/dist/electron/ElectronFramework.d.ts +15 -0
- package/dist/electron/ElectronFramework.d.ts.map +1 -1
- package/dist/electron/ElectronFramework.js +33 -2
- package/dist/electron/ElectronFramework.js.map +1 -1
- package/dist/electron/mac/asarIntegrityDigest.d.ts +10 -0
- package/dist/electron/mac/asarIntegrityDigest.d.ts.map +1 -0
- package/dist/electron/mac/asarIntegrityDigest.js +122 -0
- package/dist/electron/mac/asarIntegrityDigest.js.map +1 -0
- package/dist/electron/mac/electronMac.js +1 -28
- package/dist/electron/mac/electronMac.js.map +1 -1
- package/dist/electron/mac/electronMacUtils.d.ts +8 -0
- package/dist/electron/mac/electronMacUtils.d.ts.map +1 -1
- package/dist/electron/mac/electronMacUtils.js +36 -0
- package/dist/electron/mac/electronMacUtils.js.map +1 -1
- package/dist/fileMatcher.d.ts +47 -12
- package/dist/fileMatcher.d.ts.map +1 -1
- package/dist/fileMatcher.js +150 -45
- package/dist/fileMatcher.js.map +1 -1
- package/dist/forge-maker.d.ts +64 -0
- package/dist/forge-maker.d.ts.map +1 -1
- package/dist/forge-maker.js +104 -2
- package/dist/forge-maker.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/indexInternal.d.ts +5 -3
- package/dist/indexInternal.d.ts.map +1 -1
- package/dist/indexInternal.js +5 -3
- package/dist/indexInternal.js.map +1 -1
- package/dist/macPackager.d.ts +6 -0
- package/dist/macPackager.d.ts.map +1 -1
- package/dist/macPackager.js +48 -2
- package/dist/macPackager.js.map +1 -1
- package/dist/options/FuseOptionsV1.d.ts +4 -0
- package/dist/options/FuseOptionsV1.d.ts.map +1 -1
- package/dist/options/FuseOptionsV1.js.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.d.ts +166 -8
- package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/options/SnapOptions.d.ts +36 -15
- package/dist/options/SnapOptions.d.ts.map +1 -1
- package/dist/options/SnapOptions.js.map +1 -1
- package/dist/options/linuxOptions.d.ts +53 -18
- package/dist/options/linuxOptions.d.ts.map +1 -1
- package/dist/options/linuxOptions.js.map +1 -1
- package/dist/options/macOptions.d.ts +15 -1
- package/dist/options/macOptions.d.ts.map +1 -1
- package/dist/options/macOptions.js.map +1 -1
- package/dist/options/winOptions.d.ts +7 -4
- package/dist/options/winOptions.d.ts.map +1 -1
- package/dist/options/winOptions.js.map +1 -1
- package/dist/packager.d.ts +2 -0
- package/dist/packager.d.ts.map +1 -1
- package/dist/packager.js +6 -0
- package/dist/packager.js.map +1 -1
- package/dist/platformPackager.d.ts +11 -4
- package/dist/platformPackager.d.ts.map +1 -1
- package/dist/platformPackager.js +53 -18
- package/dist/platformPackager.js.map +1 -1
- package/dist/presets/rectCra.js +3 -1
- package/dist/presets/rectCra.js.map +1 -1
- package/dist/publish/PublishManager.d.ts +6 -1
- package/dist/publish/PublishManager.d.ts.map +1 -1
- package/dist/publish/PublishManager.js +80 -58
- package/dist/publish/PublishManager.js.map +1 -1
- package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
- package/dist/publish/updateInfoBuilder.js +8 -10
- package/dist/publish/updateInfoBuilder.js.map +1 -1
- package/dist/targets/ArchiveTarget.d.ts.map +1 -1
- package/dist/targets/ArchiveTarget.js +7 -1
- package/dist/targets/ArchiveTarget.js.map +1 -1
- package/dist/targets/archive.d.ts +12 -0
- package/dist/targets/archive.d.ts.map +1 -1
- package/dist/targets/archive.js +17 -3
- package/dist/targets/archive.js.map +1 -1
- package/dist/targets/blockmap/blockmap.d.ts +3 -2
- package/dist/targets/blockmap/blockmap.d.ts.map +1 -1
- package/dist/targets/blockmap/blockmap.js +3 -2
- package/dist/targets/blockmap/blockmap.js.map +1 -1
- package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
- package/dist/targets/differentialUpdateInfoBuilder.js +4 -0
- package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
- package/dist/targets/linux/FlatpakTarget.d.ts +17 -0
- package/dist/targets/linux/FlatpakTarget.d.ts.map +1 -1
- package/dist/targets/linux/FlatpakTarget.js +238 -48
- package/dist/targets/linux/FlatpakTarget.js.map +1 -1
- package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
- package/dist/targets/linux/FpmTarget.js +10 -14
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.d.ts +1 -3
- package/dist/targets/linux/LinuxTargetHelper.d.ts.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.js +45 -20
- package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.d.ts.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.js +5 -1
- package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.d.ts +3 -1
- package/dist/targets/linux/appimage/appImageUtil.d.ts.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.js +2 -2
- package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
- package/dist/targets/linux/appimage/appLauncher.d.ts +6 -0
- package/dist/targets/linux/appimage/appLauncher.d.ts.map +1 -1
- package/dist/targets/linux/appimage/appLauncher.js +13 -9
- package/dist/targets/linux/appimage/appLauncher.js.map +1 -1
- package/dist/targets/linux/flatpakBundle.d.ts +43 -0
- package/dist/targets/linux/flatpakBundle.d.ts.map +1 -0
- package/dist/targets/linux/flatpakBundle.js +210 -0
- package/dist/targets/linux/flatpakBundle.js.map +1 -0
- package/dist/targets/linux/snap/core24.d.ts +0 -18
- package/dist/targets/linux/snap/core24.d.ts.map +1 -1
- package/dist/targets/linux/snap/core24.js +29 -100
- package/dist/targets/linux/snap/core24.js.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.d.ts +7 -0
- package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.js +25 -6
- package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
- package/dist/targets/linux/snap/snapPlugs.d.ts +76 -0
- package/dist/targets/linux/snap/snapPlugs.d.ts.map +1 -0
- package/dist/targets/linux/snap/snapPlugs.js +242 -0
- package/dist/targets/linux/snap/snapPlugs.js.map +1 -0
- package/dist/targets/mac/MacTargetHelper.d.ts +6 -0
- package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
- package/dist/targets/mac/MacTargetHelper.js +47 -3
- package/dist/targets/mac/MacTargetHelper.js.map +1 -1
- package/dist/targets/mac/pkg.d.ts.map +1 -1
- package/dist/targets/mac/pkg.js +1 -0
- package/dist/targets/mac/pkg.js.map +1 -1
- package/dist/targets/win/nsis/Defines.d.ts +1 -0
- package/dist/targets/win/nsis/Defines.d.ts.map +1 -1
- package/dist/targets/win/nsis/Defines.js.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.d.ts +8 -1
- package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.js +36 -5
- package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
- package/dist/targets/win/nsis/nsisOptions.d.ts +6 -4
- package/dist/targets/win/nsis/nsisOptions.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.js +7 -2
- package/dist/targets/win/nsis/nsisUtil.js.map +1 -1
- package/dist/targets/win/winAppUtil.d.ts +2 -2
- package/dist/targets/win/winAppUtil.d.ts.map +1 -1
- package/dist/targets/win/winAppUtil.js +5 -3
- package/dist/targets/win/winAppUtil.js.map +1 -1
- package/dist/toolsets/appimage.d.ts.map +1 -1
- package/dist/toolsets/appimage.js +19 -19
- package/dist/toolsets/appimage.js.map +1 -1
- package/dist/toolsets/nsis.js +1 -1
- package/dist/toolsets/nsis.js.map +1 -1
- package/dist/toolsets/winCodeSign.d.ts +14 -1
- package/dist/toolsets/winCodeSign.d.ts.map +1 -1
- package/dist/toolsets/winCodeSign.js +14 -1
- package/dist/toolsets/winCodeSign.js.map +1 -1
- package/dist/util/AppFileWalker.js +9 -1
- package/dist/util/AppFileWalker.js.map +1 -1
- package/dist/util/appFileCopier.d.ts +15 -2
- package/dist/util/appFileCopier.d.ts.map +1 -1
- package/dist/util/appFileCopier.js +30 -20
- package/dist/util/appFileCopier.js.map +1 -1
- package/dist/util/config/config.d.ts +1 -1
- package/dist/util/config/config.d.ts.map +1 -1
- package/dist/util/config/config.js +42 -19
- package/dist/util/config/config.js.map +1 -1
- package/dist/util/config/fileOptions.d.ts +52 -0
- package/dist/util/config/fileOptions.d.ts.map +1 -0
- package/dist/util/config/fileOptions.js +210 -0
- package/dist/util/config/fileOptions.js.map +1 -0
- package/dist/util/config/legacyConfigGuard.d.ts.map +1 -1
- package/dist/util/config/legacyConfigGuard.js +31 -4
- package/dist/util/config/legacyConfigGuard.js.map +1 -1
- package/dist/util/config/legacyOptions.d.ts +11 -0
- package/dist/util/config/legacyOptions.d.ts.map +1 -1
- package/dist/util/config/legacyOptions.js +36 -10
- package/dist/util/config/legacyOptions.js.map +1 -1
- package/dist/util/electronGet.d.ts +13 -0
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +40 -17
- package/dist/util/electronGet.js.map +1 -1
- package/dist/util/removedEnvVars.d.ts +25 -0
- package/dist/util/removedEnvVars.d.ts.map +1 -0
- package/dist/util/removedEnvVars.js +54 -0
- package/dist/util/removedEnvVars.js.map +1 -0
- package/dist/util/trustedSourceRoots.d.ts +59 -0
- package/dist/util/trustedSourceRoots.d.ts.map +1 -0
- package/dist/util/trustedSourceRoots.js +127 -0
- package/dist/util/trustedSourceRoots.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +18 -17
- package/scheme.json +421 -436
- package/templates/nsis/include/installer.nsh +11 -8
- package/templates/nsis/installSection.nsh +5 -0
package/dist/fileMatcher.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { asArray, copyDir, copyOrLinkFile, InvalidConfigurationError, log, statOrNull, USE_HARD_LINKS } from "builder-util";
|
|
2
|
-
import {
|
|
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";
|
|
3
3
|
import { Minimatch } from "minimatch";
|
|
4
4
|
import * as path from "path";
|
|
5
|
+
import { normalizeExcludedExtensions } from "./util/config/fileOptions.js";
|
|
5
6
|
import { createFilter, hasMagic } from "./util/filter.js";
|
|
6
7
|
// https://github.com/electron-userland/electron-builder/issues/733
|
|
7
8
|
const minimatchOptions = { dot: true };
|
|
@@ -45,7 +46,7 @@ export const DEFAULT_EXCLUDED_NAMES = [
|
|
|
45
46
|
".github",
|
|
46
47
|
"electron-builder.env",
|
|
47
48
|
];
|
|
48
|
-
// File extensions (without leading dot) excluded by default from the packaged app.
|
|
49
|
+
// File extensions (without leading dot) excluded by default from the packaged app, the `"default"` entry of `fileOptions.excludedExts`.
|
|
49
50
|
export const DEFAULT_EXCLUDED_EXTENSIONS = [
|
|
50
51
|
"iml",
|
|
51
52
|
"hprof",
|
|
@@ -67,7 +68,18 @@ export const DEFAULT_EXCLUDED_EXTENSIONS = [
|
|
|
67
68
|
"o",
|
|
68
69
|
"obj",
|
|
69
70
|
"forge-meta",
|
|
71
|
+
"pdb",
|
|
70
72
|
];
|
|
73
|
+
/**
|
|
74
|
+
* The file extensions (without leading dot) excluded from the app files and the copied `node_modules`, from the
|
|
75
|
+
* `fileOptions.excludedExts` build option: the platform-level value (`mac.fileOptions.excludedExts`, ...) when it is set,
|
|
76
|
+
* otherwise the root one, otherwise `["default"]`. See `FilesBuildOptions.excludedExts`.
|
|
77
|
+
*/
|
|
78
|
+
export function resolveExcludedExtensions(config, platformOptions) {
|
|
79
|
+
const entries = platformOptions?.fileOptions?.excludedExts ?? config.fileOptions?.excludedExts ?? [DEFAULT_KEYWORD];
|
|
80
|
+
// a "!ext" that removes nothing is reported by validateConfiguration, naming the section
|
|
81
|
+
return resolveDefaultKeywordList(normalizeExcludedExtensions(entries), DEFAULT_EXCLUDED_EXTENSIONS).result;
|
|
82
|
+
}
|
|
71
83
|
// Hard cap on the number of strings a single pattern may expand to. Real opt-in patterns expand to a
|
|
72
84
|
// handful (`{obj,gltf,glb}`); this bound makes the expansion provably finite so a pathological pattern
|
|
73
85
|
// (e.g. nested or many large `{...}` groups whose product is huge) degrades to "treated literally"
|
|
@@ -131,17 +143,19 @@ function splitTopLevel(value) {
|
|
|
131
143
|
return parts;
|
|
132
144
|
}
|
|
133
145
|
/**
|
|
134
|
-
* Determines which
|
|
135
|
-
* their `files` patterns
|
|
146
|
+
* Determines which excluded extensions (`excludedExtensions`, see {@link resolveExcludedExtensions}) and default-excluded
|
|
147
|
+
* names a user has explicitly opted back in to via their `files` patterns: the extensions for the warning (the files a pattern
|
|
148
|
+
* names are let through by {@link FileMatcher.extensionReincludes}), the names to leave out of the name exclusion glob.
|
|
136
149
|
*
|
|
137
|
-
*
|
|
150
|
+
* An exclusion is treated as opted back in only when a non-negated pattern references it concretely:
|
|
138
151
|
* an extension when a pattern's basename ends with `.<ext>` (e.g. `**\/*.obj`, `assets/*.{obj,gltf}`,
|
|
139
|
-
* `**\/*.d.ts`)
|
|
152
|
+
* `**\/*.d.ts`), only the longest such extension counting (`*.d.ts` names `d.ts`, not also a listed `ts`);
|
|
153
|
+
* a name when any path segment equals it (e.g. `**\/.github/**`, `**\/yarn.lock`).
|
|
140
154
|
* Broad patterns such as `**\/*` reference nothing concrete and therefore opt nothing in.
|
|
141
155
|
*/
|
|
142
|
-
export function collectExplicitReincludes(patterns) {
|
|
156
|
+
export function collectExplicitReincludes(patterns, excludedExtensions = DEFAULT_EXCLUDED_EXTENSIONS) {
|
|
143
157
|
const segments = new Set();
|
|
144
|
-
const
|
|
158
|
+
const namedExtensions = new Set();
|
|
145
159
|
for (const pattern of patterns) {
|
|
146
160
|
if (pattern.startsWith("!")) {
|
|
147
161
|
continue;
|
|
@@ -151,36 +165,34 @@ export function collectExplicitReincludes(patterns) {
|
|
|
151
165
|
for (const part of parts) {
|
|
152
166
|
segments.add(part);
|
|
153
167
|
}
|
|
154
|
-
|
|
168
|
+
const named = longestExcludedExtension(parts[parts.length - 1], excludedExtensions);
|
|
169
|
+
if (named != null) {
|
|
170
|
+
namedExtensions.add(named);
|
|
171
|
+
}
|
|
155
172
|
}
|
|
156
173
|
}
|
|
157
|
-
const extensions = new Set(
|
|
174
|
+
const extensions = new Set(excludedExtensions.filter(ext => namedExtensions.has(ext)));
|
|
158
175
|
const names = new Set(DEFAULT_EXCLUDED_NAMES.filter(name => segments.has(name)));
|
|
159
176
|
return { extensions, names };
|
|
160
177
|
}
|
|
161
178
|
/**
|
|
162
|
-
* Builds the trailing list of default ignore globs appended to the main app file matcher
|
|
163
|
-
*
|
|
164
|
-
*
|
|
179
|
+
* Builds the trailing list of default ignore globs appended to the main app file matcher: a glob that excludes every one of
|
|
180
|
+
* `excludedExtensions` (see {@link resolveExcludedExtensions}), then the default-excluded names except those a `files` entry
|
|
181
|
+
* re-includes (see {@link collectExplicitReincludes}) and the fixed ignores. The files a `files` entry names despite their
|
|
182
|
+
* excluded extension are let through by {@link FileMatcher.extensionReincludes}, not by these patterns.
|
|
165
183
|
*/
|
|
166
|
-
export function getDefaultIgnoredPatterns(userPatterns,
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
if (!includePdb) {
|
|
170
|
-
extensions.push("pdb");
|
|
171
|
-
}
|
|
172
|
-
const names = DEFAULT_EXCLUDED_NAMES.filter(name => !reincluded.names.has(name));
|
|
184
|
+
export function getDefaultIgnoredPatterns(userPatterns, excludedExtensions = DEFAULT_EXCLUDED_EXTENSIONS) {
|
|
185
|
+
const reincludedNames = collectExplicitReincludes(userPatterns, excludedExtensions).names;
|
|
186
|
+
const names = DEFAULT_EXCLUDED_NAMES.filter(name => !reincludedNames.has(name));
|
|
173
187
|
const patterns = [];
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
patterns.push(`!**/*.${extensions[0]}`);
|
|
178
|
-
}
|
|
179
|
-
else if (extensions.length > 1) {
|
|
180
|
-
patterns.push(`!**/*.{${extensions.join(",")}}`);
|
|
188
|
+
const extensionGlob = excludedExtensionsGlob(excludedExtensions);
|
|
189
|
+
if (extensionGlob != null) {
|
|
190
|
+
patterns.push(extensionGlob);
|
|
181
191
|
}
|
|
182
192
|
patterns.push("!**/._*");
|
|
183
193
|
patterns.push("!**/electron-builder.{yaml,yml,json,json5,toml,ts}");
|
|
194
|
+
// minimatch does not expand a single-member brace (`{x}` is matched literally), so emit a bare
|
|
195
|
+
// glob when only one name is excluded.
|
|
184
196
|
if (names.length === 1) {
|
|
185
197
|
patterns.push(`!**/${names[0]}`);
|
|
186
198
|
}
|
|
@@ -194,13 +206,52 @@ export function getDefaultIgnoredPatterns(userPatterns, includePdb) {
|
|
|
194
206
|
patterns.push("!.yarnrc.yml");
|
|
195
207
|
return patterns;
|
|
196
208
|
}
|
|
209
|
+
/** The glob that excludes `excludedExtensions` (a bare one for a single extension, since minimatch matches `{x}` literally), or null for none. */
|
|
210
|
+
function excludedExtensionsGlob(excludedExtensions) {
|
|
211
|
+
if (excludedExtensions.length === 0) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
return excludedExtensions.length === 1 ? `!**/*.${excludedExtensions[0]}` : `!**/*.{${excludedExtensions.join(",")}}`;
|
|
215
|
+
}
|
|
216
|
+
/** The longest of `excludedExtensions` that `name` ends with (`index.d.ts` → `d.ts`, not also a listed `ts`), or null. */
|
|
217
|
+
function longestExcludedExtension(name, excludedExtensions) {
|
|
218
|
+
let result = null;
|
|
219
|
+
for (const ext of excludedExtensions) {
|
|
220
|
+
if (name.endsWith(`.${ext}`) && (result == null || ext.length > result.length)) {
|
|
221
|
+
result = ext;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return result;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Per excluded extension, the `files` patterns that name it: each brace-expanded alternative of a non-negated pattern whose basename
|
|
228
|
+
* ends with that extension (the longest one, see {@link longestExcludedExtension}). An alternative of `native/{**\/*,addon.pdb}`
|
|
229
|
+
* without such an extension names nothing. An alternative that still holds braces (a pattern too large to expand, or a literal brace)
|
|
230
|
+
* is recorded whole: an extension cannot hold a brace, so the extension it ends with follows its last brace and every alternative minimatch
|
|
231
|
+
* expands it to ends with it.
|
|
232
|
+
*/
|
|
233
|
+
function collectExtensionReincludes(patterns, excludedExtensions) {
|
|
234
|
+
const result = new Map();
|
|
235
|
+
for (const pattern of patterns) {
|
|
236
|
+
if (pattern.startsWith("!")) {
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
for (const expanded of expandBraces(pattern)) {
|
|
240
|
+
const extension = longestExcludedExtension(expanded.substring(expanded.lastIndexOf("/") + 1), excludedExtensions);
|
|
241
|
+
if (extension != null) {
|
|
242
|
+
result.set(extension, [...(result.get(extension) ?? []), expanded]);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return result;
|
|
247
|
+
}
|
|
197
248
|
/**
|
|
198
249
|
* Returns the default-excluded names/extensions that the given `files` patterns opt back in, formatted
|
|
199
250
|
* for display (extensions as `*.<ext>`, names verbatim). Empty when nothing default-excluded is
|
|
200
251
|
* re-included. Used to warn that files normally kept out of the package will now be included.
|
|
201
252
|
*/
|
|
202
|
-
export function getReincludedDefaultExclusions(patterns) {
|
|
203
|
-
const reincluded = collectExplicitReincludes(patterns);
|
|
253
|
+
export function getReincludedDefaultExclusions(patterns, excludedExtensions = DEFAULT_EXCLUDED_EXTENSIONS) {
|
|
254
|
+
const reincluded = collectExplicitReincludes(patterns, excludedExtensions);
|
|
204
255
|
return [...[...reincluded.extensions].map(ext => `*.${ext}`), ...reincluded.names];
|
|
205
256
|
}
|
|
206
257
|
function ensureNoEndSlash(file) {
|
|
@@ -221,6 +272,8 @@ export class FileMatcher {
|
|
|
221
272
|
constructor(from, to, macroExpander, patterns) {
|
|
222
273
|
this.macroExpander = macroExpander;
|
|
223
274
|
this.excludePatterns = null;
|
|
275
|
+
/** The files a `files` pattern names despite their excluded extension, which the filter lets through the extension glob. */
|
|
276
|
+
this.extensionReincludes = null;
|
|
224
277
|
this.from = ensureNoEndSlash(macroExpander(from));
|
|
225
278
|
this.to = ensureNoEndSlash(macroExpander(to));
|
|
226
279
|
this.patterns = asArray(patterns).map(it => this.normalizePattern(it));
|
|
@@ -244,14 +297,14 @@ export class FileMatcher {
|
|
|
244
297
|
containsOnlyIgnore() {
|
|
245
298
|
return !this.isEmpty() && this.patterns.find(it => !it.startsWith("!")) == null;
|
|
246
299
|
}
|
|
247
|
-
computeParsedPatterns(result, fromDir) {
|
|
300
|
+
computeParsedPatterns(result, fromDir, patterns = this.patterns) {
|
|
248
301
|
const relativeFrom = fromDir == null ? null : path.relative(fromDir, this.from);
|
|
249
|
-
if (
|
|
302
|
+
if (patterns.length === 0 && relativeFrom != null) {
|
|
250
303
|
// file mappings, from here is a file
|
|
251
304
|
result.push(new Minimatch(relativeFrom, minimatchOptions));
|
|
252
305
|
return;
|
|
253
306
|
}
|
|
254
|
-
for (let pattern of
|
|
307
|
+
for (let pattern of patterns) {
|
|
255
308
|
if (relativeFrom != null) {
|
|
256
309
|
pattern = path.join(relativeFrom, pattern);
|
|
257
310
|
}
|
|
@@ -268,7 +321,34 @@ export class FileMatcher {
|
|
|
268
321
|
createFilter() {
|
|
269
322
|
const parsedPatterns = [];
|
|
270
323
|
this.computeParsedPatterns(parsedPatterns);
|
|
271
|
-
|
|
324
|
+
const filter = createFilter(this.from, parsedPatterns, this.excludePatterns);
|
|
325
|
+
const reincludes = this.extensionReincludes;
|
|
326
|
+
if (reincludes == null) {
|
|
327
|
+
return filter;
|
|
328
|
+
}
|
|
329
|
+
// only the glob getMainFileMatchers appended (the last one): a `files` negation with the same text still applies
|
|
330
|
+
const globIndex = this.patterns.lastIndexOf(reincludes.glob);
|
|
331
|
+
const withoutGlob = this.patterns.filter((_, index) => index !== globIndex);
|
|
332
|
+
const otherPatterns = [];
|
|
333
|
+
this.computeParsedPatterns(otherPatterns, undefined, withoutGlob);
|
|
334
|
+
const withoutExtensionGlob = createFilter(this.from, otherPatterns, this.excludePatterns);
|
|
335
|
+
const namedBy = new Map([...reincludes.namedBy].map(([extension, patterns]) => [extension, patterns.map(it => new Minimatch(it, minimatchOptions))]));
|
|
336
|
+
return (file, stat) => {
|
|
337
|
+
if (filter(file, stat)) {
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
// a directory named with an excluded extension stays excluded
|
|
341
|
+
if (stat.isDirectory()) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
const extension = longestExcludedExtension(path.basename(file), reincludes.extensions);
|
|
345
|
+
const named = extension == null ? undefined : namedBy.get(extension);
|
|
346
|
+
if (named == null) {
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
const relative = path.relative(this.from, file).split(path.sep).join("/");
|
|
350
|
+
return named.some(it => it.match(relative)) && withoutExtensionGlob(file, stat);
|
|
351
|
+
};
|
|
272
352
|
}
|
|
273
353
|
toString() {
|
|
274
354
|
return `from: ${this.from}, to: ${this.to}, patterns: ${this.patterns.join(", ")}`;
|
|
@@ -337,12 +417,18 @@ export function getMainFileMatchers(appDir, destination, macroExpander, platform
|
|
|
337
417
|
}
|
|
338
418
|
}
|
|
339
419
|
patterns.splice(insertIndex, 0, ...customFirstPatterns);
|
|
340
|
-
const
|
|
420
|
+
const excludedExtensions = resolveExcludedExtensions(platformPackager.config, platformSpecificBuildOptions);
|
|
421
|
+
const reincludedDefaults = getReincludedDefaultExclusions(userSpecifiedPatterns, excludedExtensions);
|
|
341
422
|
if (reincludedDefaults.length > 0) {
|
|
342
423
|
// These files are kept out of the package by default; a user `files` pattern is opting them back in.
|
|
343
424
|
log.warn({ files: reincludedDefaults.join(", ") }, "`files` configuration re-includes files that are excluded by default — verify this is intentional");
|
|
344
425
|
}
|
|
345
|
-
patterns.push(...getDefaultIgnoredPatterns(userSpecifiedPatterns,
|
|
426
|
+
patterns.push(...getDefaultIgnoredPatterns(userSpecifiedPatterns, excludedExtensions));
|
|
427
|
+
const extensionGlob = excludedExtensionsGlob(excludedExtensions);
|
|
428
|
+
const namedBy = collectExtensionReincludes(userSpecifiedPatterns, excludedExtensions);
|
|
429
|
+
if (extensionGlob != null && namedBy.size > 0) {
|
|
430
|
+
matcher.extensionReincludes = { glob: extensionGlob, extensions: excludedExtensions, namedBy };
|
|
431
|
+
}
|
|
346
432
|
const debugLogger = platformPackager.debugLogger;
|
|
347
433
|
if (debugLogger.isEnabled) {
|
|
348
434
|
//tslint:disable-next-line:no-invalid-template-strings
|
|
@@ -383,8 +469,8 @@ export function getNodeModuleFileMatcher(appDir, destination, macroExpander, pla
|
|
|
383
469
|
}
|
|
384
470
|
}
|
|
385
471
|
}
|
|
386
|
-
addPatterns(packager.config.files);
|
|
387
|
-
addPatterns(platformSpecificBuildOptions.files);
|
|
472
|
+
addPatterns(packager.config.fileOptions?.files);
|
|
473
|
+
addPatterns(platformSpecificBuildOptions.fileOptions?.files);
|
|
388
474
|
if (!matcher.isEmpty()) {
|
|
389
475
|
matcher.prependPattern("**/*");
|
|
390
476
|
}
|
|
@@ -460,10 +546,15 @@ export function getFileMatchers(config, name, defaultDestination, options) {
|
|
|
460
546
|
}
|
|
461
547
|
}
|
|
462
548
|
}
|
|
463
|
-
|
|
464
|
-
|
|
549
|
+
// `extraDistFiles` is a mac option of its own; the others are read from `fileOptions`, into which flat keys are
|
|
550
|
+
// normalized when the configuration is loaded (see util/config/fileOptions.ts)
|
|
551
|
+
if (name === "extraDistFiles") {
|
|
552
|
+
addPatterns(options.customBuildOptions.extraDistFiles);
|
|
553
|
+
}
|
|
554
|
+
else {
|
|
555
|
+
addPatterns(config.fileOptions?.[name]);
|
|
556
|
+
addPatterns(options.customBuildOptions.fileOptions?.[name]);
|
|
465
557
|
}
|
|
466
|
-
addPatterns(options.customBuildOptions[name]);
|
|
467
558
|
if (!defaultMatcher.isEmpty()) {
|
|
468
559
|
// default matcher should be first in the array
|
|
469
560
|
fileMatchers.unshift(defaultMatcher);
|
|
@@ -475,8 +566,11 @@ export function getFileMatchers(config, name, defaultDestination, options) {
|
|
|
475
566
|
}
|
|
476
567
|
return fileMatchers.length === 0 ? null : fileMatchers;
|
|
477
568
|
}
|
|
569
|
+
function containmentRootFor(destination, containment) {
|
|
570
|
+
return containment?.roots.find(root => isPathWithin(path.resolve(root), path.resolve(destination))) ?? destination;
|
|
571
|
+
}
|
|
478
572
|
/** @internal */
|
|
479
|
-
export function copyFiles(matchers, transformer, isUseHardLink) {
|
|
573
|
+
export function copyFiles(matchers, transformer, isUseHardLink, containment) {
|
|
480
574
|
if (matchers == null || matchers.length === 0) {
|
|
481
575
|
return Promise.resolve();
|
|
482
576
|
}
|
|
@@ -486,20 +580,31 @@ export function copyFiles(matchers, transformer, isUseHardLink) {
|
|
|
486
580
|
log.warn({ from: matcher.from }, `file source doesn't exist`);
|
|
487
581
|
return;
|
|
488
582
|
}
|
|
583
|
+
const containmentRoot = containmentRootFor(matcher.to, containment);
|
|
489
584
|
if (fromStat.isFile()) {
|
|
585
|
+
const writes = new WriteContainment(containmentRoot, "copied file");
|
|
490
586
|
const toStat = await statOrNull(matcher.to);
|
|
491
587
|
// https://github.com/electron-userland/electron-builder/issues/1245
|
|
492
588
|
if (toStat != null && toStat.isDirectory()) {
|
|
493
|
-
|
|
589
|
+
const dest = path.join(matcher.to, path.basename(matcher.from));
|
|
590
|
+
await writes.prepareFile(dest);
|
|
591
|
+
return await copyOrLinkFile(matcher.from, dest, fromStat, isUseHardLink);
|
|
494
592
|
}
|
|
495
|
-
await
|
|
593
|
+
await writes.prepareFile(matcher.to);
|
|
496
594
|
return await copyOrLinkFile(matcher.from, matcher.to, fromStat);
|
|
497
595
|
}
|
|
498
596
|
if (matcher.isEmpty() || matcher.containsOnlyIgnore()) {
|
|
499
597
|
matcher.prependPattern("**/*");
|
|
500
598
|
}
|
|
501
599
|
log.debug({ matcher }, "copying files using pattern");
|
|
502
|
-
return await copyDir(matcher.from, matcher.to, {
|
|
600
|
+
return await copyDir(matcher.from, matcher.to, {
|
|
601
|
+
filter: matcher.createFilter(),
|
|
602
|
+
transformer,
|
|
603
|
+
isUseHardLink: isUseHardLink ? USE_HARD_LINKS : null,
|
|
604
|
+
containmentRoot,
|
|
605
|
+
allowedSymlinkRoots: containment?.allowedSymlinkRoots,
|
|
606
|
+
externalLinks: containment?.externalLinks,
|
|
607
|
+
});
|
|
503
608
|
}));
|
|
504
609
|
}
|
|
505
610
|
//# sourceMappingURL=fileMatcher.js.map
|
package/dist/fileMatcher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileMatcher.js","sourceRoot":"","sources":["../src/fileMatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAA2B,yBAAyB,EAAE,GAAG,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAEpJ,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAK5B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEzD,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;IACb,YAAY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AO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;YAC1D,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,EAAE,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;IACvJ,CAAC,CAAC,CACH,CAAA;AACH,CAAC","sourcesContent":["import { asArray, copyDir, copyOrLinkFile, FileTransformer, Filter, InvalidConfigurationError, log, statOrNull, USE_HARD_LINKS } from \"builder-util\"\nimport { Nullish } from \"builder-util-runtime\"\nimport { mkdir } from \"fs/promises\"\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.files)\n addPatterns(platformSpecificBuildOptions.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 if (name !== \"extraDistFiles\") {\n addPatterns((config as any)[name])\n }\n addPatterns((options.customBuildOptions as any)[name])\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/** @internal */\nexport function copyFiles(matchers: Array<FileMatcher> | null, transformer: FileTransformer | null, isUseHardLink?: boolean): 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 if (fromStat.isFile()) {\n const toStat = await statOrNull(matcher.to)\n // https://github.com/electron-userland/electron-builder/issues/1245\n if (toStat != null && toStat.isDirectory()) {\n return await copyOrLinkFile(matcher.from, path.join(matcher.to, path.basename(matcher.from)), fromStat, isUseHardLink)\n }\n\n await mkdir(path.dirname(matcher.to), { recursive: true })\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, { filter: matcher.createFilter(), transformer, isUseHardLink: isUseHardLink ? USE_HARD_LINKS : null })\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;AAEzD,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,gB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AA6B,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 { 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\"\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\"] }.'\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"]}
|