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2BAA2B,4BAA/G;AACA,UAAM,KAAI,wCAAJ,EAA8B,oHAAoH,cAAc,iGAAhK,CAAN;AACD;;AAED,SAAO,MAAM,GAAC,MAAP,CAAc,2BAAd,EAA6C,QAA7C,EAAP;AACD;;AAED,SAAS,uBAAT,CAAiC,WAAjC,EAAiD;AAC/C,OAAK,MAAM,IAAX,IAAmB,gBAAnB,EAAqC;AACnC,UAAM,eAAe,GAAG,WAAW,CAAC,eAApC;AACA,QAAI,GAAG,GAAG,eAAe,IAAI,IAAnB,GAA0B,IAA1B,GAAiC,eAAe,CAAC,IAAD,CAA1D;;AACA,QAAI,GAAG,IAAI,IAAX,EAAiB;AACf,YAAM,YAAY,GAAG,WAAW,CAAC,YAAjC;AACA,MAAA,GAAG,GAAG,YAAY,IAAI,IAAhB,GAAuB,IAAvB,GAA8B,YAAY,CAAC,IAAD,CAAhD;AACD;;AACD,QAAI,GAAG,IAAI,IAAX,EAAiB;AACf,aAAO,GAAP;AACD;AACF;;AACD,SAAO,IAAP;AACD,C","sourcesContent":["import { InvalidConfigurationError, log } from \"builder-util\"\nimport { httpExecutor } from \"builder-util/out/nodeHttpExecutor\"\nimport { readJson } from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { orNullIfFileNotExist } from \"read-config-file\"\nimport * as semver from \"semver\"\nimport { Configuration } from \"../configuration\"\nimport { getConfig } from \"../util/config\"\n\nexport type MetadataValue = Lazy<{ [key: string]: any } | null>\n\nconst electronPackages = [\"electron\", \"electron-prebuilt\", \"electron-prebuilt-compile\"]\n\nexport async function getElectronVersion(projectDir: string, config?: Configuration, projectMetadata: MetadataValue = new Lazy(() => orNullIfFileNotExist(readJson(path.join(projectDir, \"package.json\"))))): Promise<string> {\n if (config == null) {\n config = await getConfig(projectDir, null, null)\n }\n if (config.electronVersion != null) {\n return config.electronVersion\n }\n return await computeElectronVersion(projectDir, projectMetadata)\n}\n\nexport async function getElectronVersionFromInstalled(projectDir: string) {\n for (const name of electronPackages) {\n try {\n return (await readJson(path.join(projectDir, \"node_modules\", name, \"package.json\"))).version\n }\n catch (e) {\n if (e.code !== \"ENOENT\") {\n log.warn({name, error: e}, `cannot read electron version package.
|