modjewel-require.js file provides
functions for use with CommonJS modules,
designed for use in web browsers. The
define() function is as
specified in Asynchronous Module Definition
Note that dynamic loading is not supported; see the note on
Runs tests from the commonjs project.
test/run-tests.sh file to run the tests. The tests will run
in both the browser and command-line via Rhino.
Note that one test failure is occurring with the assert tests. Looks like a bogus test to me.
This module is not really supported, but a system module is supplied with a
This function allows you to "preload" a module. In fact, this is the only way to load modules - modules are never loaded dynamically.
The object passed to this function is described in Asynchronous Module Definition.
Using modjewel, you will have a free module available for you to
with the module id
"modjewel". This module exports the following
properties and functions:
Returns the current version of modjewel.
Returns an array of strings which are the module ids which have currently been loaded.
Returns an array of strings which are the module ids which have currently
been preloaded with the
Returns the module with the specified moduleId. Use
null to get the
Returns the module ids that the specified module
Issue a warning if a module is being recursively required. That is, in the process of the module being loaded, if it requires a module that in turn ends up requiring itself, a console message is generated indicating this.
In general, you don't need to worry about this. You do need to worry
about this if you make use of the
module.exports = trick of changing
your module's exports value. In this case, your new
may not be set before another module needs it. Using this flag will
warn you of such cases. You may need to restructure your modules, or
change the order in which you set the
exports object and make
Note that modjewel itself supports the
module.exports = trick to
reassign a module's
export value. This is useful if you'd like to
export a single function or class from your module, so that clients
of the module don't need to further derference the
to get at your goodies.
Convert CommonJS modules to AMD format. It can also generate a HTML
test driver to test the modules in a browser. It generates files named
(original base name).amd.js from files named
(original base name).js.
The generated files have code prefixing and suffixing the original file
contents with a
define() invocation. The contents of the file
are otherwise unchanged, and the line numbers for the content will be the
same in both files.
Use the modjewel project at github for communication.