@expo/config 8.3.1 → 8.5.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/Config.js CHANGED
@@ -191,7 +191,7 @@ function getConfig(projectRoot, options = {}) {
191
191
 
192
192
  // Can only change the package.json location if an app.json or app.config.json exists
193
193
  const [packageJson, packageJsonPath] = getPackageJsonAndPath(projectRoot);
194
- function fillAndReturnConfig(config, dynamicConfigObjectType) {
194
+ function fillAndReturnConfig(config, dynamicConfigObjectType, mayHaveUnusedStaticConfig = false) {
195
195
  const configWithDefaultValues = {
196
196
  ...ensureConfigHasDefaultValues({
197
197
  projectRoot,
@@ -205,7 +205,8 @@ function getConfig(projectRoot, options = {}) {
205
205
  dynamicConfigObjectType,
206
206
  rootConfig,
207
207
  dynamicConfigPath: paths.dynamicConfigPath,
208
- staticConfigPath: paths.staticConfigPath
208
+ staticConfigPath: paths.staticConfigPath,
209
+ hasUnusedStaticConfig: !!paths.staticConfigPath && !!paths.dynamicConfigPath && mayHaveUnusedStaticConfig
209
210
  };
210
211
  if (options.isModdedConfig) {
211
212
  var _config$mods;
@@ -255,7 +256,8 @@ function getConfig(projectRoot, options = {}) {
255
256
  // No app.config.json or app.json but app.config.js
256
257
  const {
257
258
  exportedObjectType,
258
- config: rawDynamicConfig
259
+ config: rawDynamicConfig,
260
+ mayHaveUnusedStaticConfig
259
261
  } = (0, _getConfig().getDynamicConfig)(paths.dynamicConfigPath, {
260
262
  projectRoot,
261
263
  staticConfigPath: paths.staticConfigPath,
@@ -265,7 +267,7 @@ function getConfig(projectRoot, options = {}) {
265
267
  // Allow for the app.config.js to `export default null;`
266
268
  // Use `dynamicConfigPath` to detect if a dynamic config exists.
267
269
  const dynamicConfig = reduceExpoObject(rawDynamicConfig) || {};
268
- return fillAndReturnConfig(dynamicConfig, exportedObjectType);
270
+ return fillAndReturnConfig(dynamicConfig, exportedObjectType, mayHaveUnusedStaticConfig);
269
271
  }
270
272
 
271
273
  // No app.config.js but json or no config
@@ -1 +1 @@
1
- {"version":3,"file":"Config.js","names":["_jsonFile","data","_interopRequireDefault","require","_fs","_glob","_path","_resolveFrom","_semver","_slugify","_getConfig","_getExpoSDKVersion","_withConfigPlugins","_withInternal","_resolvePackageJson","_Config","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","obj","__esModule","default","reduceExpoObject","config","_config$expo","undefined","mods","expo","getSupportedPlatforms","projectRoot","platforms","resolveFrom","silent","push","getConfig","options","paths","getConfigFilePaths","rawStaticConfig","staticConfigPath","getStaticConfig","rootConfig","staticConfig","packageJson","packageJsonPath","getPackageJsonAndPath","fillAndReturnConfig","dynamicConfigObjectType","configWithDefaultValues","ensureConfigHasDefaultValues","exp","pkg","skipSDKVersionRequirement","dynamicConfigPath","isModdedConfig","_config$mods","withConfigPlugins","skipPlugins","isPublicConfig","_configWithDefaultVal","_configWithDefaultVal2","_configWithDefaultVal3","_configWithDefaultVal4","_internal","hooks","ios","android","updates","codeSigningCertificate","codeSigningMetadata","getContextConfig","exportedObjectType","rawDynamicConfig","getDynamicConfig","dynamicConfig","getPackageJson","getRootPackageJsonPath","JsonFile","read","getDynamicConfigFilePath","getStaticConfigFilePath","fileName","configPath","path","join","fs","existsSync","modifyConfigAsync","modifications","readOptions","writeOptions","type","message","relative","outputConfig","dryRun","writeAsync","json5","_exp$name","_exp$slug","_exp$version","withInternal","pkgName","name","basename","pkgVersion","version","pkgWithDefaults","slug","slugify","toLowerCase","description","expWithDefaults","sdkVersion","getExpoSDKVersion","error","DEFAULT_BUILD_PATH","getWebOutputPath","_expo$web","_expo$web$build","process","env","WEBPACK_BUILD_OUTPUT_PATH","web","build","output","getNameFromConfig","appManifest","appName","displayName","webName","getDefaultTarget","_exp","semver","lt","isBareWorkflowProject","dependencies","expokit","xcodeprojFiles","globSync","absolute","cwd","length","gradleFiles","getProjectConfigDescription","getProjectConfigDescriptionWithPaths","projectConfig","relativeDynamicConfigPath"],"sources":["../src/Config.ts"],"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 GetConfigOptions,\n PackageJSONConfig,\n Platform,\n ProjectConfig,\n ProjectTarget,\n WriteConfigOptions,\n} from './Config.types';\nimport { getDynamicConfig, getStaticConfig } from './getConfig';\nimport { getExpoSDKVersion } from './getExpoSDKVersion';\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 // TODD(EvanBacon): Drop plugins array after it's been resolved.\n\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 delete configWithDefaultValues.exp.updates?.codeSigningCertificate;\n delete configWithDefaultValues.exp.updates?.codeSigningMetadata;\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\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 return {\n dynamicConfigPath: getDynamicConfigFilePath(projectRoot),\n staticConfigPath: getStaticConfigFilePath(projectRoot),\n };\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/**\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\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\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(exp: Record<string, any> = {}): {\n appName?: string;\n webName?: string;\n} {\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 // TODO: Drop this\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 * 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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,IAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,GAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,aAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,YAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,SAAA;EAAA,MAAAR,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAM,QAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAaA,SAAAS,WAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,UAAA,YAAAA,CAAA;IAAA,OAAAT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AAQ,EAAC,qBAAqB,EAAE;IAClDC,QAAQ,EAAE,IAAI;IACdC,GAAG,EAAEhH;EACP,CAAC,CAAC;EACF,IAAIkH,WAAW,CAACD,MAAM,EAAE;IACtB,OAAO,IAAI;EACb;EAEA,OAAO,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,2BAA2BA,CAACnH,WAAmB,EAAU;EACvE,MAAMO,KAAK,GAAGC,kBAAkB,CAACR,WAAW,CAAC;EAC7C,OAAOoH,oCAAoC,CAACpH,WAAW,EAAEO,KAAK,CAAC;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS6G,oCAAoCA,CAClDpH,WAAmB,EACnBqH,aAA8B,EACtB;EACR,IAAIA,aAAa,CAAC7F,iBAAiB,EAAE;IACnC,MAAM8F,yBAAyB,GAAGhE,eAAI,CAACU,QAAQ,CAAChE,WAAW,EAAEqH,aAAa,CAAC7F,iBAAiB,CAAC;IAC7F,IAAI6F,aAAa,CAAC3G,gBAAgB,EAAE;MAClC,OAAQ,GAAE4G,yBAA0B,OAAMhE,eAAI,CAACU,QAAQ,CACrDhE,WAAW,EACXqH,aAAa,CAAC3G,gBAAgB,CAC9B,EAAC;IACL;IACA,OAAO4G,yBAAyB;EAClC,CAAC,MAAM,IAAID,aAAa,CAAC3G,gBAAgB,EAAE;IACzC,OAAO4C,eAAI,CAACU,QAAQ,CAAChE,WAAW,EAAEqH,aAAa,CAAC3G,gBAAgB,CAAC;EACnE;EACA;EACA,OAAO,UAAU;AACnB"}
1
+ {"version":3,"file":"Config.js","names":["_jsonFile","data","_interopRequireDefault","require","_fs","_glob","_path","_resolveFrom","_semver","_slugify","_getConfig","_getExpoSDKVersion","_withConfigPlugins","_withInternal","_resolvePackageJson","_Config","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","obj","__esModule","default","reduceExpoObject","config","_config$expo","undefined","mods","expo","getSupportedPlatforms","projectRoot","platforms","resolveFrom","silent","push","getConfig","options","paths","getConfigFilePaths","rawStaticConfig","staticConfigPath","getStaticConfig","rootConfig","staticConfig","packageJson","packageJsonPath","getPackageJsonAndPath","fillAndReturnConfig","dynamicConfigObjectType","mayHaveUnusedStaticConfig","configWithDefaultValues","ensureConfigHasDefaultValues","exp","pkg","skipSDKVersionRequirement","dynamicConfigPath","hasUnusedStaticConfig","isModdedConfig","_config$mods","withConfigPlugins","skipPlugins","isPublicConfig","_configWithDefaultVal","_configWithDefaultVal2","_configWithDefaultVal3","_configWithDefaultVal4","_internal","hooks","ios","android","updates","codeSigningCertificate","codeSigningMetadata","getContextConfig","exportedObjectType","rawDynamicConfig","getDynamicConfig","dynamicConfig","getPackageJson","getRootPackageJsonPath","JsonFile","read","getDynamicConfigFilePath","getStaticConfigFilePath","fileName","configPath","path","join","fs","existsSync","modifyConfigAsync","modifications","readOptions","writeOptions","type","message","relative","outputConfig","dryRun","writeAsync","json5","_exp$name","_exp$slug","_exp$version","withInternal","pkgName","name","basename","pkgVersion","version","pkgWithDefaults","slug","slugify","toLowerCase","description","expWithDefaults","sdkVersion","getExpoSDKVersion","error","DEFAULT_BUILD_PATH","getWebOutputPath","_expo$web","_expo$web$build","process","env","WEBPACK_BUILD_OUTPUT_PATH","web","build","output","getNameFromConfig","appManifest","appName","displayName","webName","getDefaultTarget","_exp","semver","lt","isBareWorkflowProject","dependencies","expokit","xcodeprojFiles","globSync","absolute","cwd","length","gradleFiles","getProjectConfigDescription","getProjectConfigDescriptionWithPaths","projectConfig","relativeDynamicConfigPath"],"sources":["../src/Config.ts"],"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 GetConfigOptions,\n PackageJSONConfig,\n Platform,\n ProjectConfig,\n ProjectTarget,\n WriteConfigOptions,\n} from './Config.types';\nimport { getDynamicConfig, getStaticConfig } from './getConfig';\nimport { getExpoSDKVersion } from './getExpoSDKVersion';\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(\n config: SplitConfigs,\n dynamicConfigObjectType: string | null,\n mayHaveUnusedStaticConfig: boolean = false\n ) {\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 hasUnusedStaticConfig:\n !!paths.staticConfigPath && !!paths.dynamicConfigPath && mayHaveUnusedStaticConfig,\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 // TODD(EvanBacon): Drop plugins array after it's been resolved.\n\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 delete configWithDefaultValues.exp.updates?.codeSigningCertificate;\n delete configWithDefaultValues.exp.updates?.codeSigningMetadata;\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 {\n exportedObjectType,\n config: rawDynamicConfig,\n mayHaveUnusedStaticConfig,\n } = getDynamicConfig(paths.dynamicConfigPath, {\n projectRoot,\n staticConfigPath: paths.staticConfigPath,\n packageJsonPath,\n config: getContextConfig(staticConfig),\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, mayHaveUnusedStaticConfig);\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\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 return {\n dynamicConfigPath: getDynamicConfigFilePath(projectRoot),\n staticConfigPath: getStaticConfigFilePath(projectRoot),\n };\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/**\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\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\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(exp: Record<string, any> = {}): {\n appName?: string;\n webName?: string;\n} {\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 // TODO: Drop this\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 * 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 './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zB,OAAO,IAAI;EACb;EACA,MAAMC,WAAW,GAAG,IAAAJ,YAAQ,EAAC,qBAAqB,EAAE;IAClDC,QAAQ,EAAE,IAAI;IACdC,GAAG,EAAElH;EACP,CAAC,CAAC;EACF,IAAIoH,WAAW,CAACD,MAAM,EAAE;IACtB,OAAO,IAAI;EACb;EAEA,OAAO,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,2BAA2BA,CAACrH,WAAmB,EAAU;EACvE,MAAMO,KAAK,GAAGC,kBAAkB,CAACR,WAAW,CAAC;EAC7C,OAAOsH,oCAAoC,CAACtH,WAAW,EAAEO,KAAK,CAAC;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS+G,oCAAoCA,CAClDtH,WAAmB,EACnBuH,aAA8B,EACtB;EACR,IAAIA,aAAa,CAAC9F,iBAAiB,EAAE;IACnC,MAAM+F,yBAAyB,GAAGhE,eAAI,CAACU,QAAQ,CAAClE,WAAW,EAAEuH,aAAa,CAAC9F,iBAAiB,CAAC;IAC7F,IAAI8F,aAAa,CAAC7G,gBAAgB,EAAE;MAClC,OAAQ,GAAE8G,yBAA0B,OAAMhE,eAAI,CAACU,QAAQ,CACrDlE,WAAW,EACXuH,aAAa,CAAC7G,gBAAgB,CAC9B,EAAC;IACL;IACA,OAAO8G,yBAAyB;EAClC,CAAC,MAAM,IAAID,aAAa,CAAC7G,gBAAgB,EAAE;IACzC,OAAO8C,eAAI,CAACU,QAAQ,CAAClE,WAAW,EAAEuH,aAAa,CAAC7G,gBAAgB,CAAC;EACnE;EACA;EACA,OAAO,UAAU;AACnB"}
@@ -41,6 +41,18 @@ export interface ProjectConfig {
41
41
  * Returns null if no dynamic config file exists.
42
42
  */
43
43
  dynamicConfigObjectType: string | null;
44
+ /**
45
+ * Returns true if both a static and dynamic config are present, and the dynamic config is applied on top of the static.
46
+ * This is only used for expo-doctor diagnostic warnings. This flag may be true even in cases where all static config values are used.
47
+ * It only checks against a typical pattern for layering static and dynamic config, e.g.,:
48
+ * module.exports = ({ config }) => {
49
+ return {
50
+ ...config,
51
+ name: 'name overridden by dynamic config',
52
+ };
53
+ };
54
+ */
55
+ hasUnusedStaticConfig: boolean;
44
56
  }
45
57
  export type AppJSONConfig = {
46
58
  expo: ExpoConfig;
@@ -120,7 +132,7 @@ export declare enum ProjectPrivacy {
120
132
  }
121
133
  export type Platform = 'android' | 'ios' | 'web';
122
134
  export type ProjectTarget = 'managed' | 'bare';
123
- export type ConfigErrorCode = 'NO_APP_JSON' | 'NOT_OBJECT' | 'NO_EXPO' | 'MODULE_NOT_FOUND' | 'DEPRECATED' | 'INVALID_MODE' | 'INVALID_FORMAT' | 'INVALID_PLUGIN' | 'INVALID_CONFIG';
135
+ export type ConfigErrorCode = 'NO_APP_JSON' | 'NOT_OBJECT' | 'NO_EXPO' | 'MODULE_NOT_FOUND' | 'DEPRECATED' | 'INVALID_MODE' | 'INVALID_FORMAT' | 'INVALID_PLUGIN' | 'INVALID_CONFIG' | 'ENTRY_NOT_FOUND';
124
136
  export type ConfigContext = {
125
137
  projectRoot: string;
126
138
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Config.types.js","names":["_configTypes","data","require","ProjectPrivacy","exports"],"sources":["../src/Config.types.ts"],"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 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 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?: ExpoConfig & {\n /**\n * Only present during development using @expo/cli.\n */\n hostUri?: string;\n };\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 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 | 'DEPRECATED'\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"],"mappings":";;;;;;;;;;;;AACA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,YAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAgD,IAuHpCE,cAAc;AAAAC,OAAA,CAAAD,cAAA,GAAAA,cAAA;AAAA,WAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;AAAA,GAAdA,cAAc,KAAAC,OAAA,CAAAD,cAAA,GAAdA,cAAc"}
1
+ {"version":3,"file":"Config.types.js","names":["_configTypes","data","require","ProjectPrivacy","exports"],"sources":["../src/Config.types.ts"],"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 /**\n * Returns true if both a static and dynamic config are present, and the dynamic config is applied on top of the static.\n * This is only used for expo-doctor diagnostic warnings. This flag may be true even in cases where all static config values are used.\n * It only checks against a typical pattern for layering static and dynamic config, e.g.,:\n * module.exports = ({ config }) => {\n return {\n ...config,\n name: 'name overridden by dynamic config',\n };\n };\n */\n hasUnusedStaticConfig: boolean;\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 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 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?: ExpoConfig & {\n /**\n * Only present during development using @expo/cli.\n */\n hostUri?: string;\n };\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 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 | 'DEPRECATED'\n | 'INVALID_MODE'\n | 'INVALID_FORMAT'\n | 'INVALID_PLUGIN'\n | 'INVALID_CONFIG'\n | 'ENTRY_NOT_FOUND';\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"],"mappings":";;;;;;;;;;;;AACA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,YAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAgD,IAmIpCE,cAAc;AAAAC,OAAA,CAAAD,cAAA,GAAAA,cAAA;AAAA,WAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;AAAA,GAAdA,cAAc,KAAAC,OAAA,CAAAD,cAAA,GAAdA,cAAc"}
package/build/Errors.js CHANGED
@@ -4,19 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ConfigError = void 0;
7
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
9
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
7
  /**
11
8
  * Based on `JsonFileError` from `@expo/json-file`
12
9
  */
13
10
  class ConfigError extends Error {
11
+ name = 'ConfigError';
12
+ isConfigError = true;
14
13
  constructor(message, code, cause) {
15
14
  super(cause ? `${message}\n└─ Cause: ${cause.name}: ${cause.message}` : message);
16
15
  this.code = code;
17
16
  this.cause = cause;
18
- _defineProperty(this, "name", 'ConfigError');
19
- _defineProperty(this, "isConfigError", true);
20
17
  }
21
18
  }
22
19
  exports.ConfigError = ConfigError;
@@ -1 +1 @@
1
- {"version":3,"file":"Errors.js","names":["ConfigError","Error","constructor","message","code","cause","name","_defineProperty","exports"],"sources":["../src/Errors.ts"],"sourcesContent":["import { ConfigErrorCode } from './Config.types';\n\n/**\n * Based on `JsonFileError` from `@expo/json-file`\n */\nexport class ConfigError extends Error {\n readonly name = 'ConfigError';\n readonly isConfigError = true;\n\n constructor(\n message: string,\n public code: ConfigErrorCode,\n public cause?: Error\n ) {\n super(cause ? `${message}\\n└─ Cause: ${cause.name}: ${cause.message}` : message);\n }\n}\n"],"mappings":";;;;;;;;;AAEA;AACA;AACA;AACO,MAAMA,WAAW,SAASC,KAAK,CAAC;EAIrCC,WAAWA,CACTC,OAAe,EACRC,IAAqB,EACrBC,KAAa,EACpB;IACA,KAAK,CAACA,KAAK,GAAI,GAAEF,OAAQ,eAAcE,KAAK,CAACC,IAAK,KAAID,KAAK,CAACF,OAAQ,EAAC,GAAGA,OAAO,CAAC;IAAC,KAH1EC,IAAqB,GAArBA,IAAqB;IAAA,KACrBC,KAAa,GAAbA,KAAa;IAAAE,eAAA,eANN,aAAa;IAAAA,eAAA,wBACJ,IAAI;EAQ7B;AACF;AAACC,OAAA,CAAAR,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"file":"Errors.js","names":["ConfigError","Error","name","isConfigError","constructor","message","code","cause","exports"],"sources":["../src/Errors.ts"],"sourcesContent":["import { ConfigErrorCode } from './Config.types';\n\n/**\n * Based on `JsonFileError` from `@expo/json-file`\n */\nexport class ConfigError extends Error {\n readonly name = 'ConfigError';\n readonly isConfigError = true;\n\n constructor(\n message: string,\n public code: ConfigErrorCode,\n public cause?: Error\n ) {\n super(cause ? `${message}\\n└─ Cause: ${cause.name}: ${cause.message}` : message);\n }\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACO,MAAMA,WAAW,SAASC,KAAK,CAAC;EAC5BC,IAAI,GAAG,aAAa;EACpBC,aAAa,GAAG,IAAI;EAE7BC,WAAWA,CACTC,OAAe,EACRC,IAAqB,EACrBC,KAAa,EACpB;IACA,KAAK,CAACA,KAAK,GAAI,GAAEF,OAAQ,eAAcE,KAAK,CAACL,IAAK,KAAIK,KAAK,CAACF,OAAQ,EAAC,GAAGA,OAAO,CAAC;IAAC,KAH1EC,IAAqB,GAArBA,IAAqB;IAAA,KACrBC,KAAa,GAAbA,KAAa;EAGtB;AACF;AAACC,OAAA,CAAAR,WAAA,GAAAA,WAAA"}
@@ -54,8 +54,7 @@ function serializeAndEvaluatePlugin(val) {
54
54
  if (['undefined', 'string', 'boolean', 'number', 'bigint'].includes(typeof val)) {
55
55
  return val;
56
56
  } else if (typeof val === 'function') {
57
- var _val$name;
58
- return (_val$name = val.name) !== null && _val$name !== void 0 ? _val$name : 'withAnonymous';
57
+ return val.name || 'withAnonymous';
59
58
  } else if (Array.isArray(val)) {
60
59
  return val.map(serializeAndEvaluatePlugin);
61
60
  } else if (typeof val === 'object') {
@@ -1 +1 @@
1
- {"version":3,"file":"Serialize.js","names":["_Errors","data","require","serializeAndEvaluate","val","includes","Array","isArray","map","output","property","hasOwnProperty","ConfigError","serializeSkippingMods","serializeAndEvaluatePlugin","_val$name","name","serializeAfterStaticPlugins"],"sources":["../src/Serialize.ts"],"sourcesContent":["import { ConfigError } from './Errors';\n\nexport function serializeAndEvaluate(val: any): any {\n if (['undefined', 'string', 'boolean', 'number', 'bigint'].includes(typeof val)) {\n return val;\n } else if (typeof val === 'function') {\n // TODO: Bacon: Should we support async methods?\n return val();\n } else if (Array.isArray(val)) {\n return val.map(serializeAndEvaluate);\n } else if (typeof val === 'object') {\n const output: { [key: string]: any } = {};\n for (const property in val) {\n if (val.hasOwnProperty(property)) {\n output[property] = serializeAndEvaluate(val[property]);\n }\n }\n return output;\n }\n // symbol\n throw new ConfigError(`Expo config doesn't support \\`Symbols\\`: ${val}`, 'INVALID_CONFIG');\n}\n\nexport function serializeSkippingMods(val: any): any {\n if (typeof val === 'object' && !Array.isArray(val)) {\n const output: { [key: string]: any } = {};\n for (const property in val) {\n if (val.hasOwnProperty(property)) {\n if (property === 'mods' || property === 'plugins') {\n // Don't serialize mods or plugins\n output[property] = val[property];\n } else {\n output[property] = serializeAndEvaluate(val[property]);\n }\n }\n }\n return output;\n }\n return serializeAndEvaluate(val);\n}\n\nfunction serializeAndEvaluatePlugin(val: any): any {\n if (['undefined', 'string', 'boolean', 'number', 'bigint'].includes(typeof val)) {\n return val;\n } else if (typeof val === 'function') {\n return val.name ?? 'withAnonymous';\n } else if (Array.isArray(val)) {\n return val.map(serializeAndEvaluatePlugin);\n } else if (typeof val === 'object') {\n const output: { [key: string]: any } = {};\n for (const property in val) {\n if (val.hasOwnProperty(property)) {\n output[property] = serializeAndEvaluatePlugin(val[property]);\n }\n }\n return output;\n }\n // symbol\n throw new ConfigError(`Expo config doesn't support \\`Symbols\\`: ${val}`, 'INVALID_CONFIG');\n}\n\nexport function serializeAfterStaticPlugins(val: any): any {\n if (typeof val === 'object' && !Array.isArray(val)) {\n const output: { [key: string]: any } = {};\n for (const property in val) {\n if (val.hasOwnProperty(property)) {\n if (property === 'mods') {\n // Don't serialize mods\n output[property] = val[property];\n } else if (property === 'plugins' && Array.isArray(val[property])) {\n // Serialize the mods by removing any config plugins\n output[property] = val[property].map(serializeAndEvaluatePlugin);\n } else {\n output[property] = serializeAndEvaluate(val[property]);\n }\n }\n }\n return output;\n }\n return serializeAndEvaluate(val);\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,SAASE,oBAAoBA,CAACC,GAAQ,EAAO;EAClD,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAACC,QAAQ,CAAC,OAAOD,GAAG,CAAC,EAAE;IAC/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,CAAC;QAClC,CAAC,MAAM,IAAIA,QAAQ,KAAK,SAAS,IAAIJ,KAAK,CAACC,OAAO,CAACH,GAAG,CAACM,QAAQ,CAAC,CAAC,EAAE;UACjE;UACAD,MAAM,CAACC,QAAQ,CAAC,GAAGN,GAAG,CAACM,QAAQ,CAAC,CAACF,GAAG,CAACM,0BAA0B,CAAC;QAClE,CAAC,MAAM;UACLL,MAAM,CAACC,QAAQ,CAAC,GAAGP,oBAAoB,CAACC,GAAG,CAACM,QAAQ,CAAC,CAAC;QACxD;MACF;IACF;IACA,OAAOD,MAAM;EACf;EACA,OAAON,oBAAoB,CAACC,GAAG,CAAC;AAClC"}
1
+ {"version":3,"file":"Serialize.js","names":["_Errors","data","require","serializeAndEvaluate","val","includes","Array","isArray","map","output","property","hasOwnProperty","ConfigError","serializeSkippingMods","serializeAndEvaluatePlugin","name","serializeAfterStaticPlugins"],"sources":["../src/Serialize.ts"],"sourcesContent":["import { ConfigError } from './Errors';\n\nexport function serializeAndEvaluate(val: any): any {\n if (['undefined', 'string', 'boolean', 'number', 'bigint'].includes(typeof val)) {\n return val;\n } else if (typeof val === 'function') {\n // TODO: Bacon: Should we support async methods?\n return val();\n } else if (Array.isArray(val)) {\n return val.map(serializeAndEvaluate);\n } else if (typeof val === 'object') {\n const output: { [key: string]: any } = {};\n for (const property in val) {\n if (val.hasOwnProperty(property)) {\n output[property] = serializeAndEvaluate(val[property]);\n }\n }\n return output;\n }\n // symbol\n throw new ConfigError(`Expo config doesn't support \\`Symbols\\`: ${val}`, 'INVALID_CONFIG');\n}\n\nexport function serializeSkippingMods(val: any): any {\n if (typeof val === 'object' && !Array.isArray(val)) {\n const output: { [key: string]: any } = {};\n for (const property in val) {\n if (val.hasOwnProperty(property)) {\n if (property === 'mods' || property === 'plugins') {\n // Don't serialize mods or plugins\n output[property] = val[property];\n } else {\n output[property] = serializeAndEvaluate(val[property]);\n }\n }\n }\n return output;\n }\n return serializeAndEvaluate(val);\n}\n\nfunction serializeAndEvaluatePlugin(val: any): any {\n if (['undefined', 'string', 'boolean', 'number', 'bigint'].includes(typeof val)) {\n return val;\n } else if (typeof val === 'function') {\n return val.name || 'withAnonymous';\n } else if (Array.isArray(val)) {\n return val.map(serializeAndEvaluatePlugin);\n } else if (typeof val === 'object') {\n const output: { [key: string]: any } = {};\n for (const property in val) {\n if (val.hasOwnProperty(property)) {\n output[property] = serializeAndEvaluatePlugin(val[property]);\n }\n }\n return output;\n }\n // symbol\n throw new ConfigError(`Expo config doesn't support \\`Symbols\\`: ${val}`, 'INVALID_CONFIG');\n}\n\nexport function serializeAfterStaticPlugins(val: any): any {\n if (typeof val === 'object' && !Array.isArray(val)) {\n const output: { [key: string]: any } = {};\n for (const property in val) {\n if (val.hasOwnProperty(property)) {\n if (property === 'mods') {\n // Don't serialize mods\n output[property] = val[property];\n } else if (property === 'plugins' && Array.isArray(val[property])) {\n // Serialize the mods by removing any config plugins\n output[property] = val[property].map(serializeAndEvaluatePlugin);\n } else {\n output[property] = serializeAndEvaluate(val[property]);\n }\n }\n }\n return output;\n }\n return serializeAndEvaluate(val);\n}\n"],"mappings":";;;;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,SAASE,oBAAoBA,CAACC,GAAQ,EAAO;EAClD,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAACC,QAAQ,CAAC,OAAOD,GAAG,CAAC,EAAE;IAC/E,OAAOA,GAAG;EACZ,CAAC,MAAM,IAAI,OAAOA,GAAG,KAAK,UAAU,EAAE;IACpC;IACA,OAAOA,GAAG,EAAE;EACd,CAAC,MAAM,IAAIE,KAAK,CAACC,OAAO,CAACH,GAAG,CAAC,EAAE;IAC7B,OAAOA,GAAG,CAACI,GAAG,CAACL,oBAAoB,CAAC;EACtC,CAAC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,CAACC,GAAG,CAACM,QAAQ,CAAC,CAAC;QACxD;MACF;IACF;IACA,OAAOD,MAAM;EACf;EACA,OAAON,oBAAoB,CAACC,GAAG,CAAC;AAClC"}
@@ -0,0 +1 @@
1
+ export declare const NON_STANDARD_SYMBOL: unique symbol;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NON_STANDARD_SYMBOL = void 0;
7
+ const NON_STANDARD_SYMBOL = Symbol('non-standard');
8
+ exports.NON_STANDARD_SYMBOL = NON_STANDARD_SYMBOL;
9
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.js","names":["NON_STANDARD_SYMBOL","Symbol","exports"],"sources":["../src/environment.ts"],"sourcesContent":["export const NON_STANDARD_SYMBOL = Symbol('non-standard');\n"],"mappings":";;;;;;AAAO,MAAMA,mBAAmB,GAAGC,MAAM,CAAC,cAAc,CAAC;AAACC,OAAA,CAAAF,mBAAA,GAAAA,mBAAA"}
@@ -3,6 +3,7 @@ type RawDynamicConfig = AppJSONConfig | Partial<ExpoConfig> | null;
3
3
  export type DynamicConfigResults = {
4
4
  config: RawDynamicConfig;
5
5
  exportedObjectType: string;
6
+ mayHaveUnusedStaticConfig: boolean;
6
7
  };
7
8
  /**
8
9
  * Transpile and evaluate the dynamic config object.
@@ -25,5 +26,6 @@ export declare function evalConfig(configFile: string, request: ConfigContext |
25
26
  export declare function resolveConfigExport(result: any, configFile: string, request: ConfigContext | null): {
26
27
  config: any;
27
28
  exportedObjectType: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
29
+ mayHaveUnusedStaticConfig: any;
28
30
  };
29
31
  export {};
@@ -40,6 +40,13 @@ function _Serialize() {
40
40
  };
41
41
  return data;
42
42
  }
43
+ function _environment() {
44
+ const data = require("./environment");
45
+ _environment = function () {
46
+ return data;
47
+ };
48
+ return data;
49
+ }
43
50
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
44
51
  /**
45
52
  * Transpile and evaluate the dynamic config object.
@@ -131,7 +138,14 @@ function isSyntaxError(error) {
131
138
  * @param request
132
139
  */
133
140
  function resolveConfigExport(result, configFile, request) {
134
- var _result;
141
+ var _request$config, _result, _result2;
142
+ // add key to static config that we'll check for after the dynamic is evaluated
143
+ // to see if the static config was used in determining the dynamic
144
+ const hasBaseStaticConfig = _environment().NON_STANDARD_SYMBOL;
145
+ if (request !== null && request !== void 0 && request.config) {
146
+ // @ts-ignore
147
+ request.config[hasBaseStaticConfig] = true;
148
+ }
135
149
  if (result.default != null) {
136
150
  result = result.default;
137
151
  }
@@ -143,15 +157,27 @@ function resolveConfigExport(result, configFile, request) {
143
157
  throw new (_Errors().ConfigError)(`Config file ${configFile} cannot return a Promise.`, 'INVALID_CONFIG');
144
158
  }
145
159
 
160
+ // If the key is not added, it suggests that the static config was not used as the base for the dynamic.
161
+ // note(Keith): This is the most common way to use static and dynamic config together, but not the only way.
162
+ // Hence, this is only output from getConfig() for informational purposes for use by tools like Expo Doctor
163
+ // to suggest that there *may* be a problem.
164
+ const mayHaveUnusedStaticConfig =
165
+ // @ts-ignore
166
+ (request === null || request === void 0 ? void 0 : (_request$config = request.config) === null || _request$config === void 0 ? void 0 : _request$config[hasBaseStaticConfig]) && !((_result = result) !== null && _result !== void 0 && _result[hasBaseStaticConfig]);
167
+ if (result) {
168
+ delete result._hasBaseStaticConfig;
169
+ }
170
+
146
171
  // If the expo object exists, ignore all other values.
147
- if ((_result = result) !== null && _result !== void 0 && _result.expo) {
172
+ if ((_result2 = result) !== null && _result2 !== void 0 && _result2.expo) {
148
173
  result = (0, _Serialize().serializeSkippingMods)(result.expo);
149
174
  } else {
150
175
  result = (0, _Serialize().serializeSkippingMods)(result);
151
176
  }
152
177
  return {
153
178
  config: result,
154
- exportedObjectType
179
+ exportedObjectType,
180
+ mayHaveUnusedStaticConfig
155
181
  };
156
182
  }
157
183
  //# sourceMappingURL=evalConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"evalConfig.js","names":["_fs","data","require","_requireFromString","_interopRequireDefault","_sucrase","_Errors","_Serialize","obj","__esModule","default","evalConfig","configFile","request","contents","readFileSync","result","code","transform","filePath","transforms","requireString","error","location","extractLocationFromSyntaxError","codeFrameColumns","codeFrame","start","loc","highlightCode","message","importantStack","extractImportantStackFromNodeError","resolveConfigExport","line","lineNumber","column","columnNumber","isSyntaxError","_error$stack","traces","stack","split","filter","startsWith","length","pop","join","SyntaxError","constructor","name","_result","exportedObjectType","Promise","ConfigError","expo","serializeSkippingMods","config"],"sources":["../src/evalConfig.ts"],"sourcesContent":["import { readFileSync } from 'fs';\nimport requireString from 'require-from-string';\nimport { transform } from 'sucrase';\n\nimport { AppJSONConfig, ConfigContext, ExpoConfig } from './Config.types';\nimport { ConfigError } from './Errors';\nimport { serializeSkippingMods } from './Serialize';\n\ntype RawDynamicConfig = AppJSONConfig | Partial<ExpoConfig> | null;\n\nexport type DynamicConfigResults = { config: RawDynamicConfig; exportedObjectType: string };\n\n/**\n * Transpile and evaluate the dynamic config object.\n * This method is shared between the standard reading method in getConfig, and the headless script.\n *\n * @param options configFile path to the dynamic app.config.*, request to send to the dynamic config if it exports a function.\n * @returns the serialized and evaluated config along with the exported object type (object or function).\n */\nexport function evalConfig(\n configFile: string,\n request: ConfigContext | null\n): DynamicConfigResults {\n const contents = readFileSync(configFile, 'utf8');\n let result: any;\n try {\n const { code } = transform(contents, {\n filePath: configFile,\n transforms: ['typescript', 'imports'],\n });\n\n result = requireString(code, configFile);\n } catch (error: any) {\n const location = extractLocationFromSyntaxError(error);\n\n // Apply a code frame preview to the error if possible, sucrase doesn't do this by default.\n if (location) {\n const { codeFrameColumns } = require('@babel/code-frame');\n const codeFrame = codeFrameColumns(contents, { start: error.loc }, { highlightCode: true });\n error.codeFrame = codeFrame;\n error.message += `\\n${codeFrame}`;\n } else {\n const importantStack = extractImportantStackFromNodeError(error);\n\n if (importantStack) {\n error.message += `\\n${importantStack}`;\n }\n }\n throw error;\n }\n return resolveConfigExport(result, configFile, request);\n}\n\nfunction extractLocationFromSyntaxError(\n error: Error | any\n): { line: number; column?: number } | null {\n // sucrase provides the `loc` object\n if (error.loc) {\n return error.loc;\n }\n\n // `SyntaxError`s provide the `lineNumber` and `columnNumber` properties\n if ('lineNumber' in error && 'columnNumber' in error) {\n return { line: error.lineNumber, column: error.columnNumber };\n }\n\n return null;\n}\n\n// These kinda errors often come from syntax errors in files that were imported by the main file.\n// An example is a module that includes an import statement.\nfunction extractImportantStackFromNodeError(error: any): string | null {\n if (isSyntaxError(error)) {\n const traces = error.stack?.split('\\n').filter((line) => !line.startsWith(' at '));\n if (!traces) return null;\n\n // Remove redundant line\n if (traces[traces.length - 1].startsWith('SyntaxError:')) {\n traces.pop();\n }\n return traces.join('\\n');\n }\n return null;\n}\n\nfunction isSyntaxError(error: any): error is SyntaxError {\n return error instanceof SyntaxError || error.constructor.name === 'SyntaxError';\n}\n\n/**\n * - Resolve the exported contents of an Expo config (be it default or module.exports)\n * - Assert no promise exports\n * - Return config type\n * - Serialize config\n *\n * @param result\n * @param configFile\n * @param request\n */\nexport function resolveConfigExport(\n result: any,\n configFile: string,\n request: ConfigContext | null\n) {\n if (result.default != null) {\n result = result.default;\n }\n const exportedObjectType = typeof result;\n if (typeof result === 'function') {\n result = result(request);\n }\n\n if (result instanceof Promise) {\n throw new ConfigError(`Config file ${configFile} cannot return a Promise.`, 'INVALID_CONFIG');\n }\n\n // If the expo object exists, ignore all other values.\n if (result?.expo) {\n result = serializeSkippingMods(result.expo);\n } else {\n result = serializeSkippingMods(result);\n }\n\n return { config: result, exportedObjectType };\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,mBAAA;EAAA,MAAAF,IAAA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cAAc,CAAC,EAAE;MACxDJ,MAAM,CAACM,GAAG,EAAE;IACd;IACA,OAAON,MAAM,CAACO,IAAI,CAAC,IAAI,CAAC;EAC1B;EACA,OAAO,IAAI;AACb;AAEA,SAAST,aAAaA,CAAChB,KAAU,EAAwB;EACvD,OAAOA,KAAK,YAAY0B,WAAW,IAAI1B,KAAK,CAAC2B,WAAW,CAACC,IAAI,KAAK,aAAa;AACjF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASjB,mBAAmBA,CACjCjB,MAAW,EACXJ,UAAkB,EAClBC,OAA6B,EAC7B;EAAA,IAAAsC,OAAA;EACA,IAAInC,MAAM,CAACN,OAAO,IAAI,IAAI,EAAE;IAC1BM,MAAM,GAAGA,MAAM,CAACN,OAAO;EACzB;EACA,MAAM0C,kBAAkB,GAAG,OAAOpC,MAAM;EACxC,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;IAChCA,MAAM,GAAGA,MAAM,CAACH,OAAO,CAAC;EAC1B;EAEA,IAAIG,MAAM,YAAYqC,OAAO,EAAE;IAC7B,MAAM,KAAIC,qBAAW,EAAE,eAAc1C,UAAW,2BAA0B,EAAE,gBAAgB,CAAC;EAC/F;;EAEA;EACA,KAAAuC,OAAA,GAAInC,MAAM,cAAAmC,OAAA,eAANA,OAAA,CAAQI,IAAI,EAAE;IAChBvC,MAAM,GAAG,IAAAwC,kCAAqB,EAACxC,MAAM,CAACuC,IAAI,CAAC;EAC7C,CAAC,MAAM;IACLvC,MAAM,GAAG,IAAAwC,kCAAqB,EAACxC,MAAM,CAAC;EACxC;EAEA,OAAO;IAAEyC,MAAM,EAAEzC,MAAM;IAAEoC;EAAmB,CAAC;AAC/C"}
1
+ {"version":3,"file":"evalConfig.js","names":["_fs","data","require","_requireFromString","_interopRequireDefault","_sucrase","_Errors","_Serialize","_environment","obj","__esModule","default","evalConfig","configFile","request","contents","readFileSync","result","code","transform","filePath","transforms","requireString","error","location","extractLocationFromSyntaxError","codeFrameColumns","codeFrame","start","loc","highlightCode","message","importantStack","extractImportantStackFromNodeError","resolveConfigExport","line","lineNumber","column","columnNumber","isSyntaxError","_error$stack","traces","stack","split","filter","startsWith","length","pop","join","SyntaxError","constructor","name","_request$config","_result","_result2","hasBaseStaticConfig","NON_STANDARD_SYMBOL","config","exportedObjectType","Promise","ConfigError","mayHaveUnusedStaticConfig","_hasBaseStaticConfig","expo","serializeSkippingMods"],"sources":["../src/evalConfig.ts"],"sourcesContent":["import { readFileSync } from 'fs';\nimport requireString from 'require-from-string';\nimport { transform } from 'sucrase';\n\nimport { AppJSONConfig, ConfigContext, ExpoConfig } from './Config.types';\nimport { ConfigError } from './Errors';\nimport { serializeSkippingMods } from './Serialize';\nimport { NON_STANDARD_SYMBOL } from './environment';\n\ntype RawDynamicConfig = AppJSONConfig | Partial<ExpoConfig> | null;\n\nexport type DynamicConfigResults = {\n config: RawDynamicConfig;\n exportedObjectType: string;\n mayHaveUnusedStaticConfig: boolean;\n};\n\n/**\n * Transpile and evaluate the dynamic config object.\n * This method is shared between the standard reading method in getConfig, and the headless script.\n *\n * @param options configFile path to the dynamic app.config.*, request to send to the dynamic config if it exports a function.\n * @returns the serialized and evaluated config along with the exported object type (object or function).\n */\nexport function evalConfig(\n configFile: string,\n request: ConfigContext | null\n): DynamicConfigResults {\n const contents = readFileSync(configFile, 'utf8');\n let result: any;\n try {\n const { code } = transform(contents, {\n filePath: configFile,\n transforms: ['typescript', 'imports'],\n });\n\n result = requireString(code, configFile);\n } catch (error: any) {\n const location = extractLocationFromSyntaxError(error);\n\n // Apply a code frame preview to the error if possible, sucrase doesn't do this by default.\n if (location) {\n const { codeFrameColumns } = require('@babel/code-frame');\n const codeFrame = codeFrameColumns(contents, { start: error.loc }, { highlightCode: true });\n error.codeFrame = codeFrame;\n error.message += `\\n${codeFrame}`;\n } else {\n const importantStack = extractImportantStackFromNodeError(error);\n\n if (importantStack) {\n error.message += `\\n${importantStack}`;\n }\n }\n throw error;\n }\n return resolveConfigExport(result, configFile, request);\n}\n\nfunction extractLocationFromSyntaxError(\n error: Error | any\n): { line: number; column?: number } | null {\n // sucrase provides the `loc` object\n if (error.loc) {\n return error.loc;\n }\n\n // `SyntaxError`s provide the `lineNumber` and `columnNumber` properties\n if ('lineNumber' in error && 'columnNumber' in error) {\n return { line: error.lineNumber, column: error.columnNumber };\n }\n\n return null;\n}\n\n// These kinda errors often come from syntax errors in files that were imported by the main file.\n// An example is a module that includes an import statement.\nfunction extractImportantStackFromNodeError(error: any): string | null {\n if (isSyntaxError(error)) {\n const traces = error.stack?.split('\\n').filter((line) => !line.startsWith(' at '));\n if (!traces) return null;\n\n // Remove redundant line\n if (traces[traces.length - 1].startsWith('SyntaxError:')) {\n traces.pop();\n }\n return traces.join('\\n');\n }\n return null;\n}\n\nfunction isSyntaxError(error: any): error is SyntaxError {\n return error instanceof SyntaxError || error.constructor.name === 'SyntaxError';\n}\n\n/**\n * - Resolve the exported contents of an Expo config (be it default or module.exports)\n * - Assert no promise exports\n * - Return config type\n * - Serialize config\n *\n * @param result\n * @param configFile\n * @param request\n */\nexport function resolveConfigExport(\n result: any,\n configFile: string,\n request: ConfigContext | null\n) {\n // add key to static config that we'll check for after the dynamic is evaluated\n // to see if the static config was used in determining the dynamic\n const hasBaseStaticConfig = NON_STANDARD_SYMBOL;\n if (request?.config) {\n // @ts-ignore\n request.config[hasBaseStaticConfig] = true;\n }\n if (result.default != null) {\n result = result.default;\n }\n const exportedObjectType = typeof result;\n if (typeof result === 'function') {\n result = result(request);\n }\n\n if (result instanceof Promise) {\n throw new ConfigError(`Config file ${configFile} cannot return a Promise.`, 'INVALID_CONFIG');\n }\n\n // If the key is not added, it suggests that the static config was not used as the base for the dynamic.\n // note(Keith): This is the most common way to use static and dynamic config together, but not the only way.\n // Hence, this is only output from getConfig() for informational purposes for use by tools like Expo Doctor\n // to suggest that there *may* be a problem.\n const mayHaveUnusedStaticConfig =\n // @ts-ignore\n request?.config?.[hasBaseStaticConfig] && !result?.[hasBaseStaticConfig];\n if (result) {\n delete result._hasBaseStaticConfig;\n }\n\n // If the expo object exists, ignore all other values.\n if (result?.expo) {\n result = serializeSkippingMods(result.expo);\n } else {\n result = serializeSkippingMods(result);\n }\n\n return { config: result, exportedObjectType, mayHaveUnusedStaticConfig };\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,mBAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,WAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,UAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,aAAA;EAAA,MAAAP,IAAA,GAAAC,OAAA;EAAAM,YAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAoD,SAAAG,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAUpD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,UAAUA,CACxBC,UAAkB,EAClBC,OAA6B,EACP;EACtB,MAAMC,QAAQ,GAAG,IAAAC,kBAAY,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AAkB,GAAG,OAAOzC,MAAM;EACxC,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;IAChCA,MAAM,GAAGA,MAAM,CAACH,OAAO,CAAC;EAC1B;EAEA,IAAIG,MAAM,YAAY0C,OAAO,EAAE;IAC7B,MAAM,KAAIC,qBAAW,EAAE,eAAc/C,UAAW,2BAA0B,EAAE,gBAAgB,CAAC;EAC/F;;EAEA;EACA;EACA;EACA;EACA,MAAMgD,yBAAyB;EAC7B;EACA,CAAA/C,OAAO,aAAPA,OAAO,wBAAAsC,eAAA,GAAPtC,OAAO,CAAE2C,MAAM,cAAAL,eAAA,uBAAfA,eAAA,CAAkBG,mBAAmB,CAAC,KAAI,GAAAF,OAAA,GAACpC,MAAM,cAAAoC,OAAA,eAANA,OAAA,CAASE,mBAAmB,CAAC;EAC1E,IAAItC,MAAM,EAAE;IACV,OAAOA,MAAM,CAAC6C,oBAAoB;EACpC;;EAEA;EACA,KAAAR,QAAA,GAAIrC,MAAM,cAAAqC,QAAA,eAANA,QAAA,CAAQS,IAAI,EAAE;IAChB9C,MAAM,GAAG,IAAA+C,kCAAqB,EAAC/C,MAAM,CAAC8C,IAAI,CAAC;EAC7C,CAAC,MAAM;IACL9C,MAAM,GAAG,IAAA+C,kCAAqB,EAAC/C,MAAM,CAAC;EACxC;EAEA,OAAO;IAAEwC,MAAM,EAAExC,MAAM;IAAEyC,kBAAkB;IAAEG;EAA0B,CAAC;AAC1E"}
@@ -1,11 +1,9 @@
1
- import { ProjectConfig } from '../Config.types';
1
+ import { PackageJSONConfig } 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?: Partial<ProjectConfig>;
7
- }): string | null;
8
- export declare function getEntryPoint(projectRoot: string, entryFiles: string[], platforms: string[], projectConfig?: Partial<ProjectConfig>): string | null;
9
- export declare function getEntryPointWithExtensions(projectRoot: string, entryFiles: string[], extensions: string[], projectConfig?: Partial<ProjectConfig>): string;
10
- export declare function resolveFromSilentWithExtensions(fromDirectory: string, moduleId: string, extensions: string[]): string | null;
4
+ /** @returns the absolute entry file for an Expo project. */
5
+ export declare function resolveEntryPoint(projectRoot: string, { platform, pkg, }?: {
6
+ platform?: string;
7
+ pkg?: PackageJSONConfig;
8
+ }): string;
11
9
  export declare function getFileWithExtensions(fromDirectory: string, moduleId: string, extensions: string[]): string | null;
@@ -4,12 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ensureSlash = ensureSlash;
7
- exports.getEntryPoint = getEntryPoint;
8
- exports.getEntryPointWithExtensions = getEntryPointWithExtensions;
9
7
  exports.getFileWithExtensions = getFileWithExtensions;
10
8
  exports.getPossibleProjectRoot = getPossibleProjectRoot;
11
9
  exports.resolveEntryPoint = resolveEntryPoint;
12
- exports.resolveFromSilentWithExtensions = resolveFromSilentWithExtensions;
13
10
  function _fs() {
14
11
  const data = _interopRequireDefault(require("fs"));
15
12
  _fs = function () {
@@ -45,6 +42,13 @@ function _Config() {
45
42
  };
46
43
  return data;
47
44
  }
45
+ function _Errors() {
46
+ const data = require("../Errors");
47
+ _Errors = function () {
48
+ return data;
49
+ };
50
+ return data;
51
+ }
48
52
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
49
53
  // https://github.com/facebook/create-react-app/blob/9750738cce89a967cc71f28390daf5d4311b193c/packages/react-scripts/config/paths.js#L22
50
54
  function ensureSlash(inputPath, needsSlash) {
@@ -61,57 +65,34 @@ function getPossibleProjectRoot() {
61
65
  return _fs().default.realpathSync(process.cwd());
62
66
  }
63
67
  const nativePlatforms = ['ios', 'android'];
68
+
69
+ /** @returns the absolute entry file for an Expo project. */
64
70
  function resolveEntryPoint(projectRoot, {
65
71
  platform,
66
- projectConfig
67
- }) {
68
- const platforms = nativePlatforms.includes(platform) ? [platform, 'native'] : [platform];
69
- return getEntryPoint(projectRoot, ['./index'], platforms, projectConfig);
70
- }
71
- function getEntryPoint(projectRoot, entryFiles, platforms, projectConfig) {
72
+ pkg = (0, _Config().getPackageJson)(projectRoot)
73
+ } = {}) {
74
+ const platforms = !platform ? [] : nativePlatforms.includes(platform) ? [platform, 'native'] : [platform];
72
75
  const extensions = (0, _extensions().getBareExtensions)(platforms);
73
- return getEntryPointWithExtensions(projectRoot, entryFiles, extensions, projectConfig);
74
- }
75
76
 
76
- // Used to resolve the main entry file for a project.
77
- function getEntryPointWithExtensions(projectRoot, entryFiles, extensions, projectConfig) {
78
- if (!projectConfig) {
79
- // drop all logging abilities
80
- const original = process.stdout.write;
81
- process.stdout.write = () => true;
82
- try {
83
- projectConfig = (0, _Config().getConfig)(projectRoot, {
84
- skipSDKVersionRequirement: true
85
- });
86
- } finally {
87
- process.stdout.write = original;
88
- }
89
- }
77
+ // If the config doesn't define a custom entry then we want to look at the `package.json`s `main` field, and try again.
90
78
  const {
91
- pkg
92
- } = projectConfig;
93
- if (pkg) {
94
- // If the config doesn't define a custom entry then we want to look at the `package.json`s `main` field, and try again.
95
- const {
96
- main
97
- } = pkg;
98
- if (main && typeof main === 'string') {
99
- // 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.
100
- let entry = getFileWithExtensions(projectRoot, main, extensions);
101
- if (!entry) {
102
- // Allow for paths like: `{ "main": "expo/AppEntry" }`
103
- entry = resolveFromSilentWithExtensions(projectRoot, main, extensions);
104
- if (!entry) throw new Error(`Cannot resolve entry file: The \`main\` field defined in your \`package.json\` points to a non-existent path.`);
105
- }
106
- return entry;
79
+ main
80
+ } = pkg;
81
+ if (main && typeof main === 'string') {
82
+ // 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.
83
+ let entry = getFileWithExtensions(projectRoot, main, extensions);
84
+ if (!entry) {
85
+ // Allow for paths like: `{ "main": "expo/AppEntry" }`
86
+ entry = resolveFromSilentWithExtensions(projectRoot, main, extensions);
87
+ if (!entry) throw new (_Errors().ConfigError)(`Cannot resolve entry file: The \`main\` field defined in your \`package.json\` points to an unresolvable or non-existent path.`, 'ENTRY_NOT_FOUND');
107
88
  }
89
+ return entry;
108
90
  }
109
91
 
110
- // Now we will start looking for a default entry point using the provided `entryFiles` argument.
111
- // This will add support for create-react-app (src/index.js) and react-native-cli (index.js) which don't define a main.
112
- for (const fileName of entryFiles) {
113
- const entry = resolveFromSilentWithExtensions(projectRoot, fileName, extensions);
114
- if (entry) return entry;
92
+ // Check for a root index.* file in the project root.
93
+ const entry = resolveFromSilentWithExtensions(projectRoot, './index', extensions);
94
+ if (entry) {
95
+ return entry;
115
96
  }
116
97
  try {
117
98
  // If none of the default files exist then we will attempt to use the main Expo entry point.
@@ -121,7 +102,7 @@ function getEntryPointWithExtensions(projectRoot, entryFiles, extensions, projec
121
102
  // 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.
122
103
  return (0, _resolveFrom().default)(projectRoot, 'expo/AppEntry');
123
104
  } catch {
124
- throw new Error(`The project entry file could not be resolved. Please define it in the \`main\` field of the \`package.json\`, create an \`index.js\`, or install the \`expo\` package.`);
105
+ throw new (_Errors().ConfigError)(`The project entry file could not be resolved. Define it in the \`main\` field of the \`package.json\`, create an \`index.js\`, or install the \`expo\` package.`, 'ENTRY_NOT_FOUND');
125
106
  }
126
107
  }
127
108
 
@@ -129,7 +110,7 @@ function getEntryPointWithExtensions(projectRoot, entryFiles, extensions, projec
129
110
  function resolveFromSilentWithExtensions(fromDirectory, moduleId, extensions) {
130
111
  for (const extension of extensions) {
131
112
  const modulePath = _resolveFrom().default.silent(fromDirectory, `${moduleId}.${extension}`);
132
- if (modulePath && modulePath.endsWith(extension)) {
113
+ if (modulePath !== null && modulePath !== void 0 && modulePath.endsWith(extension)) {
133
114
  return modulePath;
134
115
  }
135
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"paths.js","names":["_fs","data","_interopRequireDefault","require","_path","_resolveFrom","_extensions","_Config","obj","__esModule","default","ensureSlash","inputPath","needsSlash","hasSlash","endsWith","substr","length","getPossibleProjectRoot","fs","realpathSync","process","cwd","nativePlatforms","resolveEntryPoint","projectRoot","platform","projectConfig","platforms","includes","getEntryPoint","entryFiles","extensions","getBareExtensions","getEntryPointWithExtensions","original","stdout","write","getConfig","skipSDKVersionRequirement","pkg","main","entry","getFileWithExtensions","resolveFromSilentWithExtensions","Error","fileName","resolveFrom","fromDirectory","moduleId","extension","modulePath","silent","path","join","existsSync"],"sources":["../../src/paths/paths.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { getBareExtensions } from './extensions';\nimport { getConfig } from '../Config';\nimport { ProjectConfig } from '../Config.types';\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?: Partial<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?: Partial<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?: Partial<ProjectConfig>\n): string {\n if (!projectConfig) {\n // drop all logging abilities\n const original = process.stdout.write;\n process.stdout.write = () => true;\n try {\n projectConfig = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n } finally {\n process.stdout.write = original;\n }\n }\n\n const { pkg } = projectConfig;\n\n 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 define it in the \\`main\\` field of the \\`package.json\\`, 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"],"mappings":";;;;;;;;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,aAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,YAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,QAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,OAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsC,SAAAC,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,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AMkB,SAAS,IAAIlB,UAAU,EAAE;IAClC,MAAMmB,UAAU,GAAGJ,sBAAW,CAACK,MAAM,CAACJ,aAAa,EAAG,GAAEC,QAAS,IAAGC,SAAU,EAAC,CAAC;IAChF,IAAIC,UAAU,IAAIA,UAAU,CAACpC,QAAQ,CAACmC,SAAS,CAAC,EAAE;MAChD,OAAOC,UAAU;IACnB;EACF;EACA,OAAOJ,sBAAW,CAACK,MAAM,CAACJ,aAAa,EAAEC,QAAQ,CAAC,IAAI,IAAI;AAC5D;;AAEA;AACA;AACO,SAASN,qBAAqBA,CACnCK,aAAqB,EACrBC,QAAgB,EAChBjB,UAAoB,EACL;EACf,MAAMmB,UAAU,GAAGE,eAAI,CAACC,IAAI,CAACN,aAAa,EAAEC,QAAQ,CAAC;EACrD,IAAI9B,aAAE,CAACoC,UAAU,CAACJ,UAAU,CAAC,EAAE;IAC7B,OAAOA,UAAU;EACnB;EACA,KAAK,MAAMD,SAAS,IAAIlB,UAAU,EAAE;IAClC,MAAMmB,UAAU,GAAGE,eAAI,CAACC,IAAI,CAACN,aAAa,EAAG,GAAEC,QAAS,IAAGC,SAAU,EAAC,CAAC;IACvE,IAAI/B,aAAE,CAACoC,UAAU,CAACJ,UAAU,CAAC,EAAE;MAC7B,OAAOA,UAAU;IACnB;EACF;EACA,OAAO,IAAI;AACb"}
1
+ {"version":3,"file":"paths.js","names":["_fs","data","_interopRequireDefault","require","_path","_resolveFrom","_extensions","_Config","_Errors","obj","__esModule","default","ensureSlash","inputPath","needsSlash","hasSlash","endsWith","substr","length","getPossibleProjectRoot","fs","realpathSync","process","cwd","nativePlatforms","resolveEntryPoint","projectRoot","platform","pkg","getPackageJson","platforms","includes","extensions","getBareExtensions","main","entry","getFileWithExtensions","resolveFromSilentWithExtensions","ConfigError","resolveFrom","fromDirectory","moduleId","extension","modulePath","silent","path","join","existsSync"],"sources":["../../src/paths/paths.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { getBareExtensions } from './extensions';\nimport { getPackageJson } from '../Config';\nimport { PackageJSONConfig } from '../Config.types';\nimport { ConfigError } from '../Errors';\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\n/** @returns the absolute entry file for an Expo project. */\nexport function resolveEntryPoint(\n projectRoot: string,\n {\n platform,\n pkg = getPackageJson(projectRoot),\n }: {\n platform?: string;\n pkg?: PackageJSONConfig;\n } = {}\n): string {\n const platforms = !platform\n ? []\n : nativePlatforms.includes(platform)\n ? [platform, 'native']\n : [platform];\n const extensions = getBareExtensions(platforms);\n\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 ConfigError(\n `Cannot resolve entry file: The \\`main\\` field defined in your \\`package.json\\` points to an unresolvable or non-existent path.`,\n 'ENTRY_NOT_FOUND'\n );\n }\n return entry;\n }\n\n // Check for a root index.* file in the project root.\n const entry = resolveFromSilentWithExtensions(projectRoot, './index', extensions);\n if (entry) {\n 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 ConfigError(\n `The project entry file could not be resolved. Define it in the \\`main\\` field of the \\`package.json\\`, create an \\`index.js\\`, or install the \\`expo\\` package.`,\n 'ENTRY_NOT_FOUND'\n );\n }\n}\n\n// Resolve from but with the ability to resolve like a bundler\nfunction 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?.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"],"mappings":";;;;;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,aAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAA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,CAAC,EAAE;MACnC,OAAOC,UAAU;IACnB;EACF;EACA,OAAOJ,sBAAW,CAACK,MAAM,CAACJ,aAAa,EAAEC,QAAQ,CAAC,IAAI,IAAI;AAC5D;;AAEA;AACA;AACO,SAASL,qBAAqBA,CACnCI,aAAqB,EACrBC,QAAgB,EAChBT,UAAoB,EACL;EACf,MAAMW,UAAU,GAAGE,eAAI,CAACC,IAAI,CAACN,aAAa,EAAEC,QAAQ,CAAC;EACrD,IAAIrB,aAAE,CAAC2B,UAAU,CAACJ,UAAU,CAAC,EAAE;IAC7B,OAAOA,UAAU;EACnB;EACA,KAAK,MAAMD,SAAS,IAAIV,UAAU,EAAE;IAClC,MAAMW,UAAU,GAAGE,eAAI,CAACC,IAAI,CAACN,aAAa,EAAG,GAAEC,QAAS,IAAGC,SAAU,EAAC,CAAC;IACvE,IAAItB,aAAE,CAAC2B,UAAU,CAACJ,UAAU,CAAC,EAAE;MAC7B,OAAOA,UAAU;IACnB;EACF;EACA,OAAO,IAAI;AACb"}
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@expo/config",
3
- "version": "8.3.1",
3
+ "version": "8.5.0",
4
4
  "description": "A library for interacting with the app.json",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
7
- "watch": "tsc --watch --preserveWatchOutput",
8
7
  "build": "tsc --emitDeclarationOnly && babel src --out-dir build --extensions \".ts\" --source-maps --ignore \"src/**/__mocks__/*\",\"src/**/__tests__/*\"",
9
- "prepare": "yarn run clean && yarn build",
10
- "clean": "rimraf build ./tsconfig.tsbuildinfo",
11
- "lint": "eslint .",
12
- "test": "jest"
8
+ "clean": "expo-module clean",
9
+ "lint": "expo-module lint",
10
+ "prepare": "expo-module clean && yarn run build",
11
+ "prepublishOnly": "expo-module prepublishOnly",
12
+ "test": "expo-module test",
13
+ "typecheck": "expo-module typecheck"
13
14
  },
14
15
  "repository": {
15
16
  "type": "git",
@@ -33,7 +34,7 @@
33
34
  ],
34
35
  "dependencies": {
35
36
  "@babel/code-frame": "~7.10.4",
36
- "@expo/config-plugins": "~7.5.0",
37
+ "@expo/config-plugins": "~7.8.0",
37
38
  "@expo/config-types": "^50.0.0-alpha.1",
38
39
  "@expo/json-file": "^8.2.37",
39
40
  "getenv": "^1.0.0",
@@ -45,10 +46,11 @@
45
46
  "sucrase": "^3.20.0"
46
47
  },
47
48
  "devDependencies": {
48
- "@types/require-from-string": "^1.2.1"
49
+ "@types/require-from-string": "^1.2.1",
50
+ "expo-module-scripts": "^3.3.0"
49
51
  },
50
52
  "publishConfig": {
51
53
  "access": "public"
52
54
  },
53
- "gitHead": "ff40b4b373ce2944d1541f70969db65e3e5c1999"
55
+ "gitHead": "2763e9cc6f2317b40da73382fe2595f8deebff46"
54
56
  }