<commit_before>var PATH = require('path');

var U = require('express-bem/lib/util');

var MakePlatform = require('enb/lib/make');
var dropRequireCache = require('enb/lib/fs/drop-require-cache');

module.exports = {
    middleware: middleware,
    middlewares: [middleware]
};

function middleware(opts) {
    var that = this; // express-bem

    opts = opts || {};
    opts.env = opts.env || this.env;
    opts.root = PATH.resolve(opts.cdir || opts.root || this.projectRoot);
    opts.noLog = 'noLog' in opts ? opts.noLog :
        typeof opts.verbosity === 'boolean' ? !opts.verbosity :
        (opts.verbosity === 'error' && opts.verbosity !== 'debug');

    var makePlatform = new MakePlatform();

    return function (ctx, next) {
        var engine = this.engines.byExtension(this.ext);
        var relBundlePath = PATH.relative(opts.root, ctx.name);
        var bundleName = PATH.basename(ctx.name);
        var bemjsonName = PATH.join(relBundlePath, bundleName + '.bemjson.js');

        var targets = [];
        var targetExtensions = (engine.targetExtensions || [engine.extension]);
        if (targetExtensions.length) {
            // build only declared techs/exts
            targetExtensions.forEach(function (ext) {
                targets.push(PATH.join(relBundlePath, bundleName + ext));
            });

        } else {
            // can't build nothing
            next();
        }<commit_msg>skip building nothing<commit_after>var PATH = require('path');

var U = require('express-bem/lib/util');

var MakePlatform = require('enb/lib/make');
var dropRequireCache = require('enb/lib/fs/drop-require-cache');

module.exports = {
    middleware: middleware,
    middlewares: [middleware]
};

function middleware(opts) {
    var that = this; // express-bem

    opts = opts || {};
    opts.env = opts.env || this.env;
    opts.root = PATH.resolve(opts.cdir || opts.root || this.projectRoot);
    opts.noLog = 'noLog' in opts ? opts.noLog :
        typeof opts.verbosity === 'boolean' ? !opts.verbosity :
        (opts.verbosity === 'error' && opts.verbosity !== 'debug');

    var makePlatform = new MakePlatform();

    return function (ctx, next) {
        var engine = this.engines.byExtension(this.ext);
        var relBundlePath = PATH.relative(opts.root, ctx.name);
        var bundleName = PATH.basename(ctx.name);
        var bemjsonName = PATH.join(relBundlePath, bundleName + '.bemjson.js');

        var targets = [];
        var targetExtensions = (engine.targetExtensions || [engine.extension]);
        if (!targetExtensions.length) {
            // can't build nothing
            next();
            return;
        }

        // build only declared techs/exts
        targetExtensions.forEach(function (ext) {
            targets.push(PATH.join(relBundlePath, bundleName + ext));
        });
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.0, 'mean_word_length': 2.6315789473684212, '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': '2519270', 'n_tokens_mistral': 845, 'n_tokens_neox': 820, 'n_words': 182}