@expo/cli 54.1.0-canary-20251015-a6a1272 → 54.1.0-canary-20251023-4c86f95
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 +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +43 -3
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/index.js +2 -1
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/resolveOptions.js +1 -1
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +29 -9
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +2 -4
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/externals.js +0 -11
- package/build/src/start/server/metro/externals.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +14 -10
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/log-box/LogBoxLog.js +11 -7
- package/build/src/start/server/metro/log-box/LogBoxLog.js.map +1 -1
- package/build/src/start/server/metro/log-box/LogBoxSymbolication.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +14 -43
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +55 -43
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/serverLogLikeMetro.js +1 -1
- package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
- package/build/src/utils/env.js +6 -0
- package/build/src/utils/env.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/package.json +20 -18
- package/static/canary/react-is/cjs/react-is.development.js +0 -133
- package/static/canary/react-is/cjs/react-is.production.js +0 -130
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js +0 -16820
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-prod.js +0 -10552
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactFabric-profiling.js +0 -11255
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +0 -17064
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +0 -10742
- package/static/canary/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +0 -11450
- package/static/canary/scheduler/cjs/scheduler-unstable_mock.development.js +0 -414
- package/static/canary/scheduler/cjs/scheduler-unstable_mock.production.js +0 -406
- package/static/canary/scheduler/cjs/scheduler-unstable_post_task.development.js +0 -150
- package/static/canary/scheduler/cjs/scheduler-unstable_post_task.production.js +0 -140
- package/static/canary/scheduler/cjs/scheduler.development.js +0 -364
- package/static/canary/scheduler/cjs/scheduler.native.development.js +0 -350
- package/static/canary/scheduler/cjs/scheduler.native.production.js +0 -330
- package/static/canary/scheduler/cjs/scheduler.production.js +0 -340
- package/static/canary-full/node_modules/react/LICENSE +0 -21
- package/static/canary-full/node_modules/react/README.md +0 -37
- package/static/canary-full/node_modules/react/cjs/react-compiler-runtime.development.js +0 -24
- package/static/canary-full/node_modules/react/cjs/react-compiler-runtime.production.js +0 -16
- package/static/canary-full/node_modules/react/cjs/react-compiler-runtime.profiling.js +0 -16
- package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.development.js +0 -349
- package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.production.js +0 -14
- package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.profiling.js +0 -14
- package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.react-server.development.js +0 -385
- package/static/canary-full/node_modules/react/cjs/react-jsx-dev-runtime.react-server.production.js +0 -40
- package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.development.js +0 -358
- package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.production.js +0 -34
- package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.profiling.js +0 -34
- package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.react-server.development.js +0 -385
- package/static/canary-full/node_modules/react/cjs/react-jsx-runtime.react-server.production.js +0 -40
- package/static/canary-full/node_modules/react/cjs/react.development.js +0 -1250
- package/static/canary-full/node_modules/react/cjs/react.production.js +0 -544
- package/static/canary-full/node_modules/react/cjs/react.react-server.development.js +0 -815
- package/static/canary-full/node_modules/react/cjs/react.react-server.production.js +0 -429
- package/static/canary-full/node_modules/react/compiler-runtime.js +0 -14
- package/static/canary-full/node_modules/react/index.js +0 -7
- package/static/canary-full/node_modules/react/jsx-dev-runtime.js +0 -7
- package/static/canary-full/node_modules/react/jsx-dev-runtime.react-server.js +0 -7
- package/static/canary-full/node_modules/react/jsx-runtime.js +0 -7
- package/static/canary-full/node_modules/react/jsx-runtime.react-server.js +0 -7
- package/static/canary-full/node_modules/react/package.json +0 -51
- package/static/canary-full/node_modules/react/react.react-server.js +0 -7
- package/static/canary-full/node_modules/react-dom/LICENSE +0 -21
- package/static/canary-full/node_modules/react-dom/README.md +0 -60
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-client.development.js +0 -25089
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-client.production.js +0 -15426
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-profiling.development.js +0 -25476
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-profiling.profiling.js +0 -16296
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +0 -9035
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +0 -5892
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js +0 -9035
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.js +0 -5972
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.browser.development.js +0 -9424
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.browser.production.js +0 -6384
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.bun.development.js +0 -8739
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.bun.production.js +0 -5967
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.edge.development.js +0 -9443
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.edge.production.js +0 -6477
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.node.development.js +0 -9317
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-server.node.production.js +0 -6372
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-test-utils.development.js +0 -24
- package/static/canary-full/node_modules/react-dom/cjs/react-dom-test-utils.production.js +0 -21
- package/static/canary-full/node_modules/react-dom/cjs/react-dom.development.js +0 -424
- package/static/canary-full/node_modules/react-dom/cjs/react-dom.production.js +0 -210
- package/static/canary-full/node_modules/react-dom/cjs/react-dom.react-server.development.js +0 -340
- package/static/canary-full/node_modules/react-dom/cjs/react-dom.react-server.production.js +0 -152
- package/static/canary-full/node_modules/react-dom/client.js +0 -38
- package/static/canary-full/node_modules/react-dom/client.react-server.js +0 -5
- package/static/canary-full/node_modules/react-dom/index.js +0 -38
- package/static/canary-full/node_modules/react-dom/package.json +0 -117
- package/static/canary-full/node_modules/react-dom/profiling.js +0 -38
- package/static/canary-full/node_modules/react-dom/profiling.react-server.js +0 -5
- package/static/canary-full/node_modules/react-dom/react-dom.react-server.js +0 -7
- package/static/canary-full/node_modules/react-dom/server.browser.js +0 -18
- package/static/canary-full/node_modules/react-dom/server.bun.js +0 -19
- package/static/canary-full/node_modules/react-dom/server.edge.js +0 -19
- package/static/canary-full/node_modules/react-dom/server.js +0 -3
- package/static/canary-full/node_modules/react-dom/server.node.js +0 -18
- package/static/canary-full/node_modules/react-dom/server.react-server.js +0 -5
- package/static/canary-full/node_modules/react-dom/static.browser.js +0 -12
- package/static/canary-full/node_modules/react-dom/static.edge.js +0 -12
- package/static/canary-full/node_modules/react-dom/static.js +0 -3
- package/static/canary-full/node_modules/react-dom/static.node.js +0 -12
- package/static/canary-full/node_modules/react-dom/static.react-server.js +0 -5
- package/static/canary-full/node_modules/react-dom/test-utils.js +0 -7
|
@@ -99,14 +99,16 @@ class LogBoxLog {
|
|
|
99
99
|
this.count += 1;
|
|
100
100
|
}
|
|
101
101
|
getAvailableStack(type) {
|
|
102
|
-
|
|
102
|
+
var _this_symbolicated_type;
|
|
103
|
+
if (((_this_symbolicated_type = this.symbolicated[type]) == null ? void 0 : _this_symbolicated_type.status) === 'COMPLETE') {
|
|
103
104
|
return this.symbolicated[type].stack;
|
|
104
105
|
}
|
|
105
106
|
return this.getStack(type);
|
|
106
107
|
}
|
|
107
108
|
flushCallbacks(type) {
|
|
109
|
+
var _this_symbolicated_type;
|
|
108
110
|
const callbacks = this.callbacks.get(type);
|
|
109
|
-
const status = this.symbolicated[type].status;
|
|
111
|
+
const status = (_this_symbolicated_type = this.symbolicated[type]) == null ? void 0 : _this_symbolicated_type.status;
|
|
110
112
|
if (callbacks) {
|
|
111
113
|
for (const callback of callbacks){
|
|
112
114
|
callback(status);
|
|
@@ -129,10 +131,11 @@ class LogBoxLog {
|
|
|
129
131
|
this._symbolicate(type, false, callback);
|
|
130
132
|
}
|
|
131
133
|
_symbolicate(type, retry, callback) {
|
|
134
|
+
var _this_symbolicated_type;
|
|
132
135
|
if (callback) {
|
|
133
136
|
this.pushCallback(type, callback);
|
|
134
137
|
}
|
|
135
|
-
const status = this.symbolicated[type].status;
|
|
138
|
+
const status = (_this_symbolicated_type = this.symbolicated[type]) == null ? void 0 : _this_symbolicated_type.status;
|
|
136
139
|
if (status === 'COMPLETE') {
|
|
137
140
|
return this.flushCallbacks(type);
|
|
138
141
|
}
|
|
@@ -155,11 +158,11 @@ class LogBoxLog {
|
|
|
155
158
|
return this.stack;
|
|
156
159
|
}
|
|
157
160
|
handleSymbolicate(type) {
|
|
158
|
-
var _this_componentStack;
|
|
161
|
+
var _this_componentStack, _this_symbolicated_type;
|
|
159
162
|
if (type === 'component' && !((_this_componentStack = this.componentStack) == null ? void 0 : _this_componentStack.length)) {
|
|
160
163
|
return;
|
|
161
164
|
}
|
|
162
|
-
if (this.symbolicated[type].status !== 'PENDING') {
|
|
165
|
+
if (((_this_symbolicated_type = this.symbolicated[type]) == null ? void 0 : _this_symbolicated_type.status) !== 'PENDING') {
|
|
163
166
|
this.updateStatus(type, null, null, null);
|
|
164
167
|
_LogBoxSymbolication.symbolicate(this.getStack(type)).then((data)=>{
|
|
165
168
|
this.updateStatus(type, null, data == null ? void 0 : data.stack, data == null ? void 0 : data.codeFrame);
|
|
@@ -169,7 +172,8 @@ class LogBoxLog {
|
|
|
169
172
|
}
|
|
170
173
|
}
|
|
171
174
|
updateStatus(type, error, stack, codeFrame) {
|
|
172
|
-
|
|
175
|
+
var _this_symbolicated_type, _this_symbolicated_type1;
|
|
176
|
+
const lastStatus = (_this_symbolicated_type = this.symbolicated[type]) == null ? void 0 : _this_symbolicated_type.status;
|
|
173
177
|
if (error != null) {
|
|
174
178
|
this.symbolicated[type] = {
|
|
175
179
|
error,
|
|
@@ -192,7 +196,7 @@ class LogBoxLog {
|
|
|
192
196
|
status: 'PENDING'
|
|
193
197
|
};
|
|
194
198
|
}
|
|
195
|
-
const status = this.symbolicated[type].status;
|
|
199
|
+
const status = (_this_symbolicated_type1 = this.symbolicated[type]) == null ? void 0 : _this_symbolicated_type1.status;
|
|
196
200
|
if (lastStatus !== status) {
|
|
197
201
|
if ([
|
|
198
202
|
'COMPLETE',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/log-box/LogBoxLog.ts"],"sourcesContent":["/**\n * Copyright (c) 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport * as LogBoxSymbolication from './LogBoxSymbolication';\nimport type { CodeFrame, StackFrame } from './LogBoxSymbolication';\n\ntype Category = string;\n\ntype Message = {\n content: string;\n substitutions: {\n length: number;\n offset: number;\n }[];\n};\n\ntype ComponentStack = CodeFrame[];\n\ntype SymbolicationStatus = 'NONE' | 'PENDING' | 'COMPLETE' | 'FAILED';\n\nexport type LogLevel = 'warn' | 'error' | 'fatal' | 'syntax' | 'static';\n\nexport type LogBoxLogData = {\n level: LogLevel;\n type?: string;\n message: Message;\n stack: StackFrame[];\n category: string;\n componentStack: ComponentStack;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n};\n\nexport type StackType = 'stack' | 'component';\n\nfunction componentStackToStack(componentStack: ComponentStack): StackFrame[] {\n return componentStack.map((stack) => ({\n file: stack.fileName,\n methodName: stack.content,\n lineNumber: stack.location?.row ?? 0,\n column: stack.location?.column ?? 0,\n arguments: [],\n }));\n}\n\ntype SymbolicationCallback = (status: SymbolicationStatus) => void;\n\ntype SymbolicationResult =\n | { error: null; stack: null; status: 'NONE' }\n | { error: null; stack: null; status: 'PENDING' }\n | { error: null; stack: StackFrame[]; status: 'COMPLETE' }\n | { error: Error; stack: null; status: 'FAILED' };\n\nexport class LogBoxLog {\n message: Message;\n type: string;\n category: Category;\n componentStack: ComponentStack;\n stack: StackFrame[];\n count: number;\n level: LogLevel;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n symbolicated: Record<StackType, SymbolicationResult> = {\n stack: {\n error: null,\n stack: null,\n status: 'NONE',\n },\n component: {\n error: null,\n stack: null,\n status: 'NONE',\n },\n };\n\n private callbacks: Map<StackType, Set<SymbolicationCallback>> = new Map();\n\n constructor(\n data: LogBoxLogData & {\n symbolicated?: Record<StackType, SymbolicationResult>;\n }\n ) {\n this.level = data.level;\n this.type = data.type ?? 'error';\n this.message = data.message;\n this.stack = data.stack;\n this.category = data.category;\n this.componentStack = data.componentStack;\n this.codeFrame = data.codeFrame;\n this.isComponentError = data.isComponentError;\n this.count = 1;\n this.symbolicated = data.symbolicated ?? this.symbolicated;\n }\n\n incrementCount(): void {\n this.count += 1;\n }\n\n getAvailableStack(type: StackType): StackFrame[] | null {\n if (this.symbolicated[type].status === 'COMPLETE') {\n return this.symbolicated[type].stack;\n }\n return this.getStack(type);\n }\n\n private flushCallbacks(type: StackType): void {\n const callbacks = this.callbacks.get(type);\n const status = this.symbolicated[type].status;\n if (callbacks) {\n for (const callback of callbacks) {\n callback(status);\n }\n callbacks.clear();\n }\n }\n\n private pushCallback(type: StackType, callback: SymbolicationCallback): void {\n let callbacks = this.callbacks.get(type);\n if (!callbacks) {\n callbacks = new Set();\n this.callbacks.set(type, callbacks);\n }\n callbacks.add(callback);\n }\n\n retrySymbolicate(type: StackType, callback?: (status: SymbolicationStatus) => void): void {\n this._symbolicate(type, true, callback);\n }\n\n symbolicate(type: StackType, callback?: (status: SymbolicationStatus) => void): void {\n this._symbolicate(type, false, callback);\n }\n\n private _symbolicate(\n type: StackType,\n retry: boolean,\n callback?: (status: SymbolicationStatus) => void\n ): void {\n if (callback) {\n this.pushCallback(type, callback);\n }\n const status = this.symbolicated[type].status;\n\n if (status === 'COMPLETE') {\n return this.flushCallbacks(type);\n }\n\n if (retry) {\n LogBoxSymbolication.deleteStack(this.getStack(type));\n this.handleSymbolicate(type);\n } else {\n if (status === 'NONE') {\n this.handleSymbolicate(type);\n }\n }\n }\n\n private componentStackCache: StackFrame[] | null = null;\n\n private getStack(type: StackType): StackFrame[] {\n if (type === 'component') {\n if (this.componentStackCache == null) {\n this.componentStackCache = componentStackToStack(this.componentStack);\n }\n return this.componentStackCache;\n }\n return this.stack;\n }\n\n private handleSymbolicate(type: StackType): void {\n if (type === 'component' && !this.componentStack?.length) {\n return;\n }\n\n if (this.symbolicated[type].status !== 'PENDING') {\n this.updateStatus(type, null, null, null);\n LogBoxSymbolication.symbolicate(this.getStack(type)).then(\n (data) => {\n this.updateStatus(type, null, data?.stack, data?.codeFrame);\n },\n (error) => {\n this.updateStatus(type, error, null, null);\n }\n );\n }\n }\n\n private updateStatus(\n type: StackType,\n error?: Error | null,\n stack?: StackFrame[] | null,\n codeFrame?: CodeFrame | null\n ): void {\n const lastStatus = this.symbolicated[type].status;\n if (error != null) {\n this.symbolicated[type] = {\n error,\n stack: null,\n status: 'FAILED',\n };\n } else if (stack != null) {\n if (codeFrame) {\n this.codeFrame = codeFrame;\n }\n\n this.symbolicated[type] = {\n error: null,\n stack,\n status: 'COMPLETE',\n };\n } else {\n this.symbolicated[type] = {\n error: null,\n stack: null,\n status: 'PENDING',\n };\n }\n\n const status = this.symbolicated[type].status;\n if (lastStatus !== status) {\n if (['COMPLETE', 'FAILED'].includes(status)) {\n this.flushCallbacks(type);\n }\n }\n }\n}\n"],"names":["LogBoxLog","componentStackToStack","componentStack","map","stack","file","fileName","methodName","content","lineNumber","location","row","column","arguments","constructor","data","symbolicated","error","status","component","callbacks","Map","componentStackCache","level","type","message","category","codeFrame","isComponentError","count","incrementCount","getAvailableStack","getStack","flushCallbacks","get","callback","clear","pushCallback","Set","set","add","retrySymbolicate","_symbolicate","symbolicate","retry","LogBoxSymbolication","deleteStack","handleSymbolicate","length","updateStatus","then","lastStatus","includes"],"mappings":"AAAA;;;;;;CAMC;;;;+BAoDYA;;;eAAAA;;;6EAlDwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCrC,SAASC,sBAAsBC,cAA8B;IAC3D,OAAOA,eAAeC,GAAG,CAAC,CAACC;YAGbA,iBACJA;eAJ4B;YACpCC,MAAMD,MAAME,QAAQ;YACpBC,YAAYH,MAAMI,OAAO;YACzBC,YAAYL,EAAAA,kBAAAA,MAAMM,QAAQ,qBAAdN,gBAAgBO,GAAG,KAAI;YACnCC,QAAQR,EAAAA,mBAAAA,MAAMM,QAAQ,qB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AAA,IAAI,CAACtB,cAAc,qBAAnB,qBAAqB8C,MAAM,GAAE;YACxD;QACF;QAEA,IAAI,IAAI,CAAChC,YAAY,CAACQ,KAAK,CAACN,MAAM,KAAK,WAAW;YAChD,IAAI,CAAC+B,YAAY,CAACzB,MAAM,MAAM,MAAM;YACpCqB,qBAAoBF,WAAW,CAAC,IAAI,CAACX,QAAQ,CAACR,OAAO0B,IAAI,CACvD,CAACnC;gBACC,IAAI,CAACkC,YAAY,CAACzB,MAAM,MAAMT,wBAAAA,KAAMX,KAAK,EAAEW,wBAAAA,KAAMY,SAAS;YAC5D,GACA,CAACV;gBACC,IAAI,CAACgC,YAAY,CAACzB,MAAMP,OAAO,MAAM;YACvC;QAEJ;IACF;IAEQgC,aACNzB,IAAe,EACfP,KAAoB,EACpBb,KAA2B,EAC3BuB,SAA4B,EACtB;QACN,MAAMwB,aAAa,IAAI,CAACnC,YAAY,CAACQ,KAAK,CAACN,MAAM;QACjD,IAAID,SAAS,MAAM;YACjB,IAAI,CAACD,YAAY,CAACQ,KAAK,GAAG;gBACxBP;gBACAb,OAAO;gBACPc,QAAQ;YACV;QACF,OAAO,IAAId,SAAS,MAAM;YACxB,IAAIuB,WAAW;gBACb,IAAI,CAACA,SAAS,GAAGA;YACnB;YAEA,IAAI,CAACX,YAAY,CAACQ,KAAK,GAAG;gBACxBP,OAAO;gBACPb;gBACAc,QAAQ;YACV;QACF,OAAO;YACL,IAAI,CAACF,YAAY,CAACQ,KAAK,GAAG;gBACxBP,OAAO;gBACPb,OAAO;gBACPc,QAAQ;YACV;QACF;QAEA,MAAMA,SAAS,IAAI,CAACF,YAAY,CAACQ,KAAK,CAACN,MAAM;QAC7C,IAAIiC,eAAejC,QAAQ;YACzB,IAAI;gBAAC;gBAAY;aAAS,CAACkC,QAAQ,CAAClC,SAAS;gBAC3C,IAAI,CAACe,cAAc,CAACT;YACtB;QACF;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/metro/log-box/LogBoxLog.ts"],"sourcesContent":["/**\n * Copyright (c) 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport * as LogBoxSymbolication from './LogBoxSymbolication';\nimport type { CodeFrame, StackFrame } from './LogBoxSymbolication';\n\ntype Category = string;\n\ntype Message = {\n content: string;\n substitutions: {\n length: number;\n offset: number;\n }[];\n};\n\ntype ComponentStack = CodeFrame[];\n\ntype SymbolicationStatus = 'NONE' | 'PENDING' | 'COMPLETE' | 'FAILED';\n\nexport type LogLevel = 'warn' | 'error' | 'fatal' | 'syntax' | 'resolution' | 'static';\n\nexport type LogBoxLogData = {\n level: LogLevel;\n type?: string;\n message: Message;\n stack: StackFrame[];\n category: string;\n componentStack: ComponentStack;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n};\n\nexport type StackType = 'stack' | 'component';\n\nfunction componentStackToStack(componentStack: ComponentStack): StackFrame[] {\n return componentStack.map((stack) => ({\n file: stack.fileName,\n methodName: stack.content,\n lineNumber: stack.location?.row ?? 0,\n column: stack.location?.column ?? 0,\n arguments: [],\n }));\n}\n\ntype SymbolicationCallback = (status: SymbolicationStatus) => void;\n\ntype SymbolicationResult =\n | { error: null; stack: null; status: 'NONE' }\n | { error: null; stack: null; status: 'PENDING' }\n | { error: null; stack: StackFrame[]; status: 'COMPLETE' }\n | { error: Error; stack: null; status: 'FAILED' };\n\nexport class LogBoxLog {\n message: Message;\n type: string;\n category: Category;\n componentStack: ComponentStack;\n stack: StackFrame[];\n count: number;\n level: LogLevel;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n symbolicated: Record<StackType, SymbolicationResult> = {\n stack: {\n error: null,\n stack: null,\n status: 'NONE',\n },\n component: {\n error: null,\n stack: null,\n status: 'NONE',\n },\n };\n\n private callbacks: Map<StackType, Set<SymbolicationCallback>> = new Map();\n\n constructor(\n data: LogBoxLogData & {\n symbolicated?: Record<StackType, SymbolicationResult>;\n }\n ) {\n this.level = data.level;\n this.type = data.type ?? 'error';\n this.message = data.message;\n this.stack = data.stack;\n this.category = data.category;\n this.componentStack = data.componentStack;\n this.codeFrame = data.codeFrame;\n this.isComponentError = data.isComponentError;\n this.count = 1;\n this.symbolicated = data.symbolicated ?? this.symbolicated;\n }\n\n incrementCount(): void {\n this.count += 1;\n }\n\n getAvailableStack(type: StackType): StackFrame[] | null {\n if (this.symbolicated[type]?.status === 'COMPLETE') {\n return this.symbolicated[type].stack;\n }\n return this.getStack(type);\n }\n\n private flushCallbacks(type: StackType): void {\n const callbacks = this.callbacks.get(type);\n const status = this.symbolicated[type]?.status;\n if (callbacks) {\n for (const callback of callbacks) {\n callback(status);\n }\n callbacks.clear();\n }\n }\n\n private pushCallback(type: StackType, callback: SymbolicationCallback): void {\n let callbacks = this.callbacks.get(type);\n if (!callbacks) {\n callbacks = new Set();\n this.callbacks.set(type, callbacks);\n }\n callbacks.add(callback);\n }\n\n retrySymbolicate(type: StackType, callback?: (status: SymbolicationStatus) => void): void {\n this._symbolicate(type, true, callback);\n }\n\n symbolicate(type: StackType, callback?: (status: SymbolicationStatus) => void): void {\n this._symbolicate(type, false, callback);\n }\n\n private _symbolicate(\n type: StackType,\n retry: boolean,\n callback?: (status: SymbolicationStatus) => void\n ): void {\n if (callback) {\n this.pushCallback(type, callback);\n }\n const status = this.symbolicated[type]?.status;\n\n if (status === 'COMPLETE') {\n return this.flushCallbacks(type);\n }\n\n if (retry) {\n LogBoxSymbolication.deleteStack(this.getStack(type));\n this.handleSymbolicate(type);\n } else {\n if (status === 'NONE') {\n this.handleSymbolicate(type);\n }\n }\n }\n\n private componentStackCache: StackFrame[] | null = null;\n\n private getStack(type: StackType): StackFrame[] {\n if (type === 'component') {\n if (this.componentStackCache == null) {\n this.componentStackCache = componentStackToStack(this.componentStack);\n }\n return this.componentStackCache;\n }\n return this.stack;\n }\n\n private handleSymbolicate(type: StackType): void {\n if (type === 'component' && !this.componentStack?.length) {\n return;\n }\n\n if (this.symbolicated[type]?.status !== 'PENDING') {\n this.updateStatus(type, null, null, null);\n LogBoxSymbolication.symbolicate(this.getStack(type)).then(\n (data) => {\n this.updateStatus(type, null, data?.stack, data?.codeFrame);\n },\n (error) => {\n this.updateStatus(type, error, null, null);\n }\n );\n }\n }\n\n private updateStatus(\n type: StackType,\n error?: Error | null,\n stack?: StackFrame[] | null,\n codeFrame?: CodeFrame | null\n ): void {\n const lastStatus = this.symbolicated[type]?.status;\n if (error != null) {\n this.symbolicated[type] = {\n error,\n stack: null,\n status: 'FAILED',\n };\n } else if (stack != null) {\n if (codeFrame) {\n this.codeFrame = codeFrame;\n }\n\n this.symbolicated[type] = {\n error: null,\n stack,\n status: 'COMPLETE',\n };\n } else {\n this.symbolicated[type] = {\n error: null,\n stack: null,\n status: 'PENDING',\n };\n }\n\n const status = this.symbolicated[type]?.status;\n if (lastStatus !== status) {\n if (['COMPLETE', 'FAILED'].includes(status)) {\n this.flushCallbacks(type);\n }\n }\n }\n}\n"],"names":["LogBoxLog","componentStackToStack","componentStack","map","stack","file","fileName","methodName","content","lineNumber","location","row","column","arguments","constructor","data","symbolicated","error","status","component","callbacks","Map","componentStackCache","level","type","message","category","codeFrame","isComponentError","count","incrementCount","getAvailableStack","getStack","flushCallbacks","get","callback","clear","pushCallback","Set","set","add","retrySymbolicate","_symbolicate","symbolicate","retry","LogBoxSymbolication","deleteStack","handleSymbolicate","length","updateStatus","then","lastStatus","includes"],"mappings":"AAAA;;;;;;CAMC;;;;+BAoDYA;;;eAAAA;;;6EAlDwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCrC,SAASC,sBAAsBC,cAA8B;IAC3D,OAAOA,eAAeC,GAAG,CAAC,CAACC;YAGbA,iBACJA;eAJ4B;YACpCC,MAAMD,MAAME,QAAQ;YACpBC,YAAYH,MAAMI,OAAO;YACzBC,YAAYL,EAAAA,kBAAAA,MAAMM,QAAQ,qBAAdN,gBAAgBO,GAAG,KAA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,qBAAvB,yBAAyBN,MAAM;QAC9C,IAAIiC,eAAejC,QAAQ;YACzB,IAAI;gBAAC;gBAAY;aAAS,CAACkC,QAAQ,CAAClC,SAAS;gBAC3C,IAAI,CAACe,cAAc,CAACT;YACtB;QACF;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/log-box/LogBoxSymbolication.ts"],"sourcesContent":["/**\n * Copyright (c) 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { parse, StackFrame as UpstreamStackFrame } from 'stacktrace-parser';\n\nexport type CodeFrame = {\n content: string;\n location?: {\n row: number;\n column: number;\n [key: string]: any;\n } | null;\n fileName: string;\n\n // TODO: When React switched to using call stack frames,\n // we gained the ability to use the collapse flag, but\n // it is not integrated into the LogBox UI.\n collapse?: boolean;\n};\n\nexport type SymbolicatedStackTrace = {\n stack: UpstreamStackFrame[];\n codeFrame?: CodeFrame;\n};\n\nexport type StackFrame = UpstreamStackFrame & {
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/metro/log-box/LogBoxSymbolication.ts"],"sourcesContent":["/**\n * Copyright (c) 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { parse, StackFrame as UpstreamStackFrame } from 'stacktrace-parser';\n\nexport type CodeFrame = {\n content: string;\n location?: {\n row: number;\n column: number;\n [key: string]: any;\n } | null;\n fileName: string;\n\n // TODO: When React switched to using call stack frames,\n // we gained the ability to use the collapse flag, but\n // it is not integrated into the LogBox UI.\n collapse?: boolean;\n};\n\nexport type SymbolicatedStackTrace = {\n stack: UpstreamStackFrame[];\n codeFrame?: CodeFrame;\n};\n\nexport type StackFrame = UpstreamStackFrame & {\n collapse?: boolean;\n};\n\nconst cache: Map<StackFrame[], Promise<SymbolicatedStackTrace>> = new Map();\n\n/**\n * Sanitize because sometimes `symbolicateStackTrace` gives us invalid values.\n */\nconst sanitize = ({\n stack: maybeStack,\n codeFrame,\n}: SymbolicatedStackTrace): SymbolicatedStackTrace => {\n if (!Array.isArray(maybeStack)) {\n throw new Error('Expected stack to be an array.');\n }\n const stack: StackFrame[] = [];\n for (const maybeFrame of maybeStack) {\n let collapse = false;\n if ('collapse' in maybeFrame) {\n if (typeof maybeFrame.collapse !== 'boolean') {\n throw new Error('Expected stack frame `collapse` to be a boolean.');\n }\n collapse = maybeFrame.collapse;\n }\n stack.push({\n arguments: maybeFrame.arguments?.map((arg) => String(arg)) ?? [],\n column: maybeFrame.column,\n file: maybeFrame.file,\n lineNumber: maybeFrame.lineNumber,\n methodName: maybeFrame.methodName,\n collapse,\n });\n }\n return { stack, codeFrame };\n};\n\nexport function deleteStack(stack: StackFrame[]): void {\n cache.delete(stack);\n}\n\nexport function symbolicate(stack: StackFrame[]): Promise<SymbolicatedStackTrace> {\n let promise = cache.get(stack);\n if (promise == null) {\n promise = symbolicateStackTrace(stack).then(sanitize);\n cache.set(stack, promise);\n }\n\n return promise;\n}\n\nasync function symbolicateStackTrace(stack: UpstreamStackFrame[]): Promise<SymbolicatedStackTrace> {\n const baseUrl =\n typeof window === 'undefined'\n ? process.env.EXPO_DEV_SERVER_ORIGIN\n : window.location.protocol + '//' + window.location.host;\n\n return fetch(baseUrl + '/symbolicate', {\n method: 'POST',\n body: JSON.stringify({ stack }),\n }).then((res) => res.json());\n}\n\nexport function parseErrorStack(stack?: string): (UpstreamStackFrame & { collapse?: boolean })[] {\n if (stack == null) {\n return [];\n }\n if (Array.isArray(stack)) {\n return stack;\n }\n\n return parse(stack).map((frame) => {\n // Add back support for Hermes native calls:\n // ` at apply (native)`\n // Which are parsed to:\n // {\n // \"file\": null,\n // \"methodName\": \"apply\",\n // \"arguments\": [\"native\"],\n // \"lineNumber\": null,\n // \"column\": null,\n // \"collapse\": false\n // },\n // https://github.com/facebook/react-native/blob/f0ad39446404bb6e027d0c486b579c312f35180a/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js#L70\n if (frame.file == null && frame.arguments?.length === 1 && frame.arguments[0] === 'native') {\n // Use `<native>` to match the `<anonymous>` and `<unknown>` used by other runtimes.\n frame.file = '<native>';\n frame.arguments = [];\n }\n\n // frame.file will mostly look like `http://localhost:8081/index.bundle?platform=web&dev=true&hot=false`\n return {\n ...frame,\n column: frame.column != null ? frame.column - 1 : null,\n };\n });\n}\n"],"names":["deleteStack","parseErrorStack","symbolicate","cache","Map","sanitize","stack","maybeStack","codeFrame","Array","isArray","Error","maybeFrame","collapse","push","arguments","map","arg","String","column","file","lineNumber","methodName","delete","promise","get","symbolicateStackTrace","then","set","baseUrl","window","process","env","EXPO_DEV_SERVER_ORIGIN","location","protocol","host","fetch","method","body","JSON","stringify","res","json","parse","frame","length"],"mappings":"AAAA;;;;;;CAMC;;;;;;;;;;;IA4DeA,WAAW;eAAXA;;IA0BAC,eAAe;eAAfA;;IAtBAC,WAAW;eAAXA;;;;yBA/DwC;;;;;;AA0BxD,MAAMC,QAA4D,IAAIC;AAEtE;;CAEC,GACD,MAAMC,WAAW,CAAC,EAChBC,OAAOC,UAAU,EACjBC,SAAS,EACc;IACvB,IAAI,CAACC,MAAMC,OAAO,CAACH,aAAa;QAC9B,MAAM,IAAII,MAAM;IAClB;IACA,MAAML,QAAsB,EAAE;IAC9B,KAAK,MAAMM,cAAcL,WAAY;YAStBK;QARb,IAAIC,WAAW;QACf,IAAI,cAAcD,YAAY;YAC5B,IAAI,OAAOA,WAAWC,QAAQ,KAAK,WAAW;gBAC5C,MAAM,IAAIF,MAAM;YAClB;YACAE,WAAWD,WAAWC,QAAQ;QAChC;QACAP,MAAMQ,IAAI,CAAC;YACTC,WAAWH,EAAAA,wBAAAA,WAAWG,SAAS,qBAApBH,sBAAsBI,GAAG,CAAC,CAACC,MAAQC,OAAOD,UAAS,EAAE;YAChEE,QAAQP,WAAWO,MAAM;YACz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D,MAAM9B,SAAS,CAAC,EAAE,KAAK,UAAU;YAC1F,oFAAoF;YACpF8B,MAAMzB,IAAI,GAAG;YACbyB,MAAM9B,SAAS,GAAG,EAAE;QACtB;QAEA,wGAAwG;QACxG,OAAO;YACL,GAAG8B,KAAK;YACR1B,QAAQ0B,MAAM1B,MAAM,IAAI,OAAO0B,MAAM1B,MAAM,GAAG,IAAI;QACpD;IACF;AACF"}
|
|
@@ -52,6 +52,13 @@ function _paths() {
|
|
|
52
52
|
};
|
|
53
53
|
return data;
|
|
54
54
|
}
|
|
55
|
+
function _utils() {
|
|
56
|
+
const data = require("@expo/log-box/utils");
|
|
57
|
+
_utils = function() {
|
|
58
|
+
return data;
|
|
59
|
+
};
|
|
60
|
+
return data;
|
|
61
|
+
}
|
|
55
62
|
function _chalk() {
|
|
56
63
|
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
|
57
64
|
_chalk = function() {
|
|
@@ -263,50 +270,13 @@ async function logMetroError(projectRoot, { error }) {
|
|
|
263
270
|
error
|
|
264
271
|
});
|
|
265
272
|
}
|
|
266
|
-
function isTransformError(error) {
|
|
267
|
-
return error.type === 'TransformError';
|
|
268
|
-
}
|
|
269
273
|
/** @returns the html required to render the static metro error as an SPA. */ function logFromError({ error, projectRoot }) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
stack = [
|
|
275
|
-
{
|
|
276
|
-
file: _path().default.join(projectRoot, error.filename),
|
|
277
|
-
methodName: '<unknown>',
|
|
278
|
-
arguments: [],
|
|
279
|
-
// TODO: Import stack
|
|
280
|
-
lineNumber: error.lineNumber,
|
|
281
|
-
column: error.column
|
|
282
|
-
}
|
|
283
|
-
];
|
|
284
|
-
} else if ('originModulePath' in error && typeof error.originModulePath === 'string') {
|
|
285
|
-
// TODO: Use import stack here when the error is resolution based.
|
|
286
|
-
stack = [
|
|
287
|
-
{
|
|
288
|
-
file: error.originModulePath,
|
|
289
|
-
methodName: '<unknown>',
|
|
290
|
-
arguments: [],
|
|
291
|
-
// TODO: Import stack
|
|
292
|
-
lineNumber: 0,
|
|
293
|
-
column: 0
|
|
294
|
-
}
|
|
295
|
-
];
|
|
296
|
-
} else {
|
|
297
|
-
stack = parseErrorStack(projectRoot, error.stack);
|
|
298
|
-
}
|
|
299
|
-
return new _LogBoxLog.LogBoxLog({
|
|
300
|
-
level: 'static',
|
|
301
|
-
message: {
|
|
302
|
-
content: error.message,
|
|
303
|
-
substitutions: []
|
|
304
|
-
},
|
|
305
|
-
isComponentError: false,
|
|
306
|
-
stack,
|
|
307
|
-
category: 'static',
|
|
308
|
-
componentStack: []
|
|
274
|
+
const data = (0, _utils().parseWebBuildErrors)({
|
|
275
|
+
error,
|
|
276
|
+
projectRoot,
|
|
277
|
+
parseErrorStack
|
|
309
278
|
});
|
|
279
|
+
return new _LogBoxLog.LogBoxLog(data);
|
|
310
280
|
}
|
|
311
281
|
async function logMetroErrorAsync({ error, projectRoot }) {
|
|
312
282
|
var _log_symbolicated_stack, _log_symbolicated;
|
|
@@ -343,7 +313,8 @@ async function getErrorOverlayHtmlAsync({ error, projectRoot, routerRoot }) {
|
|
|
343
313
|
log
|
|
344
314
|
]
|
|
345
315
|
};
|
|
346
|
-
const html = `<html><head><style>#root,body,html{height:100
|
|
316
|
+
const html = `<html><head><style>#root,body,html{height:100%;background-color:black}body{overflow:hidden}#root{display:flex}</style></head><body><div id="root"></div><script id="_expo-static-error" type="application/json">${JSON.stringify(logBoxContext)}</script></body></html>`;
|
|
317
|
+
// TODO: We could reuse the pre-built DOM Log Box from @expo/log-box
|
|
347
318
|
const errorOverlayEntry = await (0, _getStaticRenderFunctions.createMetroEndpointAsync)(projectRoot, // Keep the URL relative
|
|
348
319
|
'', (0, _resolvefrom().default)(projectRoot, 'expo-router/_error'), {
|
|
349
320
|
mode: 'development',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/metroErrorInterface.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport chalk from 'chalk';\nimport { stripVTControlCharacters } from 'node:util';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport { parse, StackFrame } from 'stacktrace-parser';\nimport terminalLink from 'terminal-link';\n\nimport { LogBoxLog } from './log-box/LogBoxLog';\nimport type { CodeFrame, StackFrame as MetroStackFrame } from './log-box/LogBoxSymbolication';\nimport { getStackFormattedLocation } from './log-box/formatProjectFilePath';\nimport { Log } from '../../../log';\nimport { stripAnsi } from '../../../utils/ansi';\nimport { env } from '../../../utils/env';\nimport { CommandError, SilentError } from '../../../utils/errors';\nimport { createMetroEndpointAsync } from '../getStaticRenderFunctions';\n\nconst isDebug = require('debug').enabled('expo:start:server:metro');\n\nfunction fill(width: number): string {\n return Array(width).join(' ');\n}\n\nfunction formatPaths(config: { filePath: string | null; line?: number; col?: number }) {\n const filePath = chalk.reset(config.filePath);\n return (\n chalk.dim('(') +\n filePath +\n chalk.dim(`:${[config.line, config.col].filter(Boolean).join(':')})`)\n );\n}\n\nexport async function logMetroErrorWithStack(\n projectRoot: string,\n {\n stack,\n codeFrame,\n error,\n }: {\n stack: MetroStackFrame[];\n codeFrame?: CodeFrame;\n error: Error;\n }\n) {\n if (error instanceof SilentError) {\n return;\n }\n\n // process.stdout.write('\\u001b[0m'); // Reset attributes\n // process.stdout.write('\\u001bc'); // Reset the terminal\n\n Log.log();\n Log.log(chalk.red('Metro error: ') + error.message);\n Log.log();\n\n if (error instanceof CommandError) {\n return;\n }\n\n Log.log(\n getStackAsFormattedLog(projectRoot, { stack, codeFrame, error, showCollapsedFrames: true })\n .stack\n );\n}\n\nexport function getStackAsFormattedLog(\n projectRoot: string,\n {\n stack,\n codeFrame,\n error,\n showCollapsedFrames = env.EXPO_DEBUG,\n }: {\n stack: MetroStackFrame[];\n codeFrame?: CodeFrame;\n error?: Error;\n showCollapsedFrames?: boolean;\n }\n): {\n isFallback: boolean;\n stack: string;\n} {\n const logs: string[] = [];\n const containsCodeFrame = likelyContainsCodeFrame(error?.message);\n\n if (containsCodeFrame) {\n // Some transformation errors will have a code frame embedded in the error message\n // from Babel and we should not duplicate it as message is already printed before this call.\n } else if (codeFrame) {\n const maxWarningLineLength = Math.max(800, process.stdout.columns);\n\n const lineText = codeFrame.content;\n const lines = codeFrame.content.split('\\n');\n\n // ---- index.tsx ------------------------------------------------------\n // 32 | This is example code which will be under the title.\n const title = path.basename(codeFrame.fileName);\n logs.push(chalk.bold`Code: ${title}`);\n\n const isPreviewTooLong = lines.some((line) => line.length > maxWarningLineLength);\n const column = codeFrame.location?.column;\n // When the preview is too long, we skip reading the file and attempting to apply\n // code coloring, this is because it can get very slow.\n if (isPreviewTooLong) {\n let previewLine = '';\n let cursorLine = '';\n\n const formattedPath = formatPaths({\n filePath: codeFrame.fileName,\n line: codeFrame.location?.row,\n col: codeFrame.location?.column,\n });\n // Create a curtailed preview line like:\n // `...transition:'fade'},k._updatePropsStack=function(){clearImmediate(k._updateImmediate),k._updateImmediate...`\n // If there is no text preview or column number, we can't do anything.\n if (lineText && column != null) {\n const rangeWindow = Math.round(\n Math.max(codeFrame.fileName?.length ?? 0, Math.max(80, process.stdout.columns)) / 2\n );\n let minBounds = Math.max(0, column - rangeWindow);\n const maxBounds = Math.min(minBounds + rangeWindow * 2, lineText.length);\n previewLine = lineText.slice(minBounds, maxBounds);\n\n // If we splice content off the start, then we should append `...`.\n // This is unlikely to happen since we limit the activation size.\n if (minBounds > 0) {\n // Adjust the min bounds so the cursor is aligned after we add the \"...\"\n minBounds -= 3;\n previewLine = chalk.dim('...') + previewLine;\n }\n if (maxBounds < lineText.length) {\n previewLine += chalk.dim('...');\n }\n\n // If the column property could be found, then use that to fix the cursor location which is often broken in regex.\n cursorLine = (column == null ? '' : fill(column) + chalk.reset('^')).slice(minBounds);\n\n logs.push(formattedPath, '', previewLine, cursorLine, chalk.dim('(error truncated)'));\n }\n } else {\n logs.push(codeFrame.content);\n }\n }\n\n let isFallback = false;\n if (stack?.length) {\n const stackProps = stack.map((frame) => {\n return {\n title: frame.methodName,\n subtitle: getStackFormattedLocation(projectRoot, frame),\n collapse: frame.collapse || isInternalBytecode(frame),\n };\n });\n\n const stackLines: string[] = [];\n const backupStackLines: string[] = [];\n\n stackProps.forEach((frame) => {\n const shouldShow = !frame.collapse || showCollapsedFrames;\n\n const position = terminalLink.isSupported\n ? terminalLink(frame.subtitle, frame.subtitle)\n : frame.subtitle;\n let lineItem = chalk.gray(` ${frame.title} (${position})`);\n\n if (frame.collapse) {\n lineItem = chalk.dim(lineItem);\n }\n // Never show the internal module system.\n const isMetroRuntime =\n /\\/metro-runtime\\/src\\/polyfills\\/require\\.js/.test(frame.subtitle) ||\n /\\/metro-require\\/require\\.js/.test(frame.subtitle);\n if (!isMetroRuntime) {\n if (shouldShow) {\n stackLines.push(lineItem);\n }\n backupStackLines.push(lineItem);\n }\n });\n\n logs.push(chalk.bold`Call Stack`);\n\n if (!backupStackLines.length) {\n logs.push(chalk.gray(' No stack trace available.'));\n } else {\n isFallback = stackLines.length === 0;\n // If there are not stack lines then it means the error likely happened in the node modules, in this case we should fallback to showing all the\n // the stacks to give the user whatever help we can.\n const displayStack = stackLines.length ? stackLines : backupStackLines;\n logs.push(displayStack.join('\\n'));\n }\n } else if (error && error.stack) {\n logs.push(chalk.gray(` ${error.stack}`));\n }\n\n return {\n isFallback,\n stack: logs.join('\\n'),\n };\n}\n\nexport const IS_METRO_BUNDLE_ERROR_SYMBOL = Symbol('_isMetroBundleError');\nconst HAS_LOGGED_SYMBOL = Symbol('_hasLoggedInCLI');\n\nexport async function logMetroError(\n projectRoot: string,\n {\n error,\n }: {\n error: Error & {\n [HAS_LOGGED_SYMBOL]?: boolean;\n };\n }\n) {\n if (error instanceof SilentError || error[HAS_LOGGED_SYMBOL]) {\n return;\n }\n error[HAS_LOGGED_SYMBOL] = true;\n\n const stack = parseErrorStack(projectRoot, error.stack);\n\n const log = new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n\n await new Promise((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\nfunction isTransformError(\n error: any\n): error is { type: 'TransformError'; filename: string; lineNumber: number; column: number } {\n return error.type === 'TransformError';\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nfunction logFromError({ error, projectRoot }: { error: Error; projectRoot: string }) {\n // Remap direct Metro Node.js errors to a format that will appear more client-friendly in the logbox UI.\n let stack: MetroStackFrame[] | undefined;\n if (isTransformError(error) && error.filename) {\n // Syntax errors in static rendering.\n stack = [\n {\n file: path.join(projectRoot, error.filename),\n methodName: '<unknown>',\n arguments: [],\n // TODO: Import stack\n lineNumber: error.lineNumber,\n column: error.column,\n },\n ];\n } else if ('originModulePath' in error && typeof error.originModulePath === 'string') {\n // TODO: Use import stack here when the error is resolution based.\n stack = [\n {\n file: error.originModulePath,\n methodName: '<unknown>',\n arguments: [],\n // TODO: Import stack\n lineNumber: 0,\n column: 0,\n },\n ];\n } else {\n stack = parseErrorStack(projectRoot, error.stack);\n }\n\n return new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function logMetroErrorAsync({\n error,\n projectRoot,\n}: {\n error: Error;\n projectRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', () => res()));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function getErrorOverlayHtmlAsync({\n error,\n projectRoot,\n routerRoot,\n}: {\n error: Error;\n projectRoot: string;\n routerRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', () => res()));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n\n if ('message' in log && 'content' in log.message && typeof log.message.content === 'string') {\n log.message.content = stripAnsi(log.message.content)!;\n }\n\n const logBoxContext = {\n selectedLogIndex: 0,\n isDisabled: false,\n logs: [log],\n };\n const html = `<html><head><style>#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}</style></head><body><div id=\"root\"></div><script id=\"_expo-static-error\" type=\"application/json\">${JSON.stringify(\n logBoxContext\n )}</script></body></html>`;\n\n const errorOverlayEntry = await createMetroEndpointAsync(\n projectRoot,\n // Keep the URL relative\n '',\n resolveFrom(projectRoot, 'expo-router/_error'),\n {\n mode: 'development',\n platform: 'web',\n minify: false,\n optimize: false,\n usedExports: false,\n baseUrl: '',\n routerRoot,\n isExporting: false,\n reactCompiler: false,\n }\n );\n\n const htmlWithJs = html.replace('</body>', `<script src=${errorOverlayEntry}></script></body>`);\n return htmlWithJs;\n}\n\nfunction parseErrorStack(\n projectRoot: string,\n stack?: string\n): (StackFrame & { collapse?: boolean })[] {\n if (stack == null) {\n return [];\n }\n if (Array.isArray(stack)) {\n return stack;\n }\n\n const serverRoot = getMetroServerRoot(projectRoot);\n\n return parse(stack)\n .map((frame) => {\n // frame.file will mostly look like `http://localhost:8081/index.bundle?platform=web&dev=true&hot=false`\n\n if (frame.file) {\n // SSR will sometimes have absolute paths followed by `.bundle?...`, we need to try and make them relative paths and append a dev server URL.\n if (frame.file.startsWith('/') && frame.file.includes('bundle?') && !canParse(frame.file)) {\n // Malformed stack file from SSR. Attempt to repair.\n frame.file = 'https://localhost:8081/' + path.relative(serverRoot, frame.file);\n }\n }\n\n return {\n ...frame,\n column: frame.column != null ? frame.column - 1 : null,\n };\n })\n .filter((frame) => frame.file && !frame.file.includes('node_modules'));\n}\n\nfunction canParse(url: string): boolean {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\nexport function dropStackIfContainsCodeFrame(err: unknown) {\n if (!(err instanceof Error)) return;\n\n if (likelyContainsCodeFrame(err.message)) {\n // If the error message contains a code frame, we should drop the stack to avoid cluttering the output.\n delete err.stack;\n }\n}\n\n/**\n * Tests given string on presence of ` [num] |` at the start of any line.\n * Returns `false` for undefined or empty strings.\n */\nexport function likelyContainsCodeFrame(message: string | undefined): boolean {\n if (!message) return false;\n\n const clean = stripVTControlCharacters(message);\n if (!clean) return false;\n\n return /^\\s*\\d+\\s+\\|/m.test(clean);\n}\n\n/**\n * Walks thru the error cause chain and attaches the import stack to the root error message.\n * Removes the error stack for import and syntax errors.\n */\nexport const attachImportStackToRootMessage = (err: unknown) => {\n if (!(err instanceof Error)) return;\n\n // Space out build failures.\n const nearestImportStackValue = nearestImportStack(err);\n if (nearestImportStackValue) {\n err.message += '\\n\\n' + nearestImportStackValue;\n\n if (!isDebug) {\n // When not debugging remove the stack to avoid cluttering the output and confusing users,\n // the import stack is the guide to fixing the error.\n delete err.stack;\n }\n }\n};\n\n/**\n * Walks thru the error cause chain and returns the nearest import stack.\n * If the import stack is not found, it returns `undefined`.\n */\nexport const nearestImportStack = (err: unknown, root: unknown = err): string | undefined => {\n if (!(err instanceof Error) || !(root instanceof Error)) return undefined;\n\n if ('_expoImportStack' in err && typeof err._expoImportStack === 'string') {\n // Space out build failures.\n return err._expoImportStack;\n } else {\n return nearestImportStack(err.cause, root);\n }\n};\n\nfunction isInternalBytecode(frame: StackFrame): boolean {\n return frame.file?.includes('InternalBytecode.js') ?? false;\n}\n"],"names":["IS_METRO_BUNDLE_ERROR_SYMBOL","attachImportStackToRootMessage","dropStackIfContainsCodeFrame","getErrorOverlayHtmlAsync","getStackAsFormattedLog","likelyContainsCodeFrame","logMetroError","logMetroErrorAsync","logMetroErrorWithStack","nearestImportStack","isDebug","require","enabled","fill","width","Array","join","formatPaths","config","filePath","chalk","reset","dim","line","col","filter","Boolean","projectRoot","stack","codeFrame","error","SilentError","Log","log","red","message","CommandError","showCollapsedFrames","env","EXPO_DEBUG","logs","containsCodeFrame","maxWarningLineLength","Math","max","process","stdout","columns","lineText","content","lines","split","title","path","basename","fileName","push","bold","isPreviewTooLong","some","length","column","location","previewLine","cursorLine","formattedPath","row","rangeWindow","round","minBounds","maxBounds","min","slice","isFallback","stackProps","map","frame","methodName","subtitle","getStackFormattedLocation","collapse","isInternalBytecode","stackLines","backupStackLines","forEach","shouldShow","position","terminalLink","isSupported","lineItem","gray","isMetroRuntime","test","displayStack","Symbol","HAS_LOGGED_SYMBOL","parseErrorStack","LogBoxLog","level","substitutions","isComponentError","category","componentStack","Promise","res","symbolicate","symbolicated","isTransformError","type","logFromError","filename","file","arguments","lineNumber","originModulePath","routerRoot","stripAnsi","logBoxContext","selectedLogIndex","isDisabled","html","JSON","stringify","errorOverlayEntry","createMetroEndpointAsync","resolveFrom","mode","platform","minify","optimize","usedExports","baseUrl","isExporting","reactCompiler","htmlWithJs","replace","isArray","serverRoot","getMetroServerRoot","parse","startsWith","includes","canParse","relative","url","URL","err","Error","clean","stripVTControlCharacters","nearestImportStackValue","root","undefined","_expoImportStack","cause"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;IA0MYA,4BAA4B;eAA5BA;;IA2OAC,8BAA8B;eAA9BA;;IA1BGC,4BAA4B;eAA5BA;;IAjGMC,wBAAwB;eAAxBA;;IAxPNC,sBAAsB;eAAtBA;;IAsWAC,uBAAuB;eAAvBA;;IA3NMC,aAAa;eAAbA;;IA0FAC,kBAAkB;eAAlBA;;IAtQAC,sBAAsB;eAAtBA;;IAwaTC,kBAAkB;eAAlBA;;;;yBAxcsB;;;;;;;gEACjB;;;;;;;yBACuB;;;;;;;gEACxB;;;;;;;gEACO;;;;;;;yBACU;;;;;;;gEACT;;;;;;2BAEC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AI,GAAI;IAE7B,IAAI9I,wBAAwB6I,IAAI/G,OAAO,GAAG;QACxC,uGAAuG;QACvG,OAAO+G,IAAItH,KAAK;IAClB;AACF;AAMO,SAASvB,wBAAwB8B,OAA2B;IACjE,IAAI,CAACA,SAAS,OAAO;IAErB,MAAMiH,QAAQC,IAAAA,oCAAwB,EAAClH;IACvC,IAAI,CAACiH,OAAO,OAAO;IAEnB,OAAO,gBAAgBxD,IAAI,CAACwD;AAC9B;AAMO,MAAMnJ,iCAAiC,CAACiJ;IAC7C,IAAI,CAAEA,CAAAA,eAAeC,KAAI,GAAI;IAE7B,4BAA4B;IAC5B,MAAMG,0BAA0B7I,mBAAmByI;IACnD,IAAII,yBAAyB;QAC3BJ,IAAI/G,OAAO,IAAI,SAASmH;QAExB,IAAI,CAAC5I,SAAS;YACZ,0FAA0F;YAC1F,qDAAqD;YACrD,OAAOwI,IAAItH,KAAK;QAClB;IACF;AACF;AAMO,MAAMnB,qBAAqB,CAACyI,KAAcK,OAAgBL,GAAG;IAClE,IAAI,CAAEA,CAAAA,eAAeC,KAAI,KAAM,CAAEI,CAAAA,gBAAgBJ,KAAI,GAAI,OAAOK;IAEhE,IAAI,sBAAsBN,OAAO,OAAOA,IAAIO,gBAAgB,KAAK,UAAU;QACzE,4BAA4B;QAC5B,OAAOP,IAAIO,gBAAgB;IAC7B,OAAO;QACL,OAAOhJ,mBAAmByI,IAAIQ,KAAK,EAAEH;IACvC;AACF;AAEA,SAAStE,mBAAmBL,KAAiB;QACpCA;IAAP,OAAOA,EAAAA,cAAAA,MAAMmC,IAAI,qBAAVnC,YAAYiE,QAAQ,CAAC,2BAA0B;AACxD"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/metroErrorInterface.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport { parseWebBuildErrors } from '@expo/log-box/utils';\nimport chalk from 'chalk';\nimport { stripVTControlCharacters } from 'node:util';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport { parse, StackFrame } from 'stacktrace-parser';\nimport terminalLink from 'terminal-link';\n\nimport { LogBoxLog, LogBoxLogData } from './log-box/LogBoxLog';\nimport type { CodeFrame, StackFrame as MetroStackFrame } from './log-box/LogBoxSymbolication';\nimport { getStackFormattedLocation } from './log-box/formatProjectFilePath';\nimport { Log } from '../../../log';\nimport { stripAnsi } from '../../../utils/ansi';\nimport { env } from '../../../utils/env';\nimport { CommandError, SilentError } from '../../../utils/errors';\nimport { createMetroEndpointAsync } from '../getStaticRenderFunctions';\n\nconst isDebug = require('debug').enabled('expo:start:server:metro');\n\nfunction fill(width: number): string {\n return Array(width).join(' ');\n}\n\nfunction formatPaths(config: { filePath: string | null; line?: number; col?: number }) {\n const filePath = chalk.reset(config.filePath);\n return (\n chalk.dim('(') +\n filePath +\n chalk.dim(`:${[config.line, config.col].filter(Boolean).join(':')})`)\n );\n}\n\nexport async function logMetroErrorWithStack(\n projectRoot: string,\n {\n stack,\n codeFrame,\n error,\n }: {\n stack: MetroStackFrame[];\n codeFrame?: CodeFrame;\n error: Error;\n }\n) {\n if (error instanceof SilentError) {\n return;\n }\n\n // process.stdout.write('\\u001b[0m'); // Reset attributes\n // process.stdout.write('\\u001bc'); // Reset the terminal\n\n Log.log();\n Log.log(chalk.red('Metro error: ') + error.message);\n Log.log();\n\n if (error instanceof CommandError) {\n return;\n }\n\n Log.log(\n getStackAsFormattedLog(projectRoot, { stack, codeFrame, error, showCollapsedFrames: true })\n .stack\n );\n}\n\nexport function getStackAsFormattedLog(\n projectRoot: string,\n {\n stack,\n codeFrame,\n error,\n showCollapsedFrames = env.EXPO_DEBUG,\n }: {\n stack: MetroStackFrame[];\n codeFrame?: CodeFrame;\n error?: Error;\n showCollapsedFrames?: boolean;\n }\n): {\n isFallback: boolean;\n stack: string;\n} {\n const logs: string[] = [];\n const containsCodeFrame = likelyContainsCodeFrame(error?.message);\n\n if (containsCodeFrame) {\n // Some transformation errors will have a code frame embedded in the error message\n // from Babel and we should not duplicate it as message is already printed before this call.\n } else if (codeFrame) {\n const maxWarningLineLength = Math.max(800, process.stdout.columns);\n\n const lineText = codeFrame.content;\n const lines = codeFrame.content.split('\\n');\n\n // ---- index.tsx ------------------------------------------------------\n // 32 | This is example code which will be under the title.\n const title = path.basename(codeFrame.fileName);\n logs.push(chalk.bold`Code: ${title}`);\n\n const isPreviewTooLong = lines.some((line) => line.length > maxWarningLineLength);\n const column = codeFrame.location?.column;\n // When the preview is too long, we skip reading the file and attempting to apply\n // code coloring, this is because it can get very slow.\n if (isPreviewTooLong) {\n let previewLine = '';\n let cursorLine = '';\n\n const formattedPath = formatPaths({\n filePath: codeFrame.fileName,\n line: codeFrame.location?.row,\n col: codeFrame.location?.column,\n });\n // Create a curtailed preview line like:\n // `...transition:'fade'},k._updatePropsStack=function(){clearImmediate(k._updateImmediate),k._updateImmediate...`\n // If there is no text preview or column number, we can't do anything.\n if (lineText && column != null) {\n const rangeWindow = Math.round(\n Math.max(codeFrame.fileName?.length ?? 0, Math.max(80, process.stdout.columns)) / 2\n );\n let minBounds = Math.max(0, column - rangeWindow);\n const maxBounds = Math.min(minBounds + rangeWindow * 2, lineText.length);\n previewLine = lineText.slice(minBounds, maxBounds);\n\n // If we splice content off the start, then we should append `...`.\n // This is unlikely to happen since we limit the activation size.\n if (minBounds > 0) {\n // Adjust the min bounds so the cursor is aligned after we add the \"...\"\n minBounds -= 3;\n previewLine = chalk.dim('...') + previewLine;\n }\n if (maxBounds < lineText.length) {\n previewLine += chalk.dim('...');\n }\n\n // If the column property could be found, then use that to fix the cursor location which is often broken in regex.\n cursorLine = (column == null ? '' : fill(column) + chalk.reset('^')).slice(minBounds);\n\n logs.push(formattedPath, '', previewLine, cursorLine, chalk.dim('(error truncated)'));\n }\n } else {\n logs.push(codeFrame.content);\n }\n }\n\n let isFallback = false;\n if (stack?.length) {\n const stackProps = stack.map((frame) => {\n return {\n title: frame.methodName,\n subtitle: getStackFormattedLocation(projectRoot, frame),\n collapse: frame.collapse || isInternalBytecode(frame),\n };\n });\n\n const stackLines: string[] = [];\n const backupStackLines: string[] = [];\n\n stackProps.forEach((frame) => {\n const shouldShow = !frame.collapse || showCollapsedFrames;\n\n const position = terminalLink.isSupported\n ? terminalLink(frame.subtitle, frame.subtitle)\n : frame.subtitle;\n let lineItem = chalk.gray(` ${frame.title} (${position})`);\n\n if (frame.collapse) {\n lineItem = chalk.dim(lineItem);\n }\n // Never show the internal module system.\n const isMetroRuntime =\n /\\/metro-runtime\\/src\\/polyfills\\/require\\.js/.test(frame.subtitle) ||\n /\\/metro-require\\/require\\.js/.test(frame.subtitle);\n if (!isMetroRuntime) {\n if (shouldShow) {\n stackLines.push(lineItem);\n }\n backupStackLines.push(lineItem);\n }\n });\n\n logs.push(chalk.bold`Call Stack`);\n\n if (!backupStackLines.length) {\n logs.push(chalk.gray(' No stack trace available.'));\n } else {\n isFallback = stackLines.length === 0;\n // If there are not stack lines then it means the error likely happened in the node modules, in this case we should fallback to showing all the\n // the stacks to give the user whatever help we can.\n const displayStack = stackLines.length ? stackLines : backupStackLines;\n logs.push(displayStack.join('\\n'));\n }\n } else if (error && error.stack) {\n logs.push(chalk.gray(` ${error.stack}`));\n }\n\n return {\n isFallback,\n stack: logs.join('\\n'),\n };\n}\n\nexport const IS_METRO_BUNDLE_ERROR_SYMBOL = Symbol('_isMetroBundleError');\nconst HAS_LOGGED_SYMBOL = Symbol('_hasLoggedInCLI');\n\nexport async function logMetroError(\n projectRoot: string,\n {\n error,\n }: {\n error: Error & {\n [HAS_LOGGED_SYMBOL]?: boolean;\n };\n }\n) {\n if (error instanceof SilentError || error[HAS_LOGGED_SYMBOL]) {\n return;\n }\n error[HAS_LOGGED_SYMBOL] = true;\n\n const stack = parseErrorStack(projectRoot, error.stack);\n\n const log = new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n\n await new Promise((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nfunction logFromError({ error, projectRoot }: { error: Error; projectRoot: string }): LogBoxLog {\n const data = parseWebBuildErrors({\n error,\n projectRoot,\n parseErrorStack,\n });\n return new LogBoxLog(data as LogBoxLogData);\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function logMetroErrorAsync({\n error,\n projectRoot,\n}: {\n error: Error;\n projectRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', () => res()));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function getErrorOverlayHtmlAsync({\n error,\n projectRoot,\n routerRoot,\n}: {\n error: Error;\n projectRoot: string;\n routerRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', () => res()));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n\n if ('message' in log && 'content' in log.message && typeof log.message.content === 'string') {\n log.message.content = stripAnsi(log.message.content)!;\n }\n\n const logBoxContext = {\n selectedLogIndex: 0,\n isDisabled: false,\n logs: [log],\n };\n const html = `<html><head><style>#root,body,html{height:100%;background-color:black}body{overflow:hidden}#root{display:flex}</style></head><body><div id=\"root\"></div><script id=\"_expo-static-error\" type=\"application/json\">${JSON.stringify(\n logBoxContext\n )}</script></body></html>`;\n\n // TODO: We could reuse the pre-built DOM Log Box from @expo/log-box\n const errorOverlayEntry = await createMetroEndpointAsync(\n projectRoot,\n // Keep the URL relative\n '',\n resolveFrom(projectRoot, 'expo-router/_error'),\n {\n mode: 'development',\n platform: 'web',\n minify: false,\n optimize: false,\n usedExports: false,\n baseUrl: '',\n routerRoot,\n isExporting: false,\n reactCompiler: false,\n }\n );\n\n const htmlWithJs = html.replace('</body>', `<script src=${errorOverlayEntry}></script></body>`);\n return htmlWithJs;\n}\n\nfunction parseErrorStack(\n projectRoot: string,\n stack?: string\n): (StackFrame & { collapse?: boolean })[] {\n if (stack == null) {\n return [];\n }\n if (Array.isArray(stack)) {\n return stack;\n }\n\n const serverRoot = getMetroServerRoot(projectRoot);\n\n return parse(stack)\n .map((frame) => {\n // frame.file will mostly look like `http://localhost:8081/index.bundle?platform=web&dev=true&hot=false`\n\n if (frame.file) {\n // SSR will sometimes have absolute paths followed by `.bundle?...`, we need to try and make them relative paths and append a dev server URL.\n if (frame.file.startsWith('/') && frame.file.includes('bundle?') && !canParse(frame.file)) {\n // Malformed stack file from SSR. Attempt to repair.\n frame.file = 'https://localhost:8081/' + path.relative(serverRoot, frame.file);\n }\n }\n\n return {\n ...frame,\n column: frame.column != null ? frame.column - 1 : null,\n };\n })\n .filter((frame) => frame.file && !frame.file.includes('node_modules'));\n}\n\nfunction canParse(url: string): boolean {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\nexport function dropStackIfContainsCodeFrame(err: unknown) {\n if (!(err instanceof Error)) return;\n\n if (likelyContainsCodeFrame(err.message)) {\n // If the error message contains a code frame, we should drop the stack to avoid cluttering the output.\n delete err.stack;\n }\n}\n\n/**\n * Tests given string on presence of ` [num] |` at the start of any line.\n * Returns `false` for undefined or empty strings.\n */\nexport function likelyContainsCodeFrame(message: string | undefined): boolean {\n if (!message) return false;\n\n const clean = stripVTControlCharacters(message);\n if (!clean) return false;\n\n return /^\\s*\\d+\\s+\\|/m.test(clean);\n}\n\n/**\n * Walks thru the error cause chain and attaches the import stack to the root error message.\n * Removes the error stack for import and syntax errors.\n */\nexport const attachImportStackToRootMessage = (err: unknown) => {\n if (!(err instanceof Error)) return;\n\n // Space out build failures.\n const nearestImportStackValue = nearestImportStack(err);\n if (nearestImportStackValue) {\n err.message += '\\n\\n' + nearestImportStackValue;\n\n if (!isDebug) {\n // When not debugging remove the stack to avoid cluttering the output and confusing users,\n // the import stack is the guide to fixing the error.\n delete err.stack;\n }\n }\n};\n\n/**\n * Walks thru the error cause chain and returns the nearest import stack.\n * If the import stack is not found, it returns `undefined`.\n */\nexport const nearestImportStack = (err: unknown, root: unknown = err): string | undefined => {\n if (!(err instanceof Error) || !(root instanceof Error)) return undefined;\n\n if ('_expoImportStack' in err && typeof err._expoImportStack === 'string') {\n // Space out build failures.\n return err._expoImportStack;\n } else {\n return nearestImportStack(err.cause, root);\n }\n};\n\nfunction isInternalBytecode(frame: StackFrame): boolean {\n return frame.file?.includes('InternalBytecode.js') ?? false;\n}\n"],"names":["IS_METRO_BUNDLE_ERROR_SYMBOL","attachImportStackToRootMessage","dropStackIfContainsCodeFrame","getErrorOverlayHtmlAsync","getStackAsFormattedLog","likelyContainsCodeFrame","logMetroError","logMetroErrorAsync","logMetroErrorWithStack","nearestImportStack","isDebug","require","enabled","fill","width","Array","join","formatPaths","config","filePath","chalk","reset","dim","line","col","filter","Boolean","projectRoot","stack","codeFrame","error","SilentError","Log","log","red","message","CommandError","showCollapsedFrames","env","EXPO_DEBUG","logs","containsCodeFrame","maxWarningLineLength","Math","max","process","stdout","columns","lineText","content","lines","split","title","path","basename","fileName","push","bold","isPreviewTooLong","some","length","column","location","previewLine","cursorLine","formattedPath","row","rangeWindow","round","minBounds","maxBounds","min","slice","isFallback","stackProps","map","frame","methodName","subtitle","getStackFormattedLocation","collapse","isInternalBytecode","stackLines","backupStackLines","forEach","shouldShow","position","terminalLink","isSupported","lineItem","gray","isMetroRuntime","test","displayStack","Symbol","HAS_LOGGED_SYMBOL","parseErrorStack","LogBoxLog","level","substitutions","isComponentError","category","componentStack","Promise","res","symbolicate","symbolicated","logFromError","data","parseWebBuildErrors","routerRoot","stripAnsi","logBoxContext","selectedLogIndex","isDisabled","html","JSON","stringify","errorOverlayEntry","createMetroEndpointAsync","resolveFrom","mode","platform","minify","optimize","usedExports","baseUrl","isExporting","reactCompiler","htmlWithJs","replace","isArray","serverRoot","getMetroServerRoot","parse","file","startsWith","includes","canParse","relative","url","URL","err","Error","clean","stripVTControlCharacters","nearestImportStackValue","root","undefined","_expoImportStack","cause"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;IA2MYA,4BAA4B;eAA5BA;;IAmMAC,8BAA8B;eAA9BA;;IA1BGC,4BAA4B;eAA5BA;;IAlGMC,wBAAwB;eAAxBA;;IA/MNC,sBAAsB;eAAtBA;;IA8TAC,uBAAuB;eAAvBA;;IAnLMC,aAAa;eAAbA;;IAiDAC,kBAAkB;eAAlBA;;IA7NAC,sBAAsB;eAAtBA;;IAgYTC,kBAAkB;eAAlBA;;;;yBAjasB;;;;;;;yBACC;;;;;;;gEAClB;;;;;;;yBACuB;;;;;;;gEACxB;;;;;;;gEACO;;;;;;;yBACU;;;;;;;gEACT;;;;;;2BAEgB;uCAEC;qBACtB;sBACM;qBACN;wBACsB;0CACD;;;;;;AAEzC,MAAMC,UAAUC,QAAQ,SAASC,OAAO,CAAC;AAEzC,SAASC,KAAKC,KAAa;IACzB,OAAOC,MAAMD,OAAOE,IAAI,CAAC;AAC3B;AAEA,SAASC,YAAYC,MAAgE;IACnF,MAAMC,WAAWC,gBAAK,CAACC,KAAK,CAACH,OAAOC,QAAQ;IAC5C,OACEC,gBAAK,CAACE,GAAG,CAAC,OACVH,WACAC,gBAAK,CAACE,GAAG,CAAC,CAAC,CAAC,EAAE;QAACJ,OAAOK,IAAI;QAAEL,OAAOM,GAAG;KAAC,CAACC,MAAM,CAACC,SAASV,IAAI,CAAC,KAAK,CAAC,CAAC;AAExE;AAEO,eAAeR,uBACpBmB,WAAmB,EACnB,EACEC,KAAK,EACLC,SAAS,EACTC,KAAK,EAKN;IAED,IAAIA,iBAAiBC,mBAAW,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,uGAAuG;QACvG,OAAO2G,IAAIlH,KAAK;IAClB;AACF;AAMO,SAASvB,wBAAwB8B,OAA2B;IACjE,IAAI,CAACA,SAAS,OAAO;IAErB,MAAM6G,QAAQC,IAAAA,oCAAwB,EAAC9G;IACvC,IAAI,CAAC6G,OAAO,OAAO;IAEnB,OAAO,gBAAgBpD,IAAI,CAACoD;AAC9B;AAMO,MAAM/I,iCAAiC,CAAC6I;IAC7C,IAAI,CAAEA,CAAAA,eAAeC,KAAI,GAAI;IAE7B,4BAA4B;IAC5B,MAAMG,0BAA0BzI,mBAAmBqI;IACnD,IAAII,yBAAyB;QAC3BJ,IAAI3G,OAAO,IAAI,SAAS+G;QAExB,IAAI,CAACxI,SAAS;YACZ,0FAA0F;YAC1F,qDAAqD;YACrD,OAAOoI,IAAIlH,KAAK;QAClB;IACF;AACF;AAMO,MAAMnB,qBAAqB,CAACqI,KAAcK,OAAgBL,GAAG;IAClE,IAAI,CAAEA,CAAAA,eAAeC,KAAI,KAAM,CAAEI,CAAAA,gBAAgBJ,KAAI,GAAI,OAAOK;IAEhE,IAAI,sBAAsBN,OAAO,OAAOA,IAAIO,gBAAgB,KAAK,UAAU;QACzE,4BAA4B;QAC5B,OAAOP,IAAIO,gBAAgB;IAC7B,OAAO;QACL,OAAO5I,mBAAmBqI,IAAIQ,KAAK,EAAEH;IACvC;AACF;AAEA,SAASlE,mBAAmBL,KAAiB;QACpCA;IAAP,OAAOA,EAAAA,cAAAA,MAAM2D,IAAI,qBAAV3D,YAAY6D,QAAQ,CAAC,2BAA0B;AACxD"}
|
|
@@ -160,14 +160,11 @@ function getNodejsExtensions(srcExts) {
|
|
|
160
160
|
nodejsSourceExtensions.splice(jsIndex + 1, 0, ...mjsExts);
|
|
161
161
|
return nodejsSourceExtensions;
|
|
162
162
|
}
|
|
163
|
-
function withExtendedResolver(config, { tsconfig, autolinkingModuleResolverInput, isTsconfigPathsEnabled, isFastResolverEnabled, isExporting,
|
|
163
|
+
function withExtendedResolver(config, { tsconfig, autolinkingModuleResolverInput, isTsconfigPathsEnabled, isFastResolverEnabled, isExporting, isReactServerComponentsEnabled, getMetroBundler }) {
|
|
164
164
|
var _config_resolver, _config_resolver1, _config_resolver2, _config_resolver3, _config_serializer_createModuleIdFactory, _config_serializer;
|
|
165
165
|
if (isReactServerComponentsEnabled) {
|
|
166
166
|
_log.Log.warn(`React Server Components (beta) is enabled.`);
|
|
167
167
|
}
|
|
168
|
-
if (isReactCanaryEnabled) {
|
|
169
|
-
_log.Log.warn(`Experimental React 19 canary is enabled.`);
|
|
170
|
-
}
|
|
171
168
|
if (isFastResolverEnabled) {
|
|
172
169
|
_log.Log.log(_chalk().default.dim`Fast resolver is enabled.`);
|
|
173
170
|
}
|
|
@@ -185,10 +182,6 @@ function withExtendedResolver(config, { tsconfig, autolinkingModuleResolverInput
|
|
|
185
182
|
'react-native/Libraries/Image/resolveAssetSource': 'expo-asset/build/resolveAssetSource'
|
|
186
183
|
}
|
|
187
184
|
};
|
|
188
|
-
// The vendored canary modules live inside /static/canary-full/node_modules
|
|
189
|
-
// Adding the `index.js` allows us to add this path as `originModulePath` to
|
|
190
|
-
// resolve the nested `node_modules` folder properly.
|
|
191
|
-
const canaryModulesPath = _path().default.join(require.resolve('@expo/cli/package.json'), '../static/canary-full/index.js');
|
|
192
185
|
let _universalAliases;
|
|
193
186
|
function getUniversalAliases() {
|
|
194
187
|
if (_universalAliases) {
|
|
@@ -515,6 +508,22 @@ function withExtendedResolver(config, { tsconfig, autolinkingModuleResolverInput
|
|
|
515
508
|
if (result.type !== 'sourceFile') {
|
|
516
509
|
return result;
|
|
517
510
|
}
|
|
511
|
+
const normalizedPath = normalizeSlashes(result.filePath);
|
|
512
|
+
const doReplace = (from, to, options)=>doReplaceHelper(from, to, {
|
|
513
|
+
normalizedPath,
|
|
514
|
+
doResolve,
|
|
515
|
+
...options
|
|
516
|
+
});
|
|
517
|
+
const doReplaceStrict = (from, to)=>doReplace(from, to, {
|
|
518
|
+
throws: true
|
|
519
|
+
});
|
|
520
|
+
if (_env.env.EXPO_UNSTABLE_WEB_MODAL) {
|
|
521
|
+
const webModalModule = doReplace('expo-router/build/layouts/_web-modal.js', 'expo-router/build/layouts/ExperimentalModalStack.js');
|
|
522
|
+
if (webModalModule) {
|
|
523
|
+
debug('Using `_unstable-web-modal` implementation.');
|
|
524
|
+
return webModalModule;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
518
527
|
if (platform === 'web') {
|
|
519
528
|
if (result.filePath.includes('node_modules')) {
|
|
520
529
|
// Disallow importing confusing native modules on web
|
|
@@ -527,8 +536,8 @@ function withExtendedResolver(config, { tsconfig, autolinkingModuleResolverInput
|
|
|
527
536
|
throw new _createExpoMetroResolver.FailedToResolvePathError(`Importing native-only module "${moduleName}" on web from: ${_path().default.relative(config.projectRoot, context.originModulePath)}`);
|
|
528
537
|
}
|
|
529
538
|
// Replace with static shims
|
|
530
|
-
|
|
531
|
-
.replace(/.*node_modules\//, '');
|
|
539
|
+
// Drop everything up until the `node_modules` folder.
|
|
540
|
+
const normalName = normalizedPath.replace(/.*node_modules\//, '');
|
|
532
541
|
const shimFile = (0, _externals.shouldCreateVirtualShim)(normalName);
|
|
533
542
|
if (shimFile) {
|
|
534
543
|
const virtualId = `\0shim:${normalName}`;
|
|
@@ -546,30 +555,21 @@ function withExtendedResolver(config, { tsconfig, autolinkingModuleResolverInput
|
|
|
546
555
|
} else {
|
|
547
556
|
var _context_customResolverOptions, _context_customResolverOptions1;
|
|
548
557
|
const isServer = ((_context_customResolverOptions = context.customResolverOptions) == null ? void 0 : _context_customResolverOptions.environment) === 'node' || ((_context_customResolverOptions1 = context.customResolverOptions) == null ? void 0 : _context_customResolverOptions1.environment) === 'react-server';
|
|
549
|
-
// react-native/Libraries/Core/InitializeCore
|
|
550
|
-
const normal = normalizeSlashes(result.filePath);
|
|
551
558
|
// Shim out React Native native runtime globals in server mode for native.
|
|
552
559
|
if (isServer) {
|
|
553
|
-
|
|
560
|
+
const emptyModule = doReplace('react-native/Libraries/Core/InitializeCore.js', undefined);
|
|
561
|
+
if (emptyModule) {
|
|
554
562
|
debug('Shimming out InitializeCore for React Native in native SSR bundle');
|
|
555
|
-
return
|
|
556
|
-
type: 'empty'
|
|
557
|
-
};
|
|
563
|
+
return emptyModule;
|
|
558
564
|
}
|
|
559
565
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
if (
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
const
|
|
566
|
-
if (
|
|
567
|
-
debug(`Redirecting React Native module "${result.filePath}" to canary build`);
|
|
568
|
-
return {
|
|
569
|
-
...result,
|
|
570
|
-
filePath: canaryFile
|
|
571
|
-
};
|
|
572
|
-
}
|
|
566
|
+
const hmrModule = doReplaceStrict('react-native/Libraries/Utilities/HMRClient.js', 'expo/src/async-require/hmr.ts');
|
|
567
|
+
if (hmrModule) return hmrModule;
|
|
568
|
+
if (_env.env.EXPO_UNSTABLE_LOG_BOX) {
|
|
569
|
+
const logBoxModule = doReplace('react-native/Libraries/LogBox/LogBoxInspectorContainer.js', '@expo/log-box/swap-rn-logbox.js');
|
|
570
|
+
if (logBoxModule) return logBoxModule;
|
|
571
|
+
const logBoxParserModule = doReplace('react-native/Libraries/LogBox/Data/parseLogBoxLog.js', '@expo/log-box/swap-rn-logbox-parser.js');
|
|
572
|
+
if (logBoxParserModule) return logBoxParserModule;
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
575
|
return result;
|
|
@@ -592,14 +592,6 @@ function withExtendedResolver(config, { tsconfig, autolinkingModuleResolverInput
|
|
|
592
592
|
...immutableContext,
|
|
593
593
|
preferNativePlatform: platform !== 'web'
|
|
594
594
|
};
|
|
595
|
-
// TODO: Remove this when we have React 19 in the expo/expo monorepo.
|
|
596
|
-
if (isReactCanaryEnabled && // Change the node modules path for react and react-dom to use the vendor in Expo CLI.
|
|
597
|
-
/^(react|react\/.*|react-dom|react-dom\/.*)$/.test(moduleName)) {
|
|
598
|
-
// Modifying the origin module path changes the starting Node module resolution path to this folder
|
|
599
|
-
context.originModulePath = canaryModulesPath;
|
|
600
|
-
// Hierarchical lookup has to be enabled for this to work
|
|
601
|
-
context.disableHierarchicalLookup = false;
|
|
602
|
-
}
|
|
603
595
|
if ((0, _metroOptions.isServerEnvironment)((_context_customResolverOptions = context.customResolverOptions) == null ? void 0 : _context_customResolverOptions.environment)) {
|
|
604
596
|
var _context_customResolverOptions1, _context_customResolverOptions2;
|
|
605
597
|
// Adjust nodejs source extensions to sort mjs after js, including platform variants.
|
|
@@ -667,11 +659,36 @@ function withExtendedResolver(config, { tsconfig, autolinkingModuleResolverInput
|
|
|
667
659
|
});
|
|
668
660
|
return (0, _withMetroErrorReportingResolver.withMetroErrorReportingResolver)((0, _withMetroSupervisingTransformWorker.withMetroSupervisingTransformWorker)(metroConfigWithCustomContext));
|
|
669
661
|
}
|
|
662
|
+
function doReplaceHelper(from, to, { throws = false, normalizedPath, doResolve }) {
|
|
663
|
+
if (!normalizedPath.endsWith(from)) {
|
|
664
|
+
return undefined;
|
|
665
|
+
}
|
|
666
|
+
if (to === undefined) {
|
|
667
|
+
return {
|
|
668
|
+
type: 'empty'
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
try {
|
|
672
|
+
const hmrModule = doResolve(to);
|
|
673
|
+
if (hmrModule.type === 'sourceFile') {
|
|
674
|
+
debug(`Using \`${to}\` implementation.`);
|
|
675
|
+
return hmrModule;
|
|
676
|
+
}
|
|
677
|
+
} catch (resolutionError) {
|
|
678
|
+
if (throws) {
|
|
679
|
+
throw new Error(`Failed to replace ${from} with ${to}. Resolution of ${to} failed.`, {
|
|
680
|
+
cause: resolutionError
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
debug(`Failed to resolve ${to} when swapping from ${from}: ${resolutionError}`);
|
|
684
|
+
}
|
|
685
|
+
return undefined;
|
|
686
|
+
}
|
|
670
687
|
function shouldAliasModule(input, alias) {
|
|
671
688
|
var _input_result, _input_result1;
|
|
672
689
|
return input.platform === alias.platform && ((_input_result = input.result) == null ? void 0 : _input_result.type) === 'sourceFile' && typeof ((_input_result1 = input.result) == null ? void 0 : _input_result1.filePath) === 'string' && normalizeSlashes(input.result.filePath).endsWith(alias.output);
|
|
673
690
|
}
|
|
674
|
-
async function withMetroMultiPlatformAsync(projectRoot, { config, exp, platformBundlers, isTsconfigPathsEnabled, isAutolinkingResolverEnabled, isFastResolverEnabled, isExporting,
|
|
691
|
+
async function withMetroMultiPlatformAsync(projectRoot, { config, exp, platformBundlers, isTsconfigPathsEnabled, isAutolinkingResolverEnabled, isFastResolverEnabled, isExporting, isReactServerComponentsEnabled, getMetroBundler }) {
|
|
675
692
|
// Change the default metro-runtime to a custom one that supports bundle splitting.
|
|
676
693
|
// NOTE(@kitten): This is now always active and EXPO_USE_METRO_REQUIRE / isNamedRequiresEnabled is disregarded
|
|
677
694
|
const metroDefaults = require('@expo/metro/metro-config/defaults/defaults');
|
|
@@ -694,10 +711,6 @@ async function withMetroMultiPlatformAsync(projectRoot, { config, exp, platformB
|
|
|
694
711
|
// @ts-expect-error: watchFolders is readonly
|
|
695
712
|
config.watchFolders.push(_path().default.join(require.resolve('@expo/metro-config/package.json'), '../..'), // For virtual modules
|
|
696
713
|
_path().default.join(require.resolve('expo/package.json'), '..'));
|
|
697
|
-
if (isReactCanaryEnabled) {
|
|
698
|
-
// @ts-expect-error: watchFolders is readonly
|
|
699
|
-
config.watchFolders.push(_path().default.join(require.resolve('@expo/cli/package.json'), '..'));
|
|
700
|
-
}
|
|
701
714
|
}
|
|
702
715
|
let tsconfig = null;
|
|
703
716
|
if (isTsconfigPathsEnabled) {
|
|
@@ -730,7 +743,6 @@ async function withMetroMultiPlatformAsync(projectRoot, { config, exp, platformB
|
|
|
730
743
|
isExporting,
|
|
731
744
|
isTsconfigPathsEnabled,
|
|
732
745
|
isFastResolverEnabled,
|
|
733
|
-
isReactCanaryEnabled,
|
|
734
746
|
isReactServerComponentsEnabled,
|
|
735
747
|
getMetroBundler
|
|
736
748
|
});
|