<commit_before>lib = require('../../lib')
config = require('../../config')
util = require('../../util')
transpile = require('../transpile')

module.exports = util.fnOptionLazyPipe(
  {
    isPlugin: false
    umd: {}
    umdCoffeeScript: {}
    umdNode: {}
    umdWeb: {}
    umdUmd: {}
    transpile: {}
  }
  (options) ->
    lib.pipe.lazypipe()
    .pipe -> lib.pipe.if(
      config.glob.coffeeScript
      (
        lib.pipe.lazypipe()
        .pipe -> lib.pipe.if(
          options.isPlugin
          lib.pipe.mirror(
            (
              lib.pipe.lazypipe()
              .pipe -> lib.metadata.rename({
                suffix: '.apply'
              })
            )()
            (
              lib.pipe.lazypipe()
              .pipe -> lib.metadata.rename({
                suffix: '.applied'
              })
              .pipe -> lib.transform.insert.transform((contents, file) ->
                contents + """
                #{file.data.exports}(#{options.params.join(', ')})
                """
              )
              .pipe -> lib.metadata.data((file) ->
                file.data.exports = file.data.namespace = file.data.dependencies[0].param ? file.data.dependencies[0].name
                return file.data
              )
            )()
          )
        )
        .pipe -> lib.pipe.mirror(
          module.exports.umdCoffeeScript(options.umd, options.umdCoffeeScript)
          (
            lib.pipe.lazypipe()
            .pipe -> transpile(options.transpile, { coffeeCoverage: null })
            .pipe -> module.exports(options)
          )()
          (
            lib.pipe.lazypipe()
            .pipe -> transpile(options.transpile, { coffeeScript: null })
            .pipe -> module.exports(options)
          )()
        )
      )()
      lib.pipe.mirror(
        module.exports.umdNode(options.umd, options.umdNode)
        module.exports.umdWeb(options.umd, options.umdWeb)
        module.exports.umdUmd(options.umd, options.umdUmd)
      )
    )
)

module.exports.umdCoffeeScript = util.fnOptionLazyPipe(
  {
    umd: config.umd
  }
  {
    umd: {
      templateSource: '''
        <%
          for (var i = 0; i != dependencies.length; ++i) {
            %><%= dependencies[i].param %> = require('<%= dependencies[i].cjs || dependencies[i].name %>')
        <%
          }
        %>
        <%= contents %>
        module.exports = <%= exports %>
        '''
    }
  }
  (options) ->
    lib.pipe.lazypipe()
    .pipe -> lib.transform.umd(options.umd)
)


module.exports.umdNode = util.fnOptionLazyPipe(
  {
    umd: config.umd
  }
  {
    umd: {
      templateName: 'node'
    }
    rename: {
      suffix: '.node'
    }
  }
  (options) ->
    lib.pipe.lazypipe()
    .pipe -> lib.transform.umd(options.umd)
    .pipe -> lib.metadata.rename(options.rename)
)

module.exports.umdWeb = util.fnOptionLazyPipe(
  {
    umd: config.umd
  }
  {
    umd: {
      templateName: 'amdWeb'
    }
    rename: {
      suffix: '.web'
    }
  }
  (options) ->
    lib.pipe.lazypipe()
    .pipe -> lib.transform.umd(options.umd)
    .pipe -> lib.metadata.rename(options.rename)
)

module.exports.umdUmd = util.fnOptionLazyPipe(
  {
    umd: config.umd
  }
  {
    umd: {
      templateName: 'amdNodeWeb'
    }
    rename: {
      suffix: '.umd'
    }
  }
  (options) ->
    lib.pipe.lazypipe()
    .pipe -> lib.transform.umd(options.umd)
    .pipe -> lib.metadata.rename(options.rename)
)
<commit_msg>Adding .coverage suffix as necessary<commit_after>lib = require('../../lib')
config = require('../../config')
util = require('../../util')
transpile = require('../transpile')

