🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

barely-a-dev-server

Package Overview
Dependencies
Maintainers
1
Versions
41
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

to
0.0.2

README.md

2

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

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

@@ -7,3 +7,8 @@ import * as esbuild from "esbuild";

export async function restartEsbuild(entryRootPath, outputRootPath, dev) {
export async function restartEsbuild(
entryRootPath,
outputRootPath,
dev,
options
) {
if (currentBuildResult) {

@@ -15,20 +20,18 @@ (await currentBuildResult).stop();

join(process.cwd(), entryRootPath),
".ts",
".ts"
);
console.log(
`Starting esbuild with ${entryPoints.length} entry points.`,
);
return currentBuildResult = esbuild.build({
console.log(`Starting esbuild with ${entryPoints.length} entry points.`);
return (currentBuildResult = esbuild.build({
format: "esm",
target: "es2020",
logLevel: "info",
minify: true, // TODO: `!dev`?
sourcemap: true,
...options,
entryPoints,
outdir: outputRootPath,
format: "esm",
target: "es2020",
bundle: true,
splitting: true,
watch: dev,
logLevel: "info",
sourcemap: true,
external: ["crypto", "worker_threads"],
minify: true, // TODO: `!dev`?
});
}));
}

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

export async function barelyServe(options) {
let { debug, dev, outDir, port, srcRoot, type } = options;
let { debug, dev, esbuildOptions, outDir, port, srcRoot, type } = options;
if (!srcRoot) {

@@ -48,2 +48,3 @@ throw new Error("Must specify `srcRoot`");

dev ??= true;
esbuildOptions ??= {};
type ??= "site";

@@ -53,3 +54,3 @@ port ??= 1234;

await restartEsbuild(srcRoot, outDir, dev);
await restartEsbuild(srcRoot, outDir, dev, esbuildOptions);
if (dev) {

@@ -56,0 +57,0 @@ new CustomServer({