@expo/cli 55.0.4 → 55.0.6
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/platforms/android/AndroidSdk.js +15 -6
- package/build/src/start/platforms/android/AndroidSdk.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 +10 -4
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +2 -12
- 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/instantiateMetro.js +2 -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 -59
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +2 -1
- package/build/src/start/server/webpack/WebpackBundlerDevServer.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/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/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 +16 -26
- 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;gBAC5E,OAAO,IAAI,CAACe,YAAY,CAAC;oBACvB,GAAGF,OAAO;oBACVP,uBAAuBU,MAAMV,qBAAqB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G,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,aAAa,EACjBC,oBAAoB,EACpB,GAAGC,SACkB,GAAG,CAAC,CAAC,EAAoB;QAC9C,IAAI;YACF,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kBF,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"}
|
|
@@ -47,9 +47,13 @@ function _interop_require_default(obj) {
|
|
|
47
47
|
* @see https://developer.android.com/studio/intro/studio-config#optimize-studio-windows
|
|
48
48
|
*/ const ANDROID_DEFAULT_LOCATION = {
|
|
49
49
|
darwin: _path().default.join(_os().default.homedir(), 'Library', 'Android', 'sdk'),
|
|
50
|
-
linux:
|
|
50
|
+
linux: [
|
|
51
|
+
_path().default.join(_os().default.homedir(), 'Android', 'Sdk'),
|
|
52
|
+
_path().default.join(_os().default.homedir(), 'Android', 'sdk')
|
|
53
|
+
],
|
|
51
54
|
win32: _path().default.join(_os().default.homedir(), 'AppData', 'Local', 'Android', 'Sdk')
|
|
52
55
|
};
|
|
56
|
+
const isAndroidDefaultLocationKey = (platform)=>ANDROID_DEFAULT_LOCATION[platform] != null;
|
|
53
57
|
function assertSdkRoot() {
|
|
54
58
|
if (process.env.ANDROID_HOME) {
|
|
55
59
|
(0, _assert().default)(_fs().default.existsSync(process.env.ANDROID_HOME), `Failed to resolve the Android SDK path. ANDROID_HOME is set to a non-existing path: ${process.env.ANDROID_HOME}`);
|
|
@@ -59,12 +63,17 @@ function assertSdkRoot() {
|
|
|
59
63
|
(0, _assert().default)(_fs().default.existsSync(process.env.ANDROID_SDK_ROOT), `Failed to resolve the Android SDK path. Deprecated ANDROID_SDK_ROOT is set to a non-existing path: ${process.env.ANDROID_SDK_ROOT}. Use ANDROID_HOME instead.`);
|
|
60
64
|
return process.env.ANDROID_SDK_ROOT;
|
|
61
65
|
}
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
return defaultLocation;
|
|
66
|
+
const platform = process.platform;
|
|
67
|
+
if (!isAndroidDefaultLocationKey(platform)) {
|
|
68
|
+
return null;
|
|
66
69
|
}
|
|
67
|
-
|
|
70
|
+
const defaultLocation = ANDROID_DEFAULT_LOCATION[platform];
|
|
71
|
+
const locations = !Array.isArray(defaultLocation) ? [
|
|
72
|
+
defaultLocation
|
|
73
|
+
] : defaultLocation;
|
|
74
|
+
const resolvedLocation = locations.find((location)=>_fs().default.existsSync(location));
|
|
75
|
+
(0, _assert().default)(!!resolvedLocation, `Failed to resolve the Android SDK path. Default install location not found: ${locations[0]}. Use ANDROID_HOME to set the Android SDK location.`);
|
|
76
|
+
return resolvedLocation;
|
|
68
77
|
}
|
|
69
78
|
|
|
70
79
|
//# sourceMappingURL=AndroidSdk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/android/AndroidSdk.ts"],"sourcesContent":["import assert from 'assert';\nimport fs from 'fs';\nimport os from 'os';\nimport path from 'path';\n\n/**\n * The default Android SDK locations per platform.\n * @see https://developer.android.com/studio/run/emulator-commandline#filedir\n * @see https://developer.android.com/studio/intro/studio-config#optimize-studio-windows\n */\nconst ANDROID_DEFAULT_LOCATION
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/android/AndroidSdk.ts"],"sourcesContent":["import assert from 'assert';\nimport fs from 'fs';\nimport os from 'os';\nimport path from 'path';\n\n/**\n * The default Android SDK locations per platform.\n * @see https://developer.android.com/studio/run/emulator-commandline#filedir\n * @see https://developer.android.com/studio/intro/studio-config#optimize-studio-windows\n */\nconst ANDROID_DEFAULT_LOCATION = {\n darwin: path.join(os.homedir(), 'Library', 'Android', 'sdk'),\n linux: [path.join(os.homedir(), 'Android', 'Sdk'), path.join(os.homedir(), 'Android', 'sdk')],\n win32: path.join(os.homedir(), 'AppData', 'Local', 'Android', 'Sdk'),\n};\n\nconst isAndroidDefaultLocationKey = (\n platform: string\n): platform is keyof typeof ANDROID_DEFAULT_LOCATION =>\n ANDROID_DEFAULT_LOCATION[platform as keyof typeof ANDROID_DEFAULT_LOCATION] != null;\n\n/**\n * Resolve and validate the root folder where the Android SDK has been installed.\n * This checks both `ANDROID_HOME`, `ANDROID_SDK_ROOT`, and the default path for the current platform.\n * @see https://developer.android.com/studio/command-line/variables\n */\nexport function assertSdkRoot(): string | null {\n if (process.env.ANDROID_HOME) {\n assert(\n fs.existsSync(process.env.ANDROID_HOME),\n `Failed to resolve the Android SDK path. ANDROID_HOME is set to a non-existing path: ${process.env.ANDROID_HOME}`\n );\n return process.env.ANDROID_HOME;\n }\n\n if (process.env.ANDROID_SDK_ROOT) {\n assert(\n fs.existsSync(process.env.ANDROID_SDK_ROOT),\n `Failed to resolve the Android SDK path. Deprecated ANDROID_SDK_ROOT is set to a non-existing path: ${process.env.ANDROID_SDK_ROOT}. Use ANDROID_HOME instead.`\n );\n return process.env.ANDROID_SDK_ROOT;\n }\n\n const platform = process.platform;\n if (!isAndroidDefaultLocationKey(platform)) {\n return null;\n }\n\n const defaultLocation = ANDROID_DEFAULT_LOCATION[platform];\n const locations = !Array.isArray(defaultLocation) ? [defaultLocation] : defaultLocation;\n const resolvedLocation = locations.find((location) => fs.existsSync(location));\n assert(\n !!resolvedLocation,\n `Failed to resolve the Android SDK path. Default install location not found: ${locations[0]}. Use ANDROID_HOME to set the Android SDK location.`\n );\n return resolvedLocation;\n}\n"],"names":["assertSdkRoot","ANDROID_DEFAULT_LOCATION","darwin","path","join","os","homedir","linux","win32","isAndroidDefaultLocationKey","platform","process","env","ANDROID_HOME","assert","fs","existsSync","ANDROID_SDK_ROOT","defaultLocation","locations","Array","isArray","resolvedLocation","find","location"],"mappings":";;;;+BA0BgBA;;;eAAAA;;;;gEA1BG;;;;;;;gEACJ;;;;;;;gEACA;;;;;;;gEACE;;;;;;;;;;;AAEjB;;;;CAIC,GACD,MAAMC,2BAA2B;IAC/BC,QAAQC,eAAI,CAACC,IAAI,CAACC,aAAE,CAACC,OAAO,IAAI,WAAW,WAAW;IACtDC,OAAO;QAACJ,eAAI,CAACC,IAAI,CAACC,aAAE,CAACC,OAAO,IAAI,WAAW;QAAQH,eAAI,CAACC,IAAI,CAACC,aAAE,CAACC,OAAO,IAAI,WAAW;KAAO;IAC7FE,OAAOL,eAAI,CAACC,IAAI,CAACC,aAAE,CAACC,OAAO,IAAI,WAAW,SAAS,WAAW;AAChE;AAEA,MAAMG,8BAA8B,CAClCC,WAEAT,wBAAwB,CAACS,SAAkD,IAAI;AAO1E,SAASV;IACd,IAAIW,QAAQC,GAAG,CAACC,YAAY,EAAE;QAC5BC,IAAAA,iBAAM,EACJC,aAAE,CAACC,UAAU,CAACL,QAAQC,GAAG,CAACC,YAAY,GACtC,CAAC,oFAAoF,EAAEF,QAAQC,GAAG,CAACC,YAAY,EAAE;QAEnH,OAAOF,QAAQC,GAAG,CAACC,YAAY;IACjC;IAEA,IAAIF,QAAQC,GAAG,CAACK,gBAAgB,EAAE;QAChCH,IAAAA,iBAAM,EACJC,aAAE,CAACC,UAAU,CAACL,QAAQC,GAAG,CAACK,gBAAgB,GAC1C,CAAC,mGAAmG,EAAEN,QAAQC,GAAG,CAACK,gBAAgB,CAAC,2BAA2B,CAAC;QAEjK,OAAON,QAAQC,GAAG,CAACK,gBAAgB;IACrC;IAEA,MAAMP,WAAWC,QAAQD,QAAQ;IACjC,IAAI,CAACD,4BAA4BC,WAAW;QAC1C,OAAO;IACT;IAEA,MAAMQ,kBAAkBjB,wBAAwB,CAACS,SAAS;IAC1D,MAAMS,YAAY,CAACC,MAAMC,OAAO,CAACH,mBAAmB;QAACA;KAAgB,GAAGA;IACxE,MAAMI,mBAAmBH,UAAUI,IAAI,CAAC,CAACC,WAAaT,aAAE,CAACC,UAAU,CAACQ;IACpEV,IAAAA,iBAAM,EACJ,CAAC,CAACQ,kBACF,CAAC,4EAA4E,EAAEH,SAAS,CAAC,EAAE,CAAC,mDAAmD,CAAC;IAElJ,OAAOG;AACT"}
|
|
@@ -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 (request.headers.origin && !(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"}
|
|
@@ -837,6 +837,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
|
|
|
837
837
|
};
|
|
838
838
|
this.instanceMetroOptions = instanceMetroOptions;
|
|
839
839
|
const parsedOptions = {
|
|
840
|
+
host: options.location.hostType === 'localhost' ? 'localhost' : undefined,
|
|
840
841
|
port: options.port,
|
|
841
842
|
maxWorkers: options.maxWorkers,
|
|
842
843
|
resetCache: options.resetDevServer
|
|
@@ -961,13 +962,14 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
|
|
|
961
962
|
routerOptions
|
|
962
963
|
});
|
|
963
964
|
this.rscRenderer = rscMiddleware;
|
|
964
|
-
middleware.use(rscMiddleware.middleware);
|
|
965
965
|
this.onReloadRscEvent = rscMiddleware.onReloadRscEvent;
|
|
966
966
|
}
|
|
967
967
|
// Append support for redirecting unhandled requests to the index.html page on web.
|
|
968
968
|
if (this.isTargetingWeb()) {
|
|
969
|
-
|
|
970
|
-
|
|
969
|
+
// Use `createRouteHandlerMiddleware()` when either of the following is true:
|
|
970
|
+
// - Server rendering is enabled (server/static output)
|
|
971
|
+
// - RSC is enabled. Even in `single` output mode, RSC needs the route handler
|
|
972
|
+
if (!useServerRendering && !isReactServerComponentsEnabled) {
|
|
971
973
|
middleware.use(new _HistoryFallbackMiddleware.HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler());
|
|
972
974
|
} else {
|
|
973
975
|
var _config_exp_extra;
|
|
@@ -1003,7 +1005,11 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
|
|
|
1003
1005
|
}
|
|
1004
1006
|
// Non-RSC apps will bundle the static HTML for a given pathname and respond with it.
|
|
1005
1007
|
return this.getStaticPageAsync(pathname, route, request);
|
|
1006
|
-
}
|
|
1008
|
+
},
|
|
1009
|
+
rsc: isReactServerComponentsEnabled ? {
|
|
1010
|
+
path: '/_flight',
|
|
1011
|
+
handler: this.rscRenderer.handler
|
|
1012
|
+
} : undefined
|
|
1007
1013
|
}));
|
|
1008
1014
|
}
|
|
1009
1015
|
}
|