Status: BETA - Mostly stable API undergoing wider testing.
The loader allows for bootstrapping a consistent and state-of-the-art CommonJS environment
for any supported platform (on servers, in browsers, desktop applications, secure sandboxes, and embedded) and thus
is ideally suited to be used as the target for the
commonjs command and the
Status: See ./NOTES.md
This module loader brings CommonJS Modules/2 (currently in draft) plus CommonJS Packages, Package Mappings and further concepts to the following platforms:
- NodeJS - Boot via
commonjs program.jsonor via
- Jetpack - Use it in any Gecko/XULRunner extension or application
- Titanium - Use it in any Appcelerator Titanium application
- RingoJS - Use it in any RingoJS application
- AdobeAir - Use it in any AdobeAir application
- GPSEE - Use it in any GPSEE application
- v8cgi - Use it in any v8cgi application
- Narwhal - Use it with any Narwhal engine platform
- Wakanda (In Progress)
- CouchApp (Initial exploration)
- Rhino (Not Yet Implemented)
- PhoneGap (Not Yet Implemented)
- Browser - For development and optimized production purposes
The loader implements or is compatible with the following specs:
- CommonJS Modues/1.1.1 (approved)
- CommonJS Modues/2.0draft8 (draft)
- CommonJS Modules/AsynchronousDefinition (proposal) (partial)
- CommonJS Packages/1.1 (draft)
- CommonJS Packages/Mappings/C (proposal)
- CommonJS Modules/LoaderPlugin (proposal) (partial)
The loader extends the core CommonJS platform defined by the above specifications with the following additions:
- CommonJS Programs/A (strawman) (Not Yet Documented)
- Various additions and generalizations to be able to load a wide range of packages. (Not Yet Documented)
The loader can be used:
- By calling it from the command line to run a program
require()ing it from any CommonJS module to load a sub-program
- By setting it up as a package server to load programs into a browser
- Aims to be complete and fully specification compliant where possible.
- Aims to validate the CommonJS Program and Mappings approaches and inform CommonJS specifications.
- Provisions and executes programs by downloading and linking dependencies on first use.
- By default isolates the dependencies for each program.
- Can provision complex applications (programs) composed of hundreds of packages by contacting an open network of public registry and repository servers. (Not Yet Implemented)
- Can load complex applications (programs) composed of hundreds of packages from Content Delivery Networks fed by a simple program server. (Not Yet Implemented)
- Supports REMOTE LIVE application DEBUGGING and EDITING for DEPLOYED applications running on any ANY PLATFORM (
eval()or equivalent required). (Not Yet Implemented)
The loader is a sub-project of the PINF Toolchain Automation Platform where an application (program) is a view into the toolchain that statically links package-based dependencies.
The toolchain is an organized body of code & services maintained collectively for the purpose of automating software production and system operation. Any CommonJS package may be used as part of the toolchain.
Demo: Hello World
Assumes NodeJS is installed. See ./docs/Setup.md for instructions.
git clone git://github.com/pinf/loader-js.git cd ./loader-js node ./pinf-loader -v ./demos/HelloWorld # If `commonjs` is linked to `./pinf-loader.sh` and on `$PATH` commonjs -v ./demos/HelloWorld
For more internal development focused demos see: ./docs/Demos.md
High-level Introduction (presentation slides)
Setup - Setup your
Demos - Looking at the source code of the demos is a good place to start.
Use Cases - The loader can be used in various ways.
Writing Programs - A quick introduction.
Source Overlays - Use cloned source code instead of downloaded archive for a package.
Compare to other loaders (third party link)
Support, Feedback & News
Developer mailing list: http://groups.google.com/group/pinf-dev/
- Clean hierarchical sandbox implementation.
- Refactored and abstracted program server to support various plugins.
- Consistent and reliable file and line info for errors and stack traces across all platforms.
- Refactor to leverage Q promises throughout.
- Run exported programs on all platforms (not just browser).
- Refactor, abstract and simplify various concepts like descriptors, locators, mapping resolver.
You can find a list of things to get involved with here: ./NOTES.md
Collaboration Platform: https://github.com/pinf/loader-js/
- Discuss your change on the mailing list
- Write a patch on your own
- Send pull request on github & ping mailing list
- Discuss pull request on github to refine
You must explicitly license your patch by adding the following to the top of any file you modify in order for your patch to be accepted:
// - <GithubUsername>, First Last <Email>, Copyright YYYY, MIT License
This project would not be possible without the following:
- CommonJS - For framing requirements into specifications
- BravoJS - For a pure and clean CommonJS Modules/2 loader implementation
- NodeJS - For providing a solid runtime used by default
- Firefox - For providing an amazing browser platform
- Jetpack - For providing a decent extension environment, API and tooling
- Firebug - For the amazing developer tool it is
- nodules - For implementing and refining CommonJS Packages/Mappings/C
- pinf - For implementing and refining various designs and specifications
- Narwhal - For providing an experimentation ground while prototyping conceps
- Github - For igniting a generation of collaborative development
This project uses code from:
Copyright (c) 2011+ Christoph Dorn
Copyright (c) 2011+ Christoph Dorn
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.