<commit_before>/**
 * @license
 * Angular Builder's data types.
 * Copyright 2013 <NAME>
 * http://github.com/claudio-silva
 * Licensed under the MIT license.
 */
'use strict';

/* jshint unused: vars */

var util = require ('./gruntUtil')
  , extend = util.extend;

//======================================================================================================================

/**
 * Angular Builder's task options.
 *
 * Note: Middleware classes augment this class with their own options.
 */
function TaskOptions ()
{}

TaskOptions.prototype = {
  /**
   * Main module name. Only this module and its dependencies will be exported.
   * @type {string}
   */
  mainModule:             '',
  /**
   * Code packaging method.
   *
   * When false, the builder generates a single optimized javascript file with all required source code in the correct
   * loading order.
   * When true, the builder generates a set of &lt;script> tags to include all the required source files in the correct
   * loading order.
   *
   * Note: The use of this setting as an option is, probably, not what you want.
   * Use the `debug` task argument instead, as it allows using the same task target for both release and debug builds.
   * @type {boolean}
   */
  debugBuild:             false,
  /**
   * A list of module names to ignore when building.
   * This allows the source code to contain references to modules not present in the build (ex. 3rd party libraries that
   * are loaded independently).
   *
   * If a module reference (for module access or for declaring a dependency) is found in the source code, which targets
   * a module that is not declared anywhere in the build's source files, the build operation aborts when that module
   * name is not present on this list.
   * @type {string|string[]}
   */
  externalModules:        '',
  /**
   * A list of framework built-in modules (ex. 'ng') that will always be appended to the `externalModules` list when
   * running tasks, so that references to them are ignored by the builder.
   * This is reserved for internal use, but could be overridden if you wish to completely replace the built-in behavior.
   * @type {string[]}
   */
  builtinModules:         ['ng'],
  /**
   * A list of modules to be excluded from the build.
   *
   * Unlike <code>externalModules</code>, which excludes each module and all of its dependencies, this option only
   * excludes the specified module from the output, not its dependencies.
   * One typical use for this is to exclude the main module from one or more build tasks.
   * @type {string[]}
   */
  excludedModules:        [],
  /**
   * A list of file paths to prepend to the build output.
   * This forces the inclusion of specific script files, independently of any source file scanning performed
   * by Grunt.
   * @type {string[]}
   */
  require:                [],
  /**
   * Allows loading third-party middleware into the middleware stack.
   * This is a task-level option. Do not specify it at target-level.
   *
   * This option allows the definition of a list of external middleware modules to load and for each one, to specify
   * where to place it on the middleware stack.
   * Each element in the list defines a module name (with the `load` property) and either the `before` or
   * `after` property with the name of a target module on the middleware stack from where to insert the loaded one
   * before or after it.
   * Note: internal middlewares are loaded into the middleware stack before the external middlewares.
   * @type {Array.<{load: string, before?: string, after?: string}>|null}
   */
  externalMiddleware:     null,
  /**
   * Defines the list of middleware bundled with angular-builder.
   * This is a task-level option. Do not specify it at target-level.
   *
   * This option sets a list of modules names to load and assemble into a middleware stack in the specified order.
   * This is reserved for internal use, but could be overridden if you wish to replace some or all of the
   * built-in behavior.
   * WARNING: the order of middleware listed here is important! If you change it, the build process may fail!
   * @type {string[]}
   * @const
   */
  internalMiddleware:     [
    './middleware/analyzer',
    './middleware/sourceCodePathsExporter',
    './middleware/requiredScriptsHandler',
    './middleware/nonAngularScriptsBuilder',
    './middleware/debugBuilder',
    './middleware/releaseBuilder',
    './middleware/stylesheetReferencesHandler',
    './middleware/templateReferencesHandler',
    './middleware/assetReferencesHandler'
  ]
};

//======================================================================================================================

/**
 * A Grunt files array with extended options.
 * @interface
 */
function GruntFilesArrayExt ()
{}

