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.[1] It is also used for browser-side JavaScript, but that code must be packaged with a transpiler since browsers don't support CommonJS.[1] The other major module specification in use is the ECMAScript (ES) modules specification (ES6 modules aka ES2015 modules).[2] 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.[3]
“ | 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. | ” |
— Kevin Dangoor[3] |
In August 2009, the project was renamed CommonJS to show the broader applicability of the APIs.[4] Specifications are created and approved in an open process. A specification is only considered final after it has been finished by multiple implementations.[5] CommonJS is not affiliated with the Ecma International group TC39 working on ECMAScript, but some members of TC39 participate in the project.[6]
Specifications
The list of specifications includes:[7]
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
- Document Object Model (DOM), a web browser client-side application programming interface (API) commonly available in JavaScript
- JSGI
References
- ↑ 1.0 1.1 Eric Elliott (26 June 2014). Programming JavaScript Applications: Robust Web Architecture with Node, HTML5, and Modern JS Libraries. "O'Reilly Media, Inc.". pp. 87–. ISBN 978-1-4919-5027-2. https://books.google.com/books?id=jUfnAwAAQBAJ&pg=PA87.
- ↑ Mario Casciaro; Luciano Mammino (29 July 2020). Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques, 3rd Edition. Packt Publishing. pp. 62. ISBN 978-1-83921-044-0. https://books.google.com/books?id=xBr0DwAAQBAJ&pg=PA62.
- ↑ 3.0 3.1 "What Server Side JavaScript needs ·". https://www.blueskyonmars.com/2009/01/29/what-server-side-javascript-needs/.
- ↑ "CommonJS: JavaScript Standard Library". http://www.commonjs.org/history/.
- ↑ "ProposalProcess - CommonJS Spec Wiki". http://wiki.commonjs.org/wiki/ProposalProcess.
- ↑ "CommonJS: the First Year ·". https://www.blueskyonmars.com/2010/01/29/commonjs-the-first-year/.
- ↑ "JavaScript Standard Library". CommonJS. http://commonjs.org/specs/.
- ↑ "olegp/common-node @ GitHub". https://olegp.github.io/common-node/.
- ↑ "CommonJS Compiler - makes your Common JS modules suitable for in-browser use". https://dsheiko.github.io/cjsc/.
- ↑ "GitHub - DrBenton/CommonJSForPHP: A simple CommonJS spec implementation for PHP 5.3+." (in en). https://github.com/DrBenton/CommonJSForPHP.
- ↑ "Implementations/CouchDB - CommonJS Spec Wiki". http://wiki.commonjs.org/wiki/Implementations/CouchDB.
- ↑ "Flusspferd - CommonJS platform | Javascript bindings for C". https://flusspferd.github.com/.
- ↑ "Implementations/GPSEE - CommonJS Spec Wiki". http://wiki.commonjs.org/wiki/Implementations/GPSEE.
- ↑ "Implementations/Smart - CommonJS Spec Wiki". http://wiki.commonjs.org/wiki/Implementations/Smart.
- ↑ "Homepage - JSBuild". Archived from the original on January 4, 2011. https://web.archive.org/web/20110104112332/http://jsbuild.kodfabrik.com/.
- ↑ "The most popular database for modern apps" (in en-us). https://www.mongodb.com/.
- ↑ "Implementations/Narwhal - CommonJS Spec Wiki". http://wiki.commonjs.org/wiki/Implementations/Narwhal.
- ↑ "Implementations/node.js - CommonJS Spec Wiki". http://wiki.commonjs.org/wiki/Implementations/node.js.
- ↑ "Implementations/Persevere - CommonJS Spec Wiki". http://wiki.commonjs.org/wiki/Implementations/Persevere.
- ↑ "GitHub - pinf/loader-js: EARLY STALLED EXPLORATION" (in en). 30 July 2021. https://github.com/pinf/loader-js.
- ↑ "Distributive-Network/PythonMonkey: A Mozilla SpiderMonkey JavaScript engine embedded into the Python VM, using the Python engine to provide the JS host environment.". 2023-07-07. https://github.com/Distributive-Network/PythonMonkey.
- ↑ "Implementations/RingoJS - CommonJS Spec Wiki". http://wiki.commonjs.org/wiki/Implementations/RingoJS.
- ↑ "SilkJS WWW Site". http://silkjs.net/.
- ↑ "Implementations/SproutCore - CommonJS Spec Wiki". http://wiki.commonjs.org/wiki/Implementations/SproutCore.
- ↑ "Implementations/TeaJS - CommonJS Spec Wiki". http://wiki.commonjs.org/wiki/Implementations/TeaJS.
- ↑ SAS, Wakanda. "Wakanda FullStack JavaScript Platform" (in en). https://wakanda.github.io/.
- ↑ "Google Code Archive - Long-term storage for Google Code Project Hosting.". https://code.google.com/archive/p/xuljet.
External links
- Kowal, Kris (Dec 2009). "CommonJS effort sets JavaScript on path for world domination". Ars Technica. https://arstechnica.com/web/news/2009/12/commonjs-effort-sets-javascript-on-path-for-world-domination.ars.
Original source: https://en.wikipedia.org/wiki/CommonJS.
Read more |