tasks/middleware/exportSourcePaths.js
function ExportSourceCodePathsMiddleware (context)
{
  var options = context.options.sourcePaths;
  /**
   * Paths of all the required files (excluding standalone scripts) in the correct loading order.
   * @type {string[]}
   */
  var tracedPaths = [];

  //--------------------------------------------------------------------------------------------------------------------
  // PUBLIC API
  //--------------------------------------------------------------------------------------------------------------------

  this.analyze = function (filesArray)
  {
    /* jshint unused: vars */
    // Do nothing
  };

  this.trace = function (module)
  {
    tracedPaths.push (module.headPath);
    arrayAppend (tracedPaths, module.bodyPaths);
  };

  this.build = function (targetScript)
  {
    /* jshint unused: vars */

    var scripts = [];

    // Include paths of forced-include scripts.

    if (context.standaloneScripts.length)
      arrayAppend (scripts, context.standaloneScripts.map (function (e)
      {
        return e.path;
      }));

    // Include all module files.

    arrayAppend (scripts, tracedPaths);

    // Export.

    context.grunt.config (options.exportToConfigProperty, scripts);
  };
}
function ExportSourceCodePathsMiddleware (context)
{
  var options = context.options.sourcePaths;
  /**
   * Paths of all the required files (excluding standalone scripts) in the correct loading order.
   * @type {string[]}
   */
  var tracedPaths = [];

  //--------------------------------------------------------------------------------------------------------------------
  // PUBLIC API
  //--------------------------------------------------------------------------------------------------------------------

  this.analyze = function (filesArray)
  {
    /* jshint unused: vars */
    // Do nothing
  };

  this.trace = function (module)
  {
    tracedPaths.push (module.headPath);
    arrayAppend (tracedPaths, module.bodyPaths);
  };

  this.build = function (targetScript)
  {
    /* jshint unused: vars */

    var scripts = [];

    // Include paths of forced-include scripts.

    if (context.standaloneScripts.length)
      arrayAppend (scripts, context.standaloneScripts.map (function (e)
      {
        return e.path;
      }));

    // Include all module files.

    arrayAppend (scripts, tracedPaths);

    // Export.

    context.grunt.config (options.exportToConfigProperty, scripts);
  };
}
function ExportSourceCodePathsMiddleware ( context ) { var options = context . options . sourcePaths ; /**
   * Paths of all the required files (excluding standalone scripts) in the correct loading order.
   * @type {string[]}
   */ var tracedPaths = [ ] ; //-------------------------------------------------------------------------------------------------------------------- // PUBLIC API //-------------------------------------------------------------------------------------------------------------------- this . analyze = function ( filesArray ) { /* jshint unused: vars */ // Do nothing } ; this . trace = function ( module ) { tracedPaths . push ( module . headPath ) ; arrayAppend ( tracedPaths , module . bodyPaths ) ; } ; this . build = function ( targetScript ) { /* jshint unused: vars */ var scripts = [ ] ; // Include paths of forced-include scripts. if ( context . standaloneScripts . length ) arrayAppend ( scripts , context . standaloneScripts . map ( function ( e ) { return e . path ; } ) ) ; // Include all module files. arrayAppend ( scripts , tracedPaths ) ; // Export. context . grunt . config ( options . exportToConfigProperty , scripts ) ; } ; }
Exports to Grunt's global configuration the paths of all script files that are required by the application,
in the order defined by the modules' dependency graph.
@constructor
@implements {MiddlewareInterface}
@param {Context} context The execution context for the middleware stack.
Exports to Grunt s global configuration the paths of all script files that are required by the application in the order defined by the modules dependency graph .