GT2/GT2-Android/node_modules/xdl/build/__sourcemaps__/Binaries.js.map

1 line
9.9 KiB
Plaintext

{"version":3,"sources":["Binaries.js"],"names":["async","name","await","sourceBashLoginScriptsAsync","_hasbinAsync","let","ignoreBundledBinaries","UserSettings","getAsync","includes","binariesPath","path","join","getBinariesPath","_prependToPath","addToPathAsync","hasSourcedBashLoginScripts","process","platform","Config","developerTool","userSettingsPATH","_expoRCFileExists","result","spawnAsync","env","PATH","stderr","Logger","global","warn","stdout","e","shellName","SHELL","Error","test","ERROR_MESSAGE","regexResult","match","length","setAsync","pathFile","dotExpoHomeDirectory","fs","writeFile","writePathToUserSettingsAsync","isXcodeInstalled","OSX_SOURCE_PATH","__dirname","Promise","resolve","reject","hasbin","ErrorCode","PLATFORM_NOT_SUPPORTED","statSync","isFile","newPath","currentPath","delimiter","_isDirectory","dir","isDirectory"],"mappings":";;;;;;;;+BAwCOA,WAA8BC,IAA9BD,EAA4C;AACjDE,UAAMC,6BAAND;;AAEA,QAAIA,MAAME,aAAaH,IAAbG,CAAV,EAA8B;AAC5B;AACF;;AAEA;AACAC,QAAIC,wBAAwBJ,MAAMK,gDAAaC,QAAbD,CAAsB,uBAAtBA,EAA+C,EAA/CA,CAAlCF;AACA,QAAIC,sBAAsBG,QAAtBH,CAA+BL,IAA/BK,CAAJ,EAA0C;AACxC;AACF;;AAEAD,QAAIK,eAAeC,cAAKC,IAALD,CAAUE,iBAAVF,EAA6BV,IAA7BU,CAAnBN;AACAS,mBAAeJ,YAAfI;AACF,G;;kBAfsBC,c;;;;;;gCAmCff,aAA6C;AAClD,QAAIgB,8BAA8BC,QAAQC,QAARD,KAAqB,OAAvD,EAAgE;AAC9D;AACF;;AAEA,QAAIE,oCAAOC,aAAPD,KAAyB,KAA7B,EAAoC;AAClC;AACF;;AAEAH,iCAA6B,IAA7BA;;AAEAX,QAAIgB,mBAAmBnB,MAAMK,gDAAaC,QAAbD,CAAsB,MAAtBA,EAA8B,IAA9BA,CAA7BF;;AAEA,Q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S,IAA/BT,GAAsC,EAAxDZ;AACA,MAAIsD,YAAYnB,MAAZmB,GAAqB,CAAzB,EAA4B;AAC1BtD,QAAIuD,YAAY3C,QAAQC,QAARD,KAAqB,OAArBA,GAA+B,GAA/BA,GAAqC,GAArDZ;AACAsD,kBAAe,GAAEC,SAAU,GAAED,WAAY,EAAzCA;AACF;;AAEA1C,UAAQQ,GAARR,CAAYS,IAAZT,GAAoB,GAAEyC,OAAQ,GAAEC,WAAY,EAA5C1C;AACF;;AAuFA,SAAS4C,YAAT,CAAsBC,GAAtB,EAA2B;AACzB,MAAI;AACF,QAAIlB,sCAAGY,QAAHZ,CAAYkB,GAAZlB,EAAiBmB,WAAjBnB,EAAJ,EAAoC;AAClC,aAAO,IAAP;AACF;;AAEA,WAAO,KAAP;AACF,GANA,CAME,OAAOZ,CAAP,EAAU;AACV,WAAO,KAAP;AACF;AACF;;AAEO,SAASe,gBAAT,GAA4B;AACjC,SAAOc,aAAa,0BAAbA,CAAP;AACF","file":"../Binaries.js","sourcesContent":["/**\n * @flow\n */\n\nimport fs from 'fs-extra';\nimport hasbin from 'hasbin';\nimport spawnAsync from '@expo/spawn-async';\nimport path from 'path';\n\nimport Config from './Config';\nimport ErrorCode from './ErrorCode';\nimport Logger from './Logger';\nimport UserSettings from './UserSettings';\nimport XDLError from './XDLError';\n\nlet hasSourcedBashLoginScripts = false;\n\nexport const OSX_SOURCE_PATH = path.join(__dirname, '..', 'binaries', 'osx');\nconst ERROR_MESSAGE = '\\nPlease run `npm install -g exp && exp path`';\n\nfunction _hasbinAsync(name) {\n return new Promise((resolve, reject) => {\n hasbin(name, result => {\n resolve(result);\n });\n });\n}\n\nexport function getBinariesPath(): string {\n if (process.platform === 'darwin') {\n return path.join(__dirname, '..', 'binaries', 'osx');\n } else if (process.platform === 'win32') {\n return path.join(__dirname, '..', 'binaries', 'windows');\n } else if (process.platform === 'linux') {\n return path.join(__dirname, '..', 'binaries', 'linux');\n } else {\n throw new XDLError(ErrorCode.PLATFORM_NOT_SUPPORTED, 'Platform not supported.');\n }\n}\n\nexport async function addToPathAsync(name: string) {\n await sourceBashLoginScriptsAsync();\n\n if (await _hasbinAsync(name)) {\n return;\n }\n\n // Users can set {ignoreBundledBinaries: [\"watchman\"]} to tell us to never use our version\n let ignoreBundledBinaries = await UserSettings.getAsync('ignoreBundledBinaries', []);\n if (ignoreBundledBinaries.includes(name)) {\n return;\n }\n\n let binariesPath = path.join(getBinariesPath(), name);\n _prependToPath(binariesPath);\n}\n\nfunction _expoRCFileExists() {\n try {\n return fs.statSync(path.join(UserSettings.dotExpoHomeDirectory(), 'bashrc')).isFile();\n } catch (e) {\n return false;\n }\n}\n\nfunction _prependToPath(newPath) {\n let currentPath = process.env.PATH ? process.env.PATH : '';\n if (currentPath.length > 0) {\n let delimiter = process.platform === 'win32' ? ';' : ':';\n currentPath = `${delimiter}${currentPath}`;\n }\n\n process.env.PATH = `${newPath}${currentPath}`;\n}\n\nexport async function sourceBashLoginScriptsAsync() {\n if (hasSourcedBashLoginScripts || process.platform === 'win32') {\n return;\n }\n\n if (Config.developerTool !== 'xde') {\n return;\n }\n\n hasSourcedBashLoginScripts = true;\n\n let userSettingsPATH = await UserSettings.getAsync('PATH', null);\n\n if (userSettingsPATH) {\n _prependToPath(userSettingsPATH);\n } else if (_expoRCFileExists()) {\n try {\n // User has a ~/.expo/bashrc. Run that and grab PATH.\n let result = await spawnAsync(path.join(getBinariesPath(), `get-path-bash`), {\n env: {\n PATH: '',\n },\n });\n\n if (result.stderr) {\n Logger.global.warn(`Error sourcing ~/.expo/bashrc script: ${result.stderr}`);\n }\n\n if (result.stdout) {\n _prependToPath(result.stdout);\n }\n } catch (e) {\n Logger.global.warn(`Error sourcing ~/.expo/bashrc script: ${e.stderr}`);\n }\n } else {\n try {\n // No ~/.expo/bashrc file found. Run `env` in process.env.SHELL.\n const shellName = process.env.SHELL;\n if (!shellName) {\n throw new Error('This command requires being run within a shell.');\n }\n\n let result;\n if (/t?csh$/.test(shellName)) {\n // csh\n result = await spawnAsync(shellName, ['-d', '-c', 'env']);\n } else if (/zsh$/.test(shellName)) {\n // zsh\n result = await spawnAsync(shellName, ['-l', '-c', 'env']);\n } else {\n // bash, fish\n result = await spawnAsync(shellName, ['-l', '-c', 'env']);\n }\n\n if (result.stderr) {\n Logger.global.warn(\n `Error sourcing shell startup scripts: ${result.stderr}.${ERROR_MESSAGE}`\n );\n }\n\n if (result.stdout) {\n let regexResult = result.stdout.match(/(^|\\n)PATH=(.+)/);\n\n if (regexResult.length >= 3) {\n _prependToPath(regexResult[2]);\n } else {\n Logger.global.warn(\n `Error parsing shell startup scripts output: ${result.stderr}.${ERROR_MESSAGE}`\n );\n }\n }\n } catch (e) {\n Logger.global.warn(`Error sourcing shell startup scripts: ${e.stderr}.${ERROR_MESSAGE}`);\n }\n }\n}\n\nexport async function writePathToUserSettingsAsync() {\n await UserSettings.setAsync('PATH', process.env.PATH);\n\n // Used in detach app\n let pathFile = path.join(UserSettings.dotExpoHomeDirectory(), 'PATH');\n await fs.writeFile(pathFile, process.env.PATH);\n}\n\nfunction _isDirectory(dir) {\n try {\n if (fs.statSync(dir).isDirectory()) {\n return true;\n }\n\n return false;\n } catch (e) {\n return false;\n }\n}\n\nexport function isXcodeInstalled() {\n return _isDirectory('/Applications/Xcode.app/');\n}\n"],"sourceRoot":"/xdl/src"}