@expo/cli 55.0.3 → 55.0.5
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/src/api/graphql/client.js +133 -68
- package/build/src/api/graphql/client.js.map +1 -1
- package/build/src/api/graphql/queries/AppQuery.js +21 -25
- package/build/src/api/graphql/queries/AppQuery.js.map +1 -1
- package/build/src/api/graphql/queries/UserQuery.js +45 -38
- package/build/src/api/graphql/queries/UserQuery.js.map +1 -1
- package/build/src/api/rest/cache/FileSystemResponseCache.js.map +1 -1
- package/build/src/api/rest/cache/ResponseCache.js.map +1 -1
- package/build/src/api/rest/cache/wrapFetchWithCache.js +7 -7
- package/build/src/api/rest/cache/wrapFetchWithCache.js.map +1 -1
- package/build/src/api/rest/client.js +3 -7
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithProgress.js +1 -8
- package/build/src/api/rest/wrapFetchWithProgress.js.map +1 -1
- package/build/src/api/user/user.js +6 -36
- package/build/src/api/user/user.js.map +1 -1
- package/build/src/prebuild/renameTemplateAppName.js +2 -6
- package/build/src/prebuild/renameTemplateAppName.js.map +1 -1
- package/build/src/prebuild/resolveLocalTemplate.js +2 -4
- package/build/src/prebuild/resolveLocalTemplate.js.map +1 -1
- package/build/src/prebuild/resolveTemplate.js +13 -17
- package/build/src/prebuild/resolveTemplate.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +4 -6
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js +2 -8
- package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
- package/build/src/start/server/metro/DevToolsPluginWebsocketEndpoint.js +1 -9
- package/build/src/start/server/metro/DevToolsPluginWebsocketEndpoint.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +13 -8
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +4 -14
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js +17 -0
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js +1 -13
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +1 -3
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +47 -34
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +27 -4
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +2 -62
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/utils/build-cache-providers/index.js +1 -1
- package/build/src/utils/build-cache-providers/index.js.map +1 -1
- package/build/src/utils/codesigning.js +3 -17
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/createFileTransform.js +3 -38
- package/build/src/utils/createFileTransform.js.map +1 -1
- package/build/src/utils/downloadAppAsync.js +1 -12
- package/build/src/utils/downloadAppAsync.js.map +1 -1
- package/build/src/utils/fetch.js +23 -4
- package/build/src/utils/fetch.js.map +1 -1
- package/build/src/utils/freeport.js +21 -5
- package/build/src/utils/freeport.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +2 -15
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/npm.js +60 -65
- package/build/src/utils/npm.js.map +1 -1
- package/build/src/utils/port.js +4 -4
- package/build/src/utils/port.js.map +1 -1
- package/build/src/utils/resolveGlobal.js +195 -0
- package/build/src/utils/resolveGlobal.js.map +1 -0
- package/build/src/utils/tar.js +138 -69
- package/build/src/utils/tar.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +12 -24
- package/build/src/utils/telemetry/clients/FetchClient.js.map +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +18 -28
- package/build/src/api/graphql/types/App.js +0 -29
- package/build/src/api/graphql/types/App.js.map +0 -1
- package/build/src/api/rest/wrapFetchWithProxy.js +0 -31
- package/build/src/api/rest/wrapFetchWithProxy.js.map +0 -1
- package/build/src/graphql/generated.js +0 -1196
- package/build/src/graphql/generated.js.map +0 -1
- package/build/src/start/server/middleware/createBuiltinAPIRequestHandler.js +0 -85
- package/build/src/start/server/middleware/createBuiltinAPIRequestHandler.js.map +0 -1
- package/build/src/utils/multipartMixed.js +0 -56
- package/build/src/utils/multipartMixed.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/ngrok/ExternalModule.ts"],"sourcesContent":["import * as PackageManager from '@expo/package-manager';\nimport requireGlobal from 'requireg';\nimport resolveFrom from 'resolve-from';\nimport semver from 'semver';\n\nimport * as Log from '../../../log';\nimport { delayAsync } from '../../../utils/delay';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { confirmAsync } from '../../../utils/prompts';\n\nconst debug = require('debug')('expo:doctor:externalModule') as typeof console.log;\n\n/** An error that is thrown when a package is installed but doesn't meet the version criteria. */\nexport class ExternalModuleVersionError extends CommandError {\n constructor(\n message: string,\n public readonly shouldGloballyInstall: boolean\n ) {\n super('EXTERNAL_MODULE_VERSION', message);\n }\n}\n\ninterface PromptOptions {\n /** Should prompt the user to install, when false the module will just assert on missing packages, default `true`. Ignored when `autoInstall` is true. */\n shouldPrompt?: boolean;\n /** Should automatically install the package without prompting, default `false` */\n autoInstall?: boolean;\n}\n\nexport interface InstallPromptOptions extends PromptOptions {\n /** Should install the package globally, default `false` */\n shouldGloballyInstall?: boolean;\n}\n\nexport interface ResolvePromptOptions extends PromptOptions {\n /**\n * Prefer to install the package globally, this can be overridden if the function\n * detects that a locally installed package simply needs an upgrade, default `false`\n */\n prefersGlobalInstall?: boolean;\n}\n\n/** Resolves a local or globally installed package, prompts to install if missing. */\nexport class ExternalModule<TModule> {\n private instance: TModule | null = null;\n\n constructor(\n /** Project root for checking if the package is installed locally. */\n private projectRoot: string,\n /** Info on the external package. */\n private pkg: {\n /** NPM package name. */\n name: string;\n /** Required semver range, ex: `^1.0.0`. */\n versionRange: string;\n },\n /** A function used to create the installation prompt message. */\n private promptMessage: (pkgName: string) => string\n ) {}\n\n /** Resolve the globally or locally installed instance, or prompt to install. */\n async resolveAsync({\n prefersGlobalInstall,\n ...options\n }: ResolvePromptOptions = {}): Promise<TModule> {\n try {\n return (\n this.getVersioned() ??\n this.installAsync({\n ...options,\n shouldGloballyInstall: prefersGlobalInstall,\n })\n );\n } catch (error: any) {\n if (error instanceof ExternalModuleVersionError) {\n // If the module version in not compliant with the version range,\n // we should prompt the user to install the package where it already exists.\n return this.installAsync({\n ...options,\n shouldGloballyInstall: error.shouldGloballyInstall ?? prefersGlobalInstall,\n });\n }\n throw error;\n }\n }\n\n /** Prompt the user to install the package and try again. */\n async installAsync({\n shouldPrompt = true,\n autoInstall,\n shouldGloballyInstall,\n }: InstallPromptOptions = {}): Promise<TModule> {\n const packageName = [this.pkg.name, this.pkg.versionRange].join('@');\n if (!autoInstall) {\n // Delay the prompt so it doesn't conflict with other dev tool logs\n await delayAsync(100);\n }\n const answer =\n autoInstall ||\n (shouldPrompt &&\n (await confirmAsync({\n message: this.promptMessage(packageName),\n initial: true,\n })));\n if (answer) {\n Log.log(`Installing ${packageName}...`);\n\n // Always use npm for global installs\n const packageManager = shouldGloballyInstall\n ? new PackageManager.NpmPackageManager({\n cwd: this.projectRoot,\n log: Log.log,\n silent: !(env.EXPO_DEBUG || env.CI),\n })\n : PackageManager.createForProject(this.projectRoot, {\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n\n try {\n if (shouldGloballyInstall) {\n await packageManager.addGlobalAsync([packageName]);\n } else {\n await packageManager.addDevAsync([packageName]);\n }\n Log.log(`Installed ${packageName}`);\n } catch (error: any) {\n error.message = `Failed to install ${packageName} ${\n shouldGloballyInstall ? 'globally' : 'locally'\n }: ${error.message}`;\n throw error;\n }\n return await this.resolveAsync({ shouldPrompt: false });\n }\n\n throw new CommandError('EXTERNAL_MODULE_AVAILABILITY', `Install ${packageName} and try again`);\n }\n\n /** Get the module. */\n get(): TModule | null {\n try {\n return this.getVersioned();\n } catch {\n return null;\n }\n }\n\n /** Get the module, throws if the module is not versioned correctly. */\n getVersioned(): TModule | null {\n this.instance ??= this._resolveModule(true) ?? this._resolveModule(false);\n return this.instance;\n }\n\n /** Exposed for testing. */\n _require(moduleId: string): any {\n return require(moduleId);\n }\n\n /** Resolve a copy that's installed in the project. Exposed for testing. */\n _resolveLocal(moduleId: string): string {\n return resolveFrom(this.projectRoot, moduleId);\n }\n\n /** Resolve a copy that's installed globally. Exposed for testing. */\n _resolveGlobal(moduleId: string): string {\n return requireGlobal.resolve(moduleId);\n }\n\n /** Resolve the module and verify the version. Exposed for testing. */\n _resolveModule(isLocal: boolean): TModule | null {\n const resolver = isLocal ? this._resolveLocal.bind(this) : this._resolveGlobal.bind(this);\n try {\n const packageJsonPath = resolver(`${this.pkg.name}/package.json`);\n const packageJson = this._require(packageJsonPath);\n if (packageJson) {\n if (semver.satisfies(packageJson.version, this.pkg.versionRange)) {\n const modulePath = resolver(this.pkg.name);\n const requiredModule = this._require(modulePath);\n if (requiredModule == null) {\n throw new CommandError(\n 'EXTERNAL_MODULE_EXPORT',\n `${this.pkg.name} exports a nullish value, which is not allowed.`\n );\n }\n return requiredModule;\n }\n throw new ExternalModuleVersionError(\n `Required module '${this.pkg.name}@${packageJson.version}' does not satisfy ${this.pkg.versionRange}. Installed at: ${packageJsonPath}`,\n !isLocal\n );\n }\n } catch (error: any) {\n if (error instanceof CommandError) {\n throw error;\n } else if (error.code !== 'MODULE_NOT_FOUND') {\n debug('Failed to resolve module', error.message);\n }\n }\n return null;\n }\n}\n"],"names":["ExternalModule","ExternalModuleVersionError","debug","require","CommandError","constructor","message","shouldGloballyInstall","projectRoot","pkg","promptMessage","instance","resolveAsync","prefersGlobalInstall","options","getVersioned","installAsync","error","shouldPrompt","autoInstall","packageName","name","versionRange","join","delayAsync","answer","confirmAsync","initial","Log","log","packageManager","PackageManager","NpmPackageManager","cwd","silent","env","EXPO_DEBUG","CI","createForProject","addGlobalAsync","addDevAsync","get","_resolveModule","_require","moduleId","_resolveLocal","resolveFrom","_resolveGlobal","requireGlobal","resolve","isLocal","resolver","bind","packageJsonPath","packageJson","semver","satisfies","version","modulePath","requiredModule","code"],"mappings":";;;;;;;;;;;IA4CaA,cAAc;eAAdA;;IA9BAC,0BAA0B;eAA1BA;;;;iEAdmB;;;;;;;gEACN;;;;;;;gEACF;;;;;;;gEACL;;;;;;6DAEE;uBACM;qBACP;wBACS;yBACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,MAAMF,mCAAmCG,oBAAY;IAC1DC,YACEC,OAAe,EACf,AAAgBC,qBAA8B,CAC9C;QACA,KAAK,CAAC,2BAA2BD,eAFjBC,wBAAAA;IAGlB;AACF;AAuBO,MAAMP;IAGXK,YACE,mEAAmE,GACnE,AAAQG,WAAmB,EAC3B,kCAAkC,GAClC,AAAQC,GAKP,EACD,+DAA+D,GAC/D,AAAQC,aAA0C,CAClD;aAVQF,cAAAA;aAEAC,MAAAA;aAOAC,gBAAAA;aAbFC,WAA2B;IAchC;IAEH,8EAA8E,GAC9E,MAAMC,aAAa,EACjBC,oBAAoB,EACpB,GAAGC,SACkB,GAAG,CAAC,CAAC,EAAoB;QAC9C,IAAI;YACF,OACE,IAAI,CAACC,YAAY,MACjB,IAAI,CAACC,YAAY,CAAC;gBAChB,GAAGF,OAAO;gBACVP,uBAAuBM;YACzB;QAEJ,EAAE,OAAOI,OAAY;YACnB,IAAIA,iBAAiBhB,4BAA4B;gBAC/C,iEAAiE;gBACjE,4EAA4E;gBAC5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IAAI,CAAChD,GAAG,CAACa,YAAY,GAAG;oBAChE,MAAMoC,aAAaP,SAAS,IAAI,CAAC1C,GAAG,CAACY,IAAI;oBACzC,MAAMsC,iBAAiB,IAAI,CAAChB,QAAQ,CAACe;oBACrC,IAAIC,kBAAkB,MAAM;wBAC1B,MAAM,IAAIvD,oBAAY,CACpB,0BACA,GAAG,IAAI,CAACK,GAAG,CAACY,IAAI,CAAC,+CAA+C,CAAC;oBAErE;oBACA,OAAOsC;gBACT;gBACA,MAAM,IAAI1D,2BACR,CAAC,iBAAiB,EAAE,IAAI,CAACQ,GAAG,CAACY,IAAI,CAAC,CAAC,EAAEiC,YAAYG,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAChD,GAAG,CAACa,YAAY,CAAC,gBAAgB,EAAE+B,iBAAiB,EACvI,CAACH;YAEL;QACF,EAAE,OAAOjC,OAAY;YACnB,IAAIA,iBAAiBb,oBAAY,EAAE;gBACjC,MAAMa;YACR,OAAO,IAAIA,MAAM2C,IAAI,KAAK,oBAAoB;gBAC5C1D,MAAM,4BAA4Be,MAAMX,OAAO;YACjD;QACF;QACA,OAAO;IACT;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/ngrok/ExternalModule.ts"],"sourcesContent":["import * as PackageManager from '@expo/package-manager';\nimport resolveFrom from 'resolve-from';\nimport semver from 'semver';\n\nimport * as Log from '../../../log';\nimport { delayAsync } from '../../../utils/delay';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { confirmAsync } from '../../../utils/prompts';\nimport { resolveGlobal } from '../../../utils/resolveGlobal';\n\nconst debug = require('debug')('expo:doctor:externalModule') as typeof console.log;\n\n/** An error that is thrown when a package is installed but doesn't meet the version criteria. */\nexport class ExternalModuleVersionError extends CommandError {\n constructor(\n message: string,\n public readonly shouldGloballyInstall: boolean\n ) {\n super('EXTERNAL_MODULE_VERSION', message);\n }\n}\n\ninterface PromptOptions {\n /** Should prompt the user to install, when false the module will just assert on missing packages, default `true`. Ignored when `autoInstall` is true. */\n shouldPrompt?: boolean;\n /** Should automatically install the package without prompting, default `false` */\n autoInstall?: boolean;\n}\n\nexport interface InstallPromptOptions extends PromptOptions {\n /** Should install the package globally, default `false` */\n shouldGloballyInstall?: boolean;\n}\n\nexport interface ResolvePromptOptions extends PromptOptions {\n /**\n * Prefer to install the package globally, this can be overridden if the function\n * detects that a locally installed package simply needs an upgrade, default `false`\n */\n prefersGlobalInstall?: boolean;\n}\n\n/** Resolves a local or globally installed package, prompts to install if missing. */\nexport class ExternalModule<TModule> {\n private instance: TModule | null = null;\n\n constructor(\n /** Project root for checking if the package is installed locally. */\n private projectRoot: string,\n /** Info on the external package. */\n private pkg: {\n /** NPM package name. */\n name: string;\n /** Required semver range, ex: `^1.0.0`. */\n versionRange: string;\n },\n /** A function used to create the installation prompt message. */\n private promptMessage: (pkgName: string) => string\n ) {}\n\n /** Resolve the globally or locally installed instance, or prompt to install. */\n async resolveAsync({\n prefersGlobalInstall,\n ...options\n }: ResolvePromptOptions = {}): Promise<TModule> {\n try {\n return (\n this.getVersioned() ??\n this.installAsync({\n ...options,\n shouldGloballyInstall: prefersGlobalInstall,\n })\n );\n } catch (error: any) {\n if (error instanceof ExternalModuleVersionError) {\n // If the module version in not compliant with the version range,\n // we should prompt the user to install the package where it already exists.\n return this.installAsync({\n ...options,\n shouldGloballyInstall: error.shouldGloballyInstall ?? prefersGlobalInstall,\n });\n }\n throw error;\n }\n }\n\n /** Prompt the user to install the package and try again. */\n async installAsync({\n shouldPrompt = true,\n autoInstall,\n shouldGloballyInstall,\n }: InstallPromptOptions = {}): Promise<TModule> {\n const packageName = [this.pkg.name, this.pkg.versionRange].join('@');\n if (!autoInstall) {\n // Delay the prompt so it doesn't conflict with other dev tool logs\n await delayAsync(100);\n }\n const answer =\n autoInstall ||\n (shouldPrompt &&\n (await confirmAsync({\n message: this.promptMessage(packageName),\n initial: true,\n })));\n if (answer) {\n Log.log(`Installing ${packageName}...`);\n\n // Always use npm for global installs\n const packageManager = shouldGloballyInstall\n ? new PackageManager.NpmPackageManager({\n cwd: this.projectRoot,\n log: Log.log,\n silent: !(env.EXPO_DEBUG || env.CI),\n })\n : PackageManager.createForProject(this.projectRoot, {\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n\n try {\n if (shouldGloballyInstall) {\n await packageManager.addGlobalAsync([packageName]);\n } else {\n await packageManager.addDevAsync([packageName]);\n }\n Log.log(`Installed ${packageName}`);\n } catch (error: any) {\n error.message = `Failed to install ${packageName} ${\n shouldGloballyInstall ? 'globally' : 'locally'\n }: ${error.message}`;\n throw error;\n }\n return await this.resolveAsync({ shouldPrompt: false });\n }\n\n throw new CommandError('EXTERNAL_MODULE_AVAILABILITY', `Install ${packageName} and try again`);\n }\n\n /** Get the module. */\n get(): TModule | null {\n try {\n return this.getVersioned();\n } catch {\n return null;\n }\n }\n\n /** Get the module, throws if the module is not versioned correctly. */\n getVersioned(): TModule | null {\n this.instance ??= this._resolveModule(true) ?? this._resolveModule(false);\n return this.instance;\n }\n\n /** Exposed for testing. */\n _require(moduleId: string): any {\n return require(moduleId);\n }\n\n /** Resolve a copy that's installed in the project. Exposed for testing. */\n _resolveLocal(moduleId: string): string {\n return resolveFrom(this.projectRoot, moduleId);\n }\n\n /** Resolve a copy that's installed globally. Exposed for testing. */\n _resolveGlobal(moduleId: string): string {\n return resolveGlobal(moduleId);\n }\n\n /** Resolve the module and verify the version. Exposed for testing. */\n _resolveModule(isLocal: boolean): TModule | null {\n const resolver = isLocal ? this._resolveLocal.bind(this) : this._resolveGlobal.bind(this);\n try {\n const packageJsonPath = resolver(`${this.pkg.name}/package.json`);\n const packageJson = this._require(packageJsonPath);\n if (packageJson) {\n if (semver.satisfies(packageJson.version, this.pkg.versionRange)) {\n const modulePath = resolver(this.pkg.name);\n const requiredModule = this._require(modulePath);\n if (requiredModule == null) {\n throw new CommandError(\n 'EXTERNAL_MODULE_EXPORT',\n `${this.pkg.name} exports a nullish value, which is not allowed.`\n );\n }\n return requiredModule;\n }\n throw new ExternalModuleVersionError(\n `Required module '${this.pkg.name}@${packageJson.version}' does not satisfy ${this.pkg.versionRange}. Installed at: ${packageJsonPath}`,\n !isLocal\n );\n }\n } catch (error: any) {\n if (error instanceof CommandError) {\n throw error;\n } else if (error.code !== 'MODULE_NOT_FOUND') {\n debug('Failed to resolve module', error.message);\n }\n }\n return null;\n }\n}\n"],"names":["ExternalModule","ExternalModuleVersionError","debug","require","CommandError","constructor","message","shouldGloballyInstall","projectRoot","pkg","promptMessage","instance","resolveAsync","prefersGlobalInstall","options","getVersioned","installAsync","error","shouldPrompt","autoInstall","packageName","name","versionRange","join","delayAsync","answer","confirmAsync","initial","Log","log","packageManager","PackageManager","NpmPackageManager","cwd","silent","env","EXPO_DEBUG","CI","createForProject","addGlobalAsync","addDevAsync","get","_resolveModule","_require","moduleId","_resolveLocal","resolveFrom","_resolveGlobal","resolveGlobal","isLocal","resolver","bind","packageJsonPath","packageJson","semver","satisfies","version","modulePath","requiredModule","code"],"mappings":";;;;;;;;;;;IA4CaA,cAAc;eAAdA;;IA9BAC,0BAA0B;eAA1BA;;;;iEAdmB;;;;;;;gEACR;;;;;;;gEACL;;;;;;6DAEE;uBACM;qBACP;wBACS;yBACA;+BACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9B,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,MAAMF,mCAAmCG,oBAAY;IAC1DC,YACEC,OAAe,EACf,AAAgBC,qBAA8B,CAC9C;QACA,KAAK,CAAC,2BAA2BD,eAFjBC,wBAAAA;IAGlB;AACF;AAuBO,MAAMP;IAGXK,YACE,mEAAmE,GACnE,AAAQG,WAAmB,EAC3B,kCAAkC,GAClC,AAAQC,GAKP,EACD,+DAA+D,GAC/D,AAAQC,aAA0C,CAClD;aAVQF,cAAAA;aAEAC,MAAAA;aAOAC,gBAAAA;aAbFC,WAA2B;IAchC;IAEH,8EAA8E,GAC9E,MAAMC,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IAAI,IAAI,IAAI,CAACJ,cAAc,CAACI,IAAI,CAAC,IAAI;QACxF,IAAI;YACF,MAAMC,kBAAkBF,SAAS,GAAG,IAAI,CAACzC,GAAG,CAACY,IAAI,CAAC,aAAa,CAAC;YAChE,MAAMgC,cAAc,IAAI,CAACV,QAAQ,CAACS;YAClC,IAAIC,aAAa;gBACf,IAAIC,iBAAM,CAACC,SAAS,CAACF,YAAYG,OAAO,EAAE,IAAI,CAAC/C,GAAG,CAACa,YAAY,GAAG;oBAChE,MAAMmC,aAAaP,SAAS,IAAI,CAACzC,GAAG,CAACY,IAAI;oBACzC,MAAMqC,iBAAiB,IAAI,CAACf,QAAQ,CAACc;oBACrC,IAAIC,kBAAkB,MAAM;wBAC1B,MAAM,IAAItD,oBAAY,CACpB,0BACA,GAAG,IAAI,CAACK,GAAG,CAACY,IAAI,CAAC,+CAA+C,CAAC;oBAErE;oBACA,OAAOqC;gBACT;gBACA,MAAM,IAAIzD,2BACR,CAAC,iBAAiB,EAAE,IAAI,CAACQ,GAAG,CAACY,IAAI,CAAC,CAAC,EAAEgC,YAAYG,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC/C,GAAG,CAACa,YAAY,CAAC,gBAAgB,EAAE8B,iBAAiB,EACvI,CAACH;YAEL;QACF,EAAE,OAAOhC,OAAY;YACnB,IAAIA,iBAAiBb,oBAAY,EAAE;gBACjC,MAAMa;YACR,OAAO,IAAIA,MAAM0C,IAAI,KAAK,oBAAoB;gBAC5CzD,MAAM,4BAA4Be,MAAMX,OAAO;YACjD;QACF;QACA,OAAO;IACT;AACF"}
|
|
@@ -15,19 +15,11 @@ function _ws() {
|
|
|
15
15
|
};
|
|
16
16
|
return data;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
function createDevToolsPluginWebsocketEndpoint({ serverBaseUrl }) {
|
|
18
|
+
function createDevToolsPluginWebsocketEndpoint() {
|
|
20
19
|
const wss = new (_ws()).WebSocketServer({
|
|
21
20
|
noServer: true
|
|
22
21
|
});
|
|
23
22
|
wss.on('connection', (ws, request)=>{
|
|
24
|
-
// Explicitly limit devtools websocket to loopback requests
|
|
25
|
-
if (!(0, _net.isLocalSocket)(request.socket) || !(0, _net.isMatchingOrigin)(request, serverBaseUrl)) {
|
|
26
|
-
// NOTE: `socket.close` nicely closes the websocket, which will still allow incoming messages
|
|
27
|
-
// `socket.terminate` instead forcefully closes down the socket
|
|
28
|
-
ws.terminate();
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
23
|
ws.on('message', (message, isBinary)=>{
|
|
32
24
|
// Broadcast the received message to all other connected clients
|
|
33
25
|
wss.clients.forEach((client)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/DevToolsPluginWebsocketEndpoint.ts"],"sourcesContent":["import { WebSocket, WebSocketServer } from 'ws';\n\
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/DevToolsPluginWebsocketEndpoint.ts"],"sourcesContent":["import { WebSocket, WebSocketServer } from 'ws';\n\nexport function createDevToolsPluginWebsocketEndpoint(): Record<string, WebSocketServer> {\n const wss = new WebSocketServer({ noServer: true });\n\n wss.on('connection', (ws, request) => {\n ws.on('message', (message, isBinary) => {\n // Broadcast the received message to all other connected clients\n wss.clients.forEach((client) => {\n if (client !== ws && client.readyState === WebSocket.OPEN) {\n client.send(message, { binary: isBinary });\n }\n });\n });\n });\n\n return { '/expo-dev-plugins/broadcast': wss };\n}\n"],"names":["createDevToolsPluginWebsocketEndpoint","wss","WebSocketServer","noServer","on","ws","request","message","isBinary","clients","forEach","client","readyState","WebSocket","OPEN","send","binary"],"mappings":";;;;+BAEgBA;;;eAAAA;;;;yBAF2B;;;;;;AAEpC,SAASA;IACd,MAAMC,MAAM,IAAIC,CAAAA,KAAc,iBAAC,CAAC;QAAEC,UAAU;IAAK;IAEjDF,IAAIG,EAAE,CAAC,cAAc,CAACC,IAAIC;QACxBD,GAAGD,EAAE,CAAC,WAAW,CAACG,SAASC;YACzB,gEAAgE;YAChEP,IAAIQ,OAAO,CAACC,OAAO,CAAC,CAACC;gBACnB,IAAIA,WAAWN,MAAMM,OAAOC,UAAU,KAAKC,eAAS,CAACC,IAAI,EAAE;oBACzDH,OAAOI,IAAI,CAACR,SAAS;wBAAES,QAAQR;oBAAS;gBAC1C;YACF;QACF;IACF;IAEA,OAAO;QAAE,+BAA+BP;IAAI;AAC9C"}
|
|
@@ -287,7 +287,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
|
|
|
287
287
|
/**
|
|
288
288
|
* Bundle render module for use in SSR
|
|
289
289
|
*/ async exportExpoRouterRenderModuleAsync({ files, includeSourceMaps, platform = 'web' }) {
|
|
290
|
-
const renderModule = await this.ssrLoadModuleContents('@expo/router-server/node/render.js', {
|
|
290
|
+
const renderModule = await this.ssrLoadModuleContents(require.resolve('@expo/router-server/node/render.js'), {
|
|
291
291
|
environment: 'node',
|
|
292
292
|
platform
|
|
293
293
|
});
|
|
@@ -347,7 +347,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
|
|
|
347
347
|
var _exp_extra, _exp_extra1;
|
|
348
348
|
const { exp } = (0, _config().getConfig)(this.projectRoot);
|
|
349
349
|
// NOTE: This could probably be folded back into `renderStaticContent` when expo-asset and font support RSC.
|
|
350
|
-
const { getBuildTimeServerManifestAsync, getManifest } = await this.ssrLoadModule('@expo/router-server/build/static/getServerManifest.js', {
|
|
350
|
+
const { getBuildTimeServerManifestAsync, getManifest } = await this.ssrLoadModule(require.resolve('@expo/router-server/build/static/getServerManifest.js'), {
|
|
351
351
|
// Only use react-server environment when the routes are using react-server rendering by default.
|
|
352
352
|
environment: this.isReactServerRoutesEnabled ? 'react-server' : 'node'
|
|
353
353
|
});
|
|
@@ -368,7 +368,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
|
|
|
368
368
|
(0, _assert().default)(routerRoot != null, 'The server must be started before calling getStaticRenderFunctionAsync.');
|
|
369
369
|
const appDir = _path().default.join(this.projectRoot, routerRoot);
|
|
370
370
|
const url = this.getDevServerUrlOrAssert();
|
|
371
|
-
const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } = await this.ssrLoadModule('@expo/router-server/node/render.js', {
|
|
371
|
+
const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } = await this.ssrLoadModule(require.resolve('@expo/router-server/node/render.js'), {
|
|
372
372
|
// This must always use the legacy rendering resolution (no `react-server`) because it leverages
|
|
373
373
|
// the previous React SSG utilities which aren't available in React 19.
|
|
374
374
|
environment: 'node'
|
|
@@ -456,7 +456,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
|
|
|
456
456
|
});
|
|
457
457
|
const bundleStaticHtml = async ()=>{
|
|
458
458
|
var _exp_extra_router, _exp_extra;
|
|
459
|
-
const { getStaticContent } = await this.ssrLoadModule('@expo/router-server/node/render.js', {
|
|
459
|
+
const { getStaticContent } = await this.ssrLoadModule(require.resolve('@expo/router-server/node/render.js'), {
|
|
460
460
|
// This must always use the legacy rendering resolution (no `react-server`) because it leverages
|
|
461
461
|
// the previous React SSG utilities which aren't available in React 19.
|
|
462
462
|
environment: 'node',
|
|
@@ -961,13 +961,14 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
|
|
|
961
961
|
routerOptions
|
|
962
962
|
});
|
|
963
963
|
this.rscRenderer = rscMiddleware;
|
|
964
|
-
middleware.use(rscMiddleware.middleware);
|
|
965
964
|
this.onReloadRscEvent = rscMiddleware.onReloadRscEvent;
|
|
966
965
|
}
|
|
967
966
|
// Append support for redirecting unhandled requests to the index.html page on web.
|
|
968
967
|
if (this.isTargetingWeb()) {
|
|
969
|
-
|
|
970
|
-
|
|
968
|
+
// Use `createRouteHandlerMiddleware()` when either of the following is true:
|
|
969
|
+
// - Server rendering is enabled (server/static output)
|
|
970
|
+
// - RSC is enabled. Even in `single` output mode, RSC needs the route handler
|
|
971
|
+
if (!useServerRendering && !isReactServerComponentsEnabled) {
|
|
971
972
|
middleware.use(new _HistoryFallbackMiddleware.HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler());
|
|
972
973
|
} else {
|
|
973
974
|
var _config_exp_extra;
|
|
@@ -1003,7 +1004,11 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
|
|
|
1003
1004
|
}
|
|
1004
1005
|
// Non-RSC apps will bundle the static HTML for a given pathname and respond with it.
|
|
1005
1006
|
return this.getStaticPageAsync(pathname, route, request);
|
|
1006
|
-
}
|
|
1007
|
+
},
|
|
1008
|
+
rsc: isReactServerComponentsEnabled ? {
|
|
1009
|
+
path: '/_flight',
|
|
1010
|
+
handler: this.rscRenderer.handler
|
|
1011
|
+
} : undefined
|
|
1007
1012
|
}));
|
|
1008
1013
|
}
|
|
1009
1014
|
}
|