@expo/cli 0.18.0 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +90 -114
- package/build/bin/cli.map +1 -1
- package/build/src/api/endpoint.js +11 -3
- package/build/src/api/endpoint.js.map +1 -1
- package/build/src/api/getExpoGoIntermediateCertificate.js +7 -4
- package/build/src/api/getExpoGoIntermediateCertificate.js.map +1 -1
- package/build/src/api/getExpoSchema.js +13 -11
- package/build/src/api/getExpoSchema.js.map +1 -1
- package/build/src/api/getNativeModuleVersions.js +7 -4
- package/build/src/api/getNativeModuleVersions.js.map +1 -1
- package/build/src/api/getProjectDevelopmentCertificate.js +7 -4
- package/build/src/api/getProjectDevelopmentCertificate.js.map +1 -1
- package/build/src/api/getVersions.js +7 -4
- package/build/src/api/getVersions.js.map +1 -1
- package/build/src/api/graphql/client.js +55 -35
- package/build/src/api/graphql/client.js.map +1 -1
- package/build/src/api/graphql/queries/AppQuery.js +9 -7
- package/build/src/api/graphql/queries/AppQuery.js.map +1 -1
- package/build/src/api/graphql/queries/UserQuery.js +7 -5
- package/build/src/api/graphql/queries/UserQuery.js.map +1 -1
- package/build/src/api/graphql/types/App.js +6 -4
- package/build/src/api/graphql/types/App.js.map +1 -1
- package/build/src/api/rest/cache/FileSystemCache.js +6 -4
- package/build/src/api/rest/cache/FileSystemCache.js.map +1 -1
- package/build/src/api/rest/cache/response.js +4 -1
- package/build/src/api/rest/cache/response.js.map +1 -1
- package/build/src/api/rest/cache/wrapFetchWithCache.js +21 -12
- package/build/src/api/rest/cache/wrapFetchWithCache.js.map +1 -1
- package/build/src/api/rest/client.js +36 -29
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithBaseUrl.js +4 -1
- package/build/src/api/rest/wrapFetchWithBaseUrl.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithOffline.js +5 -2
- package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithProgress.js +40 -19
- package/build/src/api/rest/wrapFetchWithProgress.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithProxy.js +7 -4
- package/build/src/api/rest/wrapFetchWithProxy.js.map +1 -1
- package/build/src/api/settings.js +9 -4
- package/build/src/api/settings.js.map +1 -1
- package/build/src/api/updateDevelopmentSession.js +16 -8
- package/build/src/api/updateDevelopmentSession.js.map +1 -1
- package/build/src/api/user/UserSettings.js +10 -8
- package/build/src/api/user/UserSettings.js.map +1 -1
- package/build/src/api/user/actions.js +66 -41
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/api/user/expoSsoLauncher.js +46 -25
- package/build/src/api/user/expoSsoLauncher.js.map +1 -1
- package/build/src/api/user/otp.js +70 -50
- package/build/src/api/user/otp.js.map +1 -1
- package/build/src/api/user/user.js +66 -41
- package/build/src/api/user/user.js.map +1 -1
- package/build/src/config/configAsync.js +62 -43
- package/build/src/config/configAsync.js.map +1 -1
- package/build/src/config/index.js +46 -30
- package/build/src/config/index.js.map +1 -1
- package/build/src/customize/customizeAsync.js +14 -11
- package/build/src/customize/customizeAsync.js.map +1 -1
- package/build/src/customize/generate.js +61 -46
- package/build/src/customize/generate.js.map +1 -1
- package/build/src/customize/index.js +10 -8
- package/build/src/customize/index.js.map +1 -1
- package/build/src/customize/resolveOptions.js +7 -4
- package/build/src/customize/resolveOptions.js.map +1 -1
- package/build/src/customize/templates.js +31 -34
- package/build/src/customize/templates.js.map +1 -1
- package/build/src/customize/typescript.js +43 -28
- package/build/src/customize/typescript.js.map +1 -1
- package/build/src/export/createMetadataJson.js +7 -6
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +51 -38
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/index.js +48 -36
- package/build/src/export/embed/index.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +7 -4
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/embed/xcodeCompilerLogger.js +20 -8
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -1
- package/build/src/export/exportApp.js +84 -67
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +62 -43
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportAsync.js +47 -26
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/exportHermes.js +19 -11
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +49 -38
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +19 -11
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +42 -39
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/getPublicExpoManifest.js +9 -6
- package/build/src/export/getPublicExpoManifest.js.map +1 -1
- package/build/src/export/getResolvedLocales.js +7 -4
- package/build/src/export/getResolvedLocales.js.map +1 -1
- package/build/src/export/html.js +12 -4
- package/build/src/export/html.js.map +1 -1
- package/build/src/export/index.js +49 -33
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +22 -6
- package/build/src/export/metroAssetLocalPath.js.map +1 -1
- package/build/src/export/persistMetroAssets.js +38 -24
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/publicFolder.js +15 -7
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/resolveOptions.js +19 -15
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +42 -38
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/web/exportWebAsync.js +15 -12
- package/build/src/export/web/exportWebAsync.js.map +1 -1
- package/build/src/export/web/index.js +47 -31
- package/build/src/export/web/index.js.map +1 -1
- package/build/src/export/web/resolveOptions.js +4 -1
- package/build/src/export/web/resolveOptions.js.map +1 -1
- package/build/src/export/writeContents.js +12 -7
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/graphql/generated.js +141 -128
- package/build/src/graphql/generated.js.map +1 -1
- package/build/src/install/applyPlugins.js +43 -25
- package/build/src/install/applyPlugins.js.map +1 -1
- package/build/src/install/checkPackages.js +55 -35
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/fixPackages.js +52 -35
- package/build/src/install/fixPackages.js.map +1 -1
- package/build/src/install/index.js +15 -13
- package/build/src/install/index.js.map +1 -1
- package/build/src/install/installAsync.js +90 -65
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/installExpoPackage.js +48 -27
- package/build/src/install/installExpoPackage.js.map +1 -1
- package/build/src/install/resolveOptions.js +8 -5
- package/build/src/install/resolveOptions.js.map +1 -1
- package/build/src/install/utils/autoAddConfigPlugins.js +15 -7
- package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
- package/build/src/lint/ESlintPrerequisite.js +174 -0
- package/build/src/lint/ESlintPrerequisite.js.map +1 -0
- package/build/src/lint/index.js +66 -0
- package/build/src/lint/index.js.map +1 -0
- package/build/src/lint/lintAsync.js +33 -0
- package/build/src/lint/lintAsync.js.map +1 -0
- package/build/src/log.js +20 -14
- package/build/src/log.js.map +1 -1
- package/build/src/login/index.js +43 -25
- package/build/src/login/index.js.map +1 -1
- package/build/src/logout/index.js +43 -25
- package/build/src/logout/index.js.map +1 -1
- package/build/src/prebuild/clearNativeFolder.js +65 -42
- package/build/src/prebuild/clearNativeFolder.js.map +1 -1
- package/build/src/prebuild/configureProjectAsync.js +50 -29
- package/build/src/prebuild/configureProjectAsync.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +19 -13
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/ensureConfigAsync.js +54 -28
- package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
- package/build/src/prebuild/index.js +52 -38
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +68 -51
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/renameTemplateAppName.js +15 -10
- package/build/src/prebuild/renameTemplateAppName.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +60 -35
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/resolveTemplate.js +66 -40
- package/build/src/prebuild/resolveTemplate.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +67 -44
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +70 -49
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/prebuild/validateTemplatePlatforms.js +44 -23
- package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
- package/build/src/register/index.js +43 -25
- package/build/src/register/index.js.map +1 -1
- package/build/src/register/registerAsync.js +14 -11
- package/build/src/register/registerAsync.js.map +1 -1
- package/build/src/run/android/index.js +47 -31
- package/build/src/run/android/index.js.map +1 -1
- package/build/src/run/android/resolveDevice.js +9 -6
- package/build/src/run/android/resolveDevice.js.map +1 -1
- package/build/src/run/android/resolveGradlePropsAsync.js +10 -9
- package/build/src/run/android/resolveGradlePropsAsync.js.map +1 -1
- package/build/src/run/android/resolveInstallApkName.js +14 -12
- package/build/src/run/android/resolveInstallApkName.js.map +1 -1
- package/build/src/run/android/resolveLaunchProps.js +6 -3
- package/build/src/run/android/resolveLaunchProps.js.map +1 -1
- package/build/src/run/android/resolveOptions.js +12 -9
- package/build/src/run/android/resolveOptions.js.map +1 -1
- package/build/src/run/android/runAndroidAsync.js +27 -24
- package/build/src/run/android/runAndroidAsync.js.map +1 -1
- package/build/src/run/ensureNativeProject.js +11 -8
- package/build/src/run/ensureNativeProject.js.map +1 -1
- package/build/src/run/hints.js +15 -7
- package/build/src/run/hints.js.map +1 -1
- package/build/src/run/index.js +49 -35
- package/build/src/run/index.js.map +1 -1
- package/build/src/run/ios/XcodeBuild.js +75 -51
- package/build/src/run/ios/XcodeBuild.js.map +1 -1
- package/build/src/run/ios/appleDevice/AppleDevice.js +31 -24
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
- package/build/src/run/ios/appleDevice/ClientManager.js +66 -33
- package/build/src/run/ios/appleDevice/ClientManager.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/AFCClient.js +73 -47
- package/build/src/run/ios/appleDevice/client/AFCClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js +53 -26
- package/build/src/run/ios/appleDevice/client/DebugserverClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js +15 -6
- package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js +54 -27
- package/build/src/run/ios/appleDevice/client/LockdowndClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js +56 -30
- package/build/src/run/ios/appleDevice/client/MobileImageMounterClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/ServiceClient.js +18 -4
- package/build/src/run/ios/appleDevice/client/ServiceClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js +22 -13
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -1
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js +57 -31
- package/build/src/run/ios/appleDevice/installOnDeviceAsync.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js +79 -66
- package/build/src/run/ios/appleDevice/protocol/AFCProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js +28 -14
- package/build/src/run/ios/appleDevice/protocol/AbstractProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js +24 -11
- package/build/src/run/ios/appleDevice/protocol/GDBProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js +26 -13
- package/build/src/run/ios/appleDevice/protocol/LockdownProtocol.js.map +1 -1
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js +23 -10
- package/build/src/run/ios/appleDevice/protocol/UsbmuxProtocol.js.map +1 -1
- package/build/src/run/ios/codeSigning/Security.js +27 -20
- package/build/src/run/ios/codeSigning/Security.js.map +1 -1
- package/build/src/run/ios/codeSigning/configureCodeSigning.js +49 -28
- package/build/src/run/ios/codeSigning/configureCodeSigning.js.map +1 -1
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js +61 -36
- package/build/src/run/ios/codeSigning/resolveCertificateSigningIdentity.js.map +1 -1
- package/build/src/run/ios/codeSigning/settings.js +11 -3
- package/build/src/run/ios/codeSigning/settings.js.map +1 -1
- package/build/src/run/ios/codeSigning/simulatorCodeSigning.js +7 -5
- package/build/src/run/ios/codeSigning/simulatorCodeSigning.js.map +1 -1
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js +14 -8
- package/build/src/run/ios/codeSigning/xcodeCodeSigning.js.map +1 -1
- package/build/src/run/ios/index.js +50 -34
- package/build/src/run/ios/index.js.map +1 -1
- package/build/src/run/ios/launchApp.js +52 -31
- package/build/src/run/ios/launchApp.js.map +1 -1
- package/build/src/run/ios/options/promptDevice.js +17 -13
- package/build/src/run/ios/options/promptDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveDevice.js +63 -39
- package/build/src/run/ios/options/resolveDevice.js.map +1 -1
- package/build/src/run/ios/options/resolveNativeScheme.js +57 -34
- package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
- package/build/src/run/ios/options/resolveOptions.js +15 -12
- package/build/src/run/ios/options/resolveOptions.js.map +1 -1
- package/build/src/run/ios/options/resolveXcodeProject.js +6 -3
- package/build/src/run/ios/options/resolveXcodeProject.js.map +1 -1
- package/build/src/run/ios/runIosAsync.js +63 -42
- package/build/src/run/ios/runIosAsync.js.map +1 -1
- package/build/src/run/resolveBundlerProps.js +8 -5
- package/build/src/run/resolveBundlerProps.js.map +1 -1
- package/build/src/run/startBundler.js +47 -26
- package/build/src/run/startBundler.js.map +1 -1
- package/build/src/start/detectDevClient.js +6 -3
- package/build/src/start/detectDevClient.js.map +1 -1
- package/build/src/start/doctor/Prerequisite.js +15 -7
- package/build/src/start/doctor/Prerequisite.js.map +1 -1
- package/build/src/start/doctor/SecurityBinPrerequisite.js +7 -4
- package/build/src/start/doctor/SecurityBinPrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +44 -23
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js +44 -23
- package/build/src/start/doctor/apple/XcodeDeveloperDiskImagePrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcodePrerequisite.js +61 -36
- package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcrunPrerequisite.js +15 -12
- package/build/src/start/doctor/apple/XcrunPrerequisite.js.map +1 -1
- package/build/src/start/doctor/dependencies/bundledNativeModules.js +49 -28
- package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +98 -53
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
- package/build/src/start/doctor/dependencies/getMissingPackages.js +17 -9
- package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +23 -15
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/resolvePackages.js +19 -13
- package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +63 -41
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js +64 -39
- package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
- package/build/src/start/doctor/ngrok/NgrokResolver.js +12 -5
- package/build/src/start/doctor/ngrok/NgrokResolver.js.map +1 -1
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +59 -41
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
- package/build/src/start/doctor/typescript/updateTSConfig.js +59 -36
- package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +57 -31
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
- package/build/src/start/index.js +56 -42
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/interface/KeyPressHandler.js +43 -22
- package/build/src/start/interface/KeyPressHandler.js.map +1 -1
- package/build/src/start/interface/commandsTable.js +60 -38
- package/build/src/start/interface/commandsTable.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +85 -68
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/interface/startInterface.js +78 -57
- package/build/src/start/interface/startInterface.js.map +1 -1
- package/build/src/start/platforms/AppIdResolver.js +9 -6
- package/build/src/start/platforms/AppIdResolver.js.map +1 -1
- package/build/src/start/platforms/DeviceManager.js +41 -20
- package/build/src/start/platforms/DeviceManager.js.map +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js +55 -35
- package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
- package/build/src/start/platforms/PlatformManager.js +19 -17
- package/build/src/start/platforms/PlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/ADBServer.js +15 -12
- package/build/src/start/platforms/android/ADBServer.js.map +1 -1
- package/build/src/start/platforms/android/AndroidAppIdResolver.js +6 -4
- package/build/src/start/platforms/android/AndroidAppIdResolver.js.map +1 -1
- package/build/src/start/platforms/android/AndroidDeviceManager.js +70 -50
- package/build/src/start/platforms/android/AndroidDeviceManager.js.map +1 -1
- package/build/src/start/platforms/android/AndroidPlatformManager.js +9 -6
- package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/AndroidSdk.js +11 -8
- package/build/src/start/platforms/android/AndroidSdk.js.map +1 -1
- package/build/src/start/platforms/android/activateWindow.js +43 -22
- package/build/src/start/platforms/android/activateWindow.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +73 -52
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/platforms/android/adbReverse.js +57 -31
- package/build/src/start/platforms/android/adbReverse.js.map +1 -1
- package/build/src/start/platforms/android/emulator.js +63 -42
- package/build/src/start/platforms/android/emulator.js.map +1 -1
- package/build/src/start/platforms/android/getDevices.js +11 -10
- package/build/src/start/platforms/android/getDevices.js.map +1 -1
- package/build/src/start/platforms/android/gradle.js +18 -11
- package/build/src/start/platforms/android/gradle.js.map +1 -1
- package/build/src/start/platforms/android/promptAndroidDevice.js +14 -14
- package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
- package/build/src/start/platforms/ios/AppleAppIdResolver.js +7 -4
- package/build/src/start/platforms/ios/AppleAppIdResolver.js.map +1 -1
- package/build/src/start/platforms/ios/AppleDeviceManager.js +80 -54
- package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
- package/build/src/start/platforms/ios/ApplePlatformManager.js +7 -4
- package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -1
- package/build/src/start/platforms/ios/assertSystemRequirements.js +11 -8
- package/build/src/start/platforms/ios/assertSystemRequirements.js.map +1 -1
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js +50 -29
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -1
- package/build/src/start/platforms/ios/getBestSimulator.js +53 -29
- package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
- package/build/src/start/platforms/ios/promptAppleDevice.js +18 -12
- package/build/src/start/platforms/ios/promptAppleDevice.js.map +1 -1
- package/build/src/start/platforms/ios/simctl.js +65 -42
- package/build/src/start/platforms/ios/simctl.js.map +1 -1
- package/build/src/start/platforms/ios/simctlLogging.js +67 -44
- package/build/src/start/platforms/ios/simctlLogging.js.map +1 -1
- package/build/src/start/platforms/ios/xcrun.js +8 -5
- package/build/src/start/platforms/ios/xcrun.js.map +1 -1
- package/build/src/start/project/devices.js +19 -16
- package/build/src/start/project/devices.js.map +1 -1
- package/build/src/start/project/dotExpo.js +13 -5
- package/build/src/start/project/dotExpo.js.map +1 -1
- package/build/src/start/project/settings.js +6 -4
- package/build/src/start/project/settings.js.map +1 -1
- package/build/src/start/resolveOptions.js +26 -19
- package/build/src/start/resolveOptions.js.map +1 -1
- package/build/src/start/server/AsyncNgrok.js +66 -46
- package/build/src/start/server/AsyncNgrok.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +64 -44
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +81 -69
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevToolsPluginManager.js +21 -16
- package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
- package/build/src/start/server/DevelopmentSession.js +49 -31
- package/build/src/start/server/DevelopmentSession.js.map +1 -1
- package/build/src/start/server/ReactDevToolsProxy.js +14 -6
- package/build/src/start/server/ReactDevToolsProxy.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +44 -23
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +46 -34
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +135 -108
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +24 -17
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +18 -8
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +31 -20
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
- package/build/src/start/server/metro/createJResolver.js +76 -51
- package/build/src/start/server/metro/createJResolver.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js +22 -14
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/debugging/MessageHandler.js +4 -1
- package/build/src/start/server/metro/debugging/MessageHandler.js.map +1 -1
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +10 -9
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
- package/build/src/start/server/metro/debugging/createHandlersFactory.js +14 -13
- package/build/src/start/server/metro/debugging/createHandlersFactory.js.map +1 -1
- package/build/src/start/server/metro/debugging/getDebuggerType.js +5 -2
- package/build/src/start/server/metro/debugging/getDebuggerType.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js +5 -2
- package/build/src/start/server/metro/debugging/messageHandlers/NetworkResponse.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/PageReload.js +5 -2
- package/build/src/start/server/metro/debugging/messageHandlers/PageReload.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerGetPossibleBreakpoints.js +7 -4
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerSetBreakpointByUrl.js +7 -4
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeDebuggerSetBreakpointByUrl.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeCallFunctionOn.js +7 -4
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeCallFunctionOn.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeGetProperties.js +7 -4
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeGetProperties.js.map +1 -1
- package/build/src/start/server/metro/debugging/pageIsSupported.js +4 -1
- package/build/src/start/server/metro/debugging/pageIsSupported.js.map +1 -1
- package/build/src/start/server/metro/externals.js +21 -10
- package/build/src/start/server/metro/externals.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js +20 -7
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/formatFileCandidates.js +21 -17
- package/build/src/start/server/metro/formatFileCandidates.js.map +1 -1
- package/build/src/start/server/metro/getCssModulesFromBundler.js +15 -7
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +57 -44
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +43 -34
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/metroErrors.js +11 -2
- package/build/src/start/server/metro/metroErrors.js.map +1 -1
- package/build/src/start/server/metro/metroVirtualModules.js +10 -2
- package/build/src/start/server/metro/metroVirtualModules.js.map +1 -1
- package/build/src/start/server/metro/metroWatchTypeScriptFiles.js +5 -2
- package/build/src/start/server/metro/metroWatchTypeScriptFiles.js.map +1 -1
- package/build/src/start/server/metro/router.js +27 -20
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +21 -14
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +7 -7
- package/build/src/start/server/metro/serializeHtml.js.map +1 -1
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +12 -4
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +107 -81
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js +72 -42
- package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
- package/build/src/start/server/middleware/ContextModuleSourceMapsMiddleware.js +4 -1
- package/build/src/start/server/middleware/ContextModuleSourceMapsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/CorsMiddleware.js +4 -1
- package/build/src/start/server/middleware/CorsMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/CreateFileMiddleware.js +13 -5
- package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +15 -12
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +30 -23
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ExpoMiddleware.js +47 -21
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/FaviconMiddleware.js +8 -5
- package/build/src/start/server/middleware/FaviconMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/HistoryFallbackMiddleware.js +6 -3
- package/build/src/start/server/middleware/HistoryFallbackMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js +23 -16
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +84 -60
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ReactDevToolsPageMiddleware.js +14 -7
- package/build/src/start/server/middleware/ReactDevToolsPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +47 -26
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ServeStaticMiddleware.js +11 -8
- package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +30 -24
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js +16 -8
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js +4 -2
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js +16 -12
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js +59 -37
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js +22 -16
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js.map +1 -1
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +9 -6
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/middlwareMutations.js +11 -4
- package/build/src/start/server/middleware/inspector/middlwareMutations.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +26 -18
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/middleware/mutations.js +11 -4
- package/build/src/start/server/middleware/mutations.js.map +1 -1
- package/build/src/start/server/middleware/resolveAssets.js +65 -41
- package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
- package/build/src/start/server/middleware/resolvePlatform.js +14 -6
- package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
- package/build/src/start/server/middleware/suppressErrorMiddleware.js +4 -1
- package/build/src/start/server/middleware/suppressErrorMiddleware.js.map +1 -1
- package/build/src/start/server/openPlatforms.js +7 -6
- package/build/src/start/server/openPlatforms.js.map +1 -1
- package/build/src/start/server/platformBundlers.js +5 -2
- package/build/src/start/server/platformBundlers.js.map +1 -1
- package/build/src/start/server/serverLogLikeMetro.js +62 -33
- package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
- package/build/src/start/server/type-generation/expo-env.js +12 -4
- package/build/src/start/server/type-generation/expo-env.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +52 -51
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +22 -19
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/start/server/type-generation/tsconfig.js +18 -11
- package/build/src/start/server/type-generation/tsconfig.js.map +1 -1
- package/build/src/start/server/webTemplate.js +21 -15
- package/build/src/start/server/webTemplate.js.map +1 -1
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +81 -56
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
- package/build/src/start/server/webpack/compile.js +47 -26
- package/build/src/start/server/webpack/compile.js.map +1 -1
- package/build/src/start/server/webpack/formatWebpackMessages.js +35 -25
- package/build/src/start/server/webpack/formatWebpackMessages.js.map +1 -1
- package/build/src/start/server/webpack/resolveFromProject.js +13 -5
- package/build/src/start/server/webpack/resolveFromProject.js.map +1 -1
- package/build/src/start/server/webpack/tls.js +54 -28
- package/build/src/start/server/webpack/tls.js.map +1 -1
- package/build/src/start/startAsync.js +73 -52
- package/build/src/start/startAsync.js.map +1 -1
- package/build/src/utils/FileNotifier.js +46 -25
- package/build/src/utils/FileNotifier.js.map +1 -1
- package/build/src/utils/analytics/getDevClientProperties.js +29 -21
- package/build/src/utils/analytics/getDevClientProperties.js.map +1 -1
- package/build/src/utils/analytics/getMetroDebugProperties.js +4 -1
- package/build/src/utils/analytics/getMetroDebugProperties.js.map +1 -1
- package/build/src/utils/analytics/getMetroProperties.js +4 -1
- package/build/src/utils/analytics/getMetroProperties.js.map +1 -1
- package/build/src/utils/analytics/metroDebuggerMiddleware.js +14 -6
- package/build/src/utils/analytics/metroDebuggerMiddleware.js.map +1 -1
- package/build/src/utils/ansi.js +5 -2
- package/build/src/utils/ansi.js.map +1 -1
- package/build/src/utils/args.js +57 -29
- package/build/src/utils/args.js.map +1 -1
- package/build/src/utils/array.js +16 -9
- package/build/src/utils/array.js.map +1 -1
- package/build/src/utils/cocoapods.js +77 -53
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/codesigning.js +80 -58
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/createFileTransform.js +13 -5
- package/build/src/utils/createFileTransform.js.map +1 -1
- package/build/src/utils/delay.js +13 -6
- package/build/src/utils/delay.js.map +1 -1
- package/build/src/utils/dir.js +24 -21
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/downloadAppAsync.js +16 -13
- package/build/src/utils/downloadAppAsync.js.map +1 -1
- package/build/src/utils/downloadExpoGoAsync.js +26 -20
- package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
- package/build/src/utils/editor.js +50 -24
- package/build/src/utils/editor.js.map +1 -1
- package/build/src/utils/env.js +35 -33
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/errors.js +17 -9
- package/build/src/utils/errors.js.map +1 -1
- package/build/src/utils/exit.js +10 -7
- package/build/src/utils/exit.js.map +1 -1
- package/build/src/utils/findUp.js +22 -4
- package/build/src/utils/findUp.js.map +1 -1
- package/build/src/utils/fn.js +11 -3
- package/build/src/utils/fn.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +71 -45
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/getRunningProcess.js +52 -26
- package/build/src/utils/getRunningProcess.js.map +1 -1
- package/build/src/utils/git.js +64 -38
- package/build/src/utils/git.js.map +1 -1
- package/build/src/utils/glob.js +14 -9
- package/build/src/utils/glob.js.map +1 -1
- package/build/src/utils/interactive.js +5 -2
- package/build/src/utils/interactive.js.map +1 -1
- package/build/src/utils/ip.js +5 -2
- package/build/src/utils/ip.js.map +1 -1
- package/build/src/utils/isModuleSymlinked.js +7 -4
- package/build/src/utils/isModuleSymlinked.js.map +1 -1
- package/build/src/utils/link.js +13 -5
- package/build/src/utils/link.js.map +1 -1
- package/build/src/utils/mergeGitIgnorePaths.js +22 -17
- package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
- package/build/src/utils/modifyConfigAsync.js +56 -30
- package/build/src/utils/modifyConfigAsync.js.map +1 -1
- package/build/src/utils/modifyConfigPlugins.js +43 -22
- package/build/src/utils/modifyConfigPlugins.js.map +1 -1
- package/build/src/utils/nodeEnv.js +6 -1
- package/build/src/utils/nodeEnv.js.map +1 -1
- package/build/src/utils/nodeModules.js +9 -6
- package/build/src/utils/nodeModules.js.map +1 -1
- package/build/src/utils/npm.js +32 -24
- package/build/src/utils/npm.js.map +1 -1
- package/build/src/utils/obj.js +12 -4
- package/build/src/utils/obj.js.map +1 -1
- package/build/src/utils/open.js +7 -4
- package/build/src/utils/open.js.map +1 -1
- package/build/src/utils/ora.js +25 -21
- package/build/src/utils/ora.js.map +1 -1
- package/build/src/utils/plist.js +53 -27
- package/build/src/utils/plist.js.map +1 -1
- package/build/src/utils/port.js +58 -32
- package/build/src/utils/port.js.map +1 -1
- package/build/src/utils/profile.js +49 -28
- package/build/src/utils/profile.js.map +1 -1
- package/build/src/utils/progress.js +16 -12
- package/build/src/utils/progress.js.map +1 -1
- package/build/src/utils/prompts.js +33 -28
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/utils/resolveArgs.js +23 -20
- package/build/src/utils/resolveArgs.js.map +1 -1
- package/build/src/utils/scheme.js +61 -37
- package/build/src/utils/scheme.js.map +1 -1
- package/build/src/utils/strings.js +11 -4
- package/build/src/utils/strings.js.map +1 -1
- package/build/src/utils/tar.js +43 -22
- package/build/src/utils/tar.js.map +1 -1
- package/build/src/utils/telemetry/DetachedClient.js +8 -5
- package/build/src/utils/telemetry/DetachedClient.js.map +1 -1
- package/build/src/utils/telemetry/RudderClient.js +12 -9
- package/build/src/utils/telemetry/RudderClient.js.map +1 -1
- package/build/src/utils/telemetry/flushDetached.js +8 -7
- package/build/src/utils/telemetry/flushDetached.js.map +1 -1
- package/build/src/utils/telemetry/getContext.js +48 -28
- package/build/src/utils/telemetry/getContext.js.map +1 -1
- package/build/src/utils/telemetry/index.js +16 -11
- package/build/src/utils/telemetry/index.js.map +1 -1
- package/build/src/utils/template.js +27 -2
- package/build/src/utils/template.js.map +1 -1
- package/build/src/utils/terminal.js +5 -2
- package/build/src/utils/terminal.js.map +1 -1
- package/build/src/utils/tsconfig/evaluateTsConfig.js +18 -12
- package/build/src/utils/tsconfig/evaluateTsConfig.js.map +1 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js +18 -10
- package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -1
- package/build/src/utils/tsconfig/matchTsConfigPathAlias.js +8 -4
- package/build/src/utils/tsconfig/matchTsConfigPathAlias.js.map +1 -1
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +12 -9
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -1
- package/build/src/utils/url.js +17 -10
- package/build/src/utils/url.js.map +1 -1
- package/build/src/utils/validateApplicationId.js +32 -25
- package/build/src/utils/validateApplicationId.js.map +1 -1
- package/build/src/utils/variadic.js +15 -11
- package/build/src/utils/variadic.js.map +1 -1
- package/build/src/whoami/index.js +43 -25
- package/build/src/whoami/index.js.map +1 -1
- package/build/src/whoami/whoamiAsync.js +44 -23
- package/build/src/whoami/whoamiAsync.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/instantiateMetro.ts"],"sourcesContent":["import { ExpoConfig, getConfig } from '@expo/config';\nimport { getDefaultConfig, LoadOptions } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport { Server as ConnectServer } from 'connect';\nimport http from 'http';\nimport type Metro from 'metro';\nimport Bundler from 'metro/src/Bundler';\nimport { loadConfig, resolveConfig, ConfigT } from 'metro-config';\nimport { Terminal } from 'metro-core';\nimport util from 'node:util';\nimport semver from 'semver';\nimport { URL } from 'url';\n\nimport { MetroBundlerDevServer } from './MetroBundlerDevServer';\nimport { MetroTerminalReporter } from './MetroTerminalReporter';\nimport { createDebugMiddleware } from './debugging/createDebugMiddleware';\nimport { runServer } from './runServer-fork';\nimport { withMetroMultiPlatformAsync } from './withMetroMultiPlatform';\nimport { MetroDevServerOptions } from '../../../export/fork-bundleAsync';\nimport { Log } from '../../../log';\nimport { getMetroProperties } from '../../../utils/analytics/getMetroProperties';\nimport { createDebuggerTelemetryMiddleware } from '../../../utils/analytics/metroDebuggerMiddleware';\nimport { env } from '../../../utils/env';\nimport { logEventAsync } from '../../../utils/telemetry';\nimport { createCorsMiddleware } from '../middleware/CorsMiddleware';\nimport { getMetroServerRoot } from '../middleware/ManifestMiddleware';\nimport { createJsInspectorMiddleware } from '../middleware/inspector/createJsInspectorMiddleware';\nimport { prependMiddleware, replaceMiddlewareWith } from '../middleware/mutations';\nimport { ServerNext, ServerRequest, ServerResponse } from '../middleware/server.types';\nimport { suppressRemoteDebuggingErrorMiddleware } from '../middleware/suppressErrorMiddleware';\nimport { getPlatformBundlers } from '../platformBundlers';\n// From expo/dev-server but with ability to use custom logger.\ntype MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\nfunction gteSdkVersion(exp: Pick<ExpoConfig, 'sdkVersion'>, sdkVersion: string): boolean {\n if (!exp.sdkVersion) {\n return false;\n }\n\n if (exp.sdkVersion === 'UNVERSIONED') {\n return true;\n }\n\n try {\n return semver.gte(exp.sdkVersion, sdkVersion);\n } catch {\n throw new Error(`${exp.sdkVersion} is not a valid version. Must be in the form of x.y.z`);\n }\n}\n\n// Wrap terminal and polyfill console.log so we can log during bundling without breaking the indicator.\nclass LogRespectingTerminal extends Terminal {\n constructor(stream: import('node:net').Socket | import('node:stream').Writable) {\n super(stream);\n\n const sendLog = (...args: any[]) => {\n // @ts-expect-error\n this._logLines.push(\n // format args like console.log\n util.format(...args)\n );\n // @ts-expect-error\n this._scheduleUpdate();\n\n // Flush the logs to the terminal immediately so logs at the end of the process are not lost.\n this.flush();\n };\n\n console.log = sendLog;\n console.info = sendLog;\n }\n}\n\n// Share one instance of Terminal for all instances of Metro.\nconst terminal = new LogRespectingTerminal(process.stdout);\n\nexport async function loadMetroConfigAsync(\n projectRoot: string,\n options: LoadOptions,\n {\n exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp,\n isExporting,\n getMetroBundler,\n }: { exp?: ExpoConfig; isExporting: boolean; getMetroBundler: () => Bundler }\n) {\n let reportEvent: ((event: any) => void) | undefined;\n const serverRoot = getMetroServerRoot(projectRoot);\n const terminalReporter = new MetroTerminalReporter(serverRoot, terminal);\n\n const hasConfig = await resolveConfig(options.config, projectRoot);\n let config: ConfigT = {\n ...(await loadConfig(\n { cwd: projectRoot, projectRoot, ...options },\n // If the project does not have a metro.config.js, then we use the default config.\n hasConfig.isEmpty ? getDefaultConfig(projectRoot) : undefined\n )),\n reporter: {\n update(event: any) {\n terminalReporter.update(event);\n if (reportEvent) {\n reportEvent(event);\n }\n },\n },\n };\n\n if (\n // Requires SDK 50 for expo-assets hashAssetPlugin change.\n !exp.sdkVersion ||\n gteSdkVersion(exp, '50.0.0')\n ) {\n if (isExporting) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = `/assets?export_path=${\n (exp.experiments?.baseUrl ?? '') + '/assets'\n }`;\n } else {\n // @ts-expect-error: typed as readonly\n config.transformer.publicPath = '/assets/?unstable_path=.';\n }\n } else {\n if (isExporting && exp.experiments?.baseUrl) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = exp.experiments?.baseUrl;\n }\n }\n\n const platformBundlers = getPlatformBundlers(projectRoot, exp);\n\n config = await withMetroMultiPlatformAsync(projectRoot, {\n config,\n exp,\n platformBundlers,\n isTsconfigPathsEnabled: exp.experiments?.tsconfigPaths ?? true,\n webOutput: exp.web?.output ?? 'single',\n isFastResolverEnabled: env.EXPO_USE_FAST_RESOLVER,\n isExporting,\n isReactCanaryEnabled: exp.experiments?.reactCanary ?? false,\n getMetroBundler,\n });\n\n if (process.env.NODE_ENV !== 'test') {\n logEventAsync('metro config', getMetroProperties(projectRoot, exp, config));\n }\n\n return {\n config,\n setEventReporter: (logger: (event: any) => void) => (reportEvent = logger),\n reporter: terminalReporter,\n };\n}\n\n/** The most generic possible setup for Metro bundler. */\nexport async function instantiateMetroAsync(\n metroBundler: MetroBundlerDevServer,\n options: Omit<MetroDevServerOptions, 'logger'>,\n { isExporting }: { isExporting: boolean }\n): Promise<{\n metro: Metro.Server;\n server: http.Server;\n middleware: any;\n messageSocket: MessageSocket;\n}> {\n const projectRoot = metroBundler.projectRoot;\n\n // TODO: When we bring expo/metro-config into the expo/expo repo, then we can upstream this.\n const { exp } = getConfig(projectRoot, {\n skipSDKVersionRequirement: true,\n });\n\n const { config: metroConfig, setEventReporter } = await loadMetroConfigAsync(\n projectRoot,\n options,\n {\n exp,\n isExporting,\n getMetroBundler() {\n return metro.getBundler().getBundler();\n },\n }\n );\n\n const { createDevServerMiddleware, securityHeadersMiddleware } =\n require('@react-native-community/cli-server-api') as typeof import('@react-native-community/cli-server-api');\n\n const { middleware, messageSocketEndpoint, eventsSocketEndpoint, websocketEndpoints } =\n createDevServerMiddleware({\n port: metroConfig.server.port,\n watchFolders: metroConfig.watchFolders,\n });\n\n // The `securityHeadersMiddleware` does not support cross-origin requests, we replace with the enhanced version.\n replaceMiddlewareWith(\n middleware as ConnectServer,\n securityHeadersMiddleware,\n createCorsMiddleware(exp)\n );\n\n prependMiddleware(middleware, suppressRemoteDebuggingErrorMiddleware);\n\n // TODO: We can probably drop this now.\n const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;\n // @ts-expect-error: can't mutate readonly config\n metroConfig.server.enhanceMiddleware = (metroMiddleware: any, server: Metro.Server) => {\n if (customEnhanceMiddleware) {\n metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);\n }\n return middleware.use(metroMiddleware);\n };\n\n middleware.use(createDebuggerTelemetryMiddleware(projectRoot, exp));\n\n // Initialize all React Native debug features\n const { debugMiddleware, debugWebsocketEndpoints } = createDebugMiddleware(metroBundler);\n prependMiddleware(middleware, debugMiddleware);\n middleware.use('/_expo/debugger', createJsInspectorMiddleware());\n\n const { server, metro } = await runServer(metroBundler, metroConfig, {\n // @ts-expect-error: Inconsistent `websocketEndpoints` type between metro and @react-native-community/cli-server-api\n websocketEndpoints: {\n ...websocketEndpoints,\n ...debugWebsocketEndpoints,\n },\n watch: !isExporting && isWatchEnabled(),\n });\n\n prependMiddleware(middleware, (req: ServerRequest, res: ServerResponse, next: ServerNext) => {\n // If the URL is a Metro asset request, then we need to skip all other middleware to prevent\n // the community CLI's serve-static from hosting `/assets/index.html` in place of all assets if it exists.\n // /assets/?unstable_path=.\n if (req.url) {\n const url = new URL(req.url!, 'http://localhost:8000');\n if (url.pathname.match(/^\\/assets\\/?/) && url.searchParams.get('unstable_path') != null) {\n return metro.processRequest(req, res, next);\n }\n }\n return next();\n });\n\n setEventReporter(eventsSocketEndpoint.reportEvent);\n\n return {\n metro,\n server,\n middleware,\n messageSocket: messageSocketEndpoint,\n };\n}\n\n/**\n * Simplify and communicate if Metro is running without watching file updates,.\n * Exposed for testing.\n */\nexport function isWatchEnabled() {\n if (env.CI) {\n Log.log(\n chalk`Metro is running in CI mode, reloads are disabled. Remove {bold CI=true} to enable watch mode.`\n );\n }\n\n return !env.CI;\n}\n"],"names":["loadMetroConfigAsync","instantiateMetroAsync","isWatchEnabled","gteSdkVersion","exp","sdkVersion","semver","gte","Error","LogRespectingTerminal","Terminal","constructor","stream","sendLog","args","_logLines","push","util","format","_scheduleUpdate","flush","console","log","info","terminal","process","stdout","projectRoot","options","getConfig","skipSDKVersionRequirement","isExporting","getMetroBundler","reportEvent","serverRoot","getMetroServerRoot","terminalReporter","MetroTerminalReporter","hasConfig","resolveConfig","config","loadConfig","cwd","isEmpty","getDefaultConfig","undefined","reporter","update","event","transformer","publicPath","experiments","baseUrl","platformBundlers","getPlatformBundlers","withMetroMultiPlatformAsync","isTsconfigPathsEnabled","tsconfigPaths","webOutput","web","output","isFastResolverEnabled","env","EXPO_USE_FAST_RESOLVER","isReactCanaryEnabled","reactCanary","NODE_ENV","logEventAsync","getMetroProperties","setEventReporter","logger","metroBundler","metroConfig","metro","getBundler","createDevServerMiddleware","securityHeadersMiddleware","require","middleware","messageSocketEndpoint","eventsSocketEndpoint","websocketEndpoints","port","server","watchFolders","replaceMiddlewareWith","createCorsMiddleware","prependMiddleware","suppressRemoteDebuggingErrorMiddleware","customEnhanceMiddleware","enhanceMiddleware","metroMiddleware","use","createDebuggerTelemetryMiddleware","debugMiddleware","debugWebsocketEndpoints","createDebugMiddleware","createJsInspectorMiddleware","runServer","watch","req","res","next","url","URL","pathname","match","searchParams","get","processRequest","messageSocket","CI","Log","chalk"],"mappings":"AAAA;;;;QA8EsBA,oBAAoB,GAApBA,oBAAoB;QA+EpBC,qBAAqB,GAArBA,qBAAqB;QAoG3BC,cAAc,GAAdA,cAAc;SAjQQ,OAAc;yBAAd,cAAc;IAAd,OAAc;;;;;SACN,YAAoB;yBAApB,oBAAoB;IAApB,YAAoB;;;;;SAChD,MAAO;gDAAP,OAAO;IAAP,MAAO;;;;;SAK0B,aAAc;yBAAd,cAAc;IAAd,aAAc;;;;;AACxC,IAAA,UAAY,WAAZ,YAAY,CAAA;SACpB,SAAW;gDAAX,WAAW;IAAX,SAAW;;;;;SACT,OAAQ;gDAAR,QAAQ;IAAR,OAAQ;;;;;SACP,IAAK;yBAAL,KAAK;IAAL,IAAK;;;;;AAGa,IAAA,sBAAyB,WAAzB,yBAAyB,CAAA;AACzB,IAAA,sBAAmC,WAAnC,mCAAmC,CAAA;AAC/C,IAAA,cAAkB,WAAlB,kBAAkB,CAAA;AACA,IAAA,uBAA0B,WAA1B,0BAA0B,CAAA;AAElD,IAAA,IAAc,WAAd,cAAc,CAAA;AACC,IAAA,mBAA6C,WAA7C,6CAA6C,CAAA;AAC9B,IAAA,wBAAkD,WAAlD,kDAAkD,CAAA;AAChF,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACV,IAAA,UAA0B,WAA1B,0BAA0B,CAAA;AACnB,IAAA,eAA8B,WAA9B,8BAA8B,CAAA;AAChC,IAAA,mBAAkC,WAAlC,kCAAkC,CAAA;AACzB,IAAA,4BAAqD,WAArD,qD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ACNL,UAAU;QACVgC,aAAa,EAAE/B,qBAAqB;KACrC,CAAC;CACH;AAMM,SAAS7E,cAAc,GAAG;IAC/B,IAAI4D,IAAG,IAAA,CAACiD,EAAE,EAAE;QACVC,IAAG,IAAA,CAAC1F,GAAG,CACL2F,MAAK,UAAA,CAAC,8FAA8F,CAAC,CACtG,CAAC;KACH;IAED,OAAO,CAACnD,IAAG,IAAA,CAACiD,EAAE,CAAC;CAChB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/instantiateMetro.ts"],"sourcesContent":["import { ExpoConfig, getConfig } from '@expo/config';\nimport { getDefaultConfig, LoadOptions } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport { Server as ConnectServer } from 'connect';\nimport http from 'http';\nimport type Metro from 'metro';\nimport Bundler from 'metro/src/Bundler';\nimport { loadConfig, resolveConfig, ConfigT } from 'metro-config';\nimport { Terminal } from 'metro-core';\nimport util from 'node:util';\nimport semver from 'semver';\nimport { URL } from 'url';\n\nimport { MetroBundlerDevServer } from './MetroBundlerDevServer';\nimport { MetroTerminalReporter } from './MetroTerminalReporter';\nimport { createDebugMiddleware } from './debugging/createDebugMiddleware';\nimport { runServer } from './runServer-fork';\nimport { withMetroMultiPlatformAsync } from './withMetroMultiPlatform';\nimport { MetroDevServerOptions } from '../../../export/fork-bundleAsync';\nimport { Log } from '../../../log';\nimport { getMetroProperties } from '../../../utils/analytics/getMetroProperties';\nimport { createDebuggerTelemetryMiddleware } from '../../../utils/analytics/metroDebuggerMiddleware';\nimport { env } from '../../../utils/env';\nimport { logEventAsync } from '../../../utils/telemetry';\nimport { createCorsMiddleware } from '../middleware/CorsMiddleware';\nimport { getMetroServerRoot } from '../middleware/ManifestMiddleware';\nimport { createJsInspectorMiddleware } from '../middleware/inspector/createJsInspectorMiddleware';\nimport { prependMiddleware, replaceMiddlewareWith } from '../middleware/mutations';\nimport { ServerNext, ServerRequest, ServerResponse } from '../middleware/server.types';\nimport { suppressRemoteDebuggingErrorMiddleware } from '../middleware/suppressErrorMiddleware';\nimport { getPlatformBundlers } from '../platformBundlers';\n// From expo/dev-server but with ability to use custom logger.\ntype MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\nfunction gteSdkVersion(exp: Pick<ExpoConfig, 'sdkVersion'>, sdkVersion: string): boolean {\n if (!exp.sdkVersion) {\n return false;\n }\n\n if (exp.sdkVersion === 'UNVERSIONED') {\n return true;\n }\n\n try {\n return semver.gte(exp.sdkVersion, sdkVersion);\n } catch {\n throw new Error(`${exp.sdkVersion} is not a valid version. Must be in the form of x.y.z`);\n }\n}\n\n// Wrap terminal and polyfill console.log so we can log during bundling without breaking the indicator.\nclass LogRespectingTerminal extends Terminal {\n constructor(stream: import('node:net').Socket | import('node:stream').Writable) {\n super(stream);\n\n const sendLog = (...args: any[]) => {\n // @ts-expect-error\n this._logLines.push(\n // format args like console.log\n util.format(...args)\n );\n // @ts-expect-error\n this._scheduleUpdate();\n\n // Flush the logs to the terminal immediately so logs at the end of the process are not lost.\n this.flush();\n };\n\n console.log = sendLog;\n console.info = sendLog;\n }\n}\n\n// Share one instance of Terminal for all instances of Metro.\nconst terminal = new LogRespectingTerminal(process.stdout);\n\nexport async function loadMetroConfigAsync(\n projectRoot: string,\n options: LoadOptions,\n {\n exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp,\n isExporting,\n getMetroBundler,\n }: { exp?: ExpoConfig; isExporting: boolean; getMetroBundler: () => Bundler }\n) {\n let reportEvent: ((event: any) => void) | undefined;\n const serverRoot = getMetroServerRoot(projectRoot);\n const terminalReporter = new MetroTerminalReporter(serverRoot, terminal);\n\n const hasConfig = await resolveConfig(options.config, projectRoot);\n let config: ConfigT = {\n ...(await loadConfig(\n { cwd: projectRoot, projectRoot, ...options },\n // If the project does not have a metro.config.js, then we use the default config.\n hasConfig.isEmpty ? getDefaultConfig(projectRoot) : undefined\n )),\n reporter: {\n update(event: any) {\n terminalReporter.update(event);\n if (reportEvent) {\n reportEvent(event);\n }\n },\n },\n };\n\n if (\n // Requires SDK 50 for expo-assets hashAssetPlugin change.\n !exp.sdkVersion ||\n gteSdkVersion(exp, '50.0.0')\n ) {\n if (isExporting) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = `/assets?export_path=${\n (exp.experiments?.baseUrl ?? '') + '/assets'\n }`;\n } else {\n // @ts-expect-error: typed as readonly\n config.transformer.publicPath = '/assets/?unstable_path=.';\n }\n } else {\n if (isExporting && exp.experiments?.baseUrl) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = exp.experiments?.baseUrl;\n }\n }\n\n const platformBundlers = getPlatformBundlers(projectRoot, exp);\n\n config = await withMetroMultiPlatformAsync(projectRoot, {\n config,\n exp,\n platformBundlers,\n isTsconfigPathsEnabled: exp.experiments?.tsconfigPaths ?? true,\n webOutput: exp.web?.output ?? 'single',\n isFastResolverEnabled: env.EXPO_USE_FAST_RESOLVER,\n isExporting,\n isReactCanaryEnabled: exp.experiments?.reactCanary ?? false,\n getMetroBundler,\n });\n\n if (process.env.NODE_ENV !== 'test') {\n logEventAsync('metro config', getMetroProperties(projectRoot, exp, config));\n }\n\n return {\n config,\n setEventReporter: (logger: (event: any) => void) => (reportEvent = logger),\n reporter: terminalReporter,\n };\n}\n\n/** The most generic possible setup for Metro bundler. */\nexport async function instantiateMetroAsync(\n metroBundler: MetroBundlerDevServer,\n options: Omit<MetroDevServerOptions, 'logger'>,\n { isExporting }: { isExporting: boolean }\n): Promise<{\n metro: Metro.Server;\n server: http.Server;\n middleware: any;\n messageSocket: MessageSocket;\n}> {\n const projectRoot = metroBundler.projectRoot;\n\n // TODO: When we bring expo/metro-config into the expo/expo repo, then we can upstream this.\n const { exp } = getConfig(projectRoot, {\n skipSDKVersionRequirement: true,\n });\n\n const { config: metroConfig, setEventReporter } = await loadMetroConfigAsync(\n projectRoot,\n options,\n {\n exp,\n isExporting,\n getMetroBundler() {\n return metro.getBundler().getBundler();\n },\n }\n );\n\n const { createDevServerMiddleware, securityHeadersMiddleware } =\n require('@react-native-community/cli-server-api') as typeof import('@react-native-community/cli-server-api');\n\n const { middleware, messageSocketEndpoint, eventsSocketEndpoint, websocketEndpoints } =\n createDevServerMiddleware({\n port: metroConfig.server.port,\n watchFolders: metroConfig.watchFolders,\n });\n\n // The `securityHeadersMiddleware` does not support cross-origin requests, we replace with the enhanced version.\n replaceMiddlewareWith(\n middleware as ConnectServer,\n securityHeadersMiddleware,\n createCorsMiddleware(exp)\n );\n\n prependMiddleware(middleware, suppressRemoteDebuggingErrorMiddleware);\n\n // TODO: We can probably drop this now.\n const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;\n // @ts-expect-error: can't mutate readonly config\n metroConfig.server.enhanceMiddleware = (metroMiddleware: any, server: Metro.Server) => {\n if (customEnhanceMiddleware) {\n metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);\n }\n return middleware.use(metroMiddleware);\n };\n\n middleware.use(createDebuggerTelemetryMiddleware(projectRoot, exp));\n\n // Initialize all React Native debug features\n const { debugMiddleware, debugWebsocketEndpoints } = createDebugMiddleware(metroBundler);\n prependMiddleware(middleware, debugMiddleware);\n middleware.use('/_expo/debugger', createJsInspectorMiddleware());\n\n const { server, metro } = await runServer(metroBundler, metroConfig, {\n // @ts-expect-error: Inconsistent `websocketEndpoints` type between metro and @react-native-community/cli-server-api\n websocketEndpoints: {\n ...websocketEndpoints,\n ...debugWebsocketEndpoints,\n },\n watch: !isExporting && isWatchEnabled(),\n });\n\n prependMiddleware(middleware, (req: ServerRequest, res: ServerResponse, next: ServerNext) => {\n // If the URL is a Metro asset request, then we need to skip all other middleware to prevent\n // the community CLI's serve-static from hosting `/assets/index.html` in place of all assets if it exists.\n // /assets/?unstable_path=.\n if (req.url) {\n const url = new URL(req.url!, 'http://localhost:8000');\n if (url.pathname.match(/^\\/assets\\/?/) && url.searchParams.get('unstable_path') != null) {\n return metro.processRequest(req, res, next);\n }\n }\n return next();\n });\n\n setEventReporter(eventsSocketEndpoint.reportEvent);\n\n return {\n metro,\n server,\n middleware,\n messageSocket: messageSocketEndpoint,\n };\n}\n\n/**\n * Simplify and communicate if Metro is running without watching file updates,.\n * Exposed for testing.\n */\nexport function isWatchEnabled() {\n if (env.CI) {\n Log.log(\n chalk`Metro is running in CI mode, reloads are disabled. Remove {bold CI=true} to enable watch mode.`\n );\n }\n\n return !env.CI;\n}\n"],"names":["loadMetroConfigAsync","instantiateMetroAsync","isWatchEnabled","gteSdkVersion","exp","sdkVersion","semver","gte","Error","LogRespectingTerminal","Terminal","constructor","stream","sendLog","args","_logLines","push","util","format","_scheduleUpdate","flush","console","log","info","terminal","process","stdout","projectRoot","options","getConfig","skipSDKVersionRequirement","isExporting","getMetroBundler","reportEvent","serverRoot","getMetroServerRoot","terminalReporter","MetroTerminalReporter","hasConfig","resolveConfig","config","loadConfig","cwd","isEmpty","getDefaultConfig","undefined","reporter","update","event","transformer","publicPath","experiments","baseUrl","platformBundlers","getPlatformBundlers","withMetroMultiPlatformAsync","isTsconfigPathsEnabled","tsconfigPaths","webOutput","web","output","isFastResolverEnabled","env","EXPO_USE_FAST_RESOLVER","isReactCanaryEnabled","reactCanary","NODE_ENV","logEventAsync","getMetroProperties","setEventReporter","logger","metroBundler","metroConfig","metro","getBundler","createDevServerMiddleware","securityHeadersMiddleware","require","middleware","messageSocketEndpoint","eventsSocketEndpoint","websocketEndpoints","port","server","watchFolders","replaceMiddlewareWith","createCorsMiddleware","prependMiddleware","suppressRemoteDebuggingErrorMiddleware","customEnhanceMiddleware","enhanceMiddleware","metroMiddleware","use","createDebuggerTelemetryMiddleware","debugMiddleware","debugWebsocketEndpoints","createDebugMiddleware","createJsInspectorMiddleware","runServer","watch","req","res","next","url","URL","pathname","match","searchParams","get","processRequest","messageSocket","CI","Log","chalk"],"mappings":"AAAA;;;;;;;;;;;IA8EsBA,oBAAoB,MAApBA,oBAAoB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G,EAAEC,GAAG,EAAEC,IAAI,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;QACD,OAAOA,IAAI,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;IAEHjC,gBAAgB,CAACW,oBAAoB,CAAC/C,WAAW,CAAC,CAAC;IAEnD,OAAO;QACLwC,KAAK;QACLU,MAAM;QACNL,UAAU;QACVgC,aAAa,EAAE/B,qBAAqB;KACrC,CAAC;AACJ,CAAC;AAMM,SAAS7E,cAAc,GAAG;IAC/B,IAAI4D,IAAG,IAAA,CAACiD,EAAE,EAAE;QACVC,IAAG,IAAA,CAAC1F,GAAG,CACL2F,IAAAA,MAAK,EAAA,QAAA,CAAA,CAAC,8FAA8F,CAAC,CACtG,CAAC;IACJ,CAAC;IAED,OAAO,CAACnD,IAAG,IAAA,CAACiD,EAAE,CAAC;AACjB,CAAC"}
|
|
@@ -1,35 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2022 650 Industries.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/ "use strict";
|
|
2
7
|
Object.defineProperty(exports, "__esModule", {
|
|
3
8
|
value: true
|
|
4
9
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
function _export(target, all) {
|
|
11
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: all[name]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
_export(exports, {
|
|
17
|
+
logMetroErrorWithStack: ()=>logMetroErrorWithStack,
|
|
18
|
+
logMetroError: ()=>logMetroError,
|
|
19
|
+
logMetroErrorAsync: ()=>logMetroErrorAsync,
|
|
20
|
+
getErrorOverlayHtmlAsync: ()=>getErrorOverlayHtmlAsync
|
|
21
|
+
});
|
|
9
22
|
function _chalk() {
|
|
10
|
-
const data = _interopRequireDefault(require("chalk"));
|
|
23
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("chalk"));
|
|
11
24
|
_chalk = function() {
|
|
12
25
|
return data;
|
|
13
26
|
};
|
|
14
27
|
return data;
|
|
15
28
|
}
|
|
16
29
|
function _resolveFrom() {
|
|
17
|
-
const data = _interopRequireDefault(require("resolve-from"));
|
|
30
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("resolve-from"));
|
|
18
31
|
_resolveFrom = function() {
|
|
19
32
|
return data;
|
|
20
33
|
};
|
|
21
34
|
return data;
|
|
22
35
|
}
|
|
23
36
|
function _terminalLink() {
|
|
24
|
-
const data = _interopRequireDefault(require("terminal-link"));
|
|
37
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("terminal-link"));
|
|
25
38
|
_terminalLink = function() {
|
|
26
39
|
return data;
|
|
27
40
|
};
|
|
28
41
|
return data;
|
|
29
42
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
43
|
+
const _log = require("../../../log");
|
|
44
|
+
const _errors = require("../../../utils/errors");
|
|
45
|
+
const _getStaticRenderFunctions = require("../getStaticRenderFunctions");
|
|
33
46
|
function _interopRequireDefault(obj) {
|
|
34
47
|
return obj && obj.__esModule ? obj : {
|
|
35
48
|
default: obj
|
|
@@ -51,7 +64,7 @@ async function logMetroErrorWithStack(projectRoot, { stack , codeFrame , error
|
|
|
51
64
|
}
|
|
52
65
|
// process.stdout.write('\u001b[0m'); // Reset attributes
|
|
53
66
|
// process.stdout.write('\u001bc'); // Reset the terminal
|
|
54
|
-
const { getStackFormattedLocation } = require(_resolveFrom().default(projectRoot, "@expo/metro-runtime/symbolicate"));
|
|
67
|
+
const { getStackFormattedLocation } = require((0, _resolveFrom().default)(projectRoot, "@expo/metro-runtime/symbolicate"));
|
|
55
68
|
_log.Log.log();
|
|
56
69
|
_log.Log.log(_chalk().default.red("Metro error: ") + error.message);
|
|
57
70
|
_log.Log.log();
|
|
@@ -59,8 +72,7 @@ async function logMetroErrorWithStack(projectRoot, { stack , codeFrame , error
|
|
|
59
72
|
var ref;
|
|
60
73
|
const maxWarningLineLength = Math.max(200, process.stdout.columns);
|
|
61
74
|
const lineText = codeFrame.content;
|
|
62
|
-
const isPreviewTooLong = codeFrame.content.split("\n").some((line)=>line.length > maxWarningLineLength
|
|
63
|
-
);
|
|
75
|
+
const isPreviewTooLong = codeFrame.content.split("\n").some((line)=>line.length > maxWarningLineLength);
|
|
64
76
|
const column = (ref = codeFrame.location) == null ? void 0 : ref.column;
|
|
65
77
|
// When the preview is too long, we skip reading the file and attempting to apply
|
|
66
78
|
// code coloring, this is because it can get very slow.
|
|
@@ -118,7 +130,7 @@ async function logMetroErrorWithStack(projectRoot, { stack , codeFrame , error
|
|
|
118
130
|
};
|
|
119
131
|
});
|
|
120
132
|
stackProps.forEach((frame)=>{
|
|
121
|
-
const position = _terminalLink().default.isSupported ? _terminalLink().default(frame.subtitle, frame.subtitle) : frame.subtitle;
|
|
133
|
+
const position = _terminalLink().default.isSupported ? (0, _terminalLink().default)(frame.subtitle, frame.subtitle) : frame.subtitle;
|
|
122
134
|
let lineItem = _chalk().default.gray(` ${frame.title} (${position})`);
|
|
123
135
|
if (frame.collapse) {
|
|
124
136
|
lineItem = _chalk().default.dim(lineItem);
|
|
@@ -130,11 +142,11 @@ async function logMetroErrorWithStack(projectRoot, { stack , codeFrame , error
|
|
|
130
142
|
}
|
|
131
143
|
}
|
|
132
144
|
async function logMetroError(projectRoot, { error }) {
|
|
133
|
-
var ref,
|
|
145
|
+
var ref, ref1;
|
|
134
146
|
if (error instanceof _errors.SilentError) {
|
|
135
147
|
return;
|
|
136
148
|
}
|
|
137
|
-
const { LogBoxLog , parseErrorStack } = require(_resolveFrom().default(projectRoot, "@expo/metro-runtime/symbolicate"));
|
|
149
|
+
const { LogBoxLog , parseErrorStack } = require((0, _resolveFrom().default)(projectRoot, "@expo/metro-runtime/symbolicate"));
|
|
138
150
|
const stack = parseErrorStack(error.stack);
|
|
139
151
|
const log = new LogBoxLog({
|
|
140
152
|
level: "static",
|
|
@@ -147,17 +159,16 @@ async function logMetroError(projectRoot, { error }) {
|
|
|
147
159
|
category: "static",
|
|
148
160
|
componentStack: []
|
|
149
161
|
});
|
|
150
|
-
await new Promise((res)=>log.symbolicate("stack", res)
|
|
151
|
-
|
|
152
|
-
var ref6;
|
|
162
|
+
await new Promise((res)=>log.symbolicate("stack", res));
|
|
163
|
+
var ref2;
|
|
153
164
|
logMetroErrorWithStack(projectRoot, {
|
|
154
|
-
stack: (
|
|
165
|
+
stack: (ref2 = (ref = log.symbolicated) == null ? void 0 : (ref1 = ref.stack) == null ? void 0 : ref1.stack) != null ? ref2 : [],
|
|
155
166
|
codeFrame: log.codeFrame,
|
|
156
167
|
error
|
|
157
168
|
});
|
|
158
169
|
}
|
|
159
170
|
/** @returns the html required to render the static metro error as an SPA. */ function logFromError({ error , projectRoot }) {
|
|
160
|
-
const { LogBoxLog , parseErrorStack } = require(_resolveFrom().default(projectRoot, "@expo/metro-runtime/symbolicate"));
|
|
171
|
+
const { LogBoxLog , parseErrorStack } = require((0, _resolveFrom().default)(projectRoot, "@expo/metro-runtime/symbolicate"));
|
|
161
172
|
const stack = parseErrorStack(error.stack);
|
|
162
173
|
return new LogBoxLog({
|
|
163
174
|
level: "static",
|
|
@@ -172,31 +183,29 @@ async function logMetroError(projectRoot, { error }) {
|
|
|
172
183
|
});
|
|
173
184
|
}
|
|
174
185
|
async function logMetroErrorAsync({ error , projectRoot }) {
|
|
175
|
-
var ref,
|
|
186
|
+
var ref, ref1;
|
|
176
187
|
const log = logFromError({
|
|
177
188
|
projectRoot,
|
|
178
189
|
error
|
|
179
190
|
});
|
|
180
|
-
await new Promise((res)=>log.symbolicate("stack", res)
|
|
181
|
-
|
|
182
|
-
var ref8;
|
|
191
|
+
await new Promise((res)=>log.symbolicate("stack", res));
|
|
192
|
+
var ref2;
|
|
183
193
|
logMetroErrorWithStack(projectRoot, {
|
|
184
|
-
stack: (
|
|
194
|
+
stack: (ref2 = (ref = log.symbolicated) == null ? void 0 : (ref1 = ref.stack) == null ? void 0 : ref1.stack) != null ? ref2 : [],
|
|
185
195
|
codeFrame: log.codeFrame,
|
|
186
196
|
error
|
|
187
197
|
});
|
|
188
198
|
}
|
|
189
199
|
async function getErrorOverlayHtmlAsync({ error , projectRoot , routerRoot }) {
|
|
190
|
-
var ref,
|
|
200
|
+
var ref, ref1;
|
|
191
201
|
const log = logFromError({
|
|
192
202
|
projectRoot,
|
|
193
203
|
error
|
|
194
204
|
});
|
|
195
|
-
await new Promise((res)=>log.symbolicate("stack", res)
|
|
196
|
-
|
|
197
|
-
var ref10;
|
|
205
|
+
await new Promise((res)=>log.symbolicate("stack", res));
|
|
206
|
+
var ref2;
|
|
198
207
|
logMetroErrorWithStack(projectRoot, {
|
|
199
|
-
stack: (
|
|
208
|
+
stack: (ref2 = (ref = log.symbolicated) == null ? void 0 : (ref1 = ref.stack) == null ? void 0 : ref1.stack) != null ? ref2 : [],
|
|
200
209
|
codeFrame: log.codeFrame,
|
|
201
210
|
error
|
|
202
211
|
});
|
|
@@ -208,8 +217,8 @@ async function getErrorOverlayHtmlAsync({ error , projectRoot , routerRoot }) {
|
|
|
208
217
|
]
|
|
209
218
|
};
|
|
210
219
|
const html = `<html><head><style>#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}</style></head><body><div id="root"></div><script id="_expo-static-error" type="application/json">${JSON.stringify(logBoxContext)}</script></body></html>`;
|
|
211
|
-
const errorOverlayEntry = await (0, _getStaticRenderFunctions
|
|
212
|
-
"", _resolveFrom().default(projectRoot, "expo-router/_error"), {
|
|
220
|
+
const errorOverlayEntry = await (0, _getStaticRenderFunctions.createMetroEndpointAsync)(projectRoot, // Keep the URL relative
|
|
221
|
+
"", (0, _resolveFrom().default)(projectRoot, "expo-router/_error"), {
|
|
213
222
|
mode: "development",
|
|
214
223
|
platform: "web",
|
|
215
224
|
minify: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/metroErrorInterface.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport chalk from 'chalk';\nimport resolveFrom from 'resolve-from';\nimport { StackFrame } from 'stacktrace-parser';\nimport terminalLink from 'terminal-link';\n\nimport { Log } from '../../../log';\nimport { SilentError } from '../../../utils/errors';\nimport { createMetroEndpointAsync } from '../getStaticRenderFunctions';\n\ntype CodeFrame = {\n content: string;\n location?: {\n row: number;\n column: number;\n [key: string]: any;\n };\n fileName: string;\n};\n\ntype MetroStackFrame = StackFrame & { collapse?: boolean };\n\nfunction fill(width: number): string {\n return Array(width).join(' ');\n}\n\nfunction formatPaths(config: { filePath: string | null; line?: number; col?: number }) {\n const filePath = chalk.reset(config.filePath);\n return (\n chalk.dim('(') +\n filePath +\n chalk.dim(`:${[config.line, config.col].filter(Boolean).join(':')})`)\n );\n}\n\nexport async function logMetroErrorWithStack(\n projectRoot: string,\n {\n stack,\n codeFrame,\n error,\n }: {\n stack: MetroStackFrame[];\n codeFrame: CodeFrame;\n error: Error;\n }\n) {\n if (error instanceof SilentError) {\n return;\n }\n\n // process.stdout.write('\\u001b[0m'); // Reset attributes\n // process.stdout.write('\\u001bc'); // Reset the terminal\n\n const { getStackFormattedLocation } = require(\n resolveFrom(projectRoot, '@expo/metro-runtime/symbolicate')\n );\n\n Log.log();\n Log.log(chalk.red('Metro error: ') + error.message);\n Log.log();\n\n if (codeFrame) {\n const maxWarningLineLength = Math.max(200, process.stdout.columns);\n\n const lineText = codeFrame.content;\n const isPreviewTooLong = codeFrame.content\n .split('\\n')\n .some((line) => line.length > maxWarningLineLength);\n const column = codeFrame.location?.column;\n // When the preview is too long, we skip reading the file and attempting to apply\n // code coloring, this is because it can get very slow.\n if (isPreviewTooLong) {\n let previewLine = '';\n let cursorLine = '';\n\n const formattedPath = formatPaths({\n filePath: codeFrame.fileName,\n line: codeFrame.location?.row,\n col: codeFrame.location?.column,\n });\n // Create a curtailed preview line like:\n // `...transition:'fade'},k._updatePropsStack=function(){clearImmediate(k._updateImmediate),k._updateImmediate...`\n // If there is no text preview or column number, we can't do anything.\n if (lineText && column != null) {\n const rangeWindow = Math.round(\n Math.max(codeFrame.fileName?.length ?? 0, Math.max(80, process.stdout.columns)) / 2\n );\n let minBounds = Math.max(0, column - rangeWindow);\n const maxBounds = Math.min(minBounds + rangeWindow * 2, lineText.length);\n previewLine = lineText.slice(minBounds, maxBounds);\n\n // If we splice content off the start, then we should append `...`.\n // This is unlikely to happen since we limit the activation size.\n if (minBounds > 0) {\n // Adjust the min bounds so the cursor is aligned after we add the \"...\"\n minBounds -= 3;\n previewLine = chalk.dim('...') + previewLine;\n }\n if (maxBounds < lineText.length) {\n previewLine += chalk.dim('...');\n }\n\n // If the column property could be found, then use that to fix the cursor location which is often broken in regex.\n cursorLine = (column == null ? '' : fill(column) + chalk.reset('^')).slice(minBounds);\n\n Log.log(\n [formattedPath, '', previewLine, cursorLine, chalk.dim('(error truncated)')].join('\\n')\n );\n }\n } else {\n Log.log(codeFrame.content);\n }\n }\n\n if (stack?.length) {\n Log.log();\n Log.log(chalk.bold`Call Stack`);\n\n const stackProps = stack.map((frame) => {\n return {\n title: frame.methodName,\n subtitle: getStackFormattedLocation(projectRoot, frame),\n collapse: frame.collapse,\n };\n });\n\n stackProps.forEach((frame) => {\n const position = terminalLink.isSupported\n ? terminalLink(frame.subtitle, frame.subtitle)\n : frame.subtitle;\n let lineItem = chalk.gray(` ${frame.title} (${position})`);\n if (frame.collapse) {\n lineItem = chalk.dim(lineItem);\n }\n Log.log(lineItem);\n });\n } else {\n Log.log(chalk.gray(` ${error.stack}`));\n }\n}\n\nexport async function logMetroError(projectRoot: string, { error }: { error: Error }) {\n if (error instanceof SilentError) {\n return;\n }\n\n const { LogBoxLog, parseErrorStack } = require(\n resolveFrom(projectRoot, '@expo/metro-runtime/symbolicate')\n );\n\n const stack = parseErrorStack(error.stack);\n\n const log = new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n\n await new Promise((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nfunction logFromError({ error, projectRoot }: { error: Error; projectRoot: string }): {\n symbolicated: any;\n symbolicate: (type: string, callback: () => void) => void;\n codeFrame: CodeFrame;\n} {\n const { LogBoxLog, parseErrorStack } = require(\n resolveFrom(projectRoot, '@expo/metro-runtime/symbolicate')\n );\n\n const stack = parseErrorStack(error.stack);\n\n return new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function logMetroErrorAsync({\n error,\n projectRoot,\n}: {\n error: Error;\n projectRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function getErrorOverlayHtmlAsync({\n error,\n projectRoot,\n routerRoot,\n}: {\n error: Error;\n projectRoot: string;\n routerRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n\n const logBoxContext = {\n selectedLogIndex: 0,\n isDisabled: false,\n logs: [log],\n };\n const html = `<html><head><style>#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}</style></head><body><div id=\"root\"></div><script id=\"_expo-static-error\" type=\"application/json\">${JSON.stringify(\n logBoxContext\n )}</script></body></html>`;\n\n const errorOverlayEntry = await createMetroEndpointAsync(\n projectRoot,\n // Keep the URL relative\n '',\n resolveFrom(projectRoot, 'expo-router/_error'),\n {\n mode: 'development',\n platform: 'web',\n minify: false,\n baseUrl: '',\n routerRoot,\n isExporting: false,\n }\n );\n\n const htmlWithJs = html.replace('</body>', `<script src=${errorOverlayEntry}></script></body>`);\n return htmlWithJs;\n}\n"],"names":["logMetroErrorWithStack","logMetroError","logMetroErrorAsync","getErrorOverlayHtmlAsync","fill","width","Array","join","formatPaths","config","filePath","chalk","reset","dim","line","col","filter","Boolean","projectRoot","stack","codeFrame","error","SilentError","getStackFormattedLocation","require","resolveFrom","Log","log","red","message","maxWarningLineLength","Math","max","process","stdout","columns","lineText","content","isPreviewTooLong","split","some","length","column","location","previewLine","cursorLine","formattedPath","fileName","row","rangeWindow","round","minBounds","maxBounds","min","slice","bold","stackProps","map","frame","title","methodName","subtitle","collapse","forEach","position","terminalLink","isSupported","lineItem","gray","LogBoxLog","parseErrorStack","level","substitutions","isComponentError","category","componentStack","Promise","res","symbolicate","symbolicated","logFromError","routerRoot","logBoxContext","selectedLogIndex","isDisabled","logs","html","JSON","stringify","errorOverlayEntry","createMetroEndpointAsync","mode","platform","minify","baseUrl","isExporting","htmlWithJs","replace"],"mappings":"AAMA;;;;QAkCsBA,sBAAsB,GAAtBA,sBAAsB;QA2GtBC,aAAa,GAAbA,aAAa;QA0DbC,kBAAkB,GAAlBA,kBAAkB;QAmBlBC,wBAAwB,GAAxBA,wBAAwB;SA1N5B,MAAO;gDAAP,OAAO;IAAP,MAAO;;;;;SACD,YAAc;gDAAd,cAAc;IAAd,YAAc;;;;;SAEb,aAAe;gDAAf,eAAe;IAAf,aAAe;;;;;AAEpB,IAAA,IAAc,WAAd,cAAc,CAAA;AACN,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACV,IAAA,yBAA6B,WAA7B,6BAA6B,CAAA;;;;;;AActE,SAASC,IAAI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C;CACnB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/metroErrorInterface.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport chalk from 'chalk';\nimport resolveFrom from 'resolve-from';\nimport { StackFrame } from 'stacktrace-parser';\nimport terminalLink from 'terminal-link';\n\nimport { Log } from '../../../log';\nimport { SilentError } from '../../../utils/errors';\nimport { createMetroEndpointAsync } from '../getStaticRenderFunctions';\n\ntype CodeFrame = {\n content: string;\n location?: {\n row: number;\n column: number;\n [key: string]: any;\n };\n fileName: string;\n};\n\ntype MetroStackFrame = StackFrame & { collapse?: boolean };\n\nfunction fill(width: number): string {\n return Array(width).join(' ');\n}\n\nfunction formatPaths(config: { filePath: string | null; line?: number; col?: number }) {\n const filePath = chalk.reset(config.filePath);\n return (\n chalk.dim('(') +\n filePath +\n chalk.dim(`:${[config.line, config.col].filter(Boolean).join(':')})`)\n );\n}\n\nexport async function logMetroErrorWithStack(\n projectRoot: string,\n {\n stack,\n codeFrame,\n error,\n }: {\n stack: MetroStackFrame[];\n codeFrame: CodeFrame;\n error: Error;\n }\n) {\n if (error instanceof SilentError) {\n return;\n }\n\n // process.stdout.write('\\u001b[0m'); // Reset attributes\n // process.stdout.write('\\u001bc'); // Reset the terminal\n\n const { getStackFormattedLocation } = require(\n resolveFrom(projectRoot, '@expo/metro-runtime/symbolicate')\n );\n\n Log.log();\n Log.log(chalk.red('Metro error: ') + error.message);\n Log.log();\n\n if (codeFrame) {\n const maxWarningLineLength = Math.max(200, process.stdout.columns);\n\n const lineText = codeFrame.content;\n const isPreviewTooLong = codeFrame.content\n .split('\\n')\n .some((line) => line.length > maxWarningLineLength);\n const column = codeFrame.location?.column;\n // When the preview is too long, we skip reading the file and attempting to apply\n // code coloring, this is because it can get very slow.\n if (isPreviewTooLong) {\n let previewLine = '';\n let cursorLine = '';\n\n const formattedPath = formatPaths({\n filePath: codeFrame.fileName,\n line: codeFrame.location?.row,\n col: codeFrame.location?.column,\n });\n // Create a curtailed preview line like:\n // `...transition:'fade'},k._updatePropsStack=function(){clearImmediate(k._updateImmediate),k._updateImmediate...`\n // If there is no text preview or column number, we can't do anything.\n if (lineText && column != null) {\n const rangeWindow = Math.round(\n Math.max(codeFrame.fileName?.length ?? 0, Math.max(80, process.stdout.columns)) / 2\n );\n let minBounds = Math.max(0, column - rangeWindow);\n const maxBounds = Math.min(minBounds + rangeWindow * 2, lineText.length);\n previewLine = lineText.slice(minBounds, maxBounds);\n\n // If we splice content off the start, then we should append `...`.\n // This is unlikely to happen since we limit the activation size.\n if (minBounds > 0) {\n // Adjust the min bounds so the cursor is aligned after we add the \"...\"\n minBounds -= 3;\n previewLine = chalk.dim('...') + previewLine;\n }\n if (maxBounds < lineText.length) {\n previewLine += chalk.dim('...');\n }\n\n // If the column property could be found, then use that to fix the cursor location which is often broken in regex.\n cursorLine = (column == null ? '' : fill(column) + chalk.reset('^')).slice(minBounds);\n\n Log.log(\n [formattedPath, '', previewLine, cursorLine, chalk.dim('(error truncated)')].join('\\n')\n );\n }\n } else {\n Log.log(codeFrame.content);\n }\n }\n\n if (stack?.length) {\n Log.log();\n Log.log(chalk.bold`Call Stack`);\n\n const stackProps = stack.map((frame) => {\n return {\n title: frame.methodName,\n subtitle: getStackFormattedLocation(projectRoot, frame),\n collapse: frame.collapse,\n };\n });\n\n stackProps.forEach((frame) => {\n const position = terminalLink.isSupported\n ? terminalLink(frame.subtitle, frame.subtitle)\n : frame.subtitle;\n let lineItem = chalk.gray(` ${frame.title} (${position})`);\n if (frame.collapse) {\n lineItem = chalk.dim(lineItem);\n }\n Log.log(lineItem);\n });\n } else {\n Log.log(chalk.gray(` ${error.stack}`));\n }\n}\n\nexport async function logMetroError(projectRoot: string, { error }: { error: Error }) {\n if (error instanceof SilentError) {\n return;\n }\n\n const { LogBoxLog, parseErrorStack } = require(\n resolveFrom(projectRoot, '@expo/metro-runtime/symbolicate')\n );\n\n const stack = parseErrorStack(error.stack);\n\n const log = new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n\n await new Promise((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nfunction logFromError({ error, projectRoot }: { error: Error; projectRoot: string }): {\n symbolicated: any;\n symbolicate: (type: string, callback: () => void) => void;\n codeFrame: CodeFrame;\n} {\n const { LogBoxLog, parseErrorStack } = require(\n resolveFrom(projectRoot, '@expo/metro-runtime/symbolicate')\n );\n\n const stack = parseErrorStack(error.stack);\n\n return new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function logMetroErrorAsync({\n error,\n projectRoot,\n}: {\n error: Error;\n projectRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function getErrorOverlayHtmlAsync({\n error,\n projectRoot,\n routerRoot,\n}: {\n error: Error;\n projectRoot: string;\n routerRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n\n const logBoxContext = {\n selectedLogIndex: 0,\n isDisabled: false,\n logs: [log],\n };\n const html = `<html><head><style>#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}</style></head><body><div id=\"root\"></div><script id=\"_expo-static-error\" type=\"application/json\">${JSON.stringify(\n logBoxContext\n )}</script></body></html>`;\n\n const errorOverlayEntry = await createMetroEndpointAsync(\n projectRoot,\n // Keep the URL relative\n '',\n resolveFrom(projectRoot, 'expo-router/_error'),\n {\n mode: 'development',\n platform: 'web',\n minify: false,\n baseUrl: '',\n routerRoot,\n isExporting: false,\n }\n );\n\n const htmlWithJs = html.replace('</body>', `<script src=${errorOverlayEntry}></script></body>`);\n return htmlWithJs;\n}\n"],"names":["logMetroErrorWithStack","logMetroError","logMetroErrorAsync","getErrorOverlayHtmlAsync","fill","width","Array","join","formatPaths","config","filePath","chalk","reset","dim","line","col","filter","Boolean","projectRoot","stack","codeFrame","error","SilentError","getStackFormattedLocation","require","resolveFrom","Log","log","red","message","maxWarningLineLength","Math","max","process","stdout","columns","lineText","content","isPreviewTooLong","split","some","length","column","location","previewLine","cursorLine","formattedPath","fileName","row","rangeWindow","round","minBounds","maxBounds","min","slice","bold","stackProps","map","frame","title","methodName","subtitle","collapse","forEach","position","terminalLink","isSupported","lineItem","gray","LogBoxLog","parseErrorStack","level","substitutions","isComponentError","category","componentStack","Promise","res","symbolicate","symbolicated","logFromError","routerRoot","logBoxContext","selectedLogIndex","isDisabled","logs","html","JSON","stringify","errorOverlayEntry","createMetroEndpointAsync","mode","platform","minify","baseUrl","isExporting","htmlWithJs","replace"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAkCsBA,sBAAsB,MAAtBA,sBAAsB;IA2GtBC,aAAa,MAAbA,aAAa;IA0DbC,kBAAkB,MAAlBA,kBAAkB;IAmBlBC,wBAAwB,MAAxBA,wBAAwB;;;8DA1N5B,OAAO;;;;;;;8DACD,cAAc;;;;;;;8DAEb,eAAe;;;;;;qBAEpB,cAAc;wBACN,uBAAuB;0CACV,6BAA6B;;;;;;AActE,SAASC,IAAI,CAACC,KAAa,EAAU;IACnC,OAAOC,KAAK,CAACD,KAAK,CAAC,CAACE,IAAI,CAAC,GAAG,CA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IAAI,CAACW,OAAO,CAAC,SAAS,EAAE,CAAC,YAAY,EAAER,iBAAiB,CAAC,iBAAiB,CAAC,CAAC,AAAC;IAChG,OAAOO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
// Used to cast a type to metro errors without depending on specific versions of metro.
|
|
1
2
|
"use strict";
|
|
2
3
|
Object.defineProperty(exports, "__esModule", {
|
|
3
4
|
value: true
|
|
4
5
|
});
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
isFailedToResolveNameError: ()=>isFailedToResolveNameError,
|
|
14
|
+
isFailedToResolvePathError: ()=>isFailedToResolvePathError
|
|
15
|
+
});
|
|
7
16
|
function isFailedToResolveNameError(error) {
|
|
8
17
|
return !!error && "extraPaths" in error && error.constructor.name === "FailedToResolveNameError";
|
|
9
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/metroErrors.ts"],"sourcesContent":["// Used to cast a type to metro errors without depending on specific versions of metro.\n\nexport type FileAndDirCandidates = {\n dir: FileCandidates;\n file: FileCandidates;\n};\n\n/**\n * This is a way to describe what files we tried to look for when resolving\n * a module name as file. This is mainly used for error reporting, so that\n * we can explain why we cannot resolve a module.\n */\nexport type FileCandidates =\n // We only tried to resolve a specific asset.\n | { type: 'asset'; name: string }\n // We attempted to resolve a name as being a source file (ex. JavaScript,\n // JSON...), in which case there can be several extensions we tried, for\n // example `/js/foo.ios.js`, `/js/foo.js`, etc. for a single prefix '/js/foo'.\n | {\n type: 'sourceFile';\n filePathPrefix: string;\n candidateExts: readonly string[];\n };\n\ntype FailedToResolveNameError = Error & {\n dirPaths: string[];\n extraPaths: string[];\n};\n\ntype FailedToResolvePathError = Error & {\n candidates: FileAndDirCandidates;\n};\n\nexport function isFailedToResolveNameError(error: any): error is FailedToResolveNameError {\n return !!error && 'extraPaths' in error && error.constructor.name === 'FailedToResolveNameError';\n}\n\nexport function isFailedToResolvePathError(error: any): error is FailedToResolvePathError {\n return !!error && 'candidates' in error && error.constructor.name === 'FailedToResolvePathError';\n}\n"],"names":["isFailedToResolveNameError","isFailedToResolvePathError","error","constructor","name"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/metroErrors.ts"],"sourcesContent":["// Used to cast a type to metro errors without depending on specific versions of metro.\n\nexport type FileAndDirCandidates = {\n dir: FileCandidates;\n file: FileCandidates;\n};\n\n/**\n * This is a way to describe what files we tried to look for when resolving\n * a module name as file. This is mainly used for error reporting, so that\n * we can explain why we cannot resolve a module.\n */\nexport type FileCandidates =\n // We only tried to resolve a specific asset.\n | { type: 'asset'; name: string }\n // We attempted to resolve a name as being a source file (ex. JavaScript,\n // JSON...), in which case there can be several extensions we tried, for\n // example `/js/foo.ios.js`, `/js/foo.js`, etc. for a single prefix '/js/foo'.\n | {\n type: 'sourceFile';\n filePathPrefix: string;\n candidateExts: readonly string[];\n };\n\ntype FailedToResolveNameError = Error & {\n dirPaths: string[];\n extraPaths: string[];\n};\n\ntype FailedToResolvePathError = Error & {\n candidates: FileAndDirCandidates;\n};\n\nexport function isFailedToResolveNameError(error: any): error is FailedToResolveNameError {\n return !!error && 'extraPaths' in error && error.constructor.name === 'FailedToResolveNameError';\n}\n\nexport function isFailedToResolvePathError(error: any): error is FailedToResolvePathError {\n return !!error && 'candidates' in error && error.constructor.name === 'FailedToResolvePathError';\n}\n"],"names":["isFailedToResolveNameError","isFailedToResolvePathError","error","constructor","name"],"mappings":"AAAA,uFAAuF;AAEvF;;;;;;;;;;;IA+BgBA,0BAA0B,MAA1BA,0BAA0B;IAI1BC,0BAA0B,MAA1BA,0BAA0B;;AAJnC,SAASD,0BAA0B,CAACE,KAAU,EAAqC;IACxF,OAAO,CAAC,CAACA,KAAK,IAAI,YAAY,IAAIA,KAAK,IAAIA,KAAK,CAACC,WAAW,CAACC,IAAI,KAAK,0BAA0B,CAAC;AACnG,CAAC;AAEM,SAASH,0BAA0B,CAACC,KAAU,EAAqC;IACxF,OAAO,CAAC,CAACA,KAAK,IAAI,YAAY,IAAIA,KAAK,IAAIA,KAAK,CAACC,WAAW,CAACC,IAAI,KAAK,0BAA0B,CAAC;AACnG,CAAC"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2024 650 Industries.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/ "use strict";
|
|
2
7
|
Object.defineProperty(exports, "__esModule", {
|
|
3
8
|
value: true
|
|
4
9
|
});
|
|
5
|
-
exports
|
|
10
|
+
Object.defineProperty(exports, "getMetroBundlerWithVirtualModules", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: ()=>getMetroBundlerWithVirtualModules
|
|
13
|
+
});
|
|
6
14
|
function assertBundlerHasPrivateMembers(bundler) {
|
|
7
15
|
if (!("_depGraph" in bundler)) {
|
|
8
16
|
throw new Error("Expected bundler to have member: _depGraph. Upstream metro may have removed this property.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/metroVirtualModules.ts"],"sourcesContent":["/**\n * Copyright © 2024 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 Bundler from 'metro/src/Bundler';\nimport DependencyGraph from 'metro/src/node-haste/DependencyGraph';\nimport { FileSystem } from 'metro-file-map';\n\ntype ExpoPatchedFileSystem = Omit<FileSystem, 'getSha1'> & {\n getSha1: FileSystem['getSha1'] & { __patched?: boolean };\n expoVirtualModules?: Map<string, Buffer>;\n};\n\ntype ActualDependencyGraph = DependencyGraph & {\n _fileSystem: ExpoPatchedFileSystem;\n};\n\ntype ActualBundler = Bundler & {\n _depGraph: ActualDependencyGraph;\n};\n\ntype ExpoPatchedBundler = Bundler & {\n setVirtualModule: (id: string, contents: string) => void;\n hasVirtualModule: (id: string) => boolean;\n};\n\nfunction assertBundlerHasPrivateMembers(bundler: Bundler): asserts bundler is ActualBundler {\n if (!('_depGraph' in bundler)) {\n throw new Error(\n 'Expected bundler to have member: _depGraph. Upstream metro may have removed this property.'\n );\n }\n\n assertDepGraphHasPrivateMembers(bundler._depGraph);\n}\n\nfunction assertDepGraphHasPrivateMembers(\n depGraph: unknown\n): asserts depGraph is ActualDependencyGraph {\n if (!depGraph || typeof depGraph !== 'object' || !('_fileSystem' in depGraph)) {\n throw new Error(\n 'Expected bundler._depGraph to have member: _fileSystem. Upstream metro may have removed this property.'\n );\n }\n}\n\nfunction ensureMetroBundlerPatchedWithSetVirtualModule(\n bundler: Bundler & {\n setVirtualModule?: (id: string, contents: string) => void;\n hasVirtualModule?: (id: string) => boolean;\n }\n): ExpoPatchedBundler {\n if (!bundler.setVirtualModule) {\n bundler.setVirtualModule = function (this: Bundler, id: string, contents: string) {\n assertBundlerHasPrivateMembers(this);\n const fs = ensureFileSystemPatched(this._depGraph._fileSystem);\n fs.expoVirtualModules!.set(ensureStartsWithNullByte(id), Buffer.from(contents));\n };\n bundler.hasVirtualModule = function (this: Bundler, id: string) {\n assertBundlerHasPrivateMembers(this);\n const fs = ensureFileSystemPatched(this._depGraph._fileSystem);\n return fs.expoVirtualModules!.has(ensureStartsWithNullByte(id));\n };\n }\n\n return bundler as ExpoPatchedBundler;\n}\n\nfunction ensureStartsWithNullByte(id: string): string {\n // Because you'll likely need to return the path somewhere, we should just assert with a useful error message instead of\n // attempting to mutate the value behind the scenes. This ensures correctness in the resolution.\n if (!id.startsWith('\\0')) {\n throw new Error(`Virtual modules in Expo CLI must start with with null byte (\\\\0), got: ${id}`);\n }\n return id;\n}\n\nexport function getMetroBundlerWithVirtualModules(\n bundler: Bundler & {\n transformFile: Bundler['transformFile'] & { __patched?: boolean };\n }\n): ExpoPatchedBundler {\n if (!bundler.transformFile.__patched) {\n const originalTransformFile = bundler.transformFile.bind(bundler);\n\n bundler.transformFile = async function (\n filePath: string,\n transformOptions: any,\n /** Optionally provide the file contents, this can be used to provide virtual contents for a file. */\n fileBuffer?: Buffer\n ) {\n // file buffer will be defined for virtual modules in Metro, e.g. context modules.\n if (!fileBuffer) {\n if (filePath.startsWith('\\0')) {\n const graph = await this.getDependencyGraph();\n\n assertDepGraphHasPrivateMembers(graph);\n\n if (graph._fileSystem.expoVirtualModules) {\n fileBuffer = graph._fileSystem.expoVirtualModules.get(filePath);\n }\n\n if (!fileBuffer) {\n throw new Error(`Virtual module \"${filePath}\" not found.`);\n }\n }\n }\n return originalTransformFile(filePath, transformOptions, fileBuffer);\n };\n\n bundler.transformFile.__patched = true;\n }\n\n return ensureMetroBundlerPatchedWithSetVirtualModule(bundler);\n}\n\nfunction ensureFileSystemPatched(fs: ExpoPatchedFileSystem): ExpoPatchedFileSystem {\n if (!fs.getSha1.__patched) {\n const original_getSha1 = fs.getSha1.bind(fs);\n fs.getSha1 = (filename: string) => {\n // Rollup virtual module format.\n if (filename.startsWith('\\0')) {\n return filename;\n }\n\n return original_getSha1(filename);\n };\n fs.getSha1.__patched = true;\n }\n\n // TODO: Connect virtual modules to a specific context so they don't cross-bundles.\n if (!fs.expoVirtualModules) {\n fs.expoVirtualModules = new Map<string, Buffer>();\n }\n\n return fs;\n}\n"],"names":["getMetroBundlerWithVirtualModules","assertBundlerHasPrivateMembers","bundler","Error","assertDepGraphHasPrivateMembers","_depGraph","depGraph","ensureMetroBundlerPatchedWithSetVirtualModule","setVirtualModule","id","contents","fs","ensureFileSystemPatched","_fileSystem","expoVirtualModules","set","ensureStartsWithNullByte","Buffer","from","hasVirtualModule","has","startsWith","transformFile","__patched","originalTransformFile","bind","filePath","transformOptions","fileBuffer","graph","getDependencyGraph","get","getSha1","original_getSha1","filename","Map"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/metroVirtualModules.ts"],"sourcesContent":["/**\n * Copyright © 2024 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 Bundler from 'metro/src/Bundler';\nimport DependencyGraph from 'metro/src/node-haste/DependencyGraph';\nimport { FileSystem } from 'metro-file-map';\n\ntype ExpoPatchedFileSystem = Omit<FileSystem, 'getSha1'> & {\n getSha1: FileSystem['getSha1'] & { __patched?: boolean };\n expoVirtualModules?: Map<string, Buffer>;\n};\n\ntype ActualDependencyGraph = DependencyGraph & {\n _fileSystem: ExpoPatchedFileSystem;\n};\n\ntype ActualBundler = Bundler & {\n _depGraph: ActualDependencyGraph;\n};\n\ntype ExpoPatchedBundler = Bundler & {\n setVirtualModule: (id: string, contents: string) => void;\n hasVirtualModule: (id: string) => boolean;\n};\n\nfunction assertBundlerHasPrivateMembers(bundler: Bundler): asserts bundler is ActualBundler {\n if (!('_depGraph' in bundler)) {\n throw new Error(\n 'Expected bundler to have member: _depGraph. Upstream metro may have removed this property.'\n );\n }\n\n assertDepGraphHasPrivateMembers(bundler._depGraph);\n}\n\nfunction assertDepGraphHasPrivateMembers(\n depGraph: unknown\n): asserts depGraph is ActualDependencyGraph {\n if (!depGraph || typeof depGraph !== 'object' || !('_fileSystem' in depGraph)) {\n throw new Error(\n 'Expected bundler._depGraph to have member: _fileSystem. Upstream metro may have removed this property.'\n );\n }\n}\n\nfunction ensureMetroBundlerPatchedWithSetVirtualModule(\n bundler: Bundler & {\n setVirtualModule?: (id: string, contents: string) => void;\n hasVirtualModule?: (id: string) => boolean;\n }\n): ExpoPatchedBundler {\n if (!bundler.setVirtualModule) {\n bundler.setVirtualModule = function (this: Bundler, id: string, contents: string) {\n assertBundlerHasPrivateMembers(this);\n const fs = ensureFileSystemPatched(this._depGraph._fileSystem);\n fs.expoVirtualModules!.set(ensureStartsWithNullByte(id), Buffer.from(contents));\n };\n bundler.hasVirtualModule = function (this: Bundler, id: string) {\n assertBundlerHasPrivateMembers(this);\n const fs = ensureFileSystemPatched(this._depGraph._fileSystem);\n return fs.expoVirtualModules!.has(ensureStartsWithNullByte(id));\n };\n }\n\n return bundler as ExpoPatchedBundler;\n}\n\nfunction ensureStartsWithNullByte(id: string): string {\n // Because you'll likely need to return the path somewhere, we should just assert with a useful error message instead of\n // attempting to mutate the value behind the scenes. This ensures correctness in the resolution.\n if (!id.startsWith('\\0')) {\n throw new Error(`Virtual modules in Expo CLI must start with with null byte (\\\\0), got: ${id}`);\n }\n return id;\n}\n\nexport function getMetroBundlerWithVirtualModules(\n bundler: Bundler & {\n transformFile: Bundler['transformFile'] & { __patched?: boolean };\n }\n): ExpoPatchedBundler {\n if (!bundler.transformFile.__patched) {\n const originalTransformFile = bundler.transformFile.bind(bundler);\n\n bundler.transformFile = async function (\n filePath: string,\n transformOptions: any,\n /** Optionally provide the file contents, this can be used to provide virtual contents for a file. */\n fileBuffer?: Buffer\n ) {\n // file buffer will be defined for virtual modules in Metro, e.g. context modules.\n if (!fileBuffer) {\n if (filePath.startsWith('\\0')) {\n const graph = await this.getDependencyGraph();\n\n assertDepGraphHasPrivateMembers(graph);\n\n if (graph._fileSystem.expoVirtualModules) {\n fileBuffer = graph._fileSystem.expoVirtualModules.get(filePath);\n }\n\n if (!fileBuffer) {\n throw new Error(`Virtual module \"${filePath}\" not found.`);\n }\n }\n }\n return originalTransformFile(filePath, transformOptions, fileBuffer);\n };\n\n bundler.transformFile.__patched = true;\n }\n\n return ensureMetroBundlerPatchedWithSetVirtualModule(bundler);\n}\n\nfunction ensureFileSystemPatched(fs: ExpoPatchedFileSystem): ExpoPatchedFileSystem {\n if (!fs.getSha1.__patched) {\n const original_getSha1 = fs.getSha1.bind(fs);\n fs.getSha1 = (filename: string) => {\n // Rollup virtual module format.\n if (filename.startsWith('\\0')) {\n return filename;\n }\n\n return original_getSha1(filename);\n };\n fs.getSha1.__patched = true;\n }\n\n // TODO: Connect virtual modules to a specific context so they don't cross-bundles.\n if (!fs.expoVirtualModules) {\n fs.expoVirtualModules = new Map<string, Buffer>();\n }\n\n return fs;\n}\n"],"names":["getMetroBundlerWithVirtualModules","assertBundlerHasPrivateMembers","bundler","Error","assertDepGraphHasPrivateMembers","_depGraph","depGraph","ensureMetroBundlerPatchedWithSetVirtualModule","setVirtualModule","id","contents","fs","ensureFileSystemPatched","_fileSystem","expoVirtualModules","set","ensureStartsWithNullByte","Buffer","from","hasVirtualModule","has","startsWith","transformFile","__patched","originalTransformFile","bind","filePath","transformOptions","fileBuffer","graph","getDependencyGraph","get","getSha1","original_getSha1","filename","Map"],"mappings":"AAAA;;;;;CAKC,GACD;;;;+BAyEgBA,mCAAiC;;aAAjCA,iCAAiC;;AAnDjD,SAASC,8BAA8B,CAACC,OAAgB,EAAoC;IAC1F,IAAI,CAAC,CAAC,WAAW,IAAIA,OAAO,CAAC,EAAE;QAC7B,MAAM,IAAIC,KAAK,CACb,4FAA4F,CAC7F,CAAC;IACJ,CAAC;IAEDC,+BAA+B,CAACF,OAAO,CAACG,SAAS,CAAC,CAAC;AACrD,CAAC;AAED,SAASD,+BAA+B,CACtCE,QAAiB,EAC0B;IAC3C,IAAI,CAACA,QAAQ,IAAI,OAAOA,QAAQ,KAAK,QAAQ,IAAI,CAAC,CAAC,aAAa,IAAIA,QAAQ,CAAC,EAAE;QAC7E,MAAM,IAAIH,KAAK,CACb,wGAAwG,CACzG,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAASI,6CAA6C,CACpDL,OAGC,EACmB;IACpB,IAAI,CAACA,OAAO,CAACM,gBAAgB,EAAE;QAC7BN,OAAO,CAACM,gBAAgB,GAAG,SAAyBC,EAAU,EAAEC,QAAgB,EAAE;YAChFT,8BAA8B,CAAC,IAAI,CAAC,CAAC;YACrC,MAAMU,EAAE,GAAGC,uBAAuB,CAAC,IAAI,CAACP,SAAS,CAACQ,WAAW,CAAC,AAAC;YAC/DF,EAAE,CAACG,kBAAkB,CAA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{
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "metroWatchTypeScriptFiles", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>metroWatchTypeScriptFiles
|
|
8
|
+
});
|
|
6
9
|
function _path() {
|
|
7
|
-
const data = _interopRequireDefault(require("path"));
|
|
10
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
8
11
|
_path = function() {
|
|
9
12
|
return data;
|
|
10
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/metroWatchTypeScriptFiles.ts"],"sourcesContent":["import path from 'path';\n\nimport type { ServerLike } from '../BundlerDevServer';\n\nconst debug = require('debug')(\n 'expo:start:server:metro:metroWatchTypeScriptFiles'\n) as typeof console.log;\n\nexport interface MetroWatchTypeScriptFilesOptions {\n projectRoot: string;\n metro: import('metro').Server;\n server: ServerLike;\n /* Include tsconfig.json in the watcher */\n tsconfig?: boolean;\n callback: (event: WatchEvent) => void;\n /* Array of eventTypes to watch. Defaults to all events */\n eventTypes?: string[];\n /* Throlle the callback. When true and a group of events are recieved, callback it will only be called with the\n * first event */\n throttle?: boolean;\n}\n\ninterface WatchEvent {\n filePath: string;\n metadata?: {\n type: 'f' | 'd' | 'l'; // Regular file / Directory / Symlink\n } | null;\n type: string;\n}\n\n/**\n * Use the native file watcher / Metro ruleset to detect if a\n * TypeScript file is added to the project during development.\n */\nexport function metroWatchTypeScriptFiles({\n metro,\n server,\n projectRoot,\n callback,\n tsconfig = false,\n throttle = false,\n eventTypes = ['add', 'change', 'delete'],\n}: MetroWatchTypeScriptFilesOptions): () => void {\n const watcher = metro.getBundler().getBundler().getWatcher();\n\n const tsconfigPath = path.join(projectRoot, 'tsconfig.json');\n\n const listener = ({ eventsQueue }: { eventsQueue: WatchEvent[] }) => {\n for (const event of eventsQueue) {\n if (\n eventTypes.includes(event.type) &&\n event.metadata?.type !== 'd' &&\n // We need to ignore node_modules because Metro will add all of the files in node_modules to the watcher.\n !/node_modules/.test(event.filePath) &&\n // Ignore declaration files\n !/\\.d\\.ts$/.test(event.filePath)\n ) {\n const { filePath } = event;\n // Is TypeScript?\n if (\n // If the user adds a TypeScript file to the observable files in their project.\n /\\.tsx?$/.test(filePath) ||\n // Or if the user adds a tsconfig.json file to the project root.\n (tsconfig && filePath === tsconfigPath)\n ) {\n debug('Detected TypeScript file changed in the project: ', filePath);\n callback(event);\n\n if (throttle) {\n return;\n }\n }\n }\n }\n };\n\n debug('Waiting for TypeScript files to be added to the project...');\n watcher.addListener('change', listener);\n watcher.addListener('add', listener);\n\n const off = () => {\n watcher.removeListener('change', listener);\n watcher.removeListener('add', listener);\n };\n\n server.addListener?.('close', off);\n return off;\n}\n"],"names":["metroWatchTypeScriptFiles","debug","require","metro","server","projectRoot","callback","tsconfig","throttle","eventTypes","watcher","getBundler","getWatcher","tsconfigPath","path","join","listener","eventsQueue","event","includes","type","metadata","test","filePath","addListener","off","removeListener"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/metroWatchTypeScriptFiles.ts"],"sourcesContent":["import path from 'path';\n\nimport type { ServerLike } from '../BundlerDevServer';\n\nconst debug = require('debug')(\n 'expo:start:server:metro:metroWatchTypeScriptFiles'\n) as typeof console.log;\n\nexport interface MetroWatchTypeScriptFilesOptions {\n projectRoot: string;\n metro: import('metro').Server;\n server: ServerLike;\n /* Include tsconfig.json in the watcher */\n tsconfig?: boolean;\n callback: (event: WatchEvent) => void;\n /* Array of eventTypes to watch. Defaults to all events */\n eventTypes?: string[];\n /* Throlle the callback. When true and a group of events are recieved, callback it will only be called with the\n * first event */\n throttle?: boolean;\n}\n\ninterface WatchEvent {\n filePath: string;\n metadata?: {\n type: 'f' | 'd' | 'l'; // Regular file / Directory / Symlink\n } | null;\n type: string;\n}\n\n/**\n * Use the native file watcher / Metro ruleset to detect if a\n * TypeScript file is added to the project during development.\n */\nexport function metroWatchTypeScriptFiles({\n metro,\n server,\n projectRoot,\n callback,\n tsconfig = false,\n throttle = false,\n eventTypes = ['add', 'change', 'delete'],\n}: MetroWatchTypeScriptFilesOptions): () => void {\n const watcher = metro.getBundler().getBundler().getWatcher();\n\n const tsconfigPath = path.join(projectRoot, 'tsconfig.json');\n\n const listener = ({ eventsQueue }: { eventsQueue: WatchEvent[] }) => {\n for (const event of eventsQueue) {\n if (\n eventTypes.includes(event.type) &&\n event.metadata?.type !== 'd' &&\n // We need to ignore node_modules because Metro will add all of the files in node_modules to the watcher.\n !/node_modules/.test(event.filePath) &&\n // Ignore declaration files\n !/\\.d\\.ts$/.test(event.filePath)\n ) {\n const { filePath } = event;\n // Is TypeScript?\n if (\n // If the user adds a TypeScript file to the observable files in their project.\n /\\.tsx?$/.test(filePath) ||\n // Or if the user adds a tsconfig.json file to the project root.\n (tsconfig && filePath === tsconfigPath)\n ) {\n debug('Detected TypeScript file changed in the project: ', filePath);\n callback(event);\n\n if (throttle) {\n return;\n }\n }\n }\n }\n };\n\n debug('Waiting for TypeScript files to be added to the project...');\n watcher.addListener('change', listener);\n watcher.addListener('add', listener);\n\n const off = () => {\n watcher.removeListener('change', listener);\n watcher.removeListener('add', listener);\n };\n\n server.addListener?.('close', off);\n return off;\n}\n"],"names":["metroWatchTypeScriptFiles","debug","require","metro","server","projectRoot","callback","tsconfig","throttle","eventTypes","watcher","getBundler","getWatcher","tsconfigPath","path","join","listener","eventsQueue","event","includes","type","metadata","test","filePath","addListener","off","removeListener"],"mappings":"AAAA;;;;+BAkCgBA,2BAAyB;;aAAzBA,yBAAyB;;;8DAlCxB,MAAM;;;;;;;;;;;AAIvB,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAC5B,mDAAmD,CACpD,AAAsB,AAAC;AA4BjB,SAASF,yBAAyB,CAAC,EACxCG,KAAK,CAAA,EACLC,MAAM,CAAA,EACNC,WAAW,CAAA,EACXC,QAAQ,CAAA,EACRC,QAAQ,EA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,CAAC;IACpES,OAAO,CAACc,WAAW,CAAC,QAAQ,EAAER,QAAQ,CAAC,CAAC;IACxCN,OAAO,CAACc,WAAW,CAAC,KAAK,EAAER,QAAQ,CAAC,CAAC;IAErC,MAAMS,GAAG,GAAG,IAAM;QAChBf,OAAO,CAACgB,cAAc,CAAC,QAAQ,EAAEV,QAAQ,CAAC,CAAC;QAC3CN,OAAO,CAACgB,cAAc,CAAC,KAAK,EAAEV,QAAQ,CAAC,CAAC;IAC1C,CAAC,AAAC;IAEFZ,MAAM,CAACoB,WAAW,QAAgB,GAAlCpB,KAAAA,CAAkC,GAAlCA,MAAM,CAACoB,WAAW,CAAG,OAAO,EAAEC,GAAG,CAAC,CAAC;IACnC,OAAOA,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -2,16 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports
|
|
12
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getAppRouterRelativeEntryPath: ()=>getAppRouterRelativeEntryPath,
|
|
13
|
+
getRouterDirectoryModuleIdWithManifest: ()=>getRouterDirectoryModuleIdWithManifest,
|
|
14
|
+
getRouterDirectory: ()=>getRouterDirectory,
|
|
15
|
+
isApiRouteConvention: ()=>isApiRouteConvention,
|
|
16
|
+
getApiRoutesForDirectory: ()=>getApiRoutesForDirectory,
|
|
17
|
+
getRoutePaths: ()=>getRoutePaths,
|
|
18
|
+
hasWarnedAboutApiRoutes: ()=>hasWarnedAboutApiRoutes,
|
|
19
|
+
warnInvalidWebOutput: ()=>warnInvalidWebOutput
|
|
20
|
+
});
|
|
13
21
|
function _chalk() {
|
|
14
|
-
const data = _interopRequireDefault(require("chalk"));
|
|
22
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("chalk"));
|
|
15
23
|
_chalk = function() {
|
|
16
24
|
return data;
|
|
17
25
|
};
|
|
@@ -25,22 +33,22 @@ function _glob() {
|
|
|
25
33
|
return data;
|
|
26
34
|
}
|
|
27
35
|
function _path() {
|
|
28
|
-
const data = _interopRequireDefault(require("path"));
|
|
36
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
29
37
|
_path = function() {
|
|
30
38
|
return data;
|
|
31
39
|
};
|
|
32
40
|
return data;
|
|
33
41
|
}
|
|
34
42
|
function _resolveFrom() {
|
|
35
|
-
const data = _interopRequireDefault(require("resolve-from"));
|
|
43
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("resolve-from"));
|
|
36
44
|
_resolveFrom = function() {
|
|
37
45
|
return data;
|
|
38
46
|
};
|
|
39
47
|
return data;
|
|
40
48
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
const _log = require("../../../log");
|
|
50
|
+
const _dir = require("../../../utils/dir");
|
|
51
|
+
const _link = require("../../../utils/link");
|
|
44
52
|
function _interopRequireDefault(obj) {
|
|
45
53
|
return obj && obj.__esModule ? obj : {
|
|
46
54
|
default: obj
|
|
@@ -80,7 +88,7 @@ const logSrcDir = ()=>{
|
|
|
80
88
|
};
|
|
81
89
|
function getRouterDirectory(projectRoot) {
|
|
82
90
|
// more specific directories first
|
|
83
|
-
if ((0, _dir
|
|
91
|
+
if ((0, _dir.directoryExistsSync)(_path().default.join(projectRoot, "src/app"))) {
|
|
84
92
|
logSrcDir();
|
|
85
93
|
return "src/app";
|
|
86
94
|
}
|
|
@@ -91,16 +99,15 @@ function isApiRouteConvention(name) {
|
|
|
91
99
|
return /\+api\.[tj]sx?$/.test(name);
|
|
92
100
|
}
|
|
93
101
|
function getApiRoutesForDirectory(cwd) {
|
|
94
|
-
return _glob().sync("**/*+api.@(ts|tsx|js|jsx)", {
|
|
102
|
+
return (0, _glob().sync)("**/*+api.@(ts|tsx|js|jsx)", {
|
|
95
103
|
cwd,
|
|
96
104
|
absolute: true
|
|
97
105
|
});
|
|
98
106
|
}
|
|
99
107
|
function getRoutePaths(cwd) {
|
|
100
|
-
return _glob().sync("**/*.@(ts|tsx|js|jsx)", {
|
|
108
|
+
return (0, _glob().sync)("**/*.@(ts|tsx|js|jsx)", {
|
|
101
109
|
cwd
|
|
102
|
-
}).map((p)=>"./" + normalizePaths(p)
|
|
103
|
-
);
|
|
110
|
+
}).map((p)=>"./" + normalizePaths(p));
|
|
104
111
|
}
|
|
105
112
|
function normalizePaths(p) {
|
|
106
113
|
return p.replace(/\\/g, "/");
|
|
@@ -111,7 +118,7 @@ function hasWarnedAboutApiRoutes() {
|
|
|
111
118
|
}
|
|
112
119
|
function warnInvalidWebOutput() {
|
|
113
120
|
if (!hasWarnedAboutApiRouteOutput) {
|
|
114
|
-
_log.Log.warn(_chalk().default.yellow`Using API routes requires the {bold web.output} to be set to {bold "server"} in the project {bold app.json}. ${(0, _link
|
|
121
|
+
_log.Log.warn(_chalk().default.yellow`Using API routes requires the {bold web.output} to be set to {bold "server"} in the project {bold app.json}. ${(0, _link.learnMore)("https://docs.expo.dev/router/reference/api-routes/")}`);
|
|
115
122
|
}
|
|
116
123
|
hasWarnedAboutApiRouteOutput = true;
|
|
117
124
|
}
|