<commit_before>/**
 * Copyright 2015 Kitware Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * This file contains options that apply to ALL target build configurations. Because we use
 * the DllPlugin for dynamic loading, each individual bundle has its own config options
 * that can extend these.
 */
var fs = require('fs');
var path = require('path');
var yaml = require('js-yaml');
var webpack = require('webpack');

var ExtractTextPlugin = require('extract-text-webpack-plugin');

var paths = require('./webpack.paths.js');
var es2015Preset = require.resolve('babel-preset-es2015');
var istanbulPlugin = require.resolve('babel-plugin-istanbul');

function fileLoader() {
    return {
        loader: 'file-loader',
        query: {
            name: 'assets/[name]-[hash:8].[ext]'
        }
    };
}

function urlLoader(options) {
    options = options || {};
    var loader = {
        loader: 'url-loader',
        query: {
            limit: 4096
        }
    };
    if (options.mimetype) {
        loader.query.mimetype = options.mimetype;
    }
    return loader;
}

function defaultLoaderPlugins() {
    // Computes a list of plugin paths that are opting to use Girder's loader
    // configuration directly; these paths will be added to the "include"
    // directive for the loaders in the config template below.
    var dirs = fs.readdirSync('plugins');
    var paths = [];

    dirs.forEach(function (dir) {
        // Find a plugin config file.
        var pluginFile = path.resolve('plugins', dir, 'plugin.yml');
        if (!fs.existsSync(pluginFile)) {
            pluginFile = path.resolve('plugins', dir, 'plugin.json');
            if (!fs.existsSync(pluginFile)) {
                pluginFile = null;
            }
        }

        // If there's a plugin file, and it has no config, no webpack section,
        // no defaultLoaders property, or the defaultLoaders property is
        // explicitly set to anything besdies false, then add the plugin to the
        // list of plugins that want to use Girder's loader configuration.
        if (pluginFile) {
            var config = yaml.safeLoad(fs.readFileSync(pluginFile));
            if (!config || !config.webpack || config.webpack.defaultLoaders === undefined || config.webpack.defaultLoaders !== false) {
                paths.push(path.resolve(dir));
            }
        }
    });<commit_msg>Save correct path in default loader list<commit_after>/**
 * Copyright 2015 Kitware Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * This file contains options that apply to ALL target build configurations. Because we use
 * the DllPlugin for dynamic loading, each individual bundle has its own config options
 * that can extend these.
 */
var fs = require('fs');
var path = require('path');
var yaml = require('js-yaml');
var webpack = require('webpack');

var ExtractTextPlugin = require('extract-text-webpack-plugin');

var paths = require('./webpack.paths.js');
var es2015Preset = require.resolve('babel-preset-es2015');
var istanbulPlugin = require.resolve('babel-plugin-istanbul');

function fileLoader() {
    return {
        loader: 'file-loader',
        query: {
            name: 'assets/[name]-[hash:8].[ext]'
        }
    };
}

function urlLoader(options) {
    options = options || {};
    var loader = {
        loader: 'url-loader',
        query: {
            limit: 4096
        }
    };
    if (options.mimetype) {
        loader.query.mimetype = options.mimetype;
    }
    return loader;
}

function defaultLoaderPlugins() {
    // Computes a list of plugin paths that are opting to use Girder's loader
    // configuration directly; these paths will be added to the "include"
    // directive for the loaders in the config template below.
    var dirs = fs.readdirSync('plugins');
    var paths = [];

    dirs.forEach(function (dir) {
        // Find a plugin config file.
        var pluginFile = path.resolve('plugins', dir, 'plugin.yml');
        if (!fs.existsSync(pluginFile)) {
            pluginFile = path.resolve('plugins', dir, 'plugin.json');
            if (!fs.existsSync(pluginFile)) {
                pluginFile = null;
            }
        }

        // If there's a plugin file, and it has no config, no webpack section,
        // no defaultLoaders property, or the defaultLoaders property is
        // explicitly set to anything besdies false, then add the plugin to the
        // list of plugins that want to use Girder's loader configuration.
        if (pluginFile) {
            var config = yaml.safeLoad(fs.readFileSync(pluginFile));
            if (!config || !config.webpack || config.webpack.defaultLoaders === undefined || config.webpack.defaultLoaders !== false) {
                paths.push(path.resolve('plugins', dir));
            }
        }
    });
{'fraction_non_alphanumeric': 0.1091127098321343, 'fraction_numerical': 0.007194244604316547, 'mean_word_length': 2.690897597977244, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4985141', 'n_tokens_mistral': 1593, 'n_tokens_neox': 1526, 'n_words': 567}