<commit_before>/* SPDX-License-Identifier: Apache-2.0
 *
 * BenchExec is a framework for reliable benchmarking.
 * This file is part of BenchExec.
 * Copyright (C) <NAME>. All rights reserved.
 */
const path = require("path");

module.exports = {
  webpack: function override(config, webpackEnv) {
    const isEnvDevelopment = webpackEnv === "development";

    // main configuration of output files:
    // two bundles, one for our code, one for dependencies
    config.output.filename = "bundle.min.js";
    config.output.chunkFilename = "[name].min.js";
    config.optimization.runtimeChunk = false;
    config.optimization.splitChunks = {
      chunks: "all",
      cacheGroups: {
        vendors: {
          chunks: "all",
          name: "vendors",
          test: /(node_modules|src\/data\/dependencies\.json|src\/vendor)/,
        },
      },
    };

    // same for CSS files
    const cssConfig = config.plugins.find(
      (p) => p.constructor.name === "MiniCssExtractPlugin",
    );
    if (cssConfig) {
      cssConfig.options.filename = "bundle.min.css";
      cssConfig.options.chunkFilename = "[name].min.css";
    }

    // Don't extract license comments, we bundle them separately
    config.optimization.minimizer.find(
      (m) => m.constructor.name === "TerserPlugin",
    ).options.extractComments = false;

    // Make vendor bundle change less often even if our own code changes.
    config.optimization.occurrenceOrder = false;

    // For consistency with previous configs
    delete config.output.jsonpFunction;

    // Enable ignore option of eslint config (which is the one that has eslintPath)
    // to honour our exclusions
    const isEslintConfig = (e) => e.options.eslintPath;
    const eslintOptions = config.module.rules
      .find((r) => r.use && r.use.some(isEslintConfig))
      .use.find(isEslintConfig).options;
    eslintOptions.ignore = true;

    if (isEnvDevelopment) {
      // Make @data resolve to our dummy data
      const dataPath = process.env.DATA || "src/data/data.json";
      config.resolve.alias["@data"] = path.resolve(__dirname, dataPath);
    }

    // Remove unnecessary plugins for Manifest and Service Workers
    config.plugins = config.plugins.filter(
      (e) =>
        e.constructor.name !== "ManifestPlugin" &&
        e.constructor.name !== "GenerateSW",
    );

    return config;
  },

  jest: function (config) {
    // In tests we want to skip loading the libraries from src/vendor/,<commit_msg>Simplify our webpack config overrides a little bit.<commit_after>/* SPDX-License-Identifier: Apache-2.0
 *
 * BenchExec is a framework for reliable benchmarking.
 * This file is part of BenchExec.
 * Copyright (C) <NAME>. All rights reserved.
 */
const path = require("path");

module.exports = {
  webpack: function override(config, webpackEnv) {
    const isEnvDevelopment = webpackEnv === "development";

    // main configuration of output files:
    // two bundles, one for our code, one for dependencies
    config.output.filename = "bundle.min.js";
    config.output.chunkFilename = "[name].min.js";
    config.optimization.runtimeChunk = false;
    config.optimization.splitChunks = {
      chunks: "all",
      cacheGroups: {
        vendors: {
          chunks: "all",
          name: "vendors",
          test: /(node_modules|src\/data\/dependencies\.json|src\/vendor)/,
        },
      },
    };

    // same for CSS files
    const cssConfig = config.plugins.find(
      (p) => p.constructor.name === "MiniCssExtractPlugin",
    );
    if (cssConfig) {
      cssConfig.options.filename = "bundle.min.css";
      cssConfig.options.chunkFilename = "[name].min.css";
    }

    // Don't extract license comments, we bundle them separately
    config.optimization.minimizer.find(
      (m) => m.constructor.name === "TerserPlugin",
    ).options.extractComments = false;

    // Make vendor bundle change less often even if our own code changes.
    config.optimization.occurrenceOrder = false;

    // For consistency with previous configs
    delete config.output.jsonpFunction;

    // Enable ignore option of eslint config (which is the one that has eslintPath)
    // to honour our exclusions
    const isEslintConfig = (e) => e.options.eslintPath;
    const eslintOptions = config.module.rules
      .find((r) => r.use && r.use.some(isEslintConfig))
      .use.find(isEslintConfig).options;
    eslintOptions.ignore = true;

    if (isEnvDevelopment) {
      // Make @data resolve to our dummy data
      const dataPath = process.env.DATA || "src/data/data.json";
      config.resolve.alias["@data"] = path.resolve(__dirname, dataPath);
    }

    return config;
  },

  jest: function (config) {
    // In tests we want to skip loading the libraries from src/vendor/,
{'fraction_non_alphanumeric': 0.12337116435477091, 'fraction_numerical': 0.0008406893652795292, 'mean_word_length': 2.810248198558847, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3629179', 'n_tokens_mistral': 1416, 'n_tokens_neox': 1370, 'n_words': 377}