TransformOptions

  • typedef
steal-tools.transform.options {Object}  

Specify the behavior of a transform.

Object

Properties

  1. ignore {Array<RegExp | String | function(String, Load)>}Optional

    An Array of regular expressions, or strings that specify moduleNames that should not be included in the output.

    Module names that match the regular expressions are not included. The following ignores everything in can/util/.

    transform("can/construct",{ignore: [/^can\/util\/]});
    

    Module names and their dependencies that match the strings in the array are not included. The following will not include "can/construct", and all of its dependencies:

    transform("can/component",{ignore: ["can/construct"]});
    
  2. removeDevelopmentCode=true {Boolean}Optional

    By default, removes code in between comments, like:

    //!steal-remove-start
    REMOVE.THIS;
    //!steal-remove-end
    

    If removeDevelopmentCode is false, this code is not removed.

  3. format='global' {String}Optional

    What format the output will be transpiled to. By default the format is "global". "global" means the code will be transpiled to work standalone. Module dependencies that are not included should be mapped to their name on the global object in exports.

    The other possible format values are "steal","amd", and "cjs".

  4. noGlobalShim=false {Boolean}Optional

    By default, if options.format is "global" then a global shim will be applied. This is so that the script can be run standalone. Setting noGlobalShim to true prevents adding the shim. Excluding the shim means it will have to be run with an AMD loader like requirejs.

  5. exports {Object<moduleName,String>}Optional

    A mapping of module names to their name on the global object (such as the window). For example, if an output depends on jQuery, but does not include it, you should include:

    transform("mywidget",{exports: {"jquery": "jQuery"}})
    

    Conversely you can also use exports to set values that should be exported from your module. For example, if you have a module foo that exports a value like:

    module.exports = "foo bar";
    

    You can specify where this module should be set on the window:

    transform("mywidget", {
      exports: {
        "foo": "foo.bar"
      }
    });
    

    Which, when the script runs will result in:

    window.foo.bar === "foo bar";
    
  6. useNormalizedDependencies=true {Boolean}Optional

    Use normalized dependency names instead of relative module names. For example "foo/bar" will be used instead of "./bar".

  7. normalize {function(depName, depLoad, curName, curLoad)}Optional

    An optional function that will normalize all module names written out. Use this for custom normalization behavior.

    • depName {String}

      The dependency name to normalize.

    • depLoad {Load}

      The load object for the dependency to normalize.

    • curName {String}

      The moduleName of the module whose dependencies are being normalized.

    • curLoad {Load}

      The load object of the module whose dependencies are being normalized.

  8. minify=false {Boolean}Optional

    By default, the output is not minified. Set to true to minify the result.

  9. ignoreAllDependencies=false {Boolean}Optional

    By default, the dependencies of the module specified are included, unless they are explicitly ignored. Setting ignoreAllDependencies to true only results in returning that individual module as the output.

  10. includeTraceurRuntime=true {Boolean}Optional

    By default, if an ES6 module is found and the transpiler config is set to traceur (the default), the @traceur runtime is packaged with the output. Setting this to false prevents that behavior.

  11. sourceMaps=false {Boolean}Optional

    To generate source maps alongside your transformed source, set this option to true.

  12. sourceMapsContent=false {Boolean}Optional

    Include the original source contents in the generated source maps.

Help us improve StealJS by taking our community survey