UNPKG

1.88 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../src/asar/asarFileChecker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;;2CACO,WAAkC,QAAlC,EAAoD,YAApD,EAA0E,aAA1E,EAA+F;AACpG,aAAA,KAAA,CAAe,IAAf,EAA2B;AACzB,aAAO,IAAI,KAAJ,CAAU,GAAG,aAAa,KAAK,YAAY,aAAa,QAAQ,KAAK,IAAI,EAAzE,CAAP;AACD;;AAED,QAAI,EAAJ;;AACA,QAAI;AACF,WAAK,MAAM,sBAAS,QAAT,CAAX;AACD,KAFD,CAGA,OAAO,CAAP,EAAU;AACR,YAAM,MAAM,iBAAiB,CAAC,EAAxB,CAAN;AACD;;AAED,QAAI,IAAJ;;AACA,QAAI;AACF,aAAO,GAAG,OAAH,CAAW,YAAX,CAAP;AACD,KAFD,CAGA,OAAO,CAAP,EAAU;AACR,YAAM,WAAW,MAAM,sBAAW,QAAX,CAAvB;;AACA,UAAI,YAAY,IAAhB,EAAsB;AACpB,cAAM,MAAM,mDAAN,CAAN;AACD,OAJO,CAMR;;;AACA,aAAO,IAAP;AACD;;AAED,QAAI,QAAQ,IAAZ,EAAkB;AAChB,YAAM,MAAM,mDAAN,CAAN;AACD;;AACD,QAAI,KAAK,IAAL,KAAc,CAAlB,EAAqB;AACnB,YAAM,MAAM,sBAAN,CAAN;AACD;AACF,G;;kBAjCW,kB","sourcesContent":["import { statOrNull } from \"builder-util/out/fs\"\nimport { Node, readAsar } from \"./asar\"\n\n/** @internal */\nexport async function checkFileInArchive(asarFile: string, relativeFile: string, messagePrefix: string) {\n function error(text: string) {\n return new Error(`${messagePrefix} \"${relativeFile}\" in the \"${asarFile}\" ${text}`)\n }\n\n let fs\n try {\n fs = await readAsar(asarFile)\n }\n catch (e) {\n throw error(`is corrupted: ${e}`)\n }\n\n let stat: Node | null\n try {\n stat = fs.getFile(relativeFile)\n }\n catch (e) {\n const fileStat = await statOrNull(asarFile)\n if (fileStat == null) {\n throw error(`does not exist. Seems like a wrong configuration.`)\n }\n\n // asar throws error on access to undefined object (info.link)\n stat = null\n }\n\n if (stat == null) {\n throw error(`does not exist. Seems like a wrong configuration.`)\n }\n if (stat.size === 0) {\n throw error(`is corrupted: size 0`)\n }\n}\n"],"sourceRoot":""}