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;AACnE,YAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAP,CAAmB;AAAC,QAAA,MAAM,EAAE;AAAT,OAAnB,CAAvB;;AACA,UAAI,KAAJ,EAAW;AACT,cAAM,6BAAS,WAAT,EAAsB,QAAtB,CAAN;AACD,OAFD,MAGK;AACH,cAAM,2BAAW,QAAX,EAAqB,MAAM,CAAC,IAAP,CAAY,WAAZ,EAAyB,QAAzB,CAArB,CAAN;AACD;;AACD,aAAO,QAAP;AACD,KATD,MAUK;AACH,MAAA,IAAI,GAAG,WAAP;AACD;AACF;;AAED,EAAA,IAAI,GAAG,IAAI,CAAC,OAAL,CAAa,UAAb,EAAyB,IAAzB,CAAP;AACA,QAAM,IAAI,GAAG,MAAM,sBAAW,IAAX,CAAnB;;AACA,MAAI,IAAI,IAAI,IAAZ,EAAkB;AAChB,UAAM,KAAI,wCAAJ,EAA8B,GAAG,IAAI,gBAArC,CAAN;AACD,GAFD,MAGK,IAAI,CAAC,IAAI,CAAC,MAAL,EAAL,EAAoB;AACvB,UAAM,KAAI,wCAAJ,EAA8B,GAAG,IAAI,aAArC,CAAN;AACD,GAFI,MAGA;AACH,WAAO,IAAP;AACD;AACF,C","sourcesContent":["import { outputFile } from \"fs-extra\"\nimport { homedir } from \"os\"\nimport * as path from \"path\"\nimport { TmpDir } from \"temp-file\"\nimport { InvalidConfigurationError } from \"builder-util\"\nimport { statOrNull } from \"builder-util/out/fs\"\nimport { download } from \"../binDownload\"\n\n/** @private */\nexport async function downloadCertificate(urlOrBase64: string, tmpDir: TmpDir, currentDir: string): Promise<string> {\n urlOrBase64 = urlOrBase64.trim()\n\n let file: string | null = null\n if ((urlOrBase64.length > 3 && urlOrBase64[1] === \":\") || urlOrBase64.startsWith(\"/\") || urlOrBase64.startsWith(\".\")) {\n file = urlOrBase64\n }\n else if (urlOrBase64.startsWith(\"file://\")) {\n file = urlOrBase64.substring(\"file://\".length)\n }\n else if (urlOrBase64.startsWith(\"~/\")) {\n file = path.join(homedir(), urlOrBase64.substring(\"~/\".length))\n }\n else {\n const isUrl = urlOrBase64.startsWith(\"https://\")\n if (isUrl || urlOrBase64.length > 2048 || urlOrBase64.endsWith(\"=\")) {\n const tempFile = await tmpDir.getTempFile({suffix: \".p12\"})\n if (isUrl) {\n await download(urlOrBase64, tempFile)\n }\n else {\n await outputFile(tempFile, Buffer.from(urlOrBase64, \"base64\"))\n }\n return tempFile\n }\n else {\n file = urlOrBase64\n }\n }\n\n file = path.resolve(currentDir, file)\n const stat = await statOrNull(file)\n if (stat == null) {\n throw new InvalidConfigurationError(`${file} doesn't exist`)\n }\n else if (!stat.isFile()) {\n throw new InvalidConfigurationError(`${file} not a file`)\n }\n else {\n return file\n }\n}"],"sourceRoot":""}
|