npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jsheaven/easybuild

v1.2.9

Published

Super-fast and simple IIFE, ESM and CJS build tool for JavaScript and TypeScript. Comes with an easy API and CLI. One file in, one file out. Supports node and browser output. Generates .map and .d.ts files. Minifies and prints the final code size.

Downloads

247

Readme

Super-fast and simple IIFE, ESM and CJS bundler for JavaScript and TypeScript. Comes with an easy API and CLI. One file in, one file out. Supports node and browser output. Generates .map and .d.ts files. Minifies and prints the final code size.

  1. As a developer, I don't want to configure esbuild again and again to gain the same results.
  2. As a developer, I want to have esbuild configured to bundle for browser or node and generate CJS, ESM and IIFE likewise
  3. As a developer, I don't want esbuild to fail on __dirname and __filename not being defined
  4. As a developer, I don't want node_modules to be bundled in when bundlung for Node.js
  5. As a developer, I want to have an API and CLI to simply build one file at a time
  6. As a developer, I want to see the file sizes raw, gzip and brotli compressed
  • ✅ Configures esbuild to simply generate one output (per module type) JavaScript for one input TypeScript/JavaScript
  • ✅ Generates cjs, esm and iife invariants automatically
  • ✅ Full support for .d.ts bundling and type checking
  • ✅ Prints the file sizes per compression type gzip and brotli, when done
  • ✅ Just 1849b nano sized (ESM, gizpped)
  • ✅ Available as CLI and API
  • ✅ Fixes several unintuitive esbuild default behaviours
  • ✅ Runs on Windows, Mac, Linux, CI tested
  • ✅ First class TypeScript support
  • ✅ 100% Unit Test coverage

For Node.js: npx @jsheaven/easybuild ./src/index.ts ./dist/index.js node

For browsers: npx @jsheaven/easybuild ./src/index.ts ./dist/index.js browser

You need at least version 18 of Node.js installed.

  • yarn: yarn add @jsheaven/easybuild
  • npm: npm install @jsheaven/easybuild
import { buildForNode, buildForBrowser } from '@jsheaven/easybuild'

await buildForNode({
  // source file to build
  entryPoint: './src/cli.ts',
  // file to generate (actually, generates invariants like ./dist/cli.iife.js, etc.)
  outfile: './dist/cli.js',
  // allows to disable all minification and tree shaking with one flag
  debug: false,
  // generated .d.ts files, but drives the build-time and may cause typing errors
  dts: true,
  // specific configuration for the .d.ts bundle output
  dtsOutputOptions: {
    exportReferencedTypes: true,
    inlineDeclareExternals: true,
    inlineDeclareGlobals: true,
    noBanner: true,
    sortNodes: true,
  },
  // allows to inline types (.d.ts) of dependent libraries etc.
  dtsLibOptions: { ... },
  // in case you want to set any extra esbuild options
  esBuildOptions: {
    // usually, Node.js builds are not bundled, but e.g. for CLIs you want that
    bundle: true,
  },
})
const { buildForNode, buildForBrowser } = require('@jsheaven/easybuild')

// same API like ESM variant