Permalink
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (50 sloc) 2.42 KB

package.json (package description)

Mr configures each package based on the contents of package.json, the package description, and the shared configuration. These properties are meaningful to Mr:

  • name: the name of the package, which may be used to connect common dependencies of the same name in subpackages.
  • dependencies: an object mapping a string that represents both a module identifier prefix and a package name, to an ignored version predicate.
  • mappings: an object that maps a module identifier prefix to a dependency. The dependency may be a location string, or an object with location, name, or hash properties. The location may be inferred from dependencies of already discovered packages, or from the location of the dependent package and the name. The hash is generated by an optimizer and only used for loading modules with script injection.

    "mappings": {
        "q": {
            "name": "q",
            "location": "packages/q"
        }
    }

    will cause Mr to load the Q package from ./packages/q instead of ./node_modules/q.

  • overlay: an object defining alternate configurations depending on the platform. Keys correspond to engines and values are alternate properties to overwrite on the package description. For the browser, the window, browser, and montage engines are applied. This property is likely to be deprecated and replaced by an if block or other content-negotiation blocks in the future.

  • directories: an object containing optional lib and packages directory overrides. The lib directory is a location relative to this package at which to find modules. The packages directory is a location relative to this package in which to find unknown packages by name.
  • main: the module identifier of the module that represents this package when required in other packages by the mapping module identier, or in this package by its own name.
  • production: when set to true it puts the system into production mode. Currently this only ignores any devDependencies.
  • redirects: an object that maps module identifiers to an alternate module identifier.

    "redirects": {
        "foo": "foo/index"
    }

    will cause require("foo") to return the exports from the foo/index module.