@expo/cli 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +10 -3
- package/build/bin/cli.map +1 -1
- package/build/src/api/user/actions.js +1 -1
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/export/createMetadataJson.js +2 -1
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +50 -3
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/xcodeCompilerLogger.js +97 -0
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -0
- package/build/src/export/exportApp.js +90 -103
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +18 -23
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportAsync.js +1 -1
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/exportHermes.js +0 -90
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +137 -108
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +12 -4
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +74 -49
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +1 -1
- package/build/src/export/metroAssetLocalPath.js.map +1 -1
- package/build/src/export/persistMetroAssets.js +28 -17
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/publicFolder.js +7 -0
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/saveAssets.js +176 -12
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/writeContents.js +8 -107
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/installAsync.js +29 -10
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +9 -2
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/run/hints.js +4 -0
- package/build/src/run/hints.js.map +1 -1
- package/build/src/run/index.js +101 -0
- package/build/src/run/index.js.map +1 -0
- package/build/src/start/doctor/dependencies/bundledNativeModules.js +2 -2
- package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +10 -3
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/resolvePackages.js +66 -0
- package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -0
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +2 -30
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +24 -8
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +8 -4
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +39 -16
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +6 -2
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +18 -1
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/bundleApiRoutes.js +3 -2
- package/build/src/start/server/metro/bundleApiRoutes.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +22 -5
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
- package/build/src/start/server/metro/createJResolver.js +5 -2
- package/build/src/start/server/metro/createJResolver.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js +2 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/{inspector-proxy/device.js → debugging/InspectorDevice.js} +8 -38
- package/build/src/start/server/metro/debugging/InspectorDevice.js.map +1 -0
- package/build/src/start/server/metro/debugging/InspectorProxy.js +116 -0
- package/build/src/start/server/metro/debugging/InspectorProxy.js.map +1 -0
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +45 -0
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/NetworkResponse.js +3 -4
- package/build/src/start/server/metro/debugging/inspectorHandlers/NetworkResponse.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/PageReload.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerGetPossibleBreakpoints.js +2 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerScriptParsed.js +3 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerScriptParsed.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerSetBreakpointByUrl.js +3 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerSetBreakpointByUrl.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeRuntimeCallFunctionOn.js +2 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeCallFunctionOn.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeRuntimeGetProperties.js +5 -4
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeGetProperties.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/types.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js +20 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js.map +1 -0
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +8 -5
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +3 -2
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/router.js +1 -5
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +0 -19
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +20 -4
- package/build/src/start/server/metro/serializeHtml.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +48 -85
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +12 -5
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +22 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +62 -9
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/route.test.js +11 -3
- package/build/src/start/server/type-generation/__typetests__/route.test.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +6 -4
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/codesigning.js +11 -1
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/env.js +7 -1
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js +3 -11
- package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -1
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +22 -12
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -1
- package/package.json +10 -10
- package/static/template/index.html +14 -95
- package/build/src/export/printBundleSizes.js +0 -101
- package/build/src/export/printBundleSizes.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/device.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/NetworkResponse.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/PageReload.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerScriptParsed.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerSetBreakpointByUrl.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeGetProperties.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/types.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/utils.js +0 -11
- package/build/src/start/server/metro/inspector-proxy/handlers/utils.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/index.js +0 -30
- package/build/src/start/server/metro/inspector-proxy/index.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/proxy.js +0 -169
- package/build/src/start/server/metro/inspector-proxy/proxy.js.map +0 -1
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +0 -64
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +0 -1
- /package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/PageReload.js +0 -0
- /package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/types.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport chalk from 'chalk';\n\nimport { clearNativeFolder, promptToClearMalformedNativeProjectsAsync } from './clearNativeFolder';\nimport { configureProjectAsync } from './configureProjectAsync';\nimport { ensureConfigAsync } from './ensureConfigAsync';\nimport { assertPlatforms, ensureValidPlatforms, resolveTemplateOption } from './resolveOptions';\nimport { updateFromTemplateAsync } from './updateFromTemplate';\nimport { installAsync } from '../install/installAsync';\nimport { Log } from '../log';\nimport { env } from '../utils/env';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { clearNodeModulesAsync } from '../utils/nodeModules';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\nimport { confirmAsync } from '../utils/prompts';\n\nconst debug = require('debug')('expo:prebuild') as typeof console.log;\n\nexport type PrebuildResults = {\n /** Expo config. */\n exp: ExpoConfig;\n /** Indicates if the process created new files. */\n hasNewProjectFiles: boolean;\n /** The platforms that were prebuilt. */\n platforms: ModPlatform[];\n /** Indicates if pod install was run. */\n podInstall: boolean;\n /** Indicates if node modules were installed. */\n nodeInstall: boolean;\n};\n\n/**\n * Entry point into the prebuild process, delegates to other helpers to perform various steps.\n *\n * 0. Attempt to clean the project folders.\n * 1. Create native projects (ios, android).\n * 2. Install node modules.\n * 3. Apply config to native projects.\n * 4. Install CocoaPods.\n */\nexport async function prebuildAsync(\n projectRoot: string,\n options: {\n /** Should install node modules and cocoapods. */\n install?: boolean;\n /** List of platforms to prebuild. */\n platforms: ModPlatform[];\n /** Should delete the native folders before attempting to prebuild. */\n clean?: boolean;\n /** URL or file path to the prebuild template. */\n template?: string;\n /** Name of the node package manager to install with. */\n packageManager?: {\n npm?: boolean;\n yarn?: boolean;\n pnpm?: boolean;\n bun?: boolean;\n };\n /** List of node modules to skip updating. */\n skipDependencyUpdate?: string[];\n }\n): Promise<PrebuildResults | null> {\n setNodeEnv('development');\n require('@expo/env').load(projectRoot);\n\n if (options.clean) {\n const { maybeBailOnGitStatusAsync } = await import('../utils/git.js');\n // Clean the project folders...\n if (await maybeBailOnGitStatusAsync()) {\n return null;\n }\n // Clear the native folders before syncing\n await clearNativeFolder(projectRoot, options.platforms);\n } else {\n // Check if the existing project folders are malformed.\n await promptToClearMalformedNativeProjectsAsync(projectRoot, options.platforms);\n }\n\n // Warn if the project is attempting to prebuild an unsupported platform (iOS on Windows).\n options.platforms = ensureValidPlatforms(options.platforms);\n // Assert if no platforms are left over after filtering.\n assertPlatforms(options.platforms);\n\n // Get the Expo config, create it if missing.\n const { exp, pkg } = await ensureConfigAsync(projectRoot, { platforms: options.platforms });\n\n // Create native projects from template.\n const { hasNewProjectFiles, needsPodInstall, changedDependencies } =\n await updateFromTemplateAsync(projectRoot, {\n exp,\n pkg,\n template: options.template != null ? resolveTemplateOption(options.template) : undefined,\n platforms: options.platforms,\n skipDependencyUpdate: options.skipDependencyUpdate,\n });\n\n // Install node modules\n if (options.install) {\n if (changedDependencies.length) {\n if (options.packageManager?.npm) {\n await clearNodeModulesAsync(projectRoot);\n }\n\n Log.log(chalk.gray(chalk`Dependencies in the {bold package.json} changed:`));\n Log.log(chalk.gray(' ' + changedDependencies.join(', ')));\n\n // Installing dependencies is a legacy feature from the unversioned\n // command. We know opt to not change dependencies unless a template\n // indicates a new dependency is required, or if the core dependencies are wrong.\n if (\n await confirmAsync({\n message: `Install the updated dependencies?`,\n initial: true,\n })\n ) {\n await installAsync([], {\n npm: !!options.packageManager?.npm,\n yarn: !!options.packageManager?.yarn,\n pnpm: !!options.packageManager?.pnpm,\n bun: !!options.packageManager?.bun,\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n }\n }\n }\n\n // Apply Expo config to native projects\n const configSyncingStep = logNewSection('Running prebuild');\n try {\n await profile(configureProjectAsync)(projectRoot, {\n platforms: options.platforms,\n exp,\n });\n configSyncingStep.succeed('Finished prebuild');\n } catch (error) {\n configSyncingStep.fail('Prebuild failed');\n throw error;\n }\n\n // Install CocoaPods\n let podsInstalled: boolean = false;\n // err towards running pod install less because it's slow and users can easily run npx pod-install afterwards.\n if (options.platforms.includes('ios') && options.install && needsPodInstall) {\n const { installCocoaPodsAsync } = await import('../utils/cocoapods.js');\n\n podsInstalled = await installCocoaPodsAsync(projectRoot);\n } else {\n debug('Skipped pod install');\n }\n\n return {\n nodeInstall: !!options.install,\n podInstall: !podsInstalled,\n platforms: options.platforms,\n hasNewProjectFiles,\n exp,\n };\n}\n"],"names":["prebuildAsync","debug","require","projectRoot","options","setNodeEnv","load","clean","maybeBailOnGitStatusAsync","clearNativeFolder","platforms","promptToClearMalformedNativeProjectsAsync","ensureValidPlatforms","assertPlatforms","exp","pkg","ensureConfigAsync","hasNewProjectFiles","needsPodInstall","changedDependencies","updateFromTemplateAsync","template","resolveTemplateOption","undefined","skipDependencyUpdate","install","length","packageManager","npm","clearNodeModulesAsync","Log","log","chalk","gray","join","confirmAsync","message","initial","installAsync","yarn","pnpm","bun","silent","env","EXPO_DEBUG","CI","configSyncingStep","logNewSection","profile","configureProjectAsync","succeed","error","fail","podsInstalled","includes","installCocoaPodsAsync","nodeInstall","podInstall"],"mappings":"AAAA;;;;QA0CsBA,aAAa,GAAbA,aAAa;AAxCjB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEoD,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AAC5D,IAAA,sBAAyB,WAAzB,yBAAyB,CAAA;AAC7B,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AACsB,IAAA,eAAkB,WAAlB,kBAAkB,CAAA;AACvD,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACjC,IAAA,aAAyB,WAAzB,yBAAyB,CAAA;AAClC,IAAA,IAAQ,WAAR,QAAQ,CAAA;AACR,IAAA,IAAc,WAAd,cAAc,CAAA;AACP,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACP,IAAA,YAAsB,WAAtB,sBAAsB,CAAA;AAC9B,IAAA,IAAc,WAAd,cAAc,CAAA;AACpB,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACb,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;;;;;;;;;;;;;;;;;;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C,CAAC;QAC1C,MAAMD,KAAK,CAAC;KACb;IAED,oBAAoB;IACpB,IAAIE,aAAa,GAAY,KAAK,AAAC;IACnC,8GAA8G;IAC9G,IAAIjD,OAAO,CAACM,SAAS,CAAC4C,QAAQ,CAAC,KAAK,CAAC,IAAIlD,OAAO,CAACqB,OAAO,IAAIP,eAAe,EAAE;QAC3E,MAAM,EAAEqC,qBAAqB,CAAA,EAAE,GAAG,MAAM;mDAAO,uBAAuB;UAAC,AAAC;QAExEF,aAAa,GAAG,MAAME,qBAAqB,CAACpD,WAAW,CAAC,CAAC;KAC1D,MAAM;QACLF,KAAK,CAAC,qBAAqB,CAAC,CAAC;KAC9B;IAED,OAAO;QACLuD,WAAW,EAAE,CAAC,CAACpD,OAAO,CAACqB,OAAO;QAC9BgC,UAAU,EAAE,CAACJ,aAAa;QAC1B3C,SAAS,EAAEN,OAAO,CAACM,SAAS;QAC5BO,kBAAkB;QAClBH,GAAG;KACJ,CAAC;CACH"}
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport chalk from 'chalk';\n\nimport { clearNativeFolder, promptToClearMalformedNativeProjectsAsync } from './clearNativeFolder';\nimport { configureProjectAsync } from './configureProjectAsync';\nimport { ensureConfigAsync } from './ensureConfigAsync';\nimport { assertPlatforms, ensureValidPlatforms, resolveTemplateOption } from './resolveOptions';\nimport { updateFromTemplateAsync } from './updateFromTemplate';\nimport { installAsync } from '../install/installAsync';\nimport { Log } from '../log';\nimport { env } from '../utils/env';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { clearNodeModulesAsync } from '../utils/nodeModules';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\nimport { confirmAsync } from '../utils/prompts';\n\nconst debug = require('debug')('expo:prebuild') as typeof console.log;\n\nexport type PrebuildResults = {\n /** Expo config. */\n exp: ExpoConfig;\n /** Indicates if the process created new files. */\n hasNewProjectFiles: boolean;\n /** The platforms that were prebuilt. */\n platforms: ModPlatform[];\n /** Indicates if pod install was run. */\n podInstall: boolean;\n /** Indicates if node modules were installed. */\n nodeInstall: boolean;\n};\n\n/**\n * Entry point into the prebuild process, delegates to other helpers to perform various steps.\n *\n * 0. Attempt to clean the project folders.\n * 1. Create native projects (ios, android).\n * 2. Install node modules.\n * 3. Apply config to native projects.\n * 4. Install CocoaPods.\n */\nexport async function prebuildAsync(\n projectRoot: string,\n options: {\n /** Should install node modules and cocoapods. */\n install?: boolean;\n /** List of platforms to prebuild. */\n platforms: ModPlatform[];\n /** Should delete the native folders before attempting to prebuild. */\n clean?: boolean;\n /** URL or file path to the prebuild template. */\n template?: string;\n /** Name of the node package manager to install with. */\n packageManager?: {\n npm?: boolean;\n yarn?: boolean;\n pnpm?: boolean;\n bun?: boolean;\n };\n /** List of node modules to skip updating. */\n skipDependencyUpdate?: string[];\n }\n): Promise<PrebuildResults | null> {\n setNodeEnv('development');\n require('@expo/env').load(projectRoot);\n\n if (options.clean) {\n const { maybeBailOnGitStatusAsync } = await import('../utils/git.js');\n // Clean the project folders...\n if (await maybeBailOnGitStatusAsync()) {\n return null;\n }\n // Clear the native folders before syncing\n await clearNativeFolder(projectRoot, options.platforms);\n } else {\n // Check if the existing project folders are malformed.\n await promptToClearMalformedNativeProjectsAsync(projectRoot, options.platforms);\n }\n\n // Warn if the project is attempting to prebuild an unsupported platform (iOS on Windows).\n options.platforms = ensureValidPlatforms(options.platforms);\n // Assert if no platforms are left over after filtering.\n assertPlatforms(options.platforms);\n\n // Get the Expo config, create it if missing.\n const { exp, pkg } = await ensureConfigAsync(projectRoot, { platforms: options.platforms });\n\n // Create native projects from template.\n const { hasNewProjectFiles, needsPodInstall, changedDependencies } =\n await updateFromTemplateAsync(projectRoot, {\n exp,\n pkg,\n template: options.template != null ? resolveTemplateOption(options.template) : undefined,\n platforms: options.platforms,\n skipDependencyUpdate: options.skipDependencyUpdate,\n });\n\n // Install node modules\n if (options.install) {\n if (changedDependencies.length) {\n if (options.packageManager?.npm) {\n await clearNodeModulesAsync(projectRoot);\n }\n\n Log.log(chalk.gray(chalk`Dependencies in the {bold package.json} changed:`));\n Log.log(chalk.gray(' ' + changedDependencies.join(', ')));\n\n // Installing dependencies is a legacy feature from the unversioned\n // command. We know opt to not change dependencies unless a template\n // indicates a new dependency is required, or if the core dependencies are wrong.\n if (\n await confirmAsync({\n message: `Install the updated dependencies?`,\n initial: true,\n })\n ) {\n await installAsync([], {\n npm: !!options.packageManager?.npm,\n yarn: !!options.packageManager?.yarn,\n pnpm: !!options.packageManager?.pnpm,\n bun: !!options.packageManager?.bun,\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n }\n }\n }\n\n // Apply Expo config to native projects. Prevent log-spew from ora when running in debug mode.\n const configSyncingStep: { succeed(text?: string): unknown; fail(text?: string): unknown } =\n env.EXPO_DEBUG\n ? {\n succeed(text) {\n Log.log(text!);\n },\n fail(text) {\n Log.error(text!);\n },\n }\n : logNewSection('Running prebuild');\n try {\n await profile(configureProjectAsync)(projectRoot, {\n platforms: options.platforms,\n exp,\n });\n configSyncingStep.succeed('Finished prebuild');\n } catch (error) {\n configSyncingStep.fail('Prebuild failed');\n throw error;\n }\n\n // Install CocoaPods\n let podsInstalled: boolean = false;\n // err towards running pod install less because it's slow and users can easily run npx pod-install afterwards.\n if (options.platforms.includes('ios') && options.install && needsPodInstall) {\n const { installCocoaPodsAsync } = await import('../utils/cocoapods.js');\n\n podsInstalled = await installCocoaPodsAsync(projectRoot);\n } else {\n debug('Skipped pod install');\n }\n\n return {\n nodeInstall: !!options.install,\n podInstall: !podsInstalled,\n platforms: options.platforms,\n hasNewProjectFiles,\n exp,\n };\n}\n"],"names":["prebuildAsync","debug","require","projectRoot","options","setNodeEnv","load","clean","maybeBailOnGitStatusAsync","clearNativeFolder","platforms","promptToClearMalformedNativeProjectsAsync","ensureValidPlatforms","assertPlatforms","exp","pkg","ensureConfigAsync","hasNewProjectFiles","needsPodInstall","changedDependencies","updateFromTemplateAsync","template","resolveTemplateOption","undefined","skipDependencyUpdate","install","length","packageManager","npm","clearNodeModulesAsync","Log","log","chalk","gray","join","confirmAsync","message","initial","installAsync","yarn","pnpm","bun","silent","env","EXPO_DEBUG","CI","configSyncingStep","succeed","text","fail","error","logNewSection","profile","configureProjectAsync","podsInstalled","includes","installCocoaPodsAsync","nodeInstall","podInstall"],"mappings":"AAAA;;;;QA0CsBA,aAAa,GAAbA,aAAa;AAxCjB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEoD,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AAC5D,IAAA,sBAAyB,WAAzB,yBAAyB,CAAA;AAC7B,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AACsB,IAAA,eAAkB,WAAlB,kBAAkB,CAAA;AACvD,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACjC,IAAA,aAAyB,WAAzB,yBAAyB,CAAA;AAClC,IAAA,IAAQ,WAAR,QAAQ,CAAA;AACR,IAAA,IAAc,WAAd,cAAc,CAAA;AACP,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACP,IAAA,YAAsB,WAAtB,sBAAsB,CAAA;AAC9B,IAAA,IAAc,WAAd,cAAc,CAAA;AACpB,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACb,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,AAAsB,AAAC;AAwB/D,eAAeF,aAAa,CACjCG,WAAmB,EACnBC,OAkBC,EACgC;IACjCC,CAAAA,GAAAA,QAAU,AAAe,CAAA,WAAf,CAAC,aAAa,CAAC,CAAC;IAC1BH,OAAO,CAAC,WAAW,CAAC,CAACI,IAAI,CAACH,WAAW,CAAC,CAAC;IAEvC,IAAIC,OAAO,CAACG,KAAK,EAAE;QACjB,MAAM,EA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D,OAAO,CAACM,SAAS,CAAC6C,QAAQ,CAAC,KAAK,CAAC,IAAInD,OAAO,CAACqB,OAAO,IAAIP,eAAe,EAAE;QAC3E,MAAM,EAAEsC,qBAAqB,CAAA,EAAE,GAAG,MAAM;mDAAO,uBAAuB;UAAC,AAAC;QAExEF,aAAa,GAAG,MAAME,qBAAqB,CAACrD,WAAW,CAAC,CAAC;KAC1D,MAAM;QACLF,KAAK,CAAC,qBAAqB,CAAC,CAAC;KAC9B;IAED,OAAO;QACLwD,WAAW,EAAE,CAAC,CAACrD,OAAO,CAACqB,OAAO;QAC9BiC,UAAU,EAAE,CAACJ,aAAa;QAC1B5C,SAAS,EAAEN,OAAO,CAACM,SAAS;QAC5BO,kBAAkB;QAClBH,GAAG;KACJ,CAAC;CACH"}
|
package/build/src/run/hints.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.logDeviceArgument = logDeviceArgument;
|
|
6
|
+
exports.logPlatformRunCommand = logPlatformRunCommand;
|
|
6
7
|
exports.logProjectLogsLocation = logProjectLogsLocation;
|
|
7
8
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
9
|
var _log = require("../log");
|
|
@@ -15,6 +16,9 @@ function _interopRequireDefault(obj) {
|
|
|
15
16
|
function logDeviceArgument(id) {
|
|
16
17
|
_log.Log.log(_chalk.default.dim`› Using --device ${id}`);
|
|
17
18
|
}
|
|
19
|
+
function logPlatformRunCommand(platform, argv = []) {
|
|
20
|
+
_log.Log.log(_chalk.default.dim(`› Using expo run:${platform} ${argv.join(" ")}`));
|
|
21
|
+
}
|
|
18
22
|
function logProjectLogsLocation() {
|
|
19
23
|
_log.Log.log(_chalk.default`\n› Logs for your project will appear below.${(0, _interactive).isInteractive() ? _chalk.default.dim(` Press Ctrl+C to exit.`) : ""}`);
|
|
20
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/run/hints.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { Log } from '../log';\nimport { isInteractive } from '../utils/interactive';\n\n/** Log the device argument to use for the next run: `Using --device foobar` */\nexport function logDeviceArgument(id: string) {\n Log.log(chalk.dim`› Using --device ${id}`);\n}\n\nexport function logProjectLogsLocation() {\n Log.log(\n chalk`\\n› Logs for your project will appear below.${\n isInteractive() ? chalk.dim(` Press Ctrl+C to exit.`) : ''\n }`\n );\n}\n"],"names":["logDeviceArgument","logProjectLogsLocation","id","Log","log","chalk","dim","isInteractive"],"mappings":"AAAA;;;;QAMgBA,iBAAiB,GAAjBA,iBAAiB;QAIjBC,sBAAsB,GAAtBA,sBAAsB;
|
|
1
|
+
{"version":3,"sources":["../../../src/run/hints.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { Log } from '../log';\nimport { isInteractive } from '../utils/interactive';\n\n/** Log the device argument to use for the next run: `Using --device foobar` */\nexport function logDeviceArgument(id: string) {\n Log.log(chalk.dim`› Using --device ${id}`);\n}\n\nexport function logPlatformRunCommand(platform: string, argv: string[] = []) {\n Log.log(chalk.dim(`› Using expo run:${platform} ${argv.join(' ')}`));\n}\n\nexport function logProjectLogsLocation() {\n Log.log(\n chalk`\\n› Logs for your project will appear below.${\n isInteractive() ? chalk.dim(` Press Ctrl+C to exit.`) : ''\n }`\n );\n}\n"],"names":["logDeviceArgument","logPlatformRunCommand","logProjectLogsLocation","id","Log","log","chalk","dim","platform","argv","join","isInteractive"],"mappings":"AAAA;;;;QAMgBA,iBAAiB,GAAjBA,iBAAiB;QAIjBC,qBAAqB,GAArBA,qBAAqB;QAIrBC,sBAAsB,GAAtBA,sBAAsB;AAdpB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEL,IAAA,IAAQ,WAAR,QAAQ,CAAA;AACE,IAAA,YAAsB,WAAtB,sBAAsB,CAAA;;;;;;AAG7C,SAASF,iBAAiB,CAACG,EAAU,EAAE;IAC5CC,IAAG,IAAA,CAACC,GAAG,CAACC,MAAK,QAAA,CAACC,GAAG,CAAC,mBAAmB,EAAEJ,EAAE,CAAC,CAAC,CAAC,CAAC;CAC9C;AAEM,SAASF,qBAAqB,CAACO,QAAgB,EAAEC,IAAc,GAAG,EAAE,EAAE;IAC3EL,IAAG,IAAA,CAACC,GAAG,CAACC,MAAK,QAAA,CAACC,GAAG,CAAC,CAAC,mBAAmB,EAAEC,QAAQ,CAAC,CAAC,EAAEC,IAAI,CAACC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACxE;AAEM,SAASR,sBAAsB,GAAG;IACvCE,IAAG,IAAA,CAACC,GAAG,CACLC,MAAK,QAAA,CAAC,8CAA4C,EAChDK,CAAAA,GAAAA,YAAa,AAAE,CAAA,cAAF,EAAE,GAAGL,MAAK,QAAA,CAACC,GAAG,CAAC,CAAC,sBAAsB,CAAC,CAAC,GAAG,EAAE,CAC3D,CAAC,CACH,CAAC;CACH"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.expoRun = void 0;
|
|
7
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
+
var _hints = require("./hints");
|
|
9
|
+
var _args = require("../utils/args");
|
|
10
|
+
var _errors = require("../utils/errors");
|
|
11
|
+
function _interopRequireDefault(obj) {
|
|
12
|
+
return obj && obj.__esModule ? obj : {
|
|
13
|
+
default: obj
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function _interopRequireWildcard(obj) {
|
|
17
|
+
if (obj && obj.__esModule) {
|
|
18
|
+
return obj;
|
|
19
|
+
} else {
|
|
20
|
+
var newObj = {};
|
|
21
|
+
if (obj != null) {
|
|
22
|
+
for(var key in obj){
|
|
23
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
24
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
25
|
+
if (desc.get || desc.set) {
|
|
26
|
+
Object.defineProperty(newObj, key, desc);
|
|
27
|
+
} else {
|
|
28
|
+
newObj[key] = obj[key];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
newObj.default = obj;
|
|
34
|
+
return newObj;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const expoRun = async (argv)=>{
|
|
38
|
+
const args = (0, _args).assertWithOptionsArgs({
|
|
39
|
+
// Types
|
|
40
|
+
"--help": Boolean,
|
|
41
|
+
// Aliases
|
|
42
|
+
"-h": "--help"
|
|
43
|
+
}, {
|
|
44
|
+
argv,
|
|
45
|
+
// Allow additional flags for both android and ios commands
|
|
46
|
+
permissive: true
|
|
47
|
+
});
|
|
48
|
+
try {
|
|
49
|
+
var __;
|
|
50
|
+
let [platform] = (__ = args._) != null ? __ : [];
|
|
51
|
+
// Workaround, filter `--flag` as platform
|
|
52
|
+
if (platform == null ? void 0 : platform.startsWith("-")) {
|
|
53
|
+
platform = "";
|
|
54
|
+
}
|
|
55
|
+
// Remove the platform from raw arguments, when provided
|
|
56
|
+
const argsWithoutPlatform = !platform ? argv : argv == null ? void 0 : argv.splice(1);
|
|
57
|
+
// Do not capture `--help` when platform is provided
|
|
58
|
+
if (!platform && args["--help"]) {
|
|
59
|
+
(0, _args).printHelp("Run the native app locally", `npx expo run <android|ios>`, _chalk.default`{dim $} npx expo run <android|ios> --help Output usage information`);
|
|
60
|
+
}
|
|
61
|
+
if (!platform) {
|
|
62
|
+
const { selectAsync } = await Promise.resolve().then(function() {
|
|
63
|
+
return _interopRequireWildcard(require("../utils/prompts.js"));
|
|
64
|
+
});
|
|
65
|
+
platform = await selectAsync("Select the platform to run", [
|
|
66
|
+
{
|
|
67
|
+
title: "Android",
|
|
68
|
+
value: "android"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
title: "iOS",
|
|
72
|
+
value: "ios"
|
|
73
|
+
},
|
|
74
|
+
]);
|
|
75
|
+
}
|
|
76
|
+
(0, _hints).logPlatformRunCommand(platform, argsWithoutPlatform);
|
|
77
|
+
switch(platform){
|
|
78
|
+
case "android":
|
|
79
|
+
{
|
|
80
|
+
const { expoRunAndroid } = await Promise.resolve().then(function() {
|
|
81
|
+
return _interopRequireWildcard(require("./android/index.js"));
|
|
82
|
+
});
|
|
83
|
+
return expoRunAndroid(argsWithoutPlatform);
|
|
84
|
+
}
|
|
85
|
+
case "ios":
|
|
86
|
+
{
|
|
87
|
+
const { expoRunIos } = await Promise.resolve().then(function() {
|
|
88
|
+
return _interopRequireWildcard(require("./ios/index.js"));
|
|
89
|
+
});
|
|
90
|
+
return expoRunIos(argsWithoutPlatform);
|
|
91
|
+
}
|
|
92
|
+
default:
|
|
93
|
+
throw new _errors.CommandError("UNSUPPORTED_PLATFORM", `Unsupported platform: ${platform}`);
|
|
94
|
+
}
|
|
95
|
+
} catch (error) {
|
|
96
|
+
(0, _errors).logCmdError(error);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
exports.expoRun = expoRun;
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/run/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { logPlatformRunCommand } from './hints';\nimport { Command } from '../../bin/cli';\nimport { assertWithOptionsArgs, printHelp } from '../utils/args';\nimport { CommandError, logCmdError } from '../utils/errors';\n\nexport const expoRun: Command = async (argv) => {\n const args = assertWithOptionsArgs(\n {\n // Types\n '--help': Boolean,\n // Aliases\n '-h': '--help',\n },\n {\n argv,\n // Allow additional flags for both android and ios commands\n permissive: true,\n }\n );\n\n try {\n let [platform] = args._ ?? [];\n\n // Workaround, filter `--flag` as platform\n if (platform?.startsWith('-')) {\n platform = '';\n }\n\n // Remove the platform from raw arguments, when provided\n const argsWithoutPlatform = !platform ? argv : argv?.splice(1);\n\n // Do not capture `--help` when platform is provided\n if (!platform && args['--help']) {\n printHelp(\n 'Run the native app locally',\n `npx expo run <android|ios>`,\n chalk`{dim $} npx expo run <android|ios> --help Output usage information`\n );\n }\n\n if (!platform) {\n const { selectAsync } = await import('../utils/prompts.js');\n platform = await selectAsync('Select the platform to run', [\n { title: 'Android', value: 'android' },\n { title: 'iOS', value: 'ios' },\n ]);\n }\n\n logPlatformRunCommand(platform, argsWithoutPlatform);\n\n switch (platform) {\n case 'android': {\n const { expoRunAndroid } = await import('./android/index.js');\n return expoRunAndroid(argsWithoutPlatform);\n }\n\n case 'ios': {\n const { expoRunIos } = await import('./ios/index.js');\n return expoRunIos(argsWithoutPlatform);\n }\n\n default:\n throw new CommandError('UNSUPPORTED_PLATFORM', `Unsupported platform: ${platform}`);\n }\n } catch (error: any) {\n logCmdError(error);\n }\n};\n"],"names":["expoRun","argv","args","assertWithOptionsArgs","Boolean","permissive","platform","_","startsWith","argsWithoutPlatform","splice","printHelp","chalk","selectAsync","title","value","logPlatformRunCommand","expoRunAndroid","expoRunIos","CommandError","error","logCmdError"],"mappings":"AAAA;;;;;;AACkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEa,IAAA,MAAS,WAAT,SAAS,CAAA;AAEE,IAAA,KAAe,WAAf,eAAe,CAAA;AACtB,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpD,MAAMA,OAAO,GAAY,OAAOC,IAAI,GAAK;IAC9C,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAqB,AAYjC,CAAA,sBAZiC,CAChC;QACE,QAAQ;QACR,QAAQ,EAAEC,OAAO;QACjB,UAAU;QACV,IAAI,EAAE,QAAQ;KACf,EACD;QACEH,IAAI;QACJ,2DAA2D;QAC3DI,UAAU,EAAE,IAAI;KACjB,CACF,AAAC;IAEF,IAAI;YACeH,EAAM;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iBAC5C;YAED,KAAK,KAAK;gBAAE;oBACV,MAAM,EAAES,UAAU,CAAA,EAAE,GAAG,MAAM;+DAAO,gBAAgB;sBAAC,AAAC;oBACtD,OAAOA,UAAU,CAACT,mBAAmB,CAAC,CAAC;iBACxC;YAED;gBACE,MAAM,IAAIU,OAAY,aAAA,CAAC,sBAAsB,EAAE,CAAC,sBAAsB,EAAEb,QAAQ,CAAC,CAAC,CAAC,CAAC;SACvF;KACF,CAAC,OAAOc,KAAK,EAAO;QACnBC,CAAAA,GAAAA,OAAW,AAAO,CAAA,YAAP,CAACD,KAAK,CAAC,CAAC;KACpB;CACF,AAAC;QA9DWpB,OAAO,GAAPA,OAAO"}
|
|
@@ -37,8 +37,8 @@ function _interopRequireWildcard(obj) {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
const debug = require("debug")("expo:doctor:dependencies:bundledNativeModules");
|
|
40
|
-
async function getVersionedNativeModulesAsync(projectRoot, sdkVersion) {
|
|
41
|
-
if (sdkVersion !== "UNVERSIONED" && !_env.env.EXPO_OFFLINE) {
|
|
40
|
+
async function getVersionedNativeModulesAsync(projectRoot, sdkVersion, options = {}) {
|
|
41
|
+
if (sdkVersion !== "UNVERSIONED" && !_env.env.EXPO_OFFLINE && !options.skipRemoteVersions) {
|
|
42
42
|
try {
|
|
43
43
|
debug("Fetching bundled native modules from the server...");
|
|
44
44
|
return await (0, _getNativeModuleVersions).getNativeModuleVersionsAsync(sdkVersion);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/dependencies/bundledNativeModules.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport chalk from 'chalk';\nimport resolveFrom from 'resolve-from';\n\nimport { getNativeModuleVersionsAsync } from '../../../api/getNativeModuleVersions';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')(\n 'expo:doctor:dependencies:bundledNativeModules'\n) as typeof console.log;\n\nexport type BundledNativeModules = Record<string, string>;\n\n/**\n * Gets the bundledNativeModules.json for a given SDK version:\n * - Tries to fetch the data from the /sdks/:sdkVersion/native-modules API endpoint.\n * - If the data is missing on the server (it can happen for SDKs that are yet fully released)\n * or there's a downtime, reads the local .json file from the \"expo\" package.\n * - For UNVERSIONED, returns the local .json file contents.\n */\nexport async function getVersionedNativeModulesAsync(\n projectRoot: string,\n sdkVersion: string\n): Promise<BundledNativeModules> {\n if (sdkVersion !== 'UNVERSIONED' && !env.EXPO_OFFLINE) {\n try {\n debug('Fetching bundled native modules from the server...');\n return await getNativeModuleVersionsAsync(sdkVersion);\n } catch (error: any) {\n if (error instanceof CommandError && (error.code === 'OFFLINE' || error.code === 'API')) {\n Log.warn(\n chalk`Unable to reach well-known versions endpoint. Using local dependency map {bold expo/bundledNativeModules.json} for version validation`\n );\n } else {\n throw error;\n }\n }\n }\n\n debug('Fetching bundled native modules from the local JSON file...');\n return await getBundledNativeModulesAsync(projectRoot);\n}\n\n/**\n * Get the legacy static `bundledNativeModules.json` file\n * that's shipped with the version of `expo` that the project has installed.\n */\nasync function getBundledNativeModulesAsync(projectRoot: string): Promise<BundledNativeModules> {\n // TODO: Revisit now that this code is in the `expo` package.\n const bundledNativeModulesPath = resolveFrom.silent(\n projectRoot,\n 'expo/bundledNativeModules.json'\n );\n if (!bundledNativeModulesPath) {\n Log.log();\n throw new CommandError(\n chalk`The dependency map {bold expo/bundledNativeModules.json} cannot be found, please ensure you have the package \"{bold expo}\" installed in your project.`\n );\n }\n return await JsonFile.readAsync<BundledNativeModules>(bundledNativeModulesPath);\n}\n"],"names":["getVersionedNativeModulesAsync","Log","debug","require","projectRoot","sdkVersion","env","EXPO_OFFLINE","getNativeModuleVersionsAsync","error","CommandError","code","warn","chalk","getBundledNativeModulesAsync","bundledNativeModulesPath","resolveFrom","silent","log","JsonFile","readAsync"],"mappings":"AAAA;;;;QAsBsBA,8BAA8B,GAA9BA,8BAA8B;AAtB/B,IAAA,SAAiB,kCAAjB,iBAAiB,EAAA;AACpB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACD,IAAA,YAAc,kCAAd,cAAc,EAAA;AAEO,IAAA,wBAAsC,WAAtC,sCAAsC,CAAA;AACvEC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACK,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACX,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAC5B,+CAA+C,CAChD,AAAsB,AAAC;AAWjB,eAAeH,8BAA8B,CAClDI,WAAmB,EACnBC,UAAkB,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/dependencies/bundledNativeModules.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport chalk from 'chalk';\nimport resolveFrom from 'resolve-from';\n\nimport { getNativeModuleVersionsAsync } from '../../../api/getNativeModuleVersions';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')(\n 'expo:doctor:dependencies:bundledNativeModules'\n) as typeof console.log;\n\nexport type BundledNativeModules = Record<string, string>;\n\n/**\n * Gets the bundledNativeModules.json for a given SDK version:\n * - Tries to fetch the data from the /sdks/:sdkVersion/native-modules API endpoint.\n * - If the data is missing on the server (it can happen for SDKs that are yet fully released)\n * or there's a downtime, reads the local .json file from the \"expo\" package.\n * - For UNVERSIONED, returns the local .json file contents.\n */\nexport async function getVersionedNativeModulesAsync(\n projectRoot: string,\n sdkVersion: string,\n options: {\n skipRemoteVersions?: boolean;\n } = {}\n): Promise<BundledNativeModules> {\n if (sdkVersion !== 'UNVERSIONED' && !env.EXPO_OFFLINE && !options.skipRemoteVersions) {\n try {\n debug('Fetching bundled native modules from the server...');\n return await getNativeModuleVersionsAsync(sdkVersion);\n } catch (error: any) {\n if (error instanceof CommandError && (error.code === 'OFFLINE' || error.code === 'API')) {\n Log.warn(\n chalk`Unable to reach well-known versions endpoint. Using local dependency map {bold expo/bundledNativeModules.json} for version validation`\n );\n } else {\n throw error;\n }\n }\n }\n\n debug('Fetching bundled native modules from the local JSON file...');\n return await getBundledNativeModulesAsync(projectRoot);\n}\n\n/**\n * Get the legacy static `bundledNativeModules.json` file\n * that's shipped with the version of `expo` that the project has installed.\n */\nasync function getBundledNativeModulesAsync(projectRoot: string): Promise<BundledNativeModules> {\n // TODO: Revisit now that this code is in the `expo` package.\n const bundledNativeModulesPath = resolveFrom.silent(\n projectRoot,\n 'expo/bundledNativeModules.json'\n );\n if (!bundledNativeModulesPath) {\n Log.log();\n throw new CommandError(\n chalk`The dependency map {bold expo/bundledNativeModules.json} cannot be found, please ensure you have the package \"{bold expo}\" installed in your project.`\n );\n }\n return await JsonFile.readAsync<BundledNativeModules>(bundledNativeModulesPath);\n}\n"],"names":["getVersionedNativeModulesAsync","Log","debug","require","projectRoot","sdkVersion","options","env","EXPO_OFFLINE","skipRemoteVersions","getNativeModuleVersionsAsync","error","CommandError","code","warn","chalk","getBundledNativeModulesAsync","bundledNativeModulesPath","resolveFrom","silent","log","JsonFile","readAsync"],"mappings":"AAAA;;;;QAsBsBA,8BAA8B,GAA9BA,8BAA8B;AAtB/B,IAAA,SAAiB,kCAAjB,iBAAiB,EAAA;AACpB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACD,IAAA,YAAc,kCAAd,cAAc,EAAA;AAEO,IAAA,wBAAsC,WAAtC,sCAAsC,CAAA;AACvEC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACK,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACX,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEpD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAC5B,+CAA+C,CAChD,AAAsB,AAAC;AAWjB,eAAeH,8BAA8B,CAClDI,WAAmB,EACnBC,UAAkB,EAClBC,OAEC,GAAG,EAAE,EACyB;IAC/B,IAAID,UAAU,KAAK,aAAa,IAAI,CAACE,IAAG,IAAA,CAACC,YAAY,IAAI,CAACF,OAAO,CAACG,kBAAkB,EAAE;QACpF,IAAI;YACFP,KAAK,CAAC,oDAAoD,CAAC,CAAC;YAC5D,OAAO,MAAMQ,CAAAA,GAAAA,wBAA4B,AAAY,CAAA,6BAAZ,CAACL,UAAU,CAAC,CAAC;SACvD,CAAC,OAAOM,KAAK,EAAO;YACnB,IAAIA,KAAK,YAAYC,OAAY,aAAA,IAAI,CAACD,KAAK,CAACE,IAAI,KAAK,SAAS,IAAIF,KAAK,CAACE,IAAI,KAAK,KAAK,CAAC,EAAE;gBACvFZ,GAAG,CAACa,IAAI,CACNC,MAAK,QAAA,CAAC,qIAAqI,CAAC,CAC7I,CAAC;aACH,MAAM;gBACL,MAAMJ,KAAK,CAAC;aACb;SACF;KACF;IAEDT,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACrE,OAAO,MAAMc,4BAA4B,CAACZ,WAAW,CAAC,CAAC;CACxD;AAED;;;GAGG,CACH,eAAeY,4BAA4B,CAACZ,WAAmB,EAAiC;IAC9F,6DAA6D;IAC7D,MAAMa,wBAAwB,GAAGC,YAAW,QAAA,CAACC,MAAM,CACjDf,WAAW,EACX,gCAAgC,CACjC,AAAC;IACF,IAAI,CAACa,wBAAwB,EAAE;QAC7BhB,GAAG,CAACmB,GAAG,EAAE,CAAC;QACV,MAAM,IAAIR,OAAY,aAAA,CACpBG,MAAK,QAAA,CAAC,qJAAqJ,CAAC,CAC7J,CAAC;KACH;IACD,OAAO,MAAMM,SAAQ,QAAA,CAACC,SAAS,CAAuBL,wBAAwB,CAAC,CAAC;CACjF"}
|
|
@@ -8,6 +8,7 @@ exports.getVersionedPackagesAsync = getVersionedPackagesAsync;
|
|
|
8
8
|
exports.getOperationLog = getOperationLog;
|
|
9
9
|
var _npmPackageArg = _interopRequireDefault(require("npm-package-arg"));
|
|
10
10
|
var _bundledNativeModules = require("./bundledNativeModules");
|
|
11
|
+
var _resolvePackages = require("./resolvePackages");
|
|
11
12
|
var _getVersions = require("../../../api/getVersions");
|
|
12
13
|
var _log = require("../../../log");
|
|
13
14
|
var _env = require("../../../utils/env");
|
|
@@ -38,11 +39,17 @@ const debug = require("debug")("expo:doctor:dependencies:getVersionedPackages");
|
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
41
|
async function getCombinedKnownVersionsAsync({ projectRoot , sdkVersion , skipCache }) {
|
|
41
|
-
const
|
|
42
|
-
|
|
42
|
+
const skipRemoteVersions = await (0, _resolvePackages).hasExpoCanaryAsync(projectRoot);
|
|
43
|
+
if (skipRemoteVersions) {
|
|
44
|
+
_log.Log.warn("Dependency validation might be unreliable when using canary SDK versions");
|
|
45
|
+
}
|
|
46
|
+
const bundledNativeModules = sdkVersion ? await (0, _bundledNativeModules).getVersionedNativeModulesAsync(projectRoot, sdkVersion, {
|
|
47
|
+
skipRemoteVersions
|
|
48
|
+
}) : {};
|
|
49
|
+
const versionsForSdk = !skipRemoteVersions ? await getRemoteVersionsForSdkAsync({
|
|
43
50
|
sdkVersion,
|
|
44
51
|
skipCache
|
|
45
|
-
});
|
|
52
|
+
}) : {};
|
|
46
53
|
return {
|
|
47
54
|
...bundledNativeModules,
|
|
48
55
|
// Prefer the remote versions over the bundled versions, this enables us to push
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/dependencies/getVersionedPackages.ts"],"sourcesContent":["import { PackageJSONConfig } from '@expo/config';\nimport npmPackageArg from 'npm-package-arg';\n\nimport { getVersionedNativeModulesAsync } from './bundledNativeModules';\nimport { getVersionsAsync, SDKVersion } from '../../../api/getVersions';\nimport { Log } from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')(\n 'expo:doctor:dependencies:getVersionedPackages'\n) as typeof console.log;\n\nexport type DependencyList = Record<string, string>;\n\n/** Adds `react-dom`, `react`, and `react-native` to the list of known package versions (`relatedPackages`) */\nfunction normalizeSdkVersionObject(version?: SDKVersion): Record<string, string> {\n if (!version) {\n return {};\n }\n const { relatedPackages, facebookReactVersion, facebookReactNativeVersion, expoVersion } =\n version;\n\n const reactVersion = facebookReactVersion\n ? {\n react: facebookReactVersion,\n 'react-dom': facebookReactVersion,\n }\n : undefined;\n\n const expoVersionIfAvailable = expoVersion ? { expo: expoVersion } : undefined;\n\n return {\n ...relatedPackages,\n ...reactVersion,\n ...expoVersionIfAvailable,\n 'react-native': facebookReactNativeVersion,\n };\n}\n\n/** Get the known versions for a given SDK, combines all sources. */\nexport async function getCombinedKnownVersionsAsync({\n projectRoot,\n sdkVersion,\n skipCache,\n}: {\n projectRoot: string;\n sdkVersion?: string;\n skipCache?: boolean;\n}) {\n const bundledNativeModules = sdkVersion\n ? await getVersionedNativeModulesAsync(projectRoot, sdkVersion)\n : {};\n const versionsForSdk = await getRemoteVersionsForSdkAsync({ sdkVersion, skipCache });\n return {\n ...bundledNativeModules,\n // Prefer the remote versions over the bundled versions, this enables us to push\n // emergency fixes that users can access without having to update the `expo` package.\n ...versionsForSdk,\n };\n}\n\n/** @returns a key/value list of known dependencies and their version (including range). */\nexport async function getRemoteVersionsForSdkAsync({\n sdkVersion,\n skipCache,\n}: { sdkVersion?: string; skipCache?: boolean } = {}): Promise<DependencyList> {\n if (env.EXPO_OFFLINE) {\n Log.warn('Dependency validation is unreliable in offline-mode');\n return {};\n }\n\n try {\n const { sdkVersions } = await getVersionsAsync({ skipCache });\n\n // We only want versioned dependencies so skip if they cannot be found.\n if (!sdkVersion || !(sdkVersion in sdkVersions)) {\n debug(\n `Skipping versioned dependencies because the SDK version is not found. (sdkVersion: ${sdkVersion}, available: ${Object.keys(\n sdkVersions\n ).join(', ')})`\n );\n return {};\n }\n\n const version = sdkVersions[sdkVersion as keyof typeof sdkVersions] as unknown as SDKVersion;\n\n return normalizeSdkVersionObject(version);\n } catch (error: any) {\n if (error instanceof CommandError && error.code === 'OFFLINE') {\n return getRemoteVersionsForSdkAsync({ sdkVersion, skipCache });\n }\n throw error;\n }\n}\n\ntype ExcludedNativeModules = {\n name: string;\n bundledNativeVersion: string;\n isExcludedFromValidation: boolean;\n specifiedVersion?: string; // e.g. 1.2.3, latest\n};\n\n/**\n * Versions a list of `packages` against a given `sdkVersion` based on local and remote versioning resources.\n *\n * @param projectRoot\n * @param param1\n * @returns\n */\nexport async function getVersionedPackagesAsync(\n projectRoot: string,\n {\n packages,\n sdkVersion,\n pkg,\n }: {\n /** List of npm packages to process. */\n packages: string[];\n /** Target SDK Version number to version the `packages` for. */\n sdkVersion: string;\n pkg: PackageJSONConfig;\n }\n): Promise<{\n packages: string[];\n messages: string[];\n excludedNativeModules: ExcludedNativeModules[];\n}> {\n const versionsForSdk = await getCombinedKnownVersionsAsync({\n projectRoot,\n sdkVersion,\n skipCache: true,\n });\n\n let nativeModulesCount = 0;\n let othersCount = 0;\n const excludedNativeModules: ExcludedNativeModules[] = [];\n\n const versionedPackages = packages.map((arg) => {\n const { name, type, raw, rawSpec } = npmPackageArg(arg);\n\n if (['tag', 'version', 'range'].includes(type) && name && versionsForSdk[name]) {\n // Unimodule packages from npm registry are modified to use the bundled version.\n // Some packages have the recommended version listed in https://exp.host/--/api/v2/versions.\n const isExcludedFromValidation = pkg?.expo?.install?.exclude?.includes(name);\n const hasSpecifiedExactVersion = rawSpec !== '';\n if (isExcludedFromValidation || hasSpecifiedExactVersion) {\n othersCount++;\n excludedNativeModules.push({\n name,\n bundledNativeVersion: versionsForSdk[name],\n isExcludedFromValidation,\n specifiedVersion: rawSpec,\n });\n return raw;\n }\n nativeModulesCount++;\n return `${name}@${versionsForSdk[name]}`;\n } else {\n // Other packages are passed through unmodified.\n othersCount++;\n return raw;\n }\n });\n\n const messages = getOperationLog({\n othersCount,\n nativeModulesCount,\n sdkVersion,\n });\n\n return {\n packages: versionedPackages,\n messages,\n excludedNativeModules,\n };\n}\n\n/** Craft a set of messages regarding the install operations. */\nexport function getOperationLog({\n nativeModulesCount,\n sdkVersion,\n othersCount,\n}: {\n nativeModulesCount: number;\n othersCount: number;\n sdkVersion: string;\n}): string[] {\n return [\n nativeModulesCount > 0 &&\n `${nativeModulesCount} SDK ${sdkVersion} compatible native ${\n nativeModulesCount === 1 ? 'module' : 'modules'\n }`,\n othersCount > 0 && `${othersCount} other ${othersCount === 1 ? 'package' : 'packages'}`,\n ].filter(Boolean) as string[];\n}\n"],"names":["getCombinedKnownVersionsAsync","getRemoteVersionsForSdkAsync","getVersionedPackagesAsync","getOperationLog","debug","require","normalizeSdkVersionObject","version","relatedPackages","facebookReactVersion","facebookReactNativeVersion","expoVersion","reactVersion","react","undefined","expoVersionIfAvailable","expo","projectRoot","sdkVersion","skipCache","bundledNativeModules","getVersionedNativeModulesAsync","versionsForSdk","env","EXPO_OFFLINE","Log","warn","sdkVersions","getVersionsAsync","Object","keys","join","error","CommandError","code","packages","pkg","nativeModulesCount","othersCount","excludedNativeModules","versionedPackages","map","arg","name","type","raw","rawSpec","npmPackageArg","includes","isExcludedFromValidation","install","exclude","hasSpecifiedExactVersion","push","bundledNativeVersion","specifiedVersion","messages","filter","Boolean"],"mappings":"AAAA;;;;QAyCsBA,6BAA6B,GAA7BA,6BAA6B;QAsB7BC,4BAA4B,GAA5BA,4BAA4B;QA+C5BC,yBAAyB,GAAzBA,yBAAyB;QAqE/BC,eAAe,GAAfA,eAAe;AAlLL,IAAA,cAAiB,kCAAjB,iBAAiB,EAAA;AAEI,IAAA,qBAAwB,WAAxB,wBAAwB,CAAA;AAC1B,IAAA,YAA0B,WAA1B,0BAA0B,CAAA;AACnD,IAAA,IAAc,WAAd,cAAc,CAAA;AACd,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACX,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;;;;;;AAEpD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAC5B,+CAA+C,CAChD,AAAsB,AAAC;AAIxB,8GAA8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QAAQ,EAAEK,iBAAiB;QAC3BgB,QAAQ;QACRjB,qBAAqB;KACtB,CAAC;CACH;AAGM,SAASpC,eAAe,CAAC,EAC9BkC,kBAAkB,CAAA,EAClBnB,UAAU,CAAA,EACVoB,WAAW,CAAA,EAKZ,EAAY;IACX,OAAO;QACLD,kBAAkB,GAAG,CAAC,IACpB,CAAC,EAAEA,kBAAkB,CAAC,KAAK,EAAEnB,UAAU,CAAC,mBAAmB,EACzDmB,kBAAkB,KAAK,CAAC,GAAG,QAAQ,GAAG,SAAS,CAChD,CAAC;QACJC,WAAW,GAAG,CAAC,IAAI,CAAC,EAAEA,WAAW,CAAC,OAAO,EAAEA,WAAW,KAAK,CAAC,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;KACxF,CAACmB,MAAM,CAACC,OAAO,CAAC,CAAa;CAC/B"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/dependencies/getVersionedPackages.ts"],"sourcesContent":["import { PackageJSONConfig } from '@expo/config';\nimport npmPackageArg from 'npm-package-arg';\n\nimport { getVersionedNativeModulesAsync } from './bundledNativeModules';\nimport { hasExpoCanaryAsync } from './resolvePackages';\nimport { getVersionsAsync, SDKVersion } from '../../../api/getVersions';\nimport { Log } from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')(\n 'expo:doctor:dependencies:getVersionedPackages'\n) as typeof console.log;\n\nexport type DependencyList = Record<string, string>;\n\n/** Adds `react-dom`, `react`, and `react-native` to the list of known package versions (`relatedPackages`) */\nfunction normalizeSdkVersionObject(version?: SDKVersion): Record<string, string> {\n if (!version) {\n return {};\n }\n const { relatedPackages, facebookReactVersion, facebookReactNativeVersion, expoVersion } =\n version;\n\n const reactVersion = facebookReactVersion\n ? {\n react: facebookReactVersion,\n 'react-dom': facebookReactVersion,\n }\n : undefined;\n\n const expoVersionIfAvailable = expoVersion ? { expo: expoVersion } : undefined;\n\n return {\n ...relatedPackages,\n ...reactVersion,\n ...expoVersionIfAvailable,\n 'react-native': facebookReactNativeVersion,\n };\n}\n\n/** Get the known versions for a given SDK, combines all sources. */\nexport async function getCombinedKnownVersionsAsync({\n projectRoot,\n sdkVersion,\n skipCache,\n}: {\n projectRoot: string;\n sdkVersion?: string;\n skipCache?: boolean;\n}) {\n const skipRemoteVersions = await hasExpoCanaryAsync(projectRoot);\n if (skipRemoteVersions) {\n Log.warn('Dependency validation might be unreliable when using canary SDK versions');\n }\n\n const bundledNativeModules = sdkVersion\n ? await getVersionedNativeModulesAsync(projectRoot, sdkVersion, { skipRemoteVersions })\n : {};\n const versionsForSdk = !skipRemoteVersions\n ? await getRemoteVersionsForSdkAsync({ sdkVersion, skipCache })\n : {};\n return {\n ...bundledNativeModules,\n // Prefer the remote versions over the bundled versions, this enables us to push\n // emergency fixes that users can access without having to update the `expo` package.\n ...versionsForSdk,\n };\n}\n\n/** @returns a key/value list of known dependencies and their version (including range). */\nexport async function getRemoteVersionsForSdkAsync({\n sdkVersion,\n skipCache,\n}: { sdkVersion?: string; skipCache?: boolean } = {}): Promise<DependencyList> {\n if (env.EXPO_OFFLINE) {\n Log.warn('Dependency validation is unreliable in offline-mode');\n return {};\n }\n\n try {\n const { sdkVersions } = await getVersionsAsync({ skipCache });\n\n // We only want versioned dependencies so skip if they cannot be found.\n if (!sdkVersion || !(sdkVersion in sdkVersions)) {\n debug(\n `Skipping versioned dependencies because the SDK version is not found. (sdkVersion: ${sdkVersion}, available: ${Object.keys(\n sdkVersions\n ).join(', ')})`\n );\n return {};\n }\n\n const version = sdkVersions[sdkVersion as keyof typeof sdkVersions] as unknown as SDKVersion;\n\n return normalizeSdkVersionObject(version);\n } catch (error: any) {\n if (error instanceof CommandError && error.code === 'OFFLINE') {\n return getRemoteVersionsForSdkAsync({ sdkVersion, skipCache });\n }\n throw error;\n }\n}\n\ntype ExcludedNativeModules = {\n name: string;\n bundledNativeVersion: string;\n isExcludedFromValidation: boolean;\n specifiedVersion?: string; // e.g. 1.2.3, latest\n};\n\n/**\n * Versions a list of `packages` against a given `sdkVersion` based on local and remote versioning resources.\n *\n * @param projectRoot\n * @param param1\n * @returns\n */\nexport async function getVersionedPackagesAsync(\n projectRoot: string,\n {\n packages,\n sdkVersion,\n pkg,\n }: {\n /** List of npm packages to process. */\n packages: string[];\n /** Target SDK Version number to version the `packages` for. */\n sdkVersion: string;\n pkg: PackageJSONConfig;\n }\n): Promise<{\n packages: string[];\n messages: string[];\n excludedNativeModules: ExcludedNativeModules[];\n}> {\n const versionsForSdk = await getCombinedKnownVersionsAsync({\n projectRoot,\n sdkVersion,\n skipCache: true,\n });\n\n let nativeModulesCount = 0;\n let othersCount = 0;\n const excludedNativeModules: ExcludedNativeModules[] = [];\n\n const versionedPackages = packages.map((arg) => {\n const { name, type, raw, rawSpec } = npmPackageArg(arg);\n\n if (['tag', 'version', 'range'].includes(type) && name && versionsForSdk[name]) {\n // Unimodule packages from npm registry are modified to use the bundled version.\n // Some packages have the recommended version listed in https://exp.host/--/api/v2/versions.\n const isExcludedFromValidation = pkg?.expo?.install?.exclude?.includes(name);\n const hasSpecifiedExactVersion = rawSpec !== '';\n if (isExcludedFromValidation || hasSpecifiedExactVersion) {\n othersCount++;\n excludedNativeModules.push({\n name,\n bundledNativeVersion: versionsForSdk[name],\n isExcludedFromValidation,\n specifiedVersion: rawSpec,\n });\n return raw;\n }\n nativeModulesCount++;\n return `${name}@${versionsForSdk[name]}`;\n } else {\n // Other packages are passed through unmodified.\n othersCount++;\n return raw;\n }\n });\n\n const messages = getOperationLog({\n othersCount,\n nativeModulesCount,\n sdkVersion,\n });\n\n return {\n packages: versionedPackages,\n messages,\n excludedNativeModules,\n };\n}\n\n/** Craft a set of messages regarding the install operations. */\nexport function getOperationLog({\n nativeModulesCount,\n sdkVersion,\n othersCount,\n}: {\n nativeModulesCount: number;\n othersCount: number;\n sdkVersion: string;\n}): string[] {\n return [\n nativeModulesCount > 0 &&\n `${nativeModulesCount} SDK ${sdkVersion} compatible native ${\n nativeModulesCount === 1 ? 'module' : 'modules'\n }`,\n othersCount > 0 && `${othersCount} other ${othersCount === 1 ? 'package' : 'packages'}`,\n ].filter(Boolean) as string[];\n}\n"],"names":["getCombinedKnownVersionsAsync","getRemoteVersionsForSdkAsync","getVersionedPackagesAsync","getOperationLog","debug","require","normalizeSdkVersionObject","version","relatedPackages","facebookReactVersion","facebookReactNativeVersion","expoVersion","reactVersion","react","undefined","expoVersionIfAvailable","expo","projectRoot","sdkVersion","skipCache","skipRemoteVersions","hasExpoCanaryAsync","Log","warn","bundledNativeModules","getVersionedNativeModulesAsync","versionsForSdk","env","EXPO_OFFLINE","sdkVersions","getVersionsAsync","Object","keys","join","error","CommandError","code","packages","pkg","nativeModulesCount","othersCount","excludedNativeModules","versionedPackages","map","arg","name","type","raw","rawSpec","npmPackageArg","includes","isExcludedFromValidation","install","exclude","hasSpecifiedExactVersion","push","bundledNativeVersion","specifiedVersion","messages","filter","Boolean"],"mappings":"AAAA;;;;QA0CsBA,6BAA6B,GAA7BA,6BAA6B;QA6B7BC,4BAA4B,GAA5BA,4BAA4B;QA+C5BC,yBAAyB,GAAzBA,yBAAyB;QAqE/BC,eAAe,GAAfA,eAAe;AA1LL,IAAA,cAAiB,kCAAjB,iBAAiB,EAAA;AAEI,IAAA,qBAAwB,WAAxB,wBAAwB,CAAA;AACpC,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AACT,IAAA,YAA0B,WAA1B,0BAA0B,CAAA;AACnD,IAAA,IAAc,WAAd,cAAc,CAAA;AACd,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACX,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;;;;;;AAEpD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAC5B,+CAA+C,CAChD,AAAsB,AAAC;AAIxB,8GAA8G,CAC9G,SAASC,yBAAyB,CAACC,OAAoB,EAA0B;IAC/E,IAAI,CAACA,OAAO,EAAE;QACZ,OAAO,EAAE,CAAC;KACX;IAC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C;SACZ;KACF,CAAC,AAAC;IAEH,MAAMW,QAAQ,GAAGvD,eAAe,CAAC;QAC/BqC,WAAW;QACXD,kBAAkB;QAClBrB,UAAU;KACX,CAAC,AAAC;IAEH,OAAO;QACLmB,QAAQ,EAAEK,iBAAiB;QAC3BgB,QAAQ;QACRjB,qBAAqB;KACtB,CAAC;CACH;AAGM,SAAStC,eAAe,CAAC,EAC9BoC,kBAAkB,CAAA,EAClBrB,UAAU,CAAA,EACVsB,WAAW,CAAA,EAKZ,EAAY;IACX,OAAO;QACLD,kBAAkB,GAAG,CAAC,IACpB,CAAC,EAAEA,kBAAkB,CAAC,KAAK,EAAErB,UAAU,CAAC,mBAAmB,EACzDqB,kBAAkB,KAAK,CAAC,GAAG,QAAQ,GAAG,SAAS,CAChD,CAAC;QACJC,WAAW,GAAG,CAAC,IAAI,CAAC,EAAEA,WAAW,CAAC,OAAO,EAAEA,WAAW,KAAK,CAAC,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;KACxF,CAACmB,MAAM,CAACC,OAAO,CAAC,CAAa;CAC/B"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.resolvePackageVersionAsync = resolvePackageVersionAsync;
|
|
6
|
+
exports.resolveAllPackageVersionsAsync = resolveAllPackageVersionsAsync;
|
|
7
|
+
exports.hasExpoCanaryAsync = hasExpoCanaryAsync;
|
|
8
|
+
var _jsonFile = _interopRequireDefault(require("@expo/json-file"));
|
|
9
|
+
var _resolveFrom = _interopRequireDefault(require("resolve-from"));
|
|
10
|
+
var _semver = _interopRequireDefault(require("semver"));
|
|
11
|
+
var _errors = require("../../../utils/errors");
|
|
12
|
+
function _interopRequireDefault(obj) {
|
|
13
|
+
return obj && obj.__esModule ? obj : {
|
|
14
|
+
default: obj
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
async function resolvePackageVersionAsync(projectRoot, packageName) {
|
|
18
|
+
let packageJsonPath;
|
|
19
|
+
try {
|
|
20
|
+
packageJsonPath = (0, _resolveFrom).default(projectRoot, `${packageName}/package.json`);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
// This is a workaround for packages using `exports`. If this doesn't
|
|
23
|
+
// include `package.json`, we have to use the error message to get the location.
|
|
24
|
+
if (error.code === "ERR_PACKAGE_PATH_NOT_EXPORTED") {
|
|
25
|
+
var ref;
|
|
26
|
+
packageJsonPath = (ref = error.message.match(/("exports"|defined) in (.*)$/i)) == null ? void 0 : ref[2];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (!packageJsonPath) {
|
|
30
|
+
throw new _errors.CommandError("PACKAGE_NOT_FOUND", `"${packageName}" is added as a dependency in your project's package.json but it doesn't seem to be installed. Please run "yarn" or "npm install" to fix this issue.`);
|
|
31
|
+
}
|
|
32
|
+
const packageJson = await _jsonFile.default.readAsync(packageJsonPath);
|
|
33
|
+
return packageJson.version;
|
|
34
|
+
}
|
|
35
|
+
async function resolveAllPackageVersionsAsync(projectRoot, packages) {
|
|
36
|
+
const resolvedPackages = await Promise.all(packages.map(async (packageName)=>[
|
|
37
|
+
packageName,
|
|
38
|
+
await resolvePackageVersionAsync(projectRoot, packageName),
|
|
39
|
+
]
|
|
40
|
+
));
|
|
41
|
+
return Object.fromEntries(resolvedPackages);
|
|
42
|
+
}
|
|
43
|
+
async function hasExpoCanaryAsync(projectRoot) {
|
|
44
|
+
let expoVersion = "";
|
|
45
|
+
try {
|
|
46
|
+
// Resolve installed `expo` version first
|
|
47
|
+
expoVersion = await resolvePackageVersionAsync(projectRoot, "expo");
|
|
48
|
+
} catch (error) {
|
|
49
|
+
var ref;
|
|
50
|
+
if (error.code !== "PACKAGE_NOT_FOUND") {
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
// Resolve through project `package.json`
|
|
54
|
+
const packageJson = await _jsonFile.default.readAsync((0, _resolveFrom).default(projectRoot, "./package.json"));
|
|
55
|
+
var ref1;
|
|
56
|
+
expoVersion = (ref1 = (ref = packageJson.dependencies) == null ? void 0 : ref.expo) != null ? ref1 : "";
|
|
57
|
+
}
|
|
58
|
+
if (expoVersion === "canary") {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
const prerelease = _semver.default.prerelease(expoVersion) || [];
|
|
62
|
+
return !!prerelease.some((segment)=>typeof segment === "string" && segment.includes("canary")
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=resolvePackages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/dependencies/resolvePackages.ts"],"sourcesContent":["import JsonFile from '@expo/json-file';\nimport resolveFrom from 'resolve-from';\nimport semver from 'semver';\n\nimport { CommandError } from '../../../utils/errors';\n\nexport async function resolvePackageVersionAsync(\n projectRoot: string,\n packageName: string\n): Promise<string> {\n let packageJsonPath: string | undefined;\n try {\n packageJsonPath = resolveFrom(projectRoot, `${packageName}/package.json`);\n } catch (error: any) {\n // This is a workaround for packages using `exports`. If this doesn't\n // include `package.json`, we have to use the error message to get the location.\n if (error.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED') {\n packageJsonPath = error.message.match(/(\"exports\"|defined) in (.*)$/i)?.[2];\n }\n }\n if (!packageJsonPath) {\n throw new CommandError(\n 'PACKAGE_NOT_FOUND',\n `\"${packageName}\" is added as a dependency in your project's package.json but it doesn't seem to be installed. Please run \"yarn\" or \"npm install\" to fix this issue.`\n );\n }\n const packageJson = await JsonFile.readAsync<{ version: string }>(packageJsonPath);\n return packageJson.version;\n}\n\nexport async function resolveAllPackageVersionsAsync(projectRoot: string, packages: string[]) {\n const resolvedPackages = await Promise.all(\n packages.map(async (packageName) => [\n packageName,\n await resolvePackageVersionAsync(projectRoot, packageName),\n ])\n );\n\n return Object.fromEntries(resolvedPackages);\n}\n\n/**\n * Determine if the project has a `expo@canary` version installed.\n * This means that an unsable version is used, without the API knowing the exact packages.\n * Since this may be called during, or before, packages are installed, we also need to test on `package.json`.\n * Note, this returns `false` for beta releases.\n */\nexport async function hasExpoCanaryAsync(projectRoot: string) {\n let expoVersion = '';\n\n try {\n // Resolve installed `expo` version first\n expoVersion = await resolvePackageVersionAsync(projectRoot, 'expo');\n } catch (error: any) {\n if (error.code !== 'PACKAGE_NOT_FOUND') {\n throw error;\n }\n\n // Resolve through project `package.json`\n const packageJson = await JsonFile.readAsync<{ dependencies?: Record<string, string> }>(\n resolveFrom(projectRoot, './package.json')\n );\n expoVersion = packageJson.dependencies?.expo ?? '';\n }\n\n if (expoVersion === 'canary') {\n return true;\n }\n\n const prerelease = semver.prerelease(expoVersion) || [];\n return !!prerelease.some((segment) => typeof segment === 'string' && segment.includes('canary'));\n}\n"],"names":["resolvePackageVersionAsync","resolveAllPackageVersionsAsync","hasExpoCanaryAsync","projectRoot","packageName","packageJsonPath","resolveFrom","error","code","message","match","CommandError","packageJson","JsonFile","readAsync","version","packages","resolvedPackages","Promise","all","map","Object","fromEntries","expoVersion","dependencies","expo","prerelease","semver","some","segment","includes"],"mappings":"AAAA;;;;QAMsBA,0BAA0B,GAA1BA,0BAA0B;QAwB1BC,8BAA8B,GAA9BA,8BAA8B;QAiB9BC,kBAAkB,GAAlBA,kBAAkB;AA/CnB,IAAA,SAAiB,kCAAjB,iBAAiB,EAAA;AACd,IAAA,YAAc,kCAAd,cAAc,EAAA;AACnB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AAEE,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;;;;;;AAE7C,eAAeF,0BAA0B,CAC9CG,WAAmB,EACnBC,WAAmB,EACF;IACjB,IAAIC,eAAe,AAAoB,AAAC;IACxC,IAAI;QACFA,eAAe,GAAGC,CAAAA,GAAAA,YAAW,AAA4C,CAAA,QAA5C,CAACH,WAAW,EAAE,CAAC,EAAEC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;KAC3E,CAAC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AAQ,QAAA,CAACC,SAAS,CAC1CR,CAAAA,GAAAA,YAAW,AAA+B,CAAA,QAA/B,CAACH,WAAW,EAAE,gBAAgB,CAAC,CAC3C,AAAC;YACYS,IAA8B;QAA5CW,WAAW,GAAGX,CAAAA,IAA8B,GAA9BA,CAAAA,GAAwB,GAAxBA,WAAW,CAACY,YAAY,SAAM,GAA9BZ,KAAAA,CAA8B,GAA9BA,GAAwB,CAAEa,IAAI,YAA9Bb,IAA8B,GAAI,EAAE,CAAC;KACpD;IAED,IAAIW,WAAW,KAAK,QAAQ,EAAE;QAC5B,OAAO,IAAI,CAAC;KACb;IAED,MAAMG,UAAU,GAAGC,OAAM,QAAA,CAACD,UAAU,CAACH,WAAW,CAAC,IAAI,EAAE,AAAC;IACxD,OAAO,CAAC,CAACG,UAAU,CAACE,IAAI,CAAC,CAACC,OAAO,GAAK,OAAOA,OAAO,KAAK,QAAQ,IAAIA,OAAO,CAACC,QAAQ,CAAC,QAAQ,CAAC;IAAA,CAAC,CAAC;CAClG"}
|
|
@@ -5,15 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
exports.validateDependenciesVersionsAsync = validateDependenciesVersionsAsync;
|
|
6
6
|
exports.logIncorrectDependencies = logIncorrectDependencies;
|
|
7
7
|
exports.getVersionedDependenciesAsync = getVersionedDependenciesAsync;
|
|
8
|
-
var _jsonFile = _interopRequireDefault(require("@expo/json-file"));
|
|
9
8
|
var _assert = _interopRequireDefault(require("assert"));
|
|
10
9
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
11
|
-
var _resolveFrom = _interopRequireDefault(require("resolve-from"));
|
|
12
10
|
var _semver = _interopRequireDefault(require("semver"));
|
|
13
11
|
var _getVersionedPackages = require("./getVersionedPackages");
|
|
12
|
+
var _resolvePackages = require("./resolvePackages");
|
|
14
13
|
var Log = _interopRequireWildcard(require("../../../log"));
|
|
15
14
|
var _env = require("../../../utils/env");
|
|
16
|
-
var _errors = require("../../../utils/errors");
|
|
17
15
|
function _interopRequireDefault(obj) {
|
|
18
16
|
return obj && obj.__esModule ? obj : {
|
|
19
17
|
default: obj
|
|
@@ -87,7 +85,7 @@ async function getVersionedDependenciesAsync(projectRoot, exp, pkg, packagesToCh
|
|
|
87
85
|
debug(`Comparing known versions: %O`, resolvedPackagesToCheck);
|
|
88
86
|
debug(`Skipping packages that cannot be versioned automatically: %O`, unknown);
|
|
89
87
|
// read package versions from the file system (node_modules)
|
|
90
|
-
const packageVersions = await
|
|
88
|
+
const packageVersions = await (0, _resolvePackages).resolveAllPackageVersionsAsync(projectRoot, resolvedPackagesToCheck);
|
|
91
89
|
debug(`Package versions: %O`, packageVersions);
|
|
92
90
|
// find incorrect dependencies by comparing the actual package versions with the bundled native module version ranges
|
|
93
91
|
let incorrectDeps = findIncorrectDependencies(pkg, packageVersions, combinedKnownPackages);
|
|
@@ -125,32 +123,6 @@ function getPackagesToCheck(dependencies, bundledNativeModules) {
|
|
|
125
123
|
unknown
|
|
126
124
|
};
|
|
127
125
|
}
|
|
128
|
-
async function resolvePackageVersionsAsync(projectRoot, packages) {
|
|
129
|
-
const packageVersionsFromPackageJSON = await Promise.all(packages.map((packageName)=>getPackageVersionAsync(projectRoot, packageName)
|
|
130
|
-
));
|
|
131
|
-
return packages.reduce((acc, packageName, idx)=>{
|
|
132
|
-
acc[packageName] = packageVersionsFromPackageJSON[idx];
|
|
133
|
-
return acc;
|
|
134
|
-
}, {});
|
|
135
|
-
}
|
|
136
|
-
async function getPackageVersionAsync(projectRoot, packageName) {
|
|
137
|
-
let packageJsonPath;
|
|
138
|
-
try {
|
|
139
|
-
packageJsonPath = (0, _resolveFrom).default(projectRoot, `${packageName}/package.json`);
|
|
140
|
-
} catch (error) {
|
|
141
|
-
// This is a workaround for packages using `exports`. If this doesn't
|
|
142
|
-
// include `package.json`, we have to use the error message to get the location.
|
|
143
|
-
if (error.code === "ERR_PACKAGE_PATH_NOT_EXPORTED") {
|
|
144
|
-
var ref;
|
|
145
|
-
packageJsonPath = (ref = error.message.match(/("exports"|defined) in (.*)$/i)) == null ? void 0 : ref[2];
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (!packageJsonPath) {
|
|
149
|
-
throw new _errors.CommandError(`"${packageName}" is added as a dependency in your project's package.json but it doesn't seem to be installed. Please run "yarn" or "npm install" to fix this issue.`);
|
|
150
|
-
}
|
|
151
|
-
const packageJson = await _jsonFile.default.readAsync(packageJsonPath);
|
|
152
|
-
return packageJson.version;
|
|
153
|
-
}
|
|
154
126
|
function findIncorrectDependencies(pkg, packageVersions, bundledNativeModules) {
|
|
155
127
|
const packages = Object.keys(packageVersions);
|
|
156
128
|
const incorrectDeps = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/dependencies/validateDependenciesVersions.ts"],"sourcesContent":["import { ExpoConfig, PackageJSONConfig } from '@expo/config';\nimport JsonFile from '@expo/json-file';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport resolveFrom from 'resolve-from';\nimport semver from 'semver';\n\nimport { BundledNativeModules } from './bundledNativeModules';\nimport { getCombinedKnownVersionsAsync } from './getVersionedPackages';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')('expo:doctor:dependencies:validate') as typeof console.log;\n\ninterface IncorrectDependency {\n packageName: string;\n packageType: 'dependencies' | 'devDependencies';\n expectedVersionOrRange: string;\n actualVersion: string;\n}\n\n/**\n * Print a list of incorrect dependency versions.\n * This only checks dependencies when not running in offline mode.\n *\n * @param projectRoot Expo project root.\n * @param exp Expo project config.\n * @param pkg Project's `package.json`.\n * @param packagesToCheck A list of packages to check, if undefined or empty, all will be checked.\n * @returns `true` if there are no incorrect dependencies.\n */\nexport async function validateDependenciesVersionsAsync(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'sdkVersion'>,\n pkg: PackageJSONConfig,\n packagesToCheck?: string[]\n): Promise<boolean | null> {\n if (env.EXPO_OFFLINE) {\n Log.warn('Skipping dependency validation in offline mode');\n return null;\n }\n\n const incorrectDeps = await getVersionedDependenciesAsync(projectRoot, exp, pkg, packagesToCheck);\n return logIncorrectDependencies(incorrectDeps);\n}\n\nfunction logInvalidDependency({\n packageName,\n expectedVersionOrRange,\n actualVersion,\n}: IncorrectDependency) {\n Log.warn(\n // chalk` - {underline ${packageName}} - expected version: {underline ${expectedVersionOrRange}} - actual version installed: {underline ${actualVersion}}`\n chalk` {bold ${packageName}}{cyan @}{red ${actualVersion}} - expected version: {green ${expectedVersionOrRange}}`\n );\n}\n\nexport function logIncorrectDependencies(incorrectDeps: IncorrectDependency[]) {\n if (!incorrectDeps.length) {\n return true;\n }\n\n Log.warn(\n chalk`The following packages should be updated for best compatibility with the installed {bold expo} version:`\n );\n incorrectDeps.forEach((dep) => logInvalidDependency(dep));\n\n Log.warn(\n 'Your project may not work correctly until you install the correct versions of the packages.'\n );\n\n return false;\n}\n\n/**\n * Return a list of versioned dependencies for the project SDK version.\n *\n * @param projectRoot Expo project root.\n * @param exp Expo project config.\n * @param pkg Project's `package.json`.\n * @param packagesToCheck A list of packages to check, if undefined or empty, all will be checked.\n * @returns A list of incorrect dependencies.\n */\nexport async function getVersionedDependenciesAsync(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'sdkVersion'>,\n pkg: PackageJSONConfig,\n packagesToCheck?: string[]\n): Promise<IncorrectDependency[]> {\n // This should never happen under normal circumstances since\n // the CLI is versioned in the `expo` package.\n assert(exp.sdkVersion, 'SDK Version is missing');\n\n // Get from both endpoints and combine the known package versions.\n const combinedKnownPackages = await getCombinedKnownVersionsAsync({\n projectRoot,\n sdkVersion: exp.sdkVersion,\n });\n // debug(`Known dependencies: %O`, combinedKnownPackages);\n\n const resolvedDependencies = packagesToCheck?.length\n ? // Diff the provided packages to ensure we only check against installed packages.\n getFilteredObject(packagesToCheck, { ...pkg.dependencies, ...pkg.devDependencies })\n : // If no packages are provided, check against the `package.json` `dependencies` + `devDependencies` object.\n { ...pkg.dependencies, ...pkg.devDependencies };\n debug(`Checking dependencies for ${exp.sdkVersion}: %O`, resolvedDependencies);\n\n // intersection of packages from package.json and bundled native modules\n const { known: resolvedPackagesToCheck, unknown } = getPackagesToCheck(\n resolvedDependencies,\n combinedKnownPackages\n );\n debug(`Comparing known versions: %O`, resolvedPackagesToCheck);\n debug(`Skipping packages that cannot be versioned automatically: %O`, unknown);\n // read package versions from the file system (node_modules)\n const packageVersions = await resolvePackageVersionsAsync(projectRoot, resolvedPackagesToCheck);\n debug(`Package versions: %O`, packageVersions);\n // find incorrect dependencies by comparing the actual package versions with the bundled native module version ranges\n let incorrectDeps = findIncorrectDependencies(pkg, packageVersions, combinedKnownPackages);\n debug(`Incorrect dependencies: %O`, incorrectDeps);\n\n if (pkg?.expo?.install?.exclude) {\n const packagesToExclude = pkg.expo.install.exclude;\n const incorrectAndExcludedDeps = incorrectDeps.filter((dep) =>\n packagesToExclude.includes(dep.packageName)\n );\n debug(\n `Incorrect dependency warnings filtered out by expo.install.exclude: %O`,\n incorrectAndExcludedDeps.map((dep) => dep.packageName)\n );\n incorrectDeps = incorrectDeps.filter((dep) => !packagesToExclude.includes(dep.packageName));\n }\n\n return incorrectDeps;\n}\n\nfunction getFilteredObject(keys: string[], object: Record<string, string>) {\n return keys.reduce<Record<string, string>>((acc, key) => {\n acc[key] = object[key];\n return acc;\n }, {});\n}\n\nfunction getPackagesToCheck(\n dependencies: Record<string, string> | null | undefined,\n bundledNativeModules: BundledNativeModules\n): { known: string[]; unknown: string[] } {\n const dependencyNames = Object.keys(dependencies ?? {});\n const known: string[] = [];\n const unknown: string[] = [];\n for (const dependencyName of dependencyNames) {\n if (dependencyName in bundledNativeModules) {\n known.push(dependencyName);\n } else {\n unknown.push(dependencyName);\n }\n }\n return { known, unknown };\n}\n\nasync function resolvePackageVersionsAsync(\n projectRoot: string,\n packages: string[]\n): Promise<Record<string, string>> {\n const packageVersionsFromPackageJSON = await Promise.all(\n packages.map((packageName) => getPackageVersionAsync(projectRoot, packageName))\n );\n return packages.reduce(\n (acc, packageName, idx) => {\n acc[packageName] = packageVersionsFromPackageJSON[idx];\n return acc;\n },\n {} as Record<string, string>\n );\n}\n\nasync function getPackageVersionAsync(projectRoot: string, packageName: string): Promise<string> {\n let packageJsonPath: string | undefined;\n try {\n packageJsonPath = resolveFrom(projectRoot, `${packageName}/package.json`);\n } catch (error: any) {\n // This is a workaround for packages using `exports`. If this doesn't\n // include `package.json`, we have to use the error message to get the location.\n if (error.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED') {\n packageJsonPath = error.message.match(/(\"exports\"|defined) in (.*)$/i)?.[2];\n }\n }\n if (!packageJsonPath) {\n throw new CommandError(\n `\"${packageName}\" is added as a dependency in your project's package.json but it doesn't seem to be installed. Please run \"yarn\" or \"npm install\" to fix this issue.`\n );\n }\n const packageJson = await JsonFile.readAsync<BundledNativeModules>(packageJsonPath);\n return packageJson.version;\n}\n\nfunction findIncorrectDependencies(\n pkg: PackageJSONConfig,\n packageVersions: Record<string, string>,\n bundledNativeModules: BundledNativeModules\n): IncorrectDependency[] {\n const packages = Object.keys(packageVersions);\n const incorrectDeps: IncorrectDependency[] = [];\n for (const packageName of packages) {\n const expectedVersionOrRange = bundledNativeModules[packageName];\n const actualVersion = packageVersions[packageName];\n if (isDependencyVersionIncorrect(packageName, expectedVersionOrRange, actualVersion)) {\n incorrectDeps.push({\n packageName,\n packageType: findDependencyType(pkg, packageName),\n expectedVersionOrRange,\n actualVersion,\n });\n }\n }\n return incorrectDeps;\n}\n\nfunction isDependencyVersionIncorrect(\n packageName: string,\n expectedVersionOrRange: string | undefined,\n actualVersion: string\n) {\n if (typeof expectedVersionOrRange !== 'string') {\n return false;\n }\n\n // we never want to go backwards with the expo patch version\n if (packageName === 'expo') {\n if (semver.ltr(actualVersion, expectedVersionOrRange)) {\n return true;\n }\n return false;\n }\n\n // all other packages: version range is based on Expo SDK version, so we always want to match range\n if (!semver.intersects(expectedVersionOrRange, actualVersion)) {\n return true;\n }\n\n return false;\n}\n\nfunction findDependencyType(\n pkg: PackageJSONConfig,\n packageName: string\n): IncorrectDependency['packageType'] {\n if (pkg.devDependencies && packageName in pkg.devDependencies) {\n return 'devDependencies';\n }\n\n return 'dependencies';\n}\n"],"names":["validateDependenciesVersionsAsync","logIncorrectDependencies","getVersionedDependenciesAsync","Log","debug","require","projectRoot","exp","pkg","packagesToCheck","env","EXPO_OFFLINE","warn","incorrectDeps","logInvalidDependency","packageName","expectedVersionOrRange","actualVersion","chalk","length","forEach","dep","assert","sdkVersion","combinedKnownPackages","getCombinedKnownVersionsAsync","resolvedDependencies","getFilteredObject","dependencies","devDependencies","known","resolvedPackagesToCheck","unknown","getPackagesToCheck","packageVersions","resolvePackageVersionsAsync","findIncorrectDependencies","expo","install","exclude","packagesToExclude","incorrectAndExcludedDeps","filter","includes","map","keys","object","reduce","acc","key","bundledNativeModules","dependencyNames","Object","dependencyName","push","packages","packageVersionsFromPackageJSON","Promise","all","getPackageVersionAsync","idx","packageJsonPath","resolveFrom","error","code","message","match","CommandError","packageJson","JsonFile","readAsync","version","isDependencyVersionIncorrect","packageType","findDependencyType","semver","ltr","intersects"],"mappings":"AAAA;;;;QAgCsBA,iCAAiC,GAAjCA,iCAAiC;QA0BvCC,wBAAwB,GAAxBA,wBAAwB;QA0BlBC,6BAA6B,GAA7BA,6BAA6B;AAnF9B,IAAA,SAAiB,kCAAjB,iBAAiB,EAAA;AACnB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AACD,IAAA,YAAc,kCAAd,cAAc,EAAA;AACnB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AAGmB,IAAA,qBAAwB,WAAxB,wBAAwB,CAAA;AAC1DC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACK,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACX,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;;;;;;;;;;;;;;;;;;;;;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,QAAA,CAACC,GAAG,CAAC3D,aAAa,EAAED,sBAAsB,CAAC,EAAE;YACrD,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;KACd;IAED,mGAAmG;IACnG,IAAI,CAAC2D,OAAM,QAAA,CAACE,UAAU,CAAC7D,sBAAsB,EAAEC,aAAa,CAAC,EAAE;QAC7D,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;CACd;AAED,SAASyD,kBAAkB,CACzBlE,GAAsB,EACtBO,WAAmB,EACiB;IACpC,IAAIP,GAAG,CAACqB,eAAe,IAAId,WAAW,IAAIP,GAAG,CAACqB,eAAe,EAAE;QAC7D,OAAO,iBAAiB,CAAC;KAC1B;IAED,OAAO,cAAc,CAAC;CACvB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/dependencies/validateDependenciesVersions.ts"],"sourcesContent":["import { ExpoConfig, PackageJSONConfig } from '@expo/config';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport semver from 'semver';\n\nimport { BundledNativeModules } from './bundledNativeModules';\nimport { getCombinedKnownVersionsAsync } from './getVersionedPackages';\nimport { resolveAllPackageVersionsAsync } from './resolvePackages';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\n\nconst debug = require('debug')('expo:doctor:dependencies:validate') as typeof console.log;\n\ninterface IncorrectDependency {\n packageName: string;\n packageType: 'dependencies' | 'devDependencies';\n expectedVersionOrRange: string;\n actualVersion: string;\n}\n\n/**\n * Print a list of incorrect dependency versions.\n * This only checks dependencies when not running in offline mode.\n *\n * @param projectRoot Expo project root.\n * @param exp Expo project config.\n * @param pkg Project's `package.json`.\n * @param packagesToCheck A list of packages to check, if undefined or empty, all will be checked.\n * @returns `true` if there are no incorrect dependencies.\n */\nexport async function validateDependenciesVersionsAsync(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'sdkVersion'>,\n pkg: PackageJSONConfig,\n packagesToCheck?: string[]\n): Promise<boolean | null> {\n if (env.EXPO_OFFLINE) {\n Log.warn('Skipping dependency validation in offline mode');\n return null;\n }\n\n const incorrectDeps = await getVersionedDependenciesAsync(projectRoot, exp, pkg, packagesToCheck);\n return logIncorrectDependencies(incorrectDeps);\n}\n\nfunction logInvalidDependency({\n packageName,\n expectedVersionOrRange,\n actualVersion,\n}: IncorrectDependency) {\n Log.warn(\n // chalk` - {underline ${packageName}} - expected version: {underline ${expectedVersionOrRange}} - actual version installed: {underline ${actualVersion}}`\n chalk` {bold ${packageName}}{cyan @}{red ${actualVersion}} - expected version: {green ${expectedVersionOrRange}}`\n );\n}\n\nexport function logIncorrectDependencies(incorrectDeps: IncorrectDependency[]) {\n if (!incorrectDeps.length) {\n return true;\n }\n\n Log.warn(\n chalk`The following packages should be updated for best compatibility with the installed {bold expo} version:`\n );\n incorrectDeps.forEach((dep) => logInvalidDependency(dep));\n\n Log.warn(\n 'Your project may not work correctly until you install the correct versions of the packages.'\n );\n\n return false;\n}\n\n/**\n * Return a list of versioned dependencies for the project SDK version.\n *\n * @param projectRoot Expo project root.\n * @param exp Expo project config.\n * @param pkg Project's `package.json`.\n * @param packagesToCheck A list of packages to check, if undefined or empty, all will be checked.\n * @returns A list of incorrect dependencies.\n */\nexport async function getVersionedDependenciesAsync(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'sdkVersion'>,\n pkg: PackageJSONConfig,\n packagesToCheck?: string[]\n): Promise<IncorrectDependency[]> {\n // This should never happen under normal circumstances since\n // the CLI is versioned in the `expo` package.\n assert(exp.sdkVersion, 'SDK Version is missing');\n\n // Get from both endpoints and combine the known package versions.\n const combinedKnownPackages = await getCombinedKnownVersionsAsync({\n projectRoot,\n sdkVersion: exp.sdkVersion,\n });\n // debug(`Known dependencies: %O`, combinedKnownPackages);\n\n const resolvedDependencies = packagesToCheck?.length\n ? // Diff the provided packages to ensure we only check against installed packages.\n getFilteredObject(packagesToCheck, { ...pkg.dependencies, ...pkg.devDependencies })\n : // If no packages are provided, check against the `package.json` `dependencies` + `devDependencies` object.\n { ...pkg.dependencies, ...pkg.devDependencies };\n debug(`Checking dependencies for ${exp.sdkVersion}: %O`, resolvedDependencies);\n\n // intersection of packages from package.json and bundled native modules\n const { known: resolvedPackagesToCheck, unknown } = getPackagesToCheck(\n resolvedDependencies,\n combinedKnownPackages\n );\n debug(`Comparing known versions: %O`, resolvedPackagesToCheck);\n debug(`Skipping packages that cannot be versioned automatically: %O`, unknown);\n // read package versions from the file system (node_modules)\n const packageVersions = await resolveAllPackageVersionsAsync(\n projectRoot,\n resolvedPackagesToCheck\n );\n debug(`Package versions: %O`, packageVersions);\n // find incorrect dependencies by comparing the actual package versions with the bundled native module version ranges\n let incorrectDeps = findIncorrectDependencies(pkg, packageVersions, combinedKnownPackages);\n debug(`Incorrect dependencies: %O`, incorrectDeps);\n\n if (pkg?.expo?.install?.exclude) {\n const packagesToExclude = pkg.expo.install.exclude;\n const incorrectAndExcludedDeps = incorrectDeps.filter((dep) =>\n packagesToExclude.includes(dep.packageName)\n );\n debug(\n `Incorrect dependency warnings filtered out by expo.install.exclude: %O`,\n incorrectAndExcludedDeps.map((dep) => dep.packageName)\n );\n incorrectDeps = incorrectDeps.filter((dep) => !packagesToExclude.includes(dep.packageName));\n }\n\n return incorrectDeps;\n}\n\nfunction getFilteredObject(keys: string[], object: Record<string, string>) {\n return keys.reduce<Record<string, string>>((acc, key) => {\n acc[key] = object[key];\n return acc;\n }, {});\n}\n\nfunction getPackagesToCheck(\n dependencies: Record<string, string> | null | undefined,\n bundledNativeModules: BundledNativeModules\n): { known: string[]; unknown: string[] } {\n const dependencyNames = Object.keys(dependencies ?? {});\n const known: string[] = [];\n const unknown: string[] = [];\n for (const dependencyName of dependencyNames) {\n if (dependencyName in bundledNativeModules) {\n known.push(dependencyName);\n } else {\n unknown.push(dependencyName);\n }\n }\n return { known, unknown };\n}\n\nfunction findIncorrectDependencies(\n pkg: PackageJSONConfig,\n packageVersions: Record<string, string>,\n bundledNativeModules: BundledNativeModules\n): IncorrectDependency[] {\n const packages = Object.keys(packageVersions);\n const incorrectDeps: IncorrectDependency[] = [];\n for (const packageName of packages) {\n const expectedVersionOrRange = bundledNativeModules[packageName];\n const actualVersion = packageVersions[packageName];\n if (isDependencyVersionIncorrect(packageName, expectedVersionOrRange, actualVersion)) {\n incorrectDeps.push({\n packageName,\n packageType: findDependencyType(pkg, packageName),\n expectedVersionOrRange,\n actualVersion,\n });\n }\n }\n return incorrectDeps;\n}\n\nfunction isDependencyVersionIncorrect(\n packageName: string,\n expectedVersionOrRange: string | undefined,\n actualVersion: string\n) {\n if (typeof expectedVersionOrRange !== 'string') {\n return false;\n }\n\n // we never want to go backwards with the expo patch version\n if (packageName === 'expo') {\n if (semver.ltr(actualVersion, expectedVersionOrRange)) {\n return true;\n }\n return false;\n }\n\n // all other packages: version range is based on Expo SDK version, so we always want to match range\n if (!semver.intersects(expectedVersionOrRange, actualVersion)) {\n return true;\n }\n\n return false;\n}\n\nfunction findDependencyType(\n pkg: PackageJSONConfig,\n packageName: string\n): IncorrectDependency['packageType'] {\n if (pkg.devDependencies && packageName in pkg.devDependencies) {\n return 'devDependencies';\n }\n\n return 'dependencies';\n}\n"],"names":["validateDependenciesVersionsAsync","logIncorrectDependencies","getVersionedDependenciesAsync","Log","debug","require","projectRoot","exp","pkg","packagesToCheck","env","EXPO_OFFLINE","warn","incorrectDeps","logInvalidDependency","packageName","expectedVersionOrRange","actualVersion","chalk","length","forEach","dep","assert","sdkVersion","combinedKnownPackages","getCombinedKnownVersionsAsync","resolvedDependencies","getFilteredObject","dependencies","devDependencies","known","resolvedPackagesToCheck","unknown","getPackagesToCheck","packageVersions","resolveAllPackageVersionsAsync","findIncorrectDependencies","expo","install","exclude","packagesToExclude","incorrectAndExcludedDeps","filter","includes","map","keys","object","reduce","acc","key","bundledNativeModules","dependencyNames","Object","dependencyName","push","packages","isDependencyVersionIncorrect","packageType","findDependencyType","semver","ltr","intersects"],"mappings":"AAAA;;;;QA8BsBA,iCAAiC,GAAjCA,iCAAiC;QA0Bv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,CAAC;gBACjBvC,WAAW;gBACX0C,WAAW,EAAEC,kBAAkB,CAAClD,GAAG,EAAEO,WAAW,CAAC;gBACjDC,sBAAsB;gBACtBC,aAAa;aACd,CAAC,CAAC;SACJ;KACF;IACD,OAAOJ,aAAa,CAAC;CACtB;AAED,SAAS2C,4BAA4B,CACnCzC,WAAmB,EACnBC,sBAA0C,EAC1CC,aAAqB,EACrB;IACA,IAAI,OAAOD,sBAAsB,KAAK,QAAQ,EAAE;QAC9C,OAAO,KAAK,CAAC;KACd;IAED,4DAA4D;IAC5D,IAAID,WAAW,KAAK,MAAM,EAAE;QAC1B,IAAI4C,OAAM,QAAA,CAACC,GAAG,CAAC3C,aAAa,EAAED,sBAAsB,CAAC,EAAE;YACrD,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;KACd;IAED,mGAAmG;IACnG,IAAI,CAAC2C,OAAM,QAAA,CAACE,UAAU,CAAC7C,sBAAsB,EAAEC,aAAa,CAAC,EAAE;QAC7D,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;CACd;AAED,SAASyC,kBAAkB,CACzBlD,GAAsB,EACtBO,WAAmB,EACiB;IACpC,IAAIP,GAAG,CAACqB,eAAe,IAAId,WAAW,IAAIP,GAAG,CAACqB,eAAe,EAAE;QAC7D,OAAO,iBAAiB,CAAC;KAC1B;IAED,OAAO,cAAc,CAAC;CACvB"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
var _assert = _interopRequireDefault(require("assert"));
|
|
6
5
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
7
6
|
var _commandsTable = require("./commandsTable");
|
|
8
7
|
var Log = _interopRequireWildcard(require("../../log"));
|
|
@@ -88,18 +87,35 @@ class DevServerManagerActions {
|
|
|
88
87
|
Log.log();
|
|
89
88
|
}
|
|
90
89
|
async openJsInspectorAsync() {
|
|
91
|
-
Log.log("Opening JavaScript inspector in the browser...");
|
|
92
90
|
const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();
|
|
93
|
-
(0, _assert).default(metroServerOrigin, "Metro dev server is not running");
|
|
94
91
|
const apps = await (0, _jsInspector).queryAllInspectorAppsAsync(metroServerOrigin);
|
|
92
|
+
let app1 = null;
|
|
95
93
|
if (!apps.length) {
|
|
96
|
-
Log.warn(`No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine. ${(0, _link).learnMore("https://docs.expo.dev/guides/using-hermes/")}`);
|
|
97
|
-
return;
|
|
94
|
+
return Log.warn(_chalk.default`{bold Debug:} No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine. ${(0, _link).learnMore("https://docs.expo.dev/guides/using-hermes/")}`);
|
|
98
95
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
if (apps.length === 1) {
|
|
97
|
+
app1 = apps[0];
|
|
98
|
+
} else {
|
|
99
|
+
var _deviceName;
|
|
100
|
+
const choices = apps.map((app)=>({
|
|
101
|
+
title: app.title,
|
|
102
|
+
value: (_deviceName = app.deviceName) != null ? _deviceName : "Unknown device",
|
|
103
|
+
app
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
const value = await (0, _prompts).selectAsync(_chalk.default`Debug target {dim (Hermes only)}`, choices);
|
|
107
|
+
const menuItem = choices.find((item)=>item.value === value
|
|
108
|
+
);
|
|
109
|
+
if (!menuItem) {
|
|
110
|
+
return Log.error(_chalk.default`{bold Debug:} No device available for "${value}"`);
|
|
102
111
|
}
|
|
112
|
+
app1 = menuItem.app;
|
|
113
|
+
}
|
|
114
|
+
if (!app1) {
|
|
115
|
+
return Log.error(_chalk.default`{bold Debug:} No device selected`);
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
await (0, _jsInspector).openJsInspector(metroServerOrigin, app1);
|
|
103
119
|
} catch (error) {
|
|
104
120
|
Log.error("Failed to open JavaScript inspector. This is often an issue with Google Chrome.");
|
|
105
121
|
Log.exception(error);
|