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

@bytelab.studio/tsb

v3.1.0

Published

A simple, fast bundler system for TypeScript

Downloads

7

Readme

TSB

A simple, fast bundler system for TypeScript

Installation

npm install -g @bytelab.studio/tsb

Using the tool

To use the tsb tool for your project, follow the steps below.

Step 1: Initialize a Project

First, let tsb handle the setup

tsb init

After running the command, your file structure should look like this:

.
├── node_modules
│       └── @bytelab.studio
│               └── tsb-runtime
├── out
├── package-lock.json
├── package.json
├── src
├── tsb.js
└── tsconfig.json

Step 2: Configure Your Project

A tsb.js file is generated automatically and looks something like this:

tsb.js is loaded in a sandbox context, so most Node.js features are disabled, including require modules, except for tsb.

const {builder} = require("tsb");

builder
    .module("my-module")
    .addFolders("./src")
    .output("./out")
    .platform("nodejs")
  • The module function sets the name of your project, similar to the name property in package.json.
  • The addFolders function adds a folder recursively to the source files.
  • The output function sets the output directory for your bundled files.
  • The platform function sets the output platform of the project, e.g., nodejs or browser

All flags except --script and -h | --help can be set through the config file.

Usage: tsb build <files> [options]
  -m=name, --module=name        The module name
  <>                            The files to be compiled
  -p=platform, --platform=platform
                             The target platform
  -e=file, --entry=file         The entry file
  -o=path, --output=path        The output path
  --chunk-size=bytes            Sets the minimal chunk size in bytes
  --script                      Use tsb.js definition in the CWD
  -h, --help                    Prints this help string
  --plugin-minify               Minifies the JavaScript output

| Flag | Function | |----------------|--------------------------| | <files> | addFiles, addFolders | | -m, --module | module | | -p, --platform | platform | | -e, --entry | entry | | --chunk-size | chunkSize | | --plugin-* | plugins |

Step 3: Write Program Content

Now, write the actual program.

// src/foo.ts

export function foo() {
    console.log("Foo");
}
// src/entry.ts

import {foo} from "./foo"

foo();

Step 4: Build the Project

To build the project, run the following command in your project directory:

tsb build --script

Files are generated in the output folder:

out
 ├── chunks
 │       └── <chunk>.js
 └── <module>.js

Step 5: Run the Project

To run the project, use the following command:

node ./out/<module>.js

Now your project is set up, configured, and ready to run using tsb.

NodeJS Modules

Currently, there is no way to include NodeJS modules directly in the bundled files. However, loading of NodeJS modules is supported on the NodeJS platform, and context switching with AppDomains across NodeJS modules is also supported.

Roadmap

Nothing in this roadmap is a promise. Everything in this roadmap is changeable.

Planned

  • [ ] Some sort of library system using NPM to install bundled libraries

v3.1.0

  • [x] Multi-platform support
  • [x] Macro-Plugin
  • [x] Enable loading chunks that are not directly integrated
  • [x] Enable loading files via resource path