@expo/cli 0.22.8 → 0.22.10

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 (58) hide show
  1. package/build/bin/cli +1 -1
  2. package/build/src/api/rest/client.js +2 -0
  3. package/build/src/api/rest/client.js.map +1 -1
  4. package/build/src/export/embed/exportEmbedAsync.js +3 -3
  5. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  6. package/build/src/export/embed/exportServer.js +13 -9
  7. package/build/src/export/embed/exportServer.js.map +1 -1
  8. package/build/src/export/embed/index.js +4 -0
  9. package/build/src/export/embed/index.js.map +1 -1
  10. package/build/src/export/embed/resolveOptions.js +2 -1
  11. package/build/src/export/embed/resolveOptions.js.map +1 -1
  12. package/build/src/export/embed/xcodeCompilerLogger.js +1 -0
  13. package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -1
  14. package/build/src/export/exportApp.js +27 -12
  15. package/build/src/export/exportApp.js.map +1 -1
  16. package/build/src/export/exportStaticAsync.js +18 -2
  17. package/build/src/export/exportStaticAsync.js.map +1 -1
  18. package/build/src/export/publicFolder.js +6 -1
  19. package/build/src/export/publicFolder.js.map +1 -1
  20. package/build/src/export/saveAssets.js +1 -1
  21. package/build/src/export/saveAssets.js.map +1 -1
  22. package/build/src/install/index.js +1 -0
  23. package/build/src/install/index.js.map +1 -1
  24. package/build/src/install/installAsync.js +2 -1
  25. package/build/src/install/installAsync.js.map +1 -1
  26. package/build/src/install/installExpoPackage.js +14 -6
  27. package/build/src/install/installExpoPackage.js.map +1 -1
  28. package/build/src/install/resolveOptions.js +2 -0
  29. package/build/src/install/resolveOptions.js.map +1 -1
  30. package/build/src/serve/serveAsync.js +4 -2
  31. package/build/src/serve/serveAsync.js.map +1 -1
  32. package/build/src/start/doctor/dependencies/getVersionedPackages.js +4 -0
  33. package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
  34. package/build/src/start/server/getStaticRenderFunctions.js +2 -1
  35. package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
  36. package/build/src/start/server/metro/MetroBundlerDevServer.js +105 -55
  37. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  38. package/build/src/start/server/metro/createJResolver.js +15 -5
  39. package/build/src/start/server/metro/createJResolver.js.map +1 -1
  40. package/build/src/start/server/metro/createServerComponentsMiddleware.js +28 -4
  41. package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
  42. package/build/src/start/server/metro/metroErrorInterface.js +5 -1
  43. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
  44. package/build/src/start/server/metro/withMetroMultiPlatform.js +2 -1
  45. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  46. package/build/src/start/server/middleware/ManifestMiddleware.js +6 -3
  47. package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
  48. package/build/src/start/server/middleware/metroOptions.js +1 -1
  49. package/build/src/start/server/middleware/metroOptions.js.map +1 -1
  50. package/build/src/start/startAsync.js +1 -1
  51. package/build/src/start/startAsync.js.map +1 -1
  52. package/build/src/utils/env.js +9 -0
  53. package/build/src/utils/env.js.map +1 -1
  54. package/build/src/utils/ip.js +8 -1
  55. package/build/src/utils/ip.js.map +1 -1
  56. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  57. package/build/src/utils/telemetry/utils/context.js +1 -1
  58. package/package.json +16 -16
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/export/embed/xcodeCompilerLogger.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 fs from 'fs';\nimport path from 'path';\n\nimport { Log } from '../../log';\n\nfunction isPossiblyUnableToResolveError(\n error: any\n): error is { message: string; originModulePath: string; targetModuleName: string } {\n return (\n 'message' in error &&\n typeof error.message === 'string' &&\n 'originModulePath' in error &&\n typeof error.originModulePath === 'string' &&\n 'targetModuleName' in error &&\n typeof error.targetModuleName === 'string'\n );\n}\nfunction isPossiblyTransformError(\n error: any\n): error is { message: string; filename: string; lineNumber: number; column?: number } {\n return (\n 'message' in error &&\n typeof error.message === 'string' &&\n 'filename' in error &&\n typeof error.filename === 'string' &&\n 'lineNumber' in error &&\n typeof error.lineNumber === 'number'\n );\n}\n\nexport function getXcodeCompilerErrorMessage(\n projectRoot: string,\n error: Error | any\n): string | null {\n const makeFilepathAbsolute = (filepath: string) =>\n filepath.startsWith('/') ? filepath : path.join(projectRoot, filepath);\n\n if (typeof error === 'string') {\n return makeXcodeCompilerLog('error', error);\n } else if ('message' in error) {\n // Metro's `UnableToResolveError`\n if (isPossiblyUnableToResolveError(error)) {\n const loc = getLineNumberForStringInFile(error.originModulePath, error.targetModuleName);\n return makeXcodeCompilerLog('error', error.message, {\n fileName: error.originModulePath,\n lineNumber: loc?.lineNumber,\n column: loc?.column,\n });\n } else if (isPossiblyTransformError(error)) {\n return makeXcodeCompilerLog('error', error.message, {\n // Metro generally returns the filename as relative from the project root.\n fileName: makeFilepathAbsolute(error.filename),\n lineNumber: error.lineNumber,\n column: error.column,\n });\n // TODO: ResourceNotFoundError, GraphNotFoundError, RevisionNotFoundError, AmbiguousModuleResolutionError\n } else {\n // Unknown error\n return makeXcodeCompilerLog('error', error.message);\n }\n }\n\n return null;\n}\n\n/** Log an error that can be parsed by Xcode and related build tools https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script */\nexport function logMetroErrorInXcode(projectRoot: string, error: Error | string) {\n const message = getXcodeCompilerErrorMessage(projectRoot, error);\n if (message != null) {\n console.error(message);\n }\n}\n\nexport function logInXcode(message: string) {\n Log.log(makeXcodeCompilerLog('note', message));\n}\n\nexport function warnInXcode(message: string) {\n Log.warn(makeXcodeCompilerLog('warning', message));\n}\n\n// Detect running in xcode build script. This means the logs need to be formatted in a way that Xcode can parse them, it also means that the shell is not reliable or interactive.\n// https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Access-script-related-files-from-environment-variables\nexport function isExecutingFromXcodebuild() {\n return !!process.env.BUILT_PRODUCTS_DIR;\n}\n\nfunction makeXcodeCompilerLog(\n type: 'error' | 'fatal error' | 'warning' | 'note',\n message: string,\n {\n fileName,\n lineNumber,\n column,\n }: {\n /** Absolute file path to link to in Xcode. */\n fileName?: string;\n lineNumber?: number;\n column?: number;\n } = {}\n) {\n if (!isExecutingFromXcodebuild()) {\n return message;\n }\n // TODO: Figure out how to support multi-line logs.\n const firstLine = message.split('\\n')[0];\n if (fileName && !fileName?.includes(':')) {\n return `${fileName}:${lineNumber || 0}:${\n column != null ? column + ':' : ''\n } ${type}: ${firstLine}`;\n }\n return `${type}: ${firstLine}`;\n}\n\n// TODO: Metro doesn't expose this info even though it knows it.\nfunction getLineNumberForStringInFile(originModulePath: string, targetModuleName: string) {\n let file;\n try {\n file = fs.readFileSync(originModulePath, 'utf8');\n } catch (error: any) {\n if (error.code === 'ENOENT' || error.code === 'EISDIR') {\n // We're probably dealing with a virtualised file system where\n // `this.originModulePath` doesn't actually exist on disk.\n // We can't show a code frame, but there's no need to let this I/O\n // error shadow the original module resolution error.\n return null;\n }\n throw error;\n }\n const lines = file.split('\\n');\n let lineNumber = 0;\n let column = -1;\n for (let line = 0; line < lines.length; line++) {\n const columnLocation = lines[line].lastIndexOf(targetModuleName);\n if (columnLocation >= 0) {\n lineNumber = line;\n column = columnLocation;\n break;\n }\n }\n return { lineNumber, column };\n}\n"],"names":["getXcodeCompilerErrorMessage","logMetroErrorInXcode","logInXcode","warnInXcode","isExecutingFromXcodebuild","isPossiblyUnableToResolveError","error","message","originModulePath","targetModuleName","isPossiblyTransformError","filename","lineNumber","projectRoot","makeFilepathAbsolute","filepath","startsWith","path","join","makeXcodeCompilerLog","loc","getLineNumberForStringInFile","fileName","column","console","Log","log","warn","process","env","BUILT_PRODUCTS_DIR","type","firstLine","split","includes","file","fs","readFileSync","code","lines","line","length","columnLocation","lastIndexOf"],"mappings":"AAAA;;;;;CAKC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OF,KAAK,EAAO;QACnB,IAAIA,KAAK,CAACgC,IAAI,KAAK,QAAQ,IAAIhC,KAAK,CAACgC,IAAI,KAAK,QAAQ,EAAE;YACtD,8DAA8D;YAC9D,0DAA0D;YAC1D,kEAAkE;YAClE,qDAAqD;YACrD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAMhC,KAAK,CAAC;IACd,CAAC;IACD,MAAMiC,KAAK,GAAGJ,IAAI,CAACF,KAAK,CAAC,IAAI,CAAC,AAAC;IAC/B,IAAIrB,UAAU,GAAG,CAAC,AAAC;IACnB,IAAIW,MAAM,GAAG,CAAC,CAAC,AAAC;IAChB,IAAK,IAAIiB,IAAI,GAAG,CAAC,EAAEA,IAAI,GAAGD,KAAK,CAACE,MAAM,EAAED,IAAI,EAAE,CAAE;QAC9C,MAAME,cAAc,GAAGH,KAAK,CAACC,IAAI,CAAC,CAACG,WAAW,CAAClC,gBAAgB,CAAC,AAAC;QACjE,IAAIiC,cAAc,IAAI,CAAC,EAAE;YACvB9B,UAAU,GAAG4B,IAAI,CAAC;YAClBjB,MAAM,GAAGmB,cAAc,CAAC;YACxB,MAAM;QACR,CAAC;IACH,CAAC;IACD,OAAO;QAAE9B,UAAU;QAAEW,MAAM;KAAE,CAAC;AAChC,CAAC"}
1
+ {"version":3,"sources":["../../../../src/export/embed/xcodeCompilerLogger.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 fs from 'fs';\nimport path from 'path';\n\nimport { Log } from '../../log';\n\nexport function isPossiblyUnableToResolveError(\n error: any\n): error is { message: string; originModulePath: string; targetModuleName: string } {\n return (\n 'message' in error &&\n typeof error.message === 'string' &&\n 'originModulePath' in error &&\n typeof error.originModulePath === 'string' &&\n 'targetModuleName' in error &&\n typeof error.targetModuleName === 'string'\n );\n}\nfunction isPossiblyTransformError(\n error: any\n): error is { message: string; filename: string; lineNumber: number; column?: number } {\n return (\n 'message' in error &&\n typeof error.message === 'string' &&\n 'filename' in error &&\n typeof error.filename === 'string' &&\n 'lineNumber' in error &&\n typeof error.lineNumber === 'number'\n );\n}\n\nexport function getXcodeCompilerErrorMessage(\n projectRoot: string,\n error: Error | any\n): string | null {\n const makeFilepathAbsolute = (filepath: string) =>\n filepath.startsWith('/') ? filepath : path.join(projectRoot, filepath);\n\n if (typeof error === 'string') {\n return makeXcodeCompilerLog('error', error);\n } else if ('message' in error) {\n // Metro's `UnableToResolveError`\n if (isPossiblyUnableToResolveError(error)) {\n const loc = getLineNumberForStringInFile(error.originModulePath, error.targetModuleName);\n return makeXcodeCompilerLog('error', error.message, {\n fileName: error.originModulePath,\n lineNumber: loc?.lineNumber,\n column: loc?.column,\n });\n } else if (isPossiblyTransformError(error)) {\n return makeXcodeCompilerLog('error', error.message, {\n // Metro generally returns the filename as relative from the project root.\n fileName: makeFilepathAbsolute(error.filename),\n lineNumber: error.lineNumber,\n column: error.column,\n });\n // TODO: ResourceNotFoundError, GraphNotFoundError, RevisionNotFoundError, AmbiguousModuleResolutionError\n } else {\n // Unknown error\n return makeXcodeCompilerLog('error', error.message);\n }\n }\n\n return null;\n}\n\n/** Log an error that can be parsed by Xcode and related build tools https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script */\nexport function logMetroErrorInXcode(projectRoot: string, error: Error | string) {\n const message = getXcodeCompilerErrorMessage(projectRoot, error);\n if (message != null) {\n console.error(message);\n }\n}\n\nexport function logInXcode(message: string) {\n Log.log(makeXcodeCompilerLog('note', message));\n}\n\nexport function warnInXcode(message: string) {\n Log.warn(makeXcodeCompilerLog('warning', message));\n}\n\n// Detect running in xcode build script. This means the logs need to be formatted in a way that Xcode can parse them, it also means that the shell is not reliable or interactive.\n// https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Access-script-related-files-from-environment-variables\nexport function isExecutingFromXcodebuild() {\n return !!process.env.BUILT_PRODUCTS_DIR;\n}\n\nfunction makeXcodeCompilerLog(\n type: 'error' | 'fatal error' | 'warning' | 'note',\n message: string,\n {\n fileName,\n lineNumber,\n column,\n }: {\n /** Absolute file path to link to in Xcode. */\n fileName?: string;\n lineNumber?: number;\n column?: number;\n } = {}\n) {\n if (!isExecutingFromXcodebuild()) {\n return message;\n }\n // TODO: Figure out how to support multi-line logs.\n const firstLine = message.split('\\n')[0];\n if (fileName && !fileName?.includes(':')) {\n return `${fileName}:${lineNumber || 0}:${\n column != null ? column + ':' : ''\n } ${type}: ${firstLine}`;\n }\n return `${type}: ${firstLine}`;\n}\n\n// TODO: Metro doesn't expose this info even though it knows it.\nfunction getLineNumberForStringInFile(originModulePath: string, targetModuleName: string) {\n let file;\n try {\n file = fs.readFileSync(originModulePath, 'utf8');\n } catch (error: any) {\n if (error.code === 'ENOENT' || error.code === 'EISDIR') {\n // We're probably dealing with a virtualised file system where\n // `this.originModulePath` doesn't actually exist on disk.\n // We can't show a code frame, but there's no need to let this I/O\n // error shadow the original module resolution error.\n return null;\n }\n throw error;\n }\n const lines = file.split('\\n');\n let lineNumber = 0;\n let column = -1;\n for (let line = 0; line < lines.length; line++) {\n const columnLocation = lines[line].lastIndexOf(targetModuleName);\n if (columnLocation >= 0) {\n lineNumber = line;\n column = columnLocation;\n break;\n }\n }\n return { lineNumber, column };\n}\n"],"names":["isPossiblyUnableToResolveError","getXcodeCompilerErrorMessage","logMetroErrorInXcode","logInXcode","warnInXcode","isExecutingFromXcodebuild","error","message","originModulePath","targetModuleName","isPossiblyTransformError","filename","lineNumber","projectRoot","makeFilepathAbsolute","filepath","startsWith","path","join","makeXcodeCompilerLog","loc","getLineNumberForStringInFile","fileName","column","console","Log","log","warn","process","env","BUILT_PRODUCTS_DIR","type","firstLine","split","includes","file","fs","readFileSync","code","lines","line","length","columnLocation","lastIndexOf"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAKgBA,8BAA8B,MAA9BA,8BAA8B;IAyB9BC,4BAA4B,MAA5BA,4BAA4B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,QAAQ,IAAIhC,KAAK,CAACgC,IAAI,KAAK,QAAQ,EAAE;YACtD,8DAA8D;YAC9D,0DAA0D;YAC1D,kEAAkE;YAClE,qDAAqD;YACrD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAMhC,KAAK,CAAC;IACd,CAAC;IACD,MAAMiC,KAAK,GAAGJ,IAAI,CAACF,KAAK,CAAC,IAAI,CAAC,AAAC;IAC/B,IAAIrB,UAAU,GAAG,CAAC,AAAC;IACnB,IAAIW,MAAM,GAAG,CAAC,CAAC,AAAC;IAChB,IAAK,IAAIiB,IAAI,GAAG,CAAC,EAAEA,IAAI,GAAGD,KAAK,CAACE,MAAM,EAAED,IAAI,EAAE,CAAE;QAC9C,MAAME,cAAc,GAAGH,KAAK,CAACC,IAAI,CAAC,CAACG,WAAW,CAAClC,gBAAgB,CAAC,AAAC;QACjE,IAAIiC,cAAc,IAAI,CAAC,EAAE;YACvB9B,UAAU,GAAG4B,IAAI,CAAC;YAClBjB,MAAM,GAAGmB,cAAc,CAAC;YACxB,MAAM;QACR,CAAC;IACH,CAAC;IACD,OAAO;QAAE9B,UAAU;QAAEW,MAAM;KAAE,CAAC;AAChC,CAAC"}
@@ -157,11 +157,24 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
157
157
  (0, _assert().default)(devServer instanceof _metroBundlerDevServer.MetroBundlerDevServer);
158
158
  const bundles = {};
159
159
  const domComponentAssetsMetadata = {};
160
- const spaPlatforms = useServerRendering ? platforms.filter((platform)=>platform !== "web") : platforms;
160
+ const spaPlatforms = // TODO: Support server and static rendering for server component exports.
161
+ useServerRendering && !devServer.isReactServerComponentsEnabled ? platforms.filter((platform)=>platform !== "web") : platforms;
161
162
  try {
162
- // NOTE(kitten): The public folder is currently always copied, regardless of targetDomain
163
- // split. Hence, there's another separate `copyPublicFolderAsync` call below for `web`
164
- await (0, _publicFolder.copyPublicFolderAsync)(publicPath, outputPath);
163
+ if (devServer.isReactServerComponentsEnabled) {
164
+ // In RSC mode, we only need these to be in the client dir.
165
+ // TODO: Merge back with other copy after we add SSR.
166
+ try {
167
+ await (0, _publicFolder.copyPublicFolderAsync)(publicPath, _path().default.join(outputPath, "client"));
168
+ } catch (error) {
169
+ _log.error("Failed to copy public directory to dist directory");
170
+ throw error;
171
+ }
172
+ } else {
173
+ // NOTE(kitten): The public folder is currently always copied, regardless of targetDomain
174
+ // split. Hence, there's another separate `copyPublicFolderAsync` call below for `web`
175
+ await (0, _publicFolder.copyPublicFolderAsync)(publicPath, outputPath);
176
+ }
177
+ let templateHtml;
165
178
  // Can be empty during web-only SSG.
166
179
  if (spaPlatforms.length) {
167
180
  await Promise.all(spaPlatforms.map(async (platform)=>{
@@ -243,6 +256,8 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
243
256
  if (modifyHtml) {
244
257
  html = modifyHtml(html);
245
258
  }
259
+ // HACK: This is used for adding SSR shims in React Server Components.
260
+ templateHtml = html;
246
261
  // Generate SPA-styled HTML file.
247
262
  // If web exists, then write the template HTML file.
248
263
  files.set("index.html", {
@@ -253,13 +268,12 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
253
268
  }));
254
269
  if (devServer.isReactServerComponentsEnabled) {
255
270
  const isWeb = platforms.includes("web");
256
- if (!(isWeb && useServerRendering)) {
257
- await (0, _exportStaticAsync.exportApiRoutesStandaloneAsync)(devServer, {
258
- files,
259
- platform: "web",
260
- apiRoutesOnly: !isWeb
261
- });
262
- }
271
+ await (0, _exportStaticAsync.exportApiRoutesStandaloneAsync)(devServer, {
272
+ files,
273
+ platform: "web",
274
+ apiRoutesOnly: !isWeb,
275
+ templateHtml
276
+ });
263
277
  }
264
278
  // TODO: Use same asset system across platforms again.
265
279
  const { assets , embeddedHashSet } = await (0, _exportAssets.exportAssetsAsync)(projectRoot, {
@@ -317,7 +331,8 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
317
331
  targetDomain: "client"
318
332
  });
319
333
  }
320
- } else {
334
+ } else if (// TODO: Support static export with RSC.
335
+ !devServer.isReactServerComponentsEnabled) {
321
336
  var ref3;
322
337
  await (0, _exportStaticAsync.exportFromServerAsync)(projectRoot, devServer, {
323
338
  mode,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport type { Platform } from '@expo/config';\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 exportDomComponentAsync,\n updateDomComponentAssetsForMD5Naming,\n} from './exportDomComponents';\nimport { assertEngineMismatchAsync, isEnableHermesManaged } from './exportHermes';\nimport { exportApiRoutesStandaloneAsync, exportFromServerAsync } 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} 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 minify,\n bytecode,\n maxWorkers,\n skipSSG,\n }: Pick<\n Options,\n | 'dumpAssetmap'\n | 'sourceMaps'\n | 'dev'\n | 'clear'\n | 'outputDir'\n | 'platforms'\n | 'minify'\n | 'bytecode'\n | 'maxWorkers'\n | 'skipSSG'\n >\n): Promise<void> {\n setNodeEnv(dev ? 'development' : 'production');\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 = useServerRendering\n ? platforms.filter((platform) => platform !== 'web')\n : platforms;\n\n try {\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 // 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 // Run metro bundler and create the JS bundles/source maps.\n const bundle = await devServer.nativeExportBundleAsync(\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,\n bytecode: bytecode && isHermes,\n reactCompiler: !!exp.experiments?.reactCompiler,\n },\n files\n );\n\n bundles[platform] = bundle;\n domComponentAssetsMetadata[platform] = [];\n\n getFilesFromSerialAssets(bundle.artifacts, {\n includeSourceMaps: sourceMaps,\n files,\n isServerHosted: devServer.isReactServerComponentsEnabled,\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 });\n\n // Merge the assets from the DOM component into the output assets.\n // @ts-expect-error: mutate assets\n bundle.assets.push(...platformDomComponentsBundle.assets);\n\n const assetsMetadata = updateDomComponentAssetsForMD5Naming({\n domComponentReference: filePath,\n nativeBundle: bundle,\n domComponentBundle: platformDomComponentsBundle,\n files,\n htmlOutputName,\n });\n domComponentAssetsMetadata[platform]?.push(...assetsMetadata);\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 // 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 if (!(isWeb && useServerRendering)) {\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: !isWeb,\n });\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 });\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 {\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","minify","bytecode","maxWorkers","skipSSG","exp","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","env","EXPO_PUBLIC_FOLDER","outputPath","files","Map","devServerManager","DevServerManager","startMetroAsync","port","isExporting","location","resetDevServer","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","bundles","domComponentAssetsMetadata","spaPlatforms","filter","platform","copyPublicFolderAsync","Promise","all","map","isHermes","isEnableHermesManaged","assertEngineMismatchAsync","bundle","nativeExportBundleAsync","splitChunks","EXPO_NO_BUNDLE_SPLITTING","isReactServerComponentsEnabled","mainModuleName","getEntryWithServerRoot","pkg","engine","undefined","serializerIncludeMaps","reactCompiler","experiments","getFilesFromSerialAssets","artifacts","includeSourceMaps","isServerHosted","expoDomComponentReferences","artifact","Array","isArray","metadata","flat","filePath","platformDomComponentsBundle","htmlOutputName","exportDomComponentAsync","assets","push","assetsMetadata","updateDomComponentAssetsForMD5Naming","domComponentReference","nativeBundle","domComponentBundle","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":"AAAA;;;;+BAuCsBA,gBAAc;;aAAdA,cAAc;;;yBAvCV,cAAc;;;;;;;8DAErB,QAAQ;;;;;;;8DACT,OAAO;;;;;;;8DACV,IAAI;;;;;;;8DACF,MAAM;;;;;;oCAEmC,sBAAsB;8BAC9C,gBAAgB;qCAI3C,uBAAuB;8BACmC,gBAAgB;mCACX,qBAAqB;yBAC9C,WAAW;uCACb,yBAAyB;8BAC9B,gBAAgB;4BAO/C,cAAc;+BACU,iBAAiB;2DAC3B,QAAQ;+CACiB,mDAAmD;kCAChE,kCAAkC;uCAC7B,6CAA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oBACVwC,WAAW,EAAE,IAAI;oBACjBtC,GAAG,EAAEI,aAAa,CAACJ,GAAG;iBACvB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,SAAU;QACR,MAAMkC,gBAAgB,CAAC4F,SAAS,EAAE,CAAC;IACrC,CAAC;IAED,kDAAkD;IAClD,MAAMC,IAAAA,WAAsB,uBAAA,EAAC/F,KAAK,EAAED,UAAU,CAAC,CAAC;AAClD,CAAC"}
1
+ {"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport type { Platform } from '@expo/config';\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 exportDomComponentAsync,\n updateDomComponentAssetsForMD5Naming,\n} from './exportDomComponents';\nimport { assertEngineMismatchAsync, isEnableHermesManaged } from './exportHermes';\nimport { exportApiRoutesStandaloneAsync, exportFromServerAsync } 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} 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 minify,\n bytecode,\n maxWorkers,\n skipSSG,\n }: Pick<\n Options,\n | 'dumpAssetmap'\n | 'sourceMaps'\n | 'dev'\n | 'clear'\n | 'outputDir'\n | 'platforms'\n | 'minify'\n | 'bytecode'\n | 'maxWorkers'\n | 'skipSSG'\n >\n): Promise<void> {\n setNodeEnv(dev ? 'development' : 'production');\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 // Run metro bundler and create the JS bundles/source maps.\n const bundle = await devServer.nativeExportBundleAsync(\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,\n bytecode: bytecode && isHermes,\n reactCompiler: !!exp.experiments?.reactCompiler,\n },\n files\n );\n\n bundles[platform] = bundle;\n domComponentAssetsMetadata[platform] = [];\n\n getFilesFromSerialAssets(bundle.artifacts, {\n includeSourceMaps: sourceMaps,\n files,\n isServerHosted: devServer.isReactServerComponentsEnabled,\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 });\n\n // Merge the assets from the DOM component into the output assets.\n // @ts-expect-error: mutate assets\n bundle.assets.push(...platformDomComponentsBundle.assets);\n\n const assetsMetadata = updateDomComponentAssetsForMD5Naming({\n domComponentReference: filePath,\n nativeBundle: bundle,\n domComponentBundle: platformDomComponentsBundle,\n files,\n htmlOutputName,\n });\n domComponentAssetsMetadata[platform]?.push(...assetsMetadata);\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 });\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","minify","bytecode","maxWorkers","skipSSG","exp","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","env","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","reactCompiler","experiments","getFilesFromSerialAssets","artifacts","includeSourceMaps","isServerHosted","expoDomComponentReferences","artifact","Array","isArray","metadata","flat","filePath","platformDomComponentsBundle","htmlOutputName","exportDomComponentAsync","assets","push","assetsMetadata","updateDomComponentAssetsForMD5Naming","domComponentReference","nativeBundle","domComponentBundle","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":"AAAA;;;;+BAuCsBA,gBAAc;;aAAdA,cAAc;;;yBAvCV,cAAc;;;;;;;8DAErB,QAAQ;;;;;;;8DACT,OAAO;;;;;;;8DACV,IAAI;;;;;;;8DACF,MAAM;;;;;;oCAEmC,sBAAsB;8BAC9C,gBAAgB;qCAI3C,uBAAuB;8BACmC,gBAAgB;mCACX,qBAAqB;yBAC9C,WAAW;uCACb,yBAAyB;8BAC9B,gBAAgB;4BAO/C,cAAc;+BACU,iBAAiB;2DAC3B,QAAQ;+CACiB,mDAAmD;kCAChE,kCAAkC;uCAC7B,6CAA6C;wBAC5B,8BAA8B;+BAC7C,qCAAqC;oCACtC,+CAA+C;8BAC7C,yCAAyC;6BAC5B,6BAA6B;qBAC/D,cAAc;wBACL,iBAAiB;yBACnB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtC,eAAeA,cAAc,CAClCC,WAAmB,EACnB,EACEC,SAAS,CAAA,EACTC,SAAS,CAAA,EACTC,KAAK,CAAA,EACLC,GAAG,CAAA,EACHC,YAAY,CAAA,EACZC,UAAU,CAAA,EACVC,MAAM,CAAA,EACNC,QAAQ,CAAA,EACRC,UAAU,CAAA,EACVC,OAAO,CAAA,EAaR,EACc;QAc0CC,GAAO,EAEjDA,IAAO;IAftBC,IAAAA,QAAU,WAAA,EAACR,GAAG,GAAG,aAAa,GAAG,YAAY,CAAC,CAAC;IAC/CS,OAAO,CAAC,WAAW,CAAC,CAACC,IAAI,CAACd,WAAW,CAAC,CAAC;IAEvC,MAAMe,aAAa,GAAGC,IAAAA,OAAS,EAAA,UAAA,EAAChB,WAAW,CAAC,AAAC;IAC7C,MAAMW,GAAG,GAAG,MAAMM,IAAAA,sBAA0B,2BAAA,EAACjB,WAAW,EAAE;Q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CAAC;AAClD,CAAC"}
@@ -331,8 +331,8 @@ function getPathVariations(routePath) {
331
331
  generateVariations(segments);
332
332
  return Array.from(variations);
333
333
  }
334
- async function exportApiRoutesStandaloneAsync(devServer, { files =new Map() , platform , apiRoutesOnly }) {
335
- const { serverManifest } = await devServer.getServerManifestAsync();
334
+ async function exportApiRoutesStandaloneAsync(devServer, { files =new Map() , platform , apiRoutesOnly , templateHtml }) {
335
+ const { serverManifest , htmlManifest } = await devServer.getServerManifestAsync();
336
336
  const apiRoutes = await exportApiRoutesAsync({
337
337
  server: devServer,
338
338
  manifest: serverManifest,
@@ -345,6 +345,22 @@ async function exportApiRoutesStandaloneAsync(devServer, { files =new Map() , pl
345
345
  for (const [route, contents] of apiRoutes){
346
346
  files.set(route, contents);
347
347
  }
348
+ if (templateHtml && devServer.isReactServerComponentsEnabled) {
349
+ // TODO: Export an HTML entry for each file. This is a temporary solution until we have SSR/SSG for RSC.
350
+ await getFilesToExportFromServerAsync(devServer.projectRoot, {
351
+ manifest: htmlManifest,
352
+ exportServer: true,
353
+ files,
354
+ renderAsync: async ({ pathname , filePath })=>{
355
+ files.set(filePath, {
356
+ contents: templateHtml,
357
+ routeId: pathname,
358
+ targetDomain: "server"
359
+ });
360
+ return templateHtml;
361
+ }
362
+ });
363
+ }
348
364
  return files;
349
365
  }
350
366
  async function exportApiRoutesAsync({ includeSourceMaps , server , platform , apiRoutesOnly , ...props }) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/exportStaticAsync.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ExpoConfig } from '@expo/config';\nimport chalk from 'chalk';\nimport { RouteNode } from 'expo-router/build/Route';\nimport { stripGroupSegmentsFromPath } from 'expo-router/build/matchers';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport { inspect } from 'util';\n\nimport { getVirtualFaviconAssetsAsync } from './favicon';\nimport { persistMetroAssetsAsync } from './persistMetroAssets';\nimport { ExportAssetMap, getFilesFromSerialAssets } from './saveAssets';\nimport { Log } from '../log';\nimport {\n ExpoRouterRuntimeManifest,\n MetroBundlerDevServer,\n} from '../start/server/metro/MetroBundlerDevServer';\nimport { ExpoRouterServerManifestV1 } from '../start/server/metro/fetchRouterManifest';\nimport { logMetroErrorAsync } from '../start/server/metro/metroErrorInterface';\nimport { getApiRoutesForDirectory } from '../start/server/metro/router';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport { learnMore } from '../utils/link';\n\nconst debug = require('debug')('expo:export:generateStaticRoutes') as typeof console.log;\n\ntype Options = {\n mode: 'production' | 'development';\n files?: ExportAssetMap;\n outputDir: string;\n minify: boolean;\n exportServer: boolean;\n baseUrl: string;\n includeSourceMaps: boolean;\n entryPoint?: string;\n clear: boolean;\n routerRoot: string;\n reactCompiler: boolean;\n maxWorkers?: number;\n isExporting: boolean;\n exp?: ExpoConfig;\n};\n\ntype HtmlRequestLocation = {\n /** The output file path name to use relative to the static folder. */\n filePath: string;\n /** The pathname to make requests to in order to fetch the HTML. */\n pathname: string;\n /** The runtime route node object, used to associate async modules with the static HTML. */\n route: RouteNode;\n};\n\n/** Match `(page)` -> `page` */\nfunction matchGroupName(name: string): string | undefined {\n return name.match(/^\\(([^/]+?)\\)$/)?.[1];\n}\n\nexport async function getFilesToExportFromServerAsync(\n projectRoot: string,\n {\n manifest,\n renderAsync,\n // Servers can handle group routes automatically and therefore\n // don't require the build-time generation of every possible group\n // variation.\n exportServer,\n // name : contents\n files = new Map(),\n }: {\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (requestLocation: HtmlRequestLocation) => Promise<string>;\n exportServer?: boolean;\n files?: ExportAssetMap;\n }\n): Promise<ExportAssetMap> {\n await Promise.all(\n getHtmlFiles({ manifest, includeGroupVariations: !exportServer }).map(\n async ({ route, filePath, pathname }) => {\n try {\n const targetDomain = exportServer ? 'server' : 'client';\n files.set(filePath, { contents: '', targetDomain });\n const data = await renderAsync({ route, filePath, pathname });\n files.set(filePath, {\n contents: data,\n routeId: pathname,\n targetDomain,\n });\n } catch (e: any) {\n await logMetroErrorAsync({ error: e, projectRoot });\n throw new Error('Failed to statically export route: ' + pathname);\n }\n }\n )\n );\n\n return files;\n}\n\nfunction modifyRouteNodeInRuntimeManifest(\n manifest: ExpoRouterRuntimeManifest,\n callback: (route: RouteNode) => any\n) {\n const iterateScreens = (screens: ExpoRouterRuntimeManifest['screens']) => {\n Object.values(screens).map((value) => {\n if (typeof value !== 'string') {\n if (value._route) callback(value._route);\n iterateScreens(value.screens);\n }\n });\n };\n\n iterateScreens(manifest.screens);\n}\n\n// TODO: Do this earlier in the process.\nfunction makeRuntimeEntryPointsAbsolute(manifest: ExpoRouterRuntimeManifest, appDir: string) {\n modifyRouteNodeInRuntimeManifest(manifest, (route) => {\n if (Array.isArray(route.entryPoints)) {\n route.entryPoints = route.entryPoints.map((entryPoint) => {\n if (entryPoint.startsWith('.')) {\n return path.resolve(appDir, entryPoint);\n } else if (!path.isAbsolute(entryPoint)) {\n return resolveFrom(appDir, entryPoint);\n }\n return entryPoint;\n });\n }\n });\n}\n\n/** Perform all fs commits */\nexport async function exportFromServerAsync(\n projectRoot: string,\n devServer: MetroBundlerDevServer,\n {\n outputDir,\n baseUrl,\n exportServer,\n includeSourceMaps,\n routerRoot,\n files = new Map(),\n exp,\n }: Options\n): Promise<ExportAssetMap> {\n Log.log(\n `Static rendering is enabled. ` +\n learnMore('https://docs.expo.dev/router/reference/static-rendering/')\n );\n\n const platform = 'web';\n const isExporting = true;\n const appDir = path.join(projectRoot, routerRoot);\n const injectFaviconTag = await getVirtualFaviconAssetsAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n exp,\n });\n\n const [resources, { manifest, serverManifest, renderAsync }] = await Promise.all([\n devServer.getStaticResourcesAsync({\n includeSourceMaps,\n }),\n devServer.getStaticRenderFunctionAsync(),\n ]);\n\n makeRuntimeEntryPointsAbsolute(manifest, appDir);\n\n debug('Routes:\\n', inspect(manifest, { colors: true, depth: null }));\n\n await getFilesToExportFromServerAsync(projectRoot, {\n files,\n manifest,\n exportServer,\n async renderAsync({ pathname, route }) {\n const template = await renderAsync(pathname);\n let html = await serializeHtmlWithAssets({\n isExporting,\n resources: resources.artifacts,\n template,\n baseUrl,\n route,\n hydrate: true,\n });\n\n if (injectFaviconTag) {\n html = injectFaviconTag(html);\n }\n\n return html;\n },\n });\n\n getFilesFromSerialAssets(resources.artifacts, {\n platform,\n includeSourceMaps,\n files,\n isServerHosted: true,\n });\n\n if (resources.assets) {\n // TODO: Collect files without writing to disk.\n // NOTE(kitten): Re. above, this is now using `files` except for iOS catalog output, which isn't used here\n await persistMetroAssetsAsync(projectRoot, resources.assets, {\n files,\n platform,\n outputDirectory: outputDir,\n baseUrl,\n });\n }\n\n if (exportServer) {\n const apiRoutes = await exportApiRoutesAsync({\n platform: 'web',\n server: devServer,\n manifest: serverManifest,\n // NOTE(kitten): For now, we always output source maps for API route exports\n includeSourceMaps: true,\n });\n\n // Add the api routes to the files to export.\n for (const [route, contents] of apiRoutes) {\n files.set(route, contents);\n }\n } else {\n warnPossibleInvalidExportType(appDir);\n }\n\n return files;\n}\n\nexport function getHtmlFiles({\n manifest,\n includeGroupVariations,\n}: {\n manifest: ExpoRouterRuntimeManifest;\n includeGroupVariations?: boolean;\n}): HtmlRequestLocation[] {\n const htmlFiles = new Set<Omit<HtmlRequestLocation, 'pathname'>>();\n\n function traverseScreens(\n screens: ExpoRouterRuntimeManifest['screens'],\n route: RouteNode | null,\n baseUrl = ''\n ) {\n for (const [key, value] of Object.entries(screens)) {\n let leaf: string | null = null;\n if (typeof value === 'string') {\n leaf = value;\n } else if (Object.keys(value.screens).length === 0) {\n // Ensure the trailing index is accounted for.\n if (key === value.path + '/index') {\n leaf = key;\n } else {\n leaf = value.path;\n }\n\n route = value._route ?? null;\n }\n\n if (leaf != null) {\n let filePath = baseUrl + leaf;\n\n if (leaf === '') {\n filePath =\n baseUrl === ''\n ? 'index'\n : baseUrl.endsWith('/')\n ? baseUrl + 'index'\n : baseUrl.slice(0, -1);\n } else if (\n // If the path is a collection of group segments leading to an index route, append `/index`.\n stripGroupSegmentsFromPath(filePath) === ''\n ) {\n filePath += '/index';\n }\n\n // This should never happen, the type of `string | object` originally comes from React Navigation.\n if (!route) {\n throw new Error(\n `Internal error: Route not found for \"${filePath}\" while collecting static export paths.`\n );\n }\n\n if (includeGroupVariations) {\n // TODO: Dedupe requests for alias routes.\n addOptionalGroups(filePath, route);\n } else {\n htmlFiles.add({\n filePath,\n route,\n });\n }\n } else if (typeof value === 'object' && value?.screens) {\n const newPath = baseUrl + value.path + '/';\n traverseScreens(value.screens, value._route ?? null, newPath);\n }\n }\n }\n\n function addOptionalGroups(path: string, route: RouteNode) {\n const variations = getPathVariations(path);\n for (const variation of variations) {\n htmlFiles.add({ filePath: variation, route });\n }\n }\n\n traverseScreens(manifest.screens, null);\n\n return uniqueBy(Array.from(htmlFiles), (value) => value.filePath).map((value) => {\n const parts = value.filePath.split('/');\n // Replace `:foo` with `[foo]` and `*foo` with `[...foo]`\n const partsWithGroups = parts.map((part) => {\n if (part === '*not-found') {\n return `+not-found`;\n } else if (part.startsWith(':')) {\n return `[${part.slice(1)}]`;\n } else if (part.startsWith('*')) {\n return `[...${part.slice(1)}]`;\n }\n return part;\n });\n const filePathLocation = partsWithGroups.join('/');\n const filePath = filePathLocation + '.html';\n return {\n ...value,\n filePath,\n pathname: filePathLocation.replace(/(\\/?index)?$/, ''),\n };\n });\n}\n\nfunction uniqueBy<T>(array: T[], key: (value: T) => string): T[] {\n const seen = new Set<string>();\n const result: T[] = [];\n for (const value of array) {\n const id = key(value);\n if (!seen.has(id)) {\n seen.add(id);\n result.push(value);\n }\n }\n return result;\n}\n\n// Given a route like `(foo)/bar/(baz)`, return all possible variations of the route.\n// e.g. `(foo)/bar/(baz)`, `(foo)/bar/baz`, `foo/bar/(baz)`, `foo/bar/baz`,\nexport function getPathVariations(routePath: string): string[] {\n const variations = new Set<string>();\n const segments = routePath.split('/');\n\n function generateVariations(segments: string[], current = ''): void {\n if (segments.length === 0) {\n if (current) variations.add(current);\n return;\n }\n\n const [head, ...rest] = segments;\n\n if (matchGroupName(head)) {\n const groups = head.slice(1, -1).split(',');\n\n if (groups.length > 1) {\n for (const group of groups) {\n // If there are multiple groups, recurse on each group.\n generateVariations([`(${group.trim()})`, ...rest], current);\n }\n return;\n } else {\n // Start a fork where this group is included\n generateVariations(rest, current ? `${current}/(${groups[0]})` : `(${groups[0]})`);\n // This code will continue and add paths without this group included`\n }\n } else if (current) {\n current = `${current}/${head}`;\n } else {\n current = head;\n }\n\n generateVariations(rest, current);\n }\n\n generateVariations(segments);\n\n return Array.from(variations);\n}\n\nexport async function exportApiRoutesStandaloneAsync(\n devServer: MetroBundlerDevServer,\n {\n files = new Map(),\n platform,\n apiRoutesOnly,\n }: {\n files?: ExportAssetMap;\n platform: string;\n apiRoutesOnly: boolean;\n }\n) {\n const { serverManifest } = await devServer.getServerManifestAsync();\n\n const apiRoutes = await exportApiRoutesAsync({\n server: devServer,\n manifest: serverManifest,\n // NOTE(kitten): For now, we always output source maps for API route exports\n includeSourceMaps: true,\n platform,\n apiRoutesOnly,\n });\n\n // Add the api routes to the files to export.\n for (const [route, contents] of apiRoutes) {\n files.set(route, contents);\n }\n\n return files;\n}\n\nasync function exportApiRoutesAsync({\n includeSourceMaps,\n server,\n platform,\n apiRoutesOnly,\n ...props\n}: Pick<Options, 'includeSourceMaps'> & {\n server: MetroBundlerDevServer;\n manifest: ExpoRouterServerManifestV1;\n platform: string;\n apiRoutesOnly?: boolean;\n}): Promise<ExportAssetMap> {\n const { manifest, files } = await server.exportExpoRouterApiRoutesAsync({\n outputDir: '_expo/functions',\n prerenderManifest: props.manifest,\n includeSourceMaps,\n platform,\n });\n\n // HACK: Clear out the HTML and 404 routes if we're only exporting API routes. This is used for native apps that are using API routes but haven't implemented web support yet.\n if (apiRoutesOnly) {\n manifest.htmlRoutes = [];\n manifest.notFoundRoutes = [];\n }\n\n files.set('_expo/routes.json', {\n contents: JSON.stringify(manifest, null, 2),\n targetDomain: 'server',\n });\n\n return files;\n}\n\nfunction warnPossibleInvalidExportType(appDir: string) {\n const apiRoutes = getApiRoutesForDirectory(appDir);\n if (apiRoutes.length) {\n // TODO: Allow API Routes for native-only.\n Log.warn(\n chalk.yellow`Skipping export for API routes because \\`web.output\\` is not \"server\". You may want to remove the routes: ${apiRoutes\n .map((v) => path.relative(appDir, v))\n .join(', ')}`\n );\n }\n}\n"],"names":["getFilesToExportFromServerAsync","exportFromServerAsync","getHtmlFiles","getPathVariations","exportApiRoutesStandaloneAsync","debug","require","matchGroupName","name","match","projectRoot","manifest","renderAsync","exportServer","files","Map","Promise","all","includeGroupVariations","map","route","filePath","pathname","targetDomain","set","contents","data","routeId","e","logMetroErrorAsync","error","Error","modifyRouteNodeInRuntimeManifest","callback","iterateScreens","screens","Object","values","value","_route","makeRuntimeEntryPointsAbsolute","appDir","Array","isArray","entryPoints","entryPoint","startsWith","path","resolve","isAbsolute","resolveFrom","devServer","outputDir","baseUrl","includeSourceMaps","routerRoot","exp","Log","log","learnMore","platform","isExporting","join","injectFaviconTag","getVirtualFaviconAssetsAsync","resources","serverManifest","getStaticResourcesAsync","getStaticRenderFunctionAsync","inspect","colors","depth","template","html","serializeHtmlWithAssets","artifacts","hydrate","getFilesFromSerialAssets","isServerHosted","assets","persistMetroAssetsAsync","outputDirectory","apiRoutes","exportApiRoutesAsync","server","warnPossibleInvalidExportType","htmlFiles","Set","traverseScreens","key","entries","leaf","keys","length","endsWith","slice","stripGroupSegmentsFromPath","addOptionalGroups","add","newPath","variations","variation","uniqueBy","from","parts","split","partsWithGroups","part","filePathLocation","replace","array","seen","result","id","has","push","routePath","segments","generateVariations","current","head","rest","groups","group","trim","apiRoutesOnly","getServerManifestAsync","props","exportExpoRouterApiRoutesAsync","prerenderManifest","htmlRoutes","notFoundRoutes","JSON","stringify","getApiRout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AAE,CAAC,CAAC;QAC3CY,YAAY,EAAE,QAAQ;KACvB,CAAC,CAAC;IAEH,OAAOT,KAAK,CAAC;AACf,CAAC;AAED,SAASuE,6BAA6B,CAAC5C,MAAc,EAAE;IACrD,MAAMyC,SAAS,GAAGoD,IAAAA,OAAwB,yBAAA,EAAC7F,MAAM,CAAC,AAAC;IACnD,IAAIyC,SAAS,CAACW,MAAM,EAAE;QACpB,0CAA0C;QAC1CpC,IAAG,IAAA,CAAC8E,IAAI,CACNC,MAAK,EAAA,QAAA,CAACC,MAAM,CAAC,0GAA0G,EAAEvD,SAAS,CAC/H/D,GAAG,CAAC,CAACuH,CAAC,GAAK3F,KAAI,EAAA,QAAA,CAAC4F,QAAQ,CAAClG,MAAM,EAAEiG,CAAC,CAAC,CAAC,CACpC5E,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAChB,CAAC;IACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"sources":["../../../src/export/exportStaticAsync.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ExpoConfig } from '@expo/config';\nimport chalk from 'chalk';\nimport { RouteNode } from 'expo-router/build/Route';\nimport { stripGroupSegmentsFromPath } from 'expo-router/build/matchers';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport { inspect } from 'util';\n\nimport { getVirtualFaviconAssetsAsync } from './favicon';\nimport { persistMetroAssetsAsync } from './persistMetroAssets';\nimport { ExportAssetMap, getFilesFromSerialAssets } from './saveAssets';\nimport { Log } from '../log';\nimport {\n ExpoRouterRuntimeManifest,\n MetroBundlerDevServer,\n} from '../start/server/metro/MetroBundlerDevServer';\nimport { ExpoRouterServerManifestV1 } from '../start/server/metro/fetchRouterManifest';\nimport { logMetroErrorAsync } from '../start/server/metro/metroErrorInterface';\nimport { getApiRoutesForDirectory } from '../start/server/metro/router';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport { learnMore } from '../utils/link';\n\nconst debug = require('debug')('expo:export:generateStaticRoutes') as typeof console.log;\n\ntype Options = {\n mode: 'production' | 'development';\n files?: ExportAssetMap;\n outputDir: string;\n minify: boolean;\n exportServer: boolean;\n baseUrl: string;\n includeSourceMaps: boolean;\n entryPoint?: string;\n clear: boolean;\n routerRoot: string;\n reactCompiler: boolean;\n maxWorkers?: number;\n isExporting: boolean;\n exp?: ExpoConfig;\n};\n\ntype HtmlRequestLocation = {\n /** The output file path name to use relative to the static folder. */\n filePath: string;\n /** The pathname to make requests to in order to fetch the HTML. */\n pathname: string;\n /** The runtime route node object, used to associate async modules with the static HTML. */\n route: RouteNode;\n};\n\n/** Match `(page)` -> `page` */\nfunction matchGroupName(name: string): string | undefined {\n return name.match(/^\\(([^/]+?)\\)$/)?.[1];\n}\n\nexport async function getFilesToExportFromServerAsync(\n projectRoot: string,\n {\n manifest,\n renderAsync,\n // Servers can handle group routes automatically and therefore\n // don't require the build-time generation of every possible group\n // variation.\n exportServer,\n // name : contents\n files = new Map(),\n }: {\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (requestLocation: HtmlRequestLocation) => Promise<string>;\n exportServer?: boolean;\n files?: ExportAssetMap;\n }\n): Promise<ExportAssetMap> {\n await Promise.all(\n getHtmlFiles({ manifest, includeGroupVariations: !exportServer }).map(\n async ({ route, filePath, pathname }) => {\n try {\n const targetDomain = exportServer ? 'server' : 'client';\n files.set(filePath, { contents: '', targetDomain });\n const data = await renderAsync({ route, filePath, pathname });\n files.set(filePath, {\n contents: data,\n routeId: pathname,\n targetDomain,\n });\n } catch (e: any) {\n await logMetroErrorAsync({ error: e, projectRoot });\n throw new Error('Failed to statically export route: ' + pathname);\n }\n }\n )\n );\n\n return files;\n}\n\nfunction modifyRouteNodeInRuntimeManifest(\n manifest: ExpoRouterRuntimeManifest,\n callback: (route: RouteNode) => any\n) {\n const iterateScreens = (screens: ExpoRouterRuntimeManifest['screens']) => {\n Object.values(screens).map((value) => {\n if (typeof value !== 'string') {\n if (value._route) callback(value._route);\n iterateScreens(value.screens);\n }\n });\n };\n\n iterateScreens(manifest.screens);\n}\n\n// TODO: Do this earlier in the process.\nfunction makeRuntimeEntryPointsAbsolute(manifest: ExpoRouterRuntimeManifest, appDir: string) {\n modifyRouteNodeInRuntimeManifest(manifest, (route) => {\n if (Array.isArray(route.entryPoints)) {\n route.entryPoints = route.entryPoints.map((entryPoint) => {\n if (entryPoint.startsWith('.')) {\n return path.resolve(appDir, entryPoint);\n } else if (!path.isAbsolute(entryPoint)) {\n return resolveFrom(appDir, entryPoint);\n }\n return entryPoint;\n });\n }\n });\n}\n\n/** Perform all fs commits */\nexport async function exportFromServerAsync(\n projectRoot: string,\n devServer: MetroBundlerDevServer,\n {\n outputDir,\n baseUrl,\n exportServer,\n includeSourceMaps,\n routerRoot,\n files = new Map(),\n exp,\n }: Options\n): Promise<ExportAssetMap> {\n Log.log(\n `Static rendering is enabled. ` +\n learnMore('https://docs.expo.dev/router/reference/static-rendering/')\n );\n\n const platform = 'web';\n const isExporting = true;\n const appDir = path.join(projectRoot, routerRoot);\n const injectFaviconTag = await getVirtualFaviconAssetsAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n exp,\n });\n\n const [resources, { manifest, serverManifest, renderAsync }] = await Promise.all([\n devServer.getStaticResourcesAsync({\n includeSourceMaps,\n }),\n devServer.getStaticRenderFunctionAsync(),\n ]);\n\n makeRuntimeEntryPointsAbsolute(manifest, appDir);\n\n debug('Routes:\\n', inspect(manifest, { colors: true, depth: null }));\n\n await getFilesToExportFromServerAsync(projectRoot, {\n files,\n manifest,\n exportServer,\n async renderAsync({ pathname, route }) {\n const template = await renderAsync(pathname);\n let html = await serializeHtmlWithAssets({\n isExporting,\n resources: resources.artifacts,\n template,\n baseUrl,\n route,\n hydrate: true,\n });\n\n if (injectFaviconTag) {\n html = injectFaviconTag(html);\n }\n\n return html;\n },\n });\n\n getFilesFromSerialAssets(resources.artifacts, {\n platform,\n includeSourceMaps,\n files,\n isServerHosted: true,\n });\n\n if (resources.assets) {\n // TODO: Collect files without writing to disk.\n // NOTE(kitten): Re. above, this is now using `files` except for iOS catalog output, which isn't used here\n await persistMetroAssetsAsync(projectRoot, resources.assets, {\n files,\n platform,\n outputDirectory: outputDir,\n baseUrl,\n });\n }\n\n if (exportServer) {\n const apiRoutes = await exportApiRoutesAsync({\n platform: 'web',\n server: devServer,\n manifest: serverManifest,\n // NOTE(kitten): For now, we always output source maps for API route exports\n includeSourceMaps: true,\n });\n\n // Add the api routes to the files to export.\n for (const [route, contents] of apiRoutes) {\n files.set(route, contents);\n }\n } else {\n warnPossibleInvalidExportType(appDir);\n }\n\n return files;\n}\n\nexport function getHtmlFiles({\n manifest,\n includeGroupVariations,\n}: {\n manifest: ExpoRouterRuntimeManifest;\n includeGroupVariations?: boolean;\n}): HtmlRequestLocation[] {\n const htmlFiles = new Set<Omit<HtmlRequestLocation, 'pathname'>>();\n\n function traverseScreens(\n screens: ExpoRouterRuntimeManifest['screens'],\n route: RouteNode | null,\n baseUrl = ''\n ) {\n for (const [key, value] of Object.entries(screens)) {\n let leaf: string | null = null;\n if (typeof value === 'string') {\n leaf = value;\n } else if (Object.keys(value.screens).length === 0) {\n // Ensure the trailing index is accounted for.\n if (key === value.path + '/index') {\n leaf = key;\n } else {\n leaf = value.path;\n }\n\n route = value._route ?? null;\n }\n\n if (leaf != null) {\n let filePath = baseUrl + leaf;\n\n if (leaf === '') {\n filePath =\n baseUrl === ''\n ? 'index'\n : baseUrl.endsWith('/')\n ? baseUrl + 'index'\n : baseUrl.slice(0, -1);\n } else if (\n // If the path is a collection of group segments leading to an index route, append `/index`.\n stripGroupSegmentsFromPath(filePath) === ''\n ) {\n filePath += '/index';\n }\n\n // This should never happen, the type of `string | object` originally comes from React Navigation.\n if (!route) {\n throw new Error(\n `Internal error: Route not found for \"${filePath}\" while collecting static export paths.`\n );\n }\n\n if (includeGroupVariations) {\n // TODO: Dedupe requests for alias routes.\n addOptionalGroups(filePath, route);\n } else {\n htmlFiles.add({\n filePath,\n route,\n });\n }\n } else if (typeof value === 'object' && value?.screens) {\n const newPath = baseUrl + value.path + '/';\n traverseScreens(value.screens, value._route ?? null, newPath);\n }\n }\n }\n\n function addOptionalGroups(path: string, route: RouteNode) {\n const variations = getPathVariations(path);\n for (const variation of variations) {\n htmlFiles.add({ filePath: variation, route });\n }\n }\n\n traverseScreens(manifest.screens, null);\n\n return uniqueBy(Array.from(htmlFiles), (value) => value.filePath).map((value) => {\n const parts = value.filePath.split('/');\n // Replace `:foo` with `[foo]` and `*foo` with `[...foo]`\n const partsWithGroups = parts.map((part) => {\n if (part === '*not-found') {\n return `+not-found`;\n } else if (part.startsWith(':')) {\n return `[${part.slice(1)}]`;\n } else if (part.startsWith('*')) {\n return `[...${part.slice(1)}]`;\n }\n return part;\n });\n const filePathLocation = partsWithGroups.join('/');\n const filePath = filePathLocation + '.html';\n return {\n ...value,\n filePath,\n pathname: filePathLocation.replace(/(\\/?index)?$/, ''),\n };\n });\n}\n\nfunction uniqueBy<T>(array: T[], key: (value: T) => string): T[] {\n const seen = new Set<string>();\n const result: T[] = [];\n for (const value of array) {\n const id = key(value);\n if (!seen.has(id)) {\n seen.add(id);\n result.push(value);\n }\n }\n return result;\n}\n\n// Given a route like `(foo)/bar/(baz)`, return all possible variations of the route.\n// e.g. `(foo)/bar/(baz)`, `(foo)/bar/baz`, `foo/bar/(baz)`, `foo/bar/baz`,\nexport function getPathVariations(routePath: string): string[] {\n const variations = new Set<string>();\n const segments = routePath.split('/');\n\n function generateVariations(segments: string[], current = ''): void {\n if (segments.length === 0) {\n if (current) variations.add(current);\n return;\n }\n\n const [head, ...rest] = segments;\n\n if (matchGroupName(head)) {\n const groups = head.slice(1, -1).split(',');\n\n if (groups.length > 1) {\n for (const group of groups) {\n // If there are multiple groups, recurse on each group.\n generateVariations([`(${group.trim()})`, ...rest], current);\n }\n return;\n } else {\n // Start a fork where this group is included\n generateVariations(rest, current ? `${current}/(${groups[0]})` : `(${groups[0]})`);\n // This code will continue and add paths without this group included`\n }\n } else if (current) {\n current = `${current}/${head}`;\n } else {\n current = head;\n }\n\n generateVariations(rest, current);\n }\n\n generateVariations(segments);\n\n return Array.from(variations);\n}\n\nexport async function exportApiRoutesStandaloneAsync(\n devServer: MetroBundlerDevServer,\n {\n files = new Map(),\n platform,\n apiRoutesOnly,\n templateHtml,\n }: {\n files?: ExportAssetMap;\n platform: string;\n apiRoutesOnly: boolean;\n templateHtml?: string;\n }\n) {\n const { serverManifest, htmlManifest } = await devServer.getServerManifestAsync();\n\n const apiRoutes = await exportApiRoutesAsync({\n server: devServer,\n manifest: serverManifest,\n // NOTE(kitten): For now, we always output source maps for API route exports\n includeSourceMaps: true,\n platform,\n apiRoutesOnly,\n });\n\n // Add the api routes to the files to export.\n for (const [route, contents] of apiRoutes) {\n files.set(route, contents);\n }\n\n if (templateHtml && devServer.isReactServerComponentsEnabled) {\n // TODO: Export an HTML entry for each file. This is a temporary solution until we have SSR/SSG for RSC.\n await getFilesToExportFromServerAsync(devServer.projectRoot, {\n manifest: htmlManifest,\n exportServer: true,\n files,\n renderAsync: async ({ pathname, filePath }) => {\n files.set(filePath, {\n contents: templateHtml!,\n routeId: pathname,\n targetDomain: 'server',\n });\n return templateHtml!;\n },\n });\n }\n\n return files;\n}\n\nasync function exportApiRoutesAsync({\n includeSourceMaps,\n server,\n platform,\n apiRoutesOnly,\n ...props\n}: Pick<Options, 'includeSourceMaps'> & {\n server: MetroBundlerDevServer;\n manifest: ExpoRouterServerManifestV1;\n platform: string;\n apiRoutesOnly?: boolean;\n}): Promise<ExportAssetMap> {\n const { manifest, files } = await server.exportExpoRouterApiRoutesAsync({\n outputDir: '_expo/functions',\n prerenderManifest: props.manifest,\n includeSourceMaps,\n platform,\n });\n\n // HACK: Clear out the HTML and 404 routes if we're only exporting API routes. This is used for native apps that are using API routes but haven't implemented web support yet.\n if (apiRoutesOnly) {\n manifest.htmlRoutes = [];\n manifest.notFoundRoutes = [];\n }\n\n files.set('_expo/routes.json', {\n contents: JSON.stringify(manifest, null, 2),\n targetDomain: 'server',\n });\n\n return files;\n}\n\nfunction warnPossibleInvalidExportType(appDir: string) {\n const apiRoutes = getApiRoutesForDirectory(appDir);\n if (apiRoutes.length) {\n // TODO: Allow API Routes for native-only.\n Log.warn(\n chalk.yellow`Skipping export for API routes because \\`web.output\\` is not \"server\". You may want to remove the routes: ${apiRoutes\n .map((v) => path.relative(appDir, v))\n .join(', ')}`\n );\n }\n}\n"],"names":["getFilesToExportFromServerAsync","exportFromServerAsync","getHtmlFiles","getPathVariations","exportApiRoutesStandaloneAsync","debug","require","matchGroupName","name","match","projectRoot","manifest","renderAsync","exportServer","files","Map","Promise","all","includeGroupVariations","map","route","filePath","pathname","targetDomain","set","contents","data","routeId","e","logMetroErrorAsync","error","Error","modifyRouteNodeInRuntimeManifest","callback","iterateScreens","screens","Object","values","value","_route","makeRuntimeEntryPointsAbsolute","appDir","Array","isArray","entryPoints","entryPoint","startsWith","path","resolve","isAbsolute","resolveFrom","devServer","outputDir","baseUrl","includeSourceMaps","routerRoot","exp","Log","log","learnMore","platform","isExporting","join","injectFaviconTag","getVirtualFaviconAssetsAsync","resources","serverManifest","getStaticResourcesAsync","getStaticRenderFunctionAsync","inspect","colors","depth","template","html","serializeHtmlWithAssets","artifacts","hydrate","getFilesFromSerialAssets","isServerHosted","assets","persistMetroAssetsAsync","outputDirectory","apiRoutes","exportApiRoutesAsync","server","warnPossibleInvalidExportType","htmlFiles","Set","traverseScreens","key","entries","leaf","keys","length","endsWith","slice","stripGroupSegmentsFromPath","addOptionalGroups","add","newPath","variations","variation","uniqueBy","from","parts","split","partsWithGroups","part","filePathLocation","replace","array","seen","result","id","has","push","routePath","segments","generateVariations","current","head","rest","groups","group","trim","apiRoutesOnly","templateHtml","htmlManifest","getServerManifestAsync","isReactServerComponentsEnabled","props","exportExpoRouterApiRoutesAsync","prerenderManifest","htmlRoutes","notFoundRoutes","JSON","stringify","getApiRout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a,CAAA,EACb,GAAGK,KAAK,EAMT,EAA2B;IAC1B,MAAM,EAAEvH,QAAQ,CAAA,EAAEG,KAAK,CAAA,EAAE,GAAG,MAAMsE,MAAM,CAAC+C,8BAA8B,CAAC;QACtE/E,SAAS,EAAE,iBAAiB;QAC5BgF,iBAAiB,EAAEF,KAAK,CAACvH,QAAQ;QACjC2C,iBAAiB;QACjBM,QAAQ;KACT,CAAC,AAAC;IAEH,8KAA8K;IAC9K,IAAIiE,aAAa,EAAE;QACjBlH,QAAQ,CAAC0H,UAAU,GAAG,EAAE,CAAC;QACzB1H,QAAQ,CAAC2H,cAAc,GAAG,EAAE,CAAC;IAC/B,CAAC;IAEDxH,KAAK,CAACU,GAAG,CAAC,mBAAmB,EAAE;QAC7BC,QAAQ,EAAE8G,IAAI,CAACC,SAAS,CAAC7H,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3CY,YAAY,EAAE,QAAQ;KACvB,CAAC,CAAC;IAEH,OAAOT,KAAK,CAAC;AACf,CAAC;AAED,SAASuE,6BAA6B,CAAC5C,MAAc,EAAE;IACrD,MAAMyC,SAAS,GAAGuD,IAAAA,OAAwB,yBAAA,EAAChG,MAAM,CAAC,AAAC;IACnD,IAAIyC,SAAS,CAACW,MAAM,EAAE;QACpB,0CAA0C;QAC1CpC,IAAG,IAAA,CAACiF,IAAI,CACNC,MAAK,EAAA,QAAA,CAACC,MAAM,CAAC,0GAA0G,EAAE1D,SAAS,CAC/H/D,GAAG,CAAC,CAAC0H,CAAC,GAAK9F,KAAI,EAAA,QAAA,CAAC+F,QAAQ,CAACrG,MAAM,EAAEoG,CAAC,CAAC,CAAC,CACpC/E,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAChB,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -47,7 +47,12 @@ function getUserDefinedFile(projectRoot, possiblePaths) {
47
47
  }
48
48
  async function copyPublicFolderAsync(publicFolder, outputFolder) {
49
49
  if (_fs().default.existsSync(publicFolder)) {
50
- await (0, _dir.copyAsync)(publicFolder, outputFolder);
50
+ await _fs().default.promises.mkdir(outputFolder, {
51
+ recursive: true
52
+ });
53
+ await (0, _dir.copyAsync)(publicFolder, outputFolder, {
54
+ overwrite: true
55
+ });
51
56
  }
52
57
  }
53
58
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/publicFolder.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { copyAsync } from '../utils/dir';\nimport { env } from '../utils/env';\n\nconst debug = require('debug')('expo:public-folder') as typeof console.log;\n\n/** @returns the file system path for a user-defined file in the public folder. */\nexport function getUserDefinedFile(projectRoot: string, possiblePaths: string[]): string | null {\n const publicPath = path.join(projectRoot, env.EXPO_PUBLIC_FOLDER);\n\n for (const possiblePath of possiblePaths) {\n const fullPath = path.join(publicPath, possiblePath);\n if (fs.existsSync(fullPath)) {\n debug(`Found user-defined public file: ` + possiblePath);\n return fullPath;\n }\n }\n\n return null;\n}\n\n/**\n * Copy the contents of the public folder into the output folder.\n * This enables users to add static files like `favicon.ico`.\n *\n * The contents of this folder are completely universal since they refer to\n * static network requests which fall outside the scope of React Native's magic\n * platform resolution patterns.\n */\nexport async function copyPublicFolderAsync(publicFolder: string, outputFolder: string) {\n if (fs.existsSync(publicFolder)) {\n await copyAsync(publicFolder, outputFolder);\n }\n}\n"],"names":["getUserDefinedFile","copyPublicFolderAsync","debug","require","projectRoot","possiblePaths","publicPath","path","join","env","EXPO_PUBLIC_FOLDER","possiblePath","fullPath","fs","existsSync","publicFolder","outputFolder","copyAsync"],"mappings":"AAAA;;;;;;;;;;;IASgBA,kBAAkB,MAAlBA,kBAAkB;IAsBZC,qBAAqB,MAArBA,qBAAqB;;;8DA/B5B,IAAI;;;;;;;8DACF,MAAM;;;;;;qBAEG,cAAc;qBACpB,cAAc;;;;;;AAElC,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,AAAsB,AAAC;AAGpE,SAASH,kBAAkB,CAACI,WAAmB,EAAEC,aAAuB,EAAiB;IAC9F,MAAMC,UAAU,GAAGC,KAAI,EAAA,QAAA,CAACC,IAAI,CAACJ,WAAW,EAAEK,IAAG,IAAA,CAACC,kBAAkB,CAAC,AAAC;IAElE,KAAK,MAAMC,YAAY,IAAIN,aAAa,CAAE;QACxC,MAAMO,QAAQ,GAAGL,KAAI,EAAA,QAAA,CAACC,IAAI,CAACF,UAAU,EAAEK,YAAY,CAAC,AAAC;QACrD,IAAIE,GAAE,EAAA,QAAA,CAACC,UAAU,CAACF,QAAQ,CAAC,EAAE;YAC3BV,KAAK,CAAC,CAAC,gCAAgC,CAAC,GAAGS,YAAY,CAAC,CAAC;YACzD,OAAOC,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAUM,eAAeX,qBAAqB,CAACc,YAAoB,EAAEC,YAAoB,EAAE;IACtF,IAAIH,GAAE,EAAA,QAAA,CAACC,UAAU,CAACC,YAAY,CAAC,EAAE;QAC/B,MAAME,IAAAA,IAAS,UAAA,EAACF,YAAY,EAAEC,YAAY,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC"}
1
+ {"version":3,"sources":["../../../src/export/publicFolder.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { copyAsync } from '../utils/dir';\nimport { env } from '../utils/env';\n\nconst debug = require('debug')('expo:public-folder') as typeof console.log;\n\n/** @returns the file system path for a user-defined file in the public folder. */\nexport function getUserDefinedFile(projectRoot: string, possiblePaths: string[]): string | null {\n const publicPath = path.join(projectRoot, env.EXPO_PUBLIC_FOLDER);\n\n for (const possiblePath of possiblePaths) {\n const fullPath = path.join(publicPath, possiblePath);\n if (fs.existsSync(fullPath)) {\n debug(`Found user-defined public file: ` + possiblePath);\n return fullPath;\n }\n }\n\n return null;\n}\n\n/**\n * Copy the contents of the public folder into the output folder.\n * This enables users to add static files like `favicon.ico`.\n *\n * The contents of this folder are completely universal since they refer to\n * static network requests which fall outside the scope of React Native's magic\n * platform resolution patterns.\n */\nexport async function copyPublicFolderAsync(publicFolder: string, outputFolder: string) {\n if (fs.existsSync(publicFolder)) {\n await fs.promises.mkdir(outputFolder, { recursive: true });\n await copyAsync(publicFolder, outputFolder, {\n overwrite: true,\n });\n }\n}\n"],"names":["getUserDefinedFile","copyPublicFolderAsync","debug","require","projectRoot","possiblePaths","publicPath","path","join","env","EXPO_PUBLIC_FOLDER","possiblePath","fullPath","fs","existsSync","publicFolder","outputFolder","promises","mkdir","recursive","copyAsync","overwrite"],"mappings":"AAAA;;;;;;;;;;;IASgBA,kBAAkB,MAAlBA,kBAAkB;IAsBZC,qBAAqB,MAArBA,qBAAqB;;;8DA/B5B,IAAI;;;;;;;8DACF,MAAM;;;;;;qBAEG,cAAc;qBACpB,cAAc;;;;;;AAElC,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,AAAsB,AAAC;AAGpE,SAASH,kBAAkB,CAACI,WAAmB,EAAEC,aAAuB,EAAiB;IAC9F,MAAMC,UAAU,GAAGC,KAAI,EAAA,QAAA,CAACC,IAAI,CAACJ,WAAW,EAAEK,IAAG,IAAA,CAACC,kBAAkB,CAAC,AAAC;IAElE,KAAK,MAAMC,YAAY,IAAIN,aAAa,CAAE;QACxC,MAAMO,QAAQ,GAAGL,KAAI,EAAA,QAAA,CAACC,IAAI,CAACF,UAAU,EAAEK,YAAY,CAAC,AAAC;QACrD,IAAIE,GAAE,EAAA,QAAA,CAACC,UAAU,CAACF,QAAQ,CAAC,EAAE;YAC3BV,KAAK,CAAC,CAAC,gCAAgC,CAAC,GAAGS,YAAY,CAAC,CAAC;YACzD,OAAOC,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAUM,eAAeX,qBAAqB,CAACc,YAAoB,EAAEC,YAAoB,EAAE;IACtF,IAAIH,GAAE,EAAA,QAAA,CAACC,UAAU,CAACC,YAAY,CAAC,EAAE;QAC/B,MAAMF,GAAE,EAAA,QAAA,CAACI,QAAQ,CAACC,KAAK,CAACF,YAAY,EAAE;YAAEG,SAAS,EAAE,IAAI;SAAE,CAAC,CAAC;QAC3D,MAAMC,IAAAA,IAAS,UAAA,EAACL,YAAY,EAAEC,YAAY,EAAE;YAC1CK,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -57,7 +57,7 @@ async function persistMetroFilesAsync(files, outputDir) {
57
57
  if (!files.size) {
58
58
  return;
59
59
  }
60
- _fs().default.mkdirSync(_path().default.join(outputDir), {
60
+ await _fs().default.promises.mkdir(_path().default.join(outputDir), {
61
61
  recursive: true
62
62
  });
63
63
  // Test fixtures:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/saveAssets.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 type { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport Metro from 'metro';\nimport path from 'path';\nimport prettyBytes from 'pretty-bytes';\n\nimport { Log } from '../log';\nimport { env } from '../utils/env';\n\nconst BLT = '\\u203A';\n\nexport type BundleOptions = {\n entryPoint: string;\n platform: 'android' | 'ios' | 'web';\n dev?: boolean;\n minify?: boolean;\n bytecode: boolean;\n sourceMapUrl?: string;\n sourcemaps?: boolean;\n};\n\nexport type BundleAssetWithFileHashes = Metro.AssetData & {\n fileHashes: string[]; // added by the hashAssets asset plugin\n};\n\nexport type BundleOutput = {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n};\n\nexport type ManifestAsset = { fileHashes: string[]; files: string[]; hash: string };\n\nexport type Asset = ManifestAsset | BundleAssetWithFileHashes;\n\nexport type ExportAssetDescriptor = {\n contents: string | Buffer;\n originFilename?: string;\n /** An identifier for grouping together variations of the same asset. */\n assetId?: string;\n /** Expo Router route path for formatting the HTML output. */\n routeId?: string;\n /** Expo Router API route path for formatting the server function output. */\n apiRouteId?: string;\n /** Expo Router route path for formatting the RSC output. */\n rscId?: string;\n /** A key for grouping together output files by server- or client-side. */\n targetDomain?: 'server' | 'client';\n};\n\nexport type ExportAssetMap = Map<string, ExportAssetDescriptor>;\n\nexport async function persistMetroFilesAsync(files: ExportAssetMap, outputDir: string) {\n if (!files.size) {\n return;\n }\n fs.mkdirSync(path.join(outputDir), { recursive: true });\n\n // Test fixtures:\n // Log.log(\n // JSON.stringify(\n // Object.fromEntries([...files.entries()].map(([k, v]) => [k, { ...v, contents: '' }]))\n // )\n // );\n\n const assetEntries: [string, ExportAssetDescriptor][] = [];\n const apiRouteEntries: [string, ExportAssetDescriptor][] = [];\n const routeEntries: [string, ExportAssetDescriptor][] = [];\n const rscEntries: [string, ExportAssetDescriptor][] = [];\n const remainingEntries: [string, ExportAssetDescriptor][] = [];\n\n let hasServerOutput = false;\n for (const asset of files.entries()) {\n hasServerOutput = hasServerOutput || asset[1].targetDomain === 'server';\n if (asset[1].assetId) assetEntries.push(asset);\n else if (asset[1].routeId != null) routeEntries.push(asset);\n else if (asset[1].apiRouteId != null) apiRouteEntries.push(asset);\n else if (asset[1].rscId != null) rscEntries.push(asset);\n else remainingEntries.push(asset);\n }\n\n const groups = groupBy(assetEntries, ([, { assetId }]) => assetId!);\n\n const contentSize = (contents: string | Buffer) => {\n const length =\n typeof contents === 'string' ? Buffer.byteLength(contents, 'utf8') : contents.length;\n return length;\n };\n\n const sizeStr = (contents: string | Buffer) => {\n const length = contentSize(contents);\n const size = chalk.gray`(${prettyBytes(length)})`;\n return size;\n };\n\n // TODO: If any Expo Router is used, then use a new style which is more simple:\n // `chalk.gray(/path/to/) + chalk.cyan('route')`\n // | index.html (1.2kb)\n // | /path\n // | other.html (1.2kb)\n\n const isExpoRouter = routeEntries.length;\n\n // Phase out printing all the assets as users can simply check the file system for more info.\n const showAdditionalInfo = !isExpoRouter || env.EXPO_DEBUG;\n\n const assetGroups = [...groups.entries()].sort((a, b) => a[0].localeCompare(b[0])) as [\n string,\n [string, ExportAssetDescriptor][],\n ][];\n\n if (showAdditionalInfo) {\n if (assetGroups.length) {\n const totalAssets = assetGroups.reduce((sum, [, assets]) => sum + assets.length, 0);\n\n Log.log('');\n Log.log(chalk.bold`${BLT} Assets (${totalAssets}):`);\n\n for (const [assetId, assets] of assetGroups) {\n const averageContentSize =\n assets.reduce((sum, [, { contents }]) => sum + contentSize(contents), 0) / assets.length;\n Log.log(\n assetId,\n chalk.gray(\n `(${[\n assets.length > 1 ? `${assets.length} variations` : '',\n `${prettyBytes(averageContentSize)}`,\n ]\n .filter(Boolean)\n .join(' | ')})`\n )\n );\n }\n }\n }\n\n const bundles: Map<string, [string, ExportAssetDescriptor][]> = new Map();\n const other: [string, ExportAssetDescriptor][] = [];\n\n remainingEntries.forEach(([filepath, asset]) => {\n if (!filepath.match(/_expo\\/static\\//)) {\n other.push([filepath, asset]);\n } else {\n const platform = filepath.match(/_expo\\/static\\/js\\/([^/]+)\\//)?.[1] ?? 'web';\n if (!bundles.has(platform)) bundles.set(platform, []);\n\n bundles.get(platform)!.push([filepath, asset]);\n }\n });\n\n [...bundles.entries()].forEach(([platform, assets]) => {\n Log.log('');\n Log.log(chalk.bold`${BLT} ${platform} bundles (${assets.length}):`);\n\n const allAssets = assets.sort((a, b) => a[0].localeCompare(b[0]));\n while (allAssets.length) {\n const [filePath, asset] = allAssets.shift()!;\n Log.log(filePath, sizeStr(asset.contents));\n if (filePath.match(/\\.(js|hbc)$/)) {\n // Get source map\n const sourceMapIndex = allAssets.findIndex(([fp]) => fp === filePath + '.map');\n if (sourceMapIndex !== -1) {\n const [sourceMapFilePath, sourceMapAsset] = allAssets.splice(sourceMapIndex, 1)[0];\n Log.log(chalk.gray(sourceMapFilePath), sizeStr(sourceMapAsset.contents));\n }\n }\n }\n });\n\n if (showAdditionalInfo && other.length) {\n Log.log('');\n Log.log(chalk.bold`${BLT} Files (${other.length}):`);\n\n for (const [filePath, asset] of other.sort((a, b) => a[0].localeCompare(b[0]))) {\n Log.log(filePath, sizeStr(asset.contents));\n }\n }\n\n if (rscEntries.length) {\n Log.log('');\n Log.log(chalk.bold`${BLT} React Server Components (${rscEntries.length}):`);\n\n for (const [filePath, assets] of rscEntries.sort((a, b) => a[0].length - b[0].length)) {\n const id = assets.rscId!;\n Log.log(\n '/' + (id === '' ? chalk.gray(' (index)') : id),\n sizeStr(assets.contents),\n chalk.gray(filePath)\n );\n }\n }\n\n if (routeEntries.length) {\n Log.log('');\n Log.log(chalk.bold`${BLT} Static routes (${routeEntries.length}):`);\n\n for (const [, assets] of routeEntries.sort((a, b) => a[0].length - b[0].length)) {\n const id = assets.routeId!;\n Log.log('/' + (id === '' ? chalk.gray(' (index)') : id), sizeStr(assets.contents));\n }\n }\n\n if (apiRouteEntries.length) {\n const apiRoutesWithoutSourcemaps = apiRouteEntries.filter(\n (route) => !route[0].endsWith('.map')\n );\n Log.log('');\n Log.log(chalk.bold`${BLT} API routes (${apiRoutesWithoutSourcemaps.length}):`);\n\n for (const [apiRouteFilename, assets] of apiRoutesWithoutSourcemaps.sort(\n (a, b) => a[0].length - b[0].length\n )) {\n const id = assets.apiRouteId!;\n const hasSourceMap = apiRouteEntries.find(\n ([filename, route]) =>\n filename !== apiRouteFilename &&\n route.apiRouteId === assets.apiRouteId &&\n filename.endsWith('.map')\n );\n Log.log(\n id === '' ? chalk.gray(' (index)') : id,\n sizeStr(assets.contents),\n hasSourceMap ? chalk.gray(`(source map ${sizeStr(hasSourceMap[1].contents)})`) : ''\n );\n }\n }\n\n // Decouple logging from writing for better performance.\n\n await Promise.all(\n [...files.entries()]\n .sort(([a], [b]) => a.localeCompare(b))\n .map(async ([file, { contents, targetDomain }]) => {\n // NOTE: Only use `targetDomain` if we have at least one server asset\n const domain = (hasServerOutput && targetDomain) || '';\n const outputPath = path.join(outputDir, domain, file);\n await fs.promises.mkdir(path.dirname(outputPath), { recursive: true });\n await fs.promises.writeFile(outputPath, contents);\n })\n );\n\n Log.log('');\n}\n\nfunction groupBy<T>(array: T[], key: (item: T) => string): Map<string, T[]> {\n const map = new Map<string, T[]>();\n array.forEach((item) => {\n const group = key(item);\n const list = map.get(group) ?? [];\n list.push(item);\n map.set(group, list);\n });\n return map;\n}\n\n// TODO: Move source map modification to the serializer\nexport function getFilesFromSerialAssets(\n resources: SerialAsset[],\n {\n includeSourceMaps,\n files = new Map(),\n platform,\n isServerHosted = platform === 'web',\n }: {\n includeSourceMaps: boolean;\n files?: ExportAssetMap;\n platform?: string;\n isServerHosted?: boolean;\n }\n) {\n resources.forEach((resource) => {\n if (resource.type === 'css-external') {\n return;\n }\n files.set(resource.filename, {\n contents: resource.source,\n originFilename: resource.originFilename,\n targetDomain: isServerHosted ? 'client' : undefined,\n });\n });\n\n return files;\n}\n"],"names":["persistMetroFilesAsync","getFilesFromSerialAssets","BLT","files","outputDir","size","fs","mkdirSync","path","join","recursive","assetEntries","apiRouteEntries","routeEntries","rscEntries","remainingEntries","hasServerOutput","asset","entries","targetDomain","assetId","push","routeId","apiRouteId","rscId","groups","groupBy","contentSize","contents","length","Buffer","byteLength","sizeStr","chalk","gray","prettyBytes","isExpoRouter","showAdditionalInfo","env","EXPO_DEBUG","assetGroups","sort","a","b","localeCompare","totalAssets","reduce","sum","assets","Log","log","bold","averageContentSize","filter","Boolean","bundles","Map","other","forEach","filepath","match","platform","has","set","get","allAssets","filePath","shift","sourceMapIndex","findIndex","fp","sourceMapFilePath","sourceMapAsset","splice","id","apiRoutesWithoutSourcemaps","route","endsWith","apiRouteFilename","hasSourceMap","find","filename","Promise","all","map","file","domain","outputPath","promises","mkdir","dirname","writeFile","array","key","item","group","list","resources","includeSourceMaps","isServerHosted","resource","type","source","originFilename","undefined"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAoDsBA,sBAAsB,MAAtBA,sBAAsB;IA4M5BC,wBAAwB,MAAxBA,wBAAwB;;;8DA/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AAC,CAAC;IAEH,OAAOrG,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"sources":["../../../src/export/saveAssets.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 type { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport Metro from 'metro';\nimport path from 'path';\nimport prettyBytes from 'pretty-bytes';\n\nimport { Log } from '../log';\nimport { env } from '../utils/env';\n\nconst BLT = '\\u203A';\n\nexport type BundleOptions = {\n entryPoint: string;\n platform: 'android' | 'ios' | 'web';\n dev?: boolean;\n minify?: boolean;\n bytecode: boolean;\n sourceMapUrl?: string;\n sourcemaps?: boolean;\n};\n\nexport type BundleAssetWithFileHashes = Metro.AssetData & {\n fileHashes: string[]; // added by the hashAssets asset plugin\n};\n\nexport type BundleOutput = {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n};\n\nexport type ManifestAsset = { fileHashes: string[]; files: string[]; hash: string };\n\nexport type Asset = ManifestAsset | BundleAssetWithFileHashes;\n\nexport type ExportAssetDescriptor = {\n contents: string | Buffer;\n originFilename?: string;\n /** An identifier for grouping together variations of the same asset. */\n assetId?: string;\n /** Expo Router route path for formatting the HTML output. */\n routeId?: string;\n /** Expo Router API route path for formatting the server function output. */\n apiRouteId?: string;\n /** Expo Router route path for formatting the RSC output. */\n rscId?: string;\n /** A key for grouping together output files by server- or client-side. */\n targetDomain?: 'server' | 'client';\n};\n\nexport type ExportAssetMap = Map<string, ExportAssetDescriptor>;\n\nexport async function persistMetroFilesAsync(files: ExportAssetMap, outputDir: string) {\n if (!files.size) {\n return;\n }\n await fs.promises.mkdir(path.join(outputDir), { recursive: true });\n\n // Test fixtures:\n // Log.log(\n // JSON.stringify(\n // Object.fromEntries([...files.entries()].map(([k, v]) => [k, { ...v, contents: '' }]))\n // )\n // );\n\n const assetEntries: [string, ExportAssetDescriptor][] = [];\n const apiRouteEntries: [string, ExportAssetDescriptor][] = [];\n const routeEntries: [string, ExportAssetDescriptor][] = [];\n const rscEntries: [string, ExportAssetDescriptor][] = [];\n const remainingEntries: [string, ExportAssetDescriptor][] = [];\n\n let hasServerOutput = false;\n for (const asset of files.entries()) {\n hasServerOutput = hasServerOutput || asset[1].targetDomain === 'server';\n if (asset[1].assetId) assetEntries.push(asset);\n else if (asset[1].routeId != null) routeEntries.push(asset);\n else if (asset[1].apiRouteId != null) apiRouteEntries.push(asset);\n else if (asset[1].rscId != null) rscEntries.push(asset);\n else remainingEntries.push(asset);\n }\n\n const groups = groupBy(assetEntries, ([, { assetId }]) => assetId!);\n\n const contentSize = (contents: string | Buffer) => {\n const length =\n typeof contents === 'string' ? Buffer.byteLength(contents, 'utf8') : contents.length;\n return length;\n };\n\n const sizeStr = (contents: string | Buffer) => {\n const length = contentSize(contents);\n const size = chalk.gray`(${prettyBytes(length)})`;\n return size;\n };\n\n // TODO: If any Expo Router is used, then use a new style which is more simple:\n // `chalk.gray(/path/to/) + chalk.cyan('route')`\n // | index.html (1.2kb)\n // | /path\n // | other.html (1.2kb)\n\n const isExpoRouter = routeEntries.length;\n\n // Phase out printing all the assets as users can simply check the file system for more info.\n const showAdditionalInfo = !isExpoRouter || env.EXPO_DEBUG;\n\n const assetGroups = [...groups.entries()].sort((a, b) => a[0].localeCompare(b[0])) as [\n string,\n [string, ExportAssetDescriptor][],\n ][];\n\n if (showAdditionalInfo) {\n if (assetGroups.length) {\n const totalAssets = assetGroups.reduce((sum, [, assets]) => sum + assets.length, 0);\n\n Log.log('');\n Log.log(chalk.bold`${BLT} Assets (${totalAssets}):`);\n\n for (const [assetId, assets] of assetGroups) {\n const averageContentSize =\n assets.reduce((sum, [, { contents }]) => sum + contentSize(contents), 0) / assets.length;\n Log.log(\n assetId,\n chalk.gray(\n `(${[\n assets.length > 1 ? `${assets.length} variations` : '',\n `${prettyBytes(averageContentSize)}`,\n ]\n .filter(Boolean)\n .join(' | ')})`\n )\n );\n }\n }\n }\n\n const bundles: Map<string, [string, ExportAssetDescriptor][]> = new Map();\n const other: [string, ExportAssetDescriptor][] = [];\n\n remainingEntries.forEach(([filepath, asset]) => {\n if (!filepath.match(/_expo\\/static\\//)) {\n other.push([filepath, asset]);\n } else {\n const platform = filepath.match(/_expo\\/static\\/js\\/([^/]+)\\//)?.[1] ?? 'web';\n if (!bundles.has(platform)) bundles.set(platform, []);\n\n bundles.get(platform)!.push([filepath, asset]);\n }\n });\n\n [...bundles.entries()].forEach(([platform, assets]) => {\n Log.log('');\n Log.log(chalk.bold`${BLT} ${platform} bundles (${assets.length}):`);\n\n const allAssets = assets.sort((a, b) => a[0].localeCompare(b[0]));\n while (allAssets.length) {\n const [filePath, asset] = allAssets.shift()!;\n Log.log(filePath, sizeStr(asset.contents));\n if (filePath.match(/\\.(js|hbc)$/)) {\n // Get source map\n const sourceMapIndex = allAssets.findIndex(([fp]) => fp === filePath + '.map');\n if (sourceMapIndex !== -1) {\n const [sourceMapFilePath, sourceMapAsset] = allAssets.splice(sourceMapIndex, 1)[0];\n Log.log(chalk.gray(sourceMapFilePath), sizeStr(sourceMapAsset.contents));\n }\n }\n }\n });\n\n if (showAdditionalInfo && other.length) {\n Log.log('');\n Log.log(chalk.bold`${BLT} Files (${other.length}):`);\n\n for (const [filePath, asset] of other.sort((a, b) => a[0].localeCompare(b[0]))) {\n Log.log(filePath, sizeStr(asset.contents));\n }\n }\n\n if (rscEntries.length) {\n Log.log('');\n Log.log(chalk.bold`${BLT} React Server Components (${rscEntries.length}):`);\n\n for (const [filePath, assets] of rscEntries.sort((a, b) => a[0].length - b[0].length)) {\n const id = assets.rscId!;\n Log.log(\n '/' + (id === '' ? chalk.gray(' (index)') : id),\n sizeStr(assets.contents),\n chalk.gray(filePath)\n );\n }\n }\n\n if (routeEntries.length) {\n Log.log('');\n Log.log(chalk.bold`${BLT} Static routes (${routeEntries.length}):`);\n\n for (const [, assets] of routeEntries.sort((a, b) => a[0].length - b[0].length)) {\n const id = assets.routeId!;\n Log.log('/' + (id === '' ? chalk.gray(' (index)') : id), sizeStr(assets.contents));\n }\n }\n\n if (apiRouteEntries.length) {\n const apiRoutesWithoutSourcemaps = apiRouteEntries.filter(\n (route) => !route[0].endsWith('.map')\n );\n Log.log('');\n Log.log(chalk.bold`${BLT} API routes (${apiRoutesWithoutSourcemaps.length}):`);\n\n for (const [apiRouteFilename, assets] of apiRoutesWithoutSourcemaps.sort(\n (a, b) => a[0].length - b[0].length\n )) {\n const id = assets.apiRouteId!;\n const hasSourceMap = apiRouteEntries.find(\n ([filename, route]) =>\n filename !== apiRouteFilename &&\n route.apiRouteId === assets.apiRouteId &&\n filename.endsWith('.map')\n );\n Log.log(\n id === '' ? chalk.gray(' (index)') : id,\n sizeStr(assets.contents),\n hasSourceMap ? chalk.gray(`(source map ${sizeStr(hasSourceMap[1].contents)})`) : ''\n );\n }\n }\n\n // Decouple logging from writing for better performance.\n\n await Promise.all(\n [...files.entries()]\n .sort(([a], [b]) => a.localeCompare(b))\n .map(async ([file, { contents, targetDomain }]) => {\n // NOTE: Only use `targetDomain` if we have at least one server asset\n const domain = (hasServerOutput && targetDomain) || '';\n const outputPath = path.join(outputDir, domain, file);\n await fs.promises.mkdir(path.dirname(outputPath), { recursive: true });\n await fs.promises.writeFile(outputPath, contents);\n })\n );\n\n Log.log('');\n}\n\nfunction groupBy<T>(array: T[], key: (item: T) => string): Map<string, T[]> {\n const map = new Map<string, T[]>();\n array.forEach((item) => {\n const group = key(item);\n const list = map.get(group) ?? [];\n list.push(item);\n map.set(group, list);\n });\n return map;\n}\n\n// TODO: Move source map modification to the serializer\nexport function getFilesFromSerialAssets(\n resources: SerialAsset[],\n {\n includeSourceMaps,\n files = new Map(),\n platform,\n isServerHosted = platform === 'web',\n }: {\n includeSourceMaps: boolean;\n files?: ExportAssetMap;\n platform?: string;\n isServerHosted?: boolean;\n }\n) {\n resources.forEach((resource) => {\n if (resource.type === 'css-external') {\n return;\n }\n files.set(resource.filename, {\n contents: resource.source,\n originFilename: resource.originFilename,\n targetDomain: isServerHosted ? 'client' : undefined,\n });\n });\n\n return files;\n}\n"],"names":["persistMetroFilesAsync","getFilesFromSerialAssets","BLT","files","outputDir","size","fs","promises","mkdir","path","join","recursive","assetEntries","apiRouteEntries","routeEntries","rscEntries","remainingEntries","hasServerOutput","asset","entries","targetDomain","assetId","push","routeId","apiRouteId","rscId","groups","groupBy","contentSize","contents","length","Buffer","byteLength","sizeStr","chalk","gray","prettyBytes","isExpoRouter","showAdditionalInfo","env","EXPO_DEBUG","assetGroups","sort","a","b","localeCompare","totalAssets","reduce","sum","assets","Log","log","bold","averageContentSize","filter","Boolean","bundles","Map","other","forEach","filepath","match","platform","has","set","get","allAssets","filePath","shift","sourceMapIndex","findIndex","fp","sourceMapFilePath","sourceMapAsset","splice","id","apiRoutesWithoutSourcemaps","route","endsWith","apiRouteFilename","hasSourceMap","find","filename","Promise","all","map","file","domain","outputPath","dirname","writeFile","array","key","item","group","list","resources","includeSourceMaps","isServerHosted","resource","type","source","originFilename","undefined"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAoDsBA,sBAAsB,MAAtBA,sBAAsB;IA4M5BC,wBAAwB,MAAxBA,wBAAwB;;;8DA/PtB,OAAO;;;;;;;8DACV,IAAI;;;;;;;8DAEF,MAAM;;;;;;;8DACC,cAAc;;;;;;qBAElB,QAAQ;qBACR,cAAc;;;;;;AAElC,MAAMC,GAAG,GAAG,GAAQ,AAAC;AA0Cd,eAAeF,sBAAsB,CAACG,KAAqB,EAAEC,SAAiB,EAAE;IACrF,IAAI,CAACD,KAAK,CAACE,IAAI,EAAE;QACf,OAAO;IACT,CAAC;IACD,MAAMC,GAAE,EAAA,QAAA,CAACC,QAAQ,CAACC,KAAK,CAACC,KAAI,EAAA,QAAA,CAACC,IAAI,CAACN,SAAS,CAAC,EAAE;QAAEO,SAAS,EAAE,IAAI;KAAE,CAAC,CAAC;IAEnE,iB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AAME,IAAI,GAAGV,GAAG,CAACpB,GAAG,CAAC6B,KAAK,CAAC,IAAI,EAAE,AAAC;QAClCC,IAAI,CAACzE,IAAI,CAACuE,IAAI,CAAC,CAAC;QAChBR,GAAG,CAACrB,GAAG,CAAC8B,KAAK,EAAEC,IAAI,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IACH,OAAOV,GAAG,CAAC;AACb,CAAC;AAGM,SAASpF,wBAAwB,CACtC+F,SAAwB,EACxB,EACEC,iBAAiB,CAAA,EACjB9F,KAAK,EAAG,IAAIsD,GAAG,EAAE,CAAA,EACjBK,QAAQ,CAAA,EACRoC,cAAc,EAAGpC,QAAQ,KAAK,KAAK,CAAA,EAMpC,EACD;IACAkC,SAAS,CAACrC,OAAO,CAAC,CAACwC,QAAQ,GAAK;QAC9B,IAAIA,QAAQ,CAACC,IAAI,KAAK,cAAc,EAAE;YACpC,OAAO;QACT,CAAC;QACDjG,KAAK,CAAC6D,GAAG,CAACmC,QAAQ,CAACjB,QAAQ,EAAE;YAC3BrD,QAAQ,EAAEsE,QAAQ,CAACE,MAAM;YACzBC,cAAc,EAAEH,QAAQ,CAACG,cAAc;YACvClF,YAAY,EAAE8E,cAAc,GAAG,QAAQ,GAAGK,SAAS;SACpD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAOpG,KAAK,CAAC;AACf,CAAC"}
@@ -34,6 +34,7 @@ const expoInstall = async (argv)=>{
34
34
  if (args["--help"]) {
35
35
  (0, _args.printHelp)(`Install a module or other package to a project`, `npx expo install`, [
36
36
  `--check Check which installed packages need to be updated`,
37
+ "--dev Save the dependencies as devDependencies",
37
38
  `--fix Automatically update any invalid package versions`,
38
39
  (0, _chalk().default)`--npm Use npm to install dependencies. {dim Default when package-lock.json exists}`,
39
40
  (0, _chalk().default)`--yarn Use Yarn to install dependencies. {dim Default when yarn.lock exists}`,