react/react-native
Extension happens at well-defined seams: JS spec files (Native*.js / *NativeComponent.js) + codegenConfig libraries in package.json feed codegen; TurboModuleRegistry and codegenNativeComponent/requireNativeComponent are the runtime registration points; AppRegistry.registerComponent(+setWrapperComponentProvider/setRootViewStyleProvider) registers root surfaces; community-cli-plugin exports composable Command objects (with unstable_createBundleCommandParser for custom parsers); createDevMiddleware exposes unstable_* hooks; metro-config exposes getDefaultConfig/mergeConfig/setFrameworkDefaults; the Gradle ReactExtension DSL and iOS RCTReactNativeFactoryDelegate/RCTDependencyProvider are the native wiring points; the feature-flag config and Fantom pragmas are repo-internal extension points.
- New TurboModule: author a `Native<Name>.js` spec (typed interface extending TurboModule) and fetch it with TurboModuleRegistry.getEnforcing('<Name>'); the react-native package's own specs are declared in package.json codegenConfig.libraries (FBReactNativeSpec, jsSrcsDir 'src', per-module ios unstableRequiresMainQueueSetup flags).
- New Fabric component: author a `*NativeComponent.js` spec consumed by codegenNativeComponent (options: interfaceOnly, paperComponentName, paperComponentNameDeprecated, excludedPlatforms); codegenNativeCommands generates the imperative command dispatchers; requireNativeComponent remains the runtime lookup.
- App registration seams: AppRegistry.registerComponent/registerConfig/registerRunnable; setWrapperComponentProvider wraps every root component; setRootViewStyleProvider injects root view styles; registerCallableModule exposes a JS module to native callers via BatchedBridge.
- CLI extension: @react-native/community-cli-plugin exports Command objects (bundleCommand, startCommand, codegenCommand, spmCommand) that any CLI config can register; unstable_createBundleCommandParser(additionalOptions) builds a commander parser with the base bundle options plus caller-supplied ones; unstable_buildBundleWithConfig lets embedders invoke bundling programmatically.
- Dev-middleware hooks: createDevMiddleware accepts unstable_eventReporter (structured event sink), unstable_experiments (enableOpenDebuggerRedirect, enableNetworkInspector, enableStandaloneFuseboxShell), unstable_toolLauncher (custom app launcher for the debugger frontend), unstable_customInspectorMessageHandler (per device/debugger-pair CDP handler), unstable_trackInspectorProxyEventLoopPerf.
- Metro config extension: getDefaultConfig(projectRoot) merges Metro defaults + reactNativeDefaults + frameworkDefaults; frameworks inject config via setFrameworkDefaults(); mergeConfig is re-exported for user overrides; resolver sets resolverMainFields ['react-native','browser','main'], platforms ['android','ios'], unstable_conditionNames ['react-native'].
- Android app wiring: subclass DefaultReactNativeHost/ReactNativeHost and return extra ReactPackage instances from getPackages(); ReactActivityDelegate exposes getLaunchOptions/createRootView overrides; the react-native-gradle-plugin exposes a `react {}` DSL (ReactExtension) plus settings-plugin ReactSettingsPlugin for autolinking.packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.kt#L191-197packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java#L64-85packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackage.ktpackages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt
- iOS app wiring: RCTReactNativeFactory takes an RCTReactNativeFactoryDelegate (RCTDefaultReactNativeFactoryDelegate provided); RCTDependencyProvider supplies autolinked dependencies; third-party Fabric components register through RCTComponentViewFactory's thirdPartyFabricComponentsProvider which the factory sets to itself.
- Feature-flag extension: add a definition (common|jsOnly scope, defaultValue, metadata{description,purpose,expectedReleaseValue,dateAdded}, ossReleaseStage, optional skipNativeAPI) in ReactNativeFeatureFlags.config.js and run `yarn featureflags` to regenerate JS/Java/C++ accessors; Fantom tests override flags via @fantom_flags pragmas.
- Consumer-facing presets: @react-native/jest-preset packages the preprocessor/resolver/setup for app tests; eslint-config-react-native + eslint-plugin-react-native + eslint-plugin-specs package the lint surface; @react-native/typescript-config ships tsconfig bases; babel-preset + metro-babel-transformer are the transform seam.