@expo/cli 55.0.7 → 55.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/build/bin/cli +13 -1
  2. package/build/bin/cli.map +1 -1
  3. package/build/src/config/configAsync.js +1 -1
  4. package/build/src/config/configAsync.js.map +1 -1
  5. package/build/src/customize/customizeAsync.js +1 -1
  6. package/build/src/customize/customizeAsync.js.map +1 -1
  7. package/build/src/export/embed/exportEmbedAsync.js +1 -1
  8. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  9. package/build/src/export/exportApp.js +1 -1
  10. package/build/src/export/exportApp.js.map +1 -1
  11. package/build/src/export/exportStaticAsync.js +7 -11
  12. package/build/src/export/exportStaticAsync.js.map +1 -1
  13. package/build/src/export/web/exportWebAsync.js +1 -1
  14. package/build/src/export/web/exportWebAsync.js.map +1 -1
  15. package/build/src/install/installAsync.js +1 -1
  16. package/build/src/install/installAsync.js.map +1 -1
  17. package/build/src/lint/lintAsync.js +1 -1
  18. package/build/src/lint/lintAsync.js.map +1 -1
  19. package/build/src/prebuild/prebuildAsync.js +1 -1
  20. package/build/src/prebuild/prebuildAsync.js.map +1 -1
  21. package/build/src/run/android/runAndroidAsync.js +1 -1
  22. package/build/src/run/android/runAndroidAsync.js.map +1 -1
  23. package/build/src/run/ios/runIosAsync.js +1 -1
  24. package/build/src/run/ios/runIosAsync.js.map +1 -1
  25. package/build/src/serve/serveAsync.js +1 -1
  26. package/build/src/serve/serveAsync.js.map +1 -1
  27. package/build/src/start/interface/commandsTable.js +89 -69
  28. package/build/src/start/interface/commandsTable.js.map +1 -1
  29. package/build/src/start/interface/interactiveActions.js +29 -14
  30. package/build/src/start/interface/interactiveActions.js.map +1 -1
  31. package/build/src/start/server/BundlerDevServer.js +16 -9
  32. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  33. package/build/src/start/server/DevServerManager.js +5 -1
  34. package/build/src/start/server/DevServerManager.js.map +1 -1
  35. package/build/src/start/server/UrlCreator.js +17 -7
  36. package/build/src/start/server/UrlCreator.js.map +1 -1
  37. package/build/src/start/server/getStaticRenderFunctions.js +8 -8
  38. package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
  39. package/build/src/start/server/metro/MetroBundlerDevServer.js +20 -20
  40. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  41. package/build/src/start/server/metro/MetroTerminalReporter.js +1 -1
  42. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  43. package/build/src/start/server/metro/createServerComponentsMiddleware.js +1 -1
  44. package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
  45. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +18 -18
  46. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
  47. package/build/src/start/server/metro/log-box/LogBoxSymbolication.js +5 -1
  48. package/build/src/start/server/metro/log-box/LogBoxSymbolication.js.map +1 -1
  49. package/build/src/start/server/metro/resolveLoader.js +2 -0
  50. package/build/src/start/server/metro/resolveLoader.js.map +1 -1
  51. package/build/src/start/server/metro/runServer-fork.js +6 -5
  52. package/build/src/start/server/metro/runServer-fork.js.map +1 -1
  53. package/build/src/start/server/webpack/WebpackBundlerDevServer.js +4 -4
  54. package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
  55. package/build/src/utils/editor.js +404 -31
  56. package/build/src/utils/editor.js.map +1 -1
  57. package/build/src/utils/getRunningProcess.js +80 -41
  58. package/build/src/utils/getRunningProcess.js.map +1 -1
  59. package/build/src/utils/ip.js +44 -8
  60. package/build/src/utils/ip.js.map +1 -1
  61. package/build/src/utils/nodeEnv.js +66 -1
  62. package/build/src/utils/nodeEnv.js.map +1 -1
  63. package/build/src/utils/port.js +2 -2
  64. package/build/src/utils/port.js.map +1 -1
  65. package/build/src/utils/qr.js +186 -0
  66. package/build/src/utils/qr.js.map +1 -0
  67. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  68. package/build/src/utils/telemetry/utils/context.js +1 -1
  69. package/package.json +16 -17
package/build/bin/cli CHANGED
@@ -77,6 +77,18 @@ function _interop_require_wildcard(obj, nodeInterop) {
77
77
  }
78
78
  return newObj;
79
79
  }
80
+ var _process_version;
81
+ // Check Node.js version and issue a loud warning if it's too outdated
82
+ // This is sent to stderr (console.error) so it doesn't interfere with programmatic commands
83
+ const NODE_MIN = [
84
+ 20,
85
+ 19,
86
+ 4
87
+ ];
88
+ const nodeVersion = (_process_version = process.version) == null ? void 0 : _process_version.slice(1).split('.', 3).map(Number);
89
+ if (nodeVersion[0] < NODE_MIN[0] || nodeVersion[0] === NODE_MIN[0] && nodeVersion[1] < NODE_MIN[1]) {
90
+ console.error(_chalk().default.red`{bold Node.js (${process.version}) is outdated and unsupported.}` + _chalk().default.red` Please update to a newer Node.js LTS version (required: >=${NODE_MIN.join('.')})\n` + _chalk().default.red`Go to: https://nodejs.org/en/download\n`);
91
+ }
80
92
  // Setup before requiring `debug`.
