app-builder-lib 25.1.8 → 26.0.0-alpha.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"AppFileWalker.js","sourceRoot":"","sources":["../../src/util/AppFileWalker.ts"],"names":[],"mappings":";;;AACA,uCAAgD;AAGhD,6BAA4B;AAE5B,MAAM,gCAAgC,GAAG,GAAG,IAAI,CAAC,GAAG,cAAc,CAAA;AAElE,SAAS,mBAAmB,CAAC,OAAoB;IAC/C,IAAI,CAAC,OAAO,CAAC,uBAAuB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,EAAE,CAAC;QAC5F,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;IAChC,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,MAAsB,cAAc;IAGlC,YACqB,OAAoB,EAC9B,MAAqB,EACX,QAAkB;QAFlB,YAAO,GAAP,OAAO,CAAa;QAC9B,WAAM,GAAN,MAAM,CAAe;QACX,aAAQ,GAAR,QAAQ,CAAU;QAL9B,aAAQ,GAAG,IAAI,GAAG,EAAiB,CAAA;IAMzC,CAAC;IAEM,UAAU,CAAC,IAAY,EAAE,MAAc,EAAE,QAAe;QAChE,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAA;QACb,CAAC;QAED,OAAO,IAAA,mBAAQ,EAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAO,EAAE;YAC7C,+HAA+H;YAC/H,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,CAAA;QAC/D,CAAC,CAAC,CAAA;IACJ,CAAC;IAEO,aAAa,CAAC,QAAe,EAAE,IAAY,EAAE,MAAc,EAAE,UAAkB;QACrF,MAAM,kBAAkB,G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IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;IAChD,CAAC;CACF;AA9BD,sCA8BC","sourcesContent":["import { Filter, FileConsumer } from \"builder-util\"\nimport { readlink, stat, Stats } from \"fs-extra\"\nimport { FileMatcher } from \"../fileMatcher\"\nimport { Packager } from \"../packager\"\nimport * as path from \"path\"\n\nconst nodeModulesSystemDependentSuffix = `${path.sep}node_modules`\n\nfunction addAllPatternIfNeed(matcher: FileMatcher) {\n if (!matcher.isSpecifiedAsEmptyArray && (matcher.isEmpty() || matcher.containsOnlyIgnore())) {\n matcher.prependPattern(\"**/*\")\n }\n return matcher\n}\n\nexport abstract class FileCopyHelper {\n readonly metadata = new Map<string, Stats>()\n\n protected constructor(\n protected readonly matcher: FileMatcher,\n readonly filter: Filter | null,\n protected readonly packager: Packager\n ) {}\n\n protected handleFile(file: string, parent: string, fileStat: Stats): Promise<Stats | null> | null {\n if (!fileStat.isSymbolicLink()) {\n return null\n }\n\n return readlink(file).then((linkTarget): any => {\n // http://unix.stackexchange.com/questions/105637/is-symlinks-target-relative-to-the-destinations-parent-directory-and-if-so-wh\n return this.handleSymlink(fileStat, file, parent, linkTarget)\n })\n }\n\n private handleSymlink(fileStat: Stats, file: string, parent: string, linkTarget: string): Promise<Stats> | null {\n const resolvedLinkTarget = path.resolve(parent, linkTarget)\n const link = path.relative(this.matcher.from, resolvedLinkTarget)\n if (link.startsWith(\"..\")) {\n // outside of project, linked module (https://github.com/electron-userland/electron-builder/issues/675)\n return stat(resolvedLinkTarget).then(targetFileStat => {\n this.metadata.set(file, targetFileStat)\n return targetFileStat\n })\n } else {\n const s = fileStat as any\n s.relativeLink = link\n s.linkRelativeToFile = path.relative(parent, resolvedLinkTarget)\n }\n return null\n }\n}\n\nfunction createAppFilter(matcher: FileMatcher, packager: Packager): Filter | null {\n if (packager.areNodeModulesHandledExternally) {\n return matcher.isEmpty() ? null : matcher.createFilter()\n }\n\n const nodeModulesFilter: Filter = (file, fileStat) => {\n return !(fileStat.isDirectory() && file.endsWith(nodeModulesSystemDependentSuffix))\n }\n\n if (matcher.isEmpty()) {\n return nodeModulesFilter\n }\n\n const filter = matcher.createFilter()\n return (file, fileStat) => {\n if (!nodeModulesFilter(file, fileStat)) {\n return !!packager.config.includeSubNodeModules\n }\n return filter(file, fileStat)\n }\n}\n\n/** @internal */\nexport class AppFileWalker extends FileCopyHelper implements FileConsumer {\n readonly matcherFilter: any\n constructor(matcher: FileMatcher, packager: Packager) {\n super(addAllPatternIfNeed(matcher), createAppFilter(matcher, packager), packager)\n this.matcherFilter = matcher.createFilter()\n }\n\n // noinspection JSUnusedGlobalSymbols\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n consume(file: string, fileStat: Stats, parent: string, siblingNames: Array<string>): any {\n if (fileStat.isDirectory()) {\n // https://github.com/electron-userland/electron-builder/issues/1539\n // but do not filter if we inside node_modules dir\n // update: solution disabled, node module resolver should support such setup\n if (file.endsWith(nodeModulesSystemDependentSuffix)) {\n if (!this.packager.config.includeSubNodeModules) {\n const matchesFilter = this.matcherFilter(file, fileStat)\n if (!matchesFilter) {\n // Skip the file\n return false\n }\n }\n }\n } else {\n // save memory - no need to store stat for directory\n this.metadata.set(file, fileStat)\n }\n\n return this.handleFile(file, parent, fileStat)\n }\n}\n"]}
1
+ {"version":3,"file":"AppFileWalker.js","sourceRoot":"","sources":["../../src/util/AppFileWalker.ts"],"names":[],"mappings":";;;AACA,uCAAgD;AAGhD,6BAA4B;AAE5B,SAAS,mBAAmB,CAAC,OAAoB;IAC/C,IAAI,CAAC,OAAO,CAAC,uBAAuB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,EAAE,CAAC;QAC5F,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;IAChC,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,MAAsB,cAAc;IAGlC,YACqB,OAAoB,EAC9B,MAAqB,EACX,QAAkB;QAF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CAAC,CAAA;QAClE,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AApCD,wCAoCC;AAED,SAAS,eAAe,CAAC,OAAoB,EAAE,QAAkB;IAC/D,IAAI,QAAQ,CAAC,+BAA+B,EAAE,CAAC;QAC7C,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,CAAA;IAC1D,CAAC;IACD,OAAO,OAAO,CAAC,YAAY,EAAE,CAAA;AAC/B,CAAC;AAED,gBAAgB;AAChB,MAAa,aAAc,SAAQ,cAAc;IAE/C,YAAY,OAAoB,EAAE,QAAkB;QAClD,KAAK,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAA;QACjF,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,EAAE,CAAA;IAC7C,CAAC;IAED,qCAAqC;IACrC,6DAA6D;IAC7D,OAAO,CAAC,IAAY,EAAE,QAAe,EAAE,MAAc,EAAE,YAA2B;QAChF,IAAI,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;YAC3B,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;YACxD,OAAO,CAAC,aAAa,CAAA;QACvB,CAAC;aAAM,CAAC;YACN,oDAAoD;YACpD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;QACnC,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;IAChD,CAAC;CACF;AApBD,sCAoBC","sourcesContent":["import { Filter, FileConsumer, FilterStats } from \"builder-util\"\nimport { readlink, stat, Stats } from \"fs-extra\"\nimport { FileMatcher } from \"../fileMatcher\"\nimport { Packager } from \"../packager\"\nimport * as path from \"path\"\n\nfunction addAllPatternIfNeed(matcher: FileMatcher) {\n if (!matcher.isSpecifiedAsEmptyArray && (matcher.isEmpty() || matcher.containsOnlyIgnore())) {\n matcher.prependPattern(\"**/*\")\n }\n return matcher\n}\n\nexport abstract class FileCopyHelper {\n readonly metadata = new Map<string, Stats>()\n\n protected constructor(\n protected readonly matcher: FileMatcher,\n readonly filter: Filter | null,\n protected readonly packager: Packager\n ) {}\n\n protected handleFile(file: string, parent: string, fileStat: Stats): Promise<Stats | null> | null {\n if (!fileStat.isSymbolicLink()) {\n return null\n }\n\n return readlink(file).then((linkTarget): any => {\n // http://unix.stackexchange.com/questions/105637/is-symlinks-target-relative-to-the-destinations-parent-directory-and-if-so-wh\n return this.handleSymlink(fileStat, file, parent, linkTarget)\n })\n }\n\n private handleSymlink(fileStat: Stats, file: string, parent: string, linkTarget: string): Promise<Stats> | null {\n const resolvedLinkTarget = path.resolve(parent, linkTarget)\n const link = path.relative(this.matcher.from, resolvedLinkTarget)\n if (link.startsWith(\"..\")) {\n // outside of project, linked module (https://github.com/electron-userland/electron-builder/issues/675)\n return stat(resolvedLinkTarget).then(targetFileStat => {\n this.metadata.set(file, targetFileStat)\n return targetFileStat\n })\n } else {\n const s: FilterStats = fileStat\n s.relativeLink = link\n s.linkRelativeToFile = path.relative(parent, resolvedLinkTarget)\n }\n return null\n }\n}\n\nfunction createAppFilter(matcher: FileMatcher, packager: Packager): Filter | null {\n if (packager.areNodeModulesHandledExternally) {\n return matcher.isEmpty() ? null : matcher.createFilter()\n }\n return matcher.createFilter()\n}\n\n/** @internal */\nexport class AppFileWalker extends FileCopyHelper implements FileConsumer {\n readonly matcherFilter: any\n constructor(matcher: FileMatcher, packager: Packager) {\n super(addAllPatternIfNeed(matcher), createAppFilter(matcher, packager), packager)\n this.matcherFilter = matcher.createFilter()\n }\n\n // noinspection JSUnusedGlobalSymbols\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n consume(file: string, fileStat: Stats, parent: string, siblingNames: Array<string>): any {\n if (fileStat.isDirectory()) {\n const matchesFilter = this.matcherFilter(file, fileStat)\n return !matchesFilter\n } else {\n // save memory - no need to store stat for directory\n this.metadata.set(file, fileStat)\n }\n\n return this.handleFile(file, parent, fileStat)\n }\n}\n"]}
@@ -9,7 +9,18 @@ const fileMatcher_1 = require("../fileMatcher");
9
9
  const resolve_1 = require("./resolve");
