
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
esbuild-multicontext
Advanced tools
Minimal wrapper over esbuild's context API
When working with modern codebases, there's always more than one esbuild config
in place for either bundling server separately or the client separately and
managing mulitple esbuild instances isn't recommended. esbuild
provides a
context
API for long running esbuild tasks like watching and serving client
bundles. This package wraps the context API with a very tiny wrapper to make it
easier to write build tooling scripts without having to manage esbuild
instances.
import { createContext, CONSTANTS } from 'esbuild-multicontext'
const buildContext = createContext()
// Use the helper glob to find files and directories
const entries = await buildContext.glob('./src/*.js', {
filesOnly: true,
})
buildContext.add('esm', {
entryPoints: entries,
outdir: './dist/esm',
format: 'esm',
outExtension: {
'.js': '.mjs',
},
})
buildContext.hook('esm:complete', async () => {
// context built completely
})
buildContext.hook('esm:error', async error => {
// context failed with `error`
})
buildContext.hook(CONSTANTS.ERROR, async error => {
// multi context build failed
})
buildContext.hook(CONSTANTS.BUILD_COMPLETE, async error => {
// Overall build complete
})
buildContext.hook(CONSTANTS.BUILD_ERROR, async error => {
// Overall build error
})
buildContext.hook(CONSTANTS.WATCH_COMPLETE, async error => {
// Overall watch complete
})
buildContext.hook(CONSTANTS.WATCH_ERROR, async error => {
// Overall watch error
})
// Watch each context and re-build on change
await buildContext.watch()
// Build each context and notify the respective hooks
await buildContext.build()
FAQs
Minimal wrapper over esbuild's context API
The npm package esbuild-multicontext receives a total of 3 weekly downloads. As such, esbuild-multicontext popularity was classified as not popular.
We found that esbuild-multicontext demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.