progress on migrating to heex templates and font-icons

This commit is contained in:
Adam Piontek 2022-08-13 07:32:36 -04:00
commit 3eff955672
21793 changed files with 2161968 additions and 16895 deletions
assets_old/node_modules/terser-webpack-plugin/dist

View file

@ -0,0 +1,5 @@
"use strict";
const plugin = require("./index");
module.exports = plugin.default;

View file

@ -0,0 +1,601 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var path = _interopRequireWildcard(require("path"));
var os = _interopRequireWildcard(require("os"));
var _sourceMap = require("source-map");
var _schemaUtils = require("schema-utils");
var _serializeJavascript = _interopRequireDefault(require("serialize-javascript"));
var terserPackageJson = _interopRequireWildcard(require("terser/package.json"));
var _pLimit = _interopRequireDefault(require("p-limit"));
var _jestWorker = _interopRequireDefault(require("jest-worker"));
var schema = _interopRequireWildcard(require("./options.json"));
var _minify = require("./minify");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */
/** @typedef {import("webpack").Compiler} Compiler */
/** @typedef {import("webpack").Compilation} Compilation */
/** @typedef {import("webpack").Rules} Rules */
/** @typedef {import("webpack").WebpackError} WebpackError */
/** @typedef {import("webpack").Asset} Asset */
/** @typedef {import("webpack").AssetInfo} AssetInfo */
/** @typedef {import("terser").ECMA} TerserECMA */
/** @typedef {import("terser").MinifyOptions} TerserMinifyOptions */
/** @typedef {import("jest-worker").default} JestWorker */
/** @typedef {import("source-map").RawSourceMap} RawSourceMap */
/** @typedef {import("./minify.js").InternalMinifyOptions} InternalMinifyOptions */
/** @typedef {import("./minify.js").InternalMinifyResult} InternalMinifyResult */
/** @typedef {JestWorker & { transform: (options: string) => InternalMinifyResult, minify: (options: InternalMinifyOptions) => InternalMinifyResult }} MinifyWorker */
/** @typedef {Object.<any, any> | TerserMinifyOptions} MinifyOptions */
/**
* @callback ExtractCommentsFunction
* @param {any} astNode
* @param {{ value: string, type: 'comment1' | 'comment2' | 'comment3' | 'comment4', pos: number, line: number, col: number }} comment
* @returns {boolean}
*/
/**
* @typedef {boolean | string | RegExp | ExtractCommentsFunction} ExtractCommentsCondition
*/
/**
* @typedef {string | ((fileData: any) => string)} ExtractCommentsFilename
*/
/**
* @typedef {boolean | string | ((commentsFile: string) => string)} ExtractCommentsBanner
*/
/**
* @typedef {Object} ExtractCommentsObject
* @property {ExtractCommentsCondition} condition
* @property {ExtractCommentsFilename} filename
* @property {ExtractCommentsBanner} banner
*/
/**
* @callback CustomMinifyFunction
* @param {Object.<string, string>} file
* @param {RawSourceMap | undefined} sourceMap
* @param {MinifyOptions} minifyOptions
*/
/**
* @typedef {ExtractCommentsCondition | ExtractCommentsObject} ExtractCommentsOptions
*/
/**
* @typedef {Object} TerserPluginOptions
* @property {Rules} [test]
* @property {Rules} [include]
* @property {Rules} [exclude]
* @property {MinifyOptions} [terserOptions]
* @property {ExtractCommentsOptions} [extractComments]
* @property {boolean} [parallel]
* @property {CustomMinifyFunction} [minify]
*/
class TerserPlugin {
/**
* @param {TerserPluginOptions} options
*/
constructor(options = {}) {
(0, _schemaUtils.validate)(
/** @type {Schema} */
schema, options, {
name: "Terser Plugin",
baseDataPath: "options"
});
const {
minify,
terserOptions = {},
test = /\.[cm]?js(\?.*)?$/i,
extractComments = true,
parallel = true,
include,
exclude
} = options;
this.options = {
test,
extractComments,
parallel,
include,
exclude,
minify,
terserOptions
};
}
/**
* @private
* @param {any} input
* @returns {boolean}
*/
static isSourceMap(input) {
// All required options for `new SourceMapConsumer(...options)`
// https://github.com/mozilla/source-map#new-sourcemapconsumerrawsourcemap
return Boolean(input && input.version && input.sources && Array.isArray(input.sources) && typeof input.mappings === "string");
}
/**
* @private
* @param {Error & { line: number, col: number}} error
* @param {string} file
* @param {Compilation["requestShortener"]} [requestShortener]
* @param {SourceMapConsumer} [sourceMap]
* @returns {WebpackError}
*/
static buildError(error, file, requestShortener, sourceMap) {
if (error.line) {
const original = sourceMap && sourceMap.originalPositionFor({
line: error.line,
column: error.col
});
if (original && original.source && requestShortener) {
return new Error(`${file} from Terser\n${error.message} [${requestShortener.shorten(original.source)}:${original.line},${original.column}][${file}:${error.line},${error.col}]${error.stack ? `\n${error.stack.split("\n").slice(1).join("\n")}` : ""}`);
}
return new Error(`${file} from Terser\n${error.message} [${file}:${error.line},${error.col}]${error.stack ? `\n${error.stack.split("\n").slice(1).join("\n")}` : ""}`);
}
if (error.stack) {
return new Error(`${file} from Terser\n${error.stack}`);
}
return new Error(`${file} from Terser\n${error.message}`);
}
/**
* @private
* @param {boolean} parallel
* @returns {number}
*/
static getAvailableNumberOfCores(parallel) {
// In some cases cpus() returns undefined
// https://github.com/nodejs/node/issues/19022
const cpus = os.cpus() || {
length: 1
};
return parallel === true ? cpus.length - 1 : Math.min(Number(parallel) || 0, cpus.length - 1);
}
/**
* @param {Compiler} compiler
* @param {Compilation} compilation
* @param {Record<string, import("webpack").sources.Source>} assets
* @param {{availableNumberOfCores: number}} optimizeOptions
* @returns {Promise<void>}
*/
async optimize(compiler, compilation, assets, optimizeOptions) {
const cache = compilation.getCache("TerserWebpackPlugin");
let numberOfAssetsForMinify = 0;
const assetsForMinify = await Promise.all(Object.keys(assets).filter(name => {
const {
info
} = compilation.getAsset(name);
if ( // Skip double minimize assets from child compilation
info.minimized || // Skip minimizing for extracted comments assets
info.extractedComments) {
return false;
}
if (!compiler.webpack.ModuleFilenameHelpers.matchObject.bind( // eslint-disable-next-line no-undefined
undefined, this.options)(name)) {
return false;
}
return true;
}).map(async name => {
const {
info,
source
} = compilation.getAsset(name);
const eTag = cache.getLazyHashedEtag(source);
const cacheItem = cache.getItemCache(name, eTag);
const output = await cacheItem.getPromise();
if (!output) {
numberOfAssetsForMinify += 1;
}
return {
name,
info,
inputSource: source,
output,
cacheItem
};
}));
/** @type {undefined | (() => MinifyWorker)} */
let getWorker;
/** @type {undefined | MinifyWorker} */
let initializedWorker;
/** @type {undefined | number} */
let numberOfWorkers;
if (optimizeOptions.availableNumberOfCores > 0) {
// Do not create unnecessary workers when the number of files is less than the available cores, it saves memory
numberOfWorkers = Math.min(numberOfAssetsForMinify, optimizeOptions.availableNumberOfCores); // eslint-disable-next-line consistent-return
getWorker = () => {
if (initializedWorker) {
return initializedWorker;
}
initializedWorker =
/** @type {MinifyWorker} */
new _jestWorker.default(require.resolve("./minify"), {
numWorkers: numberOfWorkers,
enableWorkerThreads: true
}); // https://github.com/facebook/jest/issues/8872#issuecomment-524822081
const workerStdout = initializedWorker.getStdout();
if (workerStdout) {
workerStdout.on("data", chunk => process.stdout.write(chunk));
}
const workerStderr = initializedWorker.getStderr();
if (workerStderr) {
workerStderr.on("data", chunk => process.stderr.write(chunk));
}
return initializedWorker;
};
}
const limit = (0, _pLimit.default)(getWorker && numberOfAssetsForMinify > 0 ?
/** @type {number} */
numberOfWorkers : Infinity);
const {
SourceMapSource,
ConcatSource,
RawSource
} = compiler.webpack.sources;
const allExtractedComments = new Map();
const scheduledTasks = [];
for (const asset of assetsForMinify) {
scheduledTasks.push(limit(async () => {
const {
name,
inputSource,
info,
cacheItem
} = asset;
let {
output
} = asset;
if (!output) {
let input;
/** @type {RawSourceMap | undefined} */
let inputSourceMap;
const {
source: sourceFromInputSource,
map
} = inputSource.sourceAndMap();
input = sourceFromInputSource;
if (map) {
if (TerserPlugin.isSourceMap(map)) {
inputSourceMap =
/** @type {RawSourceMap} */
map;
} else {
inputSourceMap =
/** @type {RawSourceMap} */
map;
compilation.warnings.push(
/** @type {WebpackError} */
new Error(`${name} contains invalid source map`));
}
}
if (Buffer.isBuffer(input)) {
input = input.toString();
}
/** @type {InternalMinifyOptions} */
const options = {
name,
input,
inputSourceMap,
minify: this.options.minify,
minifyOptions: { ...this.options.terserOptions
},
extractComments: this.options.extractComments
};
if (typeof options.minifyOptions.module === "undefined") {
if (typeof info.javascriptModule !== "undefined") {
options.minifyOptions.module = info.javascriptModule;
} else if (/\.mjs(\?.*)?$/i.test(name)) {
options.minifyOptions.module = true;
} else if (/\.cjs(\?.*)?$/i.test(name)) {
options.minifyOptions.module = false;
}
}
try {
output = await (getWorker ? getWorker().transform((0, _serializeJavascript.default)(options)) : (0, _minify.minify)(options));
} catch (error) {
const hasSourceMap = inputSourceMap && TerserPlugin.isSourceMap(inputSourceMap);
compilation.errors.push(TerserPlugin.buildError(error, name, // eslint-disable-next-line no-undefined
hasSourceMap ? compilation.requestShortener : undefined, hasSourceMap ? new _sourceMap.SourceMapConsumer(
/** @type {RawSourceMap} */
inputSourceMap) : // eslint-disable-next-line no-undefined
undefined));
return;
}
let shebang;
if (
/** @type {ExtractCommentsObject} */
this.options.extractComments.banner !== false && output.extractedComments && output.extractedComments.length > 0 && output.code.startsWith("#!")) {
const firstNewlinePosition = output.code.indexOf("\n");
shebang = output.code.substring(0, firstNewlinePosition);
output.code = output.code.substring(firstNewlinePosition + 1);
}
if (output.map) {
output.source = new SourceMapSource(output.code, name, output.map, input,
/** @type {RawSourceMap} */
inputSourceMap, true);
} else {
output.source = new RawSource(output.code);
}
if (output.extractedComments && output.extractedComments.length > 0) {
const commentsFilename =
/** @type {ExtractCommentsObject} */
this.options.extractComments.filename || "[file].LICENSE.txt[query]";
let query = "";
let filename = name;
const querySplit = filename.indexOf("?");
if (querySplit >= 0) {
query = filename.substr(querySplit);
filename = filename.substr(0, querySplit);
}
const lastSlashIndex = filename.lastIndexOf("/");
const basename = lastSlashIndex === -1 ? filename : filename.substr(lastSlashIndex + 1);
const data = {
filename,
basename,
query
};
output.commentsFilename = compilation.getPath(commentsFilename, data);
let banner; // Add a banner to the original file
if (
/** @type {ExtractCommentsObject} */
this.options.extractComments.banner !== false) {
banner =
/** @type {ExtractCommentsObject} */
this.options.extractComments.banner || `For license information please see ${path.relative(path.dirname(name), output.commentsFilename).replace(/\\/g, "/")}`;
if (typeof banner === "function") {
banner = banner(output.commentsFilename);
}
if (banner) {
output.source = new ConcatSource(shebang ? `${shebang}\n` : "", `/*! ${banner} */\n`, output.source);
}
}
const extractedCommentsString = output.extractedComments.sort().join("\n\n");
output.extractedCommentsSource = new RawSource(`${extractedCommentsString}\n`);
}
await cacheItem.storePromise({
source: output.source,
commentsFilename: output.commentsFilename,
extractedCommentsSource: output.extractedCommentsSource
});
}
/** @type {AssetInfo} */
const newInfo = {
minimized: true
};
const {
source,
extractedCommentsSource
} = output; // Write extracted comments to commentsFilename
if (extractedCommentsSource) {
const {
commentsFilename
} = output;
newInfo.related = {
license: commentsFilename
};
allExtractedComments.set(name, {
extractedCommentsSource,
commentsFilename
});
}
compilation.updateAsset(name, source, newInfo);
}));
}
await Promise.all(scheduledTasks);
if (initializedWorker) {
await initializedWorker.end();
}
await Array.from(allExtractedComments).sort().reduce(
/**
* @param {Promise<any>} previousPromise
* @param {any} extractedComments
* @returns {Promise<any>}
*/
async (previousPromise, [from, value]) => {
const previous = await previousPromise;
const {
commentsFilename,
extractedCommentsSource
} = value;
if (previous && previous.commentsFilename === commentsFilename) {
const {
from: previousFrom,
source: prevSource
} = previous;
const mergedName = `${previousFrom}|${from}`;
const name = `${commentsFilename}|${mergedName}`;
const eTag = [prevSource, extractedCommentsSource].map(item => cache.getLazyHashedEtag(item)).reduce((previousValue, currentValue) => cache.mergeEtags(previousValue, currentValue));
let source = await cache.getPromise(name, eTag);
if (!source) {
source = new ConcatSource(Array.from(new Set([...prevSource.source().split("\n\n"), ...extractedCommentsSource.source().split("\n\n")])).join("\n\n"));
await cache.storePromise(name, eTag, source);
}
compilation.updateAsset(commentsFilename, source);
return {
commentsFilename,
from: mergedName,
source
};
}
const existingAsset = compilation.getAsset(commentsFilename);
if (existingAsset) {
return {
commentsFilename,
from: commentsFilename,
source: existingAsset.source
};
}
compilation.emitAsset(commentsFilename, extractedCommentsSource, {
extractedComments: true
});
return {
commentsFilename,
from,
source: extractedCommentsSource
};
}, Promise.resolve());
}
/**
* @private
* @param {any} environment
* @returns {TerserECMA}
*/
static getEcmaVersion(environment) {
// ES 6th
if (environment.arrowFunction || environment.const || environment.destructuring || environment.forOf || environment.module) {
return 2015;
} // ES 11th
if (environment.bigIntLiteral || environment.dynamicImport) {
return 2020;
}
return 5;
}
/**
* @param {Compiler} compiler
* @returns {void}
*/
apply(compiler) {
const {
output
} = compiler.options;
if (typeof this.options.terserOptions.ecma === "undefined") {
this.options.terserOptions.ecma = TerserPlugin.getEcmaVersion(output.environment || {});
}
const pluginName = this.constructor.name;
const availableNumberOfCores = TerserPlugin.getAvailableNumberOfCores(this.options.parallel);
compiler.hooks.compilation.tap(pluginName, compilation => {
const hooks = compiler.webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(compilation);
const data = (0, _serializeJavascript.default)({
terser: terserPackageJson.version,
terserOptions: this.options.terserOptions
});
hooks.chunkHash.tap(pluginName, (chunk, hash) => {
hash.update("TerserPlugin");
hash.update(data);
});
compilation.hooks.processAssets.tapPromise({
name: pluginName,
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
additionalAssets: true
}, assets => this.optimize(compiler, compilation, assets, {
availableNumberOfCores
}));
compilation.hooks.statsPrinter.tap(pluginName, stats => {
stats.hooks.print.for("asset.info.minimized").tap("terser-webpack-plugin", (minimized, {
green,
formatFlag
}) => // eslint-disable-next-line no-undefined
minimized ? green(formatFlag("minimized")) : undefined);
});
});
}
}
var _default = TerserPlugin;
exports.default = _default;

