@expo/cli 0.18.6 → 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 CHANGED
@@ -120,7 +120,7 @@ const args = (0, _arg().default)({
120
120
  });
121
121
  if (args["--version"]) {
122
122
  // Version is added in the build script.
123
- console.log("0.18.6");
123
+ console.log("0.18.7");
124
124
  process.exit(0);
125
125
  }
126
126
  if (args["--non-interactive"]) {
@@ -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,MAApB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;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"}
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,IAAA,CAACC,YAAY,EAAE;QACpB,MAAM,IAAIC,OAAY,aA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9Bc,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,YAAjDJ,GAAiD,GAAI,UAAU,AAAC;IACvF,MAAMK,IAAAA,aAAqC,sCAAA,EACzCV,WAAW,EACXO,cAAc,EACdL,QAAQ,EACRC,eAAe,CAChB,CAAC;AACJ,CAAC;AAEM,eAAeP,kBAAkB,CACtCI,WAAmB,EACnBW,aAA4B,EAC5BC,aASC,EACiD;IAClD,IA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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;;;;;;;;;;;IAkEsBA,kBAAkB,MAAlBA,kBAAkB;IAyKlBC,SAAS,MAATA,SAAS;;;yBA3OyC,cAAc;;;;;;;8DAG3D,qDAAqD;;;;;;;8DAC7D,QAAQ;;;;;;;8DAC+B,OAAO;;;;;;;8DAG9C,kBAAkB;;;;;;;8DACN,kCAAkC;;;;;;;8DAMhD,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,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"}
@@ -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.1.1",
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.1', 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"}
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({ exp , isExporting , projectRoot , middleware , metroConfig }) {
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
- // Exporting only sets up Metro, without attaching middleware
21
- if (isExporting) {
22
- const atlas = importAtlasForExport(projectRoot);
23
- if (!atlas) {
24
- return debug("Atlas is not installed in the project, skipping initialization");
25
- }
26
- atlas.withExpoAtlas(metroConfig);
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({\n exp,\n isExporting,\n projectRoot,\n middleware,\n metroConfig,\n}: AttachAtlasOptions): Promise<void | ReturnType<\n typeof import('expo-atlas/cli').createExpoAtlasMiddleware\n>> {\n if (!env.EXPO_UNSTABLE_ATLAS) {\n return;\n }\n\n debug('Atlas is enabled, initializing for this project...');\n\n await new AtlasPrerequisite(projectRoot).bootstrapAsync({ exp });\n\n // Exporting only sets up Metro, without attaching middleware\n if (isExporting) {\n const atlas = importAtlasForExport(projectRoot);\n if (!atlas) {\n return debug('Atlas is not installed in the project, skipping initialization');\n }\n\n atlas.withExpoAtlas(metroConfig);\n debug('Attached Atlas to Metro config for exporting');\n return;\n }\n\n // Running in development mode requires middleware to be attached\n if (!isExporting && !middleware) {\n throw new Error(\n 'Expected middleware to be provided for Atlas when running in development mode'\n );\n } else if (!isExporting && middleware) {\n const atlas = importAtlasForDev(projectRoot);\n if (!atlas) {\n return debug('Atlas is not installed in the project, skipping initialization');\n }\n\n const instance = atlas.createExpoAtlasMiddleware(metroConfig);\n middleware.use('/_expo/atlas', instance.middleware);\n debug('Attached Atlas middleware for development on: /_expo/atlas');\n return instance;\n }\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\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","exp","isExporting","projectRoot","middleware","metroConfig","env","EXPO_UNSTABLE_ATLAS","AtlasPrerequisite","bootstrapAsync","atlas","importAtlasForExport","withExpoAtlas","Error","importAtlasForDev","instance","createExpoAtlasMiddleware","use","resolve","paths","error"],"mappings":"AAAA;;;;+BAgBsBA,kBAAgB;;aAAhBA,gBAAgB;;mCAbJ,qBAAqB;qBACnC,uBAAuB;AAG3C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,kCAAkC,CAAC,AAAsB,AAAC;AASlF,eAAeF,gBAAgB,CAAC,EACrCG,GAAG,CAAA,EACHC,WAAW,CAAA,EACXC,WAAW,CAAA,EACXC,UAAU,CAAA,EACVC,WAAW,CAAA,EACQ,EAElB;IACD,IAAI,CAACC,IAAG,IAAA,CAACC,mBAAmB,EAAE;QAC5B,OAAO;IACT,CAAC;IAEDR,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAE5D,MAAM,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d,CAAC;AACH,CAAC;AAED,SAAST,oBAAoB,CAACR,WAAmB,EAA4C;IAC3F,IAAI;QACF,OAAOH,OAAO,CAACA,OAAO,CAACkB,OAAO,CAAC,kBAAkB,EAAE;YAAEC,KAAK,EAAE;gBAAChB,WAAW;aAAC;SAAE,CAAC,CAAC,CAAC;IAChF,EAAE,OAAOiB,KAAK,EAAO;QACnBrB,KAAK,CAAC,oCAAoC,EAAEqB,KAAK,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
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;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AK,EAAE;gBAACf,WAAW;aAAC;SAAE,CAAC,CAAC,CAAC;IAC9E,EAAE,OAAOgB,KAAK,EAAO;QACnBtB,KAAK,CAAC,oCAAoC,EAAEsB,KAAK,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;CAGC,GACD,eAAeX,mBAAmB,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"}
@@ -79,7 +79,7 @@ function getContext() {
79
79
  cpu: summarizeCpuInfo(),
80
80
  app: {
81
81
  name: "expo/cli",
82
- version: "0.18.6"
82
+ version: "0.18.7"
83
83
  },
84
84
  ci: _ciInfo().isCI ? {
85
85
  name: _ciInfo().name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/cli",
3
- "version": "0.18.6",
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.1.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": "20f1765146f63f8fdc2543e8aba8b0e5140d1e05"
171
+ "gitHead": "4a7cf0d0baf6dfc595d93f604945d2142e705a36"
172
172
  }