10
10
  const AppFileWalker_1 = require("./AppFileWalker");
11
11
  const fs_1 = require("fs");
12
- const excludedFiles = new Set([".DS_Store", "node_modules" /* already in the queue */, "CHANGELOG.md", "ChangeLog", "changelog.md", "Changelog.md", "Changelog", "binding.gyp", ".npmignore"].concat(fileMatcher_1.excludedNames.split(",")));
12
+ const excludedFiles = new Set([
13
+ ".DS_Store",
14
+ "node_modules" /* already in the queue */,
15
+ "CHANGELOG.md",
16
+ "ChangeLog",
17
+ "changelog.md",
18
+ "Changelog.md",
19
+ "Changelog",
20
+ "binding.gyp",
21
+ ".npmignore",
22
+ "node_gyp_bins",
23
+ ].concat(fileMatcher_1.excludedNames.split(",")));
13
24
  const topLevelExcludedFiles = new Set([
14
25
  "karma.conf.js",
15
26
  ".coveralls.yml",
@@ -88,7 +99,8 @@ class NodeModuleCopyHelper extends AppFileWalker_1.FileCopyHelper {
88
99
  return null;
89
100
  }
90
101
  }
91
- return (0, fs_extra_1.lstat)(filePath).then(stat => {
102
+ return (0, fs_extra_1.lstat)(filePath).then((stat) => {
103
+ stat.relativeNodeModulesPath = path.join("node_modules", moduleName, path.relative(depPath, filePath));
92
104
  if (filter != null && !filter(filePath, stat)) {
93
105
  return null;
94
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NodeModuleCopyHelper.js","sourceRoot":"","sources":["../../src/util/NodeModuleCopyHelper.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,+CAA0C;AAC1C,uCAAoD;AACpD,6BAA4B;AAC5B,gDAA2D;AAE3D,uCAA2C;AAC3C,mDAAgD;AAEhD,2BAAiC;AAEjC,MAAM,aAAa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K,IAAI,IAAI,EAAE,CAAC;oBAClB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;oBAClB,IAAI,MAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,0CAAE,cAAc,EAAE,EAAE,CAAC;wBAC/C,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;oBAC5C,CAAC;oBACD,OAAO,GAAG,KAAK,CAAA;gBACjB,CAAC;YACH,CAAC;YAED,IAAI,OAAO,EAAE,CAAC;gBACZ,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACxB,CAAC;YAED,IAAI,CAAC,IAAI,EAAE,CAAA;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;QAED,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,YAAY,EAAE,CAAC;YACzC,MAAM,YAAY,GAAG,IAAA,iBAAY,EAAC,IAAI,CAAC,CAAA;YACvC,IAAI,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;gBAChC,+CAA+C;gBAC/C,MAAM,CAAC,KAAK,CAAC,GAAG,SAAS,CAAA;YAC3B,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAgB,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC,CAAA;IAC9D,CAAC;CACF;AAnID,oDAmIC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { CONCURRENCY } from \"builder-util\"\nimport { lstat, readdir, lstatSync } from \"fs-extra\"\nimport * as path from \"path\"\nimport { excludedNames, FileMatcher } from \"../fileMatcher\"\nimport { Packager } from \"../packager\"\nimport { resolveFunction } from \"./resolve\"\nimport { FileCopyHelper } from \"./AppFileWalker\"\nimport { NodeModuleInfo } from \"./packageDependencies\"\nimport { realpathSync } from \"fs\"\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 | undefined> = []\n const queue: Array<string> = []\n const emptyDirs: Set<string> = new Set()\n const symlinkFiles: Map<string, number> = new Map()\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 = path.join(dirPath, name)\n\n const forceIncluded = onNodeModuleFile != null && !!onNodeModuleFile(filePath)\n\n if (excludedFiles.has(name) || name.startsWith(\"._\")) {\n return null\n }\n\n // check if filematcher matches the files array as more important than the default excluded files.\n const fileMatched = filter != null && filter(dirPath, lstatSync(dirPath))\n if (!fileMatched || !forceIncluded || !!this.packager.config.disableDefaultIgnoredFiles) {\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 let isEmpty = true\n for (const child of sortedFilePaths) {\n if (child != null) {\n result.push(child)\n if (this.metadata.get(child)?.isSymbolicLink()) {\n symlinkFiles.set(child, result.length - 1)\n }\n isEmpty = false\n }\n }\n\n if (isEmpty) {\n emptyDirs.add(dirPath)\n }\n\n dirs.sort()\n for (const child of dirs) {\n queue.push(dirPath + path.sep + child)\n }\n }\n\n for (const [file, index] of symlinkFiles) {\n const resolvedPath = realpathSync(file)\n if (emptyDirs.has(resolvedPath)) {\n // delete symlink file if target is a empty dir\n result[index] = undefined\n }\n }\n return result.filter((it): it is string => it !== undefined)\n }\n}\n"]}
1
+ {"version":3,"file":"NodeModuleCopyHelper.js","sourceRoot":"","sources":["../../src/util/NodeModuleCopyHelper.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,+CAAuD;AACvD,uCAAoD;AACpD,6BAA4B;AAC5B,gDAA2D;AAE3D,uCAA2C;AAC3C,mDAAgD;AAEhD,2BAAiC;AAEjC,MAAM,aAAa,GAAG,IAAI,GAAG,CAC3B;IACE,WAAW;IACX,cAAc,CAAC,0BAA0B;IACzC,cAAc;IACd,WAAW;IACX,cAAc;IACd,cAAc;IACd,WAAW;IACX,aAAa;IACb,YAAY;IACZ,eAAe;CAChB,CAAC,MAAM,CAAC,2BAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CACnC,CAAA;AAED,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IACpC,eAAe;IACf,gBAAgB;IAChB,WAAW;IACX,iBAAiB;IACjB,QAAQ;IACR,WAAW;IACX,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,WAAW;IACX,cAAc;IACd,SAAS;IACT,UAAU;IACV,MAAM;CACP,CAAC,CAAA;AAEF,gBAAgB;AAChB,MAAa,oBAAqB,SAAQ,8BAAc;IACtD,YAAY,OAAoB,EAAE,QAAkB;QAClD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,QAAQ,CAAC,CAAA;IAC7E,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,UAA0B,EAAE,sBAAqC;;QACxF,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QAC1B,MAAM,QAAQ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YACzC,MAAM,YAAY,GAAG,IAAA,iBAAY,EAAC,IAAI,CAAC,CAAA;YACvC,IAAI,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;gBAChC,+CAA+C;gBAC/C,MAAM,CAAC,KAAK,CAAC,GAAG,SAAS,CAAA;YAC3B,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAgB,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC,CAAA;IAC9D,CAAC;CACF;AApID,oDAoIC","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { CONCURRENCY, FilterStats } from \"builder-util\"\nimport { lstat, readdir, lstatSync } from \"fs-extra\"\nimport * as path from \"path\"\nimport { excludedNames, FileMatcher } from \"../fileMatcher\"\nimport { Packager } from \"../packager\"\nimport { resolveFunction } from \"./resolve\"\nimport { FileCopyHelper } from \"./AppFileWalker\"\nimport { NodeModuleInfo } from \"./packageDependencies\"\nimport { realpathSync } from \"fs\"\n\nconst excludedFiles = new Set(\n [\n \".DS_Store\",\n \"node_modules\" /* already in the queue */,\n \"CHANGELOG.md\",\n \"ChangeLog\",\n \"changelog.md\",\n \"Changelog.md\",\n \"Changelog\",\n \"binding.gyp\",\n \".npmignore\",\n \"node_gyp_bins\",\n ].concat(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 | undefined> = []\n const queue: Array<string> = []\n const emptyDirs: Set<string> = new Set()\n const symlinkFiles: Map<string, number> = new Map()\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 = path.join(dirPath, name)\n\n const forceIncluded = onNodeModuleFile != null && !!onNodeModuleFile(filePath)\n\n if (excludedFiles.has(name) || name.startsWith(\"._\")) {\n return null\n }\n\n // check if filematcher matches the files array as more important than the default excluded files.\n const fileMatched = filter != null && filter(dirPath, lstatSync(dirPath))\n if (!fileMatched || !forceIncluded || !!this.packager.config.disableDefaultIgnoredFiles) {\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: FilterStats) => {\n stat.relativeNodeModulesPath = path.join(\"node_modules\", moduleName, path.relative(depPath, filePath))\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 let isEmpty = true\n for (const child of sortedFilePaths) {\n if (child != null) {\n result.push(child)\n if (this.metadata.get(child)?.isSymbolicLink()) {\n symlinkFiles.set(child, result.length - 1)\n }\n isEmpty = false\n }\n }\n\n if (isEmpty) {\n emptyDirs.add(dirPath)\n }\n\n dirs.sort()\n for (const child of dirs) {\n queue.push(dirPath + path.sep + child)\n }\n }\n\n for (const [file, index] of symlinkFiles) {\n const resolvedPath = realpathSync(file)\n if (emptyDirs.has(resolvedPath)) {\n // delete symlink file if target is a empty dir\n result[index] = undefined\n }\n }\n return result.filter((it): it is string => it !== undefined)\n }\n}\n"]}
@@ -150,36 +150,21 @@ async function computeNodeModuleFileSets(platformPackager, mainMatcher) {
150
150
  const result = new Array();
151
151
  let index = 0;
152
152
  const NODE_MODULES = "node_modules";
153
- const getRealSource = (name, source) => {
154
- let parentDir = path.dirname(source);
155
- const scopeDepth = name.split("/").length;
156
- // get the parent dir of the package, input: /root/path/node_modules/@electron/remote, output: /root/path/node_modules
157
- for (let i = 0; i < scopeDepth - 1; i++) {
158
- parentDir = path.dirname(parentDir);
159
- }
160
- // for the local node modules which is not in node modules
161
- if (!parentDir.endsWith(path.sep + NODE_MODULES)) {
162
- return parentDir;
163
- }
164
- // use main matcher patterns,return parent dir of the node_modules, so user can exclude some files !node_modules/xxxx
165
- return path.dirname(parentDir);
166
- };
167
- const collectNodeModules = async (dep, realSource, destination) => {
153
+ const collectNodeModules = async (dep, destination) => {
168
154
  const source = dep.dir;
169
- const matcher = new fileMatcher_1.FileMatcher(realSource, destination, mainMatcher.macroExpander, mainMatcher.patterns);
155
+ const matcher = new fileMatcher_1.FileMatcher(source, destination, mainMatcher.macroExpander, mainMatcher.patterns);
170
156
  const copier = new NodeModuleCopyHelper_1.NodeModuleCopyHelper(matcher, platformPackager.info);
171
157
  const files = await copier.collectNodeModules(dep, nodeModuleExcludedExts);
172
158
  result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata });
173
159
  if (dep.conflictDependency) {
174
160
  for (const c of dep.conflictDependency) {
175
- await collectNodeModules(c, realSource, path.join(destination, NODE_MODULES, c.name));
161
+ await collectNodeModules(c, path.join(destination, NODE_MODULES, c.name));
176
162
  }
177
163
  }
178
164
  };
179
165
  for (const dep of deps) {
180
166
  const destination = path.join(mainMatcher.to, NODE_MODULES, dep.name);
181
- const realSource = getRealSource(dep.name, dep.dir);
182
- await collectNodeModules(dep, realSource, destination);
167
+ await collectNodeModules(dep, destination);
183
168
  }
184
169
  return result;
185
170
  }
@@ -1 +1 @@
1
- {"version":3,"file":"appFileCopier.js","sourceRoot":"","sources":["../../src/util/appFileCopier.ts"],"names":[],"mappings":";;;AAoBA,gDAYC;AAED,oCA2CC;AAaD,wCAsCC;AAED,0CA4BC;AAwBD,8DA+CC;AArOD,+CAA0C;AAC1C,+CAAyI;AAEzI,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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AAE,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, CONCURRENCY, FileCopier, FileTransformer, Link, MAX_FILE_REQUESTS, statOrNull, walk } from \"builder-util\"\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\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 // 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 const NODE_MODULES = \"node_modules\"\n const getRealSource = (name: string, source: string) => {\n let parentDir = path.dirname(source)\n\n const scopeDepth = name.split(\"/\").length\n // get the parent dir of the package, input: /root/path/node_modules/@electron/remote, output: /root/path/node_modules\n for (let i = 0; i < scopeDepth - 1; i++) {\n parentDir = path.dirname(parentDir)\n }\n\n // for the local node modules which is not in node modules\n if (!parentDir.endsWith(path.sep + NODE_MODULES)) {\n return parentDir\n }\n\n // use main matcher patterns,return parent dir of the node_modules, so user can exclude some files !node_modules/xxxx\n return path.dirname(parentDir)\n }\n\n const collectNodeModules = async (dep: NodeModuleInfo, realSource: string, destination: string) => {\n const source = dep.dir\n const matcher = new FileMatcher(realSource, destination, mainMatcher.macroExpander, mainMatcher.patterns)\n const copier = new NodeModuleCopyHelper(matcher, platformPackager.info)\n const files = await copier.collectNodeModules(dep, nodeModuleExcludedExts)\n result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata })\n\n if (dep.conflictDependency) {\n for (const c of dep.conflictDependency) {\n await collectNodeModules(c, realSource, 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 const realSource = getRealSource(dep.name, dep.dir)\n await collectNodeModules(dep, realSource, 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 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":";;;AAoBA,gDAYC;AAED,oCA2CC;AAaD,wCAsCC;AAED,0CA4BC;AAwBD,8DA6BC;AAnND,+CAA0C;AAC1C,+CAAyI;AAEzI,0CAA6C;AAC7C,uCAAwC;AACxC,6BAA4B;AAC5B,2DAAmD;AACnD,kCAAkC;AAClC,gDAA0D;AAC1D,wDAAqF;AAGrF,mDAA+C;AAC/C,i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\"builder-util\"\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\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 // 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 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)\n result[index++] = validateFileSet({ src: source, destination, files, metadata: copier.metadata })\n\n if (dep.conflictDependency) {\n for (const c of dep.conflictDependency) {\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 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"]}
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.hasMagic = hasMagic;
4
4
  exports.createFilter = createFilter;
5
5
  const path = require("path");
6
- const fileTransformer_1 = require("../fileTransformer");
7
6
  /** @internal */
8
7
  function hasMagic(pattern) {
9
8
  const set = pattern.set;
@@ -21,17 +20,8 @@ function hasMagic(pattern) {
21
20
  function ensureEndSlash(s) {
22
21
  return s.length === 0 || s.endsWith(path.sep) ? s : s + path.sep;
23
22
  }
24
- function getRelativePath(file, srcWithEndSlash) {
25
- if (!file.startsWith(srcWithEndSlash)) {
26
- const index = file.indexOf(fileTransformer_1.NODE_MODULES_PATTERN);
27
- if (index < 0) {
28
- throw new Error(`${file} must be under ${srcWithEndSlash}`);
29
- }
30
- else {
31
- return file.substring(index + 1 /* leading slash */);
32
- }
33
- }
34
- let relative = file.substring(srcWithEndSlash.length);
23
+ function getRelativePath(file, srcWithEndSlash, stat) {
24
+ let relative = stat.relativeNodeModulesPath || file.substring(srcWithEndSlash.length);
35
25
  if (path.sep === "\\") {
36
26
  if (relative.startsWith("\\")) {
37
27
  // windows problem: double backslash, the above substring call removes root path with a single slash, so here can me some leftovers
@@ -48,7 +38,14 @@ function createFilter(src, patterns, excludePatterns) {
48
38
  if (src === file) {
49
39
  return true;
50
40
  }
51
- const relative = getRelativePath(file, srcWithEndSlash);
41
+ let relative = getRelativePath(file, srcWithEndSlash, stat);
42
+ // filter the root node_modules, but not a subnode_modules (like /appDir/others/foo/node_modules/blah)
43
+ if (relative === "node_modules") {
44
+ return false;
45
+ }
46
+ else if (relative.endsWith("/node_modules")) {
47
+ relative += "/";
48
+ }
52
49
  // https://github.com/electron-userland/electron-builder/issues/867
53
50
  return minimatchAll(relative, patterns, stat) && (excludePatterns == null || stat.isDirectory() || !minimatchAll(relative, excludePatterns, stat));
54
51
  };
@@ -1 +1 @@
1
- {"version":3,"file":"filter.js","sourceRoot":"","sources":["../../src/util/filter.ts"],"names":[],"mappings":";;AAOA,4BAaC;AA6BD,oCAWC;AAzDD,6BAA4B;AA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,CAAC","sourcesContent":["import { Filter } from \"builder-util\"\nimport { Stats } from \"fs-extra\"\nimport { Minimatch } from \"minimatch\"\nimport * as path from \"path\"\nimport { NODE_MODULES_PATTERN } from \"../fileTransformer\"\n\n/** @internal */\nexport function hasMagic(pattern: Minimatch) {\n const set = pattern.set\n if (set.length > 1) {\n return true\n }\n\n for (const i of set[0]) {\n if (typeof i !== \"string\") {\n return true\n }\n }\n\n return false\n}\n\n// sometimes, destination may not contain path separator in the end (path to folder), but the src does. So let's ensure paths have path separators in the end\nfunction ensureEndSlash(s: string) {\n return s.length === 0 || s.endsWith(path.sep) ? s : s + path.sep\n}\n\nfunction getRelativePath(file: string, srcWithEndSlash: string) {\n if (!file.startsWith(srcWithEndSlash)) {\n const index = file.indexOf(NODE_MODULES_PATTERN)\n if (index < 0) {\n throw new Error(`${file} must be under ${srcWithEndSlash}`)\n } else {\n return file.substring(index + 1 /* leading slash */)\n }\n }\n\n let relative = file.substring(srcWithEndSlash.length)\n if (path.sep === \"\\\\\") {\n if (relative.startsWith(\"\\\\\")) {\n // windows problem: double backslash, the above substring call removes root path with a single slash, so here can me some leftovers\n relative = relative.substring(1)\n }\n relative = relative.replace(/\\\\/g, \"/\")\n }\n return relative\n}\n\n/** @internal */\nexport function createFilter(src: string, patterns: Array<Minimatch>, excludePatterns?: Array<Minimatch> | null): Filter {\n const srcWithEndSlash = ensureEndSlash(src)\n return (file, stat) => {\n if (src === file) {\n return true\n }\n\n const relative = getRelativePath(file, srcWithEndSlash)\n // https://github.com/electron-userland/electron-builder/issues/867\n return minimatchAll(relative, patterns, stat) && (excludePatterns == null || stat.isDirectory() || !minimatchAll(relative, excludePatterns, stat))\n }\n}\n\n// https://github.com/joshwnj/minimatch-all/blob/master/index.js\nfunction minimatchAll(path: string, patterns: Array<Minimatch>, stat: Stats): boolean {\n let match = false\n for (const pattern of patterns) {\n // If we've got a match, only re-test for exclusions.\n // if we don't have a match, only re-test for inclusions.\n if (match !== pattern.negate) {\n continue\n }\n\n // partial match — pattern: foo/bar.txt path: foo — we must allow foo\n // use it only for non-negate patterns: const m = new Minimatch(\"!node_modules/@(electron-download|electron)/**/*\", {dot: true }); m.match(\"node_modules\", true) will return false, but must be true\n match = pattern.match(path, stat.isDirectory() && !pattern.negate)\n }\n return match\n}\n"]}
1
+ {"version":3,"file":"filter.js","sourceRoot":"","sources":["../../src/util/filter.ts"],"names":[],"mappings":";;AAKA,4BAaC;AAoBD,oCAmBC;AAvDD,6BAA4B;AAE5B,gBAAgB;AAChB,SAAgB,QAAQ,CAAC,OAAkB;IACzC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACvB,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,6JAA6J;AAC7J,SAAS,cAAc,CAAC,CAAS;IAC/B,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAA;AAClE,CAAC;AAED,SAAS,eAAe,CAAC,IAAY,EAAE,eAAuB,EAAE,IAAiB;IAC/E,IAAI,QAAQ,GAAG,IAAI,CAAC,uBAAuB,IAAI,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;IACrF,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;QACtB,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,mIAAmI;YACnI,QAAQ,GAAG,QAAQ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oM;QACpM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACpE,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["import { Filter, FilterStats } from \"builder-util\"\nimport { Minimatch } from \"minimatch\"\nimport * as path from \"path\"\n\n/** @internal */\nexport function hasMagic(pattern: Minimatch) {\n const set = pattern.set\n if (set.length > 1) {\n return true\n }\n\n for (const i of set[0]) {\n if (typeof i !== \"string\") {\n return true\n }\n }\n\n return false\n}\n\n// sometimes, destination may not contain path separator in the end (path to folder), but the src does. So let's ensure paths have path separators in the end\nfunction ensureEndSlash(s: string) {\n return s.length === 0 || s.endsWith(path.sep) ? s : s + path.sep\n}\n\nfunction getRelativePath(file: string, srcWithEndSlash: string, stat: FilterStats) {\n let relative = stat.relativeNodeModulesPath || file.substring(srcWithEndSlash.length)\n if (path.sep === \"\\\\\") {\n if (relative.startsWith(\"\\\\\")) {\n // windows problem: double backslash, the above substring call removes root path with a single slash, so here can me some leftovers\n relative = relative.substring(1)\n }\n relative = relative.replace(/\\\\/g, \"/\")\n }\n return relative\n}\n\n/** @internal */\nexport function createFilter(src: string, patterns: Array<Minimatch>, excludePatterns?: Array<Minimatch> | null): Filter {\n const srcWithEndSlash = ensureEndSlash(src)\n return (file, stat) => {\n if (src === file) {\n return true\n }\n\n let relative = getRelativePath(file, srcWithEndSlash, stat)\n\n // filter the root node_modules, but not a subnode_modules (like /appDir/others/foo/node_modules/blah)\n if (relative === \"node_modules\") {\n return false\n } else if (relative.endsWith(\"/node_modules\")) {\n relative += \"/\"\n }\n\n // https://github.com/electron-userland/electron-builder/issues/867\n return minimatchAll(relative, patterns, stat) && (excludePatterns == null || stat.isDirectory() || !minimatchAll(relative, excludePatterns, stat))\n }\n}\n\n// https://github.com/joshwnj/minimatch-all/blob/master/index.js\nfunction minimatchAll(path: string, patterns: Array<Minimatch>, stat: FilterStats): boolean {\n let match = false\n for (const pattern of patterns) {\n // If we've got a match, only re-test for exclusions.\n // if we don't have a match, only re-test for inclusions.\n if (match !== pattern.negate) {\n continue\n }\n\n // partial match — pattern: foo/bar.txt path: foo — we must allow foo\n // use it only for non-negate patterns: const m = new Minimatch(\"!node_modules/@(electron-download|electron)/**/*\", {dot: true }); m.match(\"node_modules\", true) will return false, but must be true\n match = pattern.match(path, stat.isDirectory() && !pattern.negate)\n }\n return match\n}\n"]}
package/out/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "25.1.8";
1
+ export declare const PACKAGE_VERSION = "26.0.0-alpha.1";
package/out/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PACKAGE_VERSION = void 0;
4
- exports.PACKAGE_VERSION = "25.1.8";
4
+ exports.PACKAGE_VERSION = "26.0.0-alpha.1";
5
5
  //# sourceMappingURL=version.js.map
@@ -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 = \"25.1.8\"\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,gBAAgB,CAAA","sourcesContent":["export const PACKAGE_VERSION = \"26.0.0-alpha.1\"\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.1.8",
4
+ "version": "26.0.0-alpha.1",
5
5
  "main": "out/index.js",
6
6
  "files": [
7
7
  "out",
@@ -49,7 +49,7 @@
49
49
  "@develar/schema-utils": "~2.6.5",
50
50
  "@electron/notarize": "2.5.0",
51
51
  "@electron/osx-sign": "1.3.1",
52
- "@electron/rebuild": "3.6.1",
52
+ "@electron/rebuild": "3.7.0",
53
53
  "@electron/universal": "2.0.1",
54
54
  "@malept/flatpak-bundler": "^0.4.0",
55
55
  "@types/fs-extra": "9.0.13",
@@ -75,9 +75,9 @@
75
75
  "semver": "^7.3.8",
76
76
  "tar": "^6.1.12",
77
77
  "temp-file": "^3.4.0",
78
- "builder-util": "25.1.7",
79
- "electron-publish": "25.1.7",
80
- "builder-util-runtime": "9.2.10"
78
+ "builder-util": "26.0.0-alpha.1",
79
+ "builder-util-runtime": "9.2.10",
80
+ "electron-publish": "26.0.0-alpha.1"
81
81
  },
82
82
  "///": "babel in devDependencies for proton tests",
83
83
  "devDependencies": {
@@ -108,12 +108,12 @@
108
108
  "@types/semver": "7.3.8",
109
109
  "@types/tar": "^6.1.3",
110
110
  "toml": "^3.0.0",
111
- "dmg-builder": "25.1.8",
112
- "electron-builder-squirrel-windows": "25.1.8"
111
+ "dmg-builder": "26.0.0-alpha.1",
112
+ "electron-builder-squirrel-windows": "26.0.0-alpha.1"
113
113
  },
114
114
  "peerDependencies": {
115
- "dmg-builder": "25.1.8",
116
- "electron-builder-squirrel-windows": "25.1.8"
115
+ "dmg-builder": "26.0.0-alpha.1",
116
+ "electron-builder-squirrel-windows": "26.0.0-alpha.1"
117
117
  },
118
118
  "//": "electron-builder-squirrel-windows and dmg-builder added as dev dep for tests (as otherwise `require` doesn't work using Yarn 2)",
119
119
  "typings": "./out/index.d.ts"
package/scheme.json CHANGED
@@ -58,7 +58,15 @@
58
58
  ]
59
59
  },
60
60
  "desktop": {
61
- "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value)."
61
+ "anyOf": [
62
+ {
63
+ "$ref": "#/definitions/LinuxDesktopFile"
64
+ },
65
+ {
66
+ "type": "null"
67
+ }
68
+ ],
69
+ "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files)"
62
70
  },
63
71
  "executableArgs": {
64
72
  "anyOf": [
@@ -576,7 +584,15 @@
576
584
  ]
577
585
  },
578
586
  "desktop": {
579
- "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value)."
587
+ "anyOf": [
588
+ {
589
+ "$ref": "#/definitions/LinuxDesktopFile"
590
+ },
591
+ {
592
+ "type": "null"
593
+ }
594
+ ],
595
+ "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files)"
580
596
  },
581
597
  "executableArgs": {
582
598
  "anyOf": [
@@ -1111,7 +1127,15 @@
1111
1127
  ]
1112
1128
  },
1113
1129
  "desktop": {
1114
- "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value)."
1130
+ "anyOf": [
1131
+ {
1132
+ "$ref": "#/definitions/LinuxDesktopFile"
1133
+ },
1134
+ {
1135
+ "type": "null"
1136
+ }
1137
+ ],
1138
+ "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files)"
1115
1139
  },
1116
1140
  "executableArgs": {
1117
1141
  "anyOf": [
@@ -1645,7 +1669,15 @@
1645
1669
  ]
1646
1670
  },
1647
1671
  "desktop": {
1648
- "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value)."
1672
+ "anyOf": [
1673
+ {
1674
+ "$ref": "#/definitions/LinuxDesktopFile"
1675
+ },
1676
+ {
1677
+ "type": "null"
1678
+ }
1679
+ ],
1680
+ "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files)"
1649
1681
  },
1650
1682
  "detectUpdateChannel": {
1651
1683
  "default": true,
@@ -1941,6 +1973,35 @@
1941
1973
  },
1942
1974
  "type": "object"
1943
1975
  },
1976
+ "LinuxDesktopFile": {
1977
+ "additionalProperties": false,
1978
+ "description": "Example Spec: https://specifications.freedesktop.org/desktop-entry-spec/latest/example.html",
1979
+ "properties": {
1980
+ "desktopActions": {
1981
+ "anyOf": [
1982
+ {
1983
+ "typeof": "function"
1984
+ },
1985
+ {
1986
+ "type": "null"
1987
+ }
1988
+ ],
1989
+ "description": "`[Desktop Actions <ActionName>]` metadata entries (name to value).\n\nConfig Example:\n```js\ndesktopActions: {\n NewWindow: {\n Name: 'New Window',\n Exec: 'app --new-window',\n }\n}\n```"
1990
+ },
1991
+ "entry": {
1992
+ "anyOf": [
1993
+ {
1994
+ "typeof": "function"
1995
+ },
1996
+ {
1997
+ "type": "null"
1998
+ }
1999
+ ],
2000
+ "description": "`[Desktop Entry]` metadata entries (name to value). Overwrites default values calculated by electron-builder"
2001
+ }
2002
+ },
2003
+ "type": "object"
2004
+ },
1944
2005
  "LinuxTargetSpecificOptions": {
1945
2006
  "additionalProperties": false,
1946
2007
  "properties": {
@@ -2010,7 +2071,15 @@
2010
2071
  ]
2011
2072
  },
2012
2073
  "desktop": {
2013
- "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value)."
2074
+ "anyOf": [
2075
+ {
2076
+ "$ref": "#/definitions/LinuxDesktopFile"
2077
+ },
2078
+ {
2079
+ "type": "null"
2080
+ }
2081
+ ],
2082
+ "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files)"
2014
2083
  },
2015
2084
  "executableArgs": {
2016
2085
  "anyOf": [
@@ -5463,7 +5532,15 @@
5463
5532
  ]
5464
5533
  },
5465
5534
  "desktop": {
5466
- "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files) entries (name to value)."
5535
+ "anyOf": [
5536
+ {
5537
+ "$ref": "#/definitions/LinuxDesktopFile"
5538
+ },
5539
+ {
5540
+ "type": "null"
5541
+ }
5542
+ ],
5543
+ "description": "The [Desktop file](https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html#desktop-files)"
5467
5544
  },
5468
5545
  "environment": {
5469
5546
  "anyOf": [
@@ -6709,7 +6786,7 @@
6709
6786
  ]
6710
6787
  }
6711
6788
  ],
6712
- "description": "Appx manifest created on disk - not packed into .appx package yet."
6789
+ "description": "The function (or path to file or module id) to be run after Appx manifest created on disk - not packed into .appx package yet."
6713
6790
  },
6714
6791
  "artifactBuildCompleted": {
6715
6792
  "anyOf": [
@@ -6934,10 +7011,13 @@
6934
7011
  "typeof": "function"
6935
7012
  },
6936
7013
  {
6937
- "type": "string"
7014
+ "type": [
7015
+ "null",
7016
+ "string"
7017
+ ]
6938
7018
  }
6939
7019
  ],
6940
- "description": "Returns the path to custom Electron build (e.g. `~/electron/out/R`). Zip files must follow the pattern `electron-v${version}-${platformName}-${arch}.zip`, otherwise it will be assumed to be an unpacked Electron app directory"
7020
+ "description": "The function (or path to file or module id) to be run when staging the electron artifact environment.\nReturns the path to custom Electron build (e.g. `~/electron/out/R`) or folder of electron zips. Zip files must follow the pattern `electron-v${version}-${platformName}-${arch}.zip`, otherwise it will be assumed to be an unpacked Electron app directory"
6941
7021
  },
6942
7022
  "electronDownload": {
6943
7023
  "$ref": "#/definitions/ElectronDownloadOptions",
@@ -7142,11 +7222,6 @@
7142
7222
  "description": "Whether to include PDB files.",
7143
7223
  "type": "boolean"
7144
7224
  },
7145
- "includeSubNodeModules": {
7146
- "default": false,
7147
- "description": "Whether to include *all* of the submodules node_modules directories",
7148
- "type": "boolean"
7149
- },
7150
7225
  "launchUiVersion": {
7151
7226
  "description": "*libui-based frameworks only* The version of LaunchUI you are packaging for. Applicable for Windows only. Defaults to version suitable for used framework version.",
7152
7227
  "type": [
@@ -7221,7 +7296,7 @@
7221
7296
  ]
7222
7297
  }
7223
7298
  ],
7224
- "description": "MSI project created on disk - not packed into .msi package yet."
7299
+ "description": "The function (or path to file or module id) to be run after MSI project created on disk - not packed into .msi package yet."
7225
7300
  },
7226
7301
  "msiWrapped": {
7227
7302
  "anyOf": [