<commit_before>"use strict";


/*global nodeca, _*/


// stdlib
var path = require('path');


// nodeca
var NLib = require('nlib');


////////////////////////////////////////////////////////////////////////////////


// dummy helper that fills env.response.data.head.assets with only those assets
// from the list of `names` which are actually exist
function inject_asset(pathname) {
  var link;

  /*jshint validthis:true,boss:true*/

  link = this.helpers.asset_path(pathname);

  if ('#' !== link) {
    this.response.data.head.assets.push({
      type: path.extname(link).substring(1),
      link: link
    });
  }
}


////////////////////////////////////////////////////////////////////////////////


// Middleware that populates `env.response.head.assets` with generic assets
// needed for the given method (based on locale, theme and namespace), such as:
// translations, views, etc.
//
nodeca.filters.before('', {weight: 50}, function base_assets(params, callback) {
  var namespace = this.request.namespace,
      locale    = this.session.locale,
      theme     = this.session.theme,
      assets    = [];

  this.extras.puncher.start('Prepare and populate list of assets');

  if (this.origin.http) {
    assets.push(
      'lib.js', 'app.js', 'app.css',
      'views/' + locale + '/' + theme + '/layouts.js',
      'views/' + locale + '/' + theme + '/common.js',
      'views/' + locale + '/' + theme + '/widgets.js',
      'common/i18n/' + locale + '.js',
      'common/app.css',
      'common/api.js',
      'common/app.js'
    );
  }

  ['forum', 'blogs', 'users', 'admin'].forEach(function (namespace) {
    assets.push(
      'views/' + locale + '/' + theme + '/' + namespace + '.js',
      namespace + '/i18n/' + locale + '.js',
      namespace + '/app.css',
      namespace + '/api.js',
      namespace + '/app.js'
    );
  });

  // inject assets
  assets.forEach(inject_asset, this);
<commit_msg>Fix base assets benchmark name<commit_after>"use strict";


/*global nodeca, _*/


// stdlib
var path = require('path');


// nodeca
var NLib = require('nlib');


////////////////////////////////////////////////////////////////////////////////


// dummy helper that fills env.response.data.head.assets with only those assets
// from the list of `names` which are actually exist
function inject_asset(pathname) {
  var link;

  /*jshint validthis:true,boss:true*/

  link = this.helpers.asset_path(pathname);

  if ('#' !== link) {
    this.response.data.head.assets.push({
      type: path.extname(link).substring(1),
      link: link
    });
  }
}


////////////////////////////////////////////////////////////////////////////////


// Middleware that populates `env.response.head.assets` with generic assets
// needed for the given method (based on locale, theme and namespace), such as:
// translations, views, etc.
//
nodeca.filters.before('', {weight: 50}, function base_assets(params, callback) {
  var namespace = this.request.namespace,
      locale    = this.session.locale,
      theme     = this.session.theme,
      assets    = [];

  this.extras.puncher.start('Assets check');

  if (this.origin.http) {
    assets.push(
      'lib.js', 'app.js', 'app.css',
      'views/' + locale + '/' + theme + '/layouts.js',
      'views/' + locale + '/' + theme + '/common.js',
      'views/' + locale + '/' + theme + '/widgets.js',
      'common/i18n/' + locale + '.js',
      'common/app.css',
      'common/api.js',
      'common/app.js'
    );
  }

  ['forum', 'blogs', 'users', 'admin'].forEach(function (namespace) {
    assets.push(
      'views/' + locale + '/' + theme + '/' + namespace + '.js',
      namespace + '/i18n/' + locale + '.js',
      namespace + '/app.css',
      namespace + '/api.js',
      namespace + '/app.js'
    );
  });

  // inject assets
  assets.forEach(inject_asset, this);

{'fraction_non_alphanumeric': 0.2471264367816092, 'fraction_numerical': 0.0036572622779519333, 'mean_word_length': 1.9705197827773469, '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': '2102772', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1136, 'n_words': 274}