app-builder-lib 26.1.0 → 26.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/asar/asarUtil.js +78 -10
- package/out/asar/asarUtil.js.map +1 -1
- package/out/codeSign/macCodeSign.js +2 -1
- package/out/codeSign/macCodeSign.js.map +1 -1
- package/out/codeSign/windowsCodeSign.js +1 -1
- package/out/codeSign/windowsCodeSign.js.map +1 -1
- package/out/electron/search-module.js +1 -1
- package/out/electron/search-module.js.map +1 -1
- package/out/fileMatcher.js +1 -1
- package/out/fileMatcher.js.map +1 -1
- package/out/linuxPackager.js +1 -1
- package/out/linuxPackager.js.map +1 -1
- package/out/macPackager.js +31 -6
- package/out/macPackager.js.map +1 -1
- package/out/node-module-collector/bunNodeModulesCollector.d.ts +11 -0
- package/out/node-module-collector/bunNodeModulesCollector.js +22 -0
- package/out/node-module-collector/bunNodeModulesCollector.js.map +1 -0
- package/out/node-module-collector/index.d.ts +18 -6
- package/out/node-module-collector/index.js +102 -28
- package/out/node-module-collector/index.js.map +1 -1
- package/out/node-module-collector/moduleCache.d.ts +21 -0
- package/out/node-module-collector/moduleCache.js +16 -0
- package/out/node-module-collector/moduleCache.js.map +1 -0
- package/out/node-module-collector/nodeModulesCollector.d.ts +48 -13
- package/out/node-module-collector/nodeModulesCollector.js +184 -59
- package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/out/node-module-collector/npmNodeModulesCollector.d.ts +10 -3
- package/out/node-module-collector/npmNodeModulesCollector.js +95 -13
- package/out/node-module-collector/npmNodeModulesCollector.js.map +1 -1
- package/out/node-module-collector/packageManager.d.ts +2 -2
- package/out/node-module-collector/packageManager.js +44 -22
- package/out/node-module-collector/packageManager.js.map +1 -1
- package/out/node-module-collector/pnpmNodeModulesCollector.d.ts +4 -4
- package/out/node-module-collector/pnpmNodeModulesCollector.js +43 -23
- package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
- package/out/node-module-collector/types.d.ts +25 -1
- package/out/node-module-collector/types.js.map +1 -1
- package/out/node-module-collector/yarnBerryNodeModulesCollector.d.ts +15 -0
- package/out/node-module-collector/yarnBerryNodeModulesCollector.js +83 -0
- package/out/node-module-collector/yarnBerryNodeModulesCollector.js.map +1 -0
- package/out/node-module-collector/yarnNodeModulesCollector.d.ts +12 -2
- package/out/node-module-collector/yarnNodeModulesCollector.js +234 -5
- package/out/node-module-collector/yarnNodeModulesCollector.js.map +1 -1
- package/out/options/PlatformSpecificBuildOptions.d.ts +2 -1
- package/out/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/out/options/macOptions.d.ts +2 -0
- package/out/options/macOptions.js.map +1 -1
- package/out/options/winOptions.d.ts +3 -2
- package/out/options/winOptions.js.map +1 -1
- package/out/packager.d.ts +6 -1
- package/out/packager.js +27 -2
- package/out/packager.js.map +1 -1
- package/out/platformPackager.d.ts +5 -0
- package/out/platformPackager.js +50 -0
- package/out/platformPackager.js.map +1 -1
- package/out/publish/PublishManager.js +2 -2
- package/out/publish/PublishManager.js.map +1 -1
- package/out/targets/AppxTarget.js +1 -1
- package/out/targets/AppxTarget.js.map +1 -1
- package/out/targets/LinuxTargetHelper.js +2 -1
- package/out/targets/LinuxTargetHelper.js.map +1 -1
- package/out/targets/MsiTarget.js +1 -1
- package/out/targets/MsiTarget.js.map +1 -1
- package/out/targets/nsis/NsisTarget.js +2 -2
- package/out/targets/nsis/NsisTarget.js.map +1 -1
- package/out/targets/nsis/nsisUtil.js +7 -1
- package/out/targets/nsis/nsisUtil.js.map +1 -1
- package/out/targets/snap.js +13 -2
- package/out/targets/snap.js.map +1 -1
- package/out/util/appFileCopier.js +17 -10
- package/out/util/appFileCopier.js.map +1 -1
- package/out/util/macosIconComposer.d.ts +10 -0
- package/out/util/macosIconComposer.js +95 -0
- package/out/util/macosIconComposer.js.map +1 -0
- package/out/util/yarn.d.ts +3 -2
- package/out/util/yarn.js +16 -12
- package/out/util/yarn.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/out/winPackager.d.ts +1 -1
- package/out/winPackager.js +26 -9
- package/out/winPackager.js.map +1 -1
- package/package.json +9 -9
- package/scheme.json +9 -9
- package/templates/nsis/uninstaller.nsh +7 -0
|
@@ -144,18 +144,25 @@ function validateFileSet(fileSet) {
|
|
|
144
144
|
}
|
|
145
145
|
/** @internal */
|
|
146
146
|
async function computeNodeModuleFileSets(platformPackager, mainMatcher) {
|
|
147
|
-
const
|
|
148
|
-
const appDir =
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
147
|
+
const packager = platformPackager.info;
|
|
148
|
+
const { tempDirManager, cancellationToken, appDir, projectDir } = packager;
|
|
149
|
+
let deps = [];
|
|
150
|
+
const searchDirectories = Array.from(new Set([appDir, projectDir, await packager.getWorkspaceRoot()])).filter((it) => it != null);
|
|
151
|
+
for (const dir of searchDirectories) {
|
|
152
|
+
if (cancellationToken.cancelled) {
|
|
153
|
+
throw new Error("user cancelled");
|
|
154
|
+
}
|
|
155
|
+
const dirDeps = await (0, node_module_collector_1.getNodeModules)(await packager.getPackageManager(), { rootDir: dir, tempDirManager, cancellationToken, packageName: packager.metadata.name });
|
|
156
|
+
if (dirDeps.length > 0) {
|
|
157
|
+
builder_util_1.log.debug({ dir, nodeModules: dirDeps.map(it => ({ ...it, dir: builder_util_1.log.filePath(it.dir) })) }, "collected node modules");
|
|
158
|
+
deps = dirDeps;
|
|
159
|
+
break;
|
|
156
160
|
}
|
|
157
161
|
}
|
|
158
|
-
|
|
162
|
+
if (deps.length === 0) {
|
|
163
|
+
builder_util_1.log.warn({ searchDirectories: searchDirectories.map(it => builder_util_1.log.filePath(it)) }, "no node modules returned while searching directories");
|
|
164
|
+
return [];
|
|
165
|
+
}
|
|
159
166
|
const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager);
|
|
160
167
|
// serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure
|
|
161
168
|
const result = new Array();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appFileCopier.js","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":";;;AAqBA,gDAYC;AAED,oCAyCC;AAaD,wCAoCC;AAED,0CA4BC;AAwBD,8DA2CC;AA9ND,+CAA4H;AAE5H,uCAAwC;AACxC,0CAA6C;AAC7C,6BAA4B;AAC5B,qDAAuC;AACvC,2DAAmD;AACnD,kCAAkC;AAClC,gDAA0D;AAC1D,wDAAqF;AAGrF,mDAA+C;AAC/C,iEAA6D;AAE7D,oEAA+E;AAE/E,MAAM,wBAAwB,GAAG,GAAG,IAAI,CAAC,GAAG,mBAAmB,IAAI,CAAC,GAAG,EAAE,CAAA;AACzE,gBAAgB;AACH,QAAA,8BAA8B,GAAG,WAAW,CAAA;AAEzD,SAAgB,kBAAkB,CAAC,IAAY,EAAE,OAAwB;IACvE,IAAI,IAAI,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC;QACzB,OAAO,OAAO,CAAC,WAAW,CAAA;IAC5B,CAAC;IAED,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAA;IAChC,gEAAgE;IAChE,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;IAClD,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAEM,KAAK,UAAU,YAAY,CAAC,OAAwB,EAAE,QAAkB,EAAE,WAA4B;IAC3G,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IACjC,2BAA2B;IAC3B,MAAM,WAAW,GAAG,IAAI,+BAAgB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,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OrNull, walk } from \"builder-util\"\nimport { Stats } from \"fs\"\nimport { ensureSymlink } from \"fs-extra\"\nimport { mkdir, readlink } from \"fs/promises\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { isLibOrExe } from \"../asar/unpackDetector\"\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\"\nimport { getNodeModules, detectPackageManager } from \"../node-module-collector\"\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 }\n\n const src = fileSet.src\n const dest = fileSet.destination\n // get node_modules path relative to src and then append to dest\n if (file.startsWith(src)) {\n return path.join(dest, path.relative(src, file))\n }\n return dest\n}\n\nexport async function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager, transformer: FileTransformer) {\n const metadata = fileSet.metadata\n // search auto unpacked dir\n const taskManager = new AsyncTaskManager(packager.cancellationToken)\n const createdParentDirs = new Set<string>()\n\n const fileCopier = new FileCopier(file => {\n return !isLibOrExe(file)\n }, transformer)\n const links: Array<Link> = []\n for (let i = 0, n = fileSet.files.length; i < n; i++) {\n const sourceFile = fileSet.files[i]\n const stat = metadata.get(sourceFile)\n if (stat == null) {\n // dir\n continue\n }\n\n const destinationFile = getDestinationPath(sourceFile, fileSet)\n if (stat.isSymbolicLink()) {\n links.push({ file: destinationFile, link: await readlink(sourceFile) })\n continue\n }\n\n const fileParent = path.dirname(destinationFile)\n if (!createdParentDirs.has(fileParent)) {\n createdParentDirs.add(fileParent)\n await mkdir(fileParent, { recursive: true })\n }\n\n taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat))\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n }\n\n if (taskManager.tasks.length > 0) {\n await taskManager.awaitTasks()\n }\n\n await asyncPool(MAX_FILE_REQUESTS, links, it => ensureSymlink(it.link, it.file))\n}\n\n// os path separator is used\nexport interface ResolvedFileSet {\n src: string\n destination: string\n\n files: Array<string>\n metadata: Map<string, Stats>\n transformedFiles?: Map<number, string | Buffer> | null\n}\n\n// used only for ASAR, if no asar, file transformed on the fly\nexport async function transformFiles(transformer: FileTransformer, fileSet: ResolvedFileSet): Promise<void> {\n if (transformer == null) {\n return\n }\n\n let transformedFiles = fileSet.transformedFiles\n if (fileSet.transformedFiles == null) {\n transformedFiles = new Map()\n fileSet.transformedFiles = transformedFiles\n }\n\n const metadata = fileSet.metadata\n const filesPromise = fileSet.files.map(async (it, index) => {\n const fileStat = metadata.get(it)\n if (fileStat == null || !fileStat.isFile()) {\n return\n }\n\n const transformedValue = transformer(it)\n if (transformedValue == null) {\n return\n }\n\n if (typeof transformedValue === \"object\" && \"then\" in transformedValue) {\n return (transformedValue as Promise<any>).then(it => {\n if (it != null) {\n transformedFiles!.set(index, it)\n }\n return\n })\n }\n transformedFiles!.set(index, transformedValue as string | Buffer)\n return\n })\n // `asyncPool` doesn't provide `index` in it's handler, so we `map` first before using it\n await asyncPool(MAX_FILE_REQUESTS, filesPromise, promise => promise)\n}\n\nexport async function computeFileSets(\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 projectDir = platformPackager.info.projectDir\n const appDir = platformPackager.info.appDir\n\n const pm = detectPackageManager(appDir === projectDir ? [appDir] : [appDir, projectDir])\n\n let deps = await getNodeModules(pm, appDir, platformPackager.info.tempDirManager)\n if (projectDir !== appDir && deps.length === 0) {\n const packageJson = require(path.join(appDir, \"package.json\"))\n if (Object.keys(packageJson.dependencies || {}).length > 0) {\n log.debug({ projectDir, appDir }, \"no node_modules in app dir, trying to find in project dir\")\n deps = await getNodeModules(pm, projectDir, platformPackager.info.tempDirManager)\n }\n }\n\n log.debug({ nodeModules: deps }, \"collected node modules\")\n\n const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager)\n // serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure\n const result = new Array<ResolvedFileSet>()\n let index = 0\n const NODE_MODULES = \"node_modules\"\n\n const collectNodeModules = async (dep: NodeModuleInfo, destination: string) => {\n const source = dep.dir\n const matcher = new FileMatcher(source, destination, mainMatcher.macroExpander, mainMatcher.patterns)\n const copier = new NodeModuleCopyHelper(matcher, platformPackager.info)\n const files = await copier.collectNodeModules(dep, nodeModuleExcludedExts, path.relative(mainMatcher.to, destination))\n result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata })\n\n if (dep.dependencies) {\n for (const c of dep.dependencies) {\n await collectNodeModules(c, path.join(destination, NODE_MODULES, c.name))\n }\n }\n }\n\n for (const dep of deps) {\n const destination = path.join(mainMatcher.to, NODE_MODULES, dep.name)\n await collectNodeModules(dep, destination)\n }\n\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 const filesPromise: Promise<any>[] = mainFileSet.files.map(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\n }\n return compilerHost.compile(file)\n })\n await asyncPool(MAX_FILE_REQUESTS, filesPromise, promise => promise)\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":";;;AAqBA,gDAYC;AAED,oCAyCC;AAaD,wCAoCC;AAED,0CA4BC;AAwBD,8DAiDC;AApOD,+CAA4H;AAE5H,uCAAwC;AACxC,0CAA6C;AAC7C,6BAA4B;AAC5B,qDAAuC;AACvC,2DAAmD;AACnD,kCAAkC;AAClC,gDAA0D;AAC1D,wDAAqF;AAGrF,mDAA+C;AAC/C,iEAA6D;AAE7D,oEAAyD;AAEzD,MAAM,wBAAwB,GAAG,GAAG,IAAI,CAAC,GAAG,mBAAmB,IAAI,CAAC,GAAG,EAAE,CAAA;AACzE,gBAAgB;AACH,QAAA,8BAA8B,GAAG,WAAW,CAAA;AAEzD,SAAgB,kBAAkB,CAAC,IAAY,EAAE,OAAwB;IACvE,IAAI,IAAI,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC;QACzB,OAAO,OAAO,CAAC,WAAW,CAAA;IAC5B,CAAC;IAED,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAA;IAChC,gEAAgE;IAChE,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC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Q,CAAC,CAAA;IAChC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,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 { AsyncTaskManager, FileCopier, FileTransformer, Link, log, MAX_FILE_REQUESTS, statOrNull, walk } from \"builder-util\"\nimport { Stats } from \"fs\"\nimport { ensureSymlink } from \"fs-extra\"\nimport { mkdir, readlink } from \"fs/promises\"\nimport * as path from \"path\"\nimport asyncPool from \"tiny-async-pool\"\nimport { isLibOrExe } from \"../asar/unpackDetector\"\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\"\nimport { getNodeModules } from \"../node-module-collector\"\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 }\n\n const src = fileSet.src\n const dest = fileSet.destination\n // get node_modules path relative to src and then append to dest\n if (file.startsWith(src)) {\n return path.join(dest, path.relative(src, file))\n }\n return dest\n}\n\nexport async function copyAppFiles(fileSet: ResolvedFileSet, packager: Packager, transformer: FileTransformer) {\n const metadata = fileSet.metadata\n // search auto unpacked dir\n const taskManager = new AsyncTaskManager(packager.cancellationToken)\n const createdParentDirs = new Set<string>()\n\n const fileCopier = new FileCopier(file => {\n return !isLibOrExe(file)\n }, transformer)\n const links: Array<Link> = []\n for (let i = 0, n = fileSet.files.length; i < n; i++) {\n const sourceFile = fileSet.files[i]\n const stat = metadata.get(sourceFile)\n if (stat == null) {\n // dir\n continue\n }\n\n const destinationFile = getDestinationPath(sourceFile, fileSet)\n if (stat.isSymbolicLink()) {\n links.push({ file: destinationFile, link: await readlink(sourceFile) })\n continue\n }\n\n const fileParent = path.dirname(destinationFile)\n if (!createdParentDirs.has(fileParent)) {\n createdParentDirs.add(fileParent)\n await mkdir(fileParent, { recursive: true })\n }\n\n taskManager.addTask(fileCopier.copy(sourceFile, destinationFile, stat))\n if (taskManager.tasks.length > MAX_FILE_REQUESTS) {\n await taskManager.awaitTasks()\n }\n }\n\n if (taskManager.tasks.length > 0) {\n await taskManager.awaitTasks()\n }\n\n await asyncPool(MAX_FILE_REQUESTS, links, it => ensureSymlink(it.link, it.file))\n}\n\n// os path separator is used\nexport interface ResolvedFileSet {\n src: string\n destination: string\n\n files: Array<string>\n metadata: Map<string, Stats>\n transformedFiles?: Map<number, string | Buffer> | null\n}\n\n// used only for ASAR, if no asar, file transformed on the fly\nexport async function transformFiles(transformer: FileTransformer, fileSet: ResolvedFileSet): Promise<void> {\n if (transformer == null) {\n return\n }\n\n let transformedFiles = fileSet.transformedFiles\n if (fileSet.transformedFiles == null) {\n transformedFiles = new Map()\n fileSet.transformedFiles = transformedFiles\n }\n\n const metadata = fileSet.metadata\n const filesPromise = fileSet.files.map(async (it, index) => {\n const fileStat = metadata.get(it)\n if (fileStat == null || !fileStat.isFile()) {\n return\n }\n\n const transformedValue = transformer(it)\n if (transformedValue == null) {\n return\n }\n\n if (typeof transformedValue === \"object\" && \"then\" in transformedValue) {\n return (transformedValue as Promise<any>).then(it => {\n if (it != null) {\n transformedFiles!.set(index, it)\n }\n return\n })\n }\n transformedFiles!.set(index, transformedValue as string | Buffer)\n return\n })\n // `asyncPool` doesn't provide `index` in it's handler, so we `map` first before using it\n await asyncPool(MAX_FILE_REQUESTS, filesPromise, promise => promise)\n}\n\nexport async function computeFileSets(\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 packager = platformPackager.info\n const { tempDirManager, cancellationToken, appDir, projectDir } = packager\n\n let deps: Array<NodeModuleInfo> = []\n const searchDirectories = Array.from(new Set([appDir, projectDir, await packager.getWorkspaceRoot()])).filter((it): it is string => it != null)\n for (const dir of searchDirectories) {\n if (cancellationToken.cancelled) {\n throw new Error(\"user cancelled\")\n }\n\n const dirDeps = await getNodeModules(await packager.getPackageManager(), { rootDir: dir, tempDirManager, cancellationToken, packageName: packager.metadata.name! })\n if (dirDeps.length > 0) {\n log.debug({ dir, nodeModules: dirDeps.map(it => ({ ...it, dir: log.filePath(it.dir) })) }, \"collected node modules\")\n deps = dirDeps\n break\n }\n }\n if (deps.length === 0) {\n log.warn({ searchDirectories: searchDirectories.map(it => log.filePath(it)) }, \"no node modules returned while searching directories\")\n return []\n }\n\n const nodeModuleExcludedExts = getNodeModuleExcludedExts(platformPackager)\n // serial execution because copyNodeModules is concurrent and so, no need to increase queue/pressure\n const result = new Array<ResolvedFileSet>()\n let index = 0\n const NODE_MODULES = \"node_modules\"\n\n const collectNodeModules = async (dep: NodeModuleInfo, destination: string) => {\n const source = dep.dir\n const matcher = new FileMatcher(source, destination, mainMatcher.macroExpander, mainMatcher.patterns)\n const copier = new NodeModuleCopyHelper(matcher, platformPackager.info)\n const files = await copier.collectNodeModules(dep, nodeModuleExcludedExts, path.relative(mainMatcher.to, destination))\n result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata })\n\n if (dep.dependencies) {\n for (const c of dep.dependencies) {\n await collectNodeModules(c, path.join(destination, NODE_MODULES, c.name))\n }\n }\n }\n\n for (const dep of deps) {\n const destination = path.join(mainMatcher.to, NODE_MODULES, dep.name)\n await collectNodeModules(dep, destination)\n }\n\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 const filesPromise: Promise<any>[] = mainFileSet.files.map(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\n }\n return compilerHost.compile(file)\n })\n await asyncPool(MAX_FILE_REQUESTS, filesPromise, promise => promise)\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"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface AssetCatalogResult {
|
|
2
|
+
assetCatalog: Buffer;
|
|
3
|
+
icnsFile: Buffer;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Generates an asset catalog and extra assets that are useful for packaging the app.
|
|
7
|
+
* @param inputPath The path to the `.icon` file
|
|
8
|
+
* @returns The asset catalog and extra assets
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateAssetCatalogForIcon(inputPath: string): Promise<AssetCatalogResult>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Adapted from https://github.com/electron/packager/pull/1806
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.generateAssetCatalogForIcon = generateAssetCatalogForIcon;
|
|
5
|
+
const builder_util_1 = require("builder-util");
|
|
6
|
+
const fs = require("fs/promises");
|
|
7
|
+
const os = require("node:os");
|
|
8
|
+
const path = require("node:path");
|
|
9
|
+
const plist = require("plist");
|
|
10
|
+
const semver = require("semver");
|
|
11
|
+
const INVALID_ACTOOL_VERSION_ERROR = new Error("Failed to check actool version. Is Xcode 26 or higher installed? See output of the `actool --version` CLI command for more details.");
|
|
12
|
+
async function checkActoolVersion(tmpDir) {
|
|
13
|
+
const acToolOutputFileName = path.resolve(tmpDir, "actool.log");
|
|
14
|
+
let versionInfo = undefined;
|
|
15
|
+
try {
|
|
16
|
+
const acToolOutputFile = await fs.open(acToolOutputFileName, "w");
|
|
17
|
+
await (0, builder_util_1.spawn)("actool", ["--version"], { stdio: ["ignore", acToolOutputFile.fd, acToolOutputFile.fd] });
|
|
18
|
+
const acToolVersionOutput = await fs.readFile(acToolOutputFileName, "utf8");
|
|
19
|
+
versionInfo = plist.parse(acToolVersionOutput);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
throw INVALID_ACTOOL_VERSION_ERROR;
|
|
23
|
+
}
|
|
24
|
+
if (!versionInfo || !versionInfo["com.apple.actool.version"] || !versionInfo["com.apple.actool.version"]["short-bundle-version"]) {
|
|
25
|
+
throw INVALID_ACTOOL_VERSION_ERROR;
|
|
26
|
+
}
|
|
27
|
+
const acToolVersion = versionInfo["com.apple.actool.version"]["short-bundle-version"];
|
|
28
|
+
if (!semver.gte(semver.coerce(acToolVersion), "26.0.0")) {
|
|
29
|
+
throw new Error(`Unsupported actool version. Must be on actool 26.0.0 or higher but found ${acToolVersion}. Install Xcode 26 or higher to get a supported version of actool.`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Generates an asset catalog and extra assets that are useful for packaging the app.
|
|
34
|
+
* @param inputPath The path to the `.icon` file
|
|
35
|
+
* @returns The asset catalog and extra assets
|
|
36
|
+
*/
|
|
37
|
+
async function generateAssetCatalogForIcon(inputPath) {
|
|
38
|
+
const tmpDir = await fs.mkdtemp(path.resolve(os.tmpdir(), "icon-compile-"));
|
|
39
|
+
const cleanup = async () => {
|
|
40
|
+
await fs.rm(tmpDir, {
|
|
41
|
+
recursive: true,
|
|
42
|
+
force: true,
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
try {
|
|
46
|
+
await checkActoolVersion(tmpDir);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
await cleanup();
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
const iconPath = path.resolve(tmpDir, "Icon.icon");
|
|
53
|
+
const outputPath = path.resolve(tmpDir, "out");
|
|
54
|
+
try {
|
|
55
|
+
await fs.cp(inputPath, iconPath, {
|
|
56
|
+
recursive: true,
|
|
57
|
+
});
|
|
58
|
+
await fs.mkdir(outputPath, {
|
|
59
|
+
recursive: true,
|
|
60
|
+
});
|
|
61
|
+
await (0, builder_util_1.spawn)("actool", [
|
|
62
|
+
iconPath,
|
|
63
|
+
"--compile",
|
|
64
|
+
outputPath,
|
|
65
|
+
"--output-format",
|
|
66
|
+
"human-readable-text",
|
|
67
|
+
"--notices",
|
|
68
|
+
"--warnings",
|
|
69
|
+
"--output-partial-info-plist",
|
|
70
|
+
path.resolve(outputPath, "assetcatalog_generated_info.plist"),
|
|
71
|
+
"--app-icon",
|
|
72
|
+
"Icon",
|
|
73
|
+
"--include-all-app-icons",
|
|
74
|
+
"--accent-color",
|
|
75
|
+
"AccentColor",
|
|
76
|
+
"--enable-on-demand-resources",
|
|
77
|
+
"NO",
|
|
78
|
+
"--development-region",
|
|
79
|
+
"en",
|
|
80
|
+
"--target-device",
|
|
81
|
+
"mac",
|
|
82
|
+
"--minimum-deployment-target",
|
|
83
|
+
"26.0",
|
|
84
|
+
"--platform",
|
|
85
|
+
"macosx",
|
|
86
|
+
]);
|
|
87
|
+
const assetCatalog = await fs.readFile(path.resolve(outputPath, "Assets.car"));
|
|
88
|
+
const icnsFile = await fs.readFile(path.resolve(outputPath, "Icon.icns"));
|
|
89
|
+
return { assetCatalog, icnsFile };
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
await cleanup();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=macosIconComposer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"macosIconComposer.js","sourceRoot":"","sources":["../../src/util/macosIconComposer.ts"],"names":[],"mappings":";AAAA,8DAA8D;;AA+C9D,kEA8DC;AA3GD,+CAAoC;AACpC,kCAAiC;AACjC,8BAA6B;AAC7B,kCAAiC;AACjC,+BAA8B;AAC9B,iCAAgC;AAOhC,MAAM,4BAA4B,GAAG,IAAI,KAAK,CAC5C,qIAAqI,CACtI,CAAA;AAED,KAAK,UAAU,kBAAkB,CAAC,MAAc;IAC9C,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAE/D,IAAI,WAAW,GAAuD,SAAS,CAAA;IAE/E,IAAI,CAAC;QACH,MAAM,gBAAgB,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAA;QACjE,MAA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AO,EAAE,CAAA;IACjB,CAAC;AACH,CAAC","sourcesContent":["// Adapted from https://github.com/electron/packager/pull/1806\n\nimport { spawn } from \"builder-util\"\nimport * as fs from \"fs/promises\"\nimport * as os from \"node:os\"\nimport * as path from \"node:path\"\nimport * as plist from \"plist\"\nimport * as semver from \"semver\"\n\nexport interface AssetCatalogResult {\n assetCatalog: Buffer\n icnsFile: Buffer\n}\n\nconst INVALID_ACTOOL_VERSION_ERROR = new Error(\n \"Failed to check actool version. Is Xcode 26 or higher installed? See output of the `actool --version` CLI command for more details.\"\n)\n\nasync function checkActoolVersion(tmpDir: string) {\n const acToolOutputFileName = path.resolve(tmpDir, \"actool.log\")\n\n let versionInfo: Record<string, Record<string, string>> | undefined = undefined\n\n try {\n const acToolOutputFile = await fs.open(acToolOutputFileName, \"w\")\n await spawn(\"actool\", [\"--version\"], { stdio: [\"ignore\", acToolOutputFile.fd, acToolOutputFile.fd] })\n const acToolVersionOutput = await fs.readFile(acToolOutputFileName, \"utf8\")\n versionInfo = plist.parse(acToolVersionOutput) as Record<string, Record<string, string>>\n } catch {\n throw INVALID_ACTOOL_VERSION_ERROR\n }\n\n if (!versionInfo || !versionInfo[\"com.apple.actool.version\"] || !versionInfo[\"com.apple.actool.version\"][\"short-bundle-version\"]) {\n throw INVALID_ACTOOL_VERSION_ERROR\n }\n\n const acToolVersion = versionInfo[\"com.apple.actool.version\"][\"short-bundle-version\"]\n if (!semver.gte(semver.coerce(acToolVersion)!, \"26.0.0\")) {\n throw new Error(`Unsupported actool version. Must be on actool 26.0.0 or higher but found ${acToolVersion}. Install Xcode 26 or higher to get a supported version of actool.`)\n }\n}\n\n/**\n * Generates an asset catalog and extra assets that are useful for packaging the app.\n * @param inputPath The path to the `.icon` file\n * @returns The asset catalog and extra assets\n */\nexport async function generateAssetCatalogForIcon(inputPath: string): Promise<AssetCatalogResult> {\n const tmpDir = await fs.mkdtemp(path.resolve(os.tmpdir(), \"icon-compile-\"))\n const cleanup = async () => {\n await fs.rm(tmpDir, {\n recursive: true,\n force: true,\n })\n }\n\n try {\n await checkActoolVersion(tmpDir)\n } catch (error) {\n await cleanup()\n throw error\n }\n\n const iconPath = path.resolve(tmpDir, \"Icon.icon\")\n const outputPath = path.resolve(tmpDir, \"out\")\n\n try {\n await fs.cp(inputPath, iconPath, {\n recursive: true,\n })\n\n await fs.mkdir(outputPath, {\n recursive: true,\n })\n\n await spawn(\"actool\", [\n iconPath,\n \"--compile\",\n outputPath,\n \"--output-format\",\n \"human-readable-text\",\n \"--notices\",\n \"--warnings\",\n \"--output-partial-info-plist\",\n path.resolve(outputPath, \"assetcatalog_generated_info.plist\"),\n \"--app-icon\",\n \"Icon\",\n \"--include-all-app-icons\",\n \"--accent-color\",\n \"AccentColor\",\n \"--enable-on-demand-resources\",\n \"NO\",\n \"--development-region\",\n \"en\",\n \"--target-device\",\n \"mac\",\n \"--minimum-deployment-target\",\n \"26.0\",\n \"--platform\",\n \"macosx\",\n ])\n\n const assetCatalog = await fs.readFile(path.resolve(outputPath, \"Assets.car\"))\n const icnsFile = await fs.readFile(path.resolve(outputPath, \"Icon.icns\"))\n\n return { assetCatalog, icnsFile }\n } finally {\n await cleanup()\n }\n}\n"]}
|
package/out/util/yarn.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Lazy } from "lazy-val";
|
|
2
2
|
import { Configuration } from "../configuration";
|
|
3
3
|
import { NodeModuleDirInfo } from "./packageDependencies";
|
|
4
|
-
export declare function installOrRebuild(config: Configuration, { appDir, projectDir }: DirectoryPaths, options: RebuildOptions, forceInstall
|
|
4
|
+
export declare function installOrRebuild(config: Configuration, { appDir, projectDir, workspaceRoot }: DirectoryPaths, options: RebuildOptions, forceInstall: boolean | undefined, env: NodeJS.ProcessEnv): Promise<void>;
|
|
5
5
|
export interface DesktopFrameworkInfo {
|
|
6
6
|
version: string;
|
|
7
7
|
useCustomDist: boolean;
|
|
8
8
|
}
|
|
9
9
|
export declare function getGypEnv(frameworkInfo: DesktopFrameworkInfo, platform: NodeJS.Platform, arch: string, buildFromSource: boolean): any;
|
|
10
|
-
export declare function installDependencies(config: Configuration, { appDir, projectDir }: DirectoryPaths, options: RebuildOptions): Promise<any>;
|
|
10
|
+
export declare function installDependencies(config: Configuration, { appDir, projectDir, workspaceRoot }: DirectoryPaths, options: RebuildOptions, env: NodeJS.ProcessEnv): Promise<any>;
|
|
11
11
|
export declare function nodeGypRebuild(platform: NodeJS.Platform, arch: string, frameworkInfo: DesktopFrameworkInfo): Promise<void>;
|
|
12
12
|
export interface RebuildOptions {
|
|
13
13
|
frameworkInfo: DesktopFrameworkInfo;
|
|
@@ -20,4 +20,5 @@ export interface RebuildOptions {
|
|
|
20
20
|
export interface DirectoryPaths {
|
|
21
21
|
appDir: string;
|
|
22
22
|
projectDir: string;
|
|
23
|
+
workspaceRoot: string | null;
|
|
23
24
|
}
|
package/out/util/yarn.js
CHANGED
|
@@ -13,7 +13,7 @@ const appBuilder_1 = require("./appBuilder");
|
|
|
13
13
|
const node_module_collector_1 = require("../node-module-collector");
|
|
14
14
|
const rebuild_1 = require("./rebuild");
|
|
15
15
|
const which = require("which");
|
|
16
|
-
async function installOrRebuild(config, { appDir, projectDir }, options, forceInstall = false) {
|
|
16
|
+
async function installOrRebuild(config, { appDir, projectDir, workspaceRoot }, options, forceInstall = false, env) {
|
|
17
17
|
const effectiveOptions = {
|
|
18
18
|
buildFromSource: config.buildDependenciesFromSource === true,
|
|
19
19
|
additionalArgs: (0, builder_util_1.asArray)(config.npmArgs),
|
|
@@ -27,10 +27,10 @@ async function installOrRebuild(config, { appDir, projectDir }, options, forceIn
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
if (forceInstall || !isDependenciesInstalled) {
|
|
30
|
-
await installDependencies(config, { appDir, projectDir }, effectiveOptions);
|
|
30
|
+
await installDependencies(config, { appDir, projectDir, workspaceRoot }, effectiveOptions, env);
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
await rebuild(config, { appDir, projectDir }, effectiveOptions);
|
|
33
|
+
await rebuild(config, { appDir, projectDir, workspaceRoot }, effectiveOptions);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function getElectronGypCacheDir() {
|
|
@@ -67,32 +67,36 @@ function getGypEnv(frameworkInfo, platform, arch, buildFromSource) {
|
|
|
67
67
|
npm_config_devdir: getElectronGypCacheDir(),
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
async function installDependencies(config, { appDir, projectDir }, options) {
|
|
70
|
+
async function installDependencies(config, { appDir, projectDir, workspaceRoot }, options, env) {
|
|
71
71
|
const platform = options.platform || process.platform;
|
|
72
72
|
const arch = options.arch || process.arch;
|
|
73
73
|
const additionalArgs = options.additionalArgs;
|
|
74
|
-
const
|
|
75
|
-
|
|
74
|
+
const searchPaths = [projectDir, appDir].concat(workspaceRoot ? [workspaceRoot] : []);
|
|
75
|
+
const { pm, resolvedDirectory: _resolvedWorkspaceDir } = await (0, node_module_collector_1.detectPackageManager)(searchPaths);
|
|
76
|
+
builder_util_1.log.info({ pm, platform, arch, projectDir, appDir, workspaceRoot: _resolvedWorkspaceDir }, "installing dependencies");
|
|
76
77
|
const execArgs = ["install"];
|
|
77
|
-
if (pm === node_module_collector_1.PM.
|
|
78
|
+
if (pm === node_module_collector_1.PM.YARN) {
|
|
79
|
+
execArgs.push("--prefer-offline");
|
|
80
|
+
}
|
|
81
|
+
else if (pm === node_module_collector_1.PM.YARN_BERRY) {
|
|
78
82
|
if (process.env.NPM_NO_BIN_LINKS === "true") {
|
|
79
83
|
execArgs.push("--no-bin-links");
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
|
-
if (pm === node_module_collector_1.PM.YARN) {
|
|
83
|
-
execArgs.push("--prefer-offline");
|
|
84
|
-
}
|
|
85
86
|
const execPath = (0, node_module_collector_1.getPackageManagerCommand)(pm);
|
|
86
87
|
if (additionalArgs != null) {
|
|
87
88
|
execArgs.push(...additionalArgs);
|
|
88
89
|
}
|
|
89
90
|
await (0, builder_util_1.spawn)(execPath, execArgs, {
|
|
90
91
|
cwd: appDir,
|
|
91
|
-
env:
|
|
92
|
+
env: {
|
|
93
|
+
...getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true),
|
|
94
|
+
...env,
|
|
95
|
+
},
|
|
92
96
|
});
|
|
93
97
|
// Some native dependencies no longer use `install` hook for building their native module, (yarn 3+ removed implicit link of `install` and `rebuild` steps)
|
|
94
98
|
// https://github.com/electron-userland/electron-builder/issues/8024
|
|
95
|
-
return rebuild(config, { appDir, projectDir }, options);
|
|
99
|
+
return rebuild(config, { appDir, projectDir, workspaceRoot }, options);
|
|
96
100
|
}
|
|
97
101
|
async function nodeGypRebuild(platform, arch, frameworkInfo) {
|
|
98
102
|
builder_util_1.log.info({ platform, arch }, "executing node-gyp rebuild");
|
package/out/util/yarn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yarn.js","sourceRoot":"","sources":["../../src/util/yarn.ts"],"names":[],"mappings":";;AAaA,4CAqBC;AAWD,8BAiCC;AAED,kDA+BC;AAED,wCAiBC;AAmBD,0BAuCC;AA5LD,+CAAkD;AAClD,uCAAqC;AAErC,2BAA4B;AAC5B,6BAA4B;AAE5B,6CAA4D;AAC5D,oEAA6F;AAE7F,uCAAoD;AACpD,+BAA8B;AAGvB,KAAK,UAAU,gBAAgB,CAAC,MAAqB,EAAE,EAAE,MAAM,EAAE,UAAU,EAAkB,EAAE,OAAuB,EAAE,YAAY,GAAG,KAAK;IACjJ,MAAM,gBAAgB,GAAmB;QACvC,eAAe,EAAE,MAAM,CAAC,2BAA2B,KAAK,IAAI;QAC5D,cAAc,EAAE,IAAA,sBAAO,EAAC,MAAM,CAAC,OAAO,CAAC;QACvC,GAAG,OAAO;KACX,CAAA;IACD,IAAI,uBAAuB,GAAG,KAAK,CAAA;IAEnC,KAAK,MAAM,SAAS,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE,CAAC;QACpD,IAA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MAAM,EAAE,CAAC,CAAA;IACrG,CAAC;IAED,MAAM,EACJ,aAAa,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,GAC5C,GAAG,OAAO,CAAA;IACX,MAAM,OAAO,GAAG;QACd,eAAe;QACf,IAAI;QACJ,eAAe;QACf,MAAM,EAAE,kBAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI;KACrC,CAAA;IACD,kBAAG,CAAC,IAAI,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAA;IAEhD,MAAM,cAAc,GAA2B;QAC7C,SAAS,EAAE,MAAM;QACjB,eAAe;QACf,IAAI;QACJ,QAAQ;QACR,eAAe;QACf,eAAe,EAAE,UAAU;QAC3B,IAAI,EAAE,MAAM,CAAC,eAAe,IAAI,YAAY;QAC5C,iBAAiB,EAAE,IAAI;KACxB,CAAA;IACD,OAAO,IAAA,iBAAa,EAAC,cAAc,CAAC,CAAA;AACtC,CAAC","sourcesContent":["import { asArray, log, spawn } from \"builder-util\"\nimport { pathExists } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport { homedir } from \"os\"\nimport * as path from \"path\"\nimport { Configuration } from \"../configuration\"\nimport { executeAppBuilderAndWriteJson } from \"./appBuilder\"\nimport { PM, detectPackageManager, getPackageManagerCommand } from \"../node-module-collector\"\nimport { NodeModuleDirInfo } from \"./packageDependencies\"\nimport { rebuild as remoteRebuild } from \"./rebuild\"\nimport * as which from \"which\"\nimport { RebuildOptions as ElectronRebuildOptions } from \"@electron/rebuild\"\n\nexport async function installOrRebuild(config: Configuration, { appDir, projectDir }: DirectoryPaths, options: RebuildOptions, forceInstall = false) {\n const effectiveOptions: RebuildOptions = {\n buildFromSource: config.buildDependenciesFromSource === true,\n additionalArgs: asArray(config.npmArgs),\n ...options,\n }\n let isDependenciesInstalled = false\n\n for (const fileOrDir of [\"node_modules\", \".pnp.js\"]) {\n if ((await pathExists(path.join(projectDir, fileOrDir))) || (await pathExists(path.join(appDir, fileOrDir)))) {\n isDependenciesInstalled = true\n\n break\n }\n }\n\n if (forceInstall || !isDependenciesInstalled) {\n await installDependencies(config, { appDir, projectDir }, effectiveOptions)\n } else {\n await rebuild(config, { appDir, projectDir }, effectiveOptions)\n }\n}\n\nexport interface DesktopFrameworkInfo {\n version: string\n useCustomDist: boolean\n}\n\nfunction getElectronGypCacheDir() {\n return path.join(homedir(), \".electron-gyp\")\n}\n\nexport function getGypEnv(frameworkInfo: DesktopFrameworkInfo, platform: NodeJS.Platform, arch: string, buildFromSource: boolean) {\n const npmConfigArch = arch === \"armv7l\" ? \"arm\" : arch\n const common: any = {\n ...process.env,\n npm_config_arch: npmConfigArch,\n npm_config_target_arch: npmConfigArch,\n npm_config_platform: platform,\n npm_config_build_from_source: buildFromSource,\n // required for node-pre-gyp\n npm_config_target_platform: platform,\n npm_config_update_binary: true,\n npm_config_fallback_to_build: true,\n }\n\n if (platform !== process.platform) {\n common.npm_config_force = \"true\"\n }\n if (platform === \"win32\" || platform === \"darwin\") {\n common.npm_config_target_libc = \"unknown\"\n }\n\n if (!frameworkInfo.useCustomDist) {\n return common\n }\n\n // https://github.com/nodejs/node-gyp/issues/21\n return {\n ...common,\n npm_config_disturl: common.npm_config_electron_mirror || \"https://electronjs.org/headers\",\n npm_config_target: frameworkInfo.version,\n npm_config_runtime: \"electron\",\n npm_config_devdir: getElectronGypCacheDir(),\n }\n}\n\nexport async function installDependencies(config: Configuration, { appDir, projectDir }: DirectoryPaths, options: RebuildOptions): Promise<any> {\n const platform = options.platform || process.platform\n const arch = options.arch || process.arch\n const additionalArgs = options.additionalArgs\n\n const pm = detectPackageManager([projectDir])\n log.info({ pm, platform, arch, projectDir, appDir }, `installing production dependencies`)\n const execArgs = [\"install\"]\n if (pm === PM.YARN_BERRY) {\n if (process.env.NPM_NO_BIN_LINKS === \"true\") {\n execArgs.push(\"--no-bin-links\")\n }\n }\n\n if (pm === PM.YARN) {\n execArgs.push(\"--prefer-offline\")\n }\n\n const execPath = getPackageManagerCommand(pm)\n\n if (additionalArgs != null) {\n execArgs.push(...additionalArgs)\n }\n await spawn(execPath, execArgs, {\n cwd: appDir,\n env: getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true),\n })\n\n // Some native dependencies no longer use `install` hook for building their native module, (yarn 3+ removed implicit link of `install` and `rebuild` steps)\n // https://github.com/electron-userland/electron-builder/issues/8024\n return rebuild(config, { appDir, projectDir }, options)\n}\n\nexport async function nodeGypRebuild(platform: NodeJS.Platform, arch: string, frameworkInfo: DesktopFrameworkInfo) {\n log.info({ platform, arch }, \"executing node-gyp rebuild\")\n // this script must be used only for electron\n const nodeGyp = process.platform === \"win32\" ? which.sync(\"node-gyp\") : \"node-gyp\"\n const args = [\"rebuild\"]\n // headers of old Electron versions do not have a valid config.gypi file\n // and --force-process-config must be passed to node-gyp >= 8.4.0 to\n // correctly build modules for them.\n // see also https://github.com/nodejs/node-gyp/pull/2497\n const [major, minor] = frameworkInfo.version\n .split(\".\")\n .slice(0, 2)\n .map(n => parseInt(n, 10))\n if (major <= 13 || (major == 14 && minor <= 1) || (major == 15 && minor <= 2)) {\n args.push(\"--force-process-config\")\n }\n await spawn(nodeGyp, args, { env: getGypEnv(frameworkInfo, platform, arch, true) })\n}\nexport interface RebuildOptions {\n frameworkInfo: DesktopFrameworkInfo\n productionDeps: Lazy<Array<NodeModuleDirInfo>>\n\n platform?: NodeJS.Platform\n arch?: string\n\n buildFromSource?: boolean\n\n additionalArgs?: Array<string> | null\n}\n\nexport interface DirectoryPaths {\n appDir: string\n projectDir: string\n}\n\n/** @internal */\nexport async function rebuild(config: Configuration, { appDir, projectDir }: DirectoryPaths, options: RebuildOptions) {\n const configuration = {\n dependencies: await options.productionDeps.value,\n nodeExecPath: process.execPath,\n platform: options.platform || process.platform,\n arch: options.arch || process.arch,\n additionalArgs: options.additionalArgs,\n execPath: process.env.npm_execpath || process.env.NPM_CLI_JS,\n buildFromSource: options.buildFromSource === true,\n }\n const { arch, buildFromSource, platform } = configuration\n\n if (config.nativeRebuilder === \"legacy\") {\n const env = getGypEnv(options.frameworkInfo, platform, arch, buildFromSource)\n return executeAppBuilderAndWriteJson([\"rebuild-node-modules\"], configuration, { env, cwd: appDir })\n }\n\n const {\n frameworkInfo: { version: electronVersion },\n } = options\n const logInfo = {\n electronVersion,\n arch,\n buildFromSource,\n appDir: log.filePath(appDir) || \"./\",\n }\n log.info(logInfo, \"executing @electron/rebuild\")\n\n const rebuildOptions: ElectronRebuildOptions = {\n buildPath: appDir,\n electronVersion,\n arch,\n platform,\n buildFromSource,\n projectRootPath: projectDir,\n mode: config.nativeRebuilder || \"sequential\",\n disablePreGypCopy: true,\n }\n return remoteRebuild(rebuildOptions)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"yarn.js","sourceRoot":"","sources":["../../src/util/yarn.ts"],"names":[],"mappings":";;AAaA,4CA2BC;AAWD,8BAiCC;AAED,kDAyCC;AAED,wCAiBC;AAoBD,0BAuCC;AA7MD,+CAAkD;AAClD,uCAAqC;AAErC,2BAA4B;AAC5B,6BAA4B;AAE5B,6CAA4D;AAC5D,oEAA6F;AAE7F,uCAAoD;AACpD,+BAA8B;AAGvB,KAAK,UAAU,gBAAgB,CACpC,MAAqB,EACrB,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAkB,EACrD,OAAuB,EACvB,YAAY,GAAG,KAAK,EACpB,GAAsB;IAEtB,MAAM,gBAAgB,GAAmB;QACvC,eAAe,EAAE,MAAM,CAAC,2BAA2B,KAAK,IAAI;QAC5D,cAAc,EAAE,IAAA,sBAAO,EAAC,MAAM,CAAC,OAAO,CAAC;QACvC,GAAG,OAAO;KACX,CAAA;IACD,IAAI,uBAAuB,GAAG,KAAK,CAAA;IAEnC,KAAK,MAAM,SAAS,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE,CAAC;QACpD,IAAI,CAAC,MAAM,IAAA,qBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,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AQ,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,CAAC,CAAA;QAC7E,OAAO,IAAA,0CAA6B,EAAC,CAAC,sBAAsB,CAAC,EAAE,aAAa,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA;IACrG,CAAC;IAED,MAAM,EACJ,aAAa,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,GAC5C,GAAG,OAAO,CAAA;IACX,MAAM,OAAO,GAAG;QACd,eAAe;QACf,IAAI;QACJ,eAAe;QACf,MAAM,EAAE,kBAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI;KACrC,CAAA;IACD,kBAAG,CAAC,IAAI,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAA;IAEhD,MAAM,cAAc,GAA2B;QAC7C,SAAS,EAAE,MAAM;QACjB,eAAe;QACf,IAAI;QACJ,QAAQ;QACR,eAAe;QACf,eAAe,EAAE,UAAU;QAC3B,IAAI,EAAE,MAAM,CAAC,eAAe,IAAI,YAAY;QAC5C,iBAAiB,EAAE,IAAI;KACxB,CAAA;IACD,OAAO,IAAA,iBAAa,EAAC,cAAc,CAAC,CAAA;AACtC,CAAC","sourcesContent":["import { asArray, log, spawn } from \"builder-util\"\nimport { pathExists } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport { homedir } from \"os\"\nimport * as path from \"path\"\nimport { Configuration } from \"../configuration\"\nimport { executeAppBuilderAndWriteJson } from \"./appBuilder\"\nimport { PM, detectPackageManager, getPackageManagerCommand } from \"../node-module-collector\"\nimport { NodeModuleDirInfo } from \"./packageDependencies\"\nimport { rebuild as remoteRebuild } from \"./rebuild\"\nimport * as which from \"which\"\nimport { RebuildOptions as ElectronRebuildOptions } from \"@electron/rebuild\"\n\nexport async function installOrRebuild(\n config: Configuration,\n { appDir, projectDir, workspaceRoot }: DirectoryPaths,\n options: RebuildOptions,\n forceInstall = false,\n env: NodeJS.ProcessEnv\n) {\n const effectiveOptions: RebuildOptions = {\n buildFromSource: config.buildDependenciesFromSource === true,\n additionalArgs: asArray(config.npmArgs),\n ...options,\n }\n let isDependenciesInstalled = false\n\n for (const fileOrDir of [\"node_modules\", \".pnp.js\"]) {\n if ((await pathExists(path.join(projectDir, fileOrDir))) || (await pathExists(path.join(appDir, fileOrDir)))) {\n isDependenciesInstalled = true\n\n break\n }\n }\n\n if (forceInstall || !isDependenciesInstalled) {\n await installDependencies(config, { appDir, projectDir, workspaceRoot }, effectiveOptions, env)\n } else {\n await rebuild(config, { appDir, projectDir, workspaceRoot }, effectiveOptions)\n }\n}\n\nexport interface DesktopFrameworkInfo {\n version: string\n useCustomDist: boolean\n}\n\nfunction getElectronGypCacheDir() {\n return path.join(homedir(), \".electron-gyp\")\n}\n\nexport function getGypEnv(frameworkInfo: DesktopFrameworkInfo, platform: NodeJS.Platform, arch: string, buildFromSource: boolean) {\n const npmConfigArch = arch === \"armv7l\" ? \"arm\" : arch\n const common: any = {\n ...process.env,\n npm_config_arch: npmConfigArch,\n npm_config_target_arch: npmConfigArch,\n npm_config_platform: platform,\n npm_config_build_from_source: buildFromSource,\n // required for node-pre-gyp\n npm_config_target_platform: platform,\n npm_config_update_binary: true,\n npm_config_fallback_to_build: true,\n }\n\n if (platform !== process.platform) {\n common.npm_config_force = \"true\"\n }\n if (platform === \"win32\" || platform === \"darwin\") {\n common.npm_config_target_libc = \"unknown\"\n }\n\n if (!frameworkInfo.useCustomDist) {\n return common\n }\n\n // https://github.com/nodejs/node-gyp/issues/21\n return {\n ...common,\n npm_config_disturl: common.npm_config_electron_mirror || \"https://electronjs.org/headers\",\n npm_config_target: frameworkInfo.version,\n npm_config_runtime: \"electron\",\n npm_config_devdir: getElectronGypCacheDir(),\n }\n}\n\nexport async function installDependencies(\n config: Configuration,\n { appDir, projectDir, workspaceRoot }: DirectoryPaths,\n options: RebuildOptions,\n env: NodeJS.ProcessEnv\n): Promise<any> {\n const platform = options.platform || process.platform\n const arch = options.arch || process.arch\n const additionalArgs = options.additionalArgs\n\n const searchPaths = [projectDir, appDir].concat(workspaceRoot ? [workspaceRoot] : [])\n const { pm, resolvedDirectory: _resolvedWorkspaceDir } = await detectPackageManager(searchPaths)\n\n log.info({ pm, platform, arch, projectDir, appDir, workspaceRoot: _resolvedWorkspaceDir }, \"installing dependencies\")\n\n const execArgs = [\"install\"]\n if (pm === PM.YARN) {\n execArgs.push(\"--prefer-offline\")\n } else if (pm === PM.YARN_BERRY) {\n if (process.env.NPM_NO_BIN_LINKS === \"true\") {\n execArgs.push(\"--no-bin-links\")\n }\n }\n\n const execPath = getPackageManagerCommand(pm)\n\n if (additionalArgs != null) {\n execArgs.push(...additionalArgs)\n }\n\n await spawn(execPath, execArgs, {\n cwd: appDir,\n env: {\n ...getGypEnv(options.frameworkInfo, platform, arch, options.buildFromSource === true),\n ...env,\n },\n })\n\n // Some native dependencies no longer use `install` hook for building their native module, (yarn 3+ removed implicit link of `install` and `rebuild` steps)\n // https://github.com/electron-userland/electron-builder/issues/8024\n return rebuild(config, { appDir, projectDir, workspaceRoot }, options)\n}\n\nexport async function nodeGypRebuild(platform: NodeJS.Platform, arch: string, frameworkInfo: DesktopFrameworkInfo) {\n log.info({ platform, arch }, \"executing node-gyp rebuild\")\n // this script must be used only for electron\n const nodeGyp = process.platform === \"win32\" ? which.sync(\"node-gyp\") : \"node-gyp\"\n const args = [\"rebuild\"]\n // headers of old Electron versions do not have a valid config.gypi file\n // and --force-process-config must be passed to node-gyp >= 8.4.0 to\n // correctly build modules for them.\n // see also https://github.com/nodejs/node-gyp/pull/2497\n const [major, minor] = frameworkInfo.version\n .split(\".\")\n .slice(0, 2)\n .map(n => parseInt(n, 10))\n if (major <= 13 || (major == 14 && minor <= 1) || (major == 15 && minor <= 2)) {\n args.push(\"--force-process-config\")\n }\n await spawn(nodeGyp, args, { env: getGypEnv(frameworkInfo, platform, arch, true) })\n}\nexport interface RebuildOptions {\n frameworkInfo: DesktopFrameworkInfo\n productionDeps: Lazy<Array<NodeModuleDirInfo>>\n\n platform?: NodeJS.Platform\n arch?: string\n\n buildFromSource?: boolean\n\n additionalArgs?: Array<string> | null\n}\n\nexport interface DirectoryPaths {\n appDir: string\n projectDir: string\n workspaceRoot: string | null\n}\n\n/** @internal */\nexport async function rebuild(config: Configuration, { appDir, projectDir }: DirectoryPaths, options: RebuildOptions) {\n const configuration = {\n dependencies: await options.productionDeps.value,\n nodeExecPath: process.execPath,\n platform: options.platform || process.platform,\n arch: options.arch || process.arch,\n additionalArgs: options.additionalArgs,\n execPath: process.env.npm_execpath || process.env.NPM_CLI_JS,\n buildFromSource: options.buildFromSource === true,\n }\n const { arch, buildFromSource, platform } = configuration\n\n if (config.nativeRebuilder === \"legacy\") {\n const env = getGypEnv(options.frameworkInfo, platform, arch, buildFromSource)\n return executeAppBuilderAndWriteJson([\"rebuild-node-modules\"], configuration, { env, cwd: appDir })\n }\n\n const {\n frameworkInfo: { version: electronVersion },\n } = options\n const logInfo = {\n electronVersion,\n arch,\n buildFromSource,\n appDir: log.filePath(appDir) || \"./\",\n }\n log.info(logInfo, \"executing @electron/rebuild\")\n\n const rebuildOptions: ElectronRebuildOptions = {\n buildPath: appDir,\n electronVersion,\n arch,\n platform,\n buildFromSource,\n projectRootPath: projectDir,\n mode: config.nativeRebuilder || \"sequential\",\n disablePreGypCopy: true,\n }\n return remoteRebuild(rebuildOptions)\n}\n"]}
|
package/out/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "26.
|
|
1
|
+
export declare const PACKAGE_VERSION = "26.3.0";
|
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,QAAQ,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"26.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"26.3.0\"\n"]}
|
package/out/winPackager.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare class WinPackager extends PlatformPackager<WindowsConfiguration>
|
|
|
18
18
|
createTargets(targets: Array<string>, mapper: (name: string, factory: (outDir: string) => Target) => void): void;
|
|
19
19
|
getIconPath(): Promise<string | null>;
|
|
20
20
|
doGetCscPassword(): string | Nullish;
|
|
21
|
-
|
|
21
|
+
signIf(file: string): Promise<boolean>;
|
|
22
22
|
signAndEditResources(file: string, arch: Arch, outDir: string, internalName?: string | null, requestedExecutionLevel?: RequestedExecutionLevel | null): Promise<void>;
|
|
23
23
|
private shouldSignFile;
|
|
24
24
|
protected createTransformerForExtraFiles(packContext: AfterPackContext): FileTransformer | null;
|
package/out/winPackager.js
CHANGED
|
@@ -101,7 +101,11 @@ class WinPackager extends platformPackager_1.PlatformPackager {
|
|
|
101
101
|
var _a;
|
|
102
102
|
return (0, platformPackager_1.chooseNotNull)((0, platformPackager_1.chooseNotNull)((_a = this.platformSpecificBuildOptions.signtoolOptions) === null || _a === void 0 ? void 0 : _a.certificatePassword, process.env.WIN_CSC_KEY_PASSWORD), super.doGetCscPassword());
|
|
103
103
|
}
|
|
104
|
-
async
|
|
104
|
+
async signIf(file) {
|
|
105
|
+
if (!this.shouldSignFile(file, true)) {
|
|
106
|
+
builder_util_1.log.info({ file: builder_util_1.log.filePath(file) }, "file signing skipped via signExts configuration");
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
105
109
|
const signOptions = {
|
|
106
110
|
path: file,
|
|
107
111
|
options: this.platformSpecificBuildOptions,
|
|
@@ -177,16 +181,29 @@ class WinPackager extends platformPackager_1.PlatformPackager {
|
|
|
177
181
|
const vendorPath = await (0, windowsSignToolManager_1.getSignVendorPath)();
|
|
178
182
|
await (0, wine_1.execWine)(path.join(vendorPath, "rcedit-ia32.exe"), path.join(vendorPath, "rcedit-x64.exe"), args);
|
|
179
183
|
}
|
|
180
|
-
await this.
|
|
184
|
+
await this.signIf(file);
|
|
181
185
|
timer.end();
|
|
182
186
|
if (buildCacheManager != null) {
|
|
183
187
|
await buildCacheManager.save();
|
|
184
188
|
}
|
|
185
189
|
}
|
|
186
|
-
shouldSignFile(file) {
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
+
shouldSignFile(file, fallbackValue = false) {
|
|
191
|
+
const backwardCompatibility = file.endsWith(".exe");
|
|
192
|
+
const signExts = this.platformSpecificBuildOptions.signExts;
|
|
193
|
+
if (!(signExts === null || signExts === void 0 ? void 0 : signExts.length)) {
|
|
194
|
+
return backwardCompatibility || fallbackValue;
|
|
195
|
+
}
|
|
196
|
+
// process patterns ( !exe => exclude .exe, .dll => include .dll )
|
|
197
|
+
// we process first to allow literal negatives in case a filename matches "help!.txt" or similar
|
|
198
|
+
if (signExts.some(ext => file.endsWith(ext))) {
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
201
|
+
// process negative patterns
|
|
202
|
+
if (signExts.some(ext => ext.startsWith("!") && file.endsWith(ext.substring(1)))) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
// if no explicit patterns matched, fall back to backward compatibility
|
|
206
|
+
return backwardCompatibility || fallbackValue;
|
|
190
207
|
}
|
|
191
208
|
createTransformerForExtraFiles(packContext) {
|
|
192
209
|
if (this.platformSpecificBuildOptions.signAndEditExecutable === false) {
|
|
@@ -196,7 +213,7 @@ class WinPackager extends platformPackager_1.PlatformPackager {
|
|
|
196
213
|
if (this.shouldSignFile(file)) {
|
|
197
214
|
const parentDir = path.dirname(file);
|
|
198
215
|
if (parentDir !== packContext.appOutDir) {
|
|
199
|
-
return new builder_util_1.CopyFileTransformer(file => this.
|
|
216
|
+
return new builder_util_1.CopyFileTransformer(file => this.signIf(file));
|
|
200
217
|
}
|
|
201
218
|
}
|
|
202
219
|
return null;
|
|
@@ -213,7 +230,7 @@ class WinPackager extends platformPackager_1.PlatformPackager {
|
|
|
213
230
|
await this.signAndEditResources(path.join(packContext.appOutDir, exeFileName), packContext.arch, packContext.outDir, path.basename(exeFileName, ".exe"), this.platformSpecificBuildOptions.requestedExecutionLevel);
|
|
214
231
|
}
|
|
215
232
|
else if (this.shouldSignFile(file)) {
|
|
216
|
-
await this.
|
|
233
|
+
await this.signIf(path.join(packContext.appOutDir, file));
|
|
217
234
|
}
|
|
218
235
|
}
|
|
219
236
|
if (!isAsar) {
|
|
@@ -225,7 +242,7 @@ class WinPackager extends platformPackager_1.PlatformPackager {
|
|
|
225
242
|
};
|
|
226
243
|
const filesToSign = await Promise.all([filesPromise(["resources", "app.asar.unpacked"]), filesPromise(["swiftshader"])]);
|
|
227
244
|
for (const file of filesToSign.flat(1)) {
|
|
228
|
-
await this.
|
|
245
|
+
await this.signIf(file);
|
|
229
246
|
}
|
|
230
247
|
return true;
|
|
231
248
|
}
|