@expo/metro-runtime 2.1.5 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/error-overlay/ErrorOverlay.d.ts +0 -7
- package/build/error-overlay/ErrorOverlay.d.ts.map +1 -1
- package/build/error-overlay/ErrorOverlay.js +12 -2
- package/build/error-overlay/ErrorOverlay.js.map +1 -1
- package/build/location/install.native.js +3 -3
- package/build/location/install.native.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Evan Bacon.
|
|
3
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
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
1
|
import React from "react";
|
|
9
2
|
import { LogBoxLog, StackType } from "./Data/LogBoxLog";
|
|
10
3
|
export declare function LogBoxInspectorContainer(): JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorOverlay.d.ts","sourceRoot":"","sources":["../../src/error-overlay/ErrorOverlay.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ErrorOverlay.d.ts","sourceRoot":"","sources":["../../src/error-overlay/ErrorOverlay.tsx"],"names":[],"mappings":"AAQA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAIhE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAkBxD,wBAAgB,wBAAwB,uBAavC;AAED,wBAAgB,eAAe,CAAC,EAC9B,GAAG,EACH,gBAAgB,EAChB,IAAI,GACL,EAAE;IACD,GAAG,EAAE,SAAS,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,SAAS,EAAE,CAAC;CACnB,eAmEA;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,GACR,EAAE;IACD,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACpC,eAGA;AAED,wBAAgB,wBAAwB,CAAC,EACvC,GAAG,EACH,OAAO,GACR,EAAE;IACD,GAAG,EAAE,SAAS,CAAC;IACf,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACpC,eA2CA;;AAkBD,wBAAqE"}
|
|
@@ -31,6 +31,7 @@ exports.ErrorOverlayBodyContents = exports.ErrorOverlayBody = exports.LogBoxInsp
|
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
33
|
*/
|
|
34
|
+
const react_views_1 = require("@bacons/react-views");
|
|
34
35
|
const react_1 = __importStar(require("react"));
|
|
35
36
|
const react_native_1 = require("react-native");
|
|
36
37
|
const LogBoxData = __importStar(require("./Data/LogBoxData"));
|
|
@@ -105,7 +106,7 @@ function LogBoxInspector({ log, selectedLogIndex, logs, }) {
|
|
|
105
106
|
const _handleRetry = (0, react_1.useCallback)((type) => {
|
|
106
107
|
LogBoxData.retrySymbolicateLogNow(type, log);
|
|
107
108
|
}, [log]);
|
|
108
|
-
return (react_1.default.createElement(react_native_1.View, { style:
|
|
109
|
+
return (react_1.default.createElement(react_native_1.View, { style: styles.container },
|
|
109
110
|
react_1.default.createElement(LogBoxInspectorHeader_1.LogBoxInspectorHeader, { onSelectIndex: onChangeSelectedIndex, level: log.level }),
|
|
110
111
|
react_1.default.createElement(ErrorOverlayBody, { onRetry: _handleRetry }),
|
|
111
112
|
react_1.default.createElement(LogBoxInspectorFooter_1.LogBoxInspectorFooter, { onDismiss: onDismiss, onMinimize: onMinimize })));
|
|
@@ -137,11 +138,20 @@ function ErrorOverlayBodyContents({ log, onRetry, }) {
|
|
|
137
138
|
onRetry: onRetry.bind(onRetry, "component") })))));
|
|
138
139
|
}
|
|
139
140
|
exports.ErrorOverlayBodyContents = ErrorOverlayBodyContents;
|
|
140
|
-
const styles =
|
|
141
|
+
const styles = react_views_1.StyleSheet.create({
|
|
141
142
|
scrollBody: {
|
|
142
143
|
backgroundColor: LogBoxStyle.getBackgroundColor(1),
|
|
143
144
|
flex: 1,
|
|
144
145
|
},
|
|
146
|
+
container: {
|
|
147
|
+
top: 0,
|
|
148
|
+
left: 0,
|
|
149
|
+
bottom: 0,
|
|
150
|
+
right: 0,
|
|
151
|
+
zIndex: 999,
|
|
152
|
+
flex: 1,
|
|
153
|
+
position: "fixed",
|
|
154
|
+
},
|
|
145
155
|
});
|
|
146
156
|
exports.default = LogBoxData.withSubscription(LogBoxInspectorContainer);
|
|
147
157
|
//# sourceMappingURL=ErrorOverlay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorOverlay.js","sourceRoot":"","sources":["../../src/error-overlay/ErrorOverlay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,+CAAgE;AAChE,+CAAsE;AAEtE,8DAAgD;AAEhD,kDAA4D;AAC5D,8DAAgD;AAChD,iFAA8E;AAC9E,2EAA8F;AAC9F,2EAA8F;AAC9F,yFAAsF;AACtF,qFAAkF;AAElF,MAAM,gBAAgB,GAAG;IACvB,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,eAAe;IACtB,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE,cAAc;IACtB,MAAM,EAAE,kCAAkC;IAC1C,SAAS,EAAE,cAAc;CAC1B,CAAC;AAEF,SAAgB,wBAAwB;IACtC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,IAAA,oBAAO,GAAE,CAAC;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACnC,IAAI,GAAG,IAAI,IAAI,EAAE;QACf,OAAO,IAAI,CAAC;KACb;IACD,OAAO,CACL,8BAAC,eAAe,IACd,GAAG,EAAE,GAAG,EACR,gBAAgB,EAAE,gBAAgB,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AC,mDAAwB,IAAC,SAAS,EAAE,GAAG,CAAC,SAAS,GAAI;YACtD,8BAAC,uDAA0B,IACzB,IAAI,EAAC,OAAO;gBACZ,6CAA6C;gBAC7C,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,GACvC;YACD,CAAC,CAAC,CAAA,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,cAAc,0CAAE,MAAM,CAAA,IAAI,CAChC,8BAAC,uDAA0B,IACzB,IAAI,EAAC,WAAW;gBAChB,6CAA6C;gBAC7C,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,GAC3C,CACH,CACU,CACZ,CACJ,CAAC;AACJ,CAAC;AAjDD,4DAiDC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,UAAU,EAAE;QACV,eAAe,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAClD,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC;AAEH,kBAAe,UAAU,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport { Keyboard, ScrollView, StyleSheet, View } from \"react-native\";\n\nimport * as LogBoxData from \"./Data/LogBoxData\";\nimport { LogBoxLog, StackType } from \"./Data/LogBoxLog\";\nimport { useLogs, useSelectedLog } from \"./Data/LogContext\";\nimport * as LogBoxStyle from \"./UI/LogBoxStyle\";\nimport { LogBoxInspectorCodeFrame } from \"./overlay/LogBoxInspectorCodeFrame\";\nimport { LogBoxInspectorFooter as ErrorOverlayFooter } from \"./overlay/LogBoxInspectorFooter\";\nimport { LogBoxInspectorHeader as ErrorOverlayHeader } from \"./overlay/LogBoxInspectorHeader\";\nimport { LogBoxInspectorMessageHeader } from \"./overlay/LogBoxInspectorMessageHeader\";\nimport { LogBoxInspectorStackFrames } from \"./overlay/LogBoxInspectorStackFrames\";\n\nconst HEADER_TITLE_MAP = {\n warn: \"Console Warning\",\n error: \"Console Error\",\n fatal: \"Uncaught Error\",\n syntax: \"Syntax Error\",\n static: \"Static Rendering Error (Node.js)\",\n component: \"Render Error\",\n};\n\nexport function LogBoxInspectorContainer() {\n const { selectedLogIndex, logs } = useLogs();\n const log = logs[selectedLogIndex];\n if (log == null) {\n return null;\n }\n return (\n <LogBoxInspector\n log={log}\n selectedLogIndex={selectedLogIndex}\n logs={logs}\n />\n );\n}\n\nexport function LogBoxInspector({\n log,\n selectedLogIndex,\n logs,\n}: {\n log: LogBoxLog;\n selectedLogIndex: number;\n logs: LogBoxLog[];\n}) {\n const onDismiss = useCallback((): void => {\n // Here we handle the cases when the log is dismissed and it\n // was either the last log, or when the current index\n // is now outside the bounds of the log array.\n const logsArray = Array.from(logs);\n if (selectedLogIndex != null) {\n if (logsArray.length - 1 <= 0) {\n LogBoxData.setSelectedLog(-1);\n } else if (selectedLogIndex >= logsArray.length - 1) {\n LogBoxData.setSelectedLog(selectedLogIndex - 1);\n }\n\n LogBoxData.dismiss(logsArray[selectedLogIndex]);\n }\n }, [selectedLogIndex]);\n\n const onMinimize = useCallback((): void => {\n LogBoxData.setSelectedLog(-1);\n }, []);\n\n const onChangeSelectedIndex = useCallback((index: number): void => {\n LogBoxData.setSelectedLog(index);\n }, []);\n\n useEffect(() => {\n if (log) {\n LogBoxData.symbolicateLogNow(\"stack\", log);\n LogBoxData.symbolicateLogNow(\"component\", log);\n }\n }, [log]);\n\n useEffect(() => {\n // Optimistically symbolicate the last and next logs.\n if (logs.length > 1) {\n const selected = selectedLogIndex;\n const lastIndex = logs.length - 1;\n const prevIndex = selected - 1 < 0 ? lastIndex : selected - 1;\n const nextIndex = selected + 1 > lastIndex ? 0 : selected + 1;\n for (const type of [\"component\", \"stack\"] as const) {\n LogBoxData.symbolicateLogLazy(type, logs[prevIndex]);\n LogBoxData.symbolicateLogLazy(type, logs[nextIndex]);\n }\n }\n }, [logs, selectedLogIndex]);\n\n useEffect(() => {\n Keyboard.dismiss();\n }, []);\n\n const _handleRetry = useCallback(\n (type: StackType) => {\n LogBoxData.retrySymbolicateLogNow(type, log);\n },\n [log]\n );\n\n return (\n <View style={[StyleSheet.absoluteFill, { flex: 1 }]}>\n <ErrorOverlayHeader\n onSelectIndex={onChangeSelectedIndex}\n level={log.level}\n />\n <ErrorOverlayBody onRetry={_handleRetry} />\n <ErrorOverlayFooter onDismiss={onDismiss} onMinimize={onMinimize} />\n </View>\n );\n}\n\nexport function ErrorOverlayBody({\n onRetry,\n}: {\n onRetry: (type: StackType) => void;\n}) {\n const log = useSelectedLog();\n return <ErrorOverlayBodyContents log={log} onRetry={onRetry} />;\n}\n\nexport function ErrorOverlayBodyContents({\n log,\n onRetry,\n}: {\n log: LogBoxLog;\n onRetry: (type: StackType) => void;\n}) {\n const [collapsed, setCollapsed] = useState(true);\n\n useEffect(() => {\n setCollapsed(true);\n }, [log]);\n\n const headerTitle =\n HEADER_TITLE_MAP[log.isComponentError ? \"component\" : log.level] ??\n log.type;\n\n const header = (\n <LogBoxInspectorMessageHeader\n collapsed={collapsed}\n onPress={() => setCollapsed(!collapsed)}\n message={log.message}\n level={log.level}\n title={headerTitle}\n />\n );\n\n return (\n <>\n {collapsed && header}\n <ScrollView style={styles.scrollBody}>\n {!collapsed && header}\n\n <LogBoxInspectorCodeFrame codeFrame={log.codeFrame} />\n <LogBoxInspectorStackFrames\n type=\"stack\"\n // eslint-disable-next-line react/jsx-no-bind\n onRetry={onRetry.bind(onRetry, \"stack\")}\n />\n {!!log?.componentStack?.length && (\n <LogBoxInspectorStackFrames\n type=\"component\"\n // eslint-disable-next-line react/jsx-no-bind\n onRetry={onRetry.bind(onRetry, \"component\")}\n />\n )}\n </ScrollView>\n </>\n );\n}\n\nconst styles = StyleSheet.create({\n scrollBody: {\n backgroundColor: LogBoxStyle.getBackgroundColor(1),\n flex: 1,\n },\n});\n\nexport default LogBoxData.withSubscription(LogBoxInspectorContainer);\n"]}
|
|
1
|
+
{"version":3,"file":"ErrorOverlay.js","sourceRoot":"","sources":["../../src/error-overlay/ErrorOverlay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,qDAAiD;AACjD,+CAAgE;AAChE,+CAA0D;AAE1D,8DAAgD;AAEhD,kDAA4D;AAC5D,8DAAgD;AAChD,iFAA8E;AAC9E,2EAA8F;AAC9F,2EAA8F;AAC9F,yFAAsF;AACtF,qFAAkF;AAElF,MAAM,gBAAgB,GAAG;IACvB,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,eAAe;IACtB,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE,cAAc;IACtB,MAAM,EAAE,kCAAkC;IAC1C,SAAS,EAAE,cAAc;CAC1B,CAAC;AAEF,SAAgB,wBAAwB;IACtC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,IAAA,oBAAO,GAAE,CAAC;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACnC,IAAI,GAAG,IAAI,IAAI,EAAE;QACf,OAAO,IAAI,CAAC;KACb;IACD,OAAO,CACL,8BAAC,eAAe,IACd,GAAG,EAAE,GAAG,EACR,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,IAAI,GACV,CACH,CAAC;AACJ,CAAC;AAbD,4DAaC;AAED,SAAgB,eAAe,CAAC,EAC9B,GAAG,EACH,gBAAgB,EAChB,IAAI,GAKL;IACC,MAAM,SAAS,GAAG,IAAA,mBAAW,EAAC,GAAS,EAAE;QACvC,4DAA4D;QAC5D,qDAAqD;QACrD,8CAA8C;QAC9C,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,gBAAgB,IAAI,IA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AAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,GAC3C,CACH,CACU,CACZ,CACJ,CAAC;AACJ,CAAC;AAjDD,4DAiDC;AAED,MAAM,MAAM,GAAG,wBAAU,CAAC,MAAM,CAAC;IAC/B,UAAU,EAAE;QACV,eAAe,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAClD,IAAI,EAAE,CAAC;KACR;IACD,SAAS,EAAE;QACT,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,GAAG;QACX,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,OAAO;KAClB;CACF,CAAC,CAAC;AAEH,kBAAe,UAAU,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { StyleSheet } from \"@bacons/react-views\";\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport { Keyboard, ScrollView, View } from \"react-native\";\n\nimport * as LogBoxData from \"./Data/LogBoxData\";\nimport { LogBoxLog, StackType } from \"./Data/LogBoxLog\";\nimport { useLogs, useSelectedLog } from \"./Data/LogContext\";\nimport * as LogBoxStyle from \"./UI/LogBoxStyle\";\nimport { LogBoxInspectorCodeFrame } from \"./overlay/LogBoxInspectorCodeFrame\";\nimport { LogBoxInspectorFooter as ErrorOverlayFooter } from \"./overlay/LogBoxInspectorFooter\";\nimport { LogBoxInspectorHeader as ErrorOverlayHeader } from \"./overlay/LogBoxInspectorHeader\";\nimport { LogBoxInspectorMessageHeader } from \"./overlay/LogBoxInspectorMessageHeader\";\nimport { LogBoxInspectorStackFrames } from \"./overlay/LogBoxInspectorStackFrames\";\n\nconst HEADER_TITLE_MAP = {\n warn: \"Console Warning\",\n error: \"Console Error\",\n fatal: \"Uncaught Error\",\n syntax: \"Syntax Error\",\n static: \"Static Rendering Error (Node.js)\",\n component: \"Render Error\",\n};\n\nexport function LogBoxInspectorContainer() {\n const { selectedLogIndex, logs } = useLogs();\n const log = logs[selectedLogIndex];\n if (log == null) {\n return null;\n }\n return (\n <LogBoxInspector\n log={log}\n selectedLogIndex={selectedLogIndex}\n logs={logs}\n />\n );\n}\n\nexport function LogBoxInspector({\n log,\n selectedLogIndex,\n logs,\n}: {\n log: LogBoxLog;\n selectedLogIndex: number;\n logs: LogBoxLog[];\n}) {\n const onDismiss = useCallback((): void => {\n // Here we handle the cases when the log is dismissed and it\n // was either the last log, or when the current index\n // is now outside the bounds of the log array.\n const logsArray = Array.from(logs);\n if (selectedLogIndex != null) {\n if (logsArray.length - 1 <= 0) {\n LogBoxData.setSelectedLog(-1);\n } else if (selectedLogIndex >= logsArray.length - 1) {\n LogBoxData.setSelectedLog(selectedLogIndex - 1);\n }\n\n LogBoxData.dismiss(logsArray[selectedLogIndex]);\n }\n }, [selectedLogIndex]);\n\n const onMinimize = useCallback((): void => {\n LogBoxData.setSelectedLog(-1);\n }, []);\n\n const onChangeSelectedIndex = useCallback((index: number): void => {\n LogBoxData.setSelectedLog(index);\n }, []);\n\n useEffect(() => {\n if (log) {\n LogBoxData.symbolicateLogNow(\"stack\", log);\n LogBoxData.symbolicateLogNow(\"component\", log);\n }\n }, [log]);\n\n useEffect(() => {\n // Optimistically symbolicate the last and next logs.\n if (logs.length > 1) {\n const selected = selectedLogIndex;\n const lastIndex = logs.length - 1;\n const prevIndex = selected - 1 < 0 ? lastIndex : selected - 1;\n const nextIndex = selected + 1 > lastIndex ? 0 : selected + 1;\n for (const type of [\"component\", \"stack\"] as const) {\n LogBoxData.symbolicateLogLazy(type, logs[prevIndex]);\n LogBoxData.symbolicateLogLazy(type, logs[nextIndex]);\n }\n }\n }, [logs, selectedLogIndex]);\n\n useEffect(() => {\n Keyboard.dismiss();\n }, []);\n\n const _handleRetry = useCallback(\n (type: StackType) => {\n LogBoxData.retrySymbolicateLogNow(type, log);\n },\n [log]\n );\n\n return (\n <View style={styles.container}>\n <ErrorOverlayHeader\n onSelectIndex={onChangeSelectedIndex}\n level={log.level}\n />\n <ErrorOverlayBody onRetry={_handleRetry} />\n <ErrorOverlayFooter onDismiss={onDismiss} onMinimize={onMinimize} />\n </View>\n );\n}\n\nexport function ErrorOverlayBody({\n onRetry,\n}: {\n onRetry: (type: StackType) => void;\n}) {\n const log = useSelectedLog();\n return <ErrorOverlayBodyContents log={log} onRetry={onRetry} />;\n}\n\nexport function ErrorOverlayBodyContents({\n log,\n onRetry,\n}: {\n log: LogBoxLog;\n onRetry: (type: StackType) => void;\n}) {\n const [collapsed, setCollapsed] = useState(true);\n\n useEffect(() => {\n setCollapsed(true);\n }, [log]);\n\n const headerTitle =\n HEADER_TITLE_MAP[log.isComponentError ? \"component\" : log.level] ??\n log.type;\n\n const header = (\n <LogBoxInspectorMessageHeader\n collapsed={collapsed}\n onPress={() => setCollapsed(!collapsed)}\n message={log.message}\n level={log.level}\n title={headerTitle}\n />\n );\n\n return (\n <>\n {collapsed && header}\n <ScrollView style={styles.scrollBody}>\n {!collapsed && header}\n\n <LogBoxInspectorCodeFrame codeFrame={log.codeFrame} />\n <LogBoxInspectorStackFrames\n type=\"stack\"\n // eslint-disable-next-line react/jsx-no-bind\n onRetry={onRetry.bind(onRetry, \"stack\")}\n />\n {!!log?.componentStack?.length && (\n <LogBoxInspectorStackFrames\n type=\"component\"\n // eslint-disable-next-line react/jsx-no-bind\n onRetry={onRetry.bind(onRetry, \"component\")}\n />\n )}\n </ScrollView>\n </>\n );\n}\n\nconst styles = StyleSheet.create({\n scrollBody: {\n backgroundColor: LogBoxStyle.getBackgroundColor(1),\n flex: 1,\n },\n container: {\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n zIndex: 999,\n flex: 1,\n position: \"fixed\",\n },\n});\n\nexport default LogBoxData.withSubscription(LogBoxInspectorContainer);\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
var _a, _b
|
|
5
|
+
var _a, _b;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
// This MUST be first to ensure that `fetch` is defined in the React Native environment.
|
|
8
8
|
require("react-native/Libraries/Core/InitializeCore");
|
|
@@ -11,7 +11,7 @@ const url_parse_1 = __importDefault(require("url-parse"));
|
|
|
11
11
|
const getDevServer_1 = __importDefault(require("../getDevServer"));
|
|
12
12
|
const Location_1 = require("./Location");
|
|
13
13
|
let hasWarned = false;
|
|
14
|
-
const manifest =
|
|
14
|
+
const manifest = expo_constants_1.default.expoConfig;
|
|
15
15
|
// Add a development warning for fetch requests with relative paths
|
|
16
16
|
// to ensure developers are aware of the need to configure a production
|
|
17
17
|
// base URL in the Expo config (app.json) under `expo.extra.router.origin`.
|
|
@@ -68,7 +68,7 @@ function wrapFetchWithWindowLocation(fetch) {
|
|
|
68
68
|
_fetch.__EXPO_BASE_URL_POLYFILLED = true;
|
|
69
69
|
return _fetch;
|
|
70
70
|
}
|
|
71
|
-
if (((
|
|
71
|
+
if (((_b = (_a = manifest === null || manifest === void 0 ? void 0 : manifest.extra) === null || _a === void 0 ? void 0 : _a.router) === null || _b === void 0 ? void 0 : _b.origin) !== false) {
|
|
72
72
|
// Polyfill window.location in native runtimes.
|
|
73
73
|
if (typeof window !== "undefined" && !window.location) {
|
|
74
74
|
const url = getBaseUrl();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.native.js","sourceRoot":"","sources":["../../src/location/install.native.ts"],"names":[],"mappings":";;;;;;AAAA,wFAAwF;AACxF,sDAAoD;AAEpD,oEAAuC;AACvC,0DAA4B;AAE5B,mEAA2C;AAC3C,yCAAsD;AAEtD,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,MAAM,QAAQ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G,IAAI,CAAC;IAEzC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,IAAI,CAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,0CAAE,MAAM,0CAAE,MAAM,MAAK,KAAK,EAAE;IAC7C,+CAA+C;IAC/C,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;QACrD,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;QACzB,IAAI,GAAG,EAAE;YACP,IAAA,0BAAe,EAAC,GAAG,CAAC,CAAC;YACrB,IAAA,kBAAO,GAAE,CAAC;SACX;KACF;IACD,iDAAiD;IACjD,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE;QACrC,KAAK,EAAE,2BAA2B,CAAC,KAAK,CAAC;KAC1C,CAAC,CAAC;CACJ","sourcesContent":["// This MUST be first to ensure that `fetch` is defined in the React Native environment.\nimport \"react-native/Libraries/Core/InitializeCore\";\n\nimport Constants from \"expo-constants\";\nimport URL from \"url-parse\";\n\nimport getDevServer from \"../getDevServer\";\nimport { install, setLocationHref } from \"./Location\";\n\nlet hasWarned = false;\n\nconst manifest = Constants.expoConfig as Record<string, any> | null;\n\n// Add a development warning for fetch requests with relative paths\n// to ensure developers are aware of the need to configure a production\n// base URL in the Expo config (app.json) under `expo.extra.router.origin`.\nfunction warnProductionOriginNotConfigured(requestUrl: string) {\n if (hasWarned) {\n return;\n }\n hasWarned = true;\n if (!manifest?.extra?.router?.origin) {\n console.warn(\n `The relative fetch request \"${requestUrl}\" will not work in production until the Expo Router Config Plugin (app.json) is configured with the \\`origin\\` prop set to the base URL of your web server, e.g. \\`{ plugins: [[\"expo-router\", { origin: \"...\" }]] }\\`. [Learn more](https://expo.github.io/router/docs/lab/runtime-location)`\n );\n }\n}\n\n// TODO: This would be better if native and tied as close to the JS engine as possible, i.e. it should\n// reflect the exact location of the JS file that was executed.\nfunction getBaseUrl() {\n if (process.env.NODE_ENV !== \"production\") {\n // e.g. http://localhost:19006\n return getDevServer().url?.replace(/\\/$/, \"\");\n }\n\n // TODO: Make it official by moving out of `extra`\n const productionBaseUrl = manifest?.extra?.router?.origin;\n\n if (!productionBaseUrl) {\n return null;\n }\n\n // Ensure no trailing slash\n return productionBaseUrl?.replace(/\\/$/, \"\");\n}\n\nfunction wrapFetchWithWindowLocation(\n fetch: Function & { __EXPO_BASE_URL_POLYFILLED?: boolean }\n) {\n if (fetch.__EXPO_BASE_URL_POLYFILLED) {\n return fetch;\n }\n\n const _fetch = (...props: any[]) => {\n if (props[0] && typeof props[0] === \"string\" && props[0].startsWith(\"/\")) {\n if (process.env.NODE_ENV !== \"production\") {\n warnProductionOriginNotConfigured(props[0]);\n }\n\n props[0] = new URL(props[0], window.location?.origin).toString();\n } else if (props[0] && typeof props[0] === \"object\") {\n if (\n props[0].url &&\n typeof props[0].url === \"string\" &&\n props[0].url.startsWith(\"/\")\n ) {\n if (process.env.NODE_ENV !== \"production\") {\n warnProductionOriginNotConfigured(props[0]);\n }\n\n props[0].url = new URL(\n props[0].url,\n window.location?.origin\n ).toString();\n }\n }\n return fetch(...props);\n };\n\n _fetch.__EXPO_BASE_URL_POLYFILLED = true;\n\n return _fetch;\n}\n\nif (manifest?.extra?.router?.origin !== false) {\n // Polyfill window.location in native runtimes.\n if (typeof window !== \"undefined\" && !window.location) {\n const url = getBaseUrl();\n if (url) {\n setLocationHref(url);\n install();\n }\n }\n // Polyfill native fetch to support relative URLs\n Object.defineProperty(global, \"fetch\", {\n value: wrapFetchWithWindowLocation(fetch),\n });\n}\n"]}
|
package/package.json
CHANGED