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

@kitchenshelf/serverless-rspack

v1.0.0-alpha.6

Published

[Serverless Framework](https://www.serverless.com) plugin for zero-config JavaScript and TypeScript code bundling using the high performance Rust-based JavaScript bundler [`rspack`](https://www.rspack.dev/guide/introduction.html)

Downloads

71

Readme

⚡ serverless-rspack

Serverless Framework plugin for zero-config JavaScript and TypeScript code bundling using the high performance Rust-based JavaScript bundler rspack

Serverless Build Status NPM

Look for the plugin under the /libs directory.

Example serverless projects are under the /examples directory.

For Developers - DEVELOPER.MD

Features

  • From zero to hero: configuration possibilities range from zero-config to fully customizable
  • Supports sls package, sls deploy
  • Build and runtime performance at its core

Table of Contents

Install

# install `serverless-rspack`
yarn add --dev @kitchenshelf/serverless-rspack
# or
npm install -D @kitchenshelf/serverless-rspack
# or
pnpm install -D @kitchenshelf/serverless-rspack

Add the following plugin to your serverless.yml:

plugins:
  - @kitchenshelf/serverless-rspack

Plugin Options

By default, no plugin options is required, but you can override the reasonable defaults via the custom.rspack section in the serverless.yml file.

custom:
  rspack:
    mode: 'production',
    esm: true

Examples

See example folder for example plugin option configuration.

Plugin Options

| Option | Description | Default | | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ------------ | | zipConcurrency | The number of concurrent zip operations to run at once. eg. 8. NOTE: This can be memory intensive and could produce slower builds. | Infinity | | keepOutputDirectory | Keeps the .rspack output folder. Useful for debugging. | false | | stats | Generate packaging information that can be used to analyze module dependencies and optimize compilation speed. | false | | config | Relative rspack config path | undefined | | esm | Output format will be ESM (experimental) | false | | mode | Used to set the build mode of Rspack to enable the default optimization strategy (https://www.rspack.dev/config/mode) | production | | tsConfig | Relative path to your tsconfig | undefined | | externals | Provides a way of excluding dependencies from the output bundles | undefined |

Default Rspack Options

The following rspack options are automatically set and cannot be overwritten.

| Option | Notes | | ------------- | ---------------------------------------------------------------------------------------------------------------- | | entry | Handler entries are determined by the plugin | | output.path | The plugin needs to have full control over where bundles are output to, so it can correctly create zip artifacts |

Function Options

| Option | Description | Default | | -------- | --------------------------------------------------------------------------------------------- | ----------- | | rspack | Set this property on a function definition to force the handler to be processed by the plugin | undefined |

Supported Runtimes

This plugin will automatically process any function that has a runtime that starts with node i.e nodejs20.x

Non-Node functions

If you wish to use this plugin alongside non Node functions like Python or functions with images, this plugin will automatically ignore any function which does not match the supported runtimes.

If you wish to force a function to be process set rspack: true on a function definition. This is handy when using custom provided node runtimes i.e runtime: 'provided.al2023'

⚠️ Note: this will only work if your custom runtime and function are written in JavaScript/Typescript. Make sure you know what you are doing when this option is set to true

Advanced Configuration

Config file

Rspack configuration can be defined by a config file.

custom:
  esbuild:
    config: './rspack.config.js'
// rspack.config.js
module.exports = (serverless) => {
  external: ['lodash'],
  // etc
};

External Dependencies

By providing a regex you can mark packages as external and they will be excluded from the output bundles.

custom:
  rspack:
    externals:
      - "^@aws-sdk\/.*$"
      - "^@smithy\/.*$"
      - '^isin-validator$'



Inspired by serverless-plugin-typescript, serverless-webpack and serverless-esbuild