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

cm-bundler

v0.2.1

Published

Bundle CM framework javascript sources.

Downloads

3

Readme

Build Status

CM bundler

Command line tool to bundle up javascript from different sources: CommonJS / Vanilla / inline code.

Installation

npm install cm-bundler

Usage

$ cm-bundler

  Usage: cm-bundler [options] [command]


  Commands:

    code <json>        generate the bundle code
    sourcemaps <json>  generate the sourcemaps
    checksum <json>    generate the bundle checksum
    all <json>         generate the bundle code + inline sourcemaps

  Options:

    -h, --help              output usage information
    -V, --version           output the version number
    -b, --benchmark <file>  benchmark output file

JSON configuration

{
  "bundleName": "my-bundle.js", // bundle filename (output from bundler pipe)  
  "entries": [
    "foo.js",                   // loaded as entry-points, not accessible from the global scope    
    "path/to/bar.js"
  ],
  "libraries": [         
    "path/lib/foo/baz/qux.js"   // accessible with `require('baz/qux')` (see "paths")
  ],
  "content": [
    {
      "path": "foo",           
      "source": "// js source code"
    },
    {
      "path": "bar", 
      "source": "// js source code",
      "execute": true,          // loaded as an entry-point 
      "expose": true            // accessible with `require('bar')`
    }
  ],
  "concat": [                   // non CommonJS files prepended to the bundle
    "vanilla/file/foo.js",
    "vanilla/file/bar.js"
  ],
  "paths": [
     "path/lib/foo",            // paths for require() lookup
     "path/lib/bar"
  ],
  "sourceMaps": {
    "enabled": true,
    "replace": {
      "vanilla": "vanilla/file/"   // {[replacement]: [matching str/regex]} replace source paths in the sourcemaps 
    }
  },       
  "uglify": true             
}
sourceMaps.replace

This option replace all matching file.path in the sourcemaps, in addition to some built-in replacements:

  • all relative references (../) are removed (/\.\.\//g)
  • .*browser-pack/_prelude.js changed by _pack/.prelude, see browserify generated prelude file

The replacement could be defined by a regular expression or a string, in this case, it will be converted into /<matching-string>/gi. Example: /usr/foo/my/lib/file.js file with {"foo/lib/": ".*my/lib/"} replacement will be visible in the browser as foo/lib/file.js.

Benchmark option

--benchmark <file> could be used to generate benchmark report for each command.

Reports give information about the time spent on each pipeline step, for example:

start: 0.004s
browserify: 2.727s
sourcemap: 0.023s
concat: 1.248s
uglify: 23.183s
remap: 0.002s
write-sourcemap: 0.122s
end: 0.107s

Test

npm test