@expo/cli 0.15.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +10 -3
- package/build/bin/cli.map +1 -1
- package/build/src/api/user/actions.js +1 -1
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/export/createMetadataJson.js +2 -1
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +50 -3
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/xcodeCompilerLogger.js +97 -0
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -0
- package/build/src/export/exportApp.js +90 -103
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +18 -23
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportAsync.js +1 -1
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/exportHermes.js +0 -90
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +137 -108
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +12 -4
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +74 -49
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +1 -1
- package/build/src/export/metroAssetLocalPath.js.map +1 -1
- package/build/src/export/persistMetroAssets.js +28 -17
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/publicFolder.js +7 -0
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/saveAssets.js +176 -12
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/writeContents.js +8 -107
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/installAsync.js +29 -10
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +9 -2
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/run/hints.js +4 -0
- package/build/src/run/hints.js.map +1 -1
- package/build/src/run/index.js +101 -0
- package/build/src/run/index.js.map +1 -0
- package/build/src/start/doctor/dependencies/bundledNativeModules.js +2 -2
- package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +10 -3
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/resolvePackages.js +66 -0
- package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -0
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +2 -30
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +24 -8
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +8 -4
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +39 -16
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +6 -2
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +18 -1
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/bundleApiRoutes.js +3 -2
- package/build/src/start/server/metro/bundleApiRoutes.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +22 -5
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
- package/build/src/start/server/metro/createJResolver.js +5 -2
- package/build/src/start/server/metro/createJResolver.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js +2 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/{inspector-proxy/device.js → debugging/InspectorDevice.js} +8 -38
- package/build/src/start/server/metro/debugging/InspectorDevice.js.map +1 -0
- package/build/src/start/server/metro/debugging/InspectorProxy.js +116 -0
- package/build/src/start/server/metro/debugging/InspectorProxy.js.map +1 -0
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +45 -0
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/NetworkResponse.js +3 -4
- package/build/src/start/server/metro/debugging/inspectorHandlers/NetworkResponse.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/PageReload.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerGetPossibleBreakpoints.js +2 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerScriptParsed.js +3 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerScriptParsed.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerSetBreakpointByUrl.js +3 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerSetBreakpointByUrl.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeRuntimeCallFunctionOn.js +2 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeCallFunctionOn.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeRuntimeGetProperties.js +5 -4
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeGetProperties.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/types.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js +20 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js.map +1 -0
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +10 -5
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +3 -2
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/router.js +1 -5
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +0 -19
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +20 -4
- package/build/src/start/server/metro/serializeHtml.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +48 -85
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +12 -5
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +22 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +12 -12
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +62 -9
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/route.test.js +11 -3
- package/build/src/start/server/type-generation/__typetests__/route.test.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +6 -4
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/codesigning.js +11 -1
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/env.js +7 -1
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js +3 -11
- package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -1
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +22 -12
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -1
- package/package.json +10 -10
- package/static/template/index.html +14 -95
- package/build/src/export/printBundleSizes.js +0 -101
- package/build/src/export/printBundleSizes.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/device.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/NetworkResponse.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/PageReload.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerScriptParsed.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerSetBreakpointByUrl.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeGetProperties.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/types.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/utils.js +0 -11
- package/build/src/start/server/metro/inspector-proxy/handlers/utils.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/index.js +0 -30
- package/build/src/start/server/metro/inspector-proxy/index.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/proxy.js +0 -169
- package/build/src/start/server/metro/inspector-proxy/proxy.js.map +0 -1
- /package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/PageReload.js +0 -0
- /package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/types.js +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -39,18 +39,18 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@babel/runtime": "^7.20.0",
|
|
41
41
|
"@expo/code-signing-certificates": "0.0.5",
|
|
42
|
-
"@expo/config": "~8.
|
|
43
|
-
"@expo/config-plugins": "~7.
|
|
42
|
+
"@expo/config": "~8.5.0",
|
|
43
|
+
"@expo/config-plugins": "~7.8.0",
|
|
44
44
|
"@expo/devcert": "^1.0.0",
|
|
45
|
-
"@expo/env": "~0.
|
|
45
|
+
"@expo/env": "~0.2.0",
|
|
46
46
|
"@expo/json-file": "^8.2.37",
|
|
47
|
-
"@expo/metro-config": "~0.
|
|
47
|
+
"@expo/metro-config": "~0.16.0",
|
|
48
48
|
"@expo/osascript": "^2.0.31",
|
|
49
49
|
"@expo/package-manager": "^1.1.1",
|
|
50
|
-
"@expo/plist": "^0.0
|
|
51
|
-
"@expo/prebuild-config": "6.
|
|
50
|
+
"@expo/plist": "^0.1.0",
|
|
51
|
+
"@expo/prebuild-config": "6.7.0",
|
|
52
52
|
"@expo/rudder-sdk-node": "1.1.1",
|
|
53
|
-
"@expo/server": "^0.
|
|
53
|
+
"@expo/server": "^0.3.0",
|
|
54
54
|
"@expo/spawn-async": "1.5.0",
|
|
55
55
|
"@expo/xcpretty": "^4.2.1",
|
|
56
56
|
"@urql/core": "2.3.6",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
117
|
"@expo/multipart-body-parser": "^1.0.0",
|
|
118
|
-
"@expo/ngrok": "4.1.
|
|
118
|
+
"@expo/ngrok": "4.1.3",
|
|
119
119
|
"@expo/webpack-config": "^0.17.4",
|
|
120
120
|
"@graphql-codegen/cli": "2.16.3",
|
|
121
121
|
"@graphql-codegen/typescript": "2.8.7",
|
|
@@ -159,5 +159,5 @@
|
|
|
159
159
|
"tree-kill": "^1.2.2",
|
|
160
160
|
"tsd": "^0.28.1"
|
|
161
161
|
},
|
|
162
|
-
"gitHead": "
|
|
162
|
+
"gitHead": "298f6e97c5eda609a25e87a7951540480119a403"
|
|
163
163
|
}
|
|
@@ -3,113 +3,32 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
|
|
6
|
-
|
|
7
|
-
This viewport works for phones with notches.
|
|
8
|
-
It's optimized for gestures by disabling global zoom.
|
|
9
|
-
-->
|
|
10
|
-
<meta
|
|
11
|
-
name="viewport"
|
|
12
|
-
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1.00001, viewport-fit=cover"
|
|
13
|
-
/>
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
|
14
7
|
<title>%WEB_TITLE%</title>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/exports/StyleSheet/initialRules.js
|
|
19
|
-
*/
|
|
8
|
+
<!-- The `react-native-web` recommended style reset: https://necolas.github.io/react-native-web/docs/setup/#root-element -->
|
|
9
|
+
<style id="expo-reset">
|
|
10
|
+
/* These styles make the body full-height */
|
|
20
11
|
html,
|
|
21
|
-
body
|
|
22
|
-
|
|
23
|
-
width: 100%;
|
|
24
|
-
/* To smooth any scrolling behavior */
|
|
25
|
-
-webkit-overflow-scrolling: touch;
|
|
26
|
-
margin: 0px;
|
|
27
|
-
padding: 0px;
|
|
28
|
-
/* Allows content to fill the viewport and go beyond the bottom */
|
|
29
|
-
min-height: 100%;
|
|
12
|
+
body {
|
|
13
|
+
height: 100%;
|
|
30
14
|
}
|
|
15
|
+
/* These styles disable body scrolling if you are using <ScrollView> */
|
|
16
|
+
body {
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
}
|
|
19
|
+
/* These styles make the root element full-height */
|
|
31
20
|
#root {
|
|
32
|
-
flex-shrink: 0;
|
|
33
|
-
flex-basis: auto;
|
|
34
|
-
flex-grow: 1;
|
|
35
21
|
display: flex;
|
|
22
|
+
height: 100%;
|
|
36
23
|
flex: 1;
|
|
37
24
|
}
|
|
38
|
-
|
|
39
|
-
html {
|
|
40
|
-
scroll-behavior: smooth;
|
|
41
|
-
/* Prevent text size change on orientation change https://gist.github.com/tfausak/2222823#file-ios-8-web-app-html-L138 */
|
|
42
|
-
-webkit-text-size-adjust: 100%;
|
|
43
|
-
height: calc(100% + env(safe-area-inset-top));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
body {
|
|
47
|
-
display: flex;
|
|
48
|
-
/* Allows you to scroll below the viewport; default value is visible */
|
|
49
|
-
overflow-y: auto;
|
|
50
|
-
overscroll-behavior-y: none;
|
|
51
|
-
text-rendering: optimizeLegibility;
|
|
52
|
-
-webkit-font-smoothing: antialiased;
|
|
53
|
-
-moz-osx-font-smoothing: grayscale;
|
|
54
|
-
-ms-overflow-style: scrollbar;
|
|
55
|
-
}
|
|
56
|
-
/* Enable for apps that support dark-theme */
|
|
57
|
-
/*@media (prefers-color-scheme: dark) {
|
|
58
|
-
body {
|
|
59
|
-
background-color: black;
|
|
60
|
-
}
|
|
61
|
-
}*/
|
|
62
25
|
</style>
|
|
63
26
|
</head>
|
|
64
27
|
|
|
65
28
|
<body>
|
|
66
|
-
<!--
|
|
67
|
-
A generic no script element with a reload button and a message.
|
|
68
|
-
Feel free to customize this however you'd like.
|
|
69
|
-
-->
|
|
29
|
+
<!-- Use static rendering with Expo Router to support running without JavaScript. -->
|
|
70
30
|
<noscript>
|
|
71
|
-
|
|
72
|
-
action=""
|
|
73
|
-
style="
|
|
74
|
-
background-color: #fff;
|
|
75
|
-
position: fixed;
|
|
76
|
-
top: 0;
|
|
77
|
-
left: 0;
|
|
78
|
-
right: 0;
|
|
79
|
-
bottom: 0;
|
|
80
|
-
z-index: 9999;
|
|
81
|
-
"
|
|
82
|
-
>
|
|
83
|
-
<div
|
|
84
|
-
style="
|
|
85
|
-
font-size: 18px;
|
|
86
|
-
font-family: Helvetica, sans-serif;
|
|
87
|
-
line-height: 24px;
|
|
88
|
-
margin: 10%;
|
|
89
|
-
width: 80%;
|
|
90
|
-
"
|
|
91
|
-
>
|
|
92
|
-
<p>Oh no! It looks like JavaScript is not enabled in your browser.</p>
|
|
93
|
-
<p style="margin: 20px 0;">
|
|
94
|
-
<button
|
|
95
|
-
type="submit"
|
|
96
|
-
style="
|
|
97
|
-
background-color: #4630eb;
|
|
98
|
-
border-radius: 100px;
|
|
99
|
-
border: none;
|
|
100
|
-
box-shadow: none;
|
|
101
|
-
color: #fff;
|
|
102
|
-
cursor: pointer;
|
|
103
|
-
font-weight: bold;
|
|
104
|
-
line-height: 20px;
|
|
105
|
-
padding: 6px 16px;
|
|
106
|
-
"
|
|
107
|
-
>
|
|
108
|
-
Reload
|
|
109
|
-
</button>
|
|
110
|
-
</p>
|
|
111
|
-
</div>
|
|
112
|
-
</form>
|
|
31
|
+
You need to enable JavaScript to run this app.
|
|
113
32
|
</noscript>
|
|
114
33
|
<!-- The root element for your Expo app. -->
|
|
115
34
|
<div id="root"></div>
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
exports.printBundleSizes = printBundleSizes;
|
|
6
|
-
exports.createFilesTable = createFilesTable;
|
|
7
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
-
var _prettyBytes = _interopRequireDefault(require("pretty-bytes"));
|
|
9
|
-
var _textTable = _interopRequireDefault(require("text-table"));
|
|
10
|
-
var Log = _interopRequireWildcard(require("../log"));
|
|
11
|
-
var _ansi = require("../utils/ansi");
|
|
12
|
-
var _link = require("../utils/link");
|
|
13
|
-
function _interopRequireDefault(obj) {
|
|
14
|
-
return obj && obj.__esModule ? obj : {
|
|
15
|
-
default: obj
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function _interopRequireWildcard(obj) {
|
|
19
|
-
if (obj && obj.__esModule) {
|
|
20
|
-
return obj;
|
|
21
|
-
} else {
|
|
22
|
-
var newObj = {};
|
|
23
|
-
if (obj != null) {
|
|
24
|
-
for(var key in obj){
|
|
25
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
26
|
-
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
27
|
-
if (desc.get || desc.set) {
|
|
28
|
-
Object.defineProperty(newObj, key, desc);
|
|
29
|
-
} else {
|
|
30
|
-
newObj[key] = obj[key];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
newObj.default = obj;
|
|
36
|
-
return newObj;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function printBundleSizes(bundles) {
|
|
40
|
-
const files = [];
|
|
41
|
-
for (const [platform, bundleOutput] of Object.entries(bundles)){
|
|
42
|
-
if (bundleOutput.hermesBytecodeBundle) {
|
|
43
|
-
files.push([
|
|
44
|
-
_chalk.default.bold(`index.${platform}.hbc`),
|
|
45
|
-
bundleOutput.hermesBytecodeBundle
|
|
46
|
-
]);
|
|
47
|
-
} else if (bundleOutput.code) {
|
|
48
|
-
files.push([
|
|
49
|
-
_chalk.default.bold(`index.${platform}.js`),
|
|
50
|
-
bundleOutput.code
|
|
51
|
-
]);
|
|
52
|
-
}
|
|
53
|
-
if (bundleOutput.hermesSourcemap) {
|
|
54
|
-
files.push([
|
|
55
|
-
_chalk.default.dim(`index.${platform}.hbc.map`),
|
|
56
|
-
bundleOutput.hermesSourcemap
|
|
57
|
-
]);
|
|
58
|
-
} else if (bundleOutput.map) {
|
|
59
|
-
files.push([
|
|
60
|
-
_chalk.default.dim(`index.${platform}.js.map`),
|
|
61
|
-
bundleOutput.map
|
|
62
|
-
]);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
Log.log();
|
|
66
|
-
Log.log(createFilesTable(files.sort((a, b)=>a[1].length - b[1].length
|
|
67
|
-
)));
|
|
68
|
-
Log.log();
|
|
69
|
-
Log.log(_chalk.default`💡 JavaScript bundle sizes affect startup time. {dim ${(0, _link).learnMore(`https://expo.fyi/javascript-bundle-sizes`)}}`);
|
|
70
|
-
Log.log();
|
|
71
|
-
return files;
|
|
72
|
-
}
|
|
73
|
-
function createFilesTable(files) {
|
|
74
|
-
const tableData = files.map((item, index)=>{
|
|
75
|
-
const fileBranch = index === 0 ? files.length > 1 ? "\u250C" : "\u2500" : index === files.length - 1 ? "\u2514" : "\u251C";
|
|
76
|
-
return [
|
|
77
|
-
`${fileBranch} ${item[0]}`,
|
|
78
|
-
(0, _prettyBytes).default(Buffer.byteLength(item[1], "utf8"))
|
|
79
|
-
];
|
|
80
|
-
});
|
|
81
|
-
var ref;
|
|
82
|
-
return (0, _textTable).default([
|
|
83
|
-
[
|
|
84
|
-
"Bundle",
|
|
85
|
-
"Size"
|
|
86
|
-
].map((v)=>_chalk.default.underline(v)
|
|
87
|
-
),
|
|
88
|
-
...tableData
|
|
89
|
-
], {
|
|
90
|
-
align: [
|
|
91
|
-
"l",
|
|
92
|
-
"r"
|
|
93
|
-
],
|
|
94
|
-
stringLength: (str)=>{
|
|
95
|
-
var ref1;
|
|
96
|
-
return (ref = (ref1 = (0, _ansi).stripAnsi(str)) == null ? void 0 : ref1.length) != null ? ref : 0;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
//# sourceMappingURL=printBundleSizes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/printBundleSizes.ts"],"sourcesContent":["import { Platform } from '@expo/config';\nimport chalk from 'chalk';\nimport prettyBytes from 'pretty-bytes';\nimport table from 'text-table';\n\nimport { BundleOutput } from './fork-bundleAsync';\nimport * as Log from '../log';\nimport { stripAnsi } from '../utils/ansi';\nimport { learnMore } from '../utils/link';\n\nexport function printBundleSizes(bundles: Partial<Record<Platform, BundleOutput>>) {\n const files: [string, string | Uint8Array][] = [];\n\n for (const [platform, bundleOutput] of Object.entries(bundles) as [\n Platform,\n Pick<BundleOutput, 'hermesBytecodeBundle' | 'code' | 'hermesSourcemap' | 'map'>,\n ][]) {\n if (bundleOutput.hermesBytecodeBundle) {\n files.push([chalk.bold(`index.${platform}.hbc`), bundleOutput.hermesBytecodeBundle]);\n } else if (bundleOutput.code) {\n files.push([chalk.bold(`index.${platform}.js`), bundleOutput.code]);\n }\n if (bundleOutput.hermesSourcemap) {\n files.push([chalk.dim(`index.${platform}.hbc.map`), bundleOutput.hermesSourcemap]);\n } else if (bundleOutput.map) {\n files.push([chalk.dim(`index.${platform}.js.map`), bundleOutput.map]);\n }\n }\n\n Log.log();\n Log.log(createFilesTable(files.sort((a, b) => a[1].length - b[1].length)));\n Log.log();\n Log.log(\n chalk`💡 JavaScript bundle sizes affect startup time. {dim ${learnMore(\n `https://expo.fyi/javascript-bundle-sizes`\n )}}`\n );\n Log.log();\n\n return files;\n}\n\nexport function createFilesTable(files: [string, string | Uint8Array][]): string {\n const tableData = files.map((item, index) => {\n const fileBranch =\n index === 0 ? (files.length > 1 ? '┌' : '─') : index === files.length - 1 ? '└' : '├';\n\n return [`${fileBranch} ${item[0]}`, prettyBytes(Buffer.byteLength(item[1], 'utf8'))];\n });\n return table([['Bundle', 'Size'].map((v) => chalk.underline(v)), ...tableData], {\n align: ['l', 'r'],\n stringLength: (str) => stripAnsi(str)?.length ?? 0,\n });\n}\n"],"names":["printBundleSizes","createFilesTable","Log","bundles","files","platform","bundleOutput","Object","entries","hermesBytecodeBundle","push","chalk","bold","code","hermesSourcemap","dim","map","log","sort","a","b","length","learnMore","tableData","item","index","fileBranch","prettyBytes","Buffer","byteLength","stripAnsi","table","v","underline","align","stringLength","str"],"mappings":"AAAA;;;;QAUgBA,gBAAgB,GAAhBA,gBAAgB;QAgChBC,gBAAgB,GAAhBA,gBAAgB;AAzCd,IAA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AC,CAACf,GAAG,CAAC,CAACgB,CAAC,GAAKrB,MAAK,QAAA,CAACsB,SAAS,CAACD,CAAC,CAAC;QAAA,CAAC;WAAKT,SAAS;KAAC,EAAE;QAC9EW,KAAK,EAAE;YAAC,GAAG;YAAE,GAAG;SAAC;QACjBC,YAAY,EAAE,CAACC,GAAG;gBAAKN,IAAc;YAAdA,OAAAA,CAAAA,GAAsB,GAAtBA,CAAAA,IAAc,GAAdA,CAAAA,GAAAA,KAAS,AAAK,CAAA,UAAL,CAACM,GAAG,CAAC,SAAQ,GAAtBN,KAAAA,CAAsB,GAAtBA,IAAc,CAAET,MAAM,YAAtBS,GAAsB,GAAI,CAAC,CAAA;SAAA;KACnD,CAAC,CAAC;CACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/inspector-proxy/device.ts"],"sourcesContent":["import type { DebuggerInfo, Device as MetroDevice } from 'metro-inspector-proxy';\nimport fetch from 'node-fetch';\nimport type WS from 'ws';\n\nimport { NetworkResponseHandler } from './handlers/NetworkResponse';\nimport { PageReloadHandler } from './handlers/PageReload';\nimport { VscodeDebuggerGetPossibleBreakpointsHandler } from './handlers/VscodeDebuggerGetPossibleBreakpoints';\nimport { VscodeDebuggerScriptParsedHandler } from './handlers/VscodeDebuggerScriptParsed';\nimport { VscodeDebuggerSetBreakpointByUrlHandler } from './handlers/VscodeDebuggerSetBreakpointByUrl';\nimport { VscodeRuntimeCallFunctionOnHandler } from './handlers/VscodeRuntimeCallFunctionOn';\nimport { VscodeRuntimeGetPropertiesHandler } from './handlers/VscodeRuntimeGetProperties';\nimport { DeviceRequest, InspectorHandler, DebuggerRequest } from './handlers/types';\nimport { MetroBundlerDevServer } from '../MetroBundlerDevServer';\n\n/** Export the supported debugger types this inspector proxy can handle */\nexport type DebuggerType = 'vscode' | 'generic';\n\n/** The debugger information being tracked by this device class */\nexport type ExpoDebuggerInfo = DebuggerInfo & { debuggerType?: DebuggerType };\n\nexport function createInspectorDeviceClass(\n metroBundler: MetroBundlerDevServer,\n MetroDeviceClass: typeof MetroDevice\n) {\n return class ExpoInspectorDevice extends MetroDeviceClass implements InspectorHandler {\n /** Stores information about currently connected debugger (if any). */\n _debuggerConnection: ExpoDebuggerInfo | null = null;\n\n /** All handlers that should be used to intercept or reply to CDP events */\n public handlers: InspectorHandler[] = [\n // Generic handlers\n new NetworkResponseHandler(),\n new PageReloadHandler(metroBundler),\n // Vscode-specific handlers\n new VscodeDebuggerGetPossibleBreakpointsHandler(),\n new VscodeDebuggerScriptParsedHandler(this),\n new VscodeDebuggerSetBreakpointByUrlHandler(),\n new VscodeRuntimeGetPropertiesHandler(),\n new VscodeRuntimeCallFunctionOnHandler(),\n ];\n\n onDeviceMessage(message: any, info: DebuggerInfo): boolean {\n return this.handlers.some((handler) => handler.onDeviceMessage?.(message, info) ?? false);\n }\n\n onDebuggerMessage(message: any, info: DebuggerInfo): boolean {\n return this.handlers.some((handler) => handler.onDebuggerMessage?.(message, info) ?? false);\n }\n\n /**\n * Handle a new device connection with the same device identifier.\n * When the app and device name matches, we can reuse the debugger connection.\n * Else, we have to shut the debugger connection down.\n */\n handleDuplicateDeviceConnection(newDevice: InstanceType<typeof MetroDeviceClass>) {\n if (this._app !== newDevice._app || this._name !== newDevice._name) {\n this._deviceSocket.close();\n this._debuggerConnection?.socket.close();\n return;\n }\n\n const oldDebugger = this._debuggerConnection;\n this._debuggerConnection = null;\n\n if (oldDebugger) {\n oldDebugger.socket.removeAllListeners();\n this._deviceSocket.close();\n newDevice.handleDebuggerConnection(oldDebugger.socket, oldDebugger.pageId);\n }\n }\n\n /**\n * Handle a new debugger connection to this device.\n * This adds the `debuggerType` property to the `DebuggerInfo` object.\n * With that information, we can enable or disable debugger-specific handlers.\n */\n handleDebuggerConnectionWithType(socket: WS, pageId: string, debuggerType: DebuggerType): void {\n this.handleDebuggerConnection(socket, pageId);\n\n if (this._debuggerConnection) {\n this._debuggerConnection.debuggerType = debuggerType;\n }\n }\n\n /** Hook into the message life cycle to answer more complex CDP messages */\n async _processMessageFromDevice(message: DeviceRequest<any>, info: DebuggerInfo) {\n if (!this.onDeviceMessage(message, info)) {\n await super._processMessageFromDevice(message, info);\n }\n }\n\n /** Hook into the message life cycle to answer more complex CDP messages */\n _interceptMessageFromDebugger(\n request: DebuggerRequest,\n info: DebuggerInfo,\n socket: WS\n ): boolean {\n // Note, `socket` is the exact same as `info.socket`\n if (this.onDebuggerMessage(request, info)) {\n return true;\n }\n\n return super._interceptMessageFromDebugger(request, info, socket);\n }\n\n /**\n * Overwrite the default text fetcher, to load sourcemaps from sources other than `localhost`.\n * @todo Cedric: remove the custom `DebuggerScriptSource` handler when switching over to `metro@>=0.75.1`\n * @see https://github.com/facebook/metro/blob/77f445f1bcd2264ad06174dbf8d542bc75834d29/packages/metro-inspector-proxy/src/Device.js#L573-L588\n * @since metro-inspector-proxy@0.75.1\n */\n async _fetchText(url: URL): Promise<string> {\n const LENGTH_LIMIT_BYTES = 350_000_000; // 350mb\n\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Received status ${response.status} while fetching: ${url}`);\n }\n\n const contentLength = response.headers.get('Content-Length');\n if (contentLength && Number(contentLength) > LENGTH_LIMIT_BYTES) {\n throw new Error('Expected file size is too large (more than 350mb)');\n }\n\n const text = await response.text();\n if (Buffer.byteLength(text, 'utf8') > LENGTH_LIMIT_BYTES) {\n throw new Error('File size is too large (more than 350mb)');\n }\n\n return text;\n }\n };\n}\n"],"names":["createInspectorDeviceClass","metroBundler","MetroDeviceClass","ExpoInspectorDevice","_debuggerConnection","handlers","NetworkResponseHandler","PageReloadHandler","VscodeDebuggerGetPossibleBreakpointsHandler","VscodeDebuggerScriptParsedHandler","VscodeDebuggerSetBreakpointByUrlHandler","VscodeRuntimeGetPropertiesHandler","VscodeRuntimeCallFunctionOnHandler","onDeviceMessage","message","info","handler","some","onDebuggerMessage","handleDuplicateDeviceConnection","newDevice","_app","_name","_deviceSocket","close","socket","oldDebugger","removeAllListeners","handleDebuggerConnection","pageId","handleDebuggerConnectionWithType","debuggerType","_processMessageFromDevice","_interceptMessageFromDebugger","request","_fetchText","url","LENGTH_LIMIT_BYTES","response","fetch","ok","Error","status","contentLength","headers","get","Number","text","Buffer","byteLength"],"mappings":"AAAA;;;;QAoBgBA,0BAA0B,GAA1BA,0BAA0B;AAnBxB,IAAA,UAAY,kCAAZ,YAAY,EAAA;AAGS,IAAA,gBAA4B,WAA5B,4BAA4B,CAAA;AACjC,IAAA,WAAuB,WAAvB,uBAAuB,CAAA;AACG,IAAA,qCAAiD,WAAjD,iDAAiD,CAAA;AAC3D,IAAA,2BAAuC,WAAvC,uCAAuC,CAAA;AACjC,IAAA,iCAA6C,WAA7C,6CAA6C,CAAA;AAClD,IAAA,4BAAwC,WAAxC,wCAAwC,CAAA;AACzC,IAAA,2BAAuC,WAAvC,uCAAuC,CAAA;;;;;;AAUlF,SAASA,0BAA0B,CACxCC,YAAmC,EACnCC,gBAAoC,EACpC;IACA,OAAO,MAAMC,mBAAmB,SAASD,gBAAgB;QACvD,sEAAsE,CACtEE,mBAAmB,GAA4B,IAAI,CAAC;QAEpD,2EAA2E,CAC3E,AAAOC,QAAQ,GAAuB;YACpC,mBAAmB;YACnB,IAAIC,gBAAsB,uBAAA,EAAE;YAC5B,IAAIC,WAAiB,kBAAA,CAACN,YAAY,CAAC;YACnC,2BAA2B;YAC3B,IAAIO,qCAA2C,4CAAA,EAAE;YACjD,IAAIC,2BAAiC,kCAAA,CAAC,IAAI,CAAC;YAC3C,IAAIC,iCAAuC,wCAAA,EAAE;YAC7C,IAAIC,2BAAiC,kCAAA,EAAE;YACvC,IAAIC,4BAAkC,mCAAA,EAAE;SACzC,CAAC;QAEFC,eAAe,CAACC,OAAY,EAAEC,IAAkB,EAAW;gBAClBC,GAAwC;YAA/E,OAAO,IAAI,CAACX,QAAQ,CAACY,IAAI,CAAC,CAACD,OAAO;gBAAKA,OAAAA,CAAAA,GAAwC,GAAxCA,OAAO,C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MAAM,CAACH,aAAa,CAAC,GAAGN,kBAAkB,EAAE;gBAC/D,MAAM,IAAII,KAAK,CAAC,mDAAmD,CAAC,CAAC;aACtE;YAED,MAAMM,IAAI,GAAG,MAAMT,QAAQ,CAACS,IAAI,EAAE,AAAC;YACnC,IAAIC,MAAM,CAACC,UAAU,CAACF,IAAI,EAAE,MAAM,CAAC,GAAGV,kBAAkB,EAAE;gBACxD,MAAM,IAAII,KAAK,CAAC,0CAA0C,CAAC,CAAC;aAC7D;YAED,OAAOM,IAAI,CAAC;SACb;KACF,CAAC;CACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/NetworkResponse.ts"],"sourcesContent":["import type { Protocol } from 'devtools-protocol';\n\nimport {\n CdpMessage,\n InspectorHandler,\n DeviceRequest,\n DebuggerRequest,\n DebuggerResponse,\n DeviceResponse,\n} from './types';\nimport { ExpoDebuggerInfo } from '../device';\n\nexport class NetworkResponseHandler implements InspectorHandler {\n /** All known responses, mapped by request id */\n storage = new Map<string, DebuggerResponse<NetworkGetResponseBody>['result']>();\n\n onDeviceMessage(message: DeviceRequest<NetworkReceivedResponseBody>) {\n if (message.method === 'Expo(Network.receivedResponseBody)') {\n const { requestId, ...requestInfo } = message.params;\n this.storage.set(requestId, requestInfo);\n return true;\n }\n\n return false;\n }\n\n onDebuggerMessage(\n message: DebuggerRequest<NetworkGetResponseBody>,\n { socket }: ExpoDebuggerInfo\n ) {\n if (\n message.method === 'Network.getResponseBody' &&\n this.storage.has(message.params.requestId)\n ) {\n const response: DeviceResponse<NetworkGetResponseBody> = {\n id: message.id,\n result: this.storage.get(message.params.requestId)!,\n };\n\n socket.send(JSON.stringify(response));\n return true;\n }\n\n return false;\n }\n}\n\n/** Custom message to transfer the response body data to the proxy */\nexport type NetworkReceivedResponseBody = CdpMessage<\n 'Expo(Network.receivedResponseBody)',\n Protocol.Network.GetResponseBodyRequest & Protocol.Network.GetResponseBodyResponse,\n never\n>;\n\n/** @see https://chromedevtools.github.io/devtools-protocol/1-2/Network/#method-getResponseBody */\nexport type NetworkGetResponseBody = CdpMessage<\n 'Network.getResponseBody',\n Protocol.Network.GetResponseBodyRequest,\n Protocol.Network.GetResponseBodyResponse\n>;\n"],"names":["NetworkResponseHandler","storage","Map","onDeviceMessage","message","method","requestId","requestInfo","params","set","onDebuggerMessage","socket","has","response","id","result","get","send","JSON","stringify"],"mappings":"AAAA;;;;AAYO,MAAMA,sBAAsB;IACjC,gDAAgD,CAChDC,OAAO,GAAG,IAAIC,GAAG,EAA8D,CAAC;IAEhFC,eAAe,CAACC,OAAmD,EAAE;QACnE,IAAIA,OAAO,CAACC,MAAM,KAAK,oCAAoC,EAAE;YAC3D,MAAM,EAAEC,SAAS,CAAA,EAAE,GAAGC,WAAW,EAAE,GAAGH,OAAO,CAACI,MAAM,AAAC;YACrD,IAAI,CAACP,OAAO,CAACQ,GAAG,CAACH,SAAS,EAAEC,WAAW,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;KACd;IAEDG,iBAAiB,CACfN,OAAgD,EAChD,EAAEO,MAAM,CAAA,EAAoB,EAC5B;QACA,IACEP,OAAO,CAACC,MAAM,KAAK,yBAAyB,IAC5C,IAAI,CAACJ,OAAO,CAACW,GAAG,CAACR,OAAO,CAACI,MAAM,CAACF,SAAS,CAAC,EAC1C;YACA,MAAMO,QAAQ,GAA2C;gBACvDC,EAAE,EAAEV,OAAO,CAACU,EAAE;gBACdC,MAAM,EAAE,IAAI,CAACd,OAAO,CAACe,GAAG,CAACZ,OAAO,CAACI,MAAM,CAACF,SAAS,CAAC;aACnD,AAAC;YAEFK,MAAM,CAACM,IAAI,CAACC,IAAI,CAACC,SAAS,CAACN,QAAQ,CAAC,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAjCYb,sBAAsB,GAAtBA,sBAAsB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/PageReload.ts"],"sourcesContent":["import type { Protocol } from 'devtools-protocol';\n\nimport { CdpMessage, DebuggerRequest, InspectorHandler } from './types';\nimport { MetroBundlerDevServer } from '../../MetroBundlerDevServer';\nimport { ExpoDebuggerInfo } from '../device';\n\nexport class PageReloadHandler implements InspectorHandler {\n constructor(private readonly metroBundler: MetroBundlerDevServer) {}\n\n onDebuggerMessage(message: DebuggerRequest<PageReload>, { socket }: ExpoDebuggerInfo) {\n if (message.method === 'Page.reload') {\n this.metroBundler.broadcastMessage('reload');\n socket.send(JSON.stringify({ id: message.id }));\n return true;\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/1-2/Page/#method-reload */\nexport type PageReload = CdpMessage<'Page.reload', Protocol.Page.ReloadRequest, never>;\n"],"names":["PageReloadHandler","constructor","metroBundler","onDebuggerMessage","message","socket","method","broadcastMessage","send","JSON","stringify","id"],"mappings":"AAAA;;;;AAMO,MAAMA,iBAAiB;IAC5BC,YAA6BC,YAAmC,CAAE;aAArCA,YAAmC,GAAnCA,YAAmC;KAAI;IAEpEC,iBAAiB,CAACC,OAAoC,EAAE,EAAEC,MAAM,CAAA,EAAoB,EAAE;QACpF,IAAID,OAAO,CAACE,MAAM,KAAK,aAAa,EAAE;YACpC,IAAI,CAACJ,YAAY,CAACK,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAC7CF,MAAM,CAACG,IAAI,CAACC,IAAI,CAACC,SAAS,CAAC;gBAAEC,EAAE,EAAEP,OAAO,CAACO,EAAE;aAAE,CAAC,CAAC,CAAC;YAChD,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAZYX,iBAAiB,GAAjBA,iBAAiB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\n\nimport { CdpMessage, DebuggerRequest, DeviceResponse, InspectorHandler } from './types';\nimport { respond } from './utils';\nimport { ExpoDebuggerInfo } from '../device';\n\n/**\n * Hermes doesn't seem to handle this request, but `locations` have to be returned.\n * Respond with an empty location to make it \"spec compliant\" with Chrome DevTools.\n */\nexport class VscodeDebuggerGetPossibleBreakpointsHandler implements InspectorHandler {\n onDebuggerMessage(\n message: DebuggerRequest<DebuggerGetPossibleBreakpoints>,\n { socket, debuggerType }: ExpoDebuggerInfo\n ): boolean {\n if (debuggerType === 'vscode' && message.method === 'Debugger.getPossibleBreakpoints') {\n return respond<DeviceResponse<DebuggerGetPossibleBreakpoints>>(socket, {\n id: message.id,\n result: { locations: [] },\n });\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Debugger/#method-getPossibleBreakpoints */\nexport type DebuggerGetPossibleBreakpoints = CdpMessage<\n 'Debugger.getPossibleBreakpoints',\n Protocol.Debugger.GetPossibleBreakpointsRequest,\n Protocol.Debugger.GetPossibleBreakpointsResponse\n>;\n"],"names":["VscodeDebuggerGetPossibleBreakpointsHandler","onDebuggerMessage","message","socket","debuggerType","method","respond","id","result","locations"],"mappings":"AAAA;;;;AAGwB,IAAA,MAAS,WAAT,SAAS,CAAA;AAO1B,MAAMA,2CAA2C;IACtDC,iBAAiB,CACfC,OAAwD,EACxD,EAAEC,MAAM,CAAA,EAAEC,YAAY,CAAA,EAAoB,EACjC;QACT,IAAIA,YAAY,KAAK,QAAQ,IAAIF,OAAO,CAACG,MAAM,KAAK,iCAAiC,EAAE;YACrF,OAAOC,CAAAA,GAAAA,MAAO,AAGZ,CAAA,QAHY,CAAiDH,MAAM,EAAE;gBACrEI,EAAE,EAAEL,OAAO,CAACK,EAAE;gBACdC,MAAM,EAAE;oBAAEC,SAAS,EAAE,EAAE;iBAAE;aAC1B,CAAC,CAAC;SACJ;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAdYT,2CAA2C,GAA3CA,2CAA2C"}
|
package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerScriptParsed.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerScriptParsed.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\nimport { Device as MetroDevice } from 'metro-inspector-proxy';\n\nimport { CdpMessage, DeviceRequest, InspectorHandler } from './types';\nimport { ExpoDebuggerInfo } from '../device';\n\n/** Android's stock emulator and other emulators such as genymotion use a standard localhost alias. */\nconst EMULATOR_LOCALHOST_ADDRESSES: Readonly<string[]> = ['10.0.2.2', '10.0.3.2'];\n/** Prefix for script URLs that are alphanumeric IDs. */\nconst FILE_PREFIX = 'file://';\n\n/**\n * Some debug clients does not support fetching source maps by URL.\n * By default, the `metro-inspector-proxy` inlines the source map as base64 string.\n * Unfortunately, that causes a multi-second delay in VS Code (±5s).\n * This handler disables inlining the source maps for VS Code only.\n */\nexport class VscodeDebuggerScriptParsedHandler implements InspectorHandler {\n constructor(private readonly device: MetroDevice) {}\n\n onDeviceMessage(message: DeviceRequest<DebuggerScriptParsed>, debuggerInfo: ExpoDebuggerInfo) {\n if (debuggerInfo.debuggerType !== 'vscode' || message.method !== 'Debugger.scriptParsed') {\n return false;\n }\n\n // See: https://github.com/facebook/metro/blob/f43caa371a813b257cb0b42028079645a1e85e0e/packages/metro-inspector-proxy/src/Device.js#L401-L410\n if (message.params.sourceMapURL) {\n for (let i = 0; i < EMULATOR_LOCALHOST_ADDRESSES.length; ++i) {\n const address = EMULATOR_LOCALHOST_ADDRESSES[i];\n if (message.params.sourceMapURL.indexOf(address) >= 0) {\n message.params.sourceMapURL = message.params.sourceMapURL.replace(address, 'localhost');\n debuggerInfo.originalSourceURLAddress = address;\n }\n }\n }\n\n // See: https://github.com/facebook/metro/blob/f43caa371a813b257cb0b42028079645a1e85e0e/packages/metro-inspector-proxy/src/Device.js#L431-L453\n if (message.params.url) {\n for (let i = 0; i < EMULATOR_LOCALHOST_ADDRESSES.length; ++i) {\n const address = EMULATOR_LOCALHOST_ADDRESSES[i];\n if (message.params.url.indexOf(address) >= 0) {\n message.params.url = message.params.url.replace(address, 'localhost');\n debuggerInfo.originalSourceURLAddress = address;\n }\n }\n\n // Chrome doesn't download source maps if URL param is not a valid\n // URL. Some frameworks pass alphanumeric script ID instead of URL which causes\n // Chrome to not download source maps. In this case we want to prepend script ID\n // with 'file://' prefix.\n if (message.params.url.match(/^[0-9a-z]+$/)) {\n message.params.url = FILE_PREFIX + message.params.url;\n debuggerInfo.prependedFilePrefix = true;\n }\n\n if (message.params.scriptId != null) {\n this.device._scriptIdToSourcePathMapping.set(message.params.scriptId, message.params.url);\n }\n }\n\n // Block `metro-inspector-proxy`'s default source map inlining\n return true;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Debugger/#event-scriptParsed */\nexport type DebuggerScriptParsed = CdpMessage<\n 'Debugger.scriptParsed',\n Protocol.Debugger.ScriptParsedEvent,\n never\n>;\n"],"names":["EMULATOR_LOCALHOST_ADDRESSES","FILE_PREFIX","VscodeDebuggerScriptParsedHandler","constructor","device","onDeviceMessage","message","debuggerInfo","debuggerType","method","params","sourceMapURL","i","length","address","indexOf","replace","originalSourceURLAddress","url","match","prependedFilePrefix","scriptId","_scriptIdToSourcePathMapping","set"],"mappings":"AAAA;;;;AAMA,sGAAsG,CACtG,MAAMA,4BAA4B,GAAuB;IAAC,UAAU;IAAE,UAAU;CAAC,AAAC;AAClF,wDAAwD,CACxD,MAAMC,WAAW,GAAG,SAAS,AAAC;AAQvB,MAAMC,iCAAiC;IAC5CC,YAA6BC,MAAmB,CAAE;aAArBA,MAAmB,GAAnBA,MAAmB;KAAI;IAEpDC,eAAe,CAACC,OAA4C,EAAEC,YAA8B,EAAE;QAC5F,IAAIA,YAAY,CAACC,YAAY,KAAK,QAAQ,IAAI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O,CAACI,MAAM,CAACQ,GAAG,GAAGjB,WAAW,GAAGK,OAAO,CAACI,MAAM,CAACQ,GAAG,CAAC;gBACtDX,YAAY,CAACa,mBAAmB,GAAG,IAAI,CAAC;aACzC;YAED,IAAId,OAAO,CAACI,MAAM,CAACW,QAAQ,IAAI,IAAI,EAAE;gBACnC,IAAI,CAACjB,MAAM,CAACkB,4BAA4B,CAACC,GAAG,CAACjB,OAAO,CAACI,MAAM,CAACW,QAAQ,EAAEf,OAAO,CAACI,MAAM,CAACQ,GAAG,CAAC,CAAC;aAC3F;SACF;QAED,8DAA8D;QAC9D,OAAO,IAAI,CAAC;KACb;CACF;QA9CYhB,iCAAiC,GAAjCA,iCAAiC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerSetBreakpointByUrl.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\n\nimport { CdpMessage, DebuggerRequest, InspectorHandler } from './types';\nimport { ExpoDebuggerInfo } from '../device';\n\n/**\n * Hermes and vscode have trouble setting breakpoints by `urlRegex` through `Debugger.setBreakpointByUrl`.\n * Vscode adds `file://` to a URL containing `http://`, which confuses Hermes and sets it to the wrong location.\n * Hermes needs to create the breakpoint to get the proper ID, but it must be unbounded.\n * Once the sourcemap is loaded, vscode will rebind the unbounded breakpoint to the correct location (using `Debugger.setBreakpoint`).\n */\nexport class VscodeDebuggerSetBreakpointByUrlHandler implements InspectorHandler {\n onDebuggerMessage(\n message: DebuggerRequest<DebuggerSetBreakpointByUrl>,\n { debuggerType }: ExpoDebuggerInfo\n ): boolean {\n if (\n debuggerType === 'vscode' &&\n message.method === 'Debugger.setBreakpointByUrl' &&\n message.params.urlRegex\n ) {\n // Explicitly force the breakpoint to be unbounded\n message.params.url = 'file://__invalid_url__';\n delete message.params.urlRegex;\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Debugger/#method-setBreakpointByUrl */\nexport type DebuggerSetBreakpointByUrl = CdpMessage<\n 'Debugger.setBreakpointByUrl',\n Protocol.Debugger.SetBreakpointByUrlRequest,\n Protocol.Debugger.SetBreakpointByUrlResponse\n>;\n"],"names":["VscodeDebuggerSetBreakpointByUrlHandler","onDebuggerMessage","message","debuggerType","method","params","urlRegex","url"],"mappings":"AAAA;;;;AAWO,MAAMA,uCAAuC;IAClDC,iBAAiB,CACfC,OAAoD,EACpD,EAAEC,YAAY,CAAA,EAAoB,EACzB;QACT,IACEA,YAAY,KAAK,QAAQ,IACzBD,OAAO,CAACE,MAAM,KAAK,6BAA6B,IAChDF,OAAO,CAACG,MAAM,CAACC,QAAQ,EACvB;YACA,kDAAkD;YAClDJ,OAAO,CAACG,MAAM,CAACE,GAAG,GAAG,wBAAwB,CAAC;YAC9C,OAAOL,OAAO,CAACG,MAAM,CAACC,QAAQ,CAAC;SAChC;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAjBYN,uCAAuC,GAAvCA,uCAAuC"}
|
package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\n\nimport { CdpMessage, DebuggerRequest, DeviceResponse, InspectorHandler } from './types';\nimport { respond } from './utils';\nimport { ExpoDebuggerInfo } from '../device';\n\n/**\n * Vscode is trying to inject a script to fetch information about \"Stringy\" variables.\n * Unfortunately, this script causes a Hermes exception and crashes the app.\n *\n * @see https://github.com/expo/vscode-expo/issues/231\n * @see https://github.com/microsoft/vscode-js-debug/blob/dcccaf3972d675cc1e5c776450bb4c3dc8c178c1/src/adapter/stackTrace.ts#L319-L324\n */\nexport class VscodeRuntimeCallFunctionOnHandler implements InspectorHandler {\n onDebuggerMessage(\n message: DebuggerRequest<RuntimeCallFunctionOn>,\n { socket, debuggerType }: ExpoDebuggerInfo\n ): boolean {\n if (debuggerType === 'vscode' && message.method === 'Runtime.callFunctionOn') {\n return respond<DeviceResponse<RuntimeCallFunctionOn>>(socket, {\n id: message.id,\n result: {\n // We don't know the `type` and vscode allows `type: undefined`\n result: { objectId: message.params.objectId } as any,\n },\n });\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Runtime/#method-callFunctionOn */\nexport type RuntimeCallFunctionOn = CdpMessage<\n 'Runtime.callFunctionOn',\n Protocol.Runtime.CallFunctionOnRequest,\n Protocol.Runtime.CallFunctionOnResponse\n>;\n"],"names":["VscodeRuntimeCallFunctionOnHandler","onDebuggerMessage","message","socket","debuggerType","method","respond","id","result","objectId","params"],"mappings":"AAAA;;;;AAGwB,IAAA,MAAS,WAAT,SAAS,CAAA;AAU1B,MAAMA,kCAAkC;IAC7CC,iBAAiB,CACfC,OAA+C,EAC/C,EAAEC,MAAM,CAAA,EAAEC,YAAY,CAAA,EAAoB,EACjC;QACT,IAAIA,YAAY,KAAK,QAAQ,IAAIF,OAAO,CAACG,MAAM,KAAK,wBAAwB,EAAE;YAC5E,OAAOC,CAAAA,GAAAA,MAAO,AAMZ,CAAA,QANY,CAAwCH,MAAM,EAAE;gBAC5DI,EAAE,EAAEL,OAAO,CAACK,EAAE;gBACdC,MAAM,EAAE;oBACN,+DAA+D;oBAC/DA,MAAM,EAAE;wBAAEC,QAAQ,EAAEP,OAAO,CAACQ,MAAM,CAACD,QAAQ;qBAAE;iBAC9C;aACF,CAAC,CAAC;SACJ;QAED,OAAO,KAAK,CAAC;KACd;CACF;QAjBYT,kCAAkC,GAAlCA,kCAAkC"}
|
package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeGetProperties.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeGetProperties.ts"],"sourcesContent":["import Protocol from 'devtools-protocol';\n\nimport { CdpMessage, DebuggerRequest, DeviceResponse, InspectorHandler } from './types';\nimport { ExpoDebuggerInfo } from '../device';\n\n/**\n * Vscode doesn't seem to work nicely with missing `description` fields on `RemoteObject` instances.\n * It also tries to invoke `Runtime.callFunctionOn` on `Symbol` types, which crashes Hermes.\n * This handler tries to compensate for these two separate issues.\n *\n * @see https://github.com/facebook/hermes/issues/114\n * @see https://github.com/microsoft/vscode-js-debug/issues/1583\n */\nexport class VscodeRuntimeGetPropertiesHandler implements InspectorHandler {\n /** Keep track of `Runtime.getProperties` responses to intercept, by request id */\n interceptGetProperties = new Set<number>();\n\n onDebuggerMessage(\n message: DebuggerRequest<RuntimeGetProperties>,\n { debuggerType }: ExpoDebuggerInfo\n ): boolean {\n if (debuggerType === 'vscode' && message.method === 'Runtime.getProperties') {\n this.interceptGetProperties.add(message.id);\n }\n\n // Do not block propagation of this message\n return false;\n }\n\n onDeviceMessage(\n message: DeviceResponse<RuntimeGetProperties>,\n { debuggerType }: ExpoDebuggerInfo\n ) {\n if (\n debuggerType === 'vscode' &&\n 'id' in message &&\n this.interceptGetProperties.has(message.id)\n ) {\n this.interceptGetProperties.delete(message.id);\n\n for (const item of message.result.result ?? []) {\n // Force-fully format the properties description to be an empty string\n if (item.value) {\n item.value.description = item.value.description ?? '';\n }\n\n // Avoid passing the `objectId` for symbol types.\n // When collapsing in vscode, it will fetch information about the symbol using the `objectId`.\n // The `Runtime.getProperties` request of the symbol hard-crashes Hermes.\n if (item.value?.type === 'symbol' && item.value.objectId) {\n delete item.value.objectId;\n }\n }\n }\n\n // Do not block propagation of this message\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Runtime/#method-getProperties */\nexport type RuntimeGetProperties = CdpMessage<\n 'Runtime.getProperties',\n Protocol.Runtime.GetPropertiesRequest,\n Protocol.Runtime.GetPropertiesResponse\n>;\n"],"names":["VscodeRuntimeGetPropertiesHandler","interceptGetProperties","Set","onDebuggerMessage","message","debuggerType","method","add","id","onDeviceMessage","has","delete","item","result","value","description","type","objectId"],"mappings":"AAAA;;;;AAaO,MAAMA,iCAAiC;IAC5C,kFAAkF,CAClFC,sBAAsB,GAAG,IAAIC,GAAG,EAAU,CAAC;IAE3CC,iBAAiB,CACfC,OAA8C,EAC9C,EAAEC,YAAY,CAAA,EAAoB,EACzB;QACT,IAAIA,YAAY,KAAK,QAAQ,IAAID,OAAO,CAACE,MAAM,KAAK,uBAAuB,EAAE;YAC3E,IAAI,CAACL,sBAAsB,CAACM,GAAG,CAACH,OAAO,CAACI,EAAE,CAAC,CAAC;SAC7C;QAED,2CAA2C;QAC3C,OAAO,KAAK,CAAC;KACd;IAEDC,eAAe,CACbL,OAA6C,EAC7C,EAAEC,YAAY,CAAA,EAAoB,EAClC;QACA,IACEA,YAAY,KAAK,QAAQ,IACzB,IAAI,IAAID,OAAO,IACf,IAAI,CAACH,sBAAsB,CAACS,GAAG,CAACN,OAAO,CAACI,EAAE,CAAC,EAC3C;YACA,IAAI,CAACP,sBAAsB,CAACU,MAAM,CAACP,OAAO,CAACI,EAAE,CAAC,CAAC;gBAE5BJ,OAAqB;YAAxC,KAAK,MAAMQ,IAAI,IAAIR,CAAAA,OAAqB,GAArBA,OAAO,CAACS,MAAM,CAACA,MAAM,YAArBT,OAAqB,GAAI,EAAE,CAAE;oBAS1CQ,GAAU;gBARd,sEAAsE;gBACtE,IAAIA,IAAI,CAACE,KAAK,EAAE;wBACWF,YAAsB;oBAA/CA,IAAI,CAACE,KAAK,CAACC,WAAW,GAAGH,CAAAA,YAAsB,GAAtBA,IAAI,CAACE,KAAK,CAACC,WAAW,YAAtBH,YAAsB,GAAI,EAAE,CAAC;iBACvD;gBAED,iDAAiD;gBACjD,8FAA8F;gBAC9F,yEAAyE;gBACzE,IAAIA,CAAAA,CAAAA,GAAU,GAAVA,IAAI,CAACE,KAAK,SAAM,GAAhBF,KAAAA,CAAgB,GAAhBA,GAAU,CAAEI,IAAI,CAAA,KAAK,QAAQ,IAAIJ,IAAI,CAACE,KAAK,CAACG,QAAQ,EAAE;oBACxD,OAAOL,IAAI,CAACE,KAAK,CAACG,QAAQ,CAAC;iBAC5B;aACF;SACF;QAED,2CAA2C;QAC3C,OAAO,KAAK,CAAC;KACd;CACF;QA7CYjB,iCAAiC,GAAjCA,iCAAiC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/types.ts"],"sourcesContent":["import { ExpoDebuggerInfo } from '../device';\n\nexport interface InspectorHandler {\n /**\n * Intercept a message coming from the device, modify or respond to it through `this._sendMessageToDevice`.\n * Return `true` if the message was handled, this will stop the message propagation.\n */\n onDeviceMessage?(message: DeviceRequest | DeviceResponse, info: ExpoDebuggerInfo): boolean;\n\n /**\n * Intercept a message coming from the debugger, modify or respond to it through `socket.send`.\n * Return `true` if the message was handled, this will stop the message propagation.\n */\n onDebuggerMessage?(message: DebuggerRequest, info: ExpoDebuggerInfo): boolean;\n}\n\n/**\n * The outline of a basic Chrome DevTools Protocol request, either from device or debugger.\n * Both the request and response parameters could be optional, use `never` to enforce these fields.\n */\nexport type CdpMessage<\n Method extends string = string,\n Request extends object = object,\n Response extends object = object,\n> = {\n id: number;\n method: Method;\n params: Request;\n result: Response;\n};\n\nexport type DeviceRequest<M extends CdpMessage = CdpMessage> = Pick<M, 'method' | 'params'>;\nexport type DeviceResponse<M extends CdpMessage = CdpMessage> = Pick<M, 'id' | 'result'>;\n\nexport type DebuggerRequest<M extends CdpMessage = CdpMessage> = Pick<\n M,\n 'id' | 'method' | 'params'\n>;\nexport type DebuggerResponse<M extends CdpMessage = CdpMessage> = Pick<M, 'result'>;\n"],"names":[],"mappings":"AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/utils.ts"],"sourcesContent":["import type WS from 'ws';\n\nimport { DebuggerResponse, DeviceResponse } from './types';\n\n/**\n * Helper function to respond to a message from the debugger or device.\n * The return value is used to stop the message propagation, \"canceling\" further handling.\n *\n * @example ```\n * return respond<DeviceResponse<CDP>>(socket, { id: message.id, result: {} });\n * ```\n */\nexport function respond<T = DeviceResponse | DebuggerResponse>(socket: WS, message: T) {\n socket.send(JSON.stringify(message));\n return true;\n}\n"],"names":["respond","socket","message","send","JSON","stringify"],"mappings":"AAAA;;;;QAYgBA,OAAO,GAAPA,OAAO;AAAhB,SAASA,OAAO,CAAwCC,MAAU,EAAEC,OAAU,EAAE;IACrFD,MAAM,CAACE,IAAI,CAACC,IAAI,CAACC,SAAS,CAACH,OAAO,CAAC,CAAC,CAAC;IACrC,OAAO,IAAI,CAAC;CACb"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "ExpoInspectorProxy", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _proxy.ExpoInspectorProxy;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
exports.createInspectorProxy = createInspectorProxy;
|
|
12
|
-
var _metroInspectorProxy = require("metro-inspector-proxy");
|
|
13
|
-
var _device = _interopRequireDefault(require("metro-inspector-proxy/src/Device"));
|
|
14
|
-
var _device1 = require("./device");
|
|
15
|
-
var _proxy = require("./proxy");
|
|
16
|
-
function _interopRequireDefault(obj) {
|
|
17
|
-
return obj && obj.__esModule ? obj : {
|
|
18
|
-
default: obj
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
const debug = require("debug")("expo:metro:inspector-proxy");
|
|
22
|
-
function createInspectorProxy(metroBundler, projectRoot) {
|
|
23
|
-
debug("Expo inspector proxy enabled");
|
|
24
|
-
// The device is slightly more complicated, we need to extend that class
|
|
25
|
-
const ExpoInspectorDevice = (0, _device1).createInspectorDeviceClass(metroBundler, _device.default);
|
|
26
|
-
const inspectorProxy = new _proxy.ExpoInspectorProxy(new _metroInspectorProxy.InspectorProxy(projectRoot), ExpoInspectorDevice);
|
|
27
|
-
return inspectorProxy;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/inspector-proxy/index.ts"],"sourcesContent":["import { InspectorProxy as MetroInspectorProxy } from 'metro-inspector-proxy';\nimport Device from 'metro-inspector-proxy/src/Device';\n\nimport { createInspectorDeviceClass } from './device';\nimport { ExpoInspectorProxy } from './proxy';\nimport { MetroBundlerDevServer } from '../MetroBundlerDevServer';\n\nexport { ExpoInspectorProxy } from './proxy';\n\nconst debug = require('debug')('expo:metro:inspector-proxy') as typeof console.log;\n\nexport function createInspectorProxy(metroBundler: MetroBundlerDevServer, projectRoot: string) {\n debug('Expo inspector proxy enabled');\n\n // The device is slightly more complicated, we need to extend that class\n const ExpoInspectorDevice = createInspectorDeviceClass(metroBundler, Device);\n\n const inspectorProxy = new ExpoInspectorProxy(\n new MetroInspectorProxy(projectRoot),\n ExpoInspectorDevice\n );\n\n return inspectorProxy;\n}\n"],"names":["ExpoInspectorProxy","createInspectorProxy","debug","require","metroBundler","projectRoot","ExpoInspectorDevice","createInspectorDeviceClass","Device","inspectorProxy","MetroInspectorProxy"],"mappings":"AAAA;;;;+BAOSA,oBAAkB;;;eAHQ,MAAS,CAGnCA,kBAAkB;;;QAIXC,oBAAoB,GAApBA,oBAAoB;AAXkB,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AAC1D,IAAA,OAAkC,kCAAlC,kCAAkC,EAAA;AAEV,IAAA,QAAU,WAAV,UAAU,CAAA;AAClB,IAAA,MAAS,WAAT,SAAS,CAAA;;;;;;AAK5C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,4BAA4B,CAAC,AAAsB,AAAC;AAE5E,SAASF,oBAAoB,CAACG,YAAmC,EAAEC,WAAmB,EAAE;IAC7FH,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAEtC,wEAAwE;IACxE,MAAMI,mBAAmB,GAAGC,CAAAA,GAAAA,QAA0B,AAAsB,CAAA,2BAAtB,CAACH,YAAY,EAAEI,OAAM,QAAA,CAAC,AAAC;IAE7E,MAAMC,cAAc,GAAG,IAAIT,MAAkB,mBAAA,CAC3C,IAAIU,oBAAmB,eAAA,CAACL,WAAW,CAAC,EACpCC,mBAAmB,CACpB,AAAC;IAEF,OAAOG,cAAc,CAAC;CACvB"}
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
var _url = require("url");
|
|
6
|
-
var _ws = _interopRequireDefault(require("ws"));
|
|
7
|
-
var _log = require("../../../../log");
|
|
8
|
-
function _interopRequireDefault(obj) {
|
|
9
|
-
return obj && obj.__esModule ? obj : {
|
|
10
|
-
default: obj
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
const WS_DEVICE_URL = "/inspector/device";
|
|
14
|
-
const WS_DEBUGGER_URL = "/inspector/debug";
|
|
15
|
-
const WS_GENERIC_ERROR_STATUS = 1011;
|
|
16
|
-
const debug = require("debug")("expo:metro:inspector-proxy:proxy");
|
|
17
|
-
class ExpoInspectorProxy {
|
|
18
|
-
constructor(metroProxy, DeviceClass, devices = new Map()){
|
|
19
|
-
this.metroProxy = metroProxy;
|
|
20
|
-
this.DeviceClass = DeviceClass;
|
|
21
|
-
this.devices = devices;
|
|
22
|
-
// monkey-patch the device list to expose it within the metro inspector
|
|
23
|
-
// See https://github.com/facebook/metro/pull/991
|
|
24
|
-
// @ts-expect-error - Device ID is changing from `number` to `string`
|
|
25
|
-
this.metroProxy._devices = this.devices;
|
|
26
|
-
// force httpEndpointMiddleware to be bound to this proxy instance
|
|
27
|
-
this.processRequest = this.processRequest.bind(this);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Normalize the server address for clients to connect to.
|
|
31
|
-
* @param addressInfo the server address returned by `HttpServer.address()` or `HttpsServer.address()`.
|
|
32
|
-
* @returns "address:port"
|
|
33
|
-
*/ static normalizeServerAddress(addressInfo) {
|
|
34
|
-
if (typeof addressInfo === "string") {
|
|
35
|
-
throw new Error(`Inspector proxy could not resolve the server address, got "${addressInfo}"`);
|
|
36
|
-
} else if (addressInfo === null) {
|
|
37
|
-
throw new Error(`Inspector proxy could not resolve the server address, got "null"`);
|
|
38
|
-
}
|
|
39
|
-
let address = addressInfo.address;
|
|
40
|
-
if (addressInfo.family === "IPv6") {
|
|
41
|
-
address = address === "::" ? `[::1]` : `[${address}]`;
|
|
42
|
-
} else {
|
|
43
|
-
address = address === "0.0.0.0" ? "localhost" : address;
|
|
44
|
-
}
|
|
45
|
-
return `${address}:${addressInfo.port}`;
|
|
46
|
-
}
|
|
47
|
-
/** @see https://chromedevtools.github.io/devtools-protocol/#endpoints */ processRequest(req, res, next) {
|
|
48
|
-
this.metroProxy.processRequest(req, res, next);
|
|
49
|
-
}
|
|
50
|
-
createWebSocketListeners(server) {
|
|
51
|
-
// Initialize the server address from the metro server.
|
|
52
|
-
// This is required to properly reference sourcemaps for the debugger.
|
|
53
|
-
this.metroProxy._serverAddressWithPort = ExpoInspectorProxy.normalizeServerAddress(server.address());
|
|
54
|
-
return {
|
|
55
|
-
[WS_DEVICE_URL]: this.createDeviceWebSocketServer(),
|
|
56
|
-
[WS_DEBUGGER_URL]: this.createDebuggerWebSocketServer()
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
createDeviceWebSocketServer() {
|
|
60
|
-
const wss = new _ws.default.Server({
|
|
61
|
-
noServer: true,
|
|
62
|
-
perMessageDeflate: false
|
|
63
|
-
});
|
|
64
|
-
// See: https://github.com/facebook/metro/blob/eeb211fdcfdcb9e7f8a51721bd0f48bc7d0d211f/packages/metro-inspector-proxy/src/InspectorProxy.js#L157
|
|
65
|
-
wss.on("connection", (socket, request)=>{
|
|
66
|
-
try {
|
|
67
|
-
const fallbackDeviceId = String(this.metroProxy._deviceCounter++);
|
|
68
|
-
const { deviceId: newDeviceId , deviceName , appName } = getDeviceInfo(request.url);
|
|
69
|
-
const deviceId = newDeviceId != null ? newDeviceId : fallbackDeviceId;
|
|
70
|
-
const oldDevice = this.devices.get(deviceId);
|
|
71
|
-
const newDevice = new this.DeviceClass(deviceId, deviceName, appName, socket, this.metroProxy._projectRoot);
|
|
72
|
-
if (oldDevice) {
|
|
73
|
-
debug("Device reconnected: device=%s, app=%s, id=%s", deviceName, appName, deviceId);
|
|
74
|
-
// See: https://github.com/facebook/metro/pull/991
|
|
75
|
-
// @ts-expect-error - Newly introduced method coming to metro-inspector-proxy soon
|
|
76
|
-
oldDevice.handleDuplicateDeviceConnection(newDevice);
|
|
77
|
-
} else {
|
|
78
|
-
debug("New device connected: device=%s, app=%s, id=%s", deviceName, appName, deviceId);
|
|
79
|
-
}
|
|
80
|
-
this.devices.set(deviceId, newDevice);
|
|
81
|
-
socket.on("close", ()=>{
|
|
82
|
-
if (this.devices.get(deviceId) === newDevice) {
|
|
83
|
-
this.devices.delete(deviceId);
|
|
84
|
-
debug("Device disconnected: device=%s, app=%s, id=%s", deviceName, appName, deviceId);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
} catch (error) {
|
|
88
|
-
let message = "";
|
|
89
|
-
debug("Could not establish a connection to on-device debugger:", error);
|
|
90
|
-
if (error instanceof Error) {
|
|
91
|
-
message = error.toString();
|
|
92
|
-
_log.Log.error("Failed to create a socket connection to on-device debugger (Hermes engine).");
|
|
93
|
-
_log.Log.exception(error);
|
|
94
|
-
} else {
|
|
95
|
-
_log.Log.error("Failed to create a socket connection to on-device debugger (Hermes engine), unknown error.");
|
|
96
|
-
}
|
|
97
|
-
socket.close(WS_GENERIC_ERROR_STATUS, message || "Unknown error");
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
return wss;
|
|
101
|
-
}
|
|
102
|
-
createDebuggerWebSocketServer() {
|
|
103
|
-
const wss = new _ws.default.Server({
|
|
104
|
-
noServer: true,
|
|
105
|
-
perMessageDeflate: false
|
|
106
|
-
});
|
|
107
|
-
// See: https://github.com/facebook/metro/blob/eeb211fdcfdcb9e7f8a51721bd0f48bc7d0d211f/packages/metro-inspector-proxy/src/InspectorProxy.js#L193
|
|
108
|
-
wss.on("connection", (socket, request)=>{
|
|
109
|
-
try {
|
|
110
|
-
const { deviceId , pageId , debuggerType } = getDebuggerInfo(request.url);
|
|
111
|
-
if (!deviceId || !pageId) {
|
|
112
|
-
// TODO(cedric): change these errors to proper error types
|
|
113
|
-
throw new Error(`Missing "device" and/or "page" IDs in query parameters`);
|
|
114
|
-
}
|
|
115
|
-
const device = this.devices.get(deviceId);
|
|
116
|
-
if (!device) {
|
|
117
|
-
// TODO(cedric): change these errors to proper error types
|
|
118
|
-
throw new Error(`Device with ID "${deviceId}" not found.`);
|
|
119
|
-
}
|
|
120
|
-
debug("New debugger connected: device=%s, app=%s", device._name, device._app);
|
|
121
|
-
// @ts-expect-error The `handleDebuggerConnectionWithType` is part of our device implementation, not Metro's device
|
|
122
|
-
if (debuggerType && typeof device.handleDebuggerConnectionWithType === "function") {
|
|
123
|
-
// @ts-expect-error The `handleDebuggerConnectionWithType` is part of our device implementation, not Metro's device
|
|
124
|
-
device.handleDebuggerConnectionWithType(socket, pageId, debuggerType);
|
|
125
|
-
} else {
|
|
126
|
-
device.handleDebuggerConnection(socket, pageId);
|
|
127
|
-
}
|
|
128
|
-
socket.on("close", ()=>{
|
|
129
|
-
debug("Debugger disconnected: device=%s, app=%s", device._name, device._app);
|
|
130
|
-
});
|
|
131
|
-
} catch (error) {
|
|
132
|
-
let message = "";
|
|
133
|
-
debug("Could not establish a connection to debugger:", error);
|
|
134
|
-
if (error instanceof Error) {
|
|
135
|
-
message = error.toString();
|
|
136
|
-
_log.Log.error("Failed to create a socket connection to the debugger.");
|
|
137
|
-
_log.Log.exception(error);
|
|
138
|
-
} else {
|
|
139
|
-
_log.Log.error("Failed to create a socket connection to the debugger, unkown error.");
|
|
140
|
-
}
|
|
141
|
-
socket.close(WS_GENERIC_ERROR_STATUS, message || "Unknown error");
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
return wss;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
exports.ExpoInspectorProxy = ExpoInspectorProxy;
|
|
148
|
-
function asString(value = "") {
|
|
149
|
-
return Array.isArray(value) ? value.join() : value;
|
|
150
|
-
}
|
|
151
|
-
function getDeviceInfo(url) {
|
|
152
|
-
const { query } = (0, _url).parse(url != null ? url : "", true);
|
|
153
|
-
return {
|
|
154
|
-
deviceId: asString(query.device) || undefined,
|
|
155
|
-
deviceName: asString(query.name) || "Unknown device name",
|
|
156
|
-
appName: asString(query.app) || "Unknown app name"
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function getDebuggerInfo(url) {
|
|
160
|
-
const { query } = (0, _url).parse(url != null ? url : "", true);
|
|
161
|
-
var ref;
|
|
162
|
-
return {
|
|
163
|
-
deviceId: asString(query.device),
|
|
164
|
-
pageId: asString(query.page),
|
|
165
|
-
debuggerType: (ref = asString(query.type)) != null ? ref : undefined
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
//# sourceMappingURL=proxy.js.map
|