<commit_before>let postcssrc = require('postcss-load-config');

class PostCssPluginsFactory {
    /**
     * Create a new instance.
     * @param {Object} preprocessor
     * @param {Config} Config
     */
    constructor(preprocessor, Config) {
        this.preprocessor = preprocessor;
        this.Config = Config;

        this.plugins = [];
    }

    /**
     * Load all relevant PostCSS plugins.
     */
    load() {
        this.loadConfigFile()
            .loadGlobalPlugins()
            .loadLocalPlugins()
            .loadAutoprefixer()
            .loadCssNano();

        return this.plugins;
    }

    /**
     * Load the user's postcss.config.js file, if any.
     */
    loadConfigFile() {
        try {
            this.plugins = [...this.plugins, ...postcssrc.sync().plugins];
        } catch (e) {
            // No postcss.config.js file exists.<commit_msg>Don't double load postcss.config.js (#3018)<commit_after>class PostCssPluginsFactory {
    /**
     * Create a new instance.
     * @param {Object} preprocessor
     * @param {Config} Config
     */
    constructor(preprocessor, Config) {
        this.preprocessor = preprocessor;
        this.Config = Config;

        this.plugins = [];
    }

    /**
     * Load all relevant PostCSS plugins.
     */
    load() {
        this.loadGlobalPlugins().loadLocalPlugins().loadAutoprefixer().loadCssNano();

        return this.plugins;
    }

    /**
     * Load the user's postcss.config.js file, if any.
     *
     * @deprecated postcss-loader already does this on its own
     */
    loadConfigFile() {
        let postcssrc = require('postcss-load-config');

        try {
            this.plugins = [...this.plugins, ...postcssrc.sync().plugins];
        } catch (e) {
            // No postcss.config.js file exists.
{'fraction_non_alphanumeric': 0.12937257079400333, 'fraction_numerical': 0.002220988339811216, 'mean_word_length': 1.8832, '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': '3685291', 'n_tokens_mistral': 534, 'n_tokens_neox': 522, 'n_words': 113}