rnx-kit/packages/tools-react-native
React Native SDK Bot 756ddeba67
RELEASING: Releasing 44 package(s) (#3342)
Releases:
  @rnx-kit/third-party-notices@2.0.0
  @rnx-kit/cli@0.18.0
  @rnx-kit/metro-plugin-cyclic-dependencies-detector@2.0.0
  @rnx-kit/react-native-error-trace-decorator@2.0.0
  @rnx-kit/esbuild-plugin-import-path-remapper@3.0.0
  @rnx-kit/babel-plugin-import-path-remapper@2.0.0
  @rnx-kit/babel-preset-metro-react-native@2.0.0
  @rnx-kit/metro-plugin-duplicates-checker@3.0.0
  @rnx-kit/react-native-test-app-msal@4.0.0
  @rnx-kit/react-native-lazy-index@4.0.0
  @rnx-kit/tools-react-native@2.0.0
  @rnx-kit/typescript-service@2.0.0
  @rnx-kit/commitlint-lite@2.0.0
  @rnx-kit/metro-serializer@2.0.0
  @rnx-kit/tools-language@3.0.0
  @rnx-kit/metro-service@4.0.0
  @rnx-kit/metro-config@2.0.0
  @rnx-kit/bundle-diff@2.0.0
  @rnx-kit/align-deps@3.0.0
  @rnx-kit/tools-node@3.0.0
  @rnx-kit/tsconfig@2.0.0
  @rnx-kit/console@2.0.0
  @react-native-webapis/battery-status@0.2.0
  @react-native-webapis/web-storage@0.3.0
  @rnx-kit/esbuild-bundle-analyzer@0.3.0
  @rnx-kit/metro-serializer-esbuild@0.2.0
  @rnx-kit/rn-changelog-generator@0.5.0
  @rnx-kit/metro-plugin-typescript@0.5.0
  @rnx-kit/metro-resolver-symlinks@0.2.0
  @rnx-kit/react-native-auth@0.3.0
  @rnx-kit/react-native-host@0.5.0
  @rnx-kit/patcher-rnmacos@0.2.0
  @rnx-kit/tools-filesystem@0.1.0
  @rnx-kit/tools-workspaces@0.2.0
  @rnx-kit/eslint-plugin@0.8.0
  @rnx-kit/tools-android@0.2.0
  @rnx-kit/tools-windows@0.2.0
  @rnx-kit/jest-preset@0.2.0
  @rnx-kit/tools-apple@0.2.0
  @rnx-kit/tools-shell@0.2.0
  @rnx-kit/polyfills@0.2.0
  @rnx-kit/config@0.7.0
  @rnx-kit/build@0.7.1
  @rnx-kit/eslint-config@0.0.4

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-11 08:59:50 +02:00
..
src fix(cli): invalidate state if `pod install` was not run (#3330) 2024-09-04 21:07:12 +02:00
test feat(tools-react-native): add caching layer on top of `loadConfig` (#3261) 2024-08-06 18:48:48 +02:00
CHANGELOG.md RELEASING: Releasing 44 package(s) (#3342) 2024-09-11 08:59:50 +02:00
README.md feat(tools-react-native): add caching layer on top of `loadConfig` (#3261) 2024-08-06 18:48:48 +02:00
cache.d.ts feat(tools-react-native): add caching layer on top of `loadConfig` (#3261) 2024-08-06 18:48:48 +02:00
cache.js feat(tools-react-native): add caching layer on top of `loadConfig` (#3261) 2024-08-06 18:48:48 +02:00
context.d.ts feat(tools-react-native): add caching layer on top of `loadConfig` (#3261) 2024-08-06 18:48:48 +02:00
context.js feat(tools-react-native): add caching layer on top of `loadConfig` (#3261) 2024-08-06 18:48:48 +02:00
eslint.config.js chore: migrate to ESLint flat config (#2782) 2023-11-03 14:02:18 +01:00
metro.d.ts fix: ensure correct metro packages are used (#2730) 2023-10-13 06:51:42 +00:00
metro.js fix(metro-plugin-typescript): disable if unsupported Metro version (#2181) 2023-02-06 16:18:37 +01:00
package.json RELEASING: Releasing 44 package(s) (#3342) 2024-09-11 08:59:50 +02:00
platform.d.ts chore: ensure consistent import/export order (#2597) 2023-08-11 11:08:53 +02:00
platform.js Tools package (#498) 2021-08-21 10:17:49 +02:00
tsconfig.json feat(tsconfig): base TypeScript configs for working with Node (#2886) 2023-12-18 12:05:07 +01:00

README.md

@rnx-kit/tools-react-native

Build npm version

@rnx-kit/tools-react-native is a collection of supplemental react-native functions and types.

You can import the entire package, or, to save space, import individual categories:

import * as tools from "@rnx-kit/tools-react-native";

// Alternatively...
import * as metroTools from "@rnx-kit/tools-react-native/metro";
import * as platformTools from "@rnx-kit/tools-react-native/platform";
Category Type Name Description
platform AllPlatforms List of supported react-native platforms.
Category Function Description
context loadContext(root) Equivalent to calling loadConfig() from @react-native-community/cli, but the result is cached for faster subsequent accesses.
context resolveCommunityCLI(root, reactNativePath) Finds path to @react-native-community/cli.
metro findMetroPath(projectRoot) Finds the installation path of Metro.
metro getMetroVersion(projectRoot) Returns Metro version number.
metro requireModuleFromMetro(moduleName, fromDir) Imports specified module starting from the installation directory of the currently used metro version.
platform expandPlatformExtensions(platform, extensions) Returns a list of extensions that should be tried for the target platform in prioritized order.
platform getAvailablePlatforms(startDir) Returns a map of available React Native platforms. The result is cached.
platform getAvailablePlatformsUncached(startDir, platformMap) Returns a map of available React Native platforms. The result is NOT cached.
platform parsePlatform(val) Parse a string to ensure it maps to a valid react-native platform.
platform platformExtensions(platform) Returns file extensions that can be mapped to the target platform.