metadata

  • typedef
load.metadata {Object}  

An object that is passed between Loader hooks. Any values can be set. These are the ones that steal.js recognize.

Object

Properties

  1. format {String}

    Specifies what type of Syntax is used. This can be specified like:

    "format amd";
    
  2. deps {Array<moduleName>}Optional

    Dependencies of this module. If the module is a global but implicitly depends on another, like jQuery, add that dependency here.

    "meta": {
      "jquery-cookie": {
        "deps": ["jquery"]
      }
    }
    
  3. exports {String}Optional

    The global property that is exported as this module's default export.

  4. init {function(Module...)}Optional

    Allows for calling noConflict and for other cleanup. this will be the global object.

    • {Module}
  5. sideBundle=false {Boolean}Optional

    Create a bundle for this module and exclude it from StealTool's bundle optimization algorithm. This is useful for modules that are infrequently used, like a page for your app that users rarely visit.

    "meta": {
      "moduleA": {
        "sideBundle": true
      }
    }
    
  6. bundle=false {Boolean}Optional

    Exclude a module from being bundled.

    "meta": {
      "MODULENAME": {
        "bundle": false
      }
    }
    

    If you exclude a module from the bundled file, you have to make sure, that in the production environment configuration the module is:

  7. useLocalDeps=false {Boolean}Optional

    Include module dependencies in the development bundle.

    "meta": {
      "MODULENAME": {
        "useLocalDeps": true
      }
    }
    

    In this example all dependencies imported by MODULENAME will be included in the bundle during build.

    This option can be used alongside environment dependant configuration to make sure a specific version of a module is used during build time but the original (local) module dependencies are included in the development bundle.

    "steal": {
      "meta": {
        "steal-less/less": {
          "useLocalDeps: true
        }
      },
      "envs": {
        "bundle-build": {
          "map" {
            "steal-less/less-engine": "steal-less/less-engine-node"
          }
        }
      }
    }
    

    The configuration above makes it so the NodeJS version of less is loaded while the application is built but useLocalDeps forces the local dependencies of steal-less#less to be included in the bundle.

  8. eval=function {String}Optional

    Specify the type of eval that should be applied to this module.

    Most modules are evaled using the Function constructor like: new Function(source).call(context). However, if you have a global module that looks like:

    var Foo = function(){
    
    };
    

    Where Foo is the exported value in your configuration:

    "steal": {
        "meta": {
            "foo": {
                "format": "global",
                "exports": "Foo"
            }
        }
    }
    

    In this situation, the default new Function method of evaluation will not work and the Foo variable will not be set on the window. In this case we want to update our eval configuration to script:

    "steal": {
        "meta": {
            "foo": {
                "format": "global",
                "exports": "Foo",
                "eval": "script"
            }
        }
    }
    

    This will use <script> elements for evaluation and the Foo property will be set.

  9. globals {Object}

    A map of globals to module names expected to be present for the execution of this module.

    This is useful for legacy code that relies on globals being defined during execution; the module names referenced are automatically turned into dependencies of this module.

    If you have a global module foo, that looks like this:

    var something = $$$;
    

    Use the following configuration to make sure the global variable $$$ is defined before foo is executed:

    "steal": {
        "meta": {
            "foo": {
                "format": "global", 
                "globals": {
                    "$$$": "bar"
                }
            }
        }
    }
    
Help us improve StealJS by taking our community survey