CommonJS

CommonJSとは、サーバーサイドなどのウェブブラウザ環境外におけるJavaScriptの各種仕様を定めることを目標としたプロジェクトである。

歴史

CommonJSプロジェクトは元々、2009年1月にMozillaのエンジニアKevin Dangoorにより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.

—Kevin Dangoor

2009年8月、プロジェクトはより広い範囲のAPIを対象とすることを示すために、現在のCommonJSへと改名された。仕様の作成と採用はオープンプロセスで進められた。仕様は複数の実装が完了した後、最終的に確定とされたCommonJSはECMAScriptの仕様を定めるEcmaインターナショナルのTC39グループとは直接関係はないが、TC39のメンバーの一部はCommonJSプロジェクトに参加している。。

2013年5月、Node.jsのパッケージマネージャーnpmの作者であるIsaac Z. Schlueterは、CommonJSはNode.jsにとって時代遅れになりつつあり、Node.jsの主要開発者はCommonJSから離れていると語った。

仕様

CommonJSで定められた仕様としては以下のようなものがある なおModuleとPromiseについては、後に2015年のECMAScript 6で標準規格が定められている。。

現行

  • Modules/1.0 (Modules/1.1で廃止)
  • Modules/1.1
  • Modules/1.1.1
  • Packages/1.0
  • Promises/B
  • Promises/C
  • System/1.0

提案

  • Binary/B
  • Binary/F
  • Console
  • Encodings/A
  • Filesystem/A
  • Filesystem/A/0
  • Modules/Async/A
  • Modules/Transport/B
  • Packages/1.1
  • Packages/Mappings
  • Unit Testing/1.0

実装

関連項目