1 line
3.7 KiB
Plaintext
1 line
3.7 KiB
Plaintext
|
{"version":3,"sources":["Extract.js"],"names":["async","archive","dir","let","dotExpoHomeDirectory","UserSettings","tmpDir","path","join","uuid","v4","mkdirp","sync","binary","Binaries","getBinariesPath","await","spawnAsync","files","fs","readdirSync","outputFile","resolve","e","console","error","message","stderr","rimraf","_extractWindowsAsync","process","platform","stdio","cwd","__dirname","tar","extract","file","extractAsync"],"mappings":";;;;;;;;+BAeAA,WAAoCC,OAApCD,EAAqDE,GAArDF,EAAkE;AAChEG,QAAIC,uBAAuBC,gDAAaD,oBAAbC,EAA3BF;AACAA,QAAIG,SAASC,cAAKC,IAALD,CAAUH,oBAAVG,EAAgC,KAAhCA,EAAuCE,gCAAKC,EAALD,EAAvCF,CAAbJ;AACAQ,wCAAOC,IAAPD,CAAYL,MAAZK;AACAR,QAAIU,SAASN,cAAKC,IAALD,CAAUO,gCAASC,eAATD,EAAVP,EAAsC,cAAtCA,EAAsD,KAAtDA,CAAbJ;AACA,QAAI;AACFa,YAAMC,iDAAWJ,MAAXI,EAAmB,CAAC,GAAD,EAAMhB,OAAN,EAAe,MAAf,EAAwB,KAAIK,MAAO,EAAnC,CAAnBW,CAAND;AACA;AACA;AACA;AACAb,UAAIe,QAAQC,YAAGC,WAAHD,CAAeb,MAAfa,CAAZhB;AACAA,UAAIkB,aAAad,cAAKe,OAALf,CAAaD,MAAbC,EAAqBW,MAAM,CAANA,CAArBX,CAAjBJ;AACAa,YAAMC,iDAAWJ,MAAXI,EAAmB,CAAC,GAAD,EAAMI,UAAN,EAAkB,MAAlB,EAA2B,KAAInB,GAAI,EAAnC,CAAnBe,CAAND;AACF,KARA,CAQE,OAAOO,CAAP,EAAU;AACVC,cAAQC,KAARD,CAAcD,EAAEG,OAAhBF;AACAA,cAAQC,KAARD,CAAcD,EAAEI,MAAhBH;AACA,YAAMD,CAAN;AACF,KAZA,SAYU;AACRK,0CAAOhB,IAAPgB,CAAYtB,MAAZsB;AACF;AACF,G;;kBApBeC,oB;;;;;;gCAsBR7B,WAA4BC,OAA5BD,EAA6CE,GAA7CF,EAA0D;AAC/D,QAAI;AACF,UAAI8B,QAAQC,QAARD,KAAqB,OAAzB,EAAkC;AAChCd,cAAMa,qBAAqB5B,OAArB4B,EAA8B3B,GAA9B2B,CAANb;AACF,OAFA,MAEO;AACLA,cAAMC,iDAAW,KAAXA,EAAkB,CAAC,KAAD,EAAQhB,OAAR,EAAiB,IAAjB,EAAuBC,GAAvB,CAAlBe,EAA+C;AACnDe,iBAAO,SAD4C;AAEnDC,eAAKC;AAF8C,SAA/CjB,CAAND;AAIF;AACF,KATA,CASE,OAAOO,CAAP,EAAU;AACV;AACA;AACAC,cAAQC,KAARD,CAAcD,EAAEG,OAAhBF;AACAR,YAAMmB,8BAAIC,OAAJD,CAAY,EAAEE,MAAMpC,OAAR,EAAiBgC,KAAK/B,GAAtB,EAAZiC,CAANnB;AACF;AACF,G;;kBAhBsBsB,Y;;;;;AAjCtB;;;;AACA;AAAA;AAAA;;AACA;;;;AACA;AAAA;AAAA;;;;AACA;AAAA;AAAA;;;;AACA;AAAA;AAAA;;;;AACA;AAAA;AAAA;;;;AAEA;AAAA;AAAA;;;;AACA;AAAA;AAAA","file":"../Extract.js","sourcesContent":["/**\n * @flow\n */\n\nimport fs from 'fs';\nimport tar from 'tar';\nimport path from 'path';\nimport spawnAsync from '@expo/spawn-async';\nimport mkdirp from 'mkdirp';\nimport rimraf from 'rimraf';\nimport uuid from 'uuid';\n\nimport * as Binaries from './Binaries';\nimport UserSettings from './UserSettings';\n\nasync function _extractWindowsAsync(archive: string, dir: string) {\n let dotExpoHomeDirectory = UserSettings.dotExpoHomeDirectory();\n let tmpDir = path.join(dotExpoHomeDirectory, 'tmp', uuid.v4());\n mkdirp.sync(tmpDir);\n let binary = path.join(Binaries.getBinariesPath(), '7z1602-extra', '7za');\n try {\n await spawnAsync(binary, ['x', archive, '-aoa', `-o${tmpDir}`]);\n // We don't know the resulting filename after this step, so\n // just assume the only file in the directory is our .tar file.\n // This should be fine since we created the directory with a random name.\n let files = fs.readdirSync(tmpDir);\n let outputFile = path.resolve(tmpDir, files[0]);\n await spawnAsync(binary, ['x', outputFile, '-aoa', `-o${dir}`]);\n } catch (e) {\n console.error(e.message);\n console.error(e.stderr);\n throw e;\n } finally {\n rimraf.sync(tmpDir);\n }\n}\n\nexport async function extractAsync(archive: string, dir: string) {\n try {\n if (process.platform === 'win32') {\n await _extractWindowsAsync(archive, dir);\n } else {\n await spawnAsync('tar', ['-xf', archive, '-C', dir], {\n stdio: 'inherit',\n cwd: __dirname,\n });\n }\n } catch (e) {\n // tar node module has previously had problems with big files, and seems to\n // be slower, so only use it as a backup.\n console.error(e.message);\n await tar.extract({ file: archive, cwd: dir });\n }\n}\n"],"sourceRoot":"/xdl/src"}
|