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-bun/layer

v1.0.1

Published

A zero-config Serverless Framework plugin to automate the management of AWS Bun Lambda Layer.

Downloads

9

Readme

Serverless Bun Layer

A zero-config Serverless Framework plugin to automate the management of AWS Bun Lambda Layer.

Getting Started

Install the plugin with your favorite package manager:

npm install @serverless-bun/layer -D # or 'bun add @serverless-bun/layer -D'

Then add the plugin to your serverless.yml file:

plugins:
  - '@serverless-bun/layer'

Ensure that the function's architecture and runtime are compatible with the Bun Layer:

custom:
  bunLayer:
    release: 1.0.25 # This is not required, however for most cases, you should specify a version here. Defaults to "latest" if unspecified.

provider:
  name: aws
  architecture: arm64 # Set to "x86_64" if arch is set to "x64".
  runtime: provided.al2 # Or "provided".

# Or at function-level:

functions:
  myFunction:
    architecture: arm64
    runtime: provided.al2

That's it! (Build and) Deploy your application with Serverless Framework:

sls deploy

Configuration

The plugin works out of the box by default; however, configurations are supported.

Custom Properties

Configure the plugin by adding the bunLayer property in the custom section of your serverless.yml file.

custom:
  bunLayer:
    arch: aarch64 # Architecture type to support. (options: 'aarch64', 'x64'; default: 'aarch64')
    release: latest # Release of Bun to install. (default: 'latest')
    url: <custom-url> # Custom URL to download Bun. (optional)
    output: ./bun-lambda-layer.zip # Output file for the Bun. (default: './bun-lambda-layer.zip')
    public: false # Allow access to the Lambda Layer from any AWS account. (default: false)
    layerKey: bun # Key of the Lambda Layer that will be injected to the layers property. (default: 'bun')
    omitInjection: false # Omit injecting the Lambda Layer into the serverless config, useful when you want to use this plugin for downloading and compiling Bun Lambda Layer only. (default: false)

Function Properties

You can specify function-level properties to control the behavior of the plugin for individual functions.

functions:
  myFunction:
    omitBunLayer: true # Omit Bun Layer for this specific function.

How it works?

The Serverless Bun Layer plugin simplifies the integration of the AWS Bun Lambda Layer into your Serverless Framework project. During the packaging phase, the plugin automatically downloads and compiles the required Bun runtime layer based on the provided configuration. This seamless process ensures that your AWS Lambda functions have access to the Bun runtime layer without manual intervention.

The compiled Lambda Layer is then intelligently injected into your serverless.yml configuration, providing a smooth and hassle-free experience. The plugin identifies functions compatible with the Bun Lambda Layer, automatically including the layer in their configurations. With the Serverless Bun Layer plugin, deploying your Bun-powered Serverless applications becomes a straightforward process, handling the complexities of Lambda Layer integration seamlessly behind the scenes.

CloudFormation Variable

Serverless Framework is powered by AWS Cloudformation under the hood. Serverless Bun Layer plugin injects Bun Lambda Layer into your Cloudformation template. For advanced use cases, you can utilize this reference in your Serverless Framework configuration as follows:

custom:
  bunLayer:
    layerKey: my-bun

resources:
  Outputs:
    MyBunLambdaLayerARN:
      # https://www.serverless.com/framework/docs/providers/aws/guide/layers#using-your-layers
      # https://www.serverless.com/framework/docs/providers/aws/guide/resources#override-aws-cloudformation-resource
      Value: !Ref MyDashbunLambdaLayer # "my-bun" becomes "MyDashbun" + "LambdaLayer"
      Export:
        Name: !Sub ${AWS::StackName}-my-bun-lambda-layer

Commands

sls bun build-layer

Builds a Lambda layer for Bun and saves it to a .zip file.

This is an alias command for the build-layer script using Serverless.

Examples

For more examples and customization options, refer to the examples directory in this repository.

License

MIT