@expo/cli 55.0.3 → 56.0.0-canary-20260128-67ce8d5
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 +3 -1
- package/build/bin/cli.map +1 -1
- package/build/src/start/interface/interactiveActions.js +2 -1
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +1 -1
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/metro/DevToolsPluginWebsocketEndpoint.js +1 -1
- package/build/src/start/server/metro/DevToolsPluginWebsocketEndpoint.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +4 -4
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +144 -33
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +2 -2
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js +1 -13
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +53 -0
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +3 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +14 -9
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +2 -62
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/utils/build-cache-providers/index.js +1 -1
- package/build/src/utils/build-cache-providers/index.js.map +1 -1
- package/build/src/utils/env.js +28 -0
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/freeport.js +21 -5
- package/build/src/utils/freeport.js.map +1 -1
- package/build/src/utils/interactive.js +1 -1
- package/build/src/utils/interactive.js.map +1 -1
- package/build/src/utils/jsonl.js +243 -0
- package/build/src/utils/jsonl.js.map +1 -0
- package/build/src/utils/port.js +4 -4
- package/build/src/utils/port.js.map +1 -1
- package/build/src/utils/progress.js +5 -0
- package/build/src/utils/progress.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/build/src/utils/url.js +4 -8
- package/build/src/utils/url.js.map +1 -1
- package/package.json +19 -20
|
@@ -15,6 +15,9 @@ _export(exports, {
|
|
|
15
15
|
extractCodeFrame: function() {
|
|
16
16
|
return extractCodeFrame;
|
|
17
17
|
},
|
|
18
|
+
formatSnippetErrorForJSONL: function() {
|
|
19
|
+
return formatSnippetErrorForJSONL;
|
|
20
|
+
},
|
|
18
21
|
formatUsingNodeStandardLibraryError: function() {
|
|
19
22
|
return formatUsingNodeStandardLibraryError;
|
|
20
23
|
},
|
|
@@ -25,6 +28,13 @@ _export(exports, {
|
|
|
25
28
|
return stripMetroInfo;
|
|
26
29
|
}
|
|
27
30
|
});
|
|
31
|
+
function _metrocore() {
|
|
32
|
+
const data = require("@expo/metro/metro-core");
|
|
33
|
+
_metrocore = function() {
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
28
38
|
function _chalk() {
|
|
29
39
|
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
|
30
40
|
_chalk = function() {
|
|
@@ -48,7 +58,9 @@ function _util() {
|
|
|
48
58
|
}
|
|
49
59
|
const _TerminalReporter = require("./TerminalReporter");
|
|
50
60
|
const _externals = require("./externals");
|
|
61
|
+
const _ansi = require("../../../utils/ansi");
|
|
51
62
|
const _env = require("../../../utils/env");
|
|
63
|
+
const _jsonl = require("../../../utils/jsonl");
|
|
52
64
|
const _link = require("../../../utils/link");
|
|
53
65
|
const _serverLogLikeMetro = require("../serverLogLikeMetro");
|
|
54
66
|
const _metroErrorInterface = require("./metroErrorInterface");
|
|
@@ -63,36 +75,60 @@ const DARK_BLOCK_CHAR = '\u2593';
|
|
|
63
75
|
const LIGHT_BLOCK_CHAR = '\u2591';
|
|
64
76
|
class MetroTerminalReporter extends _TerminalReporter.TerminalReporter {
|
|
65
77
|
constructor(projectRoot, terminal){
|
|
66
|
-
super(terminal), this.projectRoot = projectRoot;
|
|
78
|
+
super(terminal), this.projectRoot = projectRoot, this.lastFailedBuildID = undefined;
|
|
67
79
|
}
|
|
68
80
|
_log(event) {
|
|
81
|
+
const jsonlReporter = (0, _jsonl.getJsonlReporter)();
|
|
69
82
|
switch(event.type){
|
|
70
|
-
case '
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return;
|
|
83
|
+
case 'bundle_build_started':
|
|
84
|
+
{
|
|
85
|
+
const details = event.bundleDetails;
|
|
86
|
+
if (details) {
|
|
87
|
+
var _details_customTransformOptions;
|
|
88
|
+
const platform = details.platform || 'unknown';
|
|
89
|
+
const environment = (_details_customTransformOptions = details.customTransformOptions) == null ? void 0 : _details_customTransformOptions.environment;
|
|
90
|
+
jsonlReporter.emitBundlingStarted({
|
|
91
|
+
id: event.buildID,
|
|
92
|
+
platform,
|
|
93
|
+
path: details.entryFile,
|
|
94
|
+
environment
|
|
95
|
+
});
|
|
84
96
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
case 'unstable_server_log':
|
|
100
|
+
{
|
|
101
|
+
var _event_data;
|
|
102
|
+
if (typeof ((_event_data = event.data) == null ? void 0 : _event_data[0]) === 'string') {
|
|
103
|
+
const message = event.data[0];
|
|
104
|
+
if (message.match(/JavaScript logs have moved/)) {
|
|
105
|
+
// Hide this very loud message from upstream React Native in favor of the note in the terminal UI:
|
|
106
|
+
// The "› Press j │ open debugger"
|
|
107
|
+
// logger?.info(
|
|
108
|
+
// '\u001B[1m\u001B[7m💡 JavaScript logs have moved!\u001B[22m They can now be ' +
|
|
109
|
+
// 'viewed in React Native DevTools. Tip: Type \u001B[1mj\u001B[22m in ' +
|
|
110
|
+
// 'the terminal to open (requires Google Chrome or Microsoft Edge).' +
|
|
111
|
+
// '\u001B[27m',
|
|
112
|
+
// );
|
|
91
113
|
return;
|
|
92
114
|
}
|
|
115
|
+
if (!_env.env.EXPO_DEBUG) {
|
|
116
|
+
// In the context of developing an iOS app or website, the MetroInspectorProxy "connection" logs are very confusing.
|
|
117
|
+
// 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.
|
|
118
|
+
// 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.
|
|
119
|
+
if (message.match(/Connection (closed|established|failed|terminated)/i)) {
|
|
120
|
+
// Skip logging.
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
93
124
|
}
|
|
125
|
+
// In JSONL mode, emit server log events and skip normal terminal logging
|
|
126
|
+
if (jsonlReporter.emitServerLog({
|
|
127
|
+
level: event.level,
|
|
128
|
+
value: event.data ?? []
|
|
129
|
+
})) return;
|
|
130
|
+
break;
|
|
94
131
|
}
|
|
95
|
-
break;
|
|
96
132
|
case 'client_log':
|
|
97
133
|
{
|
|
98
134
|
if (this.shouldFilterClientLog(event)) {
|
|
@@ -140,11 +176,21 @@ class MetroTerminalReporter extends _TerminalReporter.TerminalReporter {
|
|
|
140
176
|
});
|
|
141
177
|
// Using EXPO_DEBUG we can print all stack
|
|
142
178
|
const filtered = usefulStackCount && !_env.env.EXPO_DEBUG ? symbolicated.filter((_, index)=>!fallbackIndices.includes(index)) : symbolicated;
|
|
179
|
+
if (jsonlReporter.emitConsole({
|
|
180
|
+
level,
|
|
181
|
+
source: 'client',
|
|
182
|
+
value: filtered
|
|
183
|
+
})) return;
|
|
143
184
|
(0, _serverLogLikeMetro.logLikeMetro)(this.terminal.log.bind(this.terminal), level, null, ...filtered);
|
|
144
185
|
})();
|
|
145
186
|
return;
|
|
146
187
|
}
|
|
147
188
|
}
|
|
189
|
+
if (jsonlReporter.emitConsole({
|
|
190
|
+
level,
|
|
191
|
+
source: 'client',
|
|
192
|
+
value: event.data
|
|
193
|
+
})) return;
|
|
148
194
|
// Overwrite the Metro terminal logging so we can improve the warnings, symbolicate stacks, and inject extra info.
|
|
149
195
|
(0, _serverLogLikeMetro.logLikeMetro)(this.terminal.log.bind(this.terminal), level, null, ...event.data);
|
|
150
196
|
return;
|
|
@@ -162,6 +208,7 @@ class MetroTerminalReporter extends _TerminalReporter.TerminalReporter {
|
|
|
162
208
|
* @returns `iOS path/to/bundle.js ▓▓▓▓▓░░░░░░░░░░░ 36.6% (4790/7922)`
|
|
163
209
|
*/ _getBundleStatusMessage(progress, phase) {
|
|
164
210
|
var _progress_bundleDetails_customTransformOptions, _progress_bundleDetails;
|
|
211
|
+
const jsonlReporter = (0, _jsonl.getJsonlReporter)();
|
|
165
212
|
const env = getEnvironmentForBuildDetails(progress.bundleDetails);
|
|
166
213
|
const platform = env || getPlatformTagForBuildDetails(progress.bundleDetails);
|
|
167
214
|
const inProgress = phase === 'in_progress';
|
|
@@ -176,30 +223,55 @@ class MetroTerminalReporter extends _TerminalReporter.TerminalReporter {
|
|
|
176
223
|
localPath = _path().default.isAbsolute(inputFile) ? _path().default.relative(this.projectRoot, inputFile) : inputFile;
|
|
177
224
|
}
|
|
178
225
|
if (!inProgress) {
|
|
179
|
-
const status = phase === 'done' ? `Bundled ` : `Bundling failed `;
|
|
180
|
-
const color = phase === 'done' ? _chalk().default.green : _chalk().default.red;
|
|
181
226
|
const startTime = this._bundleTimers.get(progress.bundleDetails.buildID);
|
|
182
|
-
let time =
|
|
227
|
+
let time = undefined;
|
|
183
228
|
if (startTime != null) {
|
|
184
229
|
const elapsed = this._getElapsedTime(startTime);
|
|
185
|
-
const micro = Number(elapsed) / 1000;
|
|
186
230
|
const converted = Number(elapsed) / 1e6;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
231
|
+
time = converted;
|
|
232
|
+
}
|
|
233
|
+
// Emit bundling.done in JSONL mode and return empty string
|
|
234
|
+
if (phase === 'done') {
|
|
235
|
+
if (jsonlReporter.emitBundlingDone({
|
|
236
|
+
id: progress.bundleDetails.buildID,
|
|
237
|
+
duration: time,
|
|
238
|
+
totalModules: progress.totalFileCount
|
|
239
|
+
})) {
|
|
240
|
+
return '';
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
// Return empty string for failed phase in JSONL mode (error is emitted by _logBundlingError)
|
|
244
|
+
if (phase === 'failed' && jsonlReporter.isEnabled) {
|
|
245
|
+
return '';
|
|
246
|
+
}
|
|
247
|
+
const status = phase === 'done' ? `Bundled ` : `Bundling failed `;
|
|
248
|
+
const color = phase === 'done' ? _chalk().default.green : _chalk().default.red;
|
|
249
|
+
let timeLabel = '';
|
|
250
|
+
// If the milliseconds are < 0.5 then it will display as 0, so we display in microseconds.
|
|
251
|
+
if (time !== undefined) {
|
|
252
|
+
if (time <= 0.5) {
|
|
190
253
|
// Format as microseconds to nearest tenth
|
|
191
|
-
|
|
254
|
+
timeLabel = _chalk().default.cyan.bold(`${time.toFixed(1)}ms`);
|
|
192
255
|
} else {
|
|
193
|
-
|
|
256
|
+
timeLabel = _chalk().default.dim(time.toFixed(0) + 'ms');
|
|
194
257
|
}
|
|
195
258
|
}
|
|
196
259
|
// iOS Bundled 150ms
|
|
197
260
|
const plural = progress.totalFileCount === 1 ? '' : 's';
|
|
198
|
-
return color(platform + status) +
|
|
261
|
+
return color(platform + status) + timeLabel + _chalk().default.reset.dim(` ${localPath} (${progress.totalFileCount} module${plural})`);
|
|
199
262
|
}
|
|
200
263
|
const filledBar = Math.floor(progress.ratio * MAX_PROGRESS_BAR_CHAR_WIDTH);
|
|
201
264
|
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
|
-
|
|
265
|
+
if ((0, _jsonl.getJsonlReporter)().emitBundlingProgress({
|
|
266
|
+
id: progress.bundleDetails.buildID ?? 'unknown',
|
|
267
|
+
progress: progress.ratio,
|
|
268
|
+
total: progress.totalFileCount,
|
|
269
|
+
current: progress.transformedFileCount
|
|
270
|
+
})) {
|
|
271
|
+
return '';
|
|
272
|
+
} else {
|
|
273
|
+
return platform + _chalk().default.reset.dim(`${_path().default.dirname(localPath)}${_path().default.sep}`) + _chalk().default.bold(_path().default.basename(localPath)) + ' ' + _progress;
|
|
274
|
+
}
|
|
203
275
|
}
|
|
204
276
|
_logInitializing(port, hasReducedPerformance) {
|
|
205
277
|
// Don't print a giant logo...
|
|
@@ -225,9 +297,28 @@ class MetroTerminalReporter extends _TerminalReporter.TerminalReporter {
|
|
|
225
297
|
].join('\n')));
|
|
226
298
|
}
|
|
227
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* Workaround to link build ids to bundling errors.
|
|
302
|
+
* This works because `_logBundleBuildFailed` is called before `_logBundlingError` in synchronous manner.
|
|
303
|
+
* https://github.com/facebook/metro/blob/main/packages/metro/src/Server.js#L939-L945
|
|
304
|
+
*/ _logBundleBuildFailed(buildID) {
|
|
305
|
+
this.lastFailedBuildID = buildID;
|
|
306
|
+
super._logBundleBuildFailed(buildID);
|
|
307
|
+
}
|
|
228
308
|
_logBundlingError(error) {
|
|
309
|
+
// Reset the last failed build id after it's used
|
|
310
|
+
// Bundling errors can also be emitted during hot reload,
|
|
311
|
+
// where bundling id is not available.
|
|
312
|
+
// https://github.com/facebook/metro/blob/main/packages/metro/src/HmrServer.js#L384
|
|
313
|
+
const lastFailedBuildID = this.lastFailedBuildID;
|
|
314
|
+
this.lastFailedBuildID = undefined;
|
|
229
315
|
const moduleResolutionError = formatUsingNodeStandardLibraryError(this.projectRoot, error);
|
|
230
316
|
if (moduleResolutionError) {
|
|
317
|
+
if ((0, _jsonl.getJsonlReporter)().emitBundlingError({
|
|
318
|
+
id: lastFailedBuildID,
|
|
319
|
+
value: (0, _ansi.stripAnsi)(moduleResolutionError) ?? '',
|
|
320
|
+
filename: error.filename
|
|
321
|
+
})) return;
|
|
231
322
|
let message = maybeAppendCodeFrame(moduleResolutionError, error.message);
|
|
232
323
|
message += '\n\n' + (0, _metroErrorInterface.nearestImportStack)(error);
|
|
233
324
|
return this.terminal.log(message);
|
|
@@ -240,9 +331,29 @@ class MetroTerminalReporter extends _TerminalReporter.TerminalReporter {
|
|
|
240
331
|
error.message = error.stack;
|
|
241
332
|
delete error.stack;
|
|
242
333
|
}
|
|
334
|
+
if ((0, _jsonl.getJsonlReporter)().emitBundlingError({
|
|
335
|
+
id: lastFailedBuildID,
|
|
336
|
+
value: (0, _ansi.stripAnsi)(formatSnippetErrorForJSONL(error)) ?? '',
|
|
337
|
+
filename: error.filename
|
|
338
|
+
})) return;
|
|
243
339
|
return super._logBundlingError(error);
|
|
244
340
|
}
|
|
245
341
|
}
|
|
342
|
+
function formatSnippetErrorForJSONL(error) {
|
|
343
|
+
if (error instanceof _metrocore().AmbiguousModuleResolutionError) {
|
|
344
|
+
const he = error.hasteError;
|
|
345
|
+
const message = 'ambiguous resolution: module `' + `${error.fromModulePath}\` tries to require \`${he.hasteName}\`, ` + 'but there are several files providing this module. You can delete ' + 'or fix them: \n\n' + Object.keys(he.duplicatesSet).sort().map((dupFilePath)=>` * \`${dupFilePath}\`\n`).join('');
|
|
346
|
+
return message;
|
|
347
|
+
}
|
|
348
|
+
let { message } = error;
|
|
349
|
+
if (error.filename && !message.includes(error.filename)) {
|
|
350
|
+
message += ` [${error.filename}]`;
|
|
351
|
+
}
|
|
352
|
+
if (error.snippet != null) {
|
|
353
|
+
message += '\n' + error.snippet;
|
|
354
|
+
}
|
|
355
|
+
return message;
|
|
356
|
+
}
|
|
246
357
|
function formatUsingNodeStandardLibraryError(projectRoot, error) {
|
|
247
358
|
if (!error.message) {
|
|
248
359
|
return null;
|
|
@@ -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 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,KAAK;oBACQD;gBAAX,IAAI,SAAOA,cAAAA,MAAME,IAAI,qBAAVF,WAAY,CAAC,EAAE,MAAK,UAAU;oBACvC,MAAMG,UAAUH,MAAME,IAAI,CAAC,EAAE;oBAC7B,IAAIC,QAAQC,KAAK,CAAC,+BAA+B;wBAC/C,kGAAkG;wBAClG,kCAAkC;wBAElC,gBAAgB;wBAChB,oFAAoF;wBACpF,8EAA8E;wBAC9E,2EAA2E;wBAC3E,oBAAoB;wBACpB,KAAK;wBACL;oBACF;oBAEA,IAAI,CAACC,QAAG,CAACC,UAAU,EAAE;wBACnB,oHAAoH;wBACpH,kKAAkK;wBAClK,gMAAgM;wBAChM,IAAIH,QAAQC,KAAK,CAAC,uDAAuD;4BACvE,gBAAgB;4BAChB;wBACF;oBACF;gBACF;gBACA;YACF,KAAK;gBAAc;oBACjB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../../../src/start/server/metro/MetroTerminalReporter.ts"],"sourcesContent":["import { AmbiguousModuleResolutionError, 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 { stripAnsi } from '../../../utils/ansi';\nimport { env } from '../../../utils/env';\nimport { getJsonlReporter } from '../../../utils/jsonl';\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 private lastFailedBuildID: string | undefined = undefined;\n\n constructor(\n public projectRoot: string,\n terminal: Terminal\n ) {\n super(terminal);\n }\n\n _log(event: TerminalReportableEvent): void {\n const jsonlReporter = getJsonlReporter();\n\n switch (event.type) {\n case 'bundle_build_started': {\n const details = event.bundleDetails;\n if (details) {\n const platform = details.platform || 'unknown';\n const environment = details.customTransformOptions?.environment;\n jsonlReporter.emitBundlingStarted({\n id: event.buildID!,\n platform,\n path: details.entryFile,\n environment,\n });\n }\n break;\n }\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\n // In JSONL mode, emit server log events and skip normal terminal logging\n if (\n jsonlReporter.emitServerLog({\n level: event.level,\n value: event.data ?? [],\n })\n )\n return;\n break;\n }\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 if (\n jsonlReporter.emitConsole({\n level,\n source: 'client',\n value: filtered,\n })\n )\n return;\n logLikeMetro(this.terminal.log.bind(this.terminal), level, null, ...filtered);\n })();\n return;\n }\n }\n\n if (\n jsonlReporter.emitConsole({\n level,\n source: 'client',\n value: event.data,\n })\n )\n return;\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 jsonlReporter = getJsonlReporter();\n\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 startTime = this._bundleTimers.get(progress.bundleDetails.buildID!);\n\n let time: number | undefined = undefined;\n\n if (startTime != null) {\n const elapsed: bigint = this._getElapsedTime(startTime);\n const converted = Number(elapsed) / 1e6;\n time = converted;\n }\n\n // Emit bundling.done in JSONL mode and return empty string\n if (phase === 'done') {\n if (\n jsonlReporter.emitBundlingDone({\n id: progress.bundleDetails.buildID!,\n duration: time,\n totalModules: progress.totalFileCount,\n })\n ) {\n return '';\n }\n }\n\n // Return empty string for failed phase in JSONL mode (error is emitted by _logBundlingError)\n if (phase === 'failed' && jsonlReporter.isEnabled) {\n return '';\n }\n\n const status = phase === 'done' ? `Bundled ` : `Bundling failed `;\n const color = phase === 'done' ? chalk.green : chalk.red;\n\n let timeLabel: string = '';\n // If the milliseconds are < 0.5 then it will display as 0, so we display in microseconds.\n if (time !== undefined) {\n if (time <= 0.5) {\n // Format as microseconds to nearest tenth\n timeLabel = chalk.cyan.bold(`${time.toFixed(1)}ms`);\n } else {\n timeLabel = chalk.dim(time.toFixed(0) + 'ms');\n }\n }\n\n // iOS Bundled 150ms\n const plural = progress.totalFileCount === 1 ? '' : 's';\n return (\n color(platform + status) +\n timeLabel +\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 if (\n getJsonlReporter().emitBundlingProgress({\n id: progress.bundleDetails.buildID ?? 'unknown',\n progress: progress.ratio,\n total: progress.totalFileCount,\n current: progress.transformedFileCount,\n })\n ) {\n return '';\n } else {\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\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 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 // Reset the last failed build id after it's used\n // Bundling errors can also be emitted during hot reload,\n // where bundling id is not available.\n // https://github.com/facebook/metro/blob/main/packages/metro/src/HmrServer.js#L384\n const lastFailedBuildID = this.lastFailedBuildID;\n this.lastFailedBuildID = undefined;\n\n const moduleResolutionError = formatUsingNodeStandardLibraryError(this.projectRoot, error);\n if (moduleResolutionError) {\n if (\n getJsonlReporter().emitBundlingError({\n id: lastFailedBuildID,\n value: stripAnsi(moduleResolutionError) ?? '',\n filename: error.filename,\n })\n )\n return;\n\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 if (\n getJsonlReporter().emitBundlingError({\n id: lastFailedBuildID,\n value: stripAnsi(formatSnippetErrorForJSONL(error)) ?? '',\n filename: error.filename,\n })\n )\n return;\n\n return super._logBundlingError(error);\n }\n}\n\n/**\n * Based on Metro's default `_logBundlingError` implementation.\n * https://github.com/facebook/metro/blob/main/packages/metro/src/lib/TerminalReporter.js#L308\n */\nexport function formatSnippetErrorForJSONL(error: SnippetError): string {\n if (error instanceof AmbiguousModuleResolutionError) {\n const he = error.hasteError;\n const message =\n 'ambiguous resolution: module `' +\n `${error.fromModulePath}\\` tries to require \\`${he.hasteName}\\`, ` +\n 'but there are several files providing this module. You can delete ' +\n 'or fix them: \\n\\n' +\n Object.keys(he.duplicatesSet)\n .sort()\n .map((dupFilePath) => ` * \\`${dupFilePath}\\`\\n`)\n .join('');\n return message;\n }\n\n let { message } = error;\n\n if (error.filename && !message.includes(error.filename)) {\n message += ` [${error.filename}]`;\n }\n\n if (error.snippet != null) {\n message += '\\n' + error.snippet;\n }\n\n return message;\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","formatSnippetErrorForJSONL","formatUsingNodeStandardLibraryError","isNodeStdLibraryModule","stripMetroInfo","debug","require","MAX_PROGRESS_BAR_CHAR_WIDTH","DARK_BLOCK_CHAR","LIGHT_BLOCK_CHAR","TerminalReporter","constructor","projectRoot","terminal","lastFailedBuildID","undefined","_log","event","jsonlReporter","getJsonlReporter","type","details","bundleDetails","platform","environment","customTransformOptions","emitBundlingStarted","id","buildID","path","entryFile","data","message","match","env","EXPO_DEBUG","emitServerLog","level","value","shouldFilterClientLog","hasStack","parsed","map","msg","includes","stack","parseErrorStringToObject","symbolicating","p","maybeSymbolicateAndFormatJSErrorStackLogAsync","usefulStackCount","fallbackIndices","symbolicated","Promise","allSettled","s","index","status","reason","isFallback","push","filtered","filter","_","emitConsole","source","logLikeMetro","log","bind","_getElapsedTime","startTime","process","hrtime","bigint","_getBundleStatusMessage","progress","phase","getEnvironmentForBuildDetails","getPlatformTagForBuildDetails","inProgress","localPath","dom","sep","replace","inputFile","isAbsolute","relative","_bundleTimers","get","time","elapsed","converted","Number","emitBundlingDone","duration","totalModules","totalFileCount","isEnabled","color","chalk","green","red","timeLabel","cyan","bold","toFixed","dim","plural","reset","filledBar","Math","floor","ratio","_progress","bgGreen","repeat","bgWhite","white","padStart","transformedFileCount","toString","length","emitBundlingProgress","total","current","dirname","basename","_logInitializing","port","hasReducedPerformance","isAppRegistryStartupMessage","shouldFilterBundleEvent","bundleType","transformCacheReset","logWarning","dependencyGraphLoading","join","_logBundleBuildFailed","_logBundlingError","error","moduleResolutionError","emitBundlingError","stripAnsi","filename","maybeAppendCodeFrame","nearestImportStack","attachImportStackToRootMessage","snippet","SyntaxError","AmbiguousModuleResolutionError","he","hasteError","fromModulePath","hasteName","Object","keys","duplicatesSet","sort","dupFilePath","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","trim"],"mappings":";;;;;;;;;;;IAkCaA,qBAAqB;eAArBA;;IAucGC,gBAAgB;eAAhBA;;IAzFAC,0BAA0B;eAA1BA;;IAmCAC,mCAAmC;eAAnCA;;IAwCAC,sBAAsB;eAAtBA;;IAkCAC,cAAc;eAAdA;;;;yBA7f8C;;;;;;;gEAC5C;;;;;;;gEACD;;;;;;;yBACwB;;;;;;kCAEI;2BAQT;sBACV;qBACN;uBACa;sBACP;oCAKnB;qCAC4D;;;;;;AAEnE,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,MAAMC,8BAA8B;AACpC,MAAMC,kBAAk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C,SAAS;YAAWC,KAAK;QAAM,CAAC,CAAChK,SAAS,IAAIA;QAC9E,OAAO,GAAG4E,gBAAK,CAACK,IAAI,CAAC4E,WAAW,CAAC,CAAC;IACpC;IAEA,OAAO;AACT;AACA,gEAAgE,GAChE,SAASvG,8BAA8BvD,aAAoC;QAE7DA,uCAQVA,wCACOA;IAVT,iGAAiG;IACjG,MAAMY,MAAMZ,CAAAA,kCAAAA,wCAAAA,cAAeG,sBAAsB,qBAArCH,sCAAuCE,WAAW,KAAI;IAClE,IAAIU,QAAQ,QAAQ;QAClB,OAAOiE,gBAAK,CAACK,IAAI,CAAC,OAAO;IAC3B,OAAO,IAAItE,QAAQ,gBAAgB;QACjC,OAAOiE,gBAAK,CAACK,IAAI,CAAC,CAAC,IAAI,EAAE1B,8BAA8BxD,eAAekK,IAAI,GAAG,CAAC,CAAC,IAAI;IACrF;IAEA,IACElK,CAAAA,kCAAAA,yCAAAA,cAAeG,sBAAsB,qBAArCH,uCAAuC2D,GAAG,KAC1C,QAAO3D,kCAAAA,yCAAAA,cAAeG,sBAAsB,qBAArCH,uCAAuC2D,GAAG,MAAK,UACtD;QACA,OAAOkB,gBAAK,CAACK,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI;IAC7B;IAEA,OAAO;AACT"}
|
|
@@ -73,7 +73,7 @@ function _interop_require_default(obj) {
|
|
|
73
73
|
const debug = require('debug')('expo:rsc');
|
|
74
74
|
const getMetroServerRootMemo = (0, _fn.memoize)(_paths().getMetroServerRoot);
|
|
75
75
|
function createServerComponentsMiddleware(projectRoot, { rscPath, instanceMetroOptions, ssrLoadModule, ssrLoadModuleArtifacts, useClientRouter, createModuleId, routerOptions }) {
|
|
76
|
-
const routerModule = useClientRouter ? '@expo/router-server/build/rsc/router/noopRouter' : '@expo/router-server/build/rsc/router/expo-definedRouter';
|
|
76
|
+
const routerModule = useClientRouter ? require.resolve('@expo/router-server/build/rsc/router/noopRouter') : require.resolve('@expo/router-server/build/rsc/router/expo-definedRouter');
|
|
77
77
|
const rscMiddleware = (0, _private().getRscMiddleware)({
|
|
78
78
|
config: {},
|
|
79
79
|
// Disabled in development
|
|
@@ -359,7 +359,7 @@ function createServerComponentsMiddleware(projectRoot, { rscPath, instanceMetroO
|
|
|
359
359
|
return rscRendererCache.get(platform);
|
|
360
360
|
}
|
|
361
361
|
// TODO: Extract CSS Modules / Assets from the bundler process
|
|
362
|
-
const renderer = await ssrLoadModule('@expo/router-server/build/rsc/rsc-renderer', {
|
|
362
|
+
const renderer = await ssrLoadModule(require.resolve('@expo/router-server/build/rsc/rsc-renderer'), {
|
|
363
363
|
environment: 'react-server',
|
|
364
364
|
platform
|
|
365
365
|
});
|