<commit_before>var requirejs = require('requirejs');

requirejs.config 
    # Use node's special variable __dirname to
    # get the directory containing this file.
    # Useful if building a library that will
    # be used in node but does not require the
    # use of node outside
    baseUrl: __dirname

    # Pass the top-level main.js/index.js require
    # function to requirejs so that node modules
    # are loaded relative to the top-level JS file.
    nodeRequire: require

    paths:
      cs:              '../lib/requirejs/cs'
      'coffee-script': '../lib/cs/coffee-script-iced'




require [
  'cs!../src/metacoffee'
  'cs!./ErrorHandler'
], (MetaCoffee, ErrorHandler) ->

  BSMetaCoffeeParser = MetaCoffee.BSMetaCoffeeParser
  BSMetaCoffeeTranslator = MetaCoffee.BSMetaCoffeeTranslator

  return compileSource = (sourceCode) ->
    try
      tree = BSMetaCoffeeParser.matchAll(
        sourceCode, "topLevel", undefined, (m, i) ->
          handled = ErrorHandler.handle(m, i)
          throw new Error("Error at line: " + handled.lineNumber + "\n\n" +
            ErrorHandler.bottomErrorArrow handled)
      )
      result = BSMetaCoffeeTranslator.matchAll(
        tree, "trans", undefined, (m, i) ->
        throw new Error("Translation error - please tell Alex about this!")
      )
    catch e
      return e.toString()
    return result<commit_msg>Added module.exports so compiler behaves like node module<commit_after>var requirejs = require('requirejs');

requirejs.config 
    # Use node's special variable __dirname to
    # get the directory containing this file.
    # Useful if building a library that will
    # be used in node but does not require the
    # use of node outside
    baseUrl: __dirname

    # Pass the top-level main.js/index.js require
    # function to requirejs so that node modules
    # are loaded relative to the top-level JS file.
    nodeRequire: require

    paths:
      cs:              '../lib/requirejs/cs'
      'coffee-script': '../lib/cs/coffee-script-iced'




require [
  'cs!../src/metacoffee'
  'cs!./ErrorHandler'
], (MetaCoffee, ErrorHandler) ->

  BSMetaCoffeeParser = MetaCoffee.BSMetaCoffeeParser
  BSMetaCoffeeTranslator = MetaCoffee.BSMetaCoffeeTranslator

  module.exports =  compileSource = (sourceCode) ->
    try
      tree = BSMetaCoffeeParser.matchAll(
        sourceCode, "topLevel", undefined, (m, i) ->
          handled = ErrorHandler.handle(m, i)
          throw new Error("Error at line: " + handled.lineNumber + "\n\n" +
            ErrorHandler.bottomErrorArrow handled)
      )
      result = BSMetaCoffeeTranslator.matchAll(
        tree, "trans", undefined, (m, i) ->
        throw new Error("Translation error - please tell Alex about this!")
      )
    catch e
      return e.toString()
    return result
{'fraction_non_alphanumeric': 0.09753483386923902, 'fraction_numerical': 0.0, 'mean_word_length': 2.674540682414698, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1417269', 'n_tokens_mistral': 849, 'n_tokens_neox': 815, 'n_words': 244}