<commit_before>var ts = require('typescript');

module.exports = function tsParser(createCompilerHost, log) {

  return {

    options: {
      allowNonTsExtensions: true
    },

    parse: function(fileNames, baseDir) {
      // This is the easiest way I could find to ensure that we loaded
      // modules with paths relative to the baseDir
      process.chdir(baseDir);

      // "Compile" a program from the given module filenames, to get hold of a
      // typeChecker that can be used to interrogate the modules, exports and so on.<commit_msg>squash-me: remove unnecessary (and very naughty) `chdir()` call<commit_after>var ts = require('typescript');
var path = require('canonical-path');

module.exports = function tsParser(createCompilerHost, log) {

  return {

    options: {
      allowNonTsExtensions: true
    },

    parse: function(fileNames, baseDir) {
      fileNames = fileNames.map(function(fileName) {
        return path.resolve(baseDir, fileName);
      });

      // "Compile" a program from the given module filenames, to get hold of a
      // typeChecker that can be used to interrogate the modules, exports and so on.
{'fraction_non_alphanumeric': 0.09336823734729494, 'fraction_numerical': 0.0, 'mean_word_length': 3.2169117647058822, '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': '7135935', 'n_tokens_mistral': 326, 'n_tokens_neox': 311, 'n_words': 115}