<commit_before>/*
 * grunt-autoprefixer
 *
 * Copyright (c) 2013 <NAME>
 * Licensed under the MIT license.
 */

module.exports = function(grunt) {

    'use strict';

    var autoprefixer = require('autoprefixer');
    var diff = require('diff');

    grunt.registerMultiTask(
        'autoprefixer',
        'Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website.',
        function() {
            var options = this.options({
                diff: false
            });

            /**
             * @type {Autoprefixer}
             */
            var compiler = autoprefixer(options.browsers);

            // Iterate over all specified file groups.
            this.files.forEach(function(f) {

                /**
                 * @type {string[]}
                 */
                var sources = f.src.filter(function(filepath) {

                    // Warn on and remove invalid source files (if nonull was set).
                    if (!grunt.file.exists(filepath)) {
                        grunt.log.warn('Source file "' + filepath + '" not found.');
                        return false;
                    } else {
                        return true;
                    }
                });

                function write(path, original, prefixed) {
                    grunt.file.write(path, prefixed);

                    if (options.diff) {
                        var diffPath = (typeof options.diff === 'string') ? options.diff : path + '.patch';
                        grunt.file.write(diffPath, diff.createPatch(path, original, prefixed));
                    }
                }

                // Write the destination file, or source file if destination isn't specified.
                if (typeof f.dest !== 'undefined') {

                    // Concat specified files.
                    var original = sources.map(function(filepath) {
                        return grunt.file.read(filepath);
                    }).join(grunt.util.linefeed);

                    write(f.dest, original, compiler.compile(original));
                    grunt.log.writeln('Prefixed file "' + f.dest + '" created.');

                } else {

                    sources.forEach(function(filepath) {
                        var original = grunt.file.read(filepath);

                        write(filepath, original, compiler.compile(original));
                        grunt.log.writeln('File "' + filepath + '" prefixed.');
                    });
                }

            });
        }
    );
};
<commit_msg>Use the new API<commit_after>/*
 * grunt-autoprefixer
 *
 * Copyright (c) 2013 <NAME>
 * Licensed under the MIT license.
 */

module.exports = function(grunt) {

    'use strict';

    var autoprefixer = require('autoprefixer');
    var diff = require('diff');

    grunt.registerMultiTask(
        'autoprefixer',
        'Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website.',
        function() {
            var options = this.options({
                diff: false
            });

            /**
             * @type {Autoprefixer}
             */
            var compiler = autoprefixer(options.browsers);

            // Iterate over all specified file groups.
            this.files.forEach(function(f) {

                /**
                 * @type {string[]}
                 */
                var sources = f.src.filter(function(filepath) {

                    // Warn on and remove invalid source files (if nonull was set).
                    if (!grunt.file.exists(filepath)) {
                        grunt.log.warn('Source file "' + filepath + '" not found.');
                        return false;
                    } else {
                        return true;
                    }
                });

                function write(path, original, prefixed) {
                    grunt.file.write(path, prefixed);

                    if (options.diff) {
                        var diffPath = (typeof options.diff === 'string') ? options.diff : path + '.patch';
                        grunt.file.write(diffPath, diff.createPatch(path, original, prefixed));
                    }
                }

                // Write the destination file, or source file if destination isn't specified.
                if (typeof f.dest !== 'undefined') {

                    // Concat specified files.
                    var original = sources.map(function(filepath) {
                        return grunt.file.read(filepath);
                    }).join(grunt.util.linefeed);

                    write(f.dest, original, compiler.process(original).css);
                    grunt.log.writeln('Prefixed file "' + f.dest + '" created.');

                } else {

                    sources.forEach(function(filepath) {
                        var original = grunt.file.read(filepath);

                        write(filepath, original, compiler.process(original).css);
                        grunt.log.writeln('File "' + filepath + '" prefixed.');
                    });
                }

            });
        }
    );
};

{'fraction_non_alphanumeric': 0.11080976365749709, 'fraction_numerical': 0.0015497869043006587, 'mean_word_length': 1.2370017331022531, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '474758', 'n_tokens_mistral': 1314, 'n_tokens_neox': 1223, 'n_words': 299}