@expo/metro-runtime 3.2.0 → 3.2.2
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/HMRClient.js.map +1 -1
- package/build/LoadingView.native.d.ts +1 -1
- package/build/LoadingView.native.d.ts.map +1 -1
- package/build/LoadingView.native.js +9 -5
- package/build/LoadingView.native.js.map +1 -1
- package/build/async-require/buildAsyncRequire.js +2 -1
- package/build/async-require/buildAsyncRequire.js.map +1 -1
- package/build/async-require/buildUrlForBundle.js +2 -1
- package/build/async-require/buildUrlForBundle.js.map +1 -1
- package/build/async-require/buildUrlForBundle.native.js +2 -1
- package/build/async-require/buildUrlForBundle.native.js.map +1 -1
- package/build/async-require/fetchAsync.js +2 -1
- package/build/async-require/fetchAsync.js.map +1 -1
- package/build/async-require/fetchAsync.native.js +2 -1
- package/build/async-require/fetchAsync.native.js.map +1 -1
- package/build/async-require/fetchThenEval.web.js +2 -1
- package/build/async-require/fetchThenEval.web.js.map +1 -1
- package/build/async-require/fetchThenEvalJs.js +2 -1
- package/build/async-require/fetchThenEvalJs.js.map +1 -1
- package/build/async-require/index.native.js.map +1 -1
- package/build/async-require/loadBundle.js +2 -1
- package/build/async-require/loadBundle.js.map +1 -1
- package/build/effects.js.map +1 -1
- package/build/error-overlay/Data/LogBoxData.js +21 -20
- package/build/error-overlay/Data/LogBoxData.js.map +1 -1
- package/build/error-overlay/Data/LogBoxLog.js.map +1 -1
- package/build/error-overlay/Data/LogBoxSymbolication.js +3 -2
- package/build/error-overlay/Data/LogBoxSymbolication.js.map +1 -1
- package/build/error-overlay/Data/LogContext.js +3 -3
- package/build/error-overlay/Data/LogContext.js.map +1 -1
- package/build/error-overlay/Data/parseLogBoxLog.js +6 -5
- package/build/error-overlay/Data/parseLogBoxLog.js.map +1 -1
- package/build/error-overlay/ErrorOverlay.js +5 -4
- package/build/error-overlay/ErrorOverlay.js.map +1 -1
- package/build/error-overlay/LogBox.web.js.map +1 -1
- package/build/error-overlay/UI/AnsiHighlight.js +2 -1
- package/build/error-overlay/UI/AnsiHighlight.js.map +1 -1
- package/build/error-overlay/UI/LogBoxButton.js +2 -1
- package/build/error-overlay/UI/LogBoxButton.js.map +1 -1
- package/build/error-overlay/UI/LogBoxMessage.js +2 -1
- package/build/error-overlay/UI/LogBoxMessage.js.map +1 -1
- package/build/error-overlay/UI/LogBoxStyle.js +15 -14
- package/build/error-overlay/UI/LogBoxStyle.js.map +1 -1
- package/build/error-overlay/formatProjectFilePath.js +3 -2
- package/build/error-overlay/formatProjectFilePath.js.map +1 -1
- package/build/error-overlay/index.js +2 -1
- package/build/error-overlay/index.js.map +1 -1
- package/build/error-overlay/modules/ExceptionsManager/index.js.map +1 -1
- package/build/error-overlay/modules/NativeLogBox/index.js.map +1 -1
- package/build/error-overlay/modules/openFileInEditor/index.js.map +1 -1
- package/build/error-overlay/modules/parseErrorStack/index.js.map +1 -1
- package/build/error-overlay/modules/stringifySafe/index.js +2 -1
- package/build/error-overlay/modules/stringifySafe/index.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js +2 -1
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js +2 -1
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js +2 -1
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js +2 -1
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorSection.js +2 -1
- package/build/error-overlay/overlay/LogBoxInspectorSection.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js +2 -1
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js +2 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js +3 -2
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js.map +1 -1
- package/build/error-overlay/toast/ErrorToast.js +2 -1
- package/build/error-overlay/toast/ErrorToast.js.map +1 -1
- package/build/error-overlay/toast/ErrorToastContainer.js +1 -1
- package/build/error-overlay/toast/ErrorToastContainer.js.map +1 -1
- package/build/error-overlay/toast/ErrorToastContainer.web.js +2 -1
- package/build/error-overlay/toast/ErrorToastContainer.web.js.map +1 -1
- package/build/error-overlay/toast/ErrorToastMessage.js +2 -1
- package/build/error-overlay/toast/ErrorToastMessage.js.map +1 -1
- package/build/error-overlay/useRejectionHandler.js +2 -1
- package/build/error-overlay/useRejectionHandler.js.map +1 -1
- package/build/getDevServer.js.map +1 -1
- package/build/location/Location.js +3 -2
- package/build/location/Location.js.map +1 -1
- package/build/location/Location.native.js +3 -2
- package/build/location/Location.native.js.map +1 -1
- package/build/location/install.native.js.map +1 -1
- package/build/messageSocket.js.map +1 -1
- package/build/setupFastRefresh.js.map +1 -1
- package/package.json +2 -2
- package/src/LoadingView.native.ts +8 -1
package/build/HMRClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HMRClient.js","sourceRoot":"","sources":["../src/HMRClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,+DAAsD;AAEtD,gEAAwC;AACxC,oEAA4C;AAC5C,kEAA0C;AAE1C,MAAM,cAAc,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACtE,MAAM,kBAAkB,GAAa,EAAE,CAAC;AAUxC,IAAI,SAAS,GAAyB,IAAI,CAAC;AAC3C,IAAI,oBAAoB,GAAkB,IAAI,CAAC;AAC/C,IAAI,0BAA0B,GAAkB,IAAI,CAAC;AACrD,IAAI,UAAU,GAAY,KAAK,CAAC;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AAK,IAAI,EAAE,CAAC;QACxC,OAAO;IACT,CAAC;IAED,uEAAuE;IACvE,uFAAuF;IACvF,aAAa,EAAE,CAAC;IAEhB,MAAM,OAAO,GAAG,0BAA0B,CAAC;IAC3C,0BAA0B,GAAG,IAAI,CAAC;IAElC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,gDAAgD;IAChD,0CAA0C;IAC1C,mBAAmB;IACnB,KAAK,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAClC,MAAM,KAAK,CAAC;AACd,CAAC;AAED,kBAAe,SAAS,CAAC","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 * Based on this but with web support:\n * https://github.com/facebook/react-native/blob/086714b02b0fb838dee5a66c5bcefe73b53cf3df/Libraries/Utilities/HMRClient.js\n */\nimport prettyFormat, { plugins } from 'pretty-format';\n\nimport LoadingView from './LoadingView';\nimport LogBox from './error-overlay/LogBox';\nimport getDevServer from './getDevServer';\n\nconst MetroHMRClient = require('metro-runtime/src/modules/HMRClient');\nconst pendingEntryPoints: string[] = [];\n\ntype HMRClientType = {\n send: (msg: string) => void;\n isEnabled: () => boolean;\n disable: () => void;\n enable: () => void;\n hasPendingUpdates: () => boolean;\n};\n\nlet hmrClient: HMRClientType | null = null;\nlet hmrUnavailableReason: string | null = null;\nlet currentCompileErrorMessage: string | null = null;\nlet didConnect: boolean = false;\nconst pendingLogs: [LogLevel, any[]][] = [];\n\ntype LogLevel =\n | 'trace'\n | 'info'\n | 'warn'\n | 'error'\n | 'log'\n | 'group'\n | 'groupCollapsed'\n | 'groupEnd'\n | 'debug';\n\nexport type HMRClientNativeInterface = {\n enable(): void;\n disable(): void;\n registerBundle(requestUrl: string): void;\n log(level: LogLevel, data: any[]): void;\n setup(props: { isEnabled: boolean }): void;\n};\n\nfunction assert(foo: any, msg: string): asserts foo {\n if (!foo) throw new Error(msg);\n}\n\n/**\n * HMR Client that receives from the server HMR updates and propagates them\n * runtime to reflects those changes.\n */\nconst HMRClient: HMRClientNativeInterface = {\n enable() {\n if (hmrUnavailableReason !== null) {\n // If HMR became unavailable while you weren't using it,\n // explain why when you try to turn it on.\n // This is an error (and not a warning) because it is shown\n // in response to a direct user action.\n throw new Error(hmrUnavailableReason);\n }\n\n assert(hmrClient, 'Expected HMRClient.setup() call at startup.');\n\n // We use this for internal logging only.\n // It doesn't affect the logic.\n hmrClient.send(JSON.stringify({ type: 'log-opt-in' }));\n\n // When toggling Fast Refresh on, we might already have some stashed updates.\n // Since they'll get applied now, we'll show a banner.\n const hasUpdates = hmrClient!.hasPendingUpdates();\n\n if (hasUpdates) {\n LoadingView.showMessage('Refreshing...', 'refresh');\n }\n try {\n hmrClient.enable();\n } finally {\n if (hasUpdates) {\n LoadingView.hide();\n }\n }\n\n // There could be a compile error while Fast Refresh was off,\n // but we ignored it at the time. Show it now.\n showCompileError();\n },\n\n disable() {\n assert(hmrClient, 'Expected HMRClient.setup() call at startup.');\n hmrClient.disable();\n },\n\n registerBundle(requestUrl: string) {\n assert(hmrClient, 'Expected HMRClient.setup() call at startup.');\n pendingEntryPoints.push(requestUrl);\n registerBundleEntryPoints(hmrClient);\n },\n\n log(level: LogLevel, data: any[]) {\n if (!hmrClient) {\n // Catch a reasonable number of early logs\n // in case hmrClient gets initialized later.\n pendingLogs.push([level, data]);\n if (pendingLogs.length > 100) {\n pendingLogs.shift();\n }\n return;\n }\n try {\n hmrClient.send(\n JSON.stringify({\n type: 'log',\n level,\n platform: 'web',\n mode: 'BRIDGE',\n data: data.map((item) =>\n typeof item === 'string'\n ? item\n : prettyFormat(item, {\n escapeString: true,\n highlight: true,\n maxDepth: 3,\n min: true,\n plugins: [plugins.ReactElement],\n })\n ),\n })\n );\n } catch {\n // If sending logs causes any failures we want to silently ignore them\n // to ensure we do not cause infinite-logging loops.\n }\n },\n\n // Called once by the bridge on startup, even if Fast Refresh is off.\n // It creates the HMR client but doesn't actually set up the socket yet.\n setup({ isEnabled }: { isEnabled: boolean }) {\n assert(!hmrClient, 'Cannot initialize hmrClient twice');\n\n const serverScheme = window.location.protocol === 'https:' ? 'wss' : 'ws';\n const client = new MetroHMRClient(`${serverScheme}://${window.location.host}/hot`);\n hmrClient = client;\n\n const { fullBundleUrl } = getDevServer();\n pendingEntryPoints.push(\n // HMRServer understands regular bundle URLs, so prefer that in case\n // there are any important URL parameters we can't reconstruct from\n // `setup()`'s arguments.\n fullBundleUrl\n );\n\n client.on('connection-error', (e: Error) => {\n let error = `Cannot connect to Metro.\n \n Try the following to fix the issue:\n - Ensure the Metro dev server is running and available on the same network as this device`;\n error += `\n \n URL: ${window.location.host}\n \n Error: ${e.message}`;\n\n setHMRUnavailableReason(error);\n });\n\n client.on('update-start', ({ isInitialUpdate }: { isInitialUpdate?: boolean }) => {\n currentCompileErrorMessage = null;\n didConnect = true;\n\n if (client.isEnabled() && !isInitialUpdate) {\n LoadingView.showMessage('Refreshing...', 'refresh');\n }\n });\n\n client.on('update', ({ isInitialUpdate }: { isInitialUpdate?: boolean }) => {\n if (client.isEnabled() && !isInitialUpdate) {\n dismissRedbox();\n LogBox.clearAllLogs();\n }\n });\n\n client.on('update-done', () => {\n LoadingView.hide();\n });\n\n client.on('error', (data: { type: string; message: string }) => {\n LoadingView.hide();\n\n if (data.type === 'GraphNotFoundError') {\n client.close();\n setHMRUnavailableReason('Metro has restarted since the last edit. Reload to reconnect.');\n } else if (data.type === 'RevisionNotFoundError') {\n client.close();\n setHMRUnavailableReason('Metro and the client are out of sync. Reload to reconnect.');\n } else {\n currentCompileErrorMessage = `${data.type} ${data.message}`;\n if (client.isEnabled()) {\n showCompileError();\n }\n }\n });\n\n client.on('close', (closeEvent: { code: number; reason: string }) => {\n LoadingView.hide();\n\n // https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4.1\n // https://www.rfc-editor.org/rfc/rfc6455.html#section-7.1.5\n const isNormalOrUnsetCloseReason =\n closeEvent == null ||\n closeEvent.code === 1000 ||\n closeEvent.code === 1005 ||\n closeEvent.code == null;\n\n setHMRUnavailableReason(\n `${\n isNormalOrUnsetCloseReason\n ? 'Disconnected from Metro.'\n : `Disconnected from Metro (${closeEvent.code}: \"${closeEvent.reason}\").`\n }\n\nTo reconnect:\n- Ensure that Metro is running and available on the same network\n- Reload this app (will trigger further help if Metro cannot be connected to)\n `\n );\n });\n\n if (isEnabled) {\n HMRClient.enable();\n } else {\n HMRClient.disable();\n }\n\n registerBundleEntryPoints(hmrClient);\n flushEarlyLogs();\n },\n};\n\nfunction setHMRUnavailableReason(reason: string) {\n assert(hmrClient, 'Expected HMRClient.setup() call at startup.');\n if (hmrUnavailableReason !== null) {\n // Don't show more than one warning.\n return;\n }\n hmrUnavailableReason = reason;\n\n // We only want to show a warning if Fast Refresh is on *and* if we ever\n // previously managed to connect successfully. We don't want to show\n // the warning to native engineers who use cached bundles without Metro.\n if (hmrClient.isEnabled() && didConnect) {\n console.warn(reason);\n // (Not using the `warning` module to prevent a Buck cycle.)\n }\n}\n\nfunction registerBundleEntryPoints(client: HMRClientType | null) {\n if (hmrUnavailableReason != null) {\n // \"Bundle Splitting – Metro disconnected\"\n window.location.reload();\n return;\n }\n\n if (pendingEntryPoints.length > 0) {\n client?.send(\n JSON.stringify({\n type: 'register-entrypoints',\n entryPoints: pendingEntryPoints,\n })\n );\n pendingEntryPoints.length = 0;\n }\n}\n\nfunction flushEarlyLogs() {\n try {\n pendingLogs.forEach(([level, data]) => {\n HMRClient.log(level, data);\n });\n } finally {\n pendingLogs.length = 0;\n }\n}\n\nfunction dismissRedbox() {\n // TODO(EvanBacon): Error overlay for web.\n}\n\nfunction showCompileError() {\n if (currentCompileErrorMessage === null) {\n return;\n }\n\n // Even if there is already a redbox, syntax errors are more important.\n // Otherwise you risk seeing a stale runtime error while a syntax error is more recent.\n dismissRedbox();\n\n const message = currentCompileErrorMessage;\n currentCompileErrorMessage = null;\n\n const error = new Error(message);\n // Symbolicating compile errors is wasted effort\n // because the stack trace is meaningless:\n // @ts-expect-error\n error.preventSymbolication = true;\n throw error;\n}\n\nexport default HMRClient;\n"]}
|
|
1
|
+
{"version":3,"file":"HMRClient.js","sourceRoot":"","sources":["../src/HMRClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,+DAAsD;AAEtD,gEAAwC;AACxC,oEAA4C;AAC5C,kEAA0C;AAE1C,MAAM,cAAc,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACtE,MAAM,kBAAkB,GAAa,EAAE,CAAC;AAUxC,IAAI,SAAS,GAAyB,IAAI,CAAC;AAC3C,IAAI,oBAAoB,GAAkB,IAAI,CAAC;AAC/C,IAAI,0BAA0B,GAAkB,IAAI,CAAC;AACrD,IAAI,UAAU,GAAY,KAAK,CAAC;AAChC,MAAM,WAAW,GAAwB,EAAE,CAAC;AAqB5C,SAAS,MAAM,CAAC,GAAQ,EAAE,GAAW;IACnC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,MAAM,SAAS,GAA6B;IAC1C,MAAM;QACJ,IAAI,oBAAoB,KAAK,IAAI,EAAE;YACjC,wDAAwD;YACxD,0CAA0C;YAC1C,2DAA2D;YAC3D,uCAAuC;YACvC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;SACvC;QAED,MAAM,CAAC,SAAS,EAAE,6CAA6C,CAAC,CAAC;QAEjE,yCAAyC;QACzC,+BAA+B;QAC/B,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;QAEvD,6EAA6E;QAC7E,sDAAsD;QACtD,MAAM,UAAU,GAAG,SAAU,CAAC,iBAAiB,EAAE,CAAC;QAElD,IAAI,UAAU,EAAE;Y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AAC,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE;YACpC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;KACJ;YAAS;QACR,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;KACxB;AACH,CAAC;AAED,SAAS,aAAa;IACpB,0CAA0C;AAC5C,CAAC;AAED,SAAS,gBAAgB;IACvB,IAAI,0BAA0B,KAAK,IAAI,EAAE;QACvC,OAAO;KACR;IAED,uEAAuE;IACvE,uFAAuF;IACvF,aAAa,EAAE,CAAC;IAEhB,MAAM,OAAO,GAAG,0BAA0B,CAAC;IAC3C,0BAA0B,GAAG,IAAI,CAAC;IAElC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,gDAAgD;IAChD,0CAA0C;IAC1C,mBAAmB;IACnB,KAAK,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAClC,MAAM,KAAK,CAAC;AACd,CAAC;AAED,kBAAe,SAAS,CAAC","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 * Based on this but with web support:\n * https://github.com/facebook/react-native/blob/086714b02b0fb838dee5a66c5bcefe73b53cf3df/Libraries/Utilities/HMRClient.js\n */\nimport prettyFormat, { plugins } from 'pretty-format';\n\nimport LoadingView from './LoadingView';\nimport LogBox from './error-overlay/LogBox';\nimport getDevServer from './getDevServer';\n\nconst MetroHMRClient = require('metro-runtime/src/modules/HMRClient');\nconst pendingEntryPoints: string[] = [];\n\ntype HMRClientType = {\n send: (msg: string) => void;\n isEnabled: () => boolean;\n disable: () => void;\n enable: () => void;\n hasPendingUpdates: () => boolean;\n};\n\nlet hmrClient: HMRClientType | null = null;\nlet hmrUnavailableReason: string | null = null;\nlet currentCompileErrorMessage: string | null = null;\nlet didConnect: boolean = false;\nconst pendingLogs: [LogLevel, any[]][] = [];\n\ntype LogLevel =\n | 'trace'\n | 'info'\n | 'warn'\n | 'error'\n | 'log'\n | 'group'\n | 'groupCollapsed'\n | 'groupEnd'\n | 'debug';\n\nexport type HMRClientNativeInterface = {\n enable(): void;\n disable(): void;\n registerBundle(requestUrl: string): void;\n log(level: LogLevel, data: any[]): void;\n setup(props: { isEnabled: boolean }): void;\n};\n\nfunction assert(foo: any, msg: string): asserts foo {\n if (!foo) throw new Error(msg);\n}\n\n/**\n * HMR Client that receives from the server HMR updates and propagates them\n * runtime to reflects those changes.\n */\nconst HMRClient: HMRClientNativeInterface = {\n enable() {\n if (hmrUnavailableReason !== null) {\n // If HMR became unavailable while you weren't using it,\n // explain why when you try to turn it on.\n // This is an error (and not a warning) because it is shown\n // in response to a direct user action.\n throw new Error(hmrUnavailableReason);\n }\n\n assert(hmrClient, 'Expected HMRClient.setup() call at startup.');\n\n // We use this for internal logging only.\n // It doesn't affect the logic.\n hmrClient.send(JSON.stringify({ type: 'log-opt-in' }));\n\n // When toggling Fast Refresh on, we might already have some stashed updates.\n // Since they'll get applied now, we'll show a banner.\n const hasUpdates = hmrClient!.hasPendingUpdates();\n\n if (hasUpdates) {\n LoadingView.showMessage('Refreshing...', 'refresh');\n }\n try {\n hmrClient.enable();\n } finally {\n if (hasUpdates) {\n LoadingView.hide();\n }\n }\n\n // There could be a compile error while Fast Refresh was off,\n // but we ignored it at the time. Show it now.\n showCompileError();\n },\n\n disable() {\n assert(hmrClient, 'Expected HMRClient.setup() call at startup.');\n hmrClient.disable();\n },\n\n registerBundle(requestUrl: string) {\n assert(hmrClient, 'Expected HMRClient.setup() call at startup.');\n pendingEntryPoints.push(requestUrl);\n registerBundleEntryPoints(hmrClient);\n },\n\n log(level: LogLevel, data: any[]) {\n if (!hmrClient) {\n // Catch a reasonable number of early logs\n // in case hmrClient gets initialized later.\n pendingLogs.push([level, data]);\n if (pendingLogs.length > 100) {\n pendingLogs.shift();\n }\n return;\n }\n try {\n hmrClient.send(\n JSON.stringify({\n type: 'log',\n level,\n platform: 'web',\n mode: 'BRIDGE',\n data: data.map((item) =>\n typeof item === 'string'\n ? item\n : prettyFormat(item, {\n escapeString: true,\n highlight: true,\n maxDepth: 3,\n min: true,\n plugins: [plugins.ReactElement],\n })\n ),\n })\n );\n } catch {\n // If sending logs causes any failures we want to silently ignore them\n // to ensure we do not cause infinite-logging loops.\n }\n },\n\n // Called once by the bridge on startup, even if Fast Refresh is off.\n // It creates the HMR client but doesn't actually set up the socket yet.\n setup({ isEnabled }: { isEnabled: boolean }) {\n assert(!hmrClient, 'Cannot initialize hmrClient twice');\n\n const serverScheme = window.location.protocol === 'https:' ? 'wss' : 'ws';\n const client = new MetroHMRClient(`${serverScheme}://${window.location.host}/hot`);\n hmrClient = client;\n\n const { fullBundleUrl } = getDevServer();\n pendingEntryPoints.push(\n // HMRServer understands regular bundle URLs, so prefer that in case\n // there are any important URL parameters we can't reconstruct from\n // `setup()`'s arguments.\n fullBundleUrl\n );\n\n client.on('connection-error', (e: Error) => {\n let error = `Cannot connect to Metro.\n \n Try the following to fix the issue:\n - Ensure the Metro dev server is running and available on the same network as this device`;\n error += `\n \n URL: ${window.location.host}\n \n Error: ${e.message}`;\n\n setHMRUnavailableReason(error);\n });\n\n client.on('update-start', ({ isInitialUpdate }: { isInitialUpdate?: boolean }) => {\n currentCompileErrorMessage = null;\n didConnect = true;\n\n if (client.isEnabled() && !isInitialUpdate) {\n LoadingView.showMessage('Refreshing...', 'refresh');\n }\n });\n\n client.on('update', ({ isInitialUpdate }: { isInitialUpdate?: boolean }) => {\n if (client.isEnabled() && !isInitialUpdate) {\n dismissRedbox();\n LogBox.clearAllLogs();\n }\n });\n\n client.on('update-done', () => {\n LoadingView.hide();\n });\n\n client.on('error', (data: { type: string; message: string }) => {\n LoadingView.hide();\n\n if (data.type === 'GraphNotFoundError') {\n client.close();\n setHMRUnavailableReason('Metro has restarted since the last edit. Reload to reconnect.');\n } else if (data.type === 'RevisionNotFoundError') {\n client.close();\n setHMRUnavailableReason('Metro and the client are out of sync. Reload to reconnect.');\n } else {\n currentCompileErrorMessage = `${data.type} ${data.message}`;\n if (client.isEnabled()) {\n showCompileError();\n }\n }\n });\n\n client.on('close', (closeEvent: { code: number; reason: string }) => {\n LoadingView.hide();\n\n // https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4.1\n // https://www.rfc-editor.org/rfc/rfc6455.html#section-7.1.5\n const isNormalOrUnsetCloseReason =\n closeEvent == null ||\n closeEvent.code === 1000 ||\n closeEvent.code === 1005 ||\n closeEvent.code == null;\n\n setHMRUnavailableReason(\n `${\n isNormalOrUnsetCloseReason\n ? 'Disconnected from Metro.'\n : `Disconnected from Metro (${closeEvent.code}: \"${closeEvent.reason}\").`\n }\n\nTo reconnect:\n- Ensure that Metro is running and available on the same network\n- Reload this app (will trigger further help if Metro cannot be connected to)\n `\n );\n });\n\n if (isEnabled) {\n HMRClient.enable();\n } else {\n HMRClient.disable();\n }\n\n registerBundleEntryPoints(hmrClient);\n flushEarlyLogs();\n },\n};\n\nfunction setHMRUnavailableReason(reason: string) {\n assert(hmrClient, 'Expected HMRClient.setup() call at startup.');\n if (hmrUnavailableReason !== null) {\n // Don't show more than one warning.\n return;\n }\n hmrUnavailableReason = reason;\n\n // We only want to show a warning if Fast Refresh is on *and* if we ever\n // previously managed to connect successfully. We don't want to show\n // the warning to native engineers who use cached bundles without Metro.\n if (hmrClient.isEnabled() && didConnect) {\n console.warn(reason);\n // (Not using the `warning` module to prevent a Buck cycle.)\n }\n}\n\nfunction registerBundleEntryPoints(client: HMRClientType | null) {\n if (hmrUnavailableReason != null) {\n // \"Bundle Splitting – Metro disconnected\"\n window.location.reload();\n return;\n }\n\n if (pendingEntryPoints.length > 0) {\n client?.send(\n JSON.stringify({\n type: 'register-entrypoints',\n entryPoints: pendingEntryPoints,\n })\n );\n pendingEntryPoints.length = 0;\n }\n}\n\nfunction flushEarlyLogs() {\n try {\n pendingLogs.forEach(([level, data]) => {\n HMRClient.log(level, data);\n });\n } finally {\n pendingLogs.length = 0;\n }\n}\n\nfunction dismissRedbox() {\n // TODO(EvanBacon): Error overlay for web.\n}\n\nfunction showCompileError() {\n if (currentCompileErrorMessage === null) {\n return;\n }\n\n // Even if there is already a redbox, syntax errors are more important.\n // Otherwise you risk seeing a stale runtime error while a syntax error is more recent.\n dismissRedbox();\n\n const message = currentCompileErrorMessage;\n currentCompileErrorMessage = null;\n\n const error = new Error(message);\n // Symbolicating compile errors is wasted effort\n // because the stack trace is meaningless:\n // @ts-expect-error\n error.preventSymbolication = true;\n throw error;\n}\n\nexport default HMRClient;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingView.native.d.ts","sourceRoot":"","sources":["../src/LoadingView.native.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"LoadingView.native.d.ts","sourceRoot":"","sources":["../src/LoadingView.native.ts"],"names":[],"mappings":"AAAA,QAAA,IAAI,WAAW,EAAE,cAAc,8CAA8C,EAAE,OAAO,CAAC;AASvF,eAAe,WAAW,CAAC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
let LoadingView;
|
|
4
|
+
try {
|
|
5
|
+
LoadingView = require('react-native/Libraries/Utilities/LoadingView');
|
|
6
|
+
}
|
|
7
|
+
catch {
|
|
8
|
+
// In react-native 0.75.0 LoadingView was renamed to DevLoadingView
|
|
9
|
+
LoadingView = require('react-native/Libraries/Utilities/DevLoadingView');
|
|
10
|
+
}
|
|
11
|
+
exports.default = LoadingView;
|
|
8
12
|
//# sourceMappingURL=LoadingView.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingView.native.js","sourceRoot":"","sources":["../src/LoadingView.native.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LoadingView.native.js","sourceRoot":"","sources":["../src/LoadingView.native.ts"],"names":[],"mappings":";;AAAA,IAAI,WAAkF,CAAC;AAEvF,IAAI;IACF,WAAW,GAAG,OAAO,CAAC,8CAA8C,CAAC,CAAC;CACvE;AAAC,MAAM;IACN,mEAAmE;IACnE,WAAW,GAAG,OAAO,CAAC,iDAAiD,CAAC,CAAC;CAC1E;AAED,kBAAe,WAAW,CAAC","sourcesContent":["let LoadingView: typeof import('react-native/Libraries/Utilities/LoadingView').default;\n\ntry {\n LoadingView = require('react-native/Libraries/Utilities/LoadingView');\n} catch {\n // In react-native 0.75.0 LoadingView was renamed to DevLoadingView\n LoadingView = require('react-native/Libraries/Utilities/DevLoadingView');\n}\n\nexport default LoadingView;\n"]}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.buildAsyncRequire =
|
|
9
|
+
exports.buildAsyncRequire = void 0;
|
|
10
10
|
const loadBundle_1 = require("./loadBundle");
|
|
11
11
|
/** Create an `loadBundleAsync` function in the expected shape for Metro bundler. */
|
|
12
12
|
function buildAsyncRequire() {
|
|
@@ -23,4 +23,5 @@ function buildAsyncRequire() {
|
|
|
23
23
|
return promise;
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
exports.buildAsyncRequire = buildAsyncRequire;
|
|
26
27
|
//# sourceMappingURL=buildAsyncRequire.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildAsyncRequire.js","sourceRoot":"","sources":["../../src/async-require/buildAsyncRequire.ts"],"names":[],"mappings":";AAAA;;;;;GAKG
|
|
1
|
+
{"version":3,"file":"buildAsyncRequire.js","sourceRoot":"","sources":["../../src/async-require/buildAsyncRequire.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,6CAA+C;AAQ/C,oFAAoF;AACpF,SAAgB,iBAAiB;IAC/B,MAAM,KAAK,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE/C,OAAO,KAAK,UAAU,yBAAyB,CAAC,IAAY;QAC1D,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACnB,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;SACzB;QAED,MAAM,OAAO,GAAG,IAAA,4BAAe,EAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACpD,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACnB,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEzB,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC;AAjBD,8CAiBC","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 */\n\nimport { loadBundleAsync } from './loadBundle';\n\n/**\n * Must satisfy the requirements of the Metro bundler.\n * https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0605-lazy-bundling.md#__loadbundleasync-in-metro\n */\ntype AsyncRequire = (path: string) => Promise<void>;\n\n/** Create an `loadBundleAsync` function in the expected shape for Metro bundler. */\nexport function buildAsyncRequire(): AsyncRequire {\n const cache = new Map<string, Promise<void>>();\n\n return async function universal_loadBundleAsync(path: string): Promise<void> {\n if (cache.has(path)) {\n return cache.get(path)!;\n }\n\n const promise = loadBundleAsync(path).catch((error) => {\n cache.delete(path);\n throw error;\n });\n\n cache.set(path, promise);\n\n return promise;\n };\n}\n"]}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.buildUrlForBundle =
|
|
9
|
+
exports.buildUrlForBundle = void 0;
|
|
10
10
|
/**
|
|
11
11
|
* Given a path and some optional additional query parameters, create the dev server bundle URL.
|
|
12
12
|
* @param bundlePath like `/foobar`
|
|
@@ -21,4 +21,5 @@ function buildUrlForBundle(bundlePath) {
|
|
|
21
21
|
// Otherwise Metro will crash from attempting to load a bundle that doesn't exist.
|
|
22
22
|
return '/' + bundlePath.replace(/^\/+/, '');
|
|
23
23
|
}
|
|
24
|
+
exports.buildUrlForBundle = buildUrlForBundle;
|
|
24
25
|
//# sourceMappingURL=buildUrlForBundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildUrlForBundle.js","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.ts"],"names":[],"mappings":";AAAA;;;;;GAKG
|
|
1
|
+
{"version":3,"file":"buildUrlForBundle.js","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,UAAkB;IAClD,IAAI,UAAU,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;QACpC,OAAO,UAAU,CAAC;KACnB;IACD,iFAAiF;IACjF,kFAAkF;IAClF,OAAO,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC9C,CAAC;AAPD,8CAOC","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 */\n\n/**\n * Given a path and some optional additional query parameters, create the dev server bundle URL.\n * @param bundlePath like `/foobar`\n * @param params like `{ platform: \"web\" }`\n * @returns a URL like \"/foobar.bundle?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null\"\n */\nexport function buildUrlForBundle(bundlePath: string): string {\n if (bundlePath.match(/^https?:\\/\\//)) {\n return bundlePath;\n }\n // NOTE(EvanBacon): This must come from the window origin (at least in dev mode).\n // Otherwise Metro will crash from attempting to load a bundle that doesn't exist.\n return '/' + bundlePath.replace(/^\\/+/, '');\n}\n"]}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.buildUrlForBundle =
|
|
9
|
+
exports.buildUrlForBundle = void 0;
|
|
10
10
|
function buildUrlForBundle(bundlePath) {
|
|
11
11
|
if (bundlePath.match(/^https?:\/\//)) {
|
|
12
12
|
return bundlePath;
|
|
@@ -24,6 +24,7 @@ function buildUrlForBundle(bundlePath) {
|
|
|
24
24
|
return joinComponents(serverUrl, bundlePath);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
exports.buildUrlForBundle = buildUrlForBundle;
|
|
27
28
|
function joinComponents(prefix, suffix) {
|
|
28
29
|
return prefix.replace(/\/+$/, '') + '/' + suffix.replace(/^\/+/, '');
|
|
29
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildUrlForBundle.native.js","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.native.ts"],"names":[],"mappings":";AAAA;;;;;GAKG
|
|
1
|
+
{"version":3,"file":"buildUrlForBundle.native.js","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.native.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,SAAgB,iBAAiB,CAAC,UAAkB;IAClD,IAAI,UAAU,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;QACpC,OAAO,UAAU,CAAC;KACnB;IAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;YACnC,OAAO,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;SACpD;QACD,MAAM,IAAI,KAAK,CACb,6IAA6I,CAC9I,CAAC;KACH;SAAM;QACL,MAAM,YAAY,GAAG,OAAO,CAAC,iBAAiB,CAAC;aAC5C,OAAmD,CAAC;QAEvD,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,YAAY,EAAE,CAAC;QAE1C,OAAO,cAAc,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;KAC9C;AACH,CAAC;AApBD,8CAoBC;AAED,SAAS,cAAc,CAAC,MAAc,EAAE,MAAc;IACpD,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACvE,CAAC","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 */\n\nexport function buildUrlForBundle(bundlePath: string): string {\n if (bundlePath.match(/^https?:\\/\\//)) {\n return bundlePath;\n }\n\n if (process.env.NODE_ENV === 'production') {\n if (typeof location !== 'undefined') {\n return joinComponents(location.origin, bundlePath);\n }\n throw new Error(\n 'Unable to determine the production URL where additional JavaScript chunks are hosted because the global \"location\" variable is not defined.'\n );\n } else {\n const getDevServer = require('../getDevServer')\n .default as typeof import('../getDevServer').default;\n\n const { url: serverUrl } = getDevServer();\n\n return joinComponents(serverUrl, bundlePath);\n }\n}\n\nfunction joinComponents(prefix: string, suffix: string): string {\n return prefix.replace(/\\/+$/, '') + '/' + suffix.replace(/^\\/+/, '');\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchAsync =
|
|
3
|
+
exports.fetchAsync = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright © 2022 650 Industries.
|
|
6
6
|
*
|
|
@@ -21,4 +21,5 @@ async function fetchAsync(url) {
|
|
|
21
21
|
headers: response.headers,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
+
exports.fetchAsync = fetchAsync;
|
|
24
25
|
//# sourceMappingURL=fetchAsync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchAsync.js","sourceRoot":"","sources":["../../src/async-require/fetchAsync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetchAsync.js","sourceRoot":"","sources":["../../src/async-require/fetchAsync.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACI,KAAK,UAAU,UAAU,CAC9B,GAAW;IAEX,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAChC,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,wEAAwE;YACxE,eAAe,EAAE,KAAK;SACvB;KACF,CAAC,CAAC;IACH,OAAO;QACL,IAAI,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE;QAC3B,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,OAAO,EAAE,QAAQ,CAAC,OAAO;KAC1B,CAAC;AACJ,CAAC;AAfD,gCAeC","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 */\nexport async function fetchAsync(\n url: string\n): Promise<{ body: string; status: number; headers: Headers }> {\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n // No real reason for this but we try to use this format for everything.\n 'expo-platform': 'web',\n },\n });\n return {\n body: await response.text(),\n status: response.status,\n headers: response.headers,\n };\n}\n"]}
|
|
@@ -10,7 +10,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.fetchAsync =
|
|
13
|
+
exports.fetchAsync = void 0;
|
|
14
14
|
// @ts-expect-error
|
|
15
15
|
const RCTNetworking_1 = __importDefault(require("react-native/Libraries/Network/RCTNetworking"));
|
|
16
16
|
function fetchAsync(url) {
|
|
@@ -55,4 +55,5 @@ function fetchAsync(url) {
|
|
|
55
55
|
responseListener?.remove();
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
+
exports.fetchAsync = fetchAsync;
|
|
58
59
|
//# sourceMappingURL=fetchAsync.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchAsync.native.js","sourceRoot":"","sources":["../../src/async-require/fetchAsync.native.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG
|
|
1
|
+
{"version":3,"file":"fetchAsync.native.js","sourceRoot":"","sources":["../../src/async-require/fetchAsync.native.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAEH,mBAAmB;AACnB,iGAAsE;AAItE,SAAgB,UAAU,CACxB,GAAW;IAEX,IAAI,EAAE,GAAkB,IAAI,CAAC;IAC7B,IAAI,UAAU,GAAkB,IAAI,CAAC;IACrC,IAAI,YAAY,GAAkB,IAAI,CAAC;IACvC,IAAI,OAAO,GAA2B,EAAE,CAAC;IACzC,IAAI,YAAY,GAAsB,IAAI,CAAC;IAC3C,IAAI,gBAAgB,GAAsB,IAAI,CAAC;IAC/C,IAAI,gBAAgB,GAAsB,IAAI,CAAC;IAC/C,OAAO,IAAI,OAAO,CAChB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAClB,MAAM,WAAW,GAAG,uBAAU,CAAC,WAAW,CAAC,IAAI,CAAC,uBAAU,CAG3C,CAAC;QAChB,YAAY,GAAG,WAAW,CAAC,uBAAuB,EAAE,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,EAAE;YAC5E,IAAI,SAAS,KAAK,EAAE,EAAE;gBACpB,YAAY,GAAG,QAAQ,CAAC;aACzB;QACH,CAAC,CAAC,CAAC;QACH,gBAAgB,GAAG,WAAW,CAC5B,2BAA2B,EAC3B,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,EAAE;YACvC,IAAI,SAAS,KAAK,EAAE,EAAE;gBACpB,UAAU,GAAG,MAAM,CAAC;gBACpB,OAAO,GAAG,eAAe,CAAC;aAC3B;QACH,CAAC,CACF,CAAC;QACF,gBAAgB,GAAG,WAAW,CAAC,4BAA4B,EAAE,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE;YAClF,IAAI,SAAS,KAAK,EAAE,EAAE;gBACpB,IAAI,KAAK,EAAE;oBACT,MAAM,CAAC,KAAK,CAAC,CAAC;iBACf;qBAAM;oBACL,OAAO,CAAC,EAAE,IAAI,EAAE,YAAa,EAAE,MAAM,EAAE,UAAW,EAAE,OAAO,EAAE,CAAC,CAAC;iBAChE;aACF;QACH,CAAC,CAAC,CAAC;QACF,uBAAU,CAAC,WAAmB,CAC7B,KAAK,EACL,cAAc,EACd,GAAG,EACH;YACE,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;SACrC,EACD,EAAE,EACF,MAAM,EACN,KAAK,EACL,CAAC,EACD,CAAC,SAAiB,EAAE,EAAE;YACpB,EAAE,GAAG,SAAS,CAAC;QACjB,CAAC,EACD,IAAI,CACL,CAAC;IACJ,CAAC,CACF,CAAC,OAAO,CAAC,GAAG,EAAE;QACb,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;QAC3B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC;AA7DD,gCA6DC","sourcesContent":["/**\n * Copyright (c) 650 Industries.\n * Copyright (c) Facebook, Inc. and its 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\n// @ts-expect-error\nimport Networking from 'react-native/Libraries/Network/RCTNetworking';\n\ntype Subscriber = { remove: () => void };\n\nexport function fetchAsync(\n url: string\n): Promise<{ body: string; status: number; headers: Record<string, string> }> {\n let id: string | null = null;\n let statusCode: number | null = null;\n let responseText: string | null = null;\n let headers: Record<string, string> = {};\n let dataListener: Subscriber | null = null;\n let completeListener: Subscriber | null = null;\n let responseListener: Subscriber | null = null;\n return new Promise<{ body: string; status: number; headers: Record<string, string> }>(\n (resolve, reject) => {\n const addListener = Networking.addListener.bind(Networking) as (\n event: string,\n callback: (props: [string, any, any]) => any\n ) => Subscriber;\n dataListener = addListener('didReceiveNetworkData', ([requestId, response]) => {\n if (requestId === id) {\n responseText = response;\n }\n });\n responseListener = addListener(\n 'didReceiveNetworkResponse',\n ([requestId, status, responseHeaders]) => {\n if (requestId === id) {\n statusCode = status;\n headers = responseHeaders;\n }\n }\n );\n completeListener = addListener('didCompleteNetworkResponse', ([requestId, error]) => {\n if (requestId === id) {\n if (error) {\n reject(error);\n } else {\n resolve({ body: responseText!, status: statusCode!, headers });\n }\n }\n });\n (Networking.sendRequest as any)(\n 'GET',\n 'asyncRequest',\n url,\n {\n 'expo-platform': process.env.EXPO_OS,\n },\n '',\n 'text',\n false,\n 0,\n (requestId: string) => {\n id = requestId;\n },\n true\n );\n }\n ).finally(() => {\n dataListener?.remove();\n completeListener?.remove();\n responseListener?.remove();\n });\n}\n"]}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.fetchThenEvalAsync =
|
|
9
|
+
exports.fetchThenEvalAsync = void 0;
|
|
10
10
|
const currentSrc = typeof document !== 'undefined' && document.currentScript
|
|
11
11
|
? ('src' in document.currentScript && document.currentScript.src) || null
|
|
12
12
|
: null;
|
|
@@ -67,6 +67,7 @@ function fetchThenEvalAsync(url, { scriptType, nonce, crossOrigin, } = {}) {
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
+
exports.fetchThenEvalAsync = fetchThenEvalAsync;
|
|
70
71
|
class AsyncRequireError extends Error {
|
|
71
72
|
name = 'AsyncRequireError';
|
|
72
73
|
type;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchThenEval.web.js","sourceRoot":"","sources":["../../src/async-require/fetchThenEval.web.ts"],"names":[],"mappings":";AAAA;;;;;GAKG
|
|
1
|
+
{"version":3,"file":"fetchThenEval.web.js","sourceRoot":"","sources":["../../src/async-require/fetchThenEval.web.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,MAAM,UAAU,GACd,OAAO,QAAQ,KAAK,WAAW,IAAI,QAAQ,CAAC,aAAa;IACvD,CAAC,CAAC,CAAC,KAAK,IAAI,QAAQ,CAAC,aAAa,IAAI,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,IAAI;IACzE,CAAC,CAAC,IAAI,CAAC;AAEX,qCAAqC;AACrC,SAAgB,kBAAkB,CAChC,GAAW,EACX,EACE,UAAU,EACV,KAAK,EACL,WAAW,MACsD,EAAE;IAErE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,OAAO,CAAC,mBAAmB,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;KAC7D;IACD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,UAAU;YAAE,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC;QACzC,IAAI,KAAK;YAAE,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC/C,+CAA+C;QAC/C,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC;QAEjB,IAAI,WAAW,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE;YACzE,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;SAClC;QAED,MAAM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C,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;SACnC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAhED,gDAgEC;AAED,MAAM,iBAAkB,SAAQ,KAAK;IAC1B,IAAI,GAAG,mBAAmB,CAAC;IACpC,IAAI,CAAU;IACd,OAAO,CAAU;CAClB","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 */\n\nconst currentSrc =\n typeof document !== 'undefined' && document.currentScript\n ? ('src' in document.currentScript && document.currentScript.src) || null\n : null;\n\n// Basically `__webpack_require__.l`.\nexport function fetchThenEvalAsync(\n url: string,\n {\n scriptType,\n nonce,\n crossOrigin,\n }: { scriptType?: string; nonce?: string; crossOrigin?: string } = {}\n): Promise<void> {\n if (typeof window === 'undefined') {\n return require('./fetchThenEvalJs').fetchThenEvalAsync(url);\n }\n return new Promise<void>((resolve, reject) => {\n const script = document.createElement('script');\n if (scriptType) script.type = scriptType;\n if (nonce) script.setAttribute('nonce', nonce);\n // script.setAttribute('data-expo-metro', ...);\n script.src = url;\n\n if (crossOrigin && script.src.indexOf(window.location.origin + '/') !== 0) {\n script.crossOrigin = crossOrigin;\n }\n\n script.onload = () => {\n script.parentNode && script.parentNode.removeChild(script);\n resolve();\n };\n // Create a new error object to preserve the original stack trace.\n const error = new AsyncRequireError();\n\n // Server error or network error.\n script.onerror = (ev) => {\n let event: Event;\n if (typeof ev === 'string') {\n event = {\n type: 'error',\n target: {\n // @ts-expect-error\n src: event,\n },\n };\n } else {\n event = ev;\n }\n\n const errorType = event && (event.type === 'load' ? 'missing' : event.type);\n // @ts-expect-error\n const realSrc = event?.target?.src;\n error.message = 'Loading module ' + url + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n error.type = errorType;\n error.request = realSrc;\n\n script.parentNode && script.parentNode.removeChild(script);\n reject(error);\n };\n\n if (script.src === currentSrc) {\n // NOTE(kitten): We always prevent `fetchThenEval` from loading the \"current script\".\n // This points at our entrypoint bundle, and we should never reload and reevaluate the\n // entrypoint bundle\n resolve();\n } else {\n document.head.appendChild(script);\n }\n });\n}\n\nclass AsyncRequireError extends Error {\n readonly name = 'AsyncRequireError';\n type?: string;\n request?: string;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchThenEvalAsync =
|
|
3
|
+
exports.fetchThenEvalAsync = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright © 2022 650 Industries.
|
|
6
6
|
*
|
|
@@ -53,6 +53,7 @@ function fetchThenEvalAsync(url) {
|
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
+
exports.fetchThenEvalAsync = fetchThenEvalAsync;
|
|
56
57
|
function jsonParseOptional(json) {
|
|
57
58
|
try {
|
|
58
59
|
return JSON.parse(json);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchThenEvalJs.js","sourceRoot":"","sources":["../../src/async-require/fetchThenEvalJs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetchThenEvalJs.js","sourceRoot":"","sources":["../../src/async-require/fetchThenEvalJs.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,6CAA0C;AAM1C;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,OAAO,IAAA,uBAAU,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;QACxD,IACE,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,IAAI;YACtC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EACzD;YACA,+BAA+B;YAC/B,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,IAAI,2BAA2B,GAAG,GAAG,CAAC,CAAC;SAChF;QAED,IAAI,MAAM,KAAK,GAAG,EAAE;YAClB,oEAAoE;YACpE,qEAAqE;YACrE,IAAI,MAAM,CAAC,uBAAuB,EAAE;gBAClC,OAAO,MAAM,CAAC,uBAAuB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;aAClD;iBAAM;gBACL,mCAAmC;gBACnC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;aACnB;SACF;aAAM;YACL,mCAAmC;YACnC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;gBAC1C,0DAA0D;gBAC1D,kKAAkK;gBAClK,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;gBACtC,IAAI,KAAK,EAAE;oBACT,+GAA+G;oBAC/G,wIAAwI;oBACxI,IAAI,SAAS,IAAI,KAAK,EAAE;wBACtB,MAAM,IAAI,KAAK,CACb,yCAAyC;4BACvC,GAAG;4BACH,2CAA2C;4BAC3C,KAAK,CAAC,OAAO;4BACb,GAAG,CACN,CAAC;qBACH;iBACF;aACF;YAED,MAAM,IAAI,KAAK,CACb,0CAA0C,GAAG,qCAAqC,IAAI,EAAE,CACzF,CAAC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AA7CD,gDA6CC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACrC,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KACzB;IAAC,MAAM;QACN,OAAO,IAAI,CAAC;KACb;AACH,CAAC","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 { fetchAsync } from './fetchAsync';\n\ndeclare let global: {\n globalEvalWithSourceUrl?: any;\n};\n\n/**\n * Load a bundle for a URL using fetch + eval on native and script tag injection on web.\n *\n * @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon`.\n */\nexport function fetchThenEvalAsync(url: string): Promise<void> {\n return fetchAsync(url).then(({ body, status, headers }) => {\n if (\n headers?.has?.('Content-Type') != null &&\n headers.get('Content-Type')!.includes('application/json')\n ) {\n // Errors are returned as JSON.\n throw new Error(JSON.parse(body).message || `Unknown error fetching '${url}'`);\n }\n\n if (status === 200) {\n // Some engines do not support `sourceURL` as a comment. We expose a\n // `globalEvalWithSourceUrl` function to handle updates in that case.\n if (global.globalEvalWithSourceUrl) {\n return global.globalEvalWithSourceUrl(body, url);\n } else {\n // eslint-disable-next-line no-eval\n return eval(body);\n }\n } else {\n // Format Metro errors if possible.\n if (process.env.NODE_ENV === 'development') {\n // body can be an error from Metro if a module is missing.\n // {\"originModulePath\":\"/Users/evanbacon/Documents/GitHub/expo/.\",\"targetModuleName\":\"./http://localhost:8081/node_modules/react-native/index.js\",\"message\":\"...\"}\n const error = jsonParseOptional(body);\n if (error) {\n // TODO: This is essentially like the Metro native red box errors. We should do a better job formatting them so\n // the user experience doesn't feel bad. This can be tested by loading a split bundle that results in a missing module error from Metro.\n if ('message' in error) {\n throw new Error(\n 'Failed to load split bundle from Metro ' +\n url +\n ' (check terminal for more info).\\n(load: ' +\n error.message +\n ')'\n );\n }\n }\n }\n\n throw new Error(\n `Failed to load split bundle from Metro ${url} (check terminal for more info).\\n${body}`\n );\n }\n });\n}\n\nfunction jsonParseOptional(json: string): any {\n try {\n return JSON.parse(json);\n } catch {\n return null;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../../src/async-require/index.native.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wCAAwC;AACxC,8BAA8B;AAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE
|
|
1
|
+
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../../src/async-require/index.native.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wCAAwC;AACxC,8BAA8B;AAC9B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,MAAM,EAAE,iBAAiB,EAAE,GACzB,OAAO,CAAC,qBAAqB,CAAyC,CAAC;IACzE,aAAa;IACb,MAAM,CAAC,GAAG,MAAM,CAAC,uBAAuB,IAAI,EAAE,mBAAmB,CAAC,GAAG,iBAAiB,EAAE,CAAC;CAC1F","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 */\n\n// Ensure this is removed in production.\n// TODO: Enable in production.\nif (process.env.NODE_ENV !== 'production') {\n const { buildAsyncRequire } =\n require('./buildAsyncRequire') as typeof import('./buildAsyncRequire');\n // @ts-ignore\n global[`${global.__METRO_GLOBAL_PREFIX__ ?? ''}__loadBundleAsync`] = buildAsyncRequire();\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadBundleAsync =
|
|
3
|
+
exports.loadBundleAsync = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright © 2022 650 Industries.
|
|
6
6
|
*
|
|
@@ -40,4 +40,5 @@ async function loadBundleAsync(bundlePath) {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
exports.loadBundleAsync = loadBundleAsync;
|
|
43
44
|
//# sourceMappingURL=loadBundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadBundle.js","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadBundle.js","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,2DAAwD;AACxD,mDAAqD;AAErD,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACI,KAAK,UAAU,eAAe,CAAC,UAAkB;IACtD,MAAM,UAAU,GAAG,IAAA,qCAAiB,EAAC,UAAU,CAAC,CAAC;IAEjD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC,CAAC;KACvC;SAAM;QACL,MAAM,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;aAC1C,OAAkD,CAAC;QACtD,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE;YACjC,qEAAqE;YACrE,WAAW,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;SACnD;QACD,eAAe,EAAE,CAAC;QAElB,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC;aAClC,IAAI,CAAC,GAAG,EAAE;YACT,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,OAAgD,CAAC;YAC3F,SAAS,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACZ,IAAI,CAAC,EAAE,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE;gBACvD,WAAW,CAAC,IAAI,EAAE,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;KACN;AACH,CAAC;AAzBD,0CAyBC","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 { buildUrlForBundle } from './buildUrlForBundle';\nimport { fetchThenEvalAsync } from './fetchThenEval';\n\nlet pendingRequests = 0;\n\n/**\n * Load a bundle for a URL using fetch + eval on native and script tag injection on web.\n *\n * @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon.bundle?params=from-metro`.\n */\nexport async function loadBundleAsync(bundlePath: string): Promise<void> {\n const requestUrl = buildUrlForBundle(bundlePath);\n\n if (process.env.NODE_ENV === 'production') {\n return fetchThenEvalAsync(requestUrl);\n } else {\n const LoadingView = require('../LoadingView')\n .default as typeof import('../LoadingView').default;\n if (process.env.EXPO_OS !== 'web') {\n // Send a signal to the `expo` package to show the loading indicator.\n LoadingView.showMessage('Downloading...', 'load');\n }\n pendingRequests++;\n\n return fetchThenEvalAsync(requestUrl)\n .then(() => {\n const HMRClient = require('../HMRClient').default as typeof import('../HMRClient').default;\n HMRClient.registerBundle(requestUrl);\n })\n .finally(() => {\n if (!--pendingRequests && process.env.EXPO_OS !== 'web') {\n LoadingView.hide();\n }\n });\n }\n}\n"]}
|
package/build/effects.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effects.js","sourceRoot":"","sources":["../src/effects.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE
|
|
1
|
+
{"version":3,"file":"effects.js","sourceRoot":"","sources":["../src/effects.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACE,kBAAkB;IAClB,OAAO,MAAM,KAAK,WAAW,EAC7B;QACA,OAAO,CAAC,oBAAoB,CAAC,CAAC;QAC9B,OAAO,CAAC,YAAY,CAAC,CAAC;QACtB,OAAO,CAAC,iBAAiB,CAAC,CAAC;KAC5B;CACF","sourcesContent":["// Only during development.\nif (process.env.NODE_ENV !== 'production') {\n if (\n // Disable for SSR\n typeof window !== 'undefined'\n ) {\n require('./setupFastRefresh');\n require('./setupHMR');\n require('./messageSocket');\n }\n}\n"]}
|
|
@@ -34,26 +34,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
34
34
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
35
35
|
};
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.reportLogBoxError =
|
|
38
|
-
exports.reportUnexpectedLogBoxError = reportUnexpectedLogBoxError;
|
|
39
|
-
exports.isLogBoxErrorMessage = isLogBoxErrorMessage;
|
|
40
|
-
exports.isMessageIgnored = isMessageIgnored;
|
|
41
|
-
exports.addLog = addLog;
|
|
42
|
-
exports.addException = addException;
|
|
43
|
-
exports.symbolicateLogNow = symbolicateLogNow;
|
|
44
|
-
exports.retrySymbolicateLogNow = retrySymbolicateLogNow;
|
|
45
|
-
exports.symbolicateLogLazy = symbolicateLogLazy;
|
|
46
|
-
exports.clear = clear;
|
|
47
|
-
exports.setSelectedLog = setSelectedLog;
|
|
48
|
-
exports.clearWarnings = clearWarnings;
|
|
49
|
-
exports.clearErrors = clearErrors;
|
|
50
|
-
exports.dismiss = dismiss;
|
|
51
|
-
exports.getIgnorePatterns = getIgnorePatterns;
|
|
52
|
-
exports.addIgnorePatterns = addIgnorePatterns;
|
|
53
|
-
exports.setDisabled = setDisabled;
|
|
54
|
-
exports.isDisabled = isDisabled;
|
|
55
|
-
exports.observe = observe;
|
|
56
|
-
exports.withSubscription = withSubscription;
|
|
37
|
+
exports.withSubscription = exports.observe = exports.isDisabled = exports.setDisabled = exports.addIgnorePatterns = exports.getIgnorePatterns = exports.dismiss = exports.clearErrors = exports.clearWarnings = exports.setSelectedLog = exports.clear = exports.symbolicateLogLazy = exports.retrySymbolicateLogNow = exports.symbolicateLogNow = exports.addException = exports.addLog = exports.isMessageIgnored = exports.isLogBoxErrorMessage = exports.reportUnexpectedLogBoxError = exports.reportLogBoxError = void 0;
|
|
57
38
|
const React = __importStar(require("react"));
|
|
58
39
|
const LogBoxLog_1 = require("./LogBoxLog");
|
|
59
40
|
const LogContext_1 = require("./LogContext");
|
|
@@ -81,13 +62,16 @@ function reportLogBoxError(error, componentStack) {
|
|
|
81
62
|
}
|
|
82
63
|
ExceptionsManager.handleException(error);
|
|
83
64
|
}
|
|
65
|
+
exports.reportLogBoxError = reportLogBoxError;
|
|
84
66
|
function reportUnexpectedLogBoxError(error, componentStack) {
|
|
85
67
|
error.message = `${LOGBOX_ERROR_MESSAGE}\n\n${error.message}`;
|
|
86
68
|
return reportLogBoxError(error, componentStack);
|
|
87
69
|
}
|
|
70
|
+
exports.reportUnexpectedLogBoxError = reportUnexpectedLogBoxError;
|
|
88
71
|
function isLogBoxErrorMessage(message) {
|
|
89
72
|
return typeof message === 'string' && message.includes(LOGBOX_ERROR_MESSAGE);
|
|
90
73
|
}
|
|
74
|
+
exports.isLogBoxErrorMessage = isLogBoxErrorMessage;
|
|
91
75
|
function isMessageIgnored(message) {
|
|
92
76
|
for (const pattern of ignorePatterns) {
|
|
93
77
|
if ((pattern instanceof RegExp && pattern.test(message)) ||
|
|
@@ -97,6 +81,7 @@ function isMessageIgnored(message) {
|
|
|
97
81
|
}
|
|
98
82
|
return false;
|
|
99
83
|
}
|
|
84
|
+
exports.isMessageIgnored = isMessageIgnored;
|
|
100
85
|
function setImmediateShim(callback) {
|
|
101
86
|
if (!global.setImmediate) {
|
|
102
87
|
return setTimeout(callback, 0);
|
|
@@ -190,6 +175,7 @@ function addLog(log) {
|
|
|
190
175
|
}
|
|
191
176
|
});
|
|
192
177
|
}
|
|
178
|
+
exports.addLog = addLog;
|
|
193
179
|
function addException(error) {
|
|
194
180
|
// Parsing logs are expensive so we schedule this
|
|
195
181
|
// otherwise spammy logs would pause rendering.
|
|
@@ -202,25 +188,30 @@ function addException(error) {
|
|
|
202
188
|
}
|
|
203
189
|
});
|
|
204
190
|
}
|
|
191
|
+
exports.addException = addException;
|
|
205
192
|
function symbolicateLogNow(type, log) {
|
|
206
193
|
log.symbolicate(type, () => {
|
|
207
194
|
handleUpdate();
|
|
208
195
|
});
|
|
209
196
|
}
|
|
197
|
+
exports.symbolicateLogNow = symbolicateLogNow;
|
|
210
198
|
function retrySymbolicateLogNow(type, log) {
|
|
211
199
|
log.retrySymbolicate(type, () => {
|
|
212
200
|
handleUpdate();
|
|
213
201
|
});
|
|
214
202
|
}
|
|
203
|
+
exports.retrySymbolicateLogNow = retrySymbolicateLogNow;
|
|
215
204
|
function symbolicateLogLazy(type, log) {
|
|
216
205
|
log.symbolicate(type);
|
|
217
206
|
}
|
|
207
|
+
exports.symbolicateLogLazy = symbolicateLogLazy;
|
|
218
208
|
function clear() {
|
|
219
209
|
if (logs.size > 0) {
|
|
220
210
|
logs = new Set();
|
|
221
211
|
setSelectedLog(-1);
|
|
222
212
|
}
|
|
223
213
|
}
|
|
214
|
+
exports.clear = clear;
|
|
224
215
|
function setSelectedLog(proposedNewIndex) {
|
|
225
216
|
const oldIndex = _selectedIndex;
|
|
226
217
|
let newIndex = proposedNewIndex;
|
|
@@ -247,6 +238,7 @@ function setSelectedLog(proposedNewIndex) {
|
|
|
247
238
|
}, 0);
|
|
248
239
|
}
|
|
249
240
|
}
|
|
241
|
+
exports.setSelectedLog = setSelectedLog;
|
|
250
242
|
function clearWarnings() {
|
|
251
243
|
const newLogs = Array.from(logs).filter((log) => log.level !== 'warn');
|
|
252
244
|
if (newLogs.length !== logs.size) {
|
|
@@ -255,6 +247,7 @@ function clearWarnings() {
|
|
|
255
247
|
handleUpdate();
|
|
256
248
|
}
|
|
257
249
|
}
|
|
250
|
+
exports.clearWarnings = clearWarnings;
|
|
258
251
|
function clearErrors() {
|
|
259
252
|
const newLogs = Array.from(logs).filter((log) => log.level !== 'error' && log.level !== 'fatal');
|
|
260
253
|
if (newLogs.length !== logs.size) {
|
|
@@ -262,15 +255,18 @@ function clearErrors() {
|
|
|
262
255
|
setSelectedLog(-1);
|
|
263
256
|
}
|
|
264
257
|
}
|
|
258
|
+
exports.clearErrors = clearErrors;
|
|
265
259
|
function dismiss(log) {
|
|
266
260
|
if (logs.has(log)) {
|
|
267
261
|
logs.delete(log);
|
|
268
262
|
handleUpdate();
|
|
269
263
|
}
|
|
270
264
|
}
|
|
265
|
+
exports.dismiss = dismiss;
|
|
271
266
|
function getIgnorePatterns() {
|
|
272
267
|
return Array.from(ignorePatterns);
|
|
273
268
|
}
|
|
269
|
+
exports.getIgnorePatterns = getIgnorePatterns;
|
|
274
270
|
function addIgnorePatterns(patterns) {
|
|
275
271
|
const existingSize = ignorePatterns.size;
|
|
276
272
|
// The same pattern may be added multiple times, but adding a new pattern
|
|
@@ -297,6 +293,7 @@ function addIgnorePatterns(patterns) {
|
|
|
297
293
|
logs = new Set(Array.from(logs).filter((log) => !isMessageIgnored(log.message.content)));
|
|
298
294
|
handleUpdate();
|
|
299
295
|
}
|
|
296
|
+
exports.addIgnorePatterns = addIgnorePatterns;
|
|
300
297
|
function setDisabled(value) {
|
|
301
298
|
if (value === _isDisabled) {
|
|
302
299
|
return;
|
|
@@ -304,9 +301,11 @@ function setDisabled(value) {
|
|
|
304
301
|
_isDisabled = value;
|
|
305
302
|
handleUpdate();
|
|
306
303
|
}
|
|
304
|
+
exports.setDisabled = setDisabled;
|
|
307
305
|
function isDisabled() {
|
|
308
306
|
return _isDisabled;
|
|
309
307
|
}
|
|
308
|
+
exports.isDisabled = isDisabled;
|
|
310
309
|
function observe(observer) {
|
|
311
310
|
const subscription = { observer };
|
|
312
311
|
observers.add(subscription);
|
|
@@ -317,6 +316,7 @@ function observe(observer) {
|
|
|
317
316
|
},
|
|
318
317
|
};
|
|
319
318
|
}
|
|
319
|
+
exports.observe = observe;
|
|
320
320
|
function withSubscription(WrappedComponent) {
|
|
321
321
|
class LogBoxStateSubscription extends React.Component {
|
|
322
322
|
static getDerivedStateFromError() {
|
|
@@ -384,4 +384,5 @@ function withSubscription(WrappedComponent) {
|
|
|
384
384
|
// @ts-expect-error
|
|
385
385
|
return LogBoxStateSubscription;
|
|
386
386
|
}
|
|
387
|
+
exports.withSubscription = withSubscription;
|
|
387
388
|
//# sourceMappingURL=LogBoxData.js.map
|