@expo/cli 0.20.2 → 0.20.4

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 CHANGED
@@ -120,7 +120,7 @@ const args = (0, _arg().default)({
120
120
  });
121
121
  if (args["--version"]) {
122
122
  // Version is added in the build script.
123
- console.log("0.20.2");
123
+ console.log("0.20.4");
124
124
  process.exit(0);
125
125
  }
126
126
  if (args["--non-interactive"]) {
@@ -73,7 +73,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
73
73
  }
74
74
  const debug = require("debug")("expo:install:check");
75
75
  async function checkPackagesAsync(projectRoot, { packages , packageManager , options: { fix } , packageManagerArguments }) {
76
- var ref, ref1, ref2;
76
+ var ref, ref1, ref2, ref3;
77
77
  // Read the project Expo config without plugins.
78
78
  const { exp , pkg } = (0, _config().getConfig)(projectRoot, {
79
79
  // Sometimes users will add a plugin to the config before installing the library,
@@ -84,6 +84,18 @@ async function checkPackagesAsync(projectRoot, { packages , packageManager , opt
84
84
  _log.log((0, _chalk().default)`Skipped ${fix ? "fixing" : "checking"} dependencies: ${(0, _strings.joinWithCommasAnd)(pkg.expo.install.exclude)}. These dependencies are listed in {bold expo.install.exclude} in package.json. ${(0, _link.learnMore)("https://docs.expo.dev/more/expo-cli/#configuring-dependency-validation")}`);
85
85
  }
86
86
  const dependencies = await (0, _validateDependenciesVersions.getVersionedDependenciesAsync)(projectRoot, exp, pkg, packages);
87
+ /*
88
+ * Expo Router projects will do this additional check
89
+ * Note: The e2e tests use nexpo which will always resolve 'expo-router/doctor.js'
90
+ * For that reason, you cannot use nexpo to test for the sub-dependency check,
91
+ * and you cannot replace this guard with a try/catch around the import('expo-router')
92
+ */ if ((ref3 = pkg.dependencies) == null ? void 0 : ref3["expo-router"]) {
93
+ const { doctor: routerDoctor } = await Promise.resolve().then(()=>/*#__PURE__*/ _interopRequireWildcard(require("expo-router/doctor.js")));
94
+ dependencies.push(...routerDoctor(pkg, require.resolve("@react-navigation/native"), {
95
+ bold: _chalk().default.bold,
96
+ learnMore: _link.learnMore
97
+ }));
98
+ }
87
99
  if (!dependencies.length) {
88
100
  _log.exit(_chalk().default.greenBright("Dependencies are up to date"), 0);
89
101
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/install/checkPackages.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport { fixPackagesAsync } from './fixPackages';\nimport { Options } from './resolveOptions';\nimport * as Log from '../log';\nimport {\n getVersionedDependenciesAsync,\n logIncorrectDependencies,\n} from '../start/doctor/dependencies/validateDependenciesVersions';\nimport { isInteractive } from '../utils/interactive';\nimport { learnMore } from '../utils/link';\nimport { confirmAsync } from '../utils/prompts';\nimport { joinWithCommasAnd } from '../utils/strings';\n\nconst debug = require('debug')('expo:install:check') as typeof console.log;\n\n/**\n * Handles `expo install --fix|check'.\n * Checks installed dependencies against bundledNativeModules and versions endpoints to find any incompatibilities.\n * If `--fix` is passed, it will install the correct versions of the dependencies.\n * If `--check` is passed, it will prompt the user to install the correct versions of the dependencies (on interactive terminal).\n */\nexport async function checkPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n options: { fix },\n packageManagerArguments,\n }: {\n /**\n * List of packages to version\n * @example ['uuid', 'react-native-reanimated@latest']\n */\n packages: string[];\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n\n /** How the check should resolve */\n options: Pick<Options, 'fix'>;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n) {\n // Read the project Expo config without plugins.\n const { exp, pkg } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n if (pkg.expo?.install?.exclude?.length) {\n Log.log(\n chalk`Skipped ${fix ? 'fixing' : 'checking'} dependencies: ${joinWithCommasAnd(\n pkg.expo.install.exclude\n )}. These dependencies are listed in {bold expo.install.exclude} in package.json. ${learnMore(\n 'https://docs.expo.dev/more/expo-cli/#configuring-dependency-validation'\n )}`\n );\n }\n\n const dependencies = await getVersionedDependenciesAsync(projectRoot, exp, pkg, packages);\n\n if (!dependencies.length) {\n Log.exit(chalk.greenBright('Dependencies are up to date'), 0);\n }\n\n logIncorrectDependencies(dependencies);\n\n const value =\n // If `--fix` then always fix.\n fix ||\n // Otherwise prompt to fix when not running in CI.\n (isInteractive() && (await confirmAsync({ message: 'Fix dependencies?' }).catch(() => false)));\n\n if (value) {\n debug('Installing fixed dependencies:', dependencies);\n // Install the corrected dependencies.\n return fixPackagesAsync(projectRoot, {\n packageManager,\n packages: dependencies,\n packageManagerArguments,\n sdkVersion: exp.sdkVersion!,\n });\n }\n // Exit with non-zero exit code if any of the dependencies are out of date.\n Log.exit(chalk.red('Found outdated dependencies'), 1);\n}\n"],"names":["checkPackagesAsync","debug","require","projectRoot","packages","packageManager","options","fix","packageManagerArguments","pkg","exp","getConfig","skipPlugins","expo","install","exclude","length","Log","log","chalk","joinWithCommasAnd","learnMore","dependencies","getVersionedDependenciesAsync","exit","greenBright","logIncorrectDependencies","value","isInteractive","confirmAsync","message","catch","fixPackagesAsync","sdkVersion","red"],"mappings":"AAAA;;;;+BAwBsBA,oBAAkB;;aAAlBA,kBAAkB;;;yBAxBd,cAAc;;;;;;;8DAEtB,OAAO;;;;;;6BAEQ,eAAe;2DAE3B,QAAQ;8CAItB,2DAA2D;6BACpC,sBAAsB;sBAC1B,eAAe;yBACZ,kBAAkB;yBACb,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,AAAsB,AAAC;AAQpE,eAAeF,kBAAkB,CACtCG,WAAmB,EACnB,EACEC,QAAQ,CAAA,EACRC,cAAc,CAAA,EACdC,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ACqB,IAAAA,YAAa,cAAA,GAAE,IAAK,MAAMC,IAAAA,QAAY,aAAA,EAAC;QAAEC,OAAO,EAAE,mBAAmB;KAAE,CAAC,CAACC,KAAK,CAAC,IAAM,KAAK,CAAC,AAAC,CAAC,AAAC;IAEjG,IAAIJ,KAAK,EAAE;QACT1B,KAAK,CAAC,gCAAgC,EAAEqB,YAAY,CAAC,CAAC;QACtD,sCAAsC;QACtC,OAAOU,IAAAA,YAAgB,iBAAA,EAAC7B,WAAW,EAAE;YACnCE,cAAc;YACdD,QAAQ,EAAEkB,YAAY;YACtBd,uBAAuB;YACvByB,UAAU,EAAEvB,GAAG,CAACuB,UAAU;SAC3B,CAAC,CAAC;IACL,CAAC;IACD,2EAA2E;IAC3EhB,IAAG,CAACO,IAAI,CAACL,MAAK,EAAA,QAAA,CAACe,GAAG,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC,CAAC;AACxD,CAAC"}
1
+ {"version":3,"sources":["../../../src/install/checkPackages.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport { fixPackagesAsync } from './fixPackages';\nimport { Options } from './resolveOptions';\nimport * as Log from '../log';\nimport {\n getVersionedDependenciesAsync,\n logIncorrectDependencies,\n} from '../start/doctor/dependencies/validateDependenciesVersions';\nimport { isInteractive } from '../utils/interactive';\nimport { learnMore } from '../utils/link';\nimport { confirmAsync } from '../utils/prompts';\nimport { joinWithCommasAnd } from '../utils/strings';\n\nconst debug = require('debug')('expo:install:check') as typeof console.log;\n\n/**\n * Handles `expo install --fix|check'.\n * Checks installed dependencies against bundledNativeModules and versions endpoints to find any incompatibilities.\n * If `--fix` is passed, it will install the correct versions of the dependencies.\n * If `--check` is passed, it will prompt the user to install the correct versions of the dependencies (on interactive terminal).\n */\nexport async function checkPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n options: { fix },\n packageManagerArguments,\n }: {\n /**\n * List of packages to version\n * @example ['uuid', 'react-native-reanimated@latest']\n */\n packages: string[];\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n\n /** How the check should resolve */\n options: Pick<Options, 'fix'>;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n) {\n // Read the project Expo config without plugins.\n const { exp, pkg } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n if (pkg.expo?.install?.exclude?.length) {\n Log.log(\n chalk`Skipped ${fix ? 'fixing' : 'checking'} dependencies: ${joinWithCommasAnd(\n pkg.expo.install.exclude\n )}. These dependencies are listed in {bold expo.install.exclude} in package.json. ${learnMore(\n 'https://docs.expo.dev/more/expo-cli/#configuring-dependency-validation'\n )}`\n );\n }\n\n const dependencies = await getVersionedDependenciesAsync(projectRoot, exp, pkg, packages);\n\n /*\n * Expo Router projects will do this additional check\n * Note: The e2e tests use nexpo which will always resolve 'expo-router/doctor.js'\n * For that reason, you cannot use nexpo to test for the sub-dependency check,\n * and you cannot replace this guard with a try/catch around the import('expo-router')\n */\n if (pkg.dependencies?.['expo-router']) {\n const { doctor: routerDoctor } = await import('expo-router/doctor.js');\n dependencies.push(\n ...routerDoctor(pkg, require.resolve('@react-navigation/native'), {\n bold: chalk.bold,\n learnMore,\n })\n );\n }\n\n if (!dependencies.length) {\n Log.exit(chalk.greenBright('Dependencies are up to date'), 0);\n }\n\n logIncorrectDependencies(dependencies);\n\n const value =\n // If `--fix` then always fix.\n fix ||\n // Otherwise prompt to fix when not running in CI.\n (isInteractive() && (await confirmAsync({ message: 'Fix dependencies?' }).catch(() => false)));\n\n if (value) {\n debug('Installing fixed dependencies:', dependencies);\n // Install the corrected dependencies.\n return fixPackagesAsync(projectRoot, {\n packageManager,\n packages: dependencies,\n packageManagerArguments,\n sdkVersion: exp.sdkVersion!,\n });\n }\n\n // Exit with non-zero exit code if any of the dependencies are out of date.\n Log.exit(chalk.red('Found outdated dependencies'), 1);\n}\n"],"names":["checkPackagesAsync","debug","require","projectRoot","packages","packageManager","options","fix","packageManagerArguments","pkg","exp","getConfig","skipPlugins","expo","install","exclude","length","Log","log","chalk","joinWithCommasAnd","learnMore","dependencies","getVersionedDependenciesAsync","doctor","routerDoctor","push","resolve","bold","exit","greenBright","logIncorrectDependencies","value","isInteractive","confirmAsync","message","catch","fixPackagesAsync","sdkVersion","red"],"mappings":"AAAA;;;;+BAwBsBA,oBAAkB;;aAAlBA,kBAAkB;;;yBAxBd,cAAc;;;;;;;8DAEtB,OAAO;;;;;;6BAEQ,eAAe;2DAE3B,QAAQ;8CAItB,2DAA2D;6BACpC,sBAAsB;sBAC1B,eAAe;yBACZ,kBAAkB;yBACb,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,AAAsB,AAAC;AAQpE,eAAeF,kBAAkB,CACtCG,WAAmB,EACnB,EACEC,QAAQ,CAAA,EACRC,cAAc,CAAA,EACdC,OAAO,EAAE,EAAEC,GAAG,CAAA,EAAE,CAAA,EAChBC,uBAAuB,CAAA,EAiBxB,EACD;QAQIC,GAAQ,cAkBRA,IAAgB;IAzBpB,gDAAgD;IAChD,MAAM,EAAEC,GAAG,CAAA,EAAED,GAAG,CAAA,EAAE,GAAGE,IAAAA,OAAS,EAAA,UAAA,EAACR,WAAW,EAAE;QAC1C,iFAAiF;QACjF,yEAAyE;QACzES,WAAW,EAAE,IAAI;KAClB,CAAC,AAAC;IAEH,IAAIH,CAAAA,GAAQ,GAARA,GAAG,CAACI,IAAI,SAAS,GAAjBJ,KAAAA,CAAiB,GAAjBA,QAAAA,GAAQ,CAAEK,OAAO,SAAA,GAAjBL,KAAAA,CAAiB,GAAjBA,aAAmBM,OAAO,SAAT,GAAjBN,KAAAA,CAAiB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AA,GAAE,IAAK,MAAMC,IAAAA,QAAY,aAAA,EAAC;QAAEC,OAAO,EAAE,mBAAmB;KAAE,CAAC,CAACC,KAAK,CAAC,IAAM,KAAK,CAAC,AAAC,CAAC,AAAC;IAEjG,IAAIJ,KAAK,EAAE;QACT/B,KAAK,CAAC,gCAAgC,EAAEqB,YAAY,CAAC,CAAC;QACtD,sCAAsC;QACtC,OAAOe,IAAAA,YAAgB,iBAAA,EAAClC,WAAW,EAAE;YACnCE,cAAc;YACdD,QAAQ,EAAEkB,YAAY;YACtBd,uBAAuB;YACvB8B,UAAU,EAAE5B,GAAG,CAAC4B,UAAU;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,2EAA2E;IAC3ErB,IAAG,CAACY,IAAI,CAACV,MAAK,EAAA,QAAA,CAACoB,GAAG,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC,CAAC;AACxD,CAAC"}
@@ -29,6 +29,13 @@ function _chalk() {
29
29
  };
30
30
  return data;
31
31
  }
32
+ function _childProcess() {
33
+ const data = require("child_process");
34
+ _childProcess = function() {
35
+ return data;
36
+ };
37
+ return data;
38
+ }
32
39
  const _log = require("../log");
33
40
  function _interopRequireDefault(obj) {
34
41
  return obj && obj.__esModule ? obj : {
@@ -86,5 +93,35 @@ class UnimplementedError extends Error {
86
93
  this.name = "UnimplementedError";
87
94
  }
88
95
  }
96
+ /**
97
+ * Add additional information when EMFILE errors are encountered.
98
+ * These errors originate from Metro's FSEventsWatcher due to `fsevents` going over MacOS system limit.
99
+ * Unfortunately, these limits in macOS are relatively low compared to an average React Native project.
100
+ *
101
+ * @see https://github.com/expo/expo/issues/29083
102
+ * @see https://github.com/facebook/metro/issues/834
103
+ * @see https://github.com/fsevents/fsevents/issues/42#issuecomment-62632234
104
+ */ function handleTooManyOpenFileErrors(error) {
105
+ // Only enable special logging when running on macOS and are running into the `EMFILE` error
106
+ if ("code" in error && error.code === "EMFILE" && process.platform === "darwin") {
107
+ try {
108
+ // Try to recover watchman, if it's not installed this will throw
109
+ (0, _childProcess().execSync)("watchman shutdown-server", {
110
+ stdio: "ignore"
111
+ });
112
+ // NOTE(cedric): this both starts the watchman server and resets all watchers
113
+ (0, _childProcess().execSync)("watchman watch-del-all", {
114
+ stdio: "ignore"
115
+ });
116
+ (0, _log.warn)("Watchman is installed but was likely not enabled when starting Metro, try starting your project again.\nIf this problem persists, follow the troubleshooting guide of Watchman: https://facebook.github.io/watchman/docs/troubleshooting");
117
+ } catch {
118
+ (0, _log.warn)(`Your macOS system limit does not allow enough watchers for Metro, install Watchman instead. Learn more: https://facebook.github.io/watchman/docs/install`);
119
+ }
120
+ (0, _log.exception)(error);
121
+ process.exit(1);
122
+ }
123
+ throw error;
124
+ }
125
+ process.on("uncaughtException", handleTooManyOpenFileErrors);
89
126
 
90
127
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/errors.ts"],"sourcesContent":["import { AssertionError } from 'assert';\nimport chalk from 'chalk';\n\nimport { exit } from '../log';\n\nconst ERROR_PREFIX = 'Error: ';\n\n/**\n * General error, formatted as a message in red text when caught by expo-cli (no stack trace is printed). Should be used in favor of `log.error()` in most cases.\n */\nexport class CommandError extends Error {\n name = 'CommandError';\n readonly isCommandError = true;\n\n constructor(\n public code: string,\n message: string = ''\n ) {\n super('');\n // If e.toString() was called to get `message` we don't want it to look\n // like \"Error: Error:\".\n if (message.startsWith(ERROR_PREFIX)) {\n message = message.substring(ERROR_PREFIX.length);\n }\n\n this.message = message || code;\n }\n}\n\nexport class AbortCommandError extends CommandError {\n constructor() {\n super('ABORTED', 'Interactive prompt was cancelled.');\n }\n}\n\n/**\n * Used to end a CLI process without printing a stack trace in the Expo CLI. Should be used in favor of `process.exit`.\n */\nexport class SilentError extends CommandError {\n constructor(messageOrError?: string | Error) {\n const message =\n (typeof messageOrError === 'string' ? messageOrError : messageOrError?.message) ??\n 'This error should fail silently in the CLI';\n super('SILENT', message);\n if (typeof messageOrError !== 'string') {\n // forward the props of the incoming error for tests or processes outside of expo-cli that use expo cli internals.\n this.stack = messageOrError?.stack ?? this.stack;\n this.name = messageOrError?.name ?? this.name;\n }\n }\n}\n\nexport function logCmdError(error: any): never {\n if (!(error instanceof Error)) {\n throw error;\n }\n if (error instanceof AbortCommandError || error instanceof SilentError) {\n // Do nothing, this is used for prompts or other cases that were custom logged.\n process.exit(0);\n } else if (\n error instanceof CommandError ||\n error instanceof AssertionError ||\n error.name === 'ApiV2Error' ||\n error.name === 'ConfigError'\n ) {\n // Print the stack trace in debug mode only.\n exit(error);\n }\n\n const errorDetails = error.stack ? '\\n' + chalk.gray(error.stack) : '';\n\n exit(chalk.red(error.toString()) + errorDetails);\n}\n\n/** This should never be thrown in production. */\nexport class UnimplementedError extends Error {\n constructor() {\n super('Unimplemented');\n this.name = 'UnimplementedError';\n }\n}\n"],"names":["CommandError","AbortCommandError","SilentError","logCmdError","UnimplementedError","ERROR_PREFIX","Error","constructor","code","message","name","isCommandError","startsWith","substring","length","messageOrError","stack","error","process","exit","AssertionError","errorDetails","chalk","gray","red","toString"],"mappings":"AAAA;;;;;;;;;;;IAUaA,YAAY,MAAZA,YAAY;IAmBZC,iBAAiB,MAAjBA,iBAAiB;IASjBC,WAAW,MAAXA,WAAW;IAcRC,WAAW,MAAXA,WAAW;IAuBdC,kBAAkB,MAAlBA,kBAAkB;;;yBA3EA,QAAQ;;;;;;;8DACrB,OAAO;;;;;;qBAEJ,QAAQ;;;;;;AAE7B,MAAMC,YAAY,GAAG,SAAS,AAAC;AAKxB,MAAML,YAAY,SAASM,KAAK;IAIrCC,YACSC,IAAY,EACnBC,OAAe,GAAG,EAAE,CACpB;QACA,KAAK,CAAC,EAAE,CAAC,CAAC;QAHHD,YAAAA,IAAY,CAAA;aAJrBE,IAAI,GAAG,cAAc;aACZC,cAAc,GAAG,IAAI;QAO5B,uEAAuE;QACvE,wBAAwB;QACxB,IAAIF,OAAO,CAACG,UAAU,CAACP,YAAY,CAAC,EAAE;YACpCI,OAA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KAAK,CAACP,IAAI,KAAK,YAAY,IAC3BO,KAAK,CAACP,IAAI,KAAK,aAAa,EAC5B;QACA,4CAA4C;QAC5CS,IAAAA,IAAI,KAAA,EAACF,KAAK,CAAC,CAAC;IACd,CAAC;IAED,MAAMI,YAAY,GAAGJ,KAAK,CAACD,KAAK,GAAG,IAAI,GAAGM,MAAK,EAAA,QAAA,CAACC,IAAI,CAACN,KAAK,CAACD,KAAK,CAAC,GAAG,EAAE,AAAC;IAEvEG,IAAAA,IAAI,KAAA,EAACG,MAAK,EAAA,QAAA,CAACE,GAAG,CAACP,KAAK,CAACQ,QAAQ,EAAE,CAAC,GAAGJ,YAAY,CAAC,CAAC;AACnD,CAAC;AAGM,MAAMjB,kBAAkB,SAASE,KAAK;IAC3CC,aAAc;QACZ,KAAK,CAAC,eAAe,CAAC,CAAC;QACvB,IAAI,CAACG,IAAI,GAAG,oBAAoB,CAAC;IACnC;CACD"}
1
+ {"version":3,"sources":["../../../src/utils/errors.ts"],"sourcesContent":["import { AssertionError } from 'assert';\nimport chalk from 'chalk';\nimport { execSync } from 'child_process';\n\nimport { exit, exception, warn } from '../log';\n\nconst ERROR_PREFIX = 'Error: ';\n\n/**\n * General error, formatted as a message in red text when caught by expo-cli (no stack trace is printed). Should be used in favor of `log.error()` in most cases.\n */\nexport class CommandError extends Error {\n name = 'CommandError';\n readonly isCommandError = true;\n\n constructor(\n public code: string,\n message: string = ''\n ) {\n super('');\n // If e.toString() was called to get `message` we don't want it to look\n // like \"Error: Error:\".\n if (message.startsWith(ERROR_PREFIX)) {\n message = message.substring(ERROR_PREFIX.length);\n }\n\n this.message = message || code;\n }\n}\n\nexport class AbortCommandError extends CommandError {\n constructor() {\n super('ABORTED', 'Interactive prompt was cancelled.');\n }\n}\n\n/**\n * Used to end a CLI process without printing a stack trace in the Expo CLI. Should be used in favor of `process.exit`.\n */\nexport class SilentError extends CommandError {\n constructor(messageOrError?: string | Error) {\n const message =\n (typeof messageOrError === 'string' ? messageOrError : messageOrError?.message) ??\n 'This error should fail silently in the CLI';\n super('SILENT', message);\n if (typeof messageOrError !== 'string') {\n // forward the props of the incoming error for tests or processes outside of expo-cli that use expo cli internals.\n this.stack = messageOrError?.stack ?? this.stack;\n this.name = messageOrError?.name ?? this.name;\n }\n }\n}\n\nexport function logCmdError(error: any): never {\n if (!(error instanceof Error)) {\n throw error;\n }\n if (error instanceof AbortCommandError || error instanceof SilentError) {\n // Do nothing, this is used for prompts or other cases that were custom logged.\n process.exit(0);\n } else if (\n error instanceof CommandError ||\n error instanceof AssertionError ||\n error.name === 'ApiV2Error' ||\n error.name === 'ConfigError'\n ) {\n // Print the stack trace in debug mode only.\n exit(error);\n }\n\n const errorDetails = error.stack ? '\\n' + chalk.gray(error.stack) : '';\n\n exit(chalk.red(error.toString()) + errorDetails);\n}\n\n/** This should never be thrown in production. */\nexport class UnimplementedError extends Error {\n constructor() {\n super('Unimplemented');\n this.name = 'UnimplementedError';\n }\n}\n\n/**\n * Add additional information when EMFILE errors are encountered.\n * These errors originate from Metro's FSEventsWatcher due to `fsevents` going over MacOS system limit.\n * Unfortunately, these limits in macOS are relatively low compared to an average React Native project.\n *\n * @see https://github.com/expo/expo/issues/29083\n * @see https://github.com/facebook/metro/issues/834\n * @see https://github.com/fsevents/fsevents/issues/42#issuecomment-62632234\n */\nfunction handleTooManyOpenFileErrors(error: any) {\n // Only enable special logging when running on macOS and are running into the `EMFILE` error\n if ('code' in error && error.code === 'EMFILE' && process.platform === 'darwin') {\n try {\n // Try to recover watchman, if it's not installed this will throw\n execSync('watchman shutdown-server', { stdio: 'ignore' });\n // NOTE(cedric): this both starts the watchman server and resets all watchers\n execSync('watchman watch-del-all', { stdio: 'ignore' });\n\n warn(\n 'Watchman is installed but was likely not enabled when starting Metro, try starting your project again.\\nIf this problem persists, follow the troubleshooting guide of Watchman: https://facebook.github.io/watchman/docs/troubleshooting'\n );\n } catch {\n warn(\n `Your macOS system limit does not allow enough watchers for Metro, install Watchman instead. Learn more: https://facebook.github.io/watchman/docs/install`\n );\n }\n\n exception(error);\n process.exit(1);\n }\n\n throw error;\n}\n\nprocess.on('uncaughtException', handleTooManyOpenFileErrors);\n"],"names":["CommandError","AbortCommandError","SilentError","logCmdError","UnimplementedError","ERROR_PREFIX","Error","constructor","code","message","name","isCommandError","startsWith","substring","length","messageOrError","stack","error","process","exit","AssertionError","errorDetails","chalk","gray","red","toString","handleTooManyOpenFileErrors","platform","execSync","stdio","warn","exception","on"],"mappings":"AAAA;;;;;;;;;;;IAWaA,YAAY,MAAZA,YAAY;IAmBZC,iBAAiB,MAAjBA,iBAAiB;IASjBC,WAAW,MAAXA,WAAW;IAcRC,WAAW,MAAXA,WAAW;IAuBdC,kBAAkB,MAAlBA,kBAAkB;;;yBA5EA,QAAQ;;;;;;;8DACrB,OAAO;;;;;;;yBACA,eAAe;;;;;;qBAEF,QAAQ;;;;;;AAE9C,MAAMC,YAAY,GAAG,SAAS,AAAC;AAKxB,MAAML,YAAY,SAASM,KAAK;IAIrCC,YACSC,IAAY,EACnBC,OAAe,GAAG,EAAE,CACpB;QACA,KAAK,CAAC,EAAE,CAAC,CAAC;QAHHD,YAAAA,IAAY,CAAA;aAJrBE,IAAI,GAAG,cAAc;aACZC,cAAc,GAAG,IAAI;QAO5B,uEAAuE;QACvE,wBAAwB;QACxB,IAAIF,OAAO,CAACG,UAAU,CAACP,YAAY,CAAC,EAAE;YACpCI,OAAO,GAAGA,OAAO,CAACI,SAAS,CAACR,YAAY,CAACS,MAAM,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,CAACL,OAAO,GAAGA,OAAO,IAAID,IAAI,CAAC;IACjC;CACD;AAEM,MAAMP,iBAAiB,SAASD,YAAY;IACjDO,aAAc;QACZ,KAAK,CAAC,SAAS,EAAE,mCAAmC,CAAC,CAAC;IACxD;CACD;AAKM,MAAML,WAAW,SAASF,YAAY;IAC3CO,YAAYQ,cAA+B,CAAE;QAC3C,MAAMN,OAAO,GACX,CAAC,OAAOM,cAAc,KAAK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AACP,KAAK,CAACQ,QAAQ,EAAE,CAAC,GAAGJ,YAAY,CAAC,CAAC;AACnD,CAAC;AAGM,MAAMjB,kBAAkB,SAASE,KAAK;IAC3CC,aAAc;QACZ,KAAK,CAAC,eAAe,CAAC,CAAC;QACvB,IAAI,CAACG,IAAI,GAAG,oBAAoB,CAAC;IACnC;CACD;AAED;;;;;;;;CAQC,GACD,SAASgB,2BAA2B,CAACT,KAAU,EAAE;IAC/C,4FAA4F;IAC5F,IAAI,MAAM,IAAIA,KAAK,IAAIA,KAAK,CAACT,IAAI,KAAK,QAAQ,IAAIU,OAAO,CAACS,QAAQ,KAAK,QAAQ,EAAE;QAC/E,IAAI;YACF,iEAAiE;YACjEC,IAAAA,aAAQ,EAAA,SAAA,EAAC,0BAA0B,EAAE;gBAAEC,KAAK,EAAE,QAAQ;aAAE,CAAC,CAAC;YAC1D,6EAA6E;YAC7ED,IAAAA,aAAQ,EAAA,SAAA,EAAC,wBAAwB,EAAE;gBAAEC,KAAK,EAAE,QAAQ;aAAE,CAAC,CAAC;YAExDC,IAAAA,IAAI,KAAA,EACF,0OAA0O,CAC3O,CAAC;QACJ,EAAE,OAAM;YACNA,IAAAA,IAAI,KAAA,EACF,CAAC,wJAAwJ,CAAC,CAC3J,CAAC;QACJ,CAAC;QAEDC,IAAAA,IAAS,UAAA,EAACd,KAAK,CAAC,CAAC;QACjBC,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAMF,KAAK,CAAC;AACd,CAAC;AAEDC,OAAO,CAACc,EAAE,CAAC,mBAAmB,EAAEN,2BAA2B,CAAC,CAAC"}
@@ -31,7 +31,7 @@ class FetchClient {
31
31
  this.headers = {
32
32
  accept: "application/json",
33
33
  "content-type": "application/json",
34
- "user-agent": `expo-cli/${"0.20.2"}`,
34
+ "user-agent": `expo-cli/${"0.20.4"}`,
35
35
  authorization: "Basic " + _nodeBuffer().Buffer.from(`${target}:`).toString("base64")
36
36
  };
37
37
  }
@@ -79,7 +79,7 @@ function createContext() {
79
79
  cpu: summarizeCpuInfo(),
80
80
  app: {
81
81
  name: "expo/cli",
82
- version: "0.20.2"
82
+ version: "0.20.4"
83
83
  },
84
84
  ci: _ciInfo().isCI ? {
85
85
  name: _ciInfo().name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/cli",
3
- "version": "0.20.2",
3
+ "version": "0.20.4",
4
4
  "description": "The Expo CLI",
5
5
  "main": "build/bin/cli",
6
6
  "bin": {
@@ -167,5 +167,5 @@
167
167
  "tree-kill": "^1.2.2",
168
168
  "tsd": "^0.28.1"
169
169
  },
170
- "gitHead": "c0899e56c5be08b0142f06f05aa7bac8d6bc18b8"
170
+ "gitHead": "1f84b4c952ed9785c41ee65c9877e44f1df27af9"
171
171
  }