0.135.1 • Published 5 months ago

esm.sh v0.135.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

esm.sh

The esm.sh CLI/API for serving hot applications.

Using the CLI tool

The CLI tool is used to run a hot application in current directory.

npx esm.sh -w

The -w option is for watching the file changes to enable HMR.

Using the API

The esm.sh API uses standard web APIs to serve hot applications.

export interface ServeOptions {
  /** The root path, default to current working directory. */
  root?: string;
  /** The fallback route, default is `index.html`. */
  fallback?: string;
}

export function serveHost(
 options?: ServeOptions,
): (req: Request) => Promise<Response>;

For Node.js runtime, you need @hono/server to listen to the requests.

import { serve } from "@hono/server";
import { serveHot } from "esm.sh";

serve({ port: 3000, fetch: serveHot() });

For Deno runtime, you can use serveHot directly.

import { serveHot } from "https://esm.sh";

Deno.server(serveHot());

For Bun runtime:

import { serveHot } from "esm.sh";

Bun.serve({ port: 3000, fetch: serveHot() });
0.135.1

5 months ago

0.135.0

5 months ago

0.0.6

9 months ago

0.0.3

11 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.1

12 months ago

0.0.2

11 months ago

0.0.0

1 year ago