<commit_before>'use strict';

const replace = require('broccoli-replace');
const Favicons = require('broccoli-favicon');
const mergeTrees = require('broccoli-merge-trees');

let htmlCache = null;

module.exports = {

  name: 'ember-cli-favicon',

  included(app) {
    this.options = app.options.favicons || {};
    this.options.htmlCallback = function(html) {
      htmlCache = html;
    };
  },

  postprocessTree(type, tree) {
    if (type === 'all') {
      const favicons = new Favicons(tree, this.options);
      tree = mergeTrees([ favicons, tree ], { overwrite: true });
      return replace(tree, {
        files: [ 'index.html' ],
        patterns: [{
          match: /<\/head>/i,
          replacement: function() {
            return (htmlCache || []).join('\n') + '\n</head>';
          }
        }]
      });
    }
    return tree;
  }

};
<commit_msg>add favicons to fingerprint exclusion<commit_after>'use strict';

const replace = require('broccoli-replace');
const Favicons = require('broccoli-favicon');
const mergeTrees = require('broccoli-merge-trees');

let htmlCache = null;

module.exports = {

  name: 'ember-cli-favicon',

  included(app) {
    let options = app.options;

    let fingerprint = options.fingerprint = options.fingerprint || {};
    fingerprint.exclude = fingerprint.exclude || [];
    fingerprint.exclude.push('apple-touch-icon', 'favicon', 'mstile');

    this.options = options.favicons || {};
    this.options.htmlCallback = function(html) {
      htmlCache = html;
    };
  },

  postprocessTree(type, tree) {
    if (type === 'all') {
      const favicons = new Favicons(tree, this.options);
      tree = mergeTrees([ favicons, tree ], { overwrite: true });
      return replace(tree, {
        files: [ 'index.html' ],
        patterns: [{
          match: /<\/head>/i,
          replacement: function() {
            return (htmlCache || []).join('\n') + '\n</head>';
          }
        }]
      });
    }
    return tree;
  }

};

{'fraction_non_alphanumeric': 0.16649848637739656, 'fraction_numerical': 0.0, 'mean_word_length': 2.598911070780399, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4760754', 'n_tokens_mistral': 637, 'n_tokens_neox': 606, 'n_words': 126}