<commit_before>var vm = require('vm'),
    _ = require('underscore'),
    uglifyJs = require('uglify-js-papandreou'),
    bootstrapper = require('../bootstrapper'),
    i18nTools = require('../i18nTools');

module.exports = function (queryObj, environment, removeAfter) {
    if (!environment) {
        throw new Error("transforms.runJavaScriptConditionalBlocks: no 'environment' option provided");
    }
    return function runJavaScriptConditionalBlocks(assetGraph) {
        assetGraph.findAssets(_.extend({type: 'Html'}, queryObj)).forEach(function (htmlAsset) {
            var contextProperties = {console: console};
            contextProperties[environment] = true;
            var context = bootstrapper.createContext(htmlAsset, assetGraph, contextProperties);

            assetGraph.collectAssetsPostOrder(htmlAsset, {type: ['HtmlScript', 'JavaScriptInclude']}).filter(function (asset) {
                return asset.type === 'JavaScript';
            }).forEach(function (javaScript) {
                // Loop through top-level statements:<commit_msg>runJavaScriptConditionalBlocks: Skip unloaded assets.<commit_after>var vm = require('vm'),
    _ = require('underscore'),
    uglifyJs = require('uglify-js-papandreou'),
    bootstrapper = require('../bootstrapper'),
    i18nTools = require('../i18nTools');

module.exports = function (queryObj, environment, removeAfter) {
    if (!environment) {
        throw new Error("transforms.runJavaScriptConditionalBlocks: no 'environment' option provided");
    }
    return function runJavaScriptConditionalBlocks(assetGraph) {
        assetGraph.findAssets(_.extend({type: 'Html'}, queryObj)).forEach(function (htmlAsset) {
            var contextProperties = {console: console};
            contextProperties[environment] = true;
            var context = bootstrapper.createContext(htmlAsset, assetGraph, contextProperties);

            assetGraph.collectAssetsPostOrder(htmlAsset, {type: ['HtmlScript', 'JavaScriptInclude']}).filter(function (asset) {
                return asset.isLoaded && asset.type === 'JavaScript';
            }).forEach(function (javaScript) {
                // Loop through top-level statements:
{'fraction_non_alphanumeric': 0.12580054894784995, 'fraction_numerical': 0.0036596523330283625, 'mean_word_length': 3.6139240506329116, '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': '1363080', 'n_tokens_mistral': 576, 'n_tokens_neox': 554, 'n_words': 115}