mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fix: update Flowtate types for js scripts, pt1
This commit is contained in:
+1
-1
@@ -23,7 +23,7 @@ function generatePackageSwift(
|
||||
projectRoot /*: string */,
|
||||
outputDir /*: string */,
|
||||
reactNativePath /*: string */,
|
||||
) /*: string */ {
|
||||
) {
|
||||
const fullOutputPath = path.join(projectRoot, outputDir);
|
||||
fs.mkdirSync(outputDir, {recursive: true});
|
||||
// Generate PAckage.swift File
|
||||
|
||||
@@ -1,336 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
/**
|
||||
* Script to create symlinks for header files in React/includes/React
|
||||
*
|
||||
* This script:
|
||||
* 1. Scans the React and Libraries directories to build a map of header files
|
||||
* 2. Iterates over an array of headers
|
||||
* 3. Looks up each header in the map and creates a symlink in React/includes/React
|
||||
*/
|
||||
|
||||
// Import the headers array from headers.js
|
||||
const {HEADERS} = require('./headers');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
/**
|
||||
* Function to recursively scan directories and build a map of header files
|
||||
* @param {string} directory - Directory to scan for header files
|
||||
* @returns {Map<string, string>} Map of filename to full path
|
||||
*/
|
||||
function buildHeaderMap(directory) {
|
||||
const headerMap = new Map();
|
||||
|
||||
function scanDirectory(dir) {
|
||||
const entries = fs.readdirSync(dir, {withFileTypes: true});
|
||||
|
||||
for (const entry of entries) {
|
||||
const fullPath = path.join(dir, entry.name);
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
scanDirectory(fullPath);
|
||||
} else if (entry.isFile() && entry.name.endsWith('.h')) {
|
||||
// Store by filename only, without any subpath
|
||||
headerMap.set(entry.name, fullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scanDirectory(directory);
|
||||
return headerMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates symlinks for header files in React/includes/React
|
||||
* @param {string} reactNativePath - Path to the React Native package directory
|
||||
* @returns {Promise<{found: number, notFound: number, errors: number}>} Statistics about the operation
|
||||
*/
|
||||
async function createSymlinks(reactNativePath) {
|
||||
console.log(`Creating symlinks for React Native at: ${reactNativePath}`);
|
||||
|
||||
// Define paths based on the provided reactNativePath
|
||||
const REACT_DIR = path.join(reactNativePath, 'React');
|
||||
const LIBRARIES_DIR = path.join(reactNativePath, 'Libraries');
|
||||
const DESTINATION_DIR = path.join(reactNativePath, 'React/includes/React');
|
||||
|
||||
// Validate that the directories exist
|
||||
if (!fs.existsSync(REACT_DIR)) {
|
||||
throw new Error(`React directory not found: ${REACT_DIR}`);
|
||||
}
|
||||
|
||||
if (!fs.existsSync(LIBRARIES_DIR)) {
|
||||
throw new Error(`Libraries directory not found: ${LIBRARIES_DIR}`);
|
||||
}
|
||||
|
||||
// Ensure destination directory exists
|
||||
if (!fs.existsSync(DESTINATION_DIR)) {
|
||||
console.log(`Creating directory: ${DESTINATION_DIR}`);
|
||||
fs.mkdirSync(DESTINATION_DIR, {recursive: true});
|
||||
}
|
||||
|
||||
console.log('Building header file map...');
|
||||
|
||||
// Build a map of all header files in React and Libraries directories
|
||||
const reactHeaderMap = buildHeaderMap(REACT_DIR);
|
||||
const librariesHeaderMap = buildHeaderMap(LIBRARIES_DIR);
|
||||
|
||||
// Merge the two maps, with React headers taking precedence
|
||||
const headerMap = new Map([...librariesHeaderMap, ...reactHeaderMap]);
|
||||
|
||||
console.log(`Found ${headerMap.size} unique header files`);
|
||||
|
||||
// Counter for statistics
|
||||
let found = 0;
|
||||
let notFound = 0;
|
||||
let errors = 0;
|
||||
|
||||
// Arrays to collect headers that couldn't be found or had errors
|
||||
const notFoundHeaders = [];
|
||||
const errorHeaders = [];
|
||||
|
||||
// Process each header
|
||||
HEADERS.forEach(header => {
|
||||
try {
|
||||
// Extract just the filename for both search and target
|
||||
let targetFilename = header;
|
||||
|
||||
// Handle headers with path components
|
||||
if (header.includes('/')) {
|
||||
const parts = header.split('/');
|
||||
targetFilename = parts[parts.length - 1];
|
||||
}
|
||||
|
||||
// Look up the header in our map using just the filename
|
||||
const sourcePath = headerMap.get(targetFilename);
|
||||
|
||||
if (sourcePath) {
|
||||
const destPath = path.join(DESTINATION_DIR, targetFilename);
|
||||
|
||||
// Create symlink
|
||||
if (fs.existsSync(destPath)) {
|
||||
fs.unlinkSync(destPath);
|
||||
}
|
||||
|
||||
// Create relative symlink
|
||||
const relativeSourcePath = path.relative(DESTINATION_DIR, sourcePath);
|
||||
fs.symlinkSync(relativeSourcePath, destPath);
|
||||
|
||||
console.log(
|
||||
`Created symlink: ${targetFilename} -> ${relativeSourcePath}`,
|
||||
);
|
||||
found++;
|
||||
} else {
|
||||
console.warn(
|
||||
`Warning: Could not find header file: ${header} (filename: ${targetFilename})`,
|
||||
);
|
||||
notFoundHeaders.push({header, targetFilename});
|
||||
notFound++;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error processing ${header}: ${error.message}`);
|
||||
errorHeaders.push({header, error: error.message});
|
||||
errors++;
|
||||
}
|
||||
});
|
||||
|
||||
// Create symlinks from ReactApple/Libraries structure
|
||||
console.log('\nProcessing ReactApple/Libraries...');
|
||||
const reactAppleLibrariesDir = path.join(
|
||||
reactNativePath,
|
||||
'ReactApple/Libraries',
|
||||
);
|
||||
|
||||
if (fs.existsSync(reactAppleLibrariesDir)) {
|
||||
const libraryNames = fs
|
||||
.readdirSync(reactAppleLibrariesDir, {withFileTypes: true})
|
||||
.filter(entry => entry.isDirectory())
|
||||
.map(entry => entry.name);
|
||||
|
||||
for (const libraryName of libraryNames) {
|
||||
const libraryPath = path.join(reactAppleLibrariesDir, libraryName);
|
||||
|
||||
// Find all library-subname directories
|
||||
const subLibraries = fs
|
||||
.readdirSync(libraryPath, {withFileTypes: true})
|
||||
.filter(entry => entry.isDirectory())
|
||||
.map(entry => entry.name);
|
||||
|
||||
for (const subLibraryName of subLibraries) {
|
||||
const exportedDir = path.join(libraryPath, subLibraryName, 'Exported');
|
||||
|
||||
if (fs.existsSync(exportedDir)) {
|
||||
console.log(
|
||||
`Found exported headers in: ${libraryName}/${subLibraryName}`,
|
||||
);
|
||||
|
||||
// Create the includes/<library-subname> directory if it doesn't exist
|
||||
const includesSubDir = path.join(
|
||||
reactNativePath,
|
||||
'React/includes',
|
||||
subLibraryName,
|
||||
);
|
||||
if (!fs.existsSync(includesSubDir)) {
|
||||
console.log(`Creating directory: ${includesSubDir}`);
|
||||
fs.mkdirSync(includesSubDir, {recursive: true});
|
||||
}
|
||||
|
||||
// Find all header files in the Exported directory
|
||||
const headerFiles = fs
|
||||
.readdirSync(exportedDir, {withFileTypes: true})
|
||||
.filter(entry => entry.isFile() && entry.name.endsWith('.h'))
|
||||
.map(entry => entry.name);
|
||||
|
||||
for (const headerFile of headerFiles) {
|
||||
try {
|
||||
const sourcePath = path.join(exportedDir, headerFile);
|
||||
const destPath = path.join(includesSubDir, headerFile);
|
||||
|
||||
// Remove existing symlink/file if it exists
|
||||
if (fs.existsSync(destPath)) {
|
||||
fs.unlinkSync(destPath);
|
||||
}
|
||||
|
||||
// Create relative symlink
|
||||
const relativeSourcePath = path.relative(
|
||||
includesSubDir,
|
||||
sourcePath,
|
||||
);
|
||||
fs.symlinkSync(relativeSourcePath, destPath);
|
||||
|
||||
console.log(
|
||||
`Created ReactApple symlink: ${subLibraryName}/${headerFile} -> ${relativeSourcePath}`,
|
||||
);
|
||||
found++;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`Error creating ReactApple symlink for ${headerFile}: ${error.message}`,
|
||||
);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log('ReactApple/Libraries directory not found, skipping...');
|
||||
}
|
||||
|
||||
// Create symlinks for Yoga public headers
|
||||
console.log('\nProcessing Yoga headers...');
|
||||
const yogaHeadersDir = path.join(reactNativePath, 'ReactCommon/yoga/yoga');
|
||||
|
||||
if (fs.existsSync(yogaHeadersDir)) {
|
||||
// Create the includes/yoga directory if it doesn't exist
|
||||
const includesYogaDir = path.join(reactNativePath, 'React/includes/yoga');
|
||||
if (!fs.existsSync(includesYogaDir)) {
|
||||
console.log(`Creating directory: ${includesYogaDir}`);
|
||||
fs.mkdirSync(includesYogaDir, {recursive: true});
|
||||
}
|
||||
|
||||
// Get header files directly in the yoga directory (ignore subfolders)
|
||||
const yogaEntries = fs.readdirSync(yogaHeadersDir, {withFileTypes: true});
|
||||
const yogaHeaderFiles = yogaEntries
|
||||
.filter(entry => entry.isFile() && entry.name.endsWith('.h'))
|
||||
.map(entry => entry.name);
|
||||
|
||||
console.log(`Found ${yogaHeaderFiles.length} Yoga header files`);
|
||||
|
||||
for (const headerFile of yogaHeaderFiles) {
|
||||
try {
|
||||
const sourcePath = path.join(yogaHeadersDir, headerFile);
|
||||
const destPath = path.join(includesYogaDir, headerFile);
|
||||
|
||||
// Remove existing symlink/file if it exists
|
||||
if (fs.existsSync(destPath)) {
|
||||
fs.unlinkSync(destPath);
|
||||
}
|
||||
|
||||
// Create relative symlink
|
||||
const relativeSourcePath = path.relative(includesYogaDir, sourcePath);
|
||||
fs.symlinkSync(relativeSourcePath, destPath);
|
||||
|
||||
console.log(
|
||||
`Created Yoga symlink: yoga/${headerFile} -> ${relativeSourcePath}`,
|
||||
);
|
||||
found++;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`Error creating Yoga symlink for ${headerFile}: ${error.message}`,
|
||||
);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log('ReactCommon/yoga/yoga directory not found, skipping...');
|
||||
}
|
||||
|
||||
console.log('\nSummary:');
|
||||
console.log(`- Found and linked: ${found} files`);
|
||||
console.log(`- Not found: ${notFound} files`);
|
||||
console.log(`- Errors: ${errors} files`);
|
||||
|
||||
if (notFound > 0) {
|
||||
console.log('\nHeaders that could not be found:');
|
||||
notFoundHeaders.forEach(({header, targetFilename}) => {
|
||||
console.log(` - ${header} (filename: ${targetFilename})`);
|
||||
});
|
||||
}
|
||||
|
||||
if (errors > 0) {
|
||||
console.log('\nHeaders that had errors:');
|
||||
errorHeaders.forEach(({header, error}) => {
|
||||
console.log(` - ${header}: ${error}`);
|
||||
});
|
||||
}
|
||||
|
||||
if (notFound > 0 || errors > 0) {
|
||||
const message = 'Some headers could not be found or had errors.';
|
||||
console.log(`\n${message}`);
|
||||
throw new Error(message);
|
||||
} else {
|
||||
console.log('\nAll headers were successfully linked.');
|
||||
}
|
||||
|
||||
return {found, notFound, errors};
|
||||
}
|
||||
|
||||
// CLI usage
|
||||
if (require.main === module) {
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
let reactNativePath;
|
||||
|
||||
if (args.length >= 1) {
|
||||
reactNativePath = path.resolve(args[0]);
|
||||
} else {
|
||||
// Default to the current package directory structure for backward compatibility
|
||||
reactNativePath = path.resolve(__dirname, '..');
|
||||
}
|
||||
|
||||
console.log('Usage: node create-symlinks.js [reactNativePath]');
|
||||
console.log(`Using React Native path: ${reactNativePath}`);
|
||||
|
||||
createSymlinks(reactNativePath)
|
||||
.then(stats => {
|
||||
console.log('\n✅ Symlink creation completed successfully!');
|
||||
process.exit(0);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('\n❌ Symlink creation failed:', error.message);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createSymlinks,
|
||||
buildHeaderMap,
|
||||
};
|
||||
-281
@@ -1,281 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
const headers = [
|
||||
'CoreModulesPlugins.h',
|
||||
'FBXXHashUtils.h',
|
||||
'NSTextStorage+FontScaling.h',
|
||||
'RCTAccessibilityManager+Internal.h',
|
||||
'RCTAccessibilityManager.h',
|
||||
'RCTActionSheetManager.h',
|
||||
'RCTActivityIndicatorView.h',
|
||||
'RCTActivityIndicatorViewManager.h',
|
||||
'RCTAdditionAnimatedNode.h',
|
||||
'RCTAlertController.h',
|
||||
'RCTAlertManager.h',
|
||||
'RCTAnimatedImage.h',
|
||||
'RCTAnimatedNode.h',
|
||||
'RCTAnimationDriver.h',
|
||||
'RCTAnimationPlugins.h',
|
||||
'RCTAnimationType.h',
|
||||
'RCTAnimationUtils.h',
|
||||
'RCTAppState.h',
|
||||
'RCTAppearance.h',
|
||||
'RCTAssert.h',
|
||||
'RCTAutoInsetsProtocol.h',
|
||||
'RCTBackedTextInputDelegate.h',
|
||||
'RCTBackedTextInputDelegateAdapter.h',
|
||||
'RCTBackedTextInputViewProtocol.h',
|
||||
'RCTBaseTextInputShadowView.h',
|
||||
'RCTBaseTextInputView.h',
|
||||
'RCTBaseTextInputViewManager.h',
|
||||
'RCTBaseTextShadowView.h',
|
||||
'RCTBaseTextViewManager.h',
|
||||
'RCTBlobManager.h',
|
||||
'RCTBorderCurve.h',
|
||||
'RCTBorderDrawing.h',
|
||||
'RCTBorderStyle.h',
|
||||
'RCTBridge+Inspector.h',
|
||||
'RCTBridge+Private.h',
|
||||
'RCTBridge.h',
|
||||
'RCTBridgeConstants.h',
|
||||
'RCTBridgeDelegate.h',
|
||||
'RCTBridgeMethod.h',
|
||||
'RCTBridgeModule.h',
|
||||
'RCTBridgeModuleDecorator.h',
|
||||
'RCTBridgeProxy+Cxx.h',
|
||||
'RCTBridgeProxy.h',
|
||||
'RCTBundleAssetImageLoader.h',
|
||||
'RCTBundleManager.h',
|
||||
'RCTBundleURLProvider.h',
|
||||
'RCTCallInvoker.h',
|
||||
'RCTCallInvokerModule.h',
|
||||
'RCTClipboard.h',
|
||||
'RCTColorAnimatedNode.h',
|
||||
'RCTComponent.h',
|
||||
'RCTComponentData.h',
|
||||
'RCTComponentEvent.h',
|
||||
'RCTConstants.h',
|
||||
'RCTConvert+CoreLocation.h',
|
||||
'RCTConvert+Text.h',
|
||||
'RCTConvert+Transform.h',
|
||||
'RCTConvert.h',
|
||||
'RCTCursor.h',
|
||||
'RCTCxxConvert.h',
|
||||
'RCTDataRequestHandler.h',
|
||||
'RCTDebuggingOverlay.h',
|
||||
'RCTDebuggingOverlayManager.h',
|
||||
'RCTDecayAnimation.h',
|
||||
'RCTDefines.h',
|
||||
'RCTDevLoadingView.h',
|
||||
'RCTDevLoadingViewProtocol.h',
|
||||
'RCTDevLoadingViewSetEnabled.h',
|
||||
'RCTDevMenu.h',
|
||||
'RCTDevSettings.h',
|
||||
'RCTDevToolsRuntimeSettingsModule.h',
|
||||
'RCTDeviceInfo.h',
|
||||
'RCTDiffClampAnimatedNode.h',
|
||||
'RCTDisplayLink.h',
|
||||
'RCTDisplayWeakRefreshable.h',
|
||||
'RCTDivisionAnimatedNode.h',
|
||||
'RCTDynamicTypeRamp.h',
|
||||
'RCTErrorCustomizer.h',
|
||||
'RCTErrorInfo.h',
|
||||
'RCTEventAnimation.h',
|
||||
'RCTEventDispatcher.h',
|
||||
'RCTEventDispatcherProtocol.h',
|
||||
'RCTEventEmitter.h',
|
||||
'RCTExceptionsManager.h',
|
||||
'RCTFPSGraph.h',
|
||||
'RCTFileReaderModule.h',
|
||||
'RCTFileRequestHandler.h',
|
||||
'RCTFont.h',
|
||||
'RCTFrameAnimation.h',
|
||||
'RCTFrameUpdate.h',
|
||||
'RCTGIFImageDecoder.h',
|
||||
'RCTHTTPRequestHandler.h',
|
||||
'RCTI18nManager.h',
|
||||
'RCTI18nUtil.h',
|
||||
'RCTImageBlurUtils.h',
|
||||
'RCTImageCache.h',
|
||||
'RCTImageDataDecoder.h',
|
||||
'RCTImageEditingManager.h',
|
||||
'RCTImageLoader.h',
|
||||
'RCTImageLoaderLoggable.h',
|
||||
'RCTImageLoaderProtocol.h',
|
||||
'RCTImageLoaderWithAttributionProtocol.h',
|
||||
'RCTImagePlugins.h',
|
||||
'RCTImageShadowView.h',
|
||||
'RCTImageSource.h',
|
||||
'RCTImageStoreManager.h',
|
||||
'RCTImageURLLoader.h',
|
||||
'RCTImageURLLoaderWithAttribution.h',
|
||||
'RCTImageUtils.h',
|
||||
'RCTImageView.h',
|
||||
'RCTImageViewManager.h',
|
||||
'RCTInitializing.h',
|
||||
'RCTInputAccessoryShadowView.h',
|
||||
'RCTInputAccessoryView.h',
|
||||
'RCTInputAccessoryViewContent.h',
|
||||
'RCTInputAccessoryViewManager.h',
|
||||
'Inspector/RCTInspector.h',
|
||||
'DevSupport/RCTInspectorDevServerHelper.h',
|
||||
'DevSupport/RCTInspectorNetworkHelper.h',
|
||||
'RCTInspectorNetworkReporter.h',
|
||||
'RCTInspectorPackagerConnection.h',
|
||||
'RCTInspectorUtils.h',
|
||||
'RCTInterpolationAnimatedNode.h',
|
||||
'RCTInvalidating.h',
|
||||
'RCTJSStackFrame.h',
|
||||
'RCTJSThread.h',
|
||||
'RCTJavaScriptExecutor.h',
|
||||
'RCTJavaScriptLoader.h',
|
||||
'RCTKeyCommands.h',
|
||||
'RCTKeyboardObserver.h',
|
||||
'RCTLayout.h',
|
||||
'RCTLayoutAnimation.h',
|
||||
'RCTLayoutAnimationGroup.h',
|
||||
'RCTLinkingManager.h',
|
||||
'RCTLinkingPlugins.h',
|
||||
'RCTLocalAssetImageLoader.h',
|
||||
'RCTLocalizedString.h',
|
||||
'RCTLog.h',
|
||||
'RCTLogBox.h',
|
||||
'RCTLogBoxView.h',
|
||||
'RCTMacros.h',
|
||||
'RCTManagedPointer.h',
|
||||
'RCTMockDef.h',
|
||||
'RCTModalHostView.h',
|
||||
'RCTModalHostViewController.h',
|
||||
'RCTModalHostViewManager.h',
|
||||
'RCTModalManager.h',
|
||||
'RCTModuleData.h',
|
||||
'RCTModuleMethod.h',
|
||||
'RCTModuloAnimatedNode.h',
|
||||
'RCTMultilineTextInputView.h',
|
||||
'RCTMultilineTextInputViewManager.h',
|
||||
'RCTMultipartDataTask.h',
|
||||
'RCTMultipartStreamReader.h',
|
||||
'RCTMultiplicationAnimatedNode.h',
|
||||
'RCTNativeAnimatedModule.h',
|
||||
'RCTNativeAnimatedNodesManager.h',
|
||||
'RCTNativeAnimatedTurboModule.h',
|
||||
'RCTNetworkPlugins.h',
|
||||
'RCTNetworkTask.h',
|
||||
'RCTNetworking.h',
|
||||
'RCTNullability.h',
|
||||
'RCTObjectAnimatedNode.h',
|
||||
'RCTPLTag.h',
|
||||
'RCTPackagerClient.h',
|
||||
'RCTPackagerConnection.h',
|
||||
'RCTParserUtils.h',
|
||||
'RCTPausedInDebuggerOverlayController.h',
|
||||
'RCTPerformanceLogger.h',
|
||||
'RCTPerformanceLoggerLabels.h',
|
||||
'RCTPlatform.h',
|
||||
'RCTPointerEvents.h',
|
||||
'RCTProfile.h',
|
||||
'RCTPropsAnimatedNode.h',
|
||||
'RCTRawTextShadowView.h',
|
||||
'RCTRawTextViewManager.h',
|
||||
'RCTReconnectingWebSocket.h',
|
||||
'RCTRedBox.h',
|
||||
'RCTRedBoxExtraDataViewController.h',
|
||||
'RCTRedBoxSetEnabled.h',
|
||||
'RCTRefreshControl.h',
|
||||
'RCTRefreshControlManager.h',
|
||||
'RCTRefreshableProtocol.h',
|
||||
'RCTReloadCommand.h',
|
||||
'RCTResizeMode.h',
|
||||
'RCTRootContentView.h',
|
||||
'RCTRootShadowView.h',
|
||||
'RCTRootView.h',
|
||||
'RCTRootViewDelegate.h',
|
||||
'RCTRootViewInternal.h',
|
||||
'RCTSafeAreaShadowView.h',
|
||||
'RCTSafeAreaView.h',
|
||||
'RCTSafeAreaViewLocalData.h',
|
||||
'RCTSafeAreaViewManager.h',
|
||||
'RCTScrollContentShadowView.h',
|
||||
'RCTScrollContentView.h',
|
||||
'RCTScrollContentViewManager.h',
|
||||
'RCTScrollEvent.h',
|
||||
'RCTScrollView.h',
|
||||
'RCTScrollViewManager.h',
|
||||
'RCTScrollableProtocol.h',
|
||||
'RCTSettingsManager.h',
|
||||
'RCTSettingsPlugins.h',
|
||||
'RCTShadowView+Internal.h',
|
||||
'RCTShadowView+Layout.h',
|
||||
'RCTShadowView.h',
|
||||
'RCTSinglelineTextInputView.h',
|
||||
'RCTSinglelineTextInputViewManager.h',
|
||||
'RCTSourceCode.h',
|
||||
'RCTSpringAnimation.h',
|
||||
'RCTStatusBarManager.h',
|
||||
'RCTStyleAnimatedNode.h',
|
||||
'RCTSubtractionAnimatedNode.h',
|
||||
'RCTSurface.h',
|
||||
'RCTSurfaceDelegate.h',
|
||||
'RCTSurfaceHostingProxyRootView.h',
|
||||
'RCTSurfaceHostingView.h',
|
||||
'RCTSurfacePresenterStub.h',
|
||||
'RCTSurfaceProtocol.h',
|
||||
'RCTSurfaceRootShadowView.h',
|
||||
'RCTSurfaceRootShadowViewDelegate.h',
|
||||
'RCTSurfaceRootView.h',
|
||||
'RCTSurfaceSizeMeasureMode.h',
|
||||
'RCTSurfaceStage.h',
|
||||
'RCTSurfaceView+Internal.h',
|
||||
'RCTSurfaceView.h',
|
||||
'RCTSwitch.h',
|
||||
'RCTSwitchManager.h',
|
||||
'RCTTextAttributes.h',
|
||||
'RCTTextDecorationLineType.h',
|
||||
'RCTTextSelection.h',
|
||||
'RCTTextShadowView.h',
|
||||
'RCTTextTransform.h',
|
||||
'RCTTextView.h',
|
||||
'RCTTextViewManager.h',
|
||||
'RCTTiming.h',
|
||||
'RCTTouchEvent.h',
|
||||
'RCTTouchHandler.h',
|
||||
'RCTTrackingAnimatedNode.h',
|
||||
'RCTTransformAnimatedNode.h',
|
||||
'RCTTurboModuleRegistry.h',
|
||||
'RCTUIImageViewAnimated.h',
|
||||
'RCTUIManager.h',
|
||||
'RCTUIManagerObserverCoordinator.h',
|
||||
'RCTUIManagerUtils.h',
|
||||
'RCTUITextField.h',
|
||||
'RCTUITextView.h',
|
||||
'RCTURLRequestDelegate.h',
|
||||
'RCTURLRequestHandler.h',
|
||||
'RCTUtils.h',
|
||||
'RCTUtilsUIOverride.h',
|
||||
'RCTValueAnimatedNode.h',
|
||||
'RCTVersion.h',
|
||||
'RCTVibration.h',
|
||||
'RCTVibrationPlugins.h',
|
||||
'RCTView.h',
|
||||
'RCTViewManager.h',
|
||||
'RCTViewUtils.h',
|
||||
'RCTVirtualTextShadowView.h',
|
||||
'RCTVirtualTextView.h',
|
||||
'RCTVirtualTextViewManager.h',
|
||||
'RCTWebSocketModule.h',
|
||||
'RCTWrapperViewController.h',
|
||||
'UIView+Private.h',
|
||||
'UIView+React.h',
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
HEADERS: headers,
|
||||
};
|
||||
+37
-26
@@ -12,6 +12,10 @@ const {execSync} = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
/*::
|
||||
type RequiredHeaders = 'react-native' | 'codegen' | 'third-party-dependencies' | 'all';
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prepares app dependencies headers for SwiftPM integration
|
||||
* @param {string} reactNativePath - Path to the React Native directory
|
||||
@@ -20,11 +24,11 @@ const path = require('path');
|
||||
* @param {string} requiredHeaders - Type of headers to include: 'react-native', 'codegen', 'third-party-dependencies', or 'all'
|
||||
*/
|
||||
function prepareAppDependenciesHeaders(
|
||||
reactNativePath,
|
||||
iosAppPath,
|
||||
outputFolder,
|
||||
requiredHeaders,
|
||||
) {
|
||||
reactNativePath /*: string */,
|
||||
iosAppPath /*: string */,
|
||||
outputFolder /*: string */,
|
||||
requiredHeaders /*: RequiredHeaders */,
|
||||
) /*: void */ {
|
||||
// Validate parameters
|
||||
if (!reactNativePath || !iosAppPath || !outputFolder || !requiredHeaders) {
|
||||
throw new Error(
|
||||
@@ -99,10 +103,10 @@ function prepareAppDependenciesHeaders(
|
||||
* @param {string} folderName - Name of the folder where headers will be created (default: 'headers')
|
||||
*/
|
||||
function hardlinkReactNativeHeaders(
|
||||
reactNativePath,
|
||||
outputFolder,
|
||||
folderName = 'headers',
|
||||
) {
|
||||
reactNativePath /*: string */,
|
||||
outputFolder /*: string */,
|
||||
folderName /*: string */ = 'headers',
|
||||
) /*: void */ {
|
||||
console.log('Creating hard links for React Native headers...');
|
||||
|
||||
const headersOutput = path.join(outputFolder, folderName);
|
||||
@@ -215,12 +219,12 @@ function hardlinkReactNativeHeaders(
|
||||
* @returns {number} Number of hard links created
|
||||
*/
|
||||
function hardlinkHeadersFromPath(
|
||||
sourcePath,
|
||||
outputPath,
|
||||
preserveStructure,
|
||||
excludeFolders,
|
||||
customMappings = {},
|
||||
) {
|
||||
sourcePath /*: string */,
|
||||
outputPath /*: string */,
|
||||
preserveStructure /*: boolean */,
|
||||
excludeFolders /*: Array<string> */,
|
||||
customMappings /*: {[string]: string} */ = {},
|
||||
) /*: number */ {
|
||||
let linkedCount = 0;
|
||||
|
||||
try {
|
||||
@@ -299,7 +303,10 @@ function hardlinkHeadersFromPath(
|
||||
* @param {string} headersOutput - Base headers output directory
|
||||
* @returns {number} Number of hard links created
|
||||
*/
|
||||
function hardlinkReactAppleHeaders(reactApplePath, headersOutput) {
|
||||
function hardlinkReactAppleHeaders(
|
||||
reactApplePath /*: string */,
|
||||
headersOutput /*: string */,
|
||||
) /*: number */ {
|
||||
let linkedCount = 0;
|
||||
|
||||
console.log(`Searching for headers in: ${reactApplePath}`);
|
||||
@@ -393,11 +400,11 @@ function hardlinkReactAppleHeaders(reactApplePath, headersOutput) {
|
||||
* @returns {number} Number of hard links created
|
||||
*/
|
||||
function hardlinkReactCommonHeaders(
|
||||
reactCommonPath,
|
||||
headersOutput,
|
||||
flattenPaths = [],
|
||||
specialMapping = {},
|
||||
) {
|
||||
reactCommonPath /*: string */,
|
||||
headersOutput /*: string */,
|
||||
flattenPaths /*: Array<string> */ = [],
|
||||
specialMapping /*: {[string]: string} */ = {},
|
||||
) /*: number */ {
|
||||
let linkedCount = 0;
|
||||
|
||||
console.log(`Searching for headers in: ${reactCommonPath}`);
|
||||
@@ -600,10 +607,10 @@ function hardlinkReactCommonHeaders(
|
||||
* @param {string} folderName - Name of the folder where headers will be created (default: 'headers')
|
||||
*/
|
||||
function hardlinkThirdPartyDependenciesHeaders(
|
||||
reactNativePath,
|
||||
outputFolder,
|
||||
folderName = 'headers',
|
||||
) {
|
||||
reactNativePath /*: string */,
|
||||
outputFolder /*: string */,
|
||||
folderName /*: string */ = 'headers',
|
||||
) /*: void */ {
|
||||
console.log('Creating hard links for Third-Party Dependencies headers...');
|
||||
|
||||
// Look for ReactNativeDependencies.xcframework/Headers folder specifically
|
||||
@@ -679,7 +686,11 @@ function hardlinkThirdPartyDependenciesHeaders(
|
||||
/**
|
||||
* Create hard links for Codegen headers in the output folder
|
||||
*/
|
||||
function hardlinkCodegenHeaders(reactNativePath, iosAppPath, outputFolder) {
|
||||
function hardlinkCodegenHeaders(
|
||||
reactNativePath /*: string */,
|
||||
iosAppPath /*: string */,
|
||||
outputFolder /*: string */,
|
||||
) /*: void */ {
|
||||
console.log('Creating hard links for Codegen headers...');
|
||||
|
||||
// Look for ReactCodegen folder specifically
|
||||
|
||||
Reference in New Issue
Block a user