Socket
Socket
Sign inDemoInstall

@hattip/bundler-cloudflare-workers

Package Overview
Dependencies
25
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @hattip/bundler-cloudflare-workers

Cloudflare Workers bundler for Hattip


Version published
Weekly downloads
132
increased by12.82%
Maintainers
1
Install size
9.38 MB
Created
Weekly downloads
 

Readme

Source

@hattip/bundler-cloudflare-workers

Hattip bundler for Cloudflare Workers. It uses esbuild behind the scenes.

CLI

hattip-cloudflare-workers [...options] <input> <output>

Bundle the Hattip app in <input> into <output> as a Clourflare Workers module.

Options:
  -e, --entry    Interpret <input> as a Cloudflare Workers module entry instead of a Hattip handler entry
  -h, --help     Display this message
  -v, --version  Display version number

The input can be either a module that default exports a Hattip handler entry or a Cloudflare Workers module similar to the following:

import cloudflareWorkersAdapter from "@hattip/adapter-cloudflare-workers";
import handler from "./handler.js";

export default {
  fetch: cloudflareWorkersAdapter(handler),
};

The output is a Clourflare Workers bundle that can be deployed with wrangler or tested with wrangler dev.

JavaScript API

import bundler from "@hattip/bundler-cloudflare-workers";

// You can specify either `cfwEntry` or `handlerEntry` but not both.
bundler({
  // cfwEntry: "entry-cloudflare-workers.js",
  handlerEntry: "./handler.js",
  output: "./cfw-bundle.js",
}).then(() => {
  console.log("Bundle complete");
});

The bundling function also accepts a second argument, a callback that is called with an esbuild options object for customizing the build.

FAQs

Last updated on 27 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc