ServerJS/Modules/Meta

From MozillaWiki
< ServerJS‎ | Modules
Revision as of 06:02, 8 June 2009 by KrisKowal (talk | contribs) (added proposal for "module" object.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Contract

Module Context

  1. In a module, there is a free variable "require", that is a function.
    1. The "require" function may have a "main" property that is the top-level "id" of the program.
    2. The "require" function may have a "paths" attribute, that is a prioritized Array of path Strings, from high to low, of paths to top-level module directories. The "paths" property must not exist in "sandbox" (a secured module system).
  2. In a module, there must be a free variable "module", that is an Object.
    1. The "module" object must have an "id" that is the top-level "id" of the module.
    2. The "module" object may have a "path" String that is the fully-qualified path to the file from which the module was created. The "path" property must not exist in a sandbox.

Discussion