@expo/config 5.0.7 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/Config.d.ts CHANGED
@@ -67,7 +67,7 @@ export declare function getNameFromConfig(exp?: Record<string, any>): {
67
67
  appName?: string;
68
68
  webName?: string;
69
69
  };
70
- export declare function getDefaultTarget(projectRoot: string): ProjectTarget;
70
+ export declare function getDefaultTarget(projectRoot: string, exp?: Pick<ExpoConfig, 'sdkVersion'>): ProjectTarget;
71
71
  /**
72
72
  * Return a useful name describing the project config.
73
73
  * - dynamic: app.config.js
package/build/Config.js CHANGED
@@ -760,12 +760,12 @@ function getNameFromConfig(exp = {}) {
760
760
  };
761
761
  }
762
762
 
763
- function getDefaultTarget(projectRoot) {
764
- const {
765
- exp
766
- } = getConfig(projectRoot, {
763
+ function getDefaultTarget(projectRoot, exp) {
764
+ var _exp;
765
+
766
+ (_exp = exp) !== null && _exp !== void 0 ? _exp : exp = getConfig(projectRoot, {
767
767
  skipSDKVersionRequirement: true
768
- }); // before SDK 37, always default to managed to preserve previous behavior
768
+ }).exp; // before SDK 37, always default to managed to preserve previous behavior
769
769
 
770
770
  if (exp.sdkVersion && exp.sdkVersion !== 'UNVERSIONED' && _semver().default.lt(exp.sdkVersion, '37.0.0')) {
771
771
  return 'managed';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Config.ts"],"names":["reduceExpoObject","config","undefined","mods","expo","getSupportedPlatforms","projectRoot","platforms","resolveFrom","silent","push","getConfig","options","paths","getConfigFilePaths","rawStaticConfig","staticConfigPath","rootConfig","staticConfig","packageJson","packageJsonPath","getPackageJsonAndPath","fillAndReturnConfig","dynamicConfigObjectType","configWithDefaultValues","ensureConfigHasDefaultValues","exp","pkg","skipSDKVersionRequirement","dynamicConfigPath","isModdedConfig","skipPlugins","isPublicConfig","_internal","hooks","ios","android","currentFullName","originalFullName","getContextConfig","exportedObjectType","rawDynamicConfig","dynamicConfig","getPackageJson","JsonFile","read","readConfigJson","skipValidation","getConfigName","path","basename","outputRootConfig","ConfigError","resolve","APP_JSON_EXAMPLE","customPaths","getCustomConfigFilePaths","getDynamicConfigFilePath","getStaticConfigFilePath","customConfigPaths","isDynamicFilePath","fileName","configPath","join","fs","existsSync","findConfigFile","configName","configNamespace","configFilename","readExpRcAsync","expRcPath","readAsync","json5","cantReadFileDefault","resetCustomConfigPaths","key","Object","keys","setCustomConfigPath","modifyConfigAsync","modifications","readOptions","writeOptions","type","message","relative","outputConfig","dryRun","writeAsync","JSON","stringify","name","slug","sdkVersion","pkgName","pkgVersion","version","pkgWithDefaults","toLowerCase","description","expWithDefaults","error","writeConfigJsonAsync","console","log","DEFAULT_BUILD_PATH","getWebOutputPath","process","env","WEBPACK_BUILD_OUTPUT_PATH","web","build","output","getNameFromConfig","appManifest","appName","displayName","webName","getDefaultTarget","semver","lt","isBareWorkflowProject","dependencies","expokit","xcodeprojFiles","absolute","cwd","length","gradleFiles","filePath","match","getProjectConfigDescription","getProjectConfigDescriptionWithPaths","projectConfig","relativeDynamicConfigPath"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAcA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA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ModConfig } from '@expo/config-plugins';\nimport JsonFile, { JSONObject } from '@expo/json-file';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport semver from 'semver';\nimport slugify from 'slugify';\n\nimport {\n AppJSONConfig,\n ConfigFilePaths,\n ExpoConfig,\n ExpRc,\n GetConfigOptions,\n PackageJSONConfig,\n Platform,\n ProjectConfig,\n ProjectTarget,\n WriteConfigOptions,\n} from './Config.types';\nimport { ConfigError } from './Errors';\nimport { getExpoSDKVersion } from './Project';\nimport { getDynamicConfig, getStaticConfig } from './getConfig';\nimport { getFullName } from './getFullName';\nimport { withConfigPlugins } from './plugins/withConfigPlugins';\nimport { withInternal } from './plugins/withInternal';\nimport { getRootPackageJsonPath } from './resolvePackageJson';\n\ntype SplitConfigs = { expo: ExpoConfig; mods: ModConfig };\n\n/**\n * If a config has an `expo` object then that will be used as the config.\n * This method reduces out other top level values if an `expo` object exists.\n *\n * @param config Input config object to reduce\n */\nfunction reduceExpoObject(config?: any): SplitConfigs {\n if (!config) return config === undefined ? null : config;\n\n const { mods, ...expo } = config.expo ?? config;\n\n return {\n expo,\n mods,\n };\n}\n\n/**\n * Get all platforms that a project is currently capable of running.\n *\n * @param projectRoot\n * @param exp\n */\nfunction getSupportedPlatforms(projectRoot: string): Platform[] {\n const platforms: Platform[] = [];\n if (resolveFrom.silent(projectRoot, 'react-native')) {\n platforms.push('ios', 'android');\n }\n if (resolveFrom.silent(projectRoot, 'react-native-web')) {\n platforms.push('web');\n }\n return platforms;\n}\n\n/**\n * Evaluate the config for an Expo project.\n * If a function is exported from the `app.config.js` then a partial config will be passed as an argument.\n * The partial config is composed from any existing app.json, and certain fields from the `package.json` like name and description.\n *\n * If options.isPublicConfig is true, the Expo config will include only public-facing options (omitting private keys).\n * The resulting config should be suitable for hosting or embedding in a publicly readable location.\n *\n * **Example**\n * ```js\n * module.exports = function({ config }) {\n * // mutate the config before returning it.\n * config.slug = 'new slug'\n * return { expo: config };\n * }\n * ```\n *\n * **Supports**\n * - `app.config.ts`\n * - `app.config.js`\n * - `app.config.json`\n * - `app.json`\n *\n * @param projectRoot the root folder containing all of your application code\n * @param options enforce criteria for a project config\n */\nexport function getConfig(projectRoot: string, options: GetConfigOptions = {}): ProjectConfig {\n const paths = getConfigFilePaths(projectRoot);\n\n const rawStaticConfig = paths.staticConfigPath ? getStaticConfig(paths.staticConfigPath) : null;\n // For legacy reasons, always return an object.\n const rootConfig = (rawStaticConfig || {}) as AppJSONConfig;\n const staticConfig = reduceExpoObject(rawStaticConfig) || {};\n\n // Can only change the package.json location if an app.json or app.config.json exists\n const [packageJson, packageJsonPath] = getPackageJsonAndPath(projectRoot);\n\n function fillAndReturnConfig(config: SplitConfigs, dynamicConfigObjectType: string | null) {\n const configWithDefaultValues = {\n ...ensureConfigHasDefaultValues({\n projectRoot,\n exp: config.expo,\n pkg: packageJson,\n skipSDKVersionRequirement: options.skipSDKVersionRequirement,\n paths,\n packageJsonPath,\n }),\n mods: config.mods,\n dynamicConfigObjectType,\n rootConfig,\n dynamicConfigPath: paths.dynamicConfigPath,\n staticConfigPath: paths.staticConfigPath,\n };\n\n if (options.isModdedConfig) {\n // @ts-ignore: Add the mods back to the object.\n configWithDefaultValues.exp.mods = config.mods ?? null;\n }\n\n // Apply static json plugins, should be done after _internal\n configWithDefaultValues.exp = withConfigPlugins(\n configWithDefaultValues.exp,\n !!options.skipPlugins\n );\n\n if (!options.isModdedConfig) {\n // @ts-ignore: Delete mods added by static plugins when they won't have a chance to be evaluated\n delete configWithDefaultValues.exp.mods;\n }\n\n if (options.isPublicConfig) {\n // Remove internal values with references to user's file paths from the public config.\n delete configWithDefaultValues.exp._internal;\n\n if (configWithDefaultValues.exp.hooks) {\n delete configWithDefaultValues.exp.hooks;\n }\n if (configWithDefaultValues.exp.ios?.config) {\n delete configWithDefaultValues.exp.ios.config;\n }\n if (configWithDefaultValues.exp.android?.config) {\n delete configWithDefaultValues.exp.android.config;\n }\n\n // These value will be overwritten when the manifest is being served from the host (i.e. not completely accurate).\n // @ts-ignore: currentFullName not on type yet.\n configWithDefaultValues.exp.currentFullName = getFullName(configWithDefaultValues.exp);\n // @ts-ignore: originalFullName not on type yet.\n configWithDefaultValues.exp.originalFullName = getFullName(configWithDefaultValues.exp);\n }\n\n return configWithDefaultValues;\n }\n\n // Fill in the static config\n function getContextConfig(config: SplitConfigs) {\n return ensureConfigHasDefaultValues({\n projectRoot,\n exp: config.expo,\n pkg: packageJson,\n skipSDKVersionRequirement: true,\n paths,\n packageJsonPath,\n }).exp;\n }\n\n if (paths.dynamicConfigPath) {\n // No app.config.json or app.json but app.config.js\n const { exportedObjectType, config: rawDynamicConfig } = getDynamicConfig(\n paths.dynamicConfigPath,\n {\n projectRoot,\n staticConfigPath: paths.staticConfigPath,\n packageJsonPath,\n config: getContextConfig(staticConfig),\n }\n );\n // Allow for the app.config.js to `export default null;`\n // Use `dynamicConfigPath` to detect if a dynamic config exists.\n const dynamicConfig = reduceExpoObject(rawDynamicConfig) || {};\n return fillAndReturnConfig(dynamicConfig, exportedObjectType);\n }\n\n // No app.config.js but json or no config\n return fillAndReturnConfig(staticConfig || {}, null);\n}\n\nexport function getPackageJson(projectRoot: string): PackageJSONConfig {\n const [pkg] = getPackageJsonAndPath(projectRoot);\n return pkg;\n}\n\nfunction getPackageJsonAndPath(projectRoot: string): [PackageJSONConfig, string] {\n const packageJsonPath = getRootPackageJsonPath(projectRoot);\n return [JsonFile.read(packageJsonPath), packageJsonPath];\n}\n\nexport function readConfigJson(\n projectRoot: string,\n skipValidation: boolean = false,\n skipSDKVersionRequirement: boolean = false\n): ProjectConfig {\n const paths = getConfigFilePaths(projectRoot);\n\n const rawStaticConfig = paths.staticConfigPath ? getStaticConfig(paths.staticConfigPath) : null;\n\n const getConfigName = (): string => {\n if (paths.staticConfigPath) return ` \\`${path.basename(paths.staticConfigPath)}\\``;\n return '';\n };\n\n let outputRootConfig = rawStaticConfig as JSONObject | null;\n if (outputRootConfig === null || typeof outputRootConfig !== 'object') {\n if (skipValidation) {\n outputRootConfig = { expo: {} };\n } else {\n throw new ConfigError(\n `Project at path ${path.resolve(\n projectRoot\n )} does not contain a valid Expo config${getConfigName()}`,\n 'NOT_OBJECT'\n );\n }\n }\n let exp = outputRootConfig.expo as Partial<ExpoConfig>;\n if (exp === null || typeof exp !== 'object') {\n throw new ConfigError(\n `Property 'expo' in${getConfigName()} for project at path ${path.resolve(\n projectRoot\n )} is not an object. Please make sure${getConfigName()} includes a managed Expo app config like this: ${APP_JSON_EXAMPLE}`,\n 'NO_EXPO'\n );\n }\n\n exp = { ...exp };\n\n const [pkg, packageJsonPath] = getPackageJsonAndPath(projectRoot);\n\n return {\n ...ensureConfigHasDefaultValues({\n projectRoot,\n exp,\n pkg,\n skipSDKVersionRequirement,\n paths,\n packageJsonPath,\n }),\n mods: null,\n dynamicConfigPath: null,\n dynamicConfigObjectType: null,\n rootConfig: { ...outputRootConfig } as AppJSONConfig,\n ...paths,\n };\n}\n\n/**\n * Get the static and dynamic config paths for a project. Also accounts for custom paths.\n *\n * @param projectRoot\n */\nexport function getConfigFilePaths(projectRoot: string): ConfigFilePaths {\n const customPaths = getCustomConfigFilePaths(projectRoot);\n if (customPaths) {\n return customPaths;\n }\n\n return {\n dynamicConfigPath: getDynamicConfigFilePath(projectRoot),\n staticConfigPath: getStaticConfigFilePath(projectRoot),\n };\n}\n\nfunction getCustomConfigFilePaths(projectRoot: string): ConfigFilePaths | null {\n if (!customConfigPaths[projectRoot]) {\n return null;\n }\n // If the user picks a custom config path, we will only use that and skip searching for a secondary config.\n if (isDynamicFilePath(customConfigPaths[projectRoot])) {\n return {\n dynamicConfigPath: customConfigPaths[projectRoot],\n staticConfigPath: null,\n };\n }\n // Anything that's not js or ts will be treated as json.\n return { staticConfigPath: customConfigPaths[projectRoot], dynamicConfigPath: null };\n}\n\nfunction getDynamicConfigFilePath(projectRoot: string): string | null {\n for (const fileName of ['app.config.ts', 'app.config.js']) {\n const configPath = path.join(projectRoot, fileName);\n if (fs.existsSync(configPath)) {\n return configPath;\n }\n }\n return null;\n}\n\nfunction getStaticConfigFilePath(projectRoot: string): string | null {\n for (const fileName of ['app.config.json', 'app.json']) {\n const configPath = path.join(projectRoot, fileName);\n if (fs.existsSync(configPath)) {\n return configPath;\n }\n }\n return null;\n}\n\n// TODO: This should account for dynamic configs\nexport function findConfigFile(\n projectRoot: string\n): { configPath: string; configName: string; configNamespace: 'expo' } {\n let configPath: string;\n // Check for a custom config path first.\n if (customConfigPaths[projectRoot]) {\n configPath = customConfigPaths[projectRoot];\n // We shouldn't verify if the file exists because\n // the user manually specified that this path should be used.\n return {\n configPath,\n configName: path.basename(configPath),\n configNamespace: 'expo',\n };\n } else {\n // app.config.json takes higher priority over app.json\n configPath = path.join(projectRoot, 'app.config.json');\n if (!fs.existsSync(configPath)) {\n configPath = path.join(projectRoot, 'app.json');\n }\n }\n\n return {\n configPath,\n configName: path.basename(configPath),\n configNamespace: 'expo',\n };\n}\n\n// TODO: deprecate\nexport function configFilename(projectRoot: string): string {\n return findConfigFile(projectRoot).configName;\n}\n\nexport async function readExpRcAsync(projectRoot: string): Promise<ExpRc> {\n const expRcPath = path.join(projectRoot, '.exprc');\n return await JsonFile.readAsync(expRcPath, { json5: true, cantReadFileDefault: {} });\n}\n\nconst customConfigPaths: { [projectRoot: string]: string } = {};\n\nexport function resetCustomConfigPaths(): void {\n for (const key of Object.keys(customConfigPaths)) {\n delete customConfigPaths[key];\n }\n}\n\nexport function setCustomConfigPath(projectRoot: string, configPath: string): void {\n customConfigPaths[projectRoot] = configPath;\n}\n\n/**\n * Attempt to modify an Expo project config.\n * This will only fully work if the project is using static configs only.\n * Otherwise 'warn' | 'fail' will return with a message about why the config couldn't be updated.\n * The potentially modified config object will be returned for testing purposes.\n *\n * @param projectRoot\n * @param modifications modifications to make to an existing config\n * @param readOptions options for reading the current config file\n * @param writeOptions If true, the static config file will not be rewritten\n */\nexport async function modifyConfigAsync(\n projectRoot: string,\n modifications: Partial<ExpoConfig>,\n readOptions: GetConfigOptions = {},\n writeOptions: WriteConfigOptions = {}\n): Promise<{\n type: 'success' | 'warn' | 'fail';\n message?: string;\n config: AppJSONConfig | null;\n}> {\n const config = getConfig(projectRoot, readOptions);\n if (config.dynamicConfigPath) {\n // We cannot automatically write to a dynamic config.\n /* Currently we should just use the safest approach possible, informing the user that they'll need to manually modify their dynamic config.\n\n if (config.staticConfigPath) {\n // Both a dynamic and a static config exist.\n if (config.dynamicConfigObjectType === 'function') {\n // The dynamic config exports a function, this means it possibly extends the static config.\n } else {\n // Dynamic config ignores the static config, there isn't a reason to automatically write to it.\n // Instead we should warn the user to add values to their dynamic config.\n }\n }\n */\n return {\n type: 'warn',\n message: `Cannot automatically write to dynamic config at: ${path.relative(\n projectRoot,\n config.dynamicConfigPath\n )}`,\n config: null,\n };\n } else if (config.staticConfigPath) {\n // Static with no dynamic config, this means we can append to the config automatically.\n let outputConfig: AppJSONConfig;\n // If the config has an expo object (app.json) then append the options to that object.\n if (config.rootConfig.expo) {\n outputConfig = {\n ...config.rootConfig,\n expo: { ...config.rootConfig.expo, ...modifications },\n };\n } else {\n // Otherwise (app.config.json) just add the config modification to the top most level.\n outputConfig = { ...config.rootConfig, ...modifications };\n }\n if (!writeOptions.dryRun) {\n await JsonFile.writeAsync(config.staticConfigPath, outputConfig, { json5: false });\n }\n return { type: 'success', config: outputConfig };\n }\n\n return { type: 'fail', message: 'No config exists', config: null };\n}\n\nconst APP_JSON_EXAMPLE = JSON.stringify({\n expo: {\n name: 'My app',\n slug: 'my-app',\n sdkVersion: '...',\n },\n});\n\nfunction ensureConfigHasDefaultValues({\n projectRoot,\n exp,\n pkg,\n paths,\n packageJsonPath,\n skipSDKVersionRequirement = false,\n}: {\n projectRoot: string;\n exp: Partial<ExpoConfig> | null;\n pkg: JSONObject;\n skipSDKVersionRequirement?: boolean;\n paths?: ConfigFilePaths;\n packageJsonPath?: string;\n}): { exp: ExpoConfig; pkg: PackageJSONConfig } {\n if (!exp) {\n exp = {};\n }\n exp = withInternal(exp as any, {\n projectRoot,\n ...(paths ?? {}),\n packageJsonPath,\n });\n // Defaults for package.json fields\n const pkgName = typeof pkg.name === 'string' ? pkg.name : path.basename(projectRoot);\n const pkgVersion = typeof pkg.version === 'string' ? pkg.version : '1.0.0';\n\n const pkgWithDefaults = { ...pkg, name: pkgName, version: pkgVersion };\n\n // Defaults for app.json/app.config.js fields\n const name = exp.name ?? pkgName;\n const slug = exp.slug ?? slugify(name.toLowerCase());\n const version = exp.version ?? pkgVersion;\n let description = exp.description;\n if (!description && typeof pkg.description === 'string') {\n description = pkg.description;\n }\n\n const expWithDefaults = { ...exp, name, slug, version, description };\n\n let sdkVersion;\n try {\n sdkVersion = getExpoSDKVersion(projectRoot, expWithDefaults);\n } catch (error) {\n if (!skipSDKVersionRequirement) throw error;\n }\n\n let platforms = exp.platforms;\n if (!platforms) {\n platforms = getSupportedPlatforms(projectRoot);\n }\n\n return {\n exp: { ...expWithDefaults, sdkVersion, platforms },\n pkg: pkgWithDefaults,\n };\n}\n\nexport async function writeConfigJsonAsync(\n projectRoot: string,\n options: object\n): Promise<ProjectConfig> {\n const paths = getConfigFilePaths(projectRoot);\n let { exp, pkg, rootConfig, dynamicConfigObjectType, staticConfigPath } = readConfigJson(\n projectRoot\n );\n exp = { ...rootConfig.expo, ...options };\n rootConfig = { ...rootConfig, expo: exp };\n\n if (paths.staticConfigPath) {\n await JsonFile.writeAsync(paths.staticConfigPath, rootConfig, { json5: false });\n } else {\n console.log('Failed to write to config: ', options);\n }\n\n return {\n exp,\n pkg,\n rootConfig,\n staticConfigPath,\n dynamicConfigObjectType,\n ...paths,\n };\n}\nconst DEFAULT_BUILD_PATH = `web-build`;\n\nexport function getWebOutputPath(config: { [key: string]: any } = {}): string {\n if (process.env.WEBPACK_BUILD_OUTPUT_PATH) {\n return process.env.WEBPACK_BUILD_OUTPUT_PATH;\n }\n const expo = config.expo || config || {};\n return expo?.web?.build?.output || DEFAULT_BUILD_PATH;\n}\n\nexport function getNameFromConfig(\n exp: Record<string, any> = {}\n): { appName?: string; webName?: string } {\n // For RN CLI support\n const appManifest = exp.expo || exp;\n const { web = {} } = appManifest;\n\n // rn-cli apps use a displayName value as well.\n const appName = exp.displayName || appManifest.displayName || appManifest.name;\n const webName = web.name || appName;\n\n return {\n appName,\n webName,\n };\n}\n\nexport function getDefaultTarget(projectRoot: string): ProjectTarget {\n const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n // before SDK 37, always default to managed to preserve previous behavior\n if (exp.sdkVersion && exp.sdkVersion !== 'UNVERSIONED' && semver.lt(exp.sdkVersion, '37.0.0')) {\n return 'managed';\n }\n return isBareWorkflowProject(projectRoot) ? 'bare' : 'managed';\n}\n\nfunction isBareWorkflowProject(projectRoot: string): boolean {\n const [pkg] = getPackageJsonAndPath(projectRoot);\n\n if (pkg.dependencies && pkg.dependencies.expokit) {\n return false;\n }\n\n const xcodeprojFiles = globSync('ios/**/*.xcodeproj', {\n absolute: true,\n cwd: projectRoot,\n });\n if (xcodeprojFiles.length) {\n return true;\n }\n const gradleFiles = globSync('android/**/*.gradle', {\n absolute: true,\n cwd: projectRoot,\n });\n if (gradleFiles.length) {\n return true;\n }\n\n return false;\n}\n\n/**\n * true if the file is .js or .ts\n *\n * @param filePath\n */\nfunction isDynamicFilePath(filePath: string): boolean {\n return !!filePath.match(/\\.[j|t]s$/);\n}\n\n/**\n * Return a useful name describing the project config.\n * - dynamic: app.config.js\n * - static: app.json\n * - custom path app config relative to root folder\n * - both: app.config.js or app.json\n */\nexport function getProjectConfigDescription(projectRoot: string): string {\n const paths = getConfigFilePaths(projectRoot);\n return getProjectConfigDescriptionWithPaths(projectRoot, paths);\n}\n\n/**\n * Returns a string describing the configurations used for the given project root.\n * Will return null if no config is found.\n *\n * @param projectRoot\n * @param projectConfig\n */\nexport function getProjectConfigDescriptionWithPaths(\n projectRoot: string,\n projectConfig: ConfigFilePaths\n): string {\n if (projectConfig.dynamicConfigPath) {\n const relativeDynamicConfigPath = path.relative(projectRoot, projectConfig.dynamicConfigPath);\n if (projectConfig.staticConfigPath) {\n return `${relativeDynamicConfigPath} or ${path.relative(\n projectRoot,\n projectConfig.staticConfigPath\n )}`;\n }\n return relativeDynamicConfigPath;\n } else if (projectConfig.staticConfigPath) {\n return path.relative(projectRoot, projectConfig.staticConfigPath);\n }\n // If a config doesn't exist, our tooling will generate a static app.json\n return 'app.json';\n}\n\nexport * from './Config.types';\n\nexport { isLegacyImportsEnabled } from './isLegacyImportsEnabled';\n"],"file":"Config.js"}
1
+ {"version":3,"sources":["../src/Config.ts"],"names":["reduceExpoObject","config","undefined","mods","expo","getSupportedPlatforms","projectRoot","platforms","resolveFrom","silent","push","getConfig","options","paths","getConfigFilePaths","rawStaticConfig","staticConfigPath","rootConfig","staticConfig","packageJson","packageJsonPath","getPackageJsonAndPath","fillAndReturnConfig","dynamicConfigObjectType","configWithDefaultValues","ensureConfigHasDefaultValues","exp","pkg","skipSDKVersionRequirement","dynamicConfigPath","isModdedConfig","skipPlugins","isPublicConfig","_internal","hooks","ios","android","currentFullName","originalFullName","getContextConfig","exportedObjectType","rawDynamicConfig","dynamicConfig","getPackageJson","JsonFile","read","readConfigJson","skipValidation","getConfigName","path","basename","outputRootConfig","ConfigError","resolve","APP_JSON_EXAMPLE","customPaths","getCustomConfigFilePaths","getDynamicConfigFilePath","getStaticConfigFilePath","customConfigPaths","isDynamicFilePath","fileName","configPath","join","fs","existsSync","findConfigFile","configName","configNamespace","configFilename","readExpRcAsync","expRcPath","readAsync","json5","cantReadFileDefault","resetCustomConfigPaths","key","Object","keys","setCustomConfigPath","modifyConfigAsync","modifications","readOptions","writeOptions","type","message","relative","outputConfig","dryRun","writeAsync","JSON","stringify","name","slug","sdkVersion","pkgName","pkgVersion","version","pkgWithDefaults","toLowerCase","description","expWithDefaults","error","writeConfigJsonAsync","console","log","DEFAULT_BUILD_PATH","getWebOutputPath","process","env","WEBPACK_BUILD_OUTPUT_PATH","web","build","output","getNameFromConfig","appManifest","appName","displayName","webName","getDefaultTarget","semver","lt","isBareWorkflowProject","dependencies","expokit","xcodeprojFiles","absolute","cwd","length","gradleFiles","filePath","match","getProjectConfigDescription","getProjectConfigDescriptionWithPaths","projectConfig","relativeDynamicConfigPath"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAcA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAgmBA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AA9lBA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAT,CAA0BC,MAA1B,EAAsD;AAAA;;AACpD,MAAI,CAACA,MAAL,EAAa,OAAOA,MAAM,KAAKC,SAAX,GAAuB,IAAvB,GAA8BD,MAArC;AAEb,QAAM;AAAEE,IAAAA,IAAF;AAAQ,OAAGC;AAAX,sBAAoBH,MAAM,CAACG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;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,2BAAT,CAAqC9H,WAArC,EAAkE;AACvE,QAAMO,KAAK,GAAGC,kBAAkB,CAACR,WAAD,CAAhC;AACA,SAAO+H,oCAAoC,CAAC/H,WAAD,EAAcO,KAAd,CAA3C;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASwH,oCAAT,CACL/H,WADK,EAELgI,aAFK,EAGG;AACR,MAAIA,aAAa,CAACzG,iBAAlB,EAAqC;AACnC,UAAM0G,yBAAyB,GAAGtF,gBAAKqC,QAAL,CAAchF,WAAd,EAA2BgI,aAAa,CAACzG,iBAAzC,CAAlC;;AACA,QAAIyG,aAAa,CAACtH,gBAAlB,EAAoC;AAClC,aAAQ,GAAEuH,yBAA0B,OAAMtF,gBAAKqC,QAAL,CACxChF,WADwC,EAExCgI,aAAa,CAACtH,gBAF0B,CAGxC,EAHF;AAID;;AACD,WAAOuH,yBAAP;AACD,GATD,MASO,IAAID,aAAa,CAACtH,gBAAlB,EAAoC;AACzC,WAAOiC,gBAAKqC,QAAL,CAAchF,WAAd,EAA2BgI,aAAa,CAACtH,gBAAzC,CAAP;AACD,GAZO,CAaR;;;AACA,SAAO,UAAP;AACD","sourcesContent":["import { ModConfig } from '@expo/config-plugins';\nimport JsonFile, { JSONObject } from '@expo/json-file';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport semver from 'semver';\nimport slugify from 'slugify';\n\nimport {\n AppJSONConfig,\n ConfigFilePaths,\n ExpoConfig,\n ExpRc,\n GetConfigOptions,\n PackageJSONConfig,\n Platform,\n ProjectConfig,\n ProjectTarget,\n WriteConfigOptions,\n} from './Config.types';\nimport { ConfigError } from './Errors';\nimport { getExpoSDKVersion } from './Project';\nimport { getDynamicConfig, getStaticConfig } from './getConfig';\nimport { getFullName } from './getFullName';\nimport { withConfigPlugins } from './plugins/withConfigPlugins';\nimport { withInternal } from './plugins/withInternal';\nimport { getRootPackageJsonPath } from './resolvePackageJson';\n\ntype SplitConfigs = { expo: ExpoConfig; mods: ModConfig };\n\n/**\n * If a config has an `expo` object then that will be used as the config.\n * This method reduces out other top level values if an `expo` object exists.\n *\n * @param config Input config object to reduce\n */\nfunction reduceExpoObject(config?: any): SplitConfigs {\n if (!config) return config === undefined ? null : config;\n\n const { mods, ...expo } = config.expo ?? config;\n\n return {\n expo,\n mods,\n };\n}\n\n/**\n * Get all platforms that a project is currently capable of running.\n *\n * @param projectRoot\n * @param exp\n */\nfunction getSupportedPlatforms(projectRoot: string): Platform[] {\n const platforms: Platform[] = [];\n if (resolveFrom.silent(projectRoot, 'react-native')) {\n platforms.push('ios', 'android');\n }\n if (resolveFrom.silent(projectRoot, 'react-native-web')) {\n platforms.push('web');\n }\n return platforms;\n}\n\n/**\n * Evaluate the config for an Expo project.\n * If a function is exported from the `app.config.js` then a partial config will be passed as an argument.\n * The partial config is composed from any existing app.json, and certain fields from the `package.json` like name and description.\n *\n * If options.isPublicConfig is true, the Expo config will include only public-facing options (omitting private keys).\n * The resulting config should be suitable for hosting or embedding in a publicly readable location.\n *\n * **Example**\n * ```js\n * module.exports = function({ config }) {\n * // mutate the config before returning it.\n * config.slug = 'new slug'\n * return { expo: config };\n * }\n * ```\n *\n * **Supports**\n * - `app.config.ts`\n * - `app.config.js`\n * - `app.config.json`\n * - `app.json`\n *\n * @param projectRoot the root folder containing all of your application code\n * @param options enforce criteria for a project config\n */\nexport function getConfig(projectRoot: string, options: GetConfigOptions = {}): ProjectConfig {\n const paths = getConfigFilePaths(projectRoot);\n\n const rawStaticConfig = paths.staticConfigPath ? getStaticConfig(paths.staticConfigPath) : null;\n // For legacy reasons, always return an object.\n const rootConfig = (rawStaticConfig || {}) as AppJSONConfig;\n const staticConfig = reduceExpoObject(rawStaticConfig) || {};\n\n // Can only change the package.json location if an app.json or app.config.json exists\n const [packageJson, packageJsonPath] = getPackageJsonAndPath(projectRoot);\n\n function fillAndReturnConfig(config: SplitConfigs, dynamicConfigObjectType: string | null) {\n const configWithDefaultValues = {\n ...ensureConfigHasDefaultValues({\n projectRoot,\n exp: config.expo,\n pkg: packageJson,\n skipSDKVersionRequirement: options.skipSDKVersionRequirement,\n paths,\n packageJsonPath,\n }),\n mods: config.mods,\n dynamicConfigObjectType,\n rootConfig,\n dynamicConfigPath: paths.dynamicConfigPath,\n staticConfigPath: paths.staticConfigPath,\n };\n\n if (options.isModdedConfig) {\n // @ts-ignore: Add the mods back to the object.\n configWithDefaultValues.exp.mods = config.mods ?? null;\n }\n\n // Apply static json plugins, should be done after _internal\n configWithDefaultValues.exp = withConfigPlugins(\n configWithDefaultValues.exp,\n !!options.skipPlugins\n );\n\n if (!options.isModdedConfig) {\n // @ts-ignore: Delete mods added by static plugins when they won't have a chance to be evaluated\n delete configWithDefaultValues.exp.mods;\n }\n\n if (options.isPublicConfig) {\n // Remove internal values with references to user's file paths from the public config.\n delete configWithDefaultValues.exp._internal;\n\n if (configWithDefaultValues.exp.hooks) {\n delete configWithDefaultValues.exp.hooks;\n }\n if (configWithDefaultValues.exp.ios?.config) {\n delete configWithDefaultValues.exp.ios.config;\n }\n if (configWithDefaultValues.exp.android?.config) {\n delete configWithDefaultValues.exp.android.config;\n }\n\n // These value will be overwritten when the manifest is being served from the host (i.e. not completely accurate).\n // @ts-ignore: currentFullName not on type yet.\n configWithDefaultValues.exp.currentFullName = getFullName(configWithDefaultValues.exp);\n // @ts-ignore: originalFullName not on type yet.\n configWithDefaultValues.exp.originalFullName = getFullName(configWithDefaultValues.exp);\n }\n\n return configWithDefaultValues;\n }\n\n // Fill in the static config\n function getContextConfig(config: SplitConfigs) {\n return ensureConfigHasDefaultValues({\n projectRoot,\n exp: config.expo,\n pkg: packageJson,\n skipSDKVersionRequirement: true,\n paths,\n packageJsonPath,\n }).exp;\n }\n\n if (paths.dynamicConfigPath) {\n // No app.config.json or app.json but app.config.js\n const { exportedObjectType, config: rawDynamicConfig } = getDynamicConfig(\n paths.dynamicConfigPath,\n {\n projectRoot,\n staticConfigPath: paths.staticConfigPath,\n packageJsonPath,\n config: getContextConfig(staticConfig),\n }\n );\n // Allow for the app.config.js to `export default null;`\n // Use `dynamicConfigPath` to detect if a dynamic config exists.\n const dynamicConfig = reduceExpoObject(rawDynamicConfig) || {};\n return fillAndReturnConfig(dynamicConfig, exportedObjectType);\n }\n\n // No app.config.js but json or no config\n return fillAndReturnConfig(staticConfig || {}, null);\n}\n\nexport function getPackageJson(projectRoot: string): PackageJSONConfig {\n const [pkg] = getPackageJsonAndPath(projectRoot);\n return pkg;\n}\n\nfunction getPackageJsonAndPath(projectRoot: string): [PackageJSONConfig, string] {\n const packageJsonPath = getRootPackageJsonPath(projectRoot);\n return [JsonFile.read(packageJsonPath), packageJsonPath];\n}\n\nexport function readConfigJson(\n projectRoot: string,\n skipValidation: boolean = false,\n skipSDKVersionRequirement: boolean = false\n): ProjectConfig {\n const paths = getConfigFilePaths(projectRoot);\n\n const rawStaticConfig = paths.staticConfigPath ? getStaticConfig(paths.staticConfigPath) : null;\n\n const getConfigName = (): string => {\n if (paths.staticConfigPath) return ` \\`${path.basename(paths.staticConfigPath)}\\``;\n return '';\n };\n\n let outputRootConfig = rawStaticConfig as JSONObject | null;\n if (outputRootConfig === null || typeof outputRootConfig !== 'object') {\n if (skipValidation) {\n outputRootConfig = { expo: {} };\n } else {\n throw new ConfigError(\n `Project at path ${path.resolve(\n projectRoot\n )} does not contain a valid Expo config${getConfigName()}`,\n 'NOT_OBJECT'\n );\n }\n }\n let exp = outputRootConfig.expo as Partial<ExpoConfig>;\n if (exp === null || typeof exp !== 'object') {\n throw new ConfigError(\n `Property 'expo' in${getConfigName()} for project at path ${path.resolve(\n projectRoot\n )} is not an object. Please make sure${getConfigName()} includes a managed Expo app config like this: ${APP_JSON_EXAMPLE}`,\n 'NO_EXPO'\n );\n }\n\n exp = { ...exp };\n\n const [pkg, packageJsonPath] = getPackageJsonAndPath(projectRoot);\n\n return {\n ...ensureConfigHasDefaultValues({\n projectRoot,\n exp,\n pkg,\n skipSDKVersionRequirement,\n paths,\n packageJsonPath,\n }),\n mods: null,\n dynamicConfigPath: null,\n dynamicConfigObjectType: null,\n rootConfig: { ...outputRootConfig } as AppJSONConfig,\n ...paths,\n };\n}\n\n/**\n * Get the static and dynamic config paths for a project. Also accounts for custom paths.\n *\n * @param projectRoot\n */\nexport function getConfigFilePaths(projectRoot: string): ConfigFilePaths {\n const customPaths = getCustomConfigFilePaths(projectRoot);\n if (customPaths) {\n return customPaths;\n }\n\n return {\n dynamicConfigPath: getDynamicConfigFilePath(projectRoot),\n staticConfigPath: getStaticConfigFilePath(projectRoot),\n };\n}\n\nfunction getCustomConfigFilePaths(projectRoot: string): ConfigFilePaths | null {\n if (!customConfigPaths[projectRoot]) {\n return null;\n }\n // If the user picks a custom config path, we will only use that and skip searching for a secondary config.\n if (isDynamicFilePath(customConfigPaths[projectRoot])) {\n return {\n dynamicConfigPath: customConfigPaths[projectRoot],\n staticConfigPath: null,\n };\n }\n // Anything that's not js or ts will be treated as json.\n return { staticConfigPath: customConfigPaths[projectRoot], dynamicConfigPath: null };\n}\n\nfunction getDynamicConfigFilePath(projectRoot: string): string | null {\n for (const fileName of ['app.config.ts', 'app.config.js']) {\n const configPath = path.join(projectRoot, fileName);\n if (fs.existsSync(configPath)) {\n return configPath;\n }\n }\n return null;\n}\n\nfunction getStaticConfigFilePath(projectRoot: string): string | null {\n for (const fileName of ['app.config.json', 'app.json']) {\n const configPath = path.join(projectRoot, fileName);\n if (fs.existsSync(configPath)) {\n return configPath;\n }\n }\n return null;\n}\n\n// TODO: This should account for dynamic configs\nexport function findConfigFile(\n projectRoot: string\n): { configPath: string; configName: string; configNamespace: 'expo' } {\n let configPath: string;\n // Check for a custom config path first.\n if (customConfigPaths[projectRoot]) {\n configPath = customConfigPaths[projectRoot];\n // We shouldn't verify if the file exists because\n // the user manually specified that this path should be used.\n return {\n configPath,\n configName: path.basename(configPath),\n configNamespace: 'expo',\n };\n } else {\n // app.config.json takes higher priority over app.json\n configPath = path.join(projectRoot, 'app.config.json');\n if (!fs.existsSync(configPath)) {\n configPath = path.join(projectRoot, 'app.json');\n }\n }\n\n return {\n configPath,\n configName: path.basename(configPath),\n configNamespace: 'expo',\n };\n}\n\n// TODO: deprecate\nexport function configFilename(projectRoot: string): string {\n return findConfigFile(projectRoot).configName;\n}\n\nexport async function readExpRcAsync(projectRoot: string): Promise<ExpRc> {\n const expRcPath = path.join(projectRoot, '.exprc');\n return await JsonFile.readAsync(expRcPath, { json5: true, cantReadFileDefault: {} });\n}\n\nconst customConfigPaths: { [projectRoot: string]: string } = {};\n\nexport function resetCustomConfigPaths(): void {\n for (const key of Object.keys(customConfigPaths)) {\n delete customConfigPaths[key];\n }\n}\n\nexport function setCustomConfigPath(projectRoot: string, configPath: string): void {\n customConfigPaths[projectRoot] = configPath;\n}\n\n/**\n * Attempt to modify an Expo project config.\n * This will only fully work if the project is using static configs only.\n * Otherwise 'warn' | 'fail' will return with a message about why the config couldn't be updated.\n * The potentially modified config object will be returned for testing purposes.\n *\n * @param projectRoot\n * @param modifications modifications to make to an existing config\n * @param readOptions options for reading the current config file\n * @param writeOptions If true, the static config file will not be rewritten\n */\nexport async function modifyConfigAsync(\n projectRoot: string,\n modifications: Partial<ExpoConfig>,\n readOptions: GetConfigOptions = {},\n writeOptions: WriteConfigOptions = {}\n): Promise<{\n type: 'success' | 'warn' | 'fail';\n message?: string;\n config: AppJSONConfig | null;\n}> {\n const config = getConfig(projectRoot, readOptions);\n if (config.dynamicConfigPath) {\n // We cannot automatically write to a dynamic config.\n /* Currently we should just use the safest approach possible, informing the user that they'll need to manually modify their dynamic config.\n\n if (config.staticConfigPath) {\n // Both a dynamic and a static config exist.\n if (config.dynamicConfigObjectType === 'function') {\n // The dynamic config exports a function, this means it possibly extends the static config.\n } else {\n // Dynamic config ignores the static config, there isn't a reason to automatically write to it.\n // Instead we should warn the user to add values to their dynamic config.\n }\n }\n */\n return {\n type: 'warn',\n message: `Cannot automatically write to dynamic config at: ${path.relative(\n projectRoot,\n config.dynamicConfigPath\n )}`,\n config: null,\n };\n } else if (config.staticConfigPath) {\n // Static with no dynamic config, this means we can append to the config automatically.\n let outputConfig: AppJSONConfig;\n // If the config has an expo object (app.json) then append the options to that object.\n if (config.rootConfig.expo) {\n outputConfig = {\n ...config.rootConfig,\n expo: { ...config.rootConfig.expo, ...modifications },\n };\n } else {\n // Otherwise (app.config.json) just add the config modification to the top most level.\n outputConfig = { ...config.rootConfig, ...modifications };\n }\n if (!writeOptions.dryRun) {\n await JsonFile.writeAsync(config.staticConfigPath, outputConfig, { json5: false });\n }\n return { type: 'success', config: outputConfig };\n }\n\n return { type: 'fail', message: 'No config exists', config: null };\n}\n\nconst APP_JSON_EXAMPLE = JSON.stringify({\n expo: {\n name: 'My app',\n slug: 'my-app',\n sdkVersion: '...',\n },\n});\n\nfunction ensureConfigHasDefaultValues({\n projectRoot,\n exp,\n pkg,\n paths,\n packageJsonPath,\n skipSDKVersionRequirement = false,\n}: {\n projectRoot: string;\n exp: Partial<ExpoConfig> | null;\n pkg: JSONObject;\n skipSDKVersionRequirement?: boolean;\n paths?: ConfigFilePaths;\n packageJsonPath?: string;\n}): { exp: ExpoConfig; pkg: PackageJSONConfig } {\n if (!exp) {\n exp = {};\n }\n exp = withInternal(exp as any, {\n projectRoot,\n ...(paths ?? {}),\n packageJsonPath,\n });\n // Defaults for package.json fields\n const pkgName = typeof pkg.name === 'string' ? pkg.name : path.basename(projectRoot);\n const pkgVersion = typeof pkg.version === 'string' ? pkg.version : '1.0.0';\n\n const pkgWithDefaults = { ...pkg, name: pkgName, version: pkgVersion };\n\n // Defaults for app.json/app.config.js fields\n const name = exp.name ?? pkgName;\n const slug = exp.slug ?? slugify(name.toLowerCase());\n const version = exp.version ?? pkgVersion;\n let description = exp.description;\n if (!description && typeof pkg.description === 'string') {\n description = pkg.description;\n }\n\n const expWithDefaults = { ...exp, name, slug, version, description };\n\n let sdkVersion;\n try {\n sdkVersion = getExpoSDKVersion(projectRoot, expWithDefaults);\n } catch (error) {\n if (!skipSDKVersionRequirement) throw error;\n }\n\n let platforms = exp.platforms;\n if (!platforms) {\n platforms = getSupportedPlatforms(projectRoot);\n }\n\n return {\n exp: { ...expWithDefaults, sdkVersion, platforms },\n pkg: pkgWithDefaults,\n };\n}\n\nexport async function writeConfigJsonAsync(\n projectRoot: string,\n options: object\n): Promise<ProjectConfig> {\n const paths = getConfigFilePaths(projectRoot);\n let { exp, pkg, rootConfig, dynamicConfigObjectType, staticConfigPath } = readConfigJson(\n projectRoot\n );\n exp = { ...rootConfig.expo, ...options };\n rootConfig = { ...rootConfig, expo: exp };\n\n if (paths.staticConfigPath) {\n await JsonFile.writeAsync(paths.staticConfigPath, rootConfig, { json5: false });\n } else {\n console.log('Failed to write to config: ', options);\n }\n\n return {\n exp,\n pkg,\n rootConfig,\n staticConfigPath,\n dynamicConfigObjectType,\n ...paths,\n };\n}\nconst DEFAULT_BUILD_PATH = `web-build`;\n\nexport function getWebOutputPath(config: { [key: string]: any } = {}): string {\n if (process.env.WEBPACK_BUILD_OUTPUT_PATH) {\n return process.env.WEBPACK_BUILD_OUTPUT_PATH;\n }\n const expo = config.expo || config || {};\n return expo?.web?.build?.output || DEFAULT_BUILD_PATH;\n}\n\nexport function getNameFromConfig(\n exp: Record<string, any> = {}\n): { appName?: string; webName?: string } {\n // For RN CLI support\n const appManifest = exp.expo || exp;\n const { web = {} } = appManifest;\n\n // rn-cli apps use a displayName value as well.\n const appName = exp.displayName || appManifest.displayName || appManifest.name;\n const webName = web.name || appName;\n\n return {\n appName,\n webName,\n };\n}\n\nexport function getDefaultTarget(\n projectRoot: string,\n exp?: Pick<ExpoConfig, 'sdkVersion'>\n): ProjectTarget {\n exp ??= getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // before SDK 37, always default to managed to preserve previous behavior\n if (exp.sdkVersion && exp.sdkVersion !== 'UNVERSIONED' && semver.lt(exp.sdkVersion, '37.0.0')) {\n return 'managed';\n }\n return isBareWorkflowProject(projectRoot) ? 'bare' : 'managed';\n}\n\nfunction isBareWorkflowProject(projectRoot: string): boolean {\n const [pkg] = getPackageJsonAndPath(projectRoot);\n\n if (pkg.dependencies && pkg.dependencies.expokit) {\n return false;\n }\n\n const xcodeprojFiles = globSync('ios/**/*.xcodeproj', {\n absolute: true,\n cwd: projectRoot,\n });\n if (xcodeprojFiles.length) {\n return true;\n }\n const gradleFiles = globSync('android/**/*.gradle', {\n absolute: true,\n cwd: projectRoot,\n });\n if (gradleFiles.length) {\n return true;\n }\n\n return false;\n}\n\n/**\n * true if the file is .js or .ts\n *\n * @param filePath\n */\nfunction isDynamicFilePath(filePath: string): boolean {\n return !!filePath.match(/\\.[j|t]s$/);\n}\n\n/**\n * Return a useful name describing the project config.\n * - dynamic: app.config.js\n * - static: app.json\n * - custom path app config relative to root folder\n * - both: app.config.js or app.json\n */\nexport function getProjectConfigDescription(projectRoot: string): string {\n const paths = getConfigFilePaths(projectRoot);\n return getProjectConfigDescriptionWithPaths(projectRoot, paths);\n}\n\n/**\n * Returns a string describing the configurations used for the given project root.\n * Will return null if no config is found.\n *\n * @param projectRoot\n * @param projectConfig\n */\nexport function getProjectConfigDescriptionWithPaths(\n projectRoot: string,\n projectConfig: ConfigFilePaths\n): string {\n if (projectConfig.dynamicConfigPath) {\n const relativeDynamicConfigPath = path.relative(projectRoot, projectConfig.dynamicConfigPath);\n if (projectConfig.staticConfigPath) {\n return `${relativeDynamicConfigPath} or ${path.relative(\n projectRoot,\n projectConfig.staticConfigPath\n )}`;\n }\n return relativeDynamicConfigPath;\n } else if (projectConfig.staticConfigPath) {\n return path.relative(projectRoot, projectConfig.staticConfigPath);\n }\n // If a config doesn't exist, our tooling will generate a static app.json\n return 'app.json';\n}\n\nexport * from './Config.types';\n\nexport { isLegacyImportsEnabled } from './isLegacyImportsEnabled';\n"],"file":"Config.js"}
@@ -1,7 +1,10 @@
1
1
  import { ModConfig } from '@expo/config-plugins';
2
2
  import { ExpoConfig } from '@expo/config-types';
3
3
  export { ExpoConfig };
4
- export declare type PackageJSONConfig = Record<string, any>;
4
+ export declare type PackageJSONConfig = {
5
+ dependencies?: Record<string, string>;
6
+ [key: string]: any;
7
+ };
5
8
  export interface ProjectConfig {
6
9
  /**
7
10
  * Fully evaluated Expo config with default values injected.
@@ -54,9 +57,11 @@ export declare type HookArguments = {
54
57
  iosBundle: string | Uint8Array;
55
58
  iosSourceMap: string | null;
56
59
  iosManifest: any;
60
+ iosManifestUrl: string;
57
61
  androidBundle: string | Uint8Array;
58
62
  androidSourceMap: string | null;
59
63
  androidManifest: any;
64
+ androidManifestUrl: string;
60
65
  projectRoot: string;
61
66
  log: (msg: any) => void;
62
67
  };
@@ -73,7 +78,21 @@ export declare type ExpoGoConfig = {
73
78
  [key: string]: any;
74
79
  };
75
80
  };
76
- export declare type ExpoAppManifest = ExpoConfig & Partial<ExpoGoConfig> & {
81
+ export declare type EASConfig = {
82
+ projectId?: string;
83
+ };
84
+ export declare type ClientScopingConfig = {
85
+ scopeKey?: string;
86
+ };
87
+ export declare type ExpoClientConfig = ExpoConfig & {
88
+ id?: string;
89
+ releaseId?: string;
90
+ revisionId?: string;
91
+ bundleUrl?: string;
92
+ hostUri?: string;
93
+ publishedTime?: string;
94
+ };
95
+ export declare type ExpoAppManifest = ExpoClientConfig & EASConfig & Partial<ExpoGoConfig> & {
77
96
  sdkVersion: string;
78
97
  bundledAssets?: string[];
79
98
  isKernel?: boolean;
@@ -82,14 +101,8 @@ export declare type ExpoAppManifest = ExpoConfig & Partial<ExpoGoConfig> & {
82
101
  iosManifestPath?: string;
83
102
  };
84
103
  assetUrlOverride?: string;
85
- publishedTime?: string;
86
104
  commitTime?: string;
87
- releaseId?: string;
88
- revisionId?: string;
89
105
  env?: Record<string, any>;
90
- bundleUrl?: string;
91
- hostUri?: string;
92
- id?: string;
93
106
  };
94
107
  export interface ExpoUpdatesManifestAsset {
95
108
  url: string;
@@ -106,8 +119,10 @@ export interface ExpoUpdatesManifest {
106
119
  metadata: {
107
120
  [key: string]: string;
108
121
  };
109
- extra: {
110
- [key: string]: any;
122
+ extra: ClientScopingConfig & {
123
+ expoClient?: ExpoClientConfig;
124
+ expoGo?: ExpoGoConfig;
125
+ eas?: EASConfig;
111
126
  };
112
127
  }
113
128
  export declare type Hook = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Config.types.ts"],"names":["ProjectPrivacy"],"mappings":";;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;IAsHYA,c;;;WAAAA,c;AAAAA,EAAAA,c;AAAAA,EAAAA,c;GAAAA,c,8BAAAA,c","sourcesContent":["import { ModConfig } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\n\nexport { ExpoConfig };\n\nexport type PackageJSONConfig = Record<string, any>;\n\nexport interface ProjectConfig {\n /**\n * Fully evaluated Expo config with default values injected.\n */\n exp: ExpoConfig;\n /**\n * Dynamic config for processing native files during the generation process.\n */\n mods?: ModConfig | null;\n /**\n * Project package.json object with default values injected.\n */\n pkg: PackageJSONConfig;\n /**\n * Unaltered static config (app.config.json, app.json, or custom json config).\n * For legacy, an empty object will be returned even if no static config exists.\n */\n rootConfig: AppJSONConfig;\n /**\n * Path to the static json config file if it exists.\n * If a project has an app.config.js and an app.json then app.json will be returned.\n * If a project has an app.config.json and an app.json then app.config.json will be returned.\n * Returns null if no static config file exists.\n */\n staticConfigPath: string | null;\n /**\n * Path to an app.config.js or app.config.ts.\n * Returns null if no dynamic config file exists.\n */\n dynamicConfigPath: string | null;\n\n /**\n * Returns the type of the value exported from the dynamic config.\n * This can be used to determine if the dynamic config is potentially extending a static config when (v === 'function').\n * Returns null if no dynamic config file exists.\n */\n dynamicConfigObjectType: string | null;\n}\nexport type AppJSONConfig = { expo: ExpoConfig; [key: string]: any };\nexport type BareAppConfig = { name: string; [key: string]: any };\nexport type HookArguments = {\n config: any;\n url: any;\n exp: ExpoConfig;\n iosBundle: string | Uint8Array;\n iosSourceMap: string | null;\n iosManifest: any;\n androidBundle: string | Uint8Array;\n androidSourceMap: string | null;\n androidManifest: any;\n projectRoot: string;\n log: (msg: any) => void;\n};\n\nexport type ExpoGoConfig = {\n mainModuleName: string;\n // A string that flipper checks to determine if Metro bundler is running\n // by adding it to the manifest, we can trick Flipper into working properly.\n // https://github.com/facebook/flipper/blob/9ca8bee208b7bfe2b8c0dab8eb4b79688a0c84bc/desktop/app/src/dispatcher/metroDevice.tsx#L37\n __flipperHack: 'React Native packager is running';\n debuggerHost: string;\n logUrl: string;\n developer: {\n tool: string | null;\n projectRoot?: string;\n };\n packagerOpts: {\n [key: string]: any;\n };\n};\n\nexport type ExpoAppManifest = ExpoConfig &\n Partial<ExpoGoConfig> & {\n sdkVersion: string;\n bundledAssets?: string[];\n isKernel?: boolean;\n kernel?: { androidManifestPath?: string; iosManifestPath?: string };\n assetUrlOverride?: string;\n publishedTime?: string;\n commitTime?: string;\n releaseId?: string;\n revisionId?: string;\n env?: Record<string, any>;\n bundleUrl?: string;\n hostUri?: string;\n id?: string;\n };\n\nexport interface ExpoUpdatesManifestAsset {\n url: string;\n key: string;\n contentType: string;\n hash?: string;\n}\n\nexport interface ExpoUpdatesManifest {\n id: string;\n createdAt: string;\n runtimeVersion: string;\n launchAsset: ExpoUpdatesManifestAsset;\n assets: ExpoUpdatesManifestAsset[];\n metadata: { [key: string]: string };\n extra: { [key: string]: any };\n}\n\nexport type Hook = {\n file: string;\n config: any;\n};\n\nexport type HookType = 'postPublish' | 'postExport';\n\nexport enum ProjectPrivacy {\n PUBLIC = 'public',\n UNLISTED = 'unlisted',\n}\n\nexport type ExpRc = { [key: string]: any };\nexport type Platform = 'android' | 'ios' | 'web';\nexport type ProjectTarget = 'managed' | 'bare';\n\nexport type ConfigErrorCode =\n | 'NO_APP_JSON'\n | 'NOT_OBJECT'\n | 'NO_EXPO'\n | 'MODULE_NOT_FOUND'\n | 'INVALID_MODE'\n | 'INVALID_FORMAT'\n | 'INVALID_PLUGIN'\n | 'INVALID_CONFIG';\n\nexport type ConfigContext = {\n projectRoot: string;\n /**\n * The static config path either app.json, app.config.json, or a custom user-defined config.\n */\n staticConfigPath: string | null;\n packageJsonPath: string | null;\n config: Partial<ExpoConfig>;\n};\n\nexport type GetConfigOptions = {\n isPublicConfig?: boolean;\n /**\n * Should the config `mods` be preserved in the config? Used for compiling mods in the eject command.\n *\n * @default false\n */\n isModdedConfig?: boolean;\n skipSDKVersionRequirement?: boolean;\n /**\n * Dangerously skip resolving plugins.\n */\n skipPlugins?: boolean;\n strict?: boolean;\n};\n\nexport type WriteConfigOptions = { dryRun?: boolean };\n\nexport type ConfigFilePaths = { staticConfigPath: string | null; dynamicConfigPath: string | null };\n"],"file":"Config.types.js"}
1
+ {"version":3,"sources":["../src/Config.types.ts"],"names":["ProjectPrivacy"],"mappings":";;;;;;;;;;;;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;IAwIYA,c;;;WAAAA,c;AAAAA,EAAAA,c;AAAAA,EAAAA,c;GAAAA,c,8BAAAA,c","sourcesContent":["import { ModConfig } from '@expo/config-plugins';\nimport { ExpoConfig } from '@expo/config-types';\n\nexport { ExpoConfig };\n\nexport type PackageJSONConfig = { dependencies?: Record<string, string>; [key: string]: any };\n\nexport interface ProjectConfig {\n /**\n * Fully evaluated Expo config with default values injected.\n */\n exp: ExpoConfig;\n /**\n * Dynamic config for processing native files during the generation process.\n */\n mods?: ModConfig | null;\n /**\n * Project package.json object with default values injected.\n */\n pkg: PackageJSONConfig;\n /**\n * Unaltered static config (app.config.json, app.json, or custom json config).\n * For legacy, an empty object will be returned even if no static config exists.\n */\n rootConfig: AppJSONConfig;\n /**\n * Path to the static json config file if it exists.\n * If a project has an app.config.js and an app.json then app.json will be returned.\n * If a project has an app.config.json and an app.json then app.config.json will be returned.\n * Returns null if no static config file exists.\n */\n staticConfigPath: string | null;\n /**\n * Path to an app.config.js or app.config.ts.\n * Returns null if no dynamic config file exists.\n */\n dynamicConfigPath: string | null;\n\n /**\n * Returns the type of the value exported from the dynamic config.\n * This can be used to determine if the dynamic config is potentially extending a static config when (v === 'function').\n * Returns null if no dynamic config file exists.\n */\n dynamicConfigObjectType: string | null;\n}\nexport type AppJSONConfig = { expo: ExpoConfig; [key: string]: any };\nexport type BareAppConfig = { name: string; [key: string]: any };\nexport type HookArguments = {\n config: any;\n url: any;\n exp: ExpoConfig;\n iosBundle: string | Uint8Array;\n iosSourceMap: string | null;\n iosManifest: any;\n iosManifestUrl: string;\n androidBundle: string | Uint8Array;\n androidSourceMap: string | null;\n androidManifest: any;\n androidManifestUrl: string;\n projectRoot: string;\n log: (msg: any) => void;\n};\n\nexport type ExpoGoConfig = {\n mainModuleName: string;\n // A string that flipper checks to determine if Metro bundler is running\n // by adding it to the manifest, we can trick Flipper into working properly.\n // https://github.com/facebook/flipper/blob/9ca8bee208b7bfe2b8c0dab8eb4b79688a0c84bc/desktop/app/src/dispatcher/metroDevice.tsx#L37\n __flipperHack: 'React Native packager is running';\n debuggerHost: string;\n logUrl: string;\n developer: {\n tool: string | null;\n projectRoot?: string;\n };\n packagerOpts: {\n [key: string]: any;\n };\n};\n\nexport type EASConfig = {\n projectId?: string;\n};\n\nexport type ClientScopingConfig = {\n scopeKey?: string;\n};\n\nexport type ExpoClientConfig = ExpoConfig & {\n id?: string;\n releaseId?: string;\n revisionId?: string;\n bundleUrl?: string;\n hostUri?: string;\n publishedTime?: string;\n};\n\nexport type ExpoAppManifest = ExpoClientConfig &\n EASConfig &\n Partial<ExpoGoConfig> & {\n sdkVersion: string;\n bundledAssets?: string[];\n isKernel?: boolean;\n kernel?: { androidManifestPath?: string; iosManifestPath?: string };\n assetUrlOverride?: string;\n commitTime?: string;\n env?: Record<string, any>;\n };\n\nexport interface ExpoUpdatesManifestAsset {\n url: string;\n key: string;\n contentType: string;\n hash?: string;\n}\n\nexport interface ExpoUpdatesManifest {\n id: string;\n createdAt: string;\n runtimeVersion: string;\n launchAsset: ExpoUpdatesManifestAsset;\n assets: ExpoUpdatesManifestAsset[];\n metadata: { [key: string]: string };\n extra: ClientScopingConfig & {\n expoClient?: ExpoClientConfig;\n expoGo?: ExpoGoConfig;\n eas?: EASConfig;\n };\n}\n\nexport type Hook = {\n file: string;\n config: any;\n};\n\nexport type HookType = 'postPublish' | 'postExport';\n\nexport enum ProjectPrivacy {\n PUBLIC = 'public',\n UNLISTED = 'unlisted',\n}\n\nexport type ExpRc = { [key: string]: any };\nexport type Platform = 'android' | 'ios' | 'web';\nexport type ProjectTarget = 'managed' | 'bare';\n\nexport type ConfigErrorCode =\n | 'NO_APP_JSON'\n | 'NOT_OBJECT'\n | 'NO_EXPO'\n | 'MODULE_NOT_FOUND'\n | 'INVALID_MODE'\n | 'INVALID_FORMAT'\n | 'INVALID_PLUGIN'\n | 'INVALID_CONFIG';\n\nexport type ConfigContext = {\n projectRoot: string;\n /**\n * The static config path either app.json, app.config.json, or a custom user-defined config.\n */\n staticConfigPath: string | null;\n packageJsonPath: string | null;\n config: Partial<ExpoConfig>;\n};\n\nexport type GetConfigOptions = {\n isPublicConfig?: boolean;\n /**\n * Should the config `mods` be preserved in the config? Used for compiling mods in the eject command.\n *\n * @default false\n */\n isModdedConfig?: boolean;\n skipSDKVersionRequirement?: boolean;\n /**\n * Dangerously skip resolving plugins.\n */\n skipPlugins?: boolean;\n strict?: boolean;\n};\n\nexport type WriteConfigOptions = { dryRun?: boolean };\n\nexport type ConfigFilePaths = { staticConfigPath: string | null; dynamicConfigPath: string | null };\n"],"file":"Config.types.js"}
@@ -1,6 +1,10 @@
1
1
  import { ProjectConfig } from '../Config.types';
2
2
  export declare function ensureSlash(inputPath: string, needsSlash: boolean): string;
3
3
  export declare function getPossibleProjectRoot(): string;
4
+ export declare function resolveEntryPoint(projectRoot: string, { platform, projectConfig }: {
5
+ platform: string;
6
+ projectConfig?: ProjectConfig;
7
+ }): string | null;
4
8
  export declare function getEntryPoint(projectRoot: string, entryFiles: string[], platforms: string[], projectConfig?: ProjectConfig): string | null;
5
9
  export declare function getEntryPointWithExtensions(projectRoot: string, entryFiles: string[], extensions: string[], projectConfig?: ProjectConfig): string;
6
10
  export declare function resolveFromSilentWithExtensions(fromDirectory: string, moduleId: string, extensions: string[]): string | null;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ensureSlash = ensureSlash;
7
7
  exports.getPossibleProjectRoot = getPossibleProjectRoot;
8
+ exports.resolveEntryPoint = resolveEntryPoint;
8
9
  exports.getEntryPoint = getEntryPoint;
9
10
  exports.getEntryPointWithExtensions = getEntryPointWithExtensions;
10
11
  exports.resolveFromSilentWithExtensions = resolveFromSilentWithExtensions;
@@ -79,8 +80,18 @@ function getPossibleProjectRoot() {
79
80
  return _fs().default.realpathSync(process.cwd());
80
81
  }
81
82
 
83
+ const nativePlatforms = ['ios', 'android'];
84
+
85
+ function resolveEntryPoint(projectRoot, {
86
+ platform,
87
+ projectConfig
88
+ }) {
89
+ const platforms = nativePlatforms.includes(platform) ? [platform, 'native'] : [platform];
90
+ return getEntryPoint(projectRoot, ['./index'], platforms, projectConfig);
91
+ }
92
+
82
93
  function getEntryPoint(projectRoot, entryFiles, platforms, projectConfig) {
83
- const extensions = (0, _extensions().getManagedExtensions)(platforms);
94
+ const extensions = (0, _extensions().getBareExtensions)(platforms);
84
95
  return getEntryPointWithExtensions(projectRoot, entryFiles, extensions, projectConfig);
85
96
  } // Used to resolve the main entry file for a project.
86
97
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/paths/paths.ts"],"names":["ensureSlash","inputPath","needsSlash","hasSlash","endsWith","substr","length","getPossibleProjectRoot","fs","realpathSync","process","cwd","getEntryPoint","projectRoot","entryFiles","platforms","projectConfig","extensions","getEntryPointWithExtensions","exp","pkg","skipSDKVersionRequirement","entryPoint","entry","getFileWithExtensions","resolveFromSilentWithExtensions","main","Error","fileName","fromDirectory","moduleId","extension","modulePath","resolveFrom","silent","path","join","existsSync"],"mappings":";;;;;;;;;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AGD;AACF,C,CAED;;;AACO,SAASF,+BAAT,CACLI,aADK,EAELC,QAFK,EAGLb,UAHK,EAIU;AACf,OAAK,MAAMc,SAAX,IAAwBd,UAAxB,EAAoC;AAClC,UAAMe,UAAU,GAAGC,uBAAYC,MAAZ,CAAmBL,aAAnB,EAAmC,GAAEC,QAAS,IAAGC,SAAU,EAA3D,CAAnB;;AACA,QAAIC,UAAU,IAAIA,UAAU,CAAC5B,QAAX,CAAoB2B,SAApB,CAAlB,EAAkD;AAChD,aAAOC,UAAP;AACD;AACF;;AACD,SAAOC,uBAAYC,MAAZ,CAAmBL,aAAnB,EAAkCC,QAAlC,KAA+C,IAAtD;AACD,C,CAED;AACA;;;AACO,SAASN,qBAAT,CACLK,aADK,EAELC,QAFK,EAGLb,UAHK,EAIU;AACf,QAAMe,UAAU,GAAGG,gBAAKC,IAAL,CAAUP,aAAV,EAAyBC,QAAzB,CAAnB;;AACA,MAAItB,cAAG6B,UAAH,CAAcL,UAAd,CAAJ,EAA+B;AAC7B,WAAOA,UAAP;AACD;;AACD,OAAK,MAAMD,SAAX,IAAwBd,UAAxB,EAAoC;AAClC,UAAMe,UAAU,GAAGG,gBAAKC,IAAL,CAAUP,aAAV,EAA0B,GAAEC,QAAS,IAAGC,SAAU,EAAlD,CAAnB;;AACA,QAAIvB,cAAG6B,UAAH,CAAcL,UAAd,CAAJ,EAA+B;AAC7B,aAAOA,UAAP;AACD;AACF;;AACD,SAAO,IAAP;AACD","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { getConfig } from '../Config';\nimport { ProjectConfig } from '../Config.types';\nimport { getManagedExtensions } from './extensions';\n\n// https://github.com/facebook/create-react-app/blob/9750738cce89a967cc71f28390daf5d4311b193c/packages/react-scripts/config/paths.js#L22\nexport function ensureSlash(inputPath: string, needsSlash: boolean): string {\n const hasSlash = inputPath.endsWith('/');\n if (hasSlash && !needsSlash) {\n return inputPath.substr(0, inputPath.length - 1);\n } else if (!hasSlash && needsSlash) {\n return `${inputPath}/`;\n } else {\n return inputPath;\n }\n}\n\nexport function getPossibleProjectRoot(): string {\n return fs.realpathSync(process.cwd());\n}\n\nexport function getEntryPoint(\n projectRoot: string,\n entryFiles: string[],\n platforms: string[],\n projectConfig?: ProjectConfig\n): string | null {\n const extensions = getManagedExtensions(platforms);\n return getEntryPointWithExtensions(projectRoot, entryFiles, extensions, projectConfig);\n}\n\n// Used to resolve the main entry file for a project.\nexport function getEntryPointWithExtensions(\n projectRoot: string,\n entryFiles: string[],\n extensions: string[],\n projectConfig?: ProjectConfig\n): string {\n const { exp, pkg } = projectConfig ?? getConfig(projectRoot, { skipSDKVersionRequirement: true });\n\n // This will first look in the `app.json`s `expo.entryPoint` field for a potential main file.\n // We check the Expo config first in case you want your project to start differently with Expo then in a standalone environment.\n if (exp && exp.entryPoint && typeof exp.entryPoint === 'string') {\n // If the field exists then we want to test it against every one of the supplied extensions\n // to ensure the bundler resolves the same way.\n let entry = getFileWithExtensions(projectRoot, exp.entryPoint, extensions);\n if (!entry) {\n // Allow for paths like: `{ \"main\": \"expo/AppEntry\" }`\n entry = resolveFromSilentWithExtensions(projectRoot, exp.entryPoint, extensions);\n\n // If it doesn't resolve then just return the entryPoint as-is. This makes\n // it possible for people who have an unconventional setup (eg: multiple\n // apps in monorepo with metro at root) to customize entry point without\n // us imposing our assumptions.\n if (!entry) {\n return exp.entryPoint;\n }\n }\n return entry;\n } else if (pkg) {\n // If the config doesn't define a custom entry then we want to look at the `package.json`s `main` field, and try again.\n const { main } = pkg;\n if (main && typeof main === 'string') {\n // Testing the main field against all of the provided extensions - for legacy reasons we can't use node module resolution as the package.json allows you to pass in a file without a relative path and expect it as a relative path.\n let entry = getFileWithExtensions(projectRoot, main, extensions);\n if (!entry) {\n // Allow for paths like: `{ \"main\": \"expo/AppEntry\" }`\n entry = resolveFromSilentWithExtensions(projectRoot, main, extensions);\n if (!entry)\n throw new Error(\n `Cannot resolve entry file: The \\`main\\` field defined in your \\`package.json\\` points to a non-existent path.`\n );\n }\n return entry;\n }\n }\n\n // Now we will start looking for a default entry point using the provided `entryFiles` argument.\n // This will add support for create-react-app (src/index.js) and react-native-cli (index.js) which don't define a main.\n for (const fileName of entryFiles) {\n const entry = resolveFromSilentWithExtensions(projectRoot, fileName, extensions);\n if (entry) return entry;\n }\n\n try {\n // If none of the default files exist then we will attempt to use the main Expo entry point.\n // This requires `expo` to be installed in the project to work as it will use `node_module/expo/AppEntry.js`\n // Doing this enables us to create a bare minimum Expo project.\n\n // TODO(Bacon): We may want to do a check against `./App` and `expo` in the `package.json` `dependencies` as we can more accurately ensure that the project is expo-min without needing the modules installed.\n return resolveFrom(projectRoot, 'expo/AppEntry');\n } catch {\n throw new Error(\n `The project entry file could not be resolved. Please either define it in the \\`package.json\\` (main), \\`app.json\\` (expo.entryPoint), create an \\`index.js\\`, or install the \\`expo\\` package.`\n );\n }\n}\n\n// Resolve from but with the ability to resolve like a bundler\nexport function resolveFromSilentWithExtensions(\n fromDirectory: string,\n moduleId: string,\n extensions: string[]\n): string | null {\n for (const extension of extensions) {\n const modulePath = resolveFrom.silent(fromDirectory, `${moduleId}.${extension}`);\n if (modulePath && modulePath.endsWith(extension)) {\n return modulePath;\n }\n }\n return resolveFrom.silent(fromDirectory, moduleId) || null;\n}\n\n// Statically attempt to resolve a module but with the ability to resolve like a bundler.\n// This won't use node module resolution.\nexport function getFileWithExtensions(\n fromDirectory: string,\n moduleId: string,\n extensions: string[]\n): string | null {\n const modulePath = path.join(fromDirectory, moduleId);\n if (fs.existsSync(modulePath)) {\n return modulePath;\n }\n for (const extension of extensions) {\n const modulePath = path.join(fromDirectory, `${moduleId}.${extension}`);\n if (fs.existsSync(modulePath)) {\n return modulePath;\n }\n }\n return null;\n}\n"],"file":"paths.js"}
1
+ {"version":3,"sources":["../../src/paths/paths.ts"],"names":["ensureSlash","inputPath","needsSlash","hasSlash","endsWith","substr","length","getPossibleProjectRoot","fs","realpathSync","process","cwd","nativePlatforms","resolveEntryPoint","projectRoot","platform","projectConfig","platforms","includes","getEntryPoint","entryFiles","extensions","getEntryPointWithExtensions","exp","pkg","skipSDKVersionRequirement","entryPoint","entry","getFileWithExtensions","resolveFromSilentWithExtensions","main","Error","fileName","fromDirectory","moduleId","extension","modulePath","resolveFrom","silent","path","join","existsSync"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;;;AAEA;AACO,SAASA,WAAT,CAAqBC,SAArB,EAAwCC,UAAxC,EAAqE;AAC1E,QAAMC,QAAQ,GAAGF,SAAS,CAACG,QAAV,CAAmB,GAAnB,CAAjB;;AACA,MAAID,QAAQ,IAAI,CAACD,UAAjB,EAA6B;AAC3B,WAAOD,SAAS,CAACI,MAAV,CAAiB,CAAjB,EAAoBJ,SAAS,CAACK,MAAV,GAAmB,CAAvC,CAAP;AACD,GAFD,MAEO,IAAI,CAACH,QAAD,IAAaD,UAAjB,EAA6B;AAClC,WAAQ,GAAED,SAAU,GAApB;AACD,GAFM,MAEA;AACL,WAAOA,SAAP;AACD;AACF;;AAEM,SAASM,sBAAT,GAA0C;AAC/C,SAAOC,cAAGC,YAAH,CAAgBC,OAAO,CAACC,GAAR,EAAhB,CAAP;AACD;;AAED,MAAMC,eAAe,GAAG,CAAC,KAAD,EAAQ,SAAR,CAAxB;;AAEO,SAASC,iBAAT,CACLC,WADK,EAEL;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,CAFK,EAGL;AACA,QAAMC,SAAS,GAAGL,eAAe,CAACM,QAAhB,CAAyBH,QAAzB,IAAqC,CAACA,QAAD,EAAW,QAAX,CAArC,GAA4D,CAACA,QAAD,CAA9E;AACA,SA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AP;AACD;;AACD,OAAK,MAAMD,SAAX,IAAwBd,UAAxB,EAAoC;AAClC,UAAMe,UAAU,GAAGG,gBAAKC,IAAL,CAAUP,aAAV,EAA0B,GAAEC,QAAS,IAAGC,SAAU,EAAlD,CAAnB;;AACA,QAAI3B,cAAGiC,UAAH,CAAcL,UAAd,CAAJ,EAA+B;AAC7B,aAAOA,UAAP;AACD;AACF;;AACD,SAAO,IAAP;AACD","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { getConfig } from '../Config';\nimport { ProjectConfig } from '../Config.types';\nimport { getBareExtensions } from './extensions';\n\n// https://github.com/facebook/create-react-app/blob/9750738cce89a967cc71f28390daf5d4311b193c/packages/react-scripts/config/paths.js#L22\nexport function ensureSlash(inputPath: string, needsSlash: boolean): string {\n const hasSlash = inputPath.endsWith('/');\n if (hasSlash && !needsSlash) {\n return inputPath.substr(0, inputPath.length - 1);\n } else if (!hasSlash && needsSlash) {\n return `${inputPath}/`;\n } else {\n return inputPath;\n }\n}\n\nexport function getPossibleProjectRoot(): string {\n return fs.realpathSync(process.cwd());\n}\n\nconst nativePlatforms = ['ios', 'android'];\n\nexport function resolveEntryPoint(\n projectRoot: string,\n { platform, projectConfig }: { platform: string; projectConfig?: ProjectConfig }\n) {\n const platforms = nativePlatforms.includes(platform) ? [platform, 'native'] : [platform];\n return getEntryPoint(projectRoot, ['./index'], platforms, projectConfig);\n}\n\nexport function getEntryPoint(\n projectRoot: string,\n entryFiles: string[],\n platforms: string[],\n projectConfig?: ProjectConfig\n): string | null {\n const extensions = getBareExtensions(platforms);\n return getEntryPointWithExtensions(projectRoot, entryFiles, extensions, projectConfig);\n}\n\n// Used to resolve the main entry file for a project.\nexport function getEntryPointWithExtensions(\n projectRoot: string,\n entryFiles: string[],\n extensions: string[],\n projectConfig?: ProjectConfig\n): string {\n const { exp, pkg } = projectConfig ?? getConfig(projectRoot, { skipSDKVersionRequirement: true });\n\n // This will first look in the `app.json`s `expo.entryPoint` field for a potential main file.\n // We check the Expo config first in case you want your project to start differently with Expo then in a standalone environment.\n if (exp && exp.entryPoint && typeof exp.entryPoint === 'string') {\n // If the field exists then we want to test it against every one of the supplied extensions\n // to ensure the bundler resolves the same way.\n let entry = getFileWithExtensions(projectRoot, exp.entryPoint, extensions);\n if (!entry) {\n // Allow for paths like: `{ \"main\": \"expo/AppEntry\" }`\n entry = resolveFromSilentWithExtensions(projectRoot, exp.entryPoint, extensions);\n\n // If it doesn't resolve then just return the entryPoint as-is. This makes\n // it possible for people who have an unconventional setup (eg: multiple\n // apps in monorepo with metro at root) to customize entry point without\n // us imposing our assumptions.\n if (!entry) {\n return exp.entryPoint;\n }\n }\n return entry;\n } else if (pkg) {\n // If the config doesn't define a custom entry then we want to look at the `package.json`s `main` field, and try again.\n const { main } = pkg;\n if (main && typeof main === 'string') {\n // Testing the main field against all of the provided extensions - for legacy reasons we can't use node module resolution as the package.json allows you to pass in a file without a relative path and expect it as a relative path.\n let entry = getFileWithExtensions(projectRoot, main, extensions);\n if (!entry) {\n // Allow for paths like: `{ \"main\": \"expo/AppEntry\" }`\n entry = resolveFromSilentWithExtensions(projectRoot, main, extensions);\n if (!entry)\n throw new Error(\n `Cannot resolve entry file: The \\`main\\` field defined in your \\`package.json\\` points to a non-existent path.`\n );\n }\n return entry;\n }\n }\n\n // Now we will start looking for a default entry point using the provided `entryFiles` argument.\n // This will add support for create-react-app (src/index.js) and react-native-cli (index.js) which don't define a main.\n for (const fileName of entryFiles) {\n const entry = resolveFromSilentWithExtensions(projectRoot, fileName, extensions);\n if (entry) return entry;\n }\n\n try {\n // If none of the default files exist then we will attempt to use the main Expo entry point.\n // This requires `expo` to be installed in the project to work as it will use `node_module/expo/AppEntry.js`\n // Doing this enables us to create a bare minimum Expo project.\n\n // TODO(Bacon): We may want to do a check against `./App` and `expo` in the `package.json` `dependencies` as we can more accurately ensure that the project is expo-min without needing the modules installed.\n return resolveFrom(projectRoot, 'expo/AppEntry');\n } catch {\n throw new Error(\n `The project entry file could not be resolved. Please either define it in the \\`package.json\\` (main), \\`app.json\\` (expo.entryPoint), create an \\`index.js\\`, or install the \\`expo\\` package.`\n );\n }\n}\n\n// Resolve from but with the ability to resolve like a bundler\nexport function resolveFromSilentWithExtensions(\n fromDirectory: string,\n moduleId: string,\n extensions: string[]\n): string | null {\n for (const extension of extensions) {\n const modulePath = resolveFrom.silent(fromDirectory, `${moduleId}.${extension}`);\n if (modulePath && modulePath.endsWith(extension)) {\n return modulePath;\n }\n }\n return resolveFrom.silent(fromDirectory, moduleId) || null;\n}\n\n// Statically attempt to resolve a module but with the ability to resolve like a bundler.\n// This won't use node module resolution.\nexport function getFileWithExtensions(\n fromDirectory: string,\n moduleId: string,\n extensions: string[]\n): string | null {\n const modulePath = path.join(fromDirectory, moduleId);\n if (fs.existsSync(modulePath)) {\n return modulePath;\n }\n for (const extension of extensions) {\n const modulePath = path.join(fromDirectory, `${moduleId}.${extension}`);\n if (fs.existsSync(modulePath)) {\n return modulePath;\n }\n }\n return null;\n}\n"],"file":"paths.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/config",
3
- "version": "5.0.7",
3
+ "version": "6.0.2",
4
4
  "description": "A library for interacting with the app.json",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -33,8 +33,8 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@babel/code-frame": "~7.10.4",
36
- "@expo/config-plugins": "3.0.7",
37
- "@expo/config-types": "^42.0.0",
36
+ "@expo/config-plugins": "4.0.2",
37
+ "@expo/config-types": "^43.0.0",
38
38
  "@expo/json-file": "8.2.33",
39
39
  "getenv": "^1.0.0",
40
40
  "glob": "7.1.6",