<commit_before>'use strict';

var path         = require('path');
var Plugin       = require('./plugin');
var requireLocal = require('../utilities/require-local');
var merge        = require('lodash-node/modern/objects/merge');

function StylePlugin () {
  this.type = 'css';
  this._superConstructor.apply(this, arguments);
}

StylePlugin.prototype = Object.create(Plugin.prototype);
StylePlugin.prototype.constructor = StylePlugin;
StylePlugin.prototype._superConstructor = Plugin;

StylePlugin.prototype.toTree = function(tree, inputPath, outputPath, options) {
  var input = path.join(inputPath, 'app.' + this.getExt(inputPath, 'app'));
  var output = path.join(outputPath, this.applicationName + '.css');

  return requireLocal(this.name).call(null, [tree], input, output, merge({}, this.options, options));
};<commit_msg>Provide useful error message when styles/app.ext is not found<commit_after>'use strict';

var path         = require('path');
var Plugin       = require('./plugin');
var requireLocal = require('../utilities/require-local');
var merge        = require('lodash-node/modern/objects/merge');

function StylePlugin () {
  this.type = 'css';
  this._superConstructor.apply(this, arguments);
}

StylePlugin.prototype = Object.create(Plugin.prototype);
StylePlugin.prototype.constructor = StylePlugin;
StylePlugin.prototype._superConstructor = Plugin;

StylePlugin.prototype.toTree = function(tree, inputPath, outputPath, options) {
  var ext = this.getExt(inputPath, 'app');

  if (!ext) {
    var attemptedExtensions = Array.isArray(this.ext) ? this.ext : [this.ext];
    throw new Error('app/styles/app.[' + attemptedExtensions.join('/') + '] does not exist');
  }

  var input = path.join(inputPath, 'app.' + ext);
  var output = path.join(outputPath, this.applicationName + '.css');

  return requireLocal(this.name).call(null, [tree], input, output, merge({}, this.options, options));
};
{'fraction_non_alphanumeric': 0.1563807531380753, 'fraction_numerical': 0.0, 'mean_word_length': 4.7620481927710845, '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': '1665781', 'n_tokens_mistral': 560, 'n_tokens_neox': 548, 'n_words': 125}