View file

@ -0,0 +1,269 @@
"use strict";
const {
minify: terserMinify
} = require("terser");
/** @typedef {import("source-map").RawSourceMap} RawSourceMap */
/** @typedef {import("./index.js").ExtractCommentsOptions} ExtractCommentsOptions */
/** @typedef {import("./index.js").CustomMinifyFunction} CustomMinifyFunction */
/** @typedef {import("./index.js").MinifyOptions} MinifyOptions */
/** @typedef {import("terser").MinifyOptions} TerserMinifyOptions */
/** @typedef {import("terser").MinifyOutput} MinifyOutput */
/** @typedef {import("terser").FormatOptions} FormatOptions */
/** @typedef {import("terser").MangleOptions} MangleOptions */
/** @typedef {import("./index.js").ExtractCommentsFunction} ExtractCommentsFunction */
/** @typedef {import("./index.js").ExtractCommentsCondition} ExtractCommentsCondition */
/**
* @typedef {Object} InternalMinifyOptions
* @property {string} name
* @property {string} input
* @property {RawSourceMap | undefined} inputSourceMap
* @property {ExtractCommentsOptions} extractComments
* @property {CustomMinifyFunction | undefined} minify
* @property {MinifyOptions} minifyOptions
*/
/**
* @typedef {Array<string>} ExtractedComments
*/
/**
* @typedef {Promise<MinifyOutput & { extractedComments?: ExtractedComments}>} InternalMinifyResult
*/
/**
* @typedef {TerserMinifyOptions & { sourceMap: undefined } & ({ output: FormatOptions & { beautify: boolean } } | { format: FormatOptions & { beautify: boolean } })} NormalizedTerserMinifyOptions
*/
/**
* @param {TerserMinifyOptions} [terserOptions={}]
* @returns {NormalizedTerserMinifyOptions}
*/
function buildTerserOptions(terserOptions = {}) {
return { ...terserOptions,
mangle: terserOptions.mangle == null ? true : typeof terserOptions.mangle === "boolean" ? terserOptions.mangle : { ...terserOptions.mangle
},
// Ignoring sourceMap from options
// eslint-disable-next-line no-undefined
sourceMap: undefined,
// the `output` option is deprecated
...(terserOptions.format ? {
format: {
beautify: false,
...terserOptions.format
}
} : {
output: {
beautify: false,
...terserOptions.output
}
})
};
}
/**
* @param {any} value
* @returns {boolean}
*/
function isObject(value) {
const type = typeof value;
return value != null && (type === "object" || type === "function");
}
/**
* @param {ExtractCommentsOptions} extractComments
* @param {NormalizedTerserMinifyOptions} terserOptions
* @param {ExtractedComments} extractedComments
* @returns {ExtractCommentsFunction}
*/
function buildComments(extractComments, terserOptions, extractedComments) {
/** @type {{ [index: string]: ExtractCommentsCondition }} */
const condition = {};
let comments;
if (terserOptions.format) {
({
comments
} = terserOptions.format);
} else if (terserOptions.output) {
({
comments
} = terserOptions.output);
}
condition.preserve = typeof comments !== "undefined" ? comments : false;
if (typeof extractComments === "boolean" && extractComments) {
condition.extract = "some";
} else if (typeof extractComments === "string" || extractComments instanceof RegExp) {
condition.extract = extractComments;
} else if (typeof extractComments === "function") {
condition.extract = extractComments;
} else if (extractComments && isObject(extractComments)) {
condition.extract = typeof extractComments.condition === "boolean" && extractComments.condition ? "some" : typeof extractComments.condition !== "undefined" ? extractComments.condition : "some";
} else {
// No extract
// Preserve using "commentsOpts" or "some"
condition.preserve = typeof comments !== "undefined" ? comments : "some";
condition.extract = false;
} // Ensure that both conditions are functions
["preserve", "extract"].forEach(key => {
/** @type {undefined | string} */
let regexStr;
/** @type {undefined | RegExp} */
let regex;
switch (typeof condition[key]) {
case "boolean":
condition[key] = condition[key] ? () => true : () => false;
break;
case "function":
break;
case "string":
if (condition[key] === "all") {
condition[key] = () => true;
break;
}
if (condition[key] === "some") {
condition[key] =
/** @type {ExtractCommentsFunction} */
(astNode, comment) => (comment.type === "comment2" || comment.type === "comment1") && /@preserve|@lic|@cc_on|^\**!/i.test(comment.value);
break;
}
regexStr =
/** @type {string} */
condition[key];
condition[key] =
/** @type {ExtractCommentsFunction} */
(astNode, comment) => new RegExp(
/** @type {string} */
regexStr).test(comment.value);
break;
default:
regex =
/** @type {RegExp} */
condition[key];
condition[key] =
/** @type {ExtractCommentsFunction} */
(astNode, comment) =>
/** @type {RegExp} */
regex.test(comment.value);
}
}); // Redefine the comments function to extract and preserve
// comments according to the two conditions
return (astNode, comment) => {
if (
/** @type {{ extract: ExtractCommentsFunction }} */
condition.extract(astNode, comment)) {
const commentText = comment.type === "comment2" ? `/*${comment.value}*/` : `//${comment.value}`; // Don't include duplicate comments
if (!extractedComments.includes(commentText)) {
extractedComments.push(commentText);
}
}
return (
/** @type {{ preserve: ExtractCommentsFunction }} */
condition.preserve(astNode, comment)
);
};
}
/**
* @param {InternalMinifyOptions} options
* @returns {InternalMinifyResult}
*/
async function minify(options) {
const {
name,
input,
inputSourceMap,
minify: minifyFn,
minifyOptions
} = options;
if (minifyFn) {
return minifyFn({
[name]: input
}, inputSourceMap, minifyOptions);
} // Copy terser options
const terserOptions = buildTerserOptions(minifyOptions); // Let terser generate a SourceMap
if (inputSourceMap) {
// @ts-ignore
terserOptions.sourceMap = {
asObject: true
};
}
/** @type {ExtractedComments} */
const extractedComments = [];
const {
extractComments
} = options;
if (terserOptions.output) {
terserOptions.output.comments = buildComments(extractComments, terserOptions, extractedComments);
} else if (terserOptions.format) {
terserOptions.format.comments = buildComments(extractComments, terserOptions, extractedComments);
}
const result = await terserMinify({
[name]: input
}, terserOptions);
return { ...result,
extractedComments
};
}
/**
* @param {string} options
* @returns {InternalMinifyResult}
*/
function transform(options) {
// 'use strict' => this === undefined (Clean Scope)
// Safer for possible security issues, albeit not critical at all here
// eslint-disable-next-line no-param-reassign
const evaluatedOptions =
/** @type {InternalMinifyOptions} */
// eslint-disable-next-line no-new-func
new Function("exports", "require", "module", "__filename", "__dirname", `'use strict'\nreturn ${options}`)(exports, require, module, __filename, __dirname);
return minify(evaluatedOptions);
}
module.exports.minify = minify;
module.exports.transform = transform;

