@expo/metro-runtime 0.0.0-canary-20231122-1af9191
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 +19 -0
- package/assets/alert-triangle.png +0 -0
- package/assets/chevron-left.png +0 -0
- package/assets/chevron-right.png +0 -0
- package/assets/close.png +0 -0
- package/assets/loader.png +0 -0
- package/async-require.d.ts +1 -0
- package/async-require.js +1 -0
- package/build/HMRClient.d.ts +17 -0
- package/build/HMRClient.d.ts.map +1 -0
- package/build/HMRClient.js +273 -0
- package/build/HMRClient.js.map +1 -0
- package/build/HMRClient.native.d.ts +3 -0
- package/build/HMRClient.native.d.ts.map +1 -0
- package/build/HMRClient.native.js +5 -0
- package/build/HMRClient.native.js.map +1 -0
- package/build/LoadingView.d.ts +14 -0
- package/build/LoadingView.d.ts.map +1 -0
- package/build/LoadingView.js +23 -0
- package/build/LoadingView.js.map +1 -0
- package/build/LoadingView.native.d.ts +3 -0
- package/build/LoadingView.native.d.ts.map +1 -0
- package/build/LoadingView.native.js +8 -0
- package/build/LoadingView.native.js.map +1 -0
- package/build/async-require/buildAsyncRequire.d.ts +15 -0
- package/build/async-require/buildAsyncRequire.d.ts.map +1 -0
- package/build/async-require/buildAsyncRequire.js +27 -0
- package/build/async-require/buildAsyncRequire.js.map +1 -0
- package/build/async-require/buildUrlForBundle.d.ts +14 -0
- package/build/async-require/buildUrlForBundle.d.ts.map +1 -0
- package/build/async-require/buildUrlForBundle.js +22 -0
- package/build/async-require/buildUrlForBundle.js.map +1 -0
- package/build/async-require/buildUrlForBundle.native.d.ts +8 -0
- package/build/async-require/buildUrlForBundle.native.d.ts.map +1 -0
- package/build/async-require/buildUrlForBundle.native.js +28 -0
- package/build/async-require/buildUrlForBundle.native.js.map +1 -0
- package/build/async-require/fetchAsync.d.ts +11 -0
- package/build/async-require/fetchAsync.d.ts.map +1 -0
- package/build/async-require/fetchAsync.js +24 -0
- package/build/async-require/fetchAsync.js.map +1 -0
- package/build/async-require/fetchAsync.native.d.ts +12 -0
- package/build/async-require/fetchAsync.native.d.ts.map +1 -0
- package/build/async-require/fetchAsync.native.js +58 -0
- package/build/async-require/fetchAsync.native.js.map +1 -0
- package/build/async-require/fetchThenEval.d.ts +2 -0
- package/build/async-require/fetchThenEval.d.ts.map +1 -0
- package/build/async-require/fetchThenEval.js +6 -0
- package/build/async-require/fetchThenEval.js.map +1 -0
- package/build/async-require/fetchThenEval.web.d.ts +12 -0
- package/build/async-require/fetchThenEval.web.d.ts.map +1 -0
- package/build/async-require/fetchThenEval.web.js +65 -0
- package/build/async-require/fetchThenEval.web.js.map +1 -0
- package/build/async-require/fetchThenEvalJs.d.ts +7 -0
- package/build/async-require/fetchThenEvalJs.d.ts.map +1 -0
- package/build/async-require/fetchThenEvalJs.js +36 -0
- package/build/async-require/fetchThenEvalJs.js.map +1 -0
- package/build/async-require/index.d.ts +2 -0
- package/build/async-require/index.d.ts.map +1 -0
- package/build/async-require/index.js +12 -0
- package/build/async-require/index.js.map +1 -0
- package/build/async-require/index.native.d.ts +7 -0
- package/build/async-require/index.native.d.ts.map +1 -0
- package/build/async-require/index.native.js +14 -0
- package/build/async-require/index.native.js.map +1 -0
- package/build/async-require/loadBundle.d.ts +7 -0
- package/build/async-require/loadBundle.d.ts.map +1 -0
- package/build/async-require/loadBundle.js +46 -0
- package/build/async-require/loadBundle.js.map +1 -0
- package/build/effects.d.ts +1 -0
- package/build/effects.d.ts.map +1 -0
- package/build/effects.js +11 -0
- package/build/effects.js.map +1 -0
- package/build/effects.native.d.ts +1 -0
- package/build/effects.native.d.ts.map +1 -0
- package/build/effects.native.js +1 -0
- package/build/effects.native.js.map +1 -0
- package/build/error-overlay/Data/LogBoxData.d.ts +60 -0
- package/build/error-overlay/Data/LogBoxData.d.ts.map +1 -0
- package/build/error-overlay/Data/LogBoxData.js +387 -0
- package/build/error-overlay/Data/LogBoxData.js.map +1 -0
- package/build/error-overlay/Data/LogBoxLog.d.ts +68 -0
- package/build/error-overlay/Data/LogBoxLog.d.ts.map +1 -0
- package/build/error-overlay/Data/LogBoxLog.js +188 -0
- package/build/error-overlay/Data/LogBoxLog.js.map +1 -0
- package/build/error-overlay/Data/LogBoxSymbolication.d.ts +17 -0
- package/build/error-overlay/Data/LogBoxSymbolication.d.ts.map +1 -0
- package/build/error-overlay/Data/LogBoxSymbolication.js +56 -0
- package/build/error-overlay/Data/LogBoxSymbolication.js.map +1 -0
- package/build/error-overlay/Data/LogContext.d.ts +14 -0
- package/build/error-overlay/Data/LogContext.d.ts.map +1 -0
- package/build/error-overlay/Data/LogContext.js +36 -0
- package/build/error-overlay/Data/LogContext.js.map +1 -0
- package/build/error-overlay/Data/parseLogBoxLog.d.ts +45 -0
- package/build/error-overlay/Data/parseLogBoxLog.d.ts.map +1 -0
- package/build/error-overlay/Data/parseLogBoxLog.js +277 -0
- package/build/error-overlay/Data/parseLogBoxLog.js.map +1 -0
- package/build/error-overlay/ErrorOverlay.d.ts +25 -0
- package/build/error-overlay/ErrorOverlay.d.ts.map +1 -0
- package/build/error-overlay/ErrorOverlay.js +158 -0
- package/build/error-overlay/ErrorOverlay.js.map +1 -0
- package/build/error-overlay/LogBox.d.ts +16 -0
- package/build/error-overlay/LogBox.d.ts.map +1 -0
- package/build/error-overlay/LogBox.js +30 -0
- package/build/error-overlay/LogBox.js.map +1 -0
- package/build/error-overlay/LogBox.web.d.ts +23 -0
- package/build/error-overlay/LogBox.web.d.ts.map +1 -0
- package/build/error-overlay/LogBox.web.js +135 -0
- package/build/error-overlay/LogBox.web.js.map +1 -0
- package/build/error-overlay/UI/AnsiHighlight.d.ts +6 -0
- package/build/error-overlay/UI/AnsiHighlight.d.ts.map +1 -0
- package/build/error-overlay/UI/AnsiHighlight.js +85 -0
- package/build/error-overlay/UI/AnsiHighlight.js.map +1 -0
- package/build/error-overlay/UI/LogBoxButton.d.ts +14 -0
- package/build/error-overlay/UI/LogBoxButton.d.ts.map +1 -0
- package/build/error-overlay/UI/LogBoxButton.js +60 -0
- package/build/error-overlay/UI/LogBoxButton.js.map +1 -0
- package/build/error-overlay/UI/LogBoxMessage.d.ts +11 -0
- package/build/error-overlay/UI/LogBoxMessage.d.ts.map +1 -0
- package/build/error-overlay/UI/LogBoxMessage.js +53 -0
- package/build/error-overlay/UI/LogBoxMessage.js.map +1 -0
- package/build/error-overlay/UI/LogBoxStyle.d.ts +22 -0
- package/build/error-overlay/UI/LogBoxStyle.d.ts.map +1 -0
- package/build/error-overlay/UI/LogBoxStyle.js +68 -0
- package/build/error-overlay/UI/LogBoxStyle.js.map +1 -0
- package/build/error-overlay/UI/constants.d.ts +2 -0
- package/build/error-overlay/UI/constants.d.ts.map +1 -0
- package/build/error-overlay/UI/constants.js +10 -0
- package/build/error-overlay/UI/constants.js.map +1 -0
- package/build/error-overlay/formatProjectFilePath.d.ts +7 -0
- package/build/error-overlay/formatProjectFilePath.d.ts.map +1 -0
- package/build/error-overlay/formatProjectFilePath.js +32 -0
- package/build/error-overlay/formatProjectFilePath.js.map +1 -0
- package/build/error-overlay/index.d.ts +3 -0
- package/build/error-overlay/index.d.ts.map +1 -0
- package/build/error-overlay/index.js +32 -0
- package/build/error-overlay/index.js.map +1 -0
- package/build/error-overlay/modules/ExceptionsManager/index.d.ts +38 -0
- package/build/error-overlay/modules/ExceptionsManager/index.d.ts.map +1 -0
- package/build/error-overlay/modules/ExceptionsManager/index.js +75 -0
- package/build/error-overlay/modules/ExceptionsManager/index.js.map +1 -0
- package/build/error-overlay/modules/ExceptionsManager/index.native.d.ts +3 -0
- package/build/error-overlay/modules/ExceptionsManager/index.native.d.ts.map +1 -0
- package/build/error-overlay/modules/ExceptionsManager/index.native.js +9 -0
- package/build/error-overlay/modules/ExceptionsManager/index.native.js.map +1 -0
- package/build/error-overlay/modules/NativeLogBox/index.d.ts +6 -0
- package/build/error-overlay/modules/NativeLogBox/index.d.ts.map +1 -0
- package/build/error-overlay/modules/NativeLogBox/index.js +32 -0
- package/build/error-overlay/modules/NativeLogBox/index.js.map +1 -0
- package/build/error-overlay/modules/NativeLogBox/index.native.d.ts +3 -0
- package/build/error-overlay/modules/NativeLogBox/index.native.d.ts.map +1 -0
- package/build/error-overlay/modules/NativeLogBox/index.native.js +8 -0
- package/build/error-overlay/modules/NativeLogBox/index.native.js.map +1 -0
- package/build/error-overlay/modules/openFileInEditor/index.d.ts +3 -0
- package/build/error-overlay/modules/openFileInEditor/index.d.ts.map +1 -0
- package/build/error-overlay/modules/openFileInEditor/index.js +15 -0
- package/build/error-overlay/modules/openFileInEditor/index.js.map +1 -0
- package/build/error-overlay/modules/openFileInEditor/index.native.d.ts +3 -0
- package/build/error-overlay/modules/openFileInEditor/index.native.d.ts.map +1 -0
- package/build/error-overlay/modules/openFileInEditor/index.native.js +8 -0
- package/build/error-overlay/modules/openFileInEditor/index.native.js.map +1 -0
- package/build/error-overlay/modules/parseErrorStack/index.d.ts +6 -0
- package/build/error-overlay/modules/parseErrorStack/index.d.ts.map +1 -0
- package/build/error-overlay/modules/parseErrorStack/index.js +25 -0
- package/build/error-overlay/modules/parseErrorStack/index.js.map +1 -0
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.d.ts +3 -0
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.d.ts.map +1 -0
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.js +9 -0
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.js.map +1 -0
- package/build/error-overlay/modules/stringifySafe/index.d.ts +20 -0
- package/build/error-overlay/modules/stringifySafe/index.d.ts.map +1 -0
- package/build/error-overlay/modules/stringifySafe/index.js +114 -0
- package/build/error-overlay/modules/stringifySafe/index.js.map +1 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.d.ts +24 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.d.ts.map +1 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.js +21 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.js.map +1 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.d.ts +3 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.d.ts.map +1 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.js +8 -0
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.d.ts +5 -0
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js +112 -0
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorFooter.d.ts +7 -0
- package/build/error-overlay/overlay/LogBoxInspectorFooter.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js +116 -0
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorHeader.d.ts +8 -0
- package/build/error-overlay/overlay/LogBoxInspectorHeader.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js +142 -0
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.d.ts +12 -0
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js +119 -0
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorSection.d.ts +16 -0
- package/build/error-overlay/overlay/LogBoxInspectorSection.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorSection.js +70 -0
- package/build/error-overlay/overlay/LogBoxInspectorSection.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.d.ts +8 -0
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js +125 -0
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.d.ts +11 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js +97 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.d.ts +10 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.d.ts.map +1 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js +174 -0
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js.map +1 -0
- package/build/error-overlay/toast/ErrorToast.d.ts +11 -0
- package/build/error-overlay/toast/ErrorToast.d.ts.map +1 -0
- package/build/error-overlay/toast/ErrorToast.js +150 -0
- package/build/error-overlay/toast/ErrorToast.js.map +1 -0
- package/build/error-overlay/toast/ErrorToastContainer.d.ts +5 -0
- package/build/error-overlay/toast/ErrorToastContainer.d.ts.map +1 -0
- package/build/error-overlay/toast/ErrorToastContainer.js +11 -0
- package/build/error-overlay/toast/ErrorToastContainer.js.map +1 -0
- package/build/error-overlay/toast/ErrorToastContainer.web.d.ts +12 -0
- package/build/error-overlay/toast/ErrorToastContainer.web.d.ts.map +1 -0
- package/build/error-overlay/toast/ErrorToastContainer.web.js +84 -0
- package/build/error-overlay/toast/ErrorToastContainer.web.js.map +1 -0
- package/build/error-overlay/toast/ErrorToastMessage.d.ts +5 -0
- package/build/error-overlay/toast/ErrorToastMessage.d.ts.map +1 -0
- package/build/error-overlay/toast/ErrorToastMessage.js +51 -0
- package/build/error-overlay/toast/ErrorToastMessage.js.map +1 -0
- package/build/error-overlay/useRejectionHandler.d.ts +3 -0
- package/build/error-overlay/useRejectionHandler.d.ts.map +1 -0
- package/build/error-overlay/useRejectionHandler.js +59 -0
- package/build/error-overlay/useRejectionHandler.js.map +1 -0
- package/build/getDevServer.d.ts +8 -0
- package/build/getDevServer.d.ts.map +1 -0
- package/build/getDevServer.js +28 -0
- package/build/getDevServer.js.map +1 -0
- package/build/getDevServer.native.d.ts +3 -0
- package/build/getDevServer.native.d.ts.map +1 -0
- package/build/getDevServer.native.js +8 -0
- package/build/getDevServer.native.js.map +1 -0
- package/build/index.d.ts +10 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +14 -0
- package/build/index.js.map +1 -0
- package/build/location/Location.d.ts +3 -0
- package/build/location/Location.d.ts.map +1 -0
- package/build/location/Location.js +8 -0
- package/build/location/Location.js.map +1 -0
- package/build/location/Location.native.d.ts +3 -0
- package/build/location/Location.native.d.ts.map +1 -0
- package/build/location/Location.native.js +195 -0
- package/build/location/Location.native.js.map +1 -0
- package/build/location/install.d.ts +1 -0
- package/build/location/install.d.ts.map +1 -0
- package/build/location/install.js +1 -0
- package/build/location/install.js.map +1 -0
- package/build/location/install.native.d.ts +2 -0
- package/build/location/install.native.d.ts.map +1 -0
- package/build/location/install.native.js +78 -0
- package/build/location/install.native.js.map +1 -0
- package/build/messageSocket.d.ts +3 -0
- package/build/messageSocket.d.ts.map +1 -0
- package/build/messageSocket.js +24 -0
- package/build/messageSocket.js.map +1 -0
- package/build/setupFastRefresh.d.ts +10 -0
- package/build/setupFastRefresh.d.ts.map +1 -0
- package/build/setupFastRefresh.js +23 -0
- package/build/setupFastRefresh.js.map +1 -0
- package/build/setupHMR.d.ts +2 -0
- package/build/setupHMR.d.ts.map +1 -0
- package/build/setupHMR.js +31 -0
- package/build/setupHMR.js.map +1 -0
- package/build/symbolicate.d.ts +5 -0
- package/build/symbolicate.d.ts.map +1 -0
- package/build/symbolicate.js +26 -0
- package/build/symbolicate.js.map +1 -0
- package/error-overlay.d.ts +1 -0
- package/error-overlay.js +1 -0
- package/package.json +41 -0
- package/symbolicate/index.d.ts +1 -0
- package/symbolicate/index.js +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @expo/metro-runtime
|
|
2
|
+
|
|
3
|
+
Injects runtime code required for advanced Metro bundling features in the Expo ecosystem.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
> `expo-router` users do not need to install this package, it is already included.
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
yarn add @expo/metro-runtime
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Import this somewhere in the initial bundle. For example, the `App.js`:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import '@expo/metro-config';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`expo/metro-config` will automatically move this import to be first in the bundle.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/assets/close.png
ADDED
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './build/async-require/index';
|
package/async-require.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./build/async-require');
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type LogLevel = 'trace' | 'info' | 'warn' | 'error' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug';
|
|
2
|
+
export type HMRClientNativeInterface = {
|
|
3
|
+
enable(): void;
|
|
4
|
+
disable(): void;
|
|
5
|
+
registerBundle(requestUrl: string): void;
|
|
6
|
+
log(level: LogLevel, data: any[]): void;
|
|
7
|
+
setup(props: {
|
|
8
|
+
isEnabled: boolean;
|
|
9
|
+
}): void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* HMR Client that receives from the server HMR updates and propagates them
|
|
13
|
+
* runtime to reflects those changes.
|
|
14
|
+
*/
|
|
15
|
+
declare const HMRClient: HMRClientNativeInterface;
|
|
16
|
+
export default HMRClient;
|
|
17
|
+
//# sourceMappingURL=HMRClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HMRClient.d.ts","sourceRoot":"","sources":["../src/HMRClient.ts"],"names":[],"mappings":"AAiCA,KAAK,QAAQ,GACT,OAAO,GACP,MAAM,GACN,MAAM,GACN,OAAO,GACP,KAAK,GACL,OAAO,GACP,gBAAgB,GAChB,UAAU,GACV,OAAO,CAAC;AAEZ,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACxC,KAAK,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CAC5C,CAAC;AAMF;;;GAGG;AACH,QAAA,MAAM,SAAS,EAAE,wBAwLhB,CAAC;AAuEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
/**
|
|
30
|
+
* Copyright (c) 650 Industries.
|
|
31
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
32
|
+
*
|
|
33
|
+
* This source code is licensed under the MIT license found in the
|
|
34
|
+
* LICENSE file in the root directory of this source tree.
|
|
35
|
+
*
|
|
36
|
+
* Based on this but with web support:
|
|
37
|
+
* https://github.com/facebook/react-native/blob/086714b02b0fb838dee5a66c5bcefe73b53cf3df/Libraries/Utilities/HMRClient.js
|
|
38
|
+
*/
|
|
39
|
+
const pretty_format_1 = __importStar(require("pretty-format"));
|
|
40
|
+
const LoadingView_1 = __importDefault(require("./LoadingView"));
|
|
41
|
+
const LogBox_1 = __importDefault(require("./error-overlay/LogBox"));
|
|
42
|
+
const getDevServer_1 = __importDefault(require("./getDevServer"));
|
|
43
|
+
const MetroHMRClient = require('metro-runtime/src/modules/HMRClient');
|
|
44
|
+
const pendingEntryPoints = [];
|
|
45
|
+
let hmrClient = null;
|
|
46
|
+
let hmrUnavailableReason = null;
|
|
47
|
+
let currentCompileErrorMessage = null;
|
|
48
|
+
let didConnect = false;
|
|
49
|
+
const pendingLogs = [];
|
|
50
|
+
function assert(foo, msg) {
|
|
51
|
+
if (!foo)
|
|
52
|
+
throw new Error(msg);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* HMR Client that receives from the server HMR updates and propagates them
|
|
56
|
+
* runtime to reflects those changes.
|
|
57
|
+
*/
|
|
58
|
+
const HMRClient = {
|
|
59
|
+
enable() {
|
|
60
|
+
if (hmrUnavailableReason !== null) {
|
|
61
|
+
// If HMR became unavailable while you weren't using it,
|
|
62
|
+
// explain why when you try to turn it on.
|
|
63
|
+
// This is an error (and not a warning) because it is shown
|
|
64
|
+
// in response to a direct user action.
|
|
65
|
+
throw new Error(hmrUnavailableReason);
|
|
66
|
+
}
|
|
67
|
+
assert(hmrClient, 'Expected HMRClient.setup() call at startup.');
|
|
68
|
+
// We use this for internal logging only.
|
|
69
|
+
// It doesn't affect the logic.
|
|
70
|
+
hmrClient.send(JSON.stringify({ type: 'log-opt-in' }));
|
|
71
|
+
// When toggling Fast Refresh on, we might already have some stashed updates.
|
|
72
|
+
// Since they'll get applied now, we'll show a banner.
|
|
73
|
+
const hasUpdates = hmrClient.hasPendingUpdates();
|
|
74
|
+
if (hasUpdates) {
|
|
75
|
+
LoadingView_1.default.showMessage('Refreshing...', 'refresh');
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
hmrClient.enable();
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
if (hasUpdates) {
|
|
82
|
+
LoadingView_1.default.hide();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// There could be a compile error while Fast Refresh was off,
|
|
86
|
+
// but we ignored it at the time. Show it now.
|
|
87
|
+
showCompileError();
|
|
88
|
+
},
|
|
89
|
+
disable() {
|
|
90
|
+
assert(hmrClient, 'Expected HMRClient.setup() call at startup.');
|
|
91
|
+
hmrClient.disable();
|
|
92
|
+
},
|
|
93
|
+
registerBundle(requestUrl) {
|
|
94
|
+
assert(hmrClient, 'Expected HMRClient.setup() call at startup.');
|
|
95
|
+
pendingEntryPoints.push(requestUrl);
|
|
96
|
+
registerBundleEntryPoints(hmrClient);
|
|
97
|
+
},
|
|
98
|
+
log(level, data) {
|
|
99
|
+
if (!hmrClient) {
|
|
100
|
+
// Catch a reasonable number of early logs
|
|
101
|
+
// in case hmrClient gets initialized later.
|
|
102
|
+
pendingLogs.push([level, data]);
|
|
103
|
+
if (pendingLogs.length > 100) {
|
|
104
|
+
pendingLogs.shift();
|
|
105
|
+
}
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
hmrClient.send(JSON.stringify({
|
|
110
|
+
type: 'log',
|
|
111
|
+
level,
|
|
112
|
+
mode: 'BRIDGE',
|
|
113
|
+
data: data.map((item) => typeof item === 'string'
|
|
114
|
+
? item
|
|
115
|
+
: (0, pretty_format_1.default)(item, {
|
|
116
|
+
escapeString: true,
|
|
117
|
+
highlight: true,
|
|
118
|
+
maxDepth: 3,
|
|
119
|
+
min: true,
|
|
120
|
+
plugins: [pretty_format_1.plugins.ReactElement],
|
|
121
|
+
})),
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// If sending logs causes any failures we want to silently ignore them
|
|
126
|
+
// to ensure we do not cause infinite-logging loops.
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
// Called once by the bridge on startup, even if Fast Refresh is off.
|
|
130
|
+
// It creates the HMR client but doesn't actually set up the socket yet.
|
|
131
|
+
setup({ isEnabled }) {
|
|
132
|
+
assert(!hmrClient, 'Cannot initialize hmrClient twice');
|
|
133
|
+
const serverScheme = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
|
134
|
+
const client = new MetroHMRClient(`${serverScheme}://${window.location.host}/hot`);
|
|
135
|
+
hmrClient = client;
|
|
136
|
+
const { fullBundleUrl } = (0, getDevServer_1.default)();
|
|
137
|
+
pendingEntryPoints.push(
|
|
138
|
+
// HMRServer understands regular bundle URLs, so prefer that in case
|
|
139
|
+
// there are any important URL parameters we can't reconstruct from
|
|
140
|
+
// `setup()`'s arguments.
|
|
141
|
+
fullBundleUrl);
|
|
142
|
+
client.on('connection-error', (e) => {
|
|
143
|
+
let error = `Cannot connect to Metro.
|
|
144
|
+
|
|
145
|
+
Try the following to fix the issue:
|
|
146
|
+
- Ensure the Metro dev server is running and available on the same network as this device`;
|
|
147
|
+
error += `
|
|
148
|
+
|
|
149
|
+
URL: ${window.location.host}
|
|
150
|
+
|
|
151
|
+
Error: ${e.message}`;
|
|
152
|
+
setHMRUnavailableReason(error);
|
|
153
|
+
});
|
|
154
|
+
client.on('update-start', ({ isInitialUpdate }) => {
|
|
155
|
+
currentCompileErrorMessage = null;
|
|
156
|
+
didConnect = true;
|
|
157
|
+
if (client.isEnabled() && !isInitialUpdate) {
|
|
158
|
+
LoadingView_1.default.showMessage('Refreshing...', 'refresh');
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
client.on('update', ({ isInitialUpdate }) => {
|
|
162
|
+
if (client.isEnabled() && !isInitialUpdate) {
|
|
163
|
+
dismissRedbox();
|
|
164
|
+
LogBox_1.default.clearAllLogs();
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
client.on('update-done', () => {
|
|
168
|
+
LoadingView_1.default.hide();
|
|
169
|
+
});
|
|
170
|
+
client.on('error', (data) => {
|
|
171
|
+
LoadingView_1.default.hide();
|
|
172
|
+
if (data.type === 'GraphNotFoundError') {
|
|
173
|
+
client.close();
|
|
174
|
+
setHMRUnavailableReason('Metro has restarted since the last edit. Reload to reconnect.');
|
|
175
|
+
}
|
|
176
|
+
else if (data.type === 'RevisionNotFoundError') {
|
|
177
|
+
client.close();
|
|
178
|
+
setHMRUnavailableReason('Metro and the client are out of sync. Reload to reconnect.');
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
currentCompileErrorMessage = `${data.type} ${data.message}`;
|
|
182
|
+
if (client.isEnabled()) {
|
|
183
|
+
showCompileError();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
client.on('close', (closeEvent) => {
|
|
188
|
+
LoadingView_1.default.hide();
|
|
189
|
+
// https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4.1
|
|
190
|
+
// https://www.rfc-editor.org/rfc/rfc6455.html#section-7.1.5
|
|
191
|
+
const isNormalOrUnsetCloseReason = closeEvent == null ||
|
|
192
|
+
closeEvent.code === 1000 ||
|
|
193
|
+
closeEvent.code === 1005 ||
|
|
194
|
+
closeEvent.code == null;
|
|
195
|
+
setHMRUnavailableReason(`${isNormalOrUnsetCloseReason
|
|
196
|
+
? 'Disconnected from Metro.'
|
|
197
|
+
: `Disconnected from Metro (${closeEvent.code}: "${closeEvent.reason}").`}
|
|
198
|
+
|
|
199
|
+
To reconnect:
|
|
200
|
+
- Ensure that Metro is running and available on the same network
|
|
201
|
+
- Reload this app (will trigger further help if Metro cannot be connected to)
|
|
202
|
+
`);
|
|
203
|
+
});
|
|
204
|
+
if (isEnabled) {
|
|
205
|
+
HMRClient.enable();
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
HMRClient.disable();
|
|
209
|
+
}
|
|
210
|
+
registerBundleEntryPoints(hmrClient);
|
|
211
|
+
flushEarlyLogs();
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
function setHMRUnavailableReason(reason) {
|
|
215
|
+
assert(hmrClient, 'Expected HMRClient.setup() call at startup.');
|
|
216
|
+
if (hmrUnavailableReason !== null) {
|
|
217
|
+
// Don't show more than one warning.
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
hmrUnavailableReason = reason;
|
|
221
|
+
// We only want to show a warning if Fast Refresh is on *and* if we ever
|
|
222
|
+
// previously managed to connect successfully. We don't want to show
|
|
223
|
+
// the warning to native engineers who use cached bundles without Metro.
|
|
224
|
+
if (hmrClient.isEnabled() && didConnect) {
|
|
225
|
+
console.warn(reason);
|
|
226
|
+
// (Not using the `warning` module to prevent a Buck cycle.)
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function registerBundleEntryPoints(client) {
|
|
230
|
+
if (hmrUnavailableReason != null) {
|
|
231
|
+
// "Bundle Splitting – Metro disconnected"
|
|
232
|
+
window.location.reload();
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
if (pendingEntryPoints.length > 0) {
|
|
236
|
+
client?.send(JSON.stringify({
|
|
237
|
+
type: 'register-entrypoints',
|
|
238
|
+
entryPoints: pendingEntryPoints,
|
|
239
|
+
}));
|
|
240
|
+
pendingEntryPoints.length = 0;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function flushEarlyLogs() {
|
|
244
|
+
try {
|
|
245
|
+
pendingLogs.forEach(([level, data]) => {
|
|
246
|
+
HMRClient.log(level, data);
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
finally {
|
|
250
|
+
pendingLogs.length = 0;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
function dismissRedbox() {
|
|
254
|
+
// TODO(EvanBacon): Error overlay for web.
|
|
255
|
+
}
|
|
256
|
+
function showCompileError() {
|
|
257
|
+
if (currentCompileErrorMessage === null) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
// Even if there is already a redbox, syntax errors are more important.
|
|
261
|
+
// Otherwise you risk seeing a stale runtime error while a syntax error is more recent.
|
|
262
|
+
dismissRedbox();
|
|
263
|
+
const message = currentCompileErrorMessage;
|
|
264
|
+
currentCompileErrorMessage = null;
|
|
265
|
+
const error = new Error(message);
|
|
266
|
+
// Symbolicating compile errors is wasted effort
|
|
267
|
+
// because the stack trace is meaningless:
|
|
268
|
+
// @ts-expect-error
|
|
269
|
+
error.preventSymbolication = true;
|
|
270
|
+
throw error;
|
|
271
|
+
}
|
|
272
|
+
exports.default = HMRClient;
|
|
273
|
+
//# sourceMappingURL=HMRClient.js.map
|
|
@@ -0,0 +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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I,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 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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HMRClient.native.d.ts","sourceRoot":"","sources":["../src/HMRClient.native.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,SAAS,KAAwD,CAAC;AAExE,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HMRClient.native.js","sourceRoot":"","sources":["../src/HMRClient.native.ts"],"names":[],"mappings":";;AAAA,MAAM,SAAS,GAAG,OAAO,CAAC,4CAA4C,CAAC,CAAC;AAExE,kBAAe,SAAS,CAAC","sourcesContent":["const HMRClient = require('react-native/Libraries/Utilities/HMRClient');\n\nexport default HMRClient;\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2023 650 Industries.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
declare function showMessage(message: string, type: 'load' | 'refresh'): void;
|
|
8
|
+
declare function hide(): void;
|
|
9
|
+
declare const _default: {
|
|
10
|
+
showMessage: typeof showMessage;
|
|
11
|
+
hide: typeof hide;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=LoadingView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingView.d.ts","sourceRoot":"","sources":["../src/LoadingView.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,iBAAS,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,QAI7D;AAED,iBAAS,IAAI,SAEZ;;;;;AAED,wBAGE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright © 2023 650 Industries.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const react_native_web_1 = require("react-native-web");
|
|
10
|
+
// Ensure events are sent so custom Fast Refresh views are shown.
|
|
11
|
+
function showMessage(message, type) {
|
|
12
|
+
react_native_web_1.DeviceEventEmitter.emit('devLoadingView:showMessage', {
|
|
13
|
+
message,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function hide() {
|
|
17
|
+
react_native_web_1.DeviceEventEmitter.emit('devLoadingView:hide', {});
|
|
18
|
+
}
|
|
19
|
+
exports.default = {
|
|
20
|
+
showMessage,
|
|
21
|
+
hide,
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=LoadingView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingView.js","sourceRoot":"","sources":["../src/LoadingView.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,uDAAsD;AAEtD,iEAAiE;AACjE,SAAS,WAAW,CAAC,OAAe,EAAE,IAAwB;IAC5D,qCAAkB,CAAC,IAAI,CAAC,4BAA4B,EAAE;QACpD,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAED,SAAS,IAAI;IACX,qCAAkB,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;AACrD,CAAC;AAED,kBAAe;IACb,WAAW;IACX,IAAI;CACL,CAAC","sourcesContent":["/**\n * Copyright © 2023 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 { DeviceEventEmitter } from 'react-native-web';\n\n// Ensure events are sent so custom Fast Refresh views are shown.\nfunction showMessage(message: string, type: 'load' | 'refresh') {\n DeviceEventEmitter.emit('devLoadingView:showMessage', {\n message,\n });\n}\n\nfunction hide() {\n DeviceEventEmitter.emit('devLoadingView:hide', {});\n}\n\nexport default {\n showMessage,\n hide,\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingView.native.d.ts","sourceRoot":"","sources":["../src/LoadingView.native.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,8CAA8C,CAAC;AAEvE,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const LoadingView_1 = __importDefault(require("react-native/Libraries/Utilities/LoadingView"));
|
|
7
|
+
exports.default = LoadingView_1.default;
|
|
8
|
+
//# sourceMappingURL=LoadingView.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingView.native.js","sourceRoot":"","sources":["../src/LoadingView.native.ts"],"names":[],"mappings":";;;;;AAAA,+FAAuE;AAEvE,kBAAe,qBAAW,CAAC","sourcesContent":["import LoadingView from 'react-native/Libraries/Utilities/LoadingView';\n\nexport default LoadingView;\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2022 650 Industries.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Must satisfy the requirements of the Metro bundler.
|
|
9
|
+
* https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0605-lazy-bundling.md#__loadbundleasync-in-metro
|
|
10
|
+
*/
|
|
11
|
+
type AsyncRequire = (path: string) => Promise<void>;
|
|
12
|
+
/** Create an `loadBundleAsync` function in the expected shape for Metro bundler. */
|
|
13
|
+
export declare function buildAsyncRequire(): AsyncRequire;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=buildAsyncRequire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildAsyncRequire.d.ts","sourceRoot":"","sources":["../../src/async-require/buildAsyncRequire.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;GAGG;AACH,KAAK,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEpD,oFAAoF;AACpF,wBAAgB,iBAAiB,IAAI,YAAY,CAiBhD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright © 2022 650 Industries.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.buildAsyncRequire = void 0;
|
|
10
|
+
const loadBundle_1 = require("./loadBundle");
|
|
11
|
+
/** Create an `loadBundleAsync` function in the expected shape for Metro bundler. */
|
|
12
|
+
function buildAsyncRequire() {
|
|
13
|
+
const cache = new Map();
|
|
14
|
+
return async function universal_loadBundleAsync(path) {
|
|
15
|
+
if (cache.has(path)) {
|
|
16
|
+
return cache.get(path);
|
|
17
|
+
}
|
|
18
|
+
const promise = (0, loadBundle_1.loadBundleAsync)(path).catch((error) => {
|
|
19
|
+
cache.delete(path);
|
|
20
|
+
throw error;
|
|
21
|
+
});
|
|
22
|
+
cache.set(path, promise);
|
|
23
|
+
return promise;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.buildAsyncRequire = buildAsyncRequire;
|
|
27
|
+
//# sourceMappingURL=buildAsyncRequire.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2022 650 Industries.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Given a path and some optional additional query parameters, create the dev server bundle URL.
|
|
9
|
+
* @param bundlePath like `/foobar`
|
|
10
|
+
* @param params like `{ platform: "web" }`
|
|
11
|
+
* @returns a URL like "/foobar.bundle?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null"
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildUrlForBundle(bundlePath: string): string;
|
|
14
|
+
//# sourceMappingURL=buildUrlForBundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildUrlForBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAI5D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright © 2022 650 Industries.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.buildUrlForBundle = void 0;
|
|
10
|
+
/**
|
|
11
|
+
* Given a path and some optional additional query parameters, create the dev server bundle URL.
|
|
12
|
+
* @param bundlePath like `/foobar`
|
|
13
|
+
* @param params like `{ platform: "web" }`
|
|
14
|
+
* @returns a URL like "/foobar.bundle?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null"
|
|
15
|
+
*/
|
|
16
|
+
function buildUrlForBundle(bundlePath) {
|
|
17
|
+
// NOTE(EvanBacon): This must come from the window origin (at least in dev mode).
|
|
18
|
+
// Otherwise Metro will crash from attempting to load a bundle that doesn't exist.
|
|
19
|
+
return '/' + bundlePath.replace(/^\/+/, '');
|
|
20
|
+
}
|
|
21
|
+
exports.buildUrlForBundle = buildUrlForBundle;
|
|
22
|
+
//# sourceMappingURL=buildUrlForBundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,iFAAiF;IACjF,kFAAkF;IAClF,OAAO,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC9C,CAAC;AAJD,8CAIC","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 // 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"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2022 650 Industries.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildUrlForBundle(bundlePath: string): string;
|
|
8
|
+
//# sourceMappingURL=buildUrlForBundle.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildUrlForBundle.native.d.ts","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.native.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAgB5D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright © 2022 650 Industries.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.buildUrlForBundle = void 0;
|
|
10
|
+
function buildUrlForBundle(bundlePath) {
|
|
11
|
+
if (process.env.NODE_ENV === 'production') {
|
|
12
|
+
if (typeof location !== 'undefined') {
|
|
13
|
+
return joinComponents(location.origin, bundlePath);
|
|
14
|
+
}
|
|
15
|
+
throw new Error('Unable to determine the production URL where additional JavaScript chunks are hosted because the global "location" variable is not defined.');
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
const getDevServer = require('../getDevServer')
|
|
19
|
+
.default;
|
|
20
|
+
const { url: serverUrl } = getDevServer();
|
|
21
|
+
return joinComponents(serverUrl, bundlePath);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.buildUrlForBundle = buildUrlForBundle;
|
|
25
|
+
function joinComponents(prefix, suffix) {
|
|
26
|
+
return prefix.replace(/\/+$/, '') + '/' + suffix.replace(/^\/+/, '');
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=buildUrlForBundle.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,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;AAhBD,8CAgBC;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 (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"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2022 650 Industries.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export declare function fetchAsync(url: string): Promise<{
|
|
8
|
+
body: string;
|
|
9
|
+
headers: Headers;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=fetchAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchAsync.d.ts","sourceRoot":"","sources":["../../src/async-require/fetchAsync.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAYzF"}
|