81
93
  if ((0, _getenv().boolish)('EXPO_DEBUG', false)) {
82
94
  _debug().default.enable('expo:*');
@@ -123,7 +135,7 @@ const args = (0, _arg().default)({
123
135
  });
124
136
  if (args['--version']) {
125
137
  // Version is added in the build script.
126
- console.log("55.0.7");
138
+ console.log("55.0.9");
127
139
  process.exit(0);
128
140
  }
129
141
  if (args['--non-interactive']) {
package/build/bin/cli.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport arg from 'arg';\nimport chalk from 'chalk';\nimport Debug from 'debug';\nimport { boolish } from 'getenv';\n\n// Setup before requiring `debug`.\nif (boolish('EXPO_DEBUG', false)) {\n Debug.enable('expo:*');\n} else if (Debug.enabled('expo:')) {\n process.env.EXPO_DEBUG = '1';\n}\n\nconst defaultCmd = 'start';\n\nexport type Command = (argv?: string[]) => void;\n\nconst commands: { [command: string]: () => Promise<Command> } = {\n // Add a new command here\n // NOTE(EvanBacon): Ensure every bundler-related command sets `NODE_ENV` as expected for the command.\n run: () => import('../src/run/index.js').then((i) => i.expoRun),\n 'run:ios': () => import('../src/run/ios/index.js').then((i) => i.expoRunIos),\n 'run:android': () => import('../src/run/android/index.js').then((i) => i.expoRunAndroid),\n start: () => import('../src/start/index.js').then((i) => i.expoStart),\n prebuild: () => import('../src/prebuild/index.js').then((i) => i.expoPrebuild),\n config: () => import('../src/config/index.js').then((i) => i.expoConfig),\n export: () => import('../src/export/index.js').then((i) => i.expoExport),\n 'export:web': () => import('../src/export/web/index.js').then((i) => i.expoExportWeb),\n 'export:embed': () => import('../src/export/embed/index.js').then((i) => i.expoExportEmbed),\n\n serve: () => import('../src/serve/index.js').then((i) => i.expoServe),\n\n // Auxiliary commands\n install: () => import('../src/install/index.js').then((i) => i.expoInstall),\n add: () => import('../src/install/index.js').then((i) => i.expoInstall),\n customize: () => import('../src/customize/index.js').then((i) => i.expoCustomize),\n lint: () => import('../src/lint/index.js').then((i) => i.expoLint),\n\n // Auth\n login: () => import('../src/login/index.js').then((i) => i.expoLogin),\n logout: () => import('../src/logout/index.js').then((i) => i.expoLogout),\n register: () => import('../src/register/index.js').then((i) => i.expoRegister),\n whoami: () => import('../src/whoami/index.js').then((i) => i.expoWhoami),\n};\n\nconst args = arg(\n {\n // Types\n '--version': Boolean,\n '--help': Boolean,\n // NOTE(EvanBacon): This is here to silence warnings from processes that\n // expect the global expo-cli.\n '--non-interactive': Boolean,\n\n // Aliases\n '-v': '--version',\n '-h': '--help',\n },\n {\n permissive: true,\n }\n);\n\nif (args['--version']) {\n // Version is added in the build script.\n console.log(process.env.__EXPO_VERSION);\n process.exit(0);\n}\n\nif (args['--non-interactive']) {\n console.warn(chalk.yellow` {bold --non-interactive} is not supported, use {bold $CI=1} instead`);\n}\n\n// Check if we are running `npx expo <subcommand>` or `npx expo`\nconst isSubcommand = Boolean(commands[args._[0]]);\n\n// Handle `--help` flag\nif (!isSubcommand && args['--help']) {\n const {\n login,\n logout,\n whoami,\n register,\n start,\n install,\n add,\n export: _export,\n config,\n customize,\n prebuild,\n 'run:ios': runIos,\n 'run:android': runAndroid,\n // NOTE(EvanBacon): Don't document this command as it's a temporary\n // workaround until we can use `expo export` for all production bundling.\n // https://github.com/expo/expo/pull/21396/files#r1121025873\n 'export:embed': exportEmbed_unused,\n // The export:web command is deprecated. Hide it from the help prompt.\n 'export:web': exportWeb_unused,\n // Other ignored commands, these are intentially not listed in the `--help` output\n run: _run,\n // NOTE(cedric): Still pending the migration to ESLint's flat config\n lint: _lint,\n serve,\n // All other commands\n ...others\n } = commands;\n\n console.log(chalk`\n {bold Usage}\n {dim $} npx expo <command>\n\n {bold Commands}\n ${Object.keys({ start, export: _export, ...others }).join(', ')}\n ${Object.keys({ 'run:ios': runIos, 'run:android': runAndroid, prebuild }).join(', ')}\n ${Object.keys({ install, customize, config, serve }).join(', ')}\n {dim ${Object.keys({ login, logout, whoami, register }).join(', ')}}\n\n {bold Options}\n --version, -v Version number\n --help, -h Usage info\n\n For more info run a command with the {bold --help} flag\n {dim $} npx expo start --help\n`);\n\n process.exit(0);\n}\n\n// NOTE(EvanBacon): Squat some directory names to help with migration,\n// users can still use folders named \"send\" or \"eject\" by using the fully qualified `npx expo start ./send`.\nif (!isSubcommand) {\n const migrationMap: Record<string, string> = {\n init: 'npx create-expo-app',\n eject: 'npx expo prebuild',\n web: 'npx expo start --web',\n 'start:web': 'npx expo start --web',\n 'build:ios': 'eas build -p ios',\n 'build:android': 'eas build -p android',\n 'client:install:ios': 'npx expo start --ios',\n 'client:install:android': 'npx expo start --android',\n doctor: 'npx expo-doctor',\n upgrade: 'https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough/',\n 'customize:web': 'npx expo customize',\n\n publish: 'eas update',\n 'publish:set': 'eas update',\n 'publish:rollback': 'eas update',\n 'publish:history': 'eas update',\n 'publish:details': 'eas update',\n\n 'build:web': 'npx expo export:web',\n\n 'credentials:manager': `eas credentials`,\n 'fetch:ios:certs': `eas credentials`,\n 'fetch:android:keystore': `eas credentials`,\n 'fetch:android:hashes': `eas credentials`,\n 'fetch:android:upload-cert': `eas credentials`,\n 'push:android:upload': `eas credentials`,\n 'push:android:show': `eas credentials`,\n 'push:android:clear': `eas credentials`,\n url: `eas build:list`,\n 'url:ipa': `eas build:list`,\n 'url:apk': `eas build:list`,\n webhooks: `eas webhook`,\n 'webhooks:add': `eas webhook:create`,\n 'webhooks:remove': `eas webhook:delete`,\n 'webhooks:update': `eas webhook:update`,\n\n 'build:status': `eas build:list`,\n 'upload:android': `eas submit -p android`,\n 'upload:ios': `eas submit -p ios`,\n };\n\n // TODO: Log telemetry about invalid command used.\n const subcommand = args._[0];\n if (subcommand in migrationMap) {\n const replacement = migrationMap[subcommand];\n console.log();\n const instruction = subcommand === 'upgrade' ? 'follow this guide' : 'use';\n console.log(\n chalk.yellow` {gray $} {bold expo ${subcommand}} is not supported in the local CLI, please ${instruction} {bold ${replacement}} instead`\n );\n console.log();\n process.exit(1);\n }\n const deprecated = ['send', 'client:ios'];\n if (deprecated.includes(subcommand)) {\n console.log();\n console.log(chalk.yellow` {gray $} {bold expo ${subcommand}} is deprecated`);\n console.log();\n process.exit(1);\n }\n}\n\nconst command = isSubcommand ? args._[0] : defaultCmd;\nconst commandArgs = isSubcommand ? args._.slice(1) : args._;\n\n// Push the help flag to the subcommand args.\nif (args['--help']) {\n commandArgs.push('--help');\n}\n\n// Install exit hooks\nprocess.on('SIGINT', () => process.exit(0));\nprocess.on('SIGTERM', () => process.exit(0));\n\ncommands[command]().then((exec) => {\n exec(commandArgs);\n\n // NOTE(EvanBacon): Track some basic telemetry events indicating the command\n // that was run. This can be disabled with the $EXPO_NO_TELEMETRY environment variable.\n // We do this to determine how well deprecations are going before removing a command.\n if (!boolish('EXPO_NO_TELEMETRY', false)) {\n const { recordCommand } =\n require('../src/utils/telemetry') as typeof import('../src/utils/telemetry');\n recordCommand(command);\n }\n});\n"],"names":["boolish","Debug","enable","enabled","process","env","EXPO_DEBUG","defaultCmd","commands","run","then","i","expoRun","expoRunIos","expoRunAndroid","start","expoStart","prebuild","expoPrebuild","config","expoConfig","export","expoExport","expoExportWeb","expoExportEmbed","serve","expoServe","install","expoInstall","add","customize","expoCustomize","lint","expoLint","login","expoLogin","logout","expoLogout","register","expoRegister","whoami","expoWhoami","args","arg","Boolean","permissive","console","log","__EXPO_VERSION","exit","warn","chalk","yellow","isSubcommand","_","_export","runIos","runAndroid","exportEmbed_unused","exportWeb_unused","_run","_lint","others","Object","keys","join","migrationMap","init","eject","web","doctor","upgrade","publish","url","webhooks","subcommand","replacement","instruction","deprecated","includes","command","commandArgs","slice","push","on","exec","recordCommand","require"],"mappings":";;;;;;gEACgB;;;;;;;gEACE;;;;;;;gEACA;;;;;;;yBACM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExB,kCAAkC;AAClC,IAAIA,IAAAA,iBAAO,EAAC,cAAc,QAAQ;IAChCC,gBAAK,CAACC,MAAM,CAAC;AACf,OAAO,IAAID,gBAAK,CAACE,OAAO,CAAC,UAAU;IACjCC,QAAQC,GAAG,CAACC,UAAU,GAAG;AAC3B;AAEA,MAAMC,aAAa;AAInB,MAAMC,WAA0D;IAC9D,yBAAyB;IACzB,qGAAqG;IACrGC,KAAK,IAAM,mEAAA,QAAO,yBAAuBC,IAAI,CAAC,CAACC,IAAMA,EAAEC,OAAO;IAC9D,WAAW,IAAM,mEAAA,QAAO,6BAA2BF,IAAI,CAAC,CAACC,IAAMA,EAAEE,UAAU;IAC3E,eAAe,IAAM,mEAAA,QAAO,iCAA+BH,IAAI,CAAC,CAACC,IAAMA,EAAEG,cAAc;IACvFC,OAAO,IAAM,mEAAA,QAAO,2BAAyBL,IAAI,CAAC,CAACC,IAAMA,EAAEK,SAAS;IACpEC,UAAU,IAAM,mEAAA,QAAO,8BAA4BP,IAAI,CAAC,CAACC,IAAMA,EAAEO,YAAY;IAC7EC,QAAQ,IAAM,mEAAA,QAAO,4BAA0BT,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rE7B,QAAQC,GAAG,CACTI,gBAAK,CAACC,MAAM,CAAC,sBAAsB,EAAEuB,WAAW,4CAA4C,EAAEE,YAAY,OAAO,EAAED,YAAY,SAAS,CAAC;QAE3I9B,QAAQC,GAAG;QACX3C,QAAQ6C,IAAI,CAAC;IACf;IACA,MAAM6B,aAAa;QAAC;QAAQ;KAAa;IACzC,IAAIA,WAAWC,QAAQ,CAACJ,aAAa;QACnC7B,QAAQC,GAAG;QACXD,QAAQC,GAAG,CAACI,gBAAK,CAACC,MAAM,CAAC,sBAAsB,EAAEuB,WAAW,eAAe,CAAC;QAC5E7B,QAAQC,GAAG;QACX3C,QAAQ6C,IAAI,CAAC;IACf;AACF;AAEA,MAAM+B,UAAU3B,eAAeX,KAAKY,CAAC,CAAC,EAAE,GAAG/C;AAC3C,MAAM0E,cAAc5B,eAAeX,KAAKY,CAAC,CAAC4B,KAAK,CAAC,KAAKxC,KAAKY,CAAC;AAE3D,6CAA6C;AAC7C,IAAIZ,IAAI,CAAC,SAAS,EAAE;IAClBuC,YAAYE,IAAI,CAAC;AACnB;AAEA,qBAAqB;AACrB/E,QAAQgF,EAAE,CAAC,UAAU,IAAMhF,QAAQ6C,IAAI,CAAC;AACxC7C,QAAQgF,EAAE,CAAC,WAAW,IAAMhF,QAAQ6C,IAAI,CAAC;AAEzCzC,QAAQ,CAACwE,QAAQ,GAAGtE,IAAI,CAAC,CAAC2E;IACxBA,KAAKJ;IAEL,4EAA4E;IAC5E,uFAAuF;IACvF,qFAAqF;IACrF,IAAI,CAACjF,IAAAA,iBAAO,EAAC,qBAAqB,QAAQ;QACxC,MAAM,EAAEsF,aAAa,EAAE,GACrBC,QAAQ;QACVD,cAAcN;IAChB;AACF"}
1
+ {"version":3,"sources":["../../bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport arg from 'arg';\nimport chalk from 'chalk';\nimport Debug from 'debug';\nimport { boolish } from 'getenv';\n\n// Check Node.js version and issue a loud warning if it's too outdated\n// This is sent to stderr (console.error) so it doesn't interfere with programmatic commands\nconst NODE_MIN = [20, 19, 4];\nconst nodeVersion = process.version?.slice(1).split('.', 3).map(Number);\nif (nodeVersion[0] < NODE_MIN[0] || (nodeVersion[0] === NODE_MIN[0] && nodeVersion[1] < NODE_MIN[1])) {\n console.error(\n chalk.red`{bold Node.js (${process.version}) is outdated and unsupported.}`\n + chalk.red` Please update to a newer Node.js LTS version (required: >=${NODE_MIN.join('.')})\\n`\n + chalk.red`Go to: https://nodejs.org/en/download\\n`\n );\n}\n\n// Setup before requiring `debug`.\nif (boolish('EXPO_DEBUG', false)) {\n Debug.enable('expo:*');\n} else if (Debug.enabled('expo:')) {\n process.env.EXPO_DEBUG = '1';\n}\n\nconst defaultCmd = 'start';\n\nexport type Command = (argv?: string[]) => void;\n\nconst commands: { [command: string]: () => Promise<Command> } = {\n // Add a new command here\n // NOTE(EvanBacon): Ensure every bundler-related command sets `NODE_ENV` as expected for the command.\n run: () => import('../src/run/index.js').then((i) => i.expoRun),\n 'run:ios': () => import('../src/run/ios/index.js').then((i) => i.expoRunIos),\n 'run:android': () => import('../src/run/android/index.js').then((i) => i.expoRunAndroid),\n start: () => import('../src/start/index.js').then((i) => i.expoStart),\n prebuild: () => import('../src/prebuild/index.js').then((i) => i.expoPrebuild),\n config: () => import('../src/config/index.js').then((i) => i.expoConfig),\n export: () => import('../src/export/index.js').then((i) => i.expoExport),\n 'export:web': () => import('../src/export/web/index.js').then((i) => i.expoExportWeb),\n 'export:embed': () => import('../src/export/embed/index.js').then((i) => i.expoExportEmbed),\n\n serve: () => import('../src/serve/index.js').then((i) => i.expoServe),\n\n // Auxiliary commands\n install: () => import('../src/install/index.js').then((i) => i.expoInstall),\n add: () => import('../src/install/index.js').then((i) => i.expoInstall),\n customize: () => import('../src/customize/index.js').then((i) => i.expoCustomize),\n lint: () => import('../src/lint/index.js').then((i) => i.expoLint),\n\n // Auth\n login: () => import('../src/login/index.js').then((i) => i.expoLogin),\n logout: () => import('../src/logout/index.js').then((i) => i.expoLogout),\n register: () => import('../src/register/index.js').then((i) => i.expoRegister),\n whoami: () => import('../src/whoami/index.js').then((i) => i.expoWhoami),\n};\n\nconst args = arg(\n {\n // Types\n '--version': Boolean,\n '--help': Boolean,\n // NOTE(EvanBacon): This is here to silence warnings from processes that\n // expect the global expo-cli.\n '--non-interactive': Boolean,\n\n // Aliases\n '-v': '--version',\n '-h': '--help',\n },\n {\n permissive: true,\n }\n);\n\nif (args['--version']) {\n // Version is added in the build script.\n console.log(process.env.__EXPO_VERSION);\n process.exit(0);\n}\n\nif (args['--non-interactive']) {\n console.warn(chalk.yellow` {bold --non-interactive} is not supported, use {bold $CI=1} instead`);\n}\n\n// Check if we are running `npx expo <subcommand>` or `npx expo`\nconst isSubcommand = Boolean(commands[args._[0]]);\n\n// Handle `--help` flag\nif (!isSubcommand && args['--help']) {\n const {\n login,\n logout,\n whoami,\n register,\n start,\n install,\n add,\n export: _export,\n config,\n customize,\n prebuild,\n 'run:ios': runIos,\n 'run:android': runAndroid,\n // NOTE(EvanBacon): Don't document this command as it's a temporary\n // workaround until we can use `expo export` for all production bundling.\n // https://github.com/expo/expo/pull/21396/files#r1121025873\n 'export:embed': exportEmbed_unused,\n // The export:web command is deprecated. Hide it from the help prompt.\n 'export:web': exportWeb_unused,\n // Other ignored commands, these are intentially not listed in the `--help` output\n run: _run,\n // NOTE(cedric): Still pending the migration to ESLint's flat config\n lint: _lint,\n serve,\n // All other commands\n ...others\n } = commands;\n\n console.log(chalk`\n {bold Usage}\n {dim $} npx expo <command>\n\n {bold Commands}\n ${Object.keys({ start, export: _export, ...others }).join(', ')}\n ${Object.keys({ 'run:ios': runIos, 'run:android': runAndroid, prebuild }).join(', ')}\n ${Object.keys({ install, customize, config, serve }).join(', ')}\n {dim ${Object.keys({ login, logout, whoami, register }).join(', ')}}\n\n {bold Options}\n --version, -v Version number\n --help, -h Usage info\n\n For more info run a command with the {bold --help} flag\n {dim $} npx expo start --help\n`);\n\n process.exit(0);\n}\n\n// NOTE(EvanBacon): Squat some directory names to help with migration,\n// users can still use folders named \"send\" or \"eject\" by using the fully qualified `npx expo start ./send`.\nif (!isSubcommand) {\n const migrationMap: Record<string, string> = {\n init: 'npx create-expo-app',\n eject: 'npx expo prebuild',\n web: 'npx expo start --web',\n 'start:web': 'npx expo start --web',\n 'build:ios': 'eas build -p ios',\n 'build:android': 'eas build -p android',\n 'client:install:ios': 'npx expo start --ios',\n 'client:install:android': 'npx expo start --android',\n doctor: 'npx expo-doctor',\n upgrade: 'https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough/',\n 'customize:web': 'npx expo customize',\n\n publish: 'eas update',\n 'publish:set': 'eas update',\n 'publish:rollback': 'eas update',\n 'publish:history': 'eas update',\n 'publish:details': 'eas update',\n\n 'build:web': 'npx expo export:web',\n\n 'credentials:manager': `eas credentials`,\n 'fetch:ios:certs': `eas credentials`,\n 'fetch:android:keystore': `eas credentials`,\n 'fetch:android:hashes': `eas credentials`,\n 'fetch:android:upload-cert': `eas credentials`,\n 'push:android:upload': `eas credentials`,\n 'push:android:show': `eas credentials`,\n 'push:android:clear': `eas credentials`,\n url: `eas build:list`,\n 'url:ipa': `eas build:list`,\n 'url:apk': `eas build:list`,\n webhooks: `eas webhook`,\n 'webhooks:add': `eas webhook:create`,\n 'webhooks:remove': `eas webhook:delete`,\n 'webhooks:update': `eas webhook:update`,\n\n 'build:status': `eas build:list`,\n 'upload:android': `eas submit -p android`,\n 'upload:ios': `eas submit -p ios`,\n };\n\n // TODO: Log telemetry about invalid command used.\n const subcommand = args._[0];\n if (subcommand in migrationMap) {\n const replacement = migrationMap[subcommand];\n console.log();\n const instruction = subcommand === 'upgrade' ? 'follow this guide' : 'use';\n console.log(\n chalk.yellow` {gray $} {bold expo ${subcommand}} is not supported in the local CLI, please ${instruction} {bold ${replacement}} instead`\n );\n console.log();\n process.exit(1);\n }\n const deprecated = ['send', 'client:ios'];\n if (deprecated.includes(subcommand)) {\n console.log();\n console.log(chalk.yellow` {gray $} {bold expo ${subcommand}} is deprecated`);\n console.log();\n process.exit(1);\n }\n}\n\nconst command = isSubcommand ? args._[0] : defaultCmd;\nconst commandArgs = isSubcommand ? args._.slice(1) : args._;\n\n// Push the help flag to the subcommand args.\nif (args['--help']) {\n commandArgs.push('--help');\n}\n\n// Install exit hooks\nprocess.on('SIGINT', () => process.exit(0));\nprocess.on('SIGTERM', () => process.exit(0));\n\ncommands[command]().then((exec) => {\n exec(commandArgs);\n\n // NOTE(EvanBacon): Track some basic telemetry events indicating the command\n // that was run. This can be disabled with the $EXPO_NO_TELEMETRY environment variable.\n // We do this to determine how well deprecations are going before removing a command.\n if (!boolish('EXPO_NO_TELEMETRY', false)) {\n const { recordCommand } =\n require('../src/utils/telemetry') as typeof import('../src/utils/telemetry');\n recordCommand(command);\n }\n});\n"],"names":["process","NODE_MIN","nodeVersion","version","slice","split","map","Number","console","error","chalk","red","join","boolish","Debug","enable","enabled","env","EXPO_DEBUG","defaultCmd","commands","run","then","i","expoRun","expoRunIos","expoRunAndroid","start","expoStart","prebuild","expoPrebuild","config","expoConfig","export","expoExport","expoExportWeb","expoExportEmbed","serve","expoServe","install","expoInstall","add","customize","expoCustomize","lint","expoLint","login","expoLogin","logout","expoLogout","register","expoRegister","whoami","expoWhoami","args","arg","Boolean","permissive","log","__EXPO_VERSION","exit","warn","yellow","isSubcommand","_","_export","runIos","runAndroid","exportEmbed_unused","exportWeb_unused","_run","_lint","others","Object","keys","migrationMap","init","eject","web","doctor","upgrade","publish","url","webhooks","subcommand","replacement","instruction","deprecated","includes","command","commandArgs","push","on","exec","recordCommand","require"],"mappings":";;;;;;gEACgB;;;;;;;gEACE;;;;;;;gEACA;;;;;;;yBACM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKJA;AAHpB,sEAAsE;AACtE,4FAA4F;AAC5F,MAAMC,WAAW;IAAC;IAAI;IAAI;CAAE;AAC5B,MAAMC,eAAcF,mBAAAA,QAAQG,OAA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,gBAAK,CAACoD,MAAM,CAAC,sBAAsB,EAAEsB,WAAW,4CAA4C,EAAEE,YAAY,OAAO,EAAED,YAAY,SAAS,CAAC;QAE3I7E,QAAQkD,GAAG;QACX1D,QAAQ4D,IAAI,CAAC;IACf;IACA,MAAM2B,aAAa;QAAC;QAAQ;KAAa;IACzC,IAAIA,WAAWC,QAAQ,CAACJ,aAAa;QACnC5E,QAAQkD,GAAG;QACXlD,QAAQkD,GAAG,CAAChD,gBAAK,CAACoD,MAAM,CAAC,sBAAsB,EAAEsB,WAAW,eAAe,CAAC;QAC5E5E,QAAQkD,GAAG;QACX1D,QAAQ4D,IAAI,CAAC;IACf;AACF;AAEA,MAAM6B,UAAU1B,eAAeT,KAAKU,CAAC,CAAC,EAAE,GAAG7C;AAC3C,MAAMuE,cAAc3B,eAAeT,KAAKU,CAAC,CAAC5D,KAAK,CAAC,KAAKkD,KAAKU,CAAC;AAE3D,6CAA6C;AAC7C,IAAIV,IAAI,CAAC,SAAS,EAAE;IAClBoC,YAAYC,IAAI,CAAC;AACnB;AAEA,qBAAqB;AACrB3F,QAAQ4F,EAAE,CAAC,UAAU,IAAM5F,QAAQ4D,IAAI,CAAC;AACxC5D,QAAQ4F,EAAE,CAAC,WAAW,IAAM5F,QAAQ4D,IAAI,CAAC;AAEzCxC,QAAQ,CAACqE,QAAQ,GAAGnE,IAAI,CAAC,CAACuE;IACxBA,KAAKH;IAEL,4EAA4E;IAC5E,uFAAuF;IACvF,qFAAqF;IACrF,IAAI,CAAC7E,IAAAA,iBAAO,EAAC,qBAAqB,QAAQ;QACxC,MAAM,EAAEiF,aAAa,EAAE,GACrBC,QAAQ;QACVD,cAAcL;IAChB;AACF"}
@@ -116,7 +116,7 @@ async function configAsync(projectRoot, options) {
116
116
  console.error = function() {};
117
117
  }
118
118
  (0, _nodeEnv.setNodeEnv)('development');
119
- require('@expo/env').load(projectRoot);
119
+ (0, _nodeEnv.loadEnvFiles)(projectRoot);
120
120
  if (options.type) {
121
121
  _assert().default.match(options.type, /^(public|prebuild|introspect)$/);
122
122
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/config/configAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfig, ProjectConfig } from '@expo/config';\nimport assert from 'assert';\nimport util from 'util';\n\nimport * as Log from '../log';\nimport { CommandError } from '../utils/errors';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { profile } from '../utils/profile';\n\ntype Options = {\n type?: string;\n full?: boolean;\n json?: boolean;\n};\n\nexport function logConfig(config: ExpoConfig | ProjectConfig) {\n const isObjStr = (str: string): boolean => /^\\w+: {/g.test(str);\n Log.log(\n util.inspect(config, {\n colors: true,\n compact: false,\n // Sort objects to the end so that smaller values aren't hidden between large objects.\n sorted(a: string, b: string) {\n if (isObjStr(a)) return 1;\n if (isObjStr(b)) return -1;\n return 0;\n },\n showHidden: false,\n depth: null,\n })\n );\n}\n\nexport async function configAsync(projectRoot: string, options: Options) {\n const loggingFunctions = {\n log: console.log,\n warn: console.warn,\n error: console.error,\n };\n // Disable logging for this command if the user wants to get JSON output.\n // This will ensure that only the JSON is printed to stdout.\n if (options.json) {\n console.log = function () {};\n console.warn = function () {};\n console.error = function () {};\n }\n setNodeEnv('development');\n require('@expo/env').load(projectRoot);\n\n if (options.type) {\n assert.match(options.type, /^(public|prebuild|introspect)$/);\n }\n\n let config: ProjectConfig;\n\n if (options.type === 'prebuild') {\n const { getPrebuildConfigAsync } = await import('@expo/prebuild-config');\n\n config = await profile(getPrebuildConfigAsync)(projectRoot, {\n platforms: ['ios', 'android'],\n });\n } else if (options.type === 'introspect') {\n const { getPrebuildConfigAsync } = await import('@expo/prebuild-config');\n const { compileModsAsync } = await import('@expo/config-plugins/build/plugins/mod-compiler.js');\n\n config = await profile(getPrebuildConfigAsync)(projectRoot, {\n platforms: ['ios', 'android'],\n });\n\n await compileModsAsync(config.exp, {\n projectRoot,\n introspect: true,\n platforms: ['ios', 'android'],\n assertMissingModProviders: false,\n });\n // @ts-ignore\n delete config.modRequest;\n // @ts-ignore\n delete config.modResults;\n } else if (options.type === 'public') {\n config = profile(getConfig)(projectRoot, {\n skipSDKVersionRequirement: true,\n isPublicConfig: true,\n });\n } else if (options.type) {\n throw new CommandError(\n `Invalid option: --type ${options.type}. Valid options are: public, prebuild`\n );\n } else {\n config = profile(getConfig)(projectRoot, {\n skipSDKVersionRequirement: true,\n });\n }\n\n const configOutput = options.full ? config : config.exp;\n\n if (!options.json) {\n Log.log();\n logConfig(configOutput);\n Log.log();\n } else {\n process.stdout.write(JSON.stringify(configOutput));\n\n // Re-enable logging functions for testing.\n console.log = loggingFunctions.log;\n console.warn = loggingFunctions.warn;\n console.error = loggingFunctions.error;\n }\n}\n"],"names":["configAsync","logConfig","config","isObjStr","str","test","Log","log","util","inspect","colors","compact","sorted","a","b","showHidden","depth","projectRoot","options","loggingFunctions","console","warn","error","json","setNodeEnv","require","load","type","assert","match","getPrebuildConfigAsync","profile","platforms","compileModsAsync","exp","introspect","assertMissingModProviders","modRequest","modResults","getConfig","skipSDKVersionRequirement","isPublicConfig","CommandError","configOutput","full","process","stdout","write","JSON","stringify"],"mappings":";;;;;;;;;;;IAiCsBA,WAAW;eAAXA;;IAlBNC,SAAS;eAATA;;;;yBAfqC;;;;;;;gEAClC;;;;;;;gEACF;;;;;;6DAEI;wBACQ;yBACF;yBACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQjB,SAASA,UAAUC,MAAkC;IAC1D,MAAMC,WAAW,CAACC,MAAyB,WAAWC,IAAI,CAACD;IAC3DE,KAAIC,GAAG,CACLC,eAAI,CAACC,OAAO,CAACP,QAAQ;QACnBQ,QAAQ;QACRC,SAAS;QACT,sFAAsF;QACtFC,QAAOC,CAAS,EAAEC,CAAS;YACzB,IAAIX,SAASU,IAAI,OAAO;YACxB,IAAIV,SAASW,IAAI,OAAO,CAAC;YACzB,OAAO;QACT;QACAC,YAAY;QACZC,OAAO;IACT;AAEJ;AAEO,eAA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mBAAS,EAAEtB,aAAa;YACvCuB,2BAA2B;YAC3BC,gBAAgB;QAClB;IACF,OAAO,IAAIvB,QAAQS,IAAI,EAAE;QACvB,MAAM,IAAIe,oBAAY,CACpB,CAAC,uBAAuB,EAAExB,QAAQS,IAAI,CAAC,qCAAqC,CAAC;IAEjF,OAAO;QACLzB,SAAS6B,IAAAA,gBAAO,EAACQ,mBAAS,EAAEtB,aAAa;YACvCuB,2BAA2B;QAC7B;IACF;IAEA,MAAMG,eAAezB,QAAQ0B,IAAI,GAAG1C,SAASA,OAAOgC,GAAG;IAEvD,IAAI,CAAChB,QAAQK,IAAI,EAAE;QACjBjB,KAAIC,GAAG;QACPN,UAAU0C;QACVrC,KAAIC,GAAG;IACT,OAAO;QACLsC,QAAQC,MAAM,CAACC,KAAK,CAACC,KAAKC,SAAS,CAACN;QAEpC,2CAA2C;QAC3CvB,QAAQb,GAAG,GAAGY,iBAAiBZ,GAAG;QAClCa,QAAQC,IAAI,GAAGF,iBAAiBE,IAAI;QACpCD,QAAQE,KAAK,GAAGH,iBAAiBG,KAAK;IACxC;AACF"}
1
+ {"version":3,"sources":["../../../src/config/configAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfig, ProjectConfig } from '@expo/config';\nimport assert from 'assert';\nimport util from 'util';\n\nimport * as Log from '../log';\nimport { CommandError } from '../utils/errors';\nimport { setNodeEnv, loadEnvFiles } from '../utils/nodeEnv';\nimport { profile } from '../utils/profile';\n\ntype Options = {\n type?: string;\n full?: boolean;\n json?: boolean;\n};\n\nexport function logConfig(config: ExpoConfig | ProjectConfig) {\n const isObjStr = (str: string): boolean => /^\\w+: {/g.test(str);\n Log.log(\n util.inspect(config, {\n colors: true,\n compact: false,\n // Sort objects to the end so that smaller values aren't hidden between large objects.\n sorted(a: string, b: string) {\n if (isObjStr(a)) return 1;\n if (isObjStr(b)) return -1;\n return 0;\n },\n showHidden: false,\n depth: null,\n })\n );\n}\n\nexport async function configAsync(projectRoot: string, options: Options) {\n const loggingFunctions = {\n log: console.log,\n warn: console.warn,\n error: console.error,\n };\n // Disable logging for this command if the user wants to get JSON output.\n // This will ensure that only the JSON is printed to stdout.\n if (options.json) {\n console.log = function () {};\n console.warn = function () {};\n console.error = function () {};\n }\n setNodeEnv('development');\n loadEnvFiles(projectRoot);\n\n if (options.type) {\n assert.match(options.type, /^(public|prebuild|introspect)$/);\n }\n\n let config: ProjectConfig;\n\n if (options.type === 'prebuild') {\n const { getPrebuildConfigAsync } = await import('@expo/prebuild-config');\n\n config = await profile(getPrebuildConfigAsync)(projectRoot, {\n platforms: ['ios', 'android'],\n });\n } else if (options.type === 'introspect') {\n const { getPrebuildConfigAsync } = await import('@expo/prebuild-config');\n const { compileModsAsync } = await import('@expo/config-plugins/build/plugins/mod-compiler.js');\n\n config = await profile(getPrebuildConfigAsync)(projectRoot, {\n platforms: ['ios', 'android'],\n });\n\n await compileModsAsync(config.exp, {\n projectRoot,\n introspect: true,\n platforms: ['ios', 'android'],\n assertMissingModProviders: false,\n });\n // @ts-ignore\n delete config.modRequest;\n // @ts-ignore\n delete config.modResults;\n } else if (options.type === 'public') {\n config = profile(getConfig)(projectRoot, {\n skipSDKVersionRequirement: true,\n isPublicConfig: true,\n });\n } else if (options.type) {\n throw new CommandError(\n `Invalid option: --type ${options.type}. Valid options are: public, prebuild`\n );\n } else {\n config = profile(getConfig)(projectRoot, {\n skipSDKVersionRequirement: true,\n });\n }\n\n const configOutput = options.full ? config : config.exp;\n\n if (!options.json) {\n Log.log();\n logConfig(configOutput);\n Log.log();\n } else {\n process.stdout.write(JSON.stringify(configOutput));\n\n // Re-enable logging functions for testing.\n console.log = loggingFunctions.log;\n console.warn = loggingFunctions.warn;\n console.error = loggingFunctions.error;\n }\n}\n"],"names":["configAsync","logConfig","config","isObjStr","str","test","Log","log","util","inspect","colors","compact","sorted","a","b","showHidden","depth","projectRoot","options","loggingFunctions","console","warn","error","json","setNodeEnv","loadEnvFiles","type","assert","match","getPrebuildConfigAsync","profile","platforms","compileModsAsync","exp","introspect","assertMissingModProviders","modRequest","modResults","getConfig","skipSDKVersionRequirement","isPublicConfig","CommandError","configOutput","full","process","stdout","write","JSON","stringify"],"mappings":";;;;;;;;;;;IAiCsBA,WAAW;eAAXA;;IAlBNC,SAAS;eAATA;;;;yBAfqC;;;;;;;gEAClC;;;;;;;gEACF;;;;;;6DAEI;wBACQ;yBACY;yBACjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQjB,SAASA,UAAUC,MAAkC;IAC1D,MAAMC,WAAW,CAACC,MAAyB,WAAWC,IAAI,CAACD;IAC3DE,KAAIC,GAAG,CACLC,eAAI,CAACC,OAAO,CAACP,QAAQ;QACnBQ,QAAQ;QACRC,SAAS;QACT,sFAAsF;QACtFC,QAAOC,CAAS,EAAEC,CAAS;YACzB,IAAIX,SAASU,IAAI,OAAO;YACxB,IAAIV,SAASW,IAAI,OAAO,CAAC;YACzB,OAAO;QACT;QACAC,YAAY;QACZC,OAAO;IACT;AAEJ;AAEO,eAAehB,YAAYiB,WAAmB,EAAEC,OAAgB;IACrE,MAAMC,mBAAmB;QACvBZ,KAAKa,QAAQb,GAAG;QAChBc,MAAMD,QAAQC,IAAI;QAClBC,OAAOF,QAAQE,KAAK;IACtB;IACA,yEAAyE;IACzE,4DAA4D;IAC5D,IAAIJ,QAAQK,IAAI,EAAE;QAChBH,QAAQb,GAAG,GAAG,YAAa;QAC3Ba,QAAQC,IAAI,GAAG,YAAa;QAC5BD,QAAQE,KAAK,GAAG,YAAa;IAC/B;IACAE,IAAAA,mBAAU,EAAC;IACXC,IAAAA,qBAAY,EAACR;IAEb,IAAIC,QAAQQ,IAAI,EAAE;QAChBC,iBAAM,CAACC,KAAK,CAACV,QAAQQ,IAAI,EAAE;IAC7B;IAEA,IAAIxB;IAEJ,IAAIgB,QAAQQ,IAAI,KAAK,YAAY;QAC/B,MAAM,EAAEG,sBAAsB,EAAE,GAAG,MAAM,mEAAA,QAAO;QAEhD3B,S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QAAQC,IAAI,GAAGF,iBAAiBE,IAAI;QACpCD,QAAQE,KAAK,GAAGH,iBAAiBG,KAAK;IACxC;AACF"}
@@ -26,7 +26,7 @@ async function customizeAsync(files, options, extras) {
26
26
  // Locate the project root based on the process current working directory.
27
27
  // This enables users to run `npx expo customize` from a subdirectory of the project.
28
28
  const projectRoot = (0, _findUp.findUpProjectRootOrAssert)(process.cwd());
29
- require('@expo/env').load(projectRoot);
29
+ (0, _nodeEnv.loadEnvFiles)(projectRoot);
30
30
  // Get the static path (defaults to 'web/')
31
31
  // Doesn't matter if expo is installed or which mode is used.
32
32
  const { exp } = (0, _config().getConfig)(projectRoot, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/customize/customizeAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\n\nimport { queryAndGenerateAsync, selectAndGenerateAsync } from './generate';\nimport { Options } from './resolveOptions';\nimport { DestinationResolutionProps } from './templates';\nimport { getRouterDirectoryModuleIdWithManifest } from '../start/server/metro/router';\nimport { getPlatformBundlers } from '../start/server/platformBundlers';\nimport { findUpProjectRootOrAssert } from '../utils/findUp';\nimport { setNodeEnv } from '../utils/nodeEnv';\n\nexport async function customizeAsync(files: string[], options: Options, extras: any[]) {\n setNodeEnv('development');\n // Locate the project root based on the process current working directory.\n // This enables users to run `npx expo customize` from a subdirectory of the project.\n const projectRoot = findUpProjectRootOrAssert(process.cwd());\n\n require('@expo/env').load(projectRoot);\n\n // Get the static path (defaults to 'web/')\n // Doesn't matter if expo is installed or which mode is used.\n const { exp } = getConfig(projectRoot, {\n skipSDKVersionRequirement: true,\n });\n\n const routerRoot = getRouterDirectoryModuleIdWithManifest(projectRoot, exp);\n\n // Create the destination resolution props which are used in both\n // the query and select functions.\n const props: DestinationResolutionProps = {\n webStaticPath:\n (exp.web?.staticPath ?? getPlatformBundlers(projectRoot, exp).web === 'webpack')\n ? 'web'\n : 'public',\n appDirPath: routerRoot,\n };\n\n // If the user provided files, we'll generate them without prompting.\n if (files.length) {\n return queryAndGenerateAsync(projectRoot, {\n files,\n props,\n extras,\n });\n }\n\n // Otherwise, we'll prompt the user to select which files to generate.\n await selectAndGenerateAsync(projectRoot, {\n props,\n extras,\n });\n}\n"],"names":["customizeAsync","files","options","extras","exp","setNodeEnv","projectRoot","findUpProjectRootOrAssert","process","cwd","require","load","getConfig","skipSDKVersionRequirement","routerRoot","getRouterDirectoryModuleIdWithManifest","props","webStaticPath","web","staticPath","getPlatformBundlers","appDirPath","length","queryAndGenerateAsync","selectAndGenerateAsync"],"mappings":";;;;+BAUsBA;;;eAAAA;;;;yBAVI;;;;;;0BAEoC;wBAGP;kCACnB;wBACM;yBACf;AAEpB,eAAeA,eAAeC,KAAe,EAAEC,OAAgB,EAAEC,MAAa;QAoB9EC;IAnBLC,IAAAA,mBAAU,EAAC;IACX,0EAA0E;IAC1E,qFAAqF;IACrF,MAAMC,cAAcC,IAAAA,iCAAyB,EAACC,QAAQC,GAAG;IAEzDC,QAAQ,aAAaC,IAAI,CAACL;IAE1B,2CAA2C;IAC3C,6DAA6D;IAC7D,MAAM,EAAEF,GAAG,EAAE,GAAGQ,IAAAA,mBAAS,EAACN,aAAa;QACrCO,2BAA2B;IAC7B;IAEA,MAAMC,aAAaC,IAAAA,8CAAsC,EAACT,aAAaF;IAEvE,iEAAiE;IACjE,kCAAkC;IAClC,MAAMY,QAAoC;QACxCC,eACE,AAACb,EAAAA,WAAAA,IAAIc,GAAG,qBAAPd,SAASe,UAAU,KAAIC,IAAAA,qCAAmB,EAACd,aAAaF,KAAKc,GAAG,KAAK,YAClE,QACA;QACNG,YAAYP;IACd;IAEA,qEAAqE;IACrE,IAAIb,MAAMqB,MAAM,EAAE;QAChB,OAAOC,IAAAA,+BAAqB,EAACjB,aAAa;YACxCL;YACAe;YACAb;QACF;IACF;IAEA,sEAAsE;IACtE,MAAMqB,IAAAA,gCAAsB,EAAClB,aAAa;QACxCU;QACAb;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/customize/customizeAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\n\nimport { queryAndGenerateAsync, selectAndGenerateAsync } from './generate';\nimport { Options } from './resolveOptions';\nimport { DestinationResolutionProps } from './templates';\nimport { getRouterDirectoryModuleIdWithManifest } from '../start/server/metro/router';\nimport { getPlatformBundlers } from '../start/server/platformBundlers';\nimport { findUpProjectRootOrAssert } from '../utils/findUp';\nimport { setNodeEnv, loadEnvFiles } from '../utils/nodeEnv';\n\nexport async function customizeAsync(files: string[], options: Options, extras: any[]) {\n setNodeEnv('development');\n // Locate the project root based on the process current working directory.\n // This enables users to run `npx expo customize` from a subdirectory of the project.\n const projectRoot = findUpProjectRootOrAssert(process.cwd());\n\n loadEnvFiles(projectRoot);\n\n // Get the static path (defaults to 'web/')\n // Doesn't matter if expo is installed or which mode is used.\n const { exp } = getConfig(projectRoot, {\n skipSDKVersionRequirement: true,\n });\n\n const routerRoot = getRouterDirectoryModuleIdWithManifest(projectRoot, exp);\n\n // Create the destination resolution props which are used in both\n // the query and select functions.\n const props: DestinationResolutionProps = {\n webStaticPath:\n (exp.web?.staticPath ?? getPlatformBundlers(projectRoot, exp).web === 'webpack')\n ? 'web'\n : 'public',\n appDirPath: routerRoot,\n };\n\n // If the user provided files, we'll generate them without prompting.\n if (files.length) {\n return queryAndGenerateAsync(projectRoot, {\n files,\n props,\n extras,\n });\n }\n\n // Otherwise, we'll prompt the user to select which files to generate.\n await selectAndGenerateAsync(projectRoot, {\n props,\n extras,\n });\n}\n"],"names":["customizeAsync","files","options","extras","exp","setNodeEnv","projectRoot","findUpProjectRootOrAssert","process","cwd","loadEnvFiles","getConfig","skipSDKVersionRequirement","routerRoot","getRouterDirectoryModuleIdWithManifest","props","webStaticPath","web","staticPath","getPlatformBundlers","appDirPath","length","queryAndGenerateAsync","selectAndGenerateAsync"],"mappings":";;;;+BAUsBA;;;eAAAA;;;;yBAVI;;;;;;0BAEoC;wBAGP;kCACnB;wBACM;yBACD;AAElC,eAAeA,eAAeC,KAAe,EAAEC,OAAgB,EAAEC,MAAa;QAoB9EC;IAnBLC,IAAAA,mBAAU,EAAC;IACX,0EAA0E;IAC1E,qFAAqF;IACrF,MAAMC,cAAcC,IAAAA,iCAAyB,EAACC,QAAQC,GAAG;IAEzDC,IAAAA,qBAAY,EAACJ;IAEb,2CAA2C;IAC3C,6DAA6D;IAC7D,MAAM,EAAEF,GAAG,EAAE,GAAGO,IAAAA,mBAAS,EAACL,aAAa;QACrCM,2BAA2B;IAC7B;IAEA,MAAMC,aAAaC,IAAAA,8CAAsC,EAACR,aAAaF;IAEvE,iEAAiE;IACjE,kCAAkC;IAClC,MAAMW,QAAoC;QACxCC,eACE,AAACZ,EAAAA,WAAAA,IAAIa,GAAG,qBAAPb,SAASc,UAAU,KAAIC,IAAAA,qCAAmB,EAACb,aAAaF,KAAKa,GAAG,KAAK,YAClE,QACA;QACNG,YAAYP;IACd;IAEA,qEAAqE;IACrE,IAAIZ,MAAMoB,MAAM,EAAE;QAChB,OAAOC,IAAAA,+BAAqB,EAAChB,aAAa;YACxCL;YACAc;YACAZ;QACF;IACF;IAEA,sEAAsE;IACtE,MAAMoB,IAAAA,gCAAsB,EAACjB,aAAa;QACxCS;QACAZ;IACF;AACF"}
@@ -185,7 +185,7 @@ async function exportEmbedAsync(projectRoot, options) {
185
185
  options.resetCache = false;
186
186
  }
187
187
  (0, _nodeEnv.setNodeEnv)(options.dev ? 'development' : 'production');
188
- require('@expo/env').load(projectRoot);
188
+ (0, _nodeEnv.loadEnvFiles)(projectRoot);
189
189
  // This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.
190
190
  // Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.
191
191
  // This path is also used for automatically deploying server bundles to a remote host.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/export/embed/exportEmbedAsync.ts"],"sourcesContent":["/**\n * Copyright © 2023 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 Server from '@expo/metro/metro/Server';\nimport splitBundleOptions from '@expo/metro/metro/lib/splitBundleOptions';\nimport * as output from '@expo/metro/metro/shared/output/bundle';\nimport type { BundleOptions } from '@expo/metro/metro/shared/types';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\n\nimport { deserializeEagerKey, getExportEmbedOptionsKey, Options } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { DOM_COMPONENTS_BUNDLE_DIR } from '../../start/server/middleware/DomComponentsMiddleware';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { copyAsync, removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { exportDomComponentAsync } from '../exportDomComponents';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\nimport { copyPublicFolderAsync } from '../publicFolder';\nimport { BundleAssetWithFileHashes, ExportAssetMap, persistMetroFilesAsync } from '../saveAssets';\nimport { exportStandaloneServerAsync } from './exportServer';\nimport { ensureProcessExitsAfterDelay } from '../../utils/exit';\nimport { resolveRealEntryFilePath } from '../../utils/filePath';\n\nconst debug = require('debug')('expo:export:embed');\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (\n !bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//) &&\n !bundleOutput.match(/\\/CoreSimulator\\/Devices\\/.*\\/data\\/Containers\\/Bundle\\/Application\\//)\n ) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(`*.app/${bundleName}`, {\n cwd: bundleParent,\n absolute: true,\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n // The React Native build scripts always enable the cache reset but we shouldn't need this in CI environments.\n // By disabling it, we can eagerly bundle code before the build and reuse the cached artifacts in subsequent builds.\n if (env.CI && options.resetCache) {\n debug('CI environment detected, disabling automatic cache reset');\n options.resetCache = false;\n }\n\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n // This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.\n // Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.\n // This path is also used for automatically deploying server bundles to a remote host.\n const eagerBundleOptions = env.__EXPO_EAGER_BUNDLE_OPTIONS\n ? deserializeEagerKey(env.__EXPO_EAGER_BUNDLE_OPTIONS)\n : null;\n if (eagerBundleOptions) {\n // Get the cache key for the current process to compare against the eager key.\n const inputKey = getExportEmbedOptionsKey(options);\n\n // If the app was bundled previously in the same process, then we should reuse the Metro cache.\n options.resetCache = false;\n\n if (eagerBundleOptions.key === inputKey) {\n // Copy the eager bundleOutput and assets to the new locations.\n await removeAsync(options.bundleOutput);\n\n copyAsync(eagerBundleOptions.options.bundleOutput, options.bundleOutput);\n\n if (eagerBundleOptions.options.assetsDest && options.assetsDest) {\n copyAsync(eagerBundleOptions.options.assetsDest, options.assetsDest);\n }\n\n console.log('info: Copied output to binary:', options.bundleOutput);\n return;\n }\n // TODO: sourcemapOutput is set on Android but not during eager. This is tolerable since it doesn't invalidate the Metro cache.\n console.log(' Eager key:', eagerBundleOptions.key);\n console.log('Request key:', inputKey);\n\n // TODO: We may want an analytic event here in the future to understand when this happens.\n console.warn('warning: Eager bundle does not match new options, bundling again.');\n }\n\n await exportEmbedInternalAsync(projectRoot, options);\n\n // Ensure the process closes after bundling\n ensureProcessExitsAfterDelay();\n}\n\nexport async function exportEmbedInternalAsync(projectRoot: string, options: Options) {\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (options.platform === 'ios') {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets, files } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // On Android, dom components proxy files should write to the assets directory instead of the res directory.\n // We use the bundleOutput directory to get the assets directory.\n const domComponentProxyOutputDir =\n options.platform === 'android' ? path.dirname(options.bundleOutput) : options.assetsDest;\n const hasDomComponents = domComponentProxyOutputDir && files.size > 0;\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\n\n // Write dom components proxy files.\n hasDomComponents ? persistMetroFilesAsync(files, domComponentProxyOutputDir) : null,\n // Copy public folder for dom components only if\n hasDomComponents\n ? copyPublicFolderAsync(\n path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER),\n path.join(domComponentProxyOutputDir, DOM_COMPONENTS_BUNDLE_DIR)\n )\n : null,\n\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(projectRoot, assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: Awaited<ReturnType<Server['build']>>;\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n}> {\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: options.resetCache,\n maxWorkers: options.maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const { exp, pkg } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const files: ExportAssetMap = new Map();\n\n try {\n const bundles = await devServer.nativeExportBundleAsync(\n exp,\n {\n // TODO: Re-enable when we get bytecode chunk splitting working again.\n splitChunks: false, //devServer.isReactServerComponentsEnabled,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: !!sourceMapUrl,\n bytecode: options.bytecode ?? false,\n // source map inline\n reactCompiler: !!exp.experiments?.reactCompiler,\n },\n files,\n {\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n }\n );\n\n const apiRoutesEnabled =\n devServer.isReactServerComponentsEnabled || exp.web?.output === 'server';\n\n if (apiRoutesEnabled) {\n await exportStandaloneServerAsync(projectRoot, devServer, {\n exp,\n pkg,\n files,\n options,\n });\n }\n\n // TODO: Remove duplicates...\n const expoDomComponentReferences = bundles.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat();\n if (expoDomComponentReferences.length > 0) {\n await Promise.all(\n // TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.\n expoDomComponentReferences.map(async (filePath) => {\n const { bundle } = await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev: options.dev,\n devServer,\n isHermes,\n includeSourceMaps: !!sourceMapUrl,\n exp,\n files,\n });\n\n if (options.assetsDest) {\n // Save assets like a typical bundler, preserving the file paths on web.\n // This is saving web-style inside of a native app's binary.\n await persistMetroAssetsAsync(\n projectRoot,\n bundle.assets.map((asset) => ({\n ...asset,\n httpServerLocation: path.join(DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation),\n })),\n {\n files,\n platform: 'web',\n outputDirectory: options.assetsDest,\n }\n );\n }\n })\n );\n }\n\n return {\n files,\n bundle: {\n code: bundles.artifacts.filter((a: any) => a.type === 'js')[0].source,\n // Can be optional when source maps aren't enabled.\n map: bundles.artifacts.filter((a: any) => a.type === 'map')[0]?.source.toString(),\n },\n assets: bundles.assets,\n };\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n } finally {\n devServerManager.stopAsync();\n }\n}\n\n// Exports for expo-updates\nexport async function createMetroServerAndBundleRequestAsync(\n projectRoot: string,\n options: Pick<\n Options,\n | 'maxWorkers'\n | 'config'\n | 'platform'\n | 'sourcemapOutput'\n | 'sourcemapUseAbsolutePath'\n | 'entryFile'\n | 'minify'\n | 'dev'\n | 'resetCache'\n | 'unstableTransformProfile'\n >\n): Promise<{ server: Server; bundleRequest: BundleOptions }> {\n const exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // TODO: This is slow ~40ms\n const { config } = await loadMetroConfigAsync(\n projectRoot,\n {\n // TODO: This is always enabled in the native script and there's no way to disable it.\n resetCache: options.resetCache,\n maxWorkers: options.maxWorkers,\n },\n {\n exp,\n isExporting: true,\n getMetroBundler() {\n return server.getBundler().getBundler();\n },\n }\n );\n\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const directBundleOptions = getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n splitChunks: false,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n isExporting: true,\n // Never output bytecode in the exported bundle since that is hardcoded in the native run script.\n bytecode: false,\n hosted: false,\n });\n\n // TODO(cedric): check if we can use the proper `bundleType=bundle` and `entryPoint=mainModuleName` properties\n const bundleRequest: BundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...directBundleOptions,\n\n // NOTE(@kitten): Cast non-optional defaults\n lazy: directBundleOptions.lazy ?? Server.DEFAULT_BUNDLE_OPTIONS.lazy,\n modulesOnly: directBundleOptions.modulesOnly ?? Server.DEFAULT_BUNDLE_OPTIONS.modulesOnly,\n runModule: directBundleOptions.runModule ?? Server.DEFAULT_BUNDLE_OPTIONS.runModule,\n\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n };\n\n const server = new Server(config, {\n watch: false,\n });\n\n return { server, bundleRequest };\n}\n\nexport async function exportEmbedAssetsAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions({\n ...bundleRequest,\n // @ts-ignore-error TODO(@kitten): Very unclear why this is here. Remove?\n bundleType: 'todo',\n });\n\n const dependencies = await server._bundler.getDependencies(\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n const config = server._config;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: config.serializer.processModuleFilter,\n assetPlugins: config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n // Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n // behavior.\n projectRoot: config.projectRoot, // this._getServerRootDir(),\n publicPath: config.transformer.publicPath,\n isHosted: false,\n });\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n }\n}\n\nfunction isError(error: any): error is Error {\n return error instanceof Error;\n}\n"],"names":["createMetroServerAndBundleRequestAsync","exportEmbedAssetsAsync","exportEmbedAsync","exportEmbedBundleAndAssetsAsync","exportEmbedInternalAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","cwd","absolute","dot","projectRoot","options","env","CI","resetCache","setNodeEnv","dev","load","eagerBundleOptions","__EXPO_EAGER_BUNDLE_OPTIONS","deserializeEagerKey","inputKey","getExportEmbedOptionsKey","key","removeAsync","copyAsync","assetsDest","console","log","warn","ensureProcessExitsAfterDelay","platform","previousPath","fs","existsSync","bundle","assets","files","mkdirSync","recursive","mode","domComponentProxyOutputDir","hasDomComponents","size","Promise","all","output","save","Log","persistMetroFilesAsync","copyPublicFolderAsync","resolve","EXPO_PUBLIC_FOLDER","join","DOM_COMPONENTS_BUNDLE_DIR","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","devServerManager","DevServerManager","startMetroAsync","minify","port","isExporting","location","resetDevServer","maxWorkers","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","exp","pkg","getConfig","skipSDKVersionRequirement","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","Map","bundles","nativeExportBundleAsync","splitChunks","mainModuleName","resolveRealEntryFilePath","entryFile","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","unstable_transformProfile","unstableTransformProfile","apiRoutesEnabled","isReactServerComponentsEnabled","web","exportStandaloneServerAsync","expoDomComponentReferences","artifacts","map","artifact","Array","isArray","metadata","flat","length","filePath","exportDomComponentAsync","includeSourceMaps","asset","httpServerLocation","code","filter","a","type","source","toString","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","stopAsync","config","loadMetroConfigAsync","getMetroBundler","server","getBundler","directBundleOptions","getMetroDirectBundleOptionsForExpoConfig","hosted","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","lazy","modulesOnly","runModule","watch","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","dependencies","_bundler","getDependencies","shallow","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","isHosted","Error"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;IAuSqBA,sCAAsC;eAAtCA;;IA6EAC,sBAAsB;eAAtBA;;IA5TAC,gBAAgB;eAAhBA;;IAqGAC,+BAA+B;eAA/BA;;IAlDAC,wBAAwB;eAAxBA;;;;yBA1GI;;;;;;;gEACP;;;;;;;gEACY;;;;;;;iEACP;;;;;;;gEAEG;;;;;;;gEACR;;;;;;;gEACJ;;;;;;;yBACkB;;;;;;;gEAChB;;;;;;gCAEsD;qCACP;qBAC5C;kCACa;uCACK;kCACD;yCACK;8BACe;sBAC/B;q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MG,OAAO;gBACzC;gBACAE,IAAAA,yCAAoB,EAACnH,aAAa8G;YACpC;QACF;QACA,MAAMA;IACR;AACF;AAEA,SAASC,QAAQD,KAAU;IACzB,OAAOA,iBAAiBuC;AAC1B"}
1
+ {"version":3,"sources":["../../../../src/export/embed/exportEmbedAsync.ts"],"sourcesContent":["/**\n * Copyright © 2023 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 Server from '@expo/metro/metro/Server';\nimport splitBundleOptions from '@expo/metro/metro/lib/splitBundleOptions';\nimport * as output from '@expo/metro/metro/shared/output/bundle';\nimport type { BundleOptions } from '@expo/metro/metro/shared/types';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\n\nimport { deserializeEagerKey, getExportEmbedOptionsKey, Options } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { DOM_COMPONENTS_BUNDLE_DIR } from '../../start/server/middleware/DomComponentsMiddleware';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { copyAsync, removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { setNodeEnv, loadEnvFiles } from '../../utils/nodeEnv';\nimport { exportDomComponentAsync } from '../exportDomComponents';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\nimport { copyPublicFolderAsync } from '../publicFolder';\nimport { BundleAssetWithFileHashes, ExportAssetMap, persistMetroFilesAsync } from '../saveAssets';\nimport { exportStandaloneServerAsync } from './exportServer';\nimport { ensureProcessExitsAfterDelay } from '../../utils/exit';\nimport { resolveRealEntryFilePath } from '../../utils/filePath';\n\nconst debug = require('debug')('expo:export:embed');\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (\n !bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//) &&\n !bundleOutput.match(/\\/CoreSimulator\\/Devices\\/.*\\/data\\/Containers\\/Bundle\\/Application\\//)\n ) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(`*.app/${bundleName}`, {\n cwd: bundleParent,\n absolute: true,\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n // The React Native build scripts always enable the cache reset but we shouldn't need this in CI environments.\n // By disabling it, we can eagerly bundle code before the build and reuse the cached artifacts in subsequent builds.\n if (env.CI && options.resetCache) {\n debug('CI environment detected, disabling automatic cache reset');\n options.resetCache = false;\n }\n\n setNodeEnv(options.dev ? 'development' : 'production');\n loadEnvFiles(projectRoot);\n\n // This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.\n // Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.\n // This path is also used for automatically deploying server bundles to a remote host.\n const eagerBundleOptions = env.__EXPO_EAGER_BUNDLE_OPTIONS\n ? deserializeEagerKey(env.__EXPO_EAGER_BUNDLE_OPTIONS)\n : null;\n if (eagerBundleOptions) {\n // Get the cache key for the current process to compare against the eager key.\n const inputKey = getExportEmbedOptionsKey(options);\n\n // If the app was bundled previously in the same process, then we should reuse the Metro cache.\n options.resetCache = false;\n\n if (eagerBundleOptions.key === inputKey) {\n // Copy the eager bundleOutput and assets to the new locations.\n await removeAsync(options.bundleOutput);\n\n copyAsync(eagerBundleOptions.options.bundleOutput, options.bundleOutput);\n\n if (eagerBundleOptions.options.assetsDest && options.assetsDest) {\n copyAsync(eagerBundleOptions.options.assetsDest, options.assetsDest);\n }\n\n console.log('info: Copied output to binary:', options.bundleOutput);\n return;\n }\n // TODO: sourcemapOutput is set on Android but not during eager. This is tolerable since it doesn't invalidate the Metro cache.\n console.log(' Eager key:', eagerBundleOptions.key);\n console.log('Request key:', inputKey);\n\n // TODO: We may want an analytic event here in the future to understand when this happens.\n console.warn('warning: Eager bundle does not match new options, bundling again.');\n }\n\n await exportEmbedInternalAsync(projectRoot, options);\n\n // Ensure the process closes after bundling\n ensureProcessExitsAfterDelay();\n}\n\nexport async function exportEmbedInternalAsync(projectRoot: string, options: Options) {\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (options.platform === 'ios') {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets, files } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // On Android, dom components proxy files should write to the assets directory instead of the res directory.\n // We use the bundleOutput directory to get the assets directory.\n const domComponentProxyOutputDir =\n options.platform === 'android' ? path.dirname(options.bundleOutput) : options.assetsDest;\n const hasDomComponents = domComponentProxyOutputDir && files.size > 0;\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\n\n // Write dom components proxy files.\n hasDomComponents ? persistMetroFilesAsync(files, domComponentProxyOutputDir) : null,\n // Copy public folder for dom components only if\n hasDomComponents\n ? copyPublicFolderAsync(\n path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER),\n path.join(domComponentProxyOutputDir, DOM_COMPONENTS_BUNDLE_DIR)\n )\n : null,\n\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(projectRoot, assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: Awaited<ReturnType<Server['build']>>;\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n}> {\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: options.resetCache,\n maxWorkers: options.maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const { exp, pkg } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const files: ExportAssetMap = new Map();\n\n try {\n const bundles = await devServer.nativeExportBundleAsync(\n exp,\n {\n // TODO: Re-enable when we get bytecode chunk splitting working again.\n splitChunks: false, //devServer.isReactServerComponentsEnabled,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: !!sourceMapUrl,\n bytecode: options.bytecode ?? false,\n // source map inline\n reactCompiler: !!exp.experiments?.reactCompiler,\n },\n files,\n {\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n }\n );\n\n const apiRoutesEnabled =\n devServer.isReactServerComponentsEnabled || exp.web?.output === 'server';\n\n if (apiRoutesEnabled) {\n await exportStandaloneServerAsync(projectRoot, devServer, {\n exp,\n pkg,\n files,\n options,\n });\n }\n\n // TODO: Remove duplicates...\n const expoDomComponentReferences = bundles.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat();\n if (expoDomComponentReferences.length > 0) {\n await Promise.all(\n // TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.\n expoDomComponentReferences.map(async (filePath) => {\n const { bundle } = await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev: options.dev,\n devServer,\n isHermes,\n includeSourceMaps: !!sourceMapUrl,\n exp,\n files,\n });\n\n if (options.assetsDest) {\n // Save assets like a typical bundler, preserving the file paths on web.\n // This is saving web-style inside of a native app's binary.\n await persistMetroAssetsAsync(\n projectRoot,\n bundle.assets.map((asset) => ({\n ...asset,\n httpServerLocation: path.join(DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation),\n })),\n {\n files,\n platform: 'web',\n outputDirectory: options.assetsDest,\n }\n );\n }\n })\n );\n }\n\n return {\n files,\n bundle: {\n code: bundles.artifacts.filter((a: any) => a.type === 'js')[0].source,\n // Can be optional when source maps aren't enabled.\n map: bundles.artifacts.filter((a: any) => a.type === 'map')[0]?.source.toString(),\n },\n assets: bundles.assets,\n };\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n } finally {\n devServerManager.stopAsync();\n }\n}\n\n// Exports for expo-updates\nexport async function createMetroServerAndBundleRequestAsync(\n projectRoot: string,\n options: Pick<\n Options,\n | 'maxWorkers'\n | 'config'\n | 'platform'\n | 'sourcemapOutput'\n | 'sourcemapUseAbsolutePath'\n | 'entryFile'\n | 'minify'\n | 'dev'\n | 'resetCache'\n | 'unstableTransformProfile'\n >\n): Promise<{ server: Server; bundleRequest: BundleOptions }> {\n const exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // TODO: This is slow ~40ms\n const { config } = await loadMetroConfigAsync(\n projectRoot,\n {\n // TODO: This is always enabled in the native script and there's no way to disable it.\n resetCache: options.resetCache,\n maxWorkers: options.maxWorkers,\n },\n {\n exp,\n isExporting: true,\n getMetroBundler() {\n return server.getBundler().getBundler();\n },\n }\n );\n\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const directBundleOptions = getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n splitChunks: false,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n isExporting: true,\n // Never output bytecode in the exported bundle since that is hardcoded in the native run script.\n bytecode: false,\n hosted: false,\n });\n\n // TODO(cedric): check if we can use the proper `bundleType=bundle` and `entryPoint=mainModuleName` properties\n const bundleRequest: BundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...directBundleOptions,\n\n // NOTE(@kitten): Cast non-optional defaults\n lazy: directBundleOptions.lazy ?? Server.DEFAULT_BUNDLE_OPTIONS.lazy,\n modulesOnly: directBundleOptions.modulesOnly ?? Server.DEFAULT_BUNDLE_OPTIONS.modulesOnly,\n runModule: directBundleOptions.runModule ?? Server.DEFAULT_BUNDLE_OPTIONS.runModule,\n\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n };\n\n const server = new Server(config, {\n watch: false,\n });\n\n return { server, bundleRequest };\n}\n\nexport async function exportEmbedAssetsAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions({\n ...bundleRequest,\n // @ts-ignore-error TODO(@kitten): Very unclear why this is here. Remove?\n bundleType: 'todo',\n });\n\n const dependencies = await server._bundler.getDependencies(\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n const config = server._config;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: config.serializer.processModuleFilter,\n assetPlugins: config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n // Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n // behavior.\n projectRoot: config.projectRoot, // this._getServerRootDir(),\n publicPath: config.transformer.publicPath,\n isHosted: false,\n });\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n }\n}\n\nfunction isError(error: any): error is Error {\n return error instanceof Error;\n}\n"],"names":["createMetroServerAndBundleRequestAsync","exportEmbedAssetsAsync","exportEmbedAsync","exportEmbedBundleAndAssetsAsync","exportEmbedInternalAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","cwd","absolute","dot","projectRoot","options","env","CI","resetCache","setNodeEnv","dev","loadEnvFiles","eagerBundleOptions","__EXPO_EAGER_BUNDLE_OPTIONS","deserializeEagerKey","inputKey","getExportEmbedOptionsKey","key","removeAsync","copyAsync","assetsDest","console","log","warn","ensureProcessExitsAfterDelay","platform","previousPath","fs","existsSync","bundle","assets","files","mkdirSync","recursive","mode","domComponentProxyOutputDir","hasDomComponents","size","Promise","all","output","save","Log","persistMetroFilesAsync","copyPublicFolderAsync","resolve","EXPO_PUBLIC_FOLDER","join","DOM_COMPONENTS_BUNDLE_DIR","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","devServerManager","DevServerManager","startMetroAsync","minify","port","isExporting","location","resetDevServer","maxWorkers","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","exp","pkg","getConfig","skipSDKVersionRequirement","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","Map","bundles","nativeExportBundleAsync","splitChunks","mainModuleName","resolveRealEntryFilePath","entryFile","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","unstable_transformProfile","unstableTransformProfile","apiRoutesEnabled","isReactServerComponentsEnabled","web","exportStandaloneServerAsync","expoDomComponentReferences","artifacts","map","artifact","Array","isArray","metadata","flat","length","filePath","exportDomComponentAsync","includeSourceMaps","asset","httpServerLocation","code","filter","a","type","source","toString","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","stopAsync","config","loadMetroConfigAsync","getMetroBundler","server","getBundler","directBundleOptions","getMetroDirectBundleOptionsForExpoConfig","hosted","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","lazy","modulesOnly","runModule","watch","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","dependencies","_bundler","getDependencies","shallow","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","isHosted","Error"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;IAuSqBA,sCAAsC;eAAtCA;;IA6EAC,sBAAsB;eAAtBA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YACzCC,UAAU;QACZ;IACF,EAAE,OAAOtC,OAAY;QACnB,IAAIC,QAAQD,QAAQ;YAClB,0EAA0E;YAC1E,iIAAiI;YACjI,IAAI7G,QAAQoB,QAAQ,KAAK,OAAO;gBAC9B,8FAA8F;gBAC9F,IAAI,aAAayF,SAASE,IAAAA,8CAAyB,KAAI;oBACrDF,MAAMG,OAAO,GAAGC,IAAAA,eAAS,EAACJ,MAAMG,OAAO;gBACzC;gBACAE,IAAAA,yCAAoB,EAACnH,aAAa8G;YACpC;QACF;QACA,MAAMA;IACR;AACF;AAEA,SAASC,QAAQD,KAAU;IACzB,OAAOA,iBAAiBuC;AAC1B"}
@@ -117,7 +117,7 @@ async function exportAppAsync(projectRoot, { platforms, outputDir, clear, dev, d
117
117
  const environment = dev ? 'development' : 'production';
118
118
  process.env.NODE_ENV = environment;
119
119
  (0, _nodeEnv.setNodeEnv)(environment);
120
- require('@expo/env').load(projectRoot);
120
+ (0, _nodeEnv.loadEnvFiles)(projectRoot);
121
121
  const projectConfig = (0, _config().getConfig)(projectRoot);
122
122
  const exp = await (0, _getPublicExpoManifest.getPublicExpoManifestAsync)(projectRoot, {
123
123
  // Web doesn't require validation.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport type { Platform } from '@expo/config';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { type PlatformMetadata, createMetadataJson } from './createMetadataJson';\nimport { exportAssetsAsync } from './exportAssets';\nimport {\n addDomBundleToMetadataAsync,\n exportDomComponentAsync,\n transformNativeBundleForMd5Filename,\n transformDomEntryForMd5Filename,\n} from './exportDomComponents';\nimport { assertEngineMismatchAsync, isEnableHermesManaged } from './exportHermes';\nimport {\n exportApiRoutesStandaloneAsync,\n exportFromServerAsync,\n injectScriptTags,\n} from './exportStaticAsync';\nimport { getVirtualFaviconAssetsAsync } from './favicon';\nimport { getPublicExpoManifestAsync } from './getPublicExpoManifest';\nimport { copyPublicFolderAsync } from './publicFolder';\nimport { Options } from './resolveOptions';\nimport {\n ExportAssetMap,\n BundleOutput,\n getFilesFromSerialAssets,\n persistMetroFilesAsync,\n BundleAssetWithFileHashes,\n} from './saveAssets';\nimport { createAssetMap } from './writeContents';\nimport * as Log from '../log';\nimport { WebSupportProjectPrerequisite } from '../start/doctor/web/WebSupportProjectPrerequisite';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../start/server/metro/MetroBundlerDevServer';\nimport { getRouterDirectoryModuleIdWithManifest } from '../start/server/metro/router';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport { getEntryWithServerRoot } from '../start/server/middleware/ManifestMiddleware';\nimport { getBaseUrlFromExpoConfig } from '../start/server/middleware/metroOptions';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../start/server/webTemplate';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\nimport { setNodeEnv } from '../utils/nodeEnv';\n\nexport async function exportAppAsync(\n projectRoot: string,\n {\n platforms,\n outputDir,\n clear,\n dev,\n dumpAssetmap,\n sourceMaps,\n inlineSourceMaps,\n minify,\n bytecode,\n maxWorkers,\n skipSSG,\n hostedNative,\n }: Pick<\n Options,\n | 'dumpAssetmap'\n | 'sourceMaps'\n | 'inlineSourceMaps'\n | 'dev'\n | 'clear'\n | 'outputDir'\n | 'platforms'\n | 'minify'\n | 'bytecode'\n | 'maxWorkers'\n | 'skipSSG'\n | 'hostedNative'\n >\n): Promise<void> {\n // Force the environment during export and do not allow overriding it.\n const environment = dev ? 'development' : 'production';\n process.env.NODE_ENV = environment;\n setNodeEnv(environment);\n\n require('@expo/env').load(projectRoot);\n\n const projectConfig = getConfig(projectRoot);\n const exp = await getPublicExpoManifestAsync(projectRoot, {\n // Web doesn't require validation.\n skipValidation: platforms.length === 1 && platforms[0] === 'web',\n });\n\n if (platforms.includes('web')) {\n await new WebSupportProjectPrerequisite(projectRoot).assertAsync();\n }\n\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\n if (skipSSG && exp.web?.output !== 'server') {\n throw new CommandError('--no-ssg can only be used with `web.output: server`');\n }\n\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n\n if (!bytecode && (platforms.includes('ios') || platforms.includes('android'))) {\n Log.warn(\n `Bytecode makes the app startup faster, disabling bytecode is highly discouraged and should only be used for debugging purposes.`\n );\n }\n\n // Print out logs\n if (baseUrl) {\n Log.log();\n Log.log(chalk.gray`Using (experimental) base path: ${baseUrl}`);\n // Warn if not using an absolute path.\n if (!baseUrl.startsWith('/')) {\n Log.log(\n chalk.yellow` Base path does not start with a slash. Requests will not be absolute.`\n );\n }\n }\n\n const mode = dev ? 'development' : 'production';\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n const outputPath = path.resolve(projectRoot, outputDir);\n\n // Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).\n\n const files: ExportAssetMap = new Map();\n\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify,\n mode,\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: clear,\n maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const bundles: Partial<Record<Platform, BundleOutput>> = {};\n const domComponentAssetsMetadata: Partial<Record<Platform, PlatformMetadata['assets']>> = {};\n\n const spaPlatforms =\n // TODO: Support server and static rendering for server component exports.\n useServerRendering && !devServer.isReactServerComponentsEnabled\n ? platforms.filter((platform) => platform !== 'web')\n : platforms;\n\n try {\n if (devServer.isReactServerComponentsEnabled) {\n // In RSC mode, we only need these to be in the client dir.\n // TODO: Merge back with other copy after we add SSR.\n try {\n await copyPublicFolderAsync(publicPath, path.join(outputPath, 'client'));\n } catch (error) {\n Log.error('Failed to copy public directory to dist directory');\n throw error;\n }\n } else {\n // NOTE(kitten): The public folder is currently always copied, regardless of targetDomain\n // split. Hence, there's another separate `copyPublicFolderAsync` call below for `web`\n await copyPublicFolderAsync(publicPath, outputPath);\n }\n\n let templateHtml: string | undefined;\n // Can be empty during web-only SSG.\n if (spaPlatforms.length) {\n await Promise.all(\n spaPlatforms.map(async (platform) => {\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 const isHermes = isEnableHermesManaged(exp, platform);\n if (isHermes) {\n await assertEngineMismatchAsync(projectRoot, exp, platform);\n }\n\n let bundle: {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n files?: ExportAssetMap;\n };\n\n try {\n // Run metro bundler and create the JS bundles/source maps.\n bundle = await devServer.nativeExportBundleAsync(\n exp,\n {\n platform,\n splitChunks:\n !env.EXPO_NO_BUNDLE_SPLITTING &&\n ((devServer.isReactServerComponentsEnabled && !bytecode) || platform === 'web'),\n mainModuleName: getEntryWithServerRoot(projectRoot, {\n platform,\n pkg: projectConfig.pkg,\n }),\n mode: dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: sourceMaps || inlineSourceMaps,\n inlineSourceMap: inlineSourceMaps,\n bytecode: bytecode && isHermes,\n reactCompiler: !!exp.experiments?.reactCompiler,\n hosted: hostedNative,\n },\n files\n );\n } catch (error) {\n Log.log('');\n if (error instanceof Error) {\n Log.exception(error);\n } else {\n Log.error('Failed to bundle the app');\n Log.log(error as any);\n }\n process.exit(1);\n }\n\n bundles[platform] = bundle;\n\n getFilesFromSerialAssets(bundle.artifacts, {\n includeSourceMaps: sourceMaps,\n files,\n isServerHosted: devServer.isReactServerComponentsEnabled || hostedNative,\n });\n\n // TODO: Remove duplicates...\n const expoDomComponentReferences = bundle.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat();\n await Promise.all(\n // TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.\n expoDomComponentReferences.map(async (filePath) => {\n const { bundle: platformDomComponentsBundle, htmlOutputName } =\n await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev,\n devServer,\n isHermes,\n includeSourceMaps: sourceMaps,\n exp,\n files,\n useMd5Filename: true,\n });\n\n // Merge the assets from the DOM component into the output assets.\n (bundle.assets as (typeof bundle.assets)[0][]).push(\n ...platformDomComponentsBundle.assets\n );\n\n transformNativeBundleForMd5Filename({\n domComponentReference: filePath,\n nativeBundle: bundle,\n files,\n htmlOutputName,\n });\n domComponentAssetsMetadata[platform] = [\n ...(domComponentAssetsMetadata[platform] || []),\n ...(await addDomBundleToMetadataAsync(platformDomComponentsBundle)),\n ...transformDomEntryForMd5Filename({\n files,\n htmlOutputName,\n }),\n ];\n })\n );\n\n if (platform === 'web') {\n // TODO: Unify with exportStaticAsync\n // TODO: Maybe move to the serializer.\n let html = await serializeHtmlWithAssets({\n isExporting: true,\n resources: bundle.artifacts,\n template: await createTemplateHtmlFromExpoConfigAsync(projectRoot, {\n scripts: [],\n cssLinks: [],\n exp: projectConfig.exp,\n }),\n baseUrl,\n });\n\n // Add the favicon assets to the HTML.\n const modifyHtml = await getVirtualFaviconAssetsAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n exp: projectConfig.exp,\n });\n if (modifyHtml) {\n html = modifyHtml(html);\n }\n\n // HACK: This is used for adding SSR shims in React Server Components.\n templateHtml = html;\n\n // Generate SPA-styled HTML file.\n // If web exists, then write the template HTML file.\n files.set('index.html', {\n contents: html,\n targetDomain: devServer.isReactServerComponentsEnabled ? 'server' : 'client',\n });\n }\n })\n );\n\n if (devServer.isReactServerComponentsEnabled) {\n const isWeb = platforms.includes('web');\n\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: !isWeb,\n templateHtml,\n });\n }\n\n // TODO: Use same asset system across platforms again.\n const { assets, embeddedHashSet } = await exportAssetsAsync(projectRoot, {\n files,\n exp,\n outputDir: outputPath,\n bundles,\n baseUrl,\n hostedNative,\n });\n\n if (dumpAssetmap) {\n Log.log('Creating asset map');\n files.set('assetmap.json', { contents: JSON.stringify(createAssetMap({ assets })) });\n }\n\n const targetDomain = devServer.isReactServerComponentsEnabled ? 'client/' : '';\n const fileNames = Object.fromEntries(\n Object.entries(bundles).map(([platform, bundle]) => [\n platform,\n bundle.artifacts\n .filter((asset) => asset.type === 'js')\n .map((asset) => targetDomain + asset.filename),\n ])\n );\n\n // Generate a `metadata.json` for EAS Update.\n const contents = createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n domComponentAssetsMetadata,\n });\n files.set('metadata.json', { contents: JSON.stringify(contents) });\n }\n\n // Additional web-only steps...\n\n if (platforms.includes('web') && useServerRendering) {\n const exportServer = exp.web?.output === 'server';\n\n if (exportServer) {\n // TODO: Remove when this is abstracted into the files map\n await copyPublicFolderAsync(publicPath, path.resolve(outputPath, 'client'));\n }\n\n if (skipSSG) {\n Log.log('Skipping static site generation');\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: true,\n });\n\n // Output a placeholder index.html if one doesn't exist in the public directory.\n // This ensures native + API routes have some content at the root URL.\n const placeholderIndex = path.resolve(outputPath, 'client/index.html');\n if (!fs.existsSync(placeholderIndex)) {\n files.set('index.html', {\n contents: `<html><body></body></html>`,\n targetDomain: 'client',\n });\n }\n } else if (\n // TODO: Support static export with RSC.\n !devServer.isReactServerComponentsEnabled\n ) {\n await exportFromServerAsync(projectRoot, devServer, {\n mode,\n files,\n clear: !!clear,\n outputDir: outputPath,\n minify,\n baseUrl,\n includeSourceMaps: sourceMaps,\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n reactCompiler: !!exp.experiments?.reactCompiler,\n exportServer,\n maxWorkers,\n isExporting: true,\n exp: projectConfig.exp,\n });\n }\n }\n } finally {\n await devServerManager.stopAsync();\n }\n\n // Write all files at the end for unified logging.\n await persistMetroFilesAsync(files, outputPath);\n}\n"],"names":["exportAppAsync","projectRoot","platforms","outputDir","clear","dev","dumpAssetmap","sourceMaps","inlineSourceMaps","minify","bytecode","maxWorkers","skipSSG","hostedNative","exp","environment","process","env","NODE_ENV","setNodeEnv","require","load","projectConfig","getConfig","getPublicExpoManifestAsync","skipValidation","length","includes","WebSupportProjectPrerequisite","assertAsync","useServerRendering","web","output","CommandError","baseUrl","getBaseUrlFromExpoConfig","Log","warn","log","chalk","gray","startsWith","yellow","mode","publicPath","path","resolve","EXPO_PUBLIC_FOLDER","outputPath","files","Map","devServerManager","DevServerManager","startMetroAsync","port","isExporting","location","resetDevServer","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","bundles","domComponentAssetsMetadata","spaPlatforms","isReactServerComponentsEnabled","filter","platform","copyPublicFolderAsync","join","error","templateHtml","Promise","all","map","isHermes","isEnableHermesManaged","assertEngineMismatchAsync","bundle","nativeExportBundleAsync","splitChunks","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","getEntryWithServerRoot","pkg","engine","undefined","serializerIncludeMaps","inlineSourceMap","reactCompiler","experiments","hosted","Error","exception","exit","getFilesFromSerialAssets","artifacts","includeSourceMaps","isServerHosted","expoDomComponentReferences","artifact","Array","isArray","metadata","flat","filePath","platformDomComponentsBundle","htmlOutputName","exportDomComponentAsync","useMd5Filename","assets","push","transformNativeBundleForMd5Filename","domComponentReference","nativeBundle","addDomBundleToMetadataAsync","transformDomEntryForMd5Filename","html","serializeHtmlWithAssets","resources","template","createTemplateHtmlFromExpoConfigAsync","scripts","cssLinks","modifyHtml","getVirtualFaviconAssetsAsync","set","contents","targetDomain","isWeb","exportApiRoutesStandaloneAsync","apiRoutesOnly","embeddedHashSet","exportAssetsAsync","JSON","stringify","createAssetMap","fileNames","Object","fromEntries","entries","asset","type","filename","createMetadataJson","exportServer","placeholderIndex","fs","existsSync","exportFromServerAsync","routerRoot","getRouterDirectoryModuleIdWithManifest","stopAsync","persistMetroFilesAsync"],"mapp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,WAAW,qBAAf5E,iBAAiB2E,aAAa;oBAC/CwD;oBACAtI;oBACA4C,aAAa;oBACbzC,KAAKQ,cAAcR,GAAG;gBACxB;YACF;QACF;IACF,SAAU;QACR,MAAMqC,iBAAiBqG,SAAS;IAClC;IAEA,kDAAkD;IAClD,MAAMC,IAAAA,kCAAsB,EAACxG,OAAOD;AACtC"}
1
+ {"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport type { Platform } from '@expo/config';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { type PlatformMetadata, createMetadataJson } from './createMetadataJson';\nimport { exportAssetsAsync } from './exportAssets';\nimport {\n addDomBundleToMetadataAsync,\n exportDomComponentAsync,\n transformNativeBundleForMd5Filename,\n transformDomEntryForMd5Filename,\n} from './exportDomComponents';\nimport { assertEngineMismatchAsync, isEnableHermesManaged } from './exportHermes';\nimport {\n exportApiRoutesStandaloneAsync,\n exportFromServerAsync,\n injectScriptTags,\n} from './exportStaticAsync';\nimport { getVirtualFaviconAssetsAsync } from './favicon';\nimport { getPublicExpoManifestAsync } from './getPublicExpoManifest';\nimport { copyPublicFolderAsync } from './publicFolder';\nimport { Options } from './resolveOptions';\nimport {\n ExportAssetMap,\n BundleOutput,\n getFilesFromSerialAssets,\n persistMetroFilesAsync,\n BundleAssetWithFileHashes,\n} from './saveAssets';\nimport { createAssetMap } from './writeContents';\nimport * as Log from '../log';\nimport { WebSupportProjectPrerequisite } from '../start/doctor/web/WebSupportProjectPrerequisite';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../start/server/metro/MetroBundlerDevServer';\nimport { getRouterDirectoryModuleIdWithManifest } from '../start/server/metro/router';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport { getEntryWithServerRoot } from '../start/server/middleware/ManifestMiddleware';\nimport { getBaseUrlFromExpoConfig } from '../start/server/middleware/metroOptions';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../start/server/webTemplate';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\nimport { setNodeEnv, loadEnvFiles } from '../utils/nodeEnv';\n\nexport async function exportAppAsync(\n projectRoot: string,\n {\n platforms,\n outputDir,\n clear,\n dev,\n dumpAssetmap,\n sourceMaps,\n inlineSourceMaps,\n minify,\n bytecode,\n maxWorkers,\n skipSSG,\n hostedNative,\n }: Pick<\n Options,\n | 'dumpAssetmap'\n | 'sourceMaps'\n | 'inlineSourceMaps'\n | 'dev'\n | 'clear'\n | 'outputDir'\n | 'platforms'\n | 'minify'\n | 'bytecode'\n | 'maxWorkers'\n | 'skipSSG'\n | 'hostedNative'\n >\n): Promise<void> {\n // Force the environment during export and do not allow overriding it.\n const environment = dev ? 'development' : 'production';\n process.env.NODE_ENV = environment;\n setNodeEnv(environment);\n loadEnvFiles(projectRoot);\n\n const projectConfig = getConfig(projectRoot);\n const exp = await getPublicExpoManifestAsync(projectRoot, {\n // Web doesn't require validation.\n skipValidation: platforms.length === 1 && platforms[0] === 'web',\n });\n\n if (platforms.includes('web')) {\n await new WebSupportProjectPrerequisite(projectRoot).assertAsync();\n }\n\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\n if (skipSSG && exp.web?.output !== 'server') {\n throw new CommandError('--no-ssg can only be used with `web.output: server`');\n }\n\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n\n if (!bytecode && (platforms.includes('ios') || platforms.includes('android'))) {\n Log.warn(\n `Bytecode makes the app startup faster, disabling bytecode is highly discouraged and should only be used for debugging purposes.`\n );\n }\n\n // Print out logs\n if (baseUrl) {\n Log.log();\n Log.log(chalk.gray`Using (experimental) base path: ${baseUrl}`);\n // Warn if not using an absolute path.\n if (!baseUrl.startsWith('/')) {\n Log.log(\n chalk.yellow` Base path does not start with a slash. Requests will not be absolute.`\n );\n }\n }\n\n const mode = dev ? 'development' : 'production';\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n const outputPath = path.resolve(projectRoot, outputDir);\n\n // Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).\n\n const files: ExportAssetMap = new Map();\n\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify,\n mode,\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: clear,\n maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const bundles: Partial<Record<Platform, BundleOutput>> = {};\n const domComponentAssetsMetadata: Partial<Record<Platform, PlatformMetadata['assets']>> = {};\n\n const spaPlatforms =\n // TODO: Support server and static rendering for server component exports.\n useServerRendering && !devServer.isReactServerComponentsEnabled\n ? platforms.filter((platform) => platform !== 'web')\n : platforms;\n\n try {\n if (devServer.isReactServerComponentsEnabled) {\n // In RSC mode, we only need these to be in the client dir.\n // TODO: Merge back with other copy after we add SSR.\n try {\n await copyPublicFolderAsync(publicPath, path.join(outputPath, 'client'));\n } catch (error) {\n Log.error('Failed to copy public directory to dist directory');\n throw error;\n }\n } else {\n // NOTE(kitten): The public folder is currently always copied, regardless of targetDomain\n // split. Hence, there's another separate `copyPublicFolderAsync` call below for `web`\n await copyPublicFolderAsync(publicPath, outputPath);\n }\n\n let templateHtml: string | undefined;\n // Can be empty during web-only SSG.\n if (spaPlatforms.length) {\n await Promise.all(\n spaPlatforms.map(async (platform) => {\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 const isHermes = isEnableHermesManaged(exp, platform);\n if (isHermes) {\n await assertEngineMismatchAsync(projectRoot, exp, platform);\n }\n\n let bundle: {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n files?: ExportAssetMap;\n };\n\n try {\n // Run metro bundler and create the JS bundles/source maps.\n bundle = await devServer.nativeExportBundleAsync(\n exp,\n {\n platform,\n splitChunks:\n !env.EXPO_NO_BUNDLE_SPLITTING &&\n ((devServer.isReactServerComponentsEnabled && !bytecode) || platform === 'web'),\n mainModuleName: getEntryWithServerRoot(projectRoot, {\n platform,\n pkg: projectConfig.pkg,\n }),\n mode: dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: sourceMaps || inlineSourceMaps,\n inlineSourceMap: inlineSourceMaps,\n bytecode: bytecode && isHermes,\n reactCompiler: !!exp.experiments?.reactCompiler,\n hosted: hostedNative,\n },\n files\n );\n } catch (error) {\n Log.log('');\n if (error instanceof Error) {\n Log.exception(error);\n } else {\n Log.error('Failed to bundle the app');\n Log.log(error as any);\n }\n process.exit(1);\n }\n\n bundles[platform] = bundle;\n\n getFilesFromSerialAssets(bundle.artifacts, {\n includeSourceMaps: sourceMaps,\n files,\n isServerHosted: devServer.isReactServerComponentsEnabled || hostedNative,\n });\n\n // TODO: Remove duplicates...\n const expoDomComponentReferences = bundle.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat();\n await Promise.all(\n // TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.\n expoDomComponentReferences.map(async (filePath) => {\n const { bundle: platformDomComponentsBundle, htmlOutputName } =\n await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev,\n devServer,\n isHermes,\n includeSourceMaps: sourceMaps,\n exp,\n files,\n useMd5Filename: true,\n });\n\n // Merge the assets from the DOM component into the output assets.\n (bundle.assets as (typeof bundle.assets)[0][]).push(\n ...platformDomComponentsBundle.assets\n );\n\n transformNativeBundleForMd5Filename({\n domComponentReference: filePath,\n nativeBundle: bundle,\n files,\n htmlOutputName,\n });\n domComponentAssetsMetadata[platform] = [\n ...(domComponentAssetsMetadata[platform] || []),\n ...(await addDomBundleToMetadataAsync(platformDomComponentsBundle)),\n ...transformDomEntryForMd5Filename({\n files,\n htmlOutputName,\n }),\n ];\n })\n );\n\n if (platform === 'web') {\n // TODO: Unify with exportStaticAsync\n // TODO: Maybe move to the serializer.\n let html = await serializeHtmlWithAssets({\n isExporting: true,\n resources: bundle.artifacts,\n template: await createTemplateHtmlFromExpoConfigAsync(projectRoot, {\n scripts: [],\n cssLinks: [],\n exp: projectConfig.exp,\n }),\n baseUrl,\n });\n\n // Add the favicon assets to the HTML.\n const modifyHtml = await getVirtualFaviconAssetsAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n exp: projectConfig.exp,\n });\n if (modifyHtml) {\n html = modifyHtml(html);\n }\n\n // HACK: This is used for adding SSR shims in React Server Components.\n templateHtml = html;\n\n // Generate SPA-styled HTML file.\n // If web exists, then write the template HTML file.\n files.set('index.html', {\n contents: html,\n targetDomain: devServer.isReactServerComponentsEnabled ? 'server' : 'client',\n });\n }\n })\n );\n\n if (devServer.isReactServerComponentsEnabled) {\n const isWeb = platforms.includes('web');\n\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: !isWeb,\n templateHtml,\n });\n }\n\n // TODO: Use same asset system across platforms again.\n const { assets, embeddedHashSet } = await exportAssetsAsync(projectRoot, {\n files,\n exp,\n outputDir: outputPath,\n bundles,\n baseUrl,\n hostedNative,\n });\n\n if (dumpAssetmap) {\n Log.log('Creating asset map');\n files.set('assetmap.json', { contents: JSON.stringify(createAssetMap({ assets })) });\n }\n\n const targetDomain = devServer.isReactServerComponentsEnabled ? 'client/' : '';\n const fileNames = Object.fromEntries(\n Object.entries(bundles).map(([platform, bundle]) => [\n platform,\n bundle.artifacts\n .filter((asset) => asset.type === 'js')\n .map((asset) => targetDomain + asset.filename),\n ])\n );\n\n // Generate a `metadata.json` for EAS Update.\n const contents = createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n domComponentAssetsMetadata,\n });\n files.set('metadata.json', { contents: JSON.stringify(contents) });\n }\n\n // Additional web-only steps...\n\n if (platforms.includes('web') && useServerRendering) {\n const exportServer = exp.web?.output === 'server';\n\n if (exportServer) {\n // TODO: Remove when this is abstracted into the files map\n await copyPublicFolderAsync(publicPath, path.resolve(outputPath, 'client'));\n }\n\n if (skipSSG) {\n Log.log('Skipping static site generation');\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: true,\n });\n\n // Output a placeholder index.html if one doesn't exist in the public directory.\n // This ensures native + API routes have some content at the root URL.\n const placeholderIndex = path.resolve(outputPath, 'client/index.html');\n if (!fs.existsSync(placeholderIndex)) {\n files.set('index.html', {\n contents: `<html><body></body></html>`,\n targetDomain: 'client',\n });\n }\n } else if (\n // TODO: Support static export with RSC.\n !devServer.isReactServerComponentsEnabled\n ) {\n await exportFromServerAsync(projectRoot, devServer, {\n mode,\n files,\n clear: !!clear,\n outputDir: outputPath,\n minify,\n baseUrl,\n includeSourceMaps: sourceMaps,\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n reactCompiler: !!exp.experiments?.reactCompiler,\n exportServer,\n maxWorkers,\n isExporting: true,\n exp: projectConfig.exp,\n });\n }\n }\n } finally {\n await devServerManager.stopAsync();\n }\n\n // Write all files at the end for unified logging.\n await persistMetroFilesAsync(files, outputPath);\n}\n"],"names":["exportAppAsync","projectRoot","platforms","outputDir","clear","dev","dumpAssetmap","sourceMaps","inlineSourceMaps","minify","bytecode","maxWorkers","skipSSG","hostedNative","exp","environment","process","env","NODE_ENV","setNodeEnv","loadEnvFiles","projectConfig","getConfig","getPublicExpoManifestAsync","skipValidation","length","includes","WebSupportProjectPrerequisite","assertAsync","useServerRendering","web","output","CommandError","baseUrl","getBaseUrlFromExpoConfig","Log","warn","log","chalk","gray","startsWith","yellow","mode","publicPath","path","resolve","EXPO_PUBLIC_FOLDER","outputPath","files","Map","devServerManager","DevServerManager","startMetroAsync","port","isExporting","location","resetDevServer","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","bundles","domComponentAssetsMetadata","spaPlatforms","isReactServerComponentsEnabled","filter","platform","copyPublicFolderAsync","join","error","templateHtml","Promise","all","map","isHermes","isEnableHermesManaged","assertEngineMismatchAsync","bundle","nativeExportBundleAsync","splitChunks","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","getEntryWithServerRoot","pkg","engine","undefined","serializerIncludeMaps","inlineSourceMap","reactCompiler","experiments","hosted","Error","exception","exit","getFilesFromSerialAssets","artifacts","includeSourceMaps","isServerHosted","expoDomComponentReferences","artifact","Array","isArray","metadata","flat","filePath","platformDomComponentsBundle","htmlOutputName","exportDomComponentAsync","useMd5Filename","assets","push","transformNativeBundleForMd5Filename","domComponentReference","nativeBundle","addDomBundleToMetadataAsync","transformDomEntryForMd5Filename","html","serializeHtmlWithAssets","resources","template","createTemplateHtmlFromExpoConfigAsync","scripts","cssLinks","modifyHtml","getVirtualFaviconAssetsAsync","set","contents","targetDomain","isWeb","exportApiRoutesStandaloneAsync","apiRoutesOnly","embeddedHashSet","exportAssetsAsync","JSON","stringify","createAssetMap","fileNames","Object","fromEntries","entries","asset","type","filename","createMetadataJson","exportServer","placeholderIndex","fs","existsSync","exportFromServerAsync","routerRoot","getRouterDirectoryModuleIdWithManifest","stopAsync","persistMetroFilesAsync"],"mappings":";;;;+BA+CsBA;;;eAAAA;;;;yBA/CI;;;;;;;gEAGP;;;;;;;gEACD;;;;;;;gEACH;;;;;;;gEACE;;;;;;oCAEyC;8BACxB;qCAM3B;8BAC0D;mCAK1D;yBACsC;uCACF;8BACL;4BAQ/B;+BACwB;6DACV;+CACyB;kCACb;uCACK;wBACiB;+BACf;oCACD;8BACE;6BACa;qBAClC;wBACS;yBACY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElC,eAAeA,eACpBC,WAAmB,EACnB,EACEC,SAAS,EACTC,SAAS,EACTC,KAAK,EACLC,GAAG,EACHC,YAAY,EACZC,UAAU,EACVC,gBAAgB,EAChBC,MAAM,EACNC,QAAQ,EACRC,UAAU,EACVC,OAAO,EACPC,YAAY,EAeb;QAkBwDC,UA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AAO,CAACE,YAAY;YACnE;YAEA,IAAInC,SAAS;gBACXuB,KAAIE,GAAG,CAAC;gBACR,MAAM4F,IAAAA,iDAA8B,EAACxE,WAAW;oBAC9CT;oBACAkB,UAAU;oBACVgE,eAAe;gBACjB;gBAEA,gFAAgF;gBAChF,sEAAsE;gBACtE,MAAMe,mBAAmBrG,eAAI,CAACC,OAAO,CAACE,YAAY;gBAClD,IAAI,CAACmG,aAAE,CAACC,UAAU,CAACF,mBAAmB;oBACpCjG,MAAM6E,GAAG,CAAC,cAAc;wBACtBC,UAAU,CAAC,0BAA0B,CAAC;wBACtCC,cAAc;oBAChB;gBACF;YACF,OAAO,IACL,wCAAwC;YACxC,CAACtE,UAAUO,8BAA8B,EACzC;oBAUmBlD;gBATnB,MAAMsI,IAAAA,wCAAqB,EAACnJ,aAAawD,WAAW;oBAClDf;oBACAM;oBACA5C,OAAO,CAAC,CAACA;oBACTD,WAAW4C;oBACXtC;oBACAwB;oBACA+D,mBAAmBzF;oBACnB8I,YAAYC,IAAAA,8CAAsC,EAACrJ,aAAaa;oBAChE0E,eAAe,CAAC,GAAC1E,mBAAAA,IAAI2E,WAAW,qBAAf3E,iBAAiB0E,aAAa;oBAC/CwD;oBACArI;oBACA2C,aAAa;oBACbxC,KAAKO,cAAcP,GAAG;gBACxB;YACF;QACF;IACF,SAAU;QACR,MAAMoC,iBAAiBqG,SAAS;IAClC;IAEA,kDAAkD;IAClD,MAAMC,IAAAA,kCAAsB,EAACxG,OAAOD;AACtC"}
@@ -40,13 +40,6 @@ function _chalk() {
40
40
  };
41
41
  return data;
42
42
  }
43
- function _utils() {
44
- const data = require("expo-router/build/loaders/utils");
45
- _utils = function() {
46
- return data;
47
- };
48
- return data;
49
- }
50
43
  function _matchers() {
51
44
  const data = require("expo-router/build/matchers");
52
45
  _matchers = function() {
@@ -231,16 +224,19 @@ async function exportFromServerAsync(projectRoot, devServer, { outputDir, baseUr
231
224
  const loaderResponse = await executeLoaderAsync(normalizedPathname, route);
232
225
  if (loaderResponse !== undefined) {
233
226
  const data = await loaderResponse.json();
234
- const loaderPath = (0, _utils().getLoaderModulePath)(normalizedPathname);
235
- const fileSystemPath = loaderPath.startsWith('/') ? loaderPath.slice(1) : loaderPath;
227
+ // Transforms a `route.contextKey` into a normalized path. For example,
228
+ // `./nested/[id]/index.tsx` becomes `/nested/[id]/index`
229
+ const loaderKey = (0, _matchers().getContextKey)(route.contextKey);
230
+ const fileSystemPath = `_expo/loaders${loaderKey}`;
236
231
  files.set(fileSystemPath, {
237
232
  contents: JSON.stringify(data, null, 2),
238
233
  targetDomain: 'client',
239
- loaderId: normalizedPathname
234
+ loaderId: loaderKey
240
235
  });
241
236
  renderOpts = {
242
237
  loader: {
243
- data
238
+ data,
239
+ key: loaderKey
244
240
  }
245
241
  };
246
242
  }