@expo/cli 0.18.5 → 0.18.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +1 -1
- package/build/src/api/user/actions.js +1 -1
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +9 -0
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +9 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +7 -0
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.types.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/debugging/AtlasPrerequisite.js +1 -1
- package/build/src/start/server/metro/debugging/AtlasPrerequisite.js.map +1 -1
- package/build/src/start/server/metro/debugging/attachAtlas.js +33 -24
- package/build/src/start/server/metro/debugging/attachAtlas.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/utils/fn.js +4 -4
- package/build/src/utils/fn.js.map +1 -1
- package/build/src/utils/telemetry/getContext.js +1 -1
- package/package.json +3 -3
package/build/bin/cli
CHANGED
|
@@ -91,7 +91,7 @@ async function showLoginPromptAsync({ printNewLine =false , otp , ...options } =
|
|
|
91
91
|
await (0, _user.ssoLoginAsync)();
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
_log.log(hasCredentials ? `Logging in to EAS with email or username (exit and run 'npx expo login' for other options)` : `Log in to EAS with email or username (exit and run 'npx expo login' for other options)`);
|
|
94
|
+
_log.log(hasCredentials ? `Logging in to EAS with email or username (exit and run 'npx expo login --help' for other login options)` : `Log in to EAS with email or username (exit and run 'npx expo login --help' for other login options)`);
|
|
95
95
|
let username = options.username;
|
|
96
96
|
let password = options.password;
|
|
97
97
|
if (!hasCredentials) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/api/user/actions.ts"],"sourcesContent":["import assert from 'assert';\nimport chalk from 'chalk';\n\nimport { retryUsernamePasswordAuthWithOTPAsync } from './otp';\nimport { Actor, getUserAsync, loginAsync, ssoLoginAsync } from './user';\nimport * as Log from '../../log';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { learnMore } from '../../utils/link';\nimport promptAsync, { Question } from '../../utils/prompts';\nimport { ApiV2Error } from '../rest/client';\n\n/** Show login prompt while prompting for missing credentials. */\nexport async function showLoginPromptAsync({\n printNewLine = false,\n otp,\n ...options\n}: {\n printNewLine?: boolean;\n username?: string;\n password?: string;\n otp?: string;\n sso?: boolean | undefined;\n} = {}): Promise<void> {\n if (env.EXPO_OFFLINE) {\n throw new CommandError('OFFLINE', 'Cannot authenticate in offline-mode');\n }\n const hasCredentials = options.username && options.password;\n const sso = options.sso;\n\n if (printNewLine) {\n Log.log();\n }\n\n if (sso) {\n await ssoLoginAsync();\n return;\n }\n\n Log.log(\n hasCredentials\n ? `Logging in to EAS with email or username (exit and run 'npx expo login' for other options)`\n : `Log in to EAS with email or username (exit and run 'npx expo login' for other options)`\n );\n\n let username = options.username;\n let password = options.password;\n\n if (!hasCredentials) {\n const resolved = await promptAsync(\n [\n !options.username && {\n type: 'text',\n name: 'username',\n message: 'Email or username',\n },\n !options.password && {\n type: 'password',\n name: 'password',\n message: 'Password',\n },\n ].filter(Boolean) as Question<string>[],\n {\n nonInteractiveHelp: `Use the EXPO_TOKEN environment variable to authenticate in CI (${learnMore(\n 'https://docs.expo.dev/accounts/programmatic-access/'\n )})`,\n }\n );\n username ??= resolved.username;\n password ??= resolved.password;\n }\n // This is just for the types.\n assert(username && password);\n\n try {\n await loginAsync({\n username,\n password,\n otp,\n });\n } catch (e) {\n if (e instanceof ApiV2Error && e.expoApiV2ErrorCode === 'ONE_TIME_PASSWORD_REQUIRED') {\n await retryUsernamePasswordAuthWithOTPAsync(\n username,\n password,\n e.expoApiV2ErrorMetadata as any\n );\n } else {\n throw e;\n }\n }\n}\n\n/** Ensure the user is logged in, if not, prompt to login. */\nexport async function ensureLoggedInAsync(): Promise<Actor> {\n let user = await getUserAsync().catch(() => null);\n\n if (!user) {\n Log.warn(chalk.yellow`An Expo user account is required to proceed.`);\n await showLoginPromptAsync({ printNewLine: true });\n user = await getUserAsync();\n }\n\n assert(user, 'User should be logged in');\n return user;\n}\n"],"names":["showLoginPromptAsync","ensureLoggedInAsync","printNewLine","otp","options","env","EXPO_OFFLINE","CommandError","hasCredentials","username","password","sso","Log","log","ssoLoginAsync","resolved","promptAsync","type","name","message","filter","Boolean","nonInteractiveHelp","learnMore","assert","loginAsync","e","ApiV2Error","expoApiV2ErrorCode","retryUsernamePasswordAuthWithOTPAsync","expoApiV2ErrorMetadata","user","getUserAsync","catch","warn","chalk","yellow"],"mappings":"AAAA;;;;;;;;;;;IAasBA,oBAAoB,MAApBA,oBAAoB;IAiFpBC,mBAAmB,MAAnBA,mBAAmB;;;8DA9FtB,QAAQ;;;;;;;8DACT,OAAO;;;;;;qBAE6B,OAAO;sBACE,QAAQ;2DAClD,WAAW;qBACZ,iBAAiB;wBACR,oBAAoB;sBACvB,kBAAkB;8DACN,qBAAqB;wBAChC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGpC,eAAeD,oBAAoB,CAAC,EACzCE,YAAY,EAAG,KAAK,CAAA,EACpBC,GAAG,CAAA,EACH,GAAGC,OAAO,EAOX,GAAG,EAAE,EAAiB;IACrB,IAAIC,IAAG,IAAA,CAACC,YAAY,EAAE;QACpB,MAAM,IAAIC,OAAY,aAAA,CAAC,SAAS,EAAE,qCAAqC,CAAC,CAAC;IAC3E,CAAC;IACD,MAAMC,cAAc,GAAGJ,OAAO,CAACK,QAAQ,IAAIL,OAAO,CAACM,QAAQ,AAAC;IAC5D,MAAMC,GAAG,GAAGP,OAAO,CAACO,GAAG,AAAC;IAExB,IAAIT,YAAY,EAAE;QAChBU,IAAG,CAACC,GAAG,EAAE,CAAC;IACZ,CAAC;IAED,IAAIF,GAAG,EAAE;QACP,MAAMG,IAAAA,KAAa,cAAA,GAAE,CAAC;QACtB,OAAO;IACT,CAAC;IAEDF,IAAG,CAACC,GAAG,CACLL,cAAc,GACV,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../../../src/api/user/actions.ts"],"sourcesContent":["import assert from 'assert';\nimport chalk from 'chalk';\n\nimport { retryUsernamePasswordAuthWithOTPAsync } from './otp';\nimport { Actor, getUserAsync, loginAsync, ssoLoginAsync } from './user';\nimport * as Log from '../../log';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { learnMore } from '../../utils/link';\nimport promptAsync, { Question } from '../../utils/prompts';\nimport { ApiV2Error } from '../rest/client';\n\n/** Show login prompt while prompting for missing credentials. */\nexport async function showLoginPromptAsync({\n printNewLine = false,\n otp,\n ...options\n}: {\n printNewLine?: boolean;\n username?: string;\n password?: string;\n otp?: string;\n sso?: boolean | undefined;\n} = {}): Promise<void> {\n if (env.EXPO_OFFLINE) {\n throw new CommandError('OFFLINE', 'Cannot authenticate in offline-mode');\n }\n const hasCredentials = options.username && options.password;\n const sso = options.sso;\n\n if (printNewLine) {\n Log.log();\n }\n\n if (sso) {\n await ssoLoginAsync();\n return;\n }\n\n Log.log(\n hasCredentials\n ? `Logging in to EAS with email or username (exit and run 'npx expo login --help' for other login options)`\n : `Log in to EAS with email or username (exit and run 'npx expo login --help' for other login options)`\n );\n\n let username = options.username;\n let password = options.password;\n\n if (!hasCredentials) {\n const resolved = await promptAsync(\n [\n !options.username && {\n type: 'text',\n name: 'username',\n message: 'Email or username',\n },\n !options.password && {\n type: 'password',\n name: 'password',\n message: 'Password',\n },\n ].filter(Boolean) as Question<string>[],\n {\n nonInteractiveHelp: `Use the EXPO_TOKEN environment variable to authenticate in CI (${learnMore(\n 'https://docs.expo.dev/accounts/programmatic-access/'\n )})`,\n }\n );\n username ??= resolved.username;\n password ??= resolved.password;\n }\n // This is just for the types.\n assert(username && password);\n\n try {\n await loginAsync({\n username,\n password,\n otp,\n });\n } catch (e) {\n if (e instanceof ApiV2Error && e.expoApiV2ErrorCode === 'ONE_TIME_PASSWORD_REQUIRED') {\n await retryUsernamePasswordAuthWithOTPAsync(\n username,\n password,\n e.expoApiV2ErrorMetadata as any\n );\n } else {\n throw e;\n }\n }\n}\n\n/** Ensure the user is logged in, if not, prompt to login. */\nexport async function ensureLoggedInAsync(): Promise<Actor> {\n let user = await getUserAsync().catch(() => null);\n\n if (!user) {\n Log.warn(chalk.yellow`An Expo user account is required to proceed.`);\n await showLoginPromptAsync({ printNewLine: true });\n user = await getUserAsync();\n }\n\n assert(user, 'User should be logged in');\n return user;\n}\n"],"names":["showLoginPromptAsync","ensureLoggedInAsync","printNewLine","otp","options","env","EXPO_OFFLINE","CommandError","hasCredentials","username","password","sso","Log","log","ssoLoginAsync","resolved","promptAsync","type","name","message","filter","Boolean","nonInteractiveHelp","learnMore","assert","loginAsync","e","ApiV2Error","expoApiV2ErrorCode","retryUsernamePasswordAuthWithOTPAsync","expoApiV2ErrorMetadata","user","getUserAsync","catch","warn","chalk","yellow"],"mappings":"AAAA;;;;;;;;;;;IAasBA,oBAAoB,MAApBA,oBAAoB;IAiFpBC,mBAAmB,MAAnBA,mBAAmB;;;8DA9FtB,QAAQ;;;;;;;8DACT,OAAO;;;;;;qBAE6B,OAAO;sBACE,QAAQ;2DAClD,WAAW;qBACZ,iBAAiB;wBACR,oBAAoB;sBACvB,kBAAkB;8DACN,qBAAqB;wBAChC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGpC,eAAeD,oBAAoB,CAAC,EACzCE,YAAY,EAAG,KAAK,CAAA,EACpBC,GAAG,CAAA,EACH,GAAGC,OAAO,EAOX,GAAG,EAAE,EAAiB;IACrB,IAAIC,IAAG,IA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,CAACL,QAAQ,CAAC;IACjC,CAAC;IACD,8BAA8B;IAC9Bc,IAAAA,OAAM,EAAA,QAAA,EAACf,QAAQ,IAAIC,QAAQ,CAAC,CAAC;IAE7B,IAAI;QACF,MAAMe,IAAAA,KAAU,WAAA,EAAC;YACfhB,QAAQ;YACRC,QAAQ;YACRP,GAAG;SACJ,CAAC,CAAC;IACL,EAAE,OAAOuB,CAAC,EAAE;QACV,IAAIA,CAAC,YAAYC,OAAU,WAAA,IAAID,CAAC,CAACE,kBAAkB,KAAK,4BAA4B,EAAE;YACpF,MAAMC,IAAAA,IAAqC,sCAAA,EACzCpB,QAAQ,EACRC,QAAQ,EACRgB,CAAC,CAACI,sBAAsB,CACzB,CAAC;QACJ,OAAO;YACL,MAAMJ,CAAC,CAAC;QACV,CAAC;IACH,CAAC;AACH,CAAC;AAGM,eAAezB,mBAAmB,GAAmB;IAC1D,IAAI8B,IAAI,GAAG,MAAMC,IAAAA,KAAY,aAAA,GAAE,CAACC,KAAK,CAAC,IAAM,IAAI,CAAC,AAAC;IAElD,IAAI,CAACF,IAAI,EAAE;QACTnB,IAAG,CAACsB,IAAI,CAACC,MAAK,EAAA,QAAA,CAACC,MAAM,CAAC,4CAA4C,CAAC,CAAC,CAAC;QACrE,MAAMpC,oBAAoB,CAAC;YAAEE,YAAY,EAAE,IAAI;SAAE,CAAC,CAAC;QACnD6B,IAAI,GAAG,MAAMC,IAAAA,KAAY,aAAA,GAAE,CAAC;IAC9B,CAAC;IAEDR,IAAAA,OAAM,EAAA,QAAA,EAACO,IAAI,EAAE,0BAA0B,CAAC,CAAC;IACzC,OAAOA,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -62,6 +62,7 @@ function _path() {
|
|
|
62
62
|
return data;
|
|
63
63
|
}
|
|
64
64
|
const _exportHermes = require("./exportHermes");
|
|
65
|
+
const _attachAtlas = require("../start/server/metro/debugging/attachAtlas");
|
|
65
66
|
const _instantiateMetro = require("../start/server/metro/instantiateMetro");
|
|
66
67
|
const _manifestMiddleware = require("../start/server/middleware/ManifestMiddleware");
|
|
67
68
|
const _metroOptions = require("../start/server/middleware/metroOptions");
|
|
@@ -125,6 +126,14 @@ async function bundleProductionMetroClientAsync(projectRoot, expoConfig, metroOp
|
|
|
125
126
|
}
|
|
126
127
|
});
|
|
127
128
|
assertMetroConfig(config);
|
|
129
|
+
// Attach Expo Atlas if enabled
|
|
130
|
+
await (0, _attachAtlas.attachAtlasAsync)({
|
|
131
|
+
exp: expoConfig,
|
|
132
|
+
projectRoot,
|
|
133
|
+
metroConfig: config,
|
|
134
|
+
isExporting: true,
|
|
135
|
+
resetAtlasFile: true
|
|
136
|
+
});
|
|
128
137
|
const metroServer = await _metro().default.runMetro(config, {
|
|
129
138
|
watch: false
|
|
130
139
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/fork-bundleAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfigFilePaths, Platform, ProjectConfig } from '@expo/config';\nimport { LoadOptions } from '@expo/metro-config';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport Metro, { MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type { TransformInputOptions } from 'metro/src/DeltaBundler/types';\nimport IncrementalBundler from 'metro/src/IncrementalBundler';\nimport Server from 'metro/src/Server';\nimport splitBundleOptions from 'metro/src/lib/splitBundleOptions';\nimport type {\n ResolverInputOptions,\n BundleOptions as MetroBundleOptions,\n} from 'metro/src/shared/types';\nimport { ConfigT } from 'metro-config';\nimport path from 'path';\n\nimport { isEnableHermesManaged, maybeThrowFromInconsistentEngineAsync } from './exportHermes';\nimport { loadMetroConfigAsync } from '../start/server/metro/instantiateMetro';\nimport { getEntryWithServerRoot } from '../start/server/middleware/ManifestMiddleware';\nimport {\n ExpoMetroBundleOptions,\n getMetroDirectBundleOptionsForExpoConfig,\n} from '../start/server/middleware/metroOptions';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\n\nexport type MetroDevServerOptions = LoadOptions;\n\nexport type BundleOptions = {\n entryPoint: string;\n platform: 'android' | 'ios' | 'web';\n dev?: boolean;\n minify?: boolean;\n bytecode: boolean;\n sourceMapUrl?: string;\n sourcemaps?: boolean;\n};\nexport type BundleAssetWithFileHashes = Metro.AssetData & {\n fileHashes: string[]; // added by the hashAssets asset plugin\n};\nexport type BundleOutput = {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n};\n\nlet nextBuildID = 0;\n\nasync function assertEngineMismatchAsync(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'ios' | 'android' | 'jsEngine'>,\n platform: Platform\n) {\n const isHermesManaged = isEnableHermesManaged(exp, platform);\n\n const paths = getConfigFilePaths(projectRoot);\n const configFilePath = paths.dynamicConfigPath ?? paths.staticConfigPath ?? 'app.json';\n await maybeThrowFromInconsistentEngineAsync(\n projectRoot,\n configFilePath,\n platform,\n isHermesManaged\n );\n}\n\nexport async function createBundlesAsync(\n projectRoot: string,\n projectConfig: ProjectConfig,\n bundleOptions: {\n clear?: boolean;\n maxWorkers?: number;\n platforms: Platform[];\n dev?: boolean;\n minify?: boolean;\n bytecode: boolean;\n sourcemaps?: boolean;\n entryPoint?: string;\n }\n): Promise<Partial<Record<Platform, BundleOutput>>> {\n if (!bundleOptions.platforms.length) {\n return {};\n }\n const { exp, pkg } = projectConfig;\n\n const bundles = await bundleProductionMetroClientAsync(\n projectRoot,\n exp,\n {\n // If not legacy, ignore the target option to prevent warnings from being thrown.\n resetCache: bundleOptions.clear,\n maxWorkers: bundleOptions.maxWorkers,\n },\n bundleOptions.platforms.map((platform: Platform) => ({\n platform,\n entryPoint:\n bundleOptions.entryPoint ?? getEntryWithServerRoot(projectRoot, { platform, pkg }),\n sourcemaps: bundleOptions.sourcemaps,\n minify: bundleOptions.minify,\n bytecode: bundleOptions.bytecode,\n dev: bundleOptions.dev,\n }))\n );\n\n // { ios: bundle, android: bundle }\n return bundleOptions.platforms.reduce<Partial<Record<Platform, BundleOutput>>>(\n (prev, platform, index) => ({\n ...prev,\n [platform]: bundles[index],\n }),\n {}\n );\n}\n\nfunction assertMetroConfig(\n config: ConfigT\n): asserts config is ConfigT & { serializer: NonNullable<ConfigT['serializer']> } {\n if (!config.serializer?.customSerializer) {\n throw new CommandError(\n 'METRO_CONFIG_MALFORMED',\n `The Metro bundler configuration is missing required features from 'expo/metro-config' and cannot be used with Expo CLI. Ensure the metro.config.js file is extending 'expo/metro-config'. Learn more: https://docs.expo.dev/guides/customizing-metro`\n );\n }\n}\n\nasync function bundleProductionMetroClientAsync(\n projectRoot: string,\n expoConfig: ExpoConfig,\n metroOptions: MetroDevServerOptions,\n bundles: BundleOptions[]\n): Promise<BundleOutput[]> {\n // Assert early so the user doesn't have to wait until bundling is complete to find out that\n // Hermes won't be available.\n await Promise.all(\n bundles.map(({ platform }) => assertEngineMismatchAsync(projectRoot, expoConfig, platform))\n );\n\n const { config, reporter } = await loadMetroConfigAsync(projectRoot, metroOptions, {\n exp: expoConfig,\n isExporting: true,\n getMetroBundler() {\n return metroServer.getBundler().getBundler();\n },\n });\n\n assertMetroConfig(config);\n\n const metroServer = await Metro.runMetro(config, {\n watch: false,\n });\n\n const buildAsync = async (bundle: BundleOptions): Promise<BundleOutput> => {\n const buildID = `bundle_${nextBuildID++}_${bundle.platform}`;\n const isHermes = isEnableHermesManaged(expoConfig, bundle.platform);\n if (isHermes) {\n await assertEngineMismatchAsync(projectRoot, expoConfig, bundle.platform);\n }\n const bundleOptions: MetroBundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n sourceMapUrl: bundle.sourceMapUrl,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, expoConfig, {\n splitChunks: !env.EXPO_NO_BUNDLE_SPLITTING && bundle.platform === 'web',\n minify: bundle.minify,\n mainModuleName: bundle.entryPoint,\n platform: bundle.platform,\n mode: bundle.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: bundle.sourcemaps,\n bytecode: bundle.bytecode && isHermes,\n // Bundle splitting on web-only for now.\n // serializerOutput: bundle.platform === 'web' ? 'static' : undefined,\n serializerOutput: 'static',\n isExporting: true,\n }),\n bundleType: 'bundle',\n inlineSourceMap: false,\n createModuleIdFactory: config.serializer.createModuleIdFactory,\n onProgress: (transformedFileCount: number, totalFileCount: number) => {\n reporter.update({\n buildID,\n type: 'bundle_transform_progressed',\n transformedFileCount,\n totalFileCount,\n });\n },\n };\n\n const bundleDetails = {\n ...bundleOptions,\n buildID,\n };\n reporter.update({\n buildID,\n type: 'bundle_build_started',\n bundleDetails,\n });\n try {\n const artifacts = await forkMetroBuildAsync(metroServer, bundleOptions);\n reporter.update({\n buildID,\n type: 'bundle_build_done',\n });\n return artifacts;\n } catch (error) {\n reporter.update({\n buildID,\n type: 'bundle_build_failed',\n });\n\n throw error;\n }\n };\n\n try {\n return await Promise.all(bundles.map((bundle) => buildAsync(bundle)));\n } catch (error) {\n // New line so errors don't show up inline with the progress bar\n console.log('');\n throw error;\n } finally {\n metroServer.end();\n }\n}\n\n// Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n// behavior.\nexport async function getAssets(metro: Metro.Server, options: MetroBundleOptions) {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions(options);\n\n // @ts-expect-error: _bundler isn't exposed on the type.\n const dependencies = await metro._bundler.getDependencies(\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n // @ts-expect-error\n const _config = metro._config as ConfigT;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: _config.serializer.processModuleFilter,\n assetPlugins: _config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n projectRoot: _config.projectRoot, // this._getServerRootDir(),\n publicPath: _config.transformer.publicPath,\n });\n}\n\nfunction isMetroServerInstance(metro: Metro.Server): metro is Metro.Server & {\n _shouldAddModuleToIgnoreList: (module: Module<MixedOutput>) => boolean;\n _bundler: IncrementalBundler;\n _config: ConfigT;\n _createModuleId: (path: string) => number;\n _resolveRelativePath(\n filePath: string,\n {\n relativeTo,\n resolverOptions,\n transformOptions,\n }: {\n relativeTo: 'project' | 'server';\n resolverOptions: ResolverInputOptions;\n transformOptions: TransformInputOptions;\n }\n ): Promise<string>;\n _getEntryPointAbsolutePath(entryFile: string): string;\n _getSortedModules(graph: ReadOnlyGraph): Module<MixedOutput>[];\n} {\n return '_shouldAddModuleToIgnoreList' in metro;\n}\n\nasync function forkMetroBuildAsync(\n metro: Metro.Server,\n options: ExpoMetroBundleOptions\n): Promise<{ artifacts: SerialAsset[]; assets: readonly BundleAssetWithFileHashes[] }> {\n if (!isMetroServerInstance(metro)) {\n throw new Error('Expected Metro server instance to have private functions exposed.');\n }\n\n if (options.serializerOptions?.output !== 'static') {\n throw new Error('Only multi-serializer output is supported.');\n }\n\n const {\n entryFile,\n graphOptions,\n onProgress,\n resolverOptions,\n serializerOptions,\n transformOptions,\n } = splitBundleOptions(options);\n\n const { prepend, graph } = await metro._bundler.buildGraph(\n entryFile,\n transformOptions,\n resolverOptions,\n {\n onProgress,\n shallow: graphOptions.shallow,\n // @ts-expect-error\n lazy: graphOptions.lazy,\n }\n );\n\n const entryPoint = metro._getEntryPointAbsolutePath(entryFile);\n\n const bundleOptions = {\n asyncRequireModulePath: await metro._resolveRelativePath(\n metro._config.transformer.asyncRequireModulePath,\n {\n relativeTo: 'project',\n resolverOptions,\n transformOptions,\n }\n ),\n processModuleFilter: metro._config.serializer.processModuleFilter,\n createModuleId: metro._createModuleId,\n getRunModuleStatement: metro._config.serializer.getRunModuleStatement,\n dev: transformOptions.dev,\n includeAsyncPaths: graphOptions.lazy,\n projectRoot: metro._config.projectRoot,\n modulesOnly: serializerOptions.modulesOnly,\n runBeforeMainModule: metro._config.serializer.getModulesRunBeforeMainModule(\n path.relative(metro._config.projectRoot, entryPoint)\n ),\n runModule: serializerOptions.runModule,\n sourceMapUrl: serializerOptions.sourceMapUrl,\n sourceUrl: serializerOptions.sourceUrl,\n inlineSourceMap: serializerOptions.inlineSourceMap,\n serverRoot: metro._config.server.unstable_serverRoot ?? metro._config.projectRoot,\n shouldAddToIgnoreList: (module: Module<MixedOutput>) =>\n metro._shouldAddModuleToIgnoreList(module),\n // Custom options we pass to the serializer to emulate the URL query parameters.\n serializerOptions: options.serializerOptions,\n };\n\n assertMetroConfig(metro._config);\n\n const bundle = await metro._config.serializer.customSerializer!(\n entryPoint,\n // @ts-expect-error: Metro is typed incorrectly\n prepend,\n graph,\n bundleOptions\n );\n\n try {\n const parsed = typeof bundle === 'string' ? JSON.parse(bundle) : bundle;\n\n assert(\n 'artifacts' in parsed && Array.isArray(parsed.artifacts),\n 'Expected serializer to return an object with key artifacts to contain an array of serial assets.'\n );\n return parsed;\n } catch (error: any) {\n throw new Error(\n 'Serializer did not return expected format. The project copy of `expo/metro-config` may be out of date. Error: ' +\n error.message\n );\n }\n}\n"],"names":["createBundlesAsync","getAssets","nextBuildID","assertEngineMismatchAsync","projectRoot","exp","platform","isHermesManaged","isEnableHermesManaged","paths","getConfigFilePaths","configFilePath","dynamicConfigPath","staticConfigPath","maybeThrowFromInconsistentEngineAsync","projectConfig","bundleOptions","platforms","length","pkg","bundles","bundleProductionMetroClientAsync","resetCache","clear","maxWorkers","map","entryPoint","getEntryWithServerRoot","sourcemaps","minify","bytecode","dev","reduce","prev","index","assertMetroConfig","config","serializer","customSerializer","CommandError","expoConfig","metroOptions","Promise","all","reporter","loadMetroConfigAsync","isExporting","getMetroBundler","metroServer","getBundler","Metro","runMetro","watch","buildAsync","bundle","buildID","isHermes","Server","DEFAULT_BUNDLE_OPTIONS","sourceMapUrl","getMetroDirectBundleOptionsForExpoConfig","splitChunks","env","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","mode","engine","undefined","serializerIncludeMaps","serializerOutput","bundleType","inlineSourceMap","createModuleIdFactory","onProgress","transformedFileCount","totalFileCount","update","type","bundleDetails","artifacts","forkMetroBuildAsync","error","console","log","end","metro","options","entryFile","resolverOptions","transformOptions","splitBundleOptions","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","assetPlugins","transformer","publicPath","isMetroServerInstance","Error","serializerOptions","output","graphOptions","prepend","graph","buildGraph","_getEntryPointAbsolutePath","asyncRequireModulePath","_resolveRelativePath","relativeTo","createModuleId","_createModuleId","getRunModuleStatement","includeAsyncPaths","modulesOnly","runBeforeMainModule","getModulesRunBeforeMainModule","path","relative","runModule","sourceUrl","serverRoot","server","unstable_serverRoot","shouldAddToIgnoreList","module","_shouldAddModuleToIgnoreList","parsed","JSON","parse","assert","Array","isArray","message"],"mappings":"AAAA;;;;;;;;;;;IAiEsBA,kBAAkB,MAAlBA,kBAAkB;IAgKlBC,SAAS,MAATA,SAAS;;;yBAjOyC,cAAc;;;;;;;8DAG3D,qDAAqD;;;;;;;8DAC7D,QAAQ;;;;;;;8DAC+B,OAAO;;;;;;;8DAG9C,kBAAkB;;;;;;;8DACN,kCAAkC;;;;;;;8DAMhD,MAAM;;;;;;8BAEsD,gBAAgB;kCACxD,wCAAwC;oCACtC,+CAA+C;8BAI/E,yCAAyC;qBAC5B,cAAc;wBACL,iBAAiB;;;;;;AAqB9C,IAAIC,WAAW,GAAG,CAAC,AAAC;AAEpB,eAAeC,yBAAyB,CACtCC,WAAmB,EACnBC,GAAqD,EACrDC,QAAkB,EAClB;IACA,MAAMC,eAAe,GAAGC,IAAAA,aAAqB,sBAAA,EAACH,GAAG,EAAEC,QAAQ,CAAC,AAAC;IAE7D,MAAMG,KAAK,GAAGC,IAAAA,OAAkB,EAAA,mBAAA,EAACN,WAAW,CAAC,AAAC;QACvBK,kBAAuB,EAAvBA,GAAiD;IAAxE,MAAME,cAAc,GAAGF,CAAAA,GAAiD,GAAjDA,CAAAA,kBAAuB,GAAvBA,KAAK,CAACG,iBAAiB,YAAvBH,kBAAuB,GAAIA,KAAK,CAACI,gBAAgB,YAAjD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,iBAAiB,CAAC7C,YAAY;QAC5CiE,SAAS,EAAEpB,iBAAiB,CAACoB,SAAS;QACtCrD,eAAe,EAAEiC,iBAAiB,CAACjC,eAAe;QAClDsD,UAAU,EAAExC,CAAAA,oBAAwC,GAAxCA,KAAK,CAACW,OAAO,CAAC8B,MAAM,CAACC,mBAAmB,YAAxC1C,oBAAwC,GAAIA,KAAK,CAACW,OAAO,CAAC5F,WAAW;QACjF4H,qBAAqB,EAAE,CAACC,MAA2B,GACjD5C,KAAK,CAAC6C,4BAA4B,CAACD,MAAM,CAAC;QAC5C,gFAAgF;QAChFzB,iBAAiB,EAAElB,OAAO,CAACkB,iBAAiB;KAC7C,AAAC;IAEFrE,iBAAiB,CAACkD,KAAK,CAACW,OAAO,CAAC,CAAC;IAEjC,MAAM1C,MAAM,GAAG,MAAM+B,KAAK,CAACW,OAAO,CAAC3D,UAAU,CAACC,gBAAgB,CAC5DZ,UAAU,EACV,+CAA+C;IAC/CiF,OAAO,EACPC,KAAK,EACL5F,aAAa,CACd,AAAC;IAEF,IAAI;QACF,MAAMmH,MAAM,GAAG,OAAO7E,MAAM,KAAK,QAAQ,GAAG8E,IAAI,CAACC,KAAK,CAAC/E,MAAM,CAAC,GAAGA,MAAM,AAAC;QAExEgF,IAAAA,OAAM,EAAA,QAAA,EACJ,WAAW,IAAIH,MAAM,IAAII,KAAK,CAACC,OAAO,CAACL,MAAM,CAACpD,SAAS,CAAC,EACxD,kGAAkG,CACnG,CAAC;QACF,OAAOoD,MAAM,CAAC;IAChB,EAAE,OAAOlD,KAAK,EAAO;QACnB,MAAM,IAAIsB,KAAK,CACb,gHAAgH,GAC9GtB,KAAK,CAACwD,OAAO,CAChB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/fork-bundleAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfigFilePaths, Platform, ProjectConfig } from '@expo/config';\nimport { LoadOptions } from '@expo/metro-config';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport Metro, { MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type { TransformInputOptions } from 'metro/src/DeltaBundler/types';\nimport IncrementalBundler from 'metro/src/IncrementalBundler';\nimport Server from 'metro/src/Server';\nimport splitBundleOptions from 'metro/src/lib/splitBundleOptions';\nimport type {\n ResolverInputOptions,\n BundleOptions as MetroBundleOptions,\n} from 'metro/src/shared/types';\nimport { ConfigT } from 'metro-config';\nimport path from 'path';\n\nimport { isEnableHermesManaged, maybeThrowFromInconsistentEngineAsync } from './exportHermes';\nimport { attachAtlasAsync } from '../start/server/metro/debugging/attachAtlas';\nimport { loadMetroConfigAsync } from '../start/server/metro/instantiateMetro';\nimport { getEntryWithServerRoot } from '../start/server/middleware/ManifestMiddleware';\nimport {\n ExpoMetroBundleOptions,\n getMetroDirectBundleOptionsForExpoConfig,\n} from '../start/server/middleware/metroOptions';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\n\nexport type MetroDevServerOptions = LoadOptions;\n\nexport type BundleOptions = {\n entryPoint: string;\n platform: 'android' | 'ios' | 'web';\n dev?: boolean;\n minify?: boolean;\n bytecode: boolean;\n sourceMapUrl?: string;\n sourcemaps?: boolean;\n};\nexport type BundleAssetWithFileHashes = Metro.AssetData & {\n fileHashes: string[]; // added by the hashAssets asset plugin\n};\nexport type BundleOutput = {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n};\n\nlet nextBuildID = 0;\n\nasync function assertEngineMismatchAsync(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'ios' | 'android' | 'jsEngine'>,\n platform: Platform\n) {\n const isHermesManaged = isEnableHermesManaged(exp, platform);\n\n const paths = getConfigFilePaths(projectRoot);\n const configFilePath = paths.dynamicConfigPath ?? paths.staticConfigPath ?? 'app.json';\n await maybeThrowFromInconsistentEngineAsync(\n projectRoot,\n configFilePath,\n platform,\n isHermesManaged\n );\n}\n\nexport async function createBundlesAsync(\n projectRoot: string,\n projectConfig: ProjectConfig,\n bundleOptions: {\n clear?: boolean;\n maxWorkers?: number;\n platforms: Platform[];\n dev?: boolean;\n minify?: boolean;\n bytecode: boolean;\n sourcemaps?: boolean;\n entryPoint?: string;\n }\n): Promise<Partial<Record<Platform, BundleOutput>>> {\n if (!bundleOptions.platforms.length) {\n return {};\n }\n const { exp, pkg } = projectConfig;\n\n const bundles = await bundleProductionMetroClientAsync(\n projectRoot,\n exp,\n {\n // If not legacy, ignore the target option to prevent warnings from being thrown.\n resetCache: bundleOptions.clear,\n maxWorkers: bundleOptions.maxWorkers,\n },\n bundleOptions.platforms.map((platform: Platform) => ({\n platform,\n entryPoint:\n bundleOptions.entryPoint ?? getEntryWithServerRoot(projectRoot, { platform, pkg }),\n sourcemaps: bundleOptions.sourcemaps,\n minify: bundleOptions.minify,\n bytecode: bundleOptions.bytecode,\n dev: bundleOptions.dev,\n }))\n );\n\n // { ios: bundle, android: bundle }\n return bundleOptions.platforms.reduce<Partial<Record<Platform, BundleOutput>>>(\n (prev, platform, index) => ({\n ...prev,\n [platform]: bundles[index],\n }),\n {}\n );\n}\n\nfunction assertMetroConfig(\n config: ConfigT\n): asserts config is ConfigT & { serializer: NonNullable<ConfigT['serializer']> } {\n if (!config.serializer?.customSerializer) {\n throw new CommandError(\n 'METRO_CONFIG_MALFORMED',\n `The Metro bundler configuration is missing required features from 'expo/metro-config' and cannot be used with Expo CLI. Ensure the metro.config.js file is extending 'expo/metro-config'. Learn more: https://docs.expo.dev/guides/customizing-metro`\n );\n }\n}\n\nasync function bundleProductionMetroClientAsync(\n projectRoot: string,\n expoConfig: ExpoConfig,\n metroOptions: MetroDevServerOptions,\n bundles: BundleOptions[]\n): Promise<BundleOutput[]> {\n // Assert early so the user doesn't have to wait until bundling is complete to find out that\n // Hermes won't be available.\n await Promise.all(\n bundles.map(({ platform }) => assertEngineMismatchAsync(projectRoot, expoConfig, platform))\n );\n\n const { config, reporter } = await loadMetroConfigAsync(projectRoot, metroOptions, {\n exp: expoConfig,\n isExporting: true,\n getMetroBundler() {\n return metroServer.getBundler().getBundler();\n },\n });\n\n assertMetroConfig(config);\n\n // Attach Expo Atlas if enabled\n await attachAtlasAsync({\n exp: expoConfig,\n projectRoot,\n metroConfig: config,\n isExporting: true,\n resetAtlasFile: true, // NOTE(cedric): reset the Atlas file once, and reuse it for static exports\n });\n\n const metroServer = await Metro.runMetro(config, {\n watch: false,\n });\n\n const buildAsync = async (bundle: BundleOptions): Promise<BundleOutput> => {\n const buildID = `bundle_${nextBuildID++}_${bundle.platform}`;\n const isHermes = isEnableHermesManaged(expoConfig, bundle.platform);\n if (isHermes) {\n await assertEngineMismatchAsync(projectRoot, expoConfig, bundle.platform);\n }\n const bundleOptions: MetroBundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n sourceMapUrl: bundle.sourceMapUrl,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, expoConfig, {\n splitChunks: !env.EXPO_NO_BUNDLE_SPLITTING && bundle.platform === 'web',\n minify: bundle.minify,\n mainModuleName: bundle.entryPoint,\n platform: bundle.platform,\n mode: bundle.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: bundle.sourcemaps,\n bytecode: bundle.bytecode && isHermes,\n // Bundle splitting on web-only for now.\n // serializerOutput: bundle.platform === 'web' ? 'static' : undefined,\n serializerOutput: 'static',\n isExporting: true,\n }),\n bundleType: 'bundle',\n inlineSourceMap: false,\n createModuleIdFactory: config.serializer.createModuleIdFactory,\n onProgress: (transformedFileCount: number, totalFileCount: number) => {\n reporter.update({\n buildID,\n type: 'bundle_transform_progressed',\n transformedFileCount,\n totalFileCount,\n });\n },\n };\n\n const bundleDetails = {\n ...bundleOptions,\n buildID,\n };\n reporter.update({\n buildID,\n type: 'bundle_build_started',\n bundleDetails,\n });\n try {\n const artifacts = await forkMetroBuildAsync(metroServer, bundleOptions);\n reporter.update({\n buildID,\n type: 'bundle_build_done',\n });\n return artifacts;\n } catch (error) {\n reporter.update({\n buildID,\n type: 'bundle_build_failed',\n });\n\n throw error;\n }\n };\n\n try {\n return await Promise.all(bundles.map((bundle) => buildAsync(bundle)));\n } catch (error) {\n // New line so errors don't show up inline with the progress bar\n console.log('');\n throw error;\n } finally {\n metroServer.end();\n }\n}\n\n// Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n// behavior.\nexport async function getAssets(metro: Metro.Server, options: MetroBundleOptions) {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions(options);\n\n // @ts-expect-error: _bundler isn't exposed on the type.\n const dependencies = await metro._bundler.getDependencies(\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n // @ts-expect-error\n const _config = metro._config as ConfigT;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: _config.serializer.processModuleFilter,\n assetPlugins: _config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n projectRoot: _config.projectRoot, // this._getServerRootDir(),\n publicPath: _config.transformer.publicPath,\n });\n}\n\nfunction isMetroServerInstance(metro: Metro.Server): metro is Metro.Server & {\n _shouldAddModuleToIgnoreList: (module: Module<MixedOutput>) => boolean;\n _bundler: IncrementalBundler;\n _config: ConfigT;\n _createModuleId: (path: string) => number;\n _resolveRelativePath(\n filePath: string,\n {\n relativeTo,\n resolverOptions,\n transformOptions,\n }: {\n relativeTo: 'project' | 'server';\n resolverOptions: ResolverInputOptions;\n transformOptions: TransformInputOptions;\n }\n ): Promise<string>;\n _getEntryPointAbsolutePath(entryFile: string): string;\n _getSortedModules(graph: ReadOnlyGraph): Module<MixedOutput>[];\n} {\n return '_shouldAddModuleToIgnoreList' in metro;\n}\n\nasync function forkMetroBuildAsync(\n metro: Metro.Server,\n options: ExpoMetroBundleOptions\n): Promise<{ artifacts: SerialAsset[]; assets: readonly BundleAssetWithFileHashes[] }> {\n if (!isMetroServerInstance(metro)) {\n throw new Error('Expected Metro server instance to have private functions exposed.');\n }\n\n if (options.serializerOptions?.output !== 'static') {\n throw new Error('Only multi-serializer output is supported.');\n }\n\n const {\n entryFile,\n graphOptions,\n onProgress,\n resolverOptions,\n serializerOptions,\n transformOptions,\n } = splitBundleOptions(options);\n\n const { prepend, graph } = await metro._bundler.buildGraph(\n entryFile,\n transformOptions,\n resolverOptions,\n {\n onProgress,\n shallow: graphOptions.shallow,\n // @ts-expect-error\n lazy: graphOptions.lazy,\n }\n );\n\n const entryPoint = metro._getEntryPointAbsolutePath(entryFile);\n\n const bundleOptions = {\n asyncRequireModulePath: await metro._resolveRelativePath(\n metro._config.transformer.asyncRequireModulePath,\n {\n relativeTo: 'project',\n resolverOptions,\n transformOptions,\n }\n ),\n processModuleFilter: metro._config.serializer.processModuleFilter,\n createModuleId: metro._createModuleId,\n getRunModuleStatement: metro._config.serializer.getRunModuleStatement,\n dev: transformOptions.dev,\n includeAsyncPaths: graphOptions.lazy,\n projectRoot: metro._config.projectRoot,\n modulesOnly: serializerOptions.modulesOnly,\n runBeforeMainModule: metro._config.serializer.getModulesRunBeforeMainModule(\n path.relative(metro._config.projectRoot, entryPoint)\n ),\n runModule: serializerOptions.runModule,\n sourceMapUrl: serializerOptions.sourceMapUrl,\n sourceUrl: serializerOptions.sourceUrl,\n inlineSourceMap: serializerOptions.inlineSourceMap,\n serverRoot: metro._config.server.unstable_serverRoot ?? metro._config.projectRoot,\n shouldAddToIgnoreList: (module: Module<MixedOutput>) =>\n metro._shouldAddModuleToIgnoreList(module),\n // Custom options we pass to the serializer to emulate the URL query parameters.\n serializerOptions: options.serializerOptions,\n };\n\n assertMetroConfig(metro._config);\n\n const bundle = await metro._config.serializer.customSerializer!(\n entryPoint,\n // @ts-expect-error: Metro is typed incorrectly\n prepend,\n graph,\n bundleOptions\n );\n\n try {\n const parsed = typeof bundle === 'string' ? JSON.parse(bundle) : bundle;\n\n assert(\n 'artifacts' in parsed && Array.isArray(parsed.artifacts),\n 'Expected serializer to return an object with key artifacts to contain an array of serial assets.'\n );\n return parsed;\n } catch (error: any) {\n throw new Error(\n 'Serializer did not return expected format. The project copy of `expo/metro-config` may be out of date. Error: ' +\n error.message\n );\n }\n}\n"],"names":["createBundlesAsync","getAssets","nextBuildID","assertEngineMismatchAsync","projectRoot","exp","platform","isHermesManaged","isEnableHermesManaged","paths","getConfigFilePaths","configFilePath","dynamicConfigPath","staticConfigPath","maybeThrowFromInconsistentEngineAsync","projectConfig","bundleOptions","platforms","length","pkg","bundles","bundleProductionMetroClientAsync","resetCache","clear","maxWorkers","map","entryPoint","getEntryWithServerRoot","sourcemaps","minify","bytecode","dev","reduce","prev","index","assertMetroConfig","config","serializer","customSerializer","CommandError","expoConfig","metroOptions","Promise","all","reporter","loadMetroConfigAsync","isExporting","getMetroBundler","metroServer","getBundler","attachAtlasAsync","metroConfig","resetAtlasFile","Metro","runMetro","watch","buildAsync","bundle","buildID","isHermes","Server","DEFAULT_BUNDLE_OPTIONS","sourceMapUrl","getMetroDirectBundleOptionsForExpoConfig","splitChunks","env","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","mode","engine","undefined","serializerIncludeMaps","serializerOutput","bundleType","inlineSourceMap","createModuleIdFactory","onProgress","transformedFileCount","totalFileCount","update","type","bundleDetails","artifacts","forkMetroBuildAsync","error","console","log","end","metro","options","entryFile","resolverOptions","transformOptions","splitBundleOptions","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","assetPlugins","transformer","publicPath","isMetroServerInstance","Error","serializerOptions","output","graphOptions","prepend","graph","buildGraph","_getEntryPointAbsolutePath","asyncRequireModulePath","_resolveRelativePath","relativeTo","createModuleId","_createModuleId","getRunModuleStatement","includeAsyncPaths","modulesOnly","runBeforeMainModule","getModulesRunBeforeMainModule","path","relative","runModule","sourceUrl","serverRoot","server","unstable_serverRoot","shouldAddToIgnoreList","module","_shouldAddModuleToIgnoreList","parsed","JSON","parse","assert","Array","isArray","message"],"mappings":"AAAA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A,KAAK,CAACW,OAAO,CAAC/F,WAAW;QACjF+H,qBAAqB,EAAE,CAACC,MAA2B,GACjD5C,KAAK,CAAC6C,4BAA4B,CAACD,MAAM,CAAC;QAC5C,gFAAgF;QAChFzB,iBAAiB,EAAElB,OAAO,CAACkB,iBAAiB;KAC7C,AAAC;IAEFxE,iBAAiB,CAACqD,KAAK,CAACW,OAAO,CAAC,CAAC;IAEjC,MAAM1C,MAAM,GAAG,MAAM+B,KAAK,CAACW,OAAO,CAAC9D,UAAU,CAACC,gBAAgB,CAC5DZ,UAAU,EACV,+CAA+C;IAC/CoF,OAAO,EACPC,KAAK,EACL/F,aAAa,CACd,AAAC;IAEF,IAAI;QACF,MAAMsH,MAAM,GAAG,OAAO7E,MAAM,KAAK,QAAQ,GAAG8E,IAAI,CAACC,KAAK,CAAC/E,MAAM,CAAC,GAAGA,MAAM,AAAC;QAExEgF,IAAAA,OAAM,EAAA,QAAA,EACJ,WAAW,IAAIH,MAAM,IAAII,KAAK,CAACC,OAAO,CAACL,MAAM,CAACpD,SAAS,CAAC,EACxD,kGAAkG,CACnG,CAAC;QACF,OAAOoD,MAAM,CAAC;IAChB,EAAE,OAAOlD,KAAK,EAAO;QACnB,MAAM,IAAIsB,KAAK,CACb,gHAAgH,GAC9GtB,KAAK,CAACwD,OAAO,CAChB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -206,8 +206,11 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
208
|
async getExpoRouterRoutesManifestAsync({ appDir }) {
|
|
209
|
+
var ref, ref1;
|
|
209
210
|
// getBuiltTimeServerManifest
|
|
211
|
+
const { exp } = (0, _config().getConfig)(this.projectRoot);
|
|
210
212
|
const manifest = await (0, _fetchRouterManifest.fetchManifest)(this.projectRoot, {
|
|
213
|
+
...(ref = exp.extra) == null ? void 0 : (ref1 = ref.router) == null ? void 0 : ref1.platformRoutes,
|
|
211
214
|
asJson: true,
|
|
212
215
|
appDir
|
|
213
216
|
});
|
|
@@ -217,6 +220,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
217
220
|
return manifest;
|
|
218
221
|
}
|
|
219
222
|
async getStaticRenderFunctionAsync() {
|
|
223
|
+
var ref;
|
|
220
224
|
const { mode , minify , isExporting } = this.instanceMetroOptions;
|
|
221
225
|
(0, _assert().default)(mode != null && isExporting != null, "The server must be started before calling ssrLoadModule.");
|
|
222
226
|
const url = this.getDevServerUrl();
|
|
@@ -225,11 +229,13 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
225
229
|
mode,
|
|
226
230
|
isExporting
|
|
227
231
|
});
|
|
232
|
+
const { exp } = (0, _config().getConfig)(this.projectRoot);
|
|
228
233
|
return {
|
|
229
234
|
serverManifest: await getBuildTimeServerManifestAsync(),
|
|
230
235
|
// Get routes from Expo Router.
|
|
231
236
|
manifest: await getManifest({
|
|
232
|
-
preserveApiRoutes: false
|
|
237
|
+
preserveApiRoutes: false,
|
|
238
|
+
...(ref = exp.extra) == null ? void 0 : ref.router
|
|
233
239
|
}),
|
|
234
240
|
// Get route generating function
|
|
235
241
|
async renderAsync (path) {
|
|
@@ -484,10 +490,12 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
484
490
|
// This should come after the static middleware so it doesn't serve the favicon from `public/favicon.ico`.
|
|
485
491
|
middleware.use(new _faviconMiddleware.FaviconMiddleware(this.projectRoot).getHandler());
|
|
486
492
|
if (useServerRendering) {
|
|
493
|
+
var ref2;
|
|
487
494
|
middleware.use((0, _createServerRouteMiddleware.createRouteHandlerMiddleware)(this.projectRoot, {
|
|
488
495
|
appDir,
|
|
489
496
|
routerRoot,
|
|
490
497
|
config,
|
|
498
|
+
...(ref2 = config.exp.extra) == null ? void 0 : ref2.router,
|
|
491
499
|
bundleApiRoute: (functionFilePath)=>this.ssrImportApiRoute(functionFilePath),
|
|
492
500
|
getStaticPageAsync: (pathname)=>{
|
|
493
501
|
return this.getStaticPageAsync(pathname);
|
|
@@ -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 assert from 'assert';\nimport chalk from 'chalk';\nimport { AssetData } from 'metro';\nimport fetch from 'node-fetch';\nimport path from 'path';\n\nimport { createRouteHandlerMiddleware } from './createServerRouteMiddleware';\nimport { ExpoRouterServerManifestV1, fetchManifest } from './fetchRouterManifest';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { getErrorOverlayHtmlAsync, logMetroErrorAsync } from './metroErrorInterface';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport {\n getRouterDirectoryModuleIdWithManifest,\n hasWarnedAboutApiRoutes,\n isApiRouteConvention,\n warnInvalidWebOutput,\n} 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 { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { logEventAsync } from '../../../utils/telemetry';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport {\n evalMetroNoHandling,\n getStaticRenderFunctionsForEntry,\n requireFileContentsWithMetro,\n} 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 ExpoMetroOptions,\n createBundleUrlPath,\n getAsyncRoutesFromExpoConfig,\n getBaseUrlFromExpoConfig,\n shouldEnableAsyncImports,\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 includeSourceMaps,\n outputDir,\n prerenderManifest,\n }: {\n includeSourceMaps?: boolean;\n outputDir: string;\n // This does not contain the API routes info.\n prerenderManifest: ExpoRouterServerManifestV1;\n }): Promise<{ files: ExportAssetMap; manifest: ExpoRouterServerManifestV1<string> }> {\n const { routerRoot } = this.instanceMetroOptions;\n assert(\n routerRoot != null,\n 'The server must be started before calling exportExpoRouterApiRoutesAsync.'\n );\n\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 this.bundleApiRoute(filepath);\n const artifactFilename = path.join(\n outputDir,\n path.relative(appDir, filepath.replace(/\\.[tj]sx?$/, '.js'))\n );\n if (contents) {\n let src = contents.src;\n if (includeSourceMaps && contents.map) {\n // TODO(kitten): Merge the source map transformer in the future\n // https://github.com/expo/expo/blob/0dffdb15/packages/%40expo/metro-config/src/serializer/serializeChunks.ts#L422-L439\n // Alternatively, check whether `sourcesRoot` helps here\n const artifactBasename = encodeURIComponent(path.basename(artifactFilename) + '.map');\n src = src.replace(\n /\\/\\/# sourceMappingURL=.*/g,\n `//# sourceMappingURL=${artifactBasename}`\n );\n files.set(artifactFilename + '.map', {\n contents: JSON.stringify({\n version: contents.map.version,\n sources: contents.map.sources.map((source: string) => {\n source =\n typeof source === 'string' && source.startsWith(this.projectRoot)\n ? path.relative(this.projectRoot, source)\n : source;\n return source.split(path.sep).join('/');\n }),\n sourcesContent: new Array(contents.map.sources.length).fill(null),\n names: contents.map.names,\n mappings: contents.map.mappings,\n }),\n targetDomain: 'server',\n });\n }\n files.set(artifactFilename, {\n contents: src,\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(): Promise<{\n serverManifest: ExpoRouterServerManifestV1;\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (path: string) => Promise<string>;\n }> {\n const { mode, minify, isExporting } = this.instanceMetroOptions;\n assert(\n mode != null && isExporting != null,\n 'The server must be started before calling ssrLoadModule.'\n );\n\n const url = this.getDevServerUrl()!;\n\n const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } =\n await this.ssrLoadModule<typeof import('expo-router/build/static/renderStaticContent')>(\n 'expo-router/node/render.js',\n {\n minify,\n mode,\n isExporting,\n }\n );\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync(),\n // Get routes from Expo Router.\n manifest: await getManifest({ 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 includeSourceMaps,\n mainModuleName,\n }: {\n includeSourceMaps?: boolean;\n mainModuleName?: string;\n } = {}): Promise<{ artifacts: SerialAsset[]; assets?: AssetData[] }> {\n const { mode, minify, isExporting, baseUrl, routerRoot, asyncRoutes } =\n this.instanceMetroOptions;\n assert(\n mode != null &&\n isExporting != null &&\n baseUrl != null &&\n routerRoot != null &&\n asyncRoutes != null,\n 'The server must be started before calling getStaticPageAsync.'\n );\n\n const platform = 'web';\n\n const devBundleUrlPathname = createBundleUrlPath({\n splitChunks: isExporting && !env.EXPO_NO_BUNDLE_SPLITTING,\n platform,\n mode,\n minify,\n environment: 'client',\n serializerOutput: 'static',\n serializerIncludeMaps: includeSourceMaps,\n mainModuleName: mainModuleName ?? resolveMainModuleName(this.projectRoot, { platform }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n asyncRoutes,\n baseUrl,\n isExporting,\n routerRoot,\n bytecode: false,\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(pathname: string) {\n const { mode, isExporting, baseUrl, routerRoot, asyncRoutes } = this.instanceMetroOptions;\n assert(\n mode != null &&\n isExporting != null &&\n baseUrl != null &&\n routerRoot != null &&\n asyncRoutes != null,\n 'The server must be started before calling getStaticPageAsync.'\n );\n const platform = 'web';\n\n const devBundleUrlPathname = createBundleUrlPath({\n splitChunks: isExporting && !env.EXPO_NO_BUNDLE_SPLITTING,\n platform,\n mode,\n environment: 'client',\n mainModuleName: resolveMainModuleName(this.projectRoot, { platform }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n baseUrl,\n isExporting,\n asyncRoutes,\n routerRoot,\n bytecode: false,\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await this.ssrLoadModule<\n typeof import('expo-router/build/static/renderStaticContent')\n >('expo-router/node/render.js', {\n minify: false,\n mode,\n isExporting,\n platform,\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(),\n bundleStaticHtml(),\n ]);\n const content = serializeHtmlWithAssets({\n isExporting,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n baseUrl,\n });\n return {\n content,\n resources,\n };\n }\n\n // Set when the server is started.\n private instanceMetroOptions: Partial<ExpoMetroOptions> = {};\n\n async ssrLoadModule<T extends Record<string, any>>(\n filePath: string,\n specificOptions: Partial<ExpoMetroOptions> = {}\n ): Promise<T> {\n const { baseUrl, routerRoot, isExporting } = this.instanceMetroOptions;\n assert(\n baseUrl != null && routerRoot != null && isExporting != null,\n 'The server must be started before calling ssrLoadModule.'\n );\n\n return (\n await getStaticRenderFunctionsForEntry<T>(\n this.projectRoot,\n this.getDevServerUrl()!,\n {\n // Bundle in Node.js mode for SSR.\n environment: 'node',\n platform: 'web',\n mode: 'development',\n bytecode: false,\n\n ...this.instanceMetroOptions,\n baseUrl,\n routerRoot,\n isExporting,\n ...specificOptions,\n },\n filePath\n )\n ).fn;\n }\n\n async ssrLoadModuleContents(\n filePath: string,\n specificOptions: Partial<ExpoMetroOptions> = {}\n ): Promise<{ src: string; filename: string }> {\n const { baseUrl, routerRoot, isExporting } = this.instanceMetroOptions;\n assert(\n baseUrl != null && routerRoot != null && isExporting != null,\n 'The server must be started before calling ssrLoadModule.'\n );\n\n return await requireFileContentsWithMetro(this.projectRoot, this.getDevServerUrl()!, filePath, {\n // Bundle in Node.js mode for SSR.\n environment: 'node',\n platform: 'web',\n mode: 'development',\n bytecode: false,\n\n ...this.instanceMetroOptions,\n baseUrl,\n routerRoot,\n isExporting,\n ...specificOptions,\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 getExpoLineOptions() {\n return this.instanceMetroOptions;\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 config = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const { exp } = config;\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\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 const mode = options.mode ?? 'development';\n\n this.instanceMetroOptions = {\n isExporting: !!options.isExporting,\n baseUrl,\n mode,\n routerRoot,\n minify: options.minify,\n asyncRoutes,\n // Options that are changing between platforms like engine, platform, and environment aren't set here.\n };\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 // 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 middleware.use(\n createRouteHandlerMiddleware(this.projectRoot, {\n appDir,\n routerRoot,\n config,\n bundleApiRoute: (functionFilePath) => this.ssrImportApiRoute(functionFilePath),\n getStaticPageAsync: (pathname) => {\n return this.getStaticPageAsync(pathname);\n },\n })\n );\n\n observeAnyFileChanges(\n {\n metro,\n server,\n },\n (events) => {\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 this.invalidateApiRouteCache();\n } else if (!hasWarnedAboutApiRoutes()) {\n for (const event of events) {\n if (\n // If the user did not delete a file that matches the Expo Router API Route convention, then we should warn that\n // API Routes are not enabled in the project.\n event.metadata?.type !== 'd' &&\n // Ensure the file is in the project's routes directory to prevent false positives in monorepos.\n event.filePath.startsWith(appDir) &&\n isApiRouteConvention(event.filePath)\n ) {\n warnInvalidWebOutput();\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 private pendingRouteOperations = new Map<\n string,\n Promise<{ src: string; filename: string; map?: any } | null>\n >();\n\n // API Routes\n\n // Bundle the API Route with Metro and return the string contents to be evaluated in the server.\n private async bundleApiRoute(\n filePath: string\n ): Promise<{ src: string; filename: string; map?: any } | null | undefined> {\n if (this.pendingRouteOperations.has(filePath)) {\n return this.pendingRouteOperations.get(filePath);\n }\n const bundleAsync = async () => {\n try {\n debug('Bundle API route:', this.instanceMetroOptions.routerRoot, filePath);\n return await this.ssrLoadModuleContents(filePath);\n } catch (error: any) {\n if (error instanceof Error) {\n await logMetroErrorAsync({ error, projectRoot: this.projectRoot });\n }\n throw error;\n } finally {\n // pendingRouteOperations.delete(filepath);\n }\n };\n const route = bundleAsync();\n\n this.pendingRouteOperations.set(filePath, route);\n return route;\n }\n\n private async ssrImportApiRoute(\n filePath: string\n ): Promise<null | Record<string, Function> | Response> {\n // TODO: Cache the evaluated function.\n try {\n const apiRoute = await this.bundleApiRoute(filePath);\n\n if (!apiRoute?.src) {\n return null;\n }\n return evalMetroNoHandling(this.projectRoot, apiRoute.src, apiRoute.filename);\n } catch (error) {\n // Format any errors that were thrown in the global scope of the evaluation.\n if (error instanceof Error) {\n try {\n const htmlServerError = await getErrorOverlayHtmlAsync({\n error,\n projectRoot: this.projectRoot,\n routerRoot: this.getExpoLineOptions().routerRoot!,\n });\n\n return new Response(htmlServerError, {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n });\n } catch (internalError) {\n debug('Failed to generate Metro server error UI for API Route error:', internalError);\n throw error;\n }\n } else {\n throw error;\n }\n }\n }\n\n private invalidateApiRouteCache() {\n this.pendingRouteOperations.clear();\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":["ForwardHtmlError","MetroBundlerDevServer","getDeepLinkHandler","CommandError","constructor","message","html","statusCode","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","BundlerDevServer","metro","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","exportExpoRouterApiRoutesAsync","includeSourceMaps","outputDir","prerenderManifest","routerRoot","instanceMetroOptions","assert","appDir","path","join","projectRoot","manifest","getExpoRouterRoutesManifestAsync","files","Map","route","apiRoutes","filepath","file","contents","bundleApiRoute","artifactFilename","relative","replace","src","map","artifactBasename","encodeURIComponent","basename","set","JSON","stringify","version","sources","source","startsWith","split","sep","sourcesContent","Array","length","fill","names","mappings","targetDomain","htmlRoutes","fetchManifest","asJson","getStaticRenderFunctionAsync","mode","minify","isExporting","url","getDevServerUrl","getStaticContent","getManifest","getBuildTimeServerManifestAsync","ssrLoadModule","serverManifest","preserveApiRoutes","renderAsync","URL","getStaticResourcesAsync","mainModuleName","data","baseUrl","asyncRoutes","platform","devBundleUrlPathname","createBundleUrlPath","splitChunks","EXPO_NO_BUNDLE_SPLITTING","environment","serializerOutput","serializerIncludeMaps","resolveMainModuleName","lazy","shouldEnableAsyncImports","bytecode","bundleUrl","results","fetch","toString","txt","text","parse","error","ok","status","Log","isArray","artifacts","errors","type","match","Error","getStaticPageAsync","pathname","bundleStaticHtml","location","resources","staticHtml","Promise","all","content","serializeHtmlWithAssets","template","devBundleUrl","filePath","specificOptions","getStaticRenderFunctionsForEntry","fn","ssrLoadModuleContents","requireFileContentsWithMetro","watchEnvironmentVariables","instance","envFiles","runtimeEnv","getFiles","NODE_ENV","fileName","observeFileChanges","server","load","force","getExpoLineOptions","startImplementationAsync","exp","urlCreator","getUrlCreator","config","getConfig","skipSDKVersionRequirement","useServerRendering","includes","web","output","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getRouterDirectoryModuleIdWithManifest","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","ServeStaticMiddleware","FaviconMiddleware","createRouteHandlerMiddleware","functionFilePath","ssrImportApiRoute","observeAnyFileChanges","events","invalidateApiRouteCache","hasWarnedAboutApiRoutes","event","metadata","isApiRouteConvention","warnInvalidWebOutput","HistoryFallbackMiddleware","internal","originalClose","close","bind","callback","err","host","protocol","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","req","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","pendingRouteOperations","has","get","bundleAsync","logMetroErrorAsync","apiRoute","evalMetroNoHandling","filename","htmlServerError","getErrorOverlayHtmlAsync","Response","headers","internalError","clear","logEventAsync","getDevClientProperties"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IA8DaA,gBAAgB,MAAhBA,gBAAgB;IAkBhBC,qBAAqB,MAArBA,qBAAqB;IAurBlBC,kBAAkB,MAAlBA,kBAAkB;;;yBAvwBR,cAAc;;;;;;;+DACZ,WAAW;;;;;;;8DAEpB,QAAQ;;;;;;;8DACT,OAAO;;;;;;;8DAEP,YAAY;;;;;;;8DACb,MAAM;;;;;;6CAEsB,+BAA+B;qCAClB,uBAAuB;kCAC3C,oBAAoB;qCACG,uBAAuB;2CAC1C,6BAA6B;wBAMhE,UAAU;+BACuB,iBAAiB;qDACC,uCAAuC;qBAE7E,cAAc;6EACC,iDAAiD;sBAChE,oBAAoB;wBACX,uBAAuB;sBACnB,qBAAqB;2BACxB,0BAA0B;kCACiB,qBAAqB;0CAKvF,6BAA6B;mDACc,iDAAiD;sCAC9D,oCAAoC;0CAChC,wCAAwC;mCAC/C,iCAAiC;2CACzB,yCAAyC;4CACxC,0CAA0C;oCAC/C,kCAAkC;6CAC5B,2CAA2C;2CAIhF,yCAAyC;uCACV,qCAAqC;8BAOpE,4BAA4B;2BACD,yBAAyB;+CACR,kDAAkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAM9F,MAAMF,gBAAgB,SAASG,OAAY,aAAA;IAChDC,YACEC,OAAe,EACRC,IAAY,EACZC,UAAkB,CACzB;QACA,KAAK,CAACF,OAAO,CAAC,CAAC;QAHRC,YAAAA,IAAY,CAAA;QACZC,kBAAAA,UAAkB,CAAA;IAG3B;CACD;AAED,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,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;oBACtF,MAAMrI,KAAK,CAAC;gBACd,CAAC;YACH,OAAO;gBACL,MAAMA,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH;IAEQyF,uBAAuB,GAAG;QAChC,IAAI,CAACgC,sBAAsB,CAACa,KAAK,EAAE,CAAC;IACtC;CACD;AAEM,SAASlP,kBAAkB,CAACgC,WAAmB,EAAmB;IACvE,OAAO,OAAO,EAAEyJ,OAAO,CAAA,EAAE,GAAK;QAC5B,IAAIA,OAAO,KAAK,MAAM,EAAE,OAAO;QAC/B,MAAM,EAAEpC,GAAG,CAAA,EAAE,GAAGI,IAAAA,OAAS,EAAA,UAAA,EAACzH,WAAW,CAAC,AAAC;QACvC,MAAMmN,IAAAA,UAAa,cAAA,EAAC,0BAA0B,EAAE;YAC9CrI,MAAM,EAAE,SAAS;YACjB,GAAGsI,IAAAA,uBAAsB,QAAA,EAACpN,WAAW,EAAEqH,GAAG,CAAC;SAC5C,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
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 assert from 'assert';\nimport chalk from 'chalk';\nimport { AssetData } from 'metro';\nimport fetch from 'node-fetch';\nimport path from 'path';\n\nimport { createRouteHandlerMiddleware } from './createServerRouteMiddleware';\nimport { ExpoRouterServerManifestV1, fetchManifest } from './fetchRouterManifest';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { getErrorOverlayHtmlAsync, logMetroErrorAsync } from './metroErrorInterface';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport {\n getRouterDirectoryModuleIdWithManifest,\n hasWarnedAboutApiRoutes,\n isApiRouteConvention,\n warnInvalidWebOutput,\n} 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 { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { logEventAsync } from '../../../utils/telemetry';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport {\n evalMetroNoHandling,\n getStaticRenderFunctionsForEntry,\n requireFileContentsWithMetro,\n} 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 ExpoMetroOptions,\n createBundleUrlPath,\n getAsyncRoutesFromExpoConfig,\n getBaseUrlFromExpoConfig,\n shouldEnableAsyncImports,\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 includeSourceMaps,\n outputDir,\n prerenderManifest,\n }: {\n includeSourceMaps?: boolean;\n outputDir: string;\n // This does not contain the API routes info.\n prerenderManifest: ExpoRouterServerManifestV1;\n }): Promise<{ files: ExportAssetMap; manifest: ExpoRouterServerManifestV1<string> }> {\n const { routerRoot } = this.instanceMetroOptions;\n assert(\n routerRoot != null,\n 'The server must be started before calling exportExpoRouterApiRoutesAsync.'\n );\n\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 this.bundleApiRoute(filepath);\n const artifactFilename = path.join(\n outputDir,\n path.relative(appDir, filepath.replace(/\\.[tj]sx?$/, '.js'))\n );\n if (contents) {\n let src = contents.src;\n if (includeSourceMaps && contents.map) {\n // TODO(kitten): Merge the source map transformer in the future\n // https://github.com/expo/expo/blob/0dffdb15/packages/%40expo/metro-config/src/serializer/serializeChunks.ts#L422-L439\n // Alternatively, check whether `sourcesRoot` helps here\n const artifactBasename = encodeURIComponent(path.basename(artifactFilename) + '.map');\n src = src.replace(\n /\\/\\/# sourceMappingURL=.*/g,\n `//# sourceMappingURL=${artifactBasename}`\n );\n files.set(artifactFilename + '.map', {\n contents: JSON.stringify({\n version: contents.map.version,\n sources: contents.map.sources.map((source: string) => {\n source =\n typeof source === 'string' && source.startsWith(this.projectRoot)\n ? path.relative(this.projectRoot, source)\n : source;\n return source.split(path.sep).join('/');\n }),\n sourcesContent: new Array(contents.map.sources.length).fill(null),\n names: contents.map.names,\n mappings: contents.map.mappings,\n }),\n targetDomain: 'server',\n });\n }\n files.set(artifactFilename, {\n contents: src,\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 { exp } = getConfig(this.projectRoot);\n const manifest = await fetchManifest(this.projectRoot, {\n ...exp.extra?.router?.platformRoutes,\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(): Promise<{\n serverManifest: ExpoRouterServerManifestV1;\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (path: string) => Promise<string>;\n }> {\n const { mode, minify, isExporting } = this.instanceMetroOptions;\n assert(\n mode != null && isExporting != null,\n 'The server must be started before calling ssrLoadModule.'\n );\n\n const url = this.getDevServerUrl()!;\n\n const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } =\n await this.ssrLoadModule<typeof import('expo-router/build/static/renderStaticContent')>(\n 'expo-router/node/render.js',\n {\n minify,\n mode,\n isExporting,\n }\n );\n\n const { exp } = getConfig(this.projectRoot);\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync(),\n // Get routes from Expo Router.\n manifest: await getManifest({ preserveApiRoutes: false, ...exp.extra?.router }),\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 includeSourceMaps,\n mainModuleName,\n }: {\n includeSourceMaps?: boolean;\n mainModuleName?: string;\n } = {}): Promise<{ artifacts: SerialAsset[]; assets?: AssetData[] }> {\n const { mode, minify, isExporting, baseUrl, routerRoot, asyncRoutes } =\n this.instanceMetroOptions;\n assert(\n mode != null &&\n isExporting != null &&\n baseUrl != null &&\n routerRoot != null &&\n asyncRoutes != null,\n 'The server must be started before calling getStaticPageAsync.'\n );\n\n const platform = 'web';\n\n const devBundleUrlPathname = createBundleUrlPath({\n splitChunks: isExporting && !env.EXPO_NO_BUNDLE_SPLITTING,\n platform,\n mode,\n minify,\n environment: 'client',\n serializerOutput: 'static',\n serializerIncludeMaps: includeSourceMaps,\n mainModuleName: mainModuleName ?? resolveMainModuleName(this.projectRoot, { platform }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n asyncRoutes,\n baseUrl,\n isExporting,\n routerRoot,\n bytecode: false,\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(pathname: string) {\n const { mode, isExporting, baseUrl, routerRoot, asyncRoutes } = this.instanceMetroOptions;\n assert(\n mode != null &&\n isExporting != null &&\n baseUrl != null &&\n routerRoot != null &&\n asyncRoutes != null,\n 'The server must be started before calling getStaticPageAsync.'\n );\n const platform = 'web';\n\n const devBundleUrlPathname = createBundleUrlPath({\n splitChunks: isExporting && !env.EXPO_NO_BUNDLE_SPLITTING,\n platform,\n mode,\n environment: 'client',\n mainModuleName: resolveMainModuleName(this.projectRoot, { platform }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n baseUrl,\n isExporting,\n asyncRoutes,\n routerRoot,\n bytecode: false,\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await this.ssrLoadModule<\n typeof import('expo-router/build/static/renderStaticContent')\n >('expo-router/node/render.js', {\n minify: false,\n mode,\n isExporting,\n platform,\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(),\n bundleStaticHtml(),\n ]);\n const content = serializeHtmlWithAssets({\n isExporting,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n baseUrl,\n });\n return {\n content,\n resources,\n };\n }\n\n // Set when the server is started.\n private instanceMetroOptions: Partial<ExpoMetroOptions> = {};\n\n async ssrLoadModule<T extends Record<string, any>>(\n filePath: string,\n specificOptions: Partial<ExpoMetroOptions> = {}\n ): Promise<T> {\n const { baseUrl, routerRoot, isExporting } = this.instanceMetroOptions;\n assert(\n baseUrl != null && routerRoot != null && isExporting != null,\n 'The server must be started before calling ssrLoadModule.'\n );\n\n return (\n await getStaticRenderFunctionsForEntry<T>(\n this.projectRoot,\n this.getDevServerUrl()!,\n {\n // Bundle in Node.js mode for SSR.\n environment: 'node',\n platform: 'web',\n mode: 'development',\n bytecode: false,\n\n ...this.instanceMetroOptions,\n baseUrl,\n routerRoot,\n isExporting,\n ...specificOptions,\n },\n filePath\n )\n ).fn;\n }\n\n async ssrLoadModuleContents(\n filePath: string,\n specificOptions: Partial<ExpoMetroOptions> = {}\n ): Promise<{ src: string; filename: string }> {\n const { baseUrl, routerRoot, isExporting } = this.instanceMetroOptions;\n assert(\n baseUrl != null && routerRoot != null && isExporting != null,\n 'The server must be started before calling ssrLoadModule.'\n );\n\n return await requireFileContentsWithMetro(this.projectRoot, this.getDevServerUrl()!, filePath, {\n // Bundle in Node.js mode for SSR.\n environment: 'node',\n platform: 'web',\n mode: 'development',\n bytecode: false,\n\n ...this.instanceMetroOptions,\n baseUrl,\n routerRoot,\n isExporting,\n ...specificOptions,\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 getExpoLineOptions() {\n return this.instanceMetroOptions;\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 config = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const { exp } = config;\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\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 const mode = options.mode ?? 'development';\n\n this.instanceMetroOptions = {\n isExporting: !!options.isExporting,\n baseUrl,\n mode,\n routerRoot,\n minify: options.minify,\n asyncRoutes,\n // Options that are changing between platforms like engine, platform, and environment aren't set here.\n };\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 // 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 middleware.use(\n createRouteHandlerMiddleware(this.projectRoot, {\n appDir,\n routerRoot,\n config,\n ...config.exp.extra?.router,\n bundleApiRoute: (functionFilePath) => this.ssrImportApiRoute(functionFilePath),\n getStaticPageAsync: (pathname) => {\n return this.getStaticPageAsync(pathname);\n },\n })\n );\n\n observeAnyFileChanges(\n {\n metro,\n server,\n },\n (events) => {\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 this.invalidateApiRouteCache();\n } else if (!hasWarnedAboutApiRoutes()) {\n for (const event of events) {\n if (\n // If the user did not delete a file that matches the Expo Router API Route convention, then we should warn that\n // API Routes are not enabled in the project.\n event.metadata?.type !== 'd' &&\n // Ensure the file is in the project's routes directory to prevent false positives in monorepos.\n event.filePath.startsWith(appDir) &&\n isApiRouteConvention(event.filePath)\n ) {\n warnInvalidWebOutput();\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 private pendingRouteOperations = new Map<\n string,\n Promise<{ src: string; filename: string; map?: any } | null>\n >();\n\n // API Routes\n\n // Bundle the API Route with Metro and return the string contents to be evaluated in the server.\n private async bundleApiRoute(\n filePath: string\n ): Promise<{ src: string; filename: string; map?: any } | null | undefined> {\n if (this.pendingRouteOperations.has(filePath)) {\n return this.pendingRouteOperations.get(filePath);\n }\n const bundleAsync = async () => {\n try {\n debug('Bundle API route:', this.instanceMetroOptions.routerRoot, filePath);\n return await this.ssrLoadModuleContents(filePath);\n } catch (error: any) {\n if (error instanceof Error) {\n await logMetroErrorAsync({ error, projectRoot: this.projectRoot });\n }\n throw error;\n } finally {\n // pendingRouteOperations.delete(filepath);\n }\n };\n const route = bundleAsync();\n\n this.pendingRouteOperations.set(filePath, route);\n return route;\n }\n\n private async ssrImportApiRoute(\n filePath: string\n ): Promise<null | Record<string, Function> | Response> {\n // TODO: Cache the evaluated function.\n try {\n const apiRoute = await this.bundleApiRoute(filePath);\n\n if (!apiRoute?.src) {\n return null;\n }\n return evalMetroNoHandling(this.projectRoot, apiRoute.src, apiRoute.filename);\n } catch (error) {\n // Format any errors that were thrown in the global scope of the evaluation.\n if (error instanceof Error) {\n try {\n const htmlServerError = await getErrorOverlayHtmlAsync({\n error,\n projectRoot: this.projectRoot,\n routerRoot: this.getExpoLineOptions().routerRoot!,\n });\n\n return new Response(htmlServerError, {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n });\n } catch (internalError) {\n debug('Failed to generate Metro server error UI for API Route error:', internalError);\n throw error;\n }\n } else {\n throw error;\n }\n }\n }\n\n private invalidateApiRouteCache() {\n this.pendingRouteOperations.clear();\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":["ForwardHtmlError","MetroBundlerDevServer","getDeepLinkHandler","CommandError","constructor","message","html","statusCode","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","BundlerDevServer","metro","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","exportExpoRouterApiRoutesAsync","includeSourceMaps","outputDir","prerenderManifest","routerRoot","instanceMetroOptions","assert","appDir","path","join","projectRoot","manifest","getExpoRouterRoutesManifestAsync","files","Map","route","apiRoutes","filepath","file","contents","bundleApiRoute","artifactFilename","relative","replace","src","map","artifactBasename","encodeURIComponent","basename","set","JSON","stringify","version","sources","source","startsWith","split","sep","sourcesContent","Array","length","fill","names","mappings","targetDomain","htmlRoutes","exp","getConfig","fetchManifest","extra","router","platformRoutes","asJson","getStaticRenderFunctionAsync","mode","minify","isExporting","url","getDevServerUrl","getStaticContent","getManifest","getBuildTimeServerManifestAsync","ssrLoadModule","serverManifest","preserveApiRoutes","renderAsync","URL","getStaticResourcesAsync","mainModuleName","data","baseUrl","asyncRoutes","platform","devBundleUrlPathname","createBundleUrlPath","splitChunks","EXPO_NO_BUNDLE_SPLITTING","environment","serializerOutput","serializerIncludeMaps","resolveMainModuleName","lazy","shouldEnableAsyncImports","bytecode","bundleUrl","results","fetch","toString","txt","text","parse","error","ok","status","Log","isArray","artifacts","errors","type","match","Error","getStaticPageAsync","pathname","bundleStaticHtml","location","resources","staticHtml","Promise","all","content","serializeHtmlWithAssets","template","devBundleUrl","filePath","specificOptions","getStaticRenderFunctionsForEntry","fn","ssrLoadModuleContents","requireFileContentsWithMetro","watchEnvironmentVariables","instance","envFiles","runtimeEnv","getFiles","NODE_ENV","fileName","observeFileChanges","server","load","force","getExpoLineOptions","startImplementationAsync","urlCreator","getUrlCreator","config","skipSDKVersionRequirement","useServerRendering","includes","web","output","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getRouterDirectoryModuleIdWithManifest","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","ServeStaticMiddleware","FaviconMiddleware","createRouteHandlerMiddleware","functionFilePath","ssrImportApiRoute","observeAnyFileChanges","events","invalidateApiRouteCache","hasWarnedAboutApiRoutes","event","metadata","isApiRouteConvention","warnInvalidWebOutput","HistoryFallbackMiddleware","internal","originalClose","close","bind","callback","err","host","protocol","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","req","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","pendingRouteOperations","has","get","bundleAsync","logMetroErrorAsync","apiRoute","evalMetroNoHandling","filename","htmlServerError","getErrorOverlayHtmlAsync","Response","headers","internalError","clear","logEventAsync","getDevClientProperties"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IA8DaA,gBAAgB,MAAhBA,gBAAgB;IAkBhBC,qBAAqB,MAArBA,qBAAqB;IA4rBlBC,kBAAkB,MAAlBA,kBAAkB;;;yBA5wBR,cAAc;;;;;;;+DACZ,WAAW;;;;;;;8DAEpB,QAAQ;;;;;;;8DACT,OAAO;;;;;;;8DAEP,YAAY;;;;;;;8DACb,MAAM;;;;;;6CAEsB,+BAA+B;qCAClB,uBAAuB;kCAC3C,oBAAoB;qCACG,uBAAuB;2CAC1C,6BAA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AAc,EAAE,WAAW;yBAC5B;qBACF,CAAC,CAAC;gBACL,EAAE,OAAOC,aAAa,EAAE;oBACtB9O,KAAK,CAAC,+DAA+D,EAAE8O,aAAa,CAAC,CAAC;oBACtF,MAAMnI,KAAK,CAAC;gBACd,CAAC;YACH,OAAO;gBACL,MAAMA,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH;IAEQuF,uBAAuB,GAAG;QAChC,IAAI,CAACgC,sBAAsB,CAACa,KAAK,EAAE,CAAC;IACtC;CACD;AAEM,SAASrP,kBAAkB,CAACgC,WAAmB,EAAmB;IACvE,OAAO,OAAO,EAAE4J,OAAO,CAAA,EAAE,GAAK;QAC5B,IAAIA,OAAO,KAAK,MAAM,EAAE,OAAO;QAC/B,MAAM,EAAExH,GAAG,CAAA,EAAE,GAAGC,IAAAA,OAAS,EAAA,UAAA,EAACrC,WAAW,CAAC,AAAC;QACvC,MAAMsN,IAAAA,UAAa,cAAA,EAAC,0BAA0B,EAAE;YAC9CnI,MAAM,EAAE,SAAS;YACjB,GAAGoI,IAAAA,uBAAsB,QAAA,EAACvN,WAAW,EAAEoC,GAAG,CAAC;SAC5C,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -91,6 +91,13 @@ class TerminalReporter extends XTerminalReporter {
|
|
|
91
91
|
* @param event event object.
|
|
92
92
|
* @param duration duration of the build in milliseconds.
|
|
93
93
|
*/ bundleBuildEnded(event, duration) {}
|
|
94
|
+
_logWatcherStatus(status) {
|
|
95
|
+
// Metro logs this warning twice. This helps reduce the noise.
|
|
96
|
+
if (status.type === "watchman_warning") {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
return super._logWatcherStatus(status);
|
|
100
|
+
}
|
|
94
101
|
/**
|
|
95
102
|
* This function is exclusively concerned with updating the internal state.
|
|
96
103
|
* No logging or status updates should be done at this point.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/TerminalReporter.ts"],"sourcesContent":["// This file represents an abstraction on the metro TerminalReporter.\n// We use this abstraction to safely extend the TerminalReporter for our own custom logging.\nimport chalk from 'chalk';\nimport UpstreamTerminalReporter from 'metro/src/lib/TerminalReporter';\nimport { Terminal } from 'metro-core';\nimport util from 'util';\n\nimport {\n BundleDetails,\n BundleProgressUpdate,\n TerminalReportableEvent,\n TerminalReporterInterface,\n} from './TerminalReporter.types';\nimport { stripAnsi } from '../../../utils/ansi';\n\nconst debug = require('debug')('expo:metro:logger') as typeof console.log;\n\n/**\n * A standard way to log a warning to the terminal. This should not be called\n * from some arbitrary Metro logic, only from the reporters. Instead of\n * calling this, add a new type of ReportableEvent instead, and implement a\n * proper handler in the reporter(s).\n */\nexport function logWarning(terminal: Terminal, format: string, ...args: any[]): void {\n const str = util.format(format, ...args);\n terminal.log('%s: %s', chalk.yellow('warning'), str);\n}\n\n/**\n * Similar to `logWarning`, but for messages that require the user to act.\n */\nexport function logError(terminal: Terminal, format: string, ...args: any[]): void {\n terminal.log(\n '%s: %s',\n chalk.red('error'),\n // Syntax errors may have colors applied for displaying code frames\n // in various places outside of where Metro is currently running.\n // If the current terminal does not support color, we'll strip the colors\n // here.\n util.format(chalk.supportsColor ? format : stripAnsi(format), ...args)\n );\n}\n\nconst XTerminalReporter = UpstreamTerminalReporter as unknown as TerminalReporterInterface;\n\n/** Extended TerminalReporter class but with proper types and extra functionality to avoid using the `_log` method directly in subclasses. */\nexport class TerminalReporter extends XTerminalReporter implements TerminalReporterInterface {\n /**\n * A cache of { [buildID]: BundleDetails } which can be used to\n * add more contextual logs. BundleDetails is currently only sent with `bundle_build_started`\n * so we need to cache the details in order to print the platform info with other event types.\n */\n _bundleDetails: Map<string, BundleDetails> = new Map();\n\n /** Keep track of how long a bundle takes to complete */\n _bundleTimers: Map<string, number> = new Map();\n\n /** Keep track of bundle processes that should not be logged. */\n _hiddenBundleEvents: Set<string> = new Set();\n\n _log(event: TerminalReportableEvent): void {\n switch (event.type) {\n case 'transform_cache_reset':\n return this.transformCacheReset();\n case 'dep_graph_loading':\n return this.dependencyGraphLoading(event.hasReducedPerformance);\n case 'client_log':\n if (this.shouldFilterClientLog(event)) {\n return;\n }\n break;\n }\n return super._log(event);\n }\n\n /** Gives subclasses an easy interface for filtering out logs. Return `true` to skip. */\n shouldFilterClientLog(event: {\n type: 'client_log';\n level: 'trace' | 'info' | 'warn' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug';\n data: unknown[];\n }): boolean {\n return false;\n }\n\n /** Gives subclasses an easy interface for filtering out bundle events, specifically for source maps. Return `true` to skip. */\n shouldFilterBundleEvent(event: TerminalReportableEvent): boolean {\n return false;\n }\n\n /** Cache has been reset. */\n transformCacheReset(): void {}\n\n /** One of the first logs that will be printed. */\n dependencyGraphLoading(hasReducedPerformance: boolean): void {}\n\n /**\n * Custom log event representing the end of the bundling.\n *\n * @param event event object.\n * @param duration duration of the build in milliseconds.\n */\n bundleBuildEnded(event: TerminalReportableEvent, duration: number): void {}\n\n /**\n * This function is exclusively concerned with updating the internal state.\n * No logging or status updates should be done at this point.\n */\n _updateState(\n event: TerminalReportableEvent & { bundleDetails?: BundleDetails; buildID?: string }\n ) {\n // Append the buildID to the bundleDetails.\n if (event.bundleDetails) {\n event.bundleDetails.buildID = event.buildID;\n }\n\n const buildID = event.bundleDetails?.buildID ?? event.buildID;\n\n if (buildID && !this._hiddenBundleEvents.has(buildID)) {\n if (this.shouldFilterBundleEvent(event)) {\n debug('skipping bundle events for', buildID, event);\n this._hiddenBundleEvents.add(buildID);\n } else {\n super._updateState(event);\n }\n } else {\n super._updateState(event);\n }\n\n switch (event.type) {\n case 'bundle_build_done':\n case 'bundle_build_failed': {\n const startTime = this._bundleTimers.get(event.buildID);\n // Observed a bug in Metro where the `bundle_build_done` is invoked twice during a static bundle\n // i.e. `expo export`.\n if (startTime == null) {\n break;\n }\n\n this.bundleBuildEnded(event, startTime ? Date.now() - startTime : 0);\n this._bundleTimers.delete(event.buildID);\n break;\n }\n case 'bundle_build_started':\n this._bundleDetails.set(event.buildID, event.bundleDetails);\n this._bundleTimers.set(event.buildID, Date.now());\n break;\n }\n }\n\n /**\n * We use Math.pow(ratio, 2) to as a conservative measure of progress because\n * we know the `totalCount` is going to progressively increase as well. We\n * also prevent the ratio from going backwards.\n */\n _updateBundleProgress(options: BundleProgressUpdate) {\n super._updateBundleProgress(options);\n\n const currentProgress = this._activeBundles.get(options.buildID);\n if (!currentProgress) {\n return;\n }\n\n // Fix an issue where the transformer is faster than the resolver,\n // locking the progress bar at 100% after transforming the first and only resolved file (1/1).\n if (currentProgress.ratio === 1 && options.totalFileCount === 1) {\n Object.assign(currentProgress, { ...currentProgress, ratio: 0 });\n }\n }\n}\n"],"names":["logWarning","logError","TerminalReporter","debug","require","terminal","format","args","str","util","log","chalk","yellow","red","supportsColor","stripAnsi","XTerminalReporter","UpstreamTerminalReporter","_bundleDetails","Map","_bundleTimers","_hiddenBundleEvents","Set","_log","event","type","transformCacheReset","dependencyGraphLoading","hasReducedPerformance","shouldFilterClientLog","shouldFilterBundleEvent","bundleBuildEnded","duration","_updateState","bundleDetails","buildID","has","add","startTime","get","Date","now","delete","set","_updateBundleProgress","options","currentProgress","_activeBundles","ratio","totalFileCount","Object","assign"],"mappings":"AAAA,qEAAqE;AACrE,4FAA4F;AAC5F;;;;;;;;;;;IAqBgBA,UAAU,MAAVA,UAAU;IAQVC,QAAQ,MAARA,QAAQ;IAeXC,gBAAgB,MAAhBA,gBAAgB;;;8DA5CX,OAAO;;;;;;;8DACY,gCAAgC;;;;;;;8DAEpD,MAAM;;;;;;sBAQG,qBAAqB;;;;;;AAE/C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,AAAsB,AAAC;AAQnE,SAASJ,UAAU,CAACK,QAAkB,EAAEC,MAAc,EAAE,GAAGC,IAAI,AAAO,EAAQ;IACnF,MAAMC,GAAG,GAAGC,KAAI,EAAA,QAAA,CAACH,MAAM,CAACA,MA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start/server/metro/TerminalReporter.ts"],"sourcesContent":["// This file represents an abstraction on the metro TerminalReporter.\n// We use this abstraction to safely extend the TerminalReporter for our own custom logging.\nimport chalk from 'chalk';\nimport UpstreamTerminalReporter from 'metro/src/lib/TerminalReporter';\nimport { Terminal } from 'metro-core';\nimport type { WatcherStatus } from 'metro-file-map';\nimport util from 'util';\n\nimport {\n BundleDetails,\n BundleProgressUpdate,\n TerminalReportableEvent,\n TerminalReporterInterface,\n} from './TerminalReporter.types';\nimport { stripAnsi } from '../../../utils/ansi';\n\nconst debug = require('debug')('expo:metro:logger') as typeof console.log;\n\n/**\n * A standard way to log a warning to the terminal. This should not be called\n * from some arbitrary Metro logic, only from the reporters. Instead of\n * calling this, add a new type of ReportableEvent instead, and implement a\n * proper handler in the reporter(s).\n */\nexport function logWarning(terminal: Terminal, format: string, ...args: any[]): void {\n const str = util.format(format, ...args);\n terminal.log('%s: %s', chalk.yellow('warning'), str);\n}\n\n/**\n * Similar to `logWarning`, but for messages that require the user to act.\n */\nexport function logError(terminal: Terminal, format: string, ...args: any[]): void {\n terminal.log(\n '%s: %s',\n chalk.red('error'),\n // Syntax errors may have colors applied for displaying code frames\n // in various places outside of where Metro is currently running.\n // If the current terminal does not support color, we'll strip the colors\n // here.\n util.format(chalk.supportsColor ? format : stripAnsi(format), ...args)\n );\n}\n\nconst XTerminalReporter = UpstreamTerminalReporter as unknown as TerminalReporterInterface;\n\n/** Extended TerminalReporter class but with proper types and extra functionality to avoid using the `_log` method directly in subclasses. */\nexport class TerminalReporter extends XTerminalReporter implements TerminalReporterInterface {\n /**\n * A cache of { [buildID]: BundleDetails } which can be used to\n * add more contextual logs. BundleDetails is currently only sent with `bundle_build_started`\n * so we need to cache the details in order to print the platform info with other event types.\n */\n _bundleDetails: Map<string, BundleDetails> = new Map();\n\n /** Keep track of how long a bundle takes to complete */\n _bundleTimers: Map<string, number> = new Map();\n\n /** Keep track of bundle processes that should not be logged. */\n _hiddenBundleEvents: Set<string> = new Set();\n\n _log(event: TerminalReportableEvent): void {\n switch (event.type) {\n case 'transform_cache_reset':\n return this.transformCacheReset();\n case 'dep_graph_loading':\n return this.dependencyGraphLoading(event.hasReducedPerformance);\n case 'client_log':\n if (this.shouldFilterClientLog(event)) {\n return;\n }\n break;\n }\n return super._log(event);\n }\n\n /** Gives subclasses an easy interface for filtering out logs. Return `true` to skip. */\n shouldFilterClientLog(event: {\n type: 'client_log';\n level: 'trace' | 'info' | 'warn' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug';\n data: unknown[];\n }): boolean {\n return false;\n }\n\n /** Gives subclasses an easy interface for filtering out bundle events, specifically for source maps. Return `true` to skip. */\n shouldFilterBundleEvent(event: TerminalReportableEvent): boolean {\n return false;\n }\n\n /** Cache has been reset. */\n transformCacheReset(): void {}\n\n /** One of the first logs that will be printed. */\n dependencyGraphLoading(hasReducedPerformance: boolean): void {}\n\n /**\n * Custom log event representing the end of the bundling.\n *\n * @param event event object.\n * @param duration duration of the build in milliseconds.\n */\n bundleBuildEnded(event: TerminalReportableEvent, duration: number): void {}\n\n _logWatcherStatus(status: WatcherStatus) {\n // Metro logs this warning twice. This helps reduce the noise.\n\n if (status.type === 'watchman_warning') {\n return;\n }\n return super._logWatcherStatus(status);\n }\n\n /**\n * This function is exclusively concerned with updating the internal state.\n * No logging or status updates should be done at this point.\n */\n _updateState(\n event: TerminalReportableEvent & { bundleDetails?: BundleDetails; buildID?: string }\n ) {\n // Append the buildID to the bundleDetails.\n if (event.bundleDetails) {\n event.bundleDetails.buildID = event.buildID;\n }\n\n const buildID = event.bundleDetails?.buildID ?? event.buildID;\n\n if (buildID && !this._hiddenBundleEvents.has(buildID)) {\n if (this.shouldFilterBundleEvent(event)) {\n debug('skipping bundle events for', buildID, event);\n this._hiddenBundleEvents.add(buildID);\n } else {\n super._updateState(event);\n }\n } else {\n super._updateState(event);\n }\n\n switch (event.type) {\n case 'bundle_build_done':\n case 'bundle_build_failed': {\n const startTime = this._bundleTimers.get(event.buildID);\n // Observed a bug in Metro where the `bundle_build_done` is invoked twice during a static bundle\n // i.e. `expo export`.\n if (startTime == null) {\n break;\n }\n\n this.bundleBuildEnded(event, startTime ? Date.now() - startTime : 0);\n this._bundleTimers.delete(event.buildID);\n break;\n }\n case 'bundle_build_started':\n this._bundleDetails.set(event.buildID, event.bundleDetails);\n this._bundleTimers.set(event.buildID, Date.now());\n break;\n }\n }\n\n /**\n * We use Math.pow(ratio, 2) to as a conservative measure of progress because\n * we know the `totalCount` is going to progressively increase as well. We\n * also prevent the ratio from going backwards.\n */\n _updateBundleProgress(options: BundleProgressUpdate) {\n super._updateBundleProgress(options);\n\n const currentProgress = this._activeBundles.get(options.buildID);\n if (!currentProgress) {\n return;\n }\n\n // Fix an issue where the transformer is faster than the resolver,\n // locking the progress bar at 100% after transforming the first and only resolved file (1/1).\n if (currentProgress.ratio === 1 && options.totalFileCount === 1) {\n Object.assign(currentProgress, { ...currentProgress, ratio: 0 });\n }\n }\n}\n"],"names":["logWarning","logError","TerminalReporter","debug","require","terminal","format","args","str","util","log","chalk","yellow","red","supportsColor","stripAnsi","XTerminalReporter","UpstreamTerminalReporter","_bundleDetails","Map","_bundleTimers","_hiddenBundleEvents","Set","_log","event","type","transformCacheReset","dependencyGraphLoading","hasReducedPerformance","shouldFilterClientLog","shouldFilterBundleEvent","bundleBuildEnded","duration","_logWatcherStatus","status","_updateState","bundleDetails","buildID","has","add","startTime","get","Date","now","delete","set","_updateBundleProgress","options","currentProgress","_activeBundles","ratio","totalFileCount","Object","assign"],"mappings":"AAAA,qEAAqE;AACrE,4FAA4F;AAC5F;;;;;;;;;;;IAsBgBA,UAAU,MAAVA,UAAU;IAQVC,QAAQ,MAARA,QAAQ;IAeXC,gBAAgB,MAAhBA,gBAAgB;;;8DA7CX,OAAO;;;;;;;8DACY,gCAAgC;;;;;;;8DAGpD,MAAM;;;;;;sBAQG,qBAAqB;;;;;;AAE/C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,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AAG,CAACM,OAAO,CAACV,OAAO,CAAC,AAAC;QACjE,IAAI,CAACW,eAAe,EAAE;YACpB,OAAO;QACT,CAAC;QAED,kEAAkE;QAClE,8FAA8F;QAC9F,IAAIA,eAAe,CAACE,KAAK,KAAK,CAAC,IAAIH,OAAO,CAACI,cAAc,KAAK,CAAC,EAAE;YAC/DC,MAAM,CAACC,MAAM,CAACL,eAAe,EAAE;gBAAE,GAAGA,eAAe;gBAAEE,KAAK,EAAE,CAAC;aAAE,CAAC,CAAC;QACnE,CAAC;IACH;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/TerminalReporter.types.ts"],"sourcesContent":["import type { ReportableEvent } from 'metro';\nimport type { TerminalReportableEvent } from 'metro/src/lib/TerminalReporter';\nimport type { Terminal } from 'metro-core';\n\nimport { MetroEnvironment } from '../middleware/metroOptions';\n\nexport type GlobalCacheDisabledReason = 'too_many_errors' | 'too_many_misses';\n\nexport type BundleDetails = {\n buildID?: string;\n bundleType: string;\n dev: boolean;\n entryFile: string;\n minify: boolean;\n platform: string | null | undefined;\n customTransformOptions?: { environment?: MetroEnvironment };\n runtimeBytecodeVersion: number | null | undefined;\n};\n\nexport type BundleProgress = {\n bundleDetails: BundleDetails;\n transformedFileCount: number;\n totalFileCount: number;\n ratio: number;\n};\n\nexport type BundleProgressUpdate = {\n buildID: string;\n transformedFileCount: number;\n totalFileCount: number;\n};\n\nexport { TerminalReportableEvent };\n\nexport type BuildPhase = 'in_progress' | 'done' | 'failed';\n\n/**\n * Code across the application takes a reporter as an option and calls the\n * update whenever one of the ReportableEvent happens. Code does not directly\n * write to the standard output, because a build would be:\n *\n * 1. ad-hoc, embedded into another tool, in which case we do not want to\n * pollute that tool's own output. The tool is free to present the\n * warnings/progress we generate any way they want, by specifying a custom\n * reporter.\n * 2. run as a background process from another tool, in which case we want\n * to expose updates in a way that is easily machine-readable, for example\n * a JSON-stream. We don't want to pollute it with textual messages.\n *\n * We centralize terminal reporting into a single place because we want the\n * output to be robust and consistent. The most common reporter is\n * TerminalReporter, that should be the only place in the application should\n * access the `terminal` module (nor the `console`).\n */\nexport type Reporter = { update(event: ReportableEvent): void };\n\nexport interface SnippetError extends Error {\n code?: string;\n filename?: string;\n snippet?: string;\n\n /** Module that failed to load ex 'fs' */\n targetModuleName?: string;\n originModulePath?: string;\n\n errors?: any[];\n}\n\nexport interface TerminalReporterInterface {\n new (terminal: Terminal): TerminalReporterInterface;\n\n /**\n * The bundle builds for which we are actively maintaining the status on the\n * terminal, ie. showing a progress bar. There can be several bundles being\n * built at the same time.\n */\n _activeBundles: Map<string, BundleProgress>;\n\n _scheduleUpdateBundleProgress: {\n (data: { buildID: string; transformedFileCount: number; totalFileCount: number }): void;\n cancel(): void;\n };\n\n /** Set in super type */\n terminal: Terminal;\n\n /**\n * Construct a message that represents the progress of a\n * single bundle build, for example:\n *\n * BUNDLE path/to/bundle.js ▓▓▓▓▓░░░░░░░░░░░ 36.6% (4790/7922)\n */\n _getBundleStatusMessage(\n {\n bundleDetails: { entryFile, bundleType, runtimeBytecodeVersion },\n transformedFileCount,\n totalFileCount,\n ratio,\n }: BundleProgress,\n phase: BuildPhase\n ): string;\n\n /**\n * This function is only concerned with logging and should not do state\n * or terminal status updates.\n */\n _log(event: TerminalReportableEvent): void;\n\n _logCacheDisabled(reason: GlobalCacheDisabledReason): void;\n\n _logBundleBuildDone(buildID: string): void;\n\n _logBundleBuildFailed(buildID: string): void;\n\n _logInitializing(port: number, hasReducedPerformance: boolean): void;\n\n _logInitializingFailed(port: number, error: SnippetError): void;\n\n /**\n * We do not want to log the whole stacktrace for bundling error, because\n * these are operational errors, not programming errors, and the stacktrace\n * is not actionable to end users.\n */\n _logBundlingError(error: SnippetError): void;\n\n /**\n * We use Math.pow(ratio, 2) to as a conservative measure of progress because\n * we know the `totalCount` is going to progressively increase as well. We\n * also prevent the ratio from going backwards.\n */\n _updateBundleProgress({\n buildID,\n transformedFileCount,\n totalFileCount,\n }: BundleProgressUpdate): void;\n\n /**\n * This function is exclusively concerned with updating the internal state.\n * No logging or status updates should be done at this point.\n */\n _updateState(event: TerminalReportableEvent): void;\n /**\n * Return a status message that is always consistent with the current state\n * of the application. Having this single function ensures we don't have\n * different call sites overriding each other status messages.\n */\n _getStatusMessage(): string;\n\n _logHmrClientError(e: Error): void;\n\n /**\n * Single entry point for reporting events. That allows us to implement the\n * corresponding JSON reporter easily and have a consistent reporting.\n */\n update(event: TerminalReportableEvent): void;\n}\n"],"names":[],"mappings":"AAAA"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/TerminalReporter.types.ts"],"sourcesContent":["import type { ReportableEvent } from 'metro';\nimport type { TerminalReportableEvent } from 'metro/src/lib/TerminalReporter';\nimport type { Terminal } from 'metro-core';\nimport type { WatcherStatus } from 'metro-file-map';\n\nimport { MetroEnvironment } from '../middleware/metroOptions';\n\nexport type GlobalCacheDisabledReason = 'too_many_errors' | 'too_many_misses';\n\nexport type BundleDetails = {\n buildID?: string;\n bundleType: string;\n dev: boolean;\n entryFile: string;\n minify: boolean;\n platform: string | null | undefined;\n customTransformOptions?: { environment?: MetroEnvironment };\n runtimeBytecodeVersion: number | null | undefined;\n};\n\nexport type BundleProgress = {\n bundleDetails: BundleDetails;\n transformedFileCount: number;\n totalFileCount: number;\n ratio: number;\n};\n\nexport type BundleProgressUpdate = {\n buildID: string;\n transformedFileCount: number;\n totalFileCount: number;\n};\n\nexport { TerminalReportableEvent };\n\nexport type BuildPhase = 'in_progress' | 'done' | 'failed';\n\n/**\n * Code across the application takes a reporter as an option and calls the\n * update whenever one of the ReportableEvent happens. Code does not directly\n * write to the standard output, because a build would be:\n *\n * 1. ad-hoc, embedded into another tool, in which case we do not want to\n * pollute that tool's own output. The tool is free to present the\n * warnings/progress we generate any way they want, by specifying a custom\n * reporter.\n * 2. run as a background process from another tool, in which case we want\n * to expose updates in a way that is easily machine-readable, for example\n * a JSON-stream. We don't want to pollute it with textual messages.\n *\n * We centralize terminal reporting into a single place because we want the\n * output to be robust and consistent. The most common reporter is\n * TerminalReporter, that should be the only place in the application should\n * access the `terminal` module (nor the `console`).\n */\nexport type Reporter = { update(event: ReportableEvent): void };\n\nexport interface SnippetError extends Error {\n code?: string;\n filename?: string;\n snippet?: string;\n\n /** Module that failed to load ex 'fs' */\n targetModuleName?: string;\n originModulePath?: string;\n\n errors?: any[];\n}\n\nexport interface TerminalReporterInterface {\n new (terminal: Terminal): TerminalReporterInterface;\n\n /**\n * The bundle builds for which we are actively maintaining the status on the\n * terminal, ie. showing a progress bar. There can be several bundles being\n * built at the same time.\n */\n _activeBundles: Map<string, BundleProgress>;\n\n _scheduleUpdateBundleProgress: {\n (data: { buildID: string; transformedFileCount: number; totalFileCount: number }): void;\n cancel(): void;\n };\n\n /** Set in super type */\n terminal: Terminal;\n\n /**\n * Construct a message that represents the progress of a\n * single bundle build, for example:\n *\n * BUNDLE path/to/bundle.js ▓▓▓▓▓░░░░░░░░░░░ 36.6% (4790/7922)\n */\n _getBundleStatusMessage(\n {\n bundleDetails: { entryFile, bundleType, runtimeBytecodeVersion },\n transformedFileCount,\n totalFileCount,\n ratio,\n }: BundleProgress,\n phase: BuildPhase\n ): string;\n\n _logWatcherStatus(event: WatcherStatus): void;\n\n /**\n * This function is only concerned with logging and should not do state\n * or terminal status updates.\n */\n _log(event: TerminalReportableEvent): void;\n\n _logCacheDisabled(reason: GlobalCacheDisabledReason): void;\n\n _logBundleBuildDone(buildID: string): void;\n\n _logBundleBuildFailed(buildID: string): void;\n\n _logInitializing(port: number, hasReducedPerformance: boolean): void;\n\n _logInitializingFailed(port: number, error: SnippetError): void;\n\n /**\n * We do not want to log the whole stacktrace for bundling error, because\n * these are operational errors, not programming errors, and the stacktrace\n * is not actionable to end users.\n */\n _logBundlingError(error: SnippetError): void;\n\n /**\n * We use Math.pow(ratio, 2) to as a conservative measure of progress because\n * we know the `totalCount` is going to progressively increase as well. We\n * also prevent the ratio from going backwards.\n */\n _updateBundleProgress({\n buildID,\n transformedFileCount,\n totalFileCount,\n }: BundleProgressUpdate): void;\n\n /**\n * This function is exclusively concerned with updating the internal state.\n * No logging or status updates should be done at this point.\n */\n _updateState(event: TerminalReportableEvent): void;\n /**\n * Return a status message that is always consistent with the current state\n * of the application. Having this single function ensures we don't have\n * different call sites overriding each other status messages.\n */\n _getStatusMessage(): string;\n\n _logHmrClientError(e: Error): void;\n\n /**\n * Single entry point for reporting events. That allows us to implement the\n * corresponding JSON reporter easily and have a consistent reporting.\n */\n update(event: TerminalReportableEvent): void;\n}\n"],"names":[],"mappings":"AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/createServerRouteMiddleware.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 type { ProjectConfig } from '@expo/config';\nimport resolve from 'resolve';\nimport resolveFrom from 'resolve-from';\nimport { promisify } from 'util';\n\nimport { ForwardHtmlError } from './MetroBundlerDevServer';\nimport { fetchManifest } from './fetchRouterManifest';\nimport { getErrorOverlayHtmlAsync, logMetroError } from './metroErrorInterface';\nimport { warnInvalidWebOutput } from './router';\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\nconst resolveAsync = promisify(resolve) as any as (\n id: string,\n opts: resolve.AsyncOpts\n) => Promise<string | null>;\n\nexport function createRouteHandlerMiddleware(\n projectRoot: string,\n options: {\n appDir: string;\n routerRoot: string;\n getStaticPageAsync: (pathname: string) => Promise<{ content: string }>;\n bundleApiRoute: (\n functionFilePath: string\n ) => Promise<null | Record<string, Function> | Response>;\n config: ProjectConfig;\n }\n) {\n if (!resolveFrom.silent(projectRoot, 'expo-router')) {\n throw new CommandError(\n 'static and server rendering requires the expo-router package to be installed in your project.'\n );\n }\n\n const { createRequestHandler } =\n require('@expo/server/build/vendor/http') as typeof import('@expo/server/build/vendor/http');\n\n return createRequestHandler(\n { build: '' },\n {\n async getRoutesManifest() {\n const manifest = await fetchManifest<RegExp>(projectRoot, options);\n debug('manifest', manifest);\n // NOTE: no app dir if null\n // TODO: Redirect to 404 page\n return (\n manifest ?? {\n // Support the onboarding screen if there's no manifest\n htmlRoutes: [\n {\n file: 'index.js',\n page: '/index',\n routeKeys: {},\n namedRegex: /^\\/(?:index)?\\/?$/i,\n },\n ],\n apiRoutes: [],\n notFoundRoutes: [],\n }\n );\n },\n async getHtml(request) {\n try {\n const { content } = await options.getStaticPageAsync(request.url);\n return content;\n } catch (error: any) {\n // Forward the Metro server response as-is. It won't be pretty, but at least it will be accurate.\n if (error instanceof ForwardHtmlError) {\n return new Response(error.html, {\n status: error.statusCode,\n headers: {\n 'Content-Type': 'text/html',\n },\n });\n }\n\n try {\n return new Response(\n await getErrorOverlayHtmlAsync({\n error,\n projectRoot,\n routerRoot: options.routerRoot,\n }),\n {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n }\n );\n } catch (staticError: any) {\n debug('Failed to render static error overlay:', staticError);\n // Fallback error for when Expo Router is misconfigured in the project.\n return new Response(\n '<span><h3>Internal Error:</h3><b>Project is not setup correctly for static rendering (check terminal for more info):</b><br/>' +\n error.message +\n '<br/><br/>' +\n staticError.message +\n '</span>',\n {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n }\n );\n }\n }\n },\n logApiRouteExecutionError(error) {\n logMetroError(projectRoot, { error });\n },\n async getApiRoute(route) {\n const { exp } = options.config;\n if (exp.web?.output !== 'server') {\n warnInvalidWebOutput();\n }\n\n const resolvedFunctionPath = await resolveAsync(route.file, {\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\n basedir: options.appDir,\n })!;\n\n try {\n debug(`Bundling middleware at: ${resolvedFunctionPath}`);\n return await options.bundleApiRoute(resolvedFunctionPath!);\n } catch (error: any) {\n return new Response(\n 'Failed to load API Route: ' + resolvedFunctionPath + '\\n\\n' + error.message,\n {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n }\n );\n }\n },\n }\n );\n}\n"],"names":["createRouteHandlerMiddleware","debug","require","resolveAsync","promisify","resolve","projectRoot","options","resolveFrom","silent","CommandError","createRequestHandler","build","getRoutesManifest","manifest","fetchManifest","htmlRoutes","file","page","routeKeys","namedRegex","apiRoutes","notFoundRoutes","getHtml","request","content","getStaticPageAsync","url","error","ForwardHtmlError","Response","html","status","statusCode","headers","getErrorOverlayHtmlAsync","routerRoot","staticError","message","logApiRouteExecutionError","logMetroError","getApiRoute","route","exp","config","web","output","warnInvalidWebOutput","resolvedFunctionPath","extensions","basedir","appDir","bundleApiRoute"],"mappings":"AAAA;;;;;CAKC,GAED;;;;+BAkBgBA,8BAA4B;;aAA5BA,4BAA4B;;;8DAjBxB,SAAS;;;;;;;8DACL,cAAc;;;;;;;yBACZ,MAAM;;;;;;uCAEC,yBAAyB;qCAC5B,uBAAuB;qCACG,uBAAuB;wBAC1C,UAAU;wBAClB,uBAAuB;;;;;;AAEpD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,yBAAyB,CAAC,AAAsB,AAAC;AAEhF,MAAMC,YAAY,GAAGC,IAAAA,KAAS,EAAA,UAAA,EAACC,QAAO,EAAA,QAAA,CAAC,AAGZ,AAAC;AAErB,SAASL,4BAA4B,CAC1CM,WAAmB,EACnBC,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/createServerRouteMiddleware.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 type { ProjectConfig } from '@expo/config';\nimport resolve from 'resolve';\nimport resolveFrom from 'resolve-from';\nimport { promisify } from 'util';\n\nimport { ForwardHtmlError } from './MetroBundlerDevServer';\nimport { fetchManifest } from './fetchRouterManifest';\nimport { getErrorOverlayHtmlAsync, logMetroError } from './metroErrorInterface';\nimport { warnInvalidWebOutput } from './router';\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\nconst resolveAsync = promisify(resolve) as any as (\n id: string,\n opts: resolve.AsyncOpts\n) => Promise<string | null>;\n\nexport function createRouteHandlerMiddleware(\n projectRoot: string,\n options: {\n appDir: string;\n routerRoot: string;\n getStaticPageAsync: (pathname: string) => Promise<{ content: string }>;\n bundleApiRoute: (\n functionFilePath: string\n ) => Promise<null | Record<string, Function> | Response>;\n config: ProjectConfig;\n } & import('expo-router/build/routes-manifest').Options\n) {\n if (!resolveFrom.silent(projectRoot, 'expo-router')) {\n throw new CommandError(\n 'static and server rendering requires the expo-router package to be installed in your project.'\n );\n }\n\n const { createRequestHandler } =\n require('@expo/server/build/vendor/http') as typeof import('@expo/server/build/vendor/http');\n\n return createRequestHandler(\n { build: '' },\n {\n async getRoutesManifest() {\n const manifest = await fetchManifest<RegExp>(projectRoot, options);\n debug('manifest', manifest);\n // NOTE: no app dir if null\n // TODO: Redirect to 404 page\n return (\n manifest ?? {\n // Support the onboarding screen if there's no manifest\n htmlRoutes: [\n {\n file: 'index.js',\n page: '/index',\n routeKeys: {},\n namedRegex: /^\\/(?:index)?\\/?$/i,\n },\n ],\n apiRoutes: [],\n notFoundRoutes: [],\n }\n );\n },\n async getHtml(request) {\n try {\n const { content } = await options.getStaticPageAsync(request.url);\n return content;\n } catch (error: any) {\n // Forward the Metro server response as-is. It won't be pretty, but at least it will be accurate.\n if (error instanceof ForwardHtmlError) {\n return new Response(error.html, {\n status: error.statusCode,\n headers: {\n 'Content-Type': 'text/html',\n },\n });\n }\n\n try {\n return new Response(\n await getErrorOverlayHtmlAsync({\n error,\n projectRoot,\n routerRoot: options.routerRoot,\n }),\n {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n }\n );\n } catch (staticError: any) {\n debug('Failed to render static error overlay:', staticError);\n // Fallback error for when Expo Router is misconfigured in the project.\n return new Response(\n '<span><h3>Internal Error:</h3><b>Project is not setup correctly for static rendering (check terminal for more info):</b><br/>' +\n error.message +\n '<br/><br/>' +\n staticError.message +\n '</span>',\n {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n }\n );\n }\n }\n },\n logApiRouteExecutionError(error) {\n logMetroError(projectRoot, { error });\n },\n async getApiRoute(route) {\n const { exp } = options.config;\n if (exp.web?.output !== 'server') {\n warnInvalidWebOutput();\n }\n\n const resolvedFunctionPath = await resolveAsync(route.file, {\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\n basedir: options.appDir,\n })!;\n\n try {\n debug(`Bundling middleware at: ${resolvedFunctionPath}`);\n return await options.bundleApiRoute(resolvedFunctionPath!);\n } catch (error: any) {\n return new Response(\n 'Failed to load API Route: ' + resolvedFunctionPath + '\\n\\n' + error.message,\n {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n }\n );\n }\n },\n }\n );\n}\n"],"names":["createRouteHandlerMiddleware","debug","require","resolveAsync","promisify","resolve","projectRoot","options","resolveFrom","silent","CommandError","createRequestHandler","build","getRoutesManifest","manifest","fetchManifest","htmlRoutes","file","page","routeKeys","namedRegex","apiRoutes","notFoundRoutes","getHtml","request","content","getStaticPageAsync","url","error","ForwardHtmlError","Response","html","status","statusCode","headers","getErrorOverlayHtmlAsync","routerRoot","staticError","message","logApiRouteExecutionError","logMetroError","getApiRoute","route","exp","config","web","output","warnInvalidWebOutput","resolvedFunctionPath","extensions","basedir","appDir","bundleApiRoute"],"mappings":"AAAA;;;;;CAKC,GAED;;;;+BAkBgBA,8BAA4B;;aAA5BA,4BAA4B;;;8DAjBxB,SAAS;;;;;;;8DACL,cAAc;;;;;;;yBACZ,MAAM;;;;;;uCAEC,yBAAyB;qCAC5B,uBAAuB;qCACG,uBAAuB;wBAC1C,UAAU;wBAClB,uBAAuB;;;;;;AAEpD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,yBAAyB,CAAC,AAAsB,AAAC;AAEhF,MAAMC,YAAY,GAAGC,IAAAA,KAAS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K,CAACzB,IAAI,EAAE;gBAC1DgC,UAAU,EAAE;oBAAC,KAAK;oBAAE,MAAM;oBAAE,KAAK;oBAAE,MAAM;iBAAC;gBAC1CC,OAAO,EAAE3C,OAAO,CAAC4C,MAAM;aACxB,CAAC,AAAC,AAAC;YAEJ,IAAI;gBACFlD,KAAK,CAAC,CAAC,wBAAwB,EAAE+C,oBAAoB,CAAC,CAAC,CAAC,CAAC;gBACzD,OAAO,MAAMzC,OAAO,CAAC6C,cAAc,CAACJ,oBAAoB,CAAE,CAAC;YAC7D,EAAE,OAAOpB,KAAK,EAAO;gBACnB,OAAO,IAAIE,QAAQ,CACjB,4BAA4B,GAAGkB,oBAAoB,GAAG,MAAM,GAAGpB,KAAK,CAACU,OAAO,EAC5E;oBACEN,MAAM,EAAE,GAAG;oBACXE,OAAO,EAAE;wBACP,cAAc,EAAE,WAAW;qBAC5B;iBACF,CACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -30,7 +30,7 @@ class AtlasPrerequisite extends _prerequisite.ProjectPrerequisite {
|
|
|
30
30
|
warningMessage: "Expo Atlas is not installed in this project, unable to gather bundle information.",
|
|
31
31
|
requiredPackages: [
|
|
32
32
|
{
|
|
33
|
-
version: "^0.
|
|
33
|
+
version: "^0.2.0",
|
|
34
34
|
pkg: "expo-atlas",
|
|
35
35
|
file: "expo-atlas/package.json",
|
|
36
36
|
dev: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/debugging/AtlasPrerequisite.ts"],"sourcesContent":["import { ProjectPrerequisite } from '../../../doctor/Prerequisite';\nimport {\n type EnsureDependenciesOptions,\n ensureDependenciesAsync,\n} from '../../../doctor/dependencies/ensureDependenciesAsync';\n\nexport class AtlasPrerequisite extends ProjectPrerequisite<\n boolean,\n Pick<EnsureDependenciesOptions, 'exp'>\n> {\n async assertImplementation({ exp }: Pick<EnsureDependenciesOptions, 'exp'> = {}) {\n await this.ensureAtlasInstalled({ exp });\n return true;\n }\n\n async bootstrapAsync({ exp }: Pick<EnsureDependenciesOptions, 'exp'> = {}) {\n await this.ensureAtlasInstalled({ exp, skipPrompt: true, isProjectMutable: true });\n }\n\n private async ensureAtlasInstalled(options: Partial<EnsureDependenciesOptions> = {}) {\n try {\n return await ensureDependenciesAsync(this.projectRoot, {\n ...options,\n installMessage:\n 'Expo Atlas is required to gather bundle information, but it is not installed in this project.',\n warningMessage:\n 'Expo Atlas is not installed in this project, unable to gather bundle information.',\n requiredPackages: [\n { version: '^0.
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/metro/debugging/AtlasPrerequisite.ts"],"sourcesContent":["import { ProjectPrerequisite } from '../../../doctor/Prerequisite';\nimport {\n type EnsureDependenciesOptions,\n ensureDependenciesAsync,\n} from '../../../doctor/dependencies/ensureDependenciesAsync';\n\nexport class AtlasPrerequisite extends ProjectPrerequisite<\n boolean,\n Pick<EnsureDependenciesOptions, 'exp'>\n> {\n async assertImplementation({ exp }: Pick<EnsureDependenciesOptions, 'exp'> = {}) {\n await this.ensureAtlasInstalled({ exp });\n return true;\n }\n\n async bootstrapAsync({ exp }: Pick<EnsureDependenciesOptions, 'exp'> = {}) {\n await this.ensureAtlasInstalled({ exp, skipPrompt: true, isProjectMutable: true });\n }\n\n private async ensureAtlasInstalled(options: Partial<EnsureDependenciesOptions> = {}) {\n try {\n return await ensureDependenciesAsync(this.projectRoot, {\n ...options,\n installMessage:\n 'Expo Atlas is required to gather bundle information, but it is not installed in this project.',\n warningMessage:\n 'Expo Atlas is not installed in this project, unable to gather bundle information.',\n requiredPackages: [\n { version: '^0.2.0', pkg: 'expo-atlas', file: 'expo-atlas/package.json', dev: true },\n ],\n });\n } catch (error) {\n this.resetAssertion({});\n throw error;\n }\n }\n}\n"],"names":["AtlasPrerequisite","ProjectPrerequisite","assertImplementation","exp","ensureAtlasInstalled","bootstrapAsync","skipPrompt","isProjectMutable","options","ensureDependenciesAsync","projectRoot","installMessage","warningMessage","requiredPackages","version","pkg","file","dev","error","resetAssertion"],"mappings":"AAAA;;;;+BAMaA,mBAAiB;;aAAjBA,iBAAiB;;8BANM,8BAA8B;yCAI3D,sDAAsD;AAEtD,MAAMA,iBAAiB,SAASC,aAAmB,oBAAA;UAIlDC,oBAAoB,CAAC,EAAEC,GAAG,CAAA,EAA0C,GAAG,EAAE,EAAE;QAC/E,MAAM,IAAI,CAACC,oBAAoB,CAAC;YAAED,GAAG;SAAE,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC;IACd;UAEME,cAAc,CAAC,EAAEF,GAAG,CAAA,EAA0C,GAAG,EAAE,EAAE;QACzE,MAAM,IAAI,CAACC,oBAAoB,CAAC;YAAED,GAAG;YAAEG,UAAU,EAAE,IAAI;YAAEC,gBAAgB,EAAE,IAAI;SAAE,CAAC,CAAC;IACrF;UAEcH,oBAAoB,CAACI,OAA2C,GAAG,EAAE,EAAE;QACnF,IAAI;YACF,OAAO,MAAMC,IAAAA,wBAAuB,wBAAA,EAAC,IAAI,CAACC,WAAW,EAAE;gBACrD,GAAGF,OAAO;gBACVG,cAAc,EACZ,+FAA+F;gBACjGC,cAAc,EACZ,mFAAmF;gBACrFC,gBAAgB,EAAE;oBAChB;wBAAEC,OAAO,EAAE,QAAQ;wBAAEC,GAAG,EAAE,YAAY;wBAAEC,IAAI,EAAE,yBAAyB;wBAAEC,GAAG,EAAE,IAAI;qBAAE;iBACrF;aACF,CAAC,CAAC;QACL,EAAE,OAAOC,KAAK,EAAE;YACd,IAAI,CAACC,cAAc,CAAC,EAAE,CAAC,CAAC;YACxB,MAAMD,KAAK,CAAC;QACd,CAAC;IACH;CACD"}
|
|
@@ -9,37 +9,31 @@ Object.defineProperty(exports, "attachAtlasAsync", {
|
|
|
9
9
|
const _atlasPrerequisite = require("./AtlasPrerequisite");
|
|
10
10
|
const _env = require("../../../../utils/env");
|
|
11
11
|
const debug = require("debug")("expo:metro:debugging:attachAtlas");
|
|
12
|
-
async function attachAtlasAsync(
|
|
12
|
+
async function attachAtlasAsync(options) {
|
|
13
13
|
if (!_env.env.EXPO_UNSTABLE_ATLAS) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
debug("Atlas is enabled, initializing for this project...");
|
|
17
|
-
await new _atlasPrerequisite.AtlasPrerequisite(projectRoot).bootstrapAsync({
|
|
18
|
-
exp
|
|
17
|
+
await new _atlasPrerequisite.AtlasPrerequisite(options.projectRoot).bootstrapAsync({
|
|
18
|
+
exp: options.exp
|
|
19
19
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
debug("Attached Atlas to Metro config for exporting");
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
// Running in development mode requires middleware to be attached
|
|
31
|
-
if (!isExporting && !middleware) {
|
|
20
|
+
return !options.isExporting ? attachAtlasToDevServer(options) : await attachAtlasToExport(options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Attach Atlas to the Metro bundler for development mode.
|
|
24
|
+
* This includes attaching to Metro's middleware stack to host the Atlas UI.
|
|
25
|
+
*/ function attachAtlasToDevServer(options) {
|
|
26
|
+
if (!options.middleware) {
|
|
32
27
|
throw new Error("Expected middleware to be provided for Atlas when running in development mode");
|
|
33
|
-
} else if (!isExporting && middleware) {
|
|
34
|
-
const atlas1 = importAtlasForDev(projectRoot);
|
|
35
|
-
if (!atlas1) {
|
|
36
|
-
return debug("Atlas is not installed in the project, skipping initialization");
|
|
37
|
-
}
|
|
38
|
-
const instance = atlas1.createExpoAtlasMiddleware(metroConfig);
|
|
39
|
-
middleware.use("/_expo/atlas", instance.middleware);
|
|
40
|
-
debug("Attached Atlas middleware for development on: /_expo/atlas");
|
|
41
|
-
return instance;
|
|
42
28
|
}
|
|
29
|
+
const atlas = importAtlasForDev(options.projectRoot);
|
|
30
|
+
if (!atlas) {
|
|
31
|
+
return debug("Atlas is not installed in the project, skipping initialization");
|
|
32
|
+
}
|
|
33
|
+
const instance = atlas.createExpoAtlasMiddleware(options.metroConfig);
|
|
34
|
+
options.middleware.use("/_expo/atlas", instance.middleware);
|
|
35
|
+
debug("Attached Atlas middleware for development on: /_expo/atlas");
|
|
36
|
+
return instance;
|
|
43
37
|
}
|
|
44
38
|
function importAtlasForDev(projectRoot) {
|
|
45
39
|
try {
|
|
@@ -53,6 +47,21 @@ function importAtlasForDev(projectRoot) {
|
|
|
53
47
|
return null;
|
|
54
48
|
}
|
|
55
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Attach Atlas to the Metro bundler for exporting mode.
|
|
52
|
+
* This only includes attaching the custom serializer to the Metro config.
|
|
53
|
+
*/ async function attachAtlasToExport(options) {
|
|
54
|
+
const atlas = importAtlasForExport(options.projectRoot);
|
|
55
|
+
if (!atlas) {
|
|
56
|
+
return debug("Atlas is not installed in the project, skipping initialization");
|
|
57
|
+
}
|
|
58
|
+
if (options.resetAtlasFile) {
|
|
59
|
+
const filePath = await atlas.resetExpoAtlasFile(options.projectRoot);
|
|
60
|
+
debug("(Re)created Atlas file at:", filePath);
|
|
61
|
+
}
|
|
62
|
+
atlas.withExpoAtlas(options.metroConfig);
|
|
63
|
+
debug("Attached Atlas to Metro config for exporting");
|
|
64
|
+
}
|
|
56
65
|
function importAtlasForExport(projectRoot) {
|
|
57
66
|
try {
|
|
58
67
|
return require(require.resolve("expo-atlas/metro", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/debugging/attachAtlas.ts"],"sourcesContent":["import type { Server as ConnectServer } from 'connect';\nimport type { ConfigT as MetroConfig } from 'metro-config';\n\nimport { AtlasPrerequisite } from './AtlasPrerequisite';\nimport { env } from '../../../../utils/env';\nimport { type EnsureDependenciesOptions } from '../../../doctor/dependencies/ensureDependenciesAsync';\n\nconst debug = require('debug')('expo:metro:debugging:attachAtlas') as typeof console.log;\n\ntype AttachAtlasOptions = Pick<EnsureDependenciesOptions, 'exp'> & {\n isExporting: boolean;\n projectRoot: string;\n middleware?: ConnectServer;\n metroConfig: MetroConfig;\n};\n\nexport async function attachAtlasAsync(
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/metro/debugging/attachAtlas.ts"],"sourcesContent":["import type { Server as ConnectServer } from 'connect';\nimport type { ConfigT as MetroConfig } from 'metro-config';\n\nimport { AtlasPrerequisite } from './AtlasPrerequisite';\nimport { env } from '../../../../utils/env';\nimport { type EnsureDependenciesOptions } from '../../../doctor/dependencies/ensureDependenciesAsync';\n\nconst debug = require('debug')('expo:metro:debugging:attachAtlas') as typeof console.log;\n\ntype AttachAtlasOptions = Pick<EnsureDependenciesOptions, 'exp'> & {\n isExporting: boolean;\n projectRoot: string;\n middleware?: ConnectServer;\n metroConfig: MetroConfig;\n resetAtlasFile?: boolean;\n};\n\nexport async function attachAtlasAsync(\n options: AttachAtlasOptions\n): Promise<void | ReturnType<typeof import('expo-atlas/cli').createExpoAtlasMiddleware>> {\n if (!env.EXPO_UNSTABLE_ATLAS) {\n return;\n }\n\n debug('Atlas is enabled, initializing for this project...');\n await new AtlasPrerequisite(options.projectRoot).bootstrapAsync({ exp: options.exp });\n\n return !options.isExporting\n ? attachAtlasToDevServer(options)\n : await attachAtlasToExport(options);\n}\n\n/**\n * Attach Atlas to the Metro bundler for development mode.\n * This includes attaching to Metro's middleware stack to host the Atlas UI.\n */\nfunction attachAtlasToDevServer(\n options: Pick<AttachAtlasOptions, 'projectRoot' | 'middleware' | 'metroConfig'>\n): void | ReturnType<typeof import('expo-atlas/cli').createExpoAtlasMiddleware> {\n if (!options.middleware) {\n throw new Error(\n 'Expected middleware to be provided for Atlas when running in development mode'\n );\n }\n\n const atlas = importAtlasForDev(options.projectRoot);\n if (!atlas) {\n return debug('Atlas is not installed in the project, skipping initialization');\n }\n\n const instance = atlas.createExpoAtlasMiddleware(options.metroConfig);\n options.middleware.use('/_expo/atlas', instance.middleware);\n debug('Attached Atlas middleware for development on: /_expo/atlas');\n return instance;\n}\n\nfunction importAtlasForDev(projectRoot: string): null | typeof import('expo-atlas/cli') {\n try {\n return require(require.resolve('expo-atlas/cli', { paths: [projectRoot] }));\n } catch (error: any) {\n debug('Failed to load Atlas from project:', error);\n return null;\n }\n}\n\n/**\n * Attach Atlas to the Metro bundler for exporting mode.\n * This only includes attaching the custom serializer to the Metro config.\n */\nasync function attachAtlasToExport(\n options: Pick<AttachAtlasOptions, 'projectRoot' | 'metroConfig' | 'resetAtlasFile'>\n): Promise<void> {\n const atlas = importAtlasForExport(options.projectRoot);\n if (!atlas) {\n return debug('Atlas is not installed in the project, skipping initialization');\n }\n\n if (options.resetAtlasFile) {\n const filePath = await atlas.resetExpoAtlasFile(options.projectRoot);\n debug('(Re)created Atlas file at:', filePath);\n }\n\n atlas.withExpoAtlas(options.metroConfig);\n debug('Attached Atlas to Metro config for exporting');\n}\n\nfunction importAtlasForExport(projectRoot: string): null | typeof import('expo-atlas/metro') {\n try {\n return require(require.resolve('expo-atlas/metro', { paths: [projectRoot] }));\n } catch (error: any) {\n debug('Failed to load Atlas from project:', error);\n return null;\n }\n}\n"],"names":["attachAtlasAsync","debug","require","options","env","EXPO_UNSTABLE_ATLAS","AtlasPrerequisite","projectRoot","bootstrapAsync","exp","isExporting","attachAtlasToDevServer","attachAtlasToExport","middleware","Error","atlas","importAtlasForDev","instance","createExpoAtlasMiddleware","metroConfig","use","resolve","paths","error","importAtlasForExport","resetAtlasFile","filePath","resetExpoAtlasFile","withExpoAtlas"],"mappings":"AAAA;;;;+BAiBsBA,kBAAgB;;aAAhBA,gBAAgB;;mCAdJ,qBAAqB;qBACnC,uBAAuB;AAG3C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,kCAAkC,CAAC,AAAsB,AAAC;AAUlF,eAAeF,gBAAgB,CACpCG,OAA2B,EAC4D;IACvF,IAAI,CAACC,IAAG,IAAA,CAACC,mBAAmB,EAAE;QAC5B,OAAO;IACT,CA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AmB,CAChCT,OAAmF,EACpE;IACf,MAAMY,KAAK,GAAGS,oBAAoB,CAACrB,OAAO,CAACI,WAAW,CAAC,AAAC;IACxD,IAAI,CAACQ,KAAK,EAAE;QACV,OAAOd,KAAK,CAAC,gEAAgE,CAAC,CAAC;IACjF,CAAC;IAED,IAAIE,OAAO,CAACsB,cAAc,EAAE;QAC1B,MAAMC,QAAQ,GAAG,MAAMX,KAAK,CAACY,kBAAkB,CAACxB,OAAO,CAACI,WAAW,CAAC,AAAC;QACrEN,KAAK,CAAC,4BAA4B,EAAEyB,QAAQ,CAAC,CAAC;IAChD,CAAC;IAEDX,KAAK,CAACa,aAAa,CAACzB,OAAO,CAACgB,WAAW,CAAC,CAAC;IACzClB,KAAK,CAAC,8CAA8C,CAAC,CAAC;AACxD,CAAC;AAED,SAASuB,oBAAoB,CAACjB,WAAmB,EAA4C;IAC3F,IAAI;QACF,OAAOL,OAAO,CAACA,OAAO,CAACmB,OAAO,CAAC,kBAAkB,EAAE;YAAEC,KAAK,EAAE;gBAACf,WAAW;aAAC;SAAE,CAAC,CAAC,CAAC;IAChF,EAAE,OAAOgB,KAAK,EAAO;QACnBtB,KAAK,CAAC,oCAAoC,EAAEsB,KAAK,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -37,7 +37,7 @@ async function fetchManifest(projectRoot, options) {
|
|
|
37
37
|
const getManifest = getExpoRouteManifestBuilderAsync(projectRoot);
|
|
38
38
|
const paths = (0, _router.getRoutePaths)(options.appDir);
|
|
39
39
|
// Get the serialized manifest
|
|
40
|
-
const jsonManifest = getManifest(paths);
|
|
40
|
+
const jsonManifest = getManifest(paths, options);
|
|
41
41
|
if (!jsonManifest) {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/fetchRouterManifest.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 resolveFrom from 'resolve-from';\n\nimport { getRoutePaths } from './router';\n\nexport type ExpoRouterServerManifestV1Route<TRegex = string> = {\n file: string;\n page: string;\n routeKeys: Record<string, string>;\n namedRegex: TRegex;\n generated?: boolean;\n};\n\nexport type ExpoRouterServerManifestV1<TRegex = string> = {\n apiRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n htmlRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n notFoundRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n};\n\nfunction getExpoRouteManifestBuilderAsync(projectRoot: string) {\n return require(resolveFrom(projectRoot, 'expo-router/build/routes-manifest'))\n .createRoutesManifest as typeof import('expo-router/build/routes-manifest').createRoutesManifest;\n}\n\n// TODO: Simplify this now that we use Node.js directly, no need for the Metro bundler caching layer.\nexport async function fetchManifest<TRegex = string>(\n projectRoot: string,\n options: {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/fetchRouterManifest.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 resolveFrom from 'resolve-from';\n\nimport { getRoutePaths } from './router';\n\nexport type ExpoRouterServerManifestV1Route<TRegex = string> = {\n file: string;\n page: string;\n routeKeys: Record<string, string>;\n namedRegex: TRegex;\n generated?: boolean;\n};\n\nexport type ExpoRouterServerManifestV1<TRegex = string> = {\n apiRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n htmlRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n notFoundRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n};\n\nfunction getExpoRouteManifestBuilderAsync(projectRoot: string) {\n return require(resolveFrom(projectRoot, 'expo-router/build/routes-manifest'))\n .createRoutesManifest as typeof import('expo-router/build/routes-manifest').createRoutesManifest;\n}\n\n// TODO: Simplify this now that we use Node.js directly, no need for the Metro bundler caching layer.\nexport async function fetchManifest<TRegex = string>(\n projectRoot: string,\n options: {\n asJson?: boolean;\n appDir: string;\n } & import('expo-router/build/routes-manifest').Options\n): Promise<ExpoRouterServerManifestV1<TRegex> | null> {\n const getManifest = getExpoRouteManifestBuilderAsync(projectRoot);\n const paths = getRoutePaths(options.appDir);\n // Get the serialized manifest\n const jsonManifest = getManifest(paths, options);\n\n if (!jsonManifest) {\n return null;\n }\n\n if (!jsonManifest.htmlRoutes || !jsonManifest.apiRoutes) {\n throw new Error('Routes manifest is malformed: ' + JSON.stringify(jsonManifest, null, 2));\n }\n\n if (!options.asJson) {\n // @ts-expect-error\n return inflateManifest(jsonManifest);\n }\n // @ts-expect-error\n return jsonManifest;\n}\n\n// Convert the serialized manifest to a usable format\nexport function inflateManifest(\n json: ExpoRouterServerManifestV1<string>\n): ExpoRouterServerManifestV1<RegExp> {\n return {\n ...json,\n htmlRoutes: json.htmlRoutes?.map((value) => {\n return {\n ...value,\n namedRegex: new RegExp(value.namedRegex),\n };\n }),\n apiRoutes: json.apiRoutes?.map((value) => {\n return {\n ...value,\n namedRegex: new RegExp(value.namedRegex),\n };\n }),\n notFoundRoutes: json.notFoundRoutes?.map((value) => {\n return {\n ...value,\n namedRegex: new RegExp(value.namedRegex),\n };\n }),\n };\n}\n"],"names":["fetchManifest","inflateManifest","getExpoRouteManifestBuilderAsync","projectRoot","require","resolveFrom","createRoutesManifest","options","getManifest","paths","getRoutePaths","appDir","jsonManifest","htmlRoutes","apiRoutes","Error","JSON","stringify","asJson","json","map","value","namedRegex","RegExp","notFoundRoutes"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAwBsBA,aAAa,MAAbA,aAAa;IA6BnBC,eAAe,MAAfA,eAAe;;;8DArDP,cAAc;;;;;;wBAER,UAAU;;;;;;AAgBxC,SAASC,gCAAgC,CAACC,WAAmB,EAAE;IAC7D,OAAOC,OAAO,CAACC,IAAAA,YAAW,EAAA,QAAA,EAACF,WAAW,EAAE,mCAAmC,CA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AAc,CAAEC,GAAG,CAAC,CAACC,KAAK,GAAK;YACxC,OAAO;gBACL,GAAGA,KAAK;gBACRC,UAAU,EAAE,IAAIC,MAAM,CAACF,KAAK,CAACC,UAAU,CAAC;aACzC,CAAC;QACJ,CAAC,CAAC;QACFE,cAAc,EAAEL,CAAAA,IAAmB,GAAnBA,IAAI,CAACK,cAAc,SAAK,GAAxBL,KAAAA,CAAwB,GAAxBA,IAAmB,CAAEC,GAAG,CAAC,CAACC,KAAK,GAAK;YAClD,OAAO;gBACL,GAAGA,KAAK;gBACRC,UAAU,EAAE,IAAIC,MAAM,CAACF,KAAK,CAACC,UAAU,CAAC;aACzC,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
|
package/build/src/utils/fn.js
CHANGED
|
@@ -13,14 +13,14 @@ _export(exports, {
|
|
|
13
13
|
guardAsync: ()=>guardAsync
|
|
14
14
|
});
|
|
15
15
|
function memoize(fn) {
|
|
16
|
-
const cache =
|
|
16
|
+
const cache = new Map();
|
|
17
17
|
return (...args)=>{
|
|
18
18
|
const key = JSON.stringify(args);
|
|
19
|
-
if (cache
|
|
20
|
-
return cache
|
|
19
|
+
if (cache.has(key)) {
|
|
20
|
+
return cache.get(key);
|
|
21
21
|
}
|
|
22
22
|
const result = fn(...args);
|
|
23
|
-
cache
|
|
23
|
+
cache.set(key, result);
|
|
24
24
|
return result;
|
|
25
25
|
};
|
|
26
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/fn.ts"],"sourcesContent":["/** `lodash.memoize` */\nexport function memoize<T extends (...args: any[]) => any>(fn: T): T {\n const cache
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/fn.ts"],"sourcesContent":["/** `lodash.memoize` */\nexport function memoize<T extends (...args: any[]) => any>(fn: T): T {\n const cache = new Map<string, any>();\n return ((...args: any[]) => {\n const key = JSON.stringify(args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n }) as T;\n}\n\n/** memoizes an async function to prevent subsequent calls that might be invoked before the function has finished resolving. */\nexport function guardAsync<V, T extends (...args: any[]) => Promise<V>>(fn: T): T {\n let invoked = false;\n let returnValue: V;\n\n const guard: any = async (...args: any[]): Promise<V> => {\n if (!invoked) {\n invoked = true;\n returnValue = await fn(...args);\n }\n\n return returnValue;\n };\n\n return guard;\n}\n"],"names":["memoize","guardAsync","fn","cache","Map","args","key","JSON","stringify","has","get","result","set","invoked","returnValue","guard"],"mappings":"AAAA,qBAAqB,GACrB;;;;;;;;;;;IAAgBA,OAAO,MAAPA,OAAO;IAcPC,UAAU,MAAVA,UAAU;;AAdnB,SAASD,OAAO,CAAoCE,EAAK,EAAK;IACnE,MAAMC,KAAK,GAAG,IAAIC,GAAG,EAAe,AAAC;IACrC,OAAQ,CAAC,GAAGC,IAAI,AAAO,GAAK;QAC1B,MAAMC,GAAG,GAAGC,IAAI,CAACC,SAAS,CAACH,IAAI,CAAC,AAAC;QACjC,IAAIF,KAAK,CAACM,GAAG,CAACH,GAAG,CAAC,EAAE;YAClB,OAAOH,KAAK,CAACO,GAAG,CAACJ,GAAG,CAAC,CAAC;QACxB,CAAC;QACD,MAAMK,MAAM,GAAGT,EAAE,IAAIG,IAAI,CAAC,AAAC;QAC3BF,KAAK,CAACS,GAAG,CAACN,GAAG,EAAEK,MAAM,CAAC,CAAC;QACvB,OAAOA,MAAM,CAAC;IAChB,CAAC,CAAO;AACV,CAAC;AAGM,SAASV,UAAU,CAA8CC,EAAK,EAAK;IAChF,IAAIW,OAAO,GAAG,KAAK,AAAC;IACpB,IAAIC,WAAW,AAAG,AAAC;IAEnB,MAAMC,KAAK,GAAQ,OAAO,GAAGV,IAAI,AAAO,GAAiB;QACvD,IAAI,CAACQ,OAAO,EAAE;YACZA,OAAO,GAAG,IAAI,CAAC;YACfC,WAAW,GAAG,MAAMZ,EAAE,IAAIG,IAAI,CAAC,CAAC;QAClC,CAAC;QAED,OAAOS,WAAW,CAAC;IACrB,CAAC,AAAC;IAEF,OAAOC,KAAK,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.7",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
"@types/wrap-ansi": "^8.0.1",
|
|
156
156
|
"@types/ws": "^8.5.4",
|
|
157
157
|
"devtools-protocol": "^0.0.1113120",
|
|
158
|
-
"expo-atlas": "^0.
|
|
158
|
+
"expo-atlas": "^0.2.0",
|
|
159
159
|
"expo-module-scripts": "^3.0.0",
|
|
160
160
|
"find-process": "^1.4.7",
|
|
161
161
|
"jest-runner-tsd": "^6.0.0",
|
|
@@ -168,5 +168,5 @@
|
|
|
168
168
|
"tree-kill": "^1.2.2",
|
|
169
169
|
"tsd": "^0.28.1"
|
|
170
170
|
},
|
|
171
|
-
"gitHead": "
|
|
171
|
+
"gitHead": "4a7cf0d0baf6dfc595d93f604945d2142e705a36"
|
|
172
172
|
}
|