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

cloudflare-workers-webpack-plugin

v3.0.1

Published

Launch Cloudflare Workers to the Edge from the comfort of your build step 🚀

Downloads

13

Readme

Cloudflare Worker Webpack Plugin

Deploy freshly-bundled Cloudflare Worker scripts and route matching patterns directly from your build step 🚀

Example use in Cloudflare Worker Webpack Boilerplate

    Example as implemented in Cloudflare Worker Webpack Boilerplate

Usage

Install, ...

npm install -D cloudflare-worker-webpack-plugin

... require...

const CloudflareWorkerPlugin = require('cloudflare-worker-webpack-plugin')

... and include the plugin in your webpack ~~dark arts~~ configuration:


// ...ave satanas webpackus ...
plugins: [

  new CloudflareWorkerPlugin(
    $CLOUDFLARE_AUTH_EMAIL,         // first arg: user-email
    $CLOUDFLARE_AUTH_KEY,           // second arg: api-key
    {                               // options object
      site: `your-site.lol`,
      enabledPatterns: `omg.your-site.lol/*,example.your-site.lol/crazy/pattern/*`,
      disabledPatterns: `example.your-site.lol/crazy/pattern/ignore-me-tho`,
      verbose: true,
      // See 'Configuration' below for additional options
    }
  ),

],

Configuration

Required Configuration

Cloudflare Credentials

  • $CLOUDFLARE_AUTH_EMAIL: Your Cloudflare user email.
  • $CLOUDFLARE_AUTH_KEY: Your Cloudflare super-duper-secret API key.

Cloudflare Zone

You must provide one of the following two options:

  • zone: Zone ID of the domain for which you're deploying your script

    OR

  • site: Fully-qualified domain name (FQDN) of your target deployment zone.

Note: If both zone and site are provided, zone wins.

Options

  • enabledPatterns: a single route matching pattern, a comma-separated list of patterns, or an Array of patterns to enable for your newly spawned JavaScript minion (default: undefined)
    • Example (string): "*.your-site.lol"
    • Example (list): "*.your-site.lol,your-site.lol/some-pattern/*"
    • Example (Array): ["*.your-site.lol", "your-site.lol/some-pattern/*"]
  • disabledPatterns: same as enabledPatterns above, but the worker will ignore requests matching these patterns.
  • script: relative path to your worker script (default: <webpack-config-output-file>)
  • scriptName: The CF refernce name of your worker script (default: Date.now())
  • metadataPath: Optional relative path to a JSON metadata file with e.g. secrets (default: undefined)
  • skipWorkerUpload: Skip uploading the worker script and process only route patterns (default: false)
  • reset: Delete ALL route patterns, DELETE existing worker script, and exit (default: false)
  • verbose: Log additional information about each deployment step to the console (default: false)
  • colors: Use colors in console output (default: false)
  • emoji: Use emoji in console output (default: false)
  • enabled: Whether to deploy to Cloudflare or bypass; useful for e.g. CI and testing (default: true)

Note: Any existing patterns not found in enabledPatterns or disabledPatterns will be deleted!

Potential Issues

This plugin does not support features reserved for Enterprise Cloudflare Workers.

Contributing

PR's are very much welcome. Here are some fun ideas to consider:

  • [ ] Write hella' cool automated tests
  • [ ] Support other neat Cloudflare Worker features like Workers KV and wasm

Feel free to create an issue throwing your own ideas at me.

Because Software

Neat Little Badges

cloudflare

code style: prettier npm version

Disclaimer

Besides a happy customer, I am not affiliated with Cloudflare in any way.

Assume in good faith that I have no idea what I'm doing; REVIEW THE SOURCE and use at your own risk 🙈

License

MIT