<commit_before>function InlineChunkManifestHtmlWebpackPlugin(options) {
    options = options || {};
    this.manifestFilename = options.filename || "manifest.json";
    this.manifestVariable = options.manifestVariable || "webpackManifest";
}

InlineChunkManifestHtmlWebpackPlugin.prototype.apply = function (compiler) {
    const manifestFilename = this.manifestFilename;
    const manifestVariable = this.manifestVariable;

    compiler.plugin("compilation", function (compilation) {
        compilation.plugin('html-webpack-plugin-alter-asset-tags', function (htmlPluginData, callback) {
            const asset = compilation.assets[manifestFilename];

            if (asset) {
                const newTag = {
                    tagName: 'script',
                    closeTag: true,
                    innerHTML: `window.${manifestVariable}=${asset.source()}`
                };

                htmlPluginData.head.unshift(newTag);
            }

            callback(null, htmlPluginData);

        });
    });
};

module.exports = InlineChunkManifestHtmlWebpackPlugin;<commit_msg>Output chunk manifest as asset<commit_after>function InlineChunkManifestHtmlWebpackPlugin(options) {
    options = options || {};
    this.manifestFilename = options.filename || "manifest.json";
    this.manifestVariable = options.manifestVariable || "webpackManifest";
    this.chunkManifestVariable = options.chunkManifestVariable || "webpackChunkManifest";
}

InlineChunkManifestHtmlWebpackPlugin.prototype.apply = function (compiler) {
    const manifestFilename = this.manifestFilename;
    const manifestVariable = this.manifestVariable;
    const chunkManifestVariable = this.chunkManifestVariable;

    compiler.plugin("compilation", function (compilation) {
        compilation.plugin('html-webpack-plugin-alter-asset-tags', function (htmlPluginData, callback) {
            const asset = compilation.assets[manifestFilename];

            if (asset) {
                const newTag = {
                    tagName: 'script',
                    closeTag: true,
                    attributes: {
                        type: 'text/javascript'
                    },
                    innerHTML: `window.${manifestVariable}=${asset.source()}`
                };

                htmlPluginData.head.unshift(newTag);
            }

            callback(null, htmlPluginData);
        });

        compilation.plugin('html-webpack-plugin-before-html-generation', function (htmlPluginData, callback) {
            const asset = compilation.assets[manifestFilename];

            if (asset) {
                htmlPluginData.assets[chunkManifestVariable] = `<script type="text/javascript">window.${manifestVariable}=${asset.source()}</script>`;
            }

            callback(null, htmlPluginData);
        });
    });
};

module.exports = InlineChunkManifestHtmlWebpackPlugin;
{'fraction_non_alphanumeric': 0.10775112964893986, 'fraction_numerical': 0.0, 'mean_word_length': 2.584059775840598, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4064639', 'n_tokens_mistral': 715, 'n_tokens_neox': 684, 'n_words': 114}