@expo/metro-runtime 3.1.3 → 3.2.0
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/README.md +1 -1
- package/build/HMRClient.js.map +1 -1
- package/build/async-require/buildAsyncRequire.js +1 -2
- package/build/async-require/buildAsyncRequire.js.map +1 -1
- package/build/async-require/buildUrlForBundle.js +1 -2
- package/build/async-require/buildUrlForBundle.js.map +1 -1
- package/build/async-require/buildUrlForBundle.native.js +1 -2
- package/build/async-require/buildUrlForBundle.native.js.map +1 -1
- package/build/async-require/fetchAsync.js +1 -2
- package/build/async-require/fetchAsync.js.map +1 -1
- package/build/async-require/fetchAsync.native.d.ts.map +1 -1
- package/build/async-require/fetchAsync.native.js +2 -4
- package/build/async-require/fetchAsync.native.js.map +1 -1
- package/build/async-require/fetchThenEval.web.d.ts.map +1 -1
- package/build/async-require/fetchThenEval.web.js +15 -5
- package/build/async-require/fetchThenEval.web.js.map +1 -1
- package/build/async-require/fetchThenEvalJs.js +1 -2
- package/build/async-require/fetchThenEvalJs.js.map +1 -1
- package/build/async-require/index.native.js.map +1 -1
- package/build/async-require/loadBundle.d.ts.map +1 -1
- package/build/async-require/loadBundle.js +3 -5
- package/build/async-require/loadBundle.js.map +1 -1
- package/build/effects.js.map +1 -1
- package/build/error-overlay/Data/LogBoxData.d.ts.map +1 -1
- package/build/error-overlay/Data/LogBoxData.js +22 -22
- 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 +2 -3
- package/build/error-overlay/Data/LogBoxSymbolication.js.map +1 -1
- package/build/error-overlay/Data/LogContext.d.ts.map +1 -1
- package/build/error-overlay/Data/LogContext.js +4 -5
- package/build/error-overlay/Data/LogContext.js.map +1 -1
- package/build/error-overlay/Data/parseLogBoxLog.js +5 -6
- package/build/error-overlay/Data/parseLogBoxLog.js.map +1 -1
- package/build/error-overlay/ErrorOverlay.js +4 -5
- 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 +1 -2
- package/build/error-overlay/UI/AnsiHighlight.js.map +1 -1
- package/build/error-overlay/UI/LogBoxButton.js +1 -2
- package/build/error-overlay/UI/LogBoxButton.js.map +1 -1
- package/build/error-overlay/UI/LogBoxMessage.js +1 -2
- package/build/error-overlay/UI/LogBoxMessage.js.map +1 -1
- package/build/error-overlay/UI/LogBoxStyle.js +14 -15
- package/build/error-overlay/UI/LogBoxStyle.js.map +1 -1
- package/build/error-overlay/UI/constants.d.ts.map +1 -1
- package/build/error-overlay/UI/constants.js +8 -6
- package/build/error-overlay/UI/constants.js.map +1 -1
- package/build/error-overlay/formatProjectFilePath.js +2 -3
- package/build/error-overlay/formatProjectFilePath.js.map +1 -1
- package/build/error-overlay/index.d.ts.map +1 -1
- package/build/error-overlay/index.js +6 -11
- 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 +1 -2
- package/build/error-overlay/modules/stringifySafe/index.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js +1 -2
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js +1 -2
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js +2 -3
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js +1 -2
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorSection.js +1 -2
- package/build/error-overlay/overlay/LogBoxInspectorSection.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.d.ts +7 -0
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js +9 -9
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js +1 -2
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js +2 -3
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js.map +1 -1
- package/build/error-overlay/toast/ErrorToast.js +1 -2
- 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 +1 -2
- package/build/error-overlay/toast/ErrorToastContainer.web.js.map +1 -1
- package/build/error-overlay/toast/ErrorToastMessage.js +1 -2
- package/build/error-overlay/toast/ErrorToastMessage.js.map +1 -1
- package/build/error-overlay/useRejectionHandler.js +1 -2
- package/build/error-overlay/useRejectionHandler.js.map +1 -1
- package/build/getDevServer.js.map +1 -1
- package/build/location/Location.js +2 -3
- package/build/location/Location.js.map +1 -1
- package/build/location/Location.native.js +2 -3
- 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/async-require/fetchAsync.native.ts +1 -2
- package/src/async-require/fetchThenEval.web.ts +16 -2
- package/src/async-require/loadBundle.ts +2 -3
- package/src/error-overlay/Data/LogBoxData.tsx +2 -0
- package/src/error-overlay/Data/LogContext.tsx +1 -2
- package/src/error-overlay/UI/constants.ts +9 -7
- package/src/error-overlay/index.tsx +7 -12
- package/src/error-overlay/overlay/LogBoxInspectorFooter.tsx +2 -2
- package/src/error-overlay/overlay/LogBoxInspectorHeader.tsx +1 -1
- package/src/error-overlay/overlay/LogBoxInspectorSourceMapStatus.tsx +3 -0
- package/src/error-overlay/toast/ErrorToast.tsx +2 -2
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ yarn add @expo/metro-runtime
|
|
|
13
13
|
Import this somewhere in the initial bundle. For example, the `App.js`:
|
|
14
14
|
|
|
15
15
|
```js
|
|
16
|
-
import '@expo/metro-
|
|
16
|
+
import '@expo/metro-runtime';
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
`expo/metro-config` will automatically move this import to be first in the bundle.
|
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;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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ChC,0CAA0C;QAC1C,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACzB,OAAO;KACR;IAED,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;QACjC,MAAM,EAAE,IAAI,CACV,IAAI,CAAC,SAAS,CAAC;YACb,IAAI,EAAE,sBAAsB;YAC5B,WAAW,EAAE,kBAAkB;SAChC,CAAC,CACH,CAAC;QACF,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC;KAC/B;AACH,CAAC;AAED,SAAS,cAAc;IACrB,IAAI;QACF,WAAW,CAAC,OAAO,CAAC,CAAC,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
|
+
{"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,WAA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,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"]}
|
|
@@ -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 = buildAsyncRequire;
|
|
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,5 +23,4 @@ function buildAsyncRequire() {
|
|
|
23
23
|
return promise;
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
exports.buildAsyncRequire = buildAsyncRequire;
|
|
27
26
|
//# 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;;AAWH,8CAiBC;AA1BD,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,CAAC;YACpB,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;QAC1B,CAAC;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","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 = buildUrlForBundle;
|
|
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,5 +21,4 @@ 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;
|
|
25
24
|
//# 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;;AAQH,8CAOC;AAbD;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,UAAkB;IAClD,IAAI,UAAU,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC;QACrC,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,iFAAiF;IACjF,kFAAkF;IAClF,OAAO,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC9C,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\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 = buildUrlForBundle;
|
|
10
10
|
function buildUrlForBundle(bundlePath) {
|
|
11
11
|
if (bundlePath.match(/^https?:\/\//)) {
|
|
12
12
|
return bundlePath;
|
|
@@ -24,7 +24,6 @@ function buildUrlForBundle(bundlePath) {
|
|
|
24
24
|
return joinComponents(serverUrl, bundlePath);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
exports.buildUrlForBundle = buildUrlForBundle;
|
|
28
27
|
function joinComponents(prefix, suffix) {
|
|
29
28
|
return prefix.replace(/\/+$/, '') + '/' + suffix.replace(/^\/+/, '');
|
|
30
29
|
}
|
|
@@ -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,8CAoBC;AApBD,SAAgB,iBAAiB,CAAC,UAAkB;IAClD,IAAI,UAAU,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC;QACrC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QAC1C,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;YACpC,OAAO,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACrD,CAAC;QACD,MAAM,IAAI,KAAK,CACb,6IAA6I,CAC9I,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,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;IAC/C,CAAC;AACH,CAAC;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 = fetchAsync;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright © 2022 650 Industries.
|
|
6
6
|
*
|
|
@@ -21,5 +21,4 @@ async function fetchAsync(url) {
|
|
|
21
21
|
headers: response.headers,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
exports.fetchAsync = fetchAsync;
|
|
25
24
|
//# 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":";;AAMA,gCAeC;AArBD;;;;;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","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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchAsync.native.d.ts","sourceRoot":"","sources":["../../src/async-require/fetchAsync.native.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"fetchAsync.native.d.ts","sourceRoot":"","sources":["../../src/async-require/fetchAsync.native.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC,CA2D5E"}
|
|
@@ -10,8 +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 =
|
|
14
|
-
const react_native_1 = require("react-native");
|
|
13
|
+
exports.fetchAsync = fetchAsync;
|
|
15
14
|
// @ts-expect-error
|
|
16
15
|
const RCTNetworking_1 = __importDefault(require("react-native/Libraries/Network/RCTNetworking"));
|
|
17
16
|
function fetchAsync(url) {
|
|
@@ -46,7 +45,7 @@ function fetchAsync(url) {
|
|
|
46
45
|
}
|
|
47
46
|
});
|
|
48
47
|
RCTNetworking_1.default.sendRequest('GET', 'asyncRequest', url, {
|
|
49
|
-
'expo-platform':
|
|
48
|
+
'expo-platform': process.env.EXPO_OS,
|
|
50
49
|
}, '', 'text', false, 0, (requestId) => {
|
|
51
50
|
id = requestId;
|
|
52
51
|
}, true);
|
|
@@ -56,5 +55,4 @@ function fetchAsync(url) {
|
|
|
56
55
|
responseListener?.remove();
|
|
57
56
|
});
|
|
58
57
|
}
|
|
59
|
-
exports.fetchAsync = fetchAsync;
|
|
60
58
|
//# 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;;;;;AAOH,gCA6DC;AAlED,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,IAA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AAC,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","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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchThenEval.web.d.ts","sourceRoot":"","sources":["../../src/async-require/fetchThenEval.web.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"fetchThenEval.web.d.ts","sourceRoot":"","sources":["../../src/async-require/fetchThenEval.web.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,EACE,UAAU,EACV,KAAK,EACL,WAAW,GACZ,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GACpE,OAAO,CAAC,IAAI,CAAC,CAyDf"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchThenEvalAsync = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* Copyright © 2022 650 Industries.
|
|
6
4
|
*
|
|
7
5
|
* This source code is licensed under the MIT license found in the
|
|
8
6
|
* LICENSE file in the root directory of this source tree.
|
|
9
7
|
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.fetchThenEvalAsync = fetchThenEvalAsync;
|
|
10
|
+
const currentSrc = typeof document !== 'undefined' && document.currentScript
|
|
11
|
+
? ('src' in document.currentScript && document.currentScript.src) || null
|
|
12
|
+
: null;
|
|
10
13
|
// Basically `__webpack_require__.l`.
|
|
11
14
|
function fetchThenEvalAsync(url, { scriptType, nonce, crossOrigin, } = {}) {
|
|
12
|
-
if (typeof
|
|
15
|
+
if (typeof window === 'undefined') {
|
|
13
16
|
return require('./fetchThenEvalJs').fetchThenEvalAsync(url);
|
|
14
17
|
}
|
|
15
18
|
return new Promise((resolve, reject) => {
|
|
@@ -53,10 +56,17 @@ function fetchThenEvalAsync(url, { scriptType, nonce, crossOrigin, } = {}) {
|
|
|
53
56
|
script.parentNode && script.parentNode.removeChild(script);
|
|
54
57
|
reject(error);
|
|
55
58
|
};
|
|
56
|
-
|
|
59
|
+
if (script.src === currentSrc) {
|
|
60
|
+
// NOTE(kitten): We always prevent `fetchThenEval` from loading the "current script".
|
|
61
|
+
// This points at our entrypoint bundle, and we should never reload and reevaluate the
|
|
62
|
+
// entrypoint bundle
|
|
63
|
+
resolve();
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
document.head.appendChild(script);
|
|
67
|
+
}
|
|
57
68
|
});
|
|
58
69
|
}
|
|
59
|
-
exports.fetchThenEvalAsync = fetchThenEvalAsync;
|
|
60
70
|
class AsyncRequireError extends Error {
|
|
61
71
|
name = 'AsyncRequireError';
|
|
62
72
|
type;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchThenEval.web.js","sourceRoot":"","sources":["../../src/async-require/fetchThenEval.web.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetchThenEval.web.js","sourceRoot":"","sources":["../../src/async-require/fetchThenEval.web.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAQH,gDAgEC;AAtED,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,CAAC;QAClC,OAAO,OAAO,CAAC,mBAAmB,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAA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,KAAK,CAAC,OAAO,GAAG,iBAAiB,GAAG,GAAG,GAAG,aAAa,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,GAAG,GAAG,CAAC;YAC3F,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;YACvB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;YAExB,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAC3D,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC;QAEF,IAAI,MAAM,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;YAC9B,qFAAqF;YACrF,sFAAsF;YACtF,oBAAoB;YACpB,OAAO,EAAE,CAAC;QACZ,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;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 = fetchThenEvalAsync;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright © 2022 650 Industries.
|
|
6
6
|
*
|
|
@@ -53,7 +53,6 @@ function fetchThenEvalAsync(url) {
|
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
exports.fetchThenEvalAsync = fetchThenEvalAsync;
|
|
57
56
|
function jsonParseOptional(json) {
|
|
58
57
|
try {
|
|
59
58
|
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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A2C;4BAC3C,KAAK,CAAC,OAAO;4BACb,GAAG,CACN,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;YAED,MAAM,IAAI,KAAK,CACb,0CAA0C,GAAG,qCAAqC,IAAI,EAAE,CACzF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACrC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;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,CAAC;IAC1C,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;AAC3F,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\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"loadBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBvE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadBundleAsync =
|
|
3
|
+
exports.loadBundleAsync = loadBundleAsync;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright © 2022 650 Industries.
|
|
6
6
|
*
|
|
@@ -21,10 +21,9 @@ async function loadBundleAsync(bundlePath) {
|
|
|
21
21
|
return (0, fetchThenEval_1.fetchThenEvalAsync)(requestUrl);
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
|
-
const Platform = require('react-native').Platform;
|
|
25
24
|
const LoadingView = require('../LoadingView')
|
|
26
25
|
.default;
|
|
27
|
-
if (
|
|
26
|
+
if (process.env.EXPO_OS !== 'web') {
|
|
28
27
|
// Send a signal to the `expo` package to show the loading indicator.
|
|
29
28
|
LoadingView.showMessage('Downloading...', 'load');
|
|
30
29
|
}
|
|
@@ -35,11 +34,10 @@ async function loadBundleAsync(bundlePath) {
|
|
|
35
34
|
HMRClient.registerBundle(requestUrl);
|
|
36
35
|
})
|
|
37
36
|
.finally(() => {
|
|
38
|
-
if (!--pendingRequests &&
|
|
37
|
+
if (!--pendingRequests && process.env.EXPO_OS !== 'web') {
|
|
39
38
|
LoadingView.hide();
|
|
40
39
|
}
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
|
-
exports.loadBundleAsync = loadBundleAsync;
|
|
45
43
|
//# 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":";;AAgBA,0CAyBC;AAzCD;;;;;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,CAAC;QAC1C,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC,CAAC;IACxC,CAAC;SAAM,CAAC;QACN,MAAM,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;aAC1C,OAAkD,CAAC;QACtD,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;YAClC,qEAAqE;YACrE,WAAW,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;QACpD,CAAC;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,CAAC;gBACxD,WAAW,CAAC,IAAI,EAAE,CAAC;YACrB,CAAC;QACH,CAAC,CAAC,CAAC;IACP,CAAC;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 { 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,CAAC;IAC1C;IACE,kBAAkB;IAClB,OAAO,MAAM,KAAK,WAAW,EAC7B,CAAC;QACD,OAAO,CAAC,oBAAoB,CAAC,CAAC;QAC9B,OAAO,CAAC,YAAY,CAAC,CAAC;QACtB,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC","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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBoxData.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxData.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"LogBoxData.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxData.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAIjG,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;AAExC,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF,KAAK,aAAa,GAAG,GAAG,CAAC;AAEzB,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE;IAC/B,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,KAAK,IAAI,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,MAAM,GA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CAyB7D;AAED,wBAAgB,aAAa,IAAI,IAAI,CAOpC;AAED,wBAAgB,WAAW,IAAI,IAAI,CAMlC;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAK5C;AAED,wBAAgB,iBAAiB,IAAI,aAAa,EAAE,CAEnD;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,IAAI,CA2BjE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAMhD;AAED,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAWxD;AAED,wBAAgB,gBAAgB,CAAC,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAiF5F"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Copyright (c) 650 Industries.
|
|
4
3
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -6,6 +5,8 @@
|
|
|
6
5
|
* This source code is licensed under the MIT license found in the
|
|
7
6
|
* LICENSE file in the root directory of this source tree.
|
|
8
7
|
*/
|
|
8
|
+
'use client';
|
|
9
|
+
"use strict";
|
|
9
10
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
11
|
if (k2 === undefined) k2 = k;
|
|
11
12
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -33,7 +34,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
33
34
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
35
|
};
|
|
35
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
37
|
+
exports.reportLogBoxError = 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
57
|
const React = __importStar(require("react"));
|
|
38
58
|
const LogBoxLog_1 = require("./LogBoxLog");
|
|
39
59
|
const LogContext_1 = require("./LogContext");
|
|
@@ -61,16 +81,13 @@ function reportLogBoxError(error, componentStack) {
|
|
|
61
81
|
}
|
|
62
82
|
ExceptionsManager.handleException(error);
|
|
63
83
|
}
|
|
64
|
-
exports.reportLogBoxError = reportLogBoxError;
|
|
65
84
|
function reportUnexpectedLogBoxError(error, componentStack) {
|
|
66
85
|
error.message = `${LOGBOX_ERROR_MESSAGE}\n\n${error.message}`;
|
|
67
86
|
return reportLogBoxError(error, componentStack);
|
|
68
87
|
}
|
|
69
|
-
exports.reportUnexpectedLogBoxError = reportUnexpectedLogBoxError;
|
|
70
88
|
function isLogBoxErrorMessage(message) {
|
|
71
89
|
return typeof message === 'string' && message.includes(LOGBOX_ERROR_MESSAGE);
|
|
72
90
|
}
|
|
73
|
-
exports.isLogBoxErrorMessage = isLogBoxErrorMessage;
|
|
74
91
|
function isMessageIgnored(message) {
|
|
75
92
|
for (const pattern of ignorePatterns) {
|
|
76
93
|
if ((pattern instanceof RegExp && pattern.test(message)) ||
|
|
@@ -80,7 +97,6 @@ function isMessageIgnored(message) {
|
|
|
80
97
|
}
|
|
81
98
|
return false;
|
|
82
99
|
}
|
|
83
|
-
exports.isMessageIgnored = isMessageIgnored;
|
|
84
100
|
function setImmediateShim(callback) {
|
|
85
101
|
if (!global.setImmediate) {
|
|
86
102
|
return setTimeout(callback, 0);
|
|
@@ -174,7 +190,6 @@ function addLog(log) {
|
|
|
174
190
|
}
|
|
175
191
|
});
|
|
176
192
|
}
|
|
177
|
-
exports.addLog = addLog;
|
|
178
193
|
function addException(error) {
|
|
179
194
|
// Parsing logs are expensive so we schedule this
|
|
180
195
|
// otherwise spammy logs would pause rendering.
|
|
@@ -187,30 +202,25 @@ function addException(error) {
|
|
|
187
202
|
}
|
|
188
203
|
});
|
|
189
204
|
}
|
|
190
|
-
exports.addException = addException;
|
|
191
205
|
function symbolicateLogNow(type, log) {
|
|
192
206
|
log.symbolicate(type, () => {
|
|
193
207
|
handleUpdate();
|
|
194
208
|
});
|
|
195
209
|
}
|
|
196
|
-
exports.symbolicateLogNow = symbolicateLogNow;
|
|
197
210
|
function retrySymbolicateLogNow(type, log) {
|
|
198
211
|
log.retrySymbolicate(type, () => {
|
|
199
212
|
handleUpdate();
|
|
200
213
|
});
|
|
201
214
|
}
|
|
202
|
-
exports.retrySymbolicateLogNow = retrySymbolicateLogNow;
|
|
203
215
|
function symbolicateLogLazy(type, log) {
|
|
204
216
|
log.symbolicate(type);
|
|
205
217
|
}
|
|
206
|
-
exports.symbolicateLogLazy = symbolicateLogLazy;
|
|
207
218
|
function clear() {
|
|
208
219
|
if (logs.size > 0) {
|
|
209
220
|
logs = new Set();
|
|
210
221
|
setSelectedLog(-1);
|
|
211
222
|
}
|
|
212
223
|
}
|
|
213
|
-
exports.clear = clear;
|
|
214
224
|
function setSelectedLog(proposedNewIndex) {
|
|
215
225
|
const oldIndex = _selectedIndex;
|
|
216
226
|
let newIndex = proposedNewIndex;
|
|
@@ -237,7 +247,6 @@ function setSelectedLog(proposedNewIndex) {
|
|
|
237
247
|
}, 0);
|
|
238
248
|
}
|
|
239
249
|
}
|
|
240
|
-
exports.setSelectedLog = setSelectedLog;
|
|
241
250
|
function clearWarnings() {
|
|
242
251
|
const newLogs = Array.from(logs).filter((log) => log.level !== 'warn');
|
|
243
252
|
if (newLogs.length !== logs.size) {
|
|
@@ -246,7 +255,6 @@ function clearWarnings() {
|
|
|
246
255
|
handleUpdate();
|
|
247
256
|
}
|
|
248
257
|
}
|
|
249
|
-
exports.clearWarnings = clearWarnings;
|
|
250
258
|
function clearErrors() {
|
|
251
259
|
const newLogs = Array.from(logs).filter((log) => log.level !== 'error' && log.level !== 'fatal');
|
|
252
260
|
if (newLogs.length !== logs.size) {
|
|
@@ -254,18 +262,15 @@ function clearErrors() {
|
|
|
254
262
|
setSelectedLog(-1);
|
|
255
263
|
}
|
|
256
264
|
}
|
|
257
|
-
exports.clearErrors = clearErrors;
|
|
258
265
|
function dismiss(log) {
|
|
259
266
|
if (logs.has(log)) {
|
|
260
267
|
logs.delete(log);
|
|
261
268
|
handleUpdate();
|
|
262
269
|
}
|
|
263
270
|
}
|
|
264
|
-
exports.dismiss = dismiss;
|
|
265
271
|
function getIgnorePatterns() {
|
|
266
272
|
return Array.from(ignorePatterns);
|
|
267
273
|
}
|
|
268
|
-
exports.getIgnorePatterns = getIgnorePatterns;
|
|
269
274
|
function addIgnorePatterns(patterns) {
|
|
270
275
|
const existingSize = ignorePatterns.size;
|
|
271
276
|
// The same pattern may be added multiple times, but adding a new pattern
|
|
@@ -292,7 +297,6 @@ function addIgnorePatterns(patterns) {
|
|
|
292
297
|
logs = new Set(Array.from(logs).filter((log) => !isMessageIgnored(log.message.content)));
|
|
293
298
|
handleUpdate();
|
|
294
299
|
}
|
|
295
|
-
exports.addIgnorePatterns = addIgnorePatterns;
|
|
296
300
|
function setDisabled(value) {
|
|
297
301
|
if (value === _isDisabled) {
|
|
298
302
|
return;
|
|
@@ -300,11 +304,9 @@ function setDisabled(value) {
|
|
|
300
304
|
_isDisabled = value;
|
|
301
305
|
handleUpdate();
|
|
302
306
|
}
|
|
303
|
-
exports.setDisabled = setDisabled;
|
|
304
307
|
function isDisabled() {
|
|
305
308
|
return _isDisabled;
|
|
306
309
|
}
|
|
307
|
-
exports.isDisabled = isDisabled;
|
|
308
310
|
function observe(observer) {
|
|
309
311
|
const subscription = { observer };
|
|
310
312
|
observers.add(subscription);
|
|
@@ -315,7 +317,6 @@ function observe(observer) {
|
|
|
315
317
|
},
|
|
316
318
|
};
|
|
317
319
|
}
|
|
318
|
-
exports.observe = observe;
|
|
319
320
|
function withSubscription(WrappedComponent) {
|
|
320
321
|
class LogBoxStateSubscription extends React.Component {
|
|
321
322
|
static getDerivedStateFromError() {
|
|
@@ -383,5 +384,4 @@ function withSubscription(WrappedComponent) {
|
|
|
383
384
|
// @ts-expect-error
|
|
384
385
|
return LogBoxStateSubscription;
|
|
385
386
|
}
|
|
386
|
-
exports.withSubscription = withSubscription;
|
|
387
387
|
//# sourceMappingURL=LogBoxData.js.map
|