"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _caseSensitivePathsWebpackPlugin = _interopRequireDefault(require("case-sensitive-paths-webpack-plugin"));

var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));

var _webpack = _interopRequireDefault(require("webpack"));

var _path = _interopRequireDefault(require("path"));

var _plugins = require("../plugins");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// isForLibraryImpact this variable for now only used in getLibraryImactPlugins.
// So you gona use it please check with that function as well
let getDocsPlugins = (isSSTest, options, isForLibraryImpact = false) => {
  let {
    app: {
      folder
    },
    unusedFiles
  } = options;
  let plugins = [new _plugins.CleanUpStatsPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.ProvidePlugin({
    React: 'react'
  }), new _webpack.default.DefinePlugin({
    __TEST__: false,
    __DEVELOPMENT__: true,
    __DOCS__: true
  }), !isForLibraryImpact && new _plugins.ModuleStatsPlugin({
    filename: 'js/moduleStats.js'
  }), new _miniCssExtractPlugin.default({
    filename: 'css/[name].css',
    chunkFilename: 'css/[name].css'
  })].filter(Boolean);

  if (unusedFiles.enable) {
    plugins.push(new _plugins.UnusedFilesFindPlugin(Object.assign(unusedFiles, {
      docsFilename: 'Undocsfiles.json',
      ssTest: true,
      origin: _path.default.join(process.cwd(), folder)
    })));
  }

  return plugins;
};

var _default = getDocsPlugins;
exports.default = _default;