barely-a-dev-server
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"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({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
7094
10
175
1
4