node_modules/grunt-angular-builder/tasks/middleware/makeDebugBuild.js
/**
 * Generates a script file that inserts SCRIPT tags to the head of the html document, which will load the original
 * source scripts in the correct order. This is used on debug builds.
 * @constructor
 * @implements {MiddlewareInterface}
 * @param {Context} context The execution context for the middleware stack.
 */
Generates a script file that inserts SCRIPT tags to the head of the html document, which will load the original
source scripts in the correct order. This is used on debug builds.
@constructor
@implements {MiddlewareInterface}
@param {Context} context The execution context for the middleware stack.
Generates a script file that inserts SCRIPT tags to the head of the html document which will load the original source scripts in the correct order . This is used on debug builds . @constructor @implements { MiddlewareInterface } @param { Context } context The execution context for the middleware stack .
function MakeDebugBuildMiddleware (context)
{
  var options = context.options.debugBuild;
  var traceOutput = [];
  context.listen (ContextEvent.ON_AFTER_ANALYZE, function ()
  {
    if (options.enabled) {
      var space = context.verbose ? NL : '';
      writeln ('%Generating the <cyan>debug</cyan> build...%', space, space);
    }
  });
  this.analyze = function (filesArray)
  {
  };
  this.trace = function ( module)
  {
    if (!options.enabled) return;
    var rep = options.rebaseDebugUrls;
    module.filePaths ().forEach (function (path)
    {
      if (context.outputtedFiles[path] && context.outputtedFiles[path] !== module.name)
        return;
      context.outputtedFiles[path] = true;
      if (rep)
        for (var i = 0, m = rep.length; i < m; ++i)
          path = path.replace (rep[i].match, rep[i].replaceWith);
      if (path) 
        traceOutput.push (util.sprintf ('<script src=\"%\"></script>', path));
    });
  };
  this.build = function (targetScript)
  {
    if (!options.enabled) return;
    var output = ['document.write (\''];
    if (context.prependOutput)
      output.push (context.prependOutput);
    util.arrayAppend (output, traceOutput);
    if (context.appendOutput)
      output.push (context.appendOutput);
    output.push ('\');');
    util.writeFile (targetScript, output.join ('\\\n'));
  };
}
function MakeDebugBuildMiddleware ( context ) { var options = context . options . debugBuild ; var traceOutput = [ ] ; context . listen ( ContextEvent . ON_AFTER_ANALYZE , function ( ) { if ( options . enabled ) { var space = context . verbose ? NL : '' ; writeln ( '%Generating the <cyan>debug</cyan> build...%' , space , space ) ; } } ) ; this . analyze = function ( filesArray ) { } ; this . trace = function ( module ) { if ( ! options . enabled ) return ; var rep = options . rebaseDebugUrls ; module . filePaths ( ) . forEach ( function ( path ) { if ( context . outputtedFiles [ path ] && context . outputtedFiles [ path ] !== module . name ) return ; context . outputtedFiles [ path ] = true ; if ( rep ) for ( var i = 0 , m = rep . length ; i < m ; ++ i ) path = path . replace ( rep [ i ] . match , rep [ i ] . replaceWith ) ; if ( path ) traceOutput . push ( util . sprintf ( '<script src=\"%\"></script>' , path ) ) ; } ) ; } ; this . build = function ( targetScript ) { if ( ! options . enabled ) return ; var output = [ 'document.write (\'' ] ; if ( context . prependOutput ) output . push ( context . prependOutput ) ; util . arrayAppend ( output , traceOutput ) ; if ( context . appendOutput ) output . push ( context . appendOutput ) ; output . push ( '\');' ) ; util . writeFile ( targetScript , output . join ( '\\\n' ) ) ; } ; }
Generates a script file that inserts SCRIPT tags to the head of the html document, which will load the original
 source scripts in the correct order.
Generates a script file that inserts SCRIPT tags to the head of the html document which will load the original source scripts in the correct order .
/** @type {string[]} */ //-------------------------------------------------------------------------------------------------------------------- // EVENTS //-------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------- // PUBLIC API //-------------------------------------------------------------------------------------------------------------------- /* jshint unused: vars */ // Do nothing /*ModuleDef*/ // Ignore empty path; it means that this middleware should not output a script tag. /* jshint unused: vars */ /** @type {string[]} */ // Output the modules (if any).