GruntFilesArrayExt.prototype = {
  /**
   * @type {string[]|null}
   */
  src:          null,
  /**
   * @type {string|null}
   */
  dest:         null,
  /**
   * A list of filenames or glob patterns that specify which javascript files should always be included in the build,
   * even if they have no module declarations.
   *
   * <b>Warning:</b> the files must also be matched by <code>src</code> to be included.
   *
   * <b>Note:</b> patterns without slashes will match against the basename of the path even if it contains slashes,
   * eg. pattern <code>*.js</code> will match filepath <code>path/to/file.js</code>.
   *
   * Usually, when a script file is found in the set of source files which doesn't contain a module declaration,
   * that file is ignored.
   * But, if the file name and path matches a file name or glob pattern specified here, it will still be included.
   *
   * Non-module files are output in the same order they were read, and <b>before</b> any module.
   *
   * <b>Tip:</b> You can append the current step's result script to another one that resulted from a previous build
   * step.
   * If you specify a target or file group exclusively for standalone script files and append the result to other built
   * files, you will have more control on the order of the assembled files.
   *
   *  @type {string|string[]|null}
   */
  forceInclude: null

};

//======================================================================================================================

/**
 * API for an Angular Builder middleware plugin.
 * Defines handlers for the three stages of the build process: analyze --> trace --> build.
 *
 * Note: implementing classes must have a compatible constructor.
 *
 * @interface
 * @param {Context} context The execution context for the middleware stack.
 */
function MiddlewareInterface (context)
{}

