@expo/cli 0.7.3 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/README.md +1 -1
  2. package/build/bin/cli +17 -3
  3. package/build/bin/cli.map +1 -1
  4. package/build/src/api/getExpoGoIntermediateCertificate.js +0 -2
  5. package/build/src/api/getExpoGoIntermediateCertificate.js.map +1 -1
  6. package/build/src/api/getProjectDevelopmentCertificate.js +0 -2
  7. package/build/src/api/getProjectDevelopmentCertificate.js.map +1 -1
  8. package/build/src/api/graphql/queries/AppQuery.js +39 -0
  9. package/build/src/api/graphql/queries/AppQuery.js.map +1 -0
  10. package/build/src/api/graphql/queries/UserQuery.js +10 -3
  11. package/build/src/api/graphql/queries/UserQuery.js.map +1 -1
  12. package/build/src/api/graphql/types/App.js +23 -0
  13. package/build/src/api/graphql/types/App.js.map +1 -0
  14. package/build/src/api/signManifest.js +0 -12
  15. package/build/src/api/signManifest.js.map +1 -1
  16. package/build/src/api/user/UserSettings.js.map +1 -1
  17. package/build/src/api/user/user.js.map +1 -1
  18. package/build/src/config/configAsync.js +3 -0
  19. package/build/src/config/configAsync.js.map +1 -1
  20. package/build/src/customize/customizeAsync.js +3 -0
  21. package/build/src/customize/customizeAsync.js.map +1 -1
  22. package/build/src/export/createBundles.js +8 -3
  23. package/build/src/export/createBundles.js.map +1 -1
  24. package/build/src/export/embed/exportEmbedAsync.js +23 -0
  25. package/build/src/export/embed/exportEmbedAsync.js.map +1 -0
  26. package/build/src/export/embed/index.js +117 -0
  27. package/build/src/export/embed/index.js.map +1 -0
  28. package/build/src/export/embed/resolveOptions.js +63 -0
  29. package/build/src/export/embed/resolveOptions.js.map +1 -0
  30. package/build/src/export/exportApp.js +58 -31
  31. package/build/src/export/exportApp.js.map +1 -1
  32. package/build/src/export/exportAssets.js +17 -0
  33. package/build/src/export/exportAssets.js.map +1 -1
  34. package/build/src/export/exportAsync.js +3 -0
  35. package/build/src/export/exportAsync.js.map +1 -1
  36. package/build/src/export/exportStaticAsync.js +179 -0
  37. package/build/src/export/exportStaticAsync.js.map +1 -0
  38. package/build/src/export/fork-bundleAsync.js +15 -43
  39. package/build/src/export/fork-bundleAsync.js.map +1 -1
  40. package/build/src/export/html.js +21 -0
  41. package/build/src/export/html.js.map +1 -0
  42. package/build/src/export/index.js +5 -1
  43. package/build/src/export/index.js.map +1 -1
  44. package/build/src/export/printBundleSizes.js +2 -2
  45. package/build/src/export/printBundleSizes.js.map +1 -1
  46. package/build/src/export/resolveOptions.js +1 -0
  47. package/build/src/export/resolveOptions.js.map +1 -1
  48. package/build/src/export/web/exportWebAsync.js +3 -0
  49. package/build/src/export/web/exportWebAsync.js.map +1 -1
  50. package/build/src/export/writeContents.js +5 -2
  51. package/build/src/export/writeContents.js.map +1 -1
  52. package/build/src/graphql/generated.js +462 -0
  53. package/build/src/graphql/generated.js.map +1 -0
  54. package/build/src/install/checkPackages.js +6 -0
  55. package/build/src/install/checkPackages.js.map +1 -1
  56. package/build/src/install/installAsync.js +18 -1
  57. package/build/src/install/installAsync.js.map +1 -1
  58. package/build/src/prebuild/clearNativeFolder.js +6 -1
  59. package/build/src/prebuild/clearNativeFolder.js.map +1 -1
  60. package/build/src/prebuild/copyTemplateFiles.js +3 -33
  61. package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
  62. package/build/src/prebuild/ensureConfigAsync.js +1 -12
  63. package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
  64. package/build/src/prebuild/prebuildAsync.js +7 -2
  65. package/build/src/prebuild/prebuildAsync.js.map +1 -1
  66. package/build/src/prebuild/resolveOptions.js +7 -8
  67. package/build/src/prebuild/resolveOptions.js.map +1 -1
  68. package/build/src/prebuild/resolveTemplate.js +5 -0
  69. package/build/src/prebuild/resolveTemplate.js.map +1 -1
  70. package/build/src/prebuild/updateFromTemplate.js +6 -8
  71. package/build/src/prebuild/updateFromTemplate.js.map +1 -1
  72. package/build/src/prebuild/updatePackageJson.js +33 -47
  73. package/build/src/prebuild/updatePackageJson.js.map +1 -1
  74. package/build/src/prebuild/validateTemplatePlatforms.js +48 -0
  75. package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -0
  76. package/build/src/run/android/runAndroidAsync.js +4 -0
  77. package/build/src/run/android/runAndroidAsync.js.map +1 -1
  78. package/build/src/run/ios/appleDevice/AppleDevice.js +25 -19
  79. package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
  80. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
  81. package/build/src/run/ios/options/resolveNativeScheme.js +13 -4
  82. package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
  83. package/build/src/run/ios/runIosAsync.js +3 -0
  84. package/build/src/run/ios/runIosAsync.js.map +1 -1
  85. package/build/src/run/startBundler.js +4 -0
  86. package/build/src/run/startBundler.js.map +1 -1
  87. package/build/src/start/doctor/Prerequisite.js.map +1 -1
  88. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +12 -6
  89. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
  90. package/build/src/start/doctor/dependencies/getVersionedPackages.js +13 -2
  91. package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
  92. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +12 -4
  93. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
  94. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +31 -5
  95. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
  96. package/build/src/start/doctor/typescript/updateTSConfig.js +6 -0
  97. package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
  98. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +1 -0
  99. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
  100. package/build/src/start/index.js +3 -1
  101. package/build/src/start/index.js.map +1 -1
  102. package/build/src/start/platforms/android/adb.js +1 -1
  103. package/build/src/start/platforms/android/adb.js.map +1 -1
  104. package/build/src/start/platforms/ios/AppleDeviceManager.js +1 -1
  105. package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
  106. package/build/src/start/server/BundlerDevServer.js +16 -2
  107. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  108. package/build/src/start/server/DevServerManager.js +33 -2
  109. package/build/src/start/server/DevServerManager.js.map +1 -1
  110. package/build/src/start/server/getStaticRenderFunctions.js +167 -0
  111. package/build/src/start/server/getStaticRenderFunctions.js.map +1 -0
  112. package/build/src/start/server/metro/MetroBundlerDevServer.js +262 -3
  113. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  114. package/build/src/start/server/metro/MetroTerminalReporter.js +2 -34
  115. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  116. package/build/src/start/server/metro/externals.js +72 -0
  117. package/build/src/start/server/metro/externals.js.map +1 -0
  118. package/build/src/start/server/metro/getCssModulesFromBundler.js +77 -0
  119. package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -0
  120. package/build/src/start/server/metro/inspector-proxy/index.js +2 -2
  121. package/build/src/start/server/metro/inspector-proxy/index.js.map +1 -1
  122. package/build/src/start/server/metro/inspector-proxy/proxy.js +1 -3
  123. package/build/src/start/server/metro/inspector-proxy/proxy.js.map +1 -1
  124. package/build/src/start/server/metro/instantiateMetro.js +47 -48
  125. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  126. package/build/src/start/server/metro/metroErrorInterface.js +137 -0
  127. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -0
  128. package/build/src/start/server/metro/metroWatchTypeScriptFiles.js +51 -0
  129. package/build/src/start/server/metro/metroWatchTypeScriptFiles.js.map +1 -0
  130. package/build/src/start/server/metro/resolveFromProject.js +26 -3
  131. package/build/src/start/server/metro/resolveFromProject.js.map +1 -1
  132. package/build/src/start/server/metro/router.js +15 -2
  133. package/build/src/start/server/metro/router.js.map +1 -1
  134. package/build/src/start/server/metro/runServer-fork.js +107 -0
  135. package/build/src/start/server/metro/runServer-fork.js.map +1 -0
  136. package/build/src/start/server/metro/symbolicate.js +6 -0
  137. package/build/src/start/server/metro/symbolicate.js.map +1 -0
  138. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +70 -0
  139. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -0
  140. package/build/src/start/server/metro/withMetroMultiPlatform.js +188 -45
  141. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  142. package/build/src/start/server/middleware/ClassicManifestMiddleware.js +8 -1
  143. package/build/src/start/server/middleware/ClassicManifestMiddleware.js.map +1 -1
  144. package/build/src/start/server/middleware/CreateFileMiddleware.js +6 -3
  145. package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
  146. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +113 -47
  147. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
  148. package/build/src/start/server/middleware/ManifestMiddleware.js +59 -20
  149. package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
  150. package/build/src/start/server/type-generation/expo-env.js +27 -0
  151. package/build/src/start/server/type-generation/expo-env.js.map +1 -0
  152. package/build/src/start/server/type-generation/index.js +57 -0
  153. package/build/src/start/server/type-generation/index.js.map +1 -0
  154. package/build/src/start/server/type-generation/routes.js +291 -0
  155. package/build/src/start/server/type-generation/routes.js.map +1 -0
  156. package/build/src/start/server/type-generation/tsconfig.js +89 -0
  157. package/build/src/start/server/type-generation/tsconfig.js.map +1 -0
  158. package/build/src/start/server/webTemplate.js +20 -4
  159. package/build/src/start/server/webTemplate.js.map +1 -1
  160. package/build/src/start/server/webpack/WebpackBundlerDevServer.js +4 -6
  161. package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
  162. package/build/src/start/startAsync.js +30 -8
  163. package/build/src/start/startAsync.js.map +1 -1
  164. package/build/src/utils/FileNotifier.js +11 -4
  165. package/build/src/utils/FileNotifier.js.map +1 -1
  166. package/build/src/utils/analytics/getMetroProperties.js +1 -1
  167. package/build/src/utils/analytics/getMetroProperties.js.map +1 -1
  168. package/build/src/utils/analytics/rudderstackClient.js +2 -2
  169. package/build/src/utils/codesigning.js +31 -7
  170. package/build/src/utils/codesigning.js.map +1 -1
  171. package/build/src/utils/dir.js +16 -6
  172. package/build/src/utils/dir.js.map +1 -1
  173. package/build/src/utils/env.js +6 -0
  174. package/build/src/utils/env.js.map +1 -1
  175. package/build/src/utils/mergeGitIgnorePaths.js +42 -0
  176. package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
  177. package/build/src/utils/nodeEnv.js +11 -0
  178. package/build/src/utils/nodeEnv.js.map +1 -0
  179. package/build/src/utils/resolveArgs.js +43 -0
  180. package/build/src/utils/resolveArgs.js.map +1 -1
  181. package/build/src/utils/strings.js +24 -0
  182. package/build/src/utils/strings.js.map +1 -0
  183. package/build/src/utils/template.js +21 -0
  184. package/build/src/utils/template.js.map +1 -0
  185. package/build/src/utils/tsconfig/evaluateTsConfig.js +61 -0
  186. package/build/src/utils/tsconfig/evaluateTsConfig.js.map +1 -0
  187. package/build/src/utils/tsconfig/loadTsConfigPaths.js +69 -0
  188. package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -0
  189. package/build/src/utils/tsconfig/matchTsConfigPathAlias.js +88 -0
  190. package/build/src/utils/tsconfig/matchTsConfigPathAlias.js.map +1 -0
  191. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +41 -0
  192. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -0
  193. package/package.json +16 -10
  194. package/static/template/metro.config.js +4 -1
  195. package/build/src/api/getProject.js +0 -19
  196. package/build/src/api/getProject.js.map +0 -1
  197. package/build/src/api/graphql/generated.js +0 -113
  198. package/build/src/api/graphql/generated.js.map +0 -1
  199. package/build/src/prebuild/writeMetroConfig.js +0 -89
  200. package/build/src/prebuild/writeMetroConfig.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/webpack/WebpackBundlerDevServer.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { Application } from 'express';\nimport fs from 'fs';\nimport http from 'http';\nimport * as path from 'path';\nimport resolveFrom from 'resolve-from';\nimport type webpack from 'webpack';\nimport type WebpackDevServer from 'webpack-dev-server';\n\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { getIpAddress } from '../../../utils/ip';\nimport { choosePortAsync } from '../../../utils/port';\nimport { createProgressBar } from '../../../utils/progress';\nimport { ensureDotExpoProjectDirectoryInitialized } from '../../project/dotExpo';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport { compileAsync } from './compile';\nimport {\n importExpoWebpackConfigFromProject,\n importWebpackDevServerFromProject,\n importWebpackFromProject,\n} from './resolveFromProject';\nimport { ensureEnvironmentSupportsTLSAsync } from './tls';\n\nconst debug = require('debug')('expo:start:server:webpack:devServer') as typeof console.log;\n\nexport type WebpackConfiguration = webpack.Configuration & {\n devServer?: {\n before?: (app: Application, server: WebpackDevServer, compiler: webpack.Compiler) => void;\n };\n};\n\nfunction assertIsWebpackDevServer(value: any): asserts value is WebpackDevServer {\n if (!value?.sockWrite) {\n throw new CommandError(\n 'WEBPACK',\n value\n ? 'Expected Webpack dev server, found: ' + (value.constructor?.name ?? value)\n : 'Webpack dev server not started yet.'\n );\n }\n}\n\nexport class WebpackBundlerDevServer extends BundlerDevServer {\n get name(): string {\n return 'webpack';\n }\n\n // A custom message websocket broadcaster used to send messages to a React Native runtime.\n private customMessageSocketBroadcaster:\n | undefined\n | ((message: string, data?: Record<string, any>) => void);\n\n public broadcastMessage(\n method: string | 'reload' | 'devMenu' | 'sendDevCommand',\n params?: Record<string, any>\n ): void {\n if (!this.instance) {\n return;\n }\n\n assertIsWebpackDevServer(this.instance?.server);\n\n // Allow any message on native\n if (this.customMessageSocketBroadcaster) {\n this.customMessageSocketBroadcaster(method, params);\n return;\n }\n\n // TODO(EvanBacon): Custom Webpack overlay.\n // Default webpack-dev-server sockets use \"content-changed\" instead of \"reload\" (what we use on native).\n // For now, just manually convert the value so our CLI interface can be unified.\n const hackyConvertedMessage = method === 'reload' ? 'content-changed' : method;\n\n this.instance.server.sockWrite(this.instance.server.sockets, hackyConvertedMessage, params);\n }\n\n private async attachNativeDevServerMiddlewareToDevServer({\n server,\n middleware,\n attachToServer,\n logger,\n }: { server: http.Server } & Awaited<ReturnType<typeof this.createNativeDevServerMiddleware>>) {\n const { attachInspectorProxy, LogReporter } = await import('@expo/dev-server');\n\n // Hook up the React Native WebSockets to the Webpack dev server.\n const { messageSocket, debuggerProxy, eventsSocket } = attachToServer(server);\n\n this.customMessageSocketBroadcaster = messageSocket.broadcast;\n\n const logReporter = new LogReporter(logger);\n logReporter.reportEvent = eventsSocket.reportEvent;\n\n const { inspectorProxy } = attachInspectorProxy(this.projectRoot, {\n middleware,\n server,\n });\n\n return {\n messageSocket,\n eventsSocket,\n debuggerProxy,\n logReporter,\n inspectorProxy,\n };\n }\n\n isTargetingNative(): boolean {\n // Temporary hack while we implement multi-bundler dev server proxy.\n return ['ios', 'android'].includes(process.env.EXPO_WEBPACK_PLATFORM || '');\n }\n\n private async createNativeDevServerMiddleware({\n port,\n options,\n }: {\n port: number;\n options: BundlerStartOptions;\n }) {\n if (!this.isTargetingNative()) {\n return null;\n }\n\n const { createDevServerMiddleware } = await import('../middleware/createDevServerMiddleware');\n\n const nativeMiddleware = createDevServerMiddleware(this.projectRoot, {\n port,\n watchFolders: [this.projectRoot],\n });\n // Add manifest middleware to the other middleware.\n // TODO: Move this in to expo/dev-server.\n\n const middleware = await this.getManifestMiddlewareAsync(options);\n\n nativeMiddleware.middleware.use(middleware);\n\n return nativeMiddleware;\n }\n\n private async getAvailablePortAsync(options: { defaultPort?: number }): Promise<number> {\n try {\n const defaultPort = options?.defaultPort ?? 19006;\n const port = await choosePortAsync(this.projectRoot, {\n defaultPort,\n host: env.WEB_HOST,\n });\n if (!port) {\n throw new CommandError('NO_PORT_FOUND', `Port ${defaultPort} not available.`);\n }\n return port;\n } catch (error: any) {\n throw new CommandError('NO_PORT_FOUND', error.message);\n }\n }\n\n async bundleAsync({ mode, clear }: { mode: 'development' | 'production'; clear: boolean }) {\n // Do this first to fail faster.\n const webpack = importWebpackFromProject(this.projectRoot);\n\n if (clear) {\n await this.clearWebProjectCacheAsync(this.projectRoot, mode);\n }\n\n const config = await this.loadConfigAsync({\n isImageEditingEnabled: true,\n mode,\n });\n\n if (!config.plugins) {\n config.plugins = [];\n }\n\n const bar = createProgressBar(chalk`{bold Web} Bundling Javascript [:bar] :percent`, {\n width: 64,\n total: 100,\n clear: true,\n complete: '=',\n incomplete: ' ',\n });\n\n // NOTE(EvanBacon): Add a progress bar to the webpack logger if defined (e.g. not in CI).\n if (bar != null) {\n config.plugins.push(\n new webpack.ProgressPlugin((percent: number) => {\n bar?.update(percent);\n if (percent === 1) {\n bar?.terminate();\n }\n })\n );\n }\n\n // Create a webpack compiler that is configured with custom messages.\n const compiler = webpack(config);\n\n try {\n await compileAsync(compiler);\n } catch (error: any) {\n Log.error(chalk.red('Failed to compile'));\n throw error;\n } finally {\n bar?.terminate();\n }\n }\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n // Do this first to fail faster.\n const webpack = importWebpackFromProject(this.projectRoot);\n const WebpackDevServer = importWebpackDevServerFromProject(this.projectRoot);\n\n await this.stopAsync();\n\n options.port = await this.getAvailablePortAsync({\n defaultPort: options.port,\n });\n const { resetDevServer, https, port, mode } = options;\n\n this.urlCreator = this.getUrlCreator({\n port,\n location: {\n scheme: https ? 'https' : 'http',\n },\n });\n\n debug('Starting webpack on port: ' + port);\n\n if (resetDevServer) {\n await this.clearWebProjectCacheAsync(this.projectRoot, mode);\n }\n\n if (https) {\n debug('Configuring TLS to enable HTTPS support');\n await ensureEnvironmentSupportsTLSAsync(this.projectRoot).catch((error) => {\n Log.error(`Error creating TLS certificates: ${error}`);\n });\n }\n\n const config = await this.loadConfigAsync(options);\n\n Log.log(chalk`Starting Webpack on port ${port} in {underline ${mode}} mode.`);\n\n // Create a webpack compiler that is configured with custom messages.\n const compiler = webpack(config);\n\n let nativeMiddleware: Awaited<ReturnType<typeof this.createNativeDevServerMiddleware>> | null =\n null;\n if (config.devServer?.before) {\n // Create the middleware required for interacting with a native runtime (Expo Go, or a development build).\n nativeMiddleware = await this.createNativeDevServerMiddleware({\n port,\n options,\n });\n // Inject the native manifest middleware.\n const originalBefore = config.devServer.before.bind(config.devServer.before);\n config.devServer.before = (\n app: Application,\n server: WebpackDevServer,\n compiler: webpack.Compiler\n ) => {\n originalBefore(app, server, compiler);\n\n if (nativeMiddleware?.middleware) {\n app.use(nativeMiddleware.middleware);\n }\n };\n }\n const { attachNativeDevServerMiddlewareToDevServer } = this;\n\n const server = new WebpackDevServer(\n // @ts-expect-error: type mismatch -- Webpack types aren't great.\n compiler,\n config.devServer\n );\n // Launch WebpackDevServer.\n server.listen(port, env.WEB_HOST, function (this: http.Server, error) {\n if (nativeMiddleware) {\n attachNativeDevServerMiddlewareToDevServer({\n server: this,\n ...nativeMiddleware,\n });\n }\n if (error) {\n Log.error(error.message);\n }\n });\n\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n callback?.(err);\n });\n };\n\n const _host = getIpAddress();\n const protocol = https ? 'https' : 'http';\n\n return {\n // Server instance\n server,\n // URL Info\n location: {\n url: `${protocol}://${_host}:${port}`,\n port,\n protocol,\n host: _host,\n },\n middleware: nativeMiddleware?.middleware,\n // Match the native protocol.\n messageSocket: {\n broadcast: this.broadcastMessage,\n },\n };\n }\n\n /** Load the Webpack config. Exposed for testing. */\n getProjectConfigFilePath(): string | null {\n // Check if the project has a webpack.config.js in the root.\n return (\n this.getConfigModuleIds().reduce<string | null | undefined>(\n (prev, moduleId) => prev || resolveFrom.silent(this.projectRoot, moduleId),\n null\n ) ?? null\n );\n }\n\n async loadConfigAsync(\n options: Pick<BundlerStartOptions, 'mode' | 'isImageEditingEnabled' | 'https'>,\n argv?: string[]\n ): Promise<WebpackConfiguration> {\n // let bar: ProgressBar | null = null;\n\n const env = {\n projectRoot: this.projectRoot,\n pwa: !!options.isImageEditingEnabled,\n // TODO: Use a new loader in Webpack config...\n logger: {\n info() {},\n },\n mode: options.mode,\n https: options.https,\n };\n setMode(env.mode ?? 'development');\n // Check if the project has a webpack.config.js in the root.\n const projectWebpackConfig = this.getProjectConfigFilePath();\n let config: WebpackConfiguration;\n if (projectWebpackConfig) {\n const webpackConfig = require(projectWebpackConfig);\n if (typeof webpackConfig === 'function') {\n config = await webpackConfig(env, argv);\n } else {\n config = webpackConfig;\n }\n } else {\n // Fallback to the default expo webpack config.\n const loadDefaultConfigAsync = importExpoWebpackConfigFromProject(this.projectRoot);\n // @ts-expect-error: types appear to be broken\n config = await loadDefaultConfigAsync(env, argv);\n }\n return config;\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./webpack.config.js'];\n }\n\n protected async clearWebProjectCacheAsync(\n projectRoot: string,\n mode: string = 'development'\n ): Promise<void> {\n Log.log(chalk.dim(`Clearing Webpack ${mode} cache directory...`));\n\n const dir = await ensureDotExpoProjectDirectoryInitialized(projectRoot);\n const cacheFolder = path.join(dir, 'web/cache', mode);\n try {\n await fs.promises.rm(cacheFolder, { recursive: true, force: true });\n } catch (error: any) {\n Log.error(`Could not clear ${mode} web cache directory: ${error.message}`);\n }\n }\n}\n\nfunction setMode(mode: 'development' | 'production' | 'test' | 'none'): void {\n process.env.BABEL_ENV = mode;\n process.env.NODE_ENV = mode;\n}\n\nexport function getProjectWebpackConfigFilePath(projectRoot: string) {\n return resolveFrom.silent(projectRoot, './webpack.config.js');\n}\n"],"names":["getProjectWebpackConfigFilePath","path","Log","debug","require","assertIsWebpackDevServer","value","sockWrite","CommandError","constructor","name","WebpackBundlerDevServer","BundlerDevServer","broadcastMessage","method","params","instance","server","customMessageSocketBroadcaster","hackyConvertedMessage","sockets","attachNativeDevServerMiddlewareToDevServer","middleware","attachToServer","logger","attachInspectorProxy","LogReporter","messageSocket","debuggerProxy","eventsSocket","broadcast","logReporter","reportEvent","inspectorProxy","projectRoot","isTargetingNative","includes","process","env","EXPO_WEBPACK_PLATFORM","createNativeDevServerMiddleware","port","options","createDevServerMiddleware","nativeMiddleware","watchFolders","getManifestMiddlewareAsync","use","getAvailablePortAsync","defaultPort","choosePortAsync","host","WEB_HOST","error","message","bundleAsync","mode","clear","webpack","importWebpackFromProject","clearWebProjectCacheAsync","config","loadConfigAsync","isImageEditingEnabled","plugins","bar","createProgressBar","chalk","width","total","complete","incomplete","push","ProgressPlugin","percent","update","terminate","compiler","compileAsync","red","startImplementationAsync","WebpackDevServer","importWebpackDevServerFromProject","stopAsync","resetDevServer","https","urlCreator","getUrlCreator","location","scheme","ensureEnvironmentSupportsTLSAsync","catch","log","devServer","before","originalBefore","bind","app","listen","originalClose","close","callback","err","_host","getIpAddress","protocol","url","getProjectConfigFilePath","getConfigModuleIds","reduce","prev","moduleId","resolveFrom","silent","argv","pwa","info","setMode","projectWebpackConfig","webpackConfig","loadDefaultConfigAsync","importExpoWebpackConfigFromProject","dim","dir","ensureDotExpoProjectDirectoryInitialized","cacheFolder","join","fs","promises","rm","recursive","force","BABEL_ENV","NODE_ENV"],"mappings":"AAAA;;;;QAwYgBA,+BAA+B,GAA/BA,+BAA+B;AAxY7B,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AAEPC,IAAAA,IAAI,mCAAM,MAAM,EAAZ;AACQ,IAAA,YAAc,kCAAd,cAAc,EAAA;AAI1BC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACK,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACX,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACvB,IAAA,GA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AC;QACtD,IAAI;YACF,MAAMuE,GAAE,QAAA,CAACC,QAAQ,CAACC,EAAE,CAACJ,WAAW,EAAE;gBAAEK,SAAS,EAAE,IAAI;gBAAEC,KAAK,EAAE,IAAI;aAAE,CAAC,CAAC;SACrE,CAAC,OAAO9E,KAAK,EAAO;YACnBnD,GAAG,CAACmD,KAAK,CAAC,CAAC,gBAAgB,EAAEG,IAAI,CAAC,sBAAsB,EAAEH,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAAC;SAC5E;KACF;CACF;QArVY3C,uBAAuB,GAAvBA,uBAAuB;AAuVpC,SAAS0G,OAAO,CAAC7D,IAAoD,EAAQ;IAC3EnB,OAAO,CAACC,GAAG,CAAC8F,SAAS,GAAG5E,IAAI,CAAC;IAC7BnB,OAAO,CAACC,GAAG,CAAC+F,QAAQ,GAAG7E,IAAI,CAAC;CAC7B;AAEM,SAASxD,+BAA+B,CAACkC,WAAmB,EAAE;IACnE,OAAO8E,YAAW,QAAA,CAACC,MAAM,CAAC/E,WAAW,EAAE,qBAAqB,CAAC,CAAC;CAC/D"}
1
+ {"version":3,"sources":["../../../../../src/start/server/webpack/WebpackBundlerDevServer.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { Application } from 'express';\nimport fs from 'fs';\nimport http from 'http';\nimport * as path from 'path';\nimport resolveFrom from 'resolve-from';\nimport type webpack from 'webpack';\nimport type WebpackDevServer from 'webpack-dev-server';\n\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { getIpAddress } from '../../../utils/ip';\nimport { setNodeEnv } from '../../../utils/nodeEnv';\nimport { choosePortAsync } from '../../../utils/port';\nimport { createProgressBar } from '../../../utils/progress';\nimport { ensureDotExpoProjectDirectoryInitialized } from '../../project/dotExpo';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport { compileAsync } from './compile';\nimport {\n importExpoWebpackConfigFromProject,\n importWebpackDevServerFromProject,\n importWebpackFromProject,\n} from './resolveFromProject';\nimport { ensureEnvironmentSupportsTLSAsync } from './tls';\n\nconst debug = require('debug')('expo:start:server:webpack:devServer') as typeof console.log;\n\nexport type WebpackConfiguration = webpack.Configuration & {\n devServer?: {\n before?: (app: Application, server: WebpackDevServer, compiler: webpack.Compiler) => void;\n };\n};\n\nfunction assertIsWebpackDevServer(value: any): asserts value is WebpackDevServer {\n if (!value?.sockWrite) {\n throw new CommandError(\n 'WEBPACK',\n value\n ? 'Expected Webpack dev server, found: ' + (value.constructor?.name ?? value)\n : 'Webpack dev server not started yet.'\n );\n }\n}\n\nexport class WebpackBundlerDevServer extends BundlerDevServer {\n get name(): string {\n return 'webpack';\n }\n\n // A custom message websocket broadcaster used to send messages to a React Native runtime.\n private customMessageSocketBroadcaster:\n | undefined\n | ((message: string, data?: Record<string, any>) => void);\n\n public broadcastMessage(\n method: string | 'reload' | 'devMenu' | 'sendDevCommand',\n params?: Record<string, any>\n ): void {\n if (!this.instance) {\n return;\n }\n\n assertIsWebpackDevServer(this.instance?.server);\n\n // Allow any message on native\n if (this.customMessageSocketBroadcaster) {\n this.customMessageSocketBroadcaster(method, params);\n return;\n }\n\n // TODO(EvanBacon): Custom Webpack overlay.\n // Default webpack-dev-server sockets use \"content-changed\" instead of \"reload\" (what we use on native).\n // For now, just manually convert the value so our CLI interface can be unified.\n const hackyConvertedMessage = method === 'reload' ? 'content-changed' : method;\n\n this.instance.server.sockWrite(this.instance.server.sockets, hackyConvertedMessage, params);\n }\n\n private async attachNativeDevServerMiddlewareToDevServer({\n server,\n middleware,\n attachToServer,\n logger,\n }: { server: http.Server } & Awaited<ReturnType<typeof this.createNativeDevServerMiddleware>>) {\n const { attachInspectorProxy, LogReporter } = await import('@expo/dev-server');\n\n // Hook up the React Native WebSockets to the Webpack dev server.\n const { messageSocket, debuggerProxy, eventsSocket } = attachToServer(server);\n\n this.customMessageSocketBroadcaster = messageSocket.broadcast;\n\n const logReporter = new LogReporter(logger);\n logReporter.reportEvent = eventsSocket.reportEvent;\n\n const { inspectorProxy } = attachInspectorProxy(this.projectRoot, {\n middleware,\n server,\n });\n\n return {\n messageSocket,\n eventsSocket,\n debuggerProxy,\n logReporter,\n inspectorProxy,\n };\n }\n\n isTargetingNative(): boolean {\n // Temporary hack while we implement multi-bundler dev server proxy.\n return ['ios', 'android'].includes(process.env.EXPO_WEBPACK_PLATFORM || '');\n }\n\n private async createNativeDevServerMiddleware({\n port,\n options,\n }: {\n port: number;\n options: BundlerStartOptions;\n }) {\n if (!this.isTargetingNative()) {\n return null;\n }\n\n const { createDevServerMiddleware } = await import('../middleware/createDevServerMiddleware');\n\n const nativeMiddleware = createDevServerMiddleware(this.projectRoot, {\n port,\n watchFolders: [this.projectRoot],\n });\n // Add manifest middleware to the other middleware.\n // TODO: Move this in to expo/dev-server.\n\n const middleware = await this.getManifestMiddlewareAsync(options);\n\n nativeMiddleware.middleware.use(middleware.getHandler());\n\n return nativeMiddleware;\n }\n\n private async getAvailablePortAsync(options: { defaultPort?: number }): Promise<number> {\n try {\n const defaultPort = options?.defaultPort ?? 19006;\n const port = await choosePortAsync(this.projectRoot, {\n defaultPort,\n host: env.WEB_HOST,\n });\n if (!port) {\n throw new CommandError('NO_PORT_FOUND', `Port ${defaultPort} not available.`);\n }\n return port;\n } catch (error: any) {\n throw new CommandError('NO_PORT_FOUND', error.message);\n }\n }\n\n async bundleAsync({ mode, clear }: { mode: 'development' | 'production'; clear: boolean }) {\n // Do this first to fail faster.\n const webpack = importWebpackFromProject(this.projectRoot);\n\n if (clear) {\n await this.clearWebProjectCacheAsync(this.projectRoot, mode);\n }\n\n const config = await this.loadConfigAsync({\n isImageEditingEnabled: true,\n mode,\n });\n\n if (!config.plugins) {\n config.plugins = [];\n }\n\n const bar = createProgressBar(chalk`{bold Web} Bundling Javascript [:bar] :percent`, {\n width: 64,\n total: 100,\n clear: true,\n complete: '=',\n incomplete: ' ',\n });\n\n // NOTE(EvanBacon): Add a progress bar to the webpack logger if defined (e.g. not in CI).\n if (bar != null) {\n config.plugins.push(\n new webpack.ProgressPlugin((percent: number) => {\n bar?.update(percent);\n if (percent === 1) {\n bar?.terminate();\n }\n })\n );\n }\n\n // Create a webpack compiler that is configured with custom messages.\n const compiler = webpack(config);\n\n try {\n await compileAsync(compiler);\n } catch (error: any) {\n Log.error(chalk.red('Failed to compile'));\n throw error;\n } finally {\n bar?.terminate();\n }\n }\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n // Do this first to fail faster.\n const webpack = importWebpackFromProject(this.projectRoot);\n const WebpackDevServer = importWebpackDevServerFromProject(this.projectRoot);\n\n await this.stopAsync();\n\n options.port = await this.getAvailablePortAsync({\n defaultPort: options.port,\n });\n const { resetDevServer, https, port, mode } = options;\n\n this.urlCreator = this.getUrlCreator({\n port,\n location: {\n scheme: https ? 'https' : 'http',\n },\n });\n\n debug('Starting webpack on port: ' + port);\n\n if (resetDevServer) {\n await this.clearWebProjectCacheAsync(this.projectRoot, mode);\n }\n\n if (https) {\n debug('Configuring TLS to enable HTTPS support');\n await ensureEnvironmentSupportsTLSAsync(this.projectRoot).catch((error) => {\n Log.error(`Error creating TLS certificates: ${error}`);\n });\n }\n\n const config = await this.loadConfigAsync(options);\n\n Log.log(chalk`Starting Webpack on port ${port} in {underline ${mode}} mode.`);\n\n // Create a webpack compiler that is configured with custom messages.\n const compiler = webpack(config);\n\n let nativeMiddleware: Awaited<ReturnType<typeof this.createNativeDevServerMiddleware>> | null =\n null;\n if (config.devServer?.before) {\n // Create the middleware required for interacting with a native runtime (Expo Go, or a development build).\n nativeMiddleware = await this.createNativeDevServerMiddleware({\n port,\n options,\n });\n // Inject the native manifest middleware.\n const originalBefore = config.devServer.before.bind(config.devServer.before);\n config.devServer.before = (\n app: Application,\n server: WebpackDevServer,\n compiler: webpack.Compiler\n ) => {\n originalBefore(app, server, compiler);\n\n if (nativeMiddleware?.middleware) {\n app.use(nativeMiddleware.middleware);\n }\n };\n }\n const { attachNativeDevServerMiddlewareToDevServer } = this;\n\n const server = new WebpackDevServer(\n // @ts-expect-error: type mismatch -- Webpack types aren't great.\n compiler,\n config.devServer\n );\n // Launch WebpackDevServer.\n server.listen(port, env.WEB_HOST, function (this: http.Server, error) {\n if (nativeMiddleware) {\n attachNativeDevServerMiddlewareToDevServer({\n server: this,\n ...nativeMiddleware,\n });\n }\n if (error) {\n Log.error(error.message);\n }\n });\n\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n callback?.(err);\n });\n };\n\n const _host = getIpAddress();\n const protocol = https ? 'https' : 'http';\n\n return {\n // Server instance\n server,\n // URL Info\n location: {\n url: `${protocol}://${_host}:${port}`,\n port,\n protocol,\n host: _host,\n },\n middleware: nativeMiddleware?.middleware,\n // Match the native protocol.\n messageSocket: {\n broadcast: this.broadcastMessage,\n },\n };\n }\n\n /** Load the Webpack config. Exposed for testing. */\n getProjectConfigFilePath(): string | null {\n // Check if the project has a webpack.config.js in the root.\n return (\n this.getConfigModuleIds().reduce<string | null | undefined>(\n (prev, moduleId) => prev || resolveFrom.silent(this.projectRoot, moduleId),\n null\n ) ?? null\n );\n }\n\n async loadConfigAsync(\n options: Pick<BundlerStartOptions, 'mode' | 'isImageEditingEnabled' | 'https'>,\n argv?: string[]\n ): Promise<WebpackConfiguration> {\n // let bar: ProgressBar | null = null;\n\n const env = {\n projectRoot: this.projectRoot,\n pwa: !!options.isImageEditingEnabled,\n // TODO: Use a new loader in Webpack config...\n logger: {\n info() {},\n },\n mode: options.mode,\n https: options.https,\n };\n setNodeEnv(env.mode ?? 'development');\n require('@expo/env').load(env.projectRoot);\n // Check if the project has a webpack.config.js in the root.\n const projectWebpackConfig = this.getProjectConfigFilePath();\n let config: WebpackConfiguration;\n if (projectWebpackConfig) {\n const webpackConfig = require(projectWebpackConfig);\n if (typeof webpackConfig === 'function') {\n config = await webpackConfig(env, argv);\n } else {\n config = webpackConfig;\n }\n } else {\n // Fallback to the default expo webpack config.\n const loadDefaultConfigAsync = importExpoWebpackConfigFromProject(this.projectRoot);\n // @ts-expect-error: types appear to be broken\n config = await loadDefaultConfigAsync(env, argv);\n }\n return config;\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./webpack.config.js'];\n }\n\n protected async clearWebProjectCacheAsync(\n projectRoot: string,\n mode: string = 'development'\n ): Promise<void> {\n Log.log(chalk.dim(`Clearing Webpack ${mode} cache directory...`));\n\n const dir = await ensureDotExpoProjectDirectoryInitialized(projectRoot);\n const cacheFolder = path.join(dir, 'web/cache', mode);\n try {\n await fs.promises.rm(cacheFolder, { recursive: true, force: true });\n } catch (error: any) {\n Log.error(`Could not clear ${mode} web cache directory: ${error.message}`);\n }\n }\n}\n\nexport function getProjectWebpackConfigFilePath(projectRoot: string) {\n return resolveFrom.silent(projectRoot, './webpack.config.js');\n}\n"],"names":["getProjectWebpackConfigFilePath","path","Log","debug","require","assertIsWebpackDevServer","value","sockWrite","CommandError","constructor","name","WebpackBundlerDevServer","BundlerDevServer","broadcastMessage","method","params","instance","server","customMessageSocketBroadcaster","hackyConvertedMessage","sockets","attachNativeDevServerMiddlewareToDevServer","middleware","attachToServer","logger","attachInspectorProxy","LogReporter","messageSocket","debuggerProxy","eventsSocket","broadcast","logReporter","reportEvent","inspectorProxy","projectRoot","isTargetingNative","includes","process","env","EXPO_WEBPACK_PLATFORM","createNativeDevServerMiddleware","port","options","createDevServerMiddleware","nativeMiddleware","watchFolders","getManifestMiddlewareAsync","use","getHandler","getAvailablePortAsync","defaultPort","choosePortAsync","host","WEB_HOST","error","message","bundleAsync","mode","clear","webpack","importWebpackFromProject","clearWebProjectCacheAsync","config","loadConfigAsync","isImageEditingEnabled","plugins","bar","createProgressBar","chalk","width","total","complete","incomplete","push","ProgressPlugin","percent","update","terminate","compiler","compileAsync","red","startImplementationAsync","WebpackDevServer","importWebpackDevServerFromProject","stopAsync","resetDevServer","https","urlCreator","getUrlCreator","location","scheme","ensureEnvironmentSupportsTLSAsync","catch","log","devServer","before","originalBefore","bind","app","listen","originalClose","close","callback","err","_host","getIpAddress","protocol","url","getProjectConfigFilePath","getConfigModuleIds","reduce","prev","moduleId","resolveFrom","silent","argv","pwa","info","setNodeEnv","load","projectWebpackConfig","webpackConfig","loadDefaultConfigAsync","importExpoWebpackConfigFromProject","dim","dir","ensureDotExpoProjectDirectoryInitialized","cacheFolder","join","fs","promises","rm","recursive","force"],"mappings":"AAAA;;;;QAqYgBA,+BAA+B,GAA/BA,+BAA+B;AArY7B,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AAEPC,IAAAA,IAAI,mCAAM,MAAM,EAAZ;AACQ,IAAA,YAAc,kCAAd,cAAc,EAAA;AAI1BC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACK,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACX,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACvB,IAAA,GAAmB,WAAnB,mBAAmB,CAAA;AACrB,IAAA,QAAwB,WAAxB,wBAAwB,CAAA;AACnB,IAAA,KAAqB,WAArB,qBAAqB,CAAA;AACnB,IAAA,SAAyB,WAAzB,yBAAyB,CAAA;AACF,IAAA,QAAuB,WAAvB,uBAAuB,CAAA;AACP,IAAA,iBAAqB,WAArB,qBAAqB,CAAA;AACjE,IAAA,QAAW,WAAX,WAAW,CAAA;AAKjC,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACqB,IAAA,IAAO,WAAP,OAAO,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,qCAAqC,CAAC,AAAsB,AAAC;AAQ5F,SAASC,wBAAwB,CAACC,KAAU,EAAqC;IAC/E,IAAI,CAACA,CAAAA,KAAK,QAAW,GAAhBA,KAAAA,CAAgB,GAAhBA,KAAK,CAAEC,SAAS,CA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,EAAE;IACnE,OAAO+E,YAAW,QAAA,CAACC,MAAM,CAAChF,WAAW,EAAE,qBAAqB,CAAC,CAAC;CAC/D"}
@@ -10,9 +10,9 @@ var _getDevClientProperties = _interopRequireDefault(require("../utils/analytics
10
10
  var _rudderstackClient = require("../utils/analytics/rudderstackClient");
11
11
  var _exit = require("../utils/exit");
12
12
  var _interactive = require("../utils/interactive");
13
+ var _nodeEnv = require("../utils/nodeEnv");
13
14
  var _profile = require("../utils/profile");
14
15
  var _validateDependenciesVersions = require("./doctor/dependencies/validateDependenciesVersions");
15
- var _typeScriptProjectPrerequisite = require("./doctor/typescript/TypeScriptProjectPrerequisite");
16
16
  var _webSupportProjectPrerequisite = require("./doctor/web/WebSupportProjectPrerequisite");
17
17
  var _startInterface = require("./interface/startInterface");
18
18
  var _resolveOptions = require("./resolveOptions");
@@ -90,13 +90,30 @@ async function getMultiBundlerStartOptions(projectRoot, { forceManifestType , ..
90
90
  }
91
91
  async function startAsync(projectRoot, options, settings) {
92
92
  Log.log(_chalk.default.gray(`Starting project at ${projectRoot}`));
93
+ (0, _nodeEnv).setNodeEnv(options.dev ? "development" : "production");
94
+ require("@expo/env").load(projectRoot);
93
95
  const { exp , pkg } = (0, _profile).profile(_config.getConfig)(projectRoot);
94
96
  const platformBundlers = (0, _platformBundlers).getPlatformBundlers(exp);
95
97
  if (!options.forceManifestType) {
96
98
  var ref;
97
- const easUpdatesUrlRegex = /^https:\/\/(staging-)?u\.expo\.dev/;
98
- const isEasUpdatesUrl = ((ref = exp.updates) == null ? void 0 : ref.url) ? easUpdatesUrlRegex.test(exp.updates.url) : false;
99
- options.forceManifestType = isEasUpdatesUrl ? "expo-updates" : "classic";
99
+ if ((ref = exp.updates) == null ? void 0 : ref.useClassicUpdates) {
100
+ options.forceManifestType = "classic";
101
+ } else {
102
+ var ref1;
103
+ const classicUpdatesUrlRegex = /^(staging\.)?exp\.host/;
104
+ let parsedUpdatesUrl = {
105
+ hostname: null
106
+ };
107
+ if ((ref1 = exp.updates) == null ? void 0 : ref1.url) {
108
+ try {
109
+ parsedUpdatesUrl = new URL(exp.updates.url);
110
+ } catch {
111
+ Log.error(`Failed to parse \`updates.url\` in this project's app config. ${exp.updates.url} is not a valid URL.`);
112
+ }
113
+ }
114
+ const isClassicUpdatesUrl = parsedUpdatesUrl.hostname ? classicUpdatesUrlRegex.test(parsedUpdatesUrl.hostname) : false;
115
+ options.forceManifestType = isClassicUpdatesUrl ? "classic" : "expo-updates";
116
+ }
100
117
  }
101
118
  const [defaultOptions, startOptions] = await getMultiBundlerStartOptions(projectRoot, options, settings, platformBundlers);
102
119
  const devServerManager = new _devServerManager.DevServerManager(projectRoot, defaultOptions);
@@ -104,7 +121,13 @@ async function startAsync(projectRoot, options, settings) {
104
121
  if (options.web || settings.webOnly) {
105
122
  await devServerManager.ensureProjectPrerequisiteAsync(_webSupportProjectPrerequisite.WebSupportProjectPrerequisite);
106
123
  }
107
- await devServerManager.ensureProjectPrerequisiteAsync(_typeScriptProjectPrerequisite.TypeScriptProjectPrerequisite);
124
+ // Start the server as soon as possible.
125
+ await (0, _profile).profile(devServerManager.startAsync.bind(devServerManager))(startOptions);
126
+ if (!settings.webOnly) {
127
+ await devServerManager.watchEnvironmentVariables();
128
+ // After the server starts, we can start attempting to bootstrap TypeScript.
129
+ await devServerManager.bootstrapTypeScriptAsync();
130
+ }
108
131
  if (!settings.webOnly && !options.devClient) {
109
132
  await (0, _profile).profile(_validateDependenciesVersions.validateDependenciesVersionsAsync)(projectRoot, exp, pkg);
110
133
  }
@@ -112,7 +135,6 @@ async function startAsync(projectRoot, options, settings) {
112
135
  if (options.devClient) {
113
136
  await trackAsync(projectRoot, exp);
114
137
  }
115
- await (0, _profile).profile(devServerManager.startAsync.bind(devServerManager))(startOptions);
116
138
  // Open project on devices.
117
139
  await (0, _profile).profile(_openPlatforms.openPlatformsAsync)(devServerManager, options);
118
140
  // Present the Terminal UI.
@@ -126,9 +148,9 @@ async function startAsync(projectRoot, options, settings) {
126
148
  ]
127
149
  });
128
150
  } else {
129
- var ref1;
151
+ var ref2;
130
152
  // Display the server location in CI...
131
- const url = (ref1 = devServerManager.getDefaultDevServer()) == null ? void 0 : ref1.getDevServerUrl();
153
+ const url = (ref2 = devServerManager.getDefaultDevServer()) == null ? void 0 : ref2.getDevServerUrl();
132
154
  if (url) {
133
155
  Log.log(_chalk.default`Waiting on {underline ${url}}`);
134
156
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/start/startAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfig } from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport getDevClientProperties from '../utils/analytics/getDevClientProperties';\nimport { logEventAsync } from '../utils/analytics/rudderstackClient';\nimport { installExitHooks } from '../utils/exit';\nimport { isInteractive } from '../utils/interactive';\nimport { profile } from '../utils/profile';\nimport { validateDependenciesVersionsAsync } from './doctor/dependencies/validateDependenciesVersions';\nimport { TypeScriptProjectPrerequisite } from './doctor/typescript/TypeScriptProjectPrerequisite';\nimport { WebSupportProjectPrerequisite } from './doctor/web/WebSupportProjectPrerequisite';\nimport { startInterfaceAsync } from './interface/startInterface';\nimport { Options, resolvePortsAsync } from './resolveOptions';\nimport { BundlerStartOptions } from './server/BundlerDevServer';\nimport { DevServerManager, MultiBundlerStartOptions } from './server/DevServerManager';\nimport { openPlatformsAsync } from './server/openPlatforms';\nimport { getPlatformBundlers, PlatformBundlers } from './server/platformBundlers';\n\nasync function getMultiBundlerStartOptions(\n projectRoot: string,\n { forceManifestType, ...options }: Options,\n settings: { webOnly?: boolean },\n platformBundlers: PlatformBundlers\n): Promise<[BundlerStartOptions, MultiBundlerStartOptions]> {\n const commonOptions: BundlerStartOptions = {\n mode: options.dev ? 'development' : 'production',\n devClient: options.devClient,\n forceManifestType,\n privateKeyPath: options.privateKeyPath ?? undefined,\n https: options.https,\n maxWorkers: options.maxWorkers,\n resetDevServer: options.clear,\n minify: options.minify,\n location: {\n hostType: options.host,\n scheme: options.scheme,\n },\n };\n const multiBundlerSettings = await resolvePortsAsync(projectRoot, options, settings);\n\n const optionalBundlers: Partial<PlatformBundlers> = { ...platformBundlers };\n // In the default case, we don't want to start multiple bundlers since this is\n // a bit slower. Our priority (for legacy) is native platforms.\n if (!options.web) {\n delete optionalBundlers['web'];\n }\n\n const bundlers = [...new Set(Object.values(optionalBundlers))];\n const multiBundlerStartOptions = bundlers.map((bundler) => {\n const port =\n bundler === 'webpack' ? multiBundlerSettings.webpackPort : multiBundlerSettings.metroPort;\n return {\n type: bundler,\n options: {\n ...commonOptions,\n port,\n },\n };\n });\n\n return [commonOptions, multiBundlerStartOptions];\n}\n\nexport async function startAsync(\n projectRoot: string,\n options: Options,\n settings: { webOnly?: boolean }\n) {\n Log.log(chalk.gray(`Starting project at ${projectRoot}`));\n\n const { exp, pkg } = profile(getConfig)(projectRoot);\n\n const platformBundlers = getPlatformBundlers(exp);\n\n if (!options.forceManifestType) {\n const easUpdatesUrlRegex = /^https:\\/\\/(staging-)?u\\.expo\\.dev/;\n const isEasUpdatesUrl = exp.updates?.url ? easUpdatesUrlRegex.test(exp.updates.url) : false;\n options.forceManifestType = isEasUpdatesUrl ? 'expo-updates' : 'classic';\n }\n\n const [defaultOptions, startOptions] = await getMultiBundlerStartOptions(\n projectRoot,\n options,\n settings,\n platformBundlers\n );\n\n const devServerManager = new DevServerManager(projectRoot, defaultOptions);\n\n // Validations\n\n if (options.web || settings.webOnly) {\n await devServerManager.ensureProjectPrerequisiteAsync(WebSupportProjectPrerequisite);\n }\n\n await devServerManager.ensureProjectPrerequisiteAsync(TypeScriptProjectPrerequisite);\n\n if (!settings.webOnly && !options.devClient) {\n await profile(validateDependenciesVersionsAsync)(projectRoot, exp, pkg);\n }\n\n // Some tracking thing\n\n if (options.devClient) {\n await trackAsync(projectRoot, exp);\n }\n\n await profile(devServerManager.startAsync.bind(devServerManager))(startOptions);\n\n // Open project on devices.\n await profile(openPlatformsAsync)(devServerManager, options);\n\n // Present the Terminal UI.\n if (isInteractive()) {\n await profile(startInterfaceAsync)(devServerManager, {\n platforms: exp.platforms ?? ['ios', 'android', 'web'],\n });\n } else {\n // Display the server location in CI...\n const url = devServerManager.getDefaultDevServer()?.getDevServerUrl();\n if (url) {\n Log.log(chalk`Waiting on {underline ${url}}`);\n }\n }\n\n // Final note about closing the server.\n const logLocation = settings.webOnly ? 'in the browser console' : 'below';\n Log.log(\n chalk`Logs for your project will appear ${logLocation}.${\n isInteractive() ? chalk.dim(` Press Ctrl+C to exit.`) : ''\n }`\n );\n}\n\nasync function trackAsync(projectRoot: string, exp: ExpoConfig): Promise<void> {\n await logEventAsync('dev client start command', {\n status: 'started',\n ...getDevClientProperties(projectRoot, exp),\n });\n installExitHooks(async () => {\n await logEventAsync('dev client start command', {\n status: 'finished',\n ...getDevClientProperties(projectRoot, exp),\n });\n // UnifiedAnalytics.flush();\n });\n}\n"],"names":["startAsync","Log","getMultiBundlerStartOptions","projectRoot","forceManifestType","options","settings","platformBundlers","commonOptions","mode","dev","devClient","privateKeyPath","undefined","https","maxWorkers","resetDevServer","clear","minify","location","hostType","host","scheme","multiBundlerSettings","resolvePortsAsync","optionalBundlers","web","bundlers","Set","Object","values","multiBundlerStartOptions","map","bundler","port","webpackPort","metroPort","type","log","chalk","gray","exp","pkg","profile","getConfig","getPlatformBundlers","easUpdatesUrlRegex","isEasUpdatesUrl","updates","url","test","defaultOptions","startOptions","devServerManager","DevServerManager","webOnly","ensureProjectPrerequisiteAsync","WebSupportProjectPrerequisite","TypeScriptProjectPrerequisite","validateDependenciesVersionsAsync","trackAsync","bind","openPlatformsAsync","isInteractive","startInterfaceAsync","platforms","getDefaultDevServer","getDevServerUrl","logLocation","dim","logEventAsync","status","getDevClientProperties","installExitHooks"],"mappings":"AAAA;;;;QAgEsBA,UAAU,GAAVA,UAAU;AAhEM,IAAA,OAAc,WAAd,cAAc,CAAA;AAClC,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbC,IAAAA,GAAG,mCAAM,QAAQ,E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C3D,CAAC,CACH,CAAC;CACH;AAED,eAAeT,UAAU,CAACzD,WAAmB,EAAEsC,GAAe,EAAiB;IAC7E,MAAM6B,CAAAA,GAAAA,kBAAa,AAGjB,CAAA,cAHiB,CAAC,0BAA0B,EAAE;QAC9CC,MAAM,EAAE,SAAS;QACjB,GAAGC,CAAAA,GAAAA,uBAAsB,AAAkB,CAAA,QAAlB,CAACrE,WAAW,EAAEsC,GAAG,CAAC;KAC5C,CAAC,CAAC;IACHgC,CAAAA,GAAAA,KAAgB,AAMd,CAAA,iBANc,CAAC,UAAY;QAC3B,MAAMH,CAAAA,GAAAA,kBAAa,AAGjB,CAAA,cAHiB,CAAC,0BAA0B,EAAE;YAC9CC,MAAM,EAAE,UAAU;YAClB,GAAGC,CAAAA,GAAAA,uBAAsB,AAAkB,CAAA,QAAlB,CAACrE,WAAW,EAAEsC,GAAG,CAAC;SAC5C,CAAC,CAAC;IACH,4BAA4B;KAC7B,CAAC,CAAC;CACJ"}
1
+ {"version":3,"sources":["../../../src/start/startAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfig } from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport getDevClientProperties from '../utils/analytics/getDevClientProperties';\nimport { logEventAsync } from '../utils/analytics/rudderstackClient';\nimport { installExitHooks } from '../utils/exit';\nimport { isInteractive } from '../utils/interactive';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { profile } from '../utils/profile';\nimport { validateDependenciesVersionsAsync } from './doctor/dependencies/validateDependenciesVersions';\nimport { WebSupportProjectPrerequisite } from './doctor/web/WebSupportProjectPrerequisite';\nimport { startInterfaceAsync } from './interface/startInterface';\nimport { Options, resolvePortsAsync } from './resolveOptions';\nimport { BundlerStartOptions } from './server/BundlerDevServer';\nimport { DevServerManager, MultiBundlerStartOptions } from './server/DevServerManager';\nimport { openPlatformsAsync } from './server/openPlatforms';\nimport { getPlatformBundlers, PlatformBundlers } from './server/platformBundlers';\n\nasync function getMultiBundlerStartOptions(\n projectRoot: string,\n { forceManifestType, ...options }: Options,\n settings: { webOnly?: boolean },\n platformBundlers: PlatformBundlers\n): Promise<[BundlerStartOptions, MultiBundlerStartOptions]> {\n const commonOptions: BundlerStartOptions = {\n mode: options.dev ? 'development' : 'production',\n devClient: options.devClient,\n forceManifestType,\n privateKeyPath: options.privateKeyPath ?? undefined,\n https: options.https,\n maxWorkers: options.maxWorkers,\n resetDevServer: options.clear,\n minify: options.minify,\n location: {\n hostType: options.host,\n scheme: options.scheme,\n },\n };\n const multiBundlerSettings = await resolvePortsAsync(projectRoot, options, settings);\n\n const optionalBundlers: Partial<PlatformBundlers> = { ...platformBundlers };\n // In the default case, we don't want to start multiple bundlers since this is\n // a bit slower. Our priority (for legacy) is native platforms.\n if (!options.web) {\n delete optionalBundlers['web'];\n }\n\n const bundlers = [...new Set(Object.values(optionalBundlers))];\n const multiBundlerStartOptions = bundlers.map((bundler) => {\n const port =\n bundler === 'webpack' ? multiBundlerSettings.webpackPort : multiBundlerSettings.metroPort;\n return {\n type: bundler,\n options: {\n ...commonOptions,\n port,\n },\n };\n });\n\n return [commonOptions, multiBundlerStartOptions];\n}\n\nexport async function startAsync(\n projectRoot: string,\n options: Options,\n settings: { webOnly?: boolean }\n) {\n Log.log(chalk.gray(`Starting project at ${projectRoot}`));\n\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n const { exp, pkg } = profile(getConfig)(projectRoot);\n\n const platformBundlers = getPlatformBundlers(exp);\n\n if (!options.forceManifestType) {\n if (exp.updates?.useClassicUpdates) {\n options.forceManifestType = 'classic';\n } else {\n const classicUpdatesUrlRegex = /^(staging\\.)?exp\\.host/;\n let parsedUpdatesUrl: { hostname: string | null } = { hostname: null };\n if (exp.updates?.url) {\n try {\n parsedUpdatesUrl = new URL(exp.updates.url);\n } catch {\n Log.error(\n `Failed to parse \\`updates.url\\` in this project's app config. ${exp.updates.url} is not a valid URL.`\n );\n }\n }\n const isClassicUpdatesUrl = parsedUpdatesUrl.hostname\n ? classicUpdatesUrlRegex.test(parsedUpdatesUrl.hostname)\n : false;\n options.forceManifestType = isClassicUpdatesUrl ? 'classic' : 'expo-updates';\n }\n }\n\n const [defaultOptions, startOptions] = await getMultiBundlerStartOptions(\n projectRoot,\n options,\n settings,\n platformBundlers\n );\n\n const devServerManager = new DevServerManager(projectRoot, defaultOptions);\n\n // Validations\n\n if (options.web || settings.webOnly) {\n await devServerManager.ensureProjectPrerequisiteAsync(WebSupportProjectPrerequisite);\n }\n\n // Start the server as soon as possible.\n await profile(devServerManager.startAsync.bind(devServerManager))(startOptions);\n\n if (!settings.webOnly) {\n await devServerManager.watchEnvironmentVariables();\n\n // After the server starts, we can start attempting to bootstrap TypeScript.\n await devServerManager.bootstrapTypeScriptAsync();\n }\n\n if (!settings.webOnly && !options.devClient) {\n await profile(validateDependenciesVersionsAsync)(projectRoot, exp, pkg);\n }\n\n // Some tracking thing\n\n if (options.devClient) {\n await trackAsync(projectRoot, exp);\n }\n\n // Open project on devices.\n await profile(openPlatformsAsync)(devServerManager, options);\n\n // Present the Terminal UI.\n if (isInteractive()) {\n await profile(startInterfaceAsync)(devServerManager, {\n platforms: exp.platforms ?? ['ios', 'android', 'web'],\n });\n } else {\n // Display the server location in CI...\n const url = devServerManager.getDefaultDevServer()?.getDevServerUrl();\n if (url) {\n Log.log(chalk`Waiting on {underline ${url}}`);\n }\n }\n\n // Final note about closing the server.\n const logLocation = settings.webOnly ? 'in the browser console' : 'below';\n Log.log(\n chalk`Logs for your project will appear ${logLocation}.${\n isInteractive() ? chalk.dim(` Press Ctrl+C to exit.`) : ''\n }`\n );\n}\n\nasync function trackAsync(projectRoot: string, exp: ExpoConfig): Promise<void> {\n await logEventAsync('dev client start command', {\n status: 'started',\n ...getDevClientProperties(projectRoot, exp),\n });\n installExitHooks(async () => {\n await logEventAsync('dev client start command', {\n status: 'finished',\n ...getDevClientProperties(projectRoot, exp),\n });\n // UnifiedAnalytics.flush();\n });\n}\n"],"names":["startAsync","Log","getMultiBundlerStartOptions","projectRoot","forceManifestType","options","settings","platformBundlers","commonOptions","mode","dev","devClient","privateKeyPath","undefined","https","maxWorkers","resetDevServer","clear","minify","location","hostType","host","scheme","multiBundlerSettings","resolvePortsAsync","optionalBundlers","web","bundlers","Set","Object","values","multiBundlerStartOptions","map","bundler","port","webpackPort","metroPort","type","log","chalk","gray","setNodeEnv","require","load","exp","pkg","profile","getConfig","getPlatformBundlers","updates","useClassicUpdates","classicUpdatesUrlRegex","parsedUpdatesUrl","hostname","url","URL","error","isClassicUpdatesUrl","test","defaultOptions","startOptions","devServerManager","DevServerManager","webOnly","ensureProjectPrerequisiteAsync","WebSupportProjectPrerequisite","bind","watchEnvironmentVariables","bootstrapTypeScriptAsync","validateDependenciesVersionsAsync","trackAsync","openPlatformsAsync","isInteractive","startInterfaceAsync","platforms","getDefaultDevServer","getDevServerUrl","logLocation","dim","logEventAsync","status","getDevClientProperties","installExitHooks"],"mappings":"AAAA;;;;QAgEsBA,UAAU,GAAVA,UAAU;AAhEM,IAAA,OAAc,WAAd,cAAc,CAAA;AAClC,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACoB,IAAA,uBAA2C,kCAA3C,2CAA2C,EAAA;AAChD,IAAA,kBAAsC,WAAtC,sCAAsC,CAAA;AACnC,IAAA,KAAe,WAAf,eAAe,CAAA;AAClB,IAAA,YAAsB,WAAtB,sBAAsB,CAAA;AACzB,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACrB,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACQ,IAAA,6BAAoD,WAApD,oDAAoD,CAAA;AACxD,IAAA,8BAA4C,WAA5C,4CAA4C,CAAA;AACtD,IAAA,eAA4B,WAA5B,4BAA4B,CAAA;AACrB,IAAA,eAAkB,WAAlB,kBAAkB,CAAA;AAEF,IAAA,iBAA2B,WAA3B,2BAA2B,CAAA;AACnD,IAAA,cAAwB,WAAxB,wBA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AAC,CAAC;SAC/C;KACF;IAED,uCAAuC;IACvC,MAAMuB,WAAW,GAAGvE,QAAQ,CAACyD,OAAO,GAAG,wBAAwB,GAAG,OAAO,AAAC;IAC1E9D,GAAG,CAACqC,GAAG,CACLC,MAAK,QAAA,CAAC,kCAAkC,EAAEsC,WAAW,CAAC,CAAC,EACrDL,CAAAA,GAAAA,YAAa,AAAE,CAAA,cAAF,EAAE,GAAGjC,MAAK,QAAA,CAACuC,GAAG,CAAC,CAAC,sBAAsB,CAAC,CAAC,GAAG,EAAE,CAC3D,CAAC,CACH,CAAC;CACH;AAED,eAAeR,UAAU,CAACnE,WAAmB,EAAEyC,GAAe,EAAiB;IAC7E,MAAMmC,CAAAA,GAAAA,kBAAa,AAGjB,CAAA,cAHiB,CAAC,0BAA0B,EAAE;QAC9CC,MAAM,EAAE,SAAS;QACjB,GAAGC,CAAAA,GAAAA,uBAAsB,AAAkB,CAAA,QAAlB,CAAC9E,WAAW,EAAEyC,GAAG,CAAC;KAC5C,CAAC,CAAC;IACHsC,CAAAA,GAAAA,KAAgB,AAMd,CAAA,iBANc,CAAC,UAAY;QAC3B,MAAMH,CAAAA,GAAAA,kBAAa,AAGjB,CAAA,cAHiB,CAAC,0BAA0B,EAAE;YAC9CC,MAAM,EAAE,UAAU;YAClB,GAAGC,CAAAA,GAAAA,uBAAsB,AAAkB,CAAA,QAAlB,CAAC9E,WAAW,EAAEyC,GAAG,CAAC;SAC5C,CAAC,CAAC;IACH,4BAA4B;KAC7B,CAAC,CAAC;CACJ"}
@@ -36,12 +36,19 @@ function _interopRequireWildcard(obj) {
36
36
  }
37
37
  const debug = require("debug")("expo:utils:fileNotifier");
38
38
  class FileNotifier {
39
+ static instances = [];
40
+ static stopAll() {
41
+ for (const instance of FileNotifier.instances){
42
+ instance.stopObserving();
43
+ }
44
+ }
39
45
  constructor(projectRoot, moduleIds, settings = {}){
40
46
  this.projectRoot = projectRoot;
41
47
  this.moduleIds = moduleIds;
42
48
  this.settings = settings;
43
49
  this.unsubscribe = null;
44
50
  this.watchFile = (0, _fn).memoize(this.startWatchingFile.bind(this));
51
+ FileNotifier.instances.push(this);
45
52
  }
46
53
  /** Get the file in the project. */ resolveFilePath() {
47
54
  for (const moduleId of this.moduleIds){
@@ -52,11 +59,11 @@ class FileNotifier {
52
59
  }
53
60
  return null;
54
61
  }
55
- startObserving() {
62
+ startObserving(callback) {
56
63
  const configPath = this.resolveFilePath();
57
64
  if (configPath) {
58
65
  debug(`Observing ${configPath}`);
59
- return this.watchFile(configPath);
66
+ return this.watchFile(configPath, callback);
60
67
  }
61
68
  return configPath;
62
69
  }
@@ -64,14 +71,14 @@ class FileNotifier {
64
71
  var _obj, ref;
65
72
  (ref = (_obj = this).unsubscribe) == null ? void 0 : ref.call(_obj);
66
73
  }
67
- startWatchingFile(filePath) {
74
+ startWatchingFile(filePath, callback) {
68
75
  const configName = _path.default.relative(this.projectRoot, filePath);
69
76
  const listener = (cur, prev)=>{
70
77
  if (prev.size || cur.size) {
71
78
  Log.log(`\u203A Detected a change in ${_chalk.default.bold(configName)}. Restart the server to see the new results.` + (this.settings.additionalWarning || ""));
72
79
  }
73
80
  };
74
- const watcher = (0, _fs).watchFile(filePath, listener);
81
+ const watcher = (0, _fs).watchFile(filePath, callback != null ? callback : listener);
75
82
  this.unsubscribe = ()=>{
76
83
  watcher.unref();
77
84
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/FileNotifier.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { watchFile } from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport * as Log from '../log';\nimport { memoize } from './fn';\n\nconst debug = require('debug')('expo:utils:fileNotifier') as typeof console.log;\n\n/** Observes and reports file changes. */\nexport class FileNotifier {\n private unsubscribe: (() => void) | null = null;\n constructor(\n /** Project root to resolve the module IDs relative to. */\n private projectRoot: string,\n /** List of module IDs sorted by priority. Only the first file that exists will be observed. */\n private moduleIds: string[],\n private settings: {\n /** An additional warning message to add to the notice. */\n additionalWarning?: string;\n } = {}\n ) {}\n\n /** Get the file in the project. */\n private resolveFilePath(): string | null {\n for (const moduleId of this.moduleIds) {\n const filePath = resolveFrom.silent(this.projectRoot, moduleId);\n if (filePath) {\n return filePath;\n }\n }\n return null;\n }\n\n public startObserving() {\n const configPath = this.resolveFilePath();\n if (configPath) {\n debug(`Observing ${configPath}`);\n return this.watchFile(configPath);\n }\n return configPath;\n }\n\n public stopObserving() {\n this.unsubscribe?.();\n }\n\n /** Watch the file and warn to reload the CLI if it changes. */\n public watchFile = memoize(this.startWatchingFile.bind(this));\n\n private startWatchingFile(filePath: string): string {\n const configName = path.relative(this.projectRoot, filePath);\n const listener = (cur: any, prev: any) => {\n if (prev.size || cur.size) {\n Log.log(\n `\\u203A Detected a change in ${chalk.bold(\n configName\n )}. Restart the server to see the new results.` + (this.settings.additionalWarning || '')\n );\n }\n };\n\n const watcher = watchFile(filePath, listener);\n\n this.unsubscribe = () => {\n watcher.unref();\n };\n\n return filePath;\n }\n}\n"],"names":["Log","debug","require","FileNotifier","constructor","projectRoot","moduleIds","settings","unsubscribe","watchFile","memoize","startWatchingFile","bind","resolveFilePath","moduleId","filePath","resolveFrom","silent","startObserving","configPath","stopObserving","configName","path","relative","listener","cur","prev","size","log","chalk","bold","additionalWarning","watcher","unref"],"mappings":"AAAA;;;;AAAkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACC,IAAA,GAAI,WAAJ,IAAI,CAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;AACC,IAAA,YAAc,kCAAd,cAAc,EAAA;AAE1BA,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACS,IAAA,GAAM,WAAN,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9B,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,yBAAyB,CAAC,AAAsB,AAAC;AAGzE,MAAMC,YAAY;IAEvBC,YAEUC,WAAmB,EAEnBC,SAAmB,EAC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AAQ,EAAEC,IAAS,GAAK;YACxC,IAAIA,IAAI,CAACC,IAAI,IAAIF,GAAG,CAACE,IAAI,EAAE;gBACzB3B,GAAG,CAAC4B,GAAG,CACL,CAAC,4BAA4B,EAAEC,MAAK,QAAA,CAACC,IAAI,CACvCT,UAAU,CACX,CAAC,4CAA4C,CAAC,GAAG,CAAC,IAAI,CAACd,QAAQ,CAACwB,iBAAiB,IAAI,EAAE,CAAC,CAC1F,CAAC;aACH;SACF,AAAC;QAEF,MAAMC,OAAO,GAAGvB,CAAAA,GAAAA,GAAS,AAAoB,CAAA,UAApB,CAACM,QAAQ,EAAES,QAAQ,CAAC,AAAC;QAE9C,IAAI,CAAChB,WAAW,GAAG,IAAM;YACvBwB,OAAO,CAACC,KAAK,EAAE,CAAC;SACjB,CAAC;QAEF,OAAOlB,QAAQ,CAAC;KACjB;CACF;QA5DYZ,YAAY,GAAZA,YAAY"}
1
+ {"version":3,"sources":["../../../src/utils/FileNotifier.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { watchFile } from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport * as Log from '../log';\nimport { memoize } from './fn';\n\nconst debug = require('debug')('expo:utils:fileNotifier') as typeof console.log;\n\n/** Observes and reports file changes. */\nexport class FileNotifier {\n static instances: FileNotifier[] = [];\n\n static stopAll() {\n for (const instance of FileNotifier.instances) {\n instance.stopObserving();\n }\n }\n\n private unsubscribe: (() => void) | null = null;\n\n constructor(\n /** Project root to resolve the module IDs relative to. */\n private projectRoot: string,\n /** List of module IDs sorted by priority. Only the first file that exists will be observed. */\n private moduleIds: string[],\n private settings: {\n /** An additional warning message to add to the notice. */\n additionalWarning?: string;\n } = {}\n ) {\n FileNotifier.instances.push(this);\n }\n\n /** Get the file in the project. */\n private resolveFilePath(): string | null {\n for (const moduleId of this.moduleIds) {\n const filePath = resolveFrom.silent(this.projectRoot, moduleId);\n if (filePath) {\n return filePath;\n }\n }\n return null;\n }\n\n public startObserving(callback?: (cur: any, prev: any) => void) {\n const configPath = this.resolveFilePath();\n if (configPath) {\n debug(`Observing ${configPath}`);\n return this.watchFile(configPath, callback);\n }\n return configPath;\n }\n\n public stopObserving() {\n this.unsubscribe?.();\n }\n\n /** Watch the file and warn to reload the CLI if it changes. */\n public watchFile = memoize(this.startWatchingFile.bind(this));\n\n private startWatchingFile(filePath: string, callback?: (cur: any, prev: any) => void): string {\n const configName = path.relative(this.projectRoot, filePath);\n const listener = (cur: any, prev: any) => {\n if (prev.size || cur.size) {\n Log.log(\n `\\u203A Detected a change in ${chalk.bold(\n configName\n )}. Restart the server to see the new results.` + (this.settings.additionalWarning || '')\n );\n }\n };\n\n const watcher = watchFile(filePath, callback ?? listener);\n\n this.unsubscribe = () => {\n watcher.unref();\n };\n\n return filePath;\n }\n}\n"],"names":["Log","debug","require","FileNotifier","instances","stopAll","instance","stopObserving","constructor","projectRoot","moduleIds","settings","unsubscribe","watchFile","memoize","startWatchingFile","bind","push","resolveFilePath","moduleId","filePath","resolveFrom","silent","startObserving","callback","configPath","configName","path","relative","listener","cur","prev","size","log","chalk","bold","additionalWarning","watcher","unref"],"mappings":"AAAA;;;;AAAkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACC,IAAA,GAAI,WAAJ,IAAI,CAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;AACC,IAAA,YAAc,kCAAd,cAAc,EAAA;AAE1BA,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACS,IAAA,GAAM,WAAN,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9B,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,yBAAyB,CAAC,AAAsB,AAAC;AAGzE,MAAMC,YAAY;IACvB,OAAOC,SAAS,GAAmB,EAAE,CAAC;IAEtC,OAAOC,OAAO,GAAG;QACf,KAAK,MAAMC,QAAQ,IAAIH,YAAY,CAACC,SAAS,CAAE;YAC7CE,QAAQ,CAACC,aAAa,EAAE,C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B,EAAEI,QAAwC,EAAU;QAC5F,MAAME,UAAU,GAAGC,KAAI,QAAA,CAACC,QAAQ,CAAC,IAAI,CAACnB,WAAW,EAAEW,QAAQ,CAAC,AAAC;QAC7D,MAAMS,QAAQ,GAAG,CAACC,GAAQ,EAAEC,IAAS,GAAK;YACxC,IAAIA,IAAI,CAACC,IAAI,IAAIF,GAAG,CAACE,IAAI,EAAE;gBACzBhC,GAAG,CAACiC,GAAG,CACL,CAAC,4BAA4B,EAAEC,MAAK,QAAA,CAACC,IAAI,CACvCT,UAAU,CACX,CAAC,4CAA4C,CAAC,GAAG,CAAC,IAAI,CAACf,QAAQ,CAACyB,iBAAiB,IAAI,EAAE,CAAC,CAC1F,CAAC;aACH;SACF,AAAC;QAEF,MAAMC,OAAO,GAAGxB,CAAAA,GAAAA,GAAS,AAAgC,CAAA,UAAhC,CAACO,QAAQ,EAAEI,QAAQ,WAARA,QAAQ,GAAIK,QAAQ,CAAC,AAAC;QAE1D,IAAI,CAACjB,WAAW,GAAG,IAAM;YACvByB,OAAO,CAACC,KAAK,EAAE,CAAC;SACjB,CAAC;QAEF,OAAOlB,QAAQ,CAAC;KACjB;CACF;QAvEYjB,YAAY,GAAZA,YAAY"}
@@ -16,7 +16,7 @@ function getMetroProperties(projectRoot, exp, metroConfig = {}) {
16
16
  resolverConditionsByPlatform: (ref2 = metroConfig.resolver) == null ? void 0 : ref2.unstable_conditionsByPlatform,
17
17
  resolverEnablePackageExports: (ref3 = metroConfig.resolver) == null ? void 0 : ref3.unstable_enablePackageExports,
18
18
  serverImportBundleSupport: (ref4 = metroConfig.server) == null ? void 0 : ref4.experimentalImportBundleSupport,
19
- serverServerRoot: (ref5 = metroConfig.server) == null ? void 0 : ref5.unstable_serverRoot,
19
+ serverServerRoot: Boolean((ref5 = metroConfig.server) == null ? void 0 : ref5.unstable_serverRoot) || undefined,
20
20
  transformerCollectDependenciesPath: (ref6 = metroConfig.transformer) == null ? void 0 : ref6.unstable_collectDependenciesPath,
21
21
  transformerDependencyMapReservedName: (ref7 = metroConfig.transformer) == null ? void 0 : ref7.unstable_dependencyMapReservedName,
22
22
  transformerDisableModuleWrapping: (ref8 = metroConfig.transformer) == null ? void 0 : ref8.unstable_disableModuleWrapping,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utils/analytics/getMetroProperties.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { resolveMetroVersionFromProject } from '../../start/server/metro/resolveFromProject';\n\n/**\n * Get the unstable / experimental properties used within the Metro config.\n * Note that this should match `metro-config`, but uses newer features that are not yet typed.\n *\n * @see https://github.com/facebook/metro/blob/1d51ffd33f54dba25c54b49ff059543dac519f21/packages/metro-config/src/configTypes.flow.js\n */\nexport function getMetroProperties(\n projectRoot: string,\n exp: ExpoConfig,\n metroConfig: Record<string, any> = {}\n) {\n return {\n sdkVersion: exp.sdkVersion,\n metroVersion: resolveMetroVersionFromProject(projectRoot),\n\n fileMapCacheManagerFactory:\n Boolean(metroConfig.unstable_fileMapCacheManagerFactory) || undefined, // CacheManagerFactory\n perfLogger: Boolean(metroConfig.unstable_perfLogger) || undefined, // PerfLoggerFactory\n\n resolverEnableSymlinks: metroConfig.resolver?.unstable_enableSymlinks, // boolean\n resolverConditionNames: metroConfig.resolver?.unstable_conditionNames, // string[]\n resolverConditionsByPlatform: metroConfig.resolver?.unstable_conditionsByPlatform, // { [platform: string]: string[] }\n resolverEnablePackageExports: metroConfig.resolver?.unstable_enablePackageExports, // boolean\n\n serverImportBundleSupport: metroConfig.server?.experimentalImportBundleSupport, // boolean\n serverServerRoot: metroConfig.server?.unstable_serverRoot, // string | null\n\n transformerCollectDependenciesPath: metroConfig.transformer?.unstable_collectDependenciesPath, // string\n transformerDependencyMapReservedName:\n metroConfig.transformer?.unstable_dependencyMapReservedName, // string | null\n transformerDisableModuleWrapping: metroConfig.transformer?.unstable_disableModuleWrapping, // boolean\n transformerDisableNormalizePseudoGlobals:\n metroConfig.transformer?.unstable_disableNormalizePseudoGlobals, // boolean\n transformerCompactOutput: metroConfig.transformer?.unstable_compactOutput, // boolean\n transformerAllowRequireContext: metroConfig.transformer?.unstable_allowRequireContext, // boolean\n };\n}\n"],"names":["getMetroProperties","projectRoot","exp","metroConfig","sdkVersion","metroVersion","resolveMetroVersionFromProject","fileMapCacheManagerFactory","Boolean","unstable_fileMapCacheManagerFactory","undefined","perfLogger","unstable_perfLogger","resolverEnableSymlinks","resolver","unstable_enableSymlinks","resolverConditionNames","unstable_conditionNames","resolverConditionsByPlatform","unstable_conditionsByPlatform","resolverEnablePackageExports","unstable_enablePackageExports","serverImportBundleSupport","server","experimentalImportBundleSupport","serverServerRoot","unstable_serverRoot","transformerCollectDependenciesPath","transformer","unstable_collectDependenciesPath","transformerDependencyMapReservedName","unstable_dependencyMapReservedName","transformerDisableModuleWrapping","unstable_disableModuleWrapping","transformerDisableNormalizePseudoGlobals","unstable_disableNormalizePseudoGlobals","transformerCompactOutput","unstable_compactOutput","transformerAllowRequireContext","unstable_allowRequireContext"],"mappings":"AAAA;;;;QAUgBA,kBAAkB,GAAlBA,kBAAkB;AARa,IAAA,mBAA6C,WAA7C,6CAA6C,CAAA;AAQrF,SAASA,kBAAkB,CAChCC,WAAmB,EACnBC,GAAe,EACfC,WAAgC,GAAG,EAAE,EACrC;QAS0BA,GAAoB,EACpBA,IAAoB,EACdA,IAAoB,EACpBA,IAAoB,EAEvBA,IAAkB,EAC3BA,IAAkB,EAEAA,IAAuB,EAEzDA,IAAuB,EACSA,IAAuB,EAEvDA,IAAuB,EACCA,KAAuB,EACjBA,KAAuB;IAvBzD,OAAO;QACLC,UAAU,EAAEF,GAAG,CAACE,UAAU;QAC1BC,YAAY,EAAEC,CAAAA,GAAAA,mBAA8B,AAAa,CAAA,+BAAb,CAACL,WAAW,CAAC;QAEzDM,0BAA0B,EACxBC,OAAO,CAACL,WAAW,CAACM,mCAAmC,CAAC,IAAIC,SAAS;QACvEC,UAAU,EAAEH,OAAO,CAACL,WAAW,CAACS,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A,WAAW,CAACyB,WAAW,SAAwC,GAA/DzB,KAAAA,CAA+D,GAA/DA,IAAuB,CAAEgC,sCAAsC;QACjEC,wBAAwB,EAAEjC,CAAAA,KAAuB,GAAvBA,WAAW,CAACyB,WAAW,SAAwB,GAA/CzB,KAAAA,CAA+C,GAA/CA,KAAuB,CAAEkC,sBAAsB;QACzEC,8BAA8B,EAAEnC,CAAAA,KAAuB,GAAvBA,WAAW,CAACyB,WAAW,SAA8B,GAArDzB,KAAAA,CAAqD,GAArDA,KAAuB,CAAEoC,4BAA4B;KACtF,CAAC;CACH"}
1
+ {"version":3,"sources":["../../../../src/utils/analytics/getMetroProperties.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { resolveMetroVersionFromProject } from '../../start/server/metro/resolveFromProject';\n\n/**\n * Get the unstable / experimental properties used within the Metro config.\n * Note that this should match `metro-config`, but uses newer features that are not yet typed.\n *\n * @see https://github.com/facebook/metro/blob/1d51ffd33f54dba25c54b49ff059543dac519f21/packages/metro-config/src/configTypes.flow.js\n */\nexport function getMetroProperties(\n projectRoot: string,\n exp: ExpoConfig,\n metroConfig: Record<string, any> = {}\n) {\n return {\n sdkVersion: exp.sdkVersion,\n metroVersion: resolveMetroVersionFromProject(projectRoot),\n\n fileMapCacheManagerFactory:\n Boolean(metroConfig.unstable_fileMapCacheManagerFactory) || undefined, // CacheManagerFactory\n perfLogger: Boolean(metroConfig.unstable_perfLogger) || undefined, // PerfLoggerFactory\n\n resolverEnableSymlinks: metroConfig.resolver?.unstable_enableSymlinks, // boolean\n resolverConditionNames: metroConfig.resolver?.unstable_conditionNames, // string[]\n resolverConditionsByPlatform: metroConfig.resolver?.unstable_conditionsByPlatform, // { [platform: string]: string[] }\n resolverEnablePackageExports: metroConfig.resolver?.unstable_enablePackageExports, // boolean\n\n serverImportBundleSupport: metroConfig.server?.experimentalImportBundleSupport, // boolean\n serverServerRoot: Boolean(metroConfig.server?.unstable_serverRoot) || undefined, // string | null\n\n transformerCollectDependenciesPath: metroConfig.transformer?.unstable_collectDependenciesPath, // string\n transformerDependencyMapReservedName:\n metroConfig.transformer?.unstable_dependencyMapReservedName, // string | null\n transformerDisableModuleWrapping: metroConfig.transformer?.unstable_disableModuleWrapping, // boolean\n transformerDisableNormalizePseudoGlobals:\n metroConfig.transformer?.unstable_disableNormalizePseudoGlobals, // boolean\n transformerCompactOutput: metroConfig.transformer?.unstable_compactOutput, // boolean\n transformerAllowRequireContext: metroConfig.transformer?.unstable_allowRequireContext, // boolean\n };\n}\n"],"names":["getMetroProperties","projectRoot","exp","metroConfig","sdkVersion","metroVersion","resolveMetroVersionFromProject","fileMapCacheManagerFactory","Boolean","unstable_fileMapCacheManagerFactory","undefined","perfLogger","unstable_perfLogger","resolverEnableSymlinks","resolver","unstable_enableSymlinks","resolverConditionNames","unstable_conditionNames","resolverConditionsByPlatform","unstable_conditionsByPlatform","resolverEnablePackageExports","unstable_enablePackageExports","serverImportBundleSupport","server","experimentalImportBundleSupport","serverServerRoot","unstable_serverRoot","transformerCollectDependenciesPath","transformer","unstable_collectDependenciesPath","transformerDependencyMapReservedName","unstable_dependencyMapReservedName","transformerDisableModuleWrapping","unstable_disableModuleWrapping","transformerDisableNormalizePseudoGlobals","unstable_disableNormalizePseudoGlobals","transformerCompactOutput","unstable_compactOutput","transformerAllowRequireContext","unstable_allowRequireContext"],"mappings":"AAAA;;;;QAUgBA,kBAAkB,GAAlBA,kBAAkB;AARa,IAAA,mBAA6C,WAA7C,6CAA6C,CAAA;AAQrF,SAASA,kBAAkB,CAChCC,WAAmB,EACnBC,GAAe,EACfC,WAAgC,GAAG,EAAE,EACrC;QAS0BA,GAAoB,EACpBA,IAAoB,EACdA,IAAoB,EACpBA,IAAoB,EAEvBA,IAAkB,EACnBA,IAAkB,EAERA,IAAuB,EAEzDA,IAAuB,EACSA,IAAuB,EAEvDA,IAAuB,EACCA,KAAuB,EACjBA,KAAuB;IAvBzD,OAAO;QACLC,UAAU,EAAEF,GAAG,CAACE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AW,SAAoC,GAA3DzB,KAAAA,CAA2D,GAA3DA,IAAuB,CAAE4B,kCAAkC;QAC7DC,gCAAgC,EAAE7B,CAAAA,IAAuB,GAAvBA,WAAW,CAACyB,WAAW,SAAgC,GAAvDzB,KAAAA,CAAuD,GAAvDA,IAAuB,CAAE8B,8BAA8B;QACzFC,wCAAwC,EACtC/B,CAAAA,IAAuB,GAAvBA,WAAW,CAACyB,WAAW,SAAwC,GAA/DzB,KAAAA,CAA+D,GAA/DA,IAAuB,CAAEgC,sCAAsC;QACjEC,wBAAwB,EAAEjC,CAAAA,KAAuB,GAAvBA,WAAW,CAACyB,WAAW,SAAwB,GAA/CzB,KAAAA,CAA+C,GAA/CA,KAAuB,CAAEkC,sBAAsB;QACzEC,8BAA8B,EAAEnC,CAAAA,KAAuB,GAAvBA,WAAW,CAACyB,WAAW,SAA8B,GAArDzB,KAAAA,CAAqD,GAArDA,KAAuB,CAAEoC,4BAA4B;KACtF,CAAC;CACH"}
@@ -94,7 +94,7 @@ async function logEventAsync(event, properties = {}) {
94
94
  }
95
95
  const { userId , deviceId } = identifyData;
96
96
  const commonEventProperties = {
97
- source_version: "0.7.3",
97
+ source_version: "0.9.0",
98
98
  source: "expo"
99
99
  };
100
100
  const identity = {
@@ -135,7 +135,7 @@ function getContext() {
135
135
  },
136
136
  app: {
137
137
  name: "expo",
138
- version: "0.7.3"
138
+ version: "0.9.0"
139
139
  },
140
140
  ci: ciInfo.isCI ? {
141
141
  name: ciInfo.name,
@@ -14,8 +14,12 @@ var _path = _interopRequireDefault(require("path"));
14
14
  var _structuredHeaders = require("structured-headers");
15
15
  var _getExpoGoIntermediateCertificate = require("../api/getExpoGoIntermediateCertificate");
16
16
  var _getProjectDevelopmentCertificate = require("../api/getProjectDevelopmentCertificate");
17
+ var _appQuery = require("../api/graphql/queries/AppQuery");
17
18
  var _settings = require("../api/settings");
19
+ var _actions = require("../api/user/actions");
20
+ var _generated = require("../graphql/generated");
18
21
  var Log = _interopRequireWildcard(require("../log"));
22
+ var _link = require("../utils/link");
19
23
  var _errors = require("./errors");
20
24
  function _interopRequireDefault(obj) {
21
25
  return obj && obj.__esModule ? obj : {
@@ -43,7 +47,7 @@ function _interopRequireWildcard(obj) {
43
47
  return newObj;
44
48
  }
45
49
  }
46
- const DEVELOPMENT_CODE_SIGNING_SETTINGS_FILE_NAME = "development-code-signing-settings.json";
50
+ const DEVELOPMENT_CODE_SIGNING_SETTINGS_FILE_NAME = "development-code-signing-settings-2.json";
47
51
  function getDevelopmentCodeSigningDirectory() {
48
52
  return _path.default.join((0, _getUserState).getExpoHomeDirectory(), "codesigning");
49
53
  }
@@ -89,6 +93,7 @@ function getProjectDevelopmentCodeSigningInfoFile(defaults) {
89
93
  }
90
94
  const DevelopmentCodeSigningInfoFile = getProjectDevelopmentCodeSigningInfoFile({
91
95
  easProjectId: null,
96
+ scopeKey: null,
92
97
  privateKey: null,
93
98
  certificateChain: null
94
99
  });
@@ -137,7 +142,7 @@ async function getCodeSigningInfoAsync(exp, expectSignatureHeader, privateKeyPat
137
142
  // can't check for scope key validity since scope key is derived on the server from projectId and we may be offline.
138
143
  // we rely upon the client certificate check to validate the scope key
139
144
  if (!easProjectId) {
140
- Log.warn("No project ID specified in app.json, unable to sign manifest");
145
+ Log.warn(`Expo Application Services (EAS) is not configured for your project. Configuring EAS enables a more secure development experience amongst many other benefits. ${(0, _link).learnMore("https://docs.expo.dev/eas/")}`);
141
146
  return null;
142
147
  }
143
148
  const developmentCodeSigningInfoFromFile = await DevelopmentCodeSigningInfoFile.readAsync(easProjectId);
@@ -152,6 +157,7 @@ async function getCodeSigningInfoAsync(exp, expectSignatureHeader, privateKeyPat
152
157
  Log.warn("There was an error fetching the Expo development certificate, falling back to cached certificate");
153
158
  return validatedCodeSigningInfo;
154
159
  } else {
160
+ // need to return null here and say a message
155
161
  throw e;
156
162
  }
157
163
  }
@@ -197,7 +203,8 @@ async function getCodeSigningInfoAsync(exp, expectSignatureHeader, privateKeyPat
197
203
  keyId: keyid,
198
204
  privateKey: privateKeyPEM,
199
205
  certificateForPrivateKey: certificatePEM,
200
- certificateChainForResponse: []
206
+ certificateChainForResponse: [],
207
+ scopeKey: null
201
208
  };
202
209
  }
203
210
  async function readFileWithErrorAsync(path, errorMessage) {
@@ -230,7 +237,7 @@ async function getProjectPrivateKeyAndCertificateFromFilePathsAsync({ codeSignin
230
237
  if (codeSigningInfo.easProjectId !== easProjectId) {
231
238
  return null;
232
239
  }
233
- const { privateKey: privateKeyPEM , certificateChain: certificatePEMs } = codeSigningInfo;
240
+ const { privateKey: privateKeyPEM , certificateChain: certificatePEMs , scopeKey , } = codeSigningInfo;
234
241
  if (!privateKeyPEM || !certificatePEMs) {
235
242
  return null;
236
243
  }
@@ -242,15 +249,30 @@ async function getProjectPrivateKeyAndCertificateFromFilePathsAsync({ codeSignin
242
249
  if (leafCertificate.validity.notBefore > now || leafCertificate.validity.notAfter < now) {
243
250
  return null;
244
251
  }
245
- // TODO(wschurman): maybe do more validation
252
+ // TODO(wschurman): maybe do more validation, like validation of projectID and scopeKey within eas certificate extension
246
253
  return {
247
254
  keyId: "expo-go",
248
255
  certificateChainForResponse: certificatePEMs,
249
256
  certificateForPrivateKey: certificatePEMs[0],
250
- privateKey: privateKeyPEM
257
+ privateKey: privateKeyPEM,
258
+ scopeKey
251
259
  };
252
260
  }
261
+ function actorCanGetProjectDevelopmentCertificate(actor, app) {
262
+ var ref, ref3, ref4, ref5;
263
+ const owningAccountId = app.ownerAccount.id;
264
+ const owningAccountIsActorPrimaryAccount = actor.__typename === "User" || actor.__typename === "SSOUser" ? actor.primaryAccount.id === owningAccountId : false;
265
+ const userHasPublishPermissionForOwningAccount = !!((ref4 = (ref = actor.accounts.find((account)=>account.id === owningAccountId
266
+ )) == null ? void 0 : (ref3 = ref.users) == null ? void 0 : ref3.find((userPermission)=>userPermission.actor.id === actor.id
267
+ )) == null ? void 0 : (ref5 = ref4.permissions) == null ? void 0 : ref5.includes(_generated.Permission.Publish));
268
+ return owningAccountIsActorPrimaryAccount || userHasPublishPermissionForOwningAccount;
269
+ }
253
270
  async function fetchAndCacheNewDevelopmentCodeSigningInfoAsync(easProjectId) {
271
+ const actor = await (0, _actions).ensureLoggedInAsync();
272
+ const app = await _appQuery.AppQuery.byIdAsync(easProjectId);
273
+ if (!actorCanGetProjectDevelopmentCertificate(actor, app)) {
274
+ return null;
275
+ }
254
276
  const keyPair = (0, _codeSigningCertificates).generateKeyPair();
255
277
  const keyPairPEM = (0, _codeSigningCertificates).convertKeyPairToPEM(keyPair);
256
278
  const csr = (0, _codeSigningCertificates).generateCSR(keyPair, `Development Certificate for ${easProjectId}`);
@@ -261,6 +283,7 @@ async function fetchAndCacheNewDevelopmentCodeSigningInfoAsync(easProjectId) {
261
283
  ]);
262
284
  await DevelopmentCodeSigningInfoFile.setAsync(easProjectId, {
263
285
  easProjectId,
286
+ scopeKey: app.scopeKey,
264
287
  privateKey: keyPairPEM.privateKeyPEM,
265
288
  certificateChain: [
266
289
  developmentSigningCertificate,
@@ -274,7 +297,8 @@ async function fetchAndCacheNewDevelopmentCodeSigningInfoAsync(easProjectId) {
274
297
  expoGoIntermediateCertificate
275
298
  ],
276
299
  certificateForPrivateKey: developmentSigningCertificate,
277
- privateKey: keyPairPEM.privateKeyPEM
300
+ privateKey: keyPairPEM.privateKeyPEM,
301
+ scopeKey: app.scopeKey
278
302
  };
279
303
  }
280
304
  function signManifestString(stringifiedManifest, codeSigningInfo) {