expo-modules-autolinking
Advanced tools
Comparing version 2.1.0-canary-20250219-4a5dade to 2.1.0-canary-20250221-ef26fed
@@ -9,3 +9,3 @@ "use strict"; | ||
const fast_glob_1 = __importDefault(require("fast-glob")); | ||
const fs_extra_1 = __importDefault(require("fs-extra")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const module_1 = require("module"); | ||
@@ -26,3 +26,3 @@ const path_1 = __importDefault(require("path")); | ||
// custom native modules should be resolved first so that they can override other modules | ||
const searchPaths = new Set(options.nativeModulesDir && fs_extra_1.default.existsSync(options.nativeModulesDir) | ||
const searchPaths = new Set(options.nativeModulesDir && fs_1.default.existsSync(options.nativeModulesDir) | ||
? [options.nativeModulesDir, ...options.searchPaths] | ||
@@ -35,3 +35,3 @@ : options.searchPaths); | ||
for (const packageConfigPath of packageConfigPaths) { | ||
const packagePath = await fs_extra_1.default.realpath(path_1.default.join(searchPath, path_1.default.dirname(packageConfigPath))); | ||
const packagePath = await fs_1.default.promises.realpath(path_1.default.join(searchPath, path_1.default.dirname(packageConfigPath))); | ||
const expoModuleConfig = (0, ExpoModuleConfig_1.requireAndResolveExpoModuleConfig)(path_1.default.join(packagePath, path_1.default.basename(packageConfigPath))); | ||
@@ -38,0 +38,0 @@ const { name, version } = resolvePackageNameAndVersion(packagePath, { |
@@ -8,3 +8,3 @@ "use strict"; | ||
const find_up_1 = __importDefault(require("find-up")); | ||
const fs_extra_1 = __importDefault(require("fs-extra")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const path_1 = __importDefault(require("path")); | ||
@@ -92,3 +92,3 @@ /** | ||
const resolvedPath = path_1.default.resolve(projectRoot, nativeModulesDir || 'modules'); | ||
return fs_extra_1.default.existsSync(resolvedPath) ? resolvedPath : null; | ||
return fs_1.default.existsSync(resolvedPath) ? resolvedPath : null; | ||
} | ||
@@ -95,0 +95,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { AndroidGradleAarProjectDescriptor, AndroidGradlePluginDescriptor, RawExpoModuleConfig, RawModuleConfigApple, SupportedPlatform } from './types'; | ||
import { AndroidGradleAarProjectDescriptor, AndroidGradlePluginDescriptor, AndroidPublication, RawExpoModuleConfig, RawModuleConfigApple, SupportedPlatform } from './types'; | ||
/** | ||
@@ -57,2 +57,6 @@ * A class that wraps the raw config (`expo-module.json` or `unimodule.json`). | ||
/** | ||
* Returns the publication config for Android. | ||
*/ | ||
androidPublication(): AndroidPublication | undefined; | ||
/** | ||
* Returns core features required by the module author. | ||
@@ -59,0 +63,0 @@ */ |
@@ -102,2 +102,8 @@ "use strict"; | ||
/** | ||
* Returns the publication config for Android. | ||
*/ | ||
androidPublication() { | ||
return this.rawConfig.android?.publication; | ||
} | ||
/** | ||
* Returns core features required by the module author. | ||
@@ -104,0 +110,0 @@ */ |
@@ -8,3 +8,3 @@ "use strict"; | ||
const fast_glob_1 = __importDefault(require("fast-glob")); | ||
const fs_extra_1 = __importDefault(require("fs-extra")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const path_1 = __importDefault(require("path")); | ||
@@ -18,3 +18,7 @@ const ANDROID_PROPERTIES_FILE = 'gradle.properties'; | ||
const generatedFileContent = await generatePackageListFileContentAsync(modules, namespace); | ||
await fs_extra_1.default.outputFile(targetPath, generatedFileContent); | ||
const parentPath = path_1.default.dirname(targetPath); | ||
if (!fs_1.default.existsSync(parentPath)) { | ||
await fs_1.default.promises.mkdir(parentPath, { recursive: true }); | ||
} | ||
await fs_1.default.promises.writeFile(targetPath, generatedFileContent, 'utf8'); | ||
} | ||
@@ -71,2 +75,3 @@ exports.generatePackageListAsync = generatePackageListAsync; | ||
const coreFeatures = revision.config?.coreFeatures() ?? []; | ||
const publication = revision.config?.androidPublication(); | ||
return { | ||
@@ -79,2 +84,3 @@ packageName, | ||
...(coreFeatures.length > 0 ? { coreFeatures } : {}), | ||
...(publication ? { publication } : {}), | ||
}; | ||
@@ -86,3 +92,3 @@ } | ||
try { | ||
const contents = await fs_extra_1.default.readFile(propsFile, 'utf8'); | ||
const contents = await fs_1.default.promises.readFile(propsFile, 'utf8'); | ||
const extraMavenReposString = searchGradlePropertyFirst(contents, ANDROID_EXTRA_BUILD_DEPS_KEY); | ||
@@ -153,3 +159,3 @@ if (extraMavenReposString) { | ||
for (const file of files) { | ||
const fileContent = await fs_extra_1.default.readFile(path_1.default.join(sourceDir, file), 'utf8'); | ||
const fileContent = await fs_1.default.promises.readFile(path_1.default.join(sourceDir, file), 'utf8'); | ||
const packageRegex = (() => { | ||
@@ -156,0 +162,0 @@ if (process.env.EXPO_SHOULD_USE_LEGACY_PACKAGE_INTERFACE) { |
@@ -9,3 +9,3 @@ "use strict"; | ||
const fast_glob_1 = __importDefault(require("fast-glob")); | ||
const fs_extra_1 = __importDefault(require("fs-extra")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const path_1 = __importDefault(require("path")); | ||
@@ -65,3 +65,3 @@ const fileUtils_1 = require("../fileUtils"); | ||
try { | ||
const contents = await fs_extra_1.default.readFile(propsFile, 'utf8'); | ||
const contents = await fs_1.default.promises.readFile(propsFile, 'utf8'); | ||
const podfileJson = JSON.parse(contents); | ||
@@ -85,3 +85,5 @@ if (podfileJson[APPLE_EXTRA_BUILD_DEPS_KEY]) { | ||
const generatedFileContent = await generatePackageListFileContentAsync(modules, className, entitlements); | ||
await fs_extra_1.default.outputFile(targetPath, generatedFileContent); | ||
const parentPath = path_1.default.dirname(targetPath); | ||
await fs_1.default.promises.mkdir(parentPath, { recursive: true }); | ||
await fs_1.default.promises.writeFile(targetPath, generatedFileContent, 'utf8'); | ||
} | ||
@@ -88,0 +90,0 @@ exports.generateModulesProviderAsync = generateModulesProviderAsync; |
@@ -102,3 +102,3 @@ "use strict"; | ||
} | ||
if (name === 'react-native') { | ||
if (name === 'react-native' || name === 'react-native-macos') { | ||
// Starting from version 0.76, the `react-native` package only defines platforms | ||
@@ -105,0 +105,0 @@ // when @react-native-community/cli-platform-android/ios is installed. |
@@ -72,2 +72,3 @@ import { ExpoModuleConfig } from './ExpoModuleConfig'; | ||
aarProjects?: ModuleAndroidAarProjectInfo[]; | ||
publication?: AndroidPublication; | ||
} | ||
@@ -122,2 +123,23 @@ export interface ModuleIosPodspecInfo { | ||
/** | ||
* Information about the available publication of an Android AAR file. | ||
*/ | ||
export interface AndroidPublication { | ||
/** | ||
* The Maven artifact ID. | ||
*/ | ||
id: string; | ||
/** | ||
* The Maven group ID. | ||
*/ | ||
group: string; | ||
/** | ||
* The Maven version. | ||
*/ | ||
version: string; | ||
/** | ||
* The Maven repository. | ||
*/ | ||
repository: string; | ||
} | ||
/** | ||
* Represents a raw config specific to Apple platforms. | ||
@@ -203,2 +225,6 @@ */ | ||
gradleAarProjects?: AndroidGradleAarProjectDescriptor[]; | ||
/** | ||
* Information about the prebuilt AAR file. | ||
*/ | ||
publication?: AndroidPublication; | ||
}; | ||
@@ -205,0 +231,0 @@ /** |
@@ -10,2 +10,3 @@ # Changelog | ||
- Added `coreFeatures` field. ([#34015](https://github.com/expo/expo/pull/34015) by [@lukmccall](https://github.com/lukmccall)) | ||
- Add macOS support. ([#35065](https://github.com/expo/expo/pull/35065) by [@gabrieldonadel](https://github.com/gabrieldonadel)) | ||
@@ -20,2 +21,4 @@ ### 🐛 Bug fixes | ||
- [Android] Introduced the Gradle plugin to improve the autolinking setup. ([#33402](https://github.com/expo/expo/pull/33402) by [@lukmccall](https://github.com/lukmccall)) | ||
- Drop `fs-extra` in favor of `fs`. ([#35036](https://github.com/expo/expo/pull/35036) by [@kitten](https://github.com/kitten)) | ||
- [Android] Added `publication` configuration. ([#35068](https://github.com/expo/expo/pull/35068) by [@lukmccall](https://github.com/lukmccall)) | ||
@@ -22,0 +25,0 @@ ## 2.0.4 - 2024-12-10 |
{ | ||
"name": "expo-modules-autolinking", | ||
"version": "2.1.0-canary-20250219-4a5dade", | ||
"version": "2.1.0-canary-20250221-ef26fed", | ||
"description": "Scripts that autolink Expo modules.", | ||
@@ -37,4 +37,3 @@ "main": "build/index.js", | ||
"devDependencies": { | ||
"@types/fs-extra": "^9.0.11", | ||
"expo-module-scripts": "4.0.5-canary-20250219-4a5dade", | ||
"expo-module-scripts": "4.0.5-canary-20250221-ef26fed", | ||
"minimatch": "^3.0.4" | ||
@@ -48,7 +47,5 @@ }, | ||
"find-up": "^5.0.0", | ||
"fs-extra": "^9.1.0", | ||
"require-from-string": "^2.0.2", | ||
"resolve-from": "^5.0.0" | ||
}, | ||
"gitHead": "4a5daded61d3d8b9d501059039ac74c09c25675b" | ||
} | ||
} |
import chalk from 'chalk'; | ||
import glob from 'fast-glob'; | ||
import fs from 'fs-extra'; | ||
import fs from 'fs'; | ||
import { createRequire } from 'module'; | ||
@@ -38,3 +38,5 @@ import path from 'path'; | ||
for (const packageConfigPath of packageConfigPaths) { | ||
const packagePath = await fs.realpath(path.join(searchPath, path.dirname(packageConfigPath))); | ||
const packagePath = await fs.promises.realpath( | ||
path.join(searchPath, path.dirname(packageConfigPath)) | ||
); | ||
const expoModuleConfig = requireAndResolveExpoModuleConfig( | ||
@@ -41,0 +43,0 @@ path.join(packagePath, path.basename(packageConfigPath)) |
import findUp from 'find-up'; | ||
import fs from 'fs-extra'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
@@ -4,0 +4,0 @@ |
import { | ||
AndroidGradleAarProjectDescriptor, | ||
AndroidGradlePluginDescriptor, | ||
AndroidPublication, | ||
RawExpoModuleConfig, | ||
@@ -121,2 +122,9 @@ RawModuleConfigApple, | ||
/** | ||
* Returns the publication config for Android. | ||
*/ | ||
androidPublication(): AndroidPublication | undefined { | ||
return this.rawConfig.android?.publication; | ||
} | ||
/** | ||
* Returns core features required by the module author. | ||
@@ -123,0 +131,0 @@ */ |
import glob from 'fast-glob'; | ||
import fs from 'fs-extra'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
@@ -19,3 +19,7 @@ | ||
const generatedFileContent = await generatePackageListFileContentAsync(modules, namespace); | ||
await fs.outputFile(targetPath, generatedFileContent); | ||
const parentPath = path.dirname(targetPath); | ||
if (!fs.existsSync(parentPath)) { | ||
await fs.promises.mkdir(parentPath, { recursive: true }); | ||
} | ||
await fs.promises.writeFile(targetPath, generatedFileContent, 'utf8'); | ||
} | ||
@@ -91,2 +95,3 @@ | ||
const coreFeatures = revision.config?.coreFeatures() ?? []; | ||
const publication = revision.config?.androidPublication(); | ||
@@ -100,2 +105,3 @@ return { | ||
...(coreFeatures.length > 0 ? { coreFeatures } : {}), | ||
...(publication ? { publication } : {}), | ||
}; | ||
@@ -109,3 +115,3 @@ } | ||
try { | ||
const contents = await fs.readFile(propsFile, 'utf8'); | ||
const contents = await fs.promises.readFile(propsFile, 'utf8'); | ||
const extraMavenReposString = searchGradlePropertyFirst(contents, ANDROID_EXTRA_BUILD_DEPS_KEY); | ||
@@ -188,3 +194,3 @@ if (extraMavenReposString) { | ||
for (const file of files) { | ||
const fileContent = await fs.readFile(path.join(sourceDir, file), 'utf8'); | ||
const fileContent = await fs.promises.readFile(path.join(sourceDir, file), 'utf8'); | ||
@@ -191,0 +197,0 @@ const packageRegex = (() => { |
import spawnAsync from '@expo/spawn-async'; | ||
import glob from 'fast-glob'; | ||
import fs from 'fs-extra'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
@@ -85,3 +85,3 @@ | ||
try { | ||
const contents = await fs.readFile(propsFile, 'utf8'); | ||
const contents = await fs.promises.readFile(propsFile, 'utf8'); | ||
const podfileJson = JSON.parse(contents); | ||
@@ -112,4 +112,5 @@ if (podfileJson[APPLE_EXTRA_BUILD_DEPS_KEY]) { | ||
); | ||
await fs.outputFile(targetPath, generatedFileContent); | ||
const parentPath = path.dirname(targetPath); | ||
await fs.promises.mkdir(parentPath, { recursive: true }); | ||
await fs.promises.writeFile(targetPath, generatedFileContent, 'utf8'); | ||
} | ||
@@ -116,0 +117,0 @@ |
@@ -138,3 +138,3 @@ import fs from 'fs/promises'; | ||
} | ||
if (name === 'react-native') { | ||
if (name === 'react-native' || name === 'react-native-macos') { | ||
// Starting from version 0.76, the `react-native` package only defines platforms | ||
@@ -141,0 +141,0 @@ // when @react-native-community/cli-platform-android/ios is installed. |
@@ -88,2 +88,3 @@ import { ExpoModuleConfig } from './ExpoModuleConfig'; | ||
aarProjects?: ModuleAndroidAarProjectInfo[]; | ||
publication?: AndroidPublication; | ||
} | ||
@@ -151,2 +152,24 @@ | ||
/** | ||
* Information about the available publication of an Android AAR file. | ||
*/ | ||
export interface AndroidPublication { | ||
/** | ||
* The Maven artifact ID. | ||
*/ | ||
id: string; | ||
/** | ||
* The Maven group ID. | ||
*/ | ||
group: string; | ||
/** | ||
* The Maven version. | ||
*/ | ||
version: string; | ||
/** | ||
* The Maven repository. | ||
*/ | ||
repository: string; | ||
} | ||
/** | ||
* Represents a raw config specific to Apple platforms. | ||
@@ -246,2 +269,7 @@ */ | ||
gradleAarProjects?: AndroidGradleAarProjectDescriptor[]; | ||
/** | ||
* Information about the prebuilt AAR file. | ||
*/ | ||
publication?: AndroidPublication; | ||
}; | ||
@@ -248,0 +276,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
443494
7
2
5609
- Removedfs-extra@^9.1.0
- Removedat-least-node@1.0.0(transitive)
- Removedfs-extra@9.1.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedjsonfile@6.1.0(transitive)
- Removeduniversalify@2.0.1(transitive)