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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@forge/bundler

v6.1.16

Published

Default bundler for Forge apps

Downloads

62,103

Readme

Forge bundler

The bundler package is responsible for compiling the user code, including dependencies (NPM packages), into files that get uploaded to AWS Lambda.

This is required for two reasons:

  • Forge only runs JavaScript functions (on either sandbox or Node runtime), so TypeScript has to be compiled to JavaScript.
  • All files that the user code imports need to be available when the Forge function runs.

The bundler is used:

  • When deploying a Forge app (forge deploy)
  • When running an app locally (forge tunnel)

Implementation

Bundler uses webpack to compile user code.

Every entry point from the manifest (referenced in modules.function.handler) and resource for Native UI is compiled into a single JavaScript file containing all of its dependencies.

Sandbox runtime

Some built-in Node modules and globals are not exposed in the sandbox JavaScript environment. Accessing those at runtime would throw an error.

Where possible, the unavailable modules and globals are replaced with compatible implementations using ProvidePlugin and alias. If there is no point in providing an implementation altogether (e.g. dns module), it is replaced with a stub showing an "unsupported" message.

Some NPM modules provide different implementations for "browser" and "node" environments, based on package-browser-field-spec. Even though Forge functions run in Node.js, our environment is more compatible with "browser" implementations. The sandbox Webpack configuration sets the resolve options to prefer those.

Node runtime

The interface for the Forge functions is different from the XIS interface, see Node runtime: Technical Details. Therefore, a layer of wrapper code is required to convert the calls and responses.

To maintain the correspondence between AWS Lambda handler and the handler in the Forge manifest, the bundled user code is put into a new location, with the wrapper code left in the original place. For example, if the manifest specifies index.run as the handler, AWS Lambda function will have:

  • index.js - wrapper code
  • bundled/index.js - bundled user code from src/index.js

The wrapper code, when invoked:

  • Parses the invocation request from XIS
  • Sets up the environment (e.g. user variables) for the Forge function run
  • Loads the user code
  • Invokes the user code
  • Converts the result or error to the XIS response format and returns it

The wrapper cannot load the user code before the environment is set up, as any actions that the user code does upon initialization might fail (e.g. because the proxy token is not yet set up).

However, wrapper needs to know which exports to make available. This information is passed to the bundler from the manifest: if it contains index.run and index.another as handlers, then the wrapper for index.js will need to export run and another. Bundler uses BannerPlugin to add this as a constant to each wrapper.

To redirect console calls from the user code to Xen Logs Ingestor that backs forge logs and the Forge Developer console, occurrences console are replaced with a custom implementation via ProvidePlugin.

Native UI

TODO: Not documented