@expo/cli 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +2 -2
- package/build/src/api/rest/client.js +29 -18
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithOffline.js +2 -2
- package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
- package/build/src/api/settings.js +14 -5
- package/build/src/api/settings.js.map +1 -1
- package/build/src/api/user/actions.js +5 -0
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/api/user/user.js +2 -2
- package/build/src/api/user/user.js.map +1 -1
- package/build/src/register/registerAsync.js +3 -0
- package/build/src/register/registerAsync.js.map +1 -1
- package/build/src/start/doctor/dependencies/bundledNativeModules.js +8 -4
- package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +25 -8
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +2 -2
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/index.js +18 -11
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/interface/commandsTable.js +12 -0
- package/build/src/start/interface/commandsTable.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +7 -2
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/interface/startInterface.js +9 -0
- package/build/src/start/interface/startInterface.js.map +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js +7 -6
- package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
- package/build/src/start/platforms/PlatformManager.js.map +1 -1
- package/build/src/start/resolveOptions.js +17 -33
- package/build/src/start/resolveOptions.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +1 -9
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +22 -0
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevelopmentSession.js +3 -3
- package/build/src/start/server/DevelopmentSession.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +2 -2
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +6 -3
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/device.js +19 -0
- package/build/src/start/server/metro/inspector-proxy/device.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/index.js +1 -1
- package/build/src/start/server/metro/inspector-proxy/index.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/proxy.js +22 -7
- package/build/src/start/server/metro/inspector-proxy/proxy.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +1 -1
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/middleware/ClassicManifestMiddleware.js +8 -7
- package/build/src/start/server/middleware/ClassicManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ContextModuleSourceMapsMiddleware.js +27 -0
- package/build/src/start/server/middleware/ContextModuleSourceMapsMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +2 -2
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +4 -4
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/type-generation/{index.js → startTypescriptTypeGeneration.js} +13 -12
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -0
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +3 -0
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
- package/build/src/utils/analytics/getDevClientProperties.js +6 -0
- package/build/src/utils/analytics/getDevClientProperties.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/ansi.js.map +1 -1
- package/build/src/utils/codesigning.js +4 -3
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/env.js +5 -5
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/mergeGitIgnorePaths.js +3 -3
- package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
- package/build/src/utils/validateApplicationId.js +21 -19
- package/build/src/utils/validateApplicationId.js.map +1 -1
- package/package.json +7 -7
- package/build/src/start/server/type-generation/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/server/UrlCreator.ts"],"sourcesContent":["import assert from 'assert';\nimport { URL } from 'url';\n\nimport * as Log from '../../log';\nimport { getIpAddress } from '../../utils/ip';\n\nconst debug = require('debug')('expo:start:server:urlCreator') as typeof console.log;\n\nexport interface CreateURLOptions {\n /** URL scheme to use when opening apps in custom runtimes. */\n scheme?: string | null;\n /** Type of dev server host to use. */\n hostType?: 'localhost' | 'lan' | 'tunnel';\n /** Requested hostname. */\n hostname?: string | null;\n}\n\ninterface UrlComponents {\n port: string;\n hostname: string;\n protocol: string;\n}\nexport class UrlCreator {\n constructor(\n private defaults: CreateURLOptions | undefined,\n private bundlerInfo: { port: number; getTunnelUrl?: () => string | null }\n ) {}\n\n /**\n * Return a URL for the \"loading\" interstitial page that is used to disambiguate which\n * native runtime to open the dev server with.\n *\n * @param options options for creating the URL\n * @param platform when opening the URL from the CLI to a connected device we can specify the platform as a query parameter, otherwise it will be inferred from the unsafe user agent sniffing.\n *\n * @returns URL like `http://localhost:19000/_expo/loading?platform=ios`\n * @returns URL like `http://localhost:19000/_expo/loading` when no platform is provided.\n */\n public constructLoadingUrl(options: CreateURLOptions, platform: string | null): string {\n const url = new URL('_expo/loading', this.constructUrl({ scheme: 'http', ...options }));\n if (platform) {\n url.search = new URLSearchParams({ platform }).toString();\n }\n const loadingUrl = url.toString();\n debug(`Loading URL: ${loadingUrl}`);\n return loadingUrl;\n }\n\n /** Create a URI for launching in a native dev client. Returns `null` when no `scheme` can be resolved. */\n public constructDevClientUrl(options?: CreateURLOptions): null | string {\n const protocol = options?.scheme || this.defaults?.scheme;\n\n if (\n !protocol ||\n // Prohibit the use of http(s) in dev client URIs since they'll never be valid.\n ['http', 'https'].includes(protocol.toLowerCase())\n ) {\n return null;\n }\n\n const manifestUrl = this.constructUrl({ ...options, scheme: 'http' });\n const devClientUrl = `${protocol}://expo-development-client/?url=${encodeURIComponent(\n manifestUrl\n )}`;\n debug(`Dev client URL: ${devClientUrl} -- manifestUrl: ${manifestUrl} -- %O`, options);\n return devClientUrl;\n }\n\n /** Create a generic URL. */\n public constructUrl(options?: Partial<CreateURLOptions> | null): string {\n const urlComponents = this.getUrlComponents({\n ...this.defaults,\n ...options,\n });\n const url = joinUrlComponents(urlComponents);\n debug(`URL: ${url}`);\n return url;\n }\n\n /** Get the URL components from the Ngrok server URL. */\n private getTunnelUrlComponents(options: Pick<CreateURLOptions, 'scheme'>): UrlComponents | null {\n const tunnelUrl = this.bundlerInfo.getTunnelUrl?.();\n if (!tunnelUrl) {\n return null;\n }\n const parsed = new URL(tunnelUrl);\n return {\n port: parsed.port,\n hostname: parsed.hostname,\n protocol: options.scheme ?? 'http',\n };\n }\n\n private getUrlComponents(options: CreateURLOptions): UrlComponents {\n // Proxy comes first.\n const proxyURL = getProxyUrl();\n if (proxyURL) {\n return getUrlComponentsFromProxyUrl(options, proxyURL);\n }\n\n // Ngrok.\n if (options.hostType === 'tunnel') {\n const components = this.getTunnelUrlComponents(options);\n if (components) {\n return components;\n }\n Log.warn('Tunnel URL not found (it might not be ready yet), falling back to LAN URL.');\n } else if (options.hostType === 'localhost' && !options.hostname) {\n options.hostname = 'localhost';\n }\n\n return {\n hostname: getDefaultHostname(options),\n port: this.bundlerInfo.port.toString(),\n protocol: options.scheme ?? 'http',\n };\n }\n}\n\nfunction getUrlComponentsFromProxyUrl(\n options: Pick<CreateURLOptions, 'scheme'>,\n url: string\n): UrlComponents {\n const parsedProxyUrl = new URL(url);\n let protocol = options.scheme ?? 'http';\n if (parsedProxyUrl.protocol === 'https:') {\n if (protocol === 'http') {\n protocol = 'https';\n }\n if (!parsedProxyUrl.port) {\n parsedProxyUrl.port = '443';\n }\n }\n return {\n port: parsedProxyUrl.port,\n hostname: parsedProxyUrl.hostname,\n protocol,\n };\n}\n\nfunction getDefaultHostname(options: Pick<CreateURLOptions, 'hostname'>) {\n // TODO: Drop REACT_NATIVE_PACKAGER_HOSTNAME\n if (process.env.REACT_NATIVE_PACKAGER_HOSTNAME) {\n return process.env.REACT_NATIVE_PACKAGER_HOSTNAME.trim();\n } else if (options.hostname === 'localhost') {\n // Restrict the use of `localhost`\n // TODO: Note why we do this.\n return '127.0.0.1';\n }\n\n return options.hostname || getIpAddress();\n}\n\nfunction joinUrlComponents({ protocol, hostname, port }: Partial<UrlComponents>): string {\n assert(hostname, 'hostname cannot be inferred.');\n const validProtocol = protocol ? `${protocol}://` : '';\n\n const url = `${validProtocol}${hostname}`;\n\n if (port) {\n return url + `:${port}`;\n }\n\n return url;\n}\n\n/** @deprecated */\nfunction getProxyUrl(): string | undefined {\n return process.env.EXPO_PACKAGER_PROXY_URL;\n}\n\n// TODO: Drop the undocumented env variables:\n// REACT_NATIVE_PACKAGER_HOSTNAME\n// EXPO_PACKAGER_PROXY_URL\n"],"names":["Log","debug","require","UrlCreator","constructor","defaults","bundlerInfo","constructLoadingUrl","options","platform","url","URL","constructUrl","scheme","search","URLSearchParams","toString","loadingUrl","constructDevClientUrl","protocol","includes","toLowerCase","manifestUrl","devClientUrl","encodeURIComponent","urlComponents","getUrlComponents","joinUrlComponents","getTunnelUrlComponents","tunnelUrl","getTunnelUrl","parsed","port","hostname","proxyURL","getProxyUrl","getUrlComponentsFromProxyUrl","hostType","components","warn","getDefaultHostname","parsedProxyUrl","process","env","REACT_NATIVE_PACKAGER_HOSTNAME","trim","getIpAddress","assert","validProtocol","EXPO_PACKAGER_PROXY_URL"],"mappings":"AAAA;;;;AAAmB,IAAA,OAAQ,kCAAR,QAA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ACR,OAAOtB,GAAG,GAAG,CAAC,CAAC,EAAEsB,IAAI,CAAC,CAAC,CAAC;KACzB;IAED,OAAOtB,GAAG,CAAC;CACZ;AAED,kBAAkB,CAClB,SAASyB,WAAW,GAAuB;IACzC,OAAOO,OAAO,CAACC,GAAG,CAACM,uBAAuB,CAAC;CAC5C,CAED,6CAA6C;CAC7C,iCAAiC;CACjC,0BAA0B"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/server/UrlCreator.ts"],"sourcesContent":["import assert from 'assert';\nimport { URL } from 'url';\n\nimport * as Log from '../../log';\nimport { getIpAddress } from '../../utils/ip';\n\nconst debug = require('debug')('expo:start:server:urlCreator') as typeof console.log;\n\nexport interface CreateURLOptions {\n /** URL scheme to use when opening apps in custom runtimes. */\n scheme?: string | null;\n /** Type of dev server host to use. */\n hostType?: 'localhost' | 'lan' | 'tunnel';\n /** Requested hostname. */\n hostname?: string | null;\n}\n\ninterface UrlComponents {\n port: string;\n hostname: string;\n protocol: string;\n}\nexport class UrlCreator {\n constructor(\n public defaults: CreateURLOptions | undefined,\n private bundlerInfo: { port: number; getTunnelUrl?: () => string | null }\n ) {}\n\n /**\n * Return a URL for the \"loading\" interstitial page that is used to disambiguate which\n * native runtime to open the dev server with.\n *\n * @param options options for creating the URL\n * @param platform when opening the URL from the CLI to a connected device we can specify the platform as a query parameter, otherwise it will be inferred from the unsafe user agent sniffing.\n *\n * @returns URL like `http://localhost:8081/_expo/loading?platform=ios`\n * @returns URL like `http://localhost:8081/_expo/loading` when no platform is provided.\n */\n public constructLoadingUrl(options: CreateURLOptions, platform: string | null): string {\n const url = new URL('_expo/loading', this.constructUrl({ scheme: 'http', ...options }));\n if (platform) {\n url.search = new URLSearchParams({ platform }).toString();\n }\n const loadingUrl = url.toString();\n debug(`Loading URL: ${loadingUrl}`);\n return loadingUrl;\n }\n\n /** Create a URI for launching in a native dev client. Returns `null` when no `scheme` can be resolved. */\n public constructDevClientUrl(options?: CreateURLOptions): null | string {\n const protocol = options?.scheme || this.defaults?.scheme;\n\n if (\n !protocol ||\n // Prohibit the use of http(s) in dev client URIs since they'll never be valid.\n ['http', 'https'].includes(protocol.toLowerCase())\n ) {\n return null;\n }\n\n const manifestUrl = this.constructUrl({ ...options, scheme: 'http' });\n const devClientUrl = `${protocol}://expo-development-client/?url=${encodeURIComponent(\n manifestUrl\n )}`;\n debug(`Dev client URL: ${devClientUrl} -- manifestUrl: ${manifestUrl} -- %O`, options);\n return devClientUrl;\n }\n\n /** Create a generic URL. */\n public constructUrl(options?: Partial<CreateURLOptions> | null): string {\n const urlComponents = this.getUrlComponents({\n ...this.defaults,\n ...options,\n });\n const url = joinUrlComponents(urlComponents);\n debug(`URL: ${url}`);\n return url;\n }\n\n /** Get the URL components from the Ngrok server URL. */\n private getTunnelUrlComponents(options: Pick<CreateURLOptions, 'scheme'>): UrlComponents | null {\n const tunnelUrl = this.bundlerInfo.getTunnelUrl?.();\n if (!tunnelUrl) {\n return null;\n }\n const parsed = new URL(tunnelUrl);\n return {\n port: parsed.port,\n hostname: parsed.hostname,\n protocol: options.scheme ?? 'http',\n };\n }\n\n private getUrlComponents(options: CreateURLOptions): UrlComponents {\n // Proxy comes first.\n const proxyURL = getProxyUrl();\n if (proxyURL) {\n return getUrlComponentsFromProxyUrl(options, proxyURL);\n }\n\n // Ngrok.\n if (options.hostType === 'tunnel') {\n const components = this.getTunnelUrlComponents(options);\n if (components) {\n return components;\n }\n Log.warn('Tunnel URL not found (it might not be ready yet), falling back to LAN URL.');\n } else if (options.hostType === 'localhost' && !options.hostname) {\n options.hostname = 'localhost';\n }\n\n return {\n hostname: getDefaultHostname(options),\n port: this.bundlerInfo.port.toString(),\n protocol: options.scheme ?? 'http',\n };\n }\n}\n\nfunction getUrlComponentsFromProxyUrl(\n options: Pick<CreateURLOptions, 'scheme'>,\n url: string\n): UrlComponents {\n const parsedProxyUrl = new URL(url);\n let protocol = options.scheme ?? 'http';\n if (parsedProxyUrl.protocol === 'https:') {\n if (protocol === 'http') {\n protocol = 'https';\n }\n if (!parsedProxyUrl.port) {\n parsedProxyUrl.port = '443';\n }\n }\n return {\n port: parsedProxyUrl.port,\n hostname: parsedProxyUrl.hostname,\n protocol,\n };\n}\n\nfunction getDefaultHostname(options: Pick<CreateURLOptions, 'hostname'>) {\n // TODO: Drop REACT_NATIVE_PACKAGER_HOSTNAME\n if (process.env.REACT_NATIVE_PACKAGER_HOSTNAME) {\n return process.env.REACT_NATIVE_PACKAGER_HOSTNAME.trim();\n } else if (options.hostname === 'localhost') {\n // Restrict the use of `localhost`\n // TODO: Note why we do this.\n return '127.0.0.1';\n }\n\n return options.hostname || getIpAddress();\n}\n\nfunction joinUrlComponents({ protocol, hostname, port }: Partial<UrlComponents>): string {\n assert(hostname, 'hostname cannot be inferred.');\n const validProtocol = protocol ? `${protocol}://` : '';\n\n const url = `${validProtocol}${hostname}`;\n\n if (port) {\n return url + `:${port}`;\n }\n\n return url;\n}\n\n/** @deprecated */\nfunction getProxyUrl(): string | undefined {\n return process.env.EXPO_PACKAGER_PROXY_URL;\n}\n\n// TODO: Drop the undocumented env variables:\n// REACT_NATIVE_PACKAGER_HOSTNAME\n// EXPO_PACKAGER_PROXY_URL\n"],"names":["Log","debug","require","UrlCreator","constructor","defaults","bundlerInfo","constructLoadingUrl","options","platform","url","URL","constructUrl","scheme","search","URLSearchParams","toString","loadingUrl","constructDevClientUrl","protocol","includes","toLowerCase","manifestUrl","devClientUrl","encodeURIComponent","urlComponents","getUrlComponents","joinUrlComponents","getTunnelUrlComponents","tunnelUrl","getTunnelUrl","parsed","port","hostname","proxyURL","getProxyUrl","getUrlComponentsFromProxyUrl","hostType","components","warn","getDefaultHostname","parsedProxyUrl","process","env","REACT_NATIVE_PACKAGER_HOSTNAME","trim","getIpAddress","assert","validProtocol","EXPO_PACKAGER_PROXY_URL"],"mappings":"AAAA;;;;AAAmB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACP,IAAA,IAAK,WAAL,KAAK,CAAA;AAEbA,I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AC,CAAC,CAAC;KACzB;IAED,OAAOtB,GAAG,CAAC;CACZ;AAED,kBAAkB,CAClB,SAASyB,WAAW,GAAuB;IACzC,OAAOO,OAAO,CAACC,GAAG,CAACM,uBAAuB,CAAC;CAC5C,CAED,6CAA6C;CAC7C,iCAAiC;CACjC,0BAA0B"}
|
|
@@ -16,6 +16,7 @@ var _rudderstackClient = require("../../../utils/analytics/rudderstackClient");
|
|
|
16
16
|
var _port = require("../../../utils/port");
|
|
17
17
|
var _bundlerDevServer = require("../BundlerDevServer");
|
|
18
18
|
var _getStaticRenderFunctions = require("../getStaticRenderFunctions");
|
|
19
|
+
var _contextModuleSourceMapsMiddleware = require("../middleware/ContextModuleSourceMapsMiddleware");
|
|
19
20
|
var _createFileMiddleware = require("../middleware/CreateFileMiddleware");
|
|
20
21
|
var _historyFallbackMiddleware = require("../middleware/HistoryFallbackMiddleware");
|
|
21
22
|
var _interstitialPageMiddleware = require("../middleware/InterstitialPageMiddleware");
|
|
@@ -23,7 +24,7 @@ var _manifestMiddleware = require("../middleware/ManifestMiddleware");
|
|
|
23
24
|
var _reactDevToolsPageMiddleware = require("../middleware/ReactDevToolsPageMiddleware");
|
|
24
25
|
var _runtimeRedirectMiddleware = require("../middleware/RuntimeRedirectMiddleware");
|
|
25
26
|
var _serveStaticMiddleware = require("../middleware/ServeStaticMiddleware");
|
|
26
|
-
var
|
|
27
|
+
var _startTypescriptTypeGeneration = require("../type-generation/startTypescriptTypeGeneration");
|
|
27
28
|
var _instantiateMetro = require("./instantiateMetro");
|
|
28
29
|
var _metroErrorInterface = require("./metroErrorInterface");
|
|
29
30
|
var _metroWatchTypeScriptFiles = require("./metroWatchTypeScriptFiles");
|
|
@@ -55,7 +56,7 @@ function _interopRequireWildcard(obj) {
|
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
const debug = require("debug")("expo:start:server:metro");
|
|
58
|
-
/** Default port to use for apps running in Expo Go. */ const EXPO_GO_METRO_PORT =
|
|
59
|
+
/** Default port to use for apps running in Expo Go. */ const EXPO_GO_METRO_PORT = 8081;
|
|
59
60
|
/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */ const DEV_CLIENT_METRO_PORT = 8081;
|
|
60
61
|
class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
61
62
|
metro = null;
|
|
@@ -200,6 +201,8 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
200
201
|
process.env.EXPO_DEV_SERVER_ORIGIN = `http://localhost:${options.port}`;
|
|
201
202
|
const { metro , server , middleware , messageSocket } = await (0, _instantiateMetro).instantiateMetroAsync(this, parsedOptions);
|
|
202
203
|
const manifestMiddleware = await this.getManifestMiddlewareAsync(options);
|
|
204
|
+
// Important that we noop source maps for context modules as soon as possible.
|
|
205
|
+
(0, _devServer).prependMiddleware(middleware, new _contextModuleSourceMapsMiddleware.ContextModuleSourceMapsMiddleware().getHandler());
|
|
203
206
|
// We need the manifest handler to be the first middleware to run so our
|
|
204
207
|
// routes take precedence over static files. For example, the manifest is
|
|
205
208
|
// served from '/' and if the user has an index.html file in their project
|
|
@@ -339,7 +342,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
339
342
|
});
|
|
340
343
|
}
|
|
341
344
|
async startTypeScriptServices() {
|
|
342
|
-
(0,
|
|
345
|
+
(0, _startTypescriptTypeGeneration).startTypescriptTypeGenerationAsync({
|
|
343
346
|
server: this.instance.server,
|
|
344
347
|
metro: this.metro,
|
|
345
348
|
projectRoot: this.projectRoot
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/MetroBundlerDevServer.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getConfig } from '@expo/config';\nimport { prependMiddleware } from '@expo/dev-server';\nimport * as runtimeEnv from '@expo/env';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fetch from 'node-fetch';\nimport path from 'path';\n\nimport { Log } from '../../../log';\nimport getDevClientProperties from '../../../utils/analytics/getDevClientProperties';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport { getStaticRenderFunctions } from '../getStaticRenderFunctions';\nimport { CreateFileMiddleware } from '../middleware/CreateFileMiddleware';\nimport { HistoryFallbackMiddleware } from '../middleware/HistoryFallbackMiddleware';\nimport { InterstitialPageMiddleware } from '../middleware/InterstitialPageMiddleware';\nimport { createBundleUrlPath, resolveMainModuleName } from '../middleware/ManifestMiddleware';\nimport { ReactDevToolsPageMiddleware } from '../middleware/ReactDevToolsPageMiddleware';\nimport {\n DeepLinkHandler,\n RuntimeRedirectMiddleware,\n} from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport { ServerNext, ServerRequest, ServerResponse } from '../middleware/server.types';\nimport { typescriptTypeGeneration } from '../type-generation';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { getErrorOverlayHtmlAsync } from './metroErrorInterface';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport { observeFileChanges } from './waitForMetroToObserveTypeScriptFile';\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\n/** Default port to use for apps running in Expo Go. */\nconst EXPO_GO_METRO_PORT = 19000;\n\n/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */\nconst DEV_CLIENT_METRO_PORT = 8081;\n\nexport class MetroBundlerDevServer extends BundlerDevServer {\n private metro: import('metro').Server | null = null;\n\n get name(): string {\n return 'metro';\n }\n\n async resolvePortAsync(options: Partial<BundlerStartOptions> = {}): Promise<number> {\n const port =\n // If the manually defined port is busy then an error should be thrown...\n options.port ??\n // Otherwise use the default port based on the runtime target.\n (options.devClient\n ? // Don't check if the port is busy if we're using the dev client since most clients are hardcoded to 8081.\n Number(process.env.RCT_METRO_PORT) || DEV_CLIENT_METRO_PORT\n : // Otherwise (running in Expo Go) use a free port that falls back on the classic 19000 port.\n await getFreePortAsync(EXPO_GO_METRO_PORT));\n\n return port;\n }\n\n /** Get routes from Expo Router. */\n async getRoutesAsync() {\n const url = this.getDevServerUrl();\n assert(url, 'Dev server must be started');\n const { getManifest } = await getStaticRenderFunctions(this.projectRoot, url, {\n // Ensure the API Routes are included\n environment: 'node',\n });\n\n return getManifest({ fetchData: true });\n }\n\n async composeResourcesWithHtml({\n mode,\n resources,\n template,\n devBundleUrl,\n }: {\n mode: 'development' | 'production';\n resources: SerialAsset[];\n template: string;\n devBundleUrl?: string;\n }) {\n const isDev = mode === 'development';\n return htmlFromSerialAssets(resources, {\n dev: isDev,\n template,\n bundleUrl: isDev ? devBundleUrl : undefined,\n });\n }\n\n async getStaticRenderFunctionAsync({\n mode,\n minify = mode !== 'development',\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n }) {\n const url = this.getDevServerUrl()!;\n\n const { getStaticContent } = await getStaticRenderFunctions(this.projectRoot, url, {\n minify,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n });\n return async (path: string) => {\n return await getStaticContent(new URL(path, url));\n };\n }\n\n async getStaticResourcesAsync({\n mode,\n minify = mode !== 'development',\n }: {\n mode: string;\n minify?: boolean;\n }): Promise<SerialAsset[]> {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n minify,\n environment: 'client',\n serializerOutput: 'static',\n mainModuleName: resolveMainModuleName(this.projectRoot, getConfig(this.projectRoot), 'web'),\n });\n\n const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl()!);\n\n // Fetch the generated HTML from our custom Metro serializer\n const results = await fetch(bundleUrl.toString());\n\n const txt = await results.text();\n\n try {\n return JSON.parse(txt);\n } catch (error: any) {\n Log.error(\n 'Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.'\n );\n debug(txt);\n throw error;\n }\n }\n\n private async renderStaticErrorAsync(error: Error) {\n return getErrorOverlayHtmlAsync({\n error,\n projectRoot: this.projectRoot,\n });\n }\n\n async getStaticPageAsync(\n pathname: string,\n {\n mode,\n minify = mode !== 'development',\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n }\n ) {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n environment: 'client',\n mainModuleName: resolveMainModuleName(this.projectRoot, getConfig(this.projectRoot), 'web'),\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await getStaticRenderFunctions(\n this.projectRoot,\n this.getDevServerUrl()!,\n {\n minify: false,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n }\n );\n\n const location = new URL(pathname, this.getDevServerUrl()!);\n return await getStaticContent(location);\n };\n\n const [resources, staticHtml] = await Promise.all([\n this.getStaticResourcesAsync({ mode, minify }),\n bundleStaticHtml(),\n ]);\n const content = await this.composeResourcesWithHtml({\n mode,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n });\n return {\n content,\n resources,\n };\n }\n\n async watchEnvironmentVariables() {\n if (!this.instance) {\n throw new Error(\n 'Cannot observe environment variable changes without a running Metro instance.'\n );\n }\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process.\n debug('Skipping Environment Variable observation because Metro is not running (headless).');\n return;\n }\n\n const envFiles = runtimeEnv\n .getFiles(process.env.NODE_ENV)\n .map((fileName) => path.join(this.projectRoot, fileName));\n\n observeFileChanges(\n {\n metro: this.metro,\n server: this.instance.server,\n },\n envFiles,\n () => {\n debug('Reloading environment variables...');\n // Force reload the environment variables.\n runtimeEnv.load(this.projectRoot, { force: true });\n }\n );\n }\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n options.port = await this.resolvePortAsync(options);\n this.urlCreator = this.getUrlCreator(options);\n\n const parsedOptions = {\n port: options.port,\n maxWorkers: options.maxWorkers,\n resetCache: options.resetDevServer,\n\n // Use the unversioned metro config.\n // TODO: Deprecate this property when expo-cli goes away.\n unversioned: false,\n };\n\n // Required for symbolication:\n process.env.EXPO_DEV_SERVER_ORIGIN = `http://localhost:${options.port}`;\n\n const { metro, server, middleware, messageSocket } = await instantiateMetroAsync(\n this,\n parsedOptions\n );\n\n const manifestMiddleware = await this.getManifestMiddlewareAsync(options);\n\n // We need the manifest handler to be the first middleware to run so our\n // routes take precedence over static files. For example, the manifest is\n // served from '/' and if the user has an index.html file in their project\n // then the manifest handler will never run, the static middleware will run\n // and serve index.html instead of the manifest.\n // https://github.com/expo/expo/issues/13114\n\n prependMiddleware(middleware, manifestMiddleware.getHandler());\n\n middleware.use(\n new InterstitialPageMiddleware(this.projectRoot, {\n // TODO: Prevent this from becoming stale.\n scheme: options.location.scheme ?? null,\n }).getHandler()\n );\n middleware.use(new ReactDevToolsPageMiddleware(this.projectRoot).getHandler());\n\n const deepLinkMiddleware = new RuntimeRedirectMiddleware(this.projectRoot, {\n onDeepLink: getDeepLinkHandler(this.projectRoot),\n getLocation: ({ runtime }) => {\n if (runtime === 'custom') {\n return this.urlCreator?.constructDevClientUrl();\n } else {\n return this.urlCreator?.constructUrl({\n scheme: 'exp',\n });\n }\n },\n });\n middleware.use(deepLinkMiddleware.getHandler());\n\n middleware.use(new CreateFileMiddleware(this.projectRoot).getHandler());\n\n // Append support for redirecting unhandled requests to the index.html page on web.\n if (this.isTargetingWeb()) {\n const { exp } = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const useWebSSG = exp.web?.output === 'static';\n\n // This MUST be after the manifest middleware so it doesn't have a chance to serve the template `public/index.html`.\n middleware.use(new ServeStaticMiddleware(this.projectRoot).getHandler());\n\n if (useWebSSG) {\n middleware.use(async (req: ServerRequest, res: ServerResponse, next: ServerNext) => {\n if (!req?.url) {\n return next();\n }\n\n // TODO: Formal manifest for allowed paths\n if (req.url.endsWith('.ico')) {\n return next();\n }\n if (req.url.includes('serializer.output=static')) {\n return next();\n }\n\n try {\n const { content } = await this.getStaticPageAsync(req.url, {\n mode: options.mode ?? 'development',\n });\n\n res.setHeader('Content-Type', 'text/html');\n res.end(content);\n return;\n } catch (error: any) {\n res.setHeader('Content-Type', 'text/html');\n res.end(await this.renderStaticErrorAsync(error));\n }\n });\n }\n\n // This MUST run last since it's the fallback.\n if (!useWebSSG) {\n middleware.use(\n new HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler()\n );\n }\n }\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n this.metro = null;\n callback?.(err);\n });\n };\n\n this.metro = metro;\n return {\n server,\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 };\n }\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n if (!this.instance) {\n throw new Error('Cannot wait for TypeScript without a running server.');\n }\n\n return new Promise<boolean>((resolve) => {\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process. In this case we can't wait for the TypeScript check to complete because we don't\n // have access to the Metro server.\n debug('Skipping TypeScript check because Metro is not running (headless).');\n return resolve(false);\n }\n\n const off = metroWatchTypeScriptFiles({\n projectRoot: this.projectRoot,\n server: this.instance!.server,\n metro: this.metro,\n tsconfig: true,\n throttle: true,\n eventTypes: ['change', 'add'],\n callback: async () => {\n // Run once, this prevents the TypeScript project prerequisite from running on every file change.\n off();\n const { TypeScriptProjectPrerequisite } = await import(\n '../../doctor/typescript/TypeScriptProjectPrerequisite'\n );\n\n try {\n const req = new TypeScriptProjectPrerequisite(this.projectRoot);\n await req.bootstrapAsync();\n resolve(true);\n } catch (error: any) {\n // Ensure the process doesn't fail if the TypeScript check fails.\n // This could happen during the install.\n Log.log();\n Log.error(\n chalk.red`Failed to automatically setup TypeScript for your project. Try restarting the dev server to fix.`\n );\n Log.exception(error);\n resolve(false);\n }\n },\n });\n });\n }\n\n public async startTypeScriptServices() {\n typescriptTypeGeneration({\n server: this.instance!.server,\n metro: this.metro,\n projectRoot: this.projectRoot,\n });\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./metro.config.js', './metro.config.json', './rn-cli.config.js'];\n }\n}\n\nexport function getDeepLinkHandler(projectRoot: string): DeepLinkHandler {\n return async ({ runtime }) => {\n if (runtime === 'expo') return;\n const { exp } = getConfig(projectRoot);\n await logEventAsync('dev client start command', {\n status: 'started',\n ...getDevClientProperties(projectRoot, exp),\n });\n };\n}\n\nfunction htmlFromSerialAssets(\n assets: SerialAsset[],\n { dev, template, bundleUrl }: { dev: boolean; template: string; bundleUrl?: string }\n) {\n // Combine the CSS modules into tags that have hot refresh data attributes.\n const styleString = assets\n .filter((asset) => asset.type === 'css')\n .map(({ metadata, filename, source }) => {\n if (dev) {\n return `<style data-expo-css-hmr=\"${metadata.hmrId}\">` + source + '\\n</style>';\n } else {\n return [\n `<link rel=\"preload\" href=\"/${filename}\" as=\"style\">`,\n `<link rel=\"stylesheet\" href=\"/${filename}\">`,\n ].join('');\n }\n })\n .join('');\n\n const jsAssets = assets.filter((asset) => asset.type === 'js');\n\n const scripts = bundleUrl\n ? `<script src=\"${bundleUrl}\" defer></script>`\n : jsAssets\n .map(({ filename }) => {\n return `<script src=\"/${filename}\" defer></script>`;\n })\n .join('');\n\n return template\n .replace('</head>', `${styleString}</head>`)\n .replace('</body>', `${scripts}\\n</body>`);\n}\n"],"names":["getDeepLinkHandler","runtimeEnv","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","MetroBundlerDevServer","BundlerDevServer","metro","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","getRoutesAsync","url","getDevServerUrl","assert","getManifest","getStaticRenderFunctions","projectRoot","environment","fetchData","composeResourcesWithHtml","mode","resources","template","devBundleUrl","isDev","htmlFromSerialAssets","dev","bundleUrl","undefined","getStaticRenderFunctionAsync","minify","getStaticContent","path","URL","getStaticResourcesAsync","devBundleUrlPathname","createBundleUrlPath","platform","serializerOutput","mainModuleName","resolveMainModuleName","getConfig","results","fetch","toString","txt","text","JSON","parse","error","Log","renderStaticErrorAsync","getErrorOverlayHtmlAsync","getStaticPageAsync","pathname","bundleStaticHtml","location","staticHtml","Promise","all","content","watchEnvironmentVariables","instance","Error","envFiles","getFiles","NODE_ENV","map","fileName","join","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","parsedOptions","maxWorkers","resetCache","resetDevServer","unversioned","EXPO_DEV_SERVER_ORIGIN","middleware","messageSocket","instantiateMetroAsync","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","ReactDevToolsPageMiddleware","deepLinkMiddleware","RuntimeRedirectMiddleware","onDeepLink","getLocation","runtime","constructDevClientUrl","constructUrl","CreateFileMiddleware","isTargetingWeb","exp","skipSDKVersionRequirement","useWebSSG","web","output","ServeStaticMiddleware","req","res","next","endsWith","includes","setHeader","end","HistoryFallbackMiddleware","internal","originalClose","close","bind","callback","err","host","protocol","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","typescriptTypeGeneration","getConfigModuleIds","logEventAsync","status","getDevClientProperties","assets","styleString","filter","asset","type","metadata","filename","source","hmrId","jsAssets","scripts","replace"],"mappings":"AAMA;;;;QAwagBA,kBAAkB,GAAlBA,kBAAkB;AAxaR,IAAA,OAAc,WAAd,cAAc,CAAA;AACN,IAAA,UAAkB,WAAlB,kBAAkB,CAAA;AACxCC,IAAAA,UAAU,mCAAM,WAAW,EAAjB;AAEH,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This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getConfig } from '@expo/config';\nimport { prependMiddleware } from '@expo/dev-server';\nimport * as runtimeEnv from '@expo/env';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fetch from 'node-fetch';\nimport path from 'path';\n\nimport { Log } from '../../../log';\nimport getDevClientProperties from '../../../utils/analytics/getDevClientProperties';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport { getStaticRenderFunctions } from '../getStaticRenderFunctions';\nimport { ContextModuleSourceMapsMiddleware } from '../middleware/ContextModuleSourceMapsMiddleware';\nimport { CreateFileMiddleware } from '../middleware/CreateFileMiddleware';\nimport { HistoryFallbackMiddleware } from '../middleware/HistoryFallbackMiddleware';\nimport { InterstitialPageMiddleware } from '../middleware/InterstitialPageMiddleware';\nimport { createBundleUrlPath, resolveMainModuleName } from '../middleware/ManifestMiddleware';\nimport { ReactDevToolsPageMiddleware } from '../middleware/ReactDevToolsPageMiddleware';\nimport {\n DeepLinkHandler,\n RuntimeRedirectMiddleware,\n} from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport { ServerNext, ServerRequest, ServerResponse } from '../middleware/server.types';\nimport { startTypescriptTypeGenerationAsync } from '../type-generation/startTypescriptTypeGeneration';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { getErrorOverlayHtmlAsync } from './metroErrorInterface';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport { observeFileChanges } from './waitForMetroToObserveTypeScriptFile';\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\n/** Default port to use for apps running in Expo Go. */\nconst EXPO_GO_METRO_PORT = 8081;\n\n/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */\nconst DEV_CLIENT_METRO_PORT = 8081;\n\nexport class MetroBundlerDevServer extends BundlerDevServer {\n private metro: import('metro').Server | null = null;\n\n get name(): string {\n return 'metro';\n }\n\n async resolvePortAsync(options: Partial<BundlerStartOptions> = {}): Promise<number> {\n const port =\n // If the manually defined port is busy then an error should be thrown...\n options.port ??\n // Otherwise use the default port based on the runtime target.\n (options.devClient\n ? // Don't check if the port is busy if we're using the dev client since most clients are hardcoded to 8081.\n Number(process.env.RCT_METRO_PORT) || DEV_CLIENT_METRO_PORT\n : // Otherwise (running in Expo Go) use a free port that falls back on the classic 8081 port.\n await getFreePortAsync(EXPO_GO_METRO_PORT));\n\n return port;\n }\n\n /** Get routes from Expo Router. */\n async getRoutesAsync() {\n const url = this.getDevServerUrl();\n assert(url, 'Dev server must be started');\n const { getManifest } = await getStaticRenderFunctions(this.projectRoot, url, {\n // Ensure the API Routes are included\n environment: 'node',\n });\n\n return getManifest({ fetchData: true });\n }\n\n async composeResourcesWithHtml({\n mode,\n resources,\n template,\n devBundleUrl,\n }: {\n mode: 'development' | 'production';\n resources: SerialAsset[];\n template: string;\n devBundleUrl?: string;\n }) {\n const isDev = mode === 'development';\n return htmlFromSerialAssets(resources, {\n dev: isDev,\n template,\n bundleUrl: isDev ? devBundleUrl : undefined,\n });\n }\n\n async getStaticRenderFunctionAsync({\n mode,\n minify = mode !== 'development',\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n }) {\n const url = this.getDevServerUrl()!;\n\n const { getStaticContent } = await getStaticRenderFunctions(this.projectRoot, url, {\n minify,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n });\n return async (path: string) => {\n return await getStaticContent(new URL(path, url));\n };\n }\n\n async getStaticResourcesAsync({\n mode,\n minify = mode !== 'development',\n }: {\n mode: string;\n minify?: boolean;\n }): Promise<SerialAsset[]> {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n minify,\n environment: 'client',\n serializerOutput: 'static',\n mainModuleName: resolveMainModuleName(this.projectRoot, getConfig(this.projectRoot), 'web'),\n });\n\n const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl()!);\n\n // Fetch the generated HTML from our custom Metro serializer\n const results = await fetch(bundleUrl.toString());\n\n const txt = await results.text();\n\n try {\n return JSON.parse(txt);\n } catch (error: any) {\n Log.error(\n 'Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.'\n );\n debug(txt);\n throw error;\n }\n }\n\n private async renderStaticErrorAsync(error: Error) {\n return getErrorOverlayHtmlAsync({\n error,\n projectRoot: this.projectRoot,\n });\n }\n\n async getStaticPageAsync(\n pathname: string,\n {\n mode,\n minify = mode !== 'development',\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n }\n ) {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n environment: 'client',\n mainModuleName: resolveMainModuleName(this.projectRoot, getConfig(this.projectRoot), 'web'),\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await getStaticRenderFunctions(\n this.projectRoot,\n this.getDevServerUrl()!,\n {\n minify: false,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n }\n );\n\n const location = new URL(pathname, this.getDevServerUrl()!);\n return await getStaticContent(location);\n };\n\n const [resources, staticHtml] = await Promise.all([\n this.getStaticResourcesAsync({ mode, minify }),\n bundleStaticHtml(),\n ]);\n const content = await this.composeResourcesWithHtml({\n mode,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n });\n return {\n content,\n resources,\n };\n }\n\n async watchEnvironmentVariables() {\n if (!this.instance) {\n throw new Error(\n 'Cannot observe environment variable changes without a running Metro instance.'\n );\n }\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process.\n debug('Skipping Environment Variable observation because Metro is not running (headless).');\n return;\n }\n\n const envFiles = runtimeEnv\n .getFiles(process.env.NODE_ENV)\n .map((fileName) => path.join(this.projectRoot, fileName));\n\n observeFileChanges(\n {\n metro: this.metro,\n server: this.instance.server,\n },\n envFiles,\n () => {\n debug('Reloading environment variables...');\n // Force reload the environment variables.\n runtimeEnv.load(this.projectRoot, { force: true });\n }\n );\n }\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n options.port = await this.resolvePortAsync(options);\n this.urlCreator = this.getUrlCreator(options);\n\n const parsedOptions = {\n port: options.port,\n maxWorkers: options.maxWorkers,\n resetCache: options.resetDevServer,\n\n // Use the unversioned metro config.\n // TODO: Deprecate this property when expo-cli goes away.\n unversioned: false,\n };\n\n // Required for symbolication:\n process.env.EXPO_DEV_SERVER_ORIGIN = `http://localhost:${options.port}`;\n\n const { metro, server, middleware, messageSocket } = await instantiateMetroAsync(\n this,\n parsedOptions\n );\n\n const manifestMiddleware = await this.getManifestMiddlewareAsync(options);\n\n // Important that we noop source maps for context modules as soon as possible.\n prependMiddleware(middleware, new ContextModuleSourceMapsMiddleware().getHandler());\n\n // We need the manifest handler to be the first middleware to run so our\n // routes take precedence over static files. For example, the manifest is\n // served from '/' and if the user has an index.html file in their project\n // then the manifest handler will never run, the static middleware will run\n // and serve index.html instead of the manifest.\n // https://github.com/expo/expo/issues/13114\n prependMiddleware(middleware, manifestMiddleware.getHandler());\n\n middleware.use(\n new InterstitialPageMiddleware(this.projectRoot, {\n // TODO: Prevent this from becoming stale.\n scheme: options.location.scheme ?? null,\n }).getHandler()\n );\n middleware.use(new ReactDevToolsPageMiddleware(this.projectRoot).getHandler());\n\n const deepLinkMiddleware = new RuntimeRedirectMiddleware(this.projectRoot, {\n onDeepLink: getDeepLinkHandler(this.projectRoot),\n getLocation: ({ runtime }) => {\n if (runtime === 'custom') {\n return this.urlCreator?.constructDevClientUrl();\n } else {\n return this.urlCreator?.constructUrl({\n scheme: 'exp',\n });\n }\n },\n });\n middleware.use(deepLinkMiddleware.getHandler());\n\n middleware.use(new CreateFileMiddleware(this.projectRoot).getHandler());\n\n // Append support for redirecting unhandled requests to the index.html page on web.\n if (this.isTargetingWeb()) {\n const { exp } = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const useWebSSG = exp.web?.output === 'static';\n\n // This MUST be after the manifest middleware so it doesn't have a chance to serve the template `public/index.html`.\n middleware.use(new ServeStaticMiddleware(this.projectRoot).getHandler());\n\n if (useWebSSG) {\n middleware.use(async (req: ServerRequest, res: ServerResponse, next: ServerNext) => {\n if (!req?.url) {\n return next();\n }\n\n // TODO: Formal manifest for allowed paths\n if (req.url.endsWith('.ico')) {\n return next();\n }\n if (req.url.includes('serializer.output=static')) {\n return next();\n }\n\n try {\n const { content } = await this.getStaticPageAsync(req.url, {\n mode: options.mode ?? 'development',\n });\n\n res.setHeader('Content-Type', 'text/html');\n res.end(content);\n return;\n } catch (error: any) {\n res.setHeader('Content-Type', 'text/html');\n res.end(await this.renderStaticErrorAsync(error));\n }\n });\n }\n\n // This MUST run last since it's the fallback.\n if (!useWebSSG) {\n middleware.use(\n new HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler()\n );\n }\n }\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n this.metro = null;\n callback?.(err);\n });\n };\n\n this.metro = metro;\n return {\n server,\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 };\n }\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n if (!this.instance) {\n throw new Error('Cannot wait for TypeScript without a running server.');\n }\n\n return new Promise<boolean>((resolve) => {\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process. In this case we can't wait for the TypeScript check to complete because we don't\n // have access to the Metro server.\n debug('Skipping TypeScript check because Metro is not running (headless).');\n return resolve(false);\n }\n\n const off = metroWatchTypeScriptFiles({\n projectRoot: this.projectRoot,\n server: this.instance!.server,\n metro: this.metro,\n tsconfig: true,\n throttle: true,\n eventTypes: ['change', 'add'],\n callback: async () => {\n // Run once, this prevents the TypeScript project prerequisite from running on every file change.\n off();\n const { TypeScriptProjectPrerequisite } = await import(\n '../../doctor/typescript/TypeScriptProjectPrerequisite'\n );\n\n try {\n const req = new TypeScriptProjectPrerequisite(this.projectRoot);\n await req.bootstrapAsync();\n resolve(true);\n } catch (error: any) {\n // Ensure the process doesn't fail if the TypeScript check fails.\n // This could happen during the install.\n Log.log();\n Log.error(\n chalk.red`Failed to automatically setup TypeScript for your project. Try restarting the dev server to fix.`\n );\n Log.exception(error);\n resolve(false);\n }\n },\n });\n });\n }\n\n public async startTypeScriptServices() {\n startTypescriptTypeGenerationAsync({\n server: this.instance!.server,\n metro: this.metro,\n projectRoot: this.projectRoot,\n });\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./metro.config.js', './metro.config.json', './rn-cli.config.js'];\n }\n}\n\nexport function getDeepLinkHandler(projectRoot: string): DeepLinkHandler {\n return async ({ runtime }) => {\n if (runtime === 'expo') return;\n const { exp } = getConfig(projectRoot);\n await logEventAsync('dev client start command', {\n status: 'started',\n ...getDevClientProperties(projectRoot, exp),\n });\n };\n}\n\nfunction htmlFromSerialAssets(\n assets: SerialAsset[],\n { dev, template, bundleUrl }: { dev: boolean; template: string; bundleUrl?: string }\n) {\n // Combine the CSS modules into tags that have hot refresh data attributes.\n const styleString = assets\n .filter((asset) => asset.type === 'css')\n .map(({ metadata, filename, source }) => {\n if (dev) {\n return `<style data-expo-css-hmr=\"${metadata.hmrId}\">` + source + '\\n</style>';\n } else {\n return [\n `<link rel=\"preload\" href=\"/${filename}\" as=\"style\">`,\n `<link rel=\"stylesheet\" href=\"/${filename}\">`,\n ].join('');\n }\n })\n .join('');\n\n const jsAssets = assets.filter((asset) => asset.type === 'js');\n\n const scripts = bundleUrl\n ? `<script src=\"${bundleUrl}\" defer></script>`\n : jsAssets\n .map(({ filename }) => {\n return `<script src=\"/${filename}\" defer></script>`;\n })\n .join('');\n\n return template\n .replace('</head>', `${styleString}</head>`)\n .replace('</body>', `${scripts}\\n</body>`);\n}\n"],"names":["getDeepLinkHandler","runtimeEnv","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","MetroBundlerDevServer","BundlerDevServer","metro","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","getRoutesAsync","url","getDevServerUrl","assert","getManifest","getStaticRenderFunctions","projectRoot","environment","fetchData","composeResourcesWithHtml","mode","resources","template","devBundleUrl","isDev","htmlFromSerialAssets","dev","bundleUrl","undefined","getStaticRenderFunctionAsync","minify","getStaticContent","path","URL","getStaticResourcesAsync","devBundleUrlPathname","createBundleUrlPath","platform","serializerOutput","mainModuleName","resolveMainModuleName","getConfig","results","fetch","toString","txt","text","JSON","parse","error","Log","renderStaticErrorAsync","getErrorOverlayHtmlAsync","getStaticPageAsync","pathname","bundleStaticHtml","location","staticHtml","Promise","all","content","watchEnvironmentVariables","instance","Error","envFiles","getFiles","NODE_ENV","map","fileName","join","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","parsedOptions","maxWorkers","resetCache","resetDevServer","unversioned","EXPO_DEV_SERVER_ORIGIN","middleware","messageSocket","instantiateMetroAsync","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","ReactDevToolsPageMiddleware","deepLinkMiddleware","RuntimeRedirectMiddleware","onDeepLink","getLocation","runtime","constructDevClientUrl","constructUrl","CreateFileMiddleware","isTargetingWeb","exp","skipSDKVersionRequirement","useWebSSG","web","output","ServeStaticMiddleware","req","res","next","endsWith","includes","setHeader","end","HistoryFallbackMiddleware","internal","originalClose","close","bind","callback","err","host","protocol","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","logEventAsync","status","getDevClientProperties","assets","styleString","filter","asset","type","metadata","filename","source","hmrId","jsAssets","scripts","replace"],"mappings":"AAMA;;;;QA2agBA,kBAAkB,GAAlBA,kBAAkB;AA3aR,IAAA,OAAc,WAAd,cAAc,CAAA;AACN,IAAA,UAAkB,WAAlB,kBAAkB,CAAA;AACxCC,IAAAA,UAAU,mCAAM,WAAW,EAAjB;AAEH,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AACP,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEH,IAAA,IAAc,WAAd,cAAc,CAAA;AACC,IAAA,uBAAiD,kCAAjD,iDAAiD,EAAA;AACtD,IAAA,kBAA4C,WAA5C,4CAA4C,CAAA;AACzC,IAAA,KAAqB,WAArB,qBAAqB,CAAA;AACmB,IAAA,iBAAqB,WAArB,qBAAqB,CAAA;AACrD,IAAA,yBAA6B,WAA7B,6BAA6B,CAAA;AACpB,IAAA,kCAAiD,WAAjD,iDAAiD,CAAA;AAC9D,IAAA,qBAAoC,WAApC,oCAAoC,CAAA;AAC/B,IAAA,0BAAyC,WAAzC,yCAAyC,CAAA;AACxC,IAAA,2BAA0C,WAA1C,0CAA0C,CAAA;AAC1B,IAAA,mBAAkC,WAAlC,kCAAkC,CAAA;AACjD,IAAA,4BAA2C,WAA3C,2CAA2C,CAAA;AAIhF,IAAA,0BAAyC,WAAzC,yCAAyC,CAAA;AACV,IAAA,sBAAqC,WAArC,qCAAqC,CAAA;AAExB,IAAA,8BAAkD,WAAlD,kDAAkD,CAAA;AAC/D,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;AACjB,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AACtB,IAAA,0BAA6B,WAA7B,6BAA6B,CAAA;AAC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I,SAAS,GACrB,CAAC,aAAa,EAAEA,SAAS,CAAC,iBAAiB,CAAC,GAC5C+H,QAAQ,CACLvF,GAAG,CAAC,CAAC,EAAEoF,QAAQ,CAAA,EAAE,GAAK;QACrB,OAAO,CAAC,cAAc,EAAEA,QAAQ,CAAC,iBAAiB,CAAC,CAAC;KACrD,CAAC,CACDlF,IAAI,CAAC,EAAE,CAAC,AAAC;IAEhB,OAAO/C,QAAQ,CACZsI,OAAO,CAAC,SAAS,EAAE,CAAC,EAAEV,WAAW,CAAC,OAAO,CAAC,CAAC,CAC3CU,OAAO,CAAC,SAAS,EAAE,CAAC,EAAED,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;CAC9C"}
|
|
@@ -33,6 +33,25 @@ function createInspectorDeviceClass(metroBundler, MetroDeviceClass) {
|
|
|
33
33
|
return (ref = handler.onDebuggerMessage == null ? void 0 : handler.onDebuggerMessage(message, info)) != null ? ref : false;
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Handle a new device connection with the same device identifier.
|
|
38
|
+
* When the app and device name matches, we can reuse the debugger connection.
|
|
39
|
+
* Else, we have to shut the debugger connection down.
|
|
40
|
+
*/ handleDuplicateDeviceConnection(newDevice) {
|
|
41
|
+
if (this._app !== newDevice._app || this._name !== newDevice._name) {
|
|
42
|
+
var ref;
|
|
43
|
+
this._deviceSocket.close();
|
|
44
|
+
(ref = this._debuggerConnection) == null ? void 0 : ref.socket.close();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const oldDebugger = this._debuggerConnection;
|
|
48
|
+
this._debuggerConnection = null;
|
|
49
|
+
if (oldDebugger) {
|
|
50
|
+
oldDebugger.socket.removeAllListeners();
|
|
51
|
+
this._deviceSocket.close();
|
|
52
|
+
newDevice.handleDebuggerConnection(oldDebugger.socket, oldDebugger.pageId);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
36
55
|
/** Hook into the message life cycle to answer more complex CDP messages */ async _processMessageFromDevice(message, info) {
|
|
37
56
|
if (!this.onDeviceMessage(message, info)) {
|
|
38
57
|
await super._processMessageFromDevice(message, info);
|
|
@@ -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 { VscodeCompatHandler } from './handlers/VscodeCompat';\nimport { DeviceRequest, InspectorHandler, DebuggerRequest } from './handlers/types';\n\nexport function createInspectorDeviceClass(\n metroBundler: MetroBundlerDevServer,\n MetroDeviceClass: typeof MetroDevice\n) {\n return class ExpoInspectorDevice extends MetroDeviceClass implements InspectorHandler {\n /** All handlers that should be used to intercept or reply to CDP events */\n public handlers: InspectorHandler[] = [\n new NetworkResponseHandler(),\n new DebuggerScriptSourceHandler(this),\n new PageReloadHandler(metroBundler),\n new VscodeCompatHandler(),\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 /** 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","handlers","NetworkResponseHandler","DebuggerScriptSourceHandler","PageReloadHandler","VscodeCompatHandler","onDeviceMessage","message","info","handler","some","onDebuggerMessage","
|
|
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 { VscodeCompatHandler } from './handlers/VscodeCompat';\nimport { DeviceRequest, InspectorHandler, DebuggerRequest } from './handlers/types';\n\nexport function createInspectorDeviceClass(\n metroBundler: MetroBundlerDevServer,\n MetroDeviceClass: typeof MetroDevice\n) {\n return class ExpoInspectorDevice extends MetroDeviceClass implements InspectorHandler {\n /** All handlers that should be used to intercept or reply to CDP events */\n public handlers: InspectorHandler[] = [\n new NetworkResponseHandler(),\n new DebuggerScriptSourceHandler(this),\n new PageReloadHandler(metroBundler),\n new VscodeCompatHandler(),\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 /** 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","handlers","NetworkResponseHandler","DebuggerScriptSourceHandler","PageReloadHandler","VscodeCompatHandler","onDeviceMessage","message","info","handler","some","onDebuggerMessage","handleDuplicateDeviceConnection","newDevice","_app","_name","_deviceSocket","close","_debuggerConnection","socket","oldDebugger","removeAllListeners","handleDebuggerConnection","pageId","_processMessageFromDevice","_interceptMessageFromDebugger","request","_fetchText","url","LENGTH_LIMIT_BYTES","response","fetch","ok","Error","status","contentLength","headers","get","Number","text","Buffer","byteLength"],"mappings":"AAAA;;;;QAWgBA,0BAA0B,GAA1BA,0BAA0B;AAVxB,IAAA,UAAY,kCAAZ,YAAY,EAAA;AAIc,IAAA,qBAAiC,WAAjC,iCAAiC,CAAA;AACtC,IAAA,gBAA4B,WAA5B,4BAA4B,CAAA;AACjC,IAAA,WAAuB,WAAvB,uBAAuB,CAAA;AACrB,IAAA,aAAyB,WAAzB,yBAAyB,CAAA;;;;;;AAGtD,SAASA,0BAA0B,CACxCC,YAAmC,EACnCC,gBAAoC,EACpC;IACA,OAAO,MAAMC,mBAAmB,SAASD,gBAAgB;QACvD,2EAA2E,CAC3E,AAAOE,QAAQ,GAAuB;YACpC,IAAIC,gBAAsB,uBAAA,EAAE;YAC5B,IAAIC,qBAA2B,4BAAA,CAAC,IAAI,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AIG,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"}
|
|
@@ -14,7 +14,7 @@ var _device = require("./device");
|
|
|
14
14
|
var _proxy = require("./proxy");
|
|
15
15
|
const debug = require("debug")("expo:metro:inspector-proxy");
|
|
16
16
|
function createInspectorProxy(metroBundler, projectRoot) {
|
|
17
|
-
debug("
|
|
17
|
+
debug("Expo inspector proxy enabled");
|
|
18
18
|
// Import the installed `metro-inspector-proxy` from the project
|
|
19
19
|
// We use these base classes to extend functionality
|
|
20
20
|
const { InspectorProxy: MetroInspectorProxy } = (0, _resolveFromProject).importMetroInspectorProxyFromProject(projectRoot);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/inspector-proxy/index.ts"],"sourcesContent":["import { MetroBundlerDevServer } from '../MetroBundlerDevServer';\nimport {\n importMetroInspectorDeviceFromProject,\n importMetroInspectorProxyFromProject,\n} from '../resolveFromProject';\nimport { createInspectorDeviceClass } from './device';\nimport { ExpoInspectorProxy } from './proxy';\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('
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/metro/inspector-proxy/index.ts"],"sourcesContent":["import { MetroBundlerDevServer } from '../MetroBundlerDevServer';\nimport {\n importMetroInspectorDeviceFromProject,\n importMetroInspectorProxyFromProject,\n} from '../resolveFromProject';\nimport { createInspectorDeviceClass } from './device';\nimport { ExpoInspectorProxy } from './proxy';\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 // Import the installed `metro-inspector-proxy` from the project\n // We use these base classes to extend functionality\n const { InspectorProxy: MetroInspectorProxy } = importMetroInspectorProxyFromProject(projectRoot);\n // The device is slightly more complicated, we need to extend that class\n const ExpoInspectorDevice = createInspectorDeviceClass(\n metroBundler,\n importMetroInspectorDeviceFromProject(projectRoot)\n );\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","InspectorProxy","MetroInspectorProxy","importMetroInspectorProxyFromProject","ExpoInspectorDevice","createInspectorDeviceClass","importMetroInspectorDeviceFromProject","inspectorProxy"],"mappings":"AAAA;;;;+BAQSA,oBAAkB;;;eAFQ,MAAS,CAEnCA,kBAAkB;;;QAIXC,oBAAoB,GAApBA,oBAAoB;AAR7B,IAAA,mBAAuB,WAAvB,uBAAuB,CAAA;AACa,IAAA,OAAU,WAAV,UAAU,CAAA;AAClB,IAAA,MAAS,WAAT,SAAS,CAAA;AAI5C,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,gEAAgE;IAChE,oDAAoD;IACpD,MAAM,EAAEI,cAAc,EAAEC,mBAAmB,CAAA,EAAE,GAAGC,CAAAA,GAAAA,mBAAoC,AAAa,CAAA,qCAAb,CAACH,WAAW,CAAC,AAAC;IAClG,wEAAwE;IACxE,MAAMI,mBAAmB,GAAGC,CAAAA,GAAAA,OAA0B,AAGrD,CAAA,2BAHqD,CACpDN,YAAY,EACZO,CAAAA,GAAAA,mBAAqC,AAAa,CAAA,sCAAb,CAACN,WAAW,CAAC,CACnD,AAAC;IAEF,MAAMO,cAAc,GAAG,IAAIZ,MAAkB,mBAAA,CAC3C,IAAIO,mBAAmB,CAACF,WAAW,CAAC,EACpCI,mBAAmB,CACpB,AAAC;IAEF,OAAOG,cAAc,CAAC;CACvB"}
|
|
@@ -20,6 +20,8 @@ class ExpoInspectorProxy {
|
|
|
20
20
|
this.DeviceClass = DeviceClass;
|
|
21
21
|
this.devices = devices;
|
|
22
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`
|
|
23
25
|
this.metroProxy._devices = this.devices;
|
|
24
26
|
// force httpEndpointMiddleware to be bound to this proxy instance
|
|
25
27
|
this.processRequest = this.processRequest.bind(this);
|
|
@@ -59,13 +61,25 @@ class ExpoInspectorProxy {
|
|
|
59
61
|
// See: https://github.com/facebook/metro/blob/eeb211fdcfdcb9e7f8a51721bd0f48bc7d0d211f/packages/metro-inspector-proxy/src/InspectorProxy.js#L157
|
|
60
62
|
wss.on("connection", (socket, request)=>{
|
|
61
63
|
try {
|
|
62
|
-
const
|
|
63
|
-
const { deviceName , appName } = getNewDeviceInfo(request.url);
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
const fallbackDeviceId = String(this.metroProxy._deviceCounter++);
|
|
65
|
+
const { deviceId: newDeviceId , deviceName , appName } = getNewDeviceInfo(request.url);
|
|
66
|
+
const deviceId = newDeviceId != null ? newDeviceId : fallbackDeviceId;
|
|
67
|
+
const oldDevice = this.devices.get(deviceId);
|
|
68
|
+
const newDevice = new this.DeviceClass(deviceId, deviceName, appName, socket, this.metroProxy._projectRoot);
|
|
69
|
+
if (oldDevice) {
|
|
70
|
+
debug("Device reconnected: device=%s, app=%s, id=%s", deviceName, appName, deviceId);
|
|
71
|
+
// See: https://github.com/facebook/metro/pull/991
|
|
72
|
+
// @ts-expect-error - Newly introduced method coming to metro-inspector-proxy soon
|
|
73
|
+
oldDevice.handleDuplicateDeviceConnection(newDevice);
|
|
74
|
+
} else {
|
|
75
|
+
debug("New device connected: device=%s, app=%s, id=%s", deviceName, appName, deviceId);
|
|
76
|
+
}
|
|
77
|
+
this.devices.set(deviceId, newDevice);
|
|
66
78
|
socket.on("close", ()=>{
|
|
67
|
-
this.devices.
|
|
68
|
-
|
|
79
|
+
if (this.devices.get(deviceId) === newDevice) {
|
|
80
|
+
this.devices.delete(deviceId);
|
|
81
|
+
debug("Device disconnected: device=%s, app=%s, id=%s", deviceName, appName, deviceId);
|
|
82
|
+
}
|
|
69
83
|
});
|
|
70
84
|
} catch (error) {
|
|
71
85
|
let message = "";
|
|
@@ -95,7 +109,7 @@ class ExpoInspectorProxy {
|
|
|
95
109
|
// TODO(cedric): change these errors to proper error types
|
|
96
110
|
throw new Error(`Missing "device" and/or "page" IDs in query parameters`);
|
|
97
111
|
}
|
|
98
|
-
const device = this.devices.get(
|
|
112
|
+
const device = this.devices.get(deviceId);
|
|
99
113
|
if (!device) {
|
|
100
114
|
// TODO(cedric): change these errors to proper error types
|
|
101
115
|
throw new Error(`Device with ID "${deviceId}" not found.`);
|
|
@@ -128,6 +142,7 @@ function asString(value = "") {
|
|
|
128
142
|
function getNewDeviceInfo(url) {
|
|
129
143
|
const { query } = (0, _url).parse(url != null ? url : "", true);
|
|
130
144
|
return {
|
|
145
|
+
deviceId: asString(query.device) || undefined,
|
|
131
146
|
deviceName: asString(query.name) || "Unknown device name",
|
|
132
147
|
appName: asString(query.app) || "Unknown app name"
|
|
133
148
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/inspector-proxy/proxy.ts"],"sourcesContent":["import type { Server as HttpServer, IncomingMessage, ServerResponse } from 'http';\nimport type { Server as HttpsServer } from 'https';\nimport type { InspectorProxy as MetroProxy, Device as MetroDevice } from 'metro-inspector-proxy';\nimport { parse } from 'url';\nimport WS, { Server as WSServer } from 'ws';\n\nimport { Log } from '../../../../log';\n\nconst WS_DEVICE_URL = '/inspector/device';\nconst WS_DEBUGGER_URL = '/inspector/debug';\nconst WS_GENERIC_ERROR_STATUS = 1011;\n\nconst debug = require('debug')('expo:metro:inspector-proxy:proxy') as typeof console.log;\n\n// This is a workaround for `ConstructorType` not working on dynamically generated classes\ntype Instantiatable<Instance> = new (...args: any) => Instance;\n\nexport class ExpoInspectorProxy<D extends MetroDevice = MetroDevice> {\n constructor(\n public readonly metroProxy: MetroProxy,\n private DeviceClass: Instantiatable<D>,\n public readonly devices: Map<number, D> = new Map()\n ) {\n // monkey-patch the device list to expose it within the metro inspector\n this.metroProxy._devices = this.devices;\n\n // force httpEndpointMiddleware to be bound to this proxy instance\n this.processRequest = this.processRequest.bind(this);\n }\n\n /**\n * Initialize the server address from the metro server.\n * This is required to properly reference sourcemaps for the debugger.\n */\n private setServerAddress(server: HttpServer | HttpsServer) {\n const addressInfo = server.address();\n\n if (typeof addressInfo === 'string') {\n throw new Error(`Inspector proxy could not resolve the server address, got \"${addressInfo}\"`);\n } else if (addressInfo === null) {\n throw new Error(`Inspector proxy could not resolve the server address, got \"null\"`);\n }\n\n const { address, port, family } = addressInfo;\n\n if (family === 'IPv6') {\n this.metroProxy._serverAddressWithPort = `[${address ?? '::1'}]:${port}`;\n } else {\n this.metroProxy._serverAddressWithPort = `${address ?? 'localhost'}:${port}`;\n }\n }\n\n /** @see https://chromedevtools.github.io/devtools-protocol/#endpoints */\n public processRequest(req: IncomingMessage, res: ServerResponse, next: (error?: Error) => any) {\n this.metroProxy.processRequest(req, res, next);\n }\n\n public createWebSocketListeners(server: HttpServer | HttpsServer): Record<string, WSServer> {\n this.setServerAddress(server);\n\n return {\n [WS_DEVICE_URL]: this.createDeviceWebSocketServer(),\n [WS_DEBUGGER_URL]: this.createDebuggerWebSocketServer(),\n };\n }\n\n private createDeviceWebSocketServer() {\n const wss = new WS.Server({\n noServer: true,\n perMessageDeflate: false,\n });\n\n // See: https://github.com/facebook/metro/blob/eeb211fdcfdcb9e7f8a51721bd0f48bc7d0d211f/packages/metro-inspector-proxy/src/InspectorProxy.js#L157\n wss.on('connection', (socket, request) => {\n try {\n const deviceId = this.metroProxy._deviceCounter++;\n const { deviceName, appName } = getNewDeviceInfo(request.url);\n\n this.devices.set(\n deviceId,\n new this.DeviceClass(deviceId, deviceName, appName, socket, this.metroProxy._projectRoot)\n );\n\n debug('New device connected: device=%s, app=%s', deviceName, appName);\n\n socket.on('close', () => {\n this.devices.delete(deviceId);\n debug('Device disconnected: device=%s, app=%s', deviceName, appName);\n });\n } catch (error: unknown) {\n let message = '';\n\n debug('Could not establish a connection to on-device debugger:', error);\n\n if (error instanceof Error) {\n message = error.toString();\n Log.error('Failed to create a socket connection to on-device debugger (Hermes engine).');\n Log.exception(error);\n } else {\n Log.error(\n 'Failed to create a socket connection to on-device debugger (Hermes engine), unknown error.'\n );\n }\n\n socket.close(WS_GENERIC_ERROR_STATUS, message || 'Unknown error');\n }\n });\n\n return wss;\n }\n\n private createDebuggerWebSocketServer() {\n const wss = new WS.Server({\n noServer: true,\n perMessageDeflate: false,\n });\n\n // See: https://github.com/facebook/metro/blob/eeb211fdcfdcb9e7f8a51721bd0f48bc7d0d211f/packages/metro-inspector-proxy/src/InspectorProxy.js#L193\n wss.on('connection', (socket, request) => {\n try {\n const { deviceId, pageId } = getExistingDeviceInfo(request.url);\n if (!deviceId || !pageId) {\n // TODO(cedric): change these errors to proper error types\n throw new Error(`Missing \"device\" and/or \"page\" IDs in query parameters`);\n }\n\n const device = this.devices.get(parseInt(deviceId, 10));\n if (!device) {\n // TODO(cedric): change these errors to proper error types\n throw new Error(`Device with ID \"${deviceId}\" not found.`);\n }\n\n debug('New debugger connected: device=%s, app=%s', device._name, device._app);\n\n device.handleDebuggerConnection(socket, pageId);\n\n socket.on('close', () => {\n debug('Debugger disconnected: device=%s, app=%s', device._name, device._app);\n });\n } catch (error: unknown) {\n let message = '';\n\n debug('Could not establish a connection to debugger:', error);\n\n if (error instanceof Error) {\n message = error.toString();\n Log.error('Failed to create a socket connection to the debugger.');\n Log.exception(error);\n } else {\n Log.error('Failed to create a socket connection to the debugger, unkown error.');\n }\n\n socket.close(WS_GENERIC_ERROR_STATUS, message || 'Unknown error');\n }\n });\n\n return wss;\n }\n}\n\nfunction asString(value: string | string[] = ''): string {\n return Array.isArray(value) ? value.join() : value;\n}\n\nfunction getNewDeviceInfo(url: IncomingMessage['url']) {\n const { query } = parse(url ?? '', true);\n return {\n deviceName: asString(query.name) || 'Unknown device name',\n appName: asString(query.app) || 'Unknown app name',\n };\n}\n\nfunction getExistingDeviceInfo(url: IncomingMessage['url']) {\n const { query } = parse(url ?? '', true);\n return {\n deviceId: asString(query.device),\n pageId: asString(query.page),\n };\n}\n"],"names":["WS_DEVICE_URL","WS_DEBUGGER_URL","WS_GENERIC_ERROR_STATUS","debug","require","ExpoInspectorProxy","constructor","metroProxy","DeviceClass","devices","Map","_devices","processRequest","bind","setServerAddress","server","addressInfo","address","Error","port","family","_serverAddressWithPort","req","res","next","createWebSocketListeners","createDeviceWebSocketServer","createDebuggerWebSocketServer","wss","WS","Server","noServer","perMessageDeflate","on","socket","request","deviceId","_deviceCounter","deviceName","appName","getNewDeviceInfo","url","set","_projectRoot","delete","error","message","toString","Log","exception","close","pageId","getExistingDeviceInfo","device","get","parseInt","_name","_app","handleDebuggerConnection","asString","value","Array","isArray","join","query","parse","name","app","page"],"mappings":"AAAA;;;;AAGsB,IAAA,IAAK,WAAL,KAAK,CAAA;AACY,IAAA,GAAI,kCAAJ,IAAI,EAAA;AAEvB,IAAA,IAAiB,WAAjB,iBAAiB,CAAA;;;;;;AAErC,MAAMA,aAAa,GAAG,mBAAmB,AAAC;AAC1C,MAAMC,eAAe,GAAG,k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/B,SAASsD,QAAQ,CAACC,KAAwB,GAAG,EAAE,EAAU;IACvD,OAAOC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,GAAGA,KAAK,CAACG,IAAI,EAAE,GAAGH,KAAK,CAAC;CACpD;AAED,SAASpB,gBAAgB,CAACC,GAA2B,EAAE;IACrD,MAAM,EAAEuB,KAAK,CAAA,EAAE,GAAGC,CAAAA,GAAAA,IAAK,AAAiB,CAAA,MAAjB,CAACxB,GAAG,WAAHA,GAAG,GAAI,EAAE,EAAE,IAAI,CAAC,AAAC;IACzC,OAAO;QACLH,UAAU,EAAEqB,QAAQ,CAACK,KAAK,CAACE,IAAI,CAAC,IAAI,qBAAqB;QACzD3B,OAAO,EAAEoB,QAAQ,CAACK,KAAK,CAACG,GAAG,CAAC,IAAI,kBAAkB;KACnD,CAAC;CACH;AAED,SAASf,qBAAqB,CAACX,GAA2B,EAAE;IAC1D,MAAM,EAAEuB,KAAK,CAAA,EAAE,GAAGC,CAAAA,GAAAA,IAAK,AAAiB,CAAA,MAAjB,CAACxB,GAAG,WAAHA,GAAG,GAAI,EAAE,EAAE,IAAI,CAAC,AAAC;IACzC,OAAO;QACLL,QAAQ,EAAEuB,QAAQ,CAACK,KAAK,CAACX,MAAM,CAAC;QAChCF,MAAM,EAAEQ,QAAQ,CAACK,KAAK,CAACI,IAAI,CAAC;KAC7B,CAAC;CACH"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/metro/inspector-proxy/proxy.ts"],"sourcesContent":["import type { Server as HttpServer, IncomingMessage, ServerResponse } from 'http';\nimport type { Server as HttpsServer } from 'https';\nimport type { InspectorProxy as MetroProxy, Device as MetroDevice } from 'metro-inspector-proxy';\nimport { parse } from 'url';\nimport WS, { Server as WSServer } from 'ws';\n\nimport { Log } from '../../../../log';\n\nconst WS_DEVICE_URL = '/inspector/device';\nconst WS_DEBUGGER_URL = '/inspector/debug';\nconst WS_GENERIC_ERROR_STATUS = 1011;\n\nconst debug = require('debug')('expo:metro:inspector-proxy:proxy') as typeof console.log;\n\n// This is a workaround for `ConstructorType` not working on dynamically generated classes\ntype Instantiatable<Instance> = new (...args: any) => Instance;\n\nexport class ExpoInspectorProxy<D extends MetroDevice = MetroDevice> {\n constructor(\n public readonly metroProxy: MetroProxy,\n private DeviceClass: Instantiatable<D>,\n public readonly devices: Map<string, D> = new Map()\n ) {\n // monkey-patch the device list to expose it within the metro inspector\n // See https://github.com/facebook/metro/pull/991\n // @ts-expect-error - Device ID is changing from `number` to `string`\n this.metroProxy._devices = this.devices;\n\n // force httpEndpointMiddleware to be bound to this proxy instance\n this.processRequest = this.processRequest.bind(this);\n }\n\n /**\n * Initialize the server address from the metro server.\n * This is required to properly reference sourcemaps for the debugger.\n */\n private setServerAddress(server: HttpServer | HttpsServer) {\n const addressInfo = server.address();\n\n if (typeof addressInfo === 'string') {\n throw new Error(`Inspector proxy could not resolve the server address, got \"${addressInfo}\"`);\n } else if (addressInfo === null) {\n throw new Error(`Inspector proxy could not resolve the server address, got \"null\"`);\n }\n\n const { address, port, family } = addressInfo;\n\n if (family === 'IPv6') {\n this.metroProxy._serverAddressWithPort = `[${address ?? '::1'}]:${port}`;\n } else {\n this.metroProxy._serverAddressWithPort = `${address ?? 'localhost'}:${port}`;\n }\n }\n\n /** @see https://chromedevtools.github.io/devtools-protocol/#endpoints */\n public processRequest(req: IncomingMessage, res: ServerResponse, next: (error?: Error) => any) {\n this.metroProxy.processRequest(req, res, next);\n }\n\n public createWebSocketListeners(server: HttpServer | HttpsServer): Record<string, WSServer> {\n this.setServerAddress(server);\n\n return {\n [WS_DEVICE_URL]: this.createDeviceWebSocketServer(),\n [WS_DEBUGGER_URL]: this.createDebuggerWebSocketServer(),\n };\n }\n\n private createDeviceWebSocketServer() {\n const wss = new WS.Server({\n noServer: true,\n perMessageDeflate: false,\n });\n\n // See: https://github.com/facebook/metro/blob/eeb211fdcfdcb9e7f8a51721bd0f48bc7d0d211f/packages/metro-inspector-proxy/src/InspectorProxy.js#L157\n wss.on('connection', (socket, request) => {\n try {\n const fallbackDeviceId = String(this.metroProxy._deviceCounter++);\n const { deviceId: newDeviceId, deviceName, appName } = getNewDeviceInfo(request.url);\n\n const deviceId = newDeviceId ?? fallbackDeviceId;\n\n const oldDevice = this.devices.get(deviceId);\n const newDevice = new this.DeviceClass(\n deviceId,\n deviceName,\n appName,\n socket,\n this.metroProxy._projectRoot\n );\n\n if (oldDevice) {\n debug('Device reconnected: device=%s, app=%s, id=%s', deviceName, appName, deviceId);\n // See: https://github.com/facebook/metro/pull/991\n // @ts-expect-error - Newly introduced method coming to metro-inspector-proxy soon\n oldDevice.handleDuplicateDeviceConnection(newDevice);\n } else {\n debug('New device connected: device=%s, app=%s, id=%s', deviceName, appName, deviceId);\n }\n\n this.devices.set(deviceId, newDevice);\n\n socket.on('close', () => {\n if (this.devices.get(deviceId) === newDevice) {\n this.devices.delete(deviceId);\n debug('Device disconnected: device=%s, app=%s, id=%s', deviceName, appName, deviceId);\n }\n });\n } catch (error: unknown) {\n let message = '';\n\n debug('Could not establish a connection to on-device debugger:', error);\n\n if (error instanceof Error) {\n message = error.toString();\n Log.error('Failed to create a socket connection to on-device debugger (Hermes engine).');\n Log.exception(error);\n } else {\n Log.error(\n 'Failed to create a socket connection to on-device debugger (Hermes engine), unknown error.'\n );\n }\n\n socket.close(WS_GENERIC_ERROR_STATUS, message || 'Unknown error');\n }\n });\n\n return wss;\n }\n\n private createDebuggerWebSocketServer() {\n const wss = new WS.Server({\n noServer: true,\n perMessageDeflate: false,\n });\n\n // See: https://github.com/facebook/metro/blob/eeb211fdcfdcb9e7f8a51721bd0f48bc7d0d211f/packages/metro-inspector-proxy/src/InspectorProxy.js#L193\n wss.on('connection', (socket, request) => {\n try {\n const { deviceId, pageId } = getExistingDeviceInfo(request.url);\n if (!deviceId || !pageId) {\n // TODO(cedric): change these errors to proper error types\n throw new Error(`Missing \"device\" and/or \"page\" IDs in query parameters`);\n }\n\n const device = this.devices.get(deviceId);\n if (!device) {\n // TODO(cedric): change these errors to proper error types\n throw new Error(`Device with ID \"${deviceId}\" not found.`);\n }\n\n debug('New debugger connected: device=%s, app=%s', device._name, device._app);\n\n device.handleDebuggerConnection(socket, pageId);\n\n socket.on('close', () => {\n debug('Debugger disconnected: device=%s, app=%s', device._name, device._app);\n });\n } catch (error: unknown) {\n let message = '';\n\n debug('Could not establish a connection to debugger:', error);\n\n if (error instanceof Error) {\n message = error.toString();\n Log.error('Failed to create a socket connection to the debugger.');\n Log.exception(error);\n } else {\n Log.error('Failed to create a socket connection to the debugger, unkown error.');\n }\n\n socket.close(WS_GENERIC_ERROR_STATUS, message || 'Unknown error');\n }\n });\n\n return wss;\n }\n}\n\nfunction asString(value: string | string[] = ''): string {\n return Array.isArray(value) ? value.join() : value;\n}\n\nfunction getNewDeviceInfo(url: IncomingMessage['url']) {\n const { query } = parse(url ?? '', true);\n return {\n deviceId: asString(query.device) || undefined,\n deviceName: asString(query.name) || 'Unknown device name',\n appName: asString(query.app) || 'Unknown app name',\n };\n}\n\nfunction getExistingDeviceInfo(url: IncomingMessage['url']) {\n const { query } = parse(url ?? '', true);\n return {\n deviceId: asString(query.device),\n pageId: asString(query.page),\n };\n}\n"],"names":["WS_DEVICE_URL","WS_DEBUGGER_URL","WS_GENERIC_ERROR_STATUS","debug","require","ExpoInspectorProxy","constructor","metroProxy","DeviceClass","devices","Map","_devices","processRequest","bind","setServerAddress","server","addressInfo","address","Error","port","family","_serverAddressWithPort","req","res","next","createWebSocketListeners","createDeviceWebSocketServer","createDebuggerWebSocketServer","wss","WS","Server","noServer","perMessageDeflate","on","socket","request","fallbackDeviceId","String","_deviceCounter","deviceId","newDeviceId","deviceName","appName","getNewDeviceInfo","url","oldDevice","get","newDevice","_projectRoot","handleDuplicateDeviceConnection","set","delete","error","message","toString","Log","exception","close","pageId","getExistingDeviceInfo","device","_name","_app","handleDebuggerConnection","asString","value","Array","isArray","join","query","parse","undefined","name","app","page"],"mappings":"AAAA;;;;AAGsB,IAAA,IAA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G,IAAI,CAAC,IAAI,qBAAqB;QACzD9B,OAAO,EAAEsB,QAAQ,CAACK,KAAK,CAACI,GAAG,CAAC,IAAI,kBAAkB;KACnD,CAAC;CACH;AAED,SAASd,qBAAqB,CAACf,GAA2B,EAAE;IAC1D,MAAM,EAAEyB,KAAK,CAAA,EAAE,GAAGC,CAAAA,GAAAA,IAAK,AAAiB,CAAA,MAAjB,CAAC1B,GAAG,WAAHA,GAAG,GAAI,EAAE,EAAE,IAAI,CAAC,AAAC;IACzC,OAAO;QACLL,QAAQ,EAAEyB,QAAQ,CAACK,KAAK,CAACT,MAAM,CAAC;QAChCF,MAAM,EAAEM,QAAQ,CAACK,KAAK,CAACK,IAAI,CAAC;KAC7B,CAAC;CACH"}
|
|
@@ -40,7 +40,7 @@ const runServer = async (metroBundler, config, { hasReducedPerformance =false ,
|
|
|
40
40
|
});
|
|
41
41
|
serverApp.use(middleware);
|
|
42
42
|
let inspectorProxy = null;
|
|
43
|
-
if (config.server.runInspectorProxy && _env.env.
|
|
43
|
+
if (config.server.runInspectorProxy && !_env.env.EXPO_NO_INSPECTOR_PROXY) {
|
|
44
44
|
inspectorProxy = (0, _inspectorProxy).createInspectorProxy(metroBundler, config.projectRoot);
|
|
45
45
|
} else if (config.server.runInspectorProxy) {
|
|
46
46
|
inspectorProxy = new InspectorProxy(config.projectRoot);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/runServer-fork.ts"],"sourcesContent":["// Copyright © 2023 650 Industries.\n// Copyright (c) Meta Platforms, Inc. and affiliates.\n//\n// Forks https://github.com/facebook/metro/blob/b80d9a0f638ee9fb82ff69cd3c8d9f4309ca1da2/packages/metro/src/index.flow.js#L57\n// and adds the ability to access the bundler instance.\nimport http from 'http';\nimport https from 'https';\nimport { RunServerOptions, Server } from 'metro';\nimport { ConfigT } from 'metro-config';\nimport { InspectorProxy } from 'metro-inspector-proxy';\nimport { parse } from 'url';\n\nimport { env } from '../../../utils/env';\nimport { MetroBundlerDevServer } from './MetroBundlerDevServer';\nimport { createInspectorProxy, ExpoInspectorProxy } from './inspector-proxy';\nimport {\n importMetroCreateWebsocketServerFromProject,\n importMetroFromProject,\n importMetroHmrServerFromProject,\n importMetroInspectorProxyFromProject,\n} from './resolveFromProject';\n\nexport const runServer = async (\n metroBundler: MetroBundlerDevServer,\n config: ConfigT,\n {\n hasReducedPerformance = false,\n host,\n onError,\n onReady,\n secureServerOptions,\n waitForBundler = false,\n websocketEndpoints = {},\n watch,\n }: RunServerOptions\n): Promise<{ server: http.Server | https.Server; metro: Server }> => {\n const projectRoot = metroBundler.projectRoot;\n\n const Metro = importMetroFromProject(projectRoot);\n\n const createWebsocketServer = importMetroCreateWebsocketServerFromProject(projectRoot);\n\n const { InspectorProxy } = importMetroInspectorProxyFromProject(projectRoot);\n\n const MetroHmrServer = importMetroHmrServerFromProject(projectRoot);\n\n // await earlyPortCheck(host, config.server.port);\n\n // if (secure != null || secureCert != null || secureKey != null) {\n // // eslint-disable-next-line no-console\n // console.warn(\n // chalk.inverse.yellow.bold(' DEPRECATED '),\n // 'The `secure`, `secureCert`, and `secureKey` options are now deprecated. ' +\n // 'Please use the `secureServerOptions` object instead to pass options to ' +\n // \"Metro's https development server.\",\n // );\n // }\n // Lazy require\n const connect = require('connect');\n\n const serverApp = connect();\n\n const { middleware, end, metroServer } = await Metro.createConnectMiddleware(config, {\n hasReducedPerformance,\n waitForBundler,\n watch,\n });\n\n serverApp.use(middleware);\n\n let inspectorProxy: InspectorProxy | ExpoInspectorProxy | null = null;\n if (config.server.runInspectorProxy && env.
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/runServer-fork.ts"],"sourcesContent":["// Copyright © 2023 650 Industries.\n// Copyright (c) Meta Platforms, Inc. and affiliates.\n//\n// Forks https://github.com/facebook/metro/blob/b80d9a0f638ee9fb82ff69cd3c8d9f4309ca1da2/packages/metro/src/index.flow.js#L57\n// and adds the ability to access the bundler instance.\nimport http from 'http';\nimport https from 'https';\nimport { RunServerOptions, Server } from 'metro';\nimport { ConfigT } from 'metro-config';\nimport { InspectorProxy } from 'metro-inspector-proxy';\nimport { parse } from 'url';\n\nimport { env } from '../../../utils/env';\nimport { MetroBundlerDevServer } from './MetroBundlerDevServer';\nimport { createInspectorProxy, ExpoInspectorProxy } from './inspector-proxy';\nimport {\n importMetroCreateWebsocketServerFromProject,\n importMetroFromProject,\n importMetroHmrServerFromProject,\n importMetroInspectorProxyFromProject,\n} from './resolveFromProject';\n\nexport const runServer = async (\n metroBundler: MetroBundlerDevServer,\n config: ConfigT,\n {\n hasReducedPerformance = false,\n host,\n onError,\n onReady,\n secureServerOptions,\n waitForBundler = false,\n websocketEndpoints = {},\n watch,\n }: RunServerOptions\n): Promise<{ server: http.Server | https.Server; metro: Server }> => {\n const projectRoot = metroBundler.projectRoot;\n\n const Metro = importMetroFromProject(projectRoot);\n\n const createWebsocketServer = importMetroCreateWebsocketServerFromProject(projectRoot);\n\n const { InspectorProxy } = importMetroInspectorProxyFromProject(projectRoot);\n\n const MetroHmrServer = importMetroHmrServerFromProject(projectRoot);\n\n // await earlyPortCheck(host, config.server.port);\n\n // if (secure != null || secureCert != null || secureKey != null) {\n // // eslint-disable-next-line no-console\n // console.warn(\n // chalk.inverse.yellow.bold(' DEPRECATED '),\n // 'The `secure`, `secureCert`, and `secureKey` options are now deprecated. ' +\n // 'Please use the `secureServerOptions` object instead to pass options to ' +\n // \"Metro's https development server.\",\n // );\n // }\n // Lazy require\n const connect = require('connect');\n\n const serverApp = connect();\n\n const { middleware, end, metroServer } = await Metro.createConnectMiddleware(config, {\n hasReducedPerformance,\n waitForBundler,\n watch,\n });\n\n serverApp.use(middleware);\n\n let inspectorProxy: InspectorProxy | ExpoInspectorProxy | null = null;\n if (config.server.runInspectorProxy && !env.EXPO_NO_INSPECTOR_PROXY) {\n inspectorProxy = createInspectorProxy(metroBundler, config.projectRoot);\n } else if (config.server.runInspectorProxy) {\n inspectorProxy = new InspectorProxy(config.projectRoot);\n }\n\n let httpServer: http.Server | https.Server;\n\n if (secureServerOptions != null) {\n httpServer = https.createServer(secureServerOptions, serverApp);\n } else {\n httpServer = http.createServer(serverApp);\n }\n return new Promise<{ server: http.Server | https.Server; metro: Server }>((resolve, reject) => {\n httpServer.on('error', (error) => {\n if (onError) {\n onError(error);\n }\n reject(error);\n end();\n });\n\n httpServer.listen(config.server.port, host, () => {\n if (onReady) {\n onReady(httpServer);\n }\n\n Object.assign(websocketEndpoints, {\n ...(inspectorProxy ? { ...inspectorProxy.createWebSocketListeners(httpServer) } : {}),\n '/hot': createWebsocketServer({\n websocketServer: new MetroHmrServer(\n metroServer.getBundler(),\n metroServer.getCreateModuleId(),\n config\n ),\n }),\n });\n\n httpServer.on('upgrade', (request, socket, head) => {\n const { pathname } = parse(request.url!);\n if (pathname != null && websocketEndpoints[pathname]) {\n websocketEndpoints[pathname].handleUpgrade(request, socket, head, (ws) => {\n websocketEndpoints[pathname].emit('connection', ws, request);\n });\n } else {\n socket.destroy();\n }\n });\n\n if (inspectorProxy) {\n // TODO(hypuk): Refactor inspectorProxy.processRequest into separate request handlers\n // so that we could provide routes (/json/list and /json/version) here.\n // Currently this causes Metro to give warning about T31407894.\n // $FlowFixMe[method-unbinding] added when improving typing for this parameters\n serverApp.use(inspectorProxy.processRequest.bind(inspectorProxy));\n }\n\n resolve({ server: httpServer, metro: metroServer });\n });\n\n // Disable any kind of automatic timeout behavior for incoming\n // requests in case it takes the packager more than the default\n // timeout of 120 seconds to respond to a request.\n httpServer.timeout = 0;\n\n httpServer.on('close', () => {\n end();\n });\n });\n};\n"],"names":["runServer","metroBundler","config","hasReducedPerformance","host","onError","onReady","secureServerOptions","waitForBundler","websocketEndpoints","watch","projectRoot","Metro","importMetroFromProject","createWebsocketServer","importMetroCreateWebsocketServerFromProject","InspectorProxy","importMetroInspectorProxyFromProject","MetroHmrServer","importMetroHmrServerFromProject","connect","require","serverApp","middleware","end","metroServer","createConnectMiddleware","use","inspectorProxy","server","runInspectorProxy","env","EXPO_NO_INSPECTOR_PROXY","createInspectorProxy","httpServer","https","createServer","http","Promise","resolve","reject","on","error","listen","port","Object","assign","createWebSocketListeners","websocketServer","getBundler","getCreateModuleId","request","socket","head","pathname","parse","url","handleUpgrade","ws","emit","destroy","processRequest","bind","metro","timeout"],"mappings":"AAKA;;;;;AAAiB,IAAA,KAAM,kCAAN,MAAM,EAAA;AACL,IAAA,MAAO,kCAAP,OAAO,EAAA;AAIH,IAAA,IAAK,WAAL,KAAK,CAAA;AAEP,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AAEiB,IAAA,eAAmB,WAAnB,mBAAmB,CAAA;AAMrE,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;;;;;;AAEtB,MAAMA,SAAS,GAAG,OACvBC,YAAmC,EACnCC,MAAe,EACf,EACEC,qBAAqB,EAAG,KAAK,CAAA,EAC7BC,IAAI,CAAA,EACJC,OAAO,CAAA,EACPC,OAAO,CAAA,EACPC,mBAAmB,CAAA,EACnBC,cAAc,EAAG,KAAK,CAAA,EACtBC,kBAAkB,EAAG,EAAE,CAAA,EACvBC,KAAK,CAAA,EACY,GACgD;IACnE,MAAMC,WAAW,GAAGV,YAAY,CAACU,WAAW,AAAC;IAE7C,MAAMC,KAAK,GAAGC,CAAAA,GAAAA,mBAAsB,AAAa,CAAA,uBAAb,CAACF,WAAW,CAAC,AAAC;IAElD,MAAMG,qBAAqB,GAAGC,CAAAA,GAAAA,mBAA2C,AAAa,CAAA,4CAAb,CAACJ,WAAW,CAAC,AAAC;IAEvF,MAAM,EAAEK,cAAc,CAAA,EAAE,GAAGC,CAAAA,GAAAA,mBAAoC,AAAa,CAAA,qCAAb,CAACN,WAAW,CAAC,AAAC;IAE7E,MAAMO,cAAc,GAAGC,CAAAA,GAAAA,mBAA+B,AAAa,CAAA,gCAAb,CAACR,WAAW,CAAC,AAAC;IAEpE,kDAAkD;IAElD,mEAAmE;IACnE,2CAA2C;IAC3C,kBAAkB;IAClB,i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