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 - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

2

package.json
{
"name": "barely-a-dev-server",
"version": "0.1.0",
"version": "0.2.0",
"type": "module",

@@ -5,0 +5,0 @@ "description": "",

# `barely-a-dev-server`
A thin, opinionated wrapper for `esbuild` as a `.ts` web server. Given a `srcRoot` folder, it:
A thin, opinionated wrapper for `esbuild` as a `.ts` web server. Given a `entryRoot` 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.
- finds all `.ts` file in `entryRoot` and uses them as entry files to run `esbuild` in `watch` mode, and
- serves the built `.js` files together with a fallback to `entryRoot` for static files.

@@ -17,4 +17,4 @@ 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.

barelyServe({
srcRoot: "src/sites",
dev,
entryRoot: "src/sites", // the only required arg
dev: true,
port: 3333,

@@ -21,0 +21,0 @@ esbuildOptions: {

@@ -41,5 +41,5 @@ import { cp } from "fs/promises";

export async function barelyServe(options) {
let { debug, dev, esbuildOptions, outDir, port, srcRoot, type } = options;
if (!srcRoot) {
throw new Error("Must specify `srcRoot`");
let { debug, dev, esbuildOptions, outDir, port, entryRoot, type } = options;
if (!entryRoot) {
throw new Error("Must specify `entryRoot`");
}

@@ -51,8 +51,8 @@ debug ??= false;

port ??= 1234;
outDir ??= join(dev ? "dist/dev" : "dist", srcRoot);
outDir ??= join(dev ? "dist/dev" : "dist", entryRoot);
await restartEsbuild(srcRoot, outDir, dev, esbuildOptions);
await restartEsbuild(entryRoot, outDir, dev, esbuildOptions);
if (dev) {
new CustomServer({
rootPaths: [outDir, srcRoot],
rootPaths: [outDir, entryRoot],
port,

@@ -63,4 +63,4 @@ debug,

// TODO: filter out `.ts` if they don't work for source maps?
await cp(srcRoot, outDir, { recursive: true });
await cp(entryRoot, outDir, { recursive: true });
}
}
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