MiddlewareInterface.prototype = {
  /**
   * Extend the task's options with the middleware's default values for its custom options.
   *
   * @param {function(Object)} extend A function that should be called with the middleware's default option values as
   * the argument.
   */
  options: function (extend) {},
  /**
   * Load and analyze the specified source files.
   * Invoked once.
   *
   * @param {GruntFilesArrayExt} filesArray The set of source code files to be processed.
   */
  analyze: function (filesArray) {},
  /**<commit_msg>Removed obsolete MiddlewareInterface.options.<commit_after>/**
 * @license
 * Angular Builder's data types.
 * Copyright 2013 <NAME>
 * http://github.com/claudio-silva
 * Licensed under the MIT license.
 */
'use strict';

/* jshint unused: vars */

var util = require ('./gruntUtil')
  , extend = util.extend;

//======================================================================================================================

/**
 * Angular Builder's task options.
 *
 * Note: Middleware classes augment this class with their own options.
 */
function TaskOptions ()
{}

TaskOptions.prototype = {
  /**
   * Main module name. Only this module and its dependencies will be exported.
   * @type {string}
   */
  mainModule:             '',
  /**
   * Code packaging method.
   *
   * When false, the builder generates a single optimized javascript file with all required source code in the correct
   * loading order.
   * When true, the builder generates a set of &lt;script> tags to include all the required source files in the correct
   * loading order.
   *
   * Note: The use of this setting as an option is, probably, not what you want.
   * Use the `debug` task argument instead, as it allows using the same task target for both release and debug builds.
   * @type {boolean}
   */
  debugBuild:             false,
  /**
   * A list of module names to ignore when building.
   * This allows the source code to contain references to modules not present in the build (ex. 3rd party libraries that
   * are loaded independently).
   *
   * If a module reference (for module access or for declaring a dependency) is found in the source code, which targets
   * a module that is not declared anywhere in the build's source files, the build operation aborts when that module
   * name is not present on this list.
   * @type {string|string[]}
   */
  externalModules:        '',
  /**
   * A list of framework built-in modules (ex. 'ng') that will always be appended to the `externalModules` list when
   * running tasks, so that references to them are ignored by the builder.
   * This is reserved for internal use, but could be overridden if you wish to completely replace the built-in behavior.
   * @type {string[]}
   */
  builtinModules:         ['ng'],
  /**
   * A list of modules to be excluded from the build.
   *
   * Unlike <code>externalModules</code>, which excludes each module and all of its dependencies, this option only
   * excludes the specified module from the output, not its dependencies.
   * One typical use for this is to exclude the main module from one or more build tasks.
   * @type {string[]}
   */
  excludedModules:        [],
  /**
   * A list of file paths to prepend to the build output.
   * This forces the inclusion of specific script files, independently of any source file scanning performed
   * by Grunt.
   * @type {string[]}
   */
  require:                [],
  /**
   * Allows loading third-party middleware into the middleware stack.
   * This is a task-level option. Do not specify it at target-level.
   *
   * This option allows the definition of a list of external middleware modules to load and for each one, to specify
   * where to place it on the middleware stack.
   * Each element in the list defines a module name (with the `load` property) and either the `before` or
   * `after` property with the name of a target module on the middleware stack from where to insert the loaded one
   * before or after it.
   * Note: internal middlewares are loaded into the middleware stack before the external middlewares.
   * @type {Array.<{load: string, before?: string, after?: string}>|null}
   */
  externalMiddleware:     null,
  /**
   * Defines the list of middleware bundled with angular-builder.
   * This is a task-level option. Do not specify it at target-level.
   *
   * This option sets a list of modules names to load and assemble into a middleware stack in the specified order.
   * This is reserved for internal use, but could be overridden if you wish to replace some or all of the
   * built-in behavior.
   * WARNING: the order of middleware listed here is important! If you change it, the build process may fail!
   * @type {string[]}
   * @const
   */
  internalMiddleware:     [
    './middleware/analyzer',
    './middleware/sourceCodePathsExporter',
    './middleware/requiredScriptsHandler',
    './middleware/nonAngularScriptsBuilder',
    './middleware/debugBuilder',
    './middleware/releaseBuilder',
    './middleware/stylesheetReferencesHandler',
    './middleware/templateReferencesHandler',
    './middleware/assetReferencesHandler'
  ]
};

//======================================================================================================================

/**
 * A Grunt files array with extended options.
 * @interface
 */
function GruntFilesArrayExt ()
{}

GruntFilesArrayExt.prototype = {
  /**
   * @type {string[]|null}
   */
  src:          null,
  /**
   * @type {string|null}
   */
  dest:         null,
  /**
   * A list of filenames or glob patterns that specify which javascript files should always be included in the build,
   * even if they have no module declarations.
   *
   * <b>Warning:</b> the files must also be matched by <code>src</code> to be included.
   *
   * <b>Note:</b> patterns without slashes will match against the basename of the path even if it contains slashes,
   * eg. pattern <code>*.js</code> will match filepath <code>path/to/file.js</code>.
   *
   * Usually, when a script file is found in the set of source files which doesn't contain a module declaration,
   * that file is ignored.
   * But, if the file name and path matches a file name or glob pattern specified here, it will still be included.
   *
   * Non-module files are output in the same order they were read, and <b>before</b> any module.
   *
   * <b>Tip:</b> You can append the current step's result script to another one that resulted from a previous build
   * step.
   * If you specify a target or file group exclusively for standalone script files and append the result to other built
   * files, you will have more control on the order of the assembled files.
   *
   *  @type {string|string[]|null}
   */
  forceInclude: null

};

//======================================================================================================================

/**
 * API for an Angular Builder middleware plugin.
 * Defines handlers for the three stages of the build process: analyze --> trace --> build.
 *
 * Note: implementing classes must have a compatible constructor.
 *
 * @interface
 * @param {Context} context The execution context for the middleware stack.
 */
function MiddlewareInterface (context)
{}

MiddlewareInterface.prototype = {
  /**
   * Load and analyze the specified source files.
   * Invoked once.
   *
   * @param {GruntFilesArrayExt} filesArray The set of source code files to be processed.
   */
  analyze: function (filesArray) {},
  /**
{'fraction_non_alphanumeric': 0.13399591175019385, 'fraction_numerical': 0.0007048706562345809, 'mean_word_length': 3.277359059391016, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7276453', 'n_tokens_mistral': 3703, 'n_tokens_neox': 3640, 'n_words': 1690}