@expo/cli 0.10.8 → 0.10.9
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 +2 -2
- package/build/src/register/registerAsync.js +2 -7
- package/build/src/register/registerAsync.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +2 -2
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +2 -2
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/device.js +0 -2
- package/build/src/start/server/metro/inspector-proxy/device.js.map +1 -1
- package/build/src/start/server/middleware/ClassicManifestMiddleware.js +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/open.js +26 -0
- package/build/src/utils/open.js.map +1 -0
- package/package.json +3 -3
- package/build/src/start/server/metro/inspector-proxy/handlers/DebuggerScriptSource.js +0 -87
- package/build/src/start/server/metro/inspector-proxy/handlers/DebuggerScriptSource.js.map +0 -1
package/build/bin/cli
CHANGED
|
@@ -132,7 +132,7 @@ const args = (0, _arg).default({
|
|
|
132
132
|
});
|
|
133
133
|
if (args["--version"]) {
|
|
134
134
|
// Version is added in the build script.
|
|
135
|
-
console.log("0.10.
|
|
135
|
+
console.log("0.10.9");
|
|
136
136
|
process.exit(0);
|
|
137
137
|
}
|
|
138
138
|
if (args["--non-interactive"]) {
|
|
@@ -262,7 +262,7 @@ commands[command]().then((exec)=>{
|
|
|
262
262
|
logEventAsync("action", {
|
|
263
263
|
action: `expo ${command}`,
|
|
264
264
|
source: "expo/cli",
|
|
265
|
-
source_version: "0.10.
|
|
265
|
+
source_version: "0.10.9"
|
|
266
266
|
});
|
|
267
267
|
});
|
|
268
268
|
|
|
@@ -3,17 +3,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.registerAsync = registerAsync;
|
|
6
|
-
var _betterOpn = _interopRequireDefault(require("better-opn"));
|
|
7
6
|
var _env = require("../utils/env");
|
|
8
7
|
var _errors = require("../utils/errors");
|
|
9
8
|
var _interactive = require("../utils/interactive");
|
|
10
9
|
var _link = require("../utils/link");
|
|
10
|
+
var _open = require("../utils/open");
|
|
11
11
|
var _ora = require("../utils/ora");
|
|
12
|
-
function _interopRequireDefault(obj) {
|
|
13
|
-
return obj && obj.__esModule ? obj : {
|
|
14
|
-
default: obj
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
12
|
async function registerAsync() {
|
|
18
13
|
if (!(0, _interactive).isInteractive()) {
|
|
19
14
|
throw new _errors.CommandError("NON_INTERACTIVE", `Cannot register an account in CI. Use the EXPO_TOKEN environment variable to authenticate in CI (${(0, _link).learnMore("https://docs.expo.dev/accounts/programmatic-access/")})`);
|
|
@@ -24,7 +19,7 @@ async function registerAsync() {
|
|
|
24
19
|
const failedMessage = `Unable to open a web browser. Register an account at: ${registrationUrl}`;
|
|
25
20
|
const spinner = (0, _ora).ora(`Opening ${registrationUrl}`).start();
|
|
26
21
|
try {
|
|
27
|
-
const opened = await (0,
|
|
22
|
+
const opened = await (0, _open).openBrowserAsync(registrationUrl);
|
|
28
23
|
if (opened) {
|
|
29
24
|
spinner.succeed(`Opened ${registrationUrl}`);
|
|
30
25
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/register/registerAsync.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/register/registerAsync.ts"],"sourcesContent":["import { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\nimport { isInteractive } from '../utils/interactive';\nimport { learnMore } from '../utils/link';\nimport { openBrowserAsync } from '../utils/open';\nimport { ora } from '../utils/ora';\n\nexport async function registerAsync() {\n if (!isInteractive()) {\n throw new CommandError(\n 'NON_INTERACTIVE',\n `Cannot register an account in CI. Use the EXPO_TOKEN environment variable to authenticate in CI (${learnMore(\n 'https://docs.expo.dev/accounts/programmatic-access/'\n )})`\n );\n } else if (env.EXPO_OFFLINE) {\n throw new CommandError('OFFLINE', `Cannot register an account in offline-mode`);\n }\n\n const registrationUrl = `https://expo.dev/signup`;\n const failedMessage = `Unable to open a web browser. Register an account at: ${registrationUrl}`;\n const spinner = ora(`Opening ${registrationUrl}`).start();\n try {\n const opened = await openBrowserAsync(registrationUrl);\n\n if (opened) {\n spinner.succeed(`Opened ${registrationUrl}`);\n } else {\n spinner.fail(failedMessage);\n }\n return;\n } catch (error) {\n spinner.fail(failedMessage);\n throw error;\n }\n}\n"],"names":["registerAsync","isInteractive","CommandError","learnMore","env","EXPO_OFFLINE","registrationUrl","failedMessage","spinner","ora","start","opened","openBrowserAsync","succeed","fail","error"],"mappings":"AAAA;;;;QAOsBA,aAAa,GAAbA,aAAa;AAPf,IAAA,IAAc,WAAd,cAAc,CAAA;AACL,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AAChB,IAAA,YAAsB,WAAtB,sBAAsB,CAAA;AAC1B,IAAA,KAAe,WAAf,eAAe,CAAA;AACR,IAAA,KAAe,WAAf,eAAe,CAAA;AAC5B,IAAA,IAAc,WAAd,cAAc,CAAA;AAE3B,eAAeA,aAAa,GAAG;IACpC,IAAI,CAACC,CAAAA,GAAAA,YAAa,AAAE,CAAA,cAAF,EAAE,EAAE;QACpB,MAAM,IAAIC,OAAY,aAAA,CACpB,iBAAiB,EACjB,CAAC,iGAAiG,EAAEC,CAAAA,GAAAA,KAAS,AAE5G,CAAA,UAF4G,CAC3G,qDAAqD,CACtD,CAAC,CAAC,CAAC,CACL,CAAC;KACH,MAAM,IAAIC,IAAG,IAAA,CAACC,YAAY,EAAE;QAC3B,MAAM,IAAIH,OAAY,aAAA,CAAC,SAAS,EAAE,CAAC,0CAA0C,CAAC,CAAC,CAAC;KACjF;IAED,MAAMI,eAAe,GAAG,CAAC,uBAAuB,CAAC,AAAC;IAClD,MAAMC,aAAa,GAAG,CAAC,sDAAsD,EAAED,eAAe,CAAC,CAAC,AAAC;IACjG,MAAME,OAAO,GAAGC,CAAAA,GAAAA,IAAG,AAA8B,CAAA,IAA9B,CAAC,CAAC,QAAQ,EAAEH,eAAe,CAAC,CAAC,CAAC,CAACI,KAAK,EAAE,AAAC;IAC1D,IAAI;QACF,MAAMC,MAAM,GAAG,MAAMC,CAAAA,GAAAA,KAAgB,AAAiB,CAAA,iBAAjB,CAACN,eAAe,CAAC,AAAC;QAEvD,IAAIK,MAAM,EAAE;YACVH,OAAO,CAACK,OAAO,CAAC,CAAC,OAAO,EAAEP,eAAe,CAAC,CAAC,CAAC,CAAC;SAC9C,MAAM;YACLE,OAAO,CAACM,IAAI,CAACP,aAAa,CAAC,CAAC;SAC7B;QACD,OAAO;KACR,CAAC,OAAOQ,KAAK,EAAE;QACdP,OAAO,CAACM,IAAI,CAACP,aAAa,CAAC,CAAC;QAC5B,MAAMQ,KAAK,CAAC;KACb;CACF"}
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
var _devServer = require("@expo/dev-server");
|
|
6
6
|
var _assert = _interopRequireDefault(require("assert"));
|
|
7
|
-
var _betterOpn = _interopRequireDefault(require("better-opn"));
|
|
8
7
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
9
8
|
var Log = _interopRequireWildcard(require("../../log"));
|
|
10
9
|
var _delay = require("../../utils/delay");
|
|
11
10
|
var _link = require("../../utils/link");
|
|
11
|
+
var _open = require("../../utils/open");
|
|
12
12
|
var _prompts = require("../../utils/prompts");
|
|
13
13
|
var _reactDevToolsProxy = require("../server/ReactDevToolsProxy");
|
|
14
14
|
var _commandsTable = require("./commandsTable");
|
|
@@ -152,7 +152,7 @@ class DevServerManagerActions {
|
|
|
152
152
|
async startReactDevToolsAsync() {
|
|
153
153
|
await (0, _reactDevToolsProxy).startReactDevToolsProxyAsync();
|
|
154
154
|
const url = this.devServerManager.getDefaultDevServer().getReactDevToolsUrl();
|
|
155
|
-
await (0,
|
|
155
|
+
await (0, _open).openBrowserAsync(url);
|
|
156
156
|
(0, _reactDevToolsProxy).addReactDevToolsReloadListener(()=>{
|
|
157
157
|
this.reconnectReactDevTools();
|
|
158
158
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/interface/interactiveActions.ts"],"sourcesContent":["import { openJsInspector, queryAllInspectorAppsAsync } from '@expo/dev-server';\nimport assert from 'assert';\nimport openBrowserAsync from 'better-opn';\nimport chalk from 'chalk';\n\nimport * as Log from '../../log';\nimport { delayAsync } from '../../utils/delay';\nimport { learnMore } from '../../utils/link';\nimport { selectAsync } from '../../utils/prompts';\nimport { DevServerManager } from '../server/DevServerManager';\nimport {\n addReactDevToolsReloadListener,\n startReactDevToolsProxyAsync,\n} from '../server/ReactDevToolsProxy';\nimport { BLT, printHelp, printItem, printQRCode, printUsage, StartOptions } from './commandsTable';\n\nconst debug = require('debug')('expo:start:interface:interactiveActions') as typeof console.log;\n\n/** Wraps the DevServerManager and adds an interface for user actions. */\nexport class DevServerManagerActions {\n constructor(private devServerManager: DevServerManager) {}\n\n printDevServerInfo(\n options: Pick<StartOptions, 'devClient' | 'isWebSocketsEnabled' | 'platforms'>\n ) {\n // If native dev server is running, print its URL.\n if (this.devServerManager.getNativeDevServerPort()) {\n const devServer = this.devServerManager.getDefaultDevServer();\n try {\n const nativeRuntimeUrl = devServer.getNativeRuntimeUrl()!;\n const interstitialPageUrl = devServer.getRedirectUrl();\n\n printQRCode(interstitialPageUrl ?? nativeRuntimeUrl);\n\n if (interstitialPageUrl) {\n Log.log(\n printItem(\n chalk`Choose an app to open your project at {underline ${interstitialPageUrl}}`\n )\n );\n }\n Log.log(printItem(chalk`Metro waiting on {underline ${nativeRuntimeUrl}}`));\n if (options.devClient === false) {\n // TODO: if development build, change this message!\n Log.log(\n printItem('Scan the QR code above with Expo Go (Android) or the Camera app (iOS)')\n );\n } else {\n Log.log(\n printItem(\n 'Scan the QR code above to open the project in a development build. ' +\n learnMore('https://expo.fyi/start')\n )\n );\n }\n } catch (error) {\n console.log('err', error);\n // @ts-ignore: If there is no development build scheme, then skip the QR code.\n if (error.code !== 'NO_DEV_CLIENT_SCHEME') {\n throw error;\n } else {\n const serverUrl = devServer.getDevServerUrl();\n Log.log(printItem(chalk`Metro waiting on {underline ${serverUrl}}`));\n Log.log(printItem(`Linking is disabled because the client scheme cannot be resolved.`));\n }\n }\n }\n\n const webDevServer = this.devServerManager.getWebDevServer();\n const webUrl = webDevServer?.getDevServerUrl({ hostType: 'localhost' });\n if (webUrl) {\n Log.log();\n Log.log(printItem(chalk`Web is waiting on {underline ${webUrl}}`));\n }\n\n printUsage(options, { verbose: false });\n printHelp();\n Log.log();\n }\n\n async openJsInspectorAsync() {\n Log.log('Opening JavaScript inspector in the browser...');\n const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();\n assert(metroServerOrigin, 'Metro dev server is not running');\n const apps = await queryAllInspectorAppsAsync(metroServerOrigin);\n if (!apps.length) {\n Log.warn(\n `No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine. ${learnMore(\n 'https://docs.expo.dev/guides/using-hermes/'\n )}`\n );\n return;\n }\n try {\n for (const app of apps) {\n await openJsInspector(app);\n }\n } catch (error: any) {\n Log.error('Failed to open JavaScript inspector. This is often an issue with Google Chrome.');\n Log.exception(error);\n }\n }\n\n reloadApp() {\n Log.log(`${BLT} Reloading apps`);\n // Send reload requests over the dev servers\n this.devServerManager.broadcastMessage('reload');\n }\n\n async openMoreToolsAsync() {\n try {\n // Options match: Chrome > View > Developer\n const value = await selectAsync(chalk`Dev tools {dim (native only)}`, [\n { title: 'Inspect elements', value: 'toggleElementInspector' },\n { title: 'Toggle performance monitor', value: 'togglePerformanceMonitor' },\n { title: 'Toggle developer menu', value: 'toggleDevMenu' },\n { title: 'Reload app', value: 'reload' },\n { title: 'Start React devtools', value: 'startReactDevTools' },\n // TODO: Maybe a \"View Source\" option to open code.\n // Toggling Remote JS Debugging is pretty rough, so leaving it disabled.\n // { title: 'Toggle Remote Debugging', value: 'toggleRemoteDebugging' },\n ]);\n if (value === 'startReactDevTools') {\n this.startReactDevToolsAsync();\n } else {\n this.devServerManager.broadcastMessage('sendDevCommand', { name: value });\n }\n } catch (error: any) {\n debug(error);\n // do nothing\n } finally {\n printHelp();\n }\n }\n\n async startReactDevToolsAsync() {\n await startReactDevToolsProxyAsync();\n const url = this.devServerManager.getDefaultDevServer().getReactDevToolsUrl();\n await openBrowserAsync(url);\n addReactDevToolsReloadListener(() => {\n this.reconnectReactDevTools();\n });\n this.reconnectReactDevTools();\n }\n\n async reconnectReactDevTools() {\n // Wait a little time for react-devtools to be initialized in browser\n await delayAsync(3000);\n this.devServerManager.broadcastMessage('sendDevCommand', { name: 'reconnectReactDevTools' });\n }\n\n toggleDevMenu() {\n Log.log(`${BLT} Toggling dev menu`);\n this.devServerManager.broadcastMessage('devMenu');\n }\n}\n"],"names":["Log","debug","require","DevServerManagerActions","constructor","devServerManager","printDevServerInfo","options","getNativeDevServerPort","devServer","getDefaultDevServer","nativeRuntimeUrl","getNativeRuntimeUrl","interstitialPageUrl","getRedirectUrl","printQRCode","log","printItem","chalk","devClient","learnMore","error","console","code","serverUrl","getDevServerUrl","webDevServer","getWebDevServer","webUrl","hostType","printUsage","verbose","printHelp","openJsInspectorAsync","metroServerOrigin","getJsInspectorBaseUrl","assert","apps","queryAllInspectorAppsAsync","length","warn","app","openJsInspector","exception","reloadApp","BLT","broadcastMessage","openMoreToolsAsync","value","selectAsync","title","startReactDevToolsAsync","name","startReactDevToolsProxyAsync","url","getReactDevToolsUrl","openBrowserAsync","addReactDevToolsReloadListener","reconnectReactDevTools","delayAsync","toggleDevMenu"],"mappings":"AAAA;;;;AAA4D,IAAA,UAAkB,WAAlB,kBAAkB,CAAA;AAC3D,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACE,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACvB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbA,IAAAA,GAAG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K,mBAAmB,EAAE,CAAC6C,mBAAmB,EAAE,AAAC;QAC9E,MAAMC,CAAAA,GAAAA,UAAgB,AAAK,CAAA,QAAL,CAACF,GAAG,CAAC,CAAC;QAC5BG,CAAAA,GAAAA,mBAA8B,AAE5B,CAAA,+BAF4B,CAAC,IAAM;YACnC,IAAI,CAACC,sBAAsB,EAAE,CAAC;SAC/B,CAAC,CAAC;QACH,IAAI,CAACA,sBAAsB,EAAE,CAAC;KAC/B;IAED,MAAMA,sBAAsB,GAAG;QAC7B,qEAAqE;QACrE,MAAMC,CAAAA,GAAAA,MAAU,AAAM,CAAA,WAAN,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAACtD,gBAAgB,CAACyC,gBAAgB,CAAC,gBAAgB,EAAE;YAAEM,IAAI,EAAE,wBAAwB;SAAE,CAAC,CAAC;KAC9F;IAEDQ,aAAa,GAAG;QACd5D,GAAG,CAACgB,GAAG,CAAC,CAAC,EAAE6B,cAAG,IAAA,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACpC,IAAI,CAACxC,gBAAgB,CAACyC,gBAAgB,CAAC,SAAS,CAAC,CAAC;KACnD;CACF;QAxIY3C,uBAAuB,GAAvBA,uBAAuB"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/interface/interactiveActions.ts"],"sourcesContent":["import { openJsInspector, queryAllInspectorAppsAsync } from '@expo/dev-server';\nimport assert from 'assert';\nimport chalk from 'chalk';\n\nimport * as Log from '../../log';\nimport { delayAsync } from '../../utils/delay';\nimport { learnMore } from '../../utils/link';\nimport { openBrowserAsync } from '../../utils/open';\nimport { selectAsync } from '../../utils/prompts';\nimport { DevServerManager } from '../server/DevServerManager';\nimport {\n addReactDevToolsReloadListener,\n startReactDevToolsProxyAsync,\n} from '../server/ReactDevToolsProxy';\nimport { BLT, printHelp, printItem, printQRCode, printUsage, StartOptions } from './commandsTable';\n\nconst debug = require('debug')('expo:start:interface:interactiveActions') as typeof console.log;\n\n/** Wraps the DevServerManager and adds an interface for user actions. */\nexport class DevServerManagerActions {\n constructor(private devServerManager: DevServerManager) {}\n\n printDevServerInfo(\n options: Pick<StartOptions, 'devClient' | 'isWebSocketsEnabled' | 'platforms'>\n ) {\n // If native dev server is running, print its URL.\n if (this.devServerManager.getNativeDevServerPort()) {\n const devServer = this.devServerManager.getDefaultDevServer();\n try {\n const nativeRuntimeUrl = devServer.getNativeRuntimeUrl()!;\n const interstitialPageUrl = devServer.getRedirectUrl();\n\n printQRCode(interstitialPageUrl ?? nativeRuntimeUrl);\n\n if (interstitialPageUrl) {\n Log.log(\n printItem(\n chalk`Choose an app to open your project at {underline ${interstitialPageUrl}}`\n )\n );\n }\n Log.log(printItem(chalk`Metro waiting on {underline ${nativeRuntimeUrl}}`));\n if (options.devClient === false) {\n // TODO: if development build, change this message!\n Log.log(\n printItem('Scan the QR code above with Expo Go (Android) or the Camera app (iOS)')\n );\n } else {\n Log.log(\n printItem(\n 'Scan the QR code above to open the project in a development build. ' +\n learnMore('https://expo.fyi/start')\n )\n );\n }\n } catch (error) {\n console.log('err', error);\n // @ts-ignore: If there is no development build scheme, then skip the QR code.\n if (error.code !== 'NO_DEV_CLIENT_SCHEME') {\n throw error;\n } else {\n const serverUrl = devServer.getDevServerUrl();\n Log.log(printItem(chalk`Metro waiting on {underline ${serverUrl}}`));\n Log.log(printItem(`Linking is disabled because the client scheme cannot be resolved.`));\n }\n }\n }\n\n const webDevServer = this.devServerManager.getWebDevServer();\n const webUrl = webDevServer?.getDevServerUrl({ hostType: 'localhost' });\n if (webUrl) {\n Log.log();\n Log.log(printItem(chalk`Web is waiting on {underline ${webUrl}}`));\n }\n\n printUsage(options, { verbose: false });\n printHelp();\n Log.log();\n }\n\n async openJsInspectorAsync() {\n Log.log('Opening JavaScript inspector in the browser...');\n const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();\n assert(metroServerOrigin, 'Metro dev server is not running');\n const apps = await queryAllInspectorAppsAsync(metroServerOrigin);\n if (!apps.length) {\n Log.warn(\n `No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine. ${learnMore(\n 'https://docs.expo.dev/guides/using-hermes/'\n )}`\n );\n return;\n }\n try {\n for (const app of apps) {\n await openJsInspector(app);\n }\n } catch (error: any) {\n Log.error('Failed to open JavaScript inspector. This is often an issue with Google Chrome.');\n Log.exception(error);\n }\n }\n\n reloadApp() {\n Log.log(`${BLT} Reloading apps`);\n // Send reload requests over the dev servers\n this.devServerManager.broadcastMessage('reload');\n }\n\n async openMoreToolsAsync() {\n try {\n // Options match: Chrome > View > Developer\n const value = await selectAsync(chalk`Dev tools {dim (native only)}`, [\n { title: 'Inspect elements', value: 'toggleElementInspector' },\n { title: 'Toggle performance monitor', value: 'togglePerformanceMonitor' },\n { title: 'Toggle developer menu', value: 'toggleDevMenu' },\n { title: 'Reload app', value: 'reload' },\n { title: 'Start React devtools', value: 'startReactDevTools' },\n // TODO: Maybe a \"View Source\" option to open code.\n // Toggling Remote JS Debugging is pretty rough, so leaving it disabled.\n // { title: 'Toggle Remote Debugging', value: 'toggleRemoteDebugging' },\n ]);\n if (value === 'startReactDevTools') {\n this.startReactDevToolsAsync();\n } else {\n this.devServerManager.broadcastMessage('sendDevCommand', { name: value });\n }\n } catch (error: any) {\n debug(error);\n // do nothing\n } finally {\n printHelp();\n }\n }\n\n async startReactDevToolsAsync() {\n await startReactDevToolsProxyAsync();\n const url = this.devServerManager.getDefaultDevServer().getReactDevToolsUrl();\n await openBrowserAsync(url);\n addReactDevToolsReloadListener(() => {\n this.reconnectReactDevTools();\n });\n this.reconnectReactDevTools();\n }\n\n async reconnectReactDevTools() {\n // Wait a little time for react-devtools to be initialized in browser\n await delayAsync(3000);\n this.devServerManager.broadcastMessage('sendDevCommand', { name: 'reconnectReactDevTools' });\n }\n\n toggleDevMenu() {\n Log.log(`${BLT} Toggling dev menu`);\n this.devServerManager.broadcastMessage('devMenu');\n }\n}\n"],"names":["Log","debug","require","DevServerManagerActions","constructor","devServerManager","printDevServerInfo","options","getNativeDevServerPort","devServer","getDefaultDevServer","nativeRuntimeUrl","getNativeRuntimeUrl","interstitialPageUrl","getRedirectUrl","printQRCode","log","printItem","chalk","devClient","learnMore","error","console","code","serverUrl","getDevServerUrl","webDevServer","getWebDevServer","webUrl","hostType","printUsage","verbose","printHelp","openJsInspectorAsync","metroServerOrigin","getJsInspectorBaseUrl","assert","apps","queryAllInspectorAppsAsync","length","warn","app","openJsInspector","exception","reloadApp","BLT","broadcastMessage","openMoreToolsAsync","value","selectAsync","title","startReactDevToolsAsync","name","startReactDevToolsProxyAsync","url","getReactDevToolsUrl","openBrowserAsync","addReactDevToolsReloadListener","reconnectReactDevTools","delayAsync","toggleDevMenu"],"mappings":"AAAA;;;;AAA4D,IAAA,UAAkB,WAAlB,kBAAkB,CAAA;AAC3D,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbA,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACY,IAAA,MAAmB,WAAnB,mBAAmB,CAAA;AACpB,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AACX,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AACvB,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AAK1C,IAAA,mBAA8B,WAA9B,8BAA8B,CAAA;AAC4C,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElG,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,yCAAyC,CAAC,AAAsB,AAAC;AAGzF,MAAMC,uBAAuB;IAClCC,YAAoBC,gBAAkC,CAAE;aAApCA,gBAAkC,GAAlCA,gBAAkC;KAAI;IAE1DC,kBAAkB,CAChBC,OAA8E,EAC9E;QACA,kDAAkD;QAClD,IAAI,IAAI,CAACF,gBAAgB,CAACG,sBAAsB,EAAE,EAAE;YAClD,MAAMC,SAAS,GAAG,IAAI,CAACJ,gBAAgB,CAACK,mBAAm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A,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACpC,IAAI,CAACxC,gBAAgB,CAACyC,gBAAgB,CAAC,SAAS,CAAC,CAAC;KACnD;CACF;QAxIY3C,uBAAuB,GAAvBA,uBAAuB"}
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
var _assert = _interopRequireDefault(require("assert"));
|
|
6
|
-
var _betterOpn = _interopRequireDefault(require("better-opn"));
|
|
7
6
|
var _resolveFrom = _interopRequireDefault(require("resolve-from"));
|
|
8
7
|
var Log = _interopRequireWildcard(require("../../log"));
|
|
9
8
|
var _fileNotifier = require("../../utils/FileNotifier");
|
|
10
9
|
var _delay = require("../../utils/delay");
|
|
11
10
|
var _env = require("../../utils/env");
|
|
12
11
|
var _errors = require("../../utils/errors");
|
|
12
|
+
var _open = require("../../utils/open");
|
|
13
13
|
var _asyncNgrok = require("./AsyncNgrok");
|
|
14
14
|
var _developmentSession = require("./DevelopmentSession");
|
|
15
15
|
var _urlCreator = require("./UrlCreator");
|
|
@@ -288,7 +288,7 @@ class BundlerDevServer {
|
|
|
288
288
|
var ref;
|
|
289
289
|
// Allow opening the tunnel URL when using Metro web.
|
|
290
290
|
const url = this.name === "metro" ? (ref = this.getTunnelUrl()) != null ? ref : serverUrl : serverUrl;
|
|
291
|
-
await (0,
|
|
291
|
+
await (0, _open).openBrowserAsync(url);
|
|
292
292
|
return {
|
|
293
293
|
url
|
|
294
294
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/server/BundlerDevServer.ts"],"sourcesContent":["import { MessageSocket } from '@expo/dev-server';\nimport assert from 'assert';\nimport openBrowserAsync from 'better-opn';\nimport resolveFrom from 'resolve-from';\n\nimport * as Log from '../../log';\nimport { FileNotifier } from '../../utils/FileNotifier';\nimport { resolveWithTimeout } from '../../utils/delay';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport {\n BaseOpenInCustomProps,\n BaseResolveDeviceProps,\n PlatformManager,\n} from '../platforms/PlatformManager';\nimport { AsyncNgrok } from './AsyncNgrok';\nimport { DevelopmentSession } from './DevelopmentSession';\nimport { CreateURLOptions, UrlCreator } from './UrlCreator';\nimport { PlatformBundlers } from './platformBundlers';\n\nconst debug = require('debug')('expo:start:server:devServer') as typeof console.log;\n\nexport type ServerLike = {\n close(callback?: (err?: Error) => void): void;\n addListener?(event: string, listener: (...args: any[]) => void): unknown;\n};\n\nexport type DevServerInstance = {\n /** Bundler dev server instance. */\n server: ServerLike;\n /** Dev server URL location properties. */\n location: {\n url: string;\n port: number;\n protocol: 'http' | 'https';\n host?: string;\n };\n /** Additional middleware that's attached to the `server`. */\n middleware: any;\n /** Message socket for communicating with the runtime. */\n messageSocket: MessageSocket;\n};\n\nexport interface BundlerStartOptions {\n /** Should the dev server use `https` protocol. */\n https?: boolean;\n /** Should start the dev servers in development mode (minify). */\n mode?: 'development' | 'production';\n /** Is dev client enabled. */\n devClient?: boolean;\n /** Should run dev servers with clean caches. */\n resetDevServer?: boolean;\n /** Which manifest type to serve. */\n forceManifestType?: 'expo-updates' | 'classic';\n /** Code signing private key path (defaults to same directory as certificate) */\n privateKeyPath?: string;\n\n /** Max amount of workers (threads) to use with Metro bundler, defaults to undefined for max workers. */\n maxWorkers?: number;\n /** Port to start the dev server on. */\n port?: number;\n\n /** Should start a headless dev server e.g. mock representation to approximate info from a server running in a different process. */\n headless?: boolean;\n /** Should instruct the bundler to create minified bundles. */\n minify?: boolean;\n\n // Webpack options\n /** Should modify and create PWA icons. */\n isImageEditingEnabled?: boolean;\n\n location: CreateURLOptions;\n}\n\nconst PLATFORM_MANAGERS = {\n simulator: () =>\n require('../platforms/ios/ApplePlatformManager')\n .ApplePlatformManager as typeof import('../platforms/ios/ApplePlatformManager').ApplePlatformManager,\n emulator: () =>\n require('../platforms/android/AndroidPlatformManager')\n .AndroidPlatformManager as typeof import('../platforms/android/AndroidPlatformManager').AndroidPlatformManager,\n};\n\nconst MIDDLEWARES = {\n classic: () =>\n require('./middleware/ClassicManifestMiddleware')\n .ClassicManifestMiddleware as typeof import('./middleware/ClassicManifestMiddleware').ClassicManifestMiddleware,\n 'expo-updates': () =>\n require('./middleware/ExpoGoManifestHandlerMiddleware')\n .ExpoGoManifestHandlerMiddleware as typeof import('./middleware/ExpoGoManifestHandlerMiddleware').ExpoGoManifestHandlerMiddleware,\n};\n\nexport abstract class BundlerDevServer {\n /** Name of the bundler. */\n abstract get name(): string;\n\n /** Ngrok instance for managing tunnel connections. */\n protected ngrok: AsyncNgrok | null = null;\n /** Interfaces with the Expo 'Development Session' API. */\n protected devSession: DevelopmentSession | null = null;\n /** Http server and related info. */\n protected instance: DevServerInstance | null = null;\n /** Native platform interfaces for opening projects. */\n private platformManagers: Record<string, PlatformManager<any>> = {};\n /** Manages the creation of dev server URLs. */\n protected urlCreator?: UrlCreator | null = null;\n\n private notifier: FileNotifier | null = null;\n\n constructor(\n /** Project root folder. */\n public projectRoot: string,\n /** A mapping of bundlers to platforms. */\n public platformBundlers: PlatformBundlers,\n // TODO: Replace with custom scheme maybe...\n public isDevClient?: boolean\n ) {}\n\n protected setInstance(instance: DevServerInstance) {\n this.instance = instance;\n }\n\n /** Get the manifest middleware function. */\n protected async getManifestMiddlewareAsync(\n options: Pick<\n BundlerStartOptions,\n 'minify' | 'mode' | 'forceManifestType' | 'privateKeyPath'\n > = {}\n ) {\n const manifestType = options.forceManifestType || 'classic';\n assert(manifestType in MIDDLEWARES, `Manifest middleware for type '${manifestType}' not found`);\n const Middleware = MIDDLEWARES[manifestType]();\n\n const urlCreator = this.getUrlCreator();\n const middleware = new Middleware(this.projectRoot, {\n constructUrl: urlCreator.constructUrl.bind(urlCreator),\n mode: options.mode,\n minify: options.minify,\n isNativeWebpack: this.name === 'webpack' && this.isTargetingNative(),\n privateKeyPath: options.privateKeyPath,\n });\n return middleware;\n }\n\n /** Start the dev server using settings defined in the start command. */\n public async startAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n await this.stopAsync();\n\n let instance: DevServerInstance;\n if (options.headless) {\n instance = await this.startHeadlessAsync(options);\n } else {\n instance = await this.startImplementationAsync(options);\n }\n\n this.setInstance(instance);\n await this.postStartAsync(options);\n return instance;\n }\n\n protected abstract startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance>;\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n return false;\n }\n\n public abstract startTypeScriptServices(): Promise<void>;\n\n public async watchEnvironmentVariables(): Promise<void> {\n // noop -- We've only implemented this functionality in Metro.\n }\n\n /**\n * Creates a mock server representation that can be used to estimate URLs for a server started in another process.\n * This is used for the run commands where you can reuse the server from a previous run.\n */\n private async startHeadlessAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n if (!options.port)\n throw new CommandError('HEADLESS_SERVER', 'headless dev server requires a port option');\n this.urlCreator = this.getUrlCreator(options);\n\n return {\n // Create a mock server\n server: {\n close: () => {\n this.instance = null;\n },\n addListener() {},\n },\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware: {},\n messageSocket: {\n broadcast: () => {\n throw new CommandError('HEADLESS_SERVER', 'Cannot broadcast messages to headless server');\n },\n },\n };\n }\n\n /**\n * Runs after the `startAsync` function, performing any additional common operations.\n * You can assume the dev server is started by the time this function is called.\n */\n protected async postStartAsync(options: BundlerStartOptions) {\n if (\n options.location.hostType === 'tunnel' &&\n !env.EXPO_OFFLINE &&\n // This is a hack to prevent using tunnel on web since we block it upstream for some reason.\n this.isTargetingNative()\n ) {\n await this._startTunnelAsync();\n }\n await this.startDevSessionAsync();\n\n this.watchConfig();\n }\n\n protected abstract getConfigModuleIds(): string[];\n\n protected watchConfig() {\n this.notifier?.stopObserving();\n this.notifier = new FileNotifier(this.projectRoot, this.getConfigModuleIds());\n this.notifier.startObserving();\n }\n\n /** Create ngrok instance and start the tunnel server. Exposed for testing. */\n public async _startTunnelAsync(): Promise<AsyncNgrok | null> {\n const port = this.getInstance()?.location.port;\n if (!port) return null;\n debug('[ngrok] connect to port: ' + port);\n this.ngrok = new AsyncNgrok(this.projectRoot, port);\n await this.ngrok.startAsync();\n return this.ngrok;\n }\n\n protected async startDevSessionAsync() {\n // This is used to make Expo Go open the project in either Expo Go, or the web browser.\n // Must come after ngrok (`startTunnelAsync`) setup.\n this.devSession?.stopNotifying?.();\n this.devSession = new DevelopmentSession(\n this.projectRoot,\n // This URL will be used on external devices so the computer IP won't be relevant.\n this.isTargetingNative()\n ? this.getNativeRuntimeUrl()\n : this.getDevServerUrl({ hostType: 'localhost' }),\n () => {\n // TODO: This appears to be happening consistently after an hour.\n // We should investigate why this is happening and fix it on our servers.\n // Log.error(\n // chalk.red(\n // '\\nAn unexpected error occurred while updating the Dev Session API. This project will not appear in the \"Development servers\" section of the Expo Go app until this process has been restarted.'\n // )\n // );\n // Log.exception(error);\n this.devSession?.closeAsync().catch((error) => {\n debug('[dev-session] error closing: ' + error.message);\n });\n }\n );\n\n await this.devSession.startAsync({\n runtime: this.isTargetingNative() ? 'native' : 'web',\n });\n }\n\n public isTargetingNative() {\n // Temporary hack while we implement multi-bundler dev server proxy.\n return true;\n }\n\n public isTargetingWeb() {\n return this.platformBundlers.web === this.name;\n }\n\n /**\n * Sends a message over web sockets to any connected device,\n * does nothing when the dev server is not running.\n *\n * @param method name of the command. In RN projects `reload`, and `devMenu` are available. In Expo Go, `sendDevCommand` is available.\n * @param params\n */\n public broadcastMessage(\n method: 'reload' | 'devMenu' | 'sendDevCommand',\n params?: Record<string, any>\n ) {\n this.getInstance()?.messageSocket.broadcast(method, params);\n }\n\n /** Get the running dev server instance. */\n public getInstance() {\n return this.instance;\n }\n\n /** Stop the running dev server instance. */\n async stopAsync() {\n // Stop file watching.\n this.notifier?.stopObserving();\n\n // Stop the dev session timer and tell Expo API to remove dev session.\n await this.devSession?.closeAsync();\n\n // Stop ngrok if running.\n await this.ngrok?.stopAsync().catch((e) => {\n Log.error(`Error stopping ngrok:`);\n Log.exception(e);\n });\n\n return resolveWithTimeout(\n () =>\n new Promise<void>((resolve, reject) => {\n // Close the server.\n debug(`Stopping dev server (bundler: ${this.name})`);\n\n if (this.instance?.server) {\n this.instance.server.close((error) => {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n });\n } else {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n resolve();\n }\n }),\n {\n // NOTE(Bacon): Metro dev server doesn't seem to be closing in time.\n timeout: 1000,\n errorMessage: `Timeout waiting for '${this.name}' dev server to close`,\n }\n );\n }\n\n public getUrlCreator(options: Partial<Pick<BundlerStartOptions, 'port' | 'location'>> = {}) {\n if (!this.urlCreator) {\n assert(options?.port, 'Dev server instance not found');\n this.urlCreator = new UrlCreator(options.location, {\n port: options.port,\n getTunnelUrl: this.getTunnelUrl.bind(this),\n });\n }\n return this.urlCreator;\n }\n\n public getNativeRuntimeUrl(opts: Partial<CreateURLOptions> = {}) {\n return this.isDevClient\n ? this.getUrlCreator().constructDevClientUrl(opts) ?? this.getDevServerUrl()\n : this.getUrlCreator().constructUrl({ ...opts, scheme: 'exp' });\n }\n\n /** Get the URL for the running instance of the dev server. */\n public getDevServerUrl(options: { hostType?: 'localhost' } = {}): string | null {\n const instance = this.getInstance();\n if (!instance?.location) {\n return null;\n }\n const { location } = instance;\n if (options.hostType === 'localhost') {\n return `${location.protocol}://localhost:${location.port}`;\n }\n return location.url ?? null;\n }\n\n /** Get the base URL for JS inspector */\n public getJsInspectorBaseUrl(): string {\n if (this.name !== 'metro') {\n throw new CommandError(\n 'DEV_SERVER',\n `Cannot get the JS inspector base url - bundler[${this.name}]`\n );\n }\n return this.getUrlCreator().constructUrl({ scheme: 'http' });\n }\n\n /** Get the tunnel URL from ngrok. */\n public getTunnelUrl(): string | null {\n return this.ngrok?.getActiveUrl() ?? null;\n }\n\n /** Open the dev server in a runtime. */\n public async openPlatformAsync(\n launchTarget: keyof typeof PLATFORM_MANAGERS | 'desktop',\n resolver: BaseResolveDeviceProps<any> = {}\n ) {\n if (launchTarget === 'desktop') {\n const serverUrl = this.getDevServerUrl({ hostType: 'localhost' });\n // Allow opening the tunnel URL when using Metro web.\n const url = this.name === 'metro' ? this.getTunnelUrl() ?? serverUrl : serverUrl;\n await openBrowserAsync(url!);\n return { url };\n }\n\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync({ runtime }, resolver);\n }\n\n /** Open the dev server in a runtime. */\n public async openCustomRuntimeAsync(\n launchTarget: keyof typeof PLATFORM_MANAGERS,\n launchProps: Partial<BaseOpenInCustomProps> = {},\n resolver: BaseResolveDeviceProps<any> = {}\n ) {\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n if (runtime !== 'custom') {\n throw new CommandError(\n `dev server cannot open custom runtimes either because it does not target native platforms or because it is not targeting dev clients. (target: ${runtime})`\n );\n }\n\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync({ runtime: 'custom', props: launchProps }, resolver);\n }\n\n /** Get the URL for opening in Expo Go. */\n protected getExpoGoUrl(): string {\n return this.getUrlCreator().constructUrl({ scheme: 'exp' });\n }\n\n /** Should use the interstitial page for selecting which runtime to use. */\n protected isRedirectPageEnabled(): boolean {\n return (\n !env.EXPO_NO_REDIRECT_PAGE &&\n // if user passed --dev-client flag, skip interstitial page\n !this.isDevClient &&\n // Checks if dev client is installed.\n !!resolveFrom.silent(this.projectRoot, 'expo-dev-client')\n );\n }\n\n /** Get the redirect URL when redirecting is enabled. */\n public getRedirectUrl(platform: keyof typeof PLATFORM_MANAGERS | null = null): string | null {\n if (!this.isRedirectPageEnabled()) {\n debug('Redirect page is disabled');\n return null;\n }\n\n return (\n this.getUrlCreator().constructLoadingUrl(\n {},\n platform === 'emulator' ? 'android' : platform === 'simulator' ? 'ios' : null\n ) ?? null\n );\n }\n\n public getReactDevToolsUrl(): string {\n return new URL(\n '_expo/react-devtools',\n this.getUrlCreator().constructUrl({ scheme: 'http' })\n ).toString();\n }\n\n protected async getPlatformManagerAsync(platform: keyof typeof PLATFORM_MANAGERS) {\n if (!this.platformManagers[platform]) {\n const Manager = PLATFORM_MANAGERS[platform]();\n const port = this.getInstance()?.location.port;\n if (!port || !this.urlCreator) {\n throw new CommandError(\n 'DEV_SERVER',\n 'Cannot interact with native platforms until dev server has started'\n );\n }\n debug(`Creating platform manager (platform: ${platform}, port: ${port})`);\n this.platformManagers[platform] = new Manager(this.projectRoot, port, {\n getCustomRuntimeUrl: this.urlCreator.constructDevClientUrl.bind(this.urlCreator),\n getExpoGoUrl: this.getExpoGoUrl.bind(this),\n getRedirectUrl: this.getRedirectUrl.bind(this, platform),\n getDevServerUrl: this.getDevServerUrl.bind(this, { hostType: 'localhost' }),\n });\n }\n return this.platformManagers[platform];\n }\n}\n"],"names":["Log","debug","require","PLATFORM_MANAGERS","simulator","ApplePlatformManager","emulator","AndroidPlatformManager","MIDDLEWARES","classic","ClassicManifestMiddleware","ExpoGoManifestHandlerMiddleware","BundlerDevServer","constructor","projectRoot","platformBundlers","isDevClient","ngrok","devSession","instance","platformManagers","urlCreator","notifier","setInstance","getManifestMiddlewareAsync","options","manifestType","forceManifestType","assert","Middleware","getUrlCreator","middleware","constructUrl","bind","mode","minify","isNativeWebpack","name","isTargetingNative","privateKeyPath","startAsync","stopAsync","headless","startHeadlessAsync","startImplementationAsync","postStartAsync","waitForTypeScriptAsync","watchEnvironmentVariables","port","CommandError","server","close","addListener","location","host","url","protocol","messageSocket","broadcast","hostType","env","EXPO_OFFLINE","_startTunnelAsync","startDevSessionAsync","watchConfig","stopObserving","FileNotifier","getConfigModuleIds","startObserving","getInstance","AsyncNgrok","stopNotifying","DevelopmentSession","getNativeRuntimeUrl","getDevServerUrl","closeAsync","catch","error","message","runtime","isTargetingWeb","web","broadcastMessage","method","params","e","exception","resolveWithTimeout","Promise","resolve","reject","timeout","errorMessage","UrlCreator","getTunnelUrl","opts","constructDevClientUrl","scheme","getJsInspectorBaseUrl","getActiveUrl","openPlatformAsync","launchTarget","resolver","serverUrl","openBrowserAsync","manager","getPlatformManagerAsync","openAsync","openCustomRuntimeAsync","launchProps","props","getExpoGoUrl","isRedirectPageEnabled","EXPO_NO_REDIRECT_PAGE","resolveFrom","silent","getRedirectUrl","platform","constructLoadingUrl","getReactDevToolsUrl","URL","toString","Manager","getCustomRuntimeUrl"],"mappings":"AAAA;;;;AACmB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACE,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACjB,IAAA,YAAc,kCAAd,cAAc,EAAA;AAE1BA,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACc,IAAA,aAA0B,WAA1B,0BAA0B,CAAA;AACpB,IAAA,MAAmB,WAAnB,mBAAmB,CAAA;AAClC,IAAA,IAAiB,WAAjB,iBAAiB,CAAA;AACR,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AAMtB,IAAA,WAAc,WAAd,cAAc,CAAA;AACN,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACZ,IAAA,WAAc,WAAd,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG3D,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,6BAA6B,CAAC,AAAsB,AAAC;AAsDpF,MAAMC,iBAAiB,GAAG;IACxBC,SAAS,EAAE,IACTF,OAAO,CAAC,uCAAuC,CAAC,CAC7CG,oBAAoB;IAA+E;IACxGC,QAAQ,EAAE,IACRJ,OAAO,CAAC,6CAA6C,CAAC,CACnDK,sBAAsB;CAC5B,AAAC;AAEF,MAAMC,WAAW,GAAG;IAClBC,OAAO,EAAE,IACPP,OAAO,CAAC,wCAAwC,CAAC,CAC9CQ,yBAAyB;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C/D,IAAI,CAAC,IAAI,CAACZ,UAAU,CAAC;gBAChF0F,YAAY,EAAE,IAAI,CAACA,YAAY,CAAC9E,IAAI,CAAC,IAAI,CAAC;gBAC1CmF,cAAc,EAAE,IAAI,CAACA,cAAc,CAACnF,IAAI,CAAC,IAAI,EAAEoF,QAAQ,CAAC;gBACxD3C,eAAe,EAAE,IAAI,CAACA,eAAe,CAACzC,IAAI,CAAC,IAAI,EAAE;oBAAE0B,QAAQ,EAAE,WAAW;iBAAE,CAAC;aAC5E,CAAC,CAAC;SACJ;QACD,OAAO,IAAI,CAACvC,gBAAgB,CAACiG,QAAQ,CAAC,CAAC;KACxC;CACF;QA1YqBzG,gBAAgB,GAAhBA,gBAAgB"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/server/BundlerDevServer.ts"],"sourcesContent":["import { MessageSocket } from '@expo/dev-server';\nimport assert from 'assert';\nimport resolveFrom from 'resolve-from';\n\nimport * as Log from '../../log';\nimport { FileNotifier } from '../../utils/FileNotifier';\nimport { resolveWithTimeout } from '../../utils/delay';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { openBrowserAsync } from '../../utils/open';\nimport {\n BaseOpenInCustomProps,\n BaseResolveDeviceProps,\n PlatformManager,\n} from '../platforms/PlatformManager';\nimport { AsyncNgrok } from './AsyncNgrok';\nimport { DevelopmentSession } from './DevelopmentSession';\nimport { CreateURLOptions, UrlCreator } from './UrlCreator';\nimport { PlatformBundlers } from './platformBundlers';\n\nconst debug = require('debug')('expo:start:server:devServer') as typeof console.log;\n\nexport type ServerLike = {\n close(callback?: (err?: Error) => void): void;\n addListener?(event: string, listener: (...args: any[]) => void): unknown;\n};\n\nexport type DevServerInstance = {\n /** Bundler dev server instance. */\n server: ServerLike;\n /** Dev server URL location properties. */\n location: {\n url: string;\n port: number;\n protocol: 'http' | 'https';\n host?: string;\n };\n /** Additional middleware that's attached to the `server`. */\n middleware: any;\n /** Message socket for communicating with the runtime. */\n messageSocket: MessageSocket;\n};\n\nexport interface BundlerStartOptions {\n /** Should the dev server use `https` protocol. */\n https?: boolean;\n /** Should start the dev servers in development mode (minify). */\n mode?: 'development' | 'production';\n /** Is dev client enabled. */\n devClient?: boolean;\n /** Should run dev servers with clean caches. */\n resetDevServer?: boolean;\n /** Which manifest type to serve. */\n forceManifestType?: 'expo-updates' | 'classic';\n /** Code signing private key path (defaults to same directory as certificate) */\n privateKeyPath?: string;\n\n /** Max amount of workers (threads) to use with Metro bundler, defaults to undefined for max workers. */\n maxWorkers?: number;\n /** Port to start the dev server on. */\n port?: number;\n\n /** Should start a headless dev server e.g. mock representation to approximate info from a server running in a different process. */\n headless?: boolean;\n /** Should instruct the bundler to create minified bundles. */\n minify?: boolean;\n\n // Webpack options\n /** Should modify and create PWA icons. */\n isImageEditingEnabled?: boolean;\n\n location: CreateURLOptions;\n}\n\nconst PLATFORM_MANAGERS = {\n simulator: () =>\n require('../platforms/ios/ApplePlatformManager')\n .ApplePlatformManager as typeof import('../platforms/ios/ApplePlatformManager').ApplePlatformManager,\n emulator: () =>\n require('../platforms/android/AndroidPlatformManager')\n .AndroidPlatformManager as typeof import('../platforms/android/AndroidPlatformManager').AndroidPlatformManager,\n};\n\nconst MIDDLEWARES = {\n classic: () =>\n require('./middleware/ClassicManifestMiddleware')\n .ClassicManifestMiddleware as typeof import('./middleware/ClassicManifestMiddleware').ClassicManifestMiddleware,\n 'expo-updates': () =>\n require('./middleware/ExpoGoManifestHandlerMiddleware')\n .ExpoGoManifestHandlerMiddleware as typeof import('./middleware/ExpoGoManifestHandlerMiddleware').ExpoGoManifestHandlerMiddleware,\n};\n\nexport abstract class BundlerDevServer {\n /** Name of the bundler. */\n abstract get name(): string;\n\n /** Ngrok instance for managing tunnel connections. */\n protected ngrok: AsyncNgrok | null = null;\n /** Interfaces with the Expo 'Development Session' API. */\n protected devSession: DevelopmentSession | null = null;\n /** Http server and related info. */\n protected instance: DevServerInstance | null = null;\n /** Native platform interfaces for opening projects. */\n private platformManagers: Record<string, PlatformManager<any>> = {};\n /** Manages the creation of dev server URLs. */\n protected urlCreator?: UrlCreator | null = null;\n\n private notifier: FileNotifier | null = null;\n\n constructor(\n /** Project root folder. */\n public projectRoot: string,\n /** A mapping of bundlers to platforms. */\n public platformBundlers: PlatformBundlers,\n // TODO: Replace with custom scheme maybe...\n public isDevClient?: boolean\n ) {}\n\n protected setInstance(instance: DevServerInstance) {\n this.instance = instance;\n }\n\n /** Get the manifest middleware function. */\n protected async getManifestMiddlewareAsync(\n options: Pick<\n BundlerStartOptions,\n 'minify' | 'mode' | 'forceManifestType' | 'privateKeyPath'\n > = {}\n ) {\n const manifestType = options.forceManifestType || 'classic';\n assert(manifestType in MIDDLEWARES, `Manifest middleware for type '${manifestType}' not found`);\n const Middleware = MIDDLEWARES[manifestType]();\n\n const urlCreator = this.getUrlCreator();\n const middleware = new Middleware(this.projectRoot, {\n constructUrl: urlCreator.constructUrl.bind(urlCreator),\n mode: options.mode,\n minify: options.minify,\n isNativeWebpack: this.name === 'webpack' && this.isTargetingNative(),\n privateKeyPath: options.privateKeyPath,\n });\n return middleware;\n }\n\n /** Start the dev server using settings defined in the start command. */\n public async startAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n await this.stopAsync();\n\n let instance: DevServerInstance;\n if (options.headless) {\n instance = await this.startHeadlessAsync(options);\n } else {\n instance = await this.startImplementationAsync(options);\n }\n\n this.setInstance(instance);\n await this.postStartAsync(options);\n return instance;\n }\n\n protected abstract startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance>;\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n return false;\n }\n\n public abstract startTypeScriptServices(): Promise<void>;\n\n public async watchEnvironmentVariables(): Promise<void> {\n // noop -- We've only implemented this functionality in Metro.\n }\n\n /**\n * Creates a mock server representation that can be used to estimate URLs for a server started in another process.\n * This is used for the run commands where you can reuse the server from a previous run.\n */\n private async startHeadlessAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n if (!options.port)\n throw new CommandError('HEADLESS_SERVER', 'headless dev server requires a port option');\n this.urlCreator = this.getUrlCreator(options);\n\n return {\n // Create a mock server\n server: {\n close: () => {\n this.instance = null;\n },\n addListener() {},\n },\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware: {},\n messageSocket: {\n broadcast: () => {\n throw new CommandError('HEADLESS_SERVER', 'Cannot broadcast messages to headless server');\n },\n },\n };\n }\n\n /**\n * Runs after the `startAsync` function, performing any additional common operations.\n * You can assume the dev server is started by the time this function is called.\n */\n protected async postStartAsync(options: BundlerStartOptions) {\n if (\n options.location.hostType === 'tunnel' &&\n !env.EXPO_OFFLINE &&\n // This is a hack to prevent using tunnel on web since we block it upstream for some reason.\n this.isTargetingNative()\n ) {\n await this._startTunnelAsync();\n }\n await this.startDevSessionAsync();\n\n this.watchConfig();\n }\n\n protected abstract getConfigModuleIds(): string[];\n\n protected watchConfig() {\n this.notifier?.stopObserving();\n this.notifier = new FileNotifier(this.projectRoot, this.getConfigModuleIds());\n this.notifier.startObserving();\n }\n\n /** Create ngrok instance and start the tunnel server. Exposed for testing. */\n public async _startTunnelAsync(): Promise<AsyncNgrok | null> {\n const port = this.getInstance()?.location.port;\n if (!port) return null;\n debug('[ngrok] connect to port: ' + port);\n this.ngrok = new AsyncNgrok(this.projectRoot, port);\n await this.ngrok.startAsync();\n return this.ngrok;\n }\n\n protected async startDevSessionAsync() {\n // This is used to make Expo Go open the project in either Expo Go, or the web browser.\n // Must come after ngrok (`startTunnelAsync`) setup.\n this.devSession?.stopNotifying?.();\n this.devSession = new DevelopmentSession(\n this.projectRoot,\n // This URL will be used on external devices so the computer IP won't be relevant.\n this.isTargetingNative()\n ? this.getNativeRuntimeUrl()\n : this.getDevServerUrl({ hostType: 'localhost' }),\n () => {\n // TODO: This appears to be happening consistently after an hour.\n // We should investigate why this is happening and fix it on our servers.\n // Log.error(\n // chalk.red(\n // '\\nAn unexpected error occurred while updating the Dev Session API. This project will not appear in the \"Development servers\" section of the Expo Go app until this process has been restarted.'\n // )\n // );\n // Log.exception(error);\n this.devSession?.closeAsync().catch((error) => {\n debug('[dev-session] error closing: ' + error.message);\n });\n }\n );\n\n await this.devSession.startAsync({\n runtime: this.isTargetingNative() ? 'native' : 'web',\n });\n }\n\n public isTargetingNative() {\n // Temporary hack while we implement multi-bundler dev server proxy.\n return true;\n }\n\n public isTargetingWeb() {\n return this.platformBundlers.web === this.name;\n }\n\n /**\n * Sends a message over web sockets to any connected device,\n * does nothing when the dev server is not running.\n *\n * @param method name of the command. In RN projects `reload`, and `devMenu` are available. In Expo Go, `sendDevCommand` is available.\n * @param params\n */\n public broadcastMessage(\n method: 'reload' | 'devMenu' | 'sendDevCommand',\n params?: Record<string, any>\n ) {\n this.getInstance()?.messageSocket.broadcast(method, params);\n }\n\n /** Get the running dev server instance. */\n public getInstance() {\n return this.instance;\n }\n\n /** Stop the running dev server instance. */\n async stopAsync() {\n // Stop file watching.\n this.notifier?.stopObserving();\n\n // Stop the dev session timer and tell Expo API to remove dev session.\n await this.devSession?.closeAsync();\n\n // Stop ngrok if running.\n await this.ngrok?.stopAsync().catch((e) => {\n Log.error(`Error stopping ngrok:`);\n Log.exception(e);\n });\n\n return resolveWithTimeout(\n () =>\n new Promise<void>((resolve, reject) => {\n // Close the server.\n debug(`Stopping dev server (bundler: ${this.name})`);\n\n if (this.instance?.server) {\n this.instance.server.close((error) => {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n });\n } else {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n resolve();\n }\n }),\n {\n // NOTE(Bacon): Metro dev server doesn't seem to be closing in time.\n timeout: 1000,\n errorMessage: `Timeout waiting for '${this.name}' dev server to close`,\n }\n );\n }\n\n public getUrlCreator(options: Partial<Pick<BundlerStartOptions, 'port' | 'location'>> = {}) {\n if (!this.urlCreator) {\n assert(options?.port, 'Dev server instance not found');\n this.urlCreator = new UrlCreator(options.location, {\n port: options.port,\n getTunnelUrl: this.getTunnelUrl.bind(this),\n });\n }\n return this.urlCreator;\n }\n\n public getNativeRuntimeUrl(opts: Partial<CreateURLOptions> = {}) {\n return this.isDevClient\n ? this.getUrlCreator().constructDevClientUrl(opts) ?? this.getDevServerUrl()\n : this.getUrlCreator().constructUrl({ ...opts, scheme: 'exp' });\n }\n\n /** Get the URL for the running instance of the dev server. */\n public getDevServerUrl(options: { hostType?: 'localhost' } = {}): string | null {\n const instance = this.getInstance();\n if (!instance?.location) {\n return null;\n }\n const { location } = instance;\n if (options.hostType === 'localhost') {\n return `${location.protocol}://localhost:${location.port}`;\n }\n return location.url ?? null;\n }\n\n /** Get the base URL for JS inspector */\n public getJsInspectorBaseUrl(): string {\n if (this.name !== 'metro') {\n throw new CommandError(\n 'DEV_SERVER',\n `Cannot get the JS inspector base url - bundler[${this.name}]`\n );\n }\n return this.getUrlCreator().constructUrl({ scheme: 'http' });\n }\n\n /** Get the tunnel URL from ngrok. */\n public getTunnelUrl(): string | null {\n return this.ngrok?.getActiveUrl() ?? null;\n }\n\n /** Open the dev server in a runtime. */\n public async openPlatformAsync(\n launchTarget: keyof typeof PLATFORM_MANAGERS | 'desktop',\n resolver: BaseResolveDeviceProps<any> = {}\n ) {\n if (launchTarget === 'desktop') {\n const serverUrl = this.getDevServerUrl({ hostType: 'localhost' });\n // Allow opening the tunnel URL when using Metro web.\n const url = this.name === 'metro' ? this.getTunnelUrl() ?? serverUrl : serverUrl;\n await openBrowserAsync(url!);\n return { url };\n }\n\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync({ runtime }, resolver);\n }\n\n /** Open the dev server in a runtime. */\n public async openCustomRuntimeAsync(\n launchTarget: keyof typeof PLATFORM_MANAGERS,\n launchProps: Partial<BaseOpenInCustomProps> = {},\n resolver: BaseResolveDeviceProps<any> = {}\n ) {\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n if (runtime !== 'custom') {\n throw new CommandError(\n `dev server cannot open custom runtimes either because it does not target native platforms or because it is not targeting dev clients. (target: ${runtime})`\n );\n }\n\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync({ runtime: 'custom', props: launchProps }, resolver);\n }\n\n /** Get the URL for opening in Expo Go. */\n protected getExpoGoUrl(): string {\n return this.getUrlCreator().constructUrl({ scheme: 'exp' });\n }\n\n /** Should use the interstitial page for selecting which runtime to use. */\n protected isRedirectPageEnabled(): boolean {\n return (\n !env.EXPO_NO_REDIRECT_PAGE &&\n // if user passed --dev-client flag, skip interstitial page\n !this.isDevClient &&\n // Checks if dev client is installed.\n !!resolveFrom.silent(this.projectRoot, 'expo-dev-client')\n );\n }\n\n /** Get the redirect URL when redirecting is enabled. */\n public getRedirectUrl(platform: keyof typeof PLATFORM_MANAGERS | null = null): string | null {\n if (!this.isRedirectPageEnabled()) {\n debug('Redirect page is disabled');\n return null;\n }\n\n return (\n this.getUrlCreator().constructLoadingUrl(\n {},\n platform === 'emulator' ? 'android' : platform === 'simulator' ? 'ios' : null\n ) ?? null\n );\n }\n\n public getReactDevToolsUrl(): string {\n return new URL(\n '_expo/react-devtools',\n this.getUrlCreator().constructUrl({ scheme: 'http' })\n ).toString();\n }\n\n protected async getPlatformManagerAsync(platform: keyof typeof PLATFORM_MANAGERS) {\n if (!this.platformManagers[platform]) {\n const Manager = PLATFORM_MANAGERS[platform]();\n const port = this.getInstance()?.location.port;\n if (!port || !this.urlCreator) {\n throw new CommandError(\n 'DEV_SERVER',\n 'Cannot interact with native platforms until dev server has started'\n );\n }\n debug(`Creating platform manager (platform: ${platform}, port: ${port})`);\n this.platformManagers[platform] = new Manager(this.projectRoot, port, {\n getCustomRuntimeUrl: this.urlCreator.constructDevClientUrl.bind(this.urlCreator),\n getExpoGoUrl: this.getExpoGoUrl.bind(this),\n getRedirectUrl: this.getRedirectUrl.bind(this, platform),\n getDevServerUrl: this.getDevServerUrl.bind(this, { hostType: 'localhost' }),\n });\n }\n return this.platformManagers[platform];\n }\n}\n"],"names":["Log","debug","require","PLATFORM_MANAGERS","simulator","ApplePlatformManager","emulator","AndroidPlatformManager","MIDDLEWARES","classic","ClassicManifestMiddleware","ExpoGoManifestHandlerMiddleware","BundlerDevServer","constructor","projectRoot","platformBundlers","isDevClient","ngrok","devSession","instance","platformManagers","urlCreator","notifier","setInstance","getManifestMiddlewareAsync","options","manifestType","forceManifestType","assert","Middleware","getUrlCreator","middleware","constructUrl","bind","mode","minify","isNativeWebpack","name","isTargetingNative","privateKeyPath","startAsync","stopAsync","headless","startHeadlessAsync","startImplementationAsync","postStartAsync","waitForTypeScriptAsync","watchEnvironmentVariables","port","CommandError","server","close","addListener","location","host","url","protocol","messageSocket","broadcast","hostType","env","EXPO_OFFLINE","_startTunnelAsync","startDevSessionAsync","watchConfig","stopObserving","FileNotifier","getConfigModuleIds","startObserving","getInstance","AsyncNgrok","stopNotifying","DevelopmentSession","getNativeRuntimeUrl","getDevServerUrl","closeAsync","catch","error","message","runtime","isTargetingWeb","web","broadcastMessage","method","params","e","exception","resolveWithTimeout","Promise","resolve","reject","timeout","errorMessage","UrlCreator","getTunnelUrl","opts","constructDevClientUrl","scheme","getJsInspectorBaseUrl","getActiveUrl","openPlatformAsync","launchTarget","resolver","serverUrl","openBrowserAsync","manager","getPlatformManagerAsync","openAsync","openCustomRuntimeAsync","launchProps","props","getExpoGoUrl","isRedirectPageEnabled","EXPO_NO_REDIRECT_PAGE","resolveFrom","silent","getRedirectUrl","platform","constructLoadingUrl","getReactDevToolsUrl","URL","toString","Manager","getCustomRuntimeUrl"],"mappings":"AAAA;;;;AACmB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACH,IAAA,YAAc,kCAAd,cAAc,EAAA;AAE1BA,IAAAA,GAAG,mCAAM,WA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4
4
|
});
|
|
5
5
|
exports.createInspectorDeviceClass = createInspectorDeviceClass;
|
|
6
6
|
var _nodeFetch = _interopRequireDefault(require("node-fetch"));
|
|
7
|
-
var _debuggerScriptSource = require("./handlers/DebuggerScriptSource");
|
|
8
7
|
var _networkResponse = require("./handlers/NetworkResponse");
|
|
9
8
|
var _pageReload = require("./handlers/PageReload");
|
|
10
9
|
var _vscodeDebuggerGetPossibleBreakpoints = require("./handlers/VscodeDebuggerGetPossibleBreakpoints");
|
|
@@ -22,7 +21,6 @@ function createInspectorDeviceClass(metroBundler, MetroDeviceClass) {
|
|
|
22
21
|
/** All handlers that should be used to intercept or reply to CDP events */ handlers = [
|
|
23
22
|
// Generic handlers
|
|
24
23
|
new _networkResponse.NetworkResponseHandler(),
|
|
25
|
-
new _debuggerScriptSource.DebuggerScriptSourceHandler(this),
|
|
26
24
|
new _pageReload.PageReloadHandler(metroBundler),
|
|
27
25
|
// Vscode-specific handlers
|
|
28
26
|
new _vscodeDebuggerGetPossibleBreakpoints.VscodeDebuggerGetPossibleBreakpointsHandler(),
|
|
@@ -1 +1 @@
|
|
|
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 { MetroBundlerDevServer } from '../MetroBundlerDevServer';\nimport { DebuggerScriptSourceHandler } from './handlers/DebuggerScriptSource';\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 { VscodeRuntimeGetPropertiesHandler } from './handlers/VscodeRuntimeGetProperties';\nimport { DeviceRequest, InspectorHandler, DebuggerRequest } from './handlers/types';\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 DebuggerScriptSourceHandler(this),\n new PageReloadHandler(metroBundler),\n // Vscode-specific handlers\n new VscodeDebuggerGetPossibleBreakpointsHandler(),\n new VscodeDebuggerScriptParsedHandler(this),\n new VscodeDebuggerSetBreakpointByUrlHandler(),\n new VscodeRuntimeGetPropertiesHandler(),\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","DebuggerScriptSourceHandler","PageReloadHandler","VscodeDebuggerGetPossibleBreakpointsHandler","VscodeDebuggerScriptParsedHandler","VscodeDebuggerSetBreakpointByUrlHandler","VscodeRuntimeGetPropertiesHandler","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;AAIc,IAAA,qBAAiC,WAAjC,iCAAiC,CAAA;AACtC,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;AACnD,IAAA,2BAAuC,WAAvC,uCAAuC,CAAA;;;;;;AASlF,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,qBAA2B,4BAAA,CAAC,IAAI,CAAC;YACrC,IAAIC,WAAiB,kBAAA,CAACP,YAAY,CAAC;YACnC,2BAA2B;YAC3B,IAAIQ,qCAA2C,4CAAA,EAAE;YACjD,IAAIC,2BAAiC,kCAAA,CAAC,IAAI,CAAC;YAC3C,IAAIC,iCAAuC,wCAAA,EAAE;YAC7C,IAAIC,2BAAiC,kCAAA,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AAQ,CAACI,MAAM,CAAC,iBAAiB,EAAEN,GAAG,CAAC,CAAC,CAAC,CAAC;aAC9E;YAED,MAAMO,aAAa,GAAGL,QAAQ,CAACM,OAAO,CAACC,GAAG,CAAC,gBAAgB,CAAC,AAAC;YAC7D,IAAIF,aAAa,IAAIG,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
|
+
{"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 { MetroBundlerDevServer } from '../MetroBundlerDevServer';\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 { VscodeRuntimeGetPropertiesHandler } from './handlers/VscodeRuntimeGetProperties';\nimport { DeviceRequest, InspectorHandler, DebuggerRequest } from './handlers/types';\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 ];\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","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;;;;QAmBgBA,0BAA0B,GAA1BA,0BAA0B;AAlBxB,IAAA,UAAY,kCAAZ,YAAY,EAAA;AAIS,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;AACnD,IAAA,2BAAuC,WAAvC,uCAAuC,CAAA;;;;;;AASlF,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;SACxC,CAAC;QAEFC,eAAe,CAACC,OAAY,EAAEC,IAAkB,EAAW;gBAClBC,GAAwC;YAA/E,OAAO,IAAI,CAACV,QAAQ,CAACW,IAAI,CAAC,CAACD,OAAO;gBAAKA,OAAAA,CAAAA,GAAwC,GAAxCA,OAAO,CAACH,eAAe,QAAiB,GAAxCG,KAAAA,CAAwC,GAAxCA,OAAO,CAACH,eAAe,CAAGC,OAAO,EAAEC,IAAI,CAAC,YAAxCC,GAAwC,GAAI,KAAK,CAA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AMT,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"}
|
|
@@ -138,7 +138,7 @@ async function createHostInfoAsync() {
|
|
|
138
138
|
host: await _userSettings.default.getAnonymousIdentifierAsync(),
|
|
139
139
|
server: "expo",
|
|
140
140
|
// Defined in the build step
|
|
141
|
-
serverVersion: "0.10.
|
|
141
|
+
serverVersion: "0.10.9",
|
|
142
142
|
serverDriver: _manifestMiddleware.DEVELOPER_TOOL,
|
|
143
143
|
serverOS: _os.default.platform(),
|
|
144
144
|
serverOSVersion: _os.default.release()
|
|
@@ -94,7 +94,7 @@ async function logEventAsync(event, properties = {}) {
|
|
|
94
94
|
}
|
|
95
95
|
const { userId , deviceId } = identifyData;
|
|
96
96
|
const commonEventProperties = {
|
|
97
|
-
source_version: "0.10.
|
|
97
|
+
source_version: "0.10.9",
|
|
98
98
|
source: "expo"
|
|
99
99
|
};
|
|
100
100
|
const identity = {
|
|
@@ -135,7 +135,7 @@ function getContext() {
|
|
|
135
135
|
},
|
|
136
136
|
app: {
|
|
137
137
|
name: "expo",
|
|
138
|
-
version: "0.10.
|
|
138
|
+
version: "0.10.9"
|
|
139
139
|
},
|
|
140
140
|
ci: ciInfo.isCI ? {
|
|
141
141
|
name: ciInfo.name,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.openBrowserAsync = openBrowserAsync;
|
|
6
|
+
var _betterOpn = _interopRequireDefault(require("better-opn"));
|
|
7
|
+
function _interopRequireDefault(obj) {
|
|
8
|
+
return obj && obj.__esModule ? obj : {
|
|
9
|
+
default: obj
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
async function openBrowserAsync(target, options) {
|
|
13
|
+
if (process.platform !== "win32") {
|
|
14
|
+
return await (0, _betterOpn).default(target, options);
|
|
15
|
+
}
|
|
16
|
+
const oldSystemRoot = process.env.SYSTEMROOT;
|
|
17
|
+
try {
|
|
18
|
+
var _SYSTEMROOT;
|
|
19
|
+
process.env.SYSTEMROOT = (_SYSTEMROOT = process.env.SYSTEMROOT) != null ? _SYSTEMROOT : process.env.SystemRoot;
|
|
20
|
+
return await (0, _betterOpn).default(target, options);
|
|
21
|
+
} finally{
|
|
22
|
+
process.env.SYSTEMROOT = oldSystemRoot;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=open.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/open.ts"],"sourcesContent":["import betterOpenBrowserAsync from 'better-opn';\n\n/**\n * Due to a bug in `open`, which is used as fallback on Windows, we need to ensure `process.env.SYSTEMROOT` is set.\n * This environment variable is set by Windows on `SystemRoot`, causing `open` to execute a command with an \"unknown\" drive letter.\n *\n * @see https://github.com/sindresorhus/open/issues/205\n */\nexport async function openBrowserAsync(\n target: string,\n options?: any\n): Promise<import('child_process').ChildProcess | false> {\n if (process.platform !== 'win32') {\n return await betterOpenBrowserAsync(target, options);\n }\n\n const oldSystemRoot = process.env.SYSTEMROOT;\n try {\n process.env.SYSTEMROOT = process.env.SYSTEMROOT ?? process.env.SystemRoot;\n return await betterOpenBrowserAsync(target, options);\n } finally {\n process.env.SYSTEMROOT = oldSystemRoot;\n }\n}\n"],"names":["openBrowserAsync","target","options","process","platform","betterOpenBrowserAsync","oldSystemRoot","env","SYSTEMROOT","SystemRoot"],"mappings":"AAAA;;;;QAQsBA,gBAAgB,GAAhBA,gBAAgB;AARH,IAAA,UAAY,kCAAZ,YAAY,EAAA;;;;;;AAQxC,eAAeA,gBAAgB,CACpCC,MAAc,EACdC,OAAa,EAC0C;IACvD,IAAIC,OAAO,CAACC,QAAQ,KAAK,OAAO,EAAE;QAChC,OAAO,MAAMC,CAAAA,GAAAA,UAAsB,AAAiB,CAAA,QAAjB,CAACJ,MAAM,EAAEC,OAAO,CAAC,CAAC;KACtD;IAED,MAAMI,aAAa,GAAGH,OAAO,CAACI,GAAG,CAACC,UAAU,AAAC;IAC7C,IAAI;YACuBL,WAAsB;QAA/CA,OAAO,CAACI,GAAG,CAACC,UAAU,GAAGL,CAAAA,WAAsB,GAAtBA,OAAO,CAACI,GAAG,CAACC,UAAU,YAAtBL,WAAsB,GAAIA,OAAO,CAACI,GAAG,CAACE,UAAU,CAAC;QAC1E,OAAO,MAAMJ,CAAAA,GAAAA,UAAsB,AAAiB,CAAA,QAAjB,CAACJ,MAAM,EAAEC,OAAO,CAAC,CAAC;KACtD,QAAS;QACRC,OAAO,CAACI,GAAG,CAACC,UAAU,GAAGF,aAAa,CAAC;KACxC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.9",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@expo/code-signing-certificates": "0.0.5",
|
|
42
42
|
"@expo/config": "~8.1.0",
|
|
43
43
|
"@expo/config-plugins": "~7.2.0",
|
|
44
|
-
"@expo/dev-server": "0.5.
|
|
44
|
+
"@expo/dev-server": "0.5.4",
|
|
45
45
|
"@expo/devcert": "^1.0.0",
|
|
46
46
|
"@expo/env": "0.0.5",
|
|
47
47
|
"@expo/json-file": "^8.2.37",
|
|
@@ -150,5 +150,5 @@
|
|
|
150
150
|
"jest-runner-tsd": "^6.0.0",
|
|
151
151
|
"tsd": "^0.28.1"
|
|
152
152
|
},
|
|
153
|
-
"gitHead": "
|
|
153
|
+
"gitHead": "4e550a9fb6804351e36f9087aeb84c94d87d631b"
|
|
154
154
|
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
6
|
-
var _nodeFetch = _interopRequireDefault(require("node-fetch"));
|
|
7
|
-
var _path = _interopRequireDefault(require("path"));
|
|
8
|
-
function _interopRequireDefault(obj) {
|
|
9
|
-
return obj && obj.__esModule ? obj : {
|
|
10
|
-
default: obj
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
class DebuggerScriptSourceHandler {
|
|
14
|
-
constructor(device){
|
|
15
|
-
this.device = device;
|
|
16
|
-
}
|
|
17
|
-
onDebuggerMessage(message, { socket }) {
|
|
18
|
-
// See: https://github.com/facebook/metro/blob/65d801cb60c06c1b17f428ca79491db73c53ef87/packages/metro-inspector-proxy/src/Device.js#L488-L544
|
|
19
|
-
if (message.method === "Debugger.getScriptSource") {
|
|
20
|
-
const { scriptId } = message.params;
|
|
21
|
-
const pathOrUrl = this.device._scriptIdToSourcePathMapping.get(scriptId);
|
|
22
|
-
// Unkown scriptId provided, can't reply
|
|
23
|
-
if (!pathOrUrl) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
// Fetch the source from URL, if the path is a bundle URL
|
|
27
|
-
if (isUrl(pathOrUrl)) {
|
|
28
|
-
(0, _nodeFetch).default(pathOrUrl).then((response)=>response.ok ? response.text() : respond(socket, message, {
|
|
29
|
-
error: `Received status ${response.status} while fetching: ${pathOrUrl}`
|
|
30
|
-
})
|
|
31
|
-
).then((scriptSource)=>{
|
|
32
|
-
if (scriptSource !== null) {
|
|
33
|
-
respond(socket, message, {
|
|
34
|
-
scriptSource
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
// Fetch the source from file directly, using the project root as starting directory
|
|
41
|
-
try {
|
|
42
|
-
const relativePath = _path.default.resolve(this.device._projectRoot, pathOrUrl);
|
|
43
|
-
respond(socket, message, {
|
|
44
|
-
scriptSource: _fs.default.readFileSync(relativePath, "utf8")
|
|
45
|
-
});
|
|
46
|
-
} catch (error) {
|
|
47
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
48
|
-
respond(socket, message, {
|
|
49
|
-
error: `Failed to load "${pathOrUrl}": ${errorMessage}`
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.DebuggerScriptSourceHandler = DebuggerScriptSourceHandler;
|
|
58
|
-
function respond(socket, request, response) {
|
|
59
|
-
if ("error" in response) {
|
|
60
|
-
socket.send(JSON.stringify({
|
|
61
|
-
id: request.id,
|
|
62
|
-
error: {
|
|
63
|
-
message: response.error
|
|
64
|
-
}
|
|
65
|
-
}));
|
|
66
|
-
} else {
|
|
67
|
-
socket.send(JSON.stringify({
|
|
68
|
-
id: request.id,
|
|
69
|
-
result: response
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
function isUrl(pathOrUrl) {
|
|
75
|
-
try {
|
|
76
|
-
const url = new URL(pathOrUrl);
|
|
77
|
-
return [
|
|
78
|
-
"http",
|
|
79
|
-
"https"
|
|
80
|
-
].some((protocol)=>url.protocol.toLowerCase().startsWith(protocol)
|
|
81
|
-
);
|
|
82
|
-
} catch {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
//# sourceMappingURL=DebuggerScriptSource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/inspector-proxy/handlers/DebuggerScriptSource.ts"],"sourcesContent":["import type { Protocol } from 'devtools-protocol';\nimport fs from 'fs';\nimport type { Device as MetroDevice } from 'metro-inspector-proxy';\nimport fetch from 'node-fetch';\nimport path from 'path';\nimport type WS from 'ws';\n\nimport { ExpoDebuggerInfo } from '../device';\nimport { CdpMessage, DebuggerRequest, DebuggerResponse, InspectorHandler } from './types';\n\n// TODO(cedric): remove this custom handler when fully switching over to `metro@>=0.75.1`\nexport class DebuggerScriptSourceHandler implements InspectorHandler {\n constructor(private readonly device: MetroDevice) {}\n\n onDebuggerMessage(\n message: DebuggerRequest<DebuggerGetScriptSource>,\n { socket }: ExpoDebuggerInfo\n ) {\n // See: https://github.com/facebook/metro/blob/65d801cb60c06c1b17f428ca79491db73c53ef87/packages/metro-inspector-proxy/src/Device.js#L488-L544\n if (message.method === 'Debugger.getScriptSource') {\n const { scriptId } = message.params;\n const pathOrUrl = this.device._scriptIdToSourcePathMapping.get(scriptId);\n\n // Unkown scriptId provided, can't reply\n if (!pathOrUrl) {\n return false;\n }\n\n // Fetch the source from URL, if the path is a bundle URL\n if (isUrl(pathOrUrl)) {\n fetch(pathOrUrl)\n .then((response) =>\n response.ok\n ? response.text()\n : respond(socket, message, {\n error: `Received status ${response.status} while fetching: ${pathOrUrl}`,\n })\n )\n .then((scriptSource) => {\n if (scriptSource !== null) {\n respond(socket, message, { scriptSource });\n }\n });\n\n return true;\n }\n\n // Fetch the source from file directly, using the project root as starting directory\n try {\n const relativePath = path.resolve(this.device._projectRoot, pathOrUrl);\n respond(socket, message, { scriptSource: fs.readFileSync(relativePath, 'utf8') });\n } catch (error: unknown) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n respond(socket, message, {\n error: `Failed to load \"${pathOrUrl}\": ${errorMessage}`,\n });\n }\n\n return true;\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Debugger/#method-getScriptSource */\nexport type DebuggerGetScriptSource = CdpMessage<\n 'Debugger.getScriptSource',\n Protocol.Debugger.GetScriptSourceRequest,\n Protocol.Debugger.GetScriptSourceResponse\n>;\n\nfunction respond<T extends CdpMessage>(\n socket: WS,\n request: DebuggerRequest<T>,\n response: DebuggerResponse<T>['result'] | { error: string }\n) {\n if ('error' in response) {\n socket.send(JSON.stringify({ id: request.id, error: { message: response.error } }));\n } else {\n socket.send(JSON.stringify({ id: request.id, result: response }));\n }\n\n return null;\n}\n\nfunction isUrl(pathOrUrl: string) {\n try {\n const url = new URL(pathOrUrl);\n return ['http', 'https'].some((protocol) => url.protocol.toLowerCase().startsWith(protocol));\n } catch {\n return false;\n }\n}\n"],"names":["DebuggerScriptSourceHandler","constructor","device","onDebuggerMessage","message","socket","method","scriptId","params","pathOrUrl","_scriptIdToSourcePathMapping","get","isUrl","fetch","then","response","ok","text","respond","error","status","scriptSource","relativePath","path","resolve","_projectRoot","fs","readFileSync","errorMessage","Error","String","request","send","JSON","stringify","id","result","url","URL","some","protocol","toLowerCase","startsWith"],"mappings":"AAAA;;;;AACe,IAAA,GAAI,kCAAJ,IAAI,EAAA;AAED,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAOhB,MAAMA,2BAA2B;IACtCC,YAA6BC,MAAmB,CAAE;aAArBA,MAAmB,GAAnBA,MAAmB;KAAI;IAEpDC,iBAAiB,CACfC,OAAiD,EACjD,EAAEC,MAAM,CAAA,EAAoB,EAC5B;QACA,8IAA8I;QAC9I,IAAID,OAAO,CAACE,MAAM,KAAK,0BAA0B,EAAE;YACjD,MAAM,EAAEC,QAAQ,CAAA,EAAE,GAAGH,OAAO,CAACI,MAAM,AAAC;YACpC,MAAMC,SAAS,GAAG,IAAI,CAACP,MAAM,CAACQ,4BAA4B,CAACC,GAAG,CAACJ,QAAQ,CAAC,AAAC;YAEzE,wCAAwC;YACxC,IAAI,CAACE,SAAS,EAAE;gBACd,OAAO,KAAK,CAAC;aACd;YAED,yDAAyD;YACzD,IAAIG,KAAK,CAACH,SAAS,CAAC,EAAE;gBACpBI,CAAAA,GAAAA,U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