@expo/cli 0.16.2 → 0.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +2 -2
- package/build/src/start/server/metro/MetroBundlerDevServer.js +8 -16
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/bundleApiRoutes.js +3 -4
- package/build/src/start/server/metro/bundleApiRoutes.js.map +1 -1
- package/build/src/start/server/metro/router.js +0 -4
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +13 -21
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/package.json +4 -4
package/build/bin/cli
CHANGED
|
@@ -137,7 +137,7 @@ const args = (0, _arg).default({
|
|
|
137
137
|
});
|
|
138
138
|
if (args["--version"]) {
|
|
139
139
|
// Version is added in the build script.
|
|
140
|
-
console.log("0.16.
|
|
140
|
+
console.log("0.16.3");
|
|
141
141
|
process.exit(0);
|
|
142
142
|
}
|
|
143
143
|
if (args["--non-interactive"]) {
|
|
@@ -271,7 +271,7 @@ commands[command]().then((exec)=>{
|
|
|
271
271
|
logEventAsync("action", {
|
|
272
272
|
action: `expo ${command}`,
|
|
273
273
|
source: "expo/cli",
|
|
274
|
-
source_version: "0.16.
|
|
274
|
+
source_version: "0.16.3"
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
277
|
});
|
|
@@ -372,24 +372,16 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
372
372
|
}
|
|
373
373
|
}));
|
|
374
374
|
if (((ref2 = exp.web) == null ? void 0 : ref2.output) === "server") {
|
|
375
|
-
//
|
|
376
|
-
|
|
375
|
+
// NOTE(EvanBacon): We aren't sure what files the API routes are using so we'll just invalidate
|
|
376
|
+
// aggressively to ensure we always have the latest. The only caching we really get here is for
|
|
377
|
+
// cases where the user is making subsequent requests to the same API route without changing anything.
|
|
378
|
+
// This is useful for testing but pretty suboptimal. Luckily our caching is pretty aggressive so it makes
|
|
379
|
+
// up for a lot of the overhead.
|
|
380
|
+
(0, _waitForMetroToObserveTypeScriptFile).observeAnyFileChanges({
|
|
377
381
|
metro,
|
|
378
382
|
server
|
|
379
|
-
},
|
|
380
|
-
|
|
381
|
-
debug(`[expo-cli] ${op} ${filepath}`);
|
|
382
|
-
if (op === "change" || op === "add") {
|
|
383
|
-
(0, _bundleApiRoutes).rebundleApiRoute(this.projectRoot, filepath, {
|
|
384
|
-
...options,
|
|
385
|
-
routerRoot,
|
|
386
|
-
baseUrl
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
if (op === "delete") {
|
|
390
|
-
// TODO: Cancel the bundling of the deleted route.
|
|
391
|
-
}
|
|
392
|
-
}
|
|
383
|
+
}, ()=>{
|
|
384
|
+
(0, _bundleApiRoutes).invalidateApiRouteCache();
|
|
393
385
|
});
|
|
394
386
|
}
|
|
395
387
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/MetroBundlerDevServer.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getConfig } from '@expo/config';\nimport * as runtimeEnv from '@expo/env';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport { AssetData } from 'metro';\nimport fetch from 'node-fetch';\nimport path from 'path';\n\nimport { bundleApiRoute, rebundleApiRoute } from './bundleApiRoutes';\nimport { createRouteHandlerMiddleware } from './createServerRouteMiddleware';\nimport { ExpoRouterServerManifestV1, fetchManifest } from './fetchRouterManifest';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport { getRouterDirectoryModuleIdWithManifest, isApiRouteConvention } from './router';\nimport { serializeHtmlWithAssets } from './serializeHtml';\nimport { observeApiRouteChanges, observeFileChanges } from './waitForMetroToObserveTypeScriptFile';\nimport { ExportAssetMap } from '../../../export/saveAssets';\nimport { Log } from '../../../log';\nimport getDevClientProperties from '../../../utils/analytics/getDevClientProperties';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { CommandError } from '../../../utils/errors';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport { getStaticRenderFunctions } from '../getStaticRenderFunctions';\nimport { ContextModuleSourceMapsMiddleware } from '../middleware/ContextModuleSourceMapsMiddleware';\nimport { CreateFileMiddleware } from '../middleware/CreateFileMiddleware';\nimport { DevToolsPluginMiddleware } from '../middleware/DevToolsPluginMiddleware';\nimport { FaviconMiddleware } from '../middleware/FaviconMiddleware';\nimport { HistoryFallbackMiddleware } from '../middleware/HistoryFallbackMiddleware';\nimport { InterstitialPageMiddleware } from '../middleware/InterstitialPageMiddleware';\nimport { resolveMainModuleName } from '../middleware/ManifestMiddleware';\nimport { ReactDevToolsPageMiddleware } from '../middleware/ReactDevToolsPageMiddleware';\nimport {\n DeepLinkHandler,\n RuntimeRedirectMiddleware,\n} from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport {\n shouldEnableAsyncImports,\n createBundleUrlPath,\n getBaseUrlFromExpoConfig,\n getAsyncRoutesFromExpoConfig,\n} from '../middleware/metroOptions';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { startTypescriptTypeGenerationAsync } from '../type-generation/startTypescriptTypeGeneration';\n\nexport type ExpoRouterRuntimeManifest = Awaited<\n ReturnType<typeof import('expo-router/build/static/renderStaticContent').getManifest>\n>;\n\nexport class ForwardHtmlError extends CommandError {\n constructor(\n message: string,\n public html: string,\n public statusCode: number\n ) {\n super(message);\n }\n}\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\n/** Default port to use for apps running in Expo Go. */\nconst EXPO_GO_METRO_PORT = 8081;\n\n/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */\nconst DEV_CLIENT_METRO_PORT = 8081;\n\nexport class MetroBundlerDevServer extends BundlerDevServer {\n private metro: import('metro').Server | null = null;\n\n get name(): string {\n return 'metro';\n }\n\n async resolvePortAsync(options: Partial<BundlerStartOptions> = {}): Promise<number> {\n const port =\n // If the manually defined port is busy then an error should be thrown...\n options.port ??\n // Otherwise use the default port based on the runtime target.\n (options.devClient\n ? // Don't check if the port is busy if we're using the dev client since most clients are hardcoded to 8081.\n Number(process.env.RCT_METRO_PORT) || DEV_CLIENT_METRO_PORT\n : // Otherwise (running in Expo Go) use a free port that falls back on the classic 8081 port.\n await getFreePortAsync(EXPO_GO_METRO_PORT));\n\n return port;\n }\n\n async exportExpoRouterApiRoutesAsync({\n mode,\n outputDir,\n prerenderManifest,\n baseUrl,\n routerRoot,\n }: {\n mode: 'development' | 'production';\n outputDir: string;\n // This does not contain the API routes info.\n prerenderManifest: ExpoRouterServerManifestV1;\n baseUrl: string;\n routerRoot: string;\n }): Promise<{ files: ExportAssetMap; manifest: ExpoRouterServerManifestV1<string> }> {\n const appDir = path.join(this.projectRoot, routerRoot);\n const manifest = await this.getExpoRouterRoutesManifestAsync({ appDir });\n\n const files: ExportAssetMap = new Map();\n\n for (const route of manifest.apiRoutes) {\n const filepath = path.join(appDir, route.file);\n const contents = await bundleApiRoute(this.projectRoot, filepath, {\n mode,\n routerRoot,\n port: this.getInstance()?.location.port,\n shouldThrow: true,\n baseUrl,\n });\n const artifactFilename = path.join(\n outputDir,\n path.relative(appDir, filepath.replace(/\\.[tj]sx?$/, '.js'))\n );\n if (contents) {\n files.set(artifactFilename, {\n contents,\n targetDomain: 'server',\n });\n }\n // Remap the manifest files to represent the output files.\n route.file = artifactFilename;\n }\n\n return {\n manifest: {\n ...manifest,\n htmlRoutes: prerenderManifest.htmlRoutes,\n },\n files,\n };\n }\n\n async getExpoRouterRoutesManifestAsync({ appDir }: { appDir: string }) {\n // getBuiltTimeServerManifest\n const manifest = await fetchManifest(this.projectRoot, {\n asJson: true,\n appDir,\n });\n\n if (!manifest) {\n throw new CommandError(\n 'EXPO_ROUTER_SERVER_MANIFEST',\n 'Unexpected error: server manifest could not be fetched.'\n );\n }\n\n return manifest;\n }\n\n async getStaticRenderFunctionAsync({\n mode,\n minify = mode !== 'development',\n baseUrl,\n routerRoot,\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n baseUrl: string;\n routerRoot: string;\n }): Promise<{\n serverManifest: ExpoRouterServerManifestV1;\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (path: string) => Promise<string>;\n }> {\n const url = this.getDevServerUrl()!;\n\n const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } =\n await getStaticRenderFunctions(this.projectRoot, url, {\n minify,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n baseUrl,\n routerRoot,\n });\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync(),\n // Get routes from Expo Router.\n manifest: await getManifest({ fetchData: true, preserveApiRoutes: false }),\n // Get route generating function\n async renderAsync(path: string) {\n return await getStaticContent(new URL(path, url));\n },\n };\n }\n\n async getStaticResourcesAsync({\n mode,\n minify = mode !== 'development',\n includeSourceMaps,\n baseUrl,\n mainModuleName,\n isExporting,\n asyncRoutes,\n routerRoot,\n }: {\n isExporting: boolean;\n mode: string;\n minify?: boolean;\n includeSourceMaps?: boolean;\n baseUrl?: string;\n mainModuleName?: string;\n asyncRoutes: boolean;\n routerRoot: string;\n }): Promise<{ artifacts: SerialAsset[]; assets?: AssetData[] }> {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n minify,\n environment: 'client',\n serializerOutput: 'static',\n serializerIncludeMaps: includeSourceMaps,\n mainModuleName:\n mainModuleName ?? resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n asyncRoutes,\n baseUrl,\n isExporting,\n routerRoot,\n });\n\n const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl()!);\n\n // Fetch the generated HTML from our custom Metro serializer\n const results = await fetch(bundleUrl.toString());\n\n const txt = await results.text();\n\n let data: any;\n try {\n data = JSON.parse(txt);\n } catch (error: any) {\n debug(txt);\n\n // Metro can throw this error when the initial module id cannot be resolved.\n if (!results.ok && txt.startsWith('<!DOCTYPE html>')) {\n throw new ForwardHtmlError(\n `Metro failed to bundle the project. Check the console for more information.`,\n txt,\n results.status\n );\n }\n\n Log.error(\n 'Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.'\n );\n throw error;\n }\n\n // NOTE: This could potentially need more validation in the future.\n if ('artifacts' in data && Array.isArray(data.artifacts)) {\n return data;\n }\n\n if (data != null && (data.errors || data.type?.match(/.*Error$/))) {\n // {\n // type: 'InternalError',\n // errors: [],\n // message: 'Metro has encountered an error: While trying to resolve module `stylis` from file `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js`, the package `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs`. Indeed, none of these files exist:\\n' +\n // '\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs/index(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css): /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/metro/src/node-haste/DependencyGraph.js (289:17)\\n' +\n // '\\n' +\n // '\\x1B[0m \\x1B[90m 287 |\\x1B[39m }\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 288 |\\x1B[39m \\x1B[36mif\\x1B[39m (error \\x1B[36minstanceof\\x1B[39m \\x1B[33mInvalidPackageError\\x1B[39m) {\\x1B[0m\\n' +\n // '\\x1B[0m\\x1B[31m\\x1B[1m>\\x1B[22m\\x1B[39m\\x1B[90m 289 |\\x1B[39m \\x1B[36mthrow\\x1B[39m \\x1B[36mnew\\x1B[39m \\x1B[33mPackageResolutionError\\x1B[39m({\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m |\\x1B[39m \\x1B[31m\\x1B[1m^\\x1B[22m\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 290 |\\x1B[39m packageError\\x1B[33m:\\x1B[39m error\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 291 |\\x1B[39m originModulePath\\x1B[33m:\\x1B[39m \\x1B[36mfrom\\x1B[39m\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 292 |\\x1B[39m targetModuleName\\x1B[33m:\\x1B[39m to\\x1B[33m,\\x1B[39m\\x1B[0m'\n // }\n // The Metro logger already showed this error.\n throw new Error(data.message);\n }\n\n throw new Error(\n 'Invalid resources returned from the Metro serializer. Expected array, found: ' + data\n );\n }\n\n private async getStaticPageAsync(\n pathname: string,\n {\n mode,\n minify = mode !== 'development',\n baseUrl,\n routerRoot,\n isExporting,\n asyncRoutes,\n }: {\n isExporting: boolean;\n mode: 'development' | 'production';\n minify?: boolean;\n baseUrl: string;\n asyncRoutes: boolean;\n routerRoot: string;\n }\n ) {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n environment: 'client',\n mainModuleName: resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n baseUrl,\n isExporting,\n asyncRoutes,\n routerRoot,\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await getStaticRenderFunctions(\n this.projectRoot,\n this.getDevServerUrl()!,\n {\n minify: false,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n baseUrl,\n routerRoot,\n }\n );\n\n const location = new URL(pathname, this.getDevServerUrl()!);\n return await getStaticContent(location);\n };\n\n const [{ artifacts: resources }, staticHtml] = await Promise.all([\n this.getStaticResourcesAsync({ isExporting, mode, minify, baseUrl, asyncRoutes, routerRoot }),\n bundleStaticHtml(),\n ]);\n const content = serializeHtmlWithAssets({\n mode,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n baseUrl,\n });\n return {\n content,\n resources,\n };\n }\n\n async watchEnvironmentVariables() {\n if (!this.instance) {\n throw new Error(\n 'Cannot observe environment variable changes without a running Metro instance.'\n );\n }\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process.\n debug('Skipping Environment Variable observation because Metro is not running (headless).');\n return;\n }\n\n const envFiles = runtimeEnv\n .getFiles(process.env.NODE_ENV)\n .map((fileName) => path.join(this.projectRoot, fileName));\n\n observeFileChanges(\n {\n metro: this.metro,\n server: this.instance.server,\n },\n envFiles,\n () => {\n debug('Reloading environment variables...');\n // Force reload the environment variables.\n runtimeEnv.load(this.projectRoot, { force: true });\n }\n );\n }\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n options.port = await this.resolvePortAsync(options);\n this.urlCreator = this.getUrlCreator(options);\n\n const parsedOptions = {\n port: options.port,\n maxWorkers: options.maxWorkers,\n resetCache: options.resetDevServer,\n };\n\n // Required for symbolication:\n process.env.EXPO_DEV_SERVER_ORIGIN = `http://localhost:${options.port}`;\n\n const { metro, server, middleware, messageSocket } = await instantiateMetroAsync(\n this,\n parsedOptions,\n {\n isExporting: !!options.isExporting,\n }\n );\n\n const manifestMiddleware = await this.getManifestMiddlewareAsync(options);\n\n // Important that we noop source maps for context modules as soon as possible.\n prependMiddleware(middleware, new ContextModuleSourceMapsMiddleware().getHandler());\n\n // We need the manifest handler to be the first middleware to run so our\n // routes take precedence over static files. For example, the manifest is\n // served from '/' and if the user has an index.html file in their project\n // then the manifest handler will never run, the static middleware will run\n // and serve index.html instead of the manifest.\n // https://github.com/expo/expo/issues/13114\n prependMiddleware(middleware, manifestMiddleware.getHandler());\n\n middleware.use(\n new InterstitialPageMiddleware(this.projectRoot, {\n // TODO: Prevent this from becoming stale.\n scheme: options.location.scheme ?? null,\n }).getHandler()\n );\n middleware.use(new ReactDevToolsPageMiddleware(this.projectRoot).getHandler());\n middleware.use(\n new DevToolsPluginMiddleware(this.projectRoot, this.devToolsPluginManager).getHandler()\n );\n\n const deepLinkMiddleware = new RuntimeRedirectMiddleware(this.projectRoot, {\n onDeepLink: getDeepLinkHandler(this.projectRoot),\n getLocation: ({ runtime }) => {\n if (runtime === 'custom') {\n return this.urlCreator?.constructDevClientUrl();\n } else {\n return this.urlCreator?.constructUrl({\n scheme: 'exp',\n });\n }\n },\n });\n middleware.use(deepLinkMiddleware.getHandler());\n\n middleware.use(new CreateFileMiddleware(this.projectRoot).getHandler());\n\n // Append support for redirecting unhandled requests to the index.html page on web.\n if (this.isTargetingWeb()) {\n const { exp } = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\n // This MUST be after the manifest middleware so it doesn't have a chance to serve the template `public/index.html`.\n middleware.use(new ServeStaticMiddleware(this.projectRoot).getHandler());\n\n // This should come after the static middleware so it doesn't serve the favicon from `public/favicon.ico`.\n middleware.use(new FaviconMiddleware(this.projectRoot).getHandler());\n\n if (useServerRendering) {\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n const asyncRoutes = getAsyncRoutesFromExpoConfig(exp, options.mode ?? 'development', 'web');\n const routerRoot = getRouterDirectoryModuleIdWithManifest(this.projectRoot, exp);\n const appDir = path.join(this.projectRoot, routerRoot);\n middleware.use(\n createRouteHandlerMiddleware(this.projectRoot, {\n ...options,\n appDir,\n baseUrl,\n routerRoot,\n getWebBundleUrl: manifestMiddleware.getWebBundleUrl.bind(manifestMiddleware),\n getStaticPageAsync: (pathname) => {\n return this.getStaticPageAsync(pathname, {\n isExporting: !!options.isExporting,\n mode: options.mode ?? 'development',\n minify: options.minify,\n baseUrl,\n asyncRoutes,\n routerRoot,\n });\n },\n })\n );\n\n if (exp.web?.output === 'server') {\n // Cache observation for API Routes...\n observeApiRouteChanges(\n appDir,\n {\n metro,\n server,\n },\n async (filepath, op) => {\n if (isApiRouteConvention(filepath)) {\n debug(`[expo-cli] ${op} ${filepath}`);\n if (op === 'change' || op === 'add') {\n rebundleApiRoute(this.projectRoot, filepath, {\n ...options,\n routerRoot,\n baseUrl,\n });\n }\n\n if (op === 'delete') {\n // TODO: Cancel the bundling of the deleted route.\n }\n }\n }\n );\n }\n } else {\n // This MUST run last since it's the fallback.\n middleware.use(\n new HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler()\n );\n }\n }\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n this.metro = null;\n callback?.(err);\n });\n };\n\n this.metro = metro;\n return {\n server,\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware,\n messageSocket,\n };\n }\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n if (!this.instance) {\n throw new Error('Cannot wait for TypeScript without a running server.');\n }\n\n return new Promise<boolean>((resolve) => {\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process. In this case we can't wait for the TypeScript check to complete because we don't\n // have access to the Metro server.\n debug('Skipping TypeScript check because Metro is not running (headless).');\n return resolve(false);\n }\n\n const off = metroWatchTypeScriptFiles({\n projectRoot: this.projectRoot,\n server: this.instance!.server,\n metro: this.metro,\n tsconfig: true,\n throttle: true,\n eventTypes: ['change', 'add'],\n callback: async () => {\n // Run once, this prevents the TypeScript project prerequisite from running on every file change.\n off();\n const { TypeScriptProjectPrerequisite } = await import(\n '../../doctor/typescript/TypeScriptProjectPrerequisite.js'\n );\n\n try {\n const req = new TypeScriptProjectPrerequisite(this.projectRoot);\n await req.bootstrapAsync();\n resolve(true);\n } catch (error: any) {\n // Ensure the process doesn't fail if the TypeScript check fails.\n // This could happen during the install.\n Log.log();\n Log.error(\n chalk.red`Failed to automatically setup TypeScript for your project. Try restarting the dev server to fix.`\n );\n Log.exception(error);\n resolve(false);\n }\n },\n });\n });\n }\n\n public async startTypeScriptServices() {\n return startTypescriptTypeGenerationAsync({\n server: this.instance?.server,\n metro: this.metro,\n projectRoot: this.projectRoot,\n });\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./metro.config.js', './metro.config.json', './rn-cli.config.js'];\n }\n}\n\nexport function getDeepLinkHandler(projectRoot: string): DeepLinkHandler {\n return async ({ runtime }) => {\n if (runtime === 'expo') return;\n const { exp } = getConfig(projectRoot);\n await logEventAsync('dev client start command', {\n status: 'started',\n ...getDevClientProperties(projectRoot, exp),\n });\n };\n}\n"],"names":["getDeepLinkHandler","runtimeEnv","ForwardHtmlError","CommandError","constructor","message","html","statusCode","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","MetroBundlerDevServer","BundlerDevServer","metro","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","exportExpoRouterApiRoutesAsync","mode","outputDir","prerenderManifest","baseUrl","routerRoot","appDir","path","join","projectRoot","manifest","getExpoRouterRoutesManifestAsync","files","Map","route","apiRoutes","filepath","file","contents","bundleApiRoute","getInstance","location","shouldThrow","artifactFilename","relative","replace","set","targetDomain","htmlRoutes","fetchManifest","asJson","getStaticRenderFunctionAsync","minify","url","getDevServerUrl","getStaticContent","getManifest","getBuildTimeServerManifestAsync","getStaticRenderFunctions","dev","environment","serverManifest","fetchData","preserveApiRoutes","renderAsync","URL","getStaticResourcesAsync","includeSourceMaps","mainModuleName","isExporting","asyncRoutes","data","devBundleUrlPathname","createBundleUrlPath","platform","serializerOutput","serializerIncludeMaps","resolveMainModuleName","lazy","shouldEnableAsyncImports","bundleUrl","results","fetch","toString","txt","text","JSON","parse","error","ok","startsWith","status","Log","Array","isArray","artifacts","errors","type","match","Error","getStaticPageAsync","pathname","bundleStaticHtml","resources","staticHtml","Promise","all","content","serializeHtmlWithAssets","template","devBundleUrl","watchEnvironmentVariables","instance","envFiles","getFiles","NODE_ENV","map","fileName","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","parsedOptions","maxWorkers","resetCache","resetDevServer","EXPO_DEV_SERVER_ORIGIN","middleware","messageSocket","instantiateMetroAsync","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","ReactDevToolsPageMiddleware","DevToolsPluginMiddleware","devToolsPluginManager","deepLinkMiddleware","RuntimeRedirectMiddleware","onDeepLink","getLocation","runtime","constructDevClientUrl","constructUrl","CreateFileMiddleware","isTargetingWeb","exp","getConfig","skipSDKVersionRequirement","useServerRendering","includes","web","output","ServeStaticMiddleware","FaviconMiddleware","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getRouterDirectoryModuleIdWithManifest","createRouteHandlerMiddleware","getWebBundleUrl","bind","observeApiRouteChanges","op","isApiRouteConvention","rebundleApiRoute","HistoryFallbackMiddleware","internal","originalClose","close","callback","err","host","protocol","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","req","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypesc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5C,CAAC,CAAC;KACJ,CAAC;CACH"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/MetroBundlerDevServer.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getConfig } from '@expo/config';\nimport * as runtimeEnv from '@expo/env';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport { AssetData } from 'metro';\nimport fetch from 'node-fetch';\nimport path from 'path';\n\nimport { bundleApiRoute, invalidateApiRouteCache } from './bundleApiRoutes';\nimport { createRouteHandlerMiddleware } from './createServerRouteMiddleware';\nimport { ExpoRouterServerManifestV1, fetchManifest } from './fetchRouterManifest';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport { getRouterDirectoryModuleIdWithManifest } from './router';\nimport { serializeHtmlWithAssets } from './serializeHtml';\nimport { observeAnyFileChanges, observeFileChanges } from './waitForMetroToObserveTypeScriptFile';\nimport { ExportAssetMap } from '../../../export/saveAssets';\nimport { Log } from '../../../log';\nimport getDevClientProperties from '../../../utils/analytics/getDevClientProperties';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { CommandError } from '../../../utils/errors';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport { getStaticRenderFunctions } from '../getStaticRenderFunctions';\nimport { ContextModuleSourceMapsMiddleware } from '../middleware/ContextModuleSourceMapsMiddleware';\nimport { CreateFileMiddleware } from '../middleware/CreateFileMiddleware';\nimport { DevToolsPluginMiddleware } from '../middleware/DevToolsPluginMiddleware';\nimport { FaviconMiddleware } from '../middleware/FaviconMiddleware';\nimport { HistoryFallbackMiddleware } from '../middleware/HistoryFallbackMiddleware';\nimport { InterstitialPageMiddleware } from '../middleware/InterstitialPageMiddleware';\nimport { resolveMainModuleName } from '../middleware/ManifestMiddleware';\nimport { ReactDevToolsPageMiddleware } from '../middleware/ReactDevToolsPageMiddleware';\nimport {\n DeepLinkHandler,\n RuntimeRedirectMiddleware,\n} from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport {\n shouldEnableAsyncImports,\n createBundleUrlPath,\n getBaseUrlFromExpoConfig,\n getAsyncRoutesFromExpoConfig,\n} from '../middleware/metroOptions';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { startTypescriptTypeGenerationAsync } from '../type-generation/startTypescriptTypeGeneration';\n\nexport type ExpoRouterRuntimeManifest = Awaited<\n ReturnType<typeof import('expo-router/build/static/renderStaticContent').getManifest>\n>;\n\nexport class ForwardHtmlError extends CommandError {\n constructor(\n message: string,\n public html: string,\n public statusCode: number\n ) {\n super(message);\n }\n}\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\n/** Default port to use for apps running in Expo Go. */\nconst EXPO_GO_METRO_PORT = 8081;\n\n/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */\nconst DEV_CLIENT_METRO_PORT = 8081;\n\nexport class MetroBundlerDevServer extends BundlerDevServer {\n private metro: import('metro').Server | null = null;\n\n get name(): string {\n return 'metro';\n }\n\n async resolvePortAsync(options: Partial<BundlerStartOptions> = {}): Promise<number> {\n const port =\n // If the manually defined port is busy then an error should be thrown...\n options.port ??\n // Otherwise use the default port based on the runtime target.\n (options.devClient\n ? // Don't check if the port is busy if we're using the dev client since most clients are hardcoded to 8081.\n Number(process.env.RCT_METRO_PORT) || DEV_CLIENT_METRO_PORT\n : // Otherwise (running in Expo Go) use a free port that falls back on the classic 8081 port.\n await getFreePortAsync(EXPO_GO_METRO_PORT));\n\n return port;\n }\n\n async exportExpoRouterApiRoutesAsync({\n mode,\n outputDir,\n prerenderManifest,\n baseUrl,\n routerRoot,\n }: {\n mode: 'development' | 'production';\n outputDir: string;\n // This does not contain the API routes info.\n prerenderManifest: ExpoRouterServerManifestV1;\n baseUrl: string;\n routerRoot: string;\n }): Promise<{ files: ExportAssetMap; manifest: ExpoRouterServerManifestV1<string> }> {\n const appDir = path.join(this.projectRoot, routerRoot);\n const manifest = await this.getExpoRouterRoutesManifestAsync({ appDir });\n\n const files: ExportAssetMap = new Map();\n\n for (const route of manifest.apiRoutes) {\n const filepath = path.join(appDir, route.file);\n const contents = await bundleApiRoute(this.projectRoot, filepath, {\n mode,\n routerRoot,\n port: this.getInstance()?.location.port,\n shouldThrow: true,\n baseUrl,\n });\n const artifactFilename = path.join(\n outputDir,\n path.relative(appDir, filepath.replace(/\\.[tj]sx?$/, '.js'))\n );\n if (contents) {\n files.set(artifactFilename, {\n contents,\n targetDomain: 'server',\n });\n }\n // Remap the manifest files to represent the output files.\n route.file = artifactFilename;\n }\n\n return {\n manifest: {\n ...manifest,\n htmlRoutes: prerenderManifest.htmlRoutes,\n },\n files,\n };\n }\n\n async getExpoRouterRoutesManifestAsync({ appDir }: { appDir: string }) {\n // getBuiltTimeServerManifest\n const manifest = await fetchManifest(this.projectRoot, {\n asJson: true,\n appDir,\n });\n\n if (!manifest) {\n throw new CommandError(\n 'EXPO_ROUTER_SERVER_MANIFEST',\n 'Unexpected error: server manifest could not be fetched.'\n );\n }\n\n return manifest;\n }\n\n async getStaticRenderFunctionAsync({\n mode,\n minify = mode !== 'development',\n baseUrl,\n routerRoot,\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n baseUrl: string;\n routerRoot: string;\n }): Promise<{\n serverManifest: ExpoRouterServerManifestV1;\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (path: string) => Promise<string>;\n }> {\n const url = this.getDevServerUrl()!;\n\n const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } =\n await getStaticRenderFunctions(this.projectRoot, url, {\n minify,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n baseUrl,\n routerRoot,\n });\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync(),\n // Get routes from Expo Router.\n manifest: await getManifest({ fetchData: true, preserveApiRoutes: false }),\n // Get route generating function\n async renderAsync(path: string) {\n return await getStaticContent(new URL(path, url));\n },\n };\n }\n\n async getStaticResourcesAsync({\n mode,\n minify = mode !== 'development',\n includeSourceMaps,\n baseUrl,\n mainModuleName,\n isExporting,\n asyncRoutes,\n routerRoot,\n }: {\n isExporting: boolean;\n mode: string;\n minify?: boolean;\n includeSourceMaps?: boolean;\n baseUrl?: string;\n mainModuleName?: string;\n asyncRoutes: boolean;\n routerRoot: string;\n }): Promise<{ artifacts: SerialAsset[]; assets?: AssetData[] }> {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n minify,\n environment: 'client',\n serializerOutput: 'static',\n serializerIncludeMaps: includeSourceMaps,\n mainModuleName:\n mainModuleName ?? resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n asyncRoutes,\n baseUrl,\n isExporting,\n routerRoot,\n });\n\n const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl()!);\n\n // Fetch the generated HTML from our custom Metro serializer\n const results = await fetch(bundleUrl.toString());\n\n const txt = await results.text();\n\n let data: any;\n try {\n data = JSON.parse(txt);\n } catch (error: any) {\n debug(txt);\n\n // Metro can throw this error when the initial module id cannot be resolved.\n if (!results.ok && txt.startsWith('<!DOCTYPE html>')) {\n throw new ForwardHtmlError(\n `Metro failed to bundle the project. Check the console for more information.`,\n txt,\n results.status\n );\n }\n\n Log.error(\n 'Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.'\n );\n throw error;\n }\n\n // NOTE: This could potentially need more validation in the future.\n if ('artifacts' in data && Array.isArray(data.artifacts)) {\n return data;\n }\n\n if (data != null && (data.errors || data.type?.match(/.*Error$/))) {\n // {\n // type: 'InternalError',\n // errors: [],\n // message: 'Metro has encountered an error: While trying to resolve module `stylis` from file `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js`, the package `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs`. Indeed, none of these files exist:\\n' +\n // '\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs/index(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css): /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/metro/src/node-haste/DependencyGraph.js (289:17)\\n' +\n // '\\n' +\n // '\\x1B[0m \\x1B[90m 287 |\\x1B[39m }\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 288 |\\x1B[39m \\x1B[36mif\\x1B[39m (error \\x1B[36minstanceof\\x1B[39m \\x1B[33mInvalidPackageError\\x1B[39m) {\\x1B[0m\\n' +\n // '\\x1B[0m\\x1B[31m\\x1B[1m>\\x1B[22m\\x1B[39m\\x1B[90m 289 |\\x1B[39m \\x1B[36mthrow\\x1B[39m \\x1B[36mnew\\x1B[39m \\x1B[33mPackageResolutionError\\x1B[39m({\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m |\\x1B[39m \\x1B[31m\\x1B[1m^\\x1B[22m\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 290 |\\x1B[39m packageError\\x1B[33m:\\x1B[39m error\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 291 |\\x1B[39m originModulePath\\x1B[33m:\\x1B[39m \\x1B[36mfrom\\x1B[39m\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 292 |\\x1B[39m targetModuleName\\x1B[33m:\\x1B[39m to\\x1B[33m,\\x1B[39m\\x1B[0m'\n // }\n // The Metro logger already showed this error.\n throw new Error(data.message);\n }\n\n throw new Error(\n 'Invalid resources returned from the Metro serializer. Expected array, found: ' + data\n );\n }\n\n private async getStaticPageAsync(\n pathname: string,\n {\n mode,\n minify = mode !== 'development',\n baseUrl,\n routerRoot,\n isExporting,\n asyncRoutes,\n }: {\n isExporting: boolean;\n mode: 'development' | 'production';\n minify?: boolean;\n baseUrl: string;\n asyncRoutes: boolean;\n routerRoot: string;\n }\n ) {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n environment: 'client',\n mainModuleName: resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n baseUrl,\n isExporting,\n asyncRoutes,\n routerRoot,\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await getStaticRenderFunctions(\n this.projectRoot,\n this.getDevServerUrl()!,\n {\n minify: false,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n baseUrl,\n routerRoot,\n }\n );\n\n const location = new URL(pathname, this.getDevServerUrl()!);\n return await getStaticContent(location);\n };\n\n const [{ artifacts: resources }, staticHtml] = await Promise.all([\n this.getStaticResourcesAsync({ isExporting, mode, minify, baseUrl, asyncRoutes, routerRoot }),\n bundleStaticHtml(),\n ]);\n const content = serializeHtmlWithAssets({\n mode,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n baseUrl,\n });\n return {\n content,\n resources,\n };\n }\n\n async watchEnvironmentVariables() {\n if (!this.instance) {\n throw new Error(\n 'Cannot observe environment variable changes without a running Metro instance.'\n );\n }\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process.\n debug('Skipping Environment Variable observation because Metro is not running (headless).');\n return;\n }\n\n const envFiles = runtimeEnv\n .getFiles(process.env.NODE_ENV)\n .map((fileName) => path.join(this.projectRoot, fileName));\n\n observeFileChanges(\n {\n metro: this.metro,\n server: this.instance.server,\n },\n envFiles,\n () => {\n debug('Reloading environment variables...');\n // Force reload the environment variables.\n runtimeEnv.load(this.projectRoot, { force: true });\n }\n );\n }\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n options.port = await this.resolvePortAsync(options);\n this.urlCreator = this.getUrlCreator(options);\n\n const parsedOptions = {\n port: options.port,\n maxWorkers: options.maxWorkers,\n resetCache: options.resetDevServer,\n };\n\n // Required for symbolication:\n process.env.EXPO_DEV_SERVER_ORIGIN = `http://localhost:${options.port}`;\n\n const { metro, server, middleware, messageSocket } = await instantiateMetroAsync(\n this,\n parsedOptions,\n {\n isExporting: !!options.isExporting,\n }\n );\n\n const manifestMiddleware = await this.getManifestMiddlewareAsync(options);\n\n // Important that we noop source maps for context modules as soon as possible.\n prependMiddleware(middleware, new ContextModuleSourceMapsMiddleware().getHandler());\n\n // We need the manifest handler to be the first middleware to run so our\n // routes take precedence over static files. For example, the manifest is\n // served from '/' and if the user has an index.html file in their project\n // then the manifest handler will never run, the static middleware will run\n // and serve index.html instead of the manifest.\n // https://github.com/expo/expo/issues/13114\n prependMiddleware(middleware, manifestMiddleware.getHandler());\n\n middleware.use(\n new InterstitialPageMiddleware(this.projectRoot, {\n // TODO: Prevent this from becoming stale.\n scheme: options.location.scheme ?? null,\n }).getHandler()\n );\n middleware.use(new ReactDevToolsPageMiddleware(this.projectRoot).getHandler());\n middleware.use(\n new DevToolsPluginMiddleware(this.projectRoot, this.devToolsPluginManager).getHandler()\n );\n\n const deepLinkMiddleware = new RuntimeRedirectMiddleware(this.projectRoot, {\n onDeepLink: getDeepLinkHandler(this.projectRoot),\n getLocation: ({ runtime }) => {\n if (runtime === 'custom') {\n return this.urlCreator?.constructDevClientUrl();\n } else {\n return this.urlCreator?.constructUrl({\n scheme: 'exp',\n });\n }\n },\n });\n middleware.use(deepLinkMiddleware.getHandler());\n\n middleware.use(new CreateFileMiddleware(this.projectRoot).getHandler());\n\n // Append support for redirecting unhandled requests to the index.html page on web.\n if (this.isTargetingWeb()) {\n const { exp } = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\n // This MUST be after the manifest middleware so it doesn't have a chance to serve the template `public/index.html`.\n middleware.use(new ServeStaticMiddleware(this.projectRoot).getHandler());\n\n // This should come after the static middleware so it doesn't serve the favicon from `public/favicon.ico`.\n middleware.use(new FaviconMiddleware(this.projectRoot).getHandler());\n\n if (useServerRendering) {\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n const asyncRoutes = getAsyncRoutesFromExpoConfig(exp, options.mode ?? 'development', 'web');\n const routerRoot = getRouterDirectoryModuleIdWithManifest(this.projectRoot, exp);\n const appDir = path.join(this.projectRoot, routerRoot);\n middleware.use(\n createRouteHandlerMiddleware(this.projectRoot, {\n ...options,\n appDir,\n baseUrl,\n routerRoot,\n getWebBundleUrl: manifestMiddleware.getWebBundleUrl.bind(manifestMiddleware),\n getStaticPageAsync: (pathname) => {\n return this.getStaticPageAsync(pathname, {\n isExporting: !!options.isExporting,\n mode: options.mode ?? 'development',\n minify: options.minify,\n baseUrl,\n asyncRoutes,\n routerRoot,\n });\n },\n })\n );\n\n if (exp.web?.output === 'server') {\n // NOTE(EvanBacon): We aren't sure what files the API routes are using so we'll just invalidate\n // aggressively to ensure we always have the latest. The only caching we really get here is for\n // cases where the user is making subsequent requests to the same API route without changing anything.\n // This is useful for testing but pretty suboptimal. Luckily our caching is pretty aggressive so it makes\n // up for a lot of the overhead.\n observeAnyFileChanges(\n {\n metro,\n server,\n },\n () => {\n invalidateApiRouteCache();\n }\n );\n }\n } else {\n // This MUST run last since it's the fallback.\n middleware.use(\n new HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler()\n );\n }\n }\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n this.metro = null;\n callback?.(err);\n });\n };\n\n this.metro = metro;\n return {\n server,\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware,\n messageSocket,\n };\n }\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n if (!this.instance) {\n throw new Error('Cannot wait for TypeScript without a running server.');\n }\n\n return new Promise<boolean>((resolve) => {\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process. In this case we can't wait for the TypeScript check to complete because we don't\n // have access to the Metro server.\n debug('Skipping TypeScript check because Metro is not running (headless).');\n return resolve(false);\n }\n\n const off = metroWatchTypeScriptFiles({\n projectRoot: this.projectRoot,\n server: this.instance!.server,\n metro: this.metro,\n tsconfig: true,\n throttle: true,\n eventTypes: ['change', 'add'],\n callback: async () => {\n // Run once, this prevents the TypeScript project prerequisite from running on every file change.\n off();\n const { TypeScriptProjectPrerequisite } = await import(\n '../../doctor/typescript/TypeScriptProjectPrerequisite.js'\n );\n\n try {\n const req = new TypeScriptProjectPrerequisite(this.projectRoot);\n await req.bootstrapAsync();\n resolve(true);\n } catch (error: any) {\n // Ensure the process doesn't fail if the TypeScript check fails.\n // This could happen during the install.\n Log.log();\n Log.error(\n chalk.red`Failed to automatically setup TypeScript for your project. Try restarting the dev server to fix.`\n );\n Log.exception(error);\n resolve(false);\n }\n },\n });\n });\n }\n\n public async startTypeScriptServices() {\n return startTypescriptTypeGenerationAsync({\n server: this.instance?.server,\n metro: this.metro,\n projectRoot: this.projectRoot,\n });\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./metro.config.js', './metro.config.json', './rn-cli.config.js'];\n }\n}\n\nexport function getDeepLinkHandler(projectRoot: string): DeepLinkHandler {\n return async ({ runtime }) => {\n if (runtime === 'expo') return;\n const { exp } = getConfig(projectRoot);\n await logEventAsync('dev client start command', {\n status: 'started',\n ...getDevClientProperties(projectRoot, exp),\n });\n };\n}\n"],"names":["getDeepLinkHandler","runtimeEnv","ForwardHtmlError","CommandError","constructor","message","html","statusCode","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","MetroBundlerDevServer","BundlerDevServer","metro","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","exportExpoRouterApiRoutesAsync","mode","outputDir","prerenderManifest","baseUrl","routerRoot","appDir","path","join","projectRoot","manifest","getExpoRouterRoutesManifestAsync","files","Map","route","apiRoutes","filepath","file","contents","bundleApiRoute","getInstance","location","shouldThrow","artifactFilename","relative","replace","set","targetDomain","htmlRoutes","fetchManifest","asJson","getStaticRenderFunctionAsync","minify","url","getDevServerUrl","getStaticContent","getManifest","getBuildTimeServerManifestAsync","getStaticRenderFunctions","dev","environment","serverManifest","fetchData","preserveApiRoutes","renderAsync","URL","getStaticResourcesAsync","includeSourceMaps","mainModuleName","isExporting","asyncRoutes","data","devBundleUrlPathname","createBundleUrlPath","platform","serializerOutput","serializerIncludeMaps","resolveMainModuleName","lazy","shouldEnableAsyncImports","bundleUrl","results","fetch","toString","txt","text","JSON","parse","error","ok","startsWith","status","Log","Array","isArray","artifacts","errors","type","match","Error","getStaticPageAsync","pathname","bundleStaticHtml","resources","staticHtml","Promise","all","content","serializeHtmlWithAssets","template","devBundleUrl","watchEnvironmentVariables","instance","envFiles","getFiles","NODE_ENV","map","fileName","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","parsedOptions","maxWorkers","resetCache","resetDevServer","EXPO_DEV_SERVER_ORIGIN","middleware","messageSocket","instantiateMetroAsync","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","ReactDevToolsPageMiddleware","DevToolsPluginMiddleware","devToolsPluginManager","deepLinkMiddleware","RuntimeRedirectMiddleware","onDeepLink","getLocation","runtime","constructDevClientUrl","constructUrl","CreateFileMiddleware","isTargetingWeb","exp","getConfig","skipSDKVersionRequirement","useServerRendering","includes","web","output","ServeStaticMiddleware","FaviconMiddleware","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getRouterDirectoryModuleIdWithManifest","createRouteHandlerMiddleware","getWebBundleUrl","bind","observeAnyFileChanges","invalidateApiRouteCache","HistoryFallbackMiddleware","internal","originalClose","close","callback","err","host","protocol","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","req","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","logEventAsync","getDevClientProperties"],"mappings":"AAMA;;;;QAmlBgBA,kBAAkB,GAAlBA,kBAAkB;AAnlBR,IAAA,OAAc,WAAd,cAAc,CAAA;AAC5BC,IAAAA,UAAU,mCAAM,WAAW,EAAjB;AAEJ,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEP,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEiC,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AAC9B,IAAA,4BAA+B,WAA/B,+BAA+B,CAAA;AAClB,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AAC3C,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;AAChB,IAAA,0BAA6B,WAA7B,6BAA6B,CAAA;AAChB,IAAA,OAAU,WAAV,UAAU,CAAA;AACzB,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AACC,IAAA,oCAAuC,WAAvC,uCAAuC,CAAA;AAE7E,IAAA,IAAc,WAAd,cAAc,CAAA;AACC,IAAA,uBAAiD,kCA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B,CAAC,0BAA0B,EAAE;YAC9CxG,MAAM,EAAE,SAAS;YACjB,GAAGyG,CAAAA,GAAAA,uBAAsB,AAAkB,CAAA,QAAlB,CAACvK,WAAW,EAAE4H,GAAG,CAAC;SAC5C,CAAC,CAAC;KACJ,CAAC;CACH"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.bundleApiRoute = bundleApiRoute;
|
|
6
|
-
exports.
|
|
6
|
+
exports.invalidateApiRouteCache = invalidateApiRouteCache;
|
|
7
7
|
var _metroErrorInterface = require("./metroErrorInterface");
|
|
8
8
|
var _getStaticRenderFunctions = require("../getStaticRenderFunctions");
|
|
9
9
|
const debug = require("debug")("expo:api-routes");
|
|
@@ -45,9 +45,8 @@ async function bundleApiRoute(projectRoot, filepath, options) {
|
|
|
45
45
|
pendingRouteOperations.set(filepath, route);
|
|
46
46
|
return route;
|
|
47
47
|
}
|
|
48
|
-
async function
|
|
49
|
-
pendingRouteOperations.
|
|
50
|
-
return bundleApiRoute(projectRoot, filepath, options);
|
|
48
|
+
async function invalidateApiRouteCache() {
|
|
49
|
+
pendingRouteOperations.clear();
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
//# sourceMappingURL=bundleApiRoutes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/bundleApiRoutes.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { logMetroErrorAsync } from './metroErrorInterface';\nimport { requireFileContentsWithMetro } from '../getStaticRenderFunctions';\n\nconst debug = require('debug')('expo:api-routes') as typeof console.log;\n\nconst pendingRouteOperations = new Map<string, Promise<string | null>>();\n\nexport type ApiRouteOptions = {\n mode?: string;\n routerRoot: string;\n port?: number;\n shouldThrow?: boolean;\n baseUrl: string;\n};\n\n// Bundle the API Route with Metro and return the string contents to be evaluated in the server.\nexport async function bundleApiRoute(\n projectRoot: string,\n filepath: string,\n options: ApiRouteOptions\n): Promise<string | null | undefined> {\n if (pendingRouteOperations.has(filepath)) {\n return pendingRouteOperations.get(filepath);\n }\n\n const devServerUrl = `http://localhost:${options.port}`;\n\n async function bundleAsync() {\n try {\n debug('Bundle API route:', options.routerRoot, filepath);\n\n const middleware = await requireFileContentsWithMetro(projectRoot, devServerUrl, filepath, {\n minify: options.mode === 'production',\n dev: options.mode !== 'production',\n // Ensure Node.js\n environment: 'node',\n baseUrl: options.baseUrl,\n routerRoot: options.routerRoot,\n });\n\n return middleware;\n } catch (error: any) {\n if (error instanceof Error) {\n await logMetroErrorAsync({ error, projectRoot });\n }\n if (options.shouldThrow) {\n throw error;\n }\n // TODO: improve error handling, maybe have this be a mock function which returns the static error html\n return null;\n } finally {\n // pendingRouteOperations.delete(filepath);\n }\n }\n const route = bundleAsync();\n\n pendingRouteOperations.set(filepath, route);\n return route;\n}\n\nexport async function
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/bundleApiRoutes.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { logMetroErrorAsync } from './metroErrorInterface';\nimport { requireFileContentsWithMetro } from '../getStaticRenderFunctions';\n\nconst debug = require('debug')('expo:api-routes') as typeof console.log;\n\nconst pendingRouteOperations = new Map<string, Promise<string | null>>();\n\nexport type ApiRouteOptions = {\n mode?: string;\n routerRoot: string;\n port?: number;\n shouldThrow?: boolean;\n baseUrl: string;\n};\n\n// Bundle the API Route with Metro and return the string contents to be evaluated in the server.\nexport async function bundleApiRoute(\n projectRoot: string,\n filepath: string,\n options: ApiRouteOptions\n): Promise<string | null | undefined> {\n if (pendingRouteOperations.has(filepath)) {\n return pendingRouteOperations.get(filepath);\n }\n\n const devServerUrl = `http://localhost:${options.port}`;\n\n async function bundleAsync() {\n try {\n debug('Bundle API route:', options.routerRoot, filepath);\n\n const middleware = await requireFileContentsWithMetro(projectRoot, devServerUrl, filepath, {\n minify: options.mode === 'production',\n dev: options.mode !== 'production',\n // Ensure Node.js\n environment: 'node',\n baseUrl: options.baseUrl,\n routerRoot: options.routerRoot,\n });\n\n return middleware;\n } catch (error: any) {\n if (error instanceof Error) {\n await logMetroErrorAsync({ error, projectRoot });\n }\n if (options.shouldThrow) {\n throw error;\n }\n // TODO: improve error handling, maybe have this be a mock function which returns the static error html\n return null;\n } finally {\n // pendingRouteOperations.delete(filepath);\n }\n }\n const route = bundleAsync();\n\n pendingRouteOperations.set(filepath, route);\n return route;\n}\n\nexport async function invalidateApiRouteCache() {\n pendingRouteOperations.clear();\n}\n"],"names":["bundleApiRoute","invalidateApiRouteCache","debug","require","pendingRouteOperations","Map","projectRoot","filepath","options","has","get","devServerUrl","port","bundleAsync","routerRoot","middleware","requireFileContentsWithMetro","minify","mode","dev","environment","baseUrl","error","Error","logMetroErrorAsync","shouldThrow","route","set","clear"],"mappings":"AAOA;;;;QAgBsBA,cAAc,GAAdA,cAAc;QA4CdC,uBAAuB,GAAvBA,uBAAuB;AA5DV,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AACb,IAAA,yBAA6B,WAA7B,6BAA6B,CAAA;AAE1E,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,AAAsB,AAAC;AAExE,MAAMC,sBAAsB,GAAG,IAAIC,GAAG,EAAkC,AAAC;AAWlE,eAAeL,cAAc,CAClCM,WAAmB,EACnBC,QAAgB,EAChBC,OAAwB,EACY;IACpC,IAAIJ,sBAAsB,CAACK,GAAG,CAACF,QAAQ,CAAC,EAAE;QACxC,OAAOH,sBAAsB,CAACM,GAAG,CAACH,QAAQ,CAAC,CAAC;KAC7C;IAED,MAAMI,YAAY,GAAG,CAAC,iBAAiB,EAAEH,OAAO,CAACI,IAAI,CAAC,CAAC,AAAC;IAExD,eAAeC,WAAW,GAAG;QAC3B,IAAI;YACFX,KAAK,CAAC,mBAAmB,EAAEM,OAAO,CAACM,UAAU,EAAEP,QAAQ,CAAC,CAAC;YAEzD,MAAMQ,UAAU,GAAG,MAAMC,CAAAA,GAAAA,yBAA4B,AAOnD,CAAA,6BAPmD,CAACV,WAAW,EAAEK,YAAY,EAAEJ,QAAQ,EAAE;gBACzFU,MAAM,EAAET,OAAO,CAACU,IAAI,KAAK,YAAY;gBACrCC,GAAG,EAAEX,OAAO,CAACU,IAAI,KAAK,YAAY;gBAClC,iBAAiB;gBACjBE,WAAW,EAAE,MAAM;gBACnBC,OAAO,EAAEb,OAAO,CAACa,OAAO;gBACxBP,UAAU,EAAEN,OAAO,CAACM,UAAU;aAC/B,CAAC,AAAC;YAEH,OAAOC,UAAU,CAAC;SACnB,CAAC,OAAOO,KAAK,EAAO;YACnB,IAAIA,KAAK,YAAYC,KAAK,EAAE;gBAC1B,MAAMC,CAAAA,GAAAA,oBAAkB,AAAwB,CAAA,mBAAxB,CAAC;oBAAEF,KAAK;oBAAEhB,WAAW;iBAAE,CAAC,CAAC;aAClD;YACD,IAAIE,OAAO,CAACiB,WAAW,EAAE;gBACvB,MAAMH,KAAK,CAAC;aACb;YACD,uGAAuG;YACvG,OAAO,IAAI,CAAC;SACb,QAAS;QACR,2CAA2C;SAC5C;KACF;IACD,MAAMI,KAAK,GAAGb,WAAW,EAAE,AAAC;IAE5BT,sBAAsB,CAACuB,GAAG,CAACpB,QAAQ,EAAEmB,KAAK,CAAC,CAAC;IAC5C,OAAOA,KAAK,CAAC;CACd;AAEM,eAAezB,uBAAuB,GAAG;IAC9CG,sBAAsB,CAACwB,KAAK,EAAE,CAAC;CAChC"}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
exports.getAppRouterRelativeEntryPath = getAppRouterRelativeEntryPath;
|
|
6
6
|
exports.getRouterDirectoryModuleIdWithManifest = getRouterDirectoryModuleIdWithManifest;
|
|
7
7
|
exports.getRouterDirectory = getRouterDirectory;
|
|
8
|
-
exports.isApiRouteConvention = isApiRouteConvention;
|
|
9
8
|
exports.getApiRoutesForDirectory = getApiRoutesForDirectory;
|
|
10
9
|
exports.getRoutePaths = getRoutePaths;
|
|
11
10
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
@@ -57,9 +56,6 @@ function getRouterDirectory(projectRoot) {
|
|
|
57
56
|
debug("Using app as the root directory for Expo Router.");
|
|
58
57
|
return "app";
|
|
59
58
|
}
|
|
60
|
-
function isApiRouteConvention(name) {
|
|
61
|
-
return /\+api\.[tj]sx?$/.test(name);
|
|
62
|
-
}
|
|
63
59
|
function getApiRoutesForDirectory(cwd) {
|
|
64
60
|
return (0, _glob).sync("**/*+api.@(ts|tsx|js|jsx)", {
|
|
65
61
|
cwd,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/router.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport chalk from 'chalk';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { Log } from '../../../log';\nimport { directoryExistsSync } from '../../../utils/dir';\nimport { memoize } from '../../../utils/fn';\n\nconst debug = require('debug')('expo:start:server:metro:router') as typeof console.log;\n\n/**\n * Get the relative path for requiring the `/app` folder relative to the `expo-router/entry` file.\n * This mechanism does require the server to restart after the `expo-router` package is installed.\n */\nexport function getAppRouterRelativeEntryPath(\n projectRoot: string,\n routerDirectory: string = getRouterDirectory(projectRoot)\n): string | undefined {\n // Auto pick App entry\n const routerEntry =\n resolveFrom.silent(projectRoot, 'expo-router/entry') ?? getFallbackEntryRoot(projectRoot);\n if (!routerEntry) {\n return undefined;\n }\n // It doesn't matter if the app folder exists.\n const appFolder = path.join(projectRoot, routerDirectory);\n const appRoot = path.relative(path.dirname(routerEntry), appFolder);\n debug('expo-router entry', routerEntry, appFolder, appRoot);\n return appRoot;\n}\n\n/** If the `expo-router` package is not installed, then use the `expo` package to determine where the node modules are relative to the project. */\nfunction getFallbackEntryRoot(projectRoot: string): string {\n const expoRoot = resolveFrom.silent(projectRoot, 'expo/package.json');\n if (expoRoot) {\n return path.join(path.dirname(path.dirname(expoRoot)), 'expo-router/entry');\n }\n return path.join(projectRoot, 'node_modules/expo-router/entry');\n}\n\nexport function getRouterDirectoryModuleIdWithManifest(\n projectRoot: string,\n exp: ExpoConfig\n): string {\n return exp.extra?.router?.root ?? getRouterDirectory(projectRoot);\n}\n\nconst logSrcDir = memoize(() =>\n Log.log(chalk.gray('Using src/app as the root directory for Expo Router.'))\n);\n\nexport function getRouterDirectory(projectRoot: string): string {\n // more specific directories first\n if (directoryExistsSync(path.join(projectRoot, 'src/app'))) {\n logSrcDir();\n return 'src/app';\n }\n\n debug('Using app as the root directory for Expo Router.');\n return 'app';\n}\n\nexport function
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/router.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport chalk from 'chalk';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { Log } from '../../../log';\nimport { directoryExistsSync } from '../../../utils/dir';\nimport { memoize } from '../../../utils/fn';\n\nconst debug = require('debug')('expo:start:server:metro:router') as typeof console.log;\n\n/**\n * Get the relative path for requiring the `/app` folder relative to the `expo-router/entry` file.\n * This mechanism does require the server to restart after the `expo-router` package is installed.\n */\nexport function getAppRouterRelativeEntryPath(\n projectRoot: string,\n routerDirectory: string = getRouterDirectory(projectRoot)\n): string | undefined {\n // Auto pick App entry\n const routerEntry =\n resolveFrom.silent(projectRoot, 'expo-router/entry') ?? getFallbackEntryRoot(projectRoot);\n if (!routerEntry) {\n return undefined;\n }\n // It doesn't matter if the app folder exists.\n const appFolder = path.join(projectRoot, routerDirectory);\n const appRoot = path.relative(path.dirname(routerEntry), appFolder);\n debug('expo-router entry', routerEntry, appFolder, appRoot);\n return appRoot;\n}\n\n/** If the `expo-router` package is not installed, then use the `expo` package to determine where the node modules are relative to the project. */\nfunction getFallbackEntryRoot(projectRoot: string): string {\n const expoRoot = resolveFrom.silent(projectRoot, 'expo/package.json');\n if (expoRoot) {\n return path.join(path.dirname(path.dirname(expoRoot)), 'expo-router/entry');\n }\n return path.join(projectRoot, 'node_modules/expo-router/entry');\n}\n\nexport function getRouterDirectoryModuleIdWithManifest(\n projectRoot: string,\n exp: ExpoConfig\n): string {\n return exp.extra?.router?.root ?? getRouterDirectory(projectRoot);\n}\n\nconst logSrcDir = memoize(() =>\n Log.log(chalk.gray('Using src/app as the root directory for Expo Router.'))\n);\n\nexport function getRouterDirectory(projectRoot: string): string {\n // more specific directories first\n if (directoryExistsSync(path.join(projectRoot, 'src/app'))) {\n logSrcDir();\n return 'src/app';\n }\n\n debug('Using app as the root directory for Expo Router.');\n return 'app';\n}\n\nexport function getApiRoutesForDirectory(cwd: string) {\n return globSync('**/*+api.@(ts|tsx|js|jsx)', {\n cwd,\n absolute: true,\n });\n}\n\n// Used to emulate a context module, but way faster. TODO: May need to adjust the extensions to stay in sync with Metro.\nexport function getRoutePaths(cwd: string) {\n return globSync('**/*.@(ts|tsx|js|jsx)', {\n cwd,\n }).map((p) => './' + normalizePaths(p));\n}\n\nfunction normalizePaths(p: string) {\n return p.replace(/\\\\/g, '/');\n}\n"],"names":["getAppRouterRelativeEntryPath","getRouterDirectoryModuleIdWithManifest","getRouterDirectory","getApiRoutesForDirectory","getRoutePaths","debug","require","projectRoot","routerDirectory","resolveFrom","routerEntry","silent","getFallbackEntryRoot","undefined","appFolder","path","join","appRoot","relative","dirname","expoRoot","exp","extra","router","root","logSrcDir","memoize","Log","log","chalk","gray","directoryExistsSync","cwd","globSync","absolute","map","p","normalizePaths","replace"],"mappings":"AAAA;;;;QAgBgBA,6BAA6B,GAA7BA,6BAA6B;QA0B7BC,sCAAsC,GAAtCA,sCAAsC;QAWtCC,kBAAkB,GAAlBA,kBAAkB;QAWlBC,wBAAwB,GAAxBA,wB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f,CAAC,CAAC;CACJ;AAGM,SAAS9B,aAAa,CAAC4B,GAAW,EAAE;IACzC,OAAOC,CAAAA,GAAAA,KAAQ,AAEb,CAAA,KAFa,CAAC,uBAAuB,EAAE;QACvCD,GAAG;KACJ,CAAC,CAACG,GAAG,CAAC,CAACC,CAAC,GAAK,IAAI,GAAGC,cAAc,CAACD,CAAC,CAAC;IAAA,CAAC,CAAC;CACzC;AAED,SAASC,cAAc,CAACD,CAAS,EAAE;IACjC,OAAOA,CAAC,CAACE,OAAO,QAAQ,GAAG,CAAC,CAAC;CAC9B"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports.observeApiRouteChanges = observeApiRouteChanges;
|
|
6
5
|
exports.waitForMetroToObserveTypeScriptFile = waitForMetroToObserveTypeScriptFile;
|
|
7
6
|
exports.observeFileChanges = observeFileChanges;
|
|
7
|
+
exports.observeAnyFileChanges = observeAnyFileChanges;
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
function _interopRequireDefault(obj) {
|
|
10
10
|
return obj && obj.__esModule ? obj : {
|
|
@@ -12,26 +12,6 @@ function _interopRequireDefault(obj) {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
const debug = require("debug")("expo:start:server:metro:waitForTypescript");
|
|
15
|
-
function observeApiRouteChanges(appDir, runner, callback) {
|
|
16
|
-
const watcher = runner.metro.getBundler().getBundler().getWatcher();
|
|
17
|
-
const listener = ({ eventsQueue })=>{
|
|
18
|
-
for (const event of eventsQueue){
|
|
19
|
-
if (// event.type === 'add' &&
|
|
20
|
-
// event.metadata?.type !== 'd' &&
|
|
21
|
-
// We need to ignore node_modules because Metro will add all of the files in node_modules to the watcher.
|
|
22
|
-
!/node_modules/.test(event.filePath) && event.filePath.startsWith(appDir)) {
|
|
23
|
-
const { filePath } = event;
|
|
24
|
-
callback(filePath, event.type);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
watcher.addListener("change", listener);
|
|
29
|
-
const off = ()=>{
|
|
30
|
-
watcher.removeListener("change", listener);
|
|
31
|
-
};
|
|
32
|
-
runner.server.addListener == null ? void 0 : runner.server.addListener("close", off);
|
|
33
|
-
return off;
|
|
34
|
-
}
|
|
35
15
|
function waitForMetroToObserveTypeScriptFile(projectRoot, runner, callback) {
|
|
36
16
|
const watcher = runner.metro.getBundler().getBundler().getWatcher();
|
|
37
17
|
const tsconfigPath = _path.default.join(projectRoot, "tsconfig.json");
|
|
@@ -87,5 +67,17 @@ function observeFileChanges(runner, files, callback) {
|
|
|
87
67
|
runner.server.addListener == null ? void 0 : runner.server.addListener("close", off);
|
|
88
68
|
return off;
|
|
89
69
|
}
|
|
70
|
+
function observeAnyFileChanges(runner, callback) {
|
|
71
|
+
const watcher = runner.metro.getBundler().getBundler().getWatcher();
|
|
72
|
+
const listener = ({ eventsQueue })=>{
|
|
73
|
+
callback();
|
|
74
|
+
};
|
|
75
|
+
watcher.addListener("change", listener);
|
|
76
|
+
const off = ()=>{
|
|
77
|
+
watcher.removeListener("change", listener);
|
|
78
|
+
};
|
|
79
|
+
runner.server.addListener == null ? void 0 : runner.server.addListener("close", off);
|
|
80
|
+
return off;
|
|
81
|
+
}
|
|
90
82
|
|
|
91
83
|
//# sourceMappingURL=waitForMetroToObserveTypeScriptFile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/waitForMetroToObserveTypeScriptFile.ts"],"sourcesContent":["import path from 'path';\n\nimport type { ServerLike } from '../BundlerDevServer';\n\nconst debug = require('debug')('expo:start:server:metro:waitForTypescript') as typeof console.log;\n\n/**\n * Use the native file watcher / Metro ruleset to detect if a\n * TypeScript file is added to the project during development.\n */\nexport function
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/waitForMetroToObserveTypeScriptFile.ts"],"sourcesContent":["import path from 'path';\n\nimport type { ServerLike } from '../BundlerDevServer';\n\nconst debug = require('debug')('expo:start:server:metro:waitForTypescript') as typeof console.log;\n\n/**\n * Use the native file watcher / Metro ruleset to detect if a\n * TypeScript file is added to the project during development.\n */\nexport function waitForMetroToObserveTypeScriptFile(\n projectRoot: string,\n runner: {\n metro: import('metro').Server;\n server: ServerLike;\n },\n callback: () => Promise<void>\n): () => void {\n const watcher = runner.metro.getBundler().getBundler().getWatcher();\n\n const tsconfigPath = path.join(projectRoot, 'tsconfig.json');\n\n const listener = ({\n eventsQueue,\n }: {\n eventsQueue: {\n filePath: string;\n metadata?: {\n type: 'f' | 'd' | 'l'; // Regular file / Directory / Symlink\n } | null;\n type: string;\n }[];\n }) => {\n for (const event of eventsQueue) {\n if (\n event.type === 'add' &&\n event.metadata?.type !== 'd' &&\n // We need to ignore node_modules because Metro will add all of the files in node_modules to the watcher.\n !/node_modules/.test(event.filePath)\n ) {\n const { filePath } = event;\n // Is TypeScript?\n if (\n // If the user adds a TypeScript file to the observable files in their project.\n /\\.tsx?$/.test(filePath) ||\n // Or if the user adds a tsconfig.json file to the project root.\n filePath === tsconfigPath\n ) {\n debug('Detected TypeScript file added to the project: ', filePath);\n callback();\n off();\n return;\n }\n }\n }\n };\n\n debug('Waiting for TypeScript files to be added to the project...');\n watcher.addListener('change', listener);\n\n const off = () => {\n watcher.removeListener('change', listener);\n };\n\n runner.server.addListener?.('close', off);\n return off;\n}\n\nexport function observeFileChanges(\n runner: {\n metro: import('metro').Server;\n server: ServerLike;\n },\n files: string[],\n callback: () => void | Promise<void>\n): () => void {\n const watcher = runner.metro.getBundler().getBundler().getWatcher();\n\n const listener = ({\n eventsQueue,\n }: {\n eventsQueue: {\n filePath: string;\n metadata?: {\n type: 'f' | 'd' | 'l'; // Regular file / Directory / Symlink\n } | null;\n type: string;\n }[];\n }) => {\n for (const event of eventsQueue) {\n if (\n // event.type === 'add' &&\n event.metadata?.type !== 'd' &&\n // We need to ignore node_modules because Metro will add all of the files in node_modules to the watcher.\n !/node_modules/.test(event.filePath)\n ) {\n const { filePath } = event;\n // Is TypeScript?\n if (files.includes(filePath)) {\n debug('Observed change:', filePath);\n callback();\n return;\n }\n }\n }\n };\n\n debug('Watching file changes:', files);\n watcher.addListener('change', listener);\n\n const off = () => {\n watcher.removeListener('change', listener);\n };\n\n runner.server.addListener?.('close', off);\n return off;\n}\n\nexport function observeAnyFileChanges(\n runner: {\n metro: import('metro').Server;\n server: ServerLike;\n },\n callback: () => void | Promise<void>\n): () => void {\n const watcher = runner.metro.getBundler().getBundler().getWatcher();\n\n const listener = ({\n eventsQueue,\n }: {\n eventsQueue: {\n filePath: string;\n metadata?: {\n type: 'f' | 'd' | 'l'; // Regular file / Directory / Symlink\n } | null;\n type: string;\n }[];\n }) => {\n callback();\n };\n\n watcher.addListener('change', listener);\n\n const off = () => {\n watcher.removeListener('change', listener);\n };\n\n runner.server.addListener?.('close', off);\n return off;\n}\n"],"names":["waitForMetroToObserveTypeScriptFile","observeFileChanges","observeAnyFileChanges","debug","require","projectRoot","runner","callback","watcher","metro","getBundler","getWatcher","tsconfigPath","path","join","listener","eventsQueue","event","type","metadata","test","filePath","off","addListener","removeListener","server","files","includes"],"mappings":"AAAA;;;;QAUgBA,mCAAmC,GAAnCA,mCAAmC;QA0DnCC,kBAAkB,GAAlBA,kBAAkB;QAkDlBC,qBAAqB,GAArBA,qBAAqB;AAtHpB,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAIvB,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,2CAA2C,CAAC,AAAsB,AAAC;AAM3F,SAASJ,mCAAmC,CACjDK,WAAmB,EACnBC,MAGC,EACDC,QAA6B,EACjB;IACZ,MAAMC,OAAO,GAAGF,MAAM,CAACG,KAAK,CAACC,UAAU,EAAE,CAACA,UAAU,EAAE,CAACC,UAAU,EAAE,AAAC;IAEpE,MAAMC,YAAY,GAAGC,KAAI,QAAA,CAACC,IAAI,CAACT,WAAW,EAA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,CAACC,UAAU,EAAE,AAAC;IAEpE,MAAMI,QAAQ,GAAG,CAAC,EAChBC,WAAW,CAAA,EASZ,GAAK;QACJT,QAAQ,EAAE,CAAC;KACZ,AAAC;IAEFC,OAAO,CAACe,WAAW,CAAC,QAAQ,EAAER,QAAQ,CAAC,CAAC;IAExC,MAAMO,GAAG,GAAG,IAAM;QAChBd,OAAO,CAACgB,cAAc,CAAC,QAAQ,EAAET,QAAQ,CAAC,CAAC;KAC5C,AAAC;IAEFT,MAAM,CAACmB,MAAM,CAACF,WAAW,QAAgB,GAAzCjB,KAAAA,CAAyC,GAAzCA,MAAM,CAACmB,MAAM,CAACF,WAAW,CAAG,OAAO,EAAED,GAAG,CAAC,AAnJ3C,CAmJ4C;IAC1C,OAAOA,GAAG,CAAC;CACZ"}
|
|
@@ -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.16.
|
|
97
|
+
source_version: "0.16.3",
|
|
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.16.
|
|
138
|
+
version: "0.16.3"
|
|
139
139
|
},
|
|
140
140
|
ci: ciInfo.isCI ? {
|
|
141
141
|
name: ciInfo.name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.3",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@expo/devcert": "^1.0.0",
|
|
45
45
|
"@expo/env": "~0.2.0",
|
|
46
46
|
"@expo/json-file": "^8.2.37",
|
|
47
|
-
"@expo/metro-config": "~0.
|
|
47
|
+
"@expo/metro-config": "~0.17.0",
|
|
48
48
|
"@expo/osascript": "^2.0.31",
|
|
49
49
|
"@expo/package-manager": "^1.1.1",
|
|
50
50
|
"@expo/plist": "^0.1.0",
|
|
51
|
-
"@expo/prebuild-config": "6.7.
|
|
51
|
+
"@expo/prebuild-config": "6.7.1",
|
|
52
52
|
"@expo/rudder-sdk-node": "1.1.1",
|
|
53
53
|
"@expo/server": "^0.3.0",
|
|
54
54
|
"@expo/spawn-async": "1.5.0",
|
|
@@ -159,5 +159,5 @@
|
|
|
159
159
|
"tree-kill": "^1.2.2",
|
|
160
160
|
"tsd": "^0.28.1"
|
|
161
161
|
},
|
|
162
|
-
"gitHead": "
|
|
162
|
+
"gitHead": "1a7c4e8ffed182e00cf1cf654ca2401441a7377a"
|
|
163
163
|
}
|