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

bitumen

v2.3.0

Published

A collection of utility classes, types, and opinionated configurations for Babel, ESLint, rollup.js, and TypeScript.

Downloads

20

Readme

Overview

bitumen is a collection of classes, types, utilities, and opinionated configuration for Babel, ESLint, JavaScript, rollup.js, and TypeScript.

Supported Environments

  • Client side: Last two versions of Chrome, Edge, Firefox (+ ESR), and Safari
  • Server side: Maintained versions of Node.js

Usage

Configuration

Babel

Option 1: 📍 package.json

{
  "babel": {
    "extends": "bitumen/configuration/babel"
  }
}

Option 2: 📍 babel.config.cjs

const base = require('bitumen/configuration/babel');

module.exports = {
  ...base,
  // custom configuration and overrides
};

ESLint

📍 .eslintrc.cjs

const base = require('bitumen/configuration/eslint');
const react = require('bitumen/configuration/eslint-react');

module.exports = {
  ...base,
  ...react,
  // custom configuration and overrides
};

rollup.js

📍 rollup.config.js

import configure from 'bitumen/configuration/rollup';

import packageJson from './package.json';

export default configure(packageJson);

configure() returns a configuration object which:

  • Reads entry points from package.json's exports field (no conditionals, null targets, or patterns).
  • Writes distributable output to DIST_PATH, mirroring the directory structure of BUILD_PATH.
  • Writes CommonJS modules to .cjs files and ES modules to .js files.
  • Excludes Jest directories __mocks__, __tests__ from the output.
  • Copies Sass stylesheets (.scss) from SRC_PATH to DIST_PATH.
  • Copies TypeScript type declarations (.d.ts) from BUILD_PATH to DIST_PATH, giving them a .d.ts extension for ECMAScript and a .d.cts extension for CommonJS.

The following environment variables must be set at runtime:

  • BUILD_PATH: Where Babel and tsc write their .js and .d.ts files.
  • DIST_PATH: Where rollup.js is to write its distributable output.
  • FORMAT: Type of modules to output; either 'es' (ES) or 'cjs' (CommonJS).
  • SRC_PATH: Where the original source code is located.

TypeScript

📍 jsconfig.json

{
  "extends": "bitumen/configuration/javascript"
}

📍 tsconfig.json

{
  "extends": "bitumen/configuration/typescript",
  // `exclude`, `files`, and `include` paths must be set locally;
  // see https://github.com/microsoft/TypeScript/issues/45050
  "include": ["./src/"]
}

Library

bitumen exposes named exports from the following entry points:

  • collections
  • configuration
  • mixins
  • types
  • utils

For example, to implement SortedSet from collections:

import {SortedSet} from 'bitumen/collections';

const set = new SortedSet();

Type Declarations

For proper module and type resolution, use the following project settings:

📍 jsconfig.json

{
  "compilerOptions": {
    "checkJs": true,
    "module": "NodeNext",
    "strictNullChecks": true // optional but recommended
  }
}

📍 tsconfig.json

{
  "compilerOptions": {
    "module": "NodeNext"
  }
}

💡 bitumen's JavaScript and TypeScript configurations are already set up this way.