<commit_before>var read = require('fs').readFileSync

/*!
 * Load the require implementation
 */
var requireCode = read(__dirname+'/require.js', 'utf-8')

/*!
 * match the start of a function declaration
 */ 
var fre = /^function\s*/

/**
 * Compile the code needed to resolve a component module
 *
 * @return {String}
 * @api private
 */

function componentsCode () {
	var component = require('sourcegraph/src/plugins/component')
	var codes = [
		component.hashSystem.toString().replace(fre, 'function components '),
		component.variants.toString()
	]
	return codes.map(function (code) {
		return code.replace(/variants/, 'componentVariants')
	}).join('\n')
}

/**
 * Compile the code needed to resolve a component module
 * 
 * @return {String}
 * @api private
 */

function nodeModulesCode () {
	var node = require('sourcegraph/src/plugins/nodeish')
	var codes = [
		node.hashSystem.toString().replace(fre, 'function node_modules '),
		node.variants.toString()
	].map(function (code) {
		return code.replace(/variants/, 'nodeishVariants')
	}).join('\n')
	return codes
}

/**
 * Wrap a mapping of modules with the environment required to run them
 *
 * @param {Object} dict, maps paths to content
 * @param {Function} next
 * @return {String}
 */

module.exports = function (dict, next) {
	var code = [
		requireCode,
		nodeModulesCode(),
		componentsCode(),
		'var modules = ' + JSON.stringify(dict),
		'var checks = [node_modules, components]'
	].join('\n')

	next(code)
}<commit_msg>tidy  object<commit_after>var read = require('fs').readFileSync

/*!
 * Load the require implementation
 */
var requireCode = read(__dirname+'/require.js', 'utf-8')

/*!
 * match the start of a function declaration
 */ 
var fre = /^function\s*/

/**
 * Compile the code needed to resolve a component module
 *
 * @return {String}
 * @api private
 */

function componentsCode () {
	var component = require('sourcegraph/src/plugins/component')
	var codes = [
		component.hashSystem.toString().replace(fre, 'function components '),
		component.variants.toString()
	]
	return codes.map(function (code) {
		return code.replace(/variants/, 'componentVariants')
	}).join('\n')
}

/**
 * Compile the code needed to resolve a component module
 * 
 * @return {String}
 * @api private
 */

function nodeModulesCode () {
	var node = require('sourcegraph/src/plugins/nodeish')
	var codes = [
		node.hashSystem.toString().replace(fre, 'function node_modules '),
		node.variants.toString()
	].map(function (code) {
		return code.replace(/variants/, 'nodeishVariants')
	}).join('\n')
	return codes
}

/**
 * Wrap a mapping of modules with the environment required to run them
 *
 * @param {Object} dict, maps paths to content
 * @param {Function} next
 * @return {String}
 */

module.exports = function (dict, next) {
	var code = [
		requireCode,
		nodeModulesCode(),
		componentsCode(),
		'var modules = ' + JSON.stringify(dict, null, '\t'),
		'var checks = [node_modules, components]'
	].join('\n')

	next(code)
}
{'fraction_non_alphanumeric': 0.15299631737529293, 'fraction_numerical': 0.0006695681285570807, 'mean_word_length': 4.03030303030303, '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': '956239', 'n_tokens_mistral': 949, 'n_tokens_neox': 929, 'n_words': 255}