app-builder-lib
Advanced tools
Comparing version 25.0.0-alpha.2 to 25.0.0-alpha.3
@@ -34,6 +34,12 @@ "use strict"; | ||
const unpackedFileIndexMap = new Map(); | ||
for (const fileSet of fileSets) { | ||
const orderedFileSets = [ | ||
// Write dependencies first to minimize offset changes to asar header | ||
...fileSets.slice(1), | ||
// Finish with the app files that change most often | ||
fileSets[0], | ||
].map(orderFileSet); | ||
for (const fileSet of orderedFileSets) { | ||
unpackedFileIndexMap.set(fileSet, await this.createPackageFromFiles(fileSet, packager.info)); | ||
} | ||
await this.writeAsarFile(fileSets, unpackedFileIndexMap); | ||
await this.writeAsarFile(orderedFileSets, unpackedFileIndexMap); | ||
} | ||
@@ -242,2 +248,45 @@ async createPackageFromFiles(fileSet, packager) { | ||
} | ||
function orderFileSet(fileSet) { | ||
const sortedFileEntries = Array.from(fileSet.files.entries()); | ||
sortedFileEntries.sort(([, a], [, b]) => { | ||
if (a === b) { | ||
return 0; | ||
} | ||
// Place addons last because their signature change | ||
const isAAddon = a.endsWith(".node"); | ||
const isBAddon = b.endsWith(".node"); | ||
if (isAAddon && !isBAddon) { | ||
return 1; | ||
} | ||
if (isBAddon && !isAAddon) { | ||
return -1; | ||
} | ||
// Otherwise order by name | ||
return a < b ? -1 : 1; | ||
}); | ||
let transformedFiles; | ||
if (fileSet.transformedFiles) { | ||
transformedFiles = new Map(); | ||
const indexMap = new Map(); | ||
for (const [newIndex, [oldIndex]] of sortedFileEntries.entries()) { | ||
indexMap.set(oldIndex, newIndex); | ||
} | ||
for (const [oldIndex, value] of fileSet.transformedFiles) { | ||
const newIndex = indexMap.get(oldIndex); | ||
if (newIndex === undefined) { | ||
const file = fileSet.files[oldIndex]; | ||
throw new Error(`Internal error: ${file} was lost while ordering asar`); | ||
} | ||
transformedFiles.set(newIndex, value); | ||
} | ||
} | ||
const { src, destination, metadata } = fileSet; | ||
return { | ||
src, | ||
destination, | ||
metadata, | ||
files: sortedFileEntries.map(([, file]) => file), | ||
transformedFiles, | ||
}; | ||
} | ||
//# sourceMappingURL=asarUtil.js.map |
@@ -1,1 +0,1 @@ | ||
export declare const PACKAGE_VERSION = "25.0.0-alpha.2"; | ||
export declare const PACKAGE_VERSION = "25.0.0-alpha.3"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PACKAGE_VERSION = void 0; | ||
exports.PACKAGE_VERSION = "25.0.0-alpha.2"; | ||
exports.PACKAGE_VERSION = "25.0.0-alpha.3"; | ||
//# sourceMappingURL=version.js.map |
@@ -237,3 +237,3 @@ "use strict"; | ||
"FileDescription", | ||
appInfo.productName, | ||
appInfo.description || appInfo.productName, | ||
"--set-version-string", | ||
@@ -240,0 +240,0 @@ "ProductName", |
{ | ||
"name": "app-builder-lib", | ||
"description": "electron-builder lib", | ||
"version": "25.0.0-alpha.2", | ||
"version": "25.0.0-alpha.3", | ||
"main": "out/index.js", | ||
@@ -74,5 +74,5 @@ "files": [ | ||
"temp-file": "^3.4.0", | ||
"builder-util": "25.0.0-alpha.1", | ||
"builder-util-runtime": "9.2.5-alpha.1", | ||
"electron-publish": "25.0.0-alpha.1" | ||
"builder-util": "25.0.0-alpha.3", | ||
"builder-util-runtime": "9.2.5-alpha.2", | ||
"electron-publish": "25.0.0-alpha.3" | ||
}, | ||
@@ -107,8 +107,8 @@ "///": "babel in devDependencies for proton tests", | ||
"@types/tar": "^6.1.3", | ||
"electron-builder-squirrel-windows": "25.0.0-alpha.2", | ||
"dmg-builder": "25.0.0-alpha.2" | ||
"dmg-builder": "25.0.0-alpha.3", | ||
"electron-builder-squirrel-windows": "25.0.0-alpha.3" | ||
}, | ||
"peerDependencies": { | ||
"dmg-builder": "25.0.0-alpha.2", | ||
"electron-builder-squirrel-windows": "25.0.0-alpha.2" | ||
"electron-builder-squirrel-windows": "25.0.0-alpha.3", | ||
"dmg-builder": "25.0.0-alpha.3" | ||
}, | ||
@@ -115,0 +115,0 @@ "//": "electron-builder-squirrel-windows and dmg-builder added as dev dep for tests (as otherwise `require` doesn't work using Yarn 2)", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
2976060
23095
+ Addedbuilder-util@25.0.0-alpha.3(transitive)
+ Addedbuilder-util-runtime@9.2.5-alpha.2(transitive)
+ Addeddmg-builder@25.0.0-alpha.3(transitive)
+ Addedelectron-builder-squirrel-windows@25.0.0-alpha.3(transitive)
+ Addedelectron-publish@25.0.0-alpha.3(transitive)
- Removedbuilder-util@25.0.0-alpha.1(transitive)
- Removedbuilder-util-runtime@9.2.5-alpha.1(transitive)
- Removeddmg-builder@25.0.0-alpha.2(transitive)
- Removedelectron-builder-squirrel-windows@25.0.0-alpha.2(transitive)
- Removedelectron-publish@25.0.0-alpha.1(transitive)
Updatedbuilder-util@25.0.0-alpha.3