@expo/cli 57.0.33 → 57.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +4 -1
- package/build/bin/cli.map +1 -1
- package/build/src/events/index.js +1 -1
- package/build/src/start/doctor/dependencies/getMissingPackages.js +6 -4
- package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +6 -1
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +1 -1
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/utils/env.js +2 -1
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/obj.js +1 -1
- package/build/src/utils/obj.js.map +1 -1
- package/build/src/utils/parentCommand.js +30 -0
- package/build/src/utils/parentCommand.js.map +1 -0
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +3 -1
- package/build/src/utils/telemetry/utils/context.js.map +1 -1
- package/package.json +14 -14
package/build/bin/cli
CHANGED
|
@@ -32,6 +32,7 @@ function _getenv() {
|
|
|
32
32
|
return data;
|
|
33
33
|
}
|
|
34
34
|
const _events = require("../src/events");
|
|
35
|
+
const _parentCommand = require("../src/utils/parentCommand");
|
|
35
36
|
function _interop_require_default(obj) {
|
|
36
37
|
return obj && obj.__esModule ? obj : {
|
|
37
38
|
default: obj
|
|
@@ -139,7 +140,7 @@ const args = (0, _arg().default)({
|
|
|
139
140
|
});
|
|
140
141
|
if (args['--version']) {
|
|
141
142
|
// Version is added in the build script.
|
|
142
|
-
console.log("57.0.
|
|
143
|
+
console.log("57.0.35");
|
|
143
144
|
process.exit(0);
|
|
144
145
|
}
|
|
145
146
|
if (args['--non-interactive']) {
|
|
@@ -264,6 +265,8 @@ if (args['--help']) {
|
|
|
264
265
|
// Install exit hooks
|
|
265
266
|
process.on('SIGINT', ()=>process.exit(0));
|
|
266
267
|
process.on('SIGTERM', ()=>process.exit(0));
|
|
268
|
+
// Child CLI invocations inherit this command, including those launched through build tools.
|
|
269
|
+
(0, _parentCommand.markAsParentCommand)(`expo ${command}`);
|
|
267
270
|
commands[command]().then((exec)=>{
|
|
268
271
|
exec(commandArgs);
|
|
269
272
|
// NOTE(EvanBacon): Track some basic telemetry events indicating the command
|
package/build/bin/cli.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport arg from 'arg';\nimport chalk from 'chalk';\nimport Debug from 'debug';\nimport { boolish } from 'getenv';\n\nimport { installEventLogger } from '../src/events';\n\n// Setup event logger output\n// NOTE: Done before any console output\ninstallEventLogger();\n\n// Check Node.js version and issue a loud warning if it's too outdated\n// This is sent to stderr (console.error) so it doesn't interfere with programmatic commands\nconst NODE_MIN = [20, 19, 4] as const;\nconst nodeVersion = process.version?.slice(1).split('.', 3).map(Number);\nif (nodeVersion[0]! < NODE_MIN[0] || (nodeVersion[0] === NODE_MIN[0] && nodeVersion[1]! < NODE_MIN[1])) {\n console.error(\n chalk.red`{bold Node.js (${process.version}) is outdated and unsupported.}`\n + chalk.red` Please update to a newer Node.js LTS version (required: >=${NODE_MIN.join('.')})\\n`\n + chalk.red`Go to: https://nodejs.org/en/download\\n`\n );\n}\n\n// Setup before requiring `debug`.\nif (boolish('EXPO_DEBUG', false)) {\n Debug.enable('expo:*');\n} else if (Debug.enabled('expo:')) {\n process.env.EXPO_DEBUG = '1';\n}\n\nconst defaultCmd = 'start';\n\nexport type Command = (argv?: string[]) => void;\n\nconst commands: { [command: string]: () => Promise<Command> } = {\n // Add a new command here\n // NOTE(EvanBacon): Ensure every bundler-related command sets `NODE_ENV` as expected for the command.\n run: () => import('../src/run/index.js').then((i) => i.expoRun),\n 'run:ios': () => import('../src/run/ios/index.js').then((i) => i.expoRunIos),\n 'run:android': () => import('../src/run/android/index.js').then((i) => i.expoRunAndroid),\n start: () => import('../src/start/index.js').then((i) => i.expoStart),\n prebuild: () => import('../src/prebuild/index.js').then((i) => i.expoPrebuild),\n config: () => import('../src/config/index.js').then((i) => i.expoConfig),\n export: () => import('../src/export/index.js').then((i) => i.expoExport),\n 'export:web': () => import('../src/export/web/index.js').then((i) => i.expoExportWeb),\n 'export:embed': () => import('../src/export/embed/index.js').then((i) => i.expoExportEmbed),\n\n serve: () => import('../src/serve/index.js').then((i) => i.expoServe),\n\n // Auxiliary commands\n install: () => import('../src/install/index.js').then((i) => i.expoInstall),\n add: () => import('../src/install/index.js').then((i) => i.expoInstall),\n customize: () => import('../src/customize/index.js').then((i) => i.expoCustomize),\n lint: () => import('../src/lint/index.js').then((i) => i.expoLint),\n\n // Auth\n login: () => import('../src/login/index.js').then((i) => i.expoLogin),\n logout: () => import('../src/logout/index.js').then((i) => i.expoLogout),\n register: () => import('../src/register/index.js').then((i) => i.expoRegister),\n whoami: () => import('../src/whoami/index.js').then((i) => i.expoWhoami),\n};\n\nconst args = arg(\n {\n // Types\n '--version': Boolean,\n '--help': Boolean,\n // NOTE(EvanBacon): This is here to silence warnings from processes that\n // expect the global expo-cli.\n '--non-interactive': Boolean,\n\n // Aliases\n '-v': '--version',\n '-h': '--help',\n },\n {\n permissive: true,\n }\n);\n\nif (args['--version']) {\n // Version is added in the build script.\n console.log(process.env.__EXPO_VERSION);\n process.exit(0);\n}\n\nif (args['--non-interactive']) {\n console.warn(chalk.yellow` {bold --non-interactive} is not supported, use {bold $CI=1} instead`);\n}\n\n// Check if we are running `npx expo <subcommand>` or `npx expo`\nconst isSubcommand = !!(args._[0] && commands[args._[0]]);\n\n// Handle `--help` flag\nif (!isSubcommand && args['--help']) {\n const {\n login,\n logout,\n whoami,\n register,\n start,\n install,\n add,\n export: _export,\n config,\n customize,\n prebuild,\n 'run:ios': runIos,\n 'run:android': runAndroid,\n // NOTE(EvanBacon): Don't document this command as it's a temporary\n // workaround until we can use `expo export` for all production bundling.\n // https://github.com/expo/expo/pull/21396/files#r1121025873\n 'export:embed': exportEmbed_unused,\n // The export:web command is deprecated. Hide it from the help prompt.\n 'export:web': exportWeb_unused,\n // Other ignored commands, these are intentially not listed in the `--help` output\n run: _run,\n // NOTE(cedric): Still pending the migration to ESLint's flat config\n lint: _lint,\n serve,\n // All other commands\n ...others\n } = commands;\n\n console.log(chalk`\n {bold Usage}\n {dim $} npx expo <command>\n\n {bold Commands}\n ${Object.keys({ start, export: _export, ...others }).join(', ')}\n ${Object.keys({ 'run:ios': runIos, 'run:android': runAndroid, prebuild }).join(', ')}\n ${Object.keys({ install, customize, config, serve }).join(', ')}\n {dim ${Object.keys({ login, logout, whoami, register }).join(', ')}}\n\n {bold Options}\n --version, -v Version number\n --help, -h Usage info\n\n For more info run a command with the {bold --help} flag\n {dim $} npx expo start --help\n`);\n\n process.exit(0);\n}\n\n// NOTE(EvanBacon): Squat some directory names to help with migration,\n// users can still use folders named \"send\" or \"eject\" by using the fully qualified `npx expo start ./send`.\nif (!isSubcommand) {\n const migrationMap: Record<string, string> = {\n init: 'npx create-expo-app',\n eject: 'npx expo prebuild',\n web: 'npx expo start --web',\n 'start:web': 'npx expo start --web',\n 'build:ios': 'eas build -p ios',\n 'build:android': 'eas build -p android',\n 'client:install:ios': 'npx expo start --ios',\n 'client:install:android': 'npx expo start --android',\n doctor: 'npx expo-doctor',\n upgrade: 'https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough/',\n 'customize:web': 'npx expo customize',\n\n publish: 'eas update',\n 'publish:set': 'eas update',\n 'publish:rollback': 'eas update',\n 'publish:history': 'eas update',\n 'publish:details': 'eas update',\n\n 'build:web': 'npx expo export:web',\n\n 'credentials:manager': `eas credentials`,\n 'fetch:ios:certs': `eas credentials`,\n 'fetch:android:keystore': `eas credentials`,\n 'fetch:android:hashes': `eas credentials`,\n 'fetch:android:upload-cert': `eas credentials`,\n 'push:android:upload': `eas credentials`,\n 'push:android:show': `eas credentials`,\n 'push:android:clear': `eas credentials`,\n url: `eas build:list`,\n 'url:ipa': `eas build:list`,\n 'url:apk': `eas build:list`,\n webhooks: `eas webhook`,\n 'webhooks:add': `eas webhook:create`,\n 'webhooks:remove': `eas webhook:delete`,\n 'webhooks:update': `eas webhook:update`,\n\n 'build:status': `eas build:list`,\n 'upload:android': `eas submit -p android`,\n 'upload:ios': `eas submit -p ios`,\n };\n\n // TODO: Log telemetry about invalid command used.\n const subcommand = args._[0];\n if (subcommand && subcommand in migrationMap) {\n const replacement = migrationMap[subcommand];\n console.log();\n const instruction = subcommand === 'upgrade' ? 'follow this guide' : 'use';\n console.log(\n chalk.yellow` {gray $} {bold expo ${subcommand}} is not supported in the local CLI, please ${instruction} {bold ${replacement}} instead`\n );\n console.log();\n process.exit(1);\n }\n const deprecated = ['send', 'client:ios'];\n if (subcommand && deprecated.includes(subcommand)) {\n console.log();\n console.log(chalk.yellow` {gray $} {bold expo ${subcommand}} is deprecated`);\n console.log();\n process.exit(1);\n }\n}\n\nconst command = isSubcommand ? args._[0]! : defaultCmd;\nconst commandArgs = isSubcommand ? args._.slice(1) : args._;\n\n// Push the help flag to the subcommand args.\nif (args['--help']) {\n commandArgs.push('--help');\n}\n\n// Install exit hooks\nprocess.on('SIGINT', () => process.exit(0));\nprocess.on('SIGTERM', () => process.exit(0));\n\ncommands[command]!().then((exec) => {\n exec(commandArgs);\n\n // NOTE(EvanBacon): Track some basic telemetry events indicating the command\n // that was run. This can be disabled with the $EXPO_NO_TELEMETRY environment variable.\n // We do this to determine how well deprecations are going before removing a command.\n if (!boolish('EXPO_NO_TELEMETRY', false)) {\n const { recordCommand } =\n require('../src/utils/telemetry') as typeof import('../src/utils/telemetry');\n recordCommand(command);\n }\n});\n"],"names":["process","installEventLogger","NODE_MIN","nodeVersion","version","slice","split","map","Number","console","error","chalk","red","join","boolish","Debug","enable","enabled","env","EXPO_DEBUG","defaultCmd","commands","run","then","i","expoRun","expoRunIos","expoRunAndroid","start","expoStart","prebuild","expoPrebuild","config","expoConfig","export","expoExport","expoExportWeb","expoExportEmbed","serve","expoServe","install","expoInstall","add","customize","expoCustomize","lint","expoLint","login","expoLogin","logout","expoLogout","register","expoRegister","whoami","expoWhoami","args","arg","Boolean","permissive","log","__EXPO_VERSION","exit","warn","yellow","isSubcommand","_","_export","runIos","runAndroid","exportEmbed_unused","exportWeb_unused","_run","_lint","others","Object","keys","migrationMap","init","eject","web","doctor","upgrade","publish","url","webhooks","subcommand","replacement","instruction","deprecated","includes","command","commandArgs","push","on","exec","recordCommand","require"],"mappings":";;;;;;gEACgB;;;;;;;gEACE;;;;;;;gEACA;;;;;;;yBACM;;;;;;wBAEW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASfA;AAPpB,4BAA4B;AAC5B,uCAAuC;AACvCC,IAAAA,0BAAkB;AAElB,sEAAsE;AACtE,4FAA4F;AAC5F,MAAMC,WAAW;IAAC;IAAI;IAAI;CAAE;AAC5B,MAAMC,eAAcH,mBAAAA,QAAQI,OAAO,qBAAfJ,iBAAiBK,KAAK,CAAC,GAAGC,KAAK,CAAC,KAAK,GAAGC,GAAG,CAACC;AAChE,IAAIL,WAAW,CAAC,EAAE,GAAID,QAAQ,CAAC,EAAE,IAAKC,WAAW,CAAC,EAAE,KAAKD,QAAQ,CAAC,EAAE,IAAIC,WAAW,CAAC,EAAE,GAAID,QAAQ,CAAC,EAAE,EAAG;IACtGO,QAAQC,KAAK,CACXC,gBAAK,CAACC,GAAG,CAAC,eAAe,EAAEZ,QAAQI,OAAO,CAAC,+BAA+B,CAAC,GACvEO,gBAAK,CAACC,GAAG,CAAC,2DAA2D,EAAEV,SAASW,IAAI,CAAC,KAAK,GAAG,CAAC,GAC9FF,gBAAK,CAACC,GAAG,CAAC,uCAAuC,CAAC;AAE1D;AAEA,kCAAkC;AAClC,IAAIE,IAAAA,iBAAO,EAAC,cAAc,QAAQ;IAChCC,gBAAK,CAACC,MAAM,CAAC;AACf,OAAO,IAAID,gBAAK,CAACE,OAAO,CAAC,UAAU;IACjCjB,QAAQkB,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6C;AAC7C,IAAIV,IAAI,CAAC,SAAS,EAAE;IAClBoC,YAAYC,IAAI,CAAC;AACnB;AAEA,qBAAqB;AACrB5F,QAAQ6F,EAAE,CAAC,UAAU,IAAM7F,QAAQ6D,IAAI,CAAC;AACxC7D,QAAQ6F,EAAE,CAAC,WAAW,IAAM7F,QAAQ6D,IAAI,CAAC;AAEzCxC,QAAQ,CAACqE,QAAQ,GAAInE,IAAI,CAAC,CAACuE;IACzBA,KAAKH;IAEL,4EAA4E;IAC5E,uFAAuF;IACvF,qFAAqF;IACrF,IAAI,CAAC7E,IAAAA,iBAAO,EAAC,qBAAqB,QAAQ;QACxC,MAAM,EAAEiF,aAAa,EAAE,GACrBC,QAAQ;QACVD,cAAcL;IAChB;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport arg from 'arg';\nimport chalk from 'chalk';\nimport Debug from 'debug';\nimport { boolish } from 'getenv';\n\nimport { installEventLogger } from '../src/events';\nimport { markAsParentCommand } from '../src/utils/parentCommand';\n\n// Setup event logger output\n// NOTE: Done before any console output\ninstallEventLogger();\n\n// Check Node.js version and issue a loud warning if it's too outdated\n// This is sent to stderr (console.error) so it doesn't interfere with programmatic commands\nconst NODE_MIN = [20, 19, 4] as const;\nconst nodeVersion = process.version?.slice(1).split('.', 3).map(Number);\nif (nodeVersion[0]! < NODE_MIN[0] || (nodeVersion[0] === NODE_MIN[0] && nodeVersion[1]! < NODE_MIN[1])) {\n console.error(\n chalk.red`{bold Node.js (${process.version}) is outdated and unsupported.}`\n + chalk.red` Please update to a newer Node.js LTS version (required: >=${NODE_MIN.join('.')})\\n`\n + chalk.red`Go to: https://nodejs.org/en/download\\n`\n );\n}\n\n// Setup before requiring `debug`.\nif (boolish('EXPO_DEBUG', false)) {\n Debug.enable('expo:*');\n} else if (Debug.enabled('expo:')) {\n process.env.EXPO_DEBUG = '1';\n}\n\nconst defaultCmd = 'start';\n\nexport type Command = (argv?: string[]) => void;\n\nconst commands: { [command: string]: () => Promise<Command> } = {\n // Add a new command here\n // NOTE(EvanBacon): Ensure every bundler-related command sets `NODE_ENV` as expected for the command.\n run: () => import('../src/run/index.js').then((i) => i.expoRun),\n 'run:ios': () => import('../src/run/ios/index.js').then((i) => i.expoRunIos),\n 'run:android': () => import('../src/run/android/index.js').then((i) => i.expoRunAndroid),\n start: () => import('../src/start/index.js').then((i) => i.expoStart),\n prebuild: () => import('../src/prebuild/index.js').then((i) => i.expoPrebuild),\n config: () => import('../src/config/index.js').then((i) => i.expoConfig),\n export: () => import('../src/export/index.js').then((i) => i.expoExport),\n 'export:web': () => import('../src/export/web/index.js').then((i) => i.expoExportWeb),\n 'export:embed': () => import('../src/export/embed/index.js').then((i) => i.expoExportEmbed),\n\n serve: () => import('../src/serve/index.js').then((i) => i.expoServe),\n\n // Auxiliary commands\n install: () => import('../src/install/index.js').then((i) => i.expoInstall),\n add: () => import('../src/install/index.js').then((i) => i.expoInstall),\n customize: () => import('../src/customize/index.js').then((i) => i.expoCustomize),\n lint: () => import('../src/lint/index.js').then((i) => i.expoLint),\n\n // Auth\n login: () => import('../src/login/index.js').then((i) => i.expoLogin),\n logout: () => import('../src/logout/index.js').then((i) => i.expoLogout),\n register: () => import('../src/register/index.js').then((i) => i.expoRegister),\n whoami: () => import('../src/whoami/index.js').then((i) => i.expoWhoami),\n};\n\nconst args = arg(\n {\n // Types\n '--version': Boolean,\n '--help': Boolean,\n // NOTE(EvanBacon): This is here to silence warnings from processes that\n // expect the global expo-cli.\n '--non-interactive': Boolean,\n\n // Aliases\n '-v': '--version',\n '-h': '--help',\n },\n {\n permissive: true,\n }\n);\n\nif (args['--version']) {\n // Version is added in the build script.\n console.log(process.env.__EXPO_VERSION);\n process.exit(0);\n}\n\nif (args['--non-interactive']) {\n console.warn(chalk.yellow` {bold --non-interactive} is not supported, use {bold $CI=1} instead`);\n}\n\n// Check if we are running `npx expo <subcommand>` or `npx expo`\nconst isSubcommand = !!(args._[0] && commands[args._[0]]);\n\n// Handle `--help` flag\nif (!isSubcommand && args['--help']) {\n const {\n login,\n logout,\n whoami,\n register,\n start,\n install,\n add,\n export: _export,\n config,\n customize,\n prebuild,\n 'run:ios': runIos,\n 'run:android': runAndroid,\n // NOTE(EvanBacon): Don't document this command as it's a temporary\n // workaround until we can use `expo export` for all production bundling.\n // https://github.com/expo/expo/pull/21396/files#r1121025873\n 'export:embed': exportEmbed_unused,\n // The export:web command is deprecated. Hide it from the help prompt.\n 'export:web': exportWeb_unused,\n // Other ignored commands, these are intentially not listed in the `--help` output\n run: _run,\n // NOTE(cedric): Still pending the migration to ESLint's flat config\n lint: _lint,\n serve,\n // All other commands\n ...others\n } = commands;\n\n console.log(chalk`\n {bold Usage}\n {dim $} npx expo <command>\n\n {bold Commands}\n ${Object.keys({ start, export: _export, ...others }).join(', ')}\n ${Object.keys({ 'run:ios': runIos, 'run:android': runAndroid, prebuild }).join(', ')}\n ${Object.keys({ install, customize, config, serve }).join(', ')}\n {dim ${Object.keys({ login, logout, whoami, register }).join(', ')}}\n\n {bold Options}\n --version, -v Version number\n --help, -h Usage info\n\n For more info run a command with the {bold --help} flag\n {dim $} npx expo start --help\n`);\n\n process.exit(0);\n}\n\n// NOTE(EvanBacon): Squat some directory names to help with migration,\n// users can still use folders named \"send\" or \"eject\" by using the fully qualified `npx expo start ./send`.\nif (!isSubcommand) {\n const migrationMap: Record<string, string> = {\n init: 'npx create-expo-app',\n eject: 'npx expo prebuild',\n web: 'npx expo start --web',\n 'start:web': 'npx expo start --web',\n 'build:ios': 'eas build -p ios',\n 'build:android': 'eas build -p android',\n 'client:install:ios': 'npx expo start --ios',\n 'client:install:android': 'npx expo start --android',\n doctor: 'npx expo-doctor',\n upgrade: 'https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough/',\n 'customize:web': 'npx expo customize',\n\n publish: 'eas update',\n 'publish:set': 'eas update',\n 'publish:rollback': 'eas update',\n 'publish:history': 'eas update',\n 'publish:details': 'eas update',\n\n 'build:web': 'npx expo export:web',\n\n 'credentials:manager': `eas credentials`,\n 'fetch:ios:certs': `eas credentials`,\n 'fetch:android:keystore': `eas credentials`,\n 'fetch:android:hashes': `eas credentials`,\n 'fetch:android:upload-cert': `eas credentials`,\n 'push:android:upload': `eas credentials`,\n 'push:android:show': `eas credentials`,\n 'push:android:clear': `eas credentials`,\n url: `eas build:list`,\n 'url:ipa': `eas build:list`,\n 'url:apk': `eas build:list`,\n webhooks: `eas webhook`,\n 'webhooks:add': `eas webhook:create`,\n 'webhooks:remove': `eas webhook:delete`,\n 'webhooks:update': `eas webhook:update`,\n\n 'build:status': `eas build:list`,\n 'upload:android': `eas submit -p android`,\n 'upload:ios': `eas submit -p ios`,\n };\n\n // TODO: Log telemetry about invalid command used.\n const subcommand = args._[0];\n if (subcommand && subcommand in migrationMap) {\n const replacement = migrationMap[subcommand];\n console.log();\n const instruction = subcommand === 'upgrade' ? 'follow this guide' : 'use';\n console.log(\n chalk.yellow` {gray $} {bold expo ${subcommand}} is not supported in the local CLI, please ${instruction} {bold ${replacement}} instead`\n );\n console.log();\n process.exit(1);\n }\n const deprecated = ['send', 'client:ios'];\n if (subcommand && deprecated.includes(subcommand)) {\n console.log();\n console.log(chalk.yellow` {gray $} {bold expo ${subcommand}} is deprecated`);\n console.log();\n process.exit(1);\n }\n}\n\nconst command = isSubcommand ? args._[0]! : defaultCmd;\nconst commandArgs = isSubcommand ? args._.slice(1) : args._;\n\n// Push the help flag to the subcommand args.\nif (args['--help']) {\n commandArgs.push('--help');\n}\n\n// Install exit hooks\nprocess.on('SIGINT', () => process.exit(0));\nprocess.on('SIGTERM', () => process.exit(0));\n\n// Child CLI invocations inherit this command, including those launched through build tools.\nmarkAsParentCommand(`expo ${command}`);\n\ncommands[command]!().then((exec) => {\n exec(commandArgs);\n\n // NOTE(EvanBacon): Track some basic telemetry events indicating the command\n // that was run. This can be disabled with the $EXPO_NO_TELEMETRY environment variable.\n // We do this to determine how well deprecations are going before removing a command.\n if (!boolish('EXPO_NO_TELEMETRY', false)) {\n const { recordCommand } =\n require('../src/utils/telemetry') as typeof import('../src/utils/telemetry');\n recordCommand(command);\n }\n});\n"],"names":["process","installEventLogger","NODE_MIN","nodeVersion","version","slice","split","map","Number","console","error","chalk","red","join","boolish","Debug","enable","enabled","env","EXPO_DEBUG","defaultCmd","commands","run","then","i","expoRun","expoRunIos","expoRunAndroid","start","expoStart","prebuild","expoPrebuild","config","expoConfig","export","expoExport","expoExportWeb","expoExportEmbed","serve","expoServe","install","expoInstall","add","customize","expoCustomize","lint","expoLint","login","expoLogin","logout","expoLogout","register","expoRegister","whoami","expoWhoami","args","arg","Boolean","permissive","log","__EXPO_VERSION","exit","warn","yellow","isSubcommand","_","_export","runIos","runAndroid","exportEmbed_unused","exportWeb_unused","_run","_lint","others","Object","keys","migrationMap","init","eject","web","doctor","upgrade","publish","url","webhooks","subcommand","replacement","instruction","deprecated","includes","command","commandArgs","push","on","markAsParentCommand","exec","recordCommand","require"],"mappings":";;;;;;gEACgB;;;;;;;gEACE;;;;;;;gEACA;;;;;;;yBACM;;;;;;wBAEW;+BACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAShBA;AAPpB,4BAA4B;AAC5B,uCAAuC;AACvCC,IAAAA,0BAAkB;AAElB,sEAAsE;AACtE,4FAA4F;AAC5F,MAAMC,WAAW;IAAC;IAAI;IAAI;CAAE;AAC5B,MAAMC,eAAcH,mBAAAA,QAAQI,OAAO,qBAAfJ,iBAAiBK,KAAK,CAAC,GAAGC,KAAK,CAAC,KAAK,GAAGC,GAAG,CAACC;AAChE,IAAIL,WAAW,CAAC,EAAE,GAAID,QAAQ,CAAC,EAAE,IAAKC,WAAW,CAAC,EAAE,KAAKD,QAAQ,CAAC,EAAE,IAAIC,WAAW,CAAC,EAAE,GAAID,QAAQ,CAAC,EAAE,EAAG;IACtGO,QAAQC,KAAK,CACXC,gBAAK,CAACC,GAAG,CAAC,eAAe,EAAEZ,QA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QAAQkD,GAAG;QACXlD,QAAQkD,GAAG,CAAChD,gBAAK,CAACoD,MAAM,CAAC,sBAAsB,EAAEsB,WAAW,eAAe,CAAC;QAC5E5E,QAAQkD,GAAG;QACX3D,QAAQ6D,IAAI,CAAC;IACf;AACF;AAEA,MAAM6B,UAAU1B,eAAeT,KAAKU,CAAC,CAAC,EAAE,GAAI7C;AAC5C,MAAMuE,cAAc3B,eAAeT,KAAKU,CAAC,CAAC5D,KAAK,CAAC,KAAKkD,KAAKU,CAAC;AAE3D,6CAA6C;AAC7C,IAAIV,IAAI,CAAC,SAAS,EAAE;IAClBoC,YAAYC,IAAI,CAAC;AACnB;AAEA,qBAAqB;AACrB5F,QAAQ6F,EAAE,CAAC,UAAU,IAAM7F,QAAQ6D,IAAI,CAAC;AACxC7D,QAAQ6F,EAAE,CAAC,WAAW,IAAM7F,QAAQ6D,IAAI,CAAC;AAEzC,4FAA4F;AAC5FiC,IAAAA,kCAAmB,EAAC,CAAC,KAAK,EAAEJ,SAAS;AAErCrE,QAAQ,CAACqE,QAAQ,GAAInE,IAAI,CAAC,CAACwE;IACzBA,KAAKJ;IAEL,4EAA4E;IAC5E,uFAAuF;IACvF,qFAAqF;IACrF,IAAI,CAAC7E,IAAAA,iBAAO,EAAC,qBAAqB,QAAQ;QACxC,MAAM,EAAEkF,aAAa,EAAE,GACrBC,QAAQ;QACVD,cAAcN;IAChB;AACF"}
|
|
@@ -76,7 +76,7 @@ function getInitMetadata() {
|
|
|
76
76
|
return {
|
|
77
77
|
format: 'v0-jsonl',
|
|
78
78
|
// Version is added in the build script.
|
|
79
|
-
version: "57.0.
|
|
79
|
+
version: "57.0.35" ?? 'UNVERSIONED'
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
function getWellKnownTemporaryLogFile(projectRoot, command) {
|
|
@@ -29,9 +29,9 @@ function _jsonfile() {
|
|
|
29
29
|
};
|
|
30
30
|
return data;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const data =
|
|
34
|
-
|
|
32
|
+
function _requireutils() {
|
|
33
|
+
const data = require("@expo/require-utils");
|
|
34
|
+
_requireutils = function() {
|
|
35
35
|
return data;
|
|
36
36
|
};
|
|
37
37
|
return data;
|
|
@@ -53,7 +53,9 @@ const debug = require('debug')('expo:doctor:dependencies:getMissingPackages');
|
|
|
53
53
|
function collectMissingPackages(projectRoot, requiredPackages) {
|
|
54
54
|
const resolutions = {};
|
|
55
55
|
const missingPackages = requiredPackages.filter((p)=>{
|
|
56
|
-
const resolved =
|
|
56
|
+
const resolved = (0, _requireutils().resolveFrom)(projectRoot, p.file, {
|
|
57
|
+
skipNodePath: true
|
|
58
|
+
});
|
|
57
59
|
if (!resolved || !versionSatisfiesRequiredPackage(resolved, p)) {
|
|
58
60
|
return true;
|
|
59
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/dependencies/getMissingPackages.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport resolveFrom from '
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/dependencies/getMissingPackages.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport { resolveFrom } from '@expo/require-utils';\nimport semver from 'semver';\n\nimport { getCombinedKnownVersionsAsync } from './getVersionedPackages';\n\nconst debug = require('debug')('expo:doctor:dependencies:getMissingPackages') as typeof console.log;\n\nexport type ResolvedPackage = {\n /** Module ID pointing to the library `package.json`. */\n file: string;\n /** NPM package name. */\n pkg: string;\n /** Required version range. */\n version?: string;\n /** If the dependency should be installed as a `devDependency` */\n dev?: boolean;\n};\n\n/** Given a set of required packages, this method returns a list of missing packages. */\nexport function collectMissingPackages(\n projectRoot: string,\n requiredPackages: ResolvedPackage[]\n): {\n missing: ResolvedPackage[];\n resolutions: Record<string, string>;\n} {\n const resolutions: Record<string, string> = {};\n\n const missingPackages = requiredPackages.filter((p) => {\n const resolved = resolveFrom(projectRoot, p.file, { skipNodePath: true });\n if (!resolved || !versionSatisfiesRequiredPackage(resolved, p)) {\n return true;\n }\n resolutions[p.pkg] = resolved;\n return false;\n });\n\n return { missing: missingPackages, resolutions };\n}\n\nexport function versionSatisfiesRequiredPackage(\n packageJsonFilePath: string,\n resolvedPackage: Pick<ResolvedPackage, 'version' | 'pkg'>\n): boolean {\n // If the version is specified, check that it satisfies the installed version.\n if (!resolvedPackage.version) {\n debug(`Required package \"${resolvedPackage.pkg}\" found (no version constraint specified).`);\n return true;\n }\n\n const pkgJson = JsonFile.read(packageJsonFilePath);\n if (\n // package.json has version.\n typeof pkgJson.version === 'string' &&\n // semver satisfaction.\n semver.satisfies(pkgJson.version, resolvedPackage.version)\n ) {\n return true;\n }\n debug(\n `Installed package \"${resolvedPackage.pkg}\" does not satisfy version constraint \"${resolvedPackage.version}\" (version: \"${pkgJson.version}\")`\n );\n return false;\n}\n\n/**\n * Collect missing packages given a list of required packages.\n * Any missing packages will be versioned to the known versions for the current SDK.\n *\n * @param projectRoot\n * @param props.requiredPackages list of required packages to check for\n * @returns list of missing packages and resolutions to existing packages.\n */\nexport async function getMissingPackagesAsync(\n projectRoot: string,\n {\n sdkVersion,\n requiredPackages,\n }: {\n sdkVersion?: string;\n requiredPackages: ResolvedPackage[];\n }\n): Promise<{\n missing: ResolvedPackage[];\n resolutions: Record<string, string>;\n}> {\n const results = collectMissingPackages(projectRoot, requiredPackages);\n if (!results.missing.length) {\n return results;\n }\n\n // Ensure the versions are right for the SDK that the project is currently using.\n await mutatePackagesWithKnownVersionsAsync(projectRoot, sdkVersion, results.missing);\n\n return results;\n}\n\nexport async function mutatePackagesWithKnownVersionsAsync(\n projectRoot: string,\n sdkVersion: string | undefined,\n packages: ResolvedPackage[]\n) {\n // Ensure the versions are right for the SDK that the project is currently using.\n const relatedPackages = await getCombinedKnownVersionsAsync({ projectRoot, sdkVersion });\n for (const pkg of packages) {\n if (\n // Only use the SDK versions if the package does not already have a hardcoded version.\n // We do this because some packages have API coded into the CLI which expects an exact version.\n !pkg.version &&\n pkg.pkg in relatedPackages\n ) {\n pkg.version = relatedPackages[pkg.pkg];\n }\n }\n return packages;\n}\n"],"names":["collectMissingPackages","getMissingPackagesAsync","mutatePackagesWithKnownVersionsAsync","versionSatisfiesRequiredPackage","debug","require","projectRoot","requiredPackages","resolutions","missingPackages","filter","p","resolved","resolveFrom","file","skipNodePath","pkg","missing","packageJsonFilePath","resolvedPackage","version","pkgJson","JsonFile","read","semver","satisfies","sdkVersion","results","length","packages","relatedPackages","getCombinedKnownVersionsAsync"],"mappings":";;;;;;;;;;;QAoBgBA;eAAAA;;QAsDMC;eAAAA;;QAwBAC;eAAAA;;QAzDNC;eAAAA;;;;gEAzCK;;;;;;;yBACO;;;;;;;gEACT;;;;;;sCAE2B;;;;;;AAE9C,MAAMC,QAAQC,QAAQ,SAAS;AAcxB,SAASL,uBACdM,WAAmB,EACnBC,gBAAmC;IAKnC,MAAMC,cAAsC,CAAC;IAE7C,MAAMC,kBAAkBF,iBAAiBG,MAAM,CAAC,CAACC;QAC/C,MAAMC,WAAWC,IAAAA,2BAAW,EAACP,aAAaK,EAAEG,IAAI,EAAE;YAAEC,cAAc;QAAK;QACvE,IAAI,CAACH,YAAY,CAACT,gCAAgCS,UAAUD,IAAI;YAC9D,OAAO;QACT;QACAH,WAAW,CAACG,EAAEK,GAAG,CAAC,GAAGJ;QACrB,OAAO;IACT;IAEA,OAAO;QAAEK,SAASR;QAAiBD;IAAY;AACjD;AAEO,SAASL,gCACde,mBAA2B,EAC3BC,eAAyD;IAEzD,8EAA8E;IAC9E,IAAI,CAACA,gBAAgBC,OAAO,EAAE;QAC5BhB,MAAM,CAAC,kBAAkB,EAAEe,gBAAgBH,GAAG,CAAC,0CAA0C,CAAC;QAC1F,OAAO;IACT;IAEA,MAAMK,UAAUC,mBAAQ,CAACC,IAAI,CAACL;IAC9B,IACE,4BAA4B;IAC5B,OAAOG,QAAQD,OAAO,KAAK,YAC3B,uBAAuB;IACvBI,iBAAM,CAACC,SAAS,CAACJ,QAAQD,OAAO,EAAED,gBAAgBC,OAAO,GACzD;QACA,OAAO;IACT;IACAhB,MACE,CAAC,mBAAmB,EAAEe,gBAAgBH,GAAG,CAAC,uCAAuC,EAAEG,gBAAgBC,OAAO,CAAC,aAAa,EAAEC,QAAQD,OAAO,CAAC,EAAE,CAAC;IAE/I,OAAO;AACT;AAUO,eAAenB,wBACpBK,WAAmB,EACnB,EACEoB,UAAU,EACVnB,gBAAgB,EAIjB;IAKD,MAAMoB,UAAU3B,uBAAuBM,aAAaC;IACpD,IAAI,CAACoB,QAAQV,OAAO,CAACW,MAAM,EAAE;QAC3B,OAAOD;IACT;IAEA,iFAAiF;IACjF,MAAMzB,qCAAqCI,aAAaoB,YAAYC,QAAQV,OAAO;IAEnF,OAAOU;AACT;AAEO,eAAezB,qCACpBI,WAAmB,EACnBoB,UAA8B,EAC9BG,QAA2B;IAE3B,iFAAiF;IACjF,MAAMC,kBAAkB,MAAMC,IAAAA,mDAA6B,EAAC;QAAEzB;QAAaoB;IAAW;IACtF,KAAK,MAAMV,OAAOa,SAAU;QAC1B,IACE,sFAAsF;QACtF,+FAA+F;QAC/F,CAACb,IAAII,OAAO,IACZJ,IAAIA,GAAG,IAAIc,iBACX;YACAd,IAAII,OAAO,GAAGU,eAAe,CAACd,IAAIA,GAAG,CAAC;QACxC;IACF;IACA,OAAOa;AACT"}
|
|
@@ -237,7 +237,12 @@ async function getAttachedDevicesAsync() {
|
|
|
237
237
|
// unauthorized: ['FA8251A00719', 'unauthorized', 'usb:338690048X', 'transport_id:5']
|
|
238
238
|
// authorized: ['FA8251A00719', 'device', 'usb:336592896X', 'product:walleye', 'model:Pixel_2', 'device:walleye', 'transport_id:4']
|
|
239
239
|
// emulator: ['emulator-5554', 'offline', 'transport_id:1']
|
|
240
|
-
|
|
240
|
+
// Match the device state before splitting metadata to preserve spaces in mDNS serials.
|
|
241
|
+
const match = line.trim().match(/^(.+?)\s+((?:offline|bootloader|device|host|recovery|rescue|sideload|unauthorized|authorizing|connecting|detached|any|no permissions)(?:\s+.*)?)$/) ?? line.trim().match(/^(\S+)\s+(.+)$/);
|
|
242
|
+
const props = match ? [
|
|
243
|
+
match[1],
|
|
244
|
+
...match[2].split(/\s+/)
|
|
245
|
+
] : [];
|
|
241
246
|
const type = line.includes('emulator') ? 'emulator' : 'device';
|
|
242
247
|
let connectionType;
|
|
243
248
|
if (type === 'device' && line.includes('usb:')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/android/adb.ts"],"sourcesContent":["import chalk from 'chalk';\nimport os from 'os';\n\nimport { ADBServer } from './ADBServer';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { learnMore } from '../../../utils/link';\n\nconst debug = require('debug')('expo:start:platforms:android:adb') as typeof console.log;\n\nexport enum DeviceABI {\n // The arch specific android target platforms are soft-deprecated.\n // Instead of using TargetPlatform as a combination arch + platform\n // the code will be updated to carry arch information in [DarwinArch]\n // and [AndroidArch].\n arm = 'arm',\n arm64 = 'arm64',\n x64 = 'x64',\n x86 = 'x86',\n x8664 = 'x86_64',\n arm64v8a = 'arm64-v8a',\n armeabiV7a = 'armeabi-v7a',\n armeabi = 'armeabi',\n universal = 'universal',\n}\n\n/** Represents a connected Android device. */\nexport type Device = {\n /** Process ID. */\n pid?: string;\n /** Name of the device, also used as the ID for opening devices. */\n name: string;\n /** Is emulator or connected device. */\n type: 'emulator' | 'device';\n /** Is the device booted (emulator). */\n isBooted: boolean;\n /** Is device authorized for developing. https://expo.fyi/authorize-android-device */\n isAuthorized: boolean;\n /** The connection type to ADB, only available when `type: device` */\n connectionType?: 'USB' | 'Network';\n};\n\ntype DeviceContext = Pick<Device, 'pid'>;\n\ntype DeviceProperties = Record<string, string>;\n\nconst CANT_START_ACTIVITY_ERROR = 'Activity not started, unable to resolve Intent';\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_CPU_NAME = 'ro.product.cpu.abi';\n\nconst PROP_CPU_ABI_LIST_NAME = 'ro.product.cpu.abilist';\n\n// Can sometimes be null\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_BOOT_ANIMATION_STATE = 'init.svc.bootanim';\n\nlet _server: ADBServer | null;\n\n/** Return the lazily loaded ADB server instance. */\nexport function getServer() {\n _server ??= new ADBServer();\n return _server;\n}\n\n/** Logs an FYI message about authorizing your device. */\nexport function logUnauthorized(device: Device) {\n Log.warn(\n `\\nThis computer is not authorized for developing on ${chalk.bold(device.name)}. ${chalk.dim(\n learnMore('https://expo.fyi/authorize-android-device')\n )}`\n );\n}\n\n/** Returns true if the provided package name is installed on the provided Android device. */\nexport async function isPackageInstalledAsync(\n device: DeviceContext,\n androidPackage: string\n): Promise<boolean> {\n const packages = await getServer().runAsync(\n adbShellArgs(device.pid, 'pm', 'list', 'packages', '--user', env.EXPO_ADB_USER, androidPackage)\n );\n\n const lines = packages.split(/\\r?\\n/);\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!.trim();\n if (line === `package:${androidPackage}`) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.launchActivity Activity to launch `[application identifier]/.[main activity name]`, ex: `com.bacon.app/.MainActivity`\n * @param props.url Optional (dev client) URL to launch\n */\nexport async function launchActivityAsync(\n device: DeviceContext,\n {\n launchActivity,\n url,\n }: {\n launchActivity: string;\n url?: string;\n }\n) {\n const command: string[] = [\n 'am',\n 'start',\n // FLAG_ACTIVITY_SINGLE_TOP -- If set, the activity will not be launched if it is already running at the top of the history stack.\n '-f',\n '0x20000000',\n // Activity to open first: com.bacon.app/.MainActivity\n '-n',\n launchActivity,\n ];\n\n if (url) {\n command.push('-d', url);\n }\n\n return openAsync(adbShellArgs(device.pid, ...command));\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.url URL to launch.\n */\nexport async function openUrlAsync(\n device: DeviceContext,\n {\n url,\n }: {\n url: string;\n }\n) {\n return openAsync(\n adbShellArgs(device.pid, 'am', 'start', '-a', 'android.intent.action.VIEW', '-d', url)\n );\n}\n\n/** Runs a generic command watches for common errors in order to throw with an expected code. */\nasync function openAsync(args: string[]): Promise<string> {\n const results = await getServer().runAsync(args);\n if (\n results.includes(CANT_START_ACTIVITY_ERROR) ||\n results.match(/Error: Activity class .* does not exist\\./g)\n ) {\n throw new CommandError('APP_NOT_INSTALLED', results.substring(results.indexOf('Error: ')));\n }\n return results;\n}\n\n/** Uninstall an app given its Android package name. */\nexport async function uninstallAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(\n adbArgs(device.pid, 'uninstall', '--user', env.EXPO_ADB_USER, appId)\n );\n}\n\n/** Get package info from an app based on its Android package name. */\nexport async function getPackageInfoAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(adbShellArgs(device.pid, 'dumpsys', 'package', appId));\n}\n\n/** Install an app on a connected device. */\nexport async function installAsync(device: DeviceContext, { filePath }: { filePath: string }) {\n // TODO: Handle the `INSTALL_FAILED_INSUFFICIENT_STORAGE` error.\n return await getServer().runAsync(\n adbArgs(device.pid, 'install', '-r', '-d', '--user', env.EXPO_ADB_USER, filePath)\n );\n}\n\n/** Format ADB args with process ID. */\nexport function adbArgs(pid: Device['pid'], ...options: string[]): string[] {\n const args = [];\n if (pid) {\n args.push('-s', pid);\n }\n\n return args.concat(options);\n}\n\n/**\n * `adb shell` concatenates trailing args and runs the result through `sh -c` on\n * the device, so unquoted metacharacters in tainted tokens execute on-device.\n */\nexport function adbShellArgs(pid: Device['pid'], ...command: string[]): string[] {\n return adbArgs(pid, 'shell', ...command.map(shellQuote));\n}\n\nfunction shellQuote(value: string): string {\n return `'${value.replace(/'/g, `'\\\\''`)}'`;\n}\n\n// TODO: This is very expensive for some operations.\nexport async function getAttachedDevicesAsync(): Promise<Device[]> {\n const output = await getServer().runAsync(['devices', '-l']);\n\n const splitItems = output\n .trim()\n .replace(/\\n$/, '')\n .split(os.EOL)\n // Filter ADB trace logs from the output, e.g.\n // adb D 03-06 15:25:53 63677 4018815 adb_client.cpp:393] adb_query: host:devices-l\n // 03-04 12:29:44.557 16415 16415 D adb : commandline.cpp:1646 Using server socket: tcp:172.27.192.1:5037\n // 03-04 12:29:44.557 16415 16415 D adb : adb_client.cpp:160 _adb_connect: host:version\n .filter((line) => !line.match(/\\.cpp:[0-9]+/));\n\n // First line is `\"List of devices attached\"`, remove it\n // @ts-ignore: todo\n const attachedDevices: {\n props: string[];\n type: Device['type'];\n isAuthorized: Device['isAuthorized'];\n isBooted: Device['isBooted'];\n connectionType?: Device['connectionType'];\n }[] = splitItems\n .slice(1, splitItems.length)\n .map((line) => {\n // unauthorized: ['FA8251A00719', 'unauthorized', 'usb:338690048X', 'transport_id:5']\n // authorized: ['FA8251A00719', 'device', 'usb:336592896X', 'product:walleye', 'model:Pixel_2', 'device:walleye', 'transport_id:4']\n // emulator: ['emulator-5554', 'offline', 'transport_id:1']\n const props = line.split(' ').filter(Boolean);\n const type = line.includes('emulator') ? 'emulator' : 'device';\n\n let connectionType;\n if (type === 'device' && line.includes('usb:')) {\n connectionType = 'USB';\n } else if (type === 'device' && line.includes('_adb-tls-connect.')) {\n connectionType = 'Network';\n }\n\n const isBooted = type === 'emulator' || props[1] !== 'offline';\n const isAuthorized =\n connectionType === 'Network'\n ? line.includes('model:') // Network connected devices show `model:<name>` when authorized\n : props[1] !== 'unauthorized';\n\n return { props, type, isAuthorized, isBooted, connectionType };\n })\n .filter(({ props: [pid] }) => !!pid);\n\n const devicePromises = attachedDevices.map<Promise<Device>>(async (props) => {\n const {\n type,\n props: [pid, ...deviceInfo],\n isAuthorized,\n isBooted,\n } = props;\n\n let name: string | null = null;\n\n if (type === 'device') {\n if (isAuthorized) {\n // Possibly formatted like `model:Pixel_2`\n // Transform to `Pixel_2`\n const modelItem = deviceInfo.find((info) => info.includes('model:'));\n if (modelItem) {\n name = modelItem.replace('model:', '');\n }\n }\n // unauthorized devices don't have a name available to read\n if (!name) {\n // Device FA8251A00719\n name = `Device ${pid}`;\n }\n } else {\n // Given an emulator pid, get the emulator name which can be used to start the emulator later.\n name = (await getAdbNameForDeviceIdAsync({ pid })) ?? '';\n }\n\n return props.connectionType\n ? { pid, name, type, isAuthorized, isBooted, connectionType: props.connectionType }\n : { pid, name, type, isAuthorized, isBooted };\n });\n\n return Promise.all(devicePromises);\n}\n\n/**\n * Return the Emulator name for an emulator ID, this can be used to determine if an emulator is booted.\n *\n * @param device.pid a value like `emulator-5554` from `abd devices`\n */\nexport async function getAdbNameForDeviceIdAsync(device: DeviceContext): Promise<string | null> {\n const results = await getServer().runAsync(adbArgs(device.pid, 'emu', 'avd', 'name'));\n\n if (results.match(/could not connect to TCP port .*: Connection refused/)) {\n // Can also occur when the emulator does not exist.\n throw new CommandError('EMULATOR_NOT_FOUND', results);\n }\n\n return sanitizeAdbDeviceName(results) ?? null;\n}\n\nexport async function isDeviceBootedAsync({\n name,\n}: { name?: string } = {}): Promise<Device | null> {\n const devices = await getAttachedDevicesAsync();\n\n if (!name) {\n return devices[0] ?? null;\n }\n\n return devices.find((device) => device.name === name) ?? null;\n}\n\n/**\n * Returns true when a device's splash screen animation has stopped.\n * This can be used to detect when a device is fully booted and ready to use.\n *\n * @param pid\n */\nexport async function isBootAnimationCompleteAsync(pid?: string): Promise<boolean> {\n try {\n const props = await getPropertyDataForDeviceAsync({ pid }, PROP_BOOT_ANIMATION_STATE);\n return !!props[PROP_BOOT_ANIMATION_STATE]?.match(/stopped/);\n } catch {\n return false;\n }\n}\n\n/** Get a list of ABIs for the provided device. */\nexport async function getDeviceABIsAsync(\n device: Pick<Device, 'name' | 'pid'>\n): Promise<DeviceABI[]> {\n const cpuAbiList = (await getPropertyDataForDeviceAsync(device, PROP_CPU_ABI_LIST_NAME))[\n PROP_CPU_ABI_LIST_NAME\n ];\n\n if (cpuAbiList) {\n return cpuAbiList.trim().split(',') as DeviceABI[];\n }\n\n const abi = (await getPropertyDataForDeviceAsync(device, PROP_CPU_NAME))[\n PROP_CPU_NAME\n ] as DeviceABI;\n return [abi];\n}\n\nexport async function getPropertyDataForDeviceAsync(\n device: DeviceContext,\n prop?: string\n): Promise<DeviceProperties> {\n const propCommand = prop\n ? adbShellArgs(device.pid, 'getprop', prop)\n : adbShellArgs(device.pid, 'getprop');\n try {\n // Prevent reading as UTF8.\n const results = await getServer().getFileOutputAsync(propCommand);\n // Like:\n // [wifi.direct.interface]: [p2p-dev-wlan0]\n // [wifi.interface]: [wlan0]\n\n if (prop) {\n debug(`Property data: (device pid: ${device.pid}, prop: ${prop}, data: ${results})`);\n return {\n [prop]: results,\n };\n }\n const props = parseAdbDeviceProperties(results);\n\n debug(`Parsed data:`, props);\n\n return props;\n } catch (error: any) {\n // TODO: Ensure error has message and not stderr\n throw new CommandError(`Failed to get properties for device (${device.pid}): ${error.message}`);\n }\n}\n\nfunction parseAdbDeviceProperties(devicePropertiesString: string) {\n const properties: DeviceProperties = {};\n const propertyExp = /\\[(.*?)\\]: \\[(.*?)\\]/gm;\n for (const match of devicePropertiesString.matchAll(propertyExp)) {\n properties[match[1]!] = match[2]!;\n }\n return properties;\n}\n\n/**\n * Sanitize the ADB device name to only get the actual device name.\n * On Windows, we need to do \\r, \\n, and \\r\\n filtering to get the name.\n */\nexport function sanitizeAdbDeviceName(deviceName: string) {\n return deviceName\n .trim()\n .split(/[\\r\\n]+/)\n .shift();\n}\n"],"names":["DeviceABI","adbArgs","adbShellArgs","getAdbNameForDeviceIdAsync","getAttachedDevicesAsync","getDeviceABIsAsync","getPackageInfoAsync","getPropertyDataForDeviceAsync","getServer","installAsync","isBootAnimationCompleteAsync","isDeviceBootedAsync","isPackageInstalledAsync","launchActivityAsync","logUnauthorized","openUrlAsync","sanitizeAdbDeviceName","uninstallAsync","debug","require","CANT_START_ACTIVITY_ERROR","PROP_CPU_NAME","PROP_CPU_ABI_LIST_NAME","PROP_BOOT_ANIMATION_STATE","_server","ADBServer","device","Log","warn","chalk","bold","name","dim","learnMore","androidPackage","packages","runAsync","pid","env","EXPO_ADB_USER","lines","split","i","length","line","trim","launchActivity","url","command","push","openAsync","args","results","includes","match","CommandError","substring","indexOf","appId","filePath","options","concat","map","shellQuote","value","replace","output","splitItems","os","EOL","filter","attachedDevices","slice","props","Boolean","type","connectionType","isBooted","isAuthorized","devicePromises","deviceInfo","modelItem","find","info","Promise","all","devices","cpuAbiList","abi","prop","propCommand","getFileOutputAsync","parseAdbDeviceProperties","error","message","devicePropertiesString","properties","propertyExp","matchAll","deviceName","shift"],"mappings":";;;;;;;;;;;QAWYA;eAAAA;;QA2KIC;eAAAA;;QAaAC;eAAAA;;QAkGMC;eAAAA;;QAzFAC;eAAAA;;QAgIAC;eAAAA;;QAtKAC;eAAAA;;QAuLAC;eAAAA;;QAjSNC;eAAAA;;QAkHMC;eAAAA;;QAoJAC;eAAAA;;QAlBAC;eAAAA;;QArOAC;eAAAA;;QAuBAC;eAAAA;;QAhCNC;eAAAA;;QAgEMC;eAAAA;;QAuQNC;eAAAA;;QA7OMC;eAAAA;;;;gEA5JJ;;;;;;;gEACH;;;;;;2BAEW;6DACL;qBACD;wBACS;sBACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,MAAMC,QAAQC,QAAQ,SAAS;AAExB,IAAA,AAAKnB,mCAAAA;IACV,kEAAkE;IAClE,mEAAmE;IACnE,qEAAqE;IACrE,qBAAqB;;;;;;;;;;WAJXA;;AAoCZ,MAAMoB,4BAA4B;AAClC,oDAAoD;AACpD,MAAMC,gBAAgB;AAEtB,MAAMC,yBAAyB;AAE/B,wBAAwB;AACxB,oDAAoD;AACpD,MAAMC,4BAA4B;AAElC,IAAIC;AAGG,SAAShB;IACdgB,YAAY,IAAIC,oBAAS;IACzB,OAAOD;AACT;AAGO,SAASV,gBAAgBY,MAAc;IAC5CC,KAAIC,IAAI,CACN,CAAC,oDAAoD,EAAEC,gBAAK,CAACC,IAAI,CAACJ,OAAOK,IA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M+C,MAAM,AAAC,CAAA,MAAMjF,8BAA8BmB,QAAQL,cAAa,CAAE,CACtEA,cACD;IACD,OAAO;QAACmE;KAAI;AACd;AAEO,eAAejF,8BACpBmB,MAAqB,EACrB+D,IAAa;IAEb,MAAMC,cAAcD,OAChBvF,aAAawB,OAAOW,GAAG,EAAE,WAAWoD,QACpCvF,aAAawB,OAAOW,GAAG,EAAE;IAC7B,IAAI;QACF,2BAA2B;QAC3B,MAAMe,UAAU,MAAM5C,YAAYmF,kBAAkB,CAACD;QACrD,QAAQ;QACR,2CAA2C;QAC3C,4BAA4B;QAE5B,IAAID,MAAM;YACRvE,MAAM,CAAC,4BAA4B,EAAEQ,OAAOW,GAAG,CAAC,QAAQ,EAAEoD,KAAK,QAAQ,EAAErC,QAAQ,CAAC,CAAC;YACnF,OAAO;gBACL,CAACqC,KAAK,EAAErC;YACV;QACF;QACA,MAAMqB,QAAQmB,yBAAyBxC;QAEvClC,MAAM,CAAC,YAAY,CAAC,EAAEuD;QAEtB,OAAOA;IACT,EAAE,OAAOoB,OAAY;QACnB,gDAAgD;QAChD,MAAM,IAAItC,oBAAY,CAAC,CAAC,qCAAqC,EAAE7B,OAAOW,GAAG,CAAC,GAAG,EAAEwD,MAAMC,OAAO,EAAE;IAChG;AACF;AAEA,SAASF,yBAAyBG,sBAA8B;IAC9D,MAAMC,aAA+B,CAAC;IACtC,MAAMC,cAAc;IACpB,KAAK,MAAM3C,SAASyC,uBAAuBG,QAAQ,CAACD,aAAc;QAChED,UAAU,CAAC1C,KAAK,CAAC,EAAE,CAAE,GAAGA,KAAK,CAAC,EAAE;IAClC;IACA,OAAO0C;AACT;AAMO,SAAShF,sBAAsBmF,UAAkB;IACtD,OAAOA,WACJtD,IAAI,GACJJ,KAAK,CAAC,WACN2D,KAAK;AACV"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/android/adb.ts"],"sourcesContent":["import chalk from 'chalk';\nimport os from 'os';\n\nimport { ADBServer } from './ADBServer';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { learnMore } from '../../../utils/link';\n\nconst debug = require('debug')('expo:start:platforms:android:adb') as typeof console.log;\n\nexport enum DeviceABI {\n // The arch specific android target platforms are soft-deprecated.\n // Instead of using TargetPlatform as a combination arch + platform\n // the code will be updated to carry arch information in [DarwinArch]\n // and [AndroidArch].\n arm = 'arm',\n arm64 = 'arm64',\n x64 = 'x64',\n x86 = 'x86',\n x8664 = 'x86_64',\n arm64v8a = 'arm64-v8a',\n armeabiV7a = 'armeabi-v7a',\n armeabi = 'armeabi',\n universal = 'universal',\n}\n\n/** Represents a connected Android device. */\nexport type Device = {\n /** Process ID. */\n pid?: string;\n /** Name of the device, also used as the ID for opening devices. */\n name: string;\n /** Is emulator or connected device. */\n type: 'emulator' | 'device';\n /** Is the device booted (emulator). */\n isBooted: boolean;\n /** Is device authorized for developing. https://expo.fyi/authorize-android-device */\n isAuthorized: boolean;\n /** The connection type to ADB, only available when `type: device` */\n connectionType?: 'USB' | 'Network';\n};\n\ntype DeviceContext = Pick<Device, 'pid'>;\n\ntype DeviceProperties = Record<string, string>;\n\nconst CANT_START_ACTIVITY_ERROR = 'Activity not started, unable to resolve Intent';\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_CPU_NAME = 'ro.product.cpu.abi';\n\nconst PROP_CPU_ABI_LIST_NAME = 'ro.product.cpu.abilist';\n\n// Can sometimes be null\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_BOOT_ANIMATION_STATE = 'init.svc.bootanim';\n\nlet _server: ADBServer | null;\n\n/** Return the lazily loaded ADB server instance. */\nexport function getServer() {\n _server ??= new ADBServer();\n return _server;\n}\n\n/** Logs an FYI message about authorizing your device. */\nexport function logUnauthorized(device: Device) {\n Log.warn(\n `\\nThis computer is not authorized for developing on ${chalk.bold(device.name)}. ${chalk.dim(\n learnMore('https://expo.fyi/authorize-android-device')\n )}`\n );\n}\n\n/** Returns true if the provided package name is installed on the provided Android device. */\nexport async function isPackageInstalledAsync(\n device: DeviceContext,\n androidPackage: string\n): Promise<boolean> {\n const packages = await getServer().runAsync(\n adbShellArgs(device.pid, 'pm', 'list', 'packages', '--user', env.EXPO_ADB_USER, androidPackage)\n );\n\n const lines = packages.split(/\\r?\\n/);\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i]!.trim();\n if (line === `package:${androidPackage}`) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.launchActivity Activity to launch `[application identifier]/.[main activity name]`, ex: `com.bacon.app/.MainActivity`\n * @param props.url Optional (dev client) URL to launch\n */\nexport async function launchActivityAsync(\n device: DeviceContext,\n {\n launchActivity,\n url,\n }: {\n launchActivity: string;\n url?: string;\n }\n) {\n const command: string[] = [\n 'am',\n 'start',\n // FLAG_ACTIVITY_SINGLE_TOP -- If set, the activity will not be launched if it is already running at the top of the history stack.\n '-f',\n '0x20000000',\n // Activity to open first: com.bacon.app/.MainActivity\n '-n',\n launchActivity,\n ];\n\n if (url) {\n command.push('-d', url);\n }\n\n return openAsync(adbShellArgs(device.pid, ...command));\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.url URL to launch.\n */\nexport async function openUrlAsync(\n device: DeviceContext,\n {\n url,\n }: {\n url: string;\n }\n) {\n return openAsync(\n adbShellArgs(device.pid, 'am', 'start', '-a', 'android.intent.action.VIEW', '-d', url)\n );\n}\n\n/** Runs a generic command watches for common errors in order to throw with an expected code. */\nasync function openAsync(args: string[]): Promise<string> {\n const results = await getServer().runAsync(args);\n if (\n results.includes(CANT_START_ACTIVITY_ERROR) ||\n results.match(/Error: Activity class .* does not exist\\./g)\n ) {\n throw new CommandError('APP_NOT_INSTALLED', results.substring(results.indexOf('Error: ')));\n }\n return results;\n}\n\n/** Uninstall an app given its Android package name. */\nexport async function uninstallAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(\n adbArgs(device.pid, 'uninstall', '--user', env.EXPO_ADB_USER, appId)\n );\n}\n\n/** Get package info from an app based on its Android package name. */\nexport async function getPackageInfoAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(adbShellArgs(device.pid, 'dumpsys', 'package', appId));\n}\n\n/** Install an app on a connected device. */\nexport async function installAsync(device: DeviceContext, { filePath }: { filePath: string }) {\n // TODO: Handle the `INSTALL_FAILED_INSUFFICIENT_STORAGE` error.\n return await getServer().runAsync(\n adbArgs(device.pid, 'install', '-r', '-d', '--user', env.EXPO_ADB_USER, filePath)\n );\n}\n\n/** Format ADB args with process ID. */\nexport function adbArgs(pid: Device['pid'], ...options: string[]): string[] {\n const args = [];\n if (pid) {\n args.push('-s', pid);\n }\n\n return args.concat(options);\n}\n\n/**\n * `adb shell` concatenates trailing args and runs the result through `sh -c` on\n * the device, so unquoted metacharacters in tainted tokens execute on-device.\n */\nexport function adbShellArgs(pid: Device['pid'], ...command: string[]): string[] {\n return adbArgs(pid, 'shell', ...command.map(shellQuote));\n}\n\nfunction shellQuote(value: string): string {\n return `'${value.replace(/'/g, `'\\\\''`)}'`;\n}\n\n// TODO: This is very expensive for some operations.\nexport async function getAttachedDevicesAsync(): Promise<Device[]> {\n const output = await getServer().runAsync(['devices', '-l']);\n\n const splitItems = output\n .trim()\n .replace(/\\n$/, '')\n .split(os.EOL)\n // Filter ADB trace logs from the output, e.g.\n // adb D 03-06 15:25:53 63677 4018815 adb_client.cpp:393] adb_query: host:devices-l\n // 03-04 12:29:44.557 16415 16415 D adb : commandline.cpp:1646 Using server socket: tcp:172.27.192.1:5037\n // 03-04 12:29:44.557 16415 16415 D adb : adb_client.cpp:160 _adb_connect: host:version\n .filter((line) => !line.match(/\\.cpp:[0-9]+/));\n\n // First line is `\"List of devices attached\"`, remove it\n // @ts-ignore: todo\n const attachedDevices: {\n props: string[];\n type: Device['type'];\n isAuthorized: Device['isAuthorized'];\n isBooted: Device['isBooted'];\n connectionType?: Device['connectionType'];\n }[] = splitItems\n .slice(1, splitItems.length)\n .map((line) => {\n // unauthorized: ['FA8251A00719', 'unauthorized', 'usb:338690048X', 'transport_id:5']\n // authorized: ['FA8251A00719', 'device', 'usb:336592896X', 'product:walleye', 'model:Pixel_2', 'device:walleye', 'transport_id:4']\n // emulator: ['emulator-5554', 'offline', 'transport_id:1']\n // Match the device state before splitting metadata to preserve spaces in mDNS serials.\n const match =\n line\n .trim()\n .match(\n /^(.+?)\\s+((?:offline|bootloader|device|host|recovery|rescue|sideload|unauthorized|authorizing|connecting|detached|any|no permissions)(?:\\s+.*)?)$/\n ) ?? line.trim().match(/^(\\S+)\\s+(.+)$/);\n const props = match ? [match[1]!, ...match[2]!.split(/\\s+/)] : [];\n const type = line.includes('emulator') ? 'emulator' : 'device';\n\n let connectionType;\n if (type === 'device' && line.includes('usb:')) {\n connectionType = 'USB';\n } else if (type === 'device' && line.includes('_adb-tls-connect.')) {\n connectionType = 'Network';\n }\n\n const isBooted = type === 'emulator' || props[1] !== 'offline';\n const isAuthorized =\n connectionType === 'Network'\n ? line.includes('model:') // Network connected devices show `model:<name>` when authorized\n : props[1] !== 'unauthorized';\n\n return { props, type, isAuthorized, isBooted, connectionType };\n })\n .filter(({ props: [pid] }) => !!pid);\n\n const devicePromises = attachedDevices.map<Promise<Device>>(async (props) => {\n const {\n type,\n props: [pid, ...deviceInfo],\n isAuthorized,\n isBooted,\n } = props;\n\n let name: string | null = null;\n\n if (type === 'device') {\n if (isAuthorized) {\n // Possibly formatted like `model:Pixel_2`\n // Transform to `Pixel_2`\n const modelItem = deviceInfo.find((info) => info.includes('model:'));\n if (modelItem) {\n name = modelItem.replace('model:', '');\n }\n }\n // unauthorized devices don't have a name available to read\n if (!name) {\n // Device FA8251A00719\n name = `Device ${pid}`;\n }\n } else {\n // Given an emulator pid, get the emulator name which can be used to start the emulator later.\n name = (await getAdbNameForDeviceIdAsync({ pid })) ?? '';\n }\n\n return props.connectionType\n ? { pid, name, type, isAuthorized, isBooted, connectionType: props.connectionType }\n : { pid, name, type, isAuthorized, isBooted };\n });\n\n return Promise.all(devicePromises);\n}\n\n/**\n * Return the Emulator name for an emulator ID, this can be used to determine if an emulator is booted.\n *\n * @param device.pid a value like `emulator-5554` from `abd devices`\n */\nexport async function getAdbNameForDeviceIdAsync(device: DeviceContext): Promise<string | null> {\n const results = await getServer().runAsync(adbArgs(device.pid, 'emu', 'avd', 'name'));\n\n if (results.match(/could not connect to TCP port .*: Connection refused/)) {\n // Can also occur when the emulator does not exist.\n throw new CommandError('EMULATOR_NOT_FOUND', results);\n }\n\n return sanitizeAdbDeviceName(results) ?? null;\n}\n\nexport async function isDeviceBootedAsync({\n name,\n}: { name?: string } = {}): Promise<Device | null> {\n const devices = await getAttachedDevicesAsync();\n\n if (!name) {\n return devices[0] ?? null;\n }\n\n return devices.find((device) => device.name === name) ?? null;\n}\n\n/**\n * Returns true when a device's splash screen animation has stopped.\n * This can be used to detect when a device is fully booted and ready to use.\n *\n * @param pid\n */\nexport async function isBootAnimationCompleteAsync(pid?: string): Promise<boolean> {\n try {\n const props = await getPropertyDataForDeviceAsync({ pid }, PROP_BOOT_ANIMATION_STATE);\n return !!props[PROP_BOOT_ANIMATION_STATE]?.match(/stopped/);\n } catch {\n return false;\n }\n}\n\n/** Get a list of ABIs for the provided device. */\nexport async function getDeviceABIsAsync(\n device: Pick<Device, 'name' | 'pid'>\n): Promise<DeviceABI[]> {\n const cpuAbiList = (await getPropertyDataForDeviceAsync(device, PROP_CPU_ABI_LIST_NAME))[\n PROP_CPU_ABI_LIST_NAME\n ];\n\n if (cpuAbiList) {\n return cpuAbiList.trim().split(',') as DeviceABI[];\n }\n\n const abi = (await getPropertyDataForDeviceAsync(device, PROP_CPU_NAME))[\n PROP_CPU_NAME\n ] as DeviceABI;\n return [abi];\n}\n\nexport async function getPropertyDataForDeviceAsync(\n device: DeviceContext,\n prop?: string\n): Promise<DeviceProperties> {\n const propCommand = prop\n ? adbShellArgs(device.pid, 'getprop', prop)\n : adbShellArgs(device.pid, 'getprop');\n try {\n // Prevent reading as UTF8.\n const results = await getServer().getFileOutputAsync(propCommand);\n // Like:\n // [wifi.direct.interface]: [p2p-dev-wlan0]\n // [wifi.interface]: [wlan0]\n\n if (prop) {\n debug(`Property data: (device pid: ${device.pid}, prop: ${prop}, data: ${results})`);\n return {\n [prop]: results,\n };\n }\n const props = parseAdbDeviceProperties(results);\n\n debug(`Parsed data:`, props);\n\n return props;\n } catch (error: any) {\n // TODO: Ensure error has message and not stderr\n throw new CommandError(`Failed to get properties for device (${device.pid}): ${error.message}`);\n }\n}\n\nfunction parseAdbDeviceProperties(devicePropertiesString: string) {\n const properties: DeviceProperties = {};\n const propertyExp = /\\[(.*?)\\]: \\[(.*?)\\]/gm;\n for (const match of devicePropertiesString.matchAll(propertyExp)) {\n properties[match[1]!] = match[2]!;\n }\n return properties;\n}\n\n/**\n * Sanitize the ADB device name to only get the actual device name.\n * On Windows, we need to do \\r, \\n, and \\r\\n filtering to get the name.\n */\nexport function sanitizeAdbDeviceName(deviceName: string) {\n return deviceName\n .trim()\n .split(/[\\r\\n]+/)\n .shift();\n}\n"],"names":["DeviceABI","adbArgs","adbShellArgs","getAdbNameForDeviceIdAsync","getAttachedDevicesAsync","getDeviceABIsAsync","getPackageInfoAsync","getPropertyDataForDeviceAsync","getServer","installAsync","isBootAnimationCompleteAsync","isDeviceBootedAsync","isPackageInstalledAsync","launchActivityAsync","logUnauthorized","openUrlAsync","sanitizeAdbDeviceName","uninstallAsync","debug","require","CANT_START_ACTIVITY_ERROR","PROP_CPU_NAME","PROP_CPU_ABI_LIST_NAME","PROP_BOOT_ANIMATION_STATE","_server","ADBServer","device","Log","warn","chalk","bold","name","dim","learnMore","androidPackage","packages","runAsync","pid","env","EXPO_ADB_USER","lines","split","i","length","line","trim","launchActivity","url","command","push","openAsync","args","results","includes","match","CommandError","substring","indexOf","appId","filePath","options","concat","map","shellQuote","value","replace","output","splitItems","os","EOL","filter","attachedDevices","slice","props","type","connectionType","isBooted","isAuthorized","devicePromises","deviceInfo","modelItem","find","info","Promise","all","devices","cpuAbiList","abi","prop","propCommand","getFileOutputAsync","parseAdbDeviceProperties","error","message","devicePropertiesString","properties","propertyExp","matchAll","deviceName","shift"],"mappings":";;;;;;;;;;;QAWYA;eAAAA;;QA2KIC;eAAAA;;QAaAC;eAAAA;;QAyGMC;eAAAA;;QAhGAC;eAAAA;;QAuIAC;eAAAA;;QA7KAC;eAAAA;;QA8LAC;eAAAA;;QAxSNC;eAAAA;;QAkHMC;eAAAA;;QA2JAC;eAAAA;;QAlBAC;eAAAA;;QA5OAC;eAAAA;;QAuBAC;eAAAA;;QAhCNC;eAAAA;;QAgEMC;eAAAA;;QA8QNC;eAAAA;;QApPMC;eAAAA;;;;gEA5JJ;;;;;;;gEACH;;;;;;2BAEW;6DACL;qBACD;wBACS;sBACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,MAAMC,QAAQC,QAAQ,SAAS;AAExB,IAAA,AAAKnB,mCAAAA;IACV,kEAAkE;IAClE,mEAAmE;IACnE,qEAAqE;IACrE,qBAAqB;;;;;;;;;;WAJXA;;AAoCZ,MAAMoB,4BAA4B;AAClC,oDAAoD;AACpD,MAAMC,gBAAgB;AAEtB,MAAMC,yBAAyB;AAE/B,wBAAwB;AACxB,oDAAoD;AACpD,MAAMC,4BAA4B;AAElC,IAAIC;AAGG,SAAShB;IACdgB,YAAY,IAAIC,oBAAS;IACzB,OAAOD;AACT;AAGO,SAASV,gBAAgBY,MAAc;IAC5CC,KAAIC,IAAI,CACN,CAAC,oDAAoD,EAAEC,gBAAK,CAACC,IAAI,CAACJ,OAAOK,IAAI,EAAE,EAAE,EAAEF,gBAAK,CAACG,GAAG,CAC1FC,IAAAA,eAAS,EAAC,+CACT;AAEP;AAGO,eAAerB,wBACpBc,MAAqB,EACrBQ,cAAsB;IAEtB,MAAMC,WAAW,MAAM3B,YAAY4B,QAAQ,CACzClC,aAA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MhF,8BAA8BmB,QAAQL,cAAa,CAAE,CACtEA,cACD;IACD,OAAO;QAACkE;KAAI;AACd;AAEO,eAAehF,8BACpBmB,MAAqB,EACrB8D,IAAa;IAEb,MAAMC,cAAcD,OAChBtF,aAAawB,OAAOW,GAAG,EAAE,WAAWmD,QACpCtF,aAAawB,OAAOW,GAAG,EAAE;IAC7B,IAAI;QACF,2BAA2B;QAC3B,MAAMe,UAAU,MAAM5C,YAAYkF,kBAAkB,CAACD;QACrD,QAAQ;QACR,2CAA2C;QAC3C,4BAA4B;QAE5B,IAAID,MAAM;YACRtE,MAAM,CAAC,4BAA4B,EAAEQ,OAAOW,GAAG,CAAC,QAAQ,EAAEmD,KAAK,QAAQ,EAAEpC,QAAQ,CAAC,CAAC;YACnF,OAAO;gBACL,CAACoC,KAAK,EAAEpC;YACV;QACF;QACA,MAAMqB,QAAQkB,yBAAyBvC;QAEvClC,MAAM,CAAC,YAAY,CAAC,EAAEuD;QAEtB,OAAOA;IACT,EAAE,OAAOmB,OAAY;QACnB,gDAAgD;QAChD,MAAM,IAAIrC,oBAAY,CAAC,CAAC,qCAAqC,EAAE7B,OAAOW,GAAG,CAAC,GAAG,EAAEuD,MAAMC,OAAO,EAAE;IAChG;AACF;AAEA,SAASF,yBAAyBG,sBAA8B;IAC9D,MAAMC,aAA+B,CAAC;IACtC,MAAMC,cAAc;IACpB,KAAK,MAAM1C,SAASwC,uBAAuBG,QAAQ,CAACD,aAAc;QAChED,UAAU,CAACzC,KAAK,CAAC,EAAE,CAAE,GAAGA,KAAK,CAAC,EAAE;IAClC;IACA,OAAOyC;AACT;AAMO,SAAS/E,sBAAsBkF,UAAkB;IACtD,OAAOA,WACJrD,IAAI,GACJJ,KAAK,CAAC,WACN0D,KAAK;AACV"}
|
|
@@ -25,9 +25,9 @@ function _resolvefrom() {
|
|
|
25
25
|
const _AsyncNgrok = require("./AsyncNgrok");
|
|
26
26
|
const _AsyncWsTunnel = require("./AsyncWsTunnel");
|
|
27
27
|
const _Bonjour = require("./Bonjour");
|
|
28
|
-
const _DevToolsPluginManager = /*#__PURE__*/ _interop_require_default(require("./devtools/DevToolsPluginManager"));
|
|
29
28
|
const _DevelopmentSession = require("./DevelopmentSession");
|
|
30
29
|
const _UrlCreator = require("./UrlCreator");
|
|
30
|
+
const _DevToolsPluginManager = /*#__PURE__*/ _interop_require_default(require("./devtools/DevToolsPluginManager"));
|
|
31
31
|
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../log"));
|
|
32
32
|
const _FileNotifier = require("../../utils/FileNotifier");
|
|
33
33
|
const _delay = require("../../utils/delay");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/server/BundlerDevServer.ts"],"sourcesContent":["import assert from 'assert';\nimport resolveFrom from 'resolve-from';\n\nimport { AsyncNgrok } from './AsyncNgrok';\nimport { AsyncWsTunnel } from './AsyncWsTunnel';\nimport { Bonjour } from './Bonjour';\nimport DevToolsPluginManager from './devtools/DevToolsPluginManager';\nimport { DevelopmentSession } from './DevelopmentSession';\nimport type { CreateURLOptions } from './UrlCreator';\nimport { UrlCreator } from './UrlCreator';\nimport type { PlatformBundlers } from './platformBundlers';\nimport * as Log from '../../log';\nimport { FileNotifier } from '../../utils/FileNotifier';\nimport { resolveWithTimeout } from '../../utils/delay';\nimport { env, envIsWebcontainer } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { isInteractive } from '../../utils/interactive';\nimport { openBrowserAsync } from '../../utils/open';\nimport type { BaseResolveDeviceProps, PlatformManager } from '../platforms/PlatformManager';\n\nconst debug = require('debug')('expo:start:server:devServer') as typeof console.log;\n\nexport type MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\nexport type ServerLike = {\n close(callback?: (err?: Error) => void): void;\n addListener?(event: string, listener: (...args: any[]) => void): unknown;\n};\n\nexport type DevServerInstance = {\n /** Bundler dev server instance. */\n server: ServerLike;\n /** Dev server URL location properties. */\n location: {\n url: string;\n port: number;\n protocol: 'http' | 'https';\n host?: string;\n };\n /** Additional middleware that's attached to the `server`. */\n middleware: any;\n /** Message socket for communicating with the runtime. */\n messageSocket: MessageSocket;\n};\n\nexport interface BundlerStartOptions {\n /** Should the dev server use `https` protocol. */\n https?: boolean;\n /** Should start the dev servers in development mode (minify). */\n mode?: 'development' | 'production';\n /** Is dev client enabled. */\n devClient?: boolean;\n /** Should run dev servers with clean caches. */\n resetDevServer?: boolean;\n /** Code signing private key path (defaults to same directory as certificate) */\n privateKeyPath?: string;\n\n /** Max amount of workers (threads) to use with Metro bundler, defaults to undefined for max workers. */\n maxWorkers?: number;\n /** Port to start the dev server on. */\n port?: number;\n\n /** Should start a headless dev server e.g. mock representation to approximate info from a server running in a different process. */\n headless?: boolean;\n /** Should instruct the bundler to create minified bundles. */\n minify?: boolean;\n\n /** Will the bundler be used for exporting. NOTE: This is an odd option to pass to the dev server. */\n isExporting?: boolean;\n\n // Webpack options\n /** Should modify and create PWA icons. */\n isImageEditingEnabled?: boolean;\n\n location: CreateURLOptions;\n}\n\nconst PLATFORM_MANAGERS = {\n simulator: () =>\n require('../platforms/ios/ApplePlatformManager')\n .ApplePlatformManager as typeof import('../platforms/ios/ApplePlatformManager').ApplePlatformManager,\n emulator: () =>\n require('../platforms/android/AndroidPlatformManager')\n .AndroidPlatformManager as typeof import('../platforms/android/AndroidPlatformManager').AndroidPlatformManager,\n};\n\ntype PlatformManagers = {\n [K in keyof typeof PLATFORM_MANAGERS]: InstanceType<ReturnType<(typeof PLATFORM_MANAGERS)[K]>>;\n};\n\ntype PlatformDevice<Platform extends keyof PlatformManagers> =\n PlatformManagers[Platform] extends PlatformManager<infer Device, any> ? Device : never;\n\ntype PlatformLaunchProps<Platform extends keyof PlatformManagers> =\n PlatformManagers[Platform] extends PlatformManager<any, infer LaunchProps> ? LaunchProps : never;\n\nexport abstract class BundlerDevServer {\n /** Name of the bundler. */\n abstract get name(): string;\n\n /** Tunnel instance for managing tunnel connections. */\n protected tunnel: AsyncNgrok | AsyncWsTunnel | null = null;\n /** Interfaces with the Expo 'Development Session' API. */\n protected devSession: DevelopmentSession | null = null;\n /** Announces dev server via Bonjour */\n protected bonjour: Bonjour | null = null;\n /** Http server and related info. */\n protected instance: DevServerInstance | null = null;\n /** Native platform interfaces for opening projects. */\n private platformManagers: { [K in keyof PlatformManagers]?: PlatformManagers[K] | undefined } =\n {};\n /** Manages the creation of dev server URLs. */\n protected urlCreator?: UrlCreator | null = null;\n\n private notifier: FileNotifier | null = null;\n protected readonly devToolsPluginManager: DevToolsPluginManager;\n public isDevClient: boolean;\n\n constructor(\n /** Project root folder. */\n public projectRoot: string,\n /** A mapping of bundlers to platforms. */\n public platformBundlers: PlatformBundlers,\n /** Advanced options */\n options?: {\n /**\n * The instance of DevToolsPluginManager\n * @default new DevToolsPluginManager(projectRoot)\n */\n devToolsPluginManager?: DevToolsPluginManager;\n // TODO: Replace with custom scheme maybe...\n isDevClient?: boolean;\n }\n ) {\n this.devToolsPluginManager =\n options?.devToolsPluginManager ?? new DevToolsPluginManager(projectRoot);\n this.isDevClient = options?.isDevClient ?? false;\n }\n\n protected setInstance(instance: DevServerInstance) {\n this.instance = instance;\n }\n\n /** Get the manifest middleware function. */\n protected async getManifestMiddlewareAsync(\n options: Pick<BundlerStartOptions, 'minify' | 'mode' | 'privateKeyPath'> = {}\n ) {\n const Middleware = require('./middleware/ExpoGoManifestHandlerMiddleware')\n .ExpoGoManifestHandlerMiddleware as typeof import('./middleware/ExpoGoManifestHandlerMiddleware').ExpoGoManifestHandlerMiddleware;\n\n const urlCreator = this.getUrlCreator();\n const middleware = new Middleware(this.projectRoot, {\n constructUrl: urlCreator.constructUrl.bind(urlCreator),\n mode: options.mode,\n minify: options.minify,\n isNativeWebpack: this.name === 'webpack' && this.isTargetingNative(),\n privateKeyPath: options.privateKeyPath,\n });\n return middleware;\n }\n\n /** Start the dev server using settings defined in the start command. */\n public async startAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n await this.stopAsync();\n\n let instance: DevServerInstance;\n if (options.headless) {\n instance = await this.startHeadlessAsync(options);\n } else {\n instance = await this.startImplementationAsync(options);\n }\n\n this.setInstance(instance);\n await this.postStartAsync(options);\n return instance;\n }\n\n protected abstract startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance>;\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n return false;\n }\n\n public abstract startTypeScriptServices(): Promise<void>;\n\n public async watchEnvironmentVariables(): Promise<void> {\n // noop -- We've only implemented this functionality in Metro.\n }\n\n /**\n * Creates a mock server representation that can be used to estimate URLs for a server started in another process.\n * This is used for the run commands where you can reuse the server from a previous run.\n */\n private async startHeadlessAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n if (!options.port)\n throw new CommandError('HEADLESS_SERVER', 'headless dev server requires a port option');\n await this.initUrlCreator(options);\n return {\n // Create a mock server\n server: {\n close: (callback: () => void) => {\n this.instance = null;\n callback?.();\n },\n addListener() {},\n },\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware: {},\n messageSocket: {\n broadcast: () => {\n throw new CommandError('HEADLESS_SERVER', 'Cannot broadcast messages to headless server');\n },\n },\n };\n }\n\n /**\n * Runs after the `startAsync` function, performing any additional common operations.\n * You can assume the dev server is started by the time this function is called.\n */\n protected async postStartAsync(options: BundlerStartOptions) {\n if (\n options.location.hostType === 'tunnel' &&\n !env.EXPO_OFFLINE &&\n // This is a hack to prevent using tunnel on web since we block it upstream for some reason.\n this.isTargetingNative()\n ) {\n await this._startTunnelAsync();\n } else if (envIsWebcontainer()) {\n await this._startTunnelAsync();\n }\n\n if (!options.isExporting) {\n await Promise.all([this.startDevSessionAsync(), this.startBonjourAsync()]);\n this.watchConfig();\n }\n }\n\n protected abstract getConfigModuleIds(): string[];\n\n protected watchConfig() {\n this.notifier?.stopObserving();\n this.notifier = new FileNotifier(this.projectRoot, this.getConfigModuleIds());\n this.notifier.startObserving();\n }\n\n /** Create the tunnel instance and start the tunnel server. Exposed for testing. */\n public async _startTunnelAsync(): Promise<AsyncNgrok | AsyncWsTunnel | null> {\n const port = this.getInstance()?.location.port;\n if (!port) return null;\n debug('[tunnel] connect to port: ' + port);\n this.tunnel = this._createTunnel(port);\n await this.tunnel.startAsync();\n return this.tunnel;\n }\n\n /** Resolve which tunnel implementation to use, without starting it. */\n private _createTunnel(port: number): AsyncNgrok | AsyncWsTunnel {\n const useV2Tunnel = env.EXPO_UNSTABLE_TUNNEL_V2 || envIsWebcontainer();\n if (useV2Tunnel) {\n const useExpoAccount = !!env.EXPO_UNSTABLE_TUNNEL_V2;\n return new AsyncWsTunnel(this.projectRoot, port, { useExpoAccount });\n }\n\n return new AsyncNgrok(this.projectRoot, port);\n }\n\n protected async startDevSessionAsync() {\n // This is used to make Expo Go open the project in either Expo Go, or the web browser.\n // Must come after ngrok (`startTunnelAsync`) setup.\n this.devSession = new DevelopmentSession(\n this.projectRoot,\n // This URL will be used on external devices so the computer IP won't be relevant.\n this.isTargetingNative()\n ? this.getNativeRuntimeUrl()\n : this.getDevServerUrl({ hostType: 'localhost' })\n );\n\n await this.devSession.startAsync({\n runtime: this.isTargetingNative() ? 'native' : 'web',\n });\n }\n\n protected async startBonjourAsync() {\n // This is used to make Expo Go open the project in either Expo Go, or the web browser.\n // Must come after ngrok (`startTunnelAsync`) setup.\n if (!this.bonjour) {\n this.bonjour = new Bonjour(this.projectRoot, this.getInstance()?.location.port);\n }\n\n await this.bonjour.announceAsync({});\n }\n\n public isTargetingNative() {\n // Temporary hack while we implement multi-bundler dev server proxy.\n return true;\n }\n\n public isTargetingWeb() {\n return this.platformBundlers.web === this.name;\n }\n\n /**\n * Sends a message over web sockets to any connected device,\n * does nothing when the dev server is not running.\n *\n * @param method name of the command. In RN projects `reload`, and `devMenu` are available. In Expo Go, `sendDevCommand` is available.\n * @param params\n */\n public broadcastMessage(\n method: 'reload' | 'devMenu' | 'sendDevCommand',\n params?: Record<string, any>\n ) {\n this.getInstance()?.messageSocket.broadcast(method, params);\n }\n\n /** Get the running dev server instance. */\n public getInstance() {\n return this.instance;\n }\n\n /** Stop the running dev server instance. */\n async stopAsync() {\n // Reset url creator\n this.urlCreator = undefined;\n\n // Stop file watching.\n this.notifier?.stopObserving();\n\n await Promise.all([\n // Stop the bonjour advertiser\n this.bonjour?.closeAsync(),\n // Stop the dev session timer and tell Expo API to remove dev session.\n this.devSession?.closeAsync(),\n ]);\n\n // Stop tunnel if running.\n await this.tunnel?.stopAsync().catch((e) => {\n Log.error(`Error stopping tunnel:`);\n Log.exception(e);\n });\n\n return resolveWithTimeout(\n () =>\n new Promise<void>((resolve, reject) => {\n // Close the server.\n debug(`Stopping dev server (bundler: ${this.name})`);\n\n if (this.instance?.server) {\n // Check if server is even running.\n this.instance.server.close((error) => {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n if (error) {\n if ('code' in error && error.code === 'ERR_SERVER_NOT_RUNNING') {\n resolve();\n } else {\n reject(error);\n }\n } else {\n resolve();\n }\n });\n } else {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n resolve();\n }\n }),\n {\n // NOTE(Bacon): Metro dev server doesn't seem to be closing in time.\n timeout: 1000,\n errorMessage: `Timeout waiting for '${this.name}' dev server to close`,\n }\n );\n }\n\n // TODO(@kitten): This should be created top-down rather than bottom up from implementors\n protected async initUrlCreator(\n options: Partial<Pick<BundlerStartOptions, 'port' | 'location'>> = {}\n ) {\n assert(options?.port, 'Dev server instance not found');\n assert(!this.urlCreator, 'Dev server is already initialized');\n const urlCreator = await UrlCreator.init(options.location, {\n port: options.port,\n getTunnelUrl: this.getTunnelUrl.bind(this),\n });\n this.urlCreator = urlCreator;\n return urlCreator;\n }\n\n public getUrlCreator() {\n assert(this.urlCreator, 'Dev server is uninitialized');\n return this.urlCreator;\n }\n\n public getNativeRuntimeUrl(opts: Partial<CreateURLOptions> = {}) {\n return this.isDevClient\n ? (this.getUrlCreator().constructDevClientUrl(opts) ?? this.getDevServerUrl())\n : this.getUrlCreator().constructExpoGoUrl(opts);\n }\n\n /** Get the URL for the running instance of the dev server. */\n public getDevServerUrl(options: { hostType?: 'localhost' } = {}): string | null {\n const instance = this.getInstance();\n if (!instance?.location) {\n return null;\n }\n\n // If we have an active WS tunnel instance, we always need to return the tunnel location.\n if (this.tunnel && this.tunnel instanceof AsyncWsTunnel) {\n return this.getUrlCreator().constructUrl({ scheme: 'http' });\n }\n\n const { location } = instance;\n if (options.hostType === 'localhost') {\n return `${location.protocol}://localhost:${location.port}`;\n }\n\n return location.url ?? null;\n }\n\n public getDevServerUrlOrAssert(options: { hostType?: 'localhost' } = {}): string {\n const instance = this.getDevServerUrl(options);\n if (!instance) {\n throw new CommandError(\n 'DEV_SERVER',\n `Cannot get the dev server URL before the server has started - bundler[${this.name}]`\n );\n }\n\n return instance;\n }\n\n /** Get the base URL for JS inspector */\n public getJsInspectorBaseUrl(): string {\n if (this.name !== 'metro') {\n throw new CommandError(\n 'DEV_SERVER',\n `Cannot get the JS inspector base url - bundler[${this.name}]`\n );\n }\n return this.getUrlCreator().constructUrl({ scheme: 'http' });\n }\n\n /** Get the tunnel URL from the tunnel. */\n public getTunnelUrl(): string | null {\n return this.tunnel?.getActiveUrl() ?? null;\n }\n\n /** Open the dev server in a runtime. */\n public async openPlatformAsync(\n launchTarget: keyof PlatformManagers | 'desktop',\n resolver: BaseResolveDeviceProps<any> = {}\n ) {\n if (launchTarget === 'desktop') {\n const serverUrl = this.getDevServerUrl({ hostType: 'localhost' });\n // Allow opening the tunnel URL when using Metro web.\n const url = this.name === 'metro' ? (this.getTunnelUrl() ?? serverUrl) : serverUrl;\n // Only launch the browser automatically if the process is interactive, otherwise we'll assume it's an agent.\n if (isInteractive()) {\n await openBrowserAsync(url!);\n }\n return { url };\n }\n\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync({ runtime }, resolver);\n }\n\n /** Open the dev server in a runtime. */\n public async openCustomRuntimeAsync<Platform extends keyof PlatformManagers>(\n launchTarget: Platform,\n launchProps: Partial<PlatformLaunchProps<Platform>> = {},\n resolver: BaseResolveDeviceProps<PlatformDevice<Platform>> = {}\n ) {\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n if (runtime !== 'custom') {\n throw new CommandError(\n `dev server cannot open custom runtimes either because it does not target native platforms or because it is not targeting dev clients. (target: ${runtime})`\n );\n }\n\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync(\n { runtime: 'custom', props: launchProps },\n resolver as BaseResolveDeviceProps<any>\n );\n }\n\n /** Get the URL for opening in Expo Go. */\n protected getExpoGoUrl(): string {\n return this.getUrlCreator().constructExpoGoUrl();\n }\n\n /** Should use the interstitial page for selecting which runtime to use. */\n protected isRedirectPageEnabled(): boolean {\n return (\n !env.EXPO_NO_REDIRECT_PAGE &&\n // if user passed --dev-client flag, skip interstitial page\n !this.isDevClient &&\n // Checks if dev client is installed.\n !!resolveFrom.silent(this.projectRoot, 'expo-dev-client')\n );\n }\n\n /** Get the redirect URL when redirecting is enabled. */\n public getRedirectUrl(platform: keyof PlatformManagers | null = null): string | null {\n if (!this.isRedirectPageEnabled()) {\n debug('Redirect page is disabled');\n return null;\n }\n\n return (\n this.getUrlCreator().constructLoadingUrl(\n {},\n platform === 'emulator' ? 'android' : platform === 'simulator' ? 'ios' : null\n ) ?? null\n );\n }\n\n protected async getPlatformManagerAsync<Platform extends keyof PlatformManagers>(\n ofPlatform: Platform\n ): Promise<PlatformManagers[Platform]> {\n const platform: keyof PlatformManagers = ofPlatform;\n if (!this.platformManagers[platform]) {\n const port = this.getInstance()?.location.port;\n if (!port || !this.urlCreator) {\n throw new CommandError(\n 'DEV_SERVER',\n 'Cannot interact with native platforms until dev server has started'\n );\n }\n debug(`Creating platform manager (platform: ${platform}, port: ${port})`);\n const managerParams = {\n getCustomRuntimeUrl: this.urlCreator.constructDevClientUrl.bind(this.urlCreator),\n getExpoGoUrl: this.getExpoGoUrl.bind(this),\n getRedirectUrl: this.getRedirectUrl.bind(this, platform),\n getDevServerUrl: this.getDevServerUrl.bind(this, { hostType: 'localhost' }),\n };\n switch (platform) {\n case 'simulator': {\n const Manager = PLATFORM_MANAGERS[platform]();\n this.platformManagers[platform] = new Manager(this.projectRoot, port, managerParams);\n break;\n }\n case 'emulator': {\n const Manager = PLATFORM_MANAGERS[platform]();\n this.platformManagers[platform] = new Manager(this.projectRoot, port, managerParams);\n break;\n }\n }\n }\n return this.platformManagers[platform] as PlatformManagers[Platform];\n }\n}\n"],"names":["BundlerDevServer","debug","require","PLATFORM_MANAGERS","simulator","ApplePlatformManager","emulator","AndroidPlatformManager","projectRoot","platformBundlers","options","tunnel","devSession","bonjour","instance","platformManagers","urlCreator","notifier","devToolsPluginManager","DevToolsPluginManager","isDevClient","setInstance","getManifestMiddlewareAsync","Middleware","ExpoGoManifestHandlerMiddleware","getUrlCreator","middleware","constructUrl","bind","mode","minify","isNativeWebpack","name","isTargetingNative","privateKeyPath","startAsync","stopAsync","headless","startHeadlessAsync","startImplementationAsync","postStartAsync","waitForTypeScriptAsync","watchEnvironmentVariables","port","CommandError","initUrlCreator","server","close","callback","addListener","location","host","url","protocol","messageSocket","broadcast","hostType","env","EXPO_OFFLINE","_startTunnelAsync","envIsWebcontainer","isExporting","Promise","all","startDevSessionAsync","startBonjourAsync","watchConfig","stopObserving","FileNotifier","getConfigModuleIds","startObserving","getInstance","_createTunnel","useV2Tunnel","EXPO_UNSTABLE_TUNNEL_V2","useExpoAccount","AsyncWsTunnel","AsyncNgrok","DevelopmentSession","getNativeRuntimeUrl","getDevServerUrl","runtime","Bonjour","announceAsync","isTargetingWeb","web","broadcastMessage","method","params","undefined","closeAsync","catch","e","Log","error","exception","resolveWithTimeout","resolve","reject","code","timeout","errorMessage","assert","UrlCreator","init","getTunnelUrl","opts","constructDevClientUrl","constructExpoGoUrl","scheme","getDevServerUrlOrAssert","getJsInspectorBaseUrl","getActiveUrl","openPlatformAsync","launchTarget","resolver","serverUrl","isInteractive","openBrowserAsync","manager","getPlatformManagerAsync","openAsync","openCustomRuntimeAsync","launchProps","props","getExpoGoUrl","isRedirectPageEnabled","EXPO_NO_REDIRECT_PAGE","resolveFrom","silent","getRedirectUrl","platform","constructLoadingUrl","ofPlatform","managerParams","getCustomRuntimeUrl","Manager"],"mappings":";;;;+BAkGsBA;;;eAAAA;;;;gEAlGH;;;;;;;gEACK;;;;;;4BAEG;+BACG;yBACN;8EACU;oCACC;4BAER;6DAEN;8BACQ;uBACM;qBACI;wBACV;6BACC;sBACG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGjC,MAAMC,QAAQC,QAAQ,SAAS;AA2D/B,MAAMC,oBAAoB;IACxBC,WAAW,IACTF,QAAQ,yCACLG,oBAAoB;IACzBC,UAAU,IACRJ,QAAQ,+CACLK,sBAAsB;AAC7B;AAYO,MAAeP;IAsBpB,YACE,yBAAyB,GACzB,AAAOQ,WAAmB,EAC1B,wCAAwC,GACxC,AAAOC,gBAAkC,EACzC,qBAAqB,GACrBC,OAQC,CACD;aAbOF,cAAAA;aAEAC,mBAAAA;QAtBT,qDAAqD,QAC3CE,SAA4C;QACtD,wDAAwD,QAC9CC,aAAwC;QAClD,qCAAqC,QAC3BC,UAA0B;QACpC,kCAAkC,QACxBC,WAAqC;QAC/C,sDAAsD,QAC9CC,mBACN,CAAC;QACH,6CAA6C,QACnCC,aAAiC;aAEnCC,WAAgC;QAoBtC,IAAI,CAACC,qBAAqB,GACxBR,CAAAA,2BAAAA,QAASQ,qBAAqB,KAAI,IAAIC,8BAAqB,CAACX;QAC9D,IAAI,CAACY,WAAW,GAAGV,CAAAA,2BAAAA,QAASU,WAAW,KAAI;IAC7C;IAEUC,YAAYP,QAA2B,EAAE;QACjD,IAAI,CAACA,QAAQ,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AAgB,CAACoH,SAAS;IACxC;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/server/BundlerDevServer.ts"],"sourcesContent":["import assert from 'assert';\nimport resolveFrom from 'resolve-from';\n\nimport { AsyncNgrok } from './AsyncNgrok';\nimport { AsyncWsTunnel } from './AsyncWsTunnel';\nimport { Bonjour } from './Bonjour';\nimport { DevelopmentSession } from './DevelopmentSession';\nimport type { CreateURLOptions } from './UrlCreator';\nimport { UrlCreator } from './UrlCreator';\nimport DevToolsPluginManager from './devtools/DevToolsPluginManager';\nimport type { PlatformBundlers } from './platformBundlers';\nimport * as Log from '../../log';\nimport { FileNotifier } from '../../utils/FileNotifier';\nimport { resolveWithTimeout } from '../../utils/delay';\nimport { env, envIsWebcontainer } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { isInteractive } from '../../utils/interactive';\nimport { openBrowserAsync } from '../../utils/open';\nimport type { BaseResolveDeviceProps, PlatformManager } from '../platforms/PlatformManager';\n\nconst debug = require('debug')('expo:start:server:devServer') as typeof console.log;\n\nexport type MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\nexport type ServerLike = {\n close(callback?: (err?: Error) => void): void;\n addListener?(event: string, listener: (...args: any[]) => void): unknown;\n};\n\nexport type DevServerInstance = {\n /** Bundler dev server instance. */\n server: ServerLike;\n /** Dev server URL location properties. */\n location: {\n url: string;\n port: number;\n protocol: 'http' | 'https';\n host?: string;\n };\n /** Additional middleware that's attached to the `server`. */\n middleware: any;\n /** Message socket for communicating with the runtime. */\n messageSocket: MessageSocket;\n};\n\nexport interface BundlerStartOptions {\n /** Should the dev server use `https` protocol. */\n https?: boolean;\n /** Should start the dev servers in development mode (minify). */\n mode?: 'development' | 'production';\n /** Is dev client enabled. */\n devClient?: boolean;\n /** Should run dev servers with clean caches. */\n resetDevServer?: boolean;\n /** Code signing private key path (defaults to same directory as certificate) */\n privateKeyPath?: string;\n\n /** Max amount of workers (threads) to use with Metro bundler, defaults to undefined for max workers. */\n maxWorkers?: number;\n /** Port to start the dev server on. */\n port?: number;\n\n /** Should start a headless dev server e.g. mock representation to approximate info from a server running in a different process. */\n headless?: boolean;\n /** Should instruct the bundler to create minified bundles. */\n minify?: boolean;\n\n /** Will the bundler be used for exporting. NOTE: This is an odd option to pass to the dev server. */\n isExporting?: boolean;\n\n // Webpack options\n /** Should modify and create PWA icons. */\n isImageEditingEnabled?: boolean;\n\n location: CreateURLOptions;\n}\n\nconst PLATFORM_MANAGERS = {\n simulator: () =>\n require('../platforms/ios/ApplePlatformManager')\n .ApplePlatformManager as typeof import('../platforms/ios/ApplePlatformManager').ApplePlatformManager,\n emulator: () =>\n require('../platforms/android/AndroidPlatformManager')\n .AndroidPlatformManager as typeof import('../platforms/android/AndroidPlatformManager').AndroidPlatformManager,\n};\n\ntype PlatformManagers = {\n [K in keyof typeof PLATFORM_MANAGERS]: InstanceType<ReturnType<(typeof PLATFORM_MANAGERS)[K]>>;\n};\n\ntype PlatformDevice<Platform extends keyof PlatformManagers> =\n PlatformManagers[Platform] extends PlatformManager<infer Device, any> ? Device : never;\n\ntype PlatformLaunchProps<Platform extends keyof PlatformManagers> =\n PlatformManagers[Platform] extends PlatformManager<any, infer LaunchProps> ? LaunchProps : never;\n\nexport abstract class BundlerDevServer {\n /** Name of the bundler. */\n abstract get name(): string;\n\n /** Tunnel instance for managing tunnel connections. */\n protected tunnel: AsyncNgrok | AsyncWsTunnel | null = null;\n /** Interfaces with the Expo 'Development Session' API. */\n protected devSession: DevelopmentSession | null = null;\n /** Announces dev server via Bonjour */\n protected bonjour: Bonjour | null = null;\n /** Http server and related info. */\n protected instance: DevServerInstance | null = null;\n /** Native platform interfaces for opening projects. */\n private platformManagers: { [K in keyof PlatformManagers]?: PlatformManagers[K] | undefined } =\n {};\n /** Manages the creation of dev server URLs. */\n protected urlCreator?: UrlCreator | null = null;\n\n private notifier: FileNotifier | null = null;\n protected readonly devToolsPluginManager: DevToolsPluginManager;\n public isDevClient: boolean;\n\n constructor(\n /** Project root folder. */\n public projectRoot: string,\n /** A mapping of bundlers to platforms. */\n public platformBundlers: PlatformBundlers,\n /** Advanced options */\n options?: {\n /**\n * The instance of DevToolsPluginManager\n * @default new DevToolsPluginManager(projectRoot)\n */\n devToolsPluginManager?: DevToolsPluginManager;\n // TODO: Replace with custom scheme maybe...\n isDevClient?: boolean;\n }\n ) {\n this.devToolsPluginManager =\n options?.devToolsPluginManager ?? new DevToolsPluginManager(projectRoot);\n this.isDevClient = options?.isDevClient ?? false;\n }\n\n protected setInstance(instance: DevServerInstance) {\n this.instance = instance;\n }\n\n /** Get the manifest middleware function. */\n protected async getManifestMiddlewareAsync(\n options: Pick<BundlerStartOptions, 'minify' | 'mode' | 'privateKeyPath'> = {}\n ) {\n const Middleware = require('./middleware/ExpoGoManifestHandlerMiddleware')\n .ExpoGoManifestHandlerMiddleware as typeof import('./middleware/ExpoGoManifestHandlerMiddleware').ExpoGoManifestHandlerMiddleware;\n\n const urlCreator = this.getUrlCreator();\n const middleware = new Middleware(this.projectRoot, {\n constructUrl: urlCreator.constructUrl.bind(urlCreator),\n mode: options.mode,\n minify: options.minify,\n isNativeWebpack: this.name === 'webpack' && this.isTargetingNative(),\n privateKeyPath: options.privateKeyPath,\n });\n return middleware;\n }\n\n /** Start the dev server using settings defined in the start command. */\n public async startAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n await this.stopAsync();\n\n let instance: DevServerInstance;\n if (options.headless) {\n instance = await this.startHeadlessAsync(options);\n } else {\n instance = await this.startImplementationAsync(options);\n }\n\n this.setInstance(instance);\n await this.postStartAsync(options);\n return instance;\n }\n\n protected abstract startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance>;\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n return false;\n }\n\n public abstract startTypeScriptServices(): Promise<void>;\n\n public async watchEnvironmentVariables(): Promise<void> {\n // noop -- We've only implemented this functionality in Metro.\n }\n\n /**\n * Creates a mock server representation that can be used to estimate URLs for a server started in another process.\n * This is used for the run commands where you can reuse the server from a previous run.\n */\n private async startHeadlessAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n if (!options.port)\n throw new CommandError('HEADLESS_SERVER', 'headless dev server requires a port option');\n await this.initUrlCreator(options);\n return {\n // Create a mock server\n server: {\n close: (callback: () => void) => {\n this.instance = null;\n callback?.();\n },\n addListener() {},\n },\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware: {},\n messageSocket: {\n broadcast: () => {\n throw new CommandError('HEADLESS_SERVER', 'Cannot broadcast messages to headless server');\n },\n },\n };\n }\n\n /**\n * Runs after the `startAsync` function, performing any additional common operations.\n * You can assume the dev server is started by the time this function is called.\n */\n protected async postStartAsync(options: BundlerStartOptions) {\n if (\n options.location.hostType === 'tunnel' &&\n !env.EXPO_OFFLINE &&\n // This is a hack to prevent using tunnel on web since we block it upstream for some reason.\n this.isTargetingNative()\n ) {\n await this._startTunnelAsync();\n } else if (envIsWebcontainer()) {\n await this._startTunnelAsync();\n }\n\n if (!options.isExporting) {\n await Promise.all([this.startDevSessionAsync(), this.startBonjourAsync()]);\n this.watchConfig();\n }\n }\n\n protected abstract getConfigModuleIds(): string[];\n\n protected watchConfig() {\n this.notifier?.stopObserving();\n this.notifier = new FileNotifier(this.projectRoot, this.getConfigModuleIds());\n this.notifier.startObserving();\n }\n\n /** Create the tunnel instance and start the tunnel server. Exposed for testing. */\n public async _startTunnelAsync(): Promise<AsyncNgrok | AsyncWsTunnel | null> {\n const port = this.getInstance()?.location.port;\n if (!port) return null;\n debug('[tunnel] connect to port: ' + port);\n this.tunnel = this._createTunnel(port);\n await this.tunnel.startAsync();\n return this.tunnel;\n }\n\n /** Resolve which tunnel implementation to use, without starting it. */\n private _createTunnel(port: number): AsyncNgrok | AsyncWsTunnel {\n const useV2Tunnel = env.EXPO_UNSTABLE_TUNNEL_V2 || envIsWebcontainer();\n if (useV2Tunnel) {\n const useExpoAccount = !!env.EXPO_UNSTABLE_TUNNEL_V2;\n return new AsyncWsTunnel(this.projectRoot, port, { useExpoAccount });\n }\n\n return new AsyncNgrok(this.projectRoot, port);\n }\n\n protected async startDevSessionAsync() {\n // This is used to make Expo Go open the project in either Expo Go, or the web browser.\n // Must come after ngrok (`startTunnelAsync`) setup.\n this.devSession = new DevelopmentSession(\n this.projectRoot,\n // This URL will be used on external devices so the computer IP won't be relevant.\n this.isTargetingNative()\n ? this.getNativeRuntimeUrl()\n : this.getDevServerUrl({ hostType: 'localhost' })\n );\n\n await this.devSession.startAsync({\n runtime: this.isTargetingNative() ? 'native' : 'web',\n });\n }\n\n protected async startBonjourAsync() {\n // This is used to make Expo Go open the project in either Expo Go, or the web browser.\n // Must come after ngrok (`startTunnelAsync`) setup.\n if (!this.bonjour) {\n this.bonjour = new Bonjour(this.projectRoot, this.getInstance()?.location.port);\n }\n\n await this.bonjour.announceAsync({});\n }\n\n public isTargetingNative() {\n // Temporary hack while we implement multi-bundler dev server proxy.\n return true;\n }\n\n public isTargetingWeb() {\n return this.platformBundlers.web === this.name;\n }\n\n /**\n * Sends a message over web sockets to any connected device,\n * does nothing when the dev server is not running.\n *\n * @param method name of the command. In RN projects `reload`, and `devMenu` are available. In Expo Go, `sendDevCommand` is available.\n * @param params\n */\n public broadcastMessage(\n method: 'reload' | 'devMenu' | 'sendDevCommand',\n params?: Record<string, any>\n ) {\n this.getInstance()?.messageSocket.broadcast(method, params);\n }\n\n /** Get the running dev server instance. */\n public getInstance() {\n return this.instance;\n }\n\n /** Stop the running dev server instance. */\n async stopAsync() {\n // Reset url creator\n this.urlCreator = undefined;\n\n // Stop file watching.\n this.notifier?.stopObserving();\n\n await Promise.all([\n // Stop the bonjour advertiser\n this.bonjour?.closeAsync(),\n // Stop the dev session timer and tell Expo API to remove dev session.\n this.devSession?.closeAsync(),\n ]);\n\n // Stop tunnel if running.\n await this.tunnel?.stopAsync().catch((e) => {\n Log.error(`Error stopping tunnel:`);\n Log.exception(e);\n });\n\n return resolveWithTimeout(\n () =>\n new Promise<void>((resolve, reject) => {\n // Close the server.\n debug(`Stopping dev server (bundler: ${this.name})`);\n\n if (this.instance?.server) {\n // Check if server is even running.\n this.instance.server.close((error) => {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n if (error) {\n if ('code' in error && error.code === 'ERR_SERVER_NOT_RUNNING') {\n resolve();\n } else {\n reject(error);\n }\n } else {\n resolve();\n }\n });\n } else {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n resolve();\n }\n }),\n {\n // NOTE(Bacon): Metro dev server doesn't seem to be closing in time.\n timeout: 1000,\n errorMessage: `Timeout waiting for '${this.name}' dev server to close`,\n }\n );\n }\n\n // TODO(@kitten): This should be created top-down rather than bottom up from implementors\n protected async initUrlCreator(\n options: Partial<Pick<BundlerStartOptions, 'port' | 'location'>> = {}\n ) {\n assert(options?.port, 'Dev server instance not found');\n assert(!this.urlCreator, 'Dev server is already initialized');\n const urlCreator = await UrlCreator.init(options.location, {\n port: options.port,\n getTunnelUrl: this.getTunnelUrl.bind(this),\n });\n this.urlCreator = urlCreator;\n return urlCreator;\n }\n\n public getUrlCreator() {\n assert(this.urlCreator, 'Dev server is uninitialized');\n return this.urlCreator;\n }\n\n public getNativeRuntimeUrl(opts: Partial<CreateURLOptions> = {}) {\n return this.isDevClient\n ? (this.getUrlCreator().constructDevClientUrl(opts) ?? this.getDevServerUrl())\n : this.getUrlCreator().constructExpoGoUrl(opts);\n }\n\n /** Get the URL for the running instance of the dev server. */\n public getDevServerUrl(options: { hostType?: 'localhost' } = {}): string | null {\n const instance = this.getInstance();\n if (!instance?.location) {\n return null;\n }\n\n // If we have an active WS tunnel instance, we always need to return the tunnel location.\n if (this.tunnel && this.tunnel instanceof AsyncWsTunnel) {\n return this.getUrlCreator().constructUrl({ scheme: 'http' });\n }\n\n const { location } = instance;\n if (options.hostType === 'localhost') {\n return `${location.protocol}://localhost:${location.port}`;\n }\n\n return location.url ?? null;\n }\n\n public getDevServerUrlOrAssert(options: { hostType?: 'localhost' } = {}): string {\n const instance = this.getDevServerUrl(options);\n if (!instance) {\n throw new CommandError(\n 'DEV_SERVER',\n `Cannot get the dev server URL before the server has started - bundler[${this.name}]`\n );\n }\n\n return instance;\n }\n\n /** Get the base URL for JS inspector */\n public getJsInspectorBaseUrl(): string {\n if (this.name !== 'metro') {\n throw new CommandError(\n 'DEV_SERVER',\n `Cannot get the JS inspector base url - bundler[${this.name}]`\n );\n }\n return this.getUrlCreator().constructUrl({ scheme: 'http' });\n }\n\n /** Get the tunnel URL from the tunnel. */\n public getTunnelUrl(): string | null {\n return this.tunnel?.getActiveUrl() ?? null;\n }\n\n /** Open the dev server in a runtime. */\n public async openPlatformAsync(\n launchTarget: keyof PlatformManagers | 'desktop',\n resolver: BaseResolveDeviceProps<any> = {}\n ) {\n if (launchTarget === 'desktop') {\n const serverUrl = this.getDevServerUrl({ hostType: 'localhost' });\n // Allow opening the tunnel URL when using Metro web.\n const url = this.name === 'metro' ? (this.getTunnelUrl() ?? serverUrl) : serverUrl;\n // Only launch the browser automatically if the process is interactive, otherwise we'll assume it's an agent.\n if (isInteractive()) {\n await openBrowserAsync(url!);\n }\n return { url };\n }\n\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync({ runtime }, resolver);\n }\n\n /** Open the dev server in a runtime. */\n public async openCustomRuntimeAsync<Platform extends keyof PlatformManagers>(\n launchTarget: Platform,\n launchProps: Partial<PlatformLaunchProps<Platform>> = {},\n resolver: BaseResolveDeviceProps<PlatformDevice<Platform>> = {}\n ) {\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n if (runtime !== 'custom') {\n throw new CommandError(\n `dev server cannot open custom runtimes either because it does not target native platforms or because it is not targeting dev clients. (target: ${runtime})`\n );\n }\n\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync(\n { runtime: 'custom', props: launchProps },\n resolver as BaseResolveDeviceProps<any>\n );\n }\n\n /** Get the URL for opening in Expo Go. */\n protected getExpoGoUrl(): string {\n return this.getUrlCreator().constructExpoGoUrl();\n }\n\n /** Should use the interstitial page for selecting which runtime to use. */\n protected isRedirectPageEnabled(): boolean {\n return (\n !env.EXPO_NO_REDIRECT_PAGE &&\n // if user passed --dev-client flag, skip interstitial page\n !this.isDevClient &&\n // Checks if dev client is installed.\n !!resolveFrom.silent(this.projectRoot, 'expo-dev-client')\n );\n }\n\n /** Get the redirect URL when redirecting is enabled. */\n public getRedirectUrl(platform: keyof PlatformManagers | null = null): string | null {\n if (!this.isRedirectPageEnabled()) {\n debug('Redirect page is disabled');\n return null;\n }\n\n return (\n this.getUrlCreator().constructLoadingUrl(\n {},\n platform === 'emulator' ? 'android' : platform === 'simulator' ? 'ios' : null\n ) ?? null\n );\n }\n\n protected async getPlatformManagerAsync<Platform extends keyof PlatformManagers>(\n ofPlatform: Platform\n ): Promise<PlatformManagers[Platform]> {\n const platform: keyof PlatformManagers = ofPlatform;\n if (!this.platformManagers[platform]) {\n const port = this.getInstance()?.location.port;\n if (!port || !this.urlCreator) {\n throw new CommandError(\n 'DEV_SERVER',\n 'Cannot interact with native platforms until dev server has started'\n );\n }\n debug(`Creating platform manager (platform: ${platform}, port: ${port})`);\n const managerParams = {\n getCustomRuntimeUrl: this.urlCreator.constructDevClientUrl.bind(this.urlCreator),\n getExpoGoUrl: this.getExpoGoUrl.bind(this),\n getRedirectUrl: this.getRedirectUrl.bind(this, platform),\n getDevServerUrl: this.getDevServerUrl.bind(this, { hostType: 'localhost' }),\n };\n switch (platform) {\n case 'simulator': {\n const Manager = PLATFORM_MANAGERS[platform]();\n this.platformManagers[platform] = new Manager(this.projectRoot, port, managerParams);\n break;\n }\n case 'emulator': {\n const Manager = PLATFORM_MANAGERS[platform]();\n this.platformManagers[platform] = new Manager(this.projectRoot, port, managerParams);\n break;\n }\n }\n }\n return this.platformManagers[platform] as PlatformManagers[Platform];\n }\n}\n"],"names":["BundlerDevServer","debug","require","PLATFORM_MANAGERS","simulator","ApplePlatformManager","emulator","AndroidPlatformManager","projectRoot","platformBundlers","options","tunnel","devSession","bonjour","instance","platformManagers","urlCreator","notifier","devToolsPluginManager","DevToolsPluginManager","isDevClient","setInstance","getManifestMiddlewareAsync","Middleware","ExpoGoManifestHandlerMiddleware","getUrlCreator","middleware","constructUrl","bind","mode","minify","isNativeWebpack","name","isTargetingNative","privateKeyPath","startAsync","stopAsync","headless","startHeadlessAsync","startImplementationAsync","postStartAsync","waitForTypeScriptAsync","watchEnvironmentVariables","port","CommandError","initUrlCreator","server","close","callback","addListener","location","host","url","protocol","messageSocket","broadcast","hostType","env","EXPO_OFFLINE","_startTunnelAsync","envIsWebcontainer","isExporting","Promise","all","startDevSessionAsync","startBonjourAsync","watchConfig","stopObserving","FileNotifier","getConfigModuleIds","startObserving","getInstance","_createTunnel","useV2Tunnel","EXPO_UNSTABLE_TUNNEL_V2","useExpoAccount","AsyncWsTunnel","AsyncNgrok","DevelopmentSession","getNativeRuntimeUrl","getDevServerUrl","runtime","Bonjour","announceAsync","isTargetingWeb","web","broadcastMessage","method","params","undefined","closeAsync","catch","e","Log","error","exception","resolveWithTimeout","resolve","reject","code","timeout","errorMessage","assert","UrlCreator","init","getTunnelUrl","opts","constructDevClientUrl","constructExpoGoUrl","scheme","getDevServerUrlOrAssert","getJsInspectorBaseUrl","getActiveUrl","openPlatformAsync","launchTarget","resolver","serverUrl","isInteractive","openBrowserAsync","manager","getPlatformManagerAsync","openAsync","openCustomRuntimeAsync","launchProps","props","getExpoGoUrl","isRedirectPageEnabled","EXPO_NO_REDIRECT_PAGE","resolveFrom","silent","getRedirectUrl","platform","constructLoadingUrl","ofPlatform","managerParams","getCustomRuntimeUrl","Manager"],"mappings":";;;;+BAkGsBA;;;eAAAA;;;;gEAlGH;;;;;;;gEACK;;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E;gBAC7B,MAAM,IAAI4B,oBAAY,CACpB,cACA;YAEJ;YACA3C,MAAM,CAAC,qCAAqC,EAAEkI,SAAS,QAAQ,EAAExF,KAAK,CAAC,CAAC;YACxE,MAAM2F,gBAAgB;gBACpBC,qBAAqB,IAAI,CAACvH,UAAU,CAAC2F,qBAAqB,CAAC/E,IAAI,CAAC,IAAI,CAACZ,UAAU;gBAC/E6G,cAAc,IAAI,CAACA,YAAY,CAACjG,IAAI,CAAC,IAAI;gBACzCsG,gBAAgB,IAAI,CAACA,cAAc,CAACtG,IAAI,CAAC,IAAI,EAAEuG;gBAC/CnD,iBAAiB,IAAI,CAACA,eAAe,CAACpD,IAAI,CAAC,IAAI,EAAE;oBAAE4B,UAAU;gBAAY;YAC3E;YACA,OAAQ2E;gBACN,KAAK;oBAAa;wBAChB,MAAMK,UAAUrI,iBAAiB,CAACgI,SAAS;wBAC3C,IAAI,CAACpH,gBAAgB,CAACoH,SAAS,GAAG,IAAIK,QAAQ,IAAI,CAAChI,WAAW,EAAEmC,MAAM2F;wBACtE;oBACF;gBACA,KAAK;oBAAY;wBACf,MAAME,UAAUrI,iBAAiB,CAACgI,SAAS;wBAC3C,IAAI,CAACpH,gBAAgB,CAACoH,SAAS,GAAG,IAAIK,QAAQ,IAAI,CAAChI,WAAW,EAAEmC,MAAM2F;wBACtE;oBACF;YACF;QACF;QACA,OAAO,IAAI,CAACvH,gBAAgB,CAACoH,SAAS;IACxC;AACF"}
|
package/build/src/utils/env.js
CHANGED
|
@@ -67,7 +67,8 @@ class Env {
|
|
|
67
67
|
return (0, _getenv().boolish)('EXPO_LOCAL', false);
|
|
68
68
|
}
|
|
69
69
|
/** Is running in non-interactive CI mode */ get CI() {
|
|
70
|
-
|
|
70
|
+
const ci = _nodeprocess().default.env.CI;
|
|
71
|
+
return ci === '1' || (ci == null ? void 0 : ci.toLowerCase()) === 'true';
|
|
71
72
|
}
|
|
72
73
|
/** Disable telemetry (analytics) */ get EXPO_NO_TELEMETRY() {
|
|
73
74
|
return (0, _getenv().boolish)('EXPO_NO_TELEMETRY', false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/env.ts"],"sourcesContent":["import { getOriginalEnvValue } from '@expo/env';\nimport { boolish, int, string } from 'getenv';\nimport process from 'node:process';\n\n// @expo/webpack-config -> expo-pwa -> @expo/image-utils: EXPO_IMAGE_UTILS_NO_SHARP\n\n// TODO: EXPO_CLI_USERNAME, EXPO_CLI_PASSWORD\n\nclass Env {\n /** Enable profiling metrics */\n get EXPO_PROFILE() {\n return boolish('EXPO_PROFILE', false);\n }\n\n /** Enable debug logging */\n get EXPO_DEBUG() {\n return boolish('EXPO_DEBUG', false);\n }\n\n /** Disable all network requests */\n get EXPO_OFFLINE() {\n return boolish('EXPO_OFFLINE', false);\n }\n\n /** Enable the beta version of Expo (TODO: Should this just be in the beta version of expo releases?) */\n get EXPO_BETA() {\n return boolish('EXPO_BETA', false);\n }\n\n /** Enable staging API environment */\n get EXPO_STAGING() {\n return boolish('EXPO_STAGING', false);\n }\n\n /** Enable local API environment */\n get EXPO_LOCAL() {\n return boolish('EXPO_LOCAL', false);\n }\n\n /** Is running in non-interactive CI mode */\n get CI() {\n return boolish('CI', false);\n }\n\n /** Disable telemetry (analytics) */\n get EXPO_NO_TELEMETRY() {\n return boolish('EXPO_NO_TELEMETRY', false);\n }\n\n /** Disable detaching telemetry to separate process */\n get EXPO_NO_TELEMETRY_DETACH() {\n return boolish('EXPO_NO_TELEMETRY_DETACH', false);\n }\n\n /** local directory to the universe repo for testing locally */\n get EXPO_UNIVERSE_DIR() {\n // Read from the pre-dotenv env — this is a filesystem path used by internal\n // tooling; a project `.env` overriding it could redirect file access.\n return getOriginalEnvValue('EXPO_UNIVERSE_DIR') || '';\n }\n\n /** @deprecated Default Webpack host string */\n get WEB_HOST() {\n return string('WEB_HOST', '0.0.0.0');\n }\n\n /** Skip warning users about a dirty git status */\n get EXPO_NO_GIT_STATUS() {\n return boolish('EXPO_NO_GIT_STATUS', true);\n }\n /** Disable auto web setup */\n get EXPO_NO_WEB_SETUP() {\n return boolish('EXPO_NO_WEB_SETUP', envIsHeadless());\n }\n /** Disable auto TypeScript setup */\n get EXPO_NO_TYPESCRIPT_SETUP() {\n return boolish('EXPO_NO_TYPESCRIPT_SETUP', false);\n }\n /** Disable all API caches. Does not disable bundler caches. */\n get EXPO_NO_CACHE() {\n return boolish('EXPO_NO_CACHE', false);\n }\n /** Disable the app select redirect page. */\n get EXPO_NO_REDIRECT_PAGE() {\n return boolish('EXPO_NO_REDIRECT_PAGE', false);\n }\n /** Disable printing the QR code in the interactive Terminal UI. */\n get EXPO_NO_QR_CODE(): boolean {\n return boolish('EXPO_NO_QR_CODE', false);\n }\n /** Resolve application IDs from Expo app config before native files in `expo start`. */\n get EXPO_RUN_PREFER_APP_CONFIG_ID(): boolean {\n return boolish('EXPO_RUN_PREFER_APP_CONFIG_ID', false);\n }\n /** The React Metro port that's baked into react-native scripts and tools. */\n get RCT_METRO_PORT() {\n return int('RCT_METRO_PORT', 0);\n }\n /** Skip validating the manifest during `export`. */\n get EXPO_SKIP_MANIFEST_VALIDATION_TOKEN(): boolean {\n return !!string('EXPO_SKIP_MANIFEST_VALIDATION_TOKEN', '');\n }\n\n /** Public folder path relative to the project root. Default to `public` */\n get EXPO_PUBLIC_FOLDER(): string {\n return string('EXPO_PUBLIC_FOLDER', 'public');\n }\n\n /** Higher priority `$EDIOTR` variable for indicating which editor to use when pressing `o` in the Terminal UI. */\n get EXPO_EDITOR(): string {\n return string('EXPO_EDITOR', '');\n }\n\n /**\n * Overwrite the dev server URL, disregarding the `--port`, `--host`, `--tunnel`, `--lan`, `--localhost` arguments.\n * This is useful for browser editors that require custom proxy URLs.\n */\n get EXPO_PACKAGER_PROXY_URL(): string {\n // Read from the pre-dotenv env — overrides dev server URL served to clients.\n return getOriginalEnvValue('EXPO_PACKAGER_PROXY_URL') || '';\n }\n\n get EXPO_UNSTABLE_TUNNEL_V2(): boolean {\n return boolish('EXPO_UNSTABLE_TUNNEL_V2', false);\n }\n\n /**\n * **Experimental** - Disable using `exp.direct` as the hostname for\n * `--tunnel` connections. This enables **https://** forwarding which\n * can be used to test universal links on iOS.\n *\n * This may cause issues with `expo-linking` and Expo Go.\n *\n * Select the exact subdomain by passing a string value that is not one of: `true`, `false`, `1`, `0`.\n */\n get EXPO_TUNNEL_SUBDOMAIN(): string | boolean {\n const subdomain = string('EXPO_TUNNEL_SUBDOMAIN', '');\n if (['0', 'false', ''].includes(subdomain)) {\n return false;\n } else if (['1', 'true'].includes(subdomain)) {\n return true;\n }\n return subdomain;\n }\n\n /**\n * Force Expo CLI to use the [`resolver.resolverMainFields`](https://facebook.github.io/metro/docs/configuration/#resolvermainfields) from the project `metro.config.js` for all platforms.\n *\n * By default, Expo CLI will use `['browser', 'module', 'main']` (default for Webpack) for web and the user-defined main fields for other platforms.\n */\n get EXPO_METRO_NO_MAIN_FIELD_OVERRIDE(): boolean {\n return boolish('EXPO_METRO_NO_MAIN_FIELD_OVERRIDE', false);\n }\n\n /**\n * HTTP/HTTPS proxy to connect to for network requests. Configures [https-proxy-agent](https://www.npmjs.com/package/https-proxy-agent).\n */\n get HTTP_PROXY(): string {\n return process.env.HTTP_PROXY || process.env.http_proxy || '';\n }\n\n /**\n * Instructs a different Metro config to be loaded.\n * The path, according to metro-config, should be a path relative to the current working directory.\n * This flag is internal and was added for external tools.\n * @internal\n */\n get EXPO_OVERRIDE_METRO_CONFIG(): string | undefined {\n // Read from the pre-dotenv env — this path is `require()`d as Metro config,\n // so a project `.env` overriding it would execute attacker code in-process.\n return getOriginalEnvValue('EXPO_OVERRIDE_METRO_CONFIG')?.trim() || undefined;\n }\n\n /**\n * Use the network inspector by overriding the metro inspector proxy with a custom version.\n * @deprecated This has been replaced by `@react-native/dev-middleware` and is now unused.\n */\n get EXPO_NO_INSPECTOR_PROXY(): boolean {\n return boolish('EXPO_NO_INSPECTOR_PROXY', false);\n }\n\n /** Disable lazy bundling in Metro bundler. */\n get EXPO_NO_METRO_LAZY() {\n return boolish('EXPO_NO_METRO_LAZY', false);\n }\n\n /**\n * Enable the unstable inverse dependency stack trace for Metro bundling errors.\n * @deprecated This will be removed in the future.\n */\n get EXPO_METRO_UNSTABLE_ERRORS() {\n return boolish('EXPO_METRO_UNSTABLE_ERRORS', true);\n }\n\n /** Disable Environment Variable injection in client bundles. */\n get EXPO_NO_CLIENT_ENV_VARS(): boolean {\n return boolish('EXPO_NO_CLIENT_ENV_VARS', false);\n }\n\n /** Set the default `user` that should be passed to `--user` with ADB commands. Used for installing APKs on Android devices with multiple profiles. Defaults to `0`. */\n get EXPO_ADB_USER(): string {\n return string('EXPO_ADB_USER', '0');\n }\n\n /** Used internally to enable E2E utilities. This behavior is not stable to external users. */\n get __EXPO_E2E_TEST(): boolean {\n return boolish('__EXPO_E2E_TEST', false);\n }\n\n /** Unstable: Force single-bundle exports in production. */\n get EXPO_NO_BUNDLE_SPLITTING(): boolean {\n return boolish('EXPO_NO_BUNDLE_SPLITTING', false);\n }\n\n /**\n * Enable Atlas to gather bundle information during development or export.\n * Note, because this used to be an experimental feature, both `EXPO_ATLAS` and `EXPO_UNSTABLE_ATLAS` are supported.\n */\n get EXPO_ATLAS() {\n return boolish('EXPO_ATLAS', boolish('EXPO_UNSTABLE_ATLAS', false));\n }\n\n /** Unstable: Enable tree shaking for Metro. */\n get EXPO_UNSTABLE_TREE_SHAKING() {\n return boolish('EXPO_UNSTABLE_TREE_SHAKING', false);\n }\n\n /** Unstable: Enable eager bundling where transformation runs uncached after the entire bundle has been created. This is required for production tree shaking and less optimized for development bundling. */\n get EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH() {\n return boolish('EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH', false);\n }\n\n /** Enable the use of Expo's custom metro require implementation. The custom require supports better debugging, tree shaking, and React Server Components. */\n get EXPO_USE_METRO_REQUIRE() {\n return boolish('EXPO_USE_METRO_REQUIRE', false);\n }\n\n /** Internal key used to pass eager bundle data from the CLI to the native run scripts during `npx expo run` commands. */\n get __EXPO_EAGER_BUNDLE_OPTIONS() {\n return getOriginalEnvValue('__EXPO_EAGER_BUNDLE_OPTIONS') || '';\n }\n\n /** Disable server deployment during production builds (during `expo export:embed`). This is useful for testing API routes and server components against a local server. */\n get EXPO_NO_DEPLOY(): boolean {\n return boolish('EXPO_NO_DEPLOY', false);\n }\n\n /** Enable hydration during development when rendering Expo Web */\n get EXPO_WEB_DEV_HYDRATE(): boolean {\n return boolish('EXPO_WEB_DEV_HYDRATE', false);\n }\n\n /** Enable experimental React Server Functions support. */\n get EXPO_UNSTABLE_SERVER_FUNCTIONS(): boolean {\n return boolish('EXPO_UNSTABLE_SERVER_FUNCTIONS', false);\n }\n\n /** Enable unstable/experimental support for deploying the native server in `npx expo run` commands. */\n get EXPO_UNSTABLE_DEPLOY_SERVER(): boolean {\n return boolish('EXPO_UNSTABLE_DEPLOY_SERVER', false);\n }\n\n /** Is running in EAS Build. This is set by EAS: https://docs.expo.dev/eas/environment-variables/ */\n get EAS_BUILD(): boolean {\n return boolish('EAS_BUILD', false);\n }\n\n /** Disable the React Native Directory compatibility check for new architecture when installing packages */\n get EXPO_NO_NEW_ARCH_COMPAT_CHECK(): boolean {\n return boolish('EXPO_NO_NEW_ARCH_COMPAT_CHECK', envIsHeadless());\n }\n\n /** Disable the dependency validation when installing other dependencies and starting the project */\n get EXPO_NO_DEPENDENCY_VALIDATION(): boolean {\n return boolish('EXPO_NO_DEPENDENCY_VALIDATION', envIsHeadless());\n }\n\n /** Force Expo CLI to run in webcontainer mode, this has impact on which URL Expo is using by default */\n get EXPO_FORCE_WEBCONTAINER_ENV(): boolean {\n return boolish('EXPO_FORCE_WEBCONTAINER_ENV', false);\n }\n\n /** Force Expo CLI to run in webcontainer mode, this has impact on which URL Expo is using by default */\n get EXPO_UNSTABLE_WEB_MODAL(): boolean {\n return boolish('EXPO_UNSTABLE_WEB_MODAL', false);\n }\n\n /** Disable @react-navigation checks for expo-router projects */\n get EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK(): boolean {\n return boolish('EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK', false);\n }\n\n /**\n * Disable Material Symbols (`md`) icon support in expo-router's NativeTabs on Android.\n * When enabled, the Metro resolver swaps the Android-specific md icon converter for a no-op\n * stub, so the `expo-symbols` dependency is tree-shaken out of the Android bundle.\n */\n get EXPO_ROUTER_DISABLE_NATIVE_TABS_MD(): boolean {\n return boolish('EXPO_ROUTER_DISABLE_NATIVE_TABS_MD', false);\n }\n\n /** Disable by falsy value live binding in experimental import export support. Enabled by default. */\n get EXPO_UNSTABLE_LIVE_BINDINGS(): boolean {\n return boolish('EXPO_UNSTABLE_LIVE_BINDINGS', true);\n }\n\n /**\n * Enable the experimental MCP integration or further specify the MCP server URL.\n */\n get EXPO_UNSTABLE_MCP_SERVER(): string {\n const value = string('EXPO_UNSTABLE_MCP_SERVER', '');\n if (value === '1' || value.toLowerCase() === 'true') {\n return this.EXPO_STAGING ? 'staging-mcp.expo.dev' : 'mcp.expo.dev';\n }\n // Re-read from the pre-dotenv env — overrides dev server URL served to clients.\n return getOriginalEnvValue('EXPO_UNSTABLE_MCP_SERVER') || '';\n }\n\n /** Enable Expo Log Box for iOS and Android (Web is enabled by default) */\n get EXPO_UNSTABLE_LOG_BOX(): boolean {\n return boolish('EXPO_UNSTABLE_LOG_BOX', false);\n }\n\n /**\n * Enable Bonjour advertising of the Expo CLI on local networks\n */\n get EXPO_UNSTABLE_BONJOUR(): boolean {\n return boolish('EXPO_UNSTABLE_BONJOUR', !envIsHeadless());\n }\n\n /** @internal Configure other environment variables for headless operations */\n get EXPO_UNSTABLE_HEADLESS() {\n return boolish('EXPO_UNSTABLE_HEADLESS', envIsWebcontainer());\n }\n}\n\nexport const env = new Env();\n\nexport function envIsWebcontainer() {\n // See: https://github.com/unjs/std-env/blob/4b1e03c4efce58249858efc2cc5f5eac727d0adb/src/providers.ts#L134-L143\n return (\n env.EXPO_FORCE_WEBCONTAINER_ENV ||\n (process.env.SHELL === '/bin/jsh' && !!process.versions.webcontainer)\n );\n}\n\nexport function envIsHeadless() {\n return env.EXPO_UNSTABLE_HEADLESS;\n}\n"],"names":["env","envIsHeadless","envIsWebcontainer","Env","EXPO_PROFILE","boolish","EXPO_DEBUG","EXPO_OFFLINE","EXPO_BETA","EXPO_STAGING","EXPO_LOCAL","CI","EXPO_NO_TELEMETRY","EXPO_NO_TELEMETRY_DETACH","EXPO_UNIVERSE_DIR","getOriginalEnvValue","WEB_HOST","string","EXPO_NO_GIT_STATUS","EXPO_NO_WEB_SETUP","EXPO_NO_TYPESCRIPT_SETUP","EXPO_NO_CACHE","EXPO_NO_REDIRECT_PAGE","EXPO_NO_QR_CODE","EXPO_RUN_PREFER_APP_CONFIG_ID","RCT_METRO_PORT","int","EXPO_SKIP_MANIFEST_VALIDATION_TOKEN","EXPO_PUBLIC_FOLDER","EXPO_EDITOR","EXPO_PACKAGER_PROXY_URL","EXPO_UNSTABLE_TUNNEL_V2","EXPO_TUNNEL_SUBDOMAIN","subdomain","includes","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","HTTP_PROXY","process","http_proxy","EXPO_OVERRIDE_METRO_CONFIG","trim","undefined","EXPO_NO_INSPECTOR_PROXY","EXPO_NO_METRO_LAZY","EXPO_METRO_UNSTABLE_ERRORS","EXPO_NO_CLIENT_ENV_VARS","EXPO_ADB_USER","__EXPO_E2E_TEST","EXPO_NO_BUNDLE_SPLITTING","EXPO_ATLAS","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","EXPO_USE_METRO_REQUIRE","__EXPO_EAGER_BUNDLE_OPTIONS","EXPO_NO_DEPLOY","EXPO_WEB_DEV_HYDRATE","EXPO_UNSTABLE_SERVER_FUNCTIONS","EXPO_UNSTABLE_DEPLOY_SERVER","EAS_BUILD","EXPO_NO_NEW_ARCH_COMPAT_CHECK","EXPO_NO_DEPENDENCY_VALIDATION","EXPO_FORCE_WEBCONTAINER_ENV","EXPO_UNSTABLE_WEB_MODAL","EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK","EXPO_ROUTER_DISABLE_NATIVE_TABS_MD","EXPO_UNSTABLE_LIVE_BINDINGS","EXPO_UNSTABLE_MCP_SERVER","value","toLowerCase","EXPO_UNSTABLE_LOG_BOX","EXPO_UNSTABLE_BONJOUR","EXPO_UNSTABLE_HEADLESS","SHELL","versions","webcontainer"],"mappings":";;;;;;;;;;;QAgVaA;eAAAA;;QAUGC;eAAAA;;QARAC;eAAAA;;;;yBAlVoB;;;;;;;yBACC;;;;;;;gEACjB;;;;;;;;;;;AAEpB,mFAAmF;AAEnF,6CAA6C;AAE7C,MAAMC;IACJ,6BAA6B,GAC7B,IAAIC,eAAe;QACjB,OAAOC,IAAAA,iBAAO,EAAC,gBAAgB;IACjC;IAEA,yBAAyB,GACzB,IAAIC,aAAa;QACf,OAAOD,IAAAA,iBAAO,EAAC,cAAc;IAC/B;IAEA,iCAAiC,GACjC,IAAIE,eAAe;QACjB,OAAOF,IAAAA,iBAAO,EAAC,gBAAgB;IACjC;IAEA,sGAAsG,GACtG,IAAIG,YAAY;QACd,OAAOH,IAAAA,iBAAO,EAAC,aAAa;IAC9B;IAEA,mCAAmC,GACnC,IAAII,eAAe;QACjB,OAAOJ,IAAAA,iBAAO,EAAC,gBAAgB;IACjC;IAEA,iCAAiC,GACjC,IAAIK,aAAa;QACf,OAAOL,IAAAA,iBAAO,EAAC,cAAc;IAC/B;IAEA,0CAA0C,GAC1C,IAAIM,KAAK;QACP,OAAON,IAAAA,iBAAO,EAAC,MAAM;IACvB;IAEA,kCAAkC,GAClC,IAAIO,oBAAoB;QACtB,OAAOP,IAAAA,iBAAO,EAAC,qBAAqB;IACtC;IAEA,oDAAoD,GACpD,IAAIQ,2BAA2B;QAC7B,OAAOR,IAAAA,iBAAO,EAAC,4BAA4B;IAC7C;IAEA,6DAA6D,GAC7D,IAAIS,oBAAoB;QACt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,EAAC,+BAA+B;IAChD;IAEA,sGAAsG,GACtG,IAAIyD,0BAAmC;QACrC,OAAOzD,IAAAA,iBAAO,EAAC,2BAA2B;IAC5C;IAEA,8DAA8D,GAC9D,IAAI0D,0CAAmD;QACrD,OAAO1D,IAAAA,iBAAO,EAAC,2CAA2C;IAC5D;IAEA;;;;GAIC,GACD,IAAI2D,qCAA8C;QAChD,OAAO3D,IAAAA,iBAAO,EAAC,sCAAsC;IACvD;IAEA,mGAAmG,GACnG,IAAI4D,8BAAuC;QACzC,OAAO5D,IAAAA,iBAAO,EAAC,+BAA+B;IAChD;IAEA;;GAEC,GACD,IAAI6D,2BAAmC;QACrC,MAAMC,QAAQlD,IAAAA,gBAAM,EAAC,4BAA4B;QACjD,IAAIkD,UAAU,OAAOA,MAAMC,WAAW,OAAO,QAAQ;YACnD,OAAO,IAAI,CAAC3D,YAAY,GAAG,yBAAyB;QACtD;QACA,gFAAgF;QAChF,OAAOM,IAAAA,0BAAmB,EAAC,+BAA+B;IAC5D;IAEA,wEAAwE,GACxE,IAAIsD,wBAAiC;QACnC,OAAOhE,IAAAA,iBAAO,EAAC,yBAAyB;IAC1C;IAEA;;GAEC,GACD,IAAIiE,wBAAiC;QACnC,OAAOjE,IAAAA,iBAAO,EAAC,yBAAyB,CAACJ;IAC3C;IAEA,4EAA4E,GAC5E,IAAIsE,yBAAyB;QAC3B,OAAOlE,IAAAA,iBAAO,EAAC,0BAA0BH;IAC3C;AACF;AAEO,MAAMF,MAAM,IAAIG;AAEhB,SAASD;IACd,gHAAgH;IAChH,OACEF,IAAI6D,2BAA2B,IAC9BxB,sBAAO,CAACrC,GAAG,CAACwE,KAAK,KAAK,cAAc,CAAC,CAACnC,sBAAO,CAACoC,QAAQ,CAACC,YAAY;AAExE;AAEO,SAASzE;IACd,OAAOD,IAAIuE,sBAAsB;AACnC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/env.ts"],"sourcesContent":["import { getOriginalEnvValue } from '@expo/env';\nimport { boolish, int, string } from 'getenv';\nimport process from 'node:process';\n\n// @expo/webpack-config -> expo-pwa -> @expo/image-utils: EXPO_IMAGE_UTILS_NO_SHARP\n\n// TODO: EXPO_CLI_USERNAME, EXPO_CLI_PASSWORD\n\nclass Env {\n /** Enable profiling metrics */\n get EXPO_PROFILE() {\n return boolish('EXPO_PROFILE', false);\n }\n\n /** Enable debug logging */\n get EXPO_DEBUG() {\n return boolish('EXPO_DEBUG', false);\n }\n\n /** Disable all network requests */\n get EXPO_OFFLINE() {\n return boolish('EXPO_OFFLINE', false);\n }\n\n /** Enable the beta version of Expo (TODO: Should this just be in the beta version of expo releases?) */\n get EXPO_BETA() {\n return boolish('EXPO_BETA', false);\n }\n\n /** Enable staging API environment */\n get EXPO_STAGING() {\n return boolish('EXPO_STAGING', false);\n }\n\n /** Enable local API environment */\n get EXPO_LOCAL() {\n return boolish('EXPO_LOCAL', false);\n }\n\n /** Is running in non-interactive CI mode */\n get CI() {\n const ci = process.env.CI;\n return ci === '1' || ci?.toLowerCase() === 'true';\n }\n\n /** Disable telemetry (analytics) */\n get EXPO_NO_TELEMETRY() {\n return boolish('EXPO_NO_TELEMETRY', false);\n }\n\n /** Disable detaching telemetry to separate process */\n get EXPO_NO_TELEMETRY_DETACH() {\n return boolish('EXPO_NO_TELEMETRY_DETACH', false);\n }\n\n /** local directory to the universe repo for testing locally */\n get EXPO_UNIVERSE_DIR() {\n // Read from the pre-dotenv env — this is a filesystem path used by internal\n // tooling; a project `.env` overriding it could redirect file access.\n return getOriginalEnvValue('EXPO_UNIVERSE_DIR') || '';\n }\n\n /** @deprecated Default Webpack host string */\n get WEB_HOST() {\n return string('WEB_HOST', '0.0.0.0');\n }\n\n /** Skip warning users about a dirty git status */\n get EXPO_NO_GIT_STATUS() {\n return boolish('EXPO_NO_GIT_STATUS', true);\n }\n /** Disable auto web setup */\n get EXPO_NO_WEB_SETUP() {\n return boolish('EXPO_NO_WEB_SETUP', envIsHeadless());\n }\n /** Disable auto TypeScript setup */\n get EXPO_NO_TYPESCRIPT_SETUP() {\n return boolish('EXPO_NO_TYPESCRIPT_SETUP', false);\n }\n /** Disable all API caches. Does not disable bundler caches. */\n get EXPO_NO_CACHE() {\n return boolish('EXPO_NO_CACHE', false);\n }\n /** Disable the app select redirect page. */\n get EXPO_NO_REDIRECT_PAGE() {\n return boolish('EXPO_NO_REDIRECT_PAGE', false);\n }\n /** Disable printing the QR code in the interactive Terminal UI. */\n get EXPO_NO_QR_CODE(): boolean {\n return boolish('EXPO_NO_QR_CODE', false);\n }\n /** Resolve application IDs from Expo app config before native files in `expo start`. */\n get EXPO_RUN_PREFER_APP_CONFIG_ID(): boolean {\n return boolish('EXPO_RUN_PREFER_APP_CONFIG_ID', false);\n }\n /** The React Metro port that's baked into react-native scripts and tools. */\n get RCT_METRO_PORT() {\n return int('RCT_METRO_PORT', 0);\n }\n /** Skip validating the manifest during `export`. */\n get EXPO_SKIP_MANIFEST_VALIDATION_TOKEN(): boolean {\n return !!string('EXPO_SKIP_MANIFEST_VALIDATION_TOKEN', '');\n }\n\n /** Public folder path relative to the project root. Default to `public` */\n get EXPO_PUBLIC_FOLDER(): string {\n return string('EXPO_PUBLIC_FOLDER', 'public');\n }\n\n /** Higher priority `$EDIOTR` variable for indicating which editor to use when pressing `o` in the Terminal UI. */\n get EXPO_EDITOR(): string {\n return string('EXPO_EDITOR', '');\n }\n\n /**\n * Overwrite the dev server URL, disregarding the `--port`, `--host`, `--tunnel`, `--lan`, `--localhost` arguments.\n * This is useful for browser editors that require custom proxy URLs.\n */\n get EXPO_PACKAGER_PROXY_URL(): string {\n // Read from the pre-dotenv env — overrides dev server URL served to clients.\n return getOriginalEnvValue('EXPO_PACKAGER_PROXY_URL') || '';\n }\n\n get EXPO_UNSTABLE_TUNNEL_V2(): boolean {\n return boolish('EXPO_UNSTABLE_TUNNEL_V2', false);\n }\n\n /**\n * **Experimental** - Disable using `exp.direct` as the hostname for\n * `--tunnel` connections. This enables **https://** forwarding which\n * can be used to test universal links on iOS.\n *\n * This may cause issues with `expo-linking` and Expo Go.\n *\n * Select the exact subdomain by passing a string value that is not one of: `true`, `false`, `1`, `0`.\n */\n get EXPO_TUNNEL_SUBDOMAIN(): string | boolean {\n const subdomain = string('EXPO_TUNNEL_SUBDOMAIN', '');\n if (['0', 'false', ''].includes(subdomain)) {\n return false;\n } else if (['1', 'true'].includes(subdomain)) {\n return true;\n }\n return subdomain;\n }\n\n /**\n * Force Expo CLI to use the [`resolver.resolverMainFields`](https://facebook.github.io/metro/docs/configuration/#resolvermainfields) from the project `metro.config.js` for all platforms.\n *\n * By default, Expo CLI will use `['browser', 'module', 'main']` (default for Webpack) for web and the user-defined main fields for other platforms.\n */\n get EXPO_METRO_NO_MAIN_FIELD_OVERRIDE(): boolean {\n return boolish('EXPO_METRO_NO_MAIN_FIELD_OVERRIDE', false);\n }\n\n /**\n * HTTP/HTTPS proxy to connect to for network requests. Configures [https-proxy-agent](https://www.npmjs.com/package/https-proxy-agent).\n */\n get HTTP_PROXY(): string {\n return process.env.HTTP_PROXY || process.env.http_proxy || '';\n }\n\n /**\n * Instructs a different Metro config to be loaded.\n * The path, according to metro-config, should be a path relative to the current working directory.\n * This flag is internal and was added for external tools.\n * @internal\n */\n get EXPO_OVERRIDE_METRO_CONFIG(): string | undefined {\n // Read from the pre-dotenv env — this path is `require()`d as Metro config,\n // so a project `.env` overriding it would execute attacker code in-process.\n return getOriginalEnvValue('EXPO_OVERRIDE_METRO_CONFIG')?.trim() || undefined;\n }\n\n /**\n * Use the network inspector by overriding the metro inspector proxy with a custom version.\n * @deprecated This has been replaced by `@react-native/dev-middleware` and is now unused.\n */\n get EXPO_NO_INSPECTOR_PROXY(): boolean {\n return boolish('EXPO_NO_INSPECTOR_PROXY', false);\n }\n\n /** Disable lazy bundling in Metro bundler. */\n get EXPO_NO_METRO_LAZY() {\n return boolish('EXPO_NO_METRO_LAZY', false);\n }\n\n /**\n * Enable the unstable inverse dependency stack trace for Metro bundling errors.\n * @deprecated This will be removed in the future.\n */\n get EXPO_METRO_UNSTABLE_ERRORS() {\n return boolish('EXPO_METRO_UNSTABLE_ERRORS', true);\n }\n\n /** Disable Environment Variable injection in client bundles. */\n get EXPO_NO_CLIENT_ENV_VARS(): boolean {\n return boolish('EXPO_NO_CLIENT_ENV_VARS', false);\n }\n\n /** Set the default `user` that should be passed to `--user` with ADB commands. Used for installing APKs on Android devices with multiple profiles. Defaults to `0`. */\n get EXPO_ADB_USER(): string {\n return string('EXPO_ADB_USER', '0');\n }\n\n /** Used internally to enable E2E utilities. This behavior is not stable to external users. */\n get __EXPO_E2E_TEST(): boolean {\n return boolish('__EXPO_E2E_TEST', false);\n }\n\n /** Unstable: Force single-bundle exports in production. */\n get EXPO_NO_BUNDLE_SPLITTING(): boolean {\n return boolish('EXPO_NO_BUNDLE_SPLITTING', false);\n }\n\n /**\n * Enable Atlas to gather bundle information during development or export.\n * Note, because this used to be an experimental feature, both `EXPO_ATLAS` and `EXPO_UNSTABLE_ATLAS` are supported.\n */\n get EXPO_ATLAS() {\n return boolish('EXPO_ATLAS', boolish('EXPO_UNSTABLE_ATLAS', false));\n }\n\n /** Unstable: Enable tree shaking for Metro. */\n get EXPO_UNSTABLE_TREE_SHAKING() {\n return boolish('EXPO_UNSTABLE_TREE_SHAKING', false);\n }\n\n /** Unstable: Enable eager bundling where transformation runs uncached after the entire bundle has been created. This is required for production tree shaking and less optimized for development bundling. */\n get EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH() {\n return boolish('EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH', false);\n }\n\n /** Enable the use of Expo's custom metro require implementation. The custom require supports better debugging, tree shaking, and React Server Components. */\n get EXPO_USE_METRO_REQUIRE() {\n return boolish('EXPO_USE_METRO_REQUIRE', false);\n }\n\n /** Internal key used to pass eager bundle data from the CLI to the native run scripts during `npx expo run` commands. */\n get __EXPO_EAGER_BUNDLE_OPTIONS() {\n return getOriginalEnvValue('__EXPO_EAGER_BUNDLE_OPTIONS') || '';\n }\n\n /** Disable server deployment during production builds (during `expo export:embed`). This is useful for testing API routes and server components against a local server. */\n get EXPO_NO_DEPLOY(): boolean {\n return boolish('EXPO_NO_DEPLOY', false);\n }\n\n /** Enable hydration during development when rendering Expo Web */\n get EXPO_WEB_DEV_HYDRATE(): boolean {\n return boolish('EXPO_WEB_DEV_HYDRATE', false);\n }\n\n /** Enable experimental React Server Functions support. */\n get EXPO_UNSTABLE_SERVER_FUNCTIONS(): boolean {\n return boolish('EXPO_UNSTABLE_SERVER_FUNCTIONS', false);\n }\n\n /** Enable unstable/experimental support for deploying the native server in `npx expo run` commands. */\n get EXPO_UNSTABLE_DEPLOY_SERVER(): boolean {\n return boolish('EXPO_UNSTABLE_DEPLOY_SERVER', false);\n }\n\n /** Is running in EAS Build. This is set by EAS: https://docs.expo.dev/eas/environment-variables/ */\n get EAS_BUILD(): boolean {\n return boolish('EAS_BUILD', false);\n }\n\n /** Disable the React Native Directory compatibility check for new architecture when installing packages */\n get EXPO_NO_NEW_ARCH_COMPAT_CHECK(): boolean {\n return boolish('EXPO_NO_NEW_ARCH_COMPAT_CHECK', envIsHeadless());\n }\n\n /** Disable the dependency validation when installing other dependencies and starting the project */\n get EXPO_NO_DEPENDENCY_VALIDATION(): boolean {\n return boolish('EXPO_NO_DEPENDENCY_VALIDATION', envIsHeadless());\n }\n\n /** Force Expo CLI to run in webcontainer mode, this has impact on which URL Expo is using by default */\n get EXPO_FORCE_WEBCONTAINER_ENV(): boolean {\n return boolish('EXPO_FORCE_WEBCONTAINER_ENV', false);\n }\n\n /** Force Expo CLI to run in webcontainer mode, this has impact on which URL Expo is using by default */\n get EXPO_UNSTABLE_WEB_MODAL(): boolean {\n return boolish('EXPO_UNSTABLE_WEB_MODAL', false);\n }\n\n /** Disable @react-navigation checks for expo-router projects */\n get EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK(): boolean {\n return boolish('EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK', false);\n }\n\n /**\n * Disable Material Symbols (`md`) icon support in expo-router's NativeTabs on Android.\n * When enabled, the Metro resolver swaps the Android-specific md icon converter for a no-op\n * stub, so the `expo-symbols` dependency is tree-shaken out of the Android bundle.\n */\n get EXPO_ROUTER_DISABLE_NATIVE_TABS_MD(): boolean {\n return boolish('EXPO_ROUTER_DISABLE_NATIVE_TABS_MD', false);\n }\n\n /** Disable by falsy value live binding in experimental import export support. Enabled by default. */\n get EXPO_UNSTABLE_LIVE_BINDINGS(): boolean {\n return boolish('EXPO_UNSTABLE_LIVE_BINDINGS', true);\n }\n\n /**\n * Enable the experimental MCP integration or further specify the MCP server URL.\n */\n get EXPO_UNSTABLE_MCP_SERVER(): string {\n const value = string('EXPO_UNSTABLE_MCP_SERVER', '');\n if (value === '1' || value.toLowerCase() === 'true') {\n return this.EXPO_STAGING ? 'staging-mcp.expo.dev' : 'mcp.expo.dev';\n }\n // Re-read from the pre-dotenv env — overrides dev server URL served to clients.\n return getOriginalEnvValue('EXPO_UNSTABLE_MCP_SERVER') || '';\n }\n\n /** Enable Expo Log Box for iOS and Android (Web is enabled by default) */\n get EXPO_UNSTABLE_LOG_BOX(): boolean {\n return boolish('EXPO_UNSTABLE_LOG_BOX', false);\n }\n\n /**\n * Enable Bonjour advertising of the Expo CLI on local networks\n */\n get EXPO_UNSTABLE_BONJOUR(): boolean {\n return boolish('EXPO_UNSTABLE_BONJOUR', !envIsHeadless());\n }\n\n /** @internal Configure other environment variables for headless operations */\n get EXPO_UNSTABLE_HEADLESS() {\n return boolish('EXPO_UNSTABLE_HEADLESS', envIsWebcontainer());\n }\n}\n\nexport const env = new Env();\n\nexport function envIsWebcontainer() {\n // See: https://github.com/unjs/std-env/blob/4b1e03c4efce58249858efc2cc5f5eac727d0adb/src/providers.ts#L134-L143\n return (\n env.EXPO_FORCE_WEBCONTAINER_ENV ||\n (process.env.SHELL === '/bin/jsh' && !!process.versions.webcontainer)\n );\n}\n\nexport function envIsHeadless() {\n return env.EXPO_UNSTABLE_HEADLESS;\n}\n"],"names":["env","envIsHeadless","envIsWebcontainer","Env","EXPO_PROFILE","boolish","EXPO_DEBUG","EXPO_OFFLINE","EXPO_BETA","EXPO_STAGING","EXPO_LOCAL","CI","ci","process","toLowerCase","EXPO_NO_TELEMETRY","EXPO_NO_TELEMETRY_DETACH","EXPO_UNIVERSE_DIR","getOriginalEnvValue","WEB_HOST","string","EXPO_NO_GIT_STATUS","EXPO_NO_WEB_SETUP","EXPO_NO_TYPESCRIPT_SETUP","EXPO_NO_CACHE","EXPO_NO_REDIRECT_PAGE","EXPO_NO_QR_CODE","EXPO_RUN_PREFER_APP_CONFIG_ID","RCT_METRO_PORT","int","EXPO_SKIP_MANIFEST_VALIDATION_TOKEN","EXPO_PUBLIC_FOLDER","EXPO_EDITOR","EXPO_PACKAGER_PROXY_URL","EXPO_UNSTABLE_TUNNEL_V2","EXPO_TUNNEL_SUBDOMAIN","subdomain","includes","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","HTTP_PROXY","http_proxy","EXPO_OVERRIDE_METRO_CONFIG","trim","undefined","EXPO_NO_INSPECTOR_PROXY","EXPO_NO_METRO_LAZY","EXPO_METRO_UNSTABLE_ERRORS","EXPO_NO_CLIENT_ENV_VARS","EXPO_ADB_USER","__EXPO_E2E_TEST","EXPO_NO_BUNDLE_SPLITTING","EXPO_ATLAS","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","EXPO_USE_METRO_REQUIRE","__EXPO_EAGER_BUNDLE_OPTIONS","EXPO_NO_DEPLOY","EXPO_WEB_DEV_HYDRATE","EXPO_UNSTABLE_SERVER_FUNCTIONS","EXPO_UNSTABLE_DEPLOY_SERVER","EAS_BUILD","EXPO_NO_NEW_ARCH_COMPAT_CHECK","EXPO_NO_DEPENDENCY_VALIDATION","EXPO_FORCE_WEBCONTAINER_ENV","EXPO_UNSTABLE_WEB_MODAL","EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK","EXPO_ROUTER_DISABL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IAAI2D,0BAAmC;QACrC,OAAO3D,IAAAA,iBAAO,EAAC,2BAA2B;IAC5C;IAEA,8DAA8D,GAC9D,IAAI4D,0CAAmD;QACrD,OAAO5D,IAAAA,iBAAO,EAAC,2CAA2C;IAC5D;IAEA;;;;GAIC,GACD,IAAI6D,qCAA8C;QAChD,OAAO7D,IAAAA,iBAAO,EAAC,sCAAsC;IACvD;IAEA,mGAAmG,GACnG,IAAI8D,8BAAuC;QACzC,OAAO9D,IAAAA,iBAAO,EAAC,+BAA+B;IAChD;IAEA;;GAEC,GACD,IAAI+D,2BAAmC;QACrC,MAAMC,QAAQjD,IAAAA,gBAAM,EAAC,4BAA4B;QACjD,IAAIiD,UAAU,OAAOA,MAAMvD,WAAW,OAAO,QAAQ;YACnD,OAAO,IAAI,CAACL,YAAY,GAAG,yBAAyB;QACtD;QACA,gFAAgF;QAChF,OAAOS,IAAAA,0BAAmB,EAAC,+BAA+B;IAC5D;IAEA,wEAAwE,GACxE,IAAIoD,wBAAiC;QACnC,OAAOjE,IAAAA,iBAAO,EAAC,yBAAyB;IAC1C;IAEA;;GAEC,GACD,IAAIkE,wBAAiC;QACnC,OAAOlE,IAAAA,iBAAO,EAAC,yBAAyB,CAACJ;IAC3C;IAEA,4EAA4E,GAC5E,IAAIuE,yBAAyB;QAC3B,OAAOnE,IAAAA,iBAAO,EAAC,0BAA0BH;IAC3C;AACF;AAEO,MAAMF,MAAM,IAAIG;AAEhB,SAASD;IACd,gHAAgH;IAChH,OACEF,IAAI+D,2BAA2B,IAC9BlD,sBAAO,CAACb,GAAG,CAACyE,KAAK,KAAK,cAAc,CAAC,CAAC5D,sBAAO,CAAC6D,QAAQ,CAACC,YAAY;AAExE;AAEO,SAAS1E;IACd,OAAOD,IAAIwE,sBAAsB;AACnC"}
|
package/build/src/utils/obj.js
CHANGED
|
@@ -24,7 +24,7 @@ function get(obj, key) {
|
|
|
24
24
|
let current = obj;
|
|
25
25
|
let branch;
|
|
26
26
|
while(branch = branches.shift()){
|
|
27
|
-
if (!(branch in current)) {
|
|
27
|
+
if (current == null || typeof current !== 'object' || !(branch in current)) {
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
30
|
current = current[branch];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/obj.ts"],"sourcesContent":["/** `lodash.get` */\nexport function get(obj: any, key: string): any | null {\n const branches = key.split('.');\n let current: any = obj;\n let branch: string | undefined;\n while ((branch = branches.shift())) {\n if (!(branch in current)) {\n return null;\n }\n current = current[branch];\n }\n return current;\n}\n\n/** `lodash.set` */\nexport function set(obj: any, key: string, value: any): any | null {\n const branches = key.split('.');\n let current: any = obj;\n let branch: string | undefined;\n while ((branch = branches.shift())) {\n if (branch === '__proto__' || branch === 'constructor' || branch === 'prototype') {\n return obj;\n }\n\n if (branches.length === 0) {\n current[branch] = value;\n return obj;\n }\n\n if (!(branch in current)) {\n current[branch] = {};\n }\n\n current = current[branch];\n }\n return null;\n}\n\n/** `lodash.pickBy` */\nexport function pickBy<T>(\n obj: { [key: string]: T },\n predicate: (value: T, key: string) => boolean | undefined\n) {\n return Object.entries(obj).reduce(\n (acc, [key, value]) => {\n if (predicate(value, key)) {\n acc[key] = value;\n }\n return acc;\n },\n {} as { [key: string]: T }\n );\n}\n"],"names":["get","pickBy","set","obj","key","branches","split","current","branch","shift","value","length","predicate","Object","entries","reduce","acc"],"mappings":"AAAA,iBAAiB;;;;;;;;;;;QACDA;eAAAA;;QAsCAC;eAAAA;;QAxBAC;eAAAA;;;AAdT,SAASF,IAAIG,GAAQ,EAAEC,GAAW;IACvC,MAAMC,WAAWD,IAAIE,KAAK,CAAC;IAC3B,IAAIC,UAAeJ;IACnB,IAAIK;IACJ,MAAQA,SAASH,SAASI,KAAK,GAAK;QAClC,
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/obj.ts"],"sourcesContent":["/** `lodash.get` */\nexport function get(obj: any, key: string): any | null {\n const branches = key.split('.');\n let current: any = obj;\n let branch: string | undefined;\n while ((branch = branches.shift())) {\n if (current == null || typeof current !== 'object' || !(branch in current)) {\n return null;\n }\n current = current[branch];\n }\n return current;\n}\n\n/** `lodash.set` */\nexport function set(obj: any, key: string, value: any): any | null {\n const branches = key.split('.');\n let current: any = obj;\n let branch: string | undefined;\n while ((branch = branches.shift())) {\n if (branch === '__proto__' || branch === 'constructor' || branch === 'prototype') {\n return obj;\n }\n\n if (branches.length === 0) {\n current[branch] = value;\n return obj;\n }\n\n if (!(branch in current)) {\n current[branch] = {};\n }\n\n current = current[branch];\n }\n return null;\n}\n\n/** `lodash.pickBy` */\nexport function pickBy<T>(\n obj: { [key: string]: T },\n predicate: (value: T, key: string) => boolean | undefined\n) {\n return Object.entries(obj).reduce(\n (acc, [key, value]) => {\n if (predicate(value, key)) {\n acc[key] = value;\n }\n return acc;\n },\n {} as { [key: string]: T }\n );\n}\n"],"names":["get","pickBy","set","obj","key","branches","split","current","branch","shift","value","length","predicate","Object","entries","reduce","acc"],"mappings":"AAAA,iBAAiB;;;;;;;;;;;QACDA;eAAAA;;QAsCAC;eAAAA;;QAxBAC;eAAAA;;;AAdT,SAASF,IAAIG,GAAQ,EAAEC,GAAW;IACvC,MAAMC,WAAWD,IAAIE,KAAK,CAAC;IAC3B,IAAIC,UAAeJ;IACnB,IAAIK;IACJ,MAAQA,SAASH,SAASI,KAAK,GAAK;QAClC,IAAIF,WAAW,QAAQ,OAAOA,YAAY,YAAY,CAAEC,CAAAA,UAAUD,OAAM,GAAI;YAC1E,OAAO;QACT;QACAA,UAAUA,OAAO,CAACC,OAAO;IAC3B;IACA,OAAOD;AACT;AAGO,SAASL,IAAIC,GAAQ,EAAEC,GAAW,EAAEM,KAAU;IACnD,MAAML,WAAWD,IAAIE,KAAK,CAAC;IAC3B,IAAIC,UAAeJ;IACnB,IAAIK;IACJ,MAAQA,SAASH,SAASI,KAAK,GAAK;QAClC,IAAID,WAAW,eAAeA,WAAW,iBAAiBA,WAAW,aAAa;YAChF,OAAOL;QACT;QAEA,IAAIE,SAASM,MAAM,KAAK,GAAG;YACzBJ,OAAO,CAACC,OAAO,GAAGE;YAClB,OAAOP;QACT;QAEA,IAAI,CAAEK,CAAAA,UAAUD,OAAM,GAAI;YACxBA,OAAO,CAACC,OAAO,GAAG,CAAC;QACrB;QAEAD,UAAUA,OAAO,CAACC,OAAO;IAC3B;IACA,OAAO;AACT;AAGO,SAASP,OACdE,GAAyB,EACzBS,SAAyD;IAEzD,OAAOC,OAAOC,OAAO,CAACX,KAAKY,MAAM,CAC/B,CAACC,KAAK,CAACZ,KAAKM,MAAM;QAChB,IAAIE,UAAUF,OAAON,MAAM;YACzBY,GAAG,CAACZ,IAAI,GAAGM;QACb;QACA,OAAOM;IACT,GACA,CAAC;AAEL"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get getParentCommand () {
|
|
13
|
+
return getParentCommand;
|
|
14
|
+
},
|
|
15
|
+
get markAsParentCommand () {
|
|
16
|
+
return markAsParentCommand;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
let parentCommand;
|
|
20
|
+
function getParentCommand() {
|
|
21
|
+
return parentCommand;
|
|
22
|
+
}
|
|
23
|
+
function markAsParentCommand(command) {
|
|
24
|
+
// EAS CLI uses the same variable name and the same `<cli> <command>` value. Do not change them.
|
|
25
|
+
parentCommand = process.env.__EXPO_PARENT_COMMAND || undefined;
|
|
26
|
+
process.env.__EXPO_PARENT_COMMAND = command;
|
|
27
|
+
return parentCommand;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=parentCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/parentCommand.ts"],"sourcesContent":["let parentCommand: string | undefined;\n\n/** The Expo CLI or EAS CLI command that started this process. */\nexport function getParentCommand(): string | undefined {\n return parentCommand;\n}\n\n/** Makes child processes report `command` as their parent command. */\nexport function markAsParentCommand(command: string): string | undefined {\n // EAS CLI uses the same variable name and the same `<cli> <command>` value. Do not change them.\n parentCommand = process.env.__EXPO_PARENT_COMMAND || undefined;\n process.env.__EXPO_PARENT_COMMAND = command;\n return parentCommand;\n}\n"],"names":["getParentCommand","markAsParentCommand","parentCommand","command","process","env","__EXPO_PARENT_COMMAND","undefined"],"mappings":";;;;;;;;;;;QAGgBA;eAAAA;;QAKAC;eAAAA;;;AARhB,IAAIC;AAGG,SAASF;IACd,OAAOE;AACT;AAGO,SAASD,oBAAoBE,OAAe;IACjD,gGAAgG;IAChGD,gBAAgBE,QAAQC,GAAG,CAACC,qBAAqB,IAAIC;IACrDH,QAAQC,GAAG,CAACC,qBAAqB,GAAGH;IACpC,OAAOD;AACT"}
|
|
@@ -26,7 +26,7 @@ class FetchClient {
|
|
|
26
26
|
this.headers = {
|
|
27
27
|
accept: 'application/json',
|
|
28
28
|
'content-type': 'application/json',
|
|
29
|
-
'user-agent': `expo-cli/${"57.0.
|
|
29
|
+
'user-agent': `expo-cli/${"57.0.35"}`,
|
|
30
30
|
authorization: 'Basic ' + _nodebuffer().Buffer.from(`${target}:`).toString('base64')
|
|
31
31
|
};
|
|
32
32
|
}
|
|
@@ -23,6 +23,7 @@ function _os() {
|
|
|
23
23
|
return data;
|
|
24
24
|
}
|
|
25
25
|
const _array = require("../../array");
|
|
26
|
+
const _parentCommand = require("../../parentCommand");
|
|
26
27
|
function _interop_require_default(obj) {
|
|
27
28
|
return obj && obj.__esModule ? obj : {
|
|
28
29
|
default: obj
|
|
@@ -83,8 +84,9 @@ function createContext() {
|
|
|
83
84
|
cpu: summarizeCpuInfo(),
|
|
84
85
|
app: {
|
|
85
86
|
name: 'expo/cli',
|
|
86
|
-
version: "57.0.
|
|
87
|
+
version: "57.0.35"
|
|
87
88
|
},
|
|
89
|
+
parent_command: (0, _parentCommand.getParentCommand)(),
|
|
88
90
|
ci: _ciinfo().isCI ? {
|
|
89
91
|
name: _ciinfo().name,
|
|
90
92
|
isPr: _ciinfo().isPR
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/utils/telemetry/utils/context.ts"],"sourcesContent":["import * as ciInfo from 'ci-info';\nimport os from 'os';\n\nimport { groupBy } from '../../array';\n\nexport function createContext() {\n return {\n os: { name: os.platform(), version: os.release(), node: process.versions.node },\n device: { arch: os.arch(), memory: summarizeMemory() },\n cpu: summarizeCpuInfo(),\n app: { name: 'expo/cli', version: process.env.__EXPO_VERSION },\n ci: ciInfo.isCI ? { name: ciInfo.name, isPr: ciInfo.isPR } : undefined,\n };\n}\n\nfunction summarizeMemory() {\n const gb = os.totalmem() / 1024 / 1024 / 1024;\n return Math.round(gb * 100) / 100;\n}\n\nfunction summarizeCpuInfo() {\n const cpus = groupBy(os.cpus() ?? [], (item) => item.model);\n const summary = { model: '', speed: 0, count: 0 };\n\n for (const key in cpus) {\n if (cpus[key]!.length > summary.count) {\n summary.model = key;\n summary.speed = cpus[key]![0]?.speed ?? 0;\n summary.count = cpus[key]!.length;\n }\n }\n\n return !summary.model || !summary.count ? undefined : summary;\n}\n"],"names":["createContext","os","name","platform","version","release","node","process","versions","device","arch","memory","summarizeMemory","cpu","summarizeCpuInfo","app","env","__EXPO_VERSION","ci","ciInfo","isCI","isPr","isPR","undefined","gb","totalmem","Math","round","cpus","groupBy","item","model","summary","speed","count","key","length"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../../../../../src/utils/telemetry/utils/context.ts"],"sourcesContent":["import * as ciInfo from 'ci-info';\nimport os from 'os';\n\nimport { groupBy } from '../../array';\nimport { getParentCommand } from '../../parentCommand';\n\nexport function createContext() {\n return {\n os: { name: os.platform(), version: os.release(), node: process.versions.node },\n device: { arch: os.arch(), memory: summarizeMemory() },\n cpu: summarizeCpuInfo(),\n app: { name: 'expo/cli', version: process.env.__EXPO_VERSION },\n parent_command: getParentCommand(),\n ci: ciInfo.isCI ? { name: ciInfo.name, isPr: ciInfo.isPR } : undefined,\n };\n}\n\nfunction summarizeMemory() {\n const gb = os.totalmem() / 1024 / 1024 / 1024;\n return Math.round(gb * 100) / 100;\n}\n\nfunction summarizeCpuInfo() {\n const cpus = groupBy(os.cpus() ?? [], (item) => item.model);\n const summary = { model: '', speed: 0, count: 0 };\n\n for (const key in cpus) {\n if (cpus[key]!.length > summary.count) {\n summary.model = key;\n summary.speed = cpus[key]![0]?.speed ?? 0;\n summary.count = cpus[key]!.length;\n }\n }\n\n return !summary.model || !summary.count ? undefined : summary;\n}\n"],"names":["createContext","os","name","platform","version","release","node","process","versions","device","arch","memory","summarizeMemory","cpu","summarizeCpuInfo","app","env","__EXPO_VERSION","parent_command","getParentCommand","ci","ciInfo","isCI","isPr","isPR","undefined","gb","totalmem","Math","round","cpus","groupBy","item","model","summary","speed","count","key","length"],"mappings":";;;;+BAMgBA;;;eAAAA;;;;iEANQ;;;;;;;gEACT;;;;;;uBAES;+BACS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,SAASA;IACd,OAAO;QACLC,IAAI;YAAEC,MAAMD,aAAE,CAACE,QAAQ;YAAIC,SAASH,aAAE,CAACI,OAAO;YAAIC,MAAMC,QAAQC,QAAQ,CAACF,IAAI;QAAC;QAC9EG,QAAQ;YAAEC,MAAMT,aAAE,CAACS,IAAI;YAAIC,QAAQC;QAAkB;QACrDC,KAAKC;QACLC,KAAK;YAAEb,MAAM;YAAYE,SAASG,QAAQS,GAAG,CAACC,cAAc;QAAC;QAC7DC,gBAAgBC,IAAAA,+BAAgB;QAChCC,IAAIC,UAAOC,IAAI,GAAG;YAAEpB,MAAMmB,UAAOnB,IAAI;YAAEqB,MAAMF,UAAOG,IAAI;QAAC,IAAIC;IAC/D;AACF;AAEA,SAASb;IACP,MAAMc,KAAKzB,aAAE,CAAC0B,QAAQ,KAAK,OAAO,OAAO;IACzC,OAAOC,KAAKC,KAAK,CAACH,KAAK,OAAO;AAChC;AAEA,SAASZ;IACP,MAAMgB,OAAOC,IAAAA,cAAO,EAAC9B,aAAE,CAAC6B,IAAI,MAAM,EAAE,EAAE,CAACE,OAASA,KAAKC,KAAK;IAC1D,MAAMC,UAAU;QAAED,OAAO;QAAIE,OAAO;QAAGC,OAAO;IAAE;IAEhD,IAAK,MAAMC,OAAOP,KAAM;QACtB,IAAIA,IAAI,CAACO,IAAI,CAAEC,MAAM,GAAGJ,QAAQE,KAAK,EAAE;gBAErBN;YADhBI,QAAQD,KAAK,GAAGI;YAChBH,QAAQC,KAAK,GAAGL,EAAAA,aAAAA,IAAI,CAACO,IAAI,AAAC,CAAC,EAAE,qBAAbP,WAAeK,KAAK,KAAI;YACxCD,QAAQE,KAAK,GAAGN,IAAI,CAACO,IAAI,CAAEC,MAAM;QACnC;IACF;IAEA,OAAO,CAACJ,QAAQD,KAAK,IAAI,CAACC,QAAQE,KAAK,GAAGX,YAAYS;AACxD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "57.0.
|
|
3
|
+
"version": "57.0.35",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "main.js",
|
|
6
6
|
"bin": {
|
|
@@ -38,30 +38,30 @@
|
|
|
38
38
|
"homepage": "https://github.com/expo/expo/tree/main/packages/@expo/cli",
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@expo/code-signing-certificates": "^0.0.6",
|
|
41
|
-
"@expo/config": "~57.0.
|
|
42
|
-
"@expo/config-plugins": "~57.0.
|
|
41
|
+
"@expo/config": "~57.0.12",
|
|
42
|
+
"@expo/config-plugins": "~57.0.13",
|
|
43
43
|
"@expo/devcert": "^1.2.1",
|
|
44
44
|
"@expo/env": "~2.4.4",
|
|
45
45
|
"@expo/image-utils": "^0.11.7",
|
|
46
|
-
"@expo/inline-modules": "^0.1.
|
|
46
|
+
"@expo/inline-modules": "^0.1.10",
|
|
47
47
|
"@expo/json-file": "^11.0.1",
|
|
48
48
|
"@expo/log-box": "^57.0.5",
|
|
49
49
|
"@expo/metro": "~56.0.2",
|
|
50
50
|
"@expo/metro-config": "~57.0.14",
|
|
51
|
-
"@expo/metro-file-map": "^57.0.
|
|
51
|
+
"@expo/metro-file-map": "^57.0.5",
|
|
52
52
|
"@expo/osascript": "^2.7.1",
|
|
53
53
|
"@expo/package-manager": "^1.13.1",
|
|
54
54
|
"@expo/plist": "^0.8.2",
|
|
55
|
-
"@expo/prebuild-config": "^57.0.
|
|
55
|
+
"@expo/prebuild-config": "^57.0.21",
|
|
56
56
|
"@expo/require-utils": "^57.0.7",
|
|
57
|
-
"@expo/router-server": "^57.0.
|
|
57
|
+
"@expo/router-server": "^57.0.16",
|
|
58
58
|
"@expo/schema-utils": "^57.0.3",
|
|
59
59
|
"@expo/spawn-async": "^1.8.0",
|
|
60
60
|
"@expo/ws-tunnel": "^2.0.0",
|
|
61
61
|
"@expo/xcpretty": "^4.4.4",
|
|
62
62
|
"@react-native/dev-middleware": "0.86.3",
|
|
63
63
|
"accepts": "^1.3.8",
|
|
64
|
-
"agent-cli-detector": "0.1.
|
|
64
|
+
"agent-cli-detector": "^0.1.8",
|
|
65
65
|
"arg": "^5.0.2",
|
|
66
66
|
"bplist-creator": "0.1.0",
|
|
67
67
|
"bplist-parser": "^0.3.1",
|
|
@@ -161,13 +161,13 @@
|
|
|
161
161
|
"taskr": "^1.1.0",
|
|
162
162
|
"tree-kill": "^1.2.2",
|
|
163
163
|
"zod": "^3.25.76",
|
|
164
|
-
"@expo/fingerprint": "0.20.
|
|
165
|
-
"expo": "57.0.
|
|
166
|
-
"expo-
|
|
167
|
-
"expo-
|
|
168
|
-
"expo-
|
|
164
|
+
"@expo/fingerprint": "0.20.17",
|
|
165
|
+
"expo": "57.0.34",
|
|
166
|
+
"expo-router": "57.0.32",
|
|
167
|
+
"expo-modules-autolinking": "57.0.18",
|
|
168
|
+
"expo-module-scripts": "56.0.3"
|
|
169
169
|
},
|
|
170
|
-
"gitHead": "
|
|
170
|
+
"gitHead": "14616b4ffe6167019952be745310f563d15bf68a",
|
|
171
171
|
"scripts": {
|
|
172
172
|
"build": "taskr",
|
|
173
173
|
"clean": "expo-module clean",
|