# CommonJS

CommonJS is a project to standardize the module ecosystem for JavaScript outside of web browsers (e.g. on web servers or native desktop applications).
CommonJS's specification of how modules should work is widely used today for server-side JavaScript with Node.js. It is also used for browser-side JavaScript, but that code must be packaged with a transpiler since browsers don't support CommonJS. The other major module specification in use is the ECMAScript (ES) modules specification (ES6 modules aka ES2015 modules). CommonJS can be recognized by the use of the require function and module.exports, while ES modules use import and export statements for similar (though not identical) functionality.

## History

The project was started by Mozilla engineer Kevin Dangoor in January, 2009 and initially named ServerJS.
   What I’m describing here is not a technical problem. It’s a matter of people getting together and making a decision to step forward and start building up something bigger and cooler together.
In August 2009, the project was renamed CommonJS to show the broader applicability of the APIs. Specifications are created and approved in an open process. A specification is only considered final after it has been finished by multiple implementations. CommonJS is not affiliated with the Ecma International group TC39 working on ECMAScript, but some members of TC39 participate in the project.

## Specifications

The list of specifications includes:

### Current

* Modules/1.0 (Superseded by Modules/1.1)
* Modules/1.1
* Modules/1.1.1
* Packages/1.0
* System/1.0

### Proposals

The proposals cover much more than modules. They intend to define a set of APIs that are useful both for non-web JavaScript implementations, with standardized package names to provide interoperability within the ecosystem. This goal sometimes overlaps with that of TC39, and parts such as Promises have indeed made it into ECMAScript itself.
The part after the slash is the version. When a proposal is in contention, each individual proposal (including sequential revisions from the same author) is assigned a new letter. When the main direction is known it starts being assigned numeric versions.
* Binary/B,F
* Console (ported from Web)
* Encodings/A,C
* Encodings/A
* HTTP Client/B
* IO/A
* Filesystem/A,A/0
* Modules/Async/A
* Modules/AsynchronousDefinition
* Modules/LoaderPlugin
* Modules/Resources
* Modules/SimpleAsynchronous
* Modules/Transport/B,C,D,E
* Modules/Wrappings
* Modules/Wrappings-Explicit-Dependencies
* Packages/1.1
* Packages/AsynchronousDefinition
* Packages/Mappings/A,B,C,D
* Promises/B,D
* Unit Testing/B,1.0,1.0.1

## Implementations

* Common Node
* CommonJS Compiler - a command-line tool that makes Common JS modules suitable for in-browser use
* CommonJS for PHP - a light-weight CommonJS implementation for PHP 5.3+
* CouchDB
* Flusspferd
* GPSEE
* Jetpack
* Joyent Smart Platform
* JSBuild
* MongoDB
* Narwhal (JavaScript platform)
* Node.js (partial; synchronous)
* Persevere
* PINF JavaScript Loader
* PythonMonkey implements a CommonJS Modules/1.1.1 environment which can load modules written in either JavaScript or Python (or both).
* RingoJS
* SilkJS
* SproutCore
* TeaJS
* Wakanda
* XULJet
* QUnit