@expo/cli 55.0.9 → 55.0.11

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.
Files changed (43) hide show
  1. package/build/bin/cli +5 -1
  2. package/build/bin/cli.map +1 -1
  3. package/build/src/events/builder.js +6 -0
  4. package/build/src/events/builder.js.map +1 -0
  5. package/build/src/events/index.js +132 -0
  6. package/build/src/events/index.js.map +1 -0
  7. package/build/src/events/stream.js +303 -0
  8. package/build/src/events/stream.js.map +1 -0
  9. package/build/src/events/types.js +6 -0
  10. package/build/src/events/types.js.map +1 -0
  11. package/build/src/export/exportAssets.js +10 -9
  12. package/build/src/export/exportAssets.js.map +1 -1
  13. package/build/src/run/android/resolveGradlePropsAsync.js +22 -9
  14. package/build/src/run/android/resolveGradlePropsAsync.js.map +1 -1
  15. package/build/src/start/interface/interactiveActions.js +15 -13
  16. package/build/src/start/interface/interactiveActions.js.map +1 -1
  17. package/build/src/start/platforms/ios/devicectl.js +27 -5
  18. package/build/src/start/platforms/ios/devicectl.js.map +1 -1
  19. package/build/src/start/server/DevToolsPluginManager.js +10 -1
  20. package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
  21. package/build/src/start/server/metro/MetroBundlerDevServer.js +27 -3
  22. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  23. package/build/src/start/server/metro/MetroTerminalReporter.js +181 -79
  24. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  25. package/build/src/start/server/metro/instantiateMetro.js +53 -14
  26. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  27. package/build/src/start/server/metro/metroErrorInterface.js +3 -5
  28. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
  29. package/build/src/start/server/metro/runServer-fork.js +4 -1
  30. package/build/src/start/server/metro/runServer-fork.js.map +1 -1
  31. package/build/src/start/server/metro/withMetroMultiPlatform.js +1 -2
  32. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  33. package/build/src/start/startAsync.js +4 -2
  34. package/build/src/start/startAsync.js.map +1 -1
  35. package/build/src/utils/env.js +3 -0
  36. package/build/src/utils/env.js.map +1 -1
  37. package/build/src/utils/interactive.js +2 -1
  38. package/build/src/utils/interactive.js.map +1 -1
  39. package/build/src/utils/nodeEnv.js +29 -2
  40. package/build/src/utils/nodeEnv.js.map +1 -1
  41. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  42. package/build/src/utils/telemetry/utils/context.js +1 -1
  43. package/package.json +11 -12