module.exports = util.fnOptionLazyPipe(
  {
    isPlugin: false
    umd: {}
    umdCoffeeScript: {}
    umdNode: {}
    umdWeb: {}
    umdUmd: {}
    transpile: {}
  }
  (options) ->
    lib.pipe.lazypipe()
    .pipe -> lib.pipe.if(
      config.glob.coffeeScript
      (
        lib.pipe.lazypipe()
        .pipe -> lib.pipe.if(
          options.isPlugin
          lib.pipe.mirror(
            (
              lib.pipe.lazypipe()
              .pipe -> lib.metadata.rename({
                suffix: '.apply'
              })
            )()
            (
              lib.pipe.lazypipe()
              .pipe -> lib.metadata.rename({
                suffix: '.applied'
              })
              .pipe -> lib.transform.insert.transform((contents, file) ->
                contents + """
                #{file.data.exports}(#{options.params.join(', ')})
                """
              )
              .pipe -> lib.metadata.data((file) ->
                file.data.exports = file.data.namespace = file.data.dependencies[0].param ? file.data.dependencies[0].name
                return file.data
              )
            )()
          )
        )
        .pipe -> lib.pipe.mirror(
          module.exports.umdCoffeeScript(options.umd, options.umdCoffeeScript)
          (
            lib.pipe.lazypipe()
            .pipe -> transpile(options.transpile, { coffeeCoverage: null })
            .pipe -> module.exports(options)
          )()
          (
            lib.pipe.lazypipe()
            .pipe -> transpile(options.transpile, { coffeeScript: null })
            .pipe -> lib.metadata.rename({
              suffix: '.coverage'
            })
            .pipe -> module.exports(options)
          )()
        )
      )()
      lib.pipe.mirror(
        module.exports.umdNode(options.umd, options.umdNode)
        module.exports.umdWeb(options.umd, options.umdWeb)
        module.exports.umdUmd(options.umd, options.umdUmd)
      )
    )
)

module.exports.umdCoffeeScript = util.fnOptionLazyPipe(
  {
    umd: config.umd
  }
  {
    umd: {
      templateSource: '''
        <%
          for (var i = 0; i != dependencies.length; ++i) {
            %><%= dependencies[i].param %> = require('<%= dependencies[i].cjs || dependencies[i].name %>')
        <%
          }
        %>
        <%= contents %>
        module.exports = <%= exports %>
        '''
    }
  }
  (options) ->
    lib.pipe.lazypipe()
    .pipe -> lib.transform.umd(options.umd)
)


module.exports.umdNode = util.fnOptionLazyPipe(
  {
    umd: config.umd
  }
  {
    umd: {
      templateName: 'node'
    }
    rename: {
      suffix: '.node'
    }
  }
  (options) ->
    lib.pipe.lazypipe()
    .pipe -> lib.transform.umd(options.umd)
    .pipe -> lib.metadata.rename(options.rename)
)

module.exports.umdWeb = util.fnOptionLazyPipe(
  {
    umd: config.umd
  }
  {
    umd: {
      templateName: 'amdWeb'
    }
    rename: {
      suffix: '.web'
    }
  }
  (options) ->
    lib.pipe.lazypipe()
    .pipe -> lib.transform.umd(options.umd)
    .pipe -> lib.metadata.rename(options.rename)
)

module.exports.umdUmd = util.fnOptionLazyPipe(
  {
    umd: config.umd
  }
  {
    umd: {
      templateName: 'amdNodeWeb'
    }
    rename: {
      suffix: '.umd'
    }
  }
  (options) ->
    lib.pipe.lazypipe()
    .pipe -> lib.transform.umd(options.umd)
    .pipe -> lib.metadata.rename(options.rename)
)

{'fraction_non_alphanumeric': 0.1576017130620985, 'fraction_numerical': 0.0008565310492505353, 'mean_word_length': 1.5616087751371115, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 66, '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': '6507798', 'n_tokens_mistral': 2400, 'n_tokens_neox': 2327, 'n_words': 304}