Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rnx-kit/config

Package Overview
Dependencies
Maintainers
7
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rnx-kit/config

Define and query information about a kit package

  • 0.4.23
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11K
increased by35.3%
Maintainers
7
Weekly downloads
 
Created
Source

@rnx-kit/config

Build npm version

Query for a package's configuration.

Configuration influences how the CLI behaves. If you're not using the CLI, and instead using a specific tool programmatically, you can use this library to read configuration data and use it as tool input.

Schema

Package configuration is under the top-level rnx-kit entry in package.hson. It is of type KitConfig.

KitConfig

NameTypeDescription
kitType"app", "library", undefinedLibrary or App package. Used by the dependency manager when projecting capabilities into dependencies, devDependencies, and peerDependencies. Library package dependencies are private, in dev and peer. App package dependencies are public.
reactNativeVersionstring, undefinedReact Native version (or range) which this package supports.
reactNativeDevVersionstring, undefinedReact Native version to use during development of this package. If not specified, the minimum reactNativeVersion is used.
bundleBundleConfig, undefinedBundler configuration for a package. If true, then all defaults will be used. If a BundleDefinition (or array) is given, the object(s) are a detailed specification of the bundling configurtion. If undefined, this package does not support bundling.
serverServerConfig, undefinedBundle server configuration. If not specified, this package does not support bundle serving.
capabilitiesCapability[], undefinedList of capabilities that this package needs. A capability is a well-known name (string).
customProfilesstring, undefinedPath to a file containing custom profiles.

BundleConfig

Union of: boolean, BundleDefinition, BundleDefinition[]

BundleDefinition inherits BundlerRuntimeParameters

NameTypeDefaultDescription
idstring, undefinedUnique identifier for this bundle definition. Only used as a reference within the build system.
targetsAllPlatforms[], undefinedThe platform(s) for which this package may be bundled.
platforms{[K in AllPlatforms]: BundleDefinition}, undefinedPlatform-specific overrides for bundling parameters. Any parameter not listed in an override gets its value from the shared bundle definition, or falls back to defaults.
entryPathstring, undefinedlib/index.jsPath to the .js file which is the entry-point for building the bundle. Either absolute, or relative to the package.
distPathstring, undefineddistPath where the bundle and source map files are written. Either absolute, or relative to the package.
assetsPathstring, undefineddistPath where all bundle assets (strings, images, fonts, sounds, ...) are written. Either absolute, or relative to the package.
bundlePrefixstring, undefinedindexPrefix for the bundle name, followed by the platform and either ".bundle" (win, android) or ".jsbundle" (mac, ios).
bundleEncodingstring, undefinedEncoding scheme to use when writing the bundle file. Currently limited to UTF-8, UTF-16 (little endian), and 7-bit ASCII.
sourceMapPathstring, undefinedPath to use when creating the bundle source map file. Either absolute, or relative to the package.
sourceMapSourceRootPathstring, undefinedPath to the package's source files. Used to make source-map paths relative and therefore portable.

AllPlatforms

Union of: "ios", "android", "windows", "win32", "macos"

BundlerRuntimeParameters

NameTypeDefaultDescription
detectCyclicDependenciesboolean, CyclicDetectorOptions, undefinedtrueChoose whether to detect cycles in the dependency graph. If true, then a default set of options will be used. If CyclicDetectorOptions is given, the object is a detailed specification of cyclic detector configuration.
detectDuplicateDependenciesboolean, DuplicateDetectorOptions, undefinedtrueChoose whether to detect duplicate packages in the dependency graph. If true, then a default set of options will be used. If DuplicateDetectorOptions is given, the object is a detailed specification of the duplicate detector configuration.
typescriptValidationboolean, undefinedtrueChoose whether to type-check the application during bundling and serving.
experimental_treeShakeboolean, undefinedfalseEXPERIMENTAL -- Choose whether to enable tree-shaking.

CyclicDetectorOptions

NameTypeDefaultDescription
includeNodeModulesboolean, undefinedfalseWhen scanning for circular dependencies, include all external packages from node_modules.
linesOfContextnumber, undefined1When a cycle is detected, this controls the size of the module backtrace that is printed with the error message.
throwOnErrorboolean, undefinedtrueWhether or not to throw an exception when a cycle is detected.

DuplicateDetectorOptions

NameTypeDefaultDescription
ignoredModulesstring[], undefinedList of modules to ignore when scanning for duplicate dependencies.
bannedModulesstring[], undefinedList of modules that always cause a failure, regardless of whether or not they are duplicated.
throwOnErrorboolean, undefinedtrueWhether or not to throw an exception when a duplicate or banned module is detected.

ServerConfig inherits BundlerRuntimeParameters

NameTypeDefaultDescription
projectRootstring, undefinedPath to the root of your react-native application. The bundle server uses this root path to resolve all web requests. The root path should contain your Babel config, otherwise Metro won't be able to find it. Either absolute, or relative to the package.
assetPluginsstring[], undefinedAdditional asset plugins to be used by the Metro Babel transformer. Comma-separated list containing plugin modules and/or absolute paths to plugin packages.
sourceExtsstring[], undefinedAdditional source-file extensions to include when generating bundles. Comma-separated list, excluding the leading dot.

API

getKitConfig({module, cwd})

Query for a package's configuration.

ParameterTypeDescription
modulestring, undefinedRead package configuration from the named module. When given, this takes precedence over cwd.
cwdstring, undefinedRead package configuration from the given directory. Ignored when module is given.
[Return]KitConfig, nullPackage configuration, or null if nothing was found.

getBundleDefinition(config, id)

Get a "complete" bundle definition from the package configuration.

If id is given, search for the matching bundle and return it. Otherwise, return the first bundle definition found.

ParameterTypeDescription
configBundleConfigThe bundle configuration, typically retrieved from the package configuration field rnx-kit.bundle.
idstring, undefinedThe id of the target bundle definition to use. This is not needed if only one bundle definition exists.
[Return]BundleDefinitionA "complete" bundle definition, with defaults applied for any missing values that have them.

getBundlePlatformDefinition(bundle, platform)

Get a platform bundle definition, applying any platform-specific overrides.

ParameterTypeDescription
bundleBundleDefinitionA "complete" bundle definition, typically from getBundleDefinition().
platformAllPlatformsThe platform to resolve.
[Return]BundleDefinitionThe input bundle definition with all platform-specific overrides applied.

getKitCapabilities(config)

Get capability information from the package configuration.

ParameterTypeDescription
configKitConfigPackage configuration.
[Return]KitCapabilitiesCapability information.
KitCapabilities
NameTypeDefaultDescription
kitType"app", "library", undefined"library"Library or App package. Used by the dependency manager when projecting capabilities into dependencies, devDependencies, and peerDependencies. Library package dependencies are private, in dev and peer. App package dependencies are public.
reactNativeVersionstringReact Native version (or range) which this package supports.
reactNativeDevVersionstringMin version in reactNativeVersionReact Native version to use during development of this package. If not specified, the minimum reactNativeVersion is used.
capabilitiesCapability[][]List of capabilities that this package needs. A capability is a well-known name (string).
customProfilesstring, undefinedPath to a file containing custom profiles.

getServerConfig(config)

Get a "complete" server configuration from the package configuration.

ParameterTypeDescription
configKitConfigThe package configuration, typically retrieved from with getKitConfig().
[Return]ServerConfigA "complete" server configuration, with defaults applied for any missing values that have them.

FAQs

Package last updated on 31 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc