GT2/GT2-Android/node_modules/react-native-scripts/build/scripts/start.js.map

1 line
8.2 KiB
Plaintext

{"version":3,"sources":["start.js"],"names":["readPackagerInfoAsync","process","cwd","settings","constructManifestUrlAsync","address","generate","qrCode","underline","cyan","printUsage","printServerInfo","key","CTRL_C","CTRL_D","emit","withTimestamp","openProjectAsync","success","error","red","message","hostType","localAddress","openUrlInSimulatorSafeAsync","msg","reset","startAsync","dev","setAsync","bold","handleKeypress","validation","reactNativeVersionWarnings","developerTool","offline","args","argv","slice","boolean","default","interactive","options","isInteractive","stdin","setRawMode","resume","setEncoding","on","run","onReady","green","dim","devMode","iosInfo","platform"],"mappings":";;;;;;;;;;AA8CA;;sFACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBACyB,qBAAgBA,qBAAhB,CAAsCC,QAAQC,GAAR,EAAtC,CADzB;;AAAA;AACQC,oBADR;AAAA;AAAA,mBAGwB,cAASC,yBAAT,CAAmCH,QAAQC,GAAR,EAAnC,CAHxB;;AAAA;AAGQG,mBAHR;;AAIE,qCAAGC,QAAH,CAAYD,OAAZ,EAAqB,kBAAU;AAC7B,gLAIF,4BAAOE,MAAP,EAAe,CAAf,CAJE,sEAQA,gBAAMC,SAAN,CAAgB,gBAAMC,IAAN,CAAWJ,OAAX,CAAhB,CARA,oIAW8C,gBAAMG,SAAN,CAAgB,gBAAMC,IAAN,CAAW,iBAAX,CAAhB,CAX9C;AAeAC;AACD,aAjBD;;AAJF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;kBAAeC,e;;;;;;uFA8Cf,kBAA8BC,GAA9B;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,2BACUA,GADV;AAAA,8CAESC,MAFT,wBAGSC,MAHT,wBAMS,GANT,wBAgBS,GAhBT,yBA6BS,GA7BT,yBAiCS,GAjCT,yBAkCS,GAlCT,yBA4CS,GA5CT;AAAA;;AAAA;AAIMb,oBAAQc,IAAR,CAAa,QAAb;AAJN;;AAAA;AAOM;AAC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MuB,UAAUzB,MAAM,aAAN,GAAsB,YAAtC;AACA,MAAM0B,UAAUrD,QAAQsD,QAAR,KAAqB,OAArB,GACZH,IAAI,GAAJ,CADY,GAETA,WAFS,WAEQA,4BAFxB;AAGA,6BAECA,mBAFD,WAE0BA,yCAF1B,GAEsEE,OAFtE,WAGCF,mBAHD,WAG0BA,0BAH1B,WAICA,mBAJD,WAI0BA,8BAJ1B,WAI8DA,2CAJ9D,WAKCA,mBALD,WAK0BA,oDAAkDtB,KAAKuB,OAAL,CAAlD,GAAkE,gBAAM3B,KAAN,CAAY0B,GAAZ,CAAgB,GAAhB,CAAlE,CAL1B;AAQD;;AAED,IAAMvC,SAAS,MAAf;AACA,IAAMC,SAAS,MAAf","file":"start.js","sourcesContent":["// @flow\n\nimport { Android, Config, Project, ProjectSettings, Simulator, UrlUtils } from 'xdl';\n\nimport chalk from 'chalk';\nimport indent from 'indent-string';\nimport qr from 'qrcode-terminal';\nimport minimist from 'minimist';\nimport log from '../util/log';\nimport clearConsole from '../util/clearConsole';\n\nimport packager from '../util/packager';\n\nConfig.validation.reactNativeVersionWarnings = false;\nConfig.developerTool = 'crna';\nConfig.offline = true;\n\nconst args = minimist(process.argv.slice(2), {\n boolean: ['reset-cache', 'interactive'],\n default: { interactive: true },\n});\nlet dev = true;\n\nconst options = {};\nif (args['reset-cache']) {\n options.reset = true;\n log('Asking packager to reset its cache...');\n}\n\nlet isInteractive = false;\nconst { stdin } = process;\nif (args.interactive && typeof stdin.setRawMode === 'function') {\n stdin.setRawMode(true);\n stdin.resume();\n stdin.setEncoding('utf8');\n stdin.on('data', handleKeypress);\n isInteractive = true;\n}\n\npackager.run(onReady, options, isInteractive);\n\nfunction onReady() {\n log(chalk.green('Packager started!\\n'));\n printServerInfo();\n}\n\n// print a nicely formatted message with setup information\nasync function printServerInfo() {\n const settings = await ProjectSettings.readPackagerInfoAsync(process.cwd());\n // who knows why qrcode-terminal takes a callback instead of just returning a string\n const address = await UrlUtils.constructManifestUrlAsync(process.cwd());\n qr.generate(address, qrCode => {\n log(\n `To view your app with live reloading, point the Expo app to this QR code.\nYou'll find the QR scanner on the Projects tab of the app.\n\n${indent(qrCode, 2)}\n\nOr enter this address in the Expo app's search bar:\n\n ${chalk.underline(chalk.cyan(address))}\n\nYour phone will need to be on the same local network as this computer.\nFor links to install the Expo app, please visit ${chalk.underline(chalk.cyan('https://expo.io'))}.\n\nLogs from serving your app will appear here. Press Ctrl+C at any time to stop.`\n );\n printUsage();\n });\n}\n\nfunction printUsage() {\n if (!isInteractive) {\n return;\n }\n const { dim, bold } = chalk;\n const devMode = dev ? 'development' : 'production';\n const iosInfo = process.platform === 'win32'\n ? dim('.')\n : `${dim(`, or`)} i ${dim(`to open iOS emulator.`)}`;\n log(\n `\n ${dim(`\\u203A Press`)} a ${dim(`to open Android device or emulator`)}${iosInfo}\n ${dim(`\\u203A Press`)} q ${dim(`to display QR code.`)}\n ${dim(`\\u203A Press`)} r ${dim(`to restart packager, or`)} R ${dim(`to restart packager and clear cache.`)}\n ${dim(`\\u203A Press`)} d ${dim(`to toggle development mode. (current mode: ${bold(devMode)}${chalk.reset.dim(')')}`)}\n`\n );\n}\n\nconst CTRL_C = '\\u0003';\nconst CTRL_D = '\\u0004';\n\nasync function handleKeypress(key) {\n switch (key) {\n case CTRL_C:\n case CTRL_D:\n process.emit('SIGINT');\n return;\n case 'a': {\n clearConsole();\n log.withTimestamp('Starting Android...');\n const { success, error } = await Android.openProjectAsync(process.cwd());\n if (!success) {\n log(chalk.red(error.message));\n }\n printUsage();\n return;\n }\n case 'i': {\n clearConsole();\n log.withTimestamp('Starting iOS...');\n const localAddress = await UrlUtils.constructManifestUrlAsync(process.cwd(), {\n hostType: 'localhost',\n });\n const { success, msg } = await Simulator.openUrlInSimulatorSafeAsync(localAddress);\n if (!success) {\n log(chalk.red(msg));\n }\n printUsage();\n return;\n }\n case 'q':\n clearConsole();\n await printServerInfo();\n return;\n case 'r':\n case 'R': {\n clearConsole();\n const reset = key === 'R';\n if (reset) {\n log.withTimestamp('Asking packager to reset its cache...');\n }\n log.withTimestamp('Restarting packager...');\n Project.startAsync(process.cwd(), { reset });\n return;\n }\n case 'd':\n clearConsole();\n dev = !dev;\n await ProjectSettings.setAsync(process.cwd(), { dev });\n log(\n `Packager now running in ${chalk.bold(dev ? 'development' : 'production')}${chalk.reset(` mode.`)}\n\nPlease close and reopen the project in the Expo app for the\nchange to take effect.`\n );\n printUsage();\n return;\n }\n}\n"]}