@expo/cli 1.0.0-canary-20241008-90b13ad → 1.0.0-canary-20241018-75a0b25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +1 -1
- package/build/metro-require/require.js +3 -1
- package/build/src/api/getExpoSchema.js +18 -15
- package/build/src/api/getExpoSchema.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +2 -0
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/exportServer.js +2 -1
- package/build/src/export/embed/exportServer.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +12 -3
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/exportApp.js +7 -4
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +2 -2
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +0 -6
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +15 -26
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +33 -11
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +19 -8
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
- package/build/src/start/server/metro/createJResolver.js +0 -31
- package/build/src/start/server/metro/createJResolver.js.map +1 -1
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +62 -9
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +6 -1
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
- package/build/src/start/server/metro/getCssModulesFromBundler.js +2 -1
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +2 -5
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +28 -4
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +0 -1
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +19 -5
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/DomComponentsMiddleware.js +8 -1
- package/build/src/start/server/middleware/DomComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +37 -4
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +72 -3
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/utils/jsonSchemaDeref.js +148 -0
- package/build/src/utils/jsonSchemaDeref.js.map +1 -0
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +15 -16
- package/static/template/[...rsc]+api.ts +2 -2
|
@@ -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 { createMetadataJson } from './createMetadataJson';\nimport { exportAssetsAsync } from './exportAssets';\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\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\n getFilesFromSerialAssets(bundle.artifacts, {\n includeSourceMaps: sourceMaps,\n files,\n isServerHosted: devServer.isReactServerComponentsEnabled,\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: 'client',\n });\n }\n })\n );\n\n if (devServer.isReactServerComponentsEnabled) {\n if (!(platforms.includes('web') && useServerRendering)) {\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\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 fileNames = Object.fromEntries(\n Object.entries(bundles).map(([platform, bundle]) => [\n platform,\n bundle.artifacts.filter((asset) => asset.type === 'js').map((asset) => asset.filename),\n ])\n );\n\n // Generate a `metadata.json` for EAS Update.\n const contents = createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\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 });\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","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","html","serializeHtmlWithAssets","resources","template","createTemplateHtmlFromExpoConfigAsync","scripts","cssLinks","modifyHtml","getVirtualFaviconAssetsAsync","set","contents","targetDomain","exportApiRoutesStandaloneAsync","assets","embeddedHashSet","exportAssetsAsync","JSON","stringify","createAssetMap","fileNames","Object","fromEntries","entries","asset","type","filename","createMetadataJson","exportServer","placeholderIndex","fs","existsSync","exportFromServerAsync","routerRoot","getRouterDirectoryModuleIdWithManifest","stopAsync","persistMetroFilesAsync"],"mappings":"AAAA;;;;+BAmCsBA,gBAAc;;aAAdA,cAAc;;;yBAnCV,cAAc;;;;;;;8DAErB,QAAQ;;;;;;;8DACT,OAAO;;;;;;;8DACV,IAAI;;;;;;;8DACF,MAAM;;;;;;oCAEY,sBAAsB;8BACvB,gBAAgB;8BACe,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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A,EAACnH,WAAW,EAAEoD,SAAS,EAAE;oBAClDhB,IAAI;oBACJO,KAAK;oBACLxC,KAAK,EAAE,CAAC,CAACA,KAAK;oBACdD,SAAS,EAAEwC,UAAU;oBACrBnC,MAAM;oBACNoB,OAAO;oBACPuD,iBAAiB,EAAE5E,UAAU;oBAC7B8G,UAAU,EAAEC,IAAAA,OAAsC,uCAAA,EAACrH,WAAW,EAAEW,GAAG,CAAC;oBACpEmE,aAAa,EAAE,CAAC,CAACnE,CAAAA,CAAAA,IAAe,GAAfA,GAAG,CAACoE,WAAW,SAAe,GAA9BpE,KAAAA,CAA8B,GAA9BA,IAAe,CAAEmE,aAAa,CAAA;oBAC/CiC,YAAY;oBACZtG,UAAU;oBACVwC,WAAW,EAAE,IAAI;oBACjBtC,GAAG,EAAEI,aAAa,CAACJ,GAAG;iBACvB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,SAAU;QACR,MAAMkC,gBAAgB,CAACyE,SAAS,EAAE,CAAC;IACrC,CAAC;IAED,kDAAkD;IAClD,MAAMC,IAAAA,WAAsB,uBAAA,EAAC5E,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 { createMetadataJson } from './createMetadataJson';\nimport { exportAssetsAsync } from './exportAssets';\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\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\n getFilesFromSerialAssets(bundle.artifacts, {\n includeSourceMaps: sourceMaps,\n files,\n isServerHosted: devServer.isReactServerComponentsEnabled,\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 fileNames = Object.fromEntries(\n Object.entries(bundles).map(([platform, bundle]) => [\n platform,\n bundle.artifacts.filter((asset) => asset.type === 'js').map((asset) => asset.filename),\n ])\n );\n\n // Generate a `metadata.json` for EAS Update.\n const contents = createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\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","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","html","serializeHtmlWithAssets","resources","template","createTemplateHtmlFromExpoConfigAsync","scripts","cssLinks","modifyHtml","getVirtualFaviconAssetsAsync","set","contents","targetDomain","isWeb","exportApiRoutesStandaloneAsync","apiRoutesOnly","assets","embeddedHashSet","exportAssetsAsync","JSON","stringify","createAssetMap","fileNames","Object","fromEntries","entries","asset","type","filename","createMetadataJson","exportServer","placeholderIndex","fs","existsSync","exportFromServerAsync","routerRoot","getRouterDirectoryModuleIdWithManifest","stopAsync","persistMetroFilesAsync"],"mappings":"AAAA;;;;+BAmCsBA,gBAAc;;aAAdA,cAAc;;;yBAnCV,cAAc;;;;;;;8DAErB,QAAQ;;;;;;;8DACT,OAAO;;;;;;;8DACV,IAAI;;;;;;;8DACF,MAAM;;;;;;oCAEY,sBAAsB;8BACvB,gBAAgB;8BACe,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,EA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AACC,UAAU,CAACF,gBAAgB,CAAC,EAAE;oBACpCvE,KAAK,CAACkD,GAAG,CAAC,YAAY,EAAE;wBACtBC,QAAQ,EAAE,CAAC,0BAA0B,CAAC;wBACtCC,YAAY,EAAE,QAAQ;qBACvB,CAAC,CAAC;gBACL,CAAC;YACH,OAAO;oBAUcpF,IAAe;gBATlC,MAAM0G,IAAAA,kBAAqB,sBAAA,EAACrH,WAAW,EAAEoD,SAAS,EAAE;oBAClDhB,IAAI;oBACJO,KAAK;oBACLxC,KAAK,EAAE,CAAC,CAACA,KAAK;oBACdD,SAAS,EAAEwC,UAAU;oBACrBnC,MAAM;oBACNoB,OAAO;oBACPuD,iBAAiB,EAAE5E,UAAU;oBAC7BgH,UAAU,EAAEC,IAAAA,OAAsC,uCAAA,EAACvH,WAAW,EAAEW,GAAG,CAAC;oBACpEmE,aAAa,EAAE,CAAC,CAACnE,CAAAA,CAAAA,IAAe,GAAfA,GAAG,CAACoE,WAAW,SAAe,GAA9BpE,KAAAA,CAA8B,GAA9BA,IAAe,CAAEmE,aAAa,CAAA;oBAC/CmC,YAAY;oBACZxG,UAAU;oBACVwC,WAAW,EAAE,IAAI;oBACjBtC,GAAG,EAAEI,aAAa,CAACJ,GAAG;iBACvB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,SAAU;QACR,MAAMkC,gBAAgB,CAAC2E,SAAS,EAAE,CAAC;IACrC,CAAC;IAED,kDAAkD;IAClD,MAAMC,IAAAA,WAAsB,uBAAA,EAAC9E,KAAK,EAAED,UAAU,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -331,7 +331,7 @@ function getPathVariations(routePath) {
|
|
|
331
331
|
generateVariations(segments);
|
|
332
332
|
return Array.from(variations);
|
|
333
333
|
}
|
|
334
|
-
async function exportApiRoutesStandaloneAsync(devServer, { files =new Map() , platform }) {
|
|
334
|
+
async function exportApiRoutesStandaloneAsync(devServer, { files =new Map() , platform , apiRoutesOnly }) {
|
|
335
335
|
const { serverManifest } = await devServer.getServerManifestAsync();
|
|
336
336
|
const apiRoutes = await exportApiRoutesAsync({
|
|
337
337
|
server: devServer,
|
|
@@ -339,7 +339,7 @@ async function exportApiRoutesStandaloneAsync(devServer, { files =new Map() , pl
|
|
|
339
339
|
// NOTE(kitten): For now, we always output source maps for API route exports
|
|
340
340
|
includeSourceMaps: true,
|
|
341
341
|
platform,
|
|
342
|
-
apiRoutesOnly
|
|
342
|
+
apiRoutesOnly
|
|
343
343
|
});
|
|
344
344
|
// Add the api routes to the files to export.
|
|
345
345
|
for (const [route, contents] of apiRoutes){
|
|
@@ -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 }: {\n files?: ExportAssetMap;\n platform: string;\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: 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\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","getServerManifestAsync","apiRoutesOnly","props","exportExpoRouterApiRoutesAsync","prerenderManifest","htmlRoutes","notFoundRoutes","JSON","stringify","getApiRoutesForDirectory","warn","chalk","yellow","v","relative"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAuDsBA,+BAA+B,MAA/BA,+BAA+B;IA0E/BC,qBAAqB,MAArBA,qBAAqB;IAoG3BC,YAAY,MAAZA,YAAY;IAoHZC,iBAAiB,MAAjBA,iBAAiB;IAwCXC,8BAA8B,MAA9BA,8BAA8B;;;8DAhYlC,OAAO;;;;;;;yBAEkB,4BAA4B;;;;;;;8DACtD,MAAM;;;;;;;8DACC,cAAc;;;;;;;yBACd,MAAM;;;;;;yBAEe,WAAW;oCAChB,sBAAsB;4BACL,cAAc;qBACnD,QAAQ;qCAMO,2CAA2C;wBACrC,8BAA8B;+BAC/B,qCAAqC;sBACnD,eAAe;;;;;;AAEzC,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,kCAAkC,CAAC,AAAs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,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 }: {\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","getApiRoutesForDirectory","warn","chalk","yellow","v","relative"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAuDsBA,+BAA+B,MAA/BA,+BAA+B;IA0E/BC,qBAAqB,MAArBA,qBAAqB;IAoG3BC,YAAY,MAAZA,YAAY;IAoHZC,iBAAiB,MAAjBA,iBAAiB;IAwCXC,8BAA8B,MAA9BA,8BAA8B;;;8DAhYlC,OAAO;;;;;;;yBAEkB,4BAA4B;;;;;;;8DACtD,MAAM;;;;;;;8DACC,cAAc;;;;;;;yBACd,MAAM;;;;;;yBAEe,WAAW;oCAChB,sBAAsB;4BACL,cAAc;qBACnD,QAAQ;qCAMO,2CAA2C;wBACrC,8BAA8B;+BAC/B,qCAAqC;sBACnD,eAAe;;;;;;AAEzC,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,kCAAkC,CAAC,AAAsB,AAAC;AA4BzF,6BAA6B,GAC7B,SAASC,cAAc,CAACC,IAAY,EAAsB;QACjDA,GAA4B;IAAnC,OAAOA,CAAAA,GAA4B,GAA5BA,IAAI,CAACC,KAAK,kBAAkB,SAAK,GAAjCD,KAAAA,CAAiC,GAAjCA,GAA4B,AAAE,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC;AAEM,eAAeR,+BAA+B,CACnDU,WAAmB,EACnB,EACEC,QAAQ,CAAA,EACRC,WAAW,CAAA,EACX,8DAA8D;AA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AiB;QAC5B6E,iBAAiB,EAAEF,KAAK,CAACpH,QAAQ;QACjC2C,iBAAiB;QACjBM,QAAQ;KACT,CAAC,AAAC;IAEH,8KAA8K;IAC9K,IAAIiE,aAAa,EAAE;QACjBlH,QAAQ,CAACuH,UAAU,GAAG,EAAE,CAAC;QACzBvH,QAAQ,CAACwH,cAAc,GAAG,EAAE,CAAC;IAC/B,CAAC;IAEDrH,KAAK,CAACU,GAAG,CAAC,mBAAmB,EAAE;QAC7BC,QAAQ,EAAE2G,IAAI,CAACC,SAAS,CAAC1H,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,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"}
|
|
@@ -101,12 +101,6 @@ class WebSupportProjectPrerequisite extends _prerequisite.ProjectPrerequisite {
|
|
|
101
101
|
}
|
|
102
102
|
/** Exposed for testing. */ async _ensureWebDependenciesInstalledAsync({ exp }) {
|
|
103
103
|
const requiredPackages = [
|
|
104
|
-
// use react-native-web/package.json to skip node module cache issues when the user installs
|
|
105
|
-
// the package and attempts to resolve the module in the same process.
|
|
106
|
-
{
|
|
107
|
-
file: "react-native-web/package.json",
|
|
108
|
-
pkg: "react-native-web"
|
|
109
|
-
},
|
|
110
104
|
{
|
|
111
105
|
file: "react-dom/package.json",
|
|
112
106
|
pkg: "react-dom"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/web/WebSupportProjectPrerequisite.ts"],"sourcesContent":["import {\n AppJSONConfig,\n ExpoConfig,\n getConfig,\n getProjectConfigDescriptionWithPaths,\n ProjectConfig,\n} from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { getPlatformBundlers } from '../../server/platformBundlers';\nimport { PrerequisiteCommandError, ProjectPrerequisite } from '../Prerequisite';\nimport { ensureDependenciesAsync } from '../dependencies/ensureDependenciesAsync';\nimport { ResolvedPackage } from '../dependencies/getMissingPackages';\n\nconst debug = require('debug')('expo:doctor:webSupport') as typeof console.log;\n\n/** Ensure the project has the required web support settings. */\nexport class WebSupportProjectPrerequisite extends ProjectPrerequisite {\n /** Ensure a project that hasn't explicitly disabled web support has all the required packages for running in the browser. */\n async assertImplementation(): Promise<void> {\n if (env.EXPO_NO_WEB_SETUP) {\n Log.warn('Skipping web setup: EXPO_NO_WEB_SETUP is enabled.');\n return;\n }\n debug('Ensuring web support is setup');\n\n const result = await this._shouldSetupWebSupportAsync();\n\n // Ensure web packages are installed\n await this._ensureWebDependenciesInstalledAsync({ exp: result.exp });\n }\n\n /** Exposed for testing. */\n async _shouldSetupWebSupportAsync(): Promise<ProjectConfig> {\n const config = getConfig(this.projectRoot);\n\n // Detect if the 'web' string is purposefully missing from the platforms array.\n if (isWebPlatformExcluded(config.rootConfig)) {\n // Get exact config description with paths.\n const configName = getProjectConfigDescriptionWithPaths(this.projectRoot, config);\n throw new PrerequisiteCommandError(\n 'WEB_SUPPORT',\n chalk`Skipping web setup: {bold \"web\"} is not included in the project ${configName} {bold \"platforms\"} array.`\n );\n }\n\n return config;\n }\n\n /** Exposed for testing. */\n async _ensureWebDependenciesInstalledAsync({ exp }: { exp: ExpoConfig }): Promise<boolean> {\n const requiredPackages: ResolvedPackage[] = [\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/web/WebSupportProjectPrerequisite.ts"],"sourcesContent":["import {\n AppJSONConfig,\n ExpoConfig,\n getConfig,\n getProjectConfigDescriptionWithPaths,\n ProjectConfig,\n} from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { getPlatformBundlers } from '../../server/platformBundlers';\nimport { PrerequisiteCommandError, ProjectPrerequisite } from '../Prerequisite';\nimport { ensureDependenciesAsync } from '../dependencies/ensureDependenciesAsync';\nimport { ResolvedPackage } from '../dependencies/getMissingPackages';\n\nconst debug = require('debug')('expo:doctor:webSupport') as typeof console.log;\n\n/** Ensure the project has the required web support settings. */\nexport class WebSupportProjectPrerequisite extends ProjectPrerequisite {\n /** Ensure a project that hasn't explicitly disabled web support has all the required packages for running in the browser. */\n async assertImplementation(): Promise<void> {\n if (env.EXPO_NO_WEB_SETUP) {\n Log.warn('Skipping web setup: EXPO_NO_WEB_SETUP is enabled.');\n return;\n }\n debug('Ensuring web support is setup');\n\n const result = await this._shouldSetupWebSupportAsync();\n\n // Ensure web packages are installed\n await this._ensureWebDependenciesInstalledAsync({ exp: result.exp });\n }\n\n /** Exposed for testing. */\n async _shouldSetupWebSupportAsync(): Promise<ProjectConfig> {\n const config = getConfig(this.projectRoot);\n\n // Detect if the 'web' string is purposefully missing from the platforms array.\n if (isWebPlatformExcluded(config.rootConfig)) {\n // Get exact config description with paths.\n const configName = getProjectConfigDescriptionWithPaths(this.projectRoot, config);\n throw new PrerequisiteCommandError(\n 'WEB_SUPPORT',\n chalk`Skipping web setup: {bold \"web\"} is not included in the project ${configName} {bold \"platforms\"} array.`\n );\n }\n\n return config;\n }\n\n /** Exposed for testing. */\n async _ensureWebDependenciesInstalledAsync({ exp }: { exp: ExpoConfig }): Promise<boolean> {\n const requiredPackages: ResolvedPackage[] = [\n { file: 'react-dom/package.json', pkg: 'react-dom' },\n ];\n\n const bundler = getPlatformBundlers(this.projectRoot, exp).web;\n // Only include webpack-config if bundler is webpack.\n if (bundler === 'webpack') {\n requiredPackages.push(\n // `webpack` and `webpack-dev-server` should be installed in the `@expo/webpack-config`\n {\n file: '@expo/webpack-config/package.json',\n pkg: '@expo/webpack-config',\n dev: true,\n }\n );\n } else if (bundler === 'metro') {\n requiredPackages.push({\n file: '@expo/metro-runtime/package.json',\n pkg: '@expo/metro-runtime',\n });\n }\n\n try {\n return await ensureDependenciesAsync(this.projectRoot, {\n // This never seems to work when prompting, installing, and running -- instead just inform the user to run the install command and try again.\n skipPrompt: true,\n isProjectMutable: false,\n exp,\n installMessage: `It looks like you're trying to use web support but don't have the required dependencies installed.`,\n warningMessage: chalk`If you're not using web, please ensure you remove the {bold \"web\"} string from the platforms array in the project Expo config.`,\n requiredPackages,\n });\n } catch (error) {\n // Reset the cached check so we can re-run the check if the user re-runs the command by pressing 'w' in the Terminal UI.\n this.resetAssertion();\n throw error;\n }\n }\n}\n\n/** Return `true` if the `web` platform is purposefully excluded from the project Expo config. */\nexport function isWebPlatformExcluded(rootConfig: AppJSONConfig): boolean {\n // Detect if the 'web' string is purposefully missing from the platforms array.\n const isWebExcluded =\n Array.isArray(rootConfig?.expo?.platforms) &&\n !!rootConfig.expo?.platforms.length &&\n !rootConfig.expo?.platforms.includes('web');\n return isWebExcluded;\n}\n"],"names":["WebSupportProjectPrerequisite","isWebPlatformExcluded","debug","require","ProjectPrerequisite","assertImplementation","env","EXPO_NO_WEB_SETUP","Log","warn","result","_shouldSetupWebSupportAsync","_ensureWebDependenciesInstalledAsync","exp","config","getConfig","projectRoot","rootConfig","configName","getProjectConfigDescriptionWithPaths","PrerequisiteCommandError","chalk","requiredPackages","file","pkg","bundler","getPlatformBundlers","web","push","dev","ensureDependenciesAsync","skipPrompt","isProjectMutable","installMessage","warningMessage","error","resetAssertion","isWebExcluded","Array","isArray","expo","platforms","length","includes"],"mappings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;IAJlB,+EAA+E;IAC/E,MAAMoB,aAAa,GACjBC,KAAK,CAACC,OAAO,CAACtB,UAAU,QAAM,GAAhBA,KAAAA,CAAgB,GAAhBA,CAAAA,GAAgB,GAAhBA,UAAU,CAAEuB,IAAI,SAAA,GAAhBvB,KAAAA,CAAgB,GAAhBA,GAAgB,CAAEwB,SAAS,AAAX,CAAY,IAC1C,CAAC,EAACxB,CAAAA,IAAe,GAAfA,UAAU,CAACuB,IAAI,SAAW,GAA1BvB,KAAAA,CAA0B,GAA1BA,IAAe,CAAEwB,SAAS,CAACC,MAAM,CAAA,IACnC,CAACzB,CAAAA,CAAAA,IAAe,GAAfA,UAAU,CAACuB,IAAI,SAAW,GAA1BvB,KAAAA,CAA0B,GAA1BA,IAAe,CAAEwB,SAAS,CAACE,QAAQ,CAAC,KAAK,CAAC,CAAA,AAAC;IAC9C,OAAON,aAAa,CAAC;AACvB,CAAC"}
|
|
@@ -126,34 +126,23 @@ class DevServerManagerActions {
|
|
|
126
126
|
_log.log();
|
|
127
127
|
}
|
|
128
128
|
async openJsInspectorAsync() {
|
|
129
|
-
const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();
|
|
130
|
-
const apps = await (0, _jsInspector.queryAllInspectorAppsAsync)(metroServerOrigin);
|
|
131
|
-
let app = null;
|
|
132
|
-
if (!apps.length) {
|
|
133
|
-
return _log.warn((0, _chalk().default)`{bold Debug:} No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine. ${(0, _link.learnMore)("https://docs.expo.dev/guides/using-hermes/")}`);
|
|
134
|
-
}
|
|
135
|
-
if (apps.length === 1) {
|
|
136
|
-
app = apps[0];
|
|
137
|
-
} else {
|
|
138
|
-
const choices = apps.map((app)=>({
|
|
139
|
-
title: app.deviceName ?? "Unknown device",
|
|
140
|
-
value: app.id,
|
|
141
|
-
app
|
|
142
|
-
}));
|
|
143
|
-
const value = await (0, _prompts.selectAsync)((0, _chalk().default)`Debug target {dim (Hermes only)}`, choices);
|
|
144
|
-
const menuItem = choices.find((item)=>item.value === value);
|
|
145
|
-
if (!menuItem) {
|
|
146
|
-
return _log.error((0, _chalk().default)`{bold Debug:} No device available for "${value}"`);
|
|
147
|
-
}
|
|
148
|
-
app = menuItem.app;
|
|
149
|
-
}
|
|
150
|
-
if (!app) {
|
|
151
|
-
return _log.error((0, _chalk().default)`{bold Debug:} No device selected`);
|
|
152
|
-
}
|
|
153
129
|
try {
|
|
154
|
-
|
|
130
|
+
const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();
|
|
131
|
+
const apps = await (0, _jsInspector.queryAllInspectorAppsAsync)(metroServerOrigin);
|
|
132
|
+
if (!apps.length) {
|
|
133
|
+
return _log.warn((0, _chalk().default)`{bold Debug:} No compatible apps connected, React Native DevTools can only be used with Hermes. ${(0, _link.learnMore)("https://docs.expo.dev/guides/using-hermes/")}`);
|
|
134
|
+
}
|
|
135
|
+
const app = await (0, _jsInspector.promptInspectorAppAsync)(apps);
|
|
136
|
+
if (!app) {
|
|
137
|
+
return _log.error((0, _chalk().default)`{bold Debug:} No inspectable device selected`);
|
|
138
|
+
}
|
|
139
|
+
if (!await (0, _jsInspector.openJsInspector)(metroServerOrigin, app)) {
|
|
140
|
+
_log.warn((0, _chalk().default)`{bold Debug:} Failed to open the React Native DevTools, see debug logs for more info.`);
|
|
141
|
+
}
|
|
155
142
|
} catch (error) {
|
|
156
|
-
|
|
143
|
+
// Handle aborting prompt
|
|
144
|
+
if (error.code === "ABORTED") return;
|
|
145
|
+
_log.error("Failed to open the React Native DevTools.");
|
|
157
146
|
_log.exception(error);
|
|
158
147
|
}
|
|
159
148
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/interface/interactiveActions.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { BLT, printHelp, printItem, printQRCode, printUsage, StartOptions } from './commandsTable';\nimport * as Log from '../../log';\nimport { delayAsync } from '../../utils/delay';\nimport { env } from '../../utils/env';\nimport { learnMore } from '../../utils/link';\nimport { openBrowserAsync } from '../../utils/open';\nimport { ExpoChoice, selectAsync } from '../../utils/prompts';\nimport { DevServerManager } from '../server/DevServerManager';\nimport {\n addReactDevToolsReloadListener,\n startReactDevToolsProxyAsync,\n} from '../server/ReactDevToolsProxy';\nimport {\n MetroInspectorProxyApp,\n openJsInspector,\n queryAllInspectorAppsAsync,\n} from '../server/middleware/inspector/JsInspector';\n\nconst debug = require('debug')('expo:start:interface:interactiveActions') as typeof console.log;\n\ninterface MoreToolMenuItem extends ExpoChoice<string> {\n action?: () => unknown;\n}\n\n/** Wraps the DevServerManager and adds an interface for user actions. */\nexport class DevServerManagerActions {\n constructor(\n private devServerManager: DevServerManager,\n private options: Pick<StartOptions, 'devClient' | 'platforms'>\n ) {}\n\n printDevServerInfo(\n options: Pick<StartOptions, 'devClient' | 'isWebSocketsEnabled' | 'platforms'>\n ) {\n // If native dev server is running, print its URL.\n if (this.devServerManager.getNativeDevServerPort()) {\n const devServer = this.devServerManager.getDefaultDevServer();\n try {\n const nativeRuntimeUrl = devServer.getNativeRuntimeUrl()!;\n const interstitialPageUrl = devServer.getRedirectUrl();\n\n printQRCode(interstitialPageUrl ?? nativeRuntimeUrl);\n\n if (interstitialPageUrl) {\n Log.log(\n printItem(\n chalk`Choose an app to open your project at {underline ${interstitialPageUrl}}`\n )\n );\n }\n\n if (env.__EXPO_E2E_TEST) {\n // Print the URL to stdout for tests\n console.info(\n `[__EXPO_E2E_TEST:server] ${JSON.stringify({ url: devServer.getDevServerUrl() })}`\n );\n }\n\n Log.log(printItem(chalk`Metro waiting on {underline ${nativeRuntimeUrl}}`));\n if (options.devClient === false) {\n // TODO: if development build, change this message!\n Log.log(\n printItem('Scan the QR code above with Expo Go (Android) or the Camera app (iOS)')\n );\n } else {\n Log.log(\n printItem(\n 'Scan the QR code above to open the project in a development build. ' +\n learnMore('https://expo.fyi/start')\n )\n );\n }\n } catch (error) {\n console.log('err', error);\n // @ts-ignore: If there is no development build scheme, then skip the QR code.\n if (error.code !== 'NO_DEV_CLIENT_SCHEME') {\n throw error;\n } else {\n const serverUrl = devServer.getDevServerUrl();\n Log.log(printItem(chalk`Metro waiting on {underline ${serverUrl}}`));\n Log.log(printItem(`Linking is disabled because the client scheme cannot be resolved.`));\n }\n }\n }\n\n if (this.options.platforms?.includes('web')) {\n const webDevServer = this.devServerManager.getWebDevServer();\n const webUrl = webDevServer?.getDevServerUrl({ hostType: 'localhost' });\n if (webUrl) {\n Log.log();\n Log.log(printItem(chalk`Web is waiting on {underline ${webUrl}}`));\n }\n }\n\n printUsage(options, { verbose: false });\n printHelp();\n Log.log();\n }\n\n async openJsInspectorAsync() {\n const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();\n const apps = await queryAllInspectorAppsAsync(metroServerOrigin);\n let app: MetroInspectorProxyApp | null = null;\n\n if (!apps.length) {\n return Log.warn(\n chalk`{bold Debug:} No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine. ${learnMore(\n 'https://docs.expo.dev/guides/using-hermes/'\n )}`\n );\n }\n\n if (apps.length === 1) {\n app = apps[0];\n } else {\n const choices = apps.map((app) => ({\n title: app.deviceName ?? 'Unknown device',\n value: app.id,\n app,\n }));\n\n const value = await selectAsync(chalk`Debug target {dim (Hermes only)}`, choices);\n const menuItem = choices.find((item) => item.value === value);\n if (!menuItem) {\n return Log.error(chalk`{bold Debug:} No device available for \"${value}\"`);\n }\n\n app = menuItem.app;\n }\n\n if (!app) {\n return Log.error(chalk`{bold Debug:} No device selected`);\n }\n\n try {\n await openJsInspector(metroServerOrigin, app);\n } catch (error: any) {\n Log.error('Failed to open JavaScript inspector. This is often an issue with Google Chrome.');\n Log.exception(error);\n }\n }\n\n reloadApp() {\n Log.log(`${BLT} Reloading apps`);\n // Send reload requests over the dev servers\n this.devServerManager.broadcastMessage('reload');\n }\n\n async openMoreToolsAsync() {\n // Options match: Chrome > View > Developer\n try {\n const defaultMenuItems: MoreToolMenuItem[] = [\n { title: 'Inspect elements', value: 'toggleElementInspector' },\n { title: 'Toggle performance monitor', value: 'togglePerformanceMonitor' },\n { title: 'Toggle developer menu', value: 'toggleDevMenu' },\n { title: 'Reload app', value: 'reload' },\n {\n title: 'Open React devtools',\n value: 'openReactDevTools',\n action: this.openReactDevToolsAsync.bind(this),\n },\n // TODO: Maybe a \"View Source\" option to open code.\n ];\n const pluginMenuItems = (\n await this.devServerManager.devtoolsPluginManager.queryPluginsAsync()\n ).map((plugin) => ({\n title: chalk`Open {bold ${plugin.packageName}}`,\n value: `devtoolsPlugin:${plugin.packageName}`,\n action: async () => {\n const url = new URL(\n plugin.webpageEndpoint,\n this.devServerManager\n .getDefaultDevServer()\n .getUrlCreator()\n .constructUrl({ scheme: 'http' })\n );\n await openBrowserAsync(url.toString());\n },\n }));\n const menuItems = [...defaultMenuItems, ...pluginMenuItems];\n const value = await selectAsync(chalk`Dev tools {dim (native only)}`, menuItems);\n const menuItem = menuItems.find((item) => item.value === value);\n if (menuItem?.action) {\n menuItem.action();\n } else if (menuItem?.value) {\n this.devServerManager.broadcastMessage('sendDevCommand', { name: menuItem.value });\n }\n } catch (error: any) {\n debug(error);\n // do nothing\n } finally {\n printHelp();\n }\n }\n\n async openReactDevToolsAsync() {\n await startReactDevToolsProxyAsync();\n const url = this.devServerManager.getDefaultDevServer().getReactDevToolsUrl();\n await openBrowserAsync(url);\n addReactDevToolsReloadListener(() => {\n this.reconnectReactDevTools();\n });\n this.reconnectReactDevTools();\n }\n\n async reconnectReactDevTools() {\n // Wait a little time for react-devtools to be initialized in browser\n await delayAsync(3000);\n this.devServerManager.broadcastMessage('sendDevCommand', { name: 'reconnectReactDevTools' });\n }\n\n toggleDevMenu() {\n Log.log(`${BLT} Toggling dev menu`);\n this.devServerManager.broadcastMessage('devMenu');\n }\n}\n"],"names":["DevServerManagerActions","debug","require","constructor","devServerManager","options","printDevServerInfo","getNativeDevServerPort","devServer","getDefaultDevServer","nativeRuntimeUrl","getNativeRuntimeUrl","interstitialPageUrl","getRedirectUrl","printQRCode","Log","log","printItem","chalk","env","__EXPO_E2E_TEST","console","info","JSON","stringify","url","getDevServerUrl","devClient","learnMore","error","code","serverUrl","platforms","includes","webDevServer","getWebDevServer","webUrl","hostType","printUsage","verbose","printHelp","openJsInspectorAsync","metroServerOrigin","getJsInspectorBaseUrl","apps","queryAllInspectorAppsAsync","app","length","warn","choices","map","title","deviceName","value","id","selectAsync","menuItem","find","item","openJsInspector","exception","reloadApp","BLT","broadcastMessage","openMoreToolsAsync","defaultMenuItems","action","openReactDevToolsAsync","bind","pluginMenuItems","devtoolsPluginManager","queryPluginsAsync","plugin","packageName","URL","webpageEndpoint","getUrlCreator","constructUrl","scheme","openBrowserAsync","toString","menuItems","name","startReactDevToolsProxyAsync","getReactDevToolsUrl","addReactDevToolsReloadListener","reconnectReactDevTools","delayAsync","toggleDevMenu"],"mappings":"AAAA;;;;+BA2BaA,yBAAuB;;aAAvBA,uBAAuB;;;8DA3BlB,OAAO;;;;;;+BAEwD,iBAAiB;2DAC7E,WAAW;uBACL,mBAAmB;qBAC1B,iBAAiB;sBACX,kBAAkB;sBACX,kBAAkB;yBACX,qBAAqB;oCAKtD,8BAA8B;6BAK9B,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEnD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,yCAAyC,CAAC,AAAsB,AAAC;AAOzF,MAAMF,uBAAuB;IAClCG,YACUC,gBAAkC,EAClCC,OAAsD,CAC9D;QAFQD,wBAAAA,gBAAkC,CAAA;QAClCC,eAAAA,OAAsD,CAAA;IAC7D;IAEHC,kBAAkB,CAChBD,OAA8E,EAC9E;YAoDI,GAAsB;QAnD1B,kDAAkD;QAClD,IAAI,IAAI,CAACD,gBAAgB,CAACG,sBAAsB,EAAE,EAAE;YAClD,MAAMC,SAAS,GAAG,IAAI,CAACJ,gBAAgB,CAACK,mBAAmB,EAA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F,CAAC;QACH,EAAE,OAAOxB,KAAK,EAAO;YACnB5B,KAAK,CAAC4B,KAAK,CAAC,CAAC;QACb,aAAa;QACf,CAAC,QAAS;YACRW,IAAAA,cAAS,UAAA,GAAE,CAAC;QACd,CAAC;IACH;UAEM2B,sBAAsB,GAAG;QAC7B,MAAMgB,IAAAA,mBAA4B,6BAAA,GAAE,CAAC;QACrC,MAAM1D,GAAG,GAAG,IAAI,CAACrB,gBAAgB,CAACK,mBAAmB,EAAE,CAAC2E,mBAAmB,EAAE,AAAC;QAC9E,MAAML,IAAAA,KAAgB,iBAAA,EAACtD,GAAG,CAAC,CAAC;QAC5B4D,IAAAA,mBAA8B,+BAAA,EAAC,IAAM;YACnC,IAAI,CAACC,sBAAsB,EAAE,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,IAAI,CAACA,sBAAsB,EAAE,CAAC;IAChC;UAEMA,sBAAsB,GAAG;QAC7B,qEAAqE;QACrE,MAAMC,IAAAA,MAAU,WAAA,EAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAACnF,gBAAgB,CAAC2D,gBAAgB,CAAC,gBAAgB,EAAE;YAAEmB,IAAI,EAAE,wBAAwB;SAAE,CAAC,CAAC;IAC/F;IAEAM,aAAa,GAAG;QACdzE,IAAG,CAACC,GAAG,CAAC,CAAC,EAAE8C,cAAG,IAAA,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACpC,IAAI,CAAC1D,gBAAgB,CAAC2D,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACpD;CACD"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/interface/interactiveActions.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { BLT, printHelp, printItem, printQRCode, printUsage, StartOptions } from './commandsTable';\nimport * as Log from '../../log';\nimport { delayAsync } from '../../utils/delay';\nimport { env } from '../../utils/env';\nimport { learnMore } from '../../utils/link';\nimport { openBrowserAsync } from '../../utils/open';\nimport { ExpoChoice, selectAsync } from '../../utils/prompts';\nimport { DevServerManager } from '../server/DevServerManager';\nimport {\n addReactDevToolsReloadListener,\n startReactDevToolsProxyAsync,\n} from '../server/ReactDevToolsProxy';\nimport {\n openJsInspector,\n queryAllInspectorAppsAsync,\n promptInspectorAppAsync,\n} from '../server/middleware/inspector/JsInspector';\n\nconst debug = require('debug')('expo:start:interface:interactiveActions') as typeof console.log;\n\ninterface MoreToolMenuItem extends ExpoChoice<string> {\n action?: () => unknown;\n}\n\n/** Wraps the DevServerManager and adds an interface for user actions. */\nexport class DevServerManagerActions {\n constructor(\n private devServerManager: DevServerManager,\n private options: Pick<StartOptions, 'devClient' | 'platforms'>\n ) {}\n\n printDevServerInfo(\n options: Pick<StartOptions, 'devClient' | 'isWebSocketsEnabled' | 'platforms'>\n ) {\n // If native dev server is running, print its URL.\n if (this.devServerManager.getNativeDevServerPort()) {\n const devServer = this.devServerManager.getDefaultDevServer();\n try {\n const nativeRuntimeUrl = devServer.getNativeRuntimeUrl()!;\n const interstitialPageUrl = devServer.getRedirectUrl();\n\n printQRCode(interstitialPageUrl ?? nativeRuntimeUrl);\n\n if (interstitialPageUrl) {\n Log.log(\n printItem(\n chalk`Choose an app to open your project at {underline ${interstitialPageUrl}}`\n )\n );\n }\n\n if (env.__EXPO_E2E_TEST) {\n // Print the URL to stdout for tests\n console.info(\n `[__EXPO_E2E_TEST:server] ${JSON.stringify({ url: devServer.getDevServerUrl() })}`\n );\n }\n\n Log.log(printItem(chalk`Metro waiting on {underline ${nativeRuntimeUrl}}`));\n if (options.devClient === false) {\n // TODO: if development build, change this message!\n Log.log(\n printItem('Scan the QR code above with Expo Go (Android) or the Camera app (iOS)')\n );\n } else {\n Log.log(\n printItem(\n 'Scan the QR code above to open the project in a development build. ' +\n learnMore('https://expo.fyi/start')\n )\n );\n }\n } catch (error) {\n console.log('err', error);\n // @ts-ignore: If there is no development build scheme, then skip the QR code.\n if (error.code !== 'NO_DEV_CLIENT_SCHEME') {\n throw error;\n } else {\n const serverUrl = devServer.getDevServerUrl();\n Log.log(printItem(chalk`Metro waiting on {underline ${serverUrl}}`));\n Log.log(printItem(`Linking is disabled because the client scheme cannot be resolved.`));\n }\n }\n }\n\n if (this.options.platforms?.includes('web')) {\n const webDevServer = this.devServerManager.getWebDevServer();\n const webUrl = webDevServer?.getDevServerUrl({ hostType: 'localhost' });\n if (webUrl) {\n Log.log();\n Log.log(printItem(chalk`Web is waiting on {underline ${webUrl}}`));\n }\n }\n\n printUsage(options, { verbose: false });\n printHelp();\n Log.log();\n }\n\n async openJsInspectorAsync() {\n try {\n const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();\n const apps = await queryAllInspectorAppsAsync(metroServerOrigin);\n if (!apps.length) {\n return Log.warn(\n chalk`{bold Debug:} No compatible apps connected, React Native DevTools can only be used with Hermes. ${learnMore(\n 'https://docs.expo.dev/guides/using-hermes/'\n )}`\n );\n }\n\n const app = await promptInspectorAppAsync(apps);\n if (!app) {\n return Log.error(chalk`{bold Debug:} No inspectable device selected`);\n }\n\n if (!(await openJsInspector(metroServerOrigin, app))) {\n Log.warn(\n chalk`{bold Debug:} Failed to open the React Native DevTools, see debug logs for more info.`\n );\n }\n } catch (error: any) {\n // Handle aborting prompt\n if (error.code === 'ABORTED') return;\n\n Log.error('Failed to open the React Native DevTools.');\n Log.exception(error);\n }\n }\n\n reloadApp() {\n Log.log(`${BLT} Reloading apps`);\n // Send reload requests over the dev servers\n this.devServerManager.broadcastMessage('reload');\n }\n\n async openMoreToolsAsync() {\n // Options match: Chrome > View > Developer\n try {\n const defaultMenuItems: MoreToolMenuItem[] = [\n { title: 'Inspect elements', value: 'toggleElementInspector' },\n { title: 'Toggle performance monitor', value: 'togglePerformanceMonitor' },\n { title: 'Toggle developer menu', value: 'toggleDevMenu' },\n { title: 'Reload app', value: 'reload' },\n {\n title: 'Open React devtools',\n value: 'openReactDevTools',\n action: this.openReactDevToolsAsync.bind(this),\n },\n // TODO: Maybe a \"View Source\" option to open code.\n ];\n const pluginMenuItems = (\n await this.devServerManager.devtoolsPluginManager.queryPluginsAsync()\n ).map((plugin) => ({\n title: chalk`Open {bold ${plugin.packageName}}`,\n value: `devtoolsPlugin:${plugin.packageName}`,\n action: async () => {\n const url = new URL(\n plugin.webpageEndpoint,\n this.devServerManager\n .getDefaultDevServer()\n .getUrlCreator()\n .constructUrl({ scheme: 'http' })\n );\n await openBrowserAsync(url.toString());\n },\n }));\n const menuItems = [...defaultMenuItems, ...pluginMenuItems];\n const value = await selectAsync(chalk`Dev tools {dim (native only)}`, menuItems);\n const menuItem = menuItems.find((item) => item.value === value);\n if (menuItem?.action) {\n menuItem.action();\n } else if (menuItem?.value) {\n this.devServerManager.broadcastMessage('sendDevCommand', { name: menuItem.value });\n }\n } catch (error: any) {\n debug(error);\n // do nothing\n } finally {\n printHelp();\n }\n }\n\n async openReactDevToolsAsync() {\n await startReactDevToolsProxyAsync();\n const url = this.devServerManager.getDefaultDevServer().getReactDevToolsUrl();\n await openBrowserAsync(url);\n addReactDevToolsReloadListener(() => {\n this.reconnectReactDevTools();\n });\n this.reconnectReactDevTools();\n }\n\n async reconnectReactDevTools() {\n // Wait a little time for react-devtools to be initialized in browser\n await delayAsync(3000);\n this.devServerManager.broadcastMessage('sendDevCommand', { name: 'reconnectReactDevTools' });\n }\n\n toggleDevMenu() {\n Log.log(`${BLT} Toggling dev menu`);\n this.devServerManager.broadcastMessage('devMenu');\n }\n}\n"],"names":["DevServerManagerActions","debug","require","constructor","devServerManager","options","printDevServerInfo","getNativeDevServerPort","devServer","getDefaultDevServer","nativeRuntimeUrl","getNativeRuntimeUrl","interstitialPageUrl","getRedirectUrl","printQRCode","Log","log","printItem","chalk","env","__EXPO_E2E_TEST","console","info","JSON","stringify","url","getDevServerUrl","devClient","learnMore","error","code","serverUrl","platforms","includes","webDevServer","getWebDevServer","webUrl","hostType","printUsage","verbose","printHelp","openJsInspectorAsync","metroServerOrigin","getJsInspectorBaseUrl","apps","queryAllInspectorAppsAsync","length","warn","app","promptInspectorAppAsync","openJsInspector","exception","reloadApp","BLT","broadcastMessage","openMoreToolsAsync","defaultMenuItems","title","value","action","openReactDevToolsAsync","bind","pluginMenuItems","devtoolsPluginManager","queryPluginsAsync","map","plugin","packageName","URL","webpageEndpoint","getUrlCreator","constructUrl","scheme","openBrowserAsync","toString","menuItems","selectAsync","menuItem","find","item","name","startReactDevToolsProxyAsync","getReactDevToolsUrl","addReactDevToolsReloadListener","reconnectReactDevTools","delayAsync","toggleDevMenu"],"mappings":"AAAA;;;;+BA2BaA,yBAAuB;;aAAvBA,uBAAuB;;;8DA3BlB,OAAO;;;;;;+BAEwD,iBAAiB;2DAC7E,WAAW;uBACL,mBAAmB;qBAC1B,iBAAiB;sBACX,kBAAkB;sBACX,kBAAkB;yBACX,qBAAqB;oCAKtD,8BAA8B;6BAK9B,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEnD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,yCAAyC,CAAC,AAAsB,AAAC;AAOzF,MAAMF,uBAAuB;IAClCG,YACUC,gBAAkC,EAClCC,OAAsD,CAC9D;QAFQD,wBAAAA,gBAAkC,CAAA;QAClCC,eAAAA,OAAsD,CAAA;IAC7D;IAEHC,kBAAkB,CAChBD,OAA8E,EAC9E;YAoDI,GAAsB;QAnD1B,kDAAkD;QAClD,IAAI,IAAI,CAACD,gBAAgB,CAACG,sBAAsB,EAAE,EAAE;YAClD,MAAMC,SAAS,GAAG,IAAI,CAACJ,gBAAgB,CAACK,mBAAmB,EAAE,AAAC;YAC9D,IAAI;gBACF,MAAMC,gBAAgB,GAAGF,SAAS,CAACG,mBAAmB,EAAE,AAAC,AAAC;gBAC1D,MAAMC,mBAAmB,GAAGJ,SAAS,CAACK,cAAc,EAAE,AAAC;gBAEvDC,IAAAA,cAAW,YAAA,EAACF,mBAAmB,IAAIF,gBAAgB,CAAC,CAAC;gBAErD,IAAIE,mBAAmB,EAAE;oBACvBG,I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BAAkB,CAAC,CAAC,CAAC;QACpC,IAAI,CAACjD,gBAAgB,CAACkD,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACpD;CACD"}
|
|
@@ -67,6 +67,13 @@ function _bundleToString() {
|
|
|
67
67
|
};
|
|
68
68
|
return data;
|
|
69
69
|
}
|
|
70
|
+
function _getGraphId() {
|
|
71
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("metro/src/lib/getGraphId"));
|
|
72
|
+
_getGraphId = function() {
|
|
73
|
+
return data;
|
|
74
|
+
};
|
|
75
|
+
return data;
|
|
76
|
+
}
|
|
70
77
|
function _path() {
|
|
71
78
|
const data = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
72
79
|
_path = function() {
|
|
@@ -156,7 +163,6 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
156
163
|
return newObj;
|
|
157
164
|
}
|
|
158
165
|
const debug = require("debug")("expo:start:server:metro");
|
|
159
|
-
const getGraphId = require("metro/src/lib/getGraphId");
|
|
160
166
|
/** Default port to use for apps running in Expo Go. */ const EXPO_GO_METRO_PORT = 8081;
|
|
161
167
|
/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */ const DEV_CLIENT_METRO_PORT = 8081;
|
|
162
168
|
class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
@@ -356,8 +362,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
356
362
|
template: staticHtml,
|
|
357
363
|
devBundleUrl: devBundleUrlPathname,
|
|
358
364
|
baseUrl,
|
|
359
|
-
|
|
360
|
-
hydrate: false
|
|
365
|
+
hydrate: true
|
|
361
366
|
});
|
|
362
367
|
return {
|
|
363
368
|
content,
|
|
@@ -430,6 +435,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
430
435
|
unstable_transformProfile: extraOptions.unstable_transformProfile ?? expoBundleOptions.unstable_transformProfile ?? "default",
|
|
431
436
|
customTransformOptions: expoBundleOptions.customTransformOptions ?? Object.create(null),
|
|
432
437
|
platform: expoBundleOptions.platform ?? "web",
|
|
438
|
+
// @ts-expect-error: `runtimeBytecodeVersion` does not exist in `expoBundleOptions` or `TransformInputOptions`
|
|
433
439
|
runtimeBytecodeVersion: expoBundleOptions.runtimeBytecodeVersion
|
|
434
440
|
};
|
|
435
441
|
const resolvedEntryFilePath = await this.resolveRelativePathAsync(filePath, {
|
|
@@ -517,15 +523,34 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
517
523
|
}
|
|
518
524
|
async singlePageReactServerComponentExportAsync(options, files, extraOptions = {}) {
|
|
519
525
|
// NOTE(EvanBacon): This will not support any code elimination since it's a static pass.
|
|
520
|
-
const { reactClientReferences: clientBoundaries , cssModules } = await this.rscRenderer.getExpoRouterClientReferencesAsync({
|
|
526
|
+
const { reactClientReferences: clientBoundaries , reactServerReferences: serverActionReferencesInServer , cssModules , } = await this.rscRenderer.getExpoRouterClientReferencesAsync({
|
|
521
527
|
platform: options.platform
|
|
522
528
|
}, files);
|
|
529
|
+
// TODO: The output keys should be in production format or use a lookup manifest.
|
|
523
530
|
debug("Evaluated client boundaries:", clientBoundaries);
|
|
524
531
|
// Run metro bundler and create the JS bundles/source maps.
|
|
525
532
|
const bundle = await this.legacySinglePageExportBundleAsync({
|
|
526
533
|
...options,
|
|
527
534
|
clientBoundaries
|
|
528
535
|
}, extraOptions);
|
|
536
|
+
// Get the React server action boundaries from the client bundle.
|
|
537
|
+
const reactServerReferences = bundle.artifacts.filter((a)=>a.type === "js").map((artifact)=>{
|
|
538
|
+
var ref;
|
|
539
|
+
return (ref = artifact.metadata.reactServerReferences) == null ? void 0 : ref.map((ref)=>(0, _createServerComponentsMiddleware.fileURLToFilePath)(ref));
|
|
540
|
+
})// TODO: Segment by module for splitting.
|
|
541
|
+
.flat().filter(Boolean);
|
|
542
|
+
if (!reactServerReferences) {
|
|
543
|
+
// Issue with babel plugin / metro-config.
|
|
544
|
+
throw new Error("Static server action references were not returned from the Metro client bundle");
|
|
545
|
+
}
|
|
546
|
+
debug("React server action boundaries from client:", reactServerReferences);
|
|
547
|
+
await this.rscRenderer.exportServerActionsAsync({
|
|
548
|
+
platform: options.platform,
|
|
549
|
+
entryPoints: [
|
|
550
|
+
...serverActionReferencesInServer,
|
|
551
|
+
...reactServerReferences
|
|
552
|
+
]
|
|
553
|
+
}, files);
|
|
529
554
|
// Inject the global CSS that was imported during the server render.
|
|
530
555
|
bundle.artifacts.push(...cssModules);
|
|
531
556
|
const serverRoot = (0, _paths().getMetroServerRoot)(this.projectRoot);
|
|
@@ -563,9 +588,9 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
563
588
|
ssrManifest
|
|
564
589
|
}, files);
|
|
565
590
|
// Save the SSR manifest so we can perform more replacements in the server renderer and with server actions.
|
|
566
|
-
files.set(`_expo/rsc/${options.platform}/ssr-manifest.
|
|
591
|
+
files.set(`_expo/rsc/${options.platform}/ssr-manifest.js`, {
|
|
567
592
|
targetDomain: "server",
|
|
568
|
-
contents: JSON.stringify(// TODO: Add a less leaky version of this across the framework with just [key, value] (module ID, chunk).
|
|
593
|
+
contents: "module.exports = " + JSON.stringify(// TODO: Add a less leaky version of this across the framework with just [key, value] (module ID, chunk).
|
|
569
594
|
Object.fromEntries(Array.from(ssrManifest.entries()).map(([key, value])=>[
|
|
570
595
|
_path().default.join(serverRoot, key),
|
|
571
596
|
[
|
|
@@ -1055,9 +1080,8 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
1055
1080
|
entryFile: resolvedEntryFilePath,
|
|
1056
1081
|
minify: transformOptions.minify,
|
|
1057
1082
|
platform: transformOptions.platform,
|
|
1058
|
-
// @ts-expect-error: typed incorrectly upstream
|
|
1059
1083
|
customResolverOptions: resolverOptions.customResolverOptions,
|
|
1060
|
-
customTransformOptions: transformOptions.customTransformOptions
|
|
1084
|
+
customTransformOptions: transformOptions.customTransformOptions ?? {}
|
|
1061
1085
|
},
|
|
1062
1086
|
isPrefetch: false,
|
|
1063
1087
|
type: "bundle_build_started"
|
|
@@ -1074,7 +1098,6 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
1074
1098
|
resolvedEntryFilePath, transformOptions, resolverOptions, {
|
|
1075
1099
|
onProgress,
|
|
1076
1100
|
shallow: graphOptions.shallow,
|
|
1077
|
-
// @ts-expect-error: typed incorrectly
|
|
1078
1101
|
lazy: graphOptions.lazy
|
|
1079
1102
|
});
|
|
1080
1103
|
delta = props.delta;
|
|
@@ -1085,7 +1108,6 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
1085
1108
|
resolvedEntryFilePath, transformOptions, resolverOptions, {
|
|
1086
1109
|
onProgress,
|
|
1087
1110
|
shallow: graphOptions.shallow,
|
|
1088
|
-
// @ts-expect-error: typed incorrectly
|
|
1089
1111
|
lazy: graphOptions.lazy
|
|
1090
1112
|
}));
|
|
1091
1113
|
delta = props1.delta;
|
|
@@ -1198,7 +1220,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
1198
1220
|
getMetroRevision(resolvedEntryFilePath, { graphOptions , transformOptions , resolverOptions }) {
|
|
1199
1221
|
(0, _assert().default)(this.metro, "Metro server must be running to bundle directly.");
|
|
1200
1222
|
const config = this.metro._config;
|
|
1201
|
-
const graphId =
|
|
1223
|
+
const graphId = (0, _getGraphId().default)(resolvedEntryFilePath, transformOptions, {
|
|
1202
1224
|
unstable_allowRequireContext: config.transformer.unstable_allowRequireContext,
|
|
1203
1225
|
resolverOptions,
|
|
1204
1226
|
shallow: graphOptions.shallow,
|