CommonJS
   HOME

TheInfoList



OR:

CommonJS is a project with the goal to establish conventions on the
module Module, modular and modularity may refer to the concept of modularity. They may also refer to: Computing and engineering * Modular design, the engineering discipline of designing complex devices using separately designed sub-components * Modul ...
ecosystem for
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
outside of the
web browser A web browser is application software for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's screen. Browsers are used o ...
. The primary reason for its creation was a major lack of commonly accepted forms of JavaScript module units which could be reusable in environments different from that provided by conventional web browsers running JavaScript scripts (e.g. web servers or native desktop applications). CommonJS's module specification is widely used today, in particular for server-side JavaScript programming with Node.js. It is also used in the development of browser-side JavaScript, but the code must be packaged with a transpiler since browsers don't support CommonJS. The other major module specification in use is the
ECMAScript ECMAScript (; ES) is a JavaScript standard intended to ensure the interoperability of web pages across different browsers. It is standardized by Ecma International in the documenECMA-262 ECMAScript is commonly used for client-side scripti ...
(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 Mozilla (stylized as moz://a) is a free software community founded in 1998 by members of Netscape. The Mozilla community uses, develops, spreads and supports Mozilla products, thereby promoting exclusively free software and open standards, ...
engineer Kevin Dangoor in January, 2009 and initially named ServerJS. 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 Ecma International () is a nonprofit standards organization for information and communication systems. It acquired its current name in 1994, when the European Computer Manufacturers Association (ECMA) changed its name to reflect the organization ...
group TC39 working on
ECMAScript ECMAScript (; ES) is a JavaScript standard intended to ensure the interoperability of web pages across different browsers. It is standardized by Ecma International in the documenECMA-262 ECMAScript is commonly used for client-side scripti ...
, but some members of TC39 participate in the project.


Specifications

The list of specifications includes:


Current


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.


Implementations


See also

* Asynchronous module definition (AMD), another JavaScript module architecture *
Comparison of server-side JavaScript solutions This is a list of server-side JavaScript implementations. Server-side JavaScript use Other common server-side programming languages are JavaServer Pages (JSP), Active Server Pages (ASP), Perl, PHP, Python, Ruby, ColdFusion Adobe Cold ...
*
Document Object Model The Document Object Model (DOM) is a cross-platform and language-independent interface that treats an XML or HTML document as a tree structure wherein each node is an object representing a part of the document. The DOM represents a document wi ...
(DOM), a
web browser A web browser is application software for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's screen. Browsers are used o ...
client-side Client-side refers to operations that are performed by the client in a client–server relationship in a computer network. General concepts Typically, a client is a computer application, such as a web browser, that runs on a user's local comput ...
application programming interface An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
(API) commonly available in JavaScript *
JSGI JSGI, or JavaScript Gateway Interface, is an interface between web servers and JavaScript-based web applications and frameworks. It was inspired by the Rack for Ruby and WSGI for Python and was one of the inspirations of PSGI for Perl. is a ref ...


References


External links

* * {{DEFAULTSORT:Commonjs JavaScript