app-builder-lib 25.0.0-alpha.7 → 25.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/configuration.d.ts +5 -0
- package/out/configuration.js.map +1 -1
- package/out/macPackager.js +1 -0
- package/out/macPackager.js.map +1 -1
- package/out/options/macOptions.d.ts +7 -0
- package/out/options/macOptions.js.map +1 -1
- package/out/packager.d.ts +2 -2
- package/out/packager.js.map +1 -1
- package/out/platformPackager.js +11 -0
- package/out/platformPackager.js.map +1 -1
- package/out/util/NodeModuleCopyHelper.js +68 -69
- package/out/util/NodeModuleCopyHelper.js.map +1 -1
- package/out/util/appFileCopier.js +34 -15
- package/out/util/appFileCopier.js.map +1 -1
- package/out/util/packageDependencies.d.ts +3 -0
- package/out/util/packageDependencies.js +1 -1
- package/out/util/packageDependencies.js.map +1 -1
- package/out/version.d.ts +1 -1
- package/out/version.js +1 -1
- package/out/version.js.map +1 -1
- package/package.json +10 -10
- package/scheme.json +42 -0
|
@@ -32,96 +32,95 @@ class NodeModuleCopyHelper extends AppFileWalker_1.FileCopyHelper {
|
|
|
32
32
|
constructor(matcher, packager) {
|
|
33
33
|
super(matcher, matcher.isEmpty() ? null : matcher.createFilter(), packager);
|
|
34
34
|
}
|
|
35
|
-
async collectNodeModules(
|
|
35
|
+
async collectNodeModules(moduleInfo, nodeModuleExcludedExts) {
|
|
36
36
|
const filter = this.filter;
|
|
37
37
|
const metadata = this.metadata;
|
|
38
38
|
const onNodeModuleFile = await (0, platformPackager_1.resolveFunction)(this.packager.appInfo.type, this.packager.config.onNodeModuleFile, "onNodeModuleFile");
|
|
39
39
|
const result = [];
|
|
40
40
|
const queue = [];
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
// noinspection SpellCheckingInspection
|
|
67
|
-
if (isTopLevel && (topLevelExcludedFiles.has(name) || (moduleName === "libui-node" && (name === "build" || name === "docs" || name === "src")))) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
if (dirPath.endsWith("build")) {
|
|
71
|
-
if (name === "gyp-mac-tool" || name === "Makefile" || name.endsWith(".mk") || name.endsWith(".gypi") || name.endsWith(".Makefile")) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
else if (dirPath.endsWith("Release") && (name === ".deps" || name === "obj.target")) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
else if (name === "src" && (dirPath.endsWith("keytar") || dirPath.endsWith("keytar-prebuild"))) {
|
|
41
|
+
const tmpPath = moduleInfo.dir;
|
|
42
|
+
const moduleName = moduleInfo.name;
|
|
43
|
+
queue.length = 1;
|
|
44
|
+
// The path should be corrected in Windows that when the moduleName is Scoped packages named.
|
|
45
|
+
const depPath = path.normalize(tmpPath);
|
|
46
|
+
queue[0] = depPath;
|
|
47
|
+
while (queue.length > 0) {
|
|
48
|
+
const dirPath = queue.pop();
|
|
49
|
+
const childNames = await (0, fs_extra_1.readdir)(dirPath);
|
|
50
|
+
childNames.sort();
|
|
51
|
+
const isTopLevel = dirPath === depPath;
|
|
52
|
+
const dirs = [];
|
|
53
|
+
// our handler is async, but we should add sorted files, so, we add file to result not in the mapper, but after map
|
|
54
|
+
const sortedFilePaths = await bluebird_lst_1.default.map(childNames, name => {
|
|
55
|
+
const filePath = dirPath + path.sep + name;
|
|
56
|
+
const forceIncluded = onNodeModuleFile != null && !!onNodeModuleFile(filePath);
|
|
57
|
+
if (excludedFiles.has(name) || name.startsWith("._")) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
if (!forceIncluded) {
|
|
61
|
+
for (const ext of nodeModuleExcludedExts) {
|
|
62
|
+
if (name.endsWith(ext)) {
|
|
79
63
|
return null;
|
|
80
64
|
}
|
|
81
|
-
|
|
65
|
+
}
|
|
66
|
+
// noinspection SpellCheckingInspection
|
|
67
|
+
if (isTopLevel && (topLevelExcludedFiles.has(name) || (moduleName === "libui-node" && (name === "build" || name === "docs" || name === "src")))) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
if (dirPath.endsWith("build")) {
|
|
71
|
+
if (name === "gyp-mac-tool" || name === "Makefile" || name.endsWith(".mk") || name.endsWith(".gypi") || name.endsWith(".Makefile")) {
|
|
82
72
|
return null;
|
|
83
73
|
}
|
|
84
74
|
}
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
else if (dirPath.endsWith("Release") && (name === ".deps" || name === "obj.target")) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
else if (name === "src" && (dirPath.endsWith("keytar") || dirPath.endsWith("keytar-prebuild"))) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
else if (dirPath.endsWith("lzma-native") && (name === "build" || name === "deps")) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return (0, fs_extra_1.lstat)(filePath).then(stat => {
|
|
86
|
+
if (filter != null && !filter(filePath, stat)) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
if (!stat.isDirectory()) {
|
|
90
|
+
metadata.set(filePath, stat);
|
|
91
|
+
}
|
|
92
|
+
const consumerResult = this.handleFile(filePath, dirPath, stat);
|
|
93
|
+
if (consumerResult == null) {
|
|
94
|
+
if (stat.isDirectory()) {
|
|
95
|
+
dirs.push(name);
|
|
87
96
|
return null;
|
|
88
97
|
}
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
else {
|
|
99
|
+
return filePath;
|
|
91
100
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
return consumerResult.then(it => {
|
|
104
|
+
// asarUtil can return modified stat (symlink handling)
|
|
105
|
+
if ((it == null ? stat : it).isDirectory()) {
|
|
95
106
|
dirs.push(name);
|
|
96
107
|
return null;
|
|
97
108
|
}
|
|
98
109
|
else {
|
|
99
110
|
return filePath;
|
|
100
111
|
}
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
return consumerResult.then(it => {
|
|
104
|
-
// asarUtil can return modified stat (symlink handling)
|
|
105
|
-
if ((it == null ? stat : it).isDirectory()) {
|
|
106
|
-
dirs.push(name);
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
return filePath;
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}, fs_1.CONCURRENCY);
|
|
116
|
-
for (const child of sortedFilePaths) {
|
|
117
|
-
if (child != null) {
|
|
118
|
-
result.push(child);
|
|
112
|
+
});
|
|
119
113
|
}
|
|
114
|
+
});
|
|
115
|
+
}, fs_1.CONCURRENCY);
|
|
116
|
+
for (const child of sortedFilePaths) {
|
|
117
|
+
if (child != null) {
|
|
118
|
+
result.push(child);
|
|
120
119
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
}
|
|
121
|
+
dirs.sort();
|
|
122
|
+
for (const child of dirs) {
|
|
123
|
+
queue.push(dirPath + path.sep + child);
|
|
125
124
|
}
|
|
126
125
|
}
|
|
127
126
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeModuleCopyHelper.js","sourceRoot":"","sources":["../../src/util/NodeModuleCopyHelper.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,4CAAiD;AACjD,uCAAyC;AACzC,6BAA4B;AAC5B,gDAA2D;AAE3D,0DAAqD;AACrD,mDAAg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AAA;YACX,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;gBACzB,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAA;YACxC,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AA9GD,oDA8GC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { CONCURRENCY } from \"builder-util/out/fs\"\nimport { lstat, readdir } from \"fs-extra\"\nimport * as path from \"path\"\nimport { excludedNames, FileMatcher } from \"../fileMatcher\"\nimport { Packager } from \"../packager\"\nimport { resolveFunction } from \"../platformPackager\"\nimport { FileCopyHelper } from \"./AppFileWalker\"\nimport { NodeModuleInfo } from \"./packageDependencies\"\n\nconst excludedFiles = new Set(\n [\".DS_Store\", \"node_modules\" /* already in the queue */, \"CHANGELOG.md\", \"ChangeLog\", \"changelog.md\", \"Changelog.md\", \"Changelog\", \"binding.gyp\", \".npmignore\"].concat(\n excludedNames.split(\",\")\n )\n)\nconst topLevelExcludedFiles = new Set([\n \"karma.conf.js\",\n \".coveralls.yml\",\n \"README.md\",\n \"readme.markdown\",\n \"README\",\n \"readme.md\",\n \"Readme.md\",\n \"Readme\",\n \"readme\",\n \"test\",\n \"tests\",\n \"__tests__\",\n \"powered-test\",\n \"example\",\n \"examples\",\n \".bin\",\n])\n\n/** @internal */\nexport class NodeModuleCopyHelper extends FileCopyHelper {\n constructor(matcher: FileMatcher, packager: Packager) {\n super(matcher, matcher.isEmpty() ? null : matcher.createFilter(), packager)\n }\n\n async collectNodeModules(moduleInfo: NodeModuleInfo, nodeModuleExcludedExts: Array<string>): Promise<Array<string>> {\n const filter = this.filter\n const metadata = this.metadata\n\n const onNodeModuleFile = await resolveFunction(this.packager.appInfo.type, this.packager.config.onNodeModuleFile, \"onNodeModuleFile\")\n\n const result: Array<string> = []\n const queue: Array<string> = []\n const tmpPath = moduleInfo.dir\n const moduleName = moduleInfo.name\n queue.length = 1\n // The path should be corrected in Windows that when the moduleName is Scoped packages named.\n const depPath = path.normalize(tmpPath)\n queue[0] = depPath\n\n while (queue.length > 0) {\n const dirPath = queue.pop()!\n\n const childNames = await readdir(dirPath)\n childNames.sort()\n\n const isTopLevel = dirPath === depPath\n const dirs: Array<string> = []\n // our handler is async, but we should add sorted files, so, we add file to result not in the mapper, but after map\n const sortedFilePaths = await BluebirdPromise.map(\n childNames,\n name => {\n const filePath = dirPath + path.sep + name\n\n const forceIncluded = onNodeModuleFile != null && !!onNodeModuleFile(filePath)\n\n if (excludedFiles.has(name) || name.startsWith(\"._\")) {\n return null\n }\n\n if (!forceIncluded) {\n for (const ext of nodeModuleExcludedExts) {\n if (name.endsWith(ext)) {\n return null\n }\n }\n\n // noinspection SpellCheckingInspection\n if (isTopLevel && (topLevelExcludedFiles.has(name) || (moduleName === \"libui-node\" && (name === \"build\" || name === \"docs\" || name === \"src\")))) {\n return null\n }\n\n if (dirPath.endsWith(\"build\")) {\n if (name === \"gyp-mac-tool\" || name === \"Makefile\" || name.endsWith(\".mk\") || name.endsWith(\".gypi\") || name.endsWith(\".Makefile\")) {\n return null\n }\n } else if (dirPath.endsWith(\"Release\") && (name === \".deps\" || name === \"obj.target\")) {\n return null\n } else if (name === \"src\" && (dirPath.endsWith(\"keytar\") || dirPath.endsWith(\"keytar-prebuild\"))) {\n return null\n } else if (dirPath.endsWith(\"lzma-native\") && (name === \"build\" || name === \"deps\")) {\n return null\n }\n }\n\n return lstat(filePath).then(stat => {\n if (filter != null && !filter(filePath, stat)) {\n return null\n }\n\n if (!stat.isDirectory()) {\n metadata.set(filePath, stat)\n }\n const consumerResult = this.handleFile(filePath, dirPath, stat)\n if (consumerResult == null) {\n if (stat.isDirectory()) {\n dirs.push(name)\n return null\n } else {\n return filePath\n }\n } else {\n return consumerResult.then(it => {\n // asarUtil can return modified stat (symlink handling)\n if ((it == null ? stat : it).isDirectory()) {\n dirs.push(name)\n return null\n } else {\n return filePath\n }\n })\n }\n })\n },\n CONCURRENCY\n )\n\n for (const child of sortedFilePaths) {\n if (child != null) {\n result.push(child)\n }\n }\n\n dirs.sort()\n for (const child of dirs) {\n queue.push(dirPath + path.sep + child)\n }\n }\n return result\n }\n}\n"]}
|
|
@@ -16,6 +16,24 @@ const NodeModuleCopyHelper_1 = require("./NodeModuleCopyHelper");
|
|
|
16
16
|
const BOWER_COMPONENTS_PATTERN = `${path.sep}bower_components${path.sep}`;
|
|
17
17
|
/** @internal */
|
|
18
18
|
exports.ELECTRON_COMPILE_SHIM_FILENAME = "__shim.js";
|
|
19
|
+
function extractPathAfterLastNodeModules(src, file) {
|
|
20
|
+
const srcComponents = src.split(path.sep);
|
|
21
|
+
const lastNodeModulesIndex = srcComponents.lastIndexOf("node_modules");
|
|
22
|
+
if (lastNodeModulesIndex === -1 || lastNodeModulesIndex === srcComponents.length - 1) {
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
const pathAfterNodeModules = srcComponents.slice(lastNodeModulesIndex + 1).join(path.sep);
|
|
26
|
+
const matchIndex = file.indexOf(pathAfterNodeModules);
|
|
27
|
+
if (matchIndex === -1) {
|
|
28
|
+
return "";
|
|
29
|
+
}
|
|
30
|
+
const remainingPathStartIndex = matchIndex + pathAfterNodeModules.length;
|
|
31
|
+
if (remainingPathStartIndex >= file.length) {
|
|
32
|
+
return "";
|
|
33
|
+
}
|
|
34
|
+
const remainingPath = file.substring(remainingPathStartIndex).trim();
|
|
35
|
+
return remainingPath.startsWith(path.sep) ? remainingPath.substring(1) : remainingPath;
|
|
36
|
+
}
|
|
19
37
|
function getDestinationPath(file, fileSet) {
|
|
20
38
|
if (file === fileSet.src) {
|
|
21
39
|
return fileSet.destination;
|
|
@@ -27,17 +45,8 @@ function getDestinationPath(file, fileSet) {
|
|
|
27
45
|
return dest + file.substring(src.length);
|
|
28
46
|
}
|
|
29
47
|
else {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// project https://github.com/angexis/punchcontrol/commit/cf929aba55c40d0d8901c54df7945e1d001ce022
|
|
33
|
-
let index = file.indexOf(fileTransformer_1.NODE_MODULES_PATTERN);
|
|
34
|
-
if (index < 0 && file.endsWith(`${path.sep}node_modules`)) {
|
|
35
|
-
index = file.length - 13;
|
|
36
|
-
}
|
|
37
|
-
if (index < 0) {
|
|
38
|
-
throw new Error(`File "${file}" not under the source directory "${fileSet.src}"`);
|
|
39
|
-
}
|
|
40
|
-
return dest + file.substring(index);
|
|
48
|
+
const e = extractPathAfterLastNodeModules(src, file);
|
|
49
|
+
return path.join(dest, e);
|
|
41
50
|
}
|
|
42
51
|
}
|
|
43
52
|
}
|
|
@@ -157,20 +166,30 @@ function validateFileSet(fileSet) {
|
|
|
157
166
|
}
|
|
158
167
|
/** @internal */
|
|
159
168
|
async function computeNodeModuleFileSets(platformPackager, mainMatcher) {
|
|
160
|
-
const deps = await platformPackager.info.getNodeDependencyInfo(platformPackager.platform).value;
|
|
169
|
+
const deps = (await platformPackager.info.getNodeDependencyInfo(platformPackager.platform).value);
|
|
161
170
|
const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager);
|
|
162
171
|
// serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure
|
|
163
172
|
const result = new Array();
|
|
164
173
|
let index = 0;
|
|
165
174
|
for (const info of deps) {
|
|
166
|
-
const source = info.
|
|
175
|
+
const source = platformPackager.info.appDir + path.sep + "node_modules" + path.sep + info.name;
|
|
176
|
+
// const source = platformPackager.info.appDir
|
|
167
177
|
const destination = getDestinationPath(source, { src: mainMatcher.from, destination: mainMatcher.to, files: [], metadata: null });
|
|
168
178
|
// use main matcher patterns, so, user can exclude some files in such hoisted node modules
|
|
169
179
|
// source here includes node_modules, but pattern base should be without because users expect that pattern "!node_modules/loot-core/src{,/**/*}" will work
|
|
170
|
-
const matcher = new fileMatcher_1.FileMatcher(path.dirname(
|
|
180
|
+
const matcher = new fileMatcher_1.FileMatcher(path.dirname(platformPackager.info.appDir + path.sep + "node_modules"), destination, mainMatcher.macroExpander, mainMatcher.patterns);
|
|
171
181
|
const copier = new NodeModuleCopyHelper_1.NodeModuleCopyHelper(matcher, platformPackager.info);
|
|
172
|
-
const files = await copier.collectNodeModules(
|
|
182
|
+
const files = await copier.collectNodeModules(info, nodeModuleExcludedExts);
|
|
173
183
|
result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata });
|
|
184
|
+
if (info.conflictDependency) {
|
|
185
|
+
for (const dep of info.conflictDependency) {
|
|
186
|
+
const source = platformPackager.info.appDir + path.sep + "node_modules" + path.sep + info.name + path.sep + "node_modules" + path.sep + dep.name;
|
|
187
|
+
const destination = getDestinationPath(source, { src: mainMatcher.from, destination: mainMatcher.to, files: [], metadata: null });
|
|
188
|
+
const matcher = new fileMatcher_1.FileMatcher(path.dirname(platformPackager.info.appDir + path.sep + "node_modules" + path.sep + info.name + path.sep + "node_modules"), destination, mainMatcher.macroExpander, mainMatcher.patterns);
|
|
189
|
+
const copier = new NodeModuleCopyHelper_1.NodeModuleCopyHelper(matcher, platformPackager.info);
|
|
190
|
+
result[index++] = validateFileSet({ src: source, destination, files: await copier.collectNodeModules(dep, nodeModuleExcludedExts), metadata: copier.metadata });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
174
193
|
}
|
|
175
194
|
return result;
|
|
176
195
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appFileCopier.js","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,+CAAoD;AACpD,4CAAyH;AAEzH,0CAA6C;AAC7C,uCAAwC;AACxC,6BAA4B;AAC5B,2DAAmD;AACnD,kCAAkC;AAClC,gDAA0D;AAC1D,wDAAqF;AAGrF,mDAA+C;AAC/C,iEAA6D;AAE7D,MAAM,wBAAwB,GAAG,GAAG,IAAI,CAAC,GAAG,mBAAmB,IAAI,CAAC,GAAG,EAAE,CAAA;AACzE,gBAAgB;AACH,QAAA,8BAA8B,GAAG,WAAW,CAAA;AA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AAI,IAAI,OAAO;CAClH,CACE,CAAA;IACD,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,CAAA;AACzG,CAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { AsyncTaskManager, log } from \"builder-util\"\nimport { CONCURRENCY, FileCopier, FileTransformer, Link, MAX_FILE_REQUESTS, statOrNull, walk } from \"builder-util/out/fs\"\nimport { Stats } from \"fs\"\nimport { mkdir, readlink } from \"fs/promises\"\nimport { ensureSymlink } from \"fs-extra\"\nimport * as path from \"path\"\nimport { isLibOrExe } from \"../asar/unpackDetector\"\nimport { Platform } from \"../core\"\nimport { excludedExts, FileMatcher } from \"../fileMatcher\"\nimport { createElectronCompilerHost, NODE_MODULES_PATTERN } from \"../fileTransformer\"\nimport { Packager } from \"../packager\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { AppFileWalker } from \"./AppFileWalker\"\nimport { NodeModuleCopyHelper } from \"./NodeModuleCopyHelper\"\n\nconst BOWER_COMPONENTS_PATTERN = `${path.sep}bower_components${path.sep}`\n/** @internal */\nexport const ELECTRON_COMPILE_SHIM_FILENAME = \"__shim.js\"\n\nexport function getDestinationPath(file: string, fileSet: ResolvedFileSet) {\n if (file === fileSet.src) {\n return fileSet.destination\n } else {\n const src = fileSet.src\n const dest = fileSet.destination\n if (file.length > src.length && file.startsWith(src) && file[src.length] === path.sep) {\n return dest + file.substring(src.length)\n } else {\n // hoisted node_modules\n // not lastIndexOf, to ensure that nested module (top-level module depends on) copied to parent node_modules, not to top-level directory\n // project https://github.com/angexis/punchcontrol/commit/cf929aba55c40d0d8901c54df7945e1d001ce022\n let index = file.indexOf(NODE_MODULES_PATTERN)\n if (index < 0 && file.endsWith(`${path.sep}node_modules`)) {\n index = file.length - 13\n }\n if (index < 0) {\n throw new Error(`File \"${file}\" not under the source directory \"${fileSet.src}\"`)\n }\n return dest + file.substring(index)\n }\n }\n}\n\nexport async function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager, transformer: FileTransformer) {\n const metadata = fileSet.metadata\n // search auto unpacked dir\n const taskManager = new AsyncTaskManager(packager.cancellationToken)\n const createdParentDirs = new Set<string>()\n\n const fileCopier = new FileCopier(file => {\n // https://github.com/electron-userland/electron-builder/issues/3038\n return !(isLibOrExe(file) || file.endsWith(\".node\"))\n }, transformer)\n const links: Array<Link> = []\n for (let i = 0, n = fileSet.files.length; i < n; i++) {\n const sourceFile = fileSet.files[i]\n const stat = metadata.get(sourceFile)\n if (stat == null) {\n // dir\n continue\n }\n\n const destinationFile = getDestinationPath(sourceFile, fileSet)\n if (stat.isSymbolicLink()) {\n links.push({ file: destinationFile, link: await readlink(sourceFile) })\n continue\n }\n\n const fileParent = path.dirname(destinationFile)\n if (!createdParentDirs.has(fileParent)) {\n createdParentDirs.add(fileParent)\n await mkdir(fileParent, { recursive: true })\n }\n\n taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat))\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n }\n\n if (taskManager.tasks.length > 0) {\n await taskManager.awaitTasks()\n }\n if (links.length > 0) {\n await BluebirdPromise.map(links, it => ensureSymlink(it.link, it.file), CONCURRENCY)\n }\n}\n\n// os path separator is used\nexport interface ResolvedFileSet {\n src: string\n destination: string\n\n files: Array<string>\n metadata: Map<string, Stats>\n transformedFiles?: Map<number, string | Buffer> | null\n}\n\n// used only for ASAR, if no asar, file transformed on the fly\nexport async function transformFiles(transformer: FileTransformer, fileSet: ResolvedFileSet): Promise<void> {\n if (transformer == null) {\n return\n }\n\n let transformedFiles = fileSet.transformedFiles\n if (fileSet.transformedFiles == null) {\n transformedFiles = new Map()\n fileSet.transformedFiles = transformedFiles\n }\n\n const metadata = fileSet.metadata\n await BluebirdPromise.filter(\n fileSet.files,\n (it, index) => {\n const fileStat = metadata.get(it)\n if (fileStat == null || !fileStat.isFile()) {\n return false\n }\n\n const transformedValue = transformer(it)\n if (transformedValue == null) {\n return false\n }\n\n if (typeof transformedValue === \"object\" && \"then\" in transformedValue) {\n return (transformedValue as Promise<any>).then(it => {\n if (it != null) {\n transformedFiles!.set(index, it)\n }\n return false\n })\n }\n transformedFiles!.set(index, transformedValue as string | Buffer)\n return false\n },\n CONCURRENCY\n )\n}\n\nexport async function computeFileSets(\n matchers: Array<FileMatcher>,\n transformer: FileTransformer | null,\n platformPackager: PlatformPackager<any>,\n isElectronCompile: boolean\n): Promise<Array<ResolvedFileSet>> {\n const fileSets: Array<ResolvedFileSet> = []\n const packager = platformPackager.info\n\n for (const matcher of matchers) {\n const fileWalker = new AppFileWalker(matcher, packager)\n\n const fromStat = await statOrNull(matcher.from)\n if (fromStat == null) {\n log.debug({ directory: matcher.from, reason: \"doesn't exist\" }, `skipped copying`)\n continue\n }\n\n const files = await walk(matcher.from, fileWalker.filter, fileWalker)\n const metadata = fileWalker.metadata\n fileSets.push(validateFileSet({ src: matcher.from, files, metadata, destination: matcher.to }))\n }\n\n if (isElectronCompile) {\n // cache files should be first (better IO)\n fileSets.unshift(await compileUsingElectronCompile(fileSets[0], packager))\n }\n return fileSets\n}\n\nfunction getNodeModuleExcludedExts(platformPackager: PlatformPackager<any>) {\n // do not exclude *.h files (https://github.com/electron-userland/electron-builder/issues/2852)\n const result = [\".o\", \".obj\"].concat(excludedExts.split(\",\").map(it => `.${it}`))\n if (platformPackager.config.includePdb !== true) {\n result.push(\".pdb\")\n }\n if (platformPackager.platform !== Platform.WINDOWS) {\n // https://github.com/electron-userland/electron-builder/issues/1738\n result.push(\".dll\")\n result.push(\".exe\")\n }\n return result\n}\n\nfunction validateFileSet(fileSet: ResolvedFileSet): ResolvedFileSet {\n if (fileSet.src == null || fileSet.src.length === 0) {\n throw new Error(\"fileset src is empty\")\n }\n return fileSet\n}\n\n/** @internal */\nexport async function computeNodeModuleFileSets(platformPackager: PlatformPackager<any>, mainMatcher: FileMatcher): Promise<Array<ResolvedFileSet>> {\n const deps = await platformPackager.info.getNodeDependencyInfo(platformPackager.platform).value\n const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager)\n // serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure\n const result = new Array<ResolvedFileSet>()\n let index = 0\n for (const info of deps) {\n const source = info.dir\n const destination = getDestinationPath(source, { src: mainMatcher.from, destination: mainMatcher.to, files: [], metadata: null as any })\n\n // use main matcher patterns, so, user can exclude some files in such hoisted node modules\n // source here includes node_modules, but pattern base should be without because users expect that pattern \"!node_modules/loot-core/src{,/**/*}\" will work\n const matcher = new FileMatcher(path.dirname(source), destination, mainMatcher.macroExpander, mainMatcher.patterns)\n const copier = new NodeModuleCopyHelper(matcher, platformPackager.info)\n const files = await copier.collectNodeModules(\n source,\n info.deps.map(it => it.name),\n nodeModuleExcludedExts\n )\n result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata })\n }\n return result\n}\n\nasync function compileUsingElectronCompile(mainFileSet: ResolvedFileSet, packager: Packager): Promise<ResolvedFileSet> {\n log.info(\"compiling using electron-compile\")\n\n const electronCompileCache = await packager.tempDirManager.getTempDir({ prefix: \"electron-compile-cache\" })\n const cacheDir = path.join(electronCompileCache, \".cache\")\n // clear and create cache dir\n await mkdir(cacheDir, { recursive: true })\n const compilerHost = await createElectronCompilerHost(mainFileSet.src, cacheDir)\n const nextSlashIndex = mainFileSet.src.length + 1\n // pre-compute electron-compile to cache dir - we need to process only subdirectories, not direct files of app dir\n await BluebirdPromise.map(\n mainFileSet.files,\n file => {\n if (\n file.includes(NODE_MODULES_PATTERN) ||\n file.includes(BOWER_COMPONENTS_PATTERN) ||\n !file.includes(path.sep, nextSlashIndex) || // ignore not root files\n !mainFileSet.metadata.get(file)!.isFile()\n ) {\n return null\n }\n return compilerHost.compile(file).then(() => null)\n },\n CONCURRENCY\n )\n\n await compilerHost.saveConfiguration()\n\n const metadata = new Map<string, Stats>()\n const cacheFiles = await walk(cacheDir, file => !file.startsWith(\".\"), {\n consume: (file, fileStat) => {\n if (fileStat.isFile()) {\n metadata.set(file, fileStat)\n }\n return null\n },\n })\n\n // add shim\n const shimPath = `${mainFileSet.src}${path.sep}${ELECTRON_COMPILE_SHIM_FILENAME}`\n mainFileSet.files.push(shimPath)\n mainFileSet.metadata.set(shimPath, { isFile: () => true, isDirectory: () => false, isSymbolicLink: () => false } as any)\n if (mainFileSet.transformedFiles == null) {\n mainFileSet.transformedFiles = new Map()\n }\n mainFileSet.transformedFiles.set(\n mainFileSet.files.length - 1,\n `\n'use strict';\nrequire('electron-compile').init(__dirname, require('path').resolve(__dirname, '${packager.metadata.main || \"index\"}'), true);\n`\n )\n return { src: electronCompileCache, files: cacheFiles, metadata, destination: mainFileSet.destination }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"appFileCopier.js","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,+CAAoD;AACpD,4CAAyH;AAEzH,0CAA6C;AAC7C,uCAAwC;AACxC,6BAA4B;AAC5B,2DAAmD;AACnD,kCAAkC;AAClC,gDAA0D;AAC1D,wDAAqF;AAGrF,mDAA+C;AAC/C,iEAA6D;AAG7D,MAAM,wBAAwB,GAAG,GAAG,IAAI,CAAC,GAAG,mBAAmB,IAAI,CAAC,GAAG,EAAE,CAAA;AACzE,gBAAgB;AACH,QAAA,8BAA8B,GAAG,WAAW,CAAA;AAEzD,SAAS,+BAA+B,CAAC,GAAW,EAAE,IAAY;IAChE,MAAM,aAAa,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACzC,MAAM,oBAAoB,GAAG,aAAa,CAAC,WAAW,CAAC,cAAc,CAAC,CAAA;IAEtE,IAAI,oBAAoB,KAAK,CAAC,CAAC,IAAI,oBAAoB,KAAK,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrF,OAAO,EAAE,CAAA;IACX,CAAC;IAED,MAAM,oBAAo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,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK,EAAS,CAAC,CAAA;IACxH,IAAI,WAAW,CAAC,gBAAgB,IAAI,IAAI,EAAE,CAAC;QACzC,WAAW,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAA;IAC1C,CAAC;IACD,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAC9B,WAAW,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAC5B;;kFAE8E,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,OAAO;CAClH,CACE,CAAA;IACD,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,CAAA;AACzG,CAAC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { AsyncTaskManager, log } from \"builder-util\"\nimport { CONCURRENCY, FileCopier, FileTransformer, Link, MAX_FILE_REQUESTS, statOrNull, walk } from \"builder-util/out/fs\"\nimport { Stats } from \"fs\"\nimport { mkdir, readlink } from \"fs/promises\"\nimport { ensureSymlink } from \"fs-extra\"\nimport * as path from \"path\"\nimport { isLibOrExe } from \"../asar/unpackDetector\"\nimport { Platform } from \"../core\"\nimport { excludedExts, FileMatcher } from \"../fileMatcher\"\nimport { createElectronCompilerHost, NODE_MODULES_PATTERN } from \"../fileTransformer\"\nimport { Packager } from \"../packager\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { AppFileWalker } from \"./AppFileWalker\"\nimport { NodeModuleCopyHelper } from \"./NodeModuleCopyHelper\"\nimport { NodeModuleInfo } from \"./packageDependencies\"\n\nconst BOWER_COMPONENTS_PATTERN = `${path.sep}bower_components${path.sep}`\n/** @internal */\nexport const ELECTRON_COMPILE_SHIM_FILENAME = \"__shim.js\"\n\nfunction extractPathAfterLastNodeModules(src: string, file: string) {\n const srcComponents = src.split(path.sep)\n const lastNodeModulesIndex = srcComponents.lastIndexOf(\"node_modules\")\n\n if (lastNodeModulesIndex === -1 || lastNodeModulesIndex === srcComponents.length - 1) {\n return \"\"\n }\n\n const pathAfterNodeModules = srcComponents.slice(lastNodeModulesIndex + 1).join(path.sep)\n\n const matchIndex = file.indexOf(pathAfterNodeModules)\n\n if (matchIndex === -1) {\n return \"\"\n }\n\n const remainingPathStartIndex = matchIndex + pathAfterNodeModules.length\n if (remainingPathStartIndex >= file.length) {\n return \"\"\n }\n\n const remainingPath = file.substring(remainingPathStartIndex).trim()\n return remainingPath.startsWith(path.sep) ? remainingPath.substring(1) : remainingPath\n}\n\nexport function getDestinationPath(file: string, fileSet: ResolvedFileSet) {\n if (file === fileSet.src) {\n return fileSet.destination\n } else {\n const src = fileSet.src\n const dest = fileSet.destination\n if (file.length > src.length && file.startsWith(src) && file[src.length] === path.sep) {\n return dest + file.substring(src.length)\n } else {\n const e = extractPathAfterLastNodeModules(src, file)\n return path.join(dest, e)\n }\n }\n}\n\nexport async function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager, transformer: FileTransformer) {\n const metadata = fileSet.metadata\n // search auto unpacked dir\n const taskManager = new AsyncTaskManager(packager.cancellationToken)\n const createdParentDirs = new Set<string>()\n\n const fileCopier = new FileCopier(file => {\n // https://github.com/electron-userland/electron-builder/issues/3038\n return !(isLibOrExe(file) || file.endsWith(\".node\"))\n }, transformer)\n const links: Array<Link> = []\n for (let i = 0, n = fileSet.files.length; i < n; i++) {\n const sourceFile = fileSet.files[i]\n const stat = metadata.get(sourceFile)\n if (stat == null) {\n // dir\n continue\n }\n\n const destinationFile = getDestinationPath(sourceFile, fileSet)\n if (stat.isSymbolicLink()) {\n links.push({ file: destinationFile, link: await readlink(sourceFile) })\n continue\n }\n\n const fileParent = path.dirname(destinationFile)\n if (!createdParentDirs.has(fileParent)) {\n createdParentDirs.add(fileParent)\n await mkdir(fileParent, { recursive: true })\n }\n\n taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat))\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n }\n\n if (taskManager.tasks.length > 0) {\n await taskManager.awaitTasks()\n }\n if (links.length > 0) {\n await BluebirdPromise.map(links, it => ensureSymlink(it.link, it.file), CONCURRENCY)\n }\n}\n\n// os path separator is used\nexport interface ResolvedFileSet {\n src: string\n destination: string\n\n files: Array<string>\n metadata: Map<string, Stats>\n transformedFiles?: Map<number, string | Buffer> | null\n}\n\n// used only for ASAR, if no asar, file transformed on the fly\nexport async function transformFiles(transformer: FileTransformer, fileSet: ResolvedFileSet): Promise<void> {\n if (transformer == null) {\n return\n }\n\n let transformedFiles = fileSet.transformedFiles\n if (fileSet.transformedFiles == null) {\n transformedFiles = new Map()\n fileSet.transformedFiles = transformedFiles\n }\n\n const metadata = fileSet.metadata\n await BluebirdPromise.filter(\n fileSet.files,\n (it, index) => {\n const fileStat = metadata.get(it)\n if (fileStat == null || !fileStat.isFile()) {\n return false\n }\n\n const transformedValue = transformer(it)\n if (transformedValue == null) {\n return false\n }\n\n if (typeof transformedValue === \"object\" && \"then\" in transformedValue) {\n return (transformedValue as Promise<any>).then(it => {\n if (it != null) {\n transformedFiles!.set(index, it)\n }\n return false\n })\n }\n transformedFiles!.set(index, transformedValue as string | Buffer)\n return false\n },\n CONCURRENCY\n )\n}\n\nexport async function computeFileSets(\n matchers: Array<FileMatcher>,\n transformer: FileTransformer | null,\n platformPackager: PlatformPackager<any>,\n isElectronCompile: boolean\n): Promise<Array<ResolvedFileSet>> {\n const fileSets: Array<ResolvedFileSet> = []\n const packager = platformPackager.info\n\n for (const matcher of matchers) {\n const fileWalker = new AppFileWalker(matcher, packager)\n\n const fromStat = await statOrNull(matcher.from)\n if (fromStat == null) {\n log.debug({ directory: matcher.from, reason: \"doesn't exist\" }, `skipped copying`)\n continue\n }\n\n const files = await walk(matcher.from, fileWalker.filter, fileWalker)\n const metadata = fileWalker.metadata\n fileSets.push(validateFileSet({ src: matcher.from, files, metadata, destination: matcher.to }))\n }\n\n if (isElectronCompile) {\n // cache files should be first (better IO)\n fileSets.unshift(await compileUsingElectronCompile(fileSets[0], packager))\n }\n return fileSets\n}\n\nfunction getNodeModuleExcludedExts(platformPackager: PlatformPackager<any>) {\n // do not exclude *.h files (https://github.com/electron-userland/electron-builder/issues/2852)\n const result = [\".o\", \".obj\"].concat(excludedExts.split(\",\").map(it => `.${it}`))\n if (platformPackager.config.includePdb !== true) {\n result.push(\".pdb\")\n }\n if (platformPackager.platform !== Platform.WINDOWS) {\n // https://github.com/electron-userland/electron-builder/issues/1738\n result.push(\".dll\")\n result.push(\".exe\")\n }\n return result\n}\n\nfunction validateFileSet(fileSet: ResolvedFileSet): ResolvedFileSet {\n if (fileSet.src == null || fileSet.src.length === 0) {\n throw new Error(\"fileset src is empty\")\n }\n return fileSet\n}\n\n/** @internal */\nexport async function computeNodeModuleFileSets(platformPackager: PlatformPackager<any>, mainMatcher: FileMatcher): Promise<Array<ResolvedFileSet>> {\n const deps = (await platformPackager.info.getNodeDependencyInfo(platformPackager.platform).value) as Array<NodeModuleInfo>\n\n const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager)\n // serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure\n const result = new Array<ResolvedFileSet>()\n let index = 0\n for (const info of deps) {\n const source = platformPackager.info.appDir + path.sep + \"node_modules\" + path.sep + info.name\n // const source = platformPackager.info.appDir\n const destination = getDestinationPath(source, { src: mainMatcher.from, destination: mainMatcher.to, files: [], metadata: null as any })\n\n // use main matcher patterns, so, user can exclude some files in such hoisted node modules\n // source here includes node_modules, but pattern base should be without because users expect that pattern \"!node_modules/loot-core/src{,/**/*}\" will work\n const matcher = new FileMatcher(path.dirname(platformPackager.info.appDir + path.sep + \"node_modules\"), destination, mainMatcher.macroExpander, mainMatcher.patterns)\n const copier = new NodeModuleCopyHelper(matcher, platformPackager.info)\n const files = await copier.collectNodeModules(info, nodeModuleExcludedExts)\n result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata })\n\n if (info.conflictDependency) {\n for (const dep of info.conflictDependency) {\n const source = platformPackager.info.appDir + path.sep + \"node_modules\" + path.sep + info.name + path.sep + \"node_modules\" + path.sep + dep.name\n const destination = getDestinationPath(source, { src: mainMatcher.from, destination: mainMatcher.to, files: [], metadata: null as any })\n const matcher = new FileMatcher(\n path.dirname(platformPackager.info.appDir + path.sep + \"node_modules\" + path.sep + info.name + path.sep + \"node_modules\"),\n destination,\n mainMatcher.macroExpander,\n mainMatcher.patterns\n )\n const copier = new NodeModuleCopyHelper(matcher, platformPackager.info)\n result[index++] = validateFileSet({ src: source, destination, files: await copier.collectNodeModules(dep, nodeModuleExcludedExts), metadata: copier.metadata })\n }\n }\n }\n return result\n}\n\nasync function compileUsingElectronCompile(mainFileSet: ResolvedFileSet, packager: Packager): Promise<ResolvedFileSet> {\n log.info(\"compiling using electron-compile\")\n\n const electronCompileCache = await packager.tempDirManager.getTempDir({ prefix: \"electron-compile-cache\" })\n const cacheDir = path.join(electronCompileCache, \".cache\")\n // clear and create cache dir\n await mkdir(cacheDir, { recursive: true })\n const compilerHost = await createElectronCompilerHost(mainFileSet.src, cacheDir)\n const nextSlashIndex = mainFileSet.src.length + 1\n // pre-compute electron-compile to cache dir - we need to process only subdirectories, not direct files of app dir\n await BluebirdPromise.map(\n mainFileSet.files,\n file => {\n if (\n file.includes(NODE_MODULES_PATTERN) ||\n file.includes(BOWER_COMPONENTS_PATTERN) ||\n !file.includes(path.sep, nextSlashIndex) || // ignore not root files\n !mainFileSet.metadata.get(file)!.isFile()\n ) {\n return null\n }\n return compilerHost.compile(file).then(() => null)\n },\n CONCURRENCY\n )\n\n await compilerHost.saveConfiguration()\n\n const metadata = new Map<string, Stats>()\n const cacheFiles = await walk(cacheDir, file => !file.startsWith(\".\"), {\n consume: (file, fileStat) => {\n if (fileStat.isFile()) {\n metadata.set(file, fileStat)\n }\n return null\n },\n })\n\n // add shim\n const shimPath = `${mainFileSet.src}${path.sep}${ELECTRON_COMPILE_SHIM_FILENAME}`\n mainFileSet.files.push(shimPath)\n mainFileSet.metadata.set(shimPath, { isFile: () => true, isDirectory: () => false, isSymbolicLink: () => false } as any)\n if (mainFileSet.transformedFiles == null) {\n mainFileSet.transformedFiles = new Map()\n }\n mainFileSet.transformedFiles.set(\n mainFileSet.files.length - 1,\n `\n'use strict';\nrequire('electron-compile').init(__dirname, require('path').resolve(__dirname, '${packager.metadata.main || \"index\"}'), true);\n`\n )\n return { src: electronCompileCache, files: cacheFiles, metadata, destination: mainFileSet.destination }\n}\n"]}
|
|
@@ -5,7 +5,7 @@ const lazy_val_1 = require("lazy-val");
|
|
|
5
5
|
const appBuilder_1 = require("./appBuilder");
|
|
6
6
|
function createLazyProductionDeps(projectDir, excludedDependencies) {
|
|
7
7
|
return new lazy_val_1.Lazy(async () => {
|
|
8
|
-
const args = ["node-dep-tree", "--dir", projectDir];
|
|
8
|
+
const args = ["node-dep-tree", "--flatten", "--dir", projectDir];
|
|
9
9
|
if (excludedDependencies != null) {
|
|
10
10
|
for (const name of excludedDependencies) {
|
|
11
11
|
args.push("--exclude-dep", name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageDependencies.js","sourceRoot":"","sources":["../../src/util/packageDependencies.ts"],"names":[],"mappings":";;;AAAA,uCAA+B;AAC/B,6CAAsD;AAEtD,SAAgB,wBAAwB,CAAC,UAAkB,EAAE,oBAA0C;IACrG,OAAO,IAAI,eAAI,CAAC,KAAK,IAAI,EAAE;QACzB,MAAM,IAAI,GAAG,CAAC,eAAe,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"packageDependencies.js","sourceRoot":"","sources":["../../src/util/packageDependencies.ts"],"names":[],"mappings":";;;AAAA,uCAA+B;AAC/B,6CAAsD;AAEtD,SAAgB,wBAAwB,CAAC,UAAkB,EAAE,oBAA0C;IACrG,OAAO,IAAI,eAAI,CAAC,KAAK,IAAI,EAAE;QACzB,MAAM,IAAI,GAAG,CAAC,eAAe,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;QAChE,IAAI,oBAAoB,IAAI,IAAI,EAAE,CAAC;YACjC,KAAK,MAAM,IAAI,IAAI,oBAAoB,EAAE,CAAC;gBACxC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAA;YAClC,CAAC;QACH,CAAC;QACD,OAAO,IAAA,oCAAuB,EAAa,IAAI,CAAC,CAAA;IAClD,CAAC,CAAC,CAAA;AACJ,CAAC;AAVD,4DAUC","sourcesContent":["import { Lazy } from \"lazy-val\"\nimport { executeAppBuilderAsJson } from \"./appBuilder\"\n\nexport function createLazyProductionDeps(projectDir: string, excludedDependencies: Array<string> | null) {\n return new Lazy(async () => {\n const args = [\"node-dep-tree\", \"--flatten\", \"--dir\", projectDir]\n if (excludedDependencies != null) {\n for (const name of excludedDependencies) {\n args.push(\"--exclude-dep\", name)\n }\n }\n return executeAppBuilderAsJson<Array<any>>(args)\n })\n}\n\nexport interface NodeModuleDirInfo {\n readonly dir: string\n readonly deps: Array<NodeModuleInfo>\n}\n\nexport interface NodeModuleInfo {\n readonly name: string\n readonly version: string\n readonly dir: string\n readonly conflictDependency: Array<NodeModuleInfo>\n}\n"]}
|
package/out/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "25.0.0-alpha.
|
|
1
|
+
export declare const PACKAGE_VERSION = "25.0.0-alpha.9";
|
package/out/version.js
CHANGED
package/out/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,gBAAgB,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"25.0.0-alpha.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,gBAAgB,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"25.0.0-alpha.9\"\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "app-builder-lib",
|
|
3
3
|
"description": "electron-builder lib",
|
|
4
|
-
"version": "25.0.0-alpha.
|
|
4
|
+
"version": "25.0.0-alpha.9",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"out",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@develar/schema-utils": "~2.6.5",
|
|
50
50
|
"@electron/notarize": "2.3.0",
|
|
51
|
-
"@electron/osx-sign": "1.0
|
|
51
|
+
"@electron/osx-sign": "1.3.0",
|
|
52
52
|
"@electron/rebuild": "3.6.0",
|
|
53
53
|
"@electron/universal": "2.0.1",
|
|
54
54
|
"@malept/flatpak-bundler": "^0.4.0",
|
|
@@ -66,14 +66,14 @@
|
|
|
66
66
|
"js-yaml": "^4.1.0",
|
|
67
67
|
"lazy-val": "^1.0.5",
|
|
68
68
|
"minimatch": "^5.1.1",
|
|
69
|
-
"read-config-file": "6.
|
|
69
|
+
"read-config-file": "6.4.0",
|
|
70
70
|
"sanitize-filename": "^1.6.3",
|
|
71
71
|
"semver": "^7.3.8",
|
|
72
72
|
"tar": "^6.1.12",
|
|
73
73
|
"temp-file": "^3.4.0",
|
|
74
|
-
"builder-util": "25.0.0-alpha.
|
|
75
|
-
"
|
|
76
|
-
"
|
|
74
|
+
"builder-util": "25.0.0-alpha.9",
|
|
75
|
+
"builder-util-runtime": "9.2.5-alpha.2",
|
|
76
|
+
"electron-publish": "25.0.0-alpha.9"
|
|
77
77
|
},
|
|
78
78
|
"///": "babel in devDependencies for proton tests",
|
|
79
79
|
"devDependencies": {
|
|
@@ -103,12 +103,12 @@
|
|
|
103
103
|
"@types/js-yaml": "4.0.3",
|
|
104
104
|
"@types/semver": "7.3.8",
|
|
105
105
|
"@types/tar": "^6.1.3",
|
|
106
|
-
"dmg-builder": "25.0.0-alpha.
|
|
107
|
-
"electron-builder-squirrel-windows": "25.0.0-alpha.
|
|
106
|
+
"dmg-builder": "25.0.0-alpha.9",
|
|
107
|
+
"electron-builder-squirrel-windows": "25.0.0-alpha.9"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|
|
110
|
-
"
|
|
111
|
-
"
|
|
110
|
+
"dmg-builder": "25.0.0-alpha.9",
|
|
111
|
+
"electron-builder-squirrel-windows": "25.0.0-alpha.9"
|
|
112
112
|
},
|
|
113
113
|
"//": "electron-builder-squirrel-windows and dmg-builder added as dev dep for tests (as otherwise `require` doesn't work using Yarn 2)",
|
|
114
114
|
"typings": "./out/index.d.ts"
|
package/scheme.json
CHANGED
|
@@ -2125,6 +2125,20 @@
|
|
|
2125
2125
|
"MacConfiguration": {
|
|
2126
2126
|
"additionalProperties": false,
|
|
2127
2127
|
"properties": {
|
|
2128
|
+
"additionalArguments": {
|
|
2129
|
+
"anyOf": [
|
|
2130
|
+
{
|
|
2131
|
+
"items": {
|
|
2132
|
+
"type": "string"
|
|
2133
|
+
},
|
|
2134
|
+
"type": "array"
|
|
2135
|
+
},
|
|
2136
|
+
{
|
|
2137
|
+
"type": "null"
|
|
2138
|
+
}
|
|
2139
|
+
],
|
|
2140
|
+
"description": "Array of strings specifying additional arguments to pass to the `codesign` command used to sign a specific file.\n\nSome subresources that you may include in your Electron app may need to be signed with --deep, this is not typically safe to apply to the entire Electron app and therefore should be applied to just your file.\nUsage Example: `['--deep']`"
|
|
2141
|
+
},
|
|
2128
2142
|
"appId": {
|
|
2129
2143
|
"default": "com.electron.${name}",
|
|
2130
2144
|
"description": "The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n[Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.",
|
|
@@ -2744,6 +2758,20 @@
|
|
|
2744
2758
|
"MasConfiguration": {
|
|
2745
2759
|
"additionalProperties": false,
|
|
2746
2760
|
"properties": {
|
|
2761
|
+
"additionalArguments": {
|
|
2762
|
+
"anyOf": [
|
|
2763
|
+
{
|
|
2764
|
+
"items": {
|
|
2765
|
+
"type": "string"
|
|
2766
|
+
},
|
|
2767
|
+
"type": "array"
|
|
2768
|
+
},
|
|
2769
|
+
{
|
|
2770
|
+
"type": "null"
|
|
2771
|
+
}
|
|
2772
|
+
],
|
|
2773
|
+
"description": "Array of strings specifying additional arguments to pass to the `codesign` command used to sign a specific file.\n\nSome subresources that you may include in your Electron app may need to be signed with --deep, this is not typically safe to apply to the entire Electron app and therefore should be applied to just your file.\nUsage Example: `['--deep']`"
|
|
2774
|
+
},
|
|
2747
2775
|
"appId": {
|
|
2748
2776
|
"default": "com.electron.${name}",
|
|
2749
2777
|
"description": "The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as\n[Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported). It is strongly recommended that an explicit ID is set.",
|
|
@@ -6418,6 +6446,20 @@
|
|
|
6418
6446
|
],
|
|
6419
6447
|
"description": "The function (or path to file or module id) to be [run after all artifacts are build](#afterAllArtifactBuild)."
|
|
6420
6448
|
},
|
|
6449
|
+
"afterExtract": {
|
|
6450
|
+
"anyOf": [
|
|
6451
|
+
{
|
|
6452
|
+
"typeof": "function"
|
|
6453
|
+
},
|
|
6454
|
+
{
|
|
6455
|
+
"type": [
|
|
6456
|
+
"null",
|
|
6457
|
+
"string"
|
|
6458
|
+
]
|
|
6459
|
+
}
|
|
6460
|
+
],
|
|
6461
|
+
"description": "The function (or path to file or module id) to be [run after the prebuilt Electron binary has been extracted to the output directory](#afterextract)"
|
|
6462
|
+
},
|
|
6421
6463
|
"afterPack": {
|
|
6422
6464
|
"anyOf": [
|
|
6423
6465
|
{
|