@depup/expo__cli 55.0.23-depup.0 → 57.0.10-depup.0
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/LICENSE +21 -0
- package/README.md +13 -15
- package/build/bin/cli +4 -4
- package/build/bin/cli.map +1 -1
- package/build/src/api/endpoint.js +4 -4
- package/build/src/api/endpoint.js.map +1 -1
- package/build/src/api/getExpoSchema.js +3 -3
- package/build/src/api/getExpoSchema.js.map +1 -1
- package/build/src/api/graphql/client.js +26 -14
- package/build/src/api/graphql/client.js.map +1 -1
- package/build/src/api/graphql/mutations/TunnelMutation.js +31 -0
- package/build/src/api/graphql/mutations/TunnelMutation.js.map +1 -0
- package/build/src/api/rest/cache/FileSystemResponseCache.js.map +1 -1
- package/build/src/api/rest/cache/ResponseCache.js +5 -5
- package/build/src/api/rest/cache/ResponseCache.js.map +1 -1
- package/build/src/api/rest/client.js +35 -20
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithBaseUrl.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithProgress.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithUserAgent.js.map +1 -1
- package/build/src/api/updateDevelopmentSession.js +6 -5
- package/build/src/api/updateDevelopmentSession.js.map +1 -1
- package/build/src/api/user/UserSettings.js +28 -15
- package/build/src/api/user/UserSettings.js.map +1 -1
- package/build/src/api/user/actions.js +10 -3
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/api/user/expoSsoLauncher.js +76 -24
- package/build/src/api/user/expoSsoLauncher.js.map +1 -1
- package/build/src/api/user/otp.js +4 -4
- package/build/src/api/user/otp.js.map +1 -1
- package/build/src/api/user/user.js +19 -7
- package/build/src/api/user/user.js.map +1 -1
- package/build/src/config/configAsync.js +3 -3
- package/build/src/config/configAsync.js.map +1 -1
- package/build/src/config/index.js.map +1 -1
- package/build/src/customize/customizeAsync.js.map +1 -1
- package/build/src/customize/generate.js +7 -4
- package/build/src/customize/generate.js.map +1 -1
- package/build/src/customize/index.js.map +1 -1
- package/build/src/customize/templates.js +4 -6
- package/build/src/customize/templates.js.map +1 -1
- package/build/src/customize/typescript.js.map +1 -1
- package/build/src/events/index.js +19 -15
- package/build/src/events/index.js.map +1 -1
- package/build/src/events/stream.js +94 -24
- package/build/src/events/stream.js.map +1 -1
- package/build/src/expoUpdatesExports.js +4 -4
- package/build/src/expoUpdatesExports.js.map +1 -1
- package/build/src/export/createMetadataJson.js +2 -1
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +45 -20
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/exportServer.js +1 -1
- package/build/src/export/embed/exportServer.js.map +1 -1
- package/build/src/export/embed/index.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +7 -6
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/embed/xcodeCompilerLogger.js +7 -7
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -1
- package/build/src/export/exportApp.js +32 -28
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +5 -5
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/exportDomComponents.js +5 -5
- package/build/src/export/exportDomComponents.js.map +1 -1
- package/build/src/export/exportHermes.js +23 -13
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +30 -21
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +26 -34
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/getPublicExpoManifest.js.map +1 -1
- package/build/src/export/getResolvedLocales.js.map +1 -1
- package/build/src/export/html.js +3 -3
- package/build/src/export/html.js.map +1 -1
- package/build/src/export/index.js +2 -0
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +4 -4
- package/build/src/export/metroAssetLocalPath.js.map +1 -1
- package/build/src/export/persistMetroAssets.js +6 -6
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/publicFolder.js +16 -4
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/resolveOptions.js +12 -13
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +3 -3
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/static.js +6 -0
- package/build/src/export/static.js.map +1 -0
- package/build/src/export/web/exportWebAsync.js.map +1 -1
- package/build/src/export/web/index.js.map +1 -1
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/checkPackages.js +1 -28
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/fixPackages.js.map +1 -1
- package/build/src/install/index.js.map +1 -1
- package/build/src/install/installAsync.js +3 -3
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/installExpoPackage.js.map +1 -1
- package/build/src/install/resolveOptions.js.map +1 -1
- package/build/src/install/utils/autoAddConfigPlugins.js +3 -3
- package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
- package/build/src/install/utils/checkPackagesCompatibility.js +32 -16
- package/build/src/install/utils/checkPackagesCompatibility.js.map +1 -1
- package/build/src/lint/ESlintPrerequisite.js.map +1 -1
- package/build/src/log.js +32 -14
- package/build/src/log.js.map +1 -1
- package/build/src/login/index.js +25 -5
- package/build/src/login/index.js.map +1 -1
- package/build/src/logout/index.js.map +1 -1
- package/build/src/prebuild/clearNativeFolder.js +49 -14
- package/build/src/prebuild/clearNativeFolder.js.map +1 -1
- package/build/src/prebuild/configureProjectAsync.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +3 -3
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
- package/build/src/prebuild/index.js +3 -2
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +31 -6
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/renameTemplateAppName.js +8 -5
- package/build/src/prebuild/renameTemplateAppName.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +7 -7
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/resolveTemplate.js +10 -5
- package/build/src/prebuild/resolveTemplate.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +3 -3
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +7 -7
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
- package/build/src/register/index.js.map +1 -1
- package/build/src/run/android/index.js.map +1 -1
- package/build/src/run/android/resolveGradlePropsAsync.js +3 -4
- package/build/src/run/android/resolveGradlePropsAsync.js.map +1 -1
- package/build/src/run/android/resolveInstallApkName.js +48 -1
- package/build/src/run/android/resolveInstallApkName.js.map +1 -1
- package/build/src/run/android/resolveLaunchProps.js +4 -1
- package/build/src/run/android/resolveLaunchProps.js.map +1 -1
- package/build/src/run/android/resolveOptions.js.map +1 -1
- package/build/src/run/android/runAndroidAsync.js.map +1 -1
- package/build/src/run/ensureNativeProject.js.map +1 -1
- package/build/src/run/hints.js +4 -4
- package/build/src/run/hints.js.map +1 -1
- package/build/src/run/index.js.map +1 -1
- package/build/src/run/ios/XcodeBuild.js +163 -23
- package/build/src/run/ios/XcodeBuild.js.map +1 -1
- package/build/src/run/ios/appleDevice/AppleDevice.js +6 -5
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
- package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/AFCClient.js +10 -16
- package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js +1 -1
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +2 -1
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js +1 -1
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/ServiceClient.js +3 -3
- package/build/src/run/ios/appleDevice/client/ServiceClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +3 -3
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +16 -13
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js +6 -6
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +5 -5
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +7 -7
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js +5 -5
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js.map +1 -1
- package/build/src/run/ios/codeSigning/Security.js +8 -8
- package/build/src/run/ios/codeSigning/Security.js.map +1 -1
- package/build/src/run/ios/codeSigning/configureCodeSigning.js +5 -3
- package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -1
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +7 -5
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -1
- package/build/src/run/ios/codeSigning/settings.js +3 -3
- package/build/src/run/ios/codeSigning/settings.js.map +1 -1
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +4 -4
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -1
- package/build/src/run/ios/index.js +8 -1
- package/build/src/run/ios/index.js.map +1 -1
- package/build/src/run/ios/launchApp.js +3 -3
- package/build/src/run/ios/launchApp.js.map +1 -1
- package/build/src/run/ios/options/appleDestinations.js.map +1 -1
- package/build/src/run/ios/options/promptDevice.js +3 -3
- package/build/src/run/ios/options/promptDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveDevice.js +8 -3
- package/build/src/run/ios/options/resolveDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveNativeScheme.js +4 -4
- package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
- package/build/src/run/ios/options/resolveOptions.js +9 -4
- package/build/src/run/ios/options/resolveOptions.js.map +1 -1
- package/build/src/run/ios/options/resolveXcodeProject.js.map +1 -1
- package/build/src/run/ios/runIosAsync.js +39 -0
- package/build/src/run/ios/runIosAsync.js.map +1 -1
- package/build/src/run/ios/validateExternalBinary.js.map +1 -1
- package/build/src/run/startBundler.js +4 -0
- package/build/src/run/startBundler.js.map +1 -1
- package/build/src/serve/index.js +4 -1
- package/build/src/serve/index.js.map +1 -1
- package/build/src/serve/serveAsync.js +23 -11
- package/build/src/serve/serveAsync.js.map +1 -1
- package/build/src/serve/static.js +69 -0
- package/build/src/serve/static.js.map +1 -0
- package/build/src/start/checkDependenciesOnStart.js +131 -0
- package/build/src/start/checkDependenciesOnStart.js.map +1 -0
- package/build/src/start/detectDevClient.js +3 -3
- package/build/src/start/detectDevClient.js.map +1 -1
- package/build/src/start/doctor/Prerequisite.js +4 -4
- package/build/src/start/doctor/Prerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +53 -91
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcodePrerequisite.js +3 -3
- package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +3 -3
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
- package/build/src/start/doctor/dependencies/getMissingPackages.js +5 -5
- package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +5 -5
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/reactNativeTv.js +149 -0
- package/build/src/start/doctor/dependencies/reactNativeTv.js.map +1 -0
- package/build/src/start/doctor/dependencies/resolvePackages.js +4 -4
- package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +33 -8
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js +3 -3
- package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
- package/build/src/start/doctor/ngrok/NgrokResolver.js +3 -3
- package/build/src/start/doctor/ngrok/NgrokResolver.js.map +1 -1
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
- package/build/src/start/doctor/typescript/updateTSConfig.js +3 -3
- package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +5 -12
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
- package/build/src/start/index.js +2 -0
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/interface/KeyPressHandler.js.map +1 -1
- package/build/src/start/interface/cliExtensionMenuItemHandler.js.map +1 -1
- package/build/src/start/interface/commandsTable.js +6 -6
- 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 +49 -6
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/interface/startInterface.js +13 -4
- package/build/src/start/interface/startInterface.js.map +1 -1
- package/build/src/start/platforms/AppIdResolver.js +4 -0
- package/build/src/start/platforms/AppIdResolver.js.map +1 -1
- package/build/src/start/platforms/DeviceManager.js.map +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js +13 -4
- package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
- package/build/src/start/platforms/PlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/AndroidAppIdResolver.js.map +1 -1
- package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -1
- package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/activateWindow.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +36 -34
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/platforms/android/adbReverse.js +4 -4
- package/build/src/start/platforms/android/adbReverse.js.map +1 -1
- package/build/src/start/platforms/android/emulator.js +5 -5
- package/build/src/start/platforms/android/emulator.js.map +1 -1
- package/build/src/start/platforms/android/getDevices.js.map +1 -1
- package/build/src/start/platforms/android/gradle.js +5 -5
- package/build/src/start/platforms/android/gradle.js.map +1 -1
- package/build/src/start/platforms/android/promptAndroidDevice.js +3 -3
- package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
- package/build/src/start/platforms/ios/AppleAppIdResolver.js.map +1 -1
- package/build/src/start/platforms/ios/AppleDeviceManager.js +20 -6
- package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
- package/build/src/start/platforms/ios/ApplePlatformManager.js +11 -0
- package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -1
- package/build/src/start/platforms/ios/devicectl.js +7 -7
- package/build/src/start/platforms/ios/devicectl.js.map +1 -1
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js +26 -11
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -1
- package/build/src/start/platforms/ios/getBestSimulator.js +5 -5
- package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
- package/build/src/start/platforms/ios/promptAppleDevice.js +5 -4
- package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
- package/build/src/start/platforms/ios/simctl.js +25 -19
- package/build/src/start/platforms/ios/simctl.js.map +1 -1
- package/build/src/start/platforms/ios/simctlLogging.js +3 -3
- package/build/src/start/platforms/ios/simctlLogging.js.map +1 -1
- package/build/src/start/platforms/ios/xcrun.js +3 -3
- package/build/src/start/platforms/ios/xcrun.js.map +1 -1
- package/build/src/start/project/devices.js +6 -6
- package/build/src/start/project/devices.js.map +1 -1
- package/build/src/start/project/dotExpo.js +4 -3
- package/build/src/start/project/dotExpo.js.map +1 -1
- package/build/src/start/resolveOptions.js +7 -7
- package/build/src/start/resolveOptions.js.map +1 -1
- package/build/src/start/server/AsyncNgrok.js +1 -1
- package/build/src/start/server/AsyncNgrok.js.map +1 -1
- package/build/src/start/server/AsyncWsTunnel.js +120 -35
- package/build/src/start/server/AsyncWsTunnel.js.map +1 -1
- package/build/src/start/server/Bonjour.js +8 -3
- package/build/src/start/server/Bonjour.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +23 -9
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevToolsPlugin.js +63 -3
- package/build/src/start/server/DevToolsPlugin.js.map +1 -1
- package/build/src/start/server/DevToolsPlugin.schema.js +8 -3
- package/build/src/start/server/DevToolsPlugin.schema.js.map +1 -1
- package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js +58 -23
- package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js.map +1 -1
- package/build/src/start/server/DevToolsPluginCliExtensionResults.js +29 -0
- package/build/src/start/server/DevToolsPluginCliExtensionResults.js.map +1 -1
- package/build/src/start/server/DevToolsPluginManager.js +20 -6
- package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
- package/build/src/start/server/DevToolsPluginServerHelpers.js +83 -0
- package/build/src/start/server/DevToolsPluginServerHelpers.js.map +1 -0
- package/build/src/start/server/DevelopmentSession.js +41 -24
- package/build/src/start/server/DevelopmentSession.js.map +1 -1
- package/build/src/start/server/MCP.js +10 -3
- package/build/src/start/server/MCP.js.map +1 -1
- package/build/src/start/server/MCPDevToolsPluginCLIExtensions.js +15 -5
- package/build/src/start/server/MCPDevToolsPluginCLIExtensions.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +14 -1
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/createMCPDevToolsExtensionSchema.js +18 -4
- package/build/src/start/server/createMCPDevToolsExtensionSchema.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +13 -24
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +241 -109
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +67 -16
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +22 -4
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/createExpoAutolinkingResolver.js +25 -12
- package/build/src/start/server/metro/createExpoAutolinkingResolver.js.map +1 -1
- package/build/src/start/server/metro/createExpoFallbackResolver.js.map +1 -1
- package/build/src/start/server/metro/createFileMap-fork.js +196 -0
- package/build/src/start/server/metro/createFileMap-fork.js.map +1 -0
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +22 -22
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/createTypescriptResolver.js +410 -0
- package/build/src/start/server/metro/createTypescriptResolver.js.map +1 -0
- package/build/src/start/server/metro/debugging/MessageHandler.js.map +1 -1
- package/build/src/start/server/metro/debugging/attachAtlas.js +3 -3
- package/build/src/start/server/metro/debugging/attachAtlas.js.map +1 -1
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +6 -5
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
- package/build/src/start/server/metro/debugging/createHandlersFactory.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js +20 -4
- package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js.map +1 -1
- package/build/src/start/server/metro/debugging/pageIsSupported.js.map +1 -1
- package/build/src/start/server/metro/dev-server/compression.js.map +1 -1
- package/build/src/start/server/metro/dev-server/createMessageSocket.js +13 -2
- package/build/src/start/server/metro/dev-server/createMessageSocket.js.map +1 -1
- package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +9 -2
- package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
- package/build/src/start/server/metro/dev-server/utils/socketMessages.js +3 -3
- package/build/src/start/server/metro/dev-server/utils/socketMessages.js.map +1 -1
- package/build/src/start/server/metro/errors/FailedToResolveNativeOnlyModuleError.js.map +1 -1
- package/build/src/start/server/metro/externals.js +4 -4
- package/build/src/start/server/metro/externals.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js +3 -3
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/getCssModulesFromBundler.js +3 -3
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +141 -57
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/log-box/LogBoxLog.js.map +1 -1
- package/build/src/start/server/metro/log-box/LogBoxSymbolication.js +4 -4
- package/build/src/start/server/metro/log-box/LogBoxSymbolication.js.map +1 -1
- package/build/src/start/server/metro/log-box/formatProjectFilePath.js +3 -3
- package/build/src/start/server/metro/log-box/formatProjectFilePath.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +16 -13
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/metroErrors.js +3 -3
- package/build/src/start/server/metro/metroErrors.js.map +1 -1
- package/build/src/start/server/metro/metroWatchTypeScriptFiles.js +48 -16
- package/build/src/start/server/metro/metroWatchTypeScriptFiles.js.map +1 -1
- package/build/src/start/server/metro/resolveLoader.js +3 -3
- package/build/src/start/server/metro/resolveLoader.js.map +1 -1
- package/build/src/start/server/metro/router.js +23 -14
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +13 -10
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +29 -13
- package/build/src/start/server/metro/serializeHtml.js.map +1 -1
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +36 -34
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/start/server/metro/withMetroErrorReportingResolver.js +53 -30
- package/build/src/start/server/metro/withMetroErrorReportingResolver.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +187 -126
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js +4 -4
- package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
- package/build/src/start/server/middleware/ContextModuleSourceMapsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/CorsMiddleware.js +3 -3
- package/build/src/start/server/middleware/CorsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +60 -9
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/DomComponentsMiddleware.js +16 -12
- package/build/src/start/server/middleware/DomComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +6 -4
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoMiddleware.js +3 -3
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/FaviconMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/HistoryFallbackMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js +13 -8
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +15 -6
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/OpenMiddleware.js +150 -0
- package/build/src/start/server/middleware/OpenMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +13 -4
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ServeStaticMiddleware.js +2 -9
- package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/domPolyfills.js +60 -0
- package/build/src/start/server/middleware/domPolyfills.js.map +1 -0
- package/build/src/start/server/middleware/inspector/JsInspector.js +6 -31
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +14 -24
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/middlwareMutations.js +3 -3
- package/build/src/start/server/middleware/inspector/middlwareMutations.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +15 -14
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/middleware/mutations.js +3 -3
- package/build/src/start/server/middleware/mutations.js.map +1 -1
- package/build/src/start/server/middleware/openHandlers.js +157 -0
- package/build/src/start/server/middleware/openHandlers.js.map +1 -0
- package/build/src/start/server/middleware/resolveAssets.js +4 -4
- package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
- package/build/src/start/server/middleware/resolvePlatform.js +9 -7
- package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
- package/build/src/start/server/middleware/resolveRuntimeVersionWithExpoUpdatesAsync.js.map +1 -1
- package/build/src/start/server/openPlatforms.js.map +1 -1
- package/build/src/start/server/platformBundlers.js +3 -1
- package/build/src/start/server/platformBundlers.js.map +1 -1
- package/build/src/start/server/serverLogLikeMetro.js +13 -36
- package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
- package/build/src/start/server/type-generation/expo-env.js +3 -3
- package/build/src/start/server/type-generation/expo-env.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +14 -55
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/start/server/type-generation/tsconfig.js +5 -5
- package/build/src/start/server/type-generation/tsconfig.js.map +1 -1
- package/build/src/start/server/webTemplate.js +12 -10
- package/build/src/start/server/webTemplate.js.map +1 -1
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +3 -3
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
- package/build/src/start/server/webpack/formatWebpackMessages.js.map +1 -1
- package/build/src/start/server/webpack/resolveFromProject.js +4 -4
- package/build/src/start/server/webpack/resolveFromProject.js.map +1 -1
- package/build/src/start/server/webpack/tls.js +3 -3
- package/build/src/start/server/webpack/tls.js.map +1 -1
- package/build/src/start/startAsync.js +21 -11
- package/build/src/start/startAsync.js.map +1 -1
- package/build/src/types.d.ts +2 -0
- package/build/src/utils/FileNotifier.js +1 -1
- package/build/src/utils/FileNotifier.js.map +1 -1
- package/build/src/utils/args.js +5 -5
- package/build/src/utils/args.js.map +1 -1
- package/build/src/utils/array.js +8 -8
- package/build/src/utils/array.js.map +1 -1
- package/build/src/utils/build-cache-providers/helpers.js +4 -4
- package/build/src/utils/build-cache-providers/helpers.js.map +1 -1
- package/build/src/utils/build-cache-providers/index.js +5 -5
- package/build/src/utils/build-cache-providers/index.js.map +1 -1
- package/build/src/utils/cocoapods.js +5 -5
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/codesigning.js +12 -6
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/composeMetroIgnorePatterns.js +69 -0
- package/build/src/utils/composeMetroIgnorePatterns.js.map +1 -0
- package/build/src/utils/createTempPath.js +3 -3
- package/build/src/utils/createTempPath.js.map +1 -1
- package/build/src/utils/delay.js +4 -4
- package/build/src/utils/delay.js.map +1 -1
- package/build/src/utils/dir.js +21 -11
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/downloadAppAsync.js.map +1 -1
- package/build/src/utils/downloadExpoGoAsync.js +4 -4
- package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
- package/build/src/utils/editor.js +4 -4
- package/build/src/utils/editor.js.map +1 -1
- package/build/src/utils/env.js +39 -13
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/errors.js +6 -6
- package/build/src/utils/errors.js.map +1 -1
- package/build/src/utils/exit.js +15 -19
- package/build/src/utils/exit.js.map +1 -1
- package/build/src/utils/expoUpdatesCli.js +5 -5
- package/build/src/utils/expoUpdatesCli.js.map +1 -1
- package/build/src/utils/fetch.js +4 -4
- package/build/src/utils/fetch.js.map +1 -1
- package/build/src/utils/findUp.js +3 -3
- package/build/src/utils/findUp.js.map +1 -1
- package/build/src/utils/fn.js +3 -3
- package/build/src/utils/fn.js.map +1 -1
- package/build/src/utils/freeport.js +3 -3
- package/build/src/utils/freeport.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +3 -5
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/getRunningProcess.js +5 -5
- package/build/src/utils/getRunningProcess.js.map +1 -1
- package/build/src/utils/git.js +3 -3
- package/build/src/utils/git.js.map +1 -1
- package/build/src/utils/glob.js +3 -3
- package/build/src/utils/glob.js.map +1 -1
- package/build/src/utils/ip.js +4 -4
- package/build/src/utils/ip.js.map +1 -1
- package/build/src/utils/link.js +3 -3
- package/build/src/utils/link.js.map +1 -1
- package/build/src/utils/mergeGitIgnorePaths.js +10 -10
- package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
- package/build/src/utils/modifyConfigAsync.js +3 -3
- package/build/src/utils/modifyConfigAsync.js.map +1 -1
- package/build/src/utils/net.js +23 -4
- package/build/src/utils/net.js.map +1 -1
- package/build/src/utils/nodeEnv.js +6 -6
- package/build/src/utils/nodeEnv.js.map +1 -1
- package/build/src/utils/npm.js +10 -9
- package/build/src/utils/npm.js.map +1 -1
- package/build/src/utils/obj.js +4 -4
- package/build/src/utils/obj.js.map +1 -1
- package/build/src/utils/open.js +240 -11
- package/build/src/utils/open.js.map +1 -1
- package/build/src/utils/ora.js +4 -4
- package/build/src/utils/ora.js.map +1 -1
- package/build/src/utils/plist.js +5 -4
- package/build/src/utils/plist.js.map +1 -1
- package/build/src/utils/port.js +12 -5
- package/build/src/utils/port.js.map +1 -1
- package/build/src/utils/progress.js +4 -4
- package/build/src/utils/progress.js.map +1 -1
- package/build/src/utils/prompts.js +11 -11
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/utils/qr.js +5 -4
- package/build/src/utils/qr.js.map +1 -1
- package/build/src/utils/resolveArgs.js +10 -9
- package/build/src/utils/resolveArgs.js.map +1 -1
- package/build/src/utils/scheme.js +4 -4
- package/build/src/utils/scheme.js.map +1 -1
- package/build/src/utils/strings.js.map +1 -1
- package/build/src/utils/tar.js +8 -7
- package/build/src/utils/tar.js.map +1 -1
- package/build/src/utils/telemetry/Telemetry.js +5 -0
- package/build/src/utils/telemetry/Telemetry.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js.map +1 -1
- package/build/src/utils/telemetry/clients/flushFetchDetached.js +5 -1
- package/build/src/utils/telemetry/clients/flushFetchDetached.js.map +1 -1
- package/build/src/utils/telemetry/index.js +4 -4
- package/build/src/utils/telemetry/index.js.map +1 -1
- package/build/src/utils/telemetry/utils/agent.js +42 -0
- package/build/src/utils/telemetry/utils/agent.js.map +1 -0
- package/build/src/utils/telemetry/utils/constants.js +3 -3
- package/build/src/utils/telemetry/utils/constants.js.map +1 -1
- package/build/src/utils/telemetry/utils/context.js +3 -2
- package/build/src/utils/telemetry/utils/context.js.map +1 -1
- package/build/src/utils/url.js +5 -17
- package/build/src/utils/url.js.map +1 -1
- package/build/src/utils/validateApplicationId.js +12 -12
- package/build/src/utils/validateApplicationId.js.map +1 -1
- package/build/src/utils/variadic.js +4 -4
- package/build/src/utils/variadic.js.map +1 -1
- package/build/src/whoami/index.js.map +1 -1
- package/changes.json +18 -26
- package/main.js +3 -0
- package/package.json +88 -80
- package/static/loading-page/index.html +45 -3
- package/static/template/+html.tsx +14 -5
- package/add-module.js +0 -8
- package/build/src/start/server/middleware/inspector/CdpClient.js +0 -81
- package/build/src/start/server/middleware/inspector/CdpClient.js.map +0 -1
- package/build/src/utils/resolveWatchFolders.js +0 -67
- package/build/src/utils/resolveWatchFolders.js.map +0 -1
- package/build/src/utils/tsconfig/evaluateTsConfig.js +0 -87
- package/build/src/utils/tsconfig/evaluateTsConfig.js.map +0 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js +0 -84
- package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +0 -1
- package/build/src/utils/tsconfig/matchTsConfigPathAlias.js +0 -94
- package/build/src/utils/tsconfig/matchTsConfigPathAlias.js.map +0 -1
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +0 -62
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +0 -1
|
@@ -10,23 +10,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10
10
|
function _export(target, all) {
|
|
11
11
|
for(var name in all)Object.defineProperty(target, name, {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: all
|
|
13
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
_export(exports, {
|
|
17
|
-
createMetroServerAndBundleRequestAsync
|
|
17
|
+
get createMetroServerAndBundleRequestAsync () {
|
|
18
18
|
return createMetroServerAndBundleRequestAsync;
|
|
19
19
|
},
|
|
20
|
-
exportEmbedAssetsAsync
|
|
20
|
+
get exportEmbedAssetsAsync () {
|
|
21
21
|
return exportEmbedAssetsAsync;
|
|
22
22
|
},
|
|
23
|
-
exportEmbedAsync
|
|
23
|
+
get exportEmbedAsync () {
|
|
24
24
|
return exportEmbedAsync;
|
|
25
25
|
},
|
|
26
|
-
exportEmbedBundleAndAssetsAsync
|
|
26
|
+
get exportEmbedBundleAndAssetsAsync () {
|
|
27
27
|
return exportEmbedBundleAndAssetsAsync;
|
|
28
28
|
},
|
|
29
|
-
exportEmbedInternalAsync
|
|
29
|
+
get exportEmbedInternalAsync () {
|
|
30
30
|
return exportEmbedInternalAsync;
|
|
31
31
|
}
|
|
32
32
|
});
|
|
@@ -65,6 +65,20 @@ function _bundle() {
|
|
|
65
65
|
};
|
|
66
66
|
return data;
|
|
67
67
|
}
|
|
68
|
+
function _packedMap() {
|
|
69
|
+
const data = require("@expo/metro-config/build/serializer/packedMap");
|
|
70
|
+
_packedMap = function() {
|
|
71
|
+
return data;
|
|
72
|
+
};
|
|
73
|
+
return data;
|
|
74
|
+
}
|
|
75
|
+
function _sourceMap() {
|
|
76
|
+
const data = require("@expo/metro-config/build/serializer/sourceMap");
|
|
77
|
+
_sourceMap = function() {
|
|
78
|
+
return data;
|
|
79
|
+
};
|
|
80
|
+
return data;
|
|
81
|
+
}
|
|
68
82
|
function _getAssets() {
|
|
69
83
|
const data = /*#__PURE__*/ _interop_require_default(require("@expo/metro-config/build/transform-worker/getAssets"));
|
|
70
84
|
_getAssets = function() {
|
|
@@ -105,6 +119,7 @@ const _xcodeCompilerLogger = require("./xcodeCompilerLogger");
|
|
|
105
119
|
const _log = require("../../log");
|
|
106
120
|
const _DevServerManager = require("../../start/server/DevServerManager");
|
|
107
121
|
const _MetroBundlerDevServer = require("../../start/server/metro/MetroBundlerDevServer");
|
|
122
|
+
const _createFileMapfork = require("../../start/server/metro/createFileMap-fork");
|
|
108
123
|
const _instantiateMetro = require("../../start/server/metro/instantiateMetro");
|
|
109
124
|
const _DomComponentsMiddleware = require("../../start/server/middleware/DomComponentsMiddleware");
|
|
110
125
|
const _metroOptions = require("../../start/server/middleware/metroOptions");
|
|
@@ -204,9 +219,9 @@ async function exportEmbedAsync(projectRoot, options) {
|
|
|
204
219
|
if (eagerBundleOptions.key === inputKey) {
|
|
205
220
|
// Copy the eager bundleOutput and assets to the new locations.
|
|
206
221
|
await (0, _dir.removeAsync)(options.bundleOutput);
|
|
207
|
-
(0, _dir.copyAsync)(eagerBundleOptions.options.bundleOutput, options.bundleOutput);
|
|
222
|
+
await (0, _dir.copyAsync)(eagerBundleOptions.options.bundleOutput, options.bundleOutput);
|
|
208
223
|
if (eagerBundleOptions.options.assetsDest && options.assetsDest) {
|
|
209
|
-
(0, _dir.copyAsync)(eagerBundleOptions.options.assetsDest, options.assetsDest);
|
|
224
|
+
await (0, _dir.copyAsync)(eagerBundleOptions.options.assetsDest, options.assetsDest);
|
|
210
225
|
}
|
|
211
226
|
console.log('info: Copied output to binary:', options.bundleOutput);
|
|
212
227
|
return;
|
|
@@ -221,12 +236,15 @@ async function exportEmbedAsync(projectRoot, options) {
|
|
|
221
236
|
// Ensure the process closes after bundling
|
|
222
237
|
(0, _exit.ensureProcessExitsAfterDelay)();
|
|
223
238
|
}
|
|
239
|
+
// Apple platforms (ios/tvos/macos) all build via Xcode and share the same bundle output and
|
|
240
|
+
// error-reporting handling.
|
|
241
|
+
const isApplePlatform = (platform)=>platform === 'ios' || platform === 'tvos' || platform === 'macos';
|
|
224
242
|
async function exportEmbedInternalAsync(projectRoot, options) {
|
|
225
243
|
// Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.
|
|
226
244
|
await (0, _dir.removeAsync)(options.bundleOutput);
|
|
227
245
|
// The iOS bundle is copied in to the Xcode project, so we need to remove the old one
|
|
228
246
|
// to prevent Xcode from loading the old one after a build failure.
|
|
229
|
-
if (options.platform
|
|
247
|
+
if (isApplePlatform(options.platform)) {
|
|
230
248
|
const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);
|
|
231
249
|
if (previousPath && _fs().default.existsSync(previousPath)) {
|
|
232
250
|
debug('Removing previous iOS bundle:', previousPath);
|
|
@@ -248,7 +266,7 @@ async function exportEmbedInternalAsync(projectRoot, options) {
|
|
|
248
266
|
// Write dom components proxy files.
|
|
249
267
|
hasDomComponents ? (0, _saveAssets.persistMetroFilesAsync)(files, domComponentProxyOutputDir) : null,
|
|
250
268
|
// Copy public folder for dom components only if
|
|
251
|
-
hasDomComponents ? (0, _publicFolder.copyPublicFolderAsync)(
|
|
269
|
+
hasDomComponents ? (0, _publicFolder.copyPublicFolderAsync)((0, _publicFolder.getPublicFolderPath)(projectRoot), _path().default.join(domComponentProxyOutputDir, _DomComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR)) : null,
|
|
252
270
|
// NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native
|
|
253
271
|
// platforms when doing production embeds (unlikely).
|
|
254
272
|
options.assetsDest ? (0, _persistMetroAssets.persistMetroAssetsAsync)(projectRoot, assets, {
|
|
@@ -280,7 +298,7 @@ async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
|
|
|
280
298
|
}
|
|
281
299
|
const files = new Map();
|
|
282
300
|
try {
|
|
283
|
-
var _exp_experiments, _exp_web, _bundles_artifacts_filter_;
|
|
301
|
+
var _exp_experiments, _exp_web, _bundles_artifacts_filter_, _bundles_artifacts_filter_1;
|
|
284
302
|
const bundles = await devServer.nativeExportBundleAsync(exp, {
|
|
285
303
|
// TODO: Re-enable when we get bytecode chunk splitting working again.
|
|
286
304
|
splitChunks: false,
|
|
@@ -342,9 +360,9 @@ async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
|
|
|
342
360
|
return {
|
|
343
361
|
files,
|
|
344
362
|
bundle: {
|
|
345
|
-
code: bundles.artifacts.filter((a)=>a.type === 'js')[0].source,
|
|
363
|
+
code: (_bundles_artifacts_filter_ = bundles.artifacts.filter((a)=>a.type === 'js')[0]) == null ? void 0 : _bundles_artifacts_filter_.source,
|
|
346
364
|
// Can be optional when source maps aren't enabled.
|
|
347
|
-
map: (
|
|
365
|
+
map: (_bundles_artifacts_filter_1 = bundles.artifacts.filter((a)=>a.type === 'map')[0]) == null ? void 0 : _bundles_artifacts_filter_1.source.toString()
|
|
348
366
|
},
|
|
349
367
|
assets: bundles.assets
|
|
350
368
|
};
|
|
@@ -352,7 +370,7 @@ async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
|
|
|
352
370
|
if (isError(error)) {
|
|
353
371
|
// Log using Xcode error format so the errors are picked up by xcodebuild.
|
|
354
372
|
// https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script
|
|
355
|
-
if (options.platform
|
|
373
|
+
if (isApplePlatform(options.platform)) {
|
|
356
374
|
// If the error is about to be presented in Xcode, strip the ansi characters from the message.
|
|
357
375
|
if ('message' in error && (0, _xcodeCompilerLogger.isExecutingFromXcodebuild)()) {
|
|
358
376
|
error.message = (0, _ansi.stripAnsi)(error.message);
|
|
@@ -378,7 +396,7 @@ async function createMetroServerAndBundleRequestAsync(projectRoot, options) {
|
|
|
378
396
|
exp,
|
|
379
397
|
isExporting: true,
|
|
380
398
|
getMetroBundler () {
|
|
381
|
-
return
|
|
399
|
+
return metro.getBundler().getBundler();
|
|
382
400
|
}
|
|
383
401
|
});
|
|
384
402
|
const isHermes = (0, _exportHermes.isEnableHermesManaged)(exp, options.platform);
|
|
@@ -410,11 +428,18 @@ async function createMetroServerAndBundleRequestAsync(projectRoot, options) {
|
|
|
410
428
|
sourceMapUrl,
|
|
411
429
|
unstable_transformProfile: options.unstableTransformProfile || (isHermes ? 'hermes-stable' : 'default')
|
|
412
430
|
};
|
|
413
|
-
const
|
|
414
|
-
|
|
415
|
-
|
|
431
|
+
const { metro } = await (0, _createFileMapfork.replaceMetroFileMap)(()=>({
|
|
432
|
+
metro: new (_Server()).default(config, {
|
|
433
|
+
watch: false
|
|
434
|
+
})
|
|
435
|
+
}));
|
|
436
|
+
// The dev server applies the same patch from `instantiateMetro.ts`;
|
|
437
|
+
// this is the export-embed / `expo-updates` path, where `data.map`
|
|
438
|
+
// would otherwise reach Metro's readers in the unwrapped wire shape.
|
|
439
|
+
(0, _packedMap().patchTransformFileForPackedMaps)(metro.getBundler().getBundler());
|
|
440
|
+
(0, _sourceMap().patchMetroSourceMapStringForPackedMaps)();
|
|
416
441
|
return {
|
|
417
|
-
server,
|
|
442
|
+
server: metro,
|
|
418
443
|
bundleRequest
|
|
419
444
|
};
|
|
420
445
|
}
|
|
@@ -449,7 +474,7 @@ async function exportEmbedAssetsAsync(server, bundleRequest, projectRoot, option
|
|
|
449
474
|
if (isError(error)) {
|
|
450
475
|
// Log using Xcode error format so the errors are picked up by xcodebuild.
|
|
451
476
|
// https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script
|
|
452
|
-
if (options.platform
|
|
477
|
+
if (isApplePlatform(options.platform)) {
|
|
453
478
|
// If the error is about to be presented in Xcode, strip the ansi characters from the message.
|
|
454
479
|
if ('message' in error && (0, _xcodeCompilerLogger.isExecutingFromXcodebuild)()) {
|
|
455
480
|
error.message = (0, _ansi.stripAnsi)(error.message);
|
|
@@ -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 getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\n\nimport { deserializeEagerKey, getExportEmbedOptionsKey, Options } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { DOM_COMPONENTS_BUNDLE_DIR } from '../../start/server/middleware/DomComponentsMiddleware';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { copyAsync, removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { setNodeEnv, loadEnvFiles } from '../../utils/nodeEnv';\nimport { exportDomComponentAsync } from '../exportDomComponents';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\nimport { copyPublicFolderAsync } from '../publicFolder';\nimport { BundleAssetWithFileHashes, ExportAssetMap, persistMetroFilesAsync } from '../saveAssets';\nimport { exportStandaloneServerAsync } from './exportServer';\nimport { ensureProcessExitsAfterDelay } from '../../utils/exit';\n\nconst debug = require('debug')('expo:export:embed');\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (\n !bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//) &&\n !bundleOutput.match(/\\/CoreSimulator\\/Devices\\/.*\\/data\\/Containers\\/Bundle\\/Application\\//)\n ) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(`*.app/${bundleName}`, {\n cwd: bundleParent,\n absolute: true,\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n // The React Native build scripts always enable the cache reset but we shouldn't need this in CI environments.\n // By disabling it, we can eagerly bundle code before the build and reuse the cached artifacts in subsequent builds.\n if (env.CI && options.resetCache) {\n debug('CI environment detected, disabling automatic cache reset');\n options.resetCache = false;\n }\n\n setNodeEnv(options.dev ? 'development' : 'production');\n loadEnvFiles(projectRoot);\n\n // This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.\n // Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.\n // This path is also used for automatically deploying server bundles to a remote host.\n const eagerBundleOptions = env.__EXPO_EAGER_BUNDLE_OPTIONS\n ? deserializeEagerKey(env.__EXPO_EAGER_BUNDLE_OPTIONS)\n : null;\n if (eagerBundleOptions) {\n // Get the cache key for the current process to compare against the eager key.\n const inputKey = getExportEmbedOptionsKey(options);\n\n // If the app was bundled previously in the same process, then we should reuse the Metro cache.\n options.resetCache = false;\n\n if (eagerBundleOptions.key === inputKey) {\n // Copy the eager bundleOutput and assets to the new locations.\n await removeAsync(options.bundleOutput);\n\n copyAsync(eagerBundleOptions.options.bundleOutput, options.bundleOutput);\n\n if (eagerBundleOptions.options.assetsDest && options.assetsDest) {\n copyAsync(eagerBundleOptions.options.assetsDest, options.assetsDest);\n }\n\n console.log('info: Copied output to binary:', options.bundleOutput);\n return;\n }\n // TODO: sourcemapOutput is set on Android but not during eager. This is tolerable since it doesn't invalidate the Metro cache.\n console.log(' Eager key:', eagerBundleOptions.key);\n console.log('Request key:', inputKey);\n\n // TODO: We may want an analytic event here in the future to understand when this happens.\n console.warn('warning: Eager bundle does not match new options, bundling again.');\n }\n\n await exportEmbedInternalAsync(projectRoot, options);\n\n // Ensure the process closes after bundling\n ensureProcessExitsAfterDelay();\n}\n\nexport async function exportEmbedInternalAsync(projectRoot: string, options: Options) {\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (options.platform === 'ios') {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets, files } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // On Android, dom components proxy files should write to the assets directory instead of the res directory.\n // We use the bundleOutput directory to get the assets directory.\n const domComponentProxyOutputDir =\n options.platform === 'android' ? path.dirname(options.bundleOutput) : options.assetsDest;\n const hasDomComponents = domComponentProxyOutputDir && files.size > 0;\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\n\n // Write dom components proxy files.\n hasDomComponents ? persistMetroFilesAsync(files, domComponentProxyOutputDir) : null,\n // Copy public folder for dom components only if\n hasDomComponents\n ? copyPublicFolderAsync(\n path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER),\n path.join(domComponentProxyOutputDir, DOM_COMPONENTS_BUNDLE_DIR)\n )\n : null,\n\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(projectRoot, assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: Awaited<ReturnType<Server['build']>>;\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n}> {\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: options.resetCache,\n maxWorkers: options.maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const { exp, pkg } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const files: ExportAssetMap = new Map();\n\n try {\n const bundles = await devServer.nativeExportBundleAsync(\n exp,\n {\n // TODO: Re-enable when we get bytecode chunk splitting working again.\n splitChunks: false, //devServer.isReactServerComponentsEnabled,\n mainModuleName: 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 includeSourceMaps: !!sourceMapUrl,\n exp,\n files,\n });\n\n if (options.assetsDest) {\n // Save assets like a typical bundler, preserving the file paths on web.\n // This is saving web-style inside of a native app's binary.\n await persistMetroAssetsAsync(\n projectRoot,\n bundle.assets.map((asset) => ({\n ...asset,\n httpServerLocation: path.join(DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation),\n })),\n {\n files,\n platform: 'web',\n outputDirectory: options.assetsDest,\n }\n );\n }\n })\n );\n }\n\n return {\n files,\n bundle: {\n code: bundles.artifacts.filter((a: any) => a.type === 'js')[0].source,\n // Can be optional when source maps aren't enabled.\n map: bundles.artifacts.filter((a: any) => a.type === 'map')[0]?.source.toString(),\n },\n assets: bundles.assets,\n };\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n } finally {\n devServerManager.stopAsync();\n }\n}\n\n// Exports for expo-updates\nexport async function createMetroServerAndBundleRequestAsync(\n projectRoot: string,\n options: Pick<\n Options,\n | 'maxWorkers'\n | 'config'\n | 'platform'\n | 'sourcemapOutput'\n | 'sourcemapUseAbsolutePath'\n | 'entryFile'\n | 'minify'\n | 'dev'\n | 'resetCache'\n | 'unstableTransformProfile'\n >\n): Promise<{ server: Server; bundleRequest: BundleOptions }> {\n const exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // TODO: This is slow ~40ms\n const { config } = await loadMetroConfigAsync(\n projectRoot,\n {\n // TODO: This is always enabled in the native script and there's no way to disable it.\n resetCache: options.resetCache,\n maxWorkers: options.maxWorkers,\n },\n {\n exp,\n isExporting: true,\n getMetroBundler() {\n return server.getBundler().getBundler();\n },\n }\n );\n\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const directBundleOptions = getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n splitChunks: false,\n // 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 server = new Server(config, {\n watch: false,\n });\n\n return { server, bundleRequest };\n}\n\nexport async function exportEmbedAssetsAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions({\n ...bundleRequest,\n // @ts-ignore-error TODO(@kitten): Very unclear why this is here. Remove?\n bundleType: 'todo',\n });\n\n const dependencies = await server._bundler.getDependencies(\n // 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 (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n }\n}\n\nfunction isError(error: any): error is Error {\n return error instanceof Error;\n}\n"],"names":["createMetroServerAndBundleRequestAsync","exportEmbedAssetsAsync","exportEmbedAsync","exportEmbedBundleAndAssetsAsync","exportEmbedInternalAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","cwd","absolute","dot","projectRoot","options","env","CI","resetCache","setNodeEnv","dev","loadEnvFiles","eagerBundleOptions","__EXPO_EAGER_BUNDLE_OPTIONS","deserializeEagerKey","inputKey","getExportEmbedOptionsKey","key","removeAsync","copyAsync","assetsDest","console","log","warn","ensureProcessExitsAfterDelay","platform","previousPath","fs","existsSync","bundle","assets","files","mkdirSync","recursive","mode","domComponentProxyOutputDir","hasDomComponents","size","Promise","all","output","save","Log","persistMetroFilesAsync","copyPublicFolderAsync","resolve","EXPO_PUBLIC_FOLDER","join","DOM_COMPONENTS_BUNDLE_DIR","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","devServerManager","DevServerManager","startMetroAsync","minify","port","isExporting","location","resetDevServer","maxWorkers","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","exp","pkg","getConfig","skipSDKVersionRequirement","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","Map","bundles","nativeExportBundleAsync","splitChunks","mainModuleName","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","server","getBundler","directBundleOptions","getMetroDirectBundleOptionsForExpoConfig","hosted","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","lazy","modulesOnly","runModule","watch","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","dependencies","_bundler","getDependencies","shallow","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","isHosted","Error"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;IA4SqBA,sCAAsC;eAAtCA;;IA8EAC,sBAAsB;eAAtBA;;IAlUAC,gBAAgB;eAAhBA;;IAqGAC,+BAA+B;eAA/BA;;IAlDAC,wBAAwB;eAAxBA;;;;yBA1GI;;;;;;;yBACkB;;;;;;;gEACzB;;;;;;;gEACY;;;;;;;iEACP;;;;;;;gEAEG;;;;;;;gEACR;;;;;;;gEACJ;;;;;;;yBACkB;;;;;;;gEAChB;;;;;;gCAEsD;qCACP;qBAC5C;kCACa;uCACK;kCACD;yCACK;8BACe;sBAC/B;qBACa;qBACnB;yBACqB;qCACD;8BACF;oCACE;8BACF;4BAC4C;8BACtC;sBACC;;;;;;;;;;;;;;;;;;;;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AGC,IAAAA,eAAS,EAACJ,MAAMG,OAAO;gBACzC;gBACAE,IAAAA,yCAAoB,EAACrH,aAAagH;YACpC;QACF;QACA,MAAMA;IACR;AACF;AAEA,SAASC,QAAQD,KAAU;IACzB,OAAOA,iBAAiBuC;AAC1B"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/embed/exportEmbedAsync.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getConfig } from '@expo/config';\nimport { 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 includeSourceMaps: !!sourceMapUrl,\n exp,\n files,\n });\n\n if (options.assetsDest) {\n // Save assets like a typical bundler, preserving the file paths on web.\n // This is saving web-style inside of a native app's binary.\n await persistMetroAssetsAsync(\n projectRoot,\n bundle.assets.map((asset) => ({\n ...asset,\n httpServerLocation: path.join(DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation),\n })),\n {\n files,\n platform: 'web',\n outputDirectory: options.assetsDest,\n }\n );\n }\n })\n );\n }\n\n return {\n files,\n bundle: {\n code: bundles.artifacts.filter((a: any) => a.type === 'js')[0]?.source!,\n // Can be optional when source maps aren't enabled.\n map: bundles.artifacts.filter((a: any) => a.type === 'map')[0]?.source.toString()!,\n },\n assets: bundles.assets,\n };\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (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;;;;;;;;;;;QAsTqBA;eAAAA;;QAsFAC;eAAAA;;QA/UAC;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,OAAOvH,WAAW;YAC/ByJ,YAAYlC,OAAOiC,WAAW,CAACC,UAAU;YACzCC,UAAU;QACZ;IACF,EAAE,OAAO1C,OAAY;QACnB,IAAIC,QAAQD,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"}
|
|
@@ -87,7 +87,7 @@ async function exportStandaloneServerAsync(projectRoot, devServer, { exp, pkg, f
|
|
|
87
87
|
platform: 'web',
|
|
88
88
|
apiRoutesOnly: true
|
|
89
89
|
});
|
|
90
|
-
const publicPath =
|
|
90
|
+
const publicPath = (0, _publicFolder.getPublicFolderPath)(projectRoot);
|
|
91
91
|
// Copy over public folder items
|
|
92
92
|
await (0, _publicFolder.copyPublicFolderAsync)(publicPath, serverOutput);
|
|
93
93
|
// Copy over the server output on top of the public folder.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/export/embed/exportServer.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 { ExpoConfig, modifyConfigAsync, PackageJSONConfig } from '@expo/config';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport { execSync } from 'node:child_process';\nimport path from 'path';\n\nimport { disableNetwork } from '../../api/settings';\nimport { Log } from '../../log';\nimport { isSpawnResultError } from '../../start/platforms/ios/xcrun';\nimport { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { exportApiRoutesStandaloneAsync } from '../exportStaticAsync';\nimport { copyPublicFolderAsync } from '../publicFolder';\nimport { ExportAssetMap, persistMetroFilesAsync } from '../saveAssets';\nimport { Options } from './resolveOptions';\nimport {\n isExecutingFromXcodebuild,\n logInXcode,\n logMetroErrorInXcode,\n warnInXcode,\n} from './xcodeCompilerLogger';\n\nconst debug = require('debug')('expo:export:server');\n\ntype ServerDeploymentResults = {\n url: string;\n dashboardUrl?: string;\n};\n\nexport async function exportStandaloneServerAsync(\n projectRoot: string,\n devServer: MetroBundlerDevServer,\n {\n exp,\n pkg,\n files,\n options,\n }: { exp: ExpoConfig; pkg: PackageJSONConfig; files: ExportAssetMap; options: Options }\n) {\n if (!options.eager) {\n await tryRemovingGeneratedOriginAsync(projectRoot, exp);\n }\n\n logInXcode('Exporting server');\n\n // Store the server output in the project's .expo directory.\n const serverOutput = path.join(projectRoot, '.expo/server', options.platform);\n\n // Remove the previous server output to prevent stale files.\n await removeAsync(serverOutput);\n\n // Export the API routes for server rendering the React Server Components.\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: true,\n });\n\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n\n // Copy over public folder items\n await copyPublicFolderAsync(publicPath, serverOutput);\n\n // Copy over the server output on top of the public folder.\n await persistMetroFilesAsync(files, serverOutput);\n\n [...files.entries()].forEach(([key, value]) => {\n if (value.targetDomain === 'server') {\n // Delete server resources to prevent them from being exposed in the binary.\n files.delete(key);\n }\n });\n\n // TODO: Deprecate this in favor of a built-in prop that users should avoid setting.\n const userDefinedServerUrl = exp.extra?.router?.origin;\n let serverUrl = userDefinedServerUrl;\n\n const shouldSkipServerDeployment = (() => {\n if (!options.eager) {\n logInXcode('Skipping server deployment because the script is not running in eager mode.');\n return true;\n }\n\n // Add an opaque flag to disable server deployment.\n if (env.EXPO_NO_DEPLOY) {\n warnInXcode('Skipping server deployment because environment variable EXPO_NO_DEPLOY is set.');\n return true;\n }\n\n // Can't safely deploy from Xcode since the PATH isn't set up correctly. We could amend this in the future and allow users who customize the PATH to deploy from Xcode.\n if (isExecutingFromXcodebuild()) {\n // TODO: Don't warn when the eager bundle has been run.\n warnInXcode(\n 'Skipping server deployment because the build is running from an Xcode run script. Build with Expo CLI or EAS Build to deploy the server automatically.'\n );\n return true;\n }\n\n return false;\n })();\n\n // Deploy the server output to a hosting provider.\n const deployedServerUrl = shouldSkipServerDeployment\n ? false\n : await runServerDeployCommandAsync(projectRoot, {\n distDirectory: serverOutput,\n deployScript: getServerDeploymentScript(pkg.scripts, options.platform),\n });\n\n if (!deployedServerUrl) {\n return;\n }\n\n if (serverUrl) {\n logInXcode(\n `Using custom server URL: ${serverUrl} (ignoring deployment URL: ${deployedServerUrl})`\n );\n }\n\n // If the user-defined server URL is not defined, use the deployed server URL.\n // This allows for overwriting the server URL in the project's native files.\n serverUrl ||= deployedServerUrl;\n\n // If the user hasn't manually defined the server URL, write the deployed server URL to the app.json.\n if (userDefinedServerUrl) {\n Log.log('Skip automatically linking server origin to native container');\n return;\n }\n Log.log('Writing generated server URL to app.json');\n\n // NOTE: Is is it possible to assert that the config needs to be modifiable before building the app?\n const modification = await modifyConfigAsync(\n projectRoot,\n {\n extra: {\n ...(exp.extra ?? {}),\n router: {\n ...(exp.extra?.router ?? {}),\n generatedOrigin: serverUrl,\n },\n },\n },\n {\n skipSDKVersionRequirement: true,\n }\n );\n\n if (modification.type !== 'success') {\n throw new CommandError(\n `Failed to write generated server origin to app.json because the file is dynamic and does not extend the static config. The client will not be able to make server requests to API routes or static files. You can disable server linking with EXPO_NO_DEPLOY=1 or by disabling server output in the app.json.`\n );\n }\n}\n\nasync function dumpDeploymentLogs(projectRoot: string, logs: string, name = 'deploy') {\n const outputPath = path.join(projectRoot, `.expo/logs/${name}.log`);\n await fs.promises.mkdir(path.dirname(outputPath), { recursive: true });\n debug('Dumping server deployment logs to: ' + outputPath);\n await fs.promises.writeFile(outputPath, logs);\n return outputPath;\n}\n\nfunction getCommandBin(command: string) {\n try {\n return execSync(`command -v ${command}`, { stdio: 'pipe' }).toString().trim();\n } catch {\n return null;\n }\n}\n\nasync function runServerDeployCommandAsync(\n projectRoot: string,\n {\n distDirectory,\n deployScript,\n }: { distDirectory: string; deployScript: { scriptName: string; script: string } | null }\n): Promise<string | false> {\n const logOfflineError = () => {\n const manualScript = deployScript\n ? `npm run ${deployScript.scriptName}`\n : `npx eas deploy --export-dir ${distDirectory}`;\n\n logMetroErrorInXcode(\n projectRoot,\n chalk.red`Running CLI in offline mode, skipping server deployment. Deploy manually with: ${manualScript}`\n );\n };\n if (env.EXPO_OFFLINE) {\n logOfflineError();\n return false;\n }\n\n // TODO: Only allow EAS deployments when staging is enabled, this is because the feature is still staging-only.\n if (!env.EXPO_UNSTABLE_DEPLOY_SERVER) {\n return false;\n }\n\n if (!env.EAS_BUILD) {\n // This check helps avoid running EAS if the user isn't a user of EAS.\n // We only need to run it when building outside of EAS.\n const globalBin = getCommandBin('eas');\n if (!globalBin) {\n // This should never happen from EAS Builds.\n // Possible to happen when building locally with `npx expo run`\n logMetroErrorInXcode(\n projectRoot,\n `eas-cli is not installed globally, skipping server deployment. Install EAS CLI with 'npm install -g eas-cli'.`\n );\n return false;\n }\n debug('Found eas-cli:', globalBin);\n }\n\n let json: any;\n try {\n let results: spawnAsync.SpawnResult;\n\n const spawnOptions: spawnAsync.SpawnOptions = {\n cwd: projectRoot,\n // Ensures that errors can be caught.\n stdio: 'pipe',\n };\n // TODO: Support absolute paths in EAS CLI\n const exportDir = path.relative(projectRoot, distDirectory);\n if (deployScript) {\n logInXcode(`Using custom server deploy script: ${deployScript.scriptName}`);\n // Amend the path to try and make the custom scripts work.\n\n results = await spawnAsync(\n 'npm',\n ['run', deployScript.scriptName, `--export-dir=${exportDir}`],\n spawnOptions\n );\n } else {\n logInXcode('Deploying server to link with client');\n\n // results = DEPLOYMENT_SUCCESS_FIXTURE;\n results = await spawnAsync(\n 'npx',\n ['eas-cli', 'deploy', '--non-interactive', '--json', `--export-dir=${exportDir}`],\n spawnOptions\n );\n\n debug('Server deployment stdout:', results.stdout);\n\n // Send stderr to stderr. stdout is parsed as JSON.\n if (results.stderr) {\n process.stderr.write(results.stderr);\n }\n }\n\n const logPath = await dumpDeploymentLogs(projectRoot, results.output.join('\\n'));\n\n try {\n // {\n // \"dashboardUrl\": \"https://staging.expo.dev/projects/6460c11c-e1bc-4084-882a-fd9f57b825b1/hosting/deployments\",\n // \"identifier\": \"8a1pwbv6c5\",\n // \"url\": \"https://sep30--8a1pwbv6c5.staging.expo.app\"\n // }\n json = JSON.parse(results.stdout.trim());\n } catch {\n logMetroErrorInXcode(\n projectRoot,\n `Failed to parse server deployment JSON output. Check the logs for more information: ${logPath}`\n );\n return false;\n }\n } catch (error) {\n if (isSpawnResultError(error)) {\n const output = error.output.join('\\n').trim() || error.toString();\n Log.log(\n chalk.dim(\n 'An error occurred while deploying server. Logs stored at: ' +\n (await dumpDeploymentLogs(projectRoot, output, 'deploy-error'))\n )\n );\n\n // Likely a server offline or network error.\n if (output.match(/ENOTFOUND/)) {\n logOfflineError();\n // Print the raw error message to help provide more context.\n Log.log(chalk.dim(output));\n // Prevent any other network requests (unlikely for this command).\n disableNetwork();\n return false;\n }\n\n logInXcode(output);\n if (output.match(/spawn eas ENOENT/)) {\n // EAS not installed.\n logMetroErrorInXcode(\n projectRoot,\n `Server deployment failed because eas-cli cannot be accessed from the build script's environment (ENOENT). Install EAS CLI with 'npm install -g eas-cli'.`\n );\n return false;\n }\n\n if (error.stderr.match(/Must configure EAS project by running/)) {\n // EAS not configured, this can happen when building a project locally before building in EAS.\n // User must run `eas init`, `eas deploy`, or `eas build` first.\n\n // TODO: Should we fail the build here or just warn users?\n logMetroErrorInXcode(\n projectRoot,\n `Skipping server deployment because EAS is not configured. Run 'eas init' before trying again, or disable server output in the project.`\n );\n return false;\n }\n }\n\n // Throw unhandled server deployment errors.\n throw error;\n }\n\n // Assert json format\n assertDeploymentJsonOutput(json);\n\n // Warn about the URL not being valid. This should never happen, but might be possible with third-parties.\n if (!canParseURL(json.url)) {\n warnInXcode(`The server deployment URL is not a valid URL: ${json.url}`);\n }\n\n if (json.dashboardUrl) {\n logInXcode(`Server dashboard: ${json.dashboardUrl}`);\n }\n\n logInXcode(`Server deployed to: ${json.url}`);\n\n return json.url;\n}\n\nfunction canParseURL(url: string): boolean {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction assertDeploymentJsonOutput(json: any): asserts json is ServerDeploymentResults {\n if (!json || typeof json !== 'object' || typeof json.url !== 'string') {\n throw new Error(\n 'JSON output of server deployment command are not in the expected format: { url: \"https://...\" }'\n );\n }\n}\n\nfunction getServerDeploymentScript(\n scripts: Record<string, string> | undefined,\n platform: string\n): { scriptName: string; script: string } | null {\n // Users can overwrite the default deployment script with:\n // { scripts: { \"native:deploy\": \"eas deploy --json --non-interactive\" } }\n // A quick search on GitHub showed that `native:deploy` is not used in any public repos yet.\n // https://github.com/search?q=%22native%3Adeploy%22+path%3Apackage.json&type=code\n const DEFAULT_SCRIPT_NAME = 'native:deploy';\n\n const scriptNames = [\n // DEFAULT_SCRIPT_NAME + ':' + platform,\n DEFAULT_SCRIPT_NAME,\n ];\n\n for (const scriptName of scriptNames) {\n if (scripts?.[scriptName]) {\n return { scriptName, script: scripts[scriptName] };\n }\n }\n\n return null;\n}\n\n/** We can try to remove the generated origin from the manifest when running outside of eager mode. Bundling is the last operation to run so the config will already be embedded with the origin. */\nasync function tryRemovingGeneratedOriginAsync(projectRoot: string, exp: ExpoConfig) {\n if (env.CI) {\n // Skip in CI since nothing is committed.\n return;\n }\n if (exp.extra?.router?.generatedOrigin == null) {\n debug('No generated origin needs removing');\n return;\n }\n\n const modification = await modifyConfigAsync(\n projectRoot,\n {\n extra: {\n ...(exp.extra ?? {}),\n router: {\n ...(exp.extra?.router ?? {}),\n generatedOrigin: undefined,\n },\n },\n },\n {\n skipSDKVersionRequirement: true,\n }\n );\n\n if (modification.type !== 'success') {\n debug('Could not remove generated origin from manifest');\n } else {\n debug('Generated origin has been removed from manifest');\n }\n}\n"],"names":["exportStandaloneServerAsync","debug","require","projectRoot","devServer","exp","pkg","files","options","eager","tryRemovingGeneratedOriginAsync","logInXcode","serverOutput","path","join","platform","removeAsync","exportApiRoutesStandaloneAsync","apiRoutesOnly","publicPath","resolve","env","EXPO_PUBLIC_FOLDER","copyPublicFolderAsync","persistMetroFilesAsync","entries","forEach","key","value","targetDomain","delete","userDefinedServerUrl","extra","router","origin","serverUrl","shouldSkipServerDeployment","EXPO_NO_DEPLOY","warnInXcode","isExecutingFromXcodebuild","deployedServerUrl","runServerDeployCommandAsync","distDirectory","deployScript","getServerDeploymentScript","scripts","Log","log","modification","modifyConfigAsync","generatedOrigin","skipSDKVersionRequirement","type","CommandError","dumpDeploymentLogs","logs","name","outputPath","fs","promises","mkdir","dirname","recursive","writeFile","getCommandBin","command","execSync","stdio","toString","trim","logOfflineError","manualScript","scriptName","logMetroErrorInXcode","chalk","red","EXPO_OFFLINE","EXPO_UNSTABLE_DEPLOY_SERVER","EAS_BUILD","globalBin","json","results","spawnOptions","cwd","exportDir","relative","spawnAsync","stdout","stderr","process","write","logPath","output","JSON","parse","error","isSpawnResultError","dim","match","disableNetwork","assertDeploymentJsonOutput","canParseURL","url","dashboardUrl","URL","Error","DEFAULT_SCRIPT_NAME","scriptNames","script","CI","undefined"],"mappings":"AAAA;;;;;CAKC;;;;+BAiCqBA;;;eAAAA;;;;yBAhC2C;;;;;;;gEAC1C;;;;;;;gEACL;;;;;;;gEACH;;;;;;;yBACU;;;;;;;gEACR;;;;;;0BAEc;qBACX;uBACe;qBAEP;qBACR;wBACS;mCACkB;8BACT;4BACiB;qCAOhD;;;;;;AAEP,MAAMC,QAAQC,QAAQ,SAAS;AAOxB,eAAeF,4BACpBG,WAAmB,EACnB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MAAMlC,cAAcmC,YAAa;QACpC,IAAI9D,2BAAAA,OAAS,CAAC2B,WAAW,EAAE;YACzB,OAAO;gBAAEA;gBAAYoC,QAAQ/D,OAAO,CAAC2B,WAAW;YAAC;QACnD;IACF;IAEA,OAAO;AACT;AAEA,kMAAkM,GAClM,eAAe9D,gCAAgCP,WAAmB,EAAEE,GAAe;QAK7EA,mBAAAA,YAWQA;IAfZ,IAAIgB,QAAG,CAACwF,EAAE,EAAE;QACV,yCAAyC;QACzC;IACF;IACA,IAAIxG,EAAAA,aAAAA,IAAI2B,KAAK,sBAAT3B,oBAAAA,WAAW4B,MAAM,qBAAjB5B,kBAAmB6C,eAAe,KAAI,MAAM;QAC9CjD,MAAM;QACN;IACF;IAEA,MAAM+C,eAAe,MAAMC,IAAAA,2BAAiB,EAC1C9C,aACA;QACE6B,OAAO;YACL,GAAI3B,IAAI2B,KAAK,IAAI,CAAC,CAAC;YACnBC,QAAQ;gBACN,GAAI5B,EAAAA,cAAAA,IAAI2B,KAAK,qBAAT3B,YAAW4B,MAAM,KAAI,CAAC,CAAC;gBAC3BiB,iBAAiB4D;YACnB;QACF;IACF,GACA;QACE3D,2BAA2B;IAC7B;IAGF,IAAIH,aAAaI,IAAI,KAAK,WAAW;QACnCnD,MAAM;IACR,OAAO;QACLA,MAAM;IACR;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/embed/exportServer.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport type { ExpoConfig, PackageJSONConfig } from '@expo/config';\nimport { modifyConfigAsync } from '@expo/config';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport { execSync } from 'node:child_process';\nimport path from 'path';\n\nimport { disableNetwork } from '../../api/settings';\nimport { Log } from '../../log';\nimport { isSpawnResultError } from '../../start/platforms/ios/xcrun';\nimport type { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { exportApiRoutesStandaloneAsync } from '../exportStaticAsync';\nimport { copyPublicFolderAsync, getPublicFolderPath } from '../publicFolder';\nimport type { ExportAssetMap } from '../saveAssets';\nimport { persistMetroFilesAsync } from '../saveAssets';\nimport type { Options } from './resolveOptions';\nimport {\n isExecutingFromXcodebuild,\n logInXcode,\n logMetroErrorInXcode,\n warnInXcode,\n} from './xcodeCompilerLogger';\n\nconst debug = require('debug')('expo:export:server');\n\ntype ServerDeploymentResults = {\n url: string;\n dashboardUrl?: string;\n};\n\nexport async function exportStandaloneServerAsync(\n projectRoot: string,\n devServer: MetroBundlerDevServer,\n {\n exp,\n pkg,\n files,\n options,\n }: { exp: ExpoConfig; pkg: PackageJSONConfig; files: ExportAssetMap; options: Options }\n) {\n if (!options.eager) {\n await tryRemovingGeneratedOriginAsync(projectRoot, exp);\n }\n\n logInXcode('Exporting server');\n\n // Store the server output in the project's .expo directory.\n const serverOutput = path.join(projectRoot, '.expo/server', options.platform);\n\n // Remove the previous server output to prevent stale files.\n await removeAsync(serverOutput);\n\n // Export the API routes for server rendering the React Server Components.\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: true,\n });\n\n const publicPath = getPublicFolderPath(projectRoot);\n\n // Copy over public folder items\n await copyPublicFolderAsync(publicPath, serverOutput);\n\n // Copy over the server output on top of the public folder.\n await persistMetroFilesAsync(files, serverOutput);\n\n [...files.entries()].forEach(([key, value]) => {\n if (value.targetDomain === 'server') {\n // Delete server resources to prevent them from being exposed in the binary.\n files.delete(key);\n }\n });\n\n // TODO: Deprecate this in favor of a built-in prop that users should avoid setting.\n const userDefinedServerUrl = exp.extra?.router?.origin;\n let serverUrl = userDefinedServerUrl;\n\n const shouldSkipServerDeployment = (() => {\n if (!options.eager) {\n logInXcode('Skipping server deployment because the script is not running in eager mode.');\n return true;\n }\n\n // Add an opaque flag to disable server deployment.\n if (env.EXPO_NO_DEPLOY) {\n warnInXcode('Skipping server deployment because environment variable EXPO_NO_DEPLOY is set.');\n return true;\n }\n\n // Can't safely deploy from Xcode since the PATH isn't set up correctly. We could amend this in the future and allow users who customize the PATH to deploy from Xcode.\n if (isExecutingFromXcodebuild()) {\n // TODO: Don't warn when the eager bundle has been run.\n warnInXcode(\n 'Skipping server deployment because the build is running from an Xcode run script. Build with Expo CLI or EAS Build to deploy the server automatically.'\n );\n return true;\n }\n\n return false;\n })();\n\n // Deploy the server output to a hosting provider.\n const deployedServerUrl = shouldSkipServerDeployment\n ? false\n : await runServerDeployCommandAsync(projectRoot, {\n distDirectory: serverOutput,\n deployScript: getServerDeploymentScript(pkg.scripts, options.platform),\n });\n\n if (!deployedServerUrl) {\n return;\n }\n\n if (serverUrl) {\n logInXcode(\n `Using custom server URL: ${serverUrl} (ignoring deployment URL: ${deployedServerUrl})`\n );\n }\n\n // If the user-defined server URL is not defined, use the deployed server URL.\n // This allows for overwriting the server URL in the project's native files.\n serverUrl ||= deployedServerUrl;\n\n // If the user hasn't manually defined the server URL, write the deployed server URL to the app.json.\n if (userDefinedServerUrl) {\n Log.log('Skip automatically linking server origin to native container');\n return;\n }\n Log.log('Writing generated server URL to app.json');\n\n // NOTE: Is is it possible to assert that the config needs to be modifiable before building the app?\n const modification = await modifyConfigAsync(\n projectRoot,\n {\n extra: {\n ...(exp.extra ?? {}),\n router: {\n ...(exp.extra?.router ?? {}),\n generatedOrigin: serverUrl,\n },\n },\n },\n {\n skipSDKVersionRequirement: true,\n }\n );\n\n if (modification.type !== 'success') {\n throw new CommandError(\n `Failed to write generated server origin to app.json because the file is dynamic and does not extend the static config. The client will not be able to make server requests to API routes or static files. You can disable server linking with EXPO_NO_DEPLOY=1 or by disabling server output in the app.json.`\n );\n }\n}\n\nasync function dumpDeploymentLogs(projectRoot: string, logs: string, name = 'deploy') {\n const outputPath = path.join(projectRoot, `.expo/logs/${name}.log`);\n await fs.promises.mkdir(path.dirname(outputPath), { recursive: true });\n debug('Dumping server deployment logs to: ' + outputPath);\n await fs.promises.writeFile(outputPath, logs);\n return outputPath;\n}\n\nfunction getCommandBin(command: string) {\n try {\n return execSync(`command -v ${command}`, { stdio: 'pipe' }).toString().trim();\n } catch {\n return null;\n }\n}\n\nasync function runServerDeployCommandAsync(\n projectRoot: string,\n {\n distDirectory,\n deployScript,\n }: { distDirectory: string; deployScript: { scriptName: string; script: string } | null }\n): Promise<string | false> {\n const logOfflineError = () => {\n const manualScript = deployScript\n ? `npm run ${deployScript.scriptName}`\n : `npx eas deploy --export-dir ${distDirectory}`;\n\n logMetroErrorInXcode(\n projectRoot,\n chalk.red`Running CLI in offline mode, skipping server deployment. Deploy manually with: ${manualScript}`\n );\n };\n if (env.EXPO_OFFLINE) {\n logOfflineError();\n return false;\n }\n\n // TODO: Only allow EAS deployments when staging is enabled, this is because the feature is still staging-only.\n if (!env.EXPO_UNSTABLE_DEPLOY_SERVER) {\n return false;\n }\n\n if (!env.EAS_BUILD) {\n // This check helps avoid running EAS if the user isn't a user of EAS.\n // We only need to run it when building outside of EAS.\n const globalBin = getCommandBin('eas');\n if (!globalBin) {\n // This should never happen from EAS Builds.\n // Possible to happen when building locally with `npx expo run`\n logMetroErrorInXcode(\n projectRoot,\n `eas-cli is not installed globally, skipping server deployment. Install EAS CLI with 'npm install -g eas-cli'.`\n );\n return false;\n }\n debug('Found eas-cli:', globalBin);\n }\n\n let json: any;\n try {\n let results: spawnAsync.SpawnResult;\n\n const spawnOptions: spawnAsync.SpawnOptions = {\n cwd: projectRoot,\n // Ensures that errors can be caught.\n stdio: 'pipe',\n };\n // TODO: Support absolute paths in EAS CLI\n const exportDir = path.relative(projectRoot, distDirectory);\n if (deployScript) {\n logInXcode(`Using custom server deploy script: ${deployScript.scriptName}`);\n // Amend the path to try and make the custom scripts work.\n\n results = await spawnAsync(\n 'npm',\n ['run', deployScript.scriptName, `--export-dir=${exportDir}`],\n spawnOptions\n );\n } else {\n logInXcode('Deploying server to link with client');\n\n // results = DEPLOYMENT_SUCCESS_FIXTURE;\n results = await spawnAsync(\n 'npx',\n ['eas-cli', 'deploy', '--non-interactive', '--json', `--export-dir=${exportDir}`],\n spawnOptions\n );\n\n debug('Server deployment stdout:', results.stdout);\n\n // Send stderr to stderr. stdout is parsed as JSON.\n if (results.stderr) {\n process.stderr.write(results.stderr);\n }\n }\n\n const logPath = await dumpDeploymentLogs(projectRoot, results.output.join('\\n'));\n\n try {\n // {\n // \"dashboardUrl\": \"https://staging.expo.dev/projects/6460c11c-e1bc-4084-882a-fd9f57b825b1/hosting/deployments\",\n // \"identifier\": \"8a1pwbv6c5\",\n // \"url\": \"https://sep30--8a1pwbv6c5.staging.expo.app\"\n // }\n json = JSON.parse(results.stdout.trim());\n } catch {\n logMetroErrorInXcode(\n projectRoot,\n `Failed to parse server deployment JSON output. Check the logs for more information: ${logPath}`\n );\n return false;\n }\n } catch (error) {\n if (isSpawnResultError(error)) {\n const output = error.output.join('\\n').trim() || error.toString();\n Log.log(\n chalk.dim(\n 'An error occurred while deploying server. Logs stored at: ' +\n (await dumpDeploymentLogs(projectRoot, output, 'deploy-error'))\n )\n );\n\n // Likely a server offline or network error.\n if (output.match(/ENOTFOUND/)) {\n logOfflineError();\n // Print the raw error message to help provide more context.\n Log.log(chalk.dim(output));\n // Prevent any other network requests (unlikely for this command).\n disableNetwork();\n return false;\n }\n\n logInXcode(output);\n if (output.match(/spawn eas ENOENT/)) {\n // EAS not installed.\n logMetroErrorInXcode(\n projectRoot,\n `Server deployment failed because eas-cli cannot be accessed from the build script's environment (ENOENT). Install EAS CLI with 'npm install -g eas-cli'.`\n );\n return false;\n }\n\n if (error.stderr.match(/Must configure EAS project by running/)) {\n // EAS not configured, this can happen when building a project locally before building in EAS.\n // User must run `eas init`, `eas deploy`, or `eas build` first.\n\n // TODO: Should we fail the build here or just warn users?\n logMetroErrorInXcode(\n projectRoot,\n `Skipping server deployment because EAS is not configured. Run 'eas init' before trying again, or disable server output in the project.`\n );\n return false;\n }\n }\n\n // Throw unhandled server deployment errors.\n throw error;\n }\n\n // Assert json format\n assertDeploymentJsonOutput(json);\n\n // Warn about the URL not being valid. This should never happen, but might be possible with third-parties.\n if (!canParseURL(json.url)) {\n warnInXcode(`The server deployment URL is not a valid URL: ${json.url}`);\n }\n\n if (json.dashboardUrl) {\n logInXcode(`Server dashboard: ${json.dashboardUrl}`);\n }\n\n logInXcode(`Server deployed to: ${json.url}`);\n\n return json.url;\n}\n\nfunction canParseURL(url: string): boolean {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction assertDeploymentJsonOutput(json: any): asserts json is ServerDeploymentResults {\n if (!json || typeof json !== 'object' || typeof json.url !== 'string') {\n throw new Error(\n 'JSON output of server deployment command are not in the expected format: { url: \"https://...\" }'\n );\n }\n}\n\nfunction getServerDeploymentScript(\n scripts: Record<string, string> | undefined,\n platform: string\n): { scriptName: string; script: string } | null {\n // Users can overwrite the default deployment script with:\n // { scripts: { \"native:deploy\": \"eas deploy --json --non-interactive\" } }\n // A quick search on GitHub showed that `native:deploy` is not used in any public repos yet.\n // https://github.com/search?q=%22native%3Adeploy%22+path%3Apackage.json&type=code\n const DEFAULT_SCRIPT_NAME = 'native:deploy';\n\n const scriptNames = [\n // DEFAULT_SCRIPT_NAME + ':' + platform,\n DEFAULT_SCRIPT_NAME,\n ];\n\n for (const scriptName of scriptNames) {\n if (scripts?.[scriptName]) {\n return { scriptName, script: scripts[scriptName] };\n }\n }\n\n return null;\n}\n\n/** We can try to remove the generated origin from the manifest when running outside of eager mode. Bundling is the last operation to run so the config will already be embedded with the origin. */\nasync function tryRemovingGeneratedOriginAsync(projectRoot: string, exp: ExpoConfig) {\n if (env.CI) {\n // Skip in CI since nothing is committed.\n return;\n }\n if (exp.extra?.router?.generatedOrigin == null) {\n debug('No generated origin needs removing');\n return;\n }\n\n const modification = await modifyConfigAsync(\n projectRoot,\n {\n extra: {\n ...(exp.extra ?? {}),\n router: {\n ...(exp.extra?.router ?? {}),\n generatedOrigin: undefined,\n },\n },\n },\n {\n skipSDKVersionRequirement: true,\n }\n );\n\n if (modification.type !== 'success') {\n debug('Could not remove generated origin from manifest');\n } else {\n debug('Generated origin has been removed from manifest');\n }\n}\n"],"names":["exportStandaloneServerAsync","debug","require","projectRoot","devServer","exp","pkg","files","options","eager","tryRemovingGeneratedOriginAsync","logInXcode","serverOutput","path","join","platform","removeAsync","exportApiRoutesStandaloneAsync","apiRoutesOnly","publicPath","getPublicFolderPath","copyPublicFolderAsync","persistMetroFilesAsync","entries","forEach","key","value","targetDomain","delete","userDefinedServerUrl","extra","router","origin","serverUrl","shouldSkipServerDeployment","env","EXPO_NO_DEPLOY","warnInXcode","isExecutingFromXcodebuild","deployedServerUrl","runServerDeployCommandAsync","distDirectory","deployScript","getServerDeploymentScript","scripts","Log","log","modification","modifyConfigAsync","generatedOrigin","skipSDKVersionRequirement","type","CommandError","dumpDeploymentLogs","logs","name","outputPath","fs","promises","mkdir","dirname","recursive","writeFile","getCommandBin","command","execSync","stdio","toString","trim","logOfflineError","manualScript","scriptName","logMetroErrorInXcode","chalk","red","EXPO_OFFLINE","EXPO_UNSTABLE_DEPLOY_SERVER","EAS_BUILD","globalBin","json","results","spawnOptions","cwd","exportDir","relative","spawnAsync","stdout","stderr","process","write","logPath","output","JSON","parse","error","isSpawnResultError","dim","match","disableNetwork","assertDeploymentJsonOutput","canParseURL","url","dashboardUrl","URL","Error","DEFAULT_SCRIPT_NAME","scriptNames","script","CI","undefined"],"mappings":"AAAA;;;;;CAKC;;;;+BAmCqBA;;;eAAAA;;;;yBAjCY;;;;;;;gEACX;;;;;;;gEACL;;;;;;;gEACH;;;;;;;yBACU;;;;;;;gEACR;;;;;;0BAEc;qBACX;uBACe;qBAEP;qBACR;wBACS;mCACkB;8BACY;4BAEpB;qCAOhC;;;;;;AAEP,MAAMC,QAAQC,QAAQ,SAAS;AAOxB,eAAe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,cAAcmC,YAAa;QACpC,IAAI9D,2BAAAA,OAAS,CAAC2B,WAAW,EAAE;YACzB,OAAO;gBAAEA;gBAAYoC,QAAQ/D,OAAO,CAAC2B,WAAW;YAAC;QACnD;IACF;IAEA,OAAO;AACT;AAEA,kMAAkM,GAClM,eAAe7D,gCAAgCP,WAAmB,EAAEE,GAAe;QAK7EA,mBAAAA,YAWQA;IAfZ,IAAI8B,QAAG,CAACyE,EAAE,EAAE;QACV,yCAAyC;QACzC;IACF;IACA,IAAIvG,EAAAA,aAAAA,IAAIyB,KAAK,sBAATzB,oBAAAA,WAAW0B,MAAM,qBAAjB1B,kBAAmB4C,eAAe,KAAI,MAAM;QAC9ChD,MAAM;QACN;IACF;IAEA,MAAM8C,eAAe,MAAMC,IAAAA,2BAAiB,EAC1C7C,aACA;QACE2B,OAAO;YACL,GAAIzB,IAAIyB,KAAK,IAAI,CAAC,CAAC;YACnBC,QAAQ;gBACN,GAAI1B,EAAAA,cAAAA,IAAIyB,KAAK,qBAATzB,YAAW0B,MAAM,KAAI,CAAC,CAAC;gBAC3BkB,iBAAiB4D;YACnB;QACF;IACF,GACA;QACE3D,2BAA2B;IAC7B;IAGF,IAAIH,aAAaI,IAAI,KAAK,WAAW;QACnClD,MAAM;IACR,OAAO;QACLA,MAAM;IACR;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/export/embed/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport arg from 'arg';\nimport chalk from 'chalk';\nimport path from 'path';\n\nimport { Command } from '../../../bin/cli';\nimport { assertWithOptionsArgs, printHelp } from '../../utils/args';\n\nexport const expoExportEmbed: Command = async (argv) => {\n const rawArgsMap: arg.Spec = {\n // Types\n '--entry-file': String,\n '--platform': String,\n '--transformer': String,\n '--bundle-output': String,\n '--bundle-encoding': String,\n '--max-workers': Number,\n '--sourcemap-output': String,\n '--sourcemap-sources-root': String,\n '--assets-dest': String,\n '--asset-catalog-dest': String,\n '--unstable-transform-profile': String,\n '--config': String,\n\n // By default we also export a standalone server, which is mostly done\n // during the `export:embed` native build to ensure that the server is\n // valid, or to deploy it later (TBD). This can be skipped using this\n // flag explicitly\n '--skip-server': Boolean,\n\n // Hack: This is added because react-native-xcode.sh script always includes this value.\n // If supplied, we'll do nothing with the value, but at least the process won't crash.\n // Note that we also don't show this value in the `--help` prompt since we don't want people to use it.\n '--config-cmd': String,\n\n // New flag to guess the other flags based on the environment.\n '--eager': Boolean,\n // Export the bundle as Hermes bytecode bundle\n '--bytecode': Boolean,\n\n // This is here for compatibility with the `npx react-native bundle` command.\n // devs should use `DEBUG=expo:*` instead.\n '--verbose': Boolean,\n '--help': Boolean,\n // Aliases\n '-h': '--help',\n '-v': '--verbose',\n };\n const args = assertWithOptionsArgs(rawArgsMap, {\n argv,\n permissive: true,\n });\n\n if (args['--help']) {\n printHelp(\n `(Internal) Export the JavaScript bundle during a native build script for embedding in a native binary`,\n chalk`npx expo export:embed {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `--entry-file <path> Path to the root JS file, either absolute or relative to current working directory`,\n `--platform <string> Either \"ios\" or \"android\" (default: \"ios\")`,\n `--transformer <string> Specify a custom transformer to be used`,\n `--dev [boolean] If false, warnings are disabled and the bundle is minified (default: true)`,\n `--minify [boolean] Allows overriding whether bundle is minified. This defaults to false if dev is true, and true if dev is false. Disabling minification can be useful for speeding up production builds for testing purposes.`,\n `--bundle-output <string> File name where to store the resulting bundle, ex. /tmp/groups.bundle`,\n `--bundle-encoding <string> Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer). (default: \"utf8\")`,\n `--max-workers <number> Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine.`,\n `--sourcemap-output <string> File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map`,\n `--sourcemap-sources-root <string> Path to make sourcemap's sources entries relative to, ex. /root/dir`,\n `--sourcemap-use-absolute-path Report SourceMapURL using its full path`,\n `--assets-dest <string> Directory name where to store assets referenced in the bundle`,\n `--asset-catalog-dest <string> Directory to create an iOS Asset Catalog for images`,\n `--unstable-transform-profile <string> Experimental, transform JS for a specific JS engine. Currently supported: hermes, hermes-canary, default`,\n `--reset-cache Removes cached files`,\n `--eager Eagerly export the bundle with default options`,\n `--bytecode Export the bundle as Hermes bytecode bundle`,\n `-v, --verbose Enables debug logging`,\n\n `--config <string> Path to the CLI configuration file`,\n // This is seemingly unused.\n `--read-global-cache Try to fetch transformed JS code from the global cache, if configured.`,\n\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n const [\n { exportEmbedAsync },\n { resolveOptions },\n { logCmdError },\n { resolveCustomBooleanArgsAsync },\n ] = await Promise.all([\n import('./exportEmbedAsync.js'),\n import('./resolveOptions.js'),\n import('../../utils/errors.js'),\n import('../../utils/resolveArgs.js'),\n ]);\n\n return (async () => {\n const parsed = await resolveCustomBooleanArgsAsync(argv ?? [], rawArgsMap, {\n '--eager': Boolean,\n '--bytecode': Boolean,\n '--dev': Boolean,\n '--minify': Boolean,\n '--sourcemap-use-absolute-path': Boolean,\n '--reset-cache': Boolean,\n '--read-global-cache': Boolean,\n });\n\n const projectRoot = path.resolve(parsed.projectRoot);\n return exportEmbedAsync(projectRoot, resolveOptions(projectRoot, args, parsed));\n })().catch(logCmdError);\n};\n"],"names":["expoExportEmbed","argv","rawArgsMap","String","Number","Boolean","args","assertWithOptionsArgs","permissive","printHelp","chalk","join","exportEmbedAsync","resolveOptions","logCmdError","resolveCustomBooleanArgsAsync","Promise","all","parsed","projectRoot","path","resolve","catch"],"mappings":";;;;;+BAQaA;;;eAAAA;;;;gEANK;;;;;;;gEACD;;;;;;sBAGgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1C,MAAMA,kBAA2B,OAAOC;IAC7C,MAAMC,aAAuB;QAC3B,QAAQ;QACR,gBAAgBC;QAChB,cAAcA;QACd,iBAAiBA;QACjB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AC;YAE/G,CAAC,iDAAiD,CAAC;SACpD,CAACC,IAAI,CAAC;IAEX;IAEA,MAAM,CACJ,EAAEC,gBAAgB,EAAE,EACpB,EAAEC,cAAc,EAAE,EAClB,EAAEC,WAAW,EAAE,EACf,EAAEC,6BAA6B,EAAE,CAClC,GAAG,MAAMC,QAAQC,GAAG,CAAC;QACpB,mEAAA,QAAO;QACP,mEAAA,QAAO;QACP,mEAAA,QAAO;QACP,mEAAA,QAAO;KACR;IAED,OAAO,AAAC,CAAA;QACN,MAAMC,SAAS,MAAMH,8BAA8Bd,QAAQ,EAAE,EAAEC,YAAY;YACzE,WAAWG;YACX,cAAcA;YACd,SAASA;YACT,YAAYA;YACZ,iCAAiCA;YACjC,iBAAiBA;YACjB,uBAAuBA;QACzB;QAEA,MAAMc,cAAcC,eAAI,CAACC,OAAO,CAACH,OAAOC,WAAW;QACnD,OAAOP,iBAAiBO,aAAaN,eAAeM,aAAab,MAAMY;IACzE,CAAA,IAAKI,KAAK,CAACR;AACb"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/embed/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport type arg from 'arg';\nimport chalk from 'chalk';\nimport path from 'path';\n\nimport type { Command } from '../../../bin/cli';\nimport { assertWithOptionsArgs, printHelp } from '../../utils/args';\n\nexport const expoExportEmbed: Command = async (argv) => {\n const rawArgsMap: arg.Spec = {\n // Types\n '--entry-file': String,\n '--platform': String,\n '--transformer': String,\n '--bundle-output': String,\n '--bundle-encoding': String,\n '--max-workers': Number,\n '--sourcemap-output': String,\n '--sourcemap-sources-root': String,\n '--assets-dest': String,\n '--asset-catalog-dest': String,\n '--unstable-transform-profile': String,\n '--config': String,\n\n // By default we also export a standalone server, which is mostly done\n // during the `export:embed` native build to ensure that the server is\n // valid, or to deploy it later (TBD). This can be skipped using this\n // flag explicitly\n '--skip-server': Boolean,\n\n // Hack: This is added because react-native-xcode.sh script always includes this value.\n // If supplied, we'll do nothing with the value, but at least the process won't crash.\n // Note that we also don't show this value in the `--help` prompt since we don't want people to use it.\n '--config-cmd': String,\n\n // New flag to guess the other flags based on the environment.\n '--eager': Boolean,\n // Export the bundle as Hermes bytecode bundle\n '--bytecode': Boolean,\n\n // This is here for compatibility with the `npx react-native bundle` command.\n // devs should use `DEBUG=expo:*` instead.\n '--verbose': Boolean,\n '--help': Boolean,\n // Aliases\n '-h': '--help',\n '-v': '--verbose',\n };\n const args = assertWithOptionsArgs(rawArgsMap, {\n argv,\n permissive: true,\n });\n\n if (args['--help']) {\n printHelp(\n `(Internal) Export the JavaScript bundle during a native build script for embedding in a native binary`,\n chalk`npx expo export:embed {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `--entry-file <path> Path to the root JS file, either absolute or relative to current working directory`,\n `--platform <string> Either \"ios\" or \"android\" (default: \"ios\")`,\n `--transformer <string> Specify a custom transformer to be used`,\n `--dev [boolean] If false, warnings are disabled and the bundle is minified (default: true)`,\n `--minify [boolean] Allows overriding whether bundle is minified. This defaults to false if dev is true, and true if dev is false. Disabling minification can be useful for speeding up production builds for testing purposes.`,\n `--bundle-output <string> File name where to store the resulting bundle, ex. /tmp/groups.bundle`,\n `--bundle-encoding <string> Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer). (default: \"utf8\")`,\n `--max-workers <number> Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine.`,\n `--sourcemap-output <string> File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map`,\n `--sourcemap-sources-root <string> Path to make sourcemap's sources entries relative to, ex. /root/dir`,\n `--sourcemap-use-absolute-path Report SourceMapURL using its full path`,\n `--assets-dest <string> Directory name where to store assets referenced in the bundle`,\n `--asset-catalog-dest <string> Directory to create an iOS Asset Catalog for images`,\n `--unstable-transform-profile <string> Experimental, transform JS for a specific JS engine. Currently supported: hermes, hermes-canary, default`,\n `--reset-cache Removes cached files`,\n `--eager Eagerly export the bundle with default options`,\n `--bytecode Export the bundle as Hermes bytecode bundle`,\n `-v, --verbose Enables debug logging`,\n\n `--config <string> Path to the CLI configuration file`,\n // This is seemingly unused.\n `--read-global-cache Try to fetch transformed JS code from the global cache, if configured.`,\n\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n const [\n { exportEmbedAsync },\n { resolveOptions },\n { logCmdError },\n { resolveCustomBooleanArgsAsync },\n ] = await Promise.all([\n import('./exportEmbedAsync.js'),\n import('./resolveOptions.js'),\n import('../../utils/errors.js'),\n import('../../utils/resolveArgs.js'),\n ]);\n\n return (async () => {\n const parsed = await resolveCustomBooleanArgsAsync(argv ?? [], rawArgsMap, {\n '--eager': Boolean,\n '--bytecode': Boolean,\n '--dev': Boolean,\n '--minify': Boolean,\n '--sourcemap-use-absolute-path': Boolean,\n '--reset-cache': Boolean,\n '--read-global-cache': Boolean,\n });\n\n const projectRoot = path.resolve(parsed.projectRoot);\n return exportEmbedAsync(projectRoot, resolveOptions(projectRoot, args, parsed));\n })().catch(logCmdError);\n};\n"],"names":["expoExportEmbed","argv","rawArgsMap","String","Number","Boolean","args","assertWithOptionsArgs","permissive","printHelp","chalk","join","exportEmbedAsync","resolveOptions","logCmdError","resolveCustomBooleanArgsAsync","Promise","all","parsed","projectRoot","path","resolve","catch"],"mappings":";;;;;+BAQaA;;;eAAAA;;;;gEANK;;;;;;;gEACD;;;;;;sBAGgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1C,MAAMA,kBAA2B,OAAOC;IAC7C,MAAMC,aAAuB;QAC3B,QAAQ;QACR,gBAAgBC;QAChB,cAAcA;QACd,iBAAiBA;QACjB,mBAAmBA;QACnB,qBAAqBA;QACrB,iBAAiBC;QACjB,sBAAsBD;QACtB,4BAA4BA;QAC5B,iBAAiBA;QACjB,wBAAwBA;QACxB,gCAAgCA;QAChC,YAAYA;QAEZ,sEAAsE;QACtE,sEAAsE;QACtE,qEAAqE;QACrE,kBAAkB;QAClB,iBA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,GAAG,CAAC;QACpB,mEAAA,QAAO;QACP,mEAAA,QAAO;QACP,mEAAA,QAAO;QACP,mEAAA,QAAO;KACR;IAED,OAAO,AAAC,CAAA;QACN,MAAMC,SAAS,MAAMH,8BAA8Bd,QAAQ,EAAE,EAAEC,YAAY;YACzE,WAAWG;YACX,cAAcA;YACd,SAASA;YACT,YAAYA;YACZ,iCAAiCA;YACjC,iBAAiBA;YACjB,uBAAuBA;QACzB;QAEA,MAAMc,cAAcC,eAAI,CAACC,OAAO,CAACH,OAAOC,WAAW;QACnD,OAAOP,iBAAiBO,aAAaN,eAAeM,aAAab,MAAMY;IACzE,CAAA,IAAKI,KAAK,CAACR;AACb"}
|
|
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
deserializeEagerKey
|
|
12
|
+
get deserializeEagerKey () {
|
|
13
13
|
return deserializeEagerKey;
|
|
14
14
|
},
|
|
15
|
-
getExportEmbedOptionsKey
|
|
15
|
+
get getExportEmbedOptionsKey () {
|
|
16
16
|
return getExportEmbedOptionsKey;
|
|
17
17
|
},
|
|
18
|
-
resolveEagerOptionsAsync
|
|
18
|
+
get resolveEagerOptionsAsync () {
|
|
19
19
|
return resolveEagerOptionsAsync;
|
|
20
20
|
},
|
|
21
|
-
resolveOptions
|
|
21
|
+
get resolveOptions () {
|
|
22
22
|
return resolveOptions;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -128,7 +128,8 @@ function resolveEagerOptionsAsync(projectRoot, { dev, platform, assetsDest, bund
|
|
|
128
128
|
}
|
|
129
129
|
if (!bundleOutput) {
|
|
130
130
|
destination ??= getTemporaryPath();
|
|
131
|
-
|
|
131
|
+
// Apple platforms (ios/tvos/macos) use `main.jsbundle`; Android uses `index.js`.
|
|
132
|
+
bundleOutput = platform === 'android' ? _path().default.join(destination, 'index.js') : _path().default.join(destination, 'main.jsbundle');
|
|
132
133
|
}
|
|
133
134
|
return {
|
|
134
135
|
...options,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/export/embed/resolveOptions.ts"],"sourcesContent":["import { resolveEntryPoint } from '@expo/config/paths';\nimport type { OutputOptions } from '@expo/metro/metro/shared/types';\nimport canonicalize from '@expo/metro/metro-core/canonicalize';\nimport arg from 'arg';\nimport os from 'os';\nimport path from 'path';\n\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { resolveCustomBooleanArgsAsync } from '../../utils/resolveArgs';\nimport { isAndroidUsingHermes, isIosUsingHermes } from '../exportHermes';\n\nexport interface Options {\n assetsDest?: string;\n assetCatalogDest?: string;\n entryFile: string;\n resetCache: boolean;\n transformer?: string;\n minify?: boolean;\n config?: string;\n platform: string;\n dev: boolean;\n bundleOutput: string;\n bundleEncoding?: OutputOptions['bundleEncoding'];\n maxWorkers?: number;\n sourcemapOutput?: string;\n sourcemapSourcesRoot?: string;\n sourcemapUseAbsolutePath: boolean;\n verbose: boolean;\n unstableTransformProfile?: string;\n eager?: boolean;\n bytecode?: boolean;\n skipServer?: boolean;\n}\n\nfunction assertIsBoolean(val: any): asserts val is boolean {\n if (typeof val !== 'boolean') {\n throw new CommandError(`Expected boolean, got ${typeof val}`);\n }\n}\n\nfunction getBundleEncoding(encoding: string | undefined): OutputOptions['bundleEncoding'] {\n return encoding === 'utf8' || encoding === 'utf16le' || encoding === 'ascii'\n ? encoding\n : undefined;\n}\n\nexport function resolveOptions(\n projectRoot: string,\n args: arg.Result<arg.Spec>,\n parsed: Awaited<ReturnType<typeof resolveCustomBooleanArgsAsync>>\n): Options {\n const dev = parsed.args['--dev'] ?? true;\n assertIsBoolean(dev);\n\n const platform = args['--platform'];\n if (!platform) {\n throw new CommandError(`Missing required argument: --platform`);\n }\n\n const bundleOutput = args['--bundle-output'];\n\n const commonOptions = {\n entryFile: args['--entry-file'] ?? resolveEntryPoint(projectRoot, { platform }),\n assetCatalogDest: args['--asset-catalog-dest'],\n platform,\n transformer: args['--transformer'],\n // TODO: Support `--dev false`\n // dev: false,\n bundleOutput,\n bundleEncoding: getBundleEncoding(args['--bundle-encoding']) ?? 'utf8',\n maxWorkers: args['--max-workers'],\n sourcemapOutput: args['--sourcemap-output'],\n sourcemapSourcesRoot: args['--sourcemap-sources-root'],\n sourcemapUseAbsolutePath: !!parsed.args['--sourcemap-use-absolute-path'],\n assetsDest: args['--assets-dest'],\n unstableTransformProfile: args['--unstable-transform-profile'],\n resetCache: !!parsed.args['--reset-cache'],\n verbose: args['--verbose'] ?? env.EXPO_DEBUG,\n config: args['--config'] ? path.resolve(args['--config']) : undefined,\n dev,\n minify: parsed.args['--minify'] as boolean | undefined,\n eager: !!parsed.args['--eager'],\n bytecode: parsed.args['--bytecode'] as boolean | undefined,\n skipServer: !!parsed.args['--skip-server'],\n };\n\n if (commonOptions.eager) {\n return resolveEagerOptionsAsync(projectRoot, commonOptions);\n }\n\n // Perform extra assertions after the eager options are resolved.\n\n if (!bundleOutput) {\n throw new CommandError(`Missing required argument: --bundle-output`);\n }\n\n const minify = parsed.args['--minify'] ?? !dev;\n assertIsBoolean(minify);\n\n return { ...commonOptions, minify, bundleOutput };\n}\n\nfunction getTemporaryPath() {\n return path.join(os.tmpdir(), Math.random().toString(36).substring(2));\n}\n\n/** Best effort guess of which options will be used for the export:embed invocation that is called from the native build scripts. */\nexport function resolveEagerOptionsAsync(\n projectRoot: string,\n {\n dev,\n platform,\n assetsDest,\n bundleOutput,\n minify,\n ...options\n }: Partial<Omit<Options, 'platform' | 'dev'>> & {\n platform: string;\n dev: boolean;\n }\n): Options {\n // If the minify prop is undefined, then check if the project is using hermes.\n minify ??= !(platform === 'android'\n ? isAndroidUsingHermes(projectRoot)\n : isIosUsingHermes(projectRoot));\n\n let destination: string | undefined;\n\n if (!assetsDest) {\n destination ??= getTemporaryPath();\n assetsDest = path.join(destination, 'assets');\n }\n\n if (!bundleOutput) {\n destination ??= getTemporaryPath();\n bundleOutput =\n platform === '
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/embed/resolveOptions.ts"],"sourcesContent":["import { resolveEntryPoint } from '@expo/config/paths';\nimport type { OutputOptions } from '@expo/metro/metro/shared/types';\nimport canonicalize from '@expo/metro/metro-core/canonicalize';\nimport type arg from 'arg';\nimport os from 'os';\nimport path from 'path';\n\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport type { resolveCustomBooleanArgsAsync } from '../../utils/resolveArgs';\nimport { isAndroidUsingHermes, isIosUsingHermes } from '../exportHermes';\n\nexport interface Options {\n assetsDest?: string;\n assetCatalogDest?: string;\n entryFile: string;\n resetCache: boolean;\n transformer?: string;\n minify?: boolean;\n config?: string;\n platform: string;\n dev: boolean;\n bundleOutput: string;\n bundleEncoding?: OutputOptions['bundleEncoding'];\n maxWorkers?: number;\n sourcemapOutput?: string;\n sourcemapSourcesRoot?: string;\n sourcemapUseAbsolutePath: boolean;\n verbose: boolean;\n unstableTransformProfile?: string;\n eager?: boolean;\n bytecode?: boolean;\n skipServer?: boolean;\n}\n\nfunction assertIsBoolean(val: any): asserts val is boolean {\n if (typeof val !== 'boolean') {\n throw new CommandError(`Expected boolean, got ${typeof val}`);\n }\n}\n\nfunction getBundleEncoding(encoding: string | undefined): OutputOptions['bundleEncoding'] {\n return encoding === 'utf8' || encoding === 'utf16le' || encoding === 'ascii'\n ? encoding\n : undefined;\n}\n\nexport function resolveOptions(\n projectRoot: string,\n args: arg.Result<arg.Spec>,\n parsed: Awaited<ReturnType<typeof resolveCustomBooleanArgsAsync>>\n): Options {\n const dev = parsed.args['--dev'] ?? true;\n assertIsBoolean(dev);\n\n const platform = args['--platform'];\n if (!platform) {\n throw new CommandError(`Missing required argument: --platform`);\n }\n\n const bundleOutput = args['--bundle-output'];\n\n const commonOptions = {\n entryFile: args['--entry-file'] ?? resolveEntryPoint(projectRoot, { platform }),\n assetCatalogDest: args['--asset-catalog-dest'],\n platform,\n transformer: args['--transformer'],\n // TODO: Support `--dev false`\n // dev: false,\n bundleOutput,\n bundleEncoding: getBundleEncoding(args['--bundle-encoding']) ?? 'utf8',\n maxWorkers: args['--max-workers'],\n sourcemapOutput: args['--sourcemap-output'],\n sourcemapSourcesRoot: args['--sourcemap-sources-root'],\n sourcemapUseAbsolutePath: !!parsed.args['--sourcemap-use-absolute-path'],\n assetsDest: args['--assets-dest'],\n unstableTransformProfile: args['--unstable-transform-profile'],\n resetCache: !!parsed.args['--reset-cache'],\n verbose: args['--verbose'] ?? env.EXPO_DEBUG,\n config: args['--config'] ? path.resolve(args['--config']) : undefined,\n dev,\n minify: parsed.args['--minify'] as boolean | undefined,\n eager: !!parsed.args['--eager'],\n bytecode: parsed.args['--bytecode'] as boolean | undefined,\n skipServer: !!parsed.args['--skip-server'],\n };\n\n if (commonOptions.eager) {\n return resolveEagerOptionsAsync(projectRoot, commonOptions);\n }\n\n // Perform extra assertions after the eager options are resolved.\n\n if (!bundleOutput) {\n throw new CommandError(`Missing required argument: --bundle-output`);\n }\n\n const minify = parsed.args['--minify'] ?? !dev;\n assertIsBoolean(minify);\n\n return { ...commonOptions, minify, bundleOutput };\n}\n\nfunction getTemporaryPath() {\n return path.join(os.tmpdir(), Math.random().toString(36).substring(2));\n}\n\n/** Best effort guess of which options will be used for the export:embed invocation that is called from the native build scripts. */\nexport function resolveEagerOptionsAsync(\n projectRoot: string,\n {\n dev,\n platform,\n assetsDest,\n bundleOutput,\n minify,\n ...options\n }: Partial<Omit<Options, 'platform' | 'dev'>> & {\n platform: string;\n dev: boolean;\n }\n): Options {\n // If the minify prop is undefined, then check if the project is using hermes.\n minify ??= !(platform === 'android'\n ? isAndroidUsingHermes(projectRoot)\n : isIosUsingHermes(projectRoot));\n\n let destination: string | undefined;\n\n if (!assetsDest) {\n destination ??= getTemporaryPath();\n assetsDest = path.join(destination, 'assets');\n }\n\n if (!bundleOutput) {\n destination ??= getTemporaryPath();\n // Apple platforms (ios/tvos/macos) use `main.jsbundle`; Android uses `index.js`.\n bundleOutput =\n platform === 'android'\n ? path.join(destination, 'index.js')\n : path.join(destination, 'main.jsbundle');\n }\n\n return {\n ...options,\n eager: options.eager ?? true,\n bundleOutput,\n assetsDest,\n entryFile: options.entryFile ?? resolveEntryPoint(projectRoot, { platform }),\n resetCache: !!options.resetCache,\n platform,\n minify,\n dev,\n bundleEncoding: 'utf8',\n sourcemapUseAbsolutePath: false,\n verbose: env.EXPO_DEBUG,\n };\n}\n\nexport function getExportEmbedOptionsKey({\n // Extract all values that won't change the Metro results.\n resetCache,\n assetsDest,\n bundleOutput,\n verbose,\n maxWorkers,\n eager,\n ...options\n}: Options) {\n // Create a sorted key for the options, removing values that won't change the Metro results.\n return JSON.stringify(options, canonicalize);\n}\n\nexport function deserializeEagerKey(key: string) {\n return JSON.parse(key) as { options: Options; key: string };\n}\n"],"names":["deserializeEagerKey","getExportEmbedOptionsKey","resolveEagerOptionsAsync","resolveOptions","assertIsBoolean","val","CommandError","getBundleEncoding","encoding","undefined","projectRoot","args","parsed","dev","platform","bundleOutput","commonOptions","entryFile","resolveEntryPoint","assetCatalogDest","transformer","bundleEncoding","maxWorkers","sourcemapOutput","sourcemapSourcesRoot","sourcemapUseAbsolutePath","assetsDest","unstableTransformProfile","resetCache","verbose","env","EXPO_DEBUG","config","path","resolve","minify","eager","bytecode","skipServer","getTemporaryPath","join","os","tmpdir","Math","random","toString","substring","options","isAndroidUsingHermes","isIosUsingHermes","destination","JSON","stringify","canonicalize","key","parse"],"mappings":";;;;;;;;;;;QA6KgBA;eAAAA;;QAdAC;eAAAA;;QAnDAC;eAAAA;;QA7DAC;eAAAA;;;;yBA/CkB;;;;;;;gEAET;;;;;;;gEAEV;;;;;;;gEACE;;;;;;qBAEG;wBACS;8BAE0B;;;;;;AAyBvD,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AAI;QACxBrB;QACAW;QACAT,WAAW8B,QAAQ9B,SAAS,IAAIC,IAAAA,0BAAiB,EAACR,aAAa;YAAEI;QAAS;QAC1Ec,YAAY,CAAC,CAACmB,QAAQnB,UAAU;QAChCd;QACAqB;QACAtB;QACAQ,gBAAgB;QAChBI,0BAA0B;QAC1BI,SAASC,QAAG,CAACC,UAAU;IACzB;AACF;AAEO,SAAS9B,yBAAyB,EACvC,0DAA0D;AAC1D2B,UAAU,EACVF,UAAU,EACVX,YAAY,EACZc,OAAO,EACPP,UAAU,EACVc,KAAK,EACL,GAAGW,SACK;IACR,4FAA4F;IAC5F,OAAOI,KAAKC,SAAS,CAACL,SAASM,uBAAY;AAC7C;AAEO,SAASrD,oBAAoBsD,GAAW;IAC7C,OAAOH,KAAKI,KAAK,CAACD;AACpB"}
|
|
@@ -10,26 +10,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10
10
|
function _export(target, all) {
|
|
11
11
|
for(var name in all)Object.defineProperty(target, name, {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: all
|
|
13
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
_export(exports, {
|
|
17
|
-
getXcodeCompilerErrorMessage
|
|
17
|
+
get getXcodeCompilerErrorMessage () {
|
|
18
18
|
return getXcodeCompilerErrorMessage;
|
|
19
19
|
},
|
|
20
|
-
isExecutingFromXcodebuild
|
|
20
|
+
get isExecutingFromXcodebuild () {
|
|
21
21
|
return isExecutingFromXcodebuild;
|
|
22
22
|
},
|
|
23
|
-
isPossiblyUnableToResolveError
|
|
23
|
+
get isPossiblyUnableToResolveError () {
|
|
24
24
|
return isPossiblyUnableToResolveError;
|
|
25
25
|
},
|
|
26
|
-
logInXcode
|
|
26
|
+
get logInXcode () {
|
|
27
27
|
return logInXcode;
|
|
28
28
|
},
|
|
29
|
-
logMetroErrorInXcode
|
|
29
|
+
get logMetroErrorInXcode () {
|
|
30
30
|
return logMetroErrorInXcode;
|
|
31
31
|
},
|
|
32
|
-
warnInXcode
|
|
32
|
+
get warnInXcode () {
|
|
33
33
|
return warnInXcode;
|
|
34
34
|
}
|
|
35
35
|
});
|