@expo/cli 55.0.18 → 55.0.19
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 +1 -1
- package/build/metro-require/require.js +4 -4
- package/build/src/events/index.js +1 -1
- package/build/src/export/createMetadataJson.js +7 -2
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +3 -2
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/exportApp.js +6 -4
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/run/android/runAndroidAsync.js.map +1 -1
- package/build/src/run/ios/launchApp.js +1 -1
- package/build/src/run/ios/launchApp.js.map +1 -1
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +3 -2
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
- package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -1
- package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +18 -4
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +72 -15
- package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +1 -0
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +36 -8
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/DomComponentsMiddleware.js +0 -3
- package/build/src/start/server/middleware/DomComponentsMiddleware.js.map +1 -1
- package/build/src/utils/resolveWatchFolders.js +67 -0
- package/build/src/utils/resolveWatchFolders.js.map +1 -0
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/android/AndroidPlatformManager.ts"],"sourcesContent":["import { AndroidAppIdResolver } from './AndroidAppIdResolver';\nimport { AndroidDeviceManager } from './AndroidDeviceManager';\nimport { Device } from './adb';\nimport { startAdbReverseAsync } from './adbReverse';\nimport { CommandError } from '../../../utils/errors';\nimport { memoize } from '../../../utils/fn';\nimport { learnMore } from '../../../utils/link';\nimport { hasDirectDevClientDependency } from '../../detectDevClient';\nimport { AppIdResolver } from '../AppIdResolver';\nimport { BaseOpenInCustomProps, BaseResolveDeviceProps, PlatformManager } from '../PlatformManager';\n\nconst debug = require('debug')(\n 'expo:start:platforms:platformManager:android'\n) as typeof console.log;\n\nexport interface AndroidOpenInCustomProps extends BaseOpenInCustomProps {\n /**\n * The Android app intent to launch through `adb shell am start -n <launchActivity>`.\n */\n launchActivity?: string;\n /**\n * The custom app id to launch, provided through `--app-id`.\n * By default, the app id is identical to the package name.\n * When using product flavors, the app id might be customized.\n */\n customAppId?: string;\n}\n\nexport class AndroidPlatformManager extends PlatformManager<Device, AndroidOpenInCustomProps> {\n /** The last used custom launch props, should be reused whenever launching custom runtime without launch props */\n private lastCustomRuntimeLaunchProps?: AndroidOpenInCustomProps;\n /** Memoized method to detect if dev client is installed */\n private hasDevClientInstalled: () => boolean;\n\n constructor(\n protected projectRoot: string,\n protected port: number,\n options: {\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL */\n getExpoGoUrl: () => string;\n /** Get redirect URL for native disambiguation. */\n getRedirectUrl: () => string | null;\n /** Dev Client URL. */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n }\n ) {\n super(projectRoot, {\n platform: 'android',\n ...options,\n resolveDeviceAsync: AndroidDeviceManager.resolveAsync,\n });\n\n this.hasDevClientInstalled = memoize(hasDirectDevClientDependency.bind(this, projectRoot));\n }\n\n async openAsync(\n options:\n | { runtime: 'expo' | 'web' }\n | { runtime: 'custom'; props?: Partial<AndroidOpenInCustomProps> },\n resolveSettings?:
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/android/AndroidPlatformManager.ts"],"sourcesContent":["import { AndroidAppIdResolver } from './AndroidAppIdResolver';\nimport { AndroidDeviceManager } from './AndroidDeviceManager';\nimport { Device } from './adb';\nimport { startAdbReverseAsync } from './adbReverse';\nimport { CommandError } from '../../../utils/errors';\nimport { memoize } from '../../../utils/fn';\nimport { learnMore } from '../../../utils/link';\nimport { hasDirectDevClientDependency } from '../../detectDevClient';\nimport { AppIdResolver } from '../AppIdResolver';\nimport { BaseOpenInCustomProps, BaseResolveDeviceProps, PlatformManager } from '../PlatformManager';\n\nconst debug = require('debug')(\n 'expo:start:platforms:platformManager:android'\n) as typeof console.log;\n\nexport interface AndroidOpenInCustomProps extends BaseOpenInCustomProps {\n /**\n * The Android app intent to launch through `adb shell am start -n <launchActivity>`.\n */\n launchActivity?: string;\n /**\n * The custom app id to launch, provided through `--app-id`.\n * By default, the app id is identical to the package name.\n * When using product flavors, the app id might be customized.\n */\n customAppId?: string;\n}\n\nexport class AndroidPlatformManager extends PlatformManager<Device, AndroidOpenInCustomProps> {\n /** The last used custom launch props, should be reused whenever launching custom runtime without launch props */\n private lastCustomRuntimeLaunchProps?: AndroidOpenInCustomProps;\n /** Memoized method to detect if dev client is installed */\n private hasDevClientInstalled: () => boolean;\n\n constructor(\n protected projectRoot: string,\n protected port: number,\n options: {\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL */\n getExpoGoUrl: () => string;\n /** Get redirect URL for native disambiguation. */\n getRedirectUrl: () => string | null;\n /** Dev Client URL. */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n }\n ) {\n super(projectRoot, {\n platform: 'android',\n ...options,\n resolveDeviceAsync: AndroidDeviceManager.resolveAsync,\n });\n\n this.hasDevClientInstalled = memoize(hasDirectDevClientDependency.bind(this, projectRoot));\n }\n\n async openAsync(\n options:\n | { runtime: 'expo' | 'web' }\n | { runtime: 'custom'; props?: Partial<AndroidOpenInCustomProps> },\n resolveSettings?: BaseResolveDeviceProps<Device>\n ): Promise<{ url: string }> {\n await startAdbReverseAsync([this.port]);\n\n if (options.runtime === 'custom') {\n // Store the resolved launch properties for future \"openAsync\" request.\n // This reuses the same launch properties when opening through the CLI interface (pressing `a`).\n if (options.props) {\n this.lastCustomRuntimeLaunchProps = options.props;\n } else if (!options.props && this.lastCustomRuntimeLaunchProps) {\n options.props = this.lastCustomRuntimeLaunchProps;\n }\n\n // Handle projects that need to launch with a custom app id and launch activity\n return this.openProjectInCustomRuntimeWithCustomAppIdAsync(options, resolveSettings);\n }\n\n return super.openAsync(options, resolveSettings);\n }\n\n /**\n * Launch the custom runtime project, using the provided custom app id and launch activity.\n * Instead of \"open url\", this will launch the activity directly.\n * If dev client is installed, it will also pass the dev client URL to the activity.\n */\n async openProjectInCustomRuntimeWithCustomAppIdAsync(\n options: { runtime: 'custom'; props?: Partial<AndroidOpenInCustomProps> },\n resolveSettings?: Partial<BaseResolveDeviceProps<Device>>\n ) {\n // Fall back to default dev client URL open behavior if no custom app id or launch activity is provided\n if (!options.props?.customAppId || !options.props?.launchActivity) {\n return super.openProjectInCustomRuntimeAsync(resolveSettings, options.props);\n }\n\n const { customAppId, launchActivity } = options.props;\n const url = this.hasDevClientInstalled()\n ? (this.props.getCustomRuntimeUrl({ scheme: options.props.scheme }) ?? undefined)\n : undefined;\n\n debug(`Opening custom runtime using launch activity: ${launchActivity} --`, options.props);\n\n const deviceManager = (await this.props.resolveDeviceAsync(\n resolveSettings\n )) as AndroidDeviceManager;\n\n if (!(await deviceManager.isAppInstalledAndIfSoReturnContainerPathForIOSAsync(customAppId))) {\n throw new CommandError(\n `No development build (${customAppId}) for this project is installed. ` +\n `Install a development build on the target device and try again.\\n${learnMore(\n 'https://docs.expo.dev/development/build/'\n )}`\n );\n }\n\n deviceManager.logOpeningUrl(url ?? launchActivity);\n await deviceManager.activateWindowAsync();\n await deviceManager.launchActivityAsync(launchActivity, url);\n\n return { url: url ?? launchActivity };\n }\n\n _getAppIdResolver(): AppIdResolver {\n return new AndroidAppIdResolver(this.projectRoot);\n }\n\n _resolveAlternativeLaunchUrl(\n applicationId: string,\n props?: Partial<AndroidOpenInCustomProps>\n ): string {\n return props?.launchActivity ?? `${applicationId}/.MainActivity`;\n }\n}\n"],"names":["AndroidPlatformManager","debug","require","PlatformManager","constructor","projectRoot","port","options","platform","resolveDeviceAsync","AndroidDeviceManager","resolveAsync","hasDevClientInstalled","memoize","hasDirectDevClientDependency","bind","openAsync","resolveSettings","startAdbReverseAsync","runtime","props","lastCustomRuntimeLaunchProps","openProjectInCustomRuntimeWithCustomAppIdAsync","customAppId","launchActivity","openProjectInCustomRuntimeAsync","url","getCustomRuntimeUrl","scheme","undefined","deviceManager","isAppInstalledAndIfSoReturnContainerPathForIOSAsync","CommandError","learnMore","logOpeningUrl","activateWindowAsync","launchActivityAsync","_getAppIdResolver","AndroidAppIdResolver","_resolveAlternativeLaunchUrl","applicationId"],"mappings":";;;;+BA4BaA;;;eAAAA;;;sCA5BwB;sCACA;4BAEA;wBACR;oBACL;sBACE;iCACmB;iCAEkC;AAE/E,MAAMC,QAAQC,QAAQ,SACpB;AAgBK,MAAMF,+BAA+BG,gCAAe;IAMzDC,YACE,AAAUC,WAAmB,EAC7B,AAAUC,IAAY,EACtBC,OASC,CACD;QACA,KAAK,CAACF,aAAa;YACjBG,UAAU;YACV,GAAGD,OAAO;YACVE,oBAAoBC,0CAAoB,CAACC,YAAY;QACvD,SAjBUN,cAAAA,kBACAC,OAAAA;QAkBV,IAAI,CAACM,qBAAqB,GAAGC,IAAAA,WAAO,EAACC,6CAA4B,CAACC,IAAI,CAAC,IAAI,EAAEV;IAC/E;IAEA,MAAMW,UACJT,OAEoE,EACpEU,eAAgD,EACtB;QAC1B,MAAMC,IAAAA,gCAAoB,EAAC;YAAC,IAAI,CAACZ,IAAI;SAAC;QAEtC,IAAIC,QAAQY,OAAO,KAAK,UAAU;YAChC,uEAAuE;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,MAAML,cAAcM,mBAAmB,CAACZ,gBAAgBE;QAExD,OAAO;YAAEA,KAAKA,OAAOF;QAAe;IACtC;IAEAa,oBAAmC;QACjC,OAAO,IAAIC,0CAAoB,CAAC,IAAI,CAACjC,WAAW;IAClD;IAEAkC,6BACEC,aAAqB,EACrBpB,KAAyC,EACjC;QACR,OAAOA,CAAAA,yBAAAA,MAAOI,cAAc,KAAI,GAAGgB,cAAc,cAAc,CAAC;IAClE;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/ios/ApplePlatformManager.ts"],"sourcesContent":["import { AppleAppIdResolver } from './AppleAppIdResolver';\nimport { AppleDeviceManager } from './AppleDeviceManager';\nimport { Device } from './simctl';\nimport { AppIdResolver } from '../AppIdResolver';\nimport { BaseOpenInCustomProps, PlatformManager } from '../PlatformManager';\n\n/** Manages launching apps on Apple simulators. */\nexport class ApplePlatformManager extends PlatformManager<Device> {\n constructor(\n protected projectRoot: string,\n protected port: number,\n options: {\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL. */\n getExpoGoUrl: () => string;\n /** Get redirect URL for native disambiguation. */\n getRedirectUrl: () => string | null;\n /** Dev Client */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n }\n ) {\n super(projectRoot, {\n platform: 'ios',\n ...options,\n resolveDeviceAsync: AppleDeviceManager.resolveAsync,\n });\n }\n\n async openAsync(\n options:\n | { runtime: 'expo' | 'web' }\n | { runtime: 'custom'; props?: Partial<BaseOpenInCustomProps> },\n resolveSettings?:
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/ios/ApplePlatformManager.ts"],"sourcesContent":["import { AppleAppIdResolver } from './AppleAppIdResolver';\nimport { AppleDeviceManager } from './AppleDeviceManager';\nimport { Device } from './simctl';\nimport { AppIdResolver } from '../AppIdResolver';\nimport { BaseOpenInCustomProps, BaseResolveDeviceProps, PlatformManager } from '../PlatformManager';\n\n/** Manages launching apps on Apple simulators. */\nexport class ApplePlatformManager extends PlatformManager<Device> {\n constructor(\n protected projectRoot: string,\n protected port: number,\n options: {\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL. */\n getExpoGoUrl: () => string;\n /** Get redirect URL for native disambiguation. */\n getRedirectUrl: () => string | null;\n /** Dev Client */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n }\n ) {\n super(projectRoot, {\n platform: 'ios',\n ...options,\n resolveDeviceAsync: AppleDeviceManager.resolveAsync,\n });\n }\n\n async openAsync(\n options:\n | { runtime: 'expo' | 'web' }\n | { runtime: 'custom'; props?: Partial<BaseOpenInCustomProps> },\n resolveSettings?: BaseResolveDeviceProps<Device>\n ): Promise<{ url: string }> {\n await AppleDeviceManager.assertSystemRequirementsAsync();\n return super.openAsync(options, resolveSettings);\n }\n\n _getAppIdResolver(): AppIdResolver {\n return new AppleAppIdResolver(this.projectRoot);\n }\n\n _resolveAlternativeLaunchUrl(\n applicationId: string,\n props?: Partial<BaseOpenInCustomProps>\n ): string {\n return applicationId;\n }\n}\n"],"names":["ApplePlatformManager","PlatformManager","constructor","projectRoot","port","options","platform","resolveDeviceAsync","AppleDeviceManager","resolveAsync","openAsync","resolveSettings","assertSystemRequirementsAsync","_getAppIdResolver","AppleAppIdResolver","_resolveAlternativeLaunchUrl","applicationId","props"],"mappings":";;;;+BAOaA;;;eAAAA;;;oCAPsB;oCACA;iCAG4C;AAGxE,MAAMA,6BAA6BC,gCAAe;IACvDC,YACE,AAAUC,WAAmB,EAC7B,AAAUC,IAAY,EACtBC,OASC,CACD;QACA,KAAK,CAACF,aAAa;YACjBG,UAAU;YACV,GAAGD,OAAO;YACVE,oBAAoBC,sCAAkB,CAACC,YAAY;QACrD,SAjBUN,cAAAA,kBACAC,OAAAA;IAiBZ;IAEA,MAAMM,UACJL,OAEiE,EACjEM,eAAgD,EACtB;QAC1B,MAAMH,sCAAkB,CAACI,6BAA6B;QACtD,OAAO,KAAK,CAACF,UAAUL,SAASM;IAClC;IAEAE,oBAAmC;QACjC,OAAO,IAAIC,sCAAkB,CAAC,IAAI,CAACX,WAAW;IAChD;IAEAY,6BACEC,aAAqB,EACrBC,KAAsC,EAC9B;QACR,OAAOD;IACT;AACF"}
|
|
@@ -385,23 +385,37 @@ class BundlerDevServer {
|
|
|
385
385
|
}
|
|
386
386
|
return this.getUrlCreator().constructLoadingUrl({}, platform === 'emulator' ? 'android' : platform === 'simulator' ? 'ios' : null) ?? null;
|
|
387
387
|
}
|
|
388
|
-
async getPlatformManagerAsync(
|
|
388
|
+
async getPlatformManagerAsync(ofPlatform) {
|
|
389
|
+
const platform = ofPlatform;
|
|
389
390
|
if (!this.platformManagers[platform]) {
|
|
390
391
|
var _this_getInstance;
|
|
391
|
-
const Manager = PLATFORM_MANAGERS[platform]();
|
|
392
392
|
const port = (_this_getInstance = this.getInstance()) == null ? void 0 : _this_getInstance.location.port;
|
|
393
393
|
if (!port || !this.urlCreator) {
|
|
394
394
|
throw new _errors.CommandError('DEV_SERVER', 'Cannot interact with native platforms until dev server has started');
|
|
395
395
|
}
|
|
396
396
|
debug(`Creating platform manager (platform: ${platform}, port: ${port})`);
|
|
397
|
-
|
|
397
|
+
const managerParams = {
|
|
398
398
|
getCustomRuntimeUrl: this.urlCreator.constructDevClientUrl.bind(this.urlCreator),
|
|
399
399
|
getExpoGoUrl: this.getExpoGoUrl.bind(this),
|
|
400
400
|
getRedirectUrl: this.getRedirectUrl.bind(this, platform),
|
|
401
401
|
getDevServerUrl: this.getDevServerUrl.bind(this, {
|
|
402
402
|
hostType: 'localhost'
|
|
403
403
|
})
|
|
404
|
-
}
|
|
404
|
+
};
|
|
405
|
+
switch(platform){
|
|
406
|
+
case 'simulator':
|
|
407
|
+
{
|
|
408
|
+
const Manager = PLATFORM_MANAGERS[platform]();
|
|
409
|
+
this.platformManagers[platform] = new Manager(this.projectRoot, port, managerParams);
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
case 'emulator':
|
|
413
|
+
{
|
|
414
|
+
const Manager = PLATFORM_MANAGERS[platform]();
|
|
415
|
+
this.platformManagers[platform] = new Manager(this.projectRoot, port, managerParams);
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
405
419
|
}
|
|
406
420
|
return this.platformManagers[platform];
|
|
407
421
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/server/BundlerDevServer.ts"],"sourcesContent":["import assert from 'assert';\nimport resolveFrom from 'resolve-from';\n\nimport { AsyncNgrok } from './AsyncNgrok';\nimport { AsyncWsTunnel } from './AsyncWsTunnel';\nimport { Bonjour } from './Bonjour';\nimport DevToolsPluginManager from './DevToolsPluginManager';\nimport { DevelopmentSession } from './DevelopmentSession';\nimport { CreateURLOptions, UrlCreator } from './UrlCreator';\nimport { PlatformBundlers } from './platformBundlers';\nimport * as Log from '../../log';\nimport { FileNotifier } from '../../utils/FileNotifier';\nimport { resolveWithTimeout } from '../../utils/delay';\nimport { env, envIsWebcontainer } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { openBrowserAsync } from '../../utils/open';\nimport {\n BaseOpenInCustomProps,\n BaseResolveDeviceProps,\n PlatformManager,\n} from '../platforms/PlatformManager';\n\nconst debug = require('debug')('expo:start:server:devServer') as typeof console.log;\n\nexport type MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\nexport type ServerLike = {\n close(callback?: (err?: Error) => void): void;\n addListener?(event: string, listener: (...args: any[]) => void): unknown;\n};\n\nexport type DevServerInstance = {\n /** Bundler dev server instance. */\n server: ServerLike;\n /** Dev server URL location properties. */\n location: {\n url: string;\n port: number;\n protocol: 'http' | 'https';\n host?: string;\n };\n /** Additional middleware that's attached to the `server`. */\n middleware: any;\n /** Message socket for communicating with the runtime. */\n messageSocket: MessageSocket;\n};\n\nexport interface BundlerStartOptions {\n /** Should the dev server use `https` protocol. */\n https?: boolean;\n /** Should start the dev servers in development mode (minify). */\n mode?: 'development' | 'production';\n /** Is dev client enabled. */\n devClient?: boolean;\n /** Should run dev servers with clean caches. */\n resetDevServer?: boolean;\n /** Code signing private key path (defaults to same directory as certificate) */\n privateKeyPath?: string;\n\n /** Max amount of workers (threads) to use with Metro bundler, defaults to undefined for max workers. */\n maxWorkers?: number;\n /** Port to start the dev server on. */\n port?: number;\n\n /** Should start a headless dev server e.g. mock representation to approximate info from a server running in a different process. */\n headless?: boolean;\n /** Should instruct the bundler to create minified bundles. */\n minify?: boolean;\n\n /** Will the bundler be used for exporting. NOTE: This is an odd option to pass to the dev server. */\n isExporting?: boolean;\n\n // Webpack options\n /** Should modify and create PWA icons. */\n isImageEditingEnabled?: boolean;\n\n location: CreateURLOptions;\n}\n\nconst PLATFORM_MANAGERS = {\n simulator: () =>\n require('../platforms/ios/ApplePlatformManager')\n .ApplePlatformManager as typeof import('../platforms/ios/ApplePlatformManager').ApplePlatformManager,\n emulator: () =>\n require('../platforms/android/AndroidPlatformManager')\n .AndroidPlatformManager as typeof import('../platforms/android/AndroidPlatformManager').AndroidPlatformManager,\n};\n\nexport abstract class BundlerDevServer {\n /** Name of the bundler. */\n abstract get name(): string;\n\n /** Tunnel instance for managing tunnel connections. */\n protected tunnel: AsyncNgrok | AsyncWsTunnel | null = null;\n /** Interfaces with the Expo 'Development Session' API. */\n protected devSession: DevelopmentSession | null = null;\n /** Announces dev server via Bonjour */\n protected bonjour: Bonjour | null = null;\n /** Http server and related info. */\n protected instance: DevServerInstance | null = null;\n /** Native platform interfaces for opening projects. */\n private platformManagers: Record<string, PlatformManager<any>> = {};\n /** Manages the creation of dev server URLs. */\n protected urlCreator?: UrlCreator | null = null;\n\n private notifier: FileNotifier | null = null;\n protected readonly devToolsPluginManager: DevToolsPluginManager;\n public isDevClient: boolean;\n\n constructor(\n /** Project root folder. */\n public projectRoot: string,\n /** A mapping of bundlers to platforms. */\n public platformBundlers: PlatformBundlers,\n /** Advanced options */\n options?: {\n /**\n * The instance of DevToolsPluginManager\n * @default new DevToolsPluginManager(projectRoot)\n */\n devToolsPluginManager?: DevToolsPluginManager;\n // TODO: Replace with custom scheme maybe...\n isDevClient?: boolean;\n }\n ) {\n this.devToolsPluginManager =\n options?.devToolsPluginManager ?? new DevToolsPluginManager(projectRoot);\n this.isDevClient = options?.isDevClient ?? false;\n }\n\n protected setInstance(instance: DevServerInstance) {\n this.instance = instance;\n }\n\n /** Get the manifest middleware function. */\n protected async getManifestMiddlewareAsync(\n options: Pick<BundlerStartOptions, 'minify' | 'mode' | 'privateKeyPath'> = {}\n ) {\n const Middleware = require('./middleware/ExpoGoManifestHandlerMiddleware')\n .ExpoGoManifestHandlerMiddleware as typeof import('./middleware/ExpoGoManifestHandlerMiddleware').ExpoGoManifestHandlerMiddleware;\n\n const urlCreator = this.getUrlCreator();\n const middleware = new Middleware(this.projectRoot, {\n constructUrl: urlCreator.constructUrl.bind(urlCreator),\n mode: options.mode,\n minify: options.minify,\n isNativeWebpack: this.name === 'webpack' && this.isTargetingNative(),\n privateKeyPath: options.privateKeyPath,\n });\n return middleware;\n }\n\n /** Start the dev server using settings defined in the start command. */\n public async startAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n await this.stopAsync();\n\n let instance: DevServerInstance;\n if (options.headless) {\n instance = await this.startHeadlessAsync(options);\n } else {\n instance = await this.startImplementationAsync(options);\n }\n\n this.setInstance(instance);\n await this.postStartAsync(options);\n return instance;\n }\n\n protected abstract startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance>;\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n return false;\n }\n\n public abstract startTypeScriptServices(): Promise<void>;\n\n public async watchEnvironmentVariables(): Promise<void> {\n // noop -- We've only implemented this functionality in Metro.\n }\n\n /**\n * Creates a mock server representation that can be used to estimate URLs for a server started in another process.\n * This is used for the run commands where you can reuse the server from a previous run.\n */\n private async startHeadlessAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n if (!options.port)\n throw new CommandError('HEADLESS_SERVER', 'headless dev server requires a port option');\n await this.initUrlCreator(options);\n return {\n // Create a mock server\n server: {\n close: (callback: () => void) => {\n this.instance = null;\n callback?.();\n },\n addListener() {},\n },\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware: {},\n messageSocket: {\n broadcast: () => {\n throw new CommandError('HEADLESS_SERVER', 'Cannot broadcast messages to headless server');\n },\n },\n };\n }\n\n /**\n * Runs after the `startAsync` function, performing any additional common operations.\n * You can assume the dev server is started by the time this function is called.\n */\n protected async postStartAsync(options: BundlerStartOptions) {\n if (\n options.location.hostType === 'tunnel' &&\n !env.EXPO_OFFLINE &&\n // This is a hack to prevent using tunnel on web since we block it upstream for some reason.\n this.isTargetingNative()\n ) {\n await this._startTunnelAsync();\n } else if (envIsWebcontainer()) {\n await this._startTunnelAsync();\n }\n\n if (!options.isExporting) {\n await Promise.all([this.startDevSessionAsync(), this.startBonjourAsync()]);\n this.watchConfig();\n }\n }\n\n protected abstract getConfigModuleIds(): string[];\n\n protected watchConfig() {\n this.notifier?.stopObserving();\n this.notifier = new FileNotifier(this.projectRoot, this.getConfigModuleIds());\n this.notifier.startObserving();\n }\n\n /** Create ngrok instance and start the tunnel server. Exposed for testing. */\n public async _startTunnelAsync(): Promise<AsyncNgrok | AsyncWsTunnel | null> {\n const port = this.getInstance()?.location.port;\n if (!port) return null;\n debug('[tunnel] connect to port: ' + port);\n this.tunnel = envIsWebcontainer()\n ? new AsyncWsTunnel(this.projectRoot, port)\n : new AsyncNgrok(this.projectRoot, port);\n await this.tunnel.startAsync();\n return this.tunnel;\n }\n\n protected async startDevSessionAsync() {\n // This is used to make Expo Go open the project in either Expo Go, or the web browser.\n // Must come after ngrok (`startTunnelAsync`) setup.\n this.devSession = new DevelopmentSession(\n this.projectRoot,\n // This URL will be used on external devices so the computer IP won't be relevant.\n this.isTargetingNative()\n ? this.getNativeRuntimeUrl()\n : this.getDevServerUrl({ hostType: 'localhost' })\n );\n\n await this.devSession.startAsync({\n runtime: this.isTargetingNative() ? 'native' : 'web',\n });\n }\n\n protected async startBonjourAsync() {\n // This is used to make Expo Go open the project in either Expo Go, or the web browser.\n // Must come after ngrok (`startTunnelAsync`) setup.\n if (!this.bonjour) {\n this.bonjour = new Bonjour(this.projectRoot, this.getInstance()?.location.port);\n }\n\n await this.bonjour.announceAsync({});\n }\n\n public isTargetingNative() {\n // Temporary hack while we implement multi-bundler dev server proxy.\n return true;\n }\n\n public isTargetingWeb() {\n return this.platformBundlers.web === this.name;\n }\n\n /**\n * Sends a message over web sockets to any connected device,\n * does nothing when the dev server is not running.\n *\n * @param method name of the command. In RN projects `reload`, and `devMenu` are available. In Expo Go, `sendDevCommand` is available.\n * @param params\n */\n public broadcastMessage(\n method: 'reload' | 'devMenu' | 'sendDevCommand',\n params?: Record<string, any>\n ) {\n this.getInstance()?.messageSocket.broadcast(method, params);\n }\n\n /** Get the running dev server instance. */\n public getInstance() {\n return this.instance;\n }\n\n /** Stop the running dev server instance. */\n async stopAsync() {\n // Reset url creator\n this.urlCreator = undefined;\n\n // Stop file watching.\n this.notifier?.stopObserving();\n\n await Promise.all([\n // Stop the bonjour advertiser\n this.bonjour?.closeAsync(),\n // Stop the dev session timer and tell Expo API to remove dev session.\n this.devSession?.closeAsync(),\n ]);\n\n // Stop tunnel if running.\n await this.tunnel?.stopAsync().catch((e) => {\n Log.error(`Error stopping tunnel:`);\n Log.exception(e);\n });\n\n return resolveWithTimeout(\n () =>\n new Promise<void>((resolve, reject) => {\n // Close the server.\n debug(`Stopping dev server (bundler: ${this.name})`);\n\n if (this.instance?.server) {\n // Check if server is even running.\n this.instance.server.close((error) => {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n if (error) {\n if ('code' in error && error.code === 'ERR_SERVER_NOT_RUNNING') {\n resolve();\n } else {\n reject(error);\n }\n } else {\n resolve();\n }\n });\n } else {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n resolve();\n }\n }),\n {\n // NOTE(Bacon): Metro dev server doesn't seem to be closing in time.\n timeout: 1000,\n errorMessage: `Timeout waiting for '${this.name}' dev server to close`,\n }\n );\n }\n\n // TODO(@kitten): This should be created top-down rather than bottom up from implementors\n protected async initUrlCreator(\n options: Partial<Pick<BundlerStartOptions, 'port' | 'location'>> = {}\n ) {\n assert(options?.port, 'Dev server instance not found');\n assert(!this.urlCreator, 'Dev server is already initialized');\n const urlCreator = await UrlCreator.init(options.location, {\n port: options.port,\n getTunnelUrl: this.getTunnelUrl.bind(this),\n });\n this.urlCreator = urlCreator;\n return urlCreator;\n }\n\n public getUrlCreator() {\n assert(this.urlCreator, 'Dev server is uninitialized');\n return this.urlCreator;\n }\n\n public getNativeRuntimeUrl(opts: Partial<CreateURLOptions> = {}) {\n return this.isDevClient\n ? (this.getUrlCreator().constructDevClientUrl(opts) ?? this.getDevServerUrl())\n : this.getUrlCreator().constructUrl({ ...opts, scheme: 'exp' });\n }\n\n /** Get the URL for the running instance of the dev server. */\n public getDevServerUrl(options: { hostType?: 'localhost' } = {}): string | null {\n const instance = this.getInstance();\n if (!instance?.location) {\n return null;\n }\n\n // If we have an active WS tunnel instance, we always need to return the tunnel location.\n if (this.tunnel && this.tunnel instanceof AsyncWsTunnel) {\n return this.getUrlCreator().constructUrl();\n }\n\n const { location } = instance;\n if (options.hostType === 'localhost') {\n return `${location.protocol}://localhost:${location.port}`;\n }\n\n return location.url ?? null;\n }\n\n public getDevServerUrlOrAssert(options: { hostType?: 'localhost' } = {}): string {\n const instance = this.getDevServerUrl(options);\n if (!instance) {\n throw new CommandError(\n 'DEV_SERVER',\n `Cannot get the dev server URL before the server has started - bundler[${this.name}]`\n );\n }\n\n return instance;\n }\n\n /** Get the base URL for JS inspector */\n public getJsInspectorBaseUrl(): string {\n if (this.name !== 'metro') {\n throw new CommandError(\n 'DEV_SERVER',\n `Cannot get the JS inspector base url - bundler[${this.name}]`\n );\n }\n return this.getUrlCreator().constructUrl({ scheme: 'http' });\n }\n\n /** Get the tunnel URL from the tunnel. */\n public getTunnelUrl(): string | null {\n return this.tunnel?.getActiveUrl() ?? null;\n }\n\n /** Open the dev server in a runtime. */\n public async openPlatformAsync(\n launchTarget: keyof typeof PLATFORM_MANAGERS | 'desktop',\n resolver: BaseResolveDeviceProps<any> = {}\n ) {\n if (launchTarget === 'desktop') {\n const serverUrl = this.getDevServerUrl({ hostType: 'localhost' });\n // Allow opening the tunnel URL when using Metro web.\n const url = this.name === 'metro' ? (this.getTunnelUrl() ?? serverUrl) : serverUrl;\n await openBrowserAsync(url!);\n return { url };\n }\n\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync({ runtime }, resolver);\n }\n\n /** Open the dev server in a runtime. */\n public async openCustomRuntimeAsync<T extends BaseOpenInCustomProps = BaseOpenInCustomProps>(\n launchTarget: keyof typeof PLATFORM_MANAGERS,\n launchProps: Partial<T> = {},\n resolver: BaseResolveDeviceProps<any> = {}\n ) {\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n if (runtime !== 'custom') {\n throw new CommandError(\n `dev server cannot open custom runtimes either because it does not target native platforms or because it is not targeting dev clients. (target: ${runtime})`\n );\n }\n\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync({ runtime: 'custom', props: launchProps }, resolver);\n }\n\n /** Get the URL for opening in Expo Go. */\n protected getExpoGoUrl(): string {\n return this.getUrlCreator().constructUrl({ scheme: 'exp' });\n }\n\n /** Should use the interstitial page for selecting which runtime to use. */\n protected isRedirectPageEnabled(): boolean {\n return (\n !env.EXPO_NO_REDIRECT_PAGE &&\n // if user passed --dev-client flag, skip interstitial page\n !this.isDevClient &&\n // Checks if dev client is installed.\n !!resolveFrom.silent(this.projectRoot, 'expo-dev-client')\n );\n }\n\n /** Get the redirect URL when redirecting is enabled. */\n public getRedirectUrl(platform: keyof typeof PLATFORM_MANAGERS | null = null): string | null {\n if (!this.isRedirectPageEnabled()) {\n debug('Redirect page is disabled');\n return null;\n }\n\n return (\n this.getUrlCreator().constructLoadingUrl(\n {},\n platform === 'emulator' ? 'android' : platform === 'simulator' ? 'ios' : null\n ) ?? null\n );\n }\n\n protected async getPlatformManagerAsync(platform: keyof typeof PLATFORM_MANAGERS) {\n if (!this.platformManagers[platform]) {\n const Manager = PLATFORM_MANAGERS[platform]();\n const port = this.getInstance()?.location.port;\n if (!port || !this.urlCreator) {\n throw new CommandError(\n 'DEV_SERVER',\n 'Cannot interact with native platforms until dev server has started'\n );\n }\n debug(`Creating platform manager (platform: ${platform}, port: ${port})`);\n this.platformManagers[platform] = new Manager(this.projectRoot, port, {\n getCustomRuntimeUrl: this.urlCreator.constructDevClientUrl.bind(this.urlCreator),\n getExpoGoUrl: this.getExpoGoUrl.bind(this),\n getRedirectUrl: this.getRedirectUrl.bind(this, platform),\n getDevServerUrl: this.getDevServerUrl.bind(this, { hostType: 'localhost' }),\n });\n }\n return this.platformManagers[platform];\n }\n}\n"],"names":["BundlerDevServer","debug","require","PLATFORM_MANAGERS","simulator","ApplePlatformManager","emulator","AndroidPlatformManager","constructor","projectRoot","platformBundlers","options","tunnel","devSession","bonjour","instance","platformManagers","urlCreator","notifier","devToolsPluginManager","DevToolsPluginManager","isDevClient","setInstance","getManifestMiddlewareAsync","Middleware","ExpoGoManifestHandlerMiddleware","getUrlCreator","middleware","constructUrl","bind","mode","minify","isNativeWebpack","name","isTargetingNative","privateKeyPath","startAsync","stopAsync","headless","startHeadlessAsync","startImplementationAsync","postStartAsync","waitForTypeScriptAsync","watchEnvironmentVariables","port","CommandError","initUrlCreator","server","close","callback","addListener","location","host","url","protocol","messageSocket","broadcast","hostType","env","EXPO_OFFLINE","_startTunnelAsync","envIsWebcontainer","isExporting","Promise","all","startDevSessionAsync","startBonjourAsync","watchConfig","stopObserving","FileNotifier","getConfigModuleIds","startObserving","getInstance","AsyncWsTunnel","AsyncNgrok","DevelopmentSession","getNativeRuntimeUrl","getDevServerUrl","runtime","Bonjour","announceAsync","isTargetingWeb","web","broadcastMessage","method","params","undefined","closeAsync","catch","e","Log","error","exception","resolveWithTimeout","resolve","reject","code","timeout","errorMessage","assert","UrlCreator","init","getTunnelUrl","opts","constructDevClientUrl","scheme","getDevServerUrlOrAssert","getJsInspectorBaseUrl","getActiveUrl","openPlatformAsync","launchTarget","resolver","serverUrl","openBrowserAsync","manager","getPlatformManagerAsync","openAsync","openCustomRuntimeAsync","launchProps","props","getExpoGoUrl","isRedirectPageEnabled","EXPO_NO_REDIRECT_PAGE","resolveFrom","silent","getRedirectUrl","platform","constructLoadingUrl","Manager","getCustomRuntimeUrl"],"mappings":";;;;+BA0FsBA;;;eAAAA;;;;gEA1FH;;;;;;;gEACK;;;;;;4BAEG;+BACG;yBACN;8EACU;oCACC;4BACU;6DAExB;8BACQ;uBACM;qBACI;wBACV;sBACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOjC,MAAMC,QAAQC,QAAQ,SAAS;AA2D/B,MAAMC,oBAAoB;IACxBC,WAAW,IACTF,QAAQ,yCACLG,oBAAoB;IACzBC,UAAU,IACRJ,QAAQ,+CACLK,sBAAsB;AAC7B;AAEO,MAAeP;IAqBpBQ,YACE,yBAAyB,GACzB,AAAOC,WAAmB,EAC1B,wCAAwC,GACxC,AAAOC,gBAAkC,EACzC,qBAAqB,GACrBC,OAQC,CACD;aAbOF,cAAAA;aAEAC,mBAAAA;aApBCE,SAA4C;aAE5CC,aAAwC;aAExCC,UAA0B;aAE1BC,WAAqC;aAEvCC,mBAAyD,CAAC;aAExDC,aAAiC;aAEnCC,WAAgC;QAoBtC,IAAI,CAACC,qBAAqB,GACxBR,CAAAA,2BAAAA,QAASQ,qBAAqB,KAAI,IAAIC,8BAAqB,CAACX;QAC9D,IAAI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IAAI,CAAC9G,gBAAgB,CAAC8G,SAAS,EAAE;gBAEvB;YADb,MAAME,UAAU7H,iBAAiB,CAAC2H,SAAS;YAC3C,MAAMlF,QAAO,oBAAA,IAAI,CAAC4B,WAAW,uBAAhB,kBAAoBrB,QAAQ,CAACP,IAAI;YAC9C,IAAI,CAACA,QAAQ,CAAC,IAAI,CAAC3B,UAAU,EAAE;gBAC7B,MAAM,IAAI4B,oBAAY,CACpB,cACA;YAEJ;YACA5C,MAAM,CAAC,qCAAqC,EAAE6H,SAAS,QAAQ,EAAElF,KAAK,CAAC,CAAC;YACxE,IAAI,CAAC5B,gBAAgB,CAAC8G,SAAS,GAAG,IAAIE,QAAQ,IAAI,CAACvH,WAAW,EAAEmC,MAAM;gBACpEqF,qBAAqB,IAAI,CAAChH,UAAU,CAACuF,qBAAqB,CAAC3E,IAAI,CAAC,IAAI,CAACZ,UAAU;gBAC/EuG,cAAc,IAAI,CAACA,YAAY,CAAC3F,IAAI,CAAC,IAAI;gBACzCgG,gBAAgB,IAAI,CAACA,cAAc,CAAChG,IAAI,CAAC,IAAI,EAAEiG;gBAC/CjD,iBAAiB,IAAI,CAACA,eAAe,CAAChD,IAAI,CAAC,IAAI,EAAE;oBAAE4B,UAAU;gBAAY;YAC3E;QACF;QACA,OAAO,IAAI,CAACzC,gBAAgB,CAAC8G,SAAS;IACxC;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/server/BundlerDevServer.ts"],"sourcesContent":["import assert from 'assert';\nimport resolveFrom from 'resolve-from';\n\nimport { AsyncNgrok } from './AsyncNgrok';\nimport { AsyncWsTunnel } from './AsyncWsTunnel';\nimport { Bonjour } from './Bonjour';\nimport DevToolsPluginManager from './DevToolsPluginManager';\nimport { DevelopmentSession } from './DevelopmentSession';\nimport { CreateURLOptions, UrlCreator } from './UrlCreator';\nimport { PlatformBundlers } from './platformBundlers';\nimport * as Log from '../../log';\nimport { FileNotifier } from '../../utils/FileNotifier';\nimport { resolveWithTimeout } from '../../utils/delay';\nimport { env, envIsWebcontainer } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { openBrowserAsync } from '../../utils/open';\nimport {\n BaseOpenInCustomProps,\n BaseResolveDeviceProps,\n PlatformManager,\n} from '../platforms/PlatformManager';\n\nconst debug = require('debug')('expo:start:server:devServer') as typeof console.log;\n\nexport type MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\nexport type ServerLike = {\n close(callback?: (err?: Error) => void): void;\n addListener?(event: string, listener: (...args: any[]) => void): unknown;\n};\n\nexport type DevServerInstance = {\n /** Bundler dev server instance. */\n server: ServerLike;\n /** Dev server URL location properties. */\n location: {\n url: string;\n port: number;\n protocol: 'http' | 'https';\n host?: string;\n };\n /** Additional middleware that's attached to the `server`. */\n middleware: any;\n /** Message socket for communicating with the runtime. */\n messageSocket: MessageSocket;\n};\n\nexport interface BundlerStartOptions {\n /** Should the dev server use `https` protocol. */\n https?: boolean;\n /** Should start the dev servers in development mode (minify). */\n mode?: 'development' | 'production';\n /** Is dev client enabled. */\n devClient?: boolean;\n /** Should run dev servers with clean caches. */\n resetDevServer?: boolean;\n /** Code signing private key path (defaults to same directory as certificate) */\n privateKeyPath?: string;\n\n /** Max amount of workers (threads) to use with Metro bundler, defaults to undefined for max workers. */\n maxWorkers?: number;\n /** Port to start the dev server on. */\n port?: number;\n\n /** Should start a headless dev server e.g. mock representation to approximate info from a server running in a different process. */\n headless?: boolean;\n /** Should instruct the bundler to create minified bundles. */\n minify?: boolean;\n\n /** Will the bundler be used for exporting. NOTE: This is an odd option to pass to the dev server. */\n isExporting?: boolean;\n\n // Webpack options\n /** Should modify and create PWA icons. */\n isImageEditingEnabled?: boolean;\n\n location: CreateURLOptions;\n}\n\nconst PLATFORM_MANAGERS = {\n simulator: () =>\n require('../platforms/ios/ApplePlatformManager')\n .ApplePlatformManager as typeof import('../platforms/ios/ApplePlatformManager').ApplePlatformManager,\n emulator: () =>\n require('../platforms/android/AndroidPlatformManager')\n .AndroidPlatformManager as typeof import('../platforms/android/AndroidPlatformManager').AndroidPlatformManager,\n};\n\ntype PlatformManagers = {\n [K in keyof typeof PLATFORM_MANAGERS]: InstanceType<ReturnType<(typeof PLATFORM_MANAGERS)[K]>>;\n};\n\ntype PlatformDevice<Platform extends keyof PlatformManagers> =\n PlatformManagers[Platform] extends PlatformManager<infer Device, any> ? Device : never;\n\ntype PlatformLaunchProps<Platform extends keyof PlatformManagers> =\n PlatformManagers[Platform] extends PlatformManager<any, infer LaunchProps> ? LaunchProps : never;\n\nexport abstract class BundlerDevServer {\n /** Name of the bundler. */\n abstract get name(): string;\n\n /** Tunnel instance for managing tunnel connections. */\n protected tunnel: AsyncNgrok | AsyncWsTunnel | null = null;\n /** Interfaces with the Expo 'Development Session' API. */\n protected devSession: DevelopmentSession | null = null;\n /** Announces dev server via Bonjour */\n protected bonjour: Bonjour | null = null;\n /** Http server and related info. */\n protected instance: DevServerInstance | null = null;\n /** Native platform interfaces for opening projects. */\n private platformManagers: { [K in keyof PlatformManagers]?: PlatformManagers[K] | undefined } =\n {};\n /** Manages the creation of dev server URLs. */\n protected urlCreator?: UrlCreator | null = null;\n\n private notifier: FileNotifier | null = null;\n protected readonly devToolsPluginManager: DevToolsPluginManager;\n public isDevClient: boolean;\n\n constructor(\n /** Project root folder. */\n public projectRoot: string,\n /** A mapping of bundlers to platforms. */\n public platformBundlers: PlatformBundlers,\n /** Advanced options */\n options?: {\n /**\n * The instance of DevToolsPluginManager\n * @default new DevToolsPluginManager(projectRoot)\n */\n devToolsPluginManager?: DevToolsPluginManager;\n // TODO: Replace with custom scheme maybe...\n isDevClient?: boolean;\n }\n ) {\n this.devToolsPluginManager =\n options?.devToolsPluginManager ?? new DevToolsPluginManager(projectRoot);\n this.isDevClient = options?.isDevClient ?? false;\n }\n\n protected setInstance(instance: DevServerInstance) {\n this.instance = instance;\n }\n\n /** Get the manifest middleware function. */\n protected async getManifestMiddlewareAsync(\n options: Pick<BundlerStartOptions, 'minify' | 'mode' | 'privateKeyPath'> = {}\n ) {\n const Middleware = require('./middleware/ExpoGoManifestHandlerMiddleware')\n .ExpoGoManifestHandlerMiddleware as typeof import('./middleware/ExpoGoManifestHandlerMiddleware').ExpoGoManifestHandlerMiddleware;\n\n const urlCreator = this.getUrlCreator();\n const middleware = new Middleware(this.projectRoot, {\n constructUrl: urlCreator.constructUrl.bind(urlCreator),\n mode: options.mode,\n minify: options.minify,\n isNativeWebpack: this.name === 'webpack' && this.isTargetingNative(),\n privateKeyPath: options.privateKeyPath,\n });\n return middleware;\n }\n\n /** Start the dev server using settings defined in the start command. */\n public async startAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n await this.stopAsync();\n\n let instance: DevServerInstance;\n if (options.headless) {\n instance = await this.startHeadlessAsync(options);\n } else {\n instance = await this.startImplementationAsync(options);\n }\n\n this.setInstance(instance);\n await this.postStartAsync(options);\n return instance;\n }\n\n protected abstract startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance>;\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n return false;\n }\n\n public abstract startTypeScriptServices(): Promise<void>;\n\n public async watchEnvironmentVariables(): Promise<void> {\n // noop -- We've only implemented this functionality in Metro.\n }\n\n /**\n * Creates a mock server representation that can be used to estimate URLs for a server started in another process.\n * This is used for the run commands where you can reuse the server from a previous run.\n */\n private async startHeadlessAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n if (!options.port)\n throw new CommandError('HEADLESS_SERVER', 'headless dev server requires a port option');\n await this.initUrlCreator(options);\n return {\n // Create a mock server\n server: {\n close: (callback: () => void) => {\n this.instance = null;\n callback?.();\n },\n addListener() {},\n },\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware: {},\n messageSocket: {\n broadcast: () => {\n throw new CommandError('HEADLESS_SERVER', 'Cannot broadcast messages to headless server');\n },\n },\n };\n }\n\n /**\n * Runs after the `startAsync` function, performing any additional common operations.\n * You can assume the dev server is started by the time this function is called.\n */\n protected async postStartAsync(options: BundlerStartOptions) {\n if (\n options.location.hostType === 'tunnel' &&\n !env.EXPO_OFFLINE &&\n // This is a hack to prevent using tunnel on web since we block it upstream for some reason.\n this.isTargetingNative()\n ) {\n await this._startTunnelAsync();\n } else if (envIsWebcontainer()) {\n await this._startTunnelAsync();\n }\n\n if (!options.isExporting) {\n await Promise.all([this.startDevSessionAsync(), this.startBonjourAsync()]);\n this.watchConfig();\n }\n }\n\n protected abstract getConfigModuleIds(): string[];\n\n protected watchConfig() {\n this.notifier?.stopObserving();\n this.notifier = new FileNotifier(this.projectRoot, this.getConfigModuleIds());\n this.notifier.startObserving();\n }\n\n /** Create ngrok instance and start the tunnel server. Exposed for testing. */\n public async _startTunnelAsync(): Promise<AsyncNgrok | AsyncWsTunnel | null> {\n const port = this.getInstance()?.location.port;\n if (!port) return null;\n debug('[tunnel] connect to port: ' + port);\n this.tunnel = envIsWebcontainer()\n ? new AsyncWsTunnel(this.projectRoot, port)\n : new AsyncNgrok(this.projectRoot, port);\n await this.tunnel.startAsync();\n return this.tunnel;\n }\n\n protected async startDevSessionAsync() {\n // This is used to make Expo Go open the project in either Expo Go, or the web browser.\n // Must come after ngrok (`startTunnelAsync`) setup.\n this.devSession = new DevelopmentSession(\n this.projectRoot,\n // This URL will be used on external devices so the computer IP won't be relevant.\n this.isTargetingNative()\n ? this.getNativeRuntimeUrl()\n : this.getDevServerUrl({ hostType: 'localhost' })\n );\n\n await this.devSession.startAsync({\n runtime: this.isTargetingNative() ? 'native' : 'web',\n });\n }\n\n protected async startBonjourAsync() {\n // This is used to make Expo Go open the project in either Expo Go, or the web browser.\n // Must come after ngrok (`startTunnelAsync`) setup.\n if (!this.bonjour) {\n this.bonjour = new Bonjour(this.projectRoot, this.getInstance()?.location.port);\n }\n\n await this.bonjour.announceAsync({});\n }\n\n public isTargetingNative() {\n // Temporary hack while we implement multi-bundler dev server proxy.\n return true;\n }\n\n public isTargetingWeb() {\n return this.platformBundlers.web === this.name;\n }\n\n /**\n * Sends a message over web sockets to any connected device,\n * does nothing when the dev server is not running.\n *\n * @param method name of the command. In RN projects `reload`, and `devMenu` are available. In Expo Go, `sendDevCommand` is available.\n * @param params\n */\n public broadcastMessage(\n method: 'reload' | 'devMenu' | 'sendDevCommand',\n params?: Record<string, any>\n ) {\n this.getInstance()?.messageSocket.broadcast(method, params);\n }\n\n /** Get the running dev server instance. */\n public getInstance() {\n return this.instance;\n }\n\n /** Stop the running dev server instance. */\n async stopAsync() {\n // Reset url creator\n this.urlCreator = undefined;\n\n // Stop file watching.\n this.notifier?.stopObserving();\n\n await Promise.all([\n // Stop the bonjour advertiser\n this.bonjour?.closeAsync(),\n // Stop the dev session timer and tell Expo API to remove dev session.\n this.devSession?.closeAsync(),\n ]);\n\n // Stop tunnel if running.\n await this.tunnel?.stopAsync().catch((e) => {\n Log.error(`Error stopping tunnel:`);\n Log.exception(e);\n });\n\n return resolveWithTimeout(\n () =>\n new Promise<void>((resolve, reject) => {\n // Close the server.\n debug(`Stopping dev server (bundler: ${this.name})`);\n\n if (this.instance?.server) {\n // Check if server is even running.\n this.instance.server.close((error) => {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n if (error) {\n if ('code' in error && error.code === 'ERR_SERVER_NOT_RUNNING') {\n resolve();\n } else {\n reject(error);\n }\n } else {\n resolve();\n }\n });\n } else {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n resolve();\n }\n }),\n {\n // NOTE(Bacon): Metro dev server doesn't seem to be closing in time.\n timeout: 1000,\n errorMessage: `Timeout waiting for '${this.name}' dev server to close`,\n }\n );\n }\n\n // TODO(@kitten): This should be created top-down rather than bottom up from implementors\n protected async initUrlCreator(\n options: Partial<Pick<BundlerStartOptions, 'port' | 'location'>> = {}\n ) {\n assert(options?.port, 'Dev server instance not found');\n assert(!this.urlCreator, 'Dev server is already initialized');\n const urlCreator = await UrlCreator.init(options.location, {\n port: options.port,\n getTunnelUrl: this.getTunnelUrl.bind(this),\n });\n this.urlCreator = urlCreator;\n return urlCreator;\n }\n\n public getUrlCreator() {\n assert(this.urlCreator, 'Dev server is uninitialized');\n return this.urlCreator;\n }\n\n public getNativeRuntimeUrl(opts: Partial<CreateURLOptions> = {}) {\n return this.isDevClient\n ? (this.getUrlCreator().constructDevClientUrl(opts) ?? this.getDevServerUrl())\n : this.getUrlCreator().constructUrl({ ...opts, scheme: 'exp' });\n }\n\n /** Get the URL for the running instance of the dev server. */\n public getDevServerUrl(options: { hostType?: 'localhost' } = {}): string | null {\n const instance = this.getInstance();\n if (!instance?.location) {\n return null;\n }\n\n // If we have an active WS tunnel instance, we always need to return the tunnel location.\n if (this.tunnel && this.tunnel instanceof AsyncWsTunnel) {\n return this.getUrlCreator().constructUrl();\n }\n\n const { location } = instance;\n if (options.hostType === 'localhost') {\n return `${location.protocol}://localhost:${location.port}`;\n }\n\n return location.url ?? null;\n }\n\n public getDevServerUrlOrAssert(options: { hostType?: 'localhost' } = {}): string {\n const instance = this.getDevServerUrl(options);\n if (!instance) {\n throw new CommandError(\n 'DEV_SERVER',\n `Cannot get the dev server URL before the server has started - bundler[${this.name}]`\n );\n }\n\n return instance;\n }\n\n /** Get the base URL for JS inspector */\n public getJsInspectorBaseUrl(): string {\n if (this.name !== 'metro') {\n throw new CommandError(\n 'DEV_SERVER',\n `Cannot get the JS inspector base url - bundler[${this.name}]`\n );\n }\n return this.getUrlCreator().constructUrl({ scheme: 'http' });\n }\n\n /** Get the tunnel URL from the tunnel. */\n public getTunnelUrl(): string | null {\n return this.tunnel?.getActiveUrl() ?? null;\n }\n\n /** Open the dev server in a runtime. */\n public async openPlatformAsync(\n launchTarget: keyof PlatformManagers | 'desktop',\n resolver: BaseResolveDeviceProps<any> = {}\n ) {\n if (launchTarget === 'desktop') {\n const serverUrl = this.getDevServerUrl({ hostType: 'localhost' });\n // Allow opening the tunnel URL when using Metro web.\n const url = this.name === 'metro' ? (this.getTunnelUrl() ?? serverUrl) : serverUrl;\n await openBrowserAsync(url!);\n return { url };\n }\n\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync({ runtime }, resolver);\n }\n\n /** Open the dev server in a runtime. */\n public async openCustomRuntimeAsync<Platform extends keyof PlatformManagers>(\n launchTarget: Platform,\n launchProps: Partial<PlatformLaunchProps<Platform>> = {},\n resolver: BaseResolveDeviceProps<PlatformDevice<Platform>> = {}\n ) {\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n if (runtime !== 'custom') {\n throw new CommandError(\n `dev server cannot open custom runtimes either because it does not target native platforms or because it is not targeting dev clients. (target: ${runtime})`\n );\n }\n\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync(\n { runtime: 'custom', props: launchProps },\n resolver as BaseResolveDeviceProps<any>\n );\n }\n\n /** Get the URL for opening in Expo Go. */\n protected getExpoGoUrl(): string {\n return this.getUrlCreator().constructUrl({ scheme: 'exp' });\n }\n\n /** Should use the interstitial page for selecting which runtime to use. */\n protected isRedirectPageEnabled(): boolean {\n return (\n !env.EXPO_NO_REDIRECT_PAGE &&\n // if user passed --dev-client flag, skip interstitial page\n !this.isDevClient &&\n // Checks if dev client is installed.\n !!resolveFrom.silent(this.projectRoot, 'expo-dev-client')\n );\n }\n\n /** Get the redirect URL when redirecting is enabled. */\n public getRedirectUrl(platform: keyof PlatformManagers | null = null): string | null {\n if (!this.isRedirectPageEnabled()) {\n debug('Redirect page is disabled');\n return null;\n }\n\n return (\n this.getUrlCreator().constructLoadingUrl(\n {},\n platform === 'emulator' ? 'android' : platform === 'simulator' ? 'ios' : null\n ) ?? null\n );\n }\n\n protected async getPlatformManagerAsync<Platform extends keyof PlatformManagers>(\n ofPlatform: Platform\n ): Promise<PlatformManagers[Platform]> {\n const platform: keyof PlatformManagers = ofPlatform;\n if (!this.platformManagers[platform]) {\n const port = this.getInstance()?.location.port;\n if (!port || !this.urlCreator) {\n throw new CommandError(\n 'DEV_SERVER',\n 'Cannot interact with native platforms until dev server has started'\n );\n }\n debug(`Creating platform manager (platform: ${platform}, port: ${port})`);\n const managerParams = {\n getCustomRuntimeUrl: this.urlCreator.constructDevClientUrl.bind(this.urlCreator),\n getExpoGoUrl: this.getExpoGoUrl.bind(this),\n getRedirectUrl: this.getRedirectUrl.bind(this, platform),\n getDevServerUrl: this.getDevServerUrl.bind(this, { hostType: 'localhost' }),\n };\n switch (platform) {\n case 'simulator': {\n const Manager = PLATFORM_MANAGERS[platform]();\n this.platformManagers[platform] = new Manager(this.projectRoot, port, managerParams);\n break;\n }\n case 'emulator': {\n const Manager = PLATFORM_MANAGERS[platform]();\n this.platformManagers[platform] = new Manager(this.projectRoot, port, managerParams);\n break;\n }\n }\n }\n return this.platformManagers[platform] as PlatformManagers[Platform];\n }\n}\n"],"names":["BundlerDevServer","debug","require","PLATFORM_MANAGERS","simulator","ApplePlatformManager","emulator","AndroidPlatformManager","constructor","projectRoot","platformBundlers","options","tunnel","devSession","bonjour","instance","platformManagers","urlCreator","notifier","devToolsPluginManager","DevToolsPluginManager","isDevClient","setInstance","getManifestMiddlewareAsync","Middleware","ExpoGoManifestHandlerMiddleware","getUrlCreator","middleware","constructUrl","bind","mode","minify","isNativeWebpack","name","isTargetingNative","privateKeyPath","startAsync","stopAsync","headless","startHeadlessAsync","startImplementationAsync","postStartAsync","waitForTypeScriptAsync","watchEnvironmentVariables","port","CommandError","initUrlCreator","server","close","callback","addListener","location","host","url","protocol","messageSocket","broadcast","hostType","env","EXPO_OFFLINE","_startTunnelAsync","envIsWebcontainer","isExporting","Promise","all","startDevSessionAsync","startBonjourAsync","watchConfig","stopObserving","FileNotifier","getConfigModuleIds","startObserving","getInstance","AsyncWsTunnel","AsyncNgrok","DevelopmentSession","getNativeRuntimeUrl","getDevServerUrl","runtime","Bonjour","announceAsync","isTargetingWeb","web","broadcastMessage","method","params","undefined","closeAsync","catch","e","Log","error","exception","resolveWithTimeout","resolve","reject","code","timeout","errorMessage","assert","UrlCreator","init","getTunnelUrl","opts","constructDevClientUrl","scheme","getDevServerUrlOrAssert","getJsInspectorBaseUrl","getActiveUrl","openPlatformAsync","launchTarget","resolver","serverUrl","openBrowserAsync","manager","getPlatformManagerAsync","openAsync","openCustomRuntimeAsync","launchProps","props","getExpoGoUrl","isRedirectPageEnabled","EXPO_NO_REDIRECT_PAGE","resolveFrom","silent","getRedirectUrl","platform","constructLoadingUrl","ofPlatform","managerParams","getCustomRuntimeUrl","Manager"],"mappings":";;;;+BAoGsBA;;;eAAAA;;;;gEApGH;;;;;;;gEACK;;;;;;4BAEG;+BACG;yBACN;8EACU;oCACC;4BACU;6DAExB;8BACQ;uBACM;qBACI;wBACV;sBACI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOjC,MAAMC,QAAQC,QAAQ,SAAS;AA2D/B,MAAMC,oBAAoB;IACxBC,WAAW,IACTF,QAAQ,yCACLG,oBAAoB;IACzBC,UAAU,IACRJ,QAAQ,+CACLK,sBAAsB;AAC7B;AAYO,MAAeP;IAsBpBQ,YACE,yBAAyB,GACzB,AAAOC,WAAmB,EAC1B,wCAAwC,GACxC,AAAOC,gBAAkC,EACzC,qBAAqB,GACrBC,OAQC,CACD;aAbOF,cAAAA;aAEAC,mBAAAA;aArBCE,SAA4C;aAE5CC,aAAwC;aAExCC,UAA0B;aAE1BC,WAAqC;aAEvCC,mBACN,CAAC;aAEOC,aAAiC;aAEnCC,WAAgC;QAoBtC,IAAI,CAACC,qBAAqB,GACxBR,CAAAA,2BAAAA,QAASQ,qBAAqB,KAAI,IAAIC,8BAAqB,CAACX;QAC9D,IAAI,CAACY,WAAW,GAAGV,CAAAA,2BAAAA,QAASU,WAAW,KAAI;IAC7C;IAEUC,YAAYP,QAA2B,EAAE;QACjD,IAAI,CAACA,QAAQ,GAAGA;I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BAAoBrB,QAAQ,CAACP,IAAI;YAC9C,IAAI,CAACA,QAAQ,CAAC,IAAI,CAAC3B,UAAU,EAAE;gBAC7B,MAAM,IAAI4B,oBAAY,CACpB,cACA;YAEJ;YACA5C,MAAM,CAAC,qCAAqC,EAAE6H,SAAS,QAAQ,EAAElF,KAAK,CAAC,CAAC;YACxE,MAAMqF,gBAAgB;gBACpBC,qBAAqB,IAAI,CAACjH,UAAU,CAACuF,qBAAqB,CAAC3E,IAAI,CAAC,IAAI,CAACZ,UAAU;gBAC/EuG,cAAc,IAAI,CAACA,YAAY,CAAC3F,IAAI,CAAC,IAAI;gBACzCgG,gBAAgB,IAAI,CAACA,cAAc,CAAChG,IAAI,CAAC,IAAI,EAAEiG;gBAC/CjD,iBAAiB,IAAI,CAACA,eAAe,CAAChD,IAAI,CAAC,IAAI,EAAE;oBAAE4B,UAAU;gBAAY;YAC3E;YACA,OAAQqE;gBACN,KAAK;oBAAa;wBAChB,MAAMK,UAAUhI,iBAAiB,CAAC2H,SAAS;wBAC3C,IAAI,CAAC9G,gBAAgB,CAAC8G,SAAS,GAAG,IAAIK,QAAQ,IAAI,CAAC1H,WAAW,EAAEmC,MAAMqF;wBACtE;oBACF;gBACA,KAAK;oBAAY;wBACf,MAAME,UAAUhI,iBAAiB,CAAC2H,SAAS;wBAC3C,IAAI,CAAC9G,gBAAgB,CAAC8G,SAAS,GAAG,IAAIK,QAAQ,IAAI,CAAC1H,WAAW,EAAEmC,MAAMqF;wBACtE;oBACF;YACF;QACF;QACA,OAAO,IAAI,CAACjH,gBAAgB,CAAC8G,SAAS;IACxC;AACF"}
|
|
@@ -8,6 +8,13 @@ Object.defineProperty(exports, "createMetroMiddleware", {
|
|
|
8
8
|
return createMetroMiddleware;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
function _paths() {
|
|
12
|
+
const data = require("@expo/config/paths");
|
|
13
|
+
_paths = function() {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
11
18
|
function _connect() {
|
|
12
19
|
const data = /*#__PURE__*/ _interop_require_default(require("connect"));
|
|
13
20
|
_connect = function() {
|
|
@@ -22,6 +29,20 @@ function _fetchnodeshim() {
|
|
|
22
29
|
};
|
|
23
30
|
return data;
|
|
24
31
|
}
|
|
32
|
+
function _nodefs() {
|
|
33
|
+
const data = /*#__PURE__*/ _interop_require_default(require("node:fs"));
|
|
34
|
+
_nodefs = function() {
|
|
35
|
+
return data;
|
|
36
|
+
};
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
function _nodepath() {
|
|
40
|
+
const data = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
41
|
+
_nodepath = function() {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
return data;
|
|
45
|
+
}
|
|
25
46
|
const _compression = require("./compression");
|
|
26
47
|
const _createEventSocket = require("./createEventSocket");
|
|
27
48
|
const _createMessageSocket = require("./createMessageSocket");
|
|
@@ -38,7 +59,7 @@ function createMetroMiddleware(metroConfig, options) {
|
|
|
38
59
|
});
|
|
39
60
|
const events = (0, _createEventSocket.createEventsSocket)(messages);
|
|
40
61
|
const middleware = (0, _connect().default)().use(noCacheMiddleware).use(_compression.compression)// Support opening stack frames from clients directly in the editor
|
|
41
|
-
.use('/open-stack-frame',
|
|
62
|
+
.use('/open-stack-frame', createMetroOpenStackFrameMiddleware(metroConfig))// Support status check to detect if the packager needs to be started from the native side
|
|
42
63
|
.use('/status', createMetroStatusMiddleware(metroConfig, options));
|
|
43
64
|
return {
|
|
44
65
|
middleware,
|
|
@@ -50,26 +71,13 @@ function createMetroMiddleware(metroConfig, options) {
|
|
|
50
71
|
}
|
|
51
72
|
};
|
|
52
73
|
}
|
|
53
|
-
const noCacheMiddleware = (
|
|
74
|
+
const noCacheMiddleware = (_req, res, next)=>{
|
|
54
75
|
res.setHeader('Surrogate-Control', 'no-store');
|
|
55
76
|
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
|
|
56
77
|
res.setHeader('Pragma', 'no-cache');
|
|
57
78
|
res.setHeader('Expires', '0');
|
|
58
79
|
next();
|
|
59
80
|
};
|
|
60
|
-
const metroOpenStackFrameMiddleware = async (req, res, next)=>{
|
|
61
|
-
if (req.method !== 'POST') {
|
|
62
|
-
return next();
|
|
63
|
-
}
|
|
64
|
-
try {
|
|
65
|
-
const frame = await new (_fetchnodeshim()).Body(req).json();
|
|
66
|
-
await (0, _editor.openInEditorAsync)(frame.file, frame.lineNumber);
|
|
67
|
-
return res.end('OK');
|
|
68
|
-
} catch {
|
|
69
|
-
res.statusCode = 400;
|
|
70
|
-
return res.end('Open stack frame requires the JSON stack frame as request body');
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
81
|
function createMetroStatusMiddleware(metroConfig, options) {
|
|
74
82
|
return async (_req, res)=>{
|
|
75
83
|
res.setHeader('X-React-Native-Project-Root', encodeURI(metroConfig.projectRoot));
|
|
@@ -78,5 +86,54 @@ function createMetroStatusMiddleware(metroConfig, options) {
|
|
|
78
86
|
res.end('packager-status:running');
|
|
79
87
|
};
|
|
80
88
|
}
|
|
89
|
+
function createMetroOpenStackFrameMiddleware(metroConfig) {
|
|
90
|
+
return async (req, res, next)=>{
|
|
91
|
+
if (req.method !== 'POST') {
|
|
92
|
+
return next();
|
|
93
|
+
}
|
|
94
|
+
let frame;
|
|
95
|
+
try {
|
|
96
|
+
const json = await new (_fetchnodeshim()).Body(req).json();
|
|
97
|
+
if (typeof json === 'object' && json != null && typeof json.file === 'string') {
|
|
98
|
+
frame = {
|
|
99
|
+
file: json.file,
|
|
100
|
+
lineNumber: typeof json.lineNumber === 'number' && Number.isSafeInteger(json.lineNumber) ? json.lineNumber : undefined
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
} catch {}
|
|
104
|
+
if (!frame) {
|
|
105
|
+
res.statusCode = 400;
|
|
106
|
+
return res.end('Open stack frame requires the JSON stack frame as request body');
|
|
107
|
+
}
|
|
108
|
+
const root = (0, _paths().getMetroServerRoot)(metroConfig.projectRoot);
|
|
109
|
+
const file = await ensureFileInRootDirectory(root, frame.file);
|
|
110
|
+
if (!file) {
|
|
111
|
+
res.statusCode = 400;
|
|
112
|
+
return res.end('Open stack frame requires target file to be in server root');
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
await (0, _editor.openInEditorAsync)(file, frame.lineNumber);
|
|
116
|
+
return res.end('OK');
|
|
117
|
+
} catch {
|
|
118
|
+
res.statusCode = 5006;
|
|
119
|
+
return res.end('Open stack frame failed to open local editor');
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
const ensureFileInRootDirectory = async (root, file)=>{
|
|
124
|
+
try {
|
|
125
|
+
file = _nodepath().default.resolve(root, file);
|
|
126
|
+
file = await _nodefs().default.promises.realpath(file);
|
|
127
|
+
// Cannot be accessed using Metro's server API, we need to move the file
|
|
128
|
+
// into the project root and try again.
|
|
129
|
+
if (!_nodepath().default.relative(root, file).startsWith('..' + _nodepath().default.sep)) {
|
|
130
|
+
return file;
|
|
131
|
+
} else {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
} catch {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
81
138
|
|
|
82
139
|
//# sourceMappingURL=createMetroMiddleware.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/dev-server/createMetroMiddleware.ts"],"sourcesContent":["import type { MetroConfig } from '@expo/metro/metro';\nimport type MetroBundler from '@expo/metro/metro/Bundler';\nimport connect from 'connect';\nimport { Body } from 'fetch-nodeshim';\n\nimport { compression } from './compression';\nimport { createEventsSocket } from './createEventSocket';\nimport { createMessagesSocket } from './createMessageSocket';\nimport { Log } from '../../../../log';\nimport { openInEditorAsync } from '../../../../utils/editor';\n\ninterface MetroMiddlewareOptions {\n getMetroBundler(): MetroBundler;\n}\n\nexport function createMetroMiddleware(\n metroConfig: Pick<MetroConfig, 'projectRoot'>,\n options: MetroMiddlewareOptions\n) {\n const messages = createMessagesSocket({ logger: Log });\n const events = createEventsSocket(messages);\n\n const middleware = connect()\n .use(noCacheMiddleware)\n .use(compression)\n // Support opening stack frames from clients directly in the editor\n .use('/open-stack-frame',
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/metro/dev-server/createMetroMiddleware.ts"],"sourcesContent":["import { getMetroServerRoot } from '@expo/config/paths';\nimport type { MetroConfig } from '@expo/metro/metro';\nimport type MetroBundler from '@expo/metro/metro/Bundler';\nimport connect from 'connect';\nimport { Body } from 'fetch-nodeshim';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { compression } from './compression';\nimport { createEventsSocket } from './createEventSocket';\nimport { createMessagesSocket } from './createMessageSocket';\nimport { Log } from '../../../../log';\nimport { openInEditorAsync } from '../../../../utils/editor';\n\ninterface MetroMiddlewareOptions {\n getMetroBundler(): MetroBundler;\n}\n\ninterface StackFrame {\n file: string;\n lineNumber?: number | undefined;\n}\n\nexport function createMetroMiddleware(\n metroConfig: Pick<MetroConfig, 'projectRoot'>,\n options: MetroMiddlewareOptions\n) {\n const messages = createMessagesSocket({ logger: Log });\n const events = createEventsSocket(messages);\n\n const middleware = connect()\n .use(noCacheMiddleware)\n .use(compression)\n // Support opening stack frames from clients directly in the editor\n .use('/open-stack-frame', createMetroOpenStackFrameMiddleware(metroConfig))\n // Support status check to detect if the packager needs to be started from the native side\n .use('/status', createMetroStatusMiddleware(metroConfig, options));\n\n return {\n middleware,\n messagesSocket: messages,\n eventsSocket: events,\n websocketEndpoints: {\n [messages.endpoint]: messages.server,\n [events.endpoint]: events.server,\n },\n };\n}\n\nconst noCacheMiddleware: connect.NextHandleFunction = (_req, res, next) => {\n res.setHeader('Surrogate-Control', 'no-store');\n res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');\n res.setHeader('Pragma', 'no-cache');\n res.setHeader('Expires', '0');\n next();\n};\n\nfunction createMetroStatusMiddleware(\n metroConfig: Pick<MetroConfig, 'projectRoot'>,\n options: MetroMiddlewareOptions\n): connect.NextHandleFunction {\n return async (_req, res) => {\n res.setHeader('X-React-Native-Project-Root', encodeURI(metroConfig.projectRoot!));\n res.flushHeaders();\n await options.getMetroBundler().ready();\n res.end('packager-status:running');\n };\n}\n\nfunction createMetroOpenStackFrameMiddleware(\n metroConfig: Pick<MetroConfig, 'projectRoot'>\n): connect.NextHandleFunction {\n return async (req, res, next) => {\n if (req.method !== 'POST') {\n return next();\n }\n\n let frame: StackFrame | undefined;\n try {\n const json = await new Body(req).json();\n if (typeof json === 'object' && json != null && typeof json.file === 'string') {\n frame = {\n file: json.file,\n lineNumber:\n typeof json.lineNumber === 'number' && Number.isSafeInteger(json.lineNumber)\n ? json.lineNumber\n : undefined,\n };\n }\n } catch {}\n if (!frame) {\n res.statusCode = 400;\n return res.end('Open stack frame requires the JSON stack frame as request body');\n }\n\n const root = getMetroServerRoot(metroConfig.projectRoot!);\n const file = await ensureFileInRootDirectory(root, frame.file);\n if (!file) {\n res.statusCode = 400;\n return res.end('Open stack frame requires target file to be in server root');\n }\n\n try {\n await openInEditorAsync(file, frame.lineNumber);\n return res.end('OK');\n } catch {\n res.statusCode = 5006;\n return res.end('Open stack frame failed to open local editor');\n }\n };\n}\n\nconst ensureFileInRootDirectory = async (root: string, file: string): Promise<string | null> => {\n try {\n file = path.resolve(root, file);\n file = await fs.promises.realpath(file);\n // Cannot be accessed using Metro's server API, we need to move the file\n // into the project root and try again.\n if (!path.relative(root, file).startsWith('..' + path.sep)) {\n return file;\n } else {\n return null;\n }\n } catch {\n return null;\n }\n};\n"],"names":["createMetroMiddleware","metroConfig","options","messages","createMessagesSocket","logger","Log","events","createEventsSocket","middleware","connect","use","noCacheMiddleware","compression","createMetroOpenStackFrameMiddleware","createMetroStatusMiddleware","messagesSocket","eventsSocket","websocketEndpoints","endpoint","server","_req","res","next","setHeader","encodeURI","projectRoot","flushHeaders","getMetroBundler","ready","end","req","method","frame","json","Body","file","lineNumber","Number","isSafeInteger","undefined","statusCode","root","getMetroServerRoot","ensureFileInRootDirectory","openInEditorAsync","path","resolve","fs","promises","realpath","relative","startsWith","sep"],"mappings":";;;;+BAuBgBA;;;eAAAA;;;;yBAvBmB;;;;;;;gEAGf;;;;;;;yBACC;;;;;;;gEACN;;;;;;;gEACE;;;;;;6BAEW;mCACO;qCACE;qBACjB;wBACc;;;;;;AAW3B,SAASA,sBACdC,WAA6C,EAC7CC,OAA+B;IAE/B,MAAMC,WAAWC,IAAAA,yCAAoB,EAAC;QAAEC,QAAQC,QAAG;IAAC;IACpD,MAAMC,SAASC,IAAAA,qCAAkB,EAACL;IAElC,MAAMM,aAAaC,IAAAA,kBAAO,IACvBC,GAAG,CAACC,mBACJD,GAAG,CAACE,wBAAW,CAChB,mEAAmE;KAClEF,GAAG,CAAC,qBAAqBG,oCAAoCb,aAC9D,0FAA0F;KACzFU,GAAG,CAAC,WAAWI,4BAA4Bd,aAAaC;IAE3D,OAAO;QACLO;QACAO,gBAAgBb;QAChBc,cAAcV;QACdW,oBAAoB;YAClB,CAACf,SAASgB,QAAQ,CAAC,EAAEhB,SAASiB,MAAM;YACpC,CAACb,OAAOY,QAAQ,CAAC,EAAEZ,OAAOa,MAAM;QAClC;IACF;AACF;AAEA,MAAMR,oBAAgD,CAACS,MAAMC,KAAKC;IAChED,IAAIE,SAAS,CAAC,qBAAqB;IACnCF,IAAIE,SAAS,CAAC,iBAAiB;IAC/BF,IAAIE,SAAS,CAAC,UAAU;IACxBF,IAAIE,SAAS,CAAC,WAAW;IACzBD;AACF;AAEA,SAASR,4BACPd,WAA6C,EAC7CC,OAA+B;IAE/B,OAAO,OAAOmB,MAAMC;QAClBA,IAAIE,SAAS,CAAC,+BAA+BC,UAAUxB,YAAYyB,WAAW;QAC9EJ,IAAIK,YAAY;QAChB,MAAMzB,QAAQ0B,eAAe,GAAGC,KAAK;QACrCP,IAAIQ,GAAG,CAAC;IACV;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AC,OAAON,mBAAI,CAACO,GAAG,GAAG;YAC1D,OAAOjB;QACT,OAAO;YACL,OAAO;QACT;IACF,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
|
|
@@ -231,6 +231,7 @@ async function loadMetroConfigAsync(projectRoot, options, { exp, isExporting, ge
|
|
|
231
231
|
config,
|
|
232
232
|
exp,
|
|
233
233
|
platformBundlers,
|
|
234
|
+
serverRoot,
|
|
234
235
|
isTsconfigPathsEnabled: ((_exp_experiments5 = exp.experiments) == null ? void 0 : _exp_experiments5.tsconfigPaths) ?? true,
|
|
235
236
|
isAutolinkingResolverEnabled: autolinkingModuleResolutionEnabled,
|
|
236
237
|
isExporting,
|