<commit_before>var VM = require('vm'),
    Q = require('qq'),
    U = require('../util'),
    INHERIT = require('inherit'),
    Tech = require('../tech').Tech;

exports.Tech = INHERIT(Tech, {

    getCreateResult: function(path, suffix, vars) {

        return [
            '({',
            '    mustDeps: [],',
            '    shouldDeps: []',
            '})'
        ].join('\n');

    },

    transformBuildDecl: function(decl) {

        var _this = this;

        return Q.when(decl)
            .then(function(decl) {

                var deps = new Deps(decl.blocks || decl.deps);

                return deps.expandByFS(_this).then(function() {
                    var d = deps.serialize(),
                        o = {};

                    if(d['']) {
                        o.deps = d[''][''];
                        delete d[''][''];
                    }
                    U.isEmptyObject(d) || (o.depsByTechs = d);

                    return o;
                });

            });

    },

    getBuildResult: function(prefixes, suffix, outputDir, outputName) {

        var _this = this;

        return Q.when(this.getContext().opts.declaration)
            .then(function(decl) {

                var deps = new Deps(decl.deps || decl.blocks);

                return Q.when(deps.expandByFS(_this), function() {
                    return deps.stringify();
                });

            });

    }

});

var Deps = exports.Deps = INHERIT({

    __constructor: function(deps) {
        this.items = {};
        this.itemsByOrder = [];
        this.uniqExpand = {};

        // Force adding of root item to this.items<commit_msg>deps.js tech: Fix twice expansion of deps<commit_after>var VM = require('vm'),
    Q = require('qq'),
    PATH = require('path'),
    U = require('../util'),
    INHERIT = require('inherit'),
    Tech = require('../tech').Tech;

exports.Tech = INHERIT(Tech, {

    getCreateResult: function(path, suffix, vars) {

        return [
            '({',
            '    mustDeps: [],',
            '    shouldDeps: []',
            '})'
        ].join('\n');

    },

    transformBuildDecl: function(decl) {

        return this.expandDeps(decl)
            .then(function(deps) {

                var d = deps.serialize(),
                    o = {};

                if(d['']) {
                    o.deps = d[''][''];
                    delete d[''][''];
                }
                U.isEmptyObject(d) || (o.depsByTechs = d);

                return o;

            });

    },

    expandDeps: function(decl) {

        var _this = this;

        return Q.when(decl)
            .then(function(decl) {
                return new Deps(decl.blocks || decl.deps).expandByFS(_this);
            });

    },

    buildByDecl: function(decl, levels, output) {

        var suffix = this.getTechName();

        return this.storeBuildResult(
            this.getPath(output, suffix),
            suffix,
            this.expandDeps(decl).then(function(deps) {
                return deps.stringify();
            }));

    }

});

var Deps = exports.Deps = INHERIT({

    __constructor: function(deps) {
        this.items = {};
        this.itemsByOrder = [];
        this.uniqExpand = {};

        // Force adding of root item to this.items
{'fraction_non_alphanumeric': 0.1520290732889158, 'fraction_numerical': 0.0, 'mean_word_length': 1.3934782608695653, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5070029', 'n_tokens_mistral': 999, 'n_tokens_neox': 924, 'n_words': 177}