@@ -12,6 +12,9 @@ _export(exports, {
12
12
  MetroTerminalReporter: function() {
13
13
  return MetroTerminalReporter;
14
14
  },
15
+ event: function() {
16
+ return event;
17
+ },
15
18
  extractCodeFrame: function() {
16
19
  return extractCodeFrame;
17
20
  },
@@ -52,20 +55,35 @@ const _env = require("../../../utils/env");
52
55
  const _link = require("../../../utils/link");
53
56
  const _serverLogLikeMetro = require("../serverLogLikeMetro");
54
57
  const _metroErrorInterface = require("./metroErrorInterface");
58
+ const _events = require("../../../events");
59
+ const _ansi = require("../../../utils/ansi");
55
60
  function _interop_require_default(obj) {
56
61
  return obj && obj.__esModule ? obj : {
57
62
  default: obj
58
63
  };
59
64
  }
60
65
  const debug = require('debug')('expo:metro:logger');
66
+ const event = (0, _events.events)('metro', (t)=>[
67
+ t.event(),
68
+ t.event(),
69
+ t.event(),
70
+ t.event(),
71
+ t.event(),
72
+ t.event(),
73
+ t.event(),
74
+ t.event(),
75
+ t.event()
76
+ ]);
61
77
  const MAX_PROGRESS_BAR_CHAR_WIDTH = 16;
62
78
  const DARK_BLOCK_CHAR = '\u2593';
63
79
  const LIGHT_BLOCK_CHAR = '\u2591';
64
80
  class MetroTerminalReporter extends _TerminalReporter.TerminalReporter {
65
- constructor(projectRoot, terminal){
66
- super(terminal), this.projectRoot = projectRoot;
81
+ #lastFailedBuildID;
82
+ constructor(serverRoot, terminal){
83
+ super(terminal), this.serverRoot = serverRoot;
67
84
  }
68
85
  _log(event) {
86
+ this.#captureLog(event);
69
87
  switch(event.type){
70
88
  case 'unstable_server_log':
71
89
  var _event_data;
@@ -97,57 +115,11 @@ class MetroTerminalReporter extends _TerminalReporter.TerminalReporter {
97
115
  {
98
116
  if (this.shouldFilterClientLog(event)) {
99
117
  return;
100
- }
101
- const { level } = event;
102
- if (!level) {
118
+ } else if (event.level != null) {
119
+ return this.#onClientLog(event);
120
+ } else {
103
121
  break;
104
122
  }
105
- if (level === 'warn' || level === 'error') {
106
- let hasStack = false;
107
- const parsed = event.data.map((msg)=>{
108
- // Quick check to see if an unsymbolicated stack is being logged.
109
- if (msg.includes('.bundle//&platform=')) {
110
- const stack = (0, _serverLogLikeMetro.parseErrorStringToObject)(msg);
111
- if (stack) {
112
- hasStack = true;
113
- }
114
- return stack;
115
- }
116
- return msg;
117
- });
118
- if (hasStack) {
119
- (async ()=>{
120
- const symbolicating = parsed.map((p)=>{
121
- if (typeof p === 'string') return p;
122
- return (0, _serverLogLikeMetro.maybeSymbolicateAndFormatJSErrorStackLogAsync)(this.projectRoot, level, p);
123
- });
124
- let usefulStackCount = 0;
125
- const fallbackIndices = [];
126
- const symbolicated = (await Promise.allSettled(symbolicating)).map((s, index)=>{
127
- if (s.status === 'rejected') {
128
- debug('Error formatting stack', parsed[index], s.reason);
129
- return parsed[index];
130
- } else if (typeof s.value === 'string') {
131
- return s.value;
132
- } else {
133
- if (!s.value.isFallback) {
134
- usefulStackCount++;
135
- } else {
136
- fallbackIndices.push(index);
137
- }
138
- return s.value.stack;
139
- }
140
- });
141
- // Using EXPO_DEBUG we can print all stack
142
- const filtered = usefulStackCount && !_env.env.EXPO_DEBUG ? symbolicated.filter((_, index)=>!fallbackIndices.includes(index)) : symbolicated;
143
- (0, _serverLogLikeMetro.logLikeMetro)(this.terminal.log.bind(this.terminal), level, null, ...filtered);
144
- })();
145
- return;
146
- }
147
- }
148
- // Overwrite the Metro terminal logging so we can improve the warnings, symbolicate stacks, and inject extra info.
149
- (0, _serverLogLikeMetro.logLikeMetro)(this.terminal.log.bind(this.terminal), level, null, ...event.data);
150
- return;
151
123
  }
152
124
  }
153
125
  return super._log(event);
@@ -165,45 +137,55 @@ class MetroTerminalReporter extends _TerminalReporter.TerminalReporter {
165
137
  const env = getEnvironmentForBuildDetails(progress.bundleDetails);
166
138
  const platform = env || getPlatformTagForBuildDetails(progress.bundleDetails);
167
139
  const inProgress = phase === 'in_progress';
168
- let localPath;
169
- if (typeof ((_progress_bundleDetails = progress.bundleDetails) == null ? void 0 : (_progress_bundleDetails_customTransformOptions = _progress_bundleDetails.customTransformOptions) == null ? void 0 : _progress_bundleDetails_customTransformOptions.dom) === 'string' && progress.bundleDetails.customTransformOptions.dom.includes(_path().default.sep)) {
170
- // Because we use a generated entry file for DOM components, we need to adjust the logging path so it
171
- // shows a unique path for each component.
172
- // Here, we take the relative import path and remove all the starting slashes.
173
- localPath = progress.bundleDetails.customTransformOptions.dom.replace(/^(\.?\.[\\/])+/, '');
174
- } else {
175
- const inputFile = progress.bundleDetails.entryFile;
176
- localPath = _path().default.isAbsolute(inputFile) ? _path().default.relative(this.projectRoot, inputFile) : inputFile;
177
- }
140
+ const localPath = typeof ((_progress_bundleDetails = progress.bundleDetails) == null ? void 0 : (_progress_bundleDetails_customTransformOptions = _progress_bundleDetails.customTransformOptions) == null ? void 0 : _progress_bundleDetails_customTransformOptions.dom) === 'string' && progress.bundleDetails.customTransformOptions.dom.includes(_path().default.sep) ? progress.bundleDetails.customTransformOptions.dom.replace(/^(\.?\.[\\/])+/, '') : this.#normalizePath(progress.bundleDetails.entryFile);
178
141
  if (!inProgress) {
179
142
  const status = phase === 'done' ? `Bundled ` : `Bundling failed `;
180
143
  const color = phase === 'done' ? _chalk().default.green : _chalk().default.red;
181
144
  const startTime = this._bundleTimers.get(progress.bundleDetails.buildID);
182
145
  let time = '';
146
+ let ms = null;
183
147
  if (startTime != null) {
184
148
  const elapsed = this._getElapsedTime(startTime);
185
149
  const micro = Number(elapsed) / 1000;
186
- const converted = Number(elapsed) / 1e6;
150
+ ms = Number(elapsed) / 1e6;
187
151
  // If the milliseconds are < 0.5 then it will display as 0, so we display in microseconds.
188
- if (converted <= 0.5) {
152
+ if (ms <= 0.5) {
189
153
  const tenthFractionOfMicro = (micro * 10 / 1000).toFixed(0);
190
154
  // Format as microseconds to nearest tenth
191
155
  time = _chalk().default.cyan.bold(`0.${tenthFractionOfMicro}ms`);
192
156
  } else {
193
- time = _chalk().default.dim(converted.toFixed(0) + 'ms');
157
+ time = _chalk().default.dim(ms.toFixed(0) + 'ms');
194
158
  }
195
159
  }
160
+ if (phase === 'done') {
161
+ event('bundling:done', {
162
+ id: progress.bundleDetails.buildID ?? null,
163
+ total: progress.totalFileCount,
164
+ ms
165
+ });
166
+ }
196
167
  // iOS Bundled 150ms
197
168
  const plural = progress.totalFileCount === 1 ? '' : 's';
198
169
  return color(platform + status) + time + _chalk().default.reset.dim(` ${localPath} (${progress.totalFileCount} module${plural})`);
199
170
  }
171
+ event('bundling:progress', {
172
+ id: progress.bundleDetails.buildID ?? null,
173
+ progress: progress.ratio,
174
+ total: progress.totalFileCount,
175
+ current: progress.transformedFileCount
176
+ });
177
+ if ((0, _events.shouldReduceLogs)()) {
178
+ return '';
179
+ }
200
180
  const filledBar = Math.floor(progress.ratio * MAX_PROGRESS_BAR_CHAR_WIDTH);
201
181
  const _progress = inProgress ? _chalk().default.green.bgGreen(DARK_BLOCK_CHAR.repeat(filledBar)) + _chalk().default.bgWhite.white(LIGHT_BLOCK_CHAR.repeat(MAX_PROGRESS_BAR_CHAR_WIDTH - filledBar)) + _chalk().default.bold(` ${(100 * progress.ratio).toFixed(1).padStart(4)}% `) + _chalk().default.dim(`(${progress.transformedFileCount.toString().padStart(progress.totalFileCount.toString().length)}/${progress.totalFileCount})`) : '';
202
182
  return platform + _chalk().default.reset.dim(`${_path().default.dirname(localPath)}${_path().default.sep}`) + _chalk().default.bold(_path().default.basename(localPath)) + ' ' + _progress;
203
183
  }
204
184
  _logInitializing(port, hasReducedPerformance) {
205
185
  // Don't print a giant logo...
206
- this.terminal.log(_chalk().default.dim('Starting Metro Bundler') + '\n');
186
+ if (!(0, _events.shouldReduceLogs)()) {
187
+ this.terminal.log(_chalk().default.dim('Starting Metro Bundler') + '\n');
188
+ }
207
189
  }
208
190
  shouldFilterClientLog(event) {
209
191
  return isAppRegistryStartupMessage(event.data);
@@ -225,25 +207,145 @@ class MetroTerminalReporter extends _TerminalReporter.TerminalReporter {
225
207
  ].join('\n')));
226
208
  }
227
209
  }
210
+ /**
211
+ * Workaround to link build ids to bundling errors.
212
+ * This works because `_logBundleBuildFailed` is called before `_logBundlingError` in synchronous manner.
213
+ * https://github.com/facebook/metro/blob/main/packages/metro/src/Server.js#L939-L945
214
+ */ _logBundleBuildFailed(buildID) {
215
+ this.#lastFailedBuildID = buildID;
216
+ super._logBundleBuildFailed(buildID);
217
+ }
228
218
  _logBundlingError(error) {
229
- const moduleResolutionError = formatUsingNodeStandardLibraryError(this.projectRoot, error);
219
+ const importStack = (0, _metroErrorInterface.nearestImportStack)(error);
220
+ const moduleResolutionError = formatUsingNodeStandardLibraryError(this.serverRoot, error);
230
221
  if (moduleResolutionError) {
231
- let message = maybeAppendCodeFrame(moduleResolutionError, error.message);
232
- message += '\n\n' + (0, _metroErrorInterface.nearestImportStack)(error);
233
- return this.terminal.log(message);
222
+ const message = maybeAppendCodeFrame(moduleResolutionError, error.message);
223
+ event('bundling:failed', {
224
+ id: this.#lastFailedBuildID ?? null,
225
+ message: (0, _ansi.stripAnsi)(message) ?? null,
226
+ importStack: importStack ?? null,
227
+ filename: error.filename ?? null,
228
+ targetModuleName: this.#normalizePath(error.targetModuleName),
229
+ originModulePath: this.#normalizePath(error.originModulePath)
230
+ });
231
+ return this.terminal.log(importStack ? `${message}\n\n${importStack}` : message);
232
+ } else {
233
+ event('bundling:failed', {
234
+ id: this.#lastFailedBuildID ?? null,
235
+ message: (0, _ansi.stripAnsi)(error.message) ?? null,
236
+ importStack: importStack ?? null,
237
+ filename: error.filename ?? null,
238
+ targetModuleName: error.targetModuleName ?? null,
239
+ originModulePath: error.originModulePath ?? null
240
+ });
241
+ (0, _metroErrorInterface.attachImportStackToRootMessage)(error, importStack);
242
+ // NOTE(@kitten): Metro drops the stack forcefully when it finds a `SyntaxError`. However,
243
+ // this is really unhelpful, since it prevents debugging Babel plugins or reporting bugs
244
+ // in Babel plugins or a transformer entirely
245
+ if (error.snippet == null && error.stack != null && error instanceof SyntaxError) {
246
+ error.message = error.stack;
247
+ delete error.stack;
248
+ }
249
+ return super._logBundlingError(error);
234
250
  }
235
- (0, _metroErrorInterface.attachImportStackToRootMessage)(error);
236
- // NOTE(@kitten): Metro drops the stack forcefully when it finds a `SyntaxError`. However,
237
- // this is really unhelpful, since it prevents debugging Babel plugins or reporting bugs
238
- // in Babel plugins or a transformer entirely
239
- if (error.snippet == null && error.stack != null && error instanceof SyntaxError) {
240
- error.message = error.stack;
241
- delete error.stack;
251
+ }
252
+ #onClientLog(evt) {
253
+ const { level = 'log', data } = evt;
254
+ if (level === 'warn' || level === 'error') {
255
+ let hasStack = false;
256
+ const parsed = data.map((msg)=>{
257
+ // Quick check to see if an unsymbolicated stack is being logged.
258
+ if (typeof msg === 'string' && msg.includes('.bundle//&platform=')) {
259
+ const stack = (0, _serverLogLikeMetro.parseErrorStringToObject)(msg);
260
+ if (stack) {
261
+ hasStack = true;
262
+ }
263
+ return stack;
264
+ }
265
+ return msg;
266
+ });
267
+ if (hasStack) {
268
+ (async ()=>{
269
+ const symbolicating = parsed.map((p)=>{
270
+ if (typeof p === 'string') {
271
+ return p;
272
+ } else if (p && typeof p === 'object' && 'message' in p && typeof p.message === 'string') {
273
+ return (0, _serverLogLikeMetro.maybeSymbolicateAndFormatJSErrorStackLogAsync)(this.serverRoot, level, p);
274
+ } else {
275
+ return null;
276
+ }
277
+ });
278
+ let usefulStackCount = 0;
279
+ const fallbackIndices = [];
280
+ const symbolicated = (await Promise.allSettled(symbolicating)).map((s, index)=>{
281
+ if (s.status === 'rejected') {
282
+ debug('Error formatting stack', parsed[index], s.reason);
283
+ return parsed[index];
284
+ } else if (!s.value) {
285
+ return parsed[index];
286
+ } else if (typeof s.value === 'string') {
287
+ return s.value;
288
+ } else {
289
+ if (!s.value.isFallback) {
290
+ usefulStackCount++;
291
+ } else {
292
+ fallbackIndices.push(index);
293
+ }
294
+ return s.value.stack;
295
+ }
296
+ });
297
+ // Using EXPO_DEBUG we can print all stack
298
+ const filtered = usefulStackCount && !_env.env.EXPO_DEBUG ? symbolicated.filter((_, index)=>!fallbackIndices.includes(index)) : symbolicated;
299
+ event('client_log', {
300
+ level,
301
+ data: symbolicated
302
+ });
303
+ (0, _serverLogLikeMetro.logLikeMetro)(this.terminal.log.bind(this.terminal), level, null, ...filtered);
304
+ })();
305
+ return;
306
+ }
242
307
  }
243
- return super._logBundlingError(error);
308
+ event('client_log', {
309
+ level,
310
+ data
311
+ });
312
+ // Overwrite the Metro terminal logging so we can improve the warnings, symbolicate stacks, and inject extra info.
313
+ (0, _serverLogLikeMetro.logLikeMetro)(this.terminal.log.bind(this.terminal), level, null, ...data);
314
+ }
315
+ #captureLog(evt) {
316
+ switch(evt.type){
317
+ case 'bundle_build_started':
318
+ {
319
+ var _evt_bundleDetails_customTransformOptions, _evt_bundleDetails, _evt_bundleDetails_customTransformOptions1;
320
+ const entry = typeof ((_evt_bundleDetails = evt.bundleDetails) == null ? void 0 : (_evt_bundleDetails_customTransformOptions = _evt_bundleDetails.customTransformOptions) == null ? void 0 : _evt_bundleDetails_customTransformOptions.dom) === 'string' && evt.bundleDetails.customTransformOptions.dom.includes(_path().default.sep) ? evt.bundleDetails.customTransformOptions.dom.replace(/^(\.?\.[\\/])+/, '') : this.#normalizePath(evt.bundleDetails.entryFile);
321
+ return event('bundling:started', {
322
+ id: evt.buildID,
323
+ platform: evt.bundleDetails.platform ?? null,
324
+ environment: ((_evt_bundleDetails_customTransformOptions1 = evt.bundleDetails.customTransformOptions) == null ? void 0 : _evt_bundleDetails_customTransformOptions1.environment) ?? null,
325
+ entry
326
+ });
327
+ }
328
+ case 'unstable_server_log':
329
+ return event('server_log', {
330
+ level: evt.level ?? null,
331
+ data: evt.data ?? null
332
+ });
333
+ case 'client_log':
334
+ // Handled separately: see this.#onClientLog
335
+ return;
336
+ case 'hmr_client_error':
337
+ case 'cache_write_error':
338
+ case 'cache_read_error':
339
+ return event(evt.type, {
340
+ message: evt.error.message
341
+ });
342
+ }
343
+ }
344
+ #normalizePath(dest) {
345
+ return dest != null && _path().default.isAbsolute(dest) ? _path().default.relative(this.serverRoot, dest) : dest || null;
244
346
  }
245
347
  }
246
- function formatUsingNodeStandardLibraryError(projectRoot, error) {
348
+ function formatUsingNodeStandardLibraryError(serverRoot, error) {
247
349
  if (!error.message) {
248
350
  return null;
249
351
  }
@@ -251,7 +353,7 @@ function formatUsingNodeStandardLibraryError(projectRoot, error) {
251
353
  if (!targetModuleName || !originModulePath) {
252
354
  return null;
253
355
  }
254
- const relativePath = _path().default.relative(projectRoot, originModulePath);
356
+ const relativePath = _path().default.relative(serverRoot, originModulePath);
255
357
  const DOCS_PAGE_URL = 'https://docs.expo.dev/workflow/using-libraries/#using-third-party-libraries';
256
358
  if (isNodeStdLibraryModule(targetModuleName)) {
257
359
  if (originModulePath.includes('node_modules')) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/metro/MetroTerminalReporter.ts"],"sourcesContent":["import type { Terminal } from '@expo/metro/metro-core';\nimport chalk from 'chalk';\nimport path from 'path';\nimport { stripVTControlCharacters } from 'util';\n\nimport { logWarning, TerminalReporter } from './TerminalReporter';\nimport {\n BuildPhase,\n BundleDetails,\n BundleProgress,\n SnippetError,\n TerminalReportableEvent,\n} from './TerminalReporter.types';\nimport { NODE_STDLIB_MODULES } from './externals';\nimport { env } from '../../../utils/env';\nimport { learnMore } from '../../../utils/link';\nimport {\n logLikeMetro,\n maybeSymbolicateAndFormatJSErrorStackLogAsync,\n parseErrorStringToObject,\n} from '../serverLogLikeMetro';\nimport { attachImportStackToRootMessage, nearestImportStack } from './metroErrorInterface';\n\nconst debug = require('debug')('expo:metro:logger') as typeof console.log;\n\nconst MAX_PROGRESS_BAR_CHAR_WIDTH = 16;\nconst DARK_BLOCK_CHAR = '\\u2593';\nconst LIGHT_BLOCK_CHAR = '\\u2591';\n/**\n * Extends the default Metro logger and adds some additional features.\n * Also removes the giant Metro logo from the output.\n */\nexport class MetroTerminalReporter extends TerminalReporter {\n constructor(\n public projectRoot: string,\n terminal: Terminal\n ) {\n super(terminal);\n }\n\n _log(event: TerminalReportableEvent): void {\n switch (event.type) {\n case 'unstable_server_log':\n if (typeof event.data?.[0] === 'string') {\n const message = event.data[0];\n if (message.match(/JavaScript logs have moved/)) {\n // Hide this very loud message from upstream React Native in favor of the note in the terminal UI:\n // The \"› Press j │ open debugger\"\n\n // logger?.info(\n // '\\u001B[1m\\u001B[7m💡 JavaScript logs have moved!\\u001B[22m They can now be ' +\n // 'viewed in React Native DevTools. Tip: Type \\u001B[1mj\\u001B[22m in ' +\n // 'the terminal to open (requires Google Chrome or Microsoft Edge).' +\n // '\\u001B[27m',\n // );\n return;\n }\n\n if (!env.EXPO_DEBUG) {\n // In the context of developing an iOS app or website, the MetroInspectorProxy \"connection\" logs are very confusing.\n // Here we'll hide them behind EXPO_DEBUG or DEBUG=expo:*. In the future we can reformat them to clearly indicate that the \"Connection\" is regarding the debugger.\n // These logs are also confusing because they can say \"connection established\" even when the debugger is not in a usable state. Really they belong in a UI or behind some sort of debug logging.\n if (message.match(/Connection (closed|established|failed|terminated)/i)) {\n // Skip logging.\n return;\n }\n }\n }\n break;\n case 'client_log': {\n if (this.shouldFilterClientLog(event)) {\n return;\n }\n const { level } = event;\n\n if (!level) {\n break;\n }\n\n if (level === 'warn' || (level as string) === 'error') {\n let hasStack = false;\n const parsed = event.data.map((msg) => {\n // Quick check to see if an unsymbolicated stack is being logged.\n if (msg.includes('.bundle//&platform=')) {\n const stack = parseErrorStringToObject(msg);\n if (stack) {\n hasStack = true;\n }\n return stack;\n }\n return msg;\n });\n\n if (hasStack) {\n (async () => {\n const symbolicating = parsed.map((p) => {\n if (typeof p === 'string') return p;\n return maybeSymbolicateAndFormatJSErrorStackLogAsync(this.projectRoot, level, p);\n });\n\n let usefulStackCount = 0;\n const fallbackIndices: number[] = [];\n const symbolicated = (await Promise.allSettled(symbolicating)).map((s, index) => {\n if (s.status === 'rejected') {\n debug('Error formatting stack', parsed[index], s.reason);\n return parsed[index];\n } else if (typeof s.value === 'string') {\n return s.value;\n } else {\n if (!s.value.isFallback) {\n usefulStackCount++;\n } else {\n fallbackIndices.push(index);\n }\n return s.value.stack;\n }\n });\n\n // Using EXPO_DEBUG we can print all stack\n const filtered =\n usefulStackCount && !env.EXPO_DEBUG\n ? symbolicated.filter((_, index) => !fallbackIndices.includes(index))\n : symbolicated;\n\n logLikeMetro(this.terminal.log.bind(this.terminal), level, null, ...filtered);\n })();\n return;\n }\n }\n\n // Overwrite the Metro terminal logging so we can improve the warnings, symbolicate stacks, and inject extra info.\n logLikeMetro(this.terminal.log.bind(this.terminal), level, null, ...event.data);\n return;\n }\n }\n return super._log(event);\n }\n\n // Used for testing\n _getElapsedTime(startTime: bigint): bigint {\n return process.hrtime.bigint() - startTime;\n }\n /**\n * Extends the bundle progress to include the current platform that we're bundling.\n *\n * @returns `iOS path/to/bundle.js ▓▓▓▓▓░░░░░░░░░░░ 36.6% (4790/7922)`\n */\n _getBundleStatusMessage(progress: BundleProgress, phase: BuildPhase): string {\n const env = getEnvironmentForBuildDetails(progress.bundleDetails);\n const platform = env || getPlatformTagForBuildDetails(progress.bundleDetails);\n const inProgress = phase === 'in_progress';\n\n let localPath: string;\n\n if (\n typeof progress.bundleDetails?.customTransformOptions?.dom === 'string' &&\n progress.bundleDetails.customTransformOptions.dom.includes(path.sep)\n ) {\n // Because we use a generated entry file for DOM components, we need to adjust the logging path so it\n // shows a unique path for each component.\n // Here, we take the relative import path and remove all the starting slashes.\n localPath = progress.bundleDetails.customTransformOptions.dom.replace(/^(\\.?\\.[\\\\/])+/, '');\n } else {\n const inputFile = progress.bundleDetails.entryFile;\n\n localPath = path.isAbsolute(inputFile)\n ? path.relative(this.projectRoot, inputFile)\n : inputFile;\n }\n\n if (!inProgress) {\n const status = phase === 'done' ? `Bundled ` : `Bundling failed `;\n const color = phase === 'done' ? chalk.green : chalk.red;\n\n const startTime = this._bundleTimers.get(progress.bundleDetails.buildID!);\n\n let time: string = '';\n\n if (startTime != null) {\n const elapsed: bigint = this._getElapsedTime(startTime);\n const micro = Number(elapsed) / 1000;\n const converted = Number(elapsed) / 1e6;\n // If the milliseconds are < 0.5 then it will display as 0, so we display in microseconds.\n if (converted <= 0.5) {\n const tenthFractionOfMicro = ((micro * 10) / 1000).toFixed(0);\n // Format as microseconds to nearest tenth\n time = chalk.cyan.bold(`0.${tenthFractionOfMicro}ms`);\n } else {\n time = chalk.dim(converted.toFixed(0) + 'ms');\n }\n }\n\n // iOS Bundled 150ms\n const plural = progress.totalFileCount === 1 ? '' : 's';\n return (\n color(platform + status) +\n time +\n chalk.reset.dim(` ${localPath} (${progress.totalFileCount} module${plural})`)\n );\n }\n\n const filledBar = Math.floor(progress.ratio * MAX_PROGRESS_BAR_CHAR_WIDTH);\n\n const _progress = inProgress\n ? chalk.green.bgGreen(DARK_BLOCK_CHAR.repeat(filledBar)) +\n chalk.bgWhite.white(LIGHT_BLOCK_CHAR.repeat(MAX_PROGRESS_BAR_CHAR_WIDTH - filledBar)) +\n chalk.bold(` ${(100 * progress.ratio).toFixed(1).padStart(4)}% `) +\n chalk.dim(\n `(${progress.transformedFileCount\n .toString()\n .padStart(progress.totalFileCount.toString().length)}/${progress.totalFileCount})`\n )\n : '';\n\n return (\n platform +\n chalk.reset.dim(`${path.dirname(localPath)}${path.sep}`) +\n chalk.bold(path.basename(localPath)) +\n ' ' +\n _progress\n );\n }\n\n _logInitializing(port: number, hasReducedPerformance: boolean): void {\n // Don't print a giant logo...\n this.terminal.log(chalk.dim('Starting Metro Bundler') + '\\n');\n }\n\n shouldFilterClientLog(event: { type: 'client_log'; data: unknown[] }): boolean {\n return isAppRegistryStartupMessage(event.data);\n }\n\n shouldFilterBundleEvent(event: TerminalReportableEvent): boolean {\n return 'bundleDetails' in event && event.bundleDetails?.bundleType === 'map';\n }\n\n /** Print the cache clear message. */\n transformCacheReset(): void {\n logWarning(\n this.terminal,\n chalk`Bundler cache is empty, rebuilding {dim (this may take a minute)}`\n );\n }\n\n /** One of the first logs that will be printed */\n dependencyGraphLoading(hasReducedPerformance: boolean): void {\n // this.terminal.log('Dependency graph is loading...');\n if (hasReducedPerformance) {\n // Extends https://github.com/facebook/metro/blob/347b1d7ed87995d7951aaa9fd597c04b06013dac/packages/metro/src/lib/TerminalReporter.js#L283-L290\n this.terminal.log(\n chalk.red(\n [\n 'Metro is operating with reduced performance.',\n 'Fix the problem above and restart Metro.',\n ].join('\\n')\n )\n );\n }\n }\n\n _logBundlingError(error: SnippetError): void {\n const moduleResolutionError = formatUsingNodeStandardLibraryError(this.projectRoot, error);\n if (moduleResolutionError) {\n let message = maybeAppendCodeFrame(moduleResolutionError, error.message);\n message += '\\n\\n' + nearestImportStack(error);\n return this.terminal.log(message);\n }\n\n attachImportStackToRootMessage(error);\n\n // NOTE(@kitten): Metro drops the stack forcefully when it finds a `SyntaxError`. However,\n // this is really unhelpful, since it prevents debugging Babel plugins or reporting bugs\n // in Babel plugins or a transformer entirely\n if (error.snippet == null && error.stack != null && error instanceof SyntaxError) {\n error.message = error.stack;\n delete error.stack;\n }\n\n return super._logBundlingError(error);\n }\n}\n\n/**\n * Formats an error where the user is attempting to import a module from the Node.js standard library.\n * Exposed for testing.\n *\n * @param error\n * @returns error message or null if not a module resolution error\n */\nexport function formatUsingNodeStandardLibraryError(\n projectRoot: string,\n error: SnippetError\n): string | null {\n if (!error.message) {\n return null;\n }\n const { targetModuleName, originModulePath } = error;\n if (!targetModuleName || !originModulePath) {\n return null;\n }\n const relativePath = path.relative(projectRoot, originModulePath);\n\n const DOCS_PAGE_URL =\n 'https://docs.expo.dev/workflow/using-libraries/#using-third-party-libraries';\n\n if (isNodeStdLibraryModule(targetModuleName)) {\n if (originModulePath.includes('node_modules')) {\n return [\n `The package at \"${chalk.bold(\n relativePath\n )}\" attempted to import the Node standard library module \"${chalk.bold(\n targetModuleName\n )}\".`,\n `It failed because the native React runtime does not include the Node standard library.`,\n learnMore(DOCS_PAGE_URL),\n ].join('\\n');\n } else {\n return [\n `You attempted to import the Node standard library module \"${chalk.bold(\n targetModuleName\n )}\" from \"${chalk.bold(relativePath)}\".`,\n `It failed because the native React runtime does not include the Node standard library.`,\n learnMore(DOCS_PAGE_URL),\n ].join('\\n');\n }\n }\n return `Unable to resolve \"${targetModuleName}\" from \"${relativePath}\"`;\n}\n\nexport function isNodeStdLibraryModule(moduleName: string): boolean {\n return /^node:/.test(moduleName) || NODE_STDLIB_MODULES.includes(moduleName);\n}\n\n/** If the code frame can be found then append it to the existing message. */\nfunction maybeAppendCodeFrame(message: string, rawMessage: string): string {\n const codeFrame = extractCodeFrame(stripMetroInfo(rawMessage));\n if (codeFrame) {\n message += '\\n' + codeFrame;\n }\n return message;\n}\n\n/** Extract fist code frame presented in the error message */\nexport function extractCodeFrame(errorMessage: string): string {\n const codeFrameLine = /^(?:\\s*(?:>?\\s*\\d+\\s*\\||\\s*\\|).*\\n?)+/;\n let wasPreviousLineCodeFrame: boolean | null = null;\n return errorMessage\n .split('\\n')\n .filter((line) => {\n if (wasPreviousLineCodeFrame === false) return false;\n const keep = codeFrameLine.test(stripVTControlCharacters(line));\n if (keep && wasPreviousLineCodeFrame === null) wasPreviousLineCodeFrame = true;\n else if (!keep && wasPreviousLineCodeFrame) wasPreviousLineCodeFrame = false;\n return keep;\n })\n .join('\\n');\n}\n\n/**\n * Remove the Metro cache clearing steps if they exist.\n * In future versions we won't need this.\n * Returns the remaining code frame logs.\n */\nexport function stripMetroInfo(errorMessage: string): string {\n // Newer versions of Metro don't include the list.\n if (!errorMessage.includes('4. Remove the cache')) {\n return errorMessage;\n }\n const lines = errorMessage.split('\\n');\n const index = lines.findIndex((line) => line.includes('4. Remove the cache'));\n if (index === -1) {\n return errorMessage;\n }\n return lines.slice(index + 1).join('\\n');\n}\n\n/** @returns if the message matches the initial startup log */\nfunction isAppRegistryStartupMessage(body: any[]): boolean {\n return (\n body.length === 1 &&\n (/^Running application \"main\" with appParams:/.test(body[0]) ||\n /^Running \"main\" with \\{/.test(body[0]))\n );\n}\n\n/** @returns platform specific tag for a `BundleDetails` object */\nfunction getPlatformTagForBuildDetails(bundleDetails?: BundleDetails | null): string {\n const platform = bundleDetails?.platform ?? null;\n if (platform) {\n const formatted = { ios: 'iOS', android: 'Android', web: 'Web' }[platform] || platform;\n return `${chalk.bold(formatted)} `;\n }\n\n return '';\n}\n/** @returns platform specific tag for a `BundleDetails` object */\nfunction getEnvironmentForBuildDetails(bundleDetails?: BundleDetails | null): string {\n // Expo CLI will pass `customTransformOptions.environment = 'node'` when bundling for the server.\n const env = bundleDetails?.customTransformOptions?.environment ?? null;\n if (env === 'node') {\n return chalk.bold('λ') + ' ';\n } else if (env === 'react-server') {\n return chalk.bold(`RSC(${getPlatformTagForBuildDetails(bundleDetails).trim()})`) + ' ';\n }\n\n if (\n bundleDetails?.customTransformOptions?.dom &&\n typeof bundleDetails?.customTransformOptions?.dom === 'string'\n ) {\n return chalk.bold(`DOM`) + ' ';\n }\n\n return '';\n}\n"],"names":["MetroTerminalReporter","extractCodeFrame","formatUsingNodeStandardLibraryError","isNodeStdLibraryModule","stripMetroInfo","debug","require","MAX_PROGRESS_BAR_CHAR_WIDTH","DARK_BLOCK_CHAR","LIGHT_BLOCK_CHAR","TerminalReporter","constructor","projectRoot","terminal","_log","event","type","data","message","match","env","EXPO_DEBUG","shouldFilterClientLog","level","hasStack","parsed","map","msg","includes","stack","parseErrorStringToObject","symbolicating","p","maybeSymbolicateAndFormatJSErrorStackLogAsync","usefulStackCount","fallbackIndices","symbolicated","Promise","allSettled","s","index","status","reason","value","isFallback","push","filtered","filter","_","logLikeMetro","log","bind","_getElapsedTime","startTime","process","hrtime","bigint","_getBundleStatusMessage","progress","phase","getEnvironmentForBuildDetails","bundleDetails","platform","getPlatformTagForBuildDetails","inProgress","localPath","customTransformOptions","dom","path","sep","replace","inputFile","entryFile","isAbsolute","relative","color","chalk","green","red","_bundleTimers","get","buildID","time","elapsed","micro","Number","converted","tenthFractionOfMicro","toFixed","cyan","bold","dim","plural","totalFileCount","reset","filledBar","Math","floor","ratio","_progress","bgGreen","repeat","bgWhite","white","padStart","transformedFileCount","toString","length","dirname","basename","_logInitializing","port","hasReducedPerformance","isAppRegistryStartupMessage","shouldFilterBundleEvent","bundleType","transformCacheReset","logWarning","dependencyGraphLoading","join","_logBundlingError","error","moduleResolutionError","maybeAppendCodeFrame","nearestImportStack","attachImportStackToRootMessage","snippet","SyntaxError","targetModuleName","originModulePath","relativePath","DOCS_PAGE_URL","learnMore","moduleName","test","NODE_STDLIB_MODULES","rawMessage","codeFrame","errorMessage","codeFrameLine","wasPreviousLineCodeFrame","split","line","keep","stripVTControlCharacters","lines","findIndex","slice","body","formatted","ios","android","web","environment","trim"],"mappings":";;;;;;;;;;;IAgCaA,qBAAqB;eAArBA;;IAuTGC,gBAAgB;eAAhBA;;IAtDAC,mCAAmC;eAAnCA;;IAwCAC,sBAAsB;eAAtBA;;IAkCAC,cAAc;eAAdA;;;;gEA1WE;;;;;;;gEACD;;;;;;;yBACwB;;;;;;kCAEI;2BAQT;qBAChB;sBACM;oCAKnB;qCAC4D;;;;;;AAEnE,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,MAAMC,8BAA8B;AACpC,MAAMC,kBAAkB;AACxB,MAAMC,mBAAmB;AAKlB,MAAMT,8BAA8BU,kCAAgB;IACzDC,YACE,AAAOC,WAAmB,EAC1BC,QAAkB,CAClB;QACA,KAAK,CAACA,gBAHCD,cAAAA;IAIT;IAEAE,KAAKC,KAA8B,EAAQ;QACzC,OAAQA,MAAMC,IAAI;YAChB,KA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AArCL,sCAAuC4F,WAAW,KAAI;IAClE,IAAIrI,QAAQ,QAAQ;QAClB,OAAOwD,gBAAK,CAACc,IAAI,CAAC,OAAO;IAC3B,OAAO,IAAItE,QAAQ,gBAAgB;QACjC,OAAOwD,gBAAK,CAACc,IAAI,CAAC,CAAC,IAAI,EAAE3B,8BAA8BF,eAAe6F,IAAI,GAAG,CAAC,CAAC,IAAI;IACrF;IAEA,IACE7F,CAAAA,kCAAAA,yCAAAA,cAAeK,sBAAsB,qBAArCL,uCAAuCM,GAAG,KAC1C,QAAON,kCAAAA,yCAAAA,cAAeK,sBAAsB,qBAArCL,uCAAuCM,GAAG,MAAK,UACtD;QACA,OAAOS,gBAAK,CAACc,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI;IAC7B;IAEA,OAAO;AACT"}
1
+ {"version":3,"sources":["../../../../../src/start/server/metro/MetroTerminalReporter.ts"],"sourcesContent":["import type { Terminal } from '@expo/metro/metro-core';\nimport chalk from 'chalk';\nimport path from 'path';\nimport { stripVTControlCharacters } from 'util';\n\nimport { logWarning, TerminalReporter } from './TerminalReporter';\nimport {\n BuildPhase,\n BundleDetails,\n BundleProgress,\n SnippetError,\n TerminalReportableEvent,\n} from './TerminalReporter.types';\nimport { NODE_STDLIB_MODULES } from './externals';\nimport { env } from '../../../utils/env';\nimport { learnMore } from '../../../utils/link';\nimport {\n logLikeMetro,\n maybeSymbolicateAndFormatJSErrorStackLogAsync,\n parseErrorStringToObject,\n} from '../serverLogLikeMetro';\nimport { attachImportStackToRootMessage, nearestImportStack } from './metroErrorInterface';\nimport { events, shouldReduceLogs } from '../../../events';\nimport { stripAnsi } from '../../../utils/ansi';\n\ntype ClientLogLevel =\n | 'trace'\n | 'info'\n | 'error'\n | 'warn'\n | 'log'\n | 'group'\n | 'groupCollapsed'\n | 'groupEnd'\n | 'debug';\n\nconst debug = require('debug')('expo:metro:logger') as typeof console.log;\n\n// prettier-ignore\nexport const event = events('metro', (t) => [\n t.event<'bundling:started', {\n id: string;\n platform: null | string;\n environment: null | string;\n entry: string;\n }>(),\n t.event<'bundling:done', {\n id: string | null;\n ms: number | null;\n total: number;\n }>(),\n t.event<'bundling:failed', {\n id: string | null;\n filename: string | null;\n message: string | null;\n importStack: string | null;\n targetModuleName: string | null;\n originModulePath: string | null;\n }>(),\n t.event<'bundling:progress', {\n id: string | null;\n progress: number;\n current: number;\n total: number;\n }>(),\n t.event<'server_log', {\n level: 'info' | 'warn' | 'error' | null;\n data: string | unknown[] | null;\n }>(),\n t.event<'client_log', {\n level: ClientLogLevel | null;\n data: unknown[] | null;\n }>(),\n t.event<'hmr_client_error', {\n message: string;\n }>(),\n t.event<'cache_write_error', {\n message: string;\n }>(),\n t.event<'cache_read_error', {\n message: string;\n }>(),\n]);\n\nconst MAX_PROGRESS_BAR_CHAR_WIDTH = 16;\nconst DARK_BLOCK_CHAR = '\\u2593';\nconst LIGHT_BLOCK_CHAR = '\\u2591';\n/**\n * Extends the default Metro logger and adds some additional features.\n * Also removes the giant Metro logo from the output.\n */\nexport class MetroTerminalReporter extends TerminalReporter {\n #lastFailedBuildID: string | undefined;\n\n constructor(\n public serverRoot: string,\n terminal: Terminal\n ) {\n super(terminal);\n }\n\n _log(event: TerminalReportableEvent): void {\n this.#captureLog(event);\n switch (event.type) {\n case 'unstable_server_log':\n if (typeof event.data?.[0] === 'string') {\n const message = event.data[0];\n if (message.match(/JavaScript logs have moved/)) {\n // Hide this very loud message from upstream React Native in favor of the note in the terminal UI:\n // The \"› Press j │ open debugger\"\n\n // logger?.info(\n // '\\u001B[1m\\u001B[7m💡 JavaScript logs have moved!\\u001B[22m They can now be ' +\n // 'viewed in React Native DevTools. Tip: Type \\u001B[1mj\\u001B[22m in ' +\n // 'the terminal to open (requires Google Chrome or Microsoft Edge).' +\n // '\\u001B[27m',\n // );\n return;\n }\n\n if (!env.EXPO_DEBUG) {\n // In the context of developing an iOS app or website, the MetroInspectorProxy \"connection\" logs are very confusing.\n // Here we'll hide them behind EXPO_DEBUG or DEBUG=expo:*. In the future we can reformat them to clearly indicate that the \"Connection\" is regarding the debugger.\n // These logs are also confusing because they can say \"connection established\" even when the debugger is not in a usable state. Really they belong in a UI or behind some sort of debug logging.\n if (message.match(/Connection (closed|established|failed|terminated)/i)) {\n // Skip logging.\n return;\n }\n }\n }\n break;\n case 'client_log': {\n if (this.shouldFilterClientLog(event)) {\n return;\n } else if (event.level != null) {\n return this.#onClientLog(event);\n } else {\n break;\n }\n }\n }\n return super._log(event);\n }\n\n // Used for testing\n _getElapsedTime(startTime: bigint): bigint {\n return process.hrtime.bigint() - startTime;\n }\n /**\n * Extends the bundle progress to include the current platform that we're bundling.\n *\n * @returns `iOS path/to/bundle.js ▓▓▓▓▓░░░░░░░░░░░ 36.6% (4790/7922)`\n */\n _getBundleStatusMessage(progress: BundleProgress, phase: BuildPhase): string {\n const env = getEnvironmentForBuildDetails(progress.bundleDetails);\n const platform = env || getPlatformTagForBuildDetails(progress.bundleDetails);\n const inProgress = phase === 'in_progress';\n\n const localPath =\n typeof progress.bundleDetails?.customTransformOptions?.dom === 'string' &&\n progress.bundleDetails.customTransformOptions.dom.includes(path.sep)\n ? progress.bundleDetails.customTransformOptions.dom.replace(/^(\\.?\\.[\\\\/])+/, '')\n : this.#normalizePath(progress.bundleDetails.entryFile);\n\n if (!inProgress) {\n const status = phase === 'done' ? `Bundled ` : `Bundling failed `;\n const color = phase === 'done' ? chalk.green : chalk.red;\n\n const startTime = this._bundleTimers.get(progress.bundleDetails.buildID!);\n\n let time: string = '';\n let ms: number | null = null;\n\n if (startTime != null) {\n const elapsed: bigint = this._getElapsedTime(startTime);\n const micro = Number(elapsed) / 1000;\n ms = Number(elapsed) / 1e6;\n // If the milliseconds are < 0.5 then it will display as 0, so we display in microseconds.\n if (ms <= 0.5) {\n const tenthFractionOfMicro = ((micro * 10) / 1000).toFixed(0);\n // Format as microseconds to nearest tenth\n time = chalk.cyan.bold(`0.${tenthFractionOfMicro}ms`);\n } else {\n time = chalk.dim(ms.toFixed(0) + 'ms');\n }\n }\n\n if (phase === 'done') {\n event('bundling:done', {\n id: progress.bundleDetails.buildID ?? null,\n total: progress.totalFileCount,\n ms,\n });\n }\n\n // iOS Bundled 150ms\n const plural = progress.totalFileCount === 1 ? '' : 's';\n return (\n color(platform + status) +\n time +\n chalk.reset.dim(` ${localPath} (${progress.totalFileCount} module${plural})`)\n );\n }\n\n event('bundling:progress', {\n id: progress.bundleDetails.buildID ?? null,\n progress: progress.ratio,\n total: progress.totalFileCount,\n current: progress.transformedFileCount,\n });\n if (shouldReduceLogs()) {\n return '';\n }\n\n const filledBar = Math.floor(progress.ratio * MAX_PROGRESS_BAR_CHAR_WIDTH);\n const _progress = inProgress\n ? chalk.green.bgGreen(DARK_BLOCK_CHAR.repeat(filledBar)) +\n chalk.bgWhite.white(LIGHT_BLOCK_CHAR.repeat(MAX_PROGRESS_BAR_CHAR_WIDTH - filledBar)) +\n chalk.bold(` ${(100 * progress.ratio).toFixed(1).padStart(4)}% `) +\n chalk.dim(\n `(${progress.transformedFileCount\n .toString()\n .padStart(progress.totalFileCount.toString().length)}/${progress.totalFileCount})`\n )\n : '';\n return (\n platform +\n chalk.reset.dim(`${path.dirname(localPath)}${path.sep}`) +\n chalk.bold(path.basename(localPath)) +\n ' ' +\n _progress\n );\n }\n\n _logInitializing(port: number, hasReducedPerformance: boolean): void {\n // Don't print a giant logo...\n if (!shouldReduceLogs()) {\n this.terminal.log(chalk.dim('Starting Metro Bundler') + '\\n');\n }\n }\n\n shouldFilterClientLog(event: { type: 'client_log'; data: unknown[] }): boolean {\n return isAppRegistryStartupMessage(event.data);\n }\n\n shouldFilterBundleEvent(event: TerminalReportableEvent): boolean {\n return 'bundleDetails' in event && event.bundleDetails?.bundleType === 'map';\n }\n\n /** Print the cache clear message. */\n transformCacheReset(): void {\n logWarning(\n this.terminal,\n chalk`Bundler cache is empty, rebuilding {dim (this may take a minute)}`\n );\n }\n\n /** One of the first logs that will be printed */\n dependencyGraphLoading(hasReducedPerformance: boolean): void {\n // this.terminal.log('Dependency graph is loading...');\n if (hasReducedPerformance) {\n // Extends https://github.com/facebook/metro/blob/347b1d7ed87995d7951aaa9fd597c04b06013dac/packages/metro/src/lib/TerminalReporter.js#L283-L290\n this.terminal.log(\n chalk.red(\n [\n 'Metro is operating with reduced performance.',\n 'Fix the problem above and restart Metro.',\n ].join('\\n')\n )\n );\n }\n }\n\n /**\n * Workaround to link build ids to bundling errors.\n * This works because `_logBundleBuildFailed` is called before `_logBundlingError` in synchronous manner.\n * https://github.com/facebook/metro/blob/main/packages/metro/src/Server.js#L939-L945\n */\n _logBundleBuildFailed(buildID: string): void {\n this.#lastFailedBuildID = buildID;\n super._logBundleBuildFailed(buildID);\n }\n\n _logBundlingError(error: SnippetError): void {\n const importStack = nearestImportStack(error);\n const moduleResolutionError = formatUsingNodeStandardLibraryError(this.serverRoot, error);\n\n if (moduleResolutionError) {\n const message = maybeAppendCodeFrame(moduleResolutionError, error.message);\n event('bundling:failed', {\n id: this.#lastFailedBuildID ?? null,\n message: stripAnsi(message) ?? null,\n importStack: importStack ?? null,\n filename: error.filename ?? null,\n targetModuleName: this.#normalizePath(error.targetModuleName),\n originModulePath: this.#normalizePath(error.originModulePath),\n });\n\n return this.terminal.log(importStack ? `${message}\\n\\n${importStack}` : message);\n } else {\n event('bundling:failed', {\n id: this.#lastFailedBuildID ?? null,\n message: stripAnsi(error.message) ?? null,\n importStack: importStack ?? null,\n filename: error.filename ?? null,\n targetModuleName: error.targetModuleName ?? null,\n originModulePath: error.originModulePath ?? null,\n });\n\n attachImportStackToRootMessage(error, importStack);\n\n // NOTE(@kitten): Metro drops the stack forcefully when it finds a `SyntaxError`. However,\n // this is really unhelpful, since it prevents debugging Babel plugins or reporting bugs\n // in Babel plugins or a transformer entirely\n if (error.snippet == null && error.stack != null && error instanceof SyntaxError) {\n error.message = error.stack;\n delete error.stack;\n }\n\n return super._logBundlingError(error);\n }\n }\n\n #onClientLog(evt: { type: 'client_log'; level?: ClientLogLevel; data: unknown[] }) {\n const { level = 'log', data } = evt;\n if (level === 'warn' || (level as string) === 'error') {\n let hasStack = false;\n const parsed = data.map((msg) => {\n // Quick check to see if an unsymbolicated stack is being logged.\n if (typeof msg === 'string' && msg.includes('.bundle//&platform=')) {\n const stack = parseErrorStringToObject(msg);\n if (stack) {\n hasStack = true;\n }\n return stack;\n }\n return msg;\n });\n\n if (hasStack) {\n (async () => {\n const symbolicating = parsed.map((p) => {\n if (typeof p === 'string') {\n return p;\n } else if (\n p &&\n typeof p === 'object' &&\n 'message' in p &&\n typeof p.message === 'string'\n ) {\n return maybeSymbolicateAndFormatJSErrorStackLogAsync(\n this.serverRoot,\n level,\n p as any\n );\n } else {\n return null;\n }\n });\n\n let usefulStackCount = 0;\n const fallbackIndices: number[] = [];\n const symbolicated = (await Promise.allSettled(symbolicating)).map((s, index) => {\n if (s.status === 'rejected') {\n debug('Error formatting stack', parsed[index], s.reason);\n return parsed[index];\n } else if (!s.value) {\n return parsed[index];\n } else if (typeof s.value === 'string') {\n return s.value;\n } else {\n if (!s.value.isFallback) {\n usefulStackCount++;\n } else {\n fallbackIndices.push(index);\n }\n return s.value.stack;\n }\n });\n\n // Using EXPO_DEBUG we can print all stack\n const filtered =\n usefulStackCount && !env.EXPO_DEBUG\n ? symbolicated.filter((_, index) => !fallbackIndices.includes(index))\n : symbolicated;\n\n event('client_log', { level, data: symbolicated });\n logLikeMetro(this.terminal.log.bind(this.terminal), level, null, ...filtered);\n })();\n return;\n }\n }\n\n event('client_log', { level, data });\n // Overwrite the Metro terminal logging so we can improve the warnings, symbolicate stacks, and inject extra info.\n logLikeMetro(this.terminal.log.bind(this.terminal), level, null, ...data);\n }\n\n #captureLog(evt: TerminalReportableEvent) {\n switch (evt.type) {\n case 'bundle_build_started': {\n const entry =\n typeof evt.bundleDetails?.customTransformOptions?.dom === 'string' &&\n evt.bundleDetails.customTransformOptions.dom.includes(path.sep)\n ? evt.bundleDetails.customTransformOptions.dom.replace(/^(\\.?\\.[\\\\/])+/, '')\n : this.#normalizePath(evt.bundleDetails.entryFile);\n return event('bundling:started', {\n id: evt.buildID,\n platform: evt.bundleDetails.platform ?? null,\n environment: evt.bundleDetails.customTransformOptions?.environment ?? null,\n entry,\n });\n }\n case 'unstable_server_log':\n return event('server_log', {\n level: evt.level ?? null,\n data: evt.data ?? null,\n });\n case 'client_log':\n // Handled separately: see this.#onClientLog\n return;\n case 'hmr_client_error':\n case 'cache_write_error':\n case 'cache_read_error':\n return event(evt.type, {\n message: evt.error.message,\n });\n }\n }\n\n #normalizePath<T extends string | null>(dest: T | undefined): T | string {\n return dest != null && path.isAbsolute(dest)\n ? path.relative(this.serverRoot, dest)\n : ((dest || null) as T);\n }\n}\n\n/**\n * Formats an error where the user is attempting to import a module from the Node.js standard library.\n * Exposed for testing.\n *\n * @param error\n * @returns error message or null if not a module resolution error\n */\nexport function formatUsingNodeStandardLibraryError(\n serverRoot: string,\n error: SnippetError\n): string | null {\n if (!error.message) {\n return null;\n }\n const { targetModuleName, originModulePath } = error;\n if (!targetModuleName || !originModulePath) {\n return null;\n }\n const relativePath = path.relative(serverRoot, originModulePath);\n\n const DOCS_PAGE_URL =\n 'https://docs.expo.dev/workflow/using-libraries/#using-third-party-libraries';\n\n if (isNodeStdLibraryModule(targetModuleName)) {\n if (originModulePath.includes('node_modules')) {\n return [\n `The package at \"${chalk.bold(\n relativePath\n )}\" attempted to import the Node standard library module \"${chalk.bold(\n targetModuleName\n )}\".`,\n `It failed because the native React runtime does not include the Node standard library.`,\n learnMore(DOCS_PAGE_URL),\n ].join('\\n');\n } else {\n return [\n `You attempted to import the Node standard library module \"${chalk.bold(\n targetModuleName\n )}\" from \"${chalk.bold(relativePath)}\".`,\n `It failed because the native React runtime does not include the Node standard library.`,\n learnMore(DOCS_PAGE_URL),\n ].join('\\n');\n }\n }\n return `Unable to resolve \"${targetModuleName}\" from \"${relativePath}\"`;\n}\n\nexport function isNodeStdLibraryModule(moduleName: string): boolean {\n return /^node:/.test(moduleName) || NODE_STDLIB_MODULES.includes(moduleName);\n}\n\n/** If the code frame can be found then append it to the existing message. */\nfunction maybeAppendCodeFrame(message: string, rawMessage: string): string {\n const codeFrame = extractCodeFrame(stripMetroInfo(rawMessage));\n if (codeFrame) {\n message += '\\n' + codeFrame;\n }\n return message;\n}\n\n/** Extract fist code frame presented in the error message */\nexport function extractCodeFrame(errorMessage: string): string {\n const codeFrameLine = /^(?:\\s*(?:>?\\s*\\d+\\s*\\||\\s*\\|).*\\n?)+/;\n let wasPreviousLineCodeFrame: boolean | null = null;\n return errorMessage\n .split('\\n')\n .filter((line) => {\n if (wasPreviousLineCodeFrame === false) return false;\n const keep = codeFrameLine.test(stripVTControlCharacters(line));\n if (keep && wasPreviousLineCodeFrame === null) wasPreviousLineCodeFrame = true;\n else if (!keep && wasPreviousLineCodeFrame) wasPreviousLineCodeFrame = false;\n return keep;\n })\n .join('\\n');\n}\n\n/**\n * Remove the Metro cache clearing steps if they exist.\n * In future versions we won't need this.\n * Returns the remaining code frame logs.\n */\nexport function stripMetroInfo(errorMessage: string): string {\n // Newer versions of Metro don't include the list.\n if (!errorMessage.includes('4. Remove the cache')) {\n return errorMessage;\n }\n const lines = errorMessage.split('\\n');\n const index = lines.findIndex((line) => line.includes('4. Remove the cache'));\n if (index === -1) {\n return errorMessage;\n }\n return lines.slice(index + 1).join('\\n');\n}\n\n/** @returns if the message matches the initial startup log */\nfunction isAppRegistryStartupMessage(body: any[]): boolean {\n return (\n body.length === 1 &&\n (/^Running application \"main\" with appParams:/.test(body[0]) ||\n /^Running \"main\" with \\{/.test(body[0]))\n );\n}\n\n/** @returns platform specific tag for a `BundleDetails` object */\nfunction getPlatformTagForBuildDetails(bundleDetails?: BundleDetails | null): string {\n const platform = bundleDetails?.platform ?? null;\n if (platform) {\n const formatted = { ios: 'iOS', android: 'Android', web: 'Web' }[platform] || platform;\n return `${chalk.bold(formatted)} `;\n }\n\n return '';\n}\n/** @returns platform specific tag for a `BundleDetails` object */\nfunction getEnvironmentForBuildDetails(bundleDetails?: BundleDetails | null): string {\n // Expo CLI will pass `customTransformOptions.environment = 'node'` when bundling for the server.\n const env = bundleDetails?.customTransformOptions?.environment ?? null;\n if (env === 'node') {\n return chalk.bold('λ') + ' ';\n } else if (env === 'react-server') {\n return chalk.bold(`RSC(${getPlatformTagForBuildDetails(bundleDetails).trim()})`) + ' ';\n }\n\n if (\n bundleDetails?.customTransformOptions?.dom &&\n typeof bundleDetails?.customTransformOptions?.dom === 'string'\n ) {\n return chalk.bold(`DOM`) + ' ';\n }\n\n return '';\n}\n"],"names":["MetroTerminalReporter","event","extractCodeFrame","formatUsingNodeStandardLibraryError","isNodeStdLibraryModule","stripMetroInfo","debug","require","events","t","MAX_PROGRESS_BAR_CHAR_WIDTH","DARK_BLOCK_CHAR","LIGHT_BLOCK_CHAR","TerminalReporter","constructor","serverRoot","terminal","_log","type","data","message","match","env","EXPO_DEBUG","shouldFilterClientLog","level","_getElapsedTime","startTime","process","hrtime","bigint","_getBundleStatusMessage","progress","phase","getEnvironmentForBuildDetails","bundleDetails","platform","getPlatformTagForBuildDetails","inProgress","localPath","customTransformOptions","dom","includes","path","sep","replace","entryFile","status","color","chalk","green","red","_bundleTimers","get","buildID","time","ms","elapsed","micro","Number","tenthFractionOfMicro","toFixed","cyan","bold","dim","id","total","totalFileCount","plural","reset","ratio","current","transformedFileCount","shouldReduceLogs","filledBar","Math","floor","_progress","bgGreen","repeat","bgWhite","white","padStart","toString","length","dirname","basename","_logInitializing","port","hasReducedPerformance","log","isAppRegistryStartupMessage","shouldFilterBundleEvent","bundleType","transformCacheReset","logWarning","dependencyGraphLoading","join","_logBundleBuildFailed","_logBundlingError","error","importStack","nearestImportStack","moduleResolutionError","maybeAppendCodeFrame","stripAnsi","filename","targetModuleName","originModulePath","attachImportStackToRootMessage","snippet","stack","SyntaxError","evt","hasStack","parsed","map","msg","parseErrorStringToObject","symbolicating","p","maybeSymbolicateAndFormatJSErrorStackLogAsync","usefulStackCount","fallbackIndices","symbolicated","Promise","allSettled","s","index","reason","value","isFallback","push","filtered","filter","_","logLikeMetro","bind","entry","environment","dest","isAbsolute","relative","relativePath","DOCS_PAGE_URL","learnMore","moduleName","test","NODE_STDLIB_MODULES","rawMessage","codeFrame","errorMessage","codeFrameLine","wasPreviousLineCodeFrame","split","line","keep","stripVTControlCharacters","lines","findIndex","slice","body","formatted","ios","android","web","trim"],"mappings":";;;;;;;;;;;IA2FaA,qBAAqB;eAArBA;;IApDAC,KAAK;eAALA;;IA2cGC,gBAAgB;eAAhBA;;IAtDAC,mCAAmC;eAAnCA;;IAwCAC,sBAAsB;eAAtBA;;IAkCAC,cAAc;eAAdA;;;;gEArgBE;;;;;;;gEACD;;;;;;;yBACwB;;;;;;kCAEI;2BAQT;qBAChB;sBACM;oCAKnB;qCAC4D;wBAC1B;sBACf;;;;;;AAa1B,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,MAAMN,QAAQO,IAAAA,cAAM,EAAC,SAAS,CAACC,IAAM;QAC1CA,EAAER,KAAK;QAMPQ,EAAER,KAAK;QAKPQ,EAAER,KAAK;QAQPQ,EAAER,KAAK;QAMPQ,EAAER,KAAK;QAIPQ,EAAER,KAAK;QAIPQ,EAAER,KAAK;QAGPQ,EAAER,KAAK;QAGPQ,EAAER,KAAK;KAGR;AAED,MAAMS,8BAA8B;AACpC,MAAMC,kBAAkB;AACxB,MAAMC,mBAAmB;AAKlB,MAAMZ,8BAA8Ba,kCAAgB;IACzD,CAAA,iBAAkB,CAAqB;IAEvCC,YACE,AAAOC,UAAkB,EACzBC,QAAkB,CAClB;QACA,KAAK,CAACA,gBAHCD,aAAAA;IAIT;IAEAE,KAAKhB,KAA8B,EAAQ;QACzC,IAAI,CAAC,CAAA,UAAW,CAACA;QACjB,OAAQA,MAAMiB,IAAI;YAChB,KAAK;oBACQjB;gBAAX,IAAI,SAAOA,cAAAA,MAAMkB,IAAI,qBAAVlB,WAAY,CAAC,EAAE,MAAK,UAAU;oBACvC,MAAMmB,UA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