@expo/cli 57.0.32 → 57.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +1 -1
- package/build/src/events/index.js +1 -1
- package/build/src/export/compileHermesArtifacts.js +28 -0
- package/build/src/export/compileHermesArtifacts.js.map +1 -0
- package/build/src/export/embed/exportEmbedAsync.js +4 -0
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/exportApp.js +9 -5
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportDomComponents.js +5 -11
- package/build/src/export/exportDomComponents.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +3 -2
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/run/ensureNativeProject.js +3 -2
- package/build/src/run/ensureNativeProject.js.map +1 -1
- package/build/src/run/ios/appleDevice/ClientManager.js +11 -6
- package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -1
- package/build/src/run/ios/runIosAsync.js +12 -4
- package/build/src/run/ios/runIosAsync.js.map +1 -1
- package/build/src/start/interface/cliExtensionMenuItemHandler.js.map +1 -1
- package/build/src/start/interface/commandsTable.js.map +1 -1
- package/build/src/start/interface/createDevToolsMenuItems.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +6 -1
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/platforms/ios/devicectl.js +2 -5
- package/build/src/start/platforms/ios/devicectl.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +6 -9
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +1 -1
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +10 -4
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/{DevToolsPlugin.js → devtools/DevToolsPlugin.js} +14 -5
- package/build/src/start/server/devtools/DevToolsPlugin.js.map +1 -0
- package/build/src/start/server/devtools/DevToolsPlugin.schema.js +195 -0
- package/build/src/start/server/devtools/DevToolsPlugin.schema.js.map +1 -0
- package/build/src/start/server/{DevToolsPluginCliExtensionExecutor.js → devtools/DevToolsPluginCliExtensionExecutor.js} +1 -1
- package/build/src/start/server/devtools/DevToolsPluginCliExtensionExecutor.js.map +1 -0
- package/build/src/start/server/{DevToolsPluginCliExtensionResults.js → devtools/DevToolsPluginCliExtensionResults.js} +24 -12
- package/build/src/start/server/devtools/DevToolsPluginCliExtensionResults.js.map +1 -0
- package/build/src/start/server/{DevToolsPluginManager.js → devtools/DevToolsPluginManager.js} +2 -2
- package/build/src/start/server/devtools/DevToolsPluginManager.js.map +1 -0
- package/build/src/start/server/devtools/DevToolsPluginServerHelpers.js.map +1 -0
- package/build/src/start/server/{MCP.js → mcp/MCP.js} +25 -15
- package/build/src/start/server/mcp/MCP.js.map +1 -0
- package/build/src/start/server/{MCPDevToolsPluginCLIExtensions.js → mcp/MCPDevToolsPluginCLIExtensions.js} +14 -27
- package/build/src/start/server/mcp/MCPDevToolsPluginCLIExtensions.js.map +1 -0
- package/build/src/start/server/{createMCPDevToolsExtensionSchema.js → mcp/createMCPDevToolsExtensionSchema.js} +8 -15
- package/build/src/start/server/mcp/createMCPDevToolsExtensionSchema.js.map +1 -0
- package/build/src/start/server/metro/MetroBundlerDevServer.js +2 -4
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +6 -2
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +1 -1
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +4 -1
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/middleware/openHandlers.js +2 -6
- package/build/src/start/server/middleware/openHandlers.js.map +1 -1
- package/build/src/start/startAsync.js +2 -4
- package/build/src/start/startAsync.js.map +1 -1
- package/build/src/utils/obj.js +1 -1
- package/build/src/utils/obj.js.map +1 -1
- package/build/src/utils/open.js +47 -31
- package/build/src/utils/open.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +26 -22
- package/build/src/start/server/DevToolsPlugin.js.map +0 -1
- package/build/src/start/server/DevToolsPlugin.schema.js +0 -84
- package/build/src/start/server/DevToolsPlugin.schema.js.map +0 -1
- package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js.map +0 -1
- package/build/src/start/server/DevToolsPluginCliExtensionResults.js.map +0 -1
- package/build/src/start/server/DevToolsPluginManager.js.map +0 -1
- package/build/src/start/server/DevToolsPluginServerHelpers.js.map +0 -1
- package/build/src/start/server/MCP.js.map +0 -1
- package/build/src/start/server/MCPDevToolsPluginCLIExtensions.js.map +0 -1
- package/build/src/start/server/createMCPDevToolsExtensionSchema.js.map +0 -1
- /package/build/src/start/server/{DevToolsPluginServerHelpers.js → devtools/DevToolsPluginServerHelpers.js} +0 -0
package/build/bin/cli
CHANGED
|
@@ -76,7 +76,7 @@ function getInitMetadata() {
|
|
|
76
76
|
return {
|
|
77
77
|
format: 'v0-jsonl',
|
|
78
78
|
// Version is added in the build script.
|
|
79
|
-
version: "57.0.
|
|
79
|
+
version: "57.0.34" ?? 'UNVERSIONED'
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
function getWellKnownTemporaryLogFile(projectRoot, command) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "compileHermesArtifactsAsync", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return compileHermesArtifactsAsync;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
async function compileHermesArtifactsAsync(projectRoot, artifacts) {
|
|
12
|
+
for (const artifact of artifacts){
|
|
13
|
+
if (artifact.type !== 'js' || Buffer.isBuffer(artifact.source)) continue;
|
|
14
|
+
const filename = artifact.filename;
|
|
15
|
+
const map = artifacts.find((asset)=>asset.type === 'map' && asset.filename === `${filename}.map`);
|
|
16
|
+
let transformJsAssetToHermesBytecodeAsync;
|
|
17
|
+
try {
|
|
18
|
+
({ transformJsAssetToHermesBytecodeAsync } = require('@expo/metro-config/build/serializer/hermesArtifacts'));
|
|
19
|
+
} catch (cause) {
|
|
20
|
+
throw new Error('Hermes artifact compilation is unavailable. Align the @expo/metro-config version resolved by @expo/cli with the project serializer.', {
|
|
21
|
+
cause
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
await transformJsAssetToHermesBytecodeAsync(projectRoot, artifact, map);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=compileHermesArtifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/export/compileHermesArtifacts.ts"],"sourcesContent":["import type { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\n\nexport async function compileHermesArtifactsAsync(\n projectRoot: string,\n artifacts: SerialAsset[]\n): Promise<void> {\n for (const artifact of artifacts) {\n if (artifact.type !== 'js' || Buffer.isBuffer(artifact.source)) continue;\n const filename = artifact.filename;\n const map = artifacts.find(\n (asset) => asset.type === 'map' && asset.filename === `${filename}.map`\n );\n\n let transformJsAssetToHermesBytecodeAsync: typeof import('@expo/metro-config/build/serializer/hermesArtifacts').transformJsAssetToHermesBytecodeAsync;\n try {\n ({\n transformJsAssetToHermesBytecodeAsync,\n } = require('@expo/metro-config/build/serializer/hermesArtifacts'));\n } catch (cause) {\n throw new Error(\n 'Hermes artifact compilation is unavailable. Align the @expo/metro-config version resolved by @expo/cli with the project serializer.',\n { cause }\n );\n }\n await transformJsAssetToHermesBytecodeAsync(projectRoot, artifact, map);\n }\n}\n"],"names":["compileHermesArtifactsAsync","projectRoot","artifacts","artifact","type","Buffer","isBuffer","source","filename","map","find","asset","transformJsAssetToHermesBytecodeAsync","require","cause","Error"],"mappings":";;;;+BAEsBA;;;eAAAA;;;AAAf,eAAeA,4BACpBC,WAAmB,EACnBC,SAAwB;IAExB,KAAK,MAAMC,YAAYD,UAAW;QAChC,IAAIC,SAASC,IAAI,KAAK,QAAQC,OAAOC,QAAQ,CAACH,SAASI,MAAM,GAAG;QAChE,MAAMC,WAAWL,SAASK,QAAQ;QAClC,MAAMC,MAAMP,UAAUQ,IAAI,CACxB,CAACC,QAAUA,MAAMP,IAAI,KAAK,SAASO,MAAMH,QAAQ,KAAK,GAAGA,SAAS,IAAI,CAAC;QAGzE,IAAII;QACJ,IAAI;YACD,CAAA,EACCA,qCAAqC,EACtC,GAAGC,QAAQ,sDAAqD;QACnE,EAAE,OAAOC,OAAO;YACd,MAAM,IAAIC,MACR,uIACA;gBAAED;YAAM;QAEZ;QACA,MAAMF,sCAAsCX,aAAaE,UAAUM;IACrE;AACF"}
|
|
@@ -127,6 +127,7 @@ const _ansi = require("../../utils/ansi");
|
|
|
127
127
|
const _dir = require("../../utils/dir");
|
|
128
128
|
const _env = require("../../utils/env");
|
|
129
129
|
const _nodeEnv = require("../../utils/nodeEnv");
|
|
130
|
+
const _compileHermesArtifacts = require("../compileHermesArtifacts");
|
|
130
131
|
const _exportDomComponents = require("../exportDomComponents");
|
|
131
132
|
const _exportHermes = require("../exportHermes");
|
|
132
133
|
const _persistMetroAssets = require("../persistMetroAssets");
|
|
@@ -358,6 +359,9 @@ async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
|
|
|
358
359
|
}
|
|
359
360
|
}));
|
|
360
361
|
}
|
|
362
|
+
if (options.bytecode && isHermes && !options.dev) {
|
|
363
|
+
await (0, _compileHermesArtifacts.compileHermesArtifactsAsync)(projectRoot, bundles.artifacts);
|
|
364
|
+
}
|
|
361
365
|
return {
|
|
362
366
|
files,
|
|
363
367
|
bundle: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/export/embed/exportEmbedAsync.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getConfig } from '@expo/config';\nimport { convertEntryPointToRelative } from '@expo/config/paths';\nimport Server from '@expo/metro/metro/Server';\nimport splitBundleOptions from '@expo/metro/metro/lib/splitBundleOptions';\nimport * as output from '@expo/metro/metro/shared/output/bundle';\nimport type { BundleOptions } from '@expo/metro/metro/shared/types';\nimport { patchTransformFileForPackedMaps } from '@expo/metro-config/build/serializer/packedMap';\nimport { patchMetroSourceMapStringForPackedMaps } from '@expo/metro-config/build/serializer/sourceMap';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\n\nimport type { Options } from './resolveOptions';\nimport { deserializeEagerKey, getExportEmbedOptionsKey } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { replaceMetroFileMap } from '../../start/server/metro/createFileMap-fork';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { DOM_COMPONENTS_BUNDLE_DIR } from '../../start/server/middleware/DomComponentsMiddleware';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { copyAsync, removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { setNodeEnv, loadEnvFiles } from '../../utils/nodeEnv';\nimport { exportDomComponentAsync } from '../exportDomComponents';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\nimport { copyPublicFolderAsync, getPublicFolderPath } from '../publicFolder';\nimport type { BundleAssetWithFileHashes, ExportAssetMap } from '../saveAssets';\nimport { persistMetroFilesAsync } from '../saveAssets';\nimport { exportStandaloneServerAsync } from './exportServer';\nimport { ensureProcessExitsAfterDelay } from '../../utils/exit';\n\nconst debug = require('debug')('expo:export:embed');\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (\n !bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//) &&\n !bundleOutput.match(/\\/CoreSimulator\\/Devices\\/.*\\/data\\/Containers\\/Bundle\\/Application\\//)\n ) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(`*.app/${bundleName}`, {\n cwd: bundleParent,\n absolute: true,\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n // The React Native build scripts always enable the cache reset but we shouldn't need this in CI environments.\n // By disabling it, we can eagerly bundle code before the build and reuse the cached artifacts in subsequent builds.\n if (env.CI && options.resetCache) {\n debug('CI environment detected, disabling automatic cache reset');\n options.resetCache = false;\n }\n\n setNodeEnv(options.dev ? 'development' : 'production');\n loadEnvFiles(projectRoot);\n\n // This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.\n // Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.\n // This path is also used for automatically deploying server bundles to a remote host.\n const eagerBundleOptions = env.__EXPO_EAGER_BUNDLE_OPTIONS\n ? deserializeEagerKey(env.__EXPO_EAGER_BUNDLE_OPTIONS)\n : null;\n if (eagerBundleOptions) {\n // Get the cache key for the current process to compare against the eager key.\n const inputKey = getExportEmbedOptionsKey(options);\n\n // If the app was bundled previously in the same process, then we should reuse the Metro cache.\n options.resetCache = false;\n\n if (eagerBundleOptions.key === inputKey) {\n // Copy the eager bundleOutput and assets to the new locations.\n await removeAsync(options.bundleOutput);\n\n await copyAsync(eagerBundleOptions.options.bundleOutput, options.bundleOutput);\n\n if (eagerBundleOptions.options.assetsDest && options.assetsDest) {\n await copyAsync(eagerBundleOptions.options.assetsDest, options.assetsDest);\n }\n\n console.log('info: Copied output to binary:', options.bundleOutput);\n return;\n }\n // TODO: sourcemapOutput is set on Android but not during eager. This is tolerable since it doesn't invalidate the Metro cache.\n console.log(' Eager key:', eagerBundleOptions.key);\n console.log('Request key:', inputKey);\n\n // TODO: We may want an analytic event here in the future to understand when this happens.\n console.warn('warning: Eager bundle does not match new options, bundling again.');\n }\n\n await exportEmbedInternalAsync(projectRoot, options);\n\n // Ensure the process closes after bundling\n ensureProcessExitsAfterDelay();\n}\n\n// Apple platforms (ios/tvos/macos) all build via Xcode and share the same bundle output and\n// error-reporting handling.\nconst isApplePlatform = (platform: string): boolean =>\n platform === 'ios' || platform === 'tvos' || platform === 'macos';\n\nexport async function exportEmbedInternalAsync(projectRoot: string, options: Options) {\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (isApplePlatform(options.platform)) {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets, files } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // On Android, dom components proxy files should write to the assets directory instead of the res directory.\n // We use the bundleOutput directory to get the assets directory.\n const domComponentProxyOutputDir =\n options.platform === 'android' ? path.dirname(options.bundleOutput) : options.assetsDest;\n const hasDomComponents = domComponentProxyOutputDir && files.size > 0;\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\n\n // Write dom components proxy files.\n hasDomComponents ? persistMetroFilesAsync(files, domComponentProxyOutputDir) : null,\n // Copy public folder for dom components only if\n hasDomComponents\n ? copyPublicFolderAsync(\n getPublicFolderPath(projectRoot),\n path.join(domComponentProxyOutputDir, DOM_COMPONENTS_BUNDLE_DIR)\n )\n : null,\n\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(projectRoot, assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: Awaited<ReturnType<Server['build']>>;\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n}> {\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: options.resetCache,\n maxWorkers: options.maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const { exp, pkg } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const files: ExportAssetMap = new Map();\n\n try {\n const bundles = await devServer.nativeExportBundleAsync(\n exp,\n {\n // TODO: Re-enable when we get bytecode chunk splitting working again.\n splitChunks: false, //devServer.isReactServerComponentsEnabled,\n mainModuleName: convertEntryPointToRelative(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: !!sourceMapUrl,\n bytecode: options.bytecode ?? false,\n // source map inline\n reactCompiler: !!exp.experiments?.reactCompiler,\n },\n files,\n {\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n }\n );\n\n // We optimistically build the server-side API routes code here, to ensure they're\n // valid or to enable parallel deployment in the future (TBD). This is disabled using\n // the explicit `--skip-server` flag.\n const apiRoutesEnabled =\n devServer.isReactServerComponentsEnabled || exp.web?.output === 'server';\n if (!options.skipServer && apiRoutesEnabled) {\n await exportStandaloneServerAsync(projectRoot, devServer, {\n exp,\n pkg,\n files,\n options,\n });\n }\n\n const expoDomComponentReferences = [\n ...new Set(\n bundles.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat()\n ),\n ];\n if (expoDomComponentReferences.length > 0) {\n await Promise.all(\n // TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.\n expoDomComponentReferences.map(async (filePath) => {\n const { bundle } = await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev: options.dev,\n devServer,\n isHermes,\n // don't ship sourcemap in the www.bundle\n includeSourceMaps: false,\n exp,\n files,\n });\n\n if (options.assetsDest) {\n // Save assets like a typical bundler, preserving the file paths on web.\n // This is saving web-style inside of a native app's binary.\n await persistMetroAssetsAsync(\n projectRoot,\n bundle.assets.map((asset) => ({\n ...asset,\n httpServerLocation: path.join(DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation),\n })),\n {\n files,\n platform: 'web',\n outputDirectory: options.assetsDest,\n }\n );\n }\n })\n );\n }\n\n return {\n files,\n bundle: {\n code: bundles.artifacts.filter((a: any) => a.type === 'js')[0]?.source!,\n // Can be optional when source maps aren't enabled.\n map: bundles.artifacts.filter((a: any) => a.type === 'map')[0]?.source.toString()!,\n },\n assets: bundles.assets,\n };\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (isApplePlatform(options.platform)) {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n } finally {\n devServerManager.stopAsync();\n }\n}\n\n// Exports for expo-updates\nexport async function createMetroServerAndBundleRequestAsync(\n projectRoot: string,\n options: Pick<\n Options,\n | 'maxWorkers'\n | 'config'\n | 'platform'\n | 'sourcemapOutput'\n | 'sourcemapUseAbsolutePath'\n | 'entryFile'\n | 'minify'\n | 'dev'\n | 'resetCache'\n | 'unstableTransformProfile'\n >\n): Promise<{ server: Server; bundleRequest: BundleOptions }> {\n const exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // TODO: This is slow ~40ms\n const { config } = await loadMetroConfigAsync(\n projectRoot,\n {\n // TODO: This is always enabled in the native script and there's no way to disable it.\n resetCache: options.resetCache,\n maxWorkers: options.maxWorkers,\n },\n {\n exp,\n isExporting: true,\n getMetroBundler() {\n return metro.getBundler().getBundler();\n },\n }\n );\n\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const directBundleOptions = getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n splitChunks: false,\n // TODO(@kitten): This currently has to match a filename exactly\n mainModuleName: convertEntryPointToRelative(projectRoot, options.entryFile, null),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n isExporting: true,\n // Never output bytecode in the exported bundle since that is hardcoded in the native run script.\n bytecode: false,\n hosted: false,\n });\n\n // TODO(cedric): check if we can use the proper `bundleType=bundle` and `entryPoint=mainModuleName` properties\n const bundleRequest: BundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...directBundleOptions,\n\n // NOTE(@kitten): Cast non-optional defaults\n lazy: directBundleOptions.lazy ?? Server.DEFAULT_BUNDLE_OPTIONS.lazy,\n modulesOnly: directBundleOptions.modulesOnly ?? Server.DEFAULT_BUNDLE_OPTIONS.modulesOnly,\n runModule: directBundleOptions.runModule ?? Server.DEFAULT_BUNDLE_OPTIONS.runModule,\n\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n };\n\n const { metro } = await replaceMetroFileMap(() => ({\n metro: new Server(config, {\n watch: false,\n }),\n }));\n\n // The dev server applies the same patch from `instantiateMetro.ts`;\n // this is the export-embed / `expo-updates` path, where `data.map`\n // would otherwise reach Metro's readers in the unwrapped wire shape.\n patchTransformFileForPackedMaps(metro.getBundler().getBundler());\n patchMetroSourceMapStringForPackedMaps();\n\n return { server: metro, bundleRequest };\n}\n\nexport async function exportEmbedAssetsAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions({\n ...bundleRequest,\n // @ts-ignore-error TODO(@kitten): Very unclear why this is here. Remove?\n bundleType: 'todo',\n });\n\n const dependencies = await server._bundler.getDependencies(\n // NOTE(@kitten): This isn't an `entryFile`, but instead a `mainModuleName`, that's been renamed\n // in `getMetroDirectBundleOptions`, where we've passed the already converted name\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n const config = server._config;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: config.serializer.processModuleFilter,\n assetPlugins: config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n // Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n // behavior.\n projectRoot: config.projectRoot, // this._getServerRootDir(),\n publicPath: config.transformer.publicPath,\n isHosted: false,\n });\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (isApplePlatform(options.platform)) {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n }\n}\n\nfunction isError(error: any): error is Error {\n return error instanceof Error;\n}\n"],"names":["createMetroServerAndBundleRequestAsync","exportEmbedAssetsAsync","exportEmbedAsync","exportEmbedBundleAndAssetsAsync","exportEmbedInternalAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","cwd","absolute","dot","projectRoot","options","env","CI","resetCache","setNodeEnv","dev","loadEnvFiles","eagerBundleOptions","__EXPO_EAGER_BUNDLE_OPTIONS","deserializeEagerKey","inputKey","getExportEmbedOptionsKey","key","removeAsync","copyAsync","assetsDest","console","log","warn","ensureProcessExitsAfterDelay","isApplePlatform","platform","previousPath","fs","existsSync","bundle","assets","files","mkdirSync","recursive","mode","domComponentProxyOutputDir","hasDomComponents","size","Promise","all","output","save","Log","persistMetroFilesAsync","copyPublicFolderAsync","getPublicFolderPath","join","DOM_COMPONENTS_BUNDLE_DIR","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","devServerManager","DevServerManager","startMetroAsync","minify","port","isExporting","location","resetDevServer","maxWorkers","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","exp","pkg","getConfig","skipSDKVersionRequirement","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","Map","bundles","nativeExportBundleAsync","splitChunks","mainModuleName","convertEntryPointToRelative","entryFile","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","unstable_transformProfile","unstableTransformProfile","apiRoutesEnabled","isReactServerComponentsEnabled","web","skipServer","exportStandaloneServerAsync","expoDomComponentReferences","Set","artifacts","map","artifact","Array","isArray","metadata","flat","length","filePath","exportDomComponentAsync","includeSourceMaps","asset","httpServerLocation","code","filter","a","type","source","toString","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","stopAsync","config","loadMetroConfigAsync","getMetroBundler","metro","getBundler","directBundleOptions","getMetroDirectBundleOptionsForExpoConfig","hosted","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","lazy","modulesOnly","runModule","replaceMetroFileMap","watch","patchTransformFileForPackedMaps","patchMetroSourceMapStringForPackedMaps","server","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","dependencies","_bundler","getDependencies","shallow","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","isHosted","Error"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;QAuTqBA;eAAAA;;QAsFAC;eAAAA;;QAhVAC;eAAAA;;QA0GAC;eAAAA;;QAlDAC;eAAAA;;;;yBApHI;;;;;;;yBACkB;;;;;;;gEACzB;;;;;;;gEACY;;;;;;;iEACP;;;;;;;yBAEwB;;;;;;;yBACO;;;;;;;gEAC5B;;;;;;;gEACR;;;;;;;gEACJ;;;;;;;yBACkB;;;;;;;gEAChB;;;;;;gCAG6C;qCACE;qBAC5C;kCACa;uCACK;mCACF;kCACC;yCACK;8BACe;sBAC/B;qBACa;qBACnB;yBACqB;qCACD;8BACF;oCACE;8BACmB;4BAEpB;8BACK;sBACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7C,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,SAASC,2BAA2BC,YAAoB;IACtD,+CAA+C;IAC/C,IACE,CAACA,aAAaC,KAAK,CAAC,kDACpB,C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AQD,QAAQ;YAClB,0EAA0E;YAC1E,iIAAiI;YACjI,IAAI3F,gBAAgBpB,QAAQqB,QAAQ,GAAG;gBACrC,8FAA8F;gBAC9F,IAAI,aAAa0F,SAASE,IAAAA,8CAAyB,KAAI;oBACrDF,MAAMG,OAAO,GAAGC,IAAAA,eAAS,EAACJ,MAAMG,OAAO;gBACzC;gBACAE,IAAAA,yCAAoB,EAACrH,aAAagH;YACpC;QACF;QACA,MAAMA;IACR;AACF;AAEA,SAASC,QAAQD,KAAU;IACzB,OAAOA,iBAAiB2C;AAC1B"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/embed/exportEmbedAsync.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getConfig } from '@expo/config';\nimport { convertEntryPointToRelative } from '@expo/config/paths';\nimport Server from '@expo/metro/metro/Server';\nimport splitBundleOptions from '@expo/metro/metro/lib/splitBundleOptions';\nimport * as output from '@expo/metro/metro/shared/output/bundle';\nimport type { BundleOptions } from '@expo/metro/metro/shared/types';\nimport { patchTransformFileForPackedMaps } from '@expo/metro-config/build/serializer/packedMap';\nimport { patchMetroSourceMapStringForPackedMaps } from '@expo/metro-config/build/serializer/sourceMap';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\n\nimport type { Options } from './resolveOptions';\nimport { deserializeEagerKey, getExportEmbedOptionsKey } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { replaceMetroFileMap } from '../../start/server/metro/createFileMap-fork';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { DOM_COMPONENTS_BUNDLE_DIR } from '../../start/server/middleware/DomComponentsMiddleware';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { copyAsync, removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { setNodeEnv, loadEnvFiles } from '../../utils/nodeEnv';\nimport { compileHermesArtifactsAsync } from '../compileHermesArtifacts';\nimport { exportDomComponentAsync } from '../exportDomComponents';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\nimport { copyPublicFolderAsync, getPublicFolderPath } from '../publicFolder';\nimport type { BundleAssetWithFileHashes, ExportAssetMap } from '../saveAssets';\nimport { persistMetroFilesAsync } from '../saveAssets';\nimport { exportStandaloneServerAsync } from './exportServer';\nimport { ensureProcessExitsAfterDelay } from '../../utils/exit';\n\nconst debug = require('debug')('expo:export:embed');\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (\n !bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//) &&\n !bundleOutput.match(/\\/CoreSimulator\\/Devices\\/.*\\/data\\/Containers\\/Bundle\\/Application\\//)\n ) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(`*.app/${bundleName}`, {\n cwd: bundleParent,\n absolute: true,\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n // The React Native build scripts always enable the cache reset but we shouldn't need this in CI environments.\n // By disabling it, we can eagerly bundle code before the build and reuse the cached artifacts in subsequent builds.\n if (env.CI && options.resetCache) {\n debug('CI environment detected, disabling automatic cache reset');\n options.resetCache = false;\n }\n\n setNodeEnv(options.dev ? 'development' : 'production');\n loadEnvFiles(projectRoot);\n\n // This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.\n // Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.\n // This path is also used for automatically deploying server bundles to a remote host.\n const eagerBundleOptions = env.__EXPO_EAGER_BUNDLE_OPTIONS\n ? deserializeEagerKey(env.__EXPO_EAGER_BUNDLE_OPTIONS)\n : null;\n if (eagerBundleOptions) {\n // Get the cache key for the current process to compare against the eager key.\n const inputKey = getExportEmbedOptionsKey(options);\n\n // If the app was bundled previously in the same process, then we should reuse the Metro cache.\n options.resetCache = false;\n\n if (eagerBundleOptions.key === inputKey) {\n // Copy the eager bundleOutput and assets to the new locations.\n await removeAsync(options.bundleOutput);\n\n await copyAsync(eagerBundleOptions.options.bundleOutput, options.bundleOutput);\n\n if (eagerBundleOptions.options.assetsDest && options.assetsDest) {\n await copyAsync(eagerBundleOptions.options.assetsDest, options.assetsDest);\n }\n\n console.log('info: Copied output to binary:', options.bundleOutput);\n return;\n }\n // TODO: sourcemapOutput is set on Android but not during eager. This is tolerable since it doesn't invalidate the Metro cache.\n console.log(' Eager key:', eagerBundleOptions.key);\n console.log('Request key:', inputKey);\n\n // TODO: We may want an analytic event here in the future to understand when this happens.\n console.warn('warning: Eager bundle does not match new options, bundling again.');\n }\n\n await exportEmbedInternalAsync(projectRoot, options);\n\n // Ensure the process closes after bundling\n ensureProcessExitsAfterDelay();\n}\n\n// Apple platforms (ios/tvos/macos) all build via Xcode and share the same bundle output and\n// error-reporting handling.\nconst isApplePlatform = (platform: string): boolean =>\n platform === 'ios' || platform === 'tvos' || platform === 'macos';\n\nexport async function exportEmbedInternalAsync(projectRoot: string, options: Options) {\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (isApplePlatform(options.platform)) {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets, files } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // On Android, dom components proxy files should write to the assets directory instead of the res directory.\n // We use the bundleOutput directory to get the assets directory.\n const domComponentProxyOutputDir =\n options.platform === 'android' ? path.dirname(options.bundleOutput) : options.assetsDest;\n const hasDomComponents = domComponentProxyOutputDir && files.size > 0;\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\n\n // Write dom components proxy files.\n hasDomComponents ? persistMetroFilesAsync(files, domComponentProxyOutputDir) : null,\n // Copy public folder for dom components only if\n hasDomComponents\n ? copyPublicFolderAsync(\n getPublicFolderPath(projectRoot),\n path.join(domComponentProxyOutputDir, DOM_COMPONENTS_BUNDLE_DIR)\n )\n : null,\n\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(projectRoot, assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: Awaited<ReturnType<Server['build']>>;\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n}> {\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: options.resetCache,\n maxWorkers: options.maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const { exp, pkg } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const files: ExportAssetMap = new Map();\n\n try {\n const bundles = await devServer.nativeExportBundleAsync(\n exp,\n {\n // TODO: Re-enable when we get bytecode chunk splitting working again.\n splitChunks: false, //devServer.isReactServerComponentsEnabled,\n mainModuleName: convertEntryPointToRelative(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: !!sourceMapUrl,\n bytecode: options.bytecode ?? false,\n // source map inline\n reactCompiler: !!exp.experiments?.reactCompiler,\n },\n files,\n {\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n }\n );\n\n // We optimistically build the server-side API routes code here, to ensure they're\n // valid or to enable parallel deployment in the future (TBD). This is disabled using\n // the explicit `--skip-server` flag.\n const apiRoutesEnabled =\n devServer.isReactServerComponentsEnabled || exp.web?.output === 'server';\n if (!options.skipServer && apiRoutesEnabled) {\n await exportStandaloneServerAsync(projectRoot, devServer, {\n exp,\n pkg,\n files,\n options,\n });\n }\n\n const expoDomComponentReferences = [\n ...new Set(\n bundles.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat()\n ),\n ];\n if (expoDomComponentReferences.length > 0) {\n await Promise.all(\n // TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.\n expoDomComponentReferences.map(async (filePath) => {\n const { bundle } = await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev: options.dev,\n devServer,\n isHermes,\n // don't ship sourcemap in the www.bundle\n includeSourceMaps: false,\n exp,\n files,\n });\n\n if (options.assetsDest) {\n // Save assets like a typical bundler, preserving the file paths on web.\n // This is saving web-style inside of a native app's binary.\n await persistMetroAssetsAsync(\n projectRoot,\n bundle.assets.map((asset) => ({\n ...asset,\n httpServerLocation: path.join(DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation),\n })),\n {\n files,\n platform: 'web',\n outputDirectory: options.assetsDest,\n }\n );\n }\n })\n );\n }\n\n if (options.bytecode && isHermes && !options.dev) {\n await compileHermesArtifactsAsync(projectRoot, bundles.artifacts);\n }\n\n return {\n files,\n bundle: {\n code: bundles.artifacts.filter((a: any) => a.type === 'js')[0]?.source!,\n // Can be optional when source maps aren't enabled.\n map: bundles.artifacts.filter((a: any) => a.type === 'map')[0]?.source.toString()!,\n },\n assets: bundles.assets,\n };\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (isApplePlatform(options.platform)) {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n } finally {\n devServerManager.stopAsync();\n }\n}\n\n// Exports for expo-updates\nexport async function createMetroServerAndBundleRequestAsync(\n projectRoot: string,\n options: Pick<\n Options,\n | 'maxWorkers'\n | 'config'\n | 'platform'\n | 'sourcemapOutput'\n | 'sourcemapUseAbsolutePath'\n | 'entryFile'\n | 'minify'\n | 'dev'\n | 'resetCache'\n | 'unstableTransformProfile'\n >\n): Promise<{ server: Server; bundleRequest: BundleOptions }> {\n const exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // TODO: This is slow ~40ms\n const { config } = await loadMetroConfigAsync(\n projectRoot,\n {\n // TODO: This is always enabled in the native script and there's no way to disable it.\n resetCache: options.resetCache,\n maxWorkers: options.maxWorkers,\n },\n {\n exp,\n isExporting: true,\n getMetroBundler() {\n return metro.getBundler().getBundler();\n },\n }\n );\n\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const directBundleOptions = getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n splitChunks: false,\n // TODO(@kitten): This currently has to match a filename exactly\n mainModuleName: convertEntryPointToRelative(projectRoot, options.entryFile, null),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n isExporting: true,\n // Never output bytecode in the exported bundle since that is hardcoded in the native run script.\n bytecode: false,\n hosted: false,\n });\n\n // TODO(cedric): check if we can use the proper `bundleType=bundle` and `entryPoint=mainModuleName` properties\n const bundleRequest: BundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...directBundleOptions,\n\n // NOTE(@kitten): Cast non-optional defaults\n lazy: directBundleOptions.lazy ?? Server.DEFAULT_BUNDLE_OPTIONS.lazy,\n modulesOnly: directBundleOptions.modulesOnly ?? Server.DEFAULT_BUNDLE_OPTIONS.modulesOnly,\n runModule: directBundleOptions.runModule ?? Server.DEFAULT_BUNDLE_OPTIONS.runModule,\n\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n };\n\n const { metro } = await replaceMetroFileMap(() => ({\n metro: new Server(config, {\n watch: false,\n }),\n }));\n\n // The dev server applies the same patch from `instantiateMetro.ts`;\n // this is the export-embed / `expo-updates` path, where `data.map`\n // would otherwise reach Metro's readers in the unwrapped wire shape.\n patchTransformFileForPackedMaps(metro.getBundler().getBundler());\n patchMetroSourceMapStringForPackedMaps();\n\n return { server: metro, bundleRequest };\n}\n\nexport async function exportEmbedAssetsAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions({\n ...bundleRequest,\n // @ts-ignore-error TODO(@kitten): Very unclear why this is here. Remove?\n bundleType: 'todo',\n });\n\n const dependencies = await server._bundler.getDependencies(\n // NOTE(@kitten): This isn't an `entryFile`, but instead a `mainModuleName`, that's been renamed\n // in `getMetroDirectBundleOptions`, where we've passed the already converted name\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n const config = server._config;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: config.serializer.processModuleFilter,\n assetPlugins: config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n // Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n // behavior.\n projectRoot: config.projectRoot, // this._getServerRootDir(),\n publicPath: config.transformer.publicPath,\n isHosted: false,\n });\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (isApplePlatform(options.platform)) {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n }\n}\n\nfunction isError(error: any): error is Error {\n return error instanceof Error;\n}\n"],"names":["createMetroServerAndBundleRequestAsync","exportEmbedAssetsAsync","exportEmbedAsync","exportEmbedBundleAndAssetsAsync","exportEmbedInternalAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","cwd","absolute","dot","projectRoot","options","env","CI","resetCache","setNodeEnv","dev","loadEnvFiles","eagerBundleOptions","__EXPO_EAGER_BUNDLE_OPTIONS","deserializeEagerKey","inputKey","getExportEmbedOptionsKey","key","removeAsync","copyAsync","assetsDest","console","log","warn","ensureProcessExitsAfterDelay","isApplePlatform","platform","previousPath","fs","existsSync","bundle","assets","files","mkdirSync","recursive","mode","domComponentProxyOutputDir","hasDomComponents","size","Promise","all","output","save","Log","persistMetroFilesAsync","copyPublicFolderAsync","getPublicFolderPath","join","DOM_COMPONENTS_BUNDLE_DIR","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","devServerManager","DevServerManager","startMetroAsync","minify","port","isExporting","location","resetDevServer","maxWorkers","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","exp","pkg","getConfig","skipSDKVersionRequirement","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","Map","bundles","nativeExportBundleAsync","splitChunks","mainModuleName","convertEntryPointToRelative","entryFile","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","unstable_transformProfile","unstableTransformProfile","apiRoutesEnabled","isReactServerComponentsEnabled","web","skipServer","exportStandaloneServerAsync","expoDomComponentReferences","Set","artifacts","map","artifact","Array","isArray","metadata","flat","length","filePath","exportDomComponentAsync","includeSourceMaps","asset","httpServerLocation","compileHermesArtifactsAsync","code","filter","a","type","source","toString","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","stopAsync","config","loadMetroConfigAsync","getMetroBundler","metro","getBundler","directBundleOptions","getMetroDirectBundleOptionsForExpoConfig","hosted","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","lazy","modulesOnly","runModule","replaceMetroFileMap","watch","patchTransformFileForPackedMaps","patchMetroSourceMapStringForPackedMaps","server","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","dependencies","_bundler","getDependencies","shallow","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","isHosted","Error"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;QA4TqBA;eAAAA;;QAsFAC;eAAAA;;QApVAC;eAAAA;;QA0GAC;eAAAA;;QAlDAC;eAAAA;;;;yBArHI;;;;;;;yBACkB;;;;;;;gEACzB;;;;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AkB,EAAC;YACtF,GAAGd,aAAa;YAChB,yEAAyE;YACzEe,YAAY;QACd;QAEA,MAAMC,eAAe,MAAMN,OAAOO,QAAQ,CAACC,eAAe,CACxD,gGAAgG;QAChG,kFAAkF;QAClF;YAACrE;SAAU,EACXgE,kBACAD,iBACA;YAAED;YAAYQ,SAAS;YAAOhB,MAAM;QAAM;QAG5C,MAAMX,SAASkB,OAAOU,OAAO;QAE7B,OAAOC,IAAAA,oBAAc,EAACL,cAAc;YAClCM,qBAAqB9B,OAAO+B,UAAU,CAACD,mBAAmB;YAC1DE,cAAchC,OAAOiC,WAAW,CAACD,YAAY;YAC7ClI,UAAUuH,iBAAiBvH,QAAQ;YACnC,2FAA2F;YAC3F,YAAY;YACZtB,aAAawH,OAAOxH,WAAW;YAC/B0J,YAAYlC,OAAOiC,WAAW,CAACC,UAAU;YACzCC,UAAU;QACZ;IACF,EAAE,OAAO1C,OAAY;QACnB,IAAIC,QAAQD,QAAQ;YAClB,0EAA0E;YAC1E,iIAAiI;YACjI,IAAI5F,gBAAgBpB,QAAQqB,QAAQ,GAAG;gBACrC,8FAA8F;gBAC9F,IAAI,aAAa2F,SAASE,IAAAA,8CAAyB,KAAI;oBACrDF,MAAMG,OAAO,GAAGC,IAAAA,eAAS,EAACJ,MAAMG,OAAO;gBACzC;gBACAE,IAAAA,yCAAoB,EAACtH,aAAaiH;YACpC;QACF;QACA,MAAMA;IACR;AACF;AAEA,SAASC,QAAQD,KAAU;IACzB,OAAOA,iBAAiB2C;AAC1B"}
|
|
@@ -57,6 +57,7 @@ function _nodepath() {
|
|
|
57
57
|
};
|
|
58
58
|
return data;
|
|
59
59
|
}
|
|
60
|
+
const _compileHermesArtifacts = require("./compileHermesArtifacts");
|
|
60
61
|
const _createMetadataJson = require("./createMetadataJson");
|
|
61
62
|
const _exportAssets = require("./exportAssets");
|
|
62
63
|
const _exportDomComponents = require("./exportDomComponents");
|
|
@@ -234,11 +235,6 @@ async function exportAppAsync(projectRoot, { platforms, outputDir, clear, dev, d
|
|
|
234
235
|
process.exit(1);
|
|
235
236
|
}
|
|
236
237
|
bundles[platform] = bundle;
|
|
237
|
-
(0, _saveAssets.getFilesFromSerialAssets)(bundle.artifacts, {
|
|
238
|
-
includeSourceMaps: sourceMaps,
|
|
239
|
-
files,
|
|
240
|
-
isServerHosted: devServer.isReactServerComponentsEnabled || hostedNative
|
|
241
|
-
});
|
|
242
238
|
const expoDomComponentReferences = [
|
|
243
239
|
...new Set(bundle.artifacts.map((artifact)=>Array.isArray(artifact.metadata.expoDomComponentReferences) ? artifact.metadata.expoDomComponentReferences : []).flat())
|
|
244
240
|
];
|
|
@@ -273,6 +269,14 @@ async function exportAppAsync(projectRoot, { platforms, outputDir, clear, dev, d
|
|
|
273
269
|
})
|
|
274
270
|
];
|
|
275
271
|
}));
|
|
272
|
+
if (bytecode && isHermes && !dev) {
|
|
273
|
+
await (0, _compileHermesArtifacts.compileHermesArtifactsAsync)(projectRoot, bundle.artifacts);
|
|
274
|
+
}
|
|
275
|
+
(0, _saveAssets.getFilesFromSerialAssets)(bundle.artifacts, {
|
|
276
|
+
includeSourceMaps: sourceMaps,
|
|
277
|
+
files,
|
|
278
|
+
isServerHosted: devServer.isReactServerComponentsEnabled || hostedNative
|
|
279
|
+
});
|
|
276
280
|
if (platform === 'web') {
|
|
277
281
|
const faviconAsset = await (0, _favicon.generateFaviconAssetAsync)(projectRoot, {
|
|
278
282
|
outputDir,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport type { Platform } from '@expo/config';\nimport { resolveRelativeEntryPoint } from '@expo/config/paths';\nimport type { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport { createFaviconAsString } from '@expo/router-server/build/utils/html';\nimport chalk from 'chalk';\nimport assert from 'node:assert';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { type PlatformMetadata, createMetadataJson } from './createMetadataJson';\nimport { exportAssetsAsync } from './exportAssets';\nimport {\n addDomBundleToMetadataAsync,\n exportDomComponentAsync,\n transformNativeBundleForMd5Filename,\n transformDomEntryForMd5Filename,\n} from './exportDomComponents';\nimport { assertEngineMismatchAsync, isEnableHermesManaged } from './exportHermes';\nimport { exportApiRoutesStandaloneAsync, exportFromServerAsync } from './exportStaticAsync';\nimport { generateFaviconAssetAsync } from './favicon';\nimport { getPublicExpoManifestAsync } from './getPublicExpoManifest';\nimport { copyPublicFolderAsync, getPublicFolderPath } from './publicFolder';\nimport type { Options } from './resolveOptions';\nimport type { ExportAssetMap, BundleOutput, BundleAssetWithFileHashes } from './saveAssets';\nimport { getFilesFromSerialAssets, persistMetroFilesAsync } 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 { getBaseUrlFromExpoConfig } from '../start/server/middleware/metroOptions';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../start/server/webTemplate';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\nimport { setNodeEnv, loadEnvFiles } from '../utils/nodeEnv';\n\nexport async function exportAppAsync(\n projectRoot: string,\n {\n platforms,\n outputDir,\n clear,\n dev,\n dumpAssetmap,\n sourceMaps,\n inlineSourceMaps,\n minify,\n bytecode,\n maxWorkers,\n skipSSG,\n hostedNative,\n }: Pick<\n Options,\n | 'dumpAssetmap'\n | 'sourceMaps'\n | 'inlineSourceMaps'\n | 'dev'\n | 'clear'\n | 'outputDir'\n | 'platforms'\n | 'minify'\n | 'bytecode'\n | 'maxWorkers'\n | 'skipSSG'\n | 'hostedNative'\n >\n): Promise<void> {\n // Force the environment during export and do not allow overriding it.\n const environment = dev ? 'development' : 'production';\n process.env.NODE_ENV = environment;\n setNodeEnv(environment);\n loadEnvFiles(projectRoot);\n\n const projectConfig = getConfig(projectRoot);\n const exp = await getPublicExpoManifestAsync(projectRoot, {\n // Web doesn't require validation.\n skipValidation: platforms.length === 1 && platforms[0] === 'web',\n });\n\n if (platforms.includes('web')) {\n await new WebSupportProjectPrerequisite(projectRoot).assertAsync();\n }\n\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\n if (skipSSG && exp.web?.output !== 'server') {\n throw new CommandError('--no-ssg can only be used with `web.output: server`');\n }\n\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n\n if (!bytecode && platforms.some((platform) => platform !== 'web')) {\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 = getPublicFolderPath(projectRoot);\n const outputPath = path.resolve(projectRoot, outputDir);\n\n // Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).\n\n const files: ExportAssetMap = new Map();\n\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify,\n mode,\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: clear,\n maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const bundles: Partial<Record<Platform, BundleOutput>> = {};\n const domComponentAssetsMetadata: Partial<Record<Platform, PlatformMetadata['assets']>> = {};\n\n const spaPlatforms =\n // TODO: Support server and static rendering for server component exports.\n useServerRendering && !devServer.isReactServerComponentsEnabled\n ? platforms.filter((platform) => platform !== 'web')\n : platforms;\n\n try {\n if (devServer.isReactServerComponentsEnabled) {\n // In RSC mode, we only need these to be in the client dir.\n // TODO: Merge back with other copy after we add SSR.\n try {\n await copyPublicFolderAsync(publicPath, path.join(outputPath, 'client'));\n } catch (error) {\n Log.error('Failed to copy public directory to dist directory');\n throw error;\n }\n } else {\n // NOTE(kitten): The public folder is currently always copied, regardless of targetDomain\n // split. Hence, there's another separate `copyPublicFolderAsync` call below for `web`\n await copyPublicFolderAsync(publicPath, outputPath);\n }\n\n let templateHtml: string | undefined;\n // Can be empty during web-only SSG.\n if (spaPlatforms.length) {\n await Promise.all(\n spaPlatforms.map(async (platform) => {\n // Assert early so the user doesn't have to wait until bundling is complete to find out that\n // Hermes won't be available.\n const isHermes = isEnableHermesManaged(exp, platform);\n if (isHermes) {\n await assertEngineMismatchAsync(projectRoot, exp, platform);\n }\n\n let bundle: {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n files?: ExportAssetMap;\n };\n\n try {\n // Run metro bundler and create the JS bundles/source maps.\n bundle = await devServer.nativeExportBundleAsync(\n exp,\n {\n platform,\n splitChunks:\n !env.EXPO_NO_BUNDLE_SPLITTING &&\n ((devServer.isReactServerComponentsEnabled && !bytecode) || platform === 'web'),\n mainModuleName: resolveRelativeEntryPoint(projectRoot, {\n platform,\n pkg: projectConfig.pkg,\n }),\n mode: dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: sourceMaps || inlineSourceMaps,\n inlineSourceMap: inlineSourceMaps,\n bytecode: bytecode && isHermes,\n reactCompiler: !!exp.experiments?.reactCompiler,\n hosted: hostedNative,\n },\n files\n );\n } catch (error) {\n Log.log('');\n if (error instanceof Error) {\n Log.exception(error);\n } else {\n Log.error('Failed to bundle the app');\n Log.log(error as any);\n }\n process.exit(1);\n }\n\n bundles[platform] = bundle;\n\n getFilesFromSerialAssets(bundle.artifacts, {\n includeSourceMaps: sourceMaps,\n files,\n isServerHosted: devServer.isReactServerComponentsEnabled || hostedNative,\n });\n\n const expoDomComponentReferences = [\n ...new Set(\n bundle.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat()\n ),\n ];\n await Promise.all(\n // TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.\n expoDomComponentReferences.map(async (filePath) => {\n const { bundle: platformDomComponentsBundle, htmlOutputName } =\n await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev,\n devServer,\n isHermes,\n includeSourceMaps: sourceMaps,\n exp,\n files,\n useMd5Filename: true,\n });\n\n // Merge the assets from the DOM component into the output assets, deduplicating by hash.\n const existingHashes = new Set(bundle.assets.map((a) => a.hash));\n (bundle.assets as (typeof bundle.assets)[0][]).push(\n ...platformDomComponentsBundle.assets.filter((a) => !existingHashes.has(a.hash))\n );\n\n transformNativeBundleForMd5Filename({\n domComponentReference: filePath,\n nativeBundle: bundle,\n files,\n htmlOutputName,\n });\n domComponentAssetsMetadata[platform] = [\n ...(domComponentAssetsMetadata[platform] || []),\n ...(await addDomBundleToMetadataAsync(platformDomComponentsBundle)),\n ...transformDomEntryForMd5Filename({\n files,\n htmlOutputName,\n }),\n ];\n })\n );\n\n if (platform === 'web') {\n const faviconAsset = await generateFaviconAssetAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n exp: projectConfig.exp,\n });\n\n // TODO: Unify with exportStaticAsync\n // TODO: Maybe move to the serializer.\n const html = serializeHtmlWithAssets({\n isExporting: true,\n resources: bundle.artifacts,\n template: await createTemplateHtmlFromExpoConfigAsync(projectRoot, {\n scripts: [],\n cssLinks: [],\n extraHead: faviconAsset ? createFaviconAsString(faviconAsset.href) : undefined,\n exp: projectConfig.exp,\n }),\n baseUrl,\n });\n\n // HACK: This is used for adding SSR shims in React Server Components.\n templateHtml = html;\n\n // Generate SPA-styled HTML file.\n // If web exists, then write the template HTML file.\n files.set('index.html', {\n contents: html,\n targetDomain: devServer.isReactServerComponentsEnabled ? 'server' : 'client',\n });\n }\n })\n );\n\n if (devServer.isReactServerComponentsEnabled) {\n const isWeb = platforms.includes('web');\n\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: !isWeb,\n templateHtml,\n });\n }\n\n // TODO: Use same asset system across platforms again.\n const { assets, embeddedHashSet } = await exportAssetsAsync(projectRoot, {\n files,\n exp,\n outputDir: outputPath,\n bundles,\n baseUrl,\n hostedNative,\n });\n\n if (dumpAssetmap) {\n Log.log('Creating asset map');\n files.set('assetmap.json', { contents: JSON.stringify(createAssetMap({ assets })) });\n }\n\n const targetDomain = devServer.isReactServerComponentsEnabled ? 'client/' : '';\n const fileNames = Object.fromEntries(\n Object.entries(bundles).map(([platform, bundle]) => [\n platform,\n bundle.artifacts\n .filter((asset) => asset.type === 'js')\n .map((asset) => targetDomain + asset.filename),\n ])\n );\n\n // Generate a `metadata.json` for EAS Update.\n const contents = createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n domComponentAssetsMetadata,\n });\n files.set('metadata.json', { contents: JSON.stringify(contents) });\n }\n\n // Additional web-only steps...\n\n if (platforms.includes('web') && useServerRendering) {\n const exportServer = exp.web?.output === 'server';\n\n if (exportServer) {\n // TODO: Remove when this is abstracted into the files map\n await copyPublicFolderAsync(publicPath, path.resolve(outputPath, 'client'));\n }\n\n if (skipSSG) {\n Log.log('Skipping static site generation');\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: true,\n });\n\n // Output a placeholder index.html if one doesn't exist in the public directory.\n // This ensures native + API routes have some content at the root URL.\n const placeholderIndex = path.resolve(outputPath, 'client/index.html');\n if (!fs.existsSync(placeholderIndex)) {\n files.set('index.html', {\n contents: `<html><body></body></html>`,\n targetDomain: 'client',\n });\n }\n } else if (\n // TODO: Support static export with RSC.\n !devServer.isReactServerComponentsEnabled\n ) {\n await exportFromServerAsync(projectRoot, devServer, {\n mode,\n files,\n clear: !!clear,\n outputDir: outputPath,\n minify,\n baseUrl,\n includeSourceMaps: sourceMaps,\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n reactCompiler: !!exp.experiments?.reactCompiler,\n exportServer,\n maxWorkers,\n isExporting: true,\n exp: projectConfig.exp,\n });\n }\n }\n } finally {\n await devServerManager.stopAsync();\n }\n\n // Write all files at the end for unified logging.\n await persistMetroFilesAsync(files, outputPath);\n}\n"],"names":["exportAppAsync","projectRoot","platforms","outputDir","clear","dev","dumpAssetmap","sourceMaps","inlineSourceMaps","minify","bytecode","maxWorkers","skipSSG","hostedNative","exp","environment","process","env","NODE_ENV","setNodeEnv","loadEnvFiles","projectConfig","getConfig","getPublicExpoManifestAsync","skipValidation","length","includes","WebSupportProjectPrerequisite","assertAsync","useServerRendering","web","output","CommandError","baseUrl","getBaseUrlFromExpoConfig","some","platform","Log","warn","log","chalk","gray","startsWith","yellow","mode","publicPath","getPublicFolderPath","outputPath","path","resolve","files","Map","devServerManager","DevServerManager","startMetroAsync","port","isExporting","location","resetDevServer","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","bundles","domComponentAssetsMetadata","spaPlatforms","isReactServerComponentsEnabled","filter","copyPublicFolderAsync","join","error","templateHtml","Promise","all","map","isHermes","isEnableHermesManaged","assertEngineMismatchAsync","bundle","nativeExportBundleAsync","splitChunks","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","resolveRelativeEntryPoint","pkg","engine","undefined","serializerIncludeMaps","inlineSourceMap","reactCompiler","experiments","hosted","Error","exception","exit","getFilesFromSerialAssets","artifacts","includeSourceMaps","isServerHosted","expoDomComponentReferences","Set","artifact","Array","isArray","metadata","flat","filePath","platformDomComponentsBundle","htmlOutputName","exportDomComponentAsync","useMd5Filename","existingHashes","assets","a","hash","push","has","transformNativeBundleForMd5Filename","domComponentReference","nativeBundle","addDomBundleToMetadataAsync","transformDomEntryForMd5Filename","faviconAsset","generateFaviconAssetAsync","html","serializeHtmlWithAssets","resources","template","createTemplateHtmlFromExpoConfigAsync","scripts","cssLinks","extraHead","createFaviconAsString","href","set","contents","targetDomain","isWeb","exportApiRoutesStandaloneAsync","apiRoutesOnly","embeddedHashSet","exportAssetsAsync","JSON","stringify","createAssetMap","fileNames","Object","fromEntries","entries","asset","type","filename","createMetadataJson","exportServer","placeholderIndex","fs","existsSync","exportFromServerAsync","routerRoot","getRouterDirectoryModuleIdWithManifest","stopAsync","persistMetroFilesAsync"],"mappings":";;;;+BAuCsBA;;;eAAAA;;;;yBAvCI;;;;;;;yBAEgB;;;;;;;yBAEJ;;;;;;;gEACpB;;;;;;;gEACC;;;;;;;gEACJ;;;;;;;gEACE;;;;;;oCAEyC;8BACxB;qCAM3B;8BAC0D;mCACK;yBAC5B;uCACC;8BACgB;4BAGM;+BAClC;6DACV;+CACyB;kCACb;uCACK;wBACiB;+BACf;8BACC;6BACa;qBAClC;wBACS;yBACY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElC,eAAeA,eACpBC,WAAmB,EACnB,EACEC,SAAS,EACTC,SAAS,EACTC,KAAK,EACLC,GAAG,EACHC,YAAY,EACZC,UAAU,EACVC,gBAAgB,EAChBC,MAAM,EACNC,QAAQ,EACRC,UAAU,EACVC,OAAO,EACPC,YAAY,EAeb;QAkBwDC,UAE1CA;IAlBf,sEAAsE;IACtE,MAAMC,cAAcV,MAAM,gBAAgB;IAC1CW,QAAQC,GAAG,CAACC,QAAQ,GAAGH;IACvBI,IAAAA,mBAAU,EAACJ;IACXK,IAAAA,qBAAY,EAACnB;IAEb,MAAMoB,gBAAgBC,IAAAA,mBAAS,EAACrB;IAChC,MAAMa,MAAM,MAAMS,IAAAA,iDAA0B,EAACtB,aAAa;QACxD,kCAAkC;QAClCuB,gBAAgBtB,UAAUuB,MAAM,KAAK,KAAKvB,SAAS,CAAC,EAAE,KAAK;IAC7D;IAEA,IAAIA,UAAUwB,QAAQ,CAAC,QAAQ;QAC7B,MAAM,IAAIC,4DAA6B,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AE,CAACC,UAAU,CAACF,mBAAmB;oBACpCxG,MAAMoF,GAAG,CAAC,cAAc;wBACtBC,UAAU,CAAC,0BAA0B,CAAC;wBACtCC,cAAc;oBAChB;gBACF;YACF,OAAO,IACL,wCAAwC;YACxC,CAAC7E,UAAUO,8BAA8B,EACzC;oBAUmBpD;gBATnB,MAAM+I,IAAAA,wCAAqB,EAAC5J,aAAa0D,WAAW;oBAClDf;oBACAM;oBACA9C,OAAO,CAAC,CAACA;oBACTD,WAAW4C;oBACXtC;oBACAwB;oBACAgE,mBAAmB1F;oBACnBuJ,YAAYC,IAAAA,8CAAsC,EAAC9J,aAAaa;oBAChE2E,eAAe,CAAC,GAAC3E,mBAAAA,IAAI4E,WAAW,qBAAf5E,iBAAiB2E,aAAa;oBAC/CgE;oBACA9I;oBACA6C,aAAa;oBACb1C,KAAKO,cAAcP,GAAG;gBACxB;YACF;QACF;IACF,SAAU;QACR,MAAMsC,iBAAiB4G,SAAS;IAClC;IAEA,kDAAkD;IAClD,MAAMC,IAAAA,kCAAsB,EAAC/G,OAAOH;AACtC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport type { Platform } from '@expo/config';\nimport { resolveRelativeEntryPoint } from '@expo/config/paths';\nimport type { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport { createFaviconAsString } from '@expo/router-server/build/utils/html';\nimport chalk from 'chalk';\nimport assert from 'node:assert';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { compileHermesArtifactsAsync } from './compileHermesArtifacts';\nimport { type PlatformMetadata, createMetadataJson } from './createMetadataJson';\nimport { exportAssetsAsync } from './exportAssets';\nimport {\n addDomBundleToMetadataAsync,\n exportDomComponentAsync,\n transformNativeBundleForMd5Filename,\n transformDomEntryForMd5Filename,\n} from './exportDomComponents';\nimport { assertEngineMismatchAsync, isEnableHermesManaged } from './exportHermes';\nimport { exportApiRoutesStandaloneAsync, exportFromServerAsync } from './exportStaticAsync';\nimport { generateFaviconAssetAsync } from './favicon';\nimport { getPublicExpoManifestAsync } from './getPublicExpoManifest';\nimport { copyPublicFolderAsync, getPublicFolderPath } from './publicFolder';\nimport type { Options } from './resolveOptions';\nimport type { ExportAssetMap, BundleOutput, BundleAssetWithFileHashes } from './saveAssets';\nimport { getFilesFromSerialAssets, persistMetroFilesAsync } 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 { getBaseUrlFromExpoConfig } from '../start/server/middleware/metroOptions';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../start/server/webTemplate';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\nimport { setNodeEnv, loadEnvFiles } from '../utils/nodeEnv';\n\nexport async function exportAppAsync(\n projectRoot: string,\n {\n platforms,\n outputDir,\n clear,\n dev,\n dumpAssetmap,\n sourceMaps,\n inlineSourceMaps,\n minify,\n bytecode,\n maxWorkers,\n skipSSG,\n hostedNative,\n }: Pick<\n Options,\n | 'dumpAssetmap'\n | 'sourceMaps'\n | 'inlineSourceMaps'\n | 'dev'\n | 'clear'\n | 'outputDir'\n | 'platforms'\n | 'minify'\n | 'bytecode'\n | 'maxWorkers'\n | 'skipSSG'\n | 'hostedNative'\n >\n): Promise<void> {\n // Force the environment during export and do not allow overriding it.\n const environment = dev ? 'development' : 'production';\n process.env.NODE_ENV = environment;\n setNodeEnv(environment);\n loadEnvFiles(projectRoot);\n\n const projectConfig = getConfig(projectRoot);\n const exp = await getPublicExpoManifestAsync(projectRoot, {\n // Web doesn't require validation.\n skipValidation: platforms.length === 1 && platforms[0] === 'web',\n });\n\n if (platforms.includes('web')) {\n await new WebSupportProjectPrerequisite(projectRoot).assertAsync();\n }\n\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\n if (skipSSG && exp.web?.output !== 'server') {\n throw new CommandError('--no-ssg can only be used with `web.output: server`');\n }\n\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n\n if (!bytecode && platforms.some((platform) => platform !== 'web')) {\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 = getPublicFolderPath(projectRoot);\n const outputPath = path.resolve(projectRoot, outputDir);\n\n // Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).\n\n const files: ExportAssetMap = new Map();\n\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify,\n mode,\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: clear,\n maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const bundles: Partial<Record<Platform, BundleOutput>> = {};\n const domComponentAssetsMetadata: Partial<Record<Platform, PlatformMetadata['assets']>> = {};\n\n const spaPlatforms =\n // TODO: Support server and static rendering for server component exports.\n useServerRendering && !devServer.isReactServerComponentsEnabled\n ? platforms.filter((platform) => platform !== 'web')\n : platforms;\n\n try {\n if (devServer.isReactServerComponentsEnabled) {\n // In RSC mode, we only need these to be in the client dir.\n // TODO: Merge back with other copy after we add SSR.\n try {\n await copyPublicFolderAsync(publicPath, path.join(outputPath, 'client'));\n } catch (error) {\n Log.error('Failed to copy public directory to dist directory');\n throw error;\n }\n } else {\n // NOTE(kitten): The public folder is currently always copied, regardless of targetDomain\n // split. Hence, there's another separate `copyPublicFolderAsync` call below for `web`\n await copyPublicFolderAsync(publicPath, outputPath);\n }\n\n let templateHtml: string | undefined;\n // Can be empty during web-only SSG.\n if (spaPlatforms.length) {\n await Promise.all(\n spaPlatforms.map(async (platform) => {\n // Assert early so the user doesn't have to wait until bundling is complete to find out that\n // Hermes won't be available.\n const isHermes = isEnableHermesManaged(exp, platform);\n if (isHermes) {\n await assertEngineMismatchAsync(projectRoot, exp, platform);\n }\n\n let bundle: {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n files?: ExportAssetMap;\n };\n\n try {\n // Run metro bundler and create the JS bundles/source maps.\n bundle = await devServer.nativeExportBundleAsync(\n exp,\n {\n platform,\n splitChunks:\n !env.EXPO_NO_BUNDLE_SPLITTING &&\n ((devServer.isReactServerComponentsEnabled && !bytecode) || platform === 'web'),\n mainModuleName: resolveRelativeEntryPoint(projectRoot, {\n platform,\n pkg: projectConfig.pkg,\n }),\n mode: dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: sourceMaps || inlineSourceMaps,\n inlineSourceMap: inlineSourceMaps,\n bytecode: bytecode && isHermes,\n reactCompiler: !!exp.experiments?.reactCompiler,\n hosted: hostedNative,\n },\n files\n );\n } catch (error) {\n Log.log('');\n if (error instanceof Error) {\n Log.exception(error);\n } else {\n Log.error('Failed to bundle the app');\n Log.log(error as any);\n }\n process.exit(1);\n }\n\n bundles[platform] = bundle;\n\n const expoDomComponentReferences = [\n ...new Set(\n bundle.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat()\n ),\n ];\n await Promise.all(\n // TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.\n expoDomComponentReferences.map(async (filePath) => {\n const { bundle: platformDomComponentsBundle, htmlOutputName } =\n await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev,\n devServer,\n isHermes,\n includeSourceMaps: sourceMaps,\n exp,\n files,\n useMd5Filename: true,\n });\n\n // Merge the assets from the DOM component into the output assets, deduplicating by hash.\n const existingHashes = new Set(bundle.assets.map((a) => a.hash));\n (bundle.assets as (typeof bundle.assets)[0][]).push(\n ...platformDomComponentsBundle.assets.filter((a) => !existingHashes.has(a.hash))\n );\n\n transformNativeBundleForMd5Filename({\n domComponentReference: filePath,\n nativeBundle: bundle,\n files,\n htmlOutputName,\n });\n domComponentAssetsMetadata[platform] = [\n ...(domComponentAssetsMetadata[platform] || []),\n ...(await addDomBundleToMetadataAsync(platformDomComponentsBundle)),\n ...transformDomEntryForMd5Filename({\n files,\n htmlOutputName,\n }),\n ];\n })\n );\n\n if (bytecode && isHermes && !dev) {\n await compileHermesArtifactsAsync(projectRoot, bundle.artifacts);\n }\n\n getFilesFromSerialAssets(bundle.artifacts, {\n includeSourceMaps: sourceMaps,\n files,\n isServerHosted: devServer.isReactServerComponentsEnabled || hostedNative,\n });\n\n if (platform === 'web') {\n const faviconAsset = await generateFaviconAssetAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n exp: projectConfig.exp,\n });\n\n // TODO: Unify with exportStaticAsync\n // TODO: Maybe move to the serializer.\n const html = serializeHtmlWithAssets({\n isExporting: true,\n resources: bundle.artifacts,\n template: await createTemplateHtmlFromExpoConfigAsync(projectRoot, {\n scripts: [],\n cssLinks: [],\n extraHead: faviconAsset ? createFaviconAsString(faviconAsset.href) : undefined,\n exp: projectConfig.exp,\n }),\n baseUrl,\n });\n\n // HACK: This is used for adding SSR shims in React Server Components.\n templateHtml = html;\n\n // Generate SPA-styled HTML file.\n // If web exists, then write the template HTML file.\n files.set('index.html', {\n contents: html,\n targetDomain: devServer.isReactServerComponentsEnabled ? 'server' : 'client',\n });\n }\n })\n );\n\n if (devServer.isReactServerComponentsEnabled) {\n const isWeb = platforms.includes('web');\n\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: !isWeb,\n templateHtml,\n });\n }\n\n // TODO: Use same asset system across platforms again.\n const { assets, embeddedHashSet } = await exportAssetsAsync(projectRoot, {\n files,\n exp,\n outputDir: outputPath,\n bundles,\n baseUrl,\n hostedNative,\n });\n\n if (dumpAssetmap) {\n Log.log('Creating asset map');\n files.set('assetmap.json', { contents: JSON.stringify(createAssetMap({ assets })) });\n }\n\n const targetDomain = devServer.isReactServerComponentsEnabled ? 'client/' : '';\n const fileNames = Object.fromEntries(\n Object.entries(bundles).map(([platform, bundle]) => [\n platform,\n bundle.artifacts\n .filter((asset) => asset.type === 'js')\n .map((asset) => targetDomain + asset.filename),\n ])\n );\n\n // Generate a `metadata.json` for EAS Update.\n const contents = createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n domComponentAssetsMetadata,\n });\n files.set('metadata.json', { contents: JSON.stringify(contents) });\n }\n\n // Additional web-only steps...\n\n if (platforms.includes('web') && useServerRendering) {\n const exportServer = exp.web?.output === 'server';\n\n if (exportServer) {\n // TODO: Remove when this is abstracted into the files map\n await copyPublicFolderAsync(publicPath, path.resolve(outputPath, 'client'));\n }\n\n if (skipSSG) {\n Log.log('Skipping static site generation');\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: true,\n });\n\n // Output a placeholder index.html if one doesn't exist in the public directory.\n // This ensures native + API routes have some content at the root URL.\n const placeholderIndex = path.resolve(outputPath, 'client/index.html');\n if (!fs.existsSync(placeholderIndex)) {\n files.set('index.html', {\n contents: `<html><body></body></html>`,\n targetDomain: 'client',\n });\n }\n } else if (\n // TODO: Support static export with RSC.\n !devServer.isReactServerComponentsEnabled\n ) {\n await exportFromServerAsync(projectRoot, devServer, {\n mode,\n files,\n clear: !!clear,\n outputDir: outputPath,\n minify,\n baseUrl,\n includeSourceMaps: sourceMaps,\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n reactCompiler: !!exp.experiments?.reactCompiler,\n exportServer,\n maxWorkers,\n isExporting: true,\n exp: projectConfig.exp,\n });\n }\n }\n } finally {\n await devServerManager.stopAsync();\n }\n\n // Write all files at the end for unified logging.\n await persistMetroFilesAsync(files, outputPath);\n}\n"],"names":["exportAppAsync","projectRoot","platforms","outputDir","clear","dev","dumpAssetmap","sourceMaps","inlineSourceMaps","minify","bytecode","maxWorkers","skipSSG","hostedNative","exp","environment","process","env","NODE_ENV","setNodeEnv","loadEnvFiles","projectConfig","getConfig","getPublicExpoManifestAsync","skipValidation","length","includes","WebSupportProjectPrerequisite","assertAsync","useServerRendering","web","output","CommandError","baseUrl","getBaseUrlFromExpoConfig","some","platform","Log","warn","log","chalk","gray","startsWith","yellow","mode","publicPath","getPublicFolderPath","outputPath","path","resolve","files","Map","devServerManager","DevServerManager","startMetroAsync","port","isExporting","location","resetDevServer","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","bundles","domComponentAssetsMetadata","spaPlatforms","isReactServerComponentsEnabled","filter","copyPublicFolderAsync","join","error","templateHtml","Promise","all","map","isHermes","isEnableHermesManaged","assertEngineMismatchAsync","bundle","nativeExportBundleAsync","splitChunks","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","resolveRelativeEntryPoint","pkg","engine","undefined","serializerIncludeMaps","inlineSourceMap","reactCompiler","experiments","hosted","Error","exception","exit","expoDomComponentReferences","Set","artifacts","artifact","Array","isArray","metadata","flat","filePath","platformDomComponentsBundle","htmlOutputName","exportDomComponentAsync","includeSourceMaps","useMd5Filename","existingHashes","assets","a","hash","push","has","transformNativeBundleForMd5Filename","domComponentReference","nativeBundle","addDomBundleToMetadataAsync","transformDomEntryForMd5Filename","compileHermesArtifactsAsync","getFilesFromSerialAssets","isServerHosted","faviconAsset","generateFaviconAssetAsync","html","serializeHtmlWithAssets","resources","template","createTemplateHtmlFromExpoConfigAsync","scripts","cssLinks","extraHead","createFaviconAsString","href","set","contents","targetDomain","isWeb","exportApiRoutesStandaloneAsync","apiRoutesOnly","embeddedHashSet","exportAssetsAsync","JSON","stringify","createAssetMap","fileNames","Object","fromEntries","entries","asset","type","filename","createMetadataJson","exportServer","placeholderIndex","fs","existsSync","exportFromServerAsync","routerRoot","getRouterDirectoryModuleIdWithManifest","stopAsync","persistMetroFilesAsync"],"mappings":";;;;+BAwCsBA;;;eAAAA;;;;yBAxCI;;;;;;;yBAEgB;;;;;;;yBAEJ;;;;;;;gEACpB;;;;;;;gEACC;;;;;;;gEACJ;;;;;;;gEACE;;;;;;wCAE2B;oCACc;8BACxB;qCAM3B;8BAC0D;mCACK;yBAC5B;uCACC;8BACgB;4BAGM;+BAClC;6DACV;+CACyB;kCACb;uCACK;wBACiB;+BACf;8BACC;6BACa;qBAClC;wBACS;yBACY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElC,eAAeA,eACpBC,WAAmB,EACnB,EACEC,SAAS,EACTC,SAAS,EACTC,KAAK,EACLC,GAAG,EACHC,YAAY,EACZC,UAAU,EACVC,gBAAgB,EAChBC,MAAM,EACNC,QAAQ,EACRC,UAAU,EACVC,OAAO,EACPC,YAAY,EAeb;QAkBwDC,UAE1CA;IAlBf,sEAAsE;IACtE,MAAMC,cAAcV,MAAM,gBAAgB;IAC1CW,QAAQC,GAAG,CAACC,QAAQ,GAAGH;IACvBI,IAAAA,mBAAU,EAACJ;IACXK,IAAAA,qBAAY,EAACnB;IAEb,MAAMoB,gBAAgBC,IAAAA,mBAAS,EAACrB;IAChC,MAAMa,MAAM,MAAMS,IAAAA,iDAA0B,EAACtB,aAAa;QACxD,kCAAkC;QAClCuB,gBAAgBtB,UAAUuB,MAAM,KAAK,KAAKvB,SAAS,CAAC,EAAE,KAAK;IAC7D;IAEA,IAAIA,UAAUwB,QAAQ,CAAC,QAAQ;QAC7B,MAAM,IAAIC,4DAA6B,CAAC1B,aAAa2B,WAAW;IAClE;IAEA,MAAMC,qBAAqB;QAAC;QAAU;KAAS,CAACH,QAAQ,CAACZ,EAAAA,WAAAA,IAAIgB,G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ACC,UAAU,CAACF,mBAAmB;oBACpCzG,MAAMqF,GAAG,CAAC,cAAc;wBACtBC,UAAU,CAAC,0BAA0B,CAAC;wBACtCC,cAAc;oBAChB;gBACF;YACF,OAAO,IACL,wCAAwC;YACxC,CAAC9E,UAAUO,8BAA8B,EACzC;oBAUmBpD;gBATnB,MAAMgJ,IAAAA,wCAAqB,EAAC7J,aAAa0D,WAAW;oBAClDf;oBACAM;oBACA9C,OAAO,CAAC,CAACA;oBACTD,WAAW4C;oBACXtC;oBACAwB;oBACA0E,mBAAmBpG;oBACnBwJ,YAAYC,IAAAA,8CAAsC,EAAC/J,aAAaa;oBAChE2E,eAAe,CAAC,GAAC3E,mBAAAA,IAAI4E,WAAW,qBAAf5E,iBAAiB2E,aAAa;oBAC/CiE;oBACA/I;oBACA6C,aAAa;oBACb1C,KAAKO,cAAcP,GAAG;gBACxB;YACF;QACF;IACF,SAAU;QACR,MAAMsC,iBAAiB6G,SAAS;IAClC;IAEA,kDAAkD;IAClD,MAAMC,IAAAA,kCAAsB,EAAChH,OAAOH;AACtC"}
|
|
@@ -169,22 +169,16 @@ function transformNativeBundleForMd5Filename({ domComponentReference, nativeBund
|
|
|
169
169
|
if (artifact.type !== 'js') {
|
|
170
170
|
continue;
|
|
171
171
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const replaceBuffer = Buffer.from(`${htmlMd5}.html`, 'utf8');
|
|
177
|
-
(0, _assert().default)(searchBuffer.length === replaceBuffer.length);
|
|
178
|
-
let index = assetEntity.contents.indexOf(searchBuffer, 0);
|
|
179
|
-
while(index !== -1){
|
|
180
|
-
replaceBuffer.copy(assetEntity.contents, index);
|
|
181
|
-
index = assetEntity.contents.indexOf(searchBuffer, index + searchBuffer.length);
|
|
172
|
+
if (Buffer.isBuffer(artifact.source)) {
|
|
173
|
+
var _artifact_metadata_expoDomComponentReferences;
|
|
174
|
+
if ((_artifact_metadata_expoDomComponentReferences = artifact.metadata.expoDomComponentReferences) == null ? void 0 : _artifact_metadata_expoDomComponentReferences.length) {
|
|
175
|
+
throw new Error(`Cannot rename DOM assets in compiled Hermes bytecode (${artifact.filename}). ` + 'Run `npx expo-doctor` to check package compatibility. Custom serializers must defer Hermes compilation until DOM filenames are resolved.');
|
|
182
176
|
}
|
|
183
177
|
} else {
|
|
184
178
|
const search = `${hash}.html`;
|
|
185
179
|
const replace = `${htmlMd5}.html`;
|
|
186
180
|
(0, _assert().default)(search.length === replace.length);
|
|
187
|
-
|
|
181
|
+
artifact.source = artifact.source.replaceAll(search, replace);
|
|
188
182
|
}
|
|
189
183
|
}
|
|
190
184
|
} //#endregion `npx export` for updates
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportDomComponents.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\nimport { convertEntryPointToRelative } from '@expo/config/paths';\nimport assert from 'assert';\nimport crypto from 'crypto';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport url from 'url';\n\nimport type { PlatformMetadata } from './createMetadataJson';\nimport { type BundleOutput, type ExportAssetMap, getFilesFromSerialAssets } from './saveAssets';\nimport type { MetroBundlerDevServer } from '../start/server/metro/MetroBundlerDevServer';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport {\n getDomComponentHtml,\n DOM_COMPONENTS_BUNDLE_DIR,\n} from '../start/server/middleware/DomComponentsMiddleware';\nimport { env } from '../utils/env';\nimport { toPosixPath } from '../utils/filePath';\n\nconst debug = require('debug')('expo:export:exportDomComponents') as typeof console.log;\n\n// TODO(EvanBacon): determine how to support DOM Components with hosting.\nexport async function exportDomComponentAsync({\n filePath,\n projectRoot,\n dev,\n devServer,\n isHermes,\n includeSourceMaps,\n exp,\n files,\n useMd5Filename = false,\n}: {\n filePath: string;\n projectRoot: string;\n dev: boolean;\n devServer: MetroBundlerDevServer;\n isHermes: boolean;\n includeSourceMaps: boolean;\n exp: ExpoConfig;\n files: ExportAssetMap;\n useMd5Filename?: boolean;\n}): Promise<{\n bundle: BundleOutput;\n htmlOutputName: string;\n}> {\n const virtualEntry = resolveFrom(projectRoot, 'expo/dom/entry.js');\n debug('Bundle DOM Component:', filePath);\n // MUST MATCH THE BABEL PLUGIN!\n const hash = crypto.createHash('md5').update(filePath).digest('hex');\n const outputName = `${DOM_COMPONENTS_BUNDLE_DIR}/${hash}.html`;\n const generatedEntryPath = path.resolve(\n filePath.startsWith('file://') ? url.fileURLToPath(filePath) : filePath\n );\n const baseUrl = `/${DOM_COMPONENTS_BUNDLE_DIR}`;\n // The relative import path will be used like URI so it must be POSIX.\n const relativeImport =\n './' + toPosixPath(path.relative(path.dirname(virtualEntry), generatedEntryPath));\n // Run metro bundler and create the JS bundles/source maps.\n const bundle = await devServer.legacySinglePageExportBundleAsync({\n platform: 'web',\n domRoot: encodeURI(relativeImport),\n splitChunks: !env.EXPO_NO_BUNDLE_SPLITTING,\n mainModuleName: convertEntryPointToRelative(projectRoot, virtualEntry),\n mode: dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: includeSourceMaps,\n bytecode: false,\n reactCompiler: !!exp.experiments?.reactCompiler,\n baseUrl: './',\n useMd5Filename,\n // Minify may be false because it's skipped on native when Hermes is enabled, default to true.\n minify: true,\n });\n\n if (useMd5Filename) {\n for (const artifact of bundle.artifacts) {\n const md5 = crypto.createHash('md5').update(artifact.source).digest('hex');\n artifact.filename = `${md5}.${artifact.type}`;\n }\n }\n\n const html = await serializeHtmlWithAssets({\n isExporting: true,\n resources: bundle.artifacts,\n template: getDomComponentHtml(),\n baseUrl: './',\n });\n\n const serialAssets = bundle.artifacts.map((a) => {\n return {\n ...a,\n filename: path.join(baseUrl, a.filename),\n };\n });\n\n getFilesFromSerialAssets(serialAssets, {\n includeSourceMaps,\n files,\n platform: 'web',\n });\n\n files.set(outputName, {\n contents: html,\n });\n\n return {\n bundle,\n htmlOutputName: outputName,\n };\n}\n\n//#region `npx export` for updates\n\n/**\n * Add the DOM component bundle to the metadata for updates.\n */\nexport function addDomBundleToMetadataAsync(bundle: BundleOutput): PlatformMetadata['assets'] {\n const assetsMetadata: PlatformMetadata['assets'] = [];\n for (const artifact of bundle.artifacts) {\n if (artifact.type === 'map') {\n continue;\n }\n assetsMetadata.push({\n path: `${DOM_COMPONENTS_BUNDLE_DIR}/${artifact.filename}`,\n ext: artifact.type,\n });\n }\n return assetsMetadata;\n}\n\n/**\n * Transform the DOM component entry (*.html) to use MD5 filename by its content.\n */\nexport function transformDomEntryForMd5Filename({\n files,\n htmlOutputName,\n}: {\n files: ExportAssetMap;\n htmlOutputName: string;\n}): PlatformMetadata['assets'] {\n const htmlContent = files.get(htmlOutputName);\n assert(htmlContent);\n const htmlMd5 = crypto.createHash('md5').update(htmlContent.contents.toString()).digest('hex');\n const htmlMd5Filename = `${DOM_COMPONENTS_BUNDLE_DIR}/${htmlMd5}.html`;\n files.set(htmlMd5Filename, htmlContent);\n files.delete(htmlOutputName);\n return [\n {\n path: htmlMd5Filename,\n ext: 'html',\n },\n ];\n}\n\n/**\n * Post-transform the native bundle to use MD5 filename based on DOM component entry content.\n */\nexport function transformNativeBundleForMd5Filename({\n domComponentReference,\n nativeBundle,\n files,\n htmlOutputName,\n}: {\n domComponentReference: string;\n nativeBundle: BundleOutput;\n files: ExportAssetMap;\n htmlOutputName: string;\n}) {\n const htmlContent = files.get(htmlOutputName);\n assert(htmlContent);\n const htmlMd5 = crypto.createHash('md5').update(htmlContent.contents.toString()).digest('hex');\n const hash = crypto.createHash('md5').update(domComponentReference).digest('hex');\n for (const artifact of nativeBundle.artifacts) {\n if (artifact.type !== 'js') {\n continue;\n }\n const assetEntity = files.get(artifact.filename);\n assert(assetEntity);\n if (Buffer.isBuffer(assetEntity.contents)) {\n const searchBuffer = Buffer.from(`${hash}.html`, 'utf8');\n const replaceBuffer = Buffer.from(`${htmlMd5}.html`, 'utf8');\n assert(searchBuffer.length === replaceBuffer.length);\n let index = assetEntity.contents.indexOf(searchBuffer, 0);\n while (index !== -1) {\n replaceBuffer.copy(assetEntity.contents, index);\n index = assetEntity.contents.indexOf(searchBuffer, index + searchBuffer.length);\n }\n } else {\n const search = `${hash}.html`;\n const replace = `${htmlMd5}.html`;\n assert(search.length === replace.length);\n assetEntity.contents = assetEntity.contents.toString().replaceAll(search, replace);\n }\n }\n}\n\n//#endregion `npx export` for updates\n"],"names":["addDomBundleToMetadataAsync","exportDomComponentAsync","transformDomEntryForMd5Filename","transformNativeBundleForMd5Filename","debug","require","filePath","projectRoot","dev","devServer","isHermes","includeSourceMaps","exp","files","useMd5Filename","virtualEntry","resolveFrom","hash","crypto","createHash","update","digest","outputName","DOM_COMPONENTS_BUNDLE_DIR","generatedEntryPath","path","resolve","startsWith","url","fileURLToPath","baseUrl","relativeImport","toPosixPath","relative","dirname","bundle","legacySinglePageExportBundleAsync","platform","domRoot","encodeURI","splitChunks","env","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","convertEntryPointToRelative","mode","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","minify","artifact","artifacts","md5","source","filename","type","html","serializeHtmlWithAssets","isExporting","resources","template","getDomComponentHtml","serialAssets","map","a","join","getFilesFromSerialAssets","set","contents","htmlOutputName","assetsMetadata","push","ext","htmlContent","get","assert","htmlMd5","toString","htmlMd5Filename","delete","domComponentReference","nativeBundle","assetEntity","Buffer","isBuffer","searchBuffer","from","replaceBuffer","length","index","indexOf","copy","search","replace","replaceAll"],"mappings":";;;;;;;;;;;QAqHgBA;eAAAA;;QA/FMC;eAAAA;;QAgHNC;eAAAA;;QAwBAC;eAAAA;;;;yBA7J4B;;;;;;;gEACzB;;;;;;;gEACA;;;;;;;gEACF;;;;;;;gEACO;;;;;;;gEACR;;;;;;4BAGiE;+BAEzC;yCAIjC;qBACa;0BACQ;;;;;;AAE5B,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,eAAeJ,wBAAwB,EAC5CK,QAAQ,EACRC,WAAW,EACXC,GAAG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ACjCD,IAAAA,iBAAM,EAACiB,OAAOJ,MAAM,KAAKK,QAAQL,MAAM;YACvCN,YAAYd,QAAQ,GAAGc,YAAYd,QAAQ,CAACS,QAAQ,GAAGiB,UAAU,CAACF,QAAQC;QAC5E;IACF;AACF,EAEA,qCAAqC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportDomComponents.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\nimport { convertEntryPointToRelative } from '@expo/config/paths';\nimport assert from 'assert';\nimport crypto from 'crypto';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport url from 'url';\n\nimport type { PlatformMetadata } from './createMetadataJson';\nimport { type BundleOutput, type ExportAssetMap, getFilesFromSerialAssets } from './saveAssets';\nimport type { MetroBundlerDevServer } from '../start/server/metro/MetroBundlerDevServer';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport {\n getDomComponentHtml,\n DOM_COMPONENTS_BUNDLE_DIR,\n} from '../start/server/middleware/DomComponentsMiddleware';\nimport { env } from '../utils/env';\nimport { toPosixPath } from '../utils/filePath';\n\nconst debug = require('debug')('expo:export:exportDomComponents') as typeof console.log;\n\n// TODO(EvanBacon): determine how to support DOM Components with hosting.\nexport async function exportDomComponentAsync({\n filePath,\n projectRoot,\n dev,\n devServer,\n isHermes,\n includeSourceMaps,\n exp,\n files,\n useMd5Filename = false,\n}: {\n filePath: string;\n projectRoot: string;\n dev: boolean;\n devServer: MetroBundlerDevServer;\n isHermes: boolean;\n includeSourceMaps: boolean;\n exp: ExpoConfig;\n files: ExportAssetMap;\n useMd5Filename?: boolean;\n}): Promise<{\n bundle: BundleOutput;\n htmlOutputName: string;\n}> {\n const virtualEntry = resolveFrom(projectRoot, 'expo/dom/entry.js');\n debug('Bundle DOM Component:', filePath);\n // MUST MATCH THE BABEL PLUGIN!\n const hash = crypto.createHash('md5').update(filePath).digest('hex');\n const outputName = `${DOM_COMPONENTS_BUNDLE_DIR}/${hash}.html`;\n const generatedEntryPath = path.resolve(\n filePath.startsWith('file://') ? url.fileURLToPath(filePath) : filePath\n );\n const baseUrl = `/${DOM_COMPONENTS_BUNDLE_DIR}`;\n // The relative import path will be used like URI so it must be POSIX.\n const relativeImport =\n './' + toPosixPath(path.relative(path.dirname(virtualEntry), generatedEntryPath));\n // Run metro bundler and create the JS bundles/source maps.\n const bundle = await devServer.legacySinglePageExportBundleAsync({\n platform: 'web',\n domRoot: encodeURI(relativeImport),\n splitChunks: !env.EXPO_NO_BUNDLE_SPLITTING,\n mainModuleName: convertEntryPointToRelative(projectRoot, virtualEntry),\n mode: dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: includeSourceMaps,\n bytecode: false,\n reactCompiler: !!exp.experiments?.reactCompiler,\n baseUrl: './',\n useMd5Filename,\n // Minify may be false because it's skipped on native when Hermes is enabled, default to true.\n minify: true,\n });\n\n if (useMd5Filename) {\n for (const artifact of bundle.artifacts) {\n const md5 = crypto.createHash('md5').update(artifact.source).digest('hex');\n artifact.filename = `${md5}.${artifact.type}`;\n }\n }\n\n const html = await serializeHtmlWithAssets({\n isExporting: true,\n resources: bundle.artifacts,\n template: getDomComponentHtml(),\n baseUrl: './',\n });\n\n const serialAssets = bundle.artifacts.map((a) => {\n return {\n ...a,\n filename: path.join(baseUrl, a.filename),\n };\n });\n\n getFilesFromSerialAssets(serialAssets, {\n includeSourceMaps,\n files,\n platform: 'web',\n });\n\n files.set(outputName, {\n contents: html,\n });\n\n return {\n bundle,\n htmlOutputName: outputName,\n };\n}\n\n//#region `npx export` for updates\n\n/**\n * Add the DOM component bundle to the metadata for updates.\n */\nexport function addDomBundleToMetadataAsync(bundle: BundleOutput): PlatformMetadata['assets'] {\n const assetsMetadata: PlatformMetadata['assets'] = [];\n for (const artifact of bundle.artifacts) {\n if (artifact.type === 'map') {\n continue;\n }\n assetsMetadata.push({\n path: `${DOM_COMPONENTS_BUNDLE_DIR}/${artifact.filename}`,\n ext: artifact.type,\n });\n }\n return assetsMetadata;\n}\n\n/**\n * Transform the DOM component entry (*.html) to use MD5 filename by its content.\n */\nexport function transformDomEntryForMd5Filename({\n files,\n htmlOutputName,\n}: {\n files: ExportAssetMap;\n htmlOutputName: string;\n}): PlatformMetadata['assets'] {\n const htmlContent = files.get(htmlOutputName);\n assert(htmlContent);\n const htmlMd5 = crypto.createHash('md5').update(htmlContent.contents.toString()).digest('hex');\n const htmlMd5Filename = `${DOM_COMPONENTS_BUNDLE_DIR}/${htmlMd5}.html`;\n files.set(htmlMd5Filename, htmlContent);\n files.delete(htmlOutputName);\n return [\n {\n path: htmlMd5Filename,\n ext: 'html',\n },\n ];\n}\n\n/**\n * Post-transform the native bundle to use MD5 filename based on DOM component entry content.\n */\nexport function transformNativeBundleForMd5Filename({\n domComponentReference,\n nativeBundle,\n files,\n htmlOutputName,\n}: {\n domComponentReference: string;\n nativeBundle: BundleOutput;\n files: ExportAssetMap;\n htmlOutputName: string;\n}) {\n const htmlContent = files.get(htmlOutputName);\n assert(htmlContent);\n const htmlMd5 = crypto.createHash('md5').update(htmlContent.contents.toString()).digest('hex');\n const hash = crypto.createHash('md5').update(domComponentReference).digest('hex');\n for (const artifact of nativeBundle.artifacts) {\n if (artifact.type !== 'js') {\n continue;\n }\n if (Buffer.isBuffer(artifact.source)) {\n if (artifact.metadata.expoDomComponentReferences?.length) {\n throw new Error(\n `Cannot rename DOM assets in compiled Hermes bytecode (${artifact.filename}). ` +\n 'Run `npx expo-doctor` to check package compatibility. Custom serializers must defer Hermes compilation until DOM filenames are resolved.'\n );\n }\n } else {\n const search = `${hash}.html`;\n const replace = `${htmlMd5}.html`;\n assert(search.length === replace.length);\n artifact.source = artifact.source.replaceAll(search, replace);\n }\n }\n}\n\n//#endregion `npx export` for updates\n"],"names":["addDomBundleToMetadataAsync","exportDomComponentAsync","transformDomEntryForMd5Filename","transformNativeBundleForMd5Filename","debug","require","filePath","projectRoot","dev","devServer","isHermes","includeSourceMaps","exp","files","useMd5Filename","virtualEntry","resolveFrom","hash","crypto","createHash","update","digest","outputName","DOM_COMPONENTS_BUNDLE_DIR","generatedEntryPath","path","resolve","startsWith","url","fileURLToPath","baseUrl","relativeImport","toPosixPath","relative","dirname","bundle","legacySinglePageExportBundleAsync","platform","domRoot","encodeURI","splitChunks","env","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","convertEntryPointToRelative","mode","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","minify","artifact","artifacts","md5","source","filename","type","html","serializeHtmlWithAssets","isExporting","resources","template","getDomComponentHtml","serialAssets","map","a","join","getFilesFromSerialAssets","set","contents","htmlOutputName","assetsMetadata","push","ext","htmlContent","get","assert","htmlMd5","toString","htmlMd5Filename","delete","domComponentReference","nativeBundle","Buffer","isBuffer","metadata","expoDomComponentReferences","length","Error","search","replace","replaceAll"],"mappings":";;;;;;;;;;;QAqHgBA;eAAAA;;QA/FMC;eAAAA;;QAgHNC;eAAAA;;QAwBAC;eAAAA;;;;yBA7J4B;;;;;;;gEACzB;;;;;;;gEACA;;;;;;;gEACF;;;;;;;gEACO;;;;;;;gEACR;;;;;;4BAGiE;+BAEzC;yCAIjC;qBACa;0BACQ;;;;;;AAE5B,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,eAAeJ,wBAAwB,EAC5CK,QAAQ,EACRC,WAAW,EACXC,GAAG,EACHC,SAAS,EACTC,QAAQ,EACRC,iBAAiB,EACjBC,GAAG,EACHC,KAAK,EACLC,iBAAiB,KAAK,EAWvB;QA0BoBF;IAtBnB,MAAMG,eAAeC,IAAAA,sBAAW,EAACT,aAAa;IAC9CH,MAAM,yBAAyBE;IAC/B,+BAA+B;IAC/B,MAAMW,OAAOC,iBAAM,CAACC,UAAU,CAAC,OAAOC,MAAM,CAACd,UAAUe,MAAM,CAAC;IAC9D,MAAMC,aAAa,GAAGC,kDAAyB,CAAC,CAAC,EAAEN,KAAK,KAAK,CAAC;IAC9D,MAAMO,qBAAqBC,eAAI,CAACC,OAAO,CACrCpB,SA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OAAOC,MAAM,CAAC+D,uBAAuB9D,MAAM,CAAC;IAC3E,KAAK,MAAMgC,YAAY+B,aAAa9B,SAAS,CAAE;QAC7C,IAAID,SAASK,IAAI,KAAK,MAAM;YAC1B;QACF;QACA,IAAI2B,OAAOC,QAAQ,CAACjC,SAASG,MAAM,GAAG;gBAChCH;YAAJ,KAAIA,gDAAAA,SAASkC,QAAQ,CAACC,0BAA0B,qBAA5CnC,8CAA8CoC,MAAM,EAAE;gBACxD,MAAM,IAAIC,MACR,CAAC,sDAAsD,EAAErC,SAASI,QAAQ,CAAC,GAAG,CAAC,GAC7E;YAEN;QACF,OAAO;YACL,MAAMkC,SAAS,GAAG1E,KAAK,KAAK,CAAC;YAC7B,MAAM2E,UAAU,GAAGb,QAAQ,KAAK,CAAC;YACjCD,IAAAA,iBAAM,EAACa,OAAOF,MAAM,KAAKG,QAAQH,MAAM;YACvCpC,SAASG,MAAM,GAAGH,SAASG,MAAM,CAACqC,UAAU,CAACF,QAAQC;QACvD;IACF;AACF,EAEA,qCAAqC"}
|
|
@@ -89,7 +89,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
89
89
|
return newObj;
|
|
90
90
|
}
|
|
91
91
|
const debug = require('debug')('expo:prebuild');
|
|
92
|
-
async function prebuildAsync(projectRoot, options) {
|
|
92
|
+
async function prebuildAsync(projectRoot, options, /** Runs after native configuration, before native dependency installation. */ onProjectReady) {
|
|
93
93
|
var _exp_experiments;
|
|
94
94
|
(0, _nodeEnv.setNodeEnv)('development');
|
|
95
95
|
(0, _nodeEnv.loadEnvFiles)(projectRoot);
|
|
@@ -188,11 +188,12 @@ async function prebuildAsync(projectRoot, options) {
|
|
|
188
188
|
configSyncingStep.fail('Prebuild failed');
|
|
189
189
|
throw error;
|
|
190
190
|
}
|
|
191
|
+
await (onProjectReady == null ? void 0 : onProjectReady());
|
|
191
192
|
// Install CocoaPods
|
|
192
193
|
let podsInstalled = false;
|
|
193
194
|
// err towards running pod install less because it's slow and users can easily run npx pod-install afterwards.
|
|
194
195
|
if (options.platforms.includes('ios') && options.install && needsPodInstall) {
|
|
195
|
-
const { installCocoaPodsAsync } =
|
|
196
|
+
const { installCocoaPodsAsync } = require('../utils/cocoapods');
|
|
196
197
|
podsInstalled = await installCocoaPodsAsync(projectRoot);
|
|
197
198
|
} else {
|
|
198
199
|
debug('Skipped pod install');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\nimport { getConfig } from '@expo/config';\nimport type { ModPlatform } from '@expo/config-plugins';\nimport { updateXcodeProject } from '@expo/inline-modules';\nimport chalk from 'chalk';\n\nimport {\n clearNativeFolder,\n getExistingNativePlatformsAsync,\n promptToClearMalformedNativeProjectsAsync,\n maybeBailOnNativeModuleAsync,\n} from './clearNativeFolder';\nimport { configureProjectAsync } from './configureProjectAsync';\nimport { ensureConfigAsync } from './ensureConfigAsync';\nimport { assertPlatforms, ensureValidPlatforms, resolveTemplateOption } from './resolveOptions';\nimport { updateFromTemplateAsync } from './updateFromTemplate';\nimport { installAsync } from '../install/installAsync';\nimport { Log } from '../log';\nimport { env } from '../utils/env';\nimport { setNodeEnv, loadEnvFiles } from '../utils/nodeEnv';\nimport { clearNodeModulesAsync } from '../utils/nodeModules';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\nimport { confirmAsync } from '../utils/prompts';\n\nconst debug = require('debug')('expo:prebuild') as typeof console.log;\n\nexport type PrebuildResults = {\n /** Expo config. */\n exp: ExpoConfig;\n /** Indicates if the process created new files. */\n hasNewProjectFiles: boolean;\n /** The platforms that were prebuilt. */\n platforms: ModPlatform[];\n /** Indicates if pod install was run. */\n podInstall: boolean;\n /** Indicates if node modules were installed. */\n nodeInstall: boolean;\n};\n\n/**\n * Entry point into the prebuild process, delegates to other helpers to perform various steps.\n *\n * 0. Attempt to clean the project folders.\n * 1. Create native projects (ios, android).\n * 2. Install node modules.\n * 3. Apply config to native projects.\n * 4. Install CocoaPods.\n */\nexport async function prebuildAsync(\n projectRoot: string,\n options: {\n /** Should install node modules and cocoapods. */\n install?: boolean;\n /** List of platforms to prebuild. */\n platforms: ModPlatform[];\n /** Should delete the native folders before attempting to prebuild. */\n clean?: boolean;\n /** URL or file path to the prebuild template. */\n template?: string;\n /** Name of the node package manager to install with. */\n packageManager?: {\n npm?: boolean;\n yarn?: boolean;\n pnpm?: boolean;\n bun?: boolean;\n };\n /** List of node modules to skip updating. */\n skipDependencyUpdate?: string[];\n }\n): Promise<PrebuildResults | null> {\n setNodeEnv('development');\n loadEnvFiles(projectRoot);\n\n const { platforms } = getConfig(projectRoot).exp;\n if (platforms?.length) {\n // Filter out platforms that aren't in the app.json.\n const finalPlatforms = options.platforms.filter((platform) => platforms.includes(platform));\n if (finalPlatforms.length > 0) {\n options.platforms = finalPlatforms;\n } else {\n const requestedPlatforms = options.platforms.join(', ');\n Log.warn(\n chalk`⚠️ Requested prebuild for \"${requestedPlatforms}\", but only \"${platforms.join(', ')}\" is present in app config (\"expo.platforms\" entry). Continuing with \"${requestedPlatforms}\".`\n );\n }\n }\n if (options.clean) {\n // Only run the destructive-path guards when there are native folders to delete, so a\n // first-ever prebuild doesn't prompt on git status or native module detection.\n const existingPlatforms = await getExistingNativePlatformsAsync(projectRoot, options.platforms);\n if (existingPlatforms.length) {\n const { maybeBailOnGitStatusAsync } = await import('../utils/git.js');\n // Clean the project folders...\n if (await maybeBailOnGitStatusAsync()) {\n return null;\n }\n // Check if the target project is actually a native module, which we don't want to erase\n if (await maybeBailOnNativeModuleAsync(projectRoot)) {\n return null;\n }\n // Clear the native folders before syncing\n await clearNativeFolder(projectRoot, options.platforms);\n }\n } else {\n // Check if the existing project folders are malformed.\n await promptToClearMalformedNativeProjectsAsync(projectRoot, options.platforms);\n }\n\n // Warn if the project is attempting to prebuild an unsupported platform (iOS on Windows).\n options.platforms = ensureValidPlatforms(options.platforms);\n // Assert if no platforms are left over after filtering.\n assertPlatforms(options.platforms);\n\n // Get the Expo config, create it if missing.\n const { exp, pkg } = await ensureConfigAsync(projectRoot, { platforms: options.platforms });\n\n // Create native projects from template.\n const { hasNewProjectFiles, needsPodInstall, templateChecksum, changedDependencies } =\n await updateFromTemplateAsync(projectRoot, {\n exp,\n pkg,\n template: options.template != null ? resolveTemplateOption(options.template) : undefined,\n platforms: options.platforms,\n skipDependencyUpdate: options.skipDependencyUpdate,\n });\n\n // Install node modules\n if (options.install) {\n if (changedDependencies.length) {\n if (options.packageManager?.npm) {\n await clearNodeModulesAsync(projectRoot);\n }\n\n Log.log(chalk.gray(chalk`Dependencies in the {bold package.json} changed:`));\n Log.log(chalk.gray(' ' + changedDependencies.join(', ')));\n\n // Installing dependencies is a legacy feature from the unversioned\n // command. We know opt to not change dependencies unless a template\n // indicates a new dependency is required, or if the core dependencies are wrong.\n if (\n await confirmAsync({\n message: `Install the updated dependencies?`,\n initial: true,\n })\n ) {\n await installAsync([], {\n npm: !!options.packageManager?.npm,\n yarn: !!options.packageManager?.yarn,\n pnpm: !!options.packageManager?.pnpm,\n bun: !!options.packageManager?.bun,\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n }\n }\n }\n\n // Apply Expo config to native projects. Prevent log-spew from ora when running in debug mode.\n const configSyncingStep: { succeed(text?: string): unknown; fail(text?: string): unknown } =\n env.EXPO_DEBUG\n ? {\n succeed(text) {\n Log.log(text!);\n },\n fail(text) {\n Log.error(text!);\n },\n }\n : logNewSection('Running prebuild');\n try {\n await profile(configureProjectAsync)(projectRoot, {\n platforms: options.platforms,\n exp,\n templateChecksum,\n });\n configSyncingStep.succeed('Finished prebuild');\n } catch (error) {\n configSyncingStep.fail('Prebuild failed');\n throw error;\n }\n\n // Install CocoaPods\n let podsInstalled: boolean = false;\n // err towards running pod install less because it's slow and users can easily run npx pod-install afterwards.\n if (options.platforms.includes('ios') && options.install && needsPodInstall) {\n const { installCocoaPodsAsync } = await import('../utils/cocoapods.js');\n\n podsInstalled = await installCocoaPodsAsync(projectRoot);\n } else {\n debug('Skipped pod install');\n }\n const inlineModules = exp.experiments?.inlineModules ?? false;\n if (inlineModules && options.platforms.includes('ios')) {\n await updateXcodeProject(projectRoot, {\n watchedDirectories: inlineModules.watchedDirectories ?? [],\n xcodeProjectTargets: inlineModules.xcodeProjectTargets,\n name: exp.name,\n });\n }\n\n return {\n nodeInstall: !!options.install,\n podInstall: !podsInstalled,\n platforms: options.platforms,\n hasNewProjectFiles,\n exp,\n };\n}\n"],"names":["prebuildAsync","debug","require","projectRoot","options","exp","setNodeEnv","loadEnvFiles","platforms","getConfig","length","finalPlatforms","filter","platform","includes","requestedPlatforms","join","Log","warn","chalk","clean","existingPlatforms","getExistingNativePlatformsAsync","maybeBailOnGitStatusAsync","maybeBailOnNativeModuleAsync","clearNativeFolder","promptToClearMalformedNativeProjectsAsync","ensureValidPlatforms","assertPlatforms","pkg","ensureConfigAsync","hasNewProjectFiles","needsPodInstall","templateChecksum","changedDependencies","updateFromTemplateAsync","template","resolveTemplateOption","undefined","skipDependencyUpdate","install","packageManager","npm","clearNodeModulesAsync","log","gray","confirmAsync","message","initial","installAsync","yarn","pnpm","bun","silent","env","EXPO_DEBUG","CI","configSyncingStep","succeed","text","fail","error","logNewSection","profile","configureProjectAsync","podsInstalled","installCocoaPodsAsync","inlineModules","experiments","updateXcodeProject","watchedDirectories","xcodeProjectTargets","name","nodeInstall","podInstall"],"mappings":";;;;+BAiDsBA;;;eAAAA;;;;yBAhDI;;;;;;;yBAES;;;;;;;gEACjB;;;;;;mCAOX;uCAC+B;mCACJ;gCAC2C;oCACrC;8BACX;qBACT;qBACA;yBACqB;6BACH;qBACR;yBACN;yBACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAwBxB,eAAeF,cACpBG,WAAmB,EACnBC,OAkBC;QA0HqBC;IAxHtBC,IAAAA,mBAAU,EAAC;IACXC,IAAAA,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AAImE,IAAI;QAChB;IACF;IAEA,OAAO;QACLC,aAAa,CAAC,CAACrE,QAAQoC,OAAO;QAC9BkC,YAAY,CAACT;QACbzD,WAAWJ,QAAQI,SAAS;QAC5BuB;QACA1B;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\nimport { getConfig } from '@expo/config';\nimport type { ModPlatform } from '@expo/config-plugins';\nimport { updateXcodeProject } from '@expo/inline-modules';\nimport chalk from 'chalk';\n\nimport {\n clearNativeFolder,\n getExistingNativePlatformsAsync,\n promptToClearMalformedNativeProjectsAsync,\n maybeBailOnNativeModuleAsync,\n} from './clearNativeFolder';\nimport { configureProjectAsync } from './configureProjectAsync';\nimport { ensureConfigAsync } from './ensureConfigAsync';\nimport { assertPlatforms, ensureValidPlatforms, resolveTemplateOption } from './resolveOptions';\nimport { updateFromTemplateAsync } from './updateFromTemplate';\nimport { installAsync } from '../install/installAsync';\nimport { Log } from '../log';\nimport { env } from '../utils/env';\nimport { setNodeEnv, loadEnvFiles } from '../utils/nodeEnv';\nimport { clearNodeModulesAsync } from '../utils/nodeModules';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\nimport { confirmAsync } from '../utils/prompts';\n\nconst debug = require('debug')('expo:prebuild') as typeof console.log;\n\nexport type PrebuildResults = {\n /** Expo config. */\n exp: ExpoConfig;\n /** Indicates if the process created new files. */\n hasNewProjectFiles: boolean;\n /** The platforms that were prebuilt. */\n platforms: ModPlatform[];\n /** Indicates if pod install was run. */\n podInstall: boolean;\n /** Indicates if node modules were installed. */\n nodeInstall: boolean;\n};\n\n/**\n * Entry point into the prebuild process, delegates to other helpers to perform various steps.\n *\n * 0. Attempt to clean the project folders.\n * 1. Create native projects (ios, android).\n * 2. Install node modules.\n * 3. Apply config to native projects.\n * 4. Install CocoaPods.\n */\nexport async function prebuildAsync(\n projectRoot: string,\n options: {\n /** Should install node modules and cocoapods. */\n install?: boolean;\n /** List of platforms to prebuild. */\n platforms: ModPlatform[];\n /** Should delete the native folders before attempting to prebuild. */\n clean?: boolean;\n /** URL or file path to the prebuild template. */\n template?: string;\n /** Name of the node package manager to install with. */\n packageManager?: {\n npm?: boolean;\n yarn?: boolean;\n pnpm?: boolean;\n bun?: boolean;\n };\n /** List of node modules to skip updating. */\n skipDependencyUpdate?: string[];\n },\n /** Runs after native configuration, before native dependency installation. */\n onProjectReady?: () => Promise<void>\n): Promise<PrebuildResults | null> {\n setNodeEnv('development');\n loadEnvFiles(projectRoot);\n\n const { platforms } = getConfig(projectRoot).exp;\n if (platforms?.length) {\n // Filter out platforms that aren't in the app.json.\n const finalPlatforms = options.platforms.filter((platform) => platforms.includes(platform));\n if (finalPlatforms.length > 0) {\n options.platforms = finalPlatforms;\n } else {\n const requestedPlatforms = options.platforms.join(', ');\n Log.warn(\n chalk`⚠️ Requested prebuild for \"${requestedPlatforms}\", but only \"${platforms.join(', ')}\" is present in app config (\"expo.platforms\" entry). Continuing with \"${requestedPlatforms}\".`\n );\n }\n }\n if (options.clean) {\n // Only run the destructive-path guards when there are native folders to delete, so a\n // first-ever prebuild doesn't prompt on git status or native module detection.\n const existingPlatforms = await getExistingNativePlatformsAsync(projectRoot, options.platforms);\n if (existingPlatforms.length) {\n const { maybeBailOnGitStatusAsync } = await import('../utils/git.js');\n // Clean the project folders...\n if (await maybeBailOnGitStatusAsync()) {\n return null;\n }\n // Check if the target project is actually a native module, which we don't want to erase\n if (await maybeBailOnNativeModuleAsync(projectRoot)) {\n return null;\n }\n // Clear the native folders before syncing\n await clearNativeFolder(projectRoot, options.platforms);\n }\n } else {\n // Check if the existing project folders are malformed.\n await promptToClearMalformedNativeProjectsAsync(projectRoot, options.platforms);\n }\n\n // Warn if the project is attempting to prebuild an unsupported platform (iOS on Windows).\n options.platforms = ensureValidPlatforms(options.platforms);\n // Assert if no platforms are left over after filtering.\n assertPlatforms(options.platforms);\n\n // Get the Expo config, create it if missing.\n const { exp, pkg } = await ensureConfigAsync(projectRoot, { platforms: options.platforms });\n\n // Create native projects from template.\n const { hasNewProjectFiles, needsPodInstall, templateChecksum, changedDependencies } =\n await updateFromTemplateAsync(projectRoot, {\n exp,\n pkg,\n template: options.template != null ? resolveTemplateOption(options.template) : undefined,\n platforms: options.platforms,\n skipDependencyUpdate: options.skipDependencyUpdate,\n });\n\n // Install node modules\n if (options.install) {\n if (changedDependencies.length) {\n if (options.packageManager?.npm) {\n await clearNodeModulesAsync(projectRoot);\n }\n\n Log.log(chalk.gray(chalk`Dependencies in the {bold package.json} changed:`));\n Log.log(chalk.gray(' ' + changedDependencies.join(', ')));\n\n // Installing dependencies is a legacy feature from the unversioned\n // command. We know opt to not change dependencies unless a template\n // indicates a new dependency is required, or if the core dependencies are wrong.\n if (\n await confirmAsync({\n message: `Install the updated dependencies?`,\n initial: true,\n })\n ) {\n await installAsync([], {\n npm: !!options.packageManager?.npm,\n yarn: !!options.packageManager?.yarn,\n pnpm: !!options.packageManager?.pnpm,\n bun: !!options.packageManager?.bun,\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n }\n }\n }\n\n // Apply Expo config to native projects. Prevent log-spew from ora when running in debug mode.\n const configSyncingStep: { succeed(text?: string): unknown; fail(text?: string): unknown } =\n env.EXPO_DEBUG\n ? {\n succeed(text) {\n Log.log(text!);\n },\n fail(text) {\n Log.error(text!);\n },\n }\n : logNewSection('Running prebuild');\n try {\n await profile(configureProjectAsync)(projectRoot, {\n platforms: options.platforms,\n exp,\n templateChecksum,\n });\n configSyncingStep.succeed('Finished prebuild');\n } catch (error) {\n configSyncingStep.fail('Prebuild failed');\n throw error;\n }\n\n await onProjectReady?.();\n\n // Install CocoaPods\n let podsInstalled: boolean = false;\n // err towards running pod install less because it's slow and users can easily run npx pod-install afterwards.\n if (options.platforms.includes('ios') && options.install && needsPodInstall) {\n const { installCocoaPodsAsync } =\n require('../utils/cocoapods') as typeof import('../utils/cocoapods');\n\n podsInstalled = await installCocoaPodsAsync(projectRoot);\n } else {\n debug('Skipped pod install');\n }\n const inlineModules = exp.experiments?.inlineModules ?? false;\n if (inlineModules && options.platforms.includes('ios')) {\n await updateXcodeProject(projectRoot, {\n watchedDirectories: inlineModules.watchedDirectories ?? [],\n xcodeProjectTargets: inlineModules.xcodeProjectTargets,\n name: exp.name,\n });\n }\n\n return {\n nodeInstall: !!options.install,\n podInstall: !podsInstalled,\n platforms: options.platforms,\n hasNewProjectFiles,\n exp,\n };\n}\n"],"names":["prebuildAsync","debug","require","projectRoot","options","onProjectReady","exp","setNodeEnv","loadEnvFiles","platforms","getConfig","length","finalPlatforms","filter","platform","includes","requestedPlatforms","join","Log","warn","chalk","clean","existingPlatforms","getExistingNativePlatformsAsync","maybeBailOnGitStatusAsync","maybeBailOnNativeModuleAsync","clearNativeFolder","promptToClearMalformedNativeProjectsAsync","ensureValidPlatforms","assertPlatforms","pkg","ensureConfigAsync","hasNewProjectFiles","needsPodInstall","templateChecksum","changedDependencies","updateFromTemplateAsync","template","resolveTemplateOption","undefined","skipDependencyUpdate","install","packageManager","npm","clearNodeModulesAsync","log","gray","confirmAsync","message","initial","installAsync","yarn","pnpm","bun","silent","env","EXPO_DEBUG","CI","configSyncingStep","succeed","text","fail","error","logNewSection","profile","configureProjectAsync","podsInstalled","installCocoaPodsAsync","inlineModules","experiments","updateXcodeProject","watchedDirectories","xcodeProjectTargets","name","nodeInstall","podInstall"],"mappings":";;;;+BAiDsBA;;;eAAAA;;;;yBAhDI;;;;;;;yBAES;;;;;;;gEACjB;;;;;;mCAOX;uCAC+B;mCACJ;gCAC2C;oCACrC;8BACX;qBACT;qBACA;yBACqB;6BACH;qBACR;yBACN;yBACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAwBxB,eAAeF,cACpBG,WAAmB,EACnBC,OAkBC,EACD,4EAA4E,GAC5EC,cAAoC;QA6HdC;IA3HtBC,IAAAA,mB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