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

serverless-rollup-plugin

v5.0.1

Published

A plugin for the serverless framework to build lambda code using rollup

Downloads

807

Readme

Welcome to serverless-rollup-plugin 👋

Release Maintainability npm version FOSSA Status All Contributors

A plugin for the serverless framework to bundle lambda code using rollup

Install

npm install --save-dev serverless-rollup-plugin

Requires Node.js 18 and serverless 3.2.

Usage

Add the plugin to your serverless config:

plugins:
  - serverless-rollup-plugin
  - ...any other plugins

For each function that you would like to use rollup option, just define the handler option as normal. You can optionally define the dependencies property as a list of packages to be installed in the node_modules folder in your lambda.

testFunction:
  handler: src/functions/testFunction/index.handler
  dependencies:
    - aws-xray-sdk-core
  copyFiles:
    - some/glob/**/*.pattern

Config

By default, serverless-rollup-plugin will attempt to load rollup.config.js. In order to override this behavior, you can add the following to configuration options:

custom:
  rollup:
    config: ./custom-rollup.config.js

Using Yarn

By default if you specify function dependencies npm will be used. You can override this by setting the installCommand property, like this:

custom:
  rollup:
    installCommand: yarn add

Add Global Dependency

If you want to add a dependency for every lambda function (for example adding source map support), you can add them to the rollup dependencies property:

custom:
  rollup:
    dependencies:
      - some-package-name

Output Options

If you don't specify output settings in your rollup config, the following defaults will be used:

{
  "format": "cjs",
  "sourcemap": true
}

If the format is esm, the resulting package will use the mjs extension to make use of native lambda esm support.

Concurrency

By default, serverless-rollup-plugin will output rollup bundles concurrently. In systems with low memory, such as small CI instances, it may be necessary to limit the number concurrent outputs so as not to run out of memory. You can define the number of concurrent outputs by using the concurrency option:

custom:
  rollup:
    concurrency: 3

Any value other than a number will be treated as Number.POSITIVE_INFINITY.

Adding Sourcemap Support

You can easily get your lambda stack traces to show correct file/line information using the source-map-support package. To use this with the serverless-rollup-plugin, first install the package and add it to the universal dependencies:

custom:
  rollup:
    dependencies:
      - source-map-support

Then in your rollup config, set the output banner to install it:

export default {
  output: {
    format: "cjs",
    sourcemap: true,
    banner: "require('source-map-support').install();"
  }
};

If you do specify output settings, they will be used and only the file property will be overwritten.

Copying Resource Files

To copy a static file into your function deployment, use the copyFiles parameter. This parameter is an array of glob pattern strings, or objects with the following properties:

| Name | Required | Description | | ----------- | -------- | --------------------------------------------------------------- | | glob | Yes | A glob pattern | | srcBase | No | Part of the path that will be removed from the destination path | | destination | No | Destination path within the lambda's directory structure |

🧑‍💻 Contributors

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator