Why AMD as the authoring format?
Because AMD is awesome!
Since most node.js modules are installed through npm it's easier to write it using the AMD format and them convert into a node.js compatible format during npm publish
. We use nodefy to convert the AMD modules into regular node.js modules so it won't add any extra overhead for your node.js apps. The opposite approach would be harder to automate.
By keeping each function in a separate package we can require just the methods/packages that are required by our app and let the RequireJS optimizer bundle only what is currently being used. We also have an extra benefit that we split the methods into separate packages so we reduce the chance of name collisions and the code is more organized. AMD is flexible and enables things that wouldn't be possible with a different module system or with a conventional namespace approach (remapping a module, conditionally loading, etc).
Read these links if you still can't see why:
- MOUT & Modularity
- Why AMD?
- AMD is better for the web than CJS modules
- AMD & CommonJS modules
- AMD vs. CJS
- Namespaces are Old School
It's fairly easy to write tools to convert between the different formats so it should not be an issue in case in the future we decide to change it.
PS: Your mileage may vary...