<commit_before>/**
 * GKA (generate keyframes animation)
 * author: joeyguo
 * HomePage: https://github.com/joeyguo/gka
 * MIT Licensed.
 *
 */

const fs        = require("fs"),
    path        = require('path'),
    mkdirp      = require('mkdirp'),
    Spritesmith = require('spritesmith');

// sprites
// 生成合图, 返回坐标数据
function gsprites(srcs, filepath, algorithm, callback) {
    Spritesmith.run({
        src: srcs,
        algorithm: algorithm,
    }, function(err, r) {
        mkdirp(path.dirname(filepath), function (err) {
            fs.writeFileSync(filepath, r.image);
            // console.log('[-] ' + path.basename(filepath) +' generated');
            callback && callback(r, filepath);
        });
    });
}

// 获取所有输出的文件路径，并去重
function getFiles(data) {
    var srcs = data.frames.map(item => {
        return item['src'];
    });
    return srcs.filter((item, index, self) => {
          return self.indexOf(item) == index;     
    });
}

module.exports = class ImageSpritesPlugin {
    constructor({algorithm, spritesCount}) {
        this.algorithm = algorithm
        this.spritesCount = spritesCount
        this.apply = this.apply.bind(this)
    }

    apply(compiler) {<commit_msg>[ImageSpritesPlugin] disable sorting from smallest to largest<commit_after>/**
 * GKA (generate keyframes animation)
 * author: joeyguo
 * HomePage: https://github.com/joeyguo/gka
 * MIT Licensed.
 *
 */

const fs        = require("fs"),
    path        = require('path'),
    mkdirp      = require('mkdirp'),
    Spritesmith = require('spritesmith');

// sprites
// 生成合图, 返回坐标数据
function gsprites(srcs, filepath, algorithm, callback) {
    Spritesmith.run({
        src: srcs,
        algorithm: algorithm,
        algorithmOpts: {sort: false},
    }, function(err, r) {
        mkdirp(path.dirname(filepath), function (err) {
            fs.writeFileSync(filepath, r.image);
            // console.log('[-] ' + path.basename(filepath) +' generated');
            callback && callback(r, filepath);
        });
    });
}

// 获取所有输出的文件路径，并去重
function getFiles(data) {
    var srcs = data.frames.map(item => {
        return item['src'];
    });
    return srcs.filter((item, index, self) => {
          return self.indexOf(item) == index;     
    });
}

module.exports = class ImageSpritesPlugin {
    constructor({algorithm, spritesCount}) {
        this.algorithm = algorithm
        this.spritesCount = spritesCount
        this.apply = this.apply.bind(this)
    }

    apply(compiler) {
{'fraction_non_alphanumeric': 0.14703525641025642, 'fraction_numerical': 0.0, 'mean_word_length': 2.5268361581920904, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '3497519', 'n_tokens_mistral': 822, 'n_tokens_neox': 803, 'n_words': 155}