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AHW,c;;;;;;;;4CAKL,WAA8B,IAA9B,EAA4C,MAA5C,EAA4D,QAA5D,EAA6F,gBAA7F,EAA4H;AACjI,UAAM,eAAe,GAAG,IAAI,GAAG,qBAAqB,EAApD;;AACA,uBAAI,IAAJ,CAAS;AAAC,oBAAc,mBAAI,QAAJ,CAAa,YAAb;AAAf,KAAT,EAAqD,oBAArD;;AACA,UAAM,aAAiC,KAAK,KAAL,EAAW,MAAM,sCAAkB,CAAC,UAAD,EAAa,SAAb,EAAwB,IAAxB,EAA8B,UAA9B,EAA0C,YAA1C,CAAlB,CAAjB,EAAvC;AACA,aAAS,IAAT,CAAc,uBAAd,CAAsC;AACpC,YAAM,YAD8B;AAEpC,wBAAkB,oBAAoB,IAApB,GAA2B,IAA3B,GAAkC,GAAG,gBAAgB,GAAG,qBAAqB,EAF3D;AAGpC,YAHoC;AAIpC,YAAM,IAJ8B;AAKpC,cALoC;AAMpC;AANoC,KAAtC;AAQA,WAAO,UAAP;AACD,G;;kBAbW,c","sourcesContent":["import { log, executeAppBuilder } from \"builder-util\"\nimport { BlockMapDataHolder, PackageFileInfo } from \"builder-util-runtime\"\nimport * as path from \"path\"\nimport { Target } from \"../core\"\nimport { PlatformPackager } from \"../platformPackager\"\nimport { ArchiveOptions } from \"./archive\"\n\nexport const BLOCK_MAP_FILE_SUFFIX = \".blockmap\"\n\nexport function createNsisWebDifferentialUpdateInfo(artifactPath: string, packageFiles: { [arch: string]: PackageFileInfo }) {\n if (packageFiles == null) {\n return null\n }\n\n const keys = Object.keys(packageFiles)\n if (keys.length <= 0) {\n return null\n }\n\n const packages: { [arch: string]: PackageFileInfo } = {}\n for (const arch of keys) {\n const packageFileInfo = packageFiles[arch]\n const file = path.basename(packageFileInfo.path)\n packages[arch] = {\n ...packageFileInfo,\n path: file,\n // https://github.com/electron-userland/electron-builder/issues/2583\n file,\n } as any\n }\n return {packages}\n}\n\nexport function configureDifferentialAwareArchiveOptions(archiveOptions: ArchiveOptions): ArchiveOptions {\n /*\n * dict size 64 MB: Full: 33,744.88 KB, To download: 17,630.3 KB (52%)\n * dict size 16 MB: Full: 33,936.84 KB, To download: 16,175.9 KB (48%)\n * dict size 8 MB: Full: 34,187.59 KB, To download: 8,229.9 KB (24%)\n * dict size 4 MB: Full: 34,628.73 KB, To download: 3,782.97 KB (11%)\n\n as we can see, if file changed in one place, all block is invalidated (and update size approximately equals to dict size)\n\n 1 MB is used:\n\n 1MB:\n\n 2018/01/11 11:54:41:0045 File has 59 changed blocks\n 2018/01/11 11:54:41:0050 Full: 71,588.59 KB, To download: 1,243.39 KB (2%)\n\n 4MB:\n\n 2018/01/11 11:31:43:0440 Full: 70,303.55 KB, To download: 4,843.27 KB (7%)\n 2018/01/11 11:31:43:0435 File has 234 changed blocks\n\n */\n archiveOptions.dictSize = 1\n // solid compression leads to a lot of changed blocks\n archiveOptions.solid = false\n // do not allow to change compression level to avoid different packages\n archiveOptions.compression = \"normal\"\n return archiveOptions\n}\n\nexport async function appendBlockmap(file: string): Promise<BlockMapDataHolder> {\n log.info({file: log.filePath(file)}, \"building embedded block map\")\n return JSON.parse(await executeAppBuilder([\"blockmap\", \"--input\", file, \"--compression\", \"deflate\"]))\n}\n\nexport async function createBlockmap(file: string, target: Target, packager: PlatformPackager<any>, safeArtifactName: string | null): Promise<BlockMapDataHolder> {\n const blockMapFile = `${file}${BLOCK_MAP_FILE_SUFFIX}`\n log.info({blockMapFile: log.filePath(blockMapFile)}, \"building block map\")\n const updateInfo: BlockMapDataHolder = JSON.parse(await executeAppBuilder([\"blockmap\", \"--input\", file, \"--output\", blockMapFile]))\n packager.info.dispatchArtifactCreated({\n file: blockMapFile,\n safeArtifactName: safeArtifactName == null ? null : `${safeArtifactName}${BLOCK_MAP_FILE_SUFFIX}`,\n target,\n arch: null,\n packager,\n updateInfo,\n })\n return updateInfo\n}"],"sourceRoot":""}