Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

barely-a-dev-server

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

barely-a-dev-server

A thin, opinionated wrapper for `esbuild` as a `.ts` web server. Given a `srcRoot` folder, it:

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
31
decreased by-58.11%
Maintainers
1
Weekly downloads
 
Created
Source

barely-a-dev-server

A thin, opinionated wrapper for esbuild as a .ts web server. Given a srcRoot folder, it:

  • finds all .ts file in srcRoot and uses them as entry files to run esbuild in watch mode, and
  • serves the built .js files together with a fallback to srcRoot for static files.

When run with "dev": false, it writes these files to an output dir (dist/ + the source root by default), ready to serve using your favorite static file server.

Usage:

// script/build.js
import { barelyServe } from "barely-a-dev-server";

barelyServe({
  srcRoot: "src/sites",
  dev,
  port: 3333,
  esbuildOptions: {
    target: "esnext",
  },
});
<!-- src/index.html -->
<script src="./index.js" href="./index.ts" type="module" defer></script>

(Note that src must reference the built .js file. You can use href to store a reference to the source that e.g. you can click in VSCode.)

// index.ts
const a: number = 4;
console.log(a);

Assumptions

  • You're using only ESM code.
  • You have a build script to invoke this from. (TODO: CLI)

FAQs

Package last updated on 10 Oct 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc