<commit_before>const path = require('path');
const { readFile } = require('fildes');
const stylelint = require('stylelint');
const postcss = require('postcss');
const importCSS = require('postcss-import');
const copyCSS = require('postcss-copy');
const pxtorem = require('postcss-pxtorem');
const cssnext = require('postcss-cssnext');
const reporter = require('postcss-reporter');
const { log } = require('./log.js');

const lint = stylelint({
  extends: 'stylelint-config-standard',
  rules: {
    'max-empty-lines': 2
  },
  ignoreFiles: ['node_modules/**']
});

module.exports = ({ input, output }) => {
  return readFile(input)
  .then(css => {
    return postcss([
      lint,
      importCSS({
        plugins: [lint],
        onImport: files => {
          files = files.map(file => path.relative(process.cwd(), file))
          log('IMPORTS', files)
        }
      }),
      copyCSS({
        src: ['node_modules'],
        dest: 'dist/fonts/',
        template: '[name].[hash].[ext]',
        relativePath: (dirname, fileMeta, result, opts) => {
          return path.dirname(result.opts.to);
        }
      }),
      pxtorem({
        rootValue: 16,
        unitPrecision: 4,
        replace: true,
        mediaQuery: true
      }),
      cssnext({
        browsers: [
          'android >= 4',
          'ios >= 8',
          'chrome >= 45', // 9
          'firefox >= 3.6',
          'ie >= 8'
        ],
        features: {
          rem: {
            rootValue: 16,
            unitPrecision: 4
          }
        }
      }),
      reporter()
    ])
    .process(css, {
      from: input,
      to: output,
      map: {
        inline: false
      }
    })
  })
}

module.exports.foo = 'bar'
<commit_msg>sets copy dest relative to output directory<commit_after>const { dirname, join, relative } = require('path');
const { readFile } = require('fildes');
const stylelint = require('stylelint');
const postcss = require('postcss');
const importCSS = require('postcss-import');
const copyCSS = require('postcss-copy');
const pxtorem = require('postcss-pxtorem');
const cssnext = require('postcss-cssnext');
const reporter = require('postcss-reporter');
const { log } = require('./log.js');

const lint = stylelint({
  extends: 'stylelint-config-standard',
  rules: {
    'max-empty-lines': 2
  },
  ignoreFiles: ['node_modules/**']
});

module.exports = ({ input, output, assets = '../fonts' }) => {
  return readFile(input)
  .then(css => {
    return postcss([
      lint,
      importCSS({
        plugins: [lint],
        onImport: files => {
          files = files.map(file => relative(process.cwd(), file))
          log('IMPORTS', files)
        }
      }),
      copyCSS({
        src: ['node_modules'],
        dest: join(dirname(output), assets),
        template: '[name].[hash].[ext]',
        relativePath: (dir, fileMeta, result, opts) => {
          return dirname(result.opts.to);
        }
      }),
      pxtorem({
        rootValue: 16,
        unitPrecision: 4,
        replace: true,
        mediaQuery: true
      }),
      cssnext({
        browsers: [
          'android >= 4',
          'ios >= 8',
          'chrome >= 45', // 9
          'firefox >= 3.6',
          'ie >= 8'
        ],
        features: {
          rem: {
            rootValue: 16,
            unitPrecision: 4
          }
        }
      }),
      reporter()
    ])
    .process(css, {
      from: input,
      to: output,
      map: {
        inline: false
      }
    })
  })
}

module.exports.foo = 'bar'

{'fraction_non_alphanumeric': 0.1641113003975014, 'fraction_numerical': 0.008517887563884156, 'mean_word_length': 1.9906621392190154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '717611', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1078, 'n_words': 237}