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

uncommon

v0.0.1-dev

Published

uncommon is a build tool for compiling a single browser compatible script from a CommonJS project

Downloads

4

Readme

uncommon

Develop modular javascript for the browser without extra frameworks, package managers, or loaders

Build Status

Installation

$ npm install uncommon

Don't have node.js or npm installed? Take a moment to learn about server-side javascript.

Example

Format your javascript project so it has a main CommonJS module:

// use relative paths to load other modules in your project
var foo = require('./foo');
var bar = require('../lib/bar');

// or reference an external dependency by name
var $ = require('jquery');

// export the external interface as a module
module.exports = {
	process: function(data) {
		return bar.process(data);
	}
};
module.exports.fnx = foo.fnx;

Now create a uncommon.config.json file at the root of your project to describe how it should be packaged:

{
	"name": "global_symbol",
	"main": "./path/to/main_module.js",
	"output": "./path/to/output_script.js",
	"dependencies": {
		"module_name": "global_symbol", 
		"underscore": "_",
		"jquery": "$"
	}
}

Bundle the project into a single script using the uncommon build command:

$ uncommon build path/to/project 

Or host it on a local server that will rebuild the script as you make changes:

$ uncommon preview path/to/project --port 8888

uncommon will recursively find and package all of your project's required modules and create shims for any external dependencies. Your project is wrapped inside of a self-executing function along with a lightweight runtime (about 30 lines) for building and exporting your public interface. Your new package can be included like another script by adding <script src="output_script.js"></script> to your html file.

The details

Modern javascript libraries like Backbone and ember.js often require lower-level libraries that are very common, heavyweight, or use shared-state configuration. For example: underscore or JQuery. The developers want to provide a single, prebuilt script but won't, can't, or shouldn't include the necessary libraries. uncommon is an alternative to the complicated and/or project specific tools used for packaging these scripts without their runtime dependencies.

With uncommon you can write and organize your library or application as simple CommonJS modules and then compile them into a single script. uncommon can import dependencies from the global scope and expose them as modules; allowing your code to depend on shared libraries or legacy scripts that may already be loaded on the page. 'uncommon' can also export your module as a global symbol so legacy or inline scripts can use it without any loaders or modification. Projects configured for use with 'uncommon' are compatible with other CommonJS runtimes and package managers (such as npm).

Compatibility with node.js

uncommon requires your project to be defined using the CommonJS module 1.0 specification. As long as your code does not use any browser-only features or scripts it will be compatible with node.js as is, without any modification or build steps. External dependencies will be loaded in as node modules instead of being bootstraped by the uncommon runtime.

For packaging existing node modules for the browser, I recommend using browserify instead of uncommon. browserify has support for node specific features that uncommon does not.

Compatibility with ender

ender is a full-featured package management and build tool for CommonJS projects. If you are developing a front-end javascript application I strongly recommend using ender instead of uncommon for building your project. For libraries and packages that are not meant to stand-alone, uncommon can be used within packages or alongside ender for building a drop-in ready script that is independent from npm.

Usage

under construction