npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rnx-kit/react-native-error-trace-decorator

v2.0.0

Published

EXPERIMENTAL - USE WITH CAUTION - New package called react-native-error-trace-decorator

Downloads

2

Readme

@rnx-kit/react-native-error-trace-decorator

Build npm version

🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧

THIS TOOL IS EXPERIMENTAL — USE WITH CAUTION

🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧🚧

An experimental tool to symbolicate error stack traces for react-native apps containing multiple bundles.

Motivation

For react-native apps which are split across multiple bundles, the generated stack traces can be a bit confusing as the traces often points across multiple bundles.

This is how an error stack trace looks like for a react native app split into two bundles:

Error: Test Error Here
at value (address at /data/bundles/firstBundle/hermes.android.first.bundle:1:448970)
at ol (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:83916)
at ul (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:83778)
at ql (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:114629)
at Fa (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:101389)
at Ua (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:101247)
at La (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:101131)
at Ea (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:98552)
at dt (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:66522)
at _a (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:96208)
at li (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:106463)
at anonymous (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:116075)
at anonymous (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:438794)
at run (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:435789)
at runApplication (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:436267)
at apply (native)
at value (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:42976)
at anonymous (address at/data/bundles/secondBundle/hermes.android.second.bundle:1:41459)
at value (address at /data/bundles/secondBundle/hermes.android.second.bundle:1:42422)
at value (address at/data/bundles/secondBundle/hermes.android.second.bundle:1:41417)

As we can see, the above error stack refers to two separate bundles namely, hermes.android.first.bundle and hermes.android.second.bundle. In order to symbolicate this stack trace, we need to do the following:

  • Pick one line at a time from the stack trace file.
  • Figure out which bundle the current error line corresponds to.(in this case, either hermes.android.first.bundle or hermes.android.second.bundle).
  • Symbolicate the line using the corresponding sourcemap file.(e.g. hermes.android.first.bundle.map or hermes.android.second.bundle.map).
  • Continue the process for all the lines in the stack trace.

This following process can get increasingly difficult, as the number of bundles increase. This tool aims at simplifying the process.

Installation

yarn add @rnx-kit/react-native-error-trace-decorator --dev

or if you're using npm

npm add --save-dev @rnx-kit/react-native-error-trace-decorator

Usage

In order to work, this tool requires some basic information, namely, a text file containing the error stack trace and a configuration file in the following format:

config.json

{
  "configs": [
    {
      "bundleIdentifier": "hermes.android.first.bundle",
      "sourcemap": "./hermes.android.first.bundle.map"
    },
    {
      "bundleIdentifier": "hermes.android.second.bundle",
      "sourcemap": "./hermes.android.second.bundle.map"
    }
  ]
}

Each entry in the configs array should contain a bundleIdentifier and a sourcemap parameter. Each config corresponds to a bundle.

  • bundleIdentifier - This should contain a string which can be used to identify a particular bundle in the error stack. For instance, firstBundle/hermes.android.first.bundle can be an identifier for the first bundle in the error stack and similarly secondBundle/hermes.android.second.bundle can be an identifier for the second bundle and so on.
  • sourcemap - This should contain a path to the sourcemap file corresponding to the bundle passed in the bundleIdentifier field.

If the tool is added as a dependency in your package, run the following:

yarn react-native-error-trace-decorator --errorFile <path_to_the_error_file> --configFile <path_to_the_config_file>

Alternatively, this tool can be directly run using npx,

npx @rnx-kit/react-native-error-trace-decorator --errorFile <path_to_the_error_file> --configFile <path_to_the_config_file>