amis-rpc-design/node_modules/@react-native-community/cli-platform-android/build/config/index.js.map

1 line
8.0 KiB
Plaintext
Raw Normal View History

2023-10-07 19:42:30 +08:00
{"version":3,"names":["projectConfig","root","userConfig","src","sourceDir","findAndroidDir","path","join","appName","getAppName","manifestPath","findManifest","buildGradlePath","findBuildGradle","packageName","getPackageName","CLIError","dependencyConfiguration","unstable_reactLegacyComponentNames","userConfigAppName","fs","existsSync","dependencyConfig","packageClassName","findPackageClassName","packageImportPath","packageInstance","buildTypes","libraryName","findLibraryName","componentDescriptors","findComponentDescriptors","cmakeListsPath","process","platform","replace"],"sources":["../../src/config/index.ts"],"sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport path from 'path';\nimport fs from 'fs';\nimport findAndroidDir from './findAndroidDir';\nimport findManifest from './findManifest';\nimport findPackageClassName from './findPackageClassName';\nimport {\n AndroidProjectParams,\n AndroidProjectConfig,\n AndroidDependencyParams,\n AndroidDependencyConfig,\n} from '@react-native-community/cli-types';\nimport {getPackageName} from './getAndroidProject';\nimport {findLibraryName} from './findLibraryName';\nimport {findComponentDescriptors} from './findComponentDescriptors';\nimport {findBuildGradle} from './findBuildGradle';\nimport {CLIError} from '@react-native-community/cli-tools';\n\n/**\n * Gets android project config by analyzing given folder and taking some\n * defaults specified by user into consideration\n */\nexport function projectConfig(\n root: string,\n userConfig: AndroidProjectParams = {},\n): AndroidProjectConfig | null {\n const src = userConfig.sourceDir || findAndroidDir(root);\n\n if (!src) {\n return null;\n }\n\n const sourceDir = path.join(root, src);\n\n const appName = getAppName(sourceDir, userConfig.appName);\n\n const manifestPath = userConfig.manifestPath\n ? path.join(sourceDir, userConfig.manifestPath)\n : findManifest(path.join(sourceDir, appName));\n const buildGradlePath = findBuildGradle(sourceDir, false);\n\n if (!manifestPath && !buildGradlePath) {\n return null;\n }\n\n const packageName =\n userConfig.packageName || getPackageName(manifestPath, buildGradlePath);\n\n if (!packageName) {\n throw new CLIError(\n `Package name not found in neither ${manifestPath} nor ${buildGradlePath}`,\n );\n }\n\n return {\n sourceDir,\n appName,\n packageName,\n dependencyConfiguration: userConfig.dependencyConfiguration,\n unstable_reactLegacyComponentNames:\n userConfig.unstable_reactLegacyComponentNames,\n };\n}\n\nfunction getAppName(sourceDir: string, userConfigAppName: string | undefined) {\n let appName = '';\n if (\n typeof userConfigAppName === 'string' &&\n fs.existsSync(path.join(sourceDir, userConfigAppName))\n ) {\n appName = userConfigAppName;\n } else if (fs.existsSync(path.join(sourceDir, 'app'))) {\n appName = 'app';\n }\n return appName;\n}\n\n/**\n * Same as projectConfigAndroid except it returns\n * different config that applies to packages only\n */\nexport function dependencyConfig(\n root: string,\n userConfig: AndroidDependencyParams | null = {},\n): AndroidDependencyConfig | null {\n if (userConfig === null) {\n return null;\n }\n\n const src = userConfig.sourceDir || findAndroidDir(root);\n\n if (!src) {\n return null;\n }\n\n const sourceDir = path.join(root, src);\n const manifestPath = userConfig.manifestPath\n ? path.join(sourceDir, userConfig.manifestPath)\n : findManifest(sourceDir);\n const buildGradlePath = findBuildGradle(sourceDir, true);\n\n if (!manifestPath && !buildGradlePath) {\n return null;\n }\n\n const packageName =\n userConfig.packageName || getPackageName(manifestPath, buildGradlePath);\n const packageClassName = findPackageClassName(sourceDir);\n\n /**\n * This module has no package to export\n */\n if (!packageClassName) {\n return null;\n }\n\n c