View file

@ -0,0 +1,151 @@
{
"definitions": {
"Rule": {
"description": "Filtering rule as regex or string.",
"anyOf": [
{
"instanceof": "RegExp",
"tsType": "RegExp"
},
{
"type": "string",
"minLength": 1
}
]
},
"Rules": {
"description": "Filtering rules.",
"anyOf": [
{
"type": "array",
"items": {
"description": "A rule condition.",
"oneOf": [
{
"$ref": "#/definitions/Rule"
}
]
}
},
{
"$ref": "#/definitions/Rule"
}
]
}
},
"title": "TerserPluginOptions",
"type": "object",
"additionalProperties": false,
"properties": {
"test": {
"description": "Include all modules that pass test assertion.",
"oneOf": [
{
"$ref": "#/definitions/Rules"
}
]
},
"include": {
"description": "Include all modules matching any of these conditions.",
"oneOf": [
{
"$ref": "#/definitions/Rules"
}
]
},
"exclude": {
"description": "Exclude all modules matching any of these conditions.",
"oneOf": [
{
"$ref": "#/definitions/Rules"
}
]
},
"terserOptions": {
"description": "Options for `terser`.",
"additionalProperties": true,
"type": "object"
},
"extractComments": {
"description": "Whether comments shall be extracted to a separate file.",
"anyOf": [
{
"type": "boolean"
},
{
"type": "string",
"minLength": 1
},
{
"instanceof": "RegExp"
},
{
"instanceof": "Function"
},
{
"additionalProperties": false,
"properties": {
"condition": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "string",
"minLength": 1
},
{
"instanceof": "RegExp"
},
{
"instanceof": "Function"
}
]
},
"filename": {
"anyOf": [
{
"type": "string",
"minLength": 1
},
{
"instanceof": "Function"
}
]
},
"banner": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "string",
"minLength": 1
},
{
"instanceof": "Function"
}
]
}
},
"type": "object"
}
]
},
"parallel": {
"description": "Use multi-process parallel running to improve the build speed.",
"anyOf": [
{
"type": "boolean"
},
{
"type": "integer"
}
]
},
"minify": {
"description": "Allows you to override default minify function.",
"instanceof": "Function"
}
}
}