UNPKG

2.84 kBTypeScriptView Raw
1export = JsonMinimizerPlugin;
2/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */
3/** @typedef {import("webpack").Compiler} Compiler */
4/** @typedef {import("webpack").Compilation} Compilation */
5/** @typedef {import("webpack").Asset} Asset */
6/** @typedef {import("webpack").WebpackError} WebpackError */
7/** @typedef {RegExp | string} Rule */
8/** @typedef {Rule[] | Rule} Rules */
9/**
10 * @typedef {Object} JSONOptions
11 * @property {(this: any, key: string, value: any) => any | (number | string)[] | null} [replacer]
12 * @property {string | number} [space]
13 */
14/**
15 * @typedef {Object} BasePluginOptions
16 * @property {Rule} [test]
17 * @property {Rule} [include]
18 * @property {Rule} [exclude]
19 * @property {JSONOptions} [minimizerOptions]
20 */
21/**
22 * @typedef {Object} MinimizedResult
23 * @property {string} code
24 */
25/**
26 * @typedef {Object} InternalOptions
27 * @property {string} input
28 * @property {JSONOptions} [minimizerOptions]
29 */
30/**
31 * @typedef {BasePluginOptions} InternalPluginOptions
32 */
33declare class JsonMinimizerPlugin {
34 /**
35 * @param {any} error
36 * @param {string} file
37 * @param {string} context
38 * @returns {Error}
39 */
40 static buildError(error: any, file: string, context: string): Error;
41 /**
42 * @param {BasePluginOptions} [options]
43 */
44 constructor(options?: BasePluginOptions | undefined);
45 /**
46 * @private
47 * @type {InternalPluginOptions}
48 */
49 private options;
50 /**
51 * @private
52 * @param {Compiler} compiler
53 * @param {Compilation} compilation
54 * @param {Record<string, import("webpack").sources.Source>} assets
55 * @returns {Promise<void>}
56 */
57 private optimize;
58 /**
59 * @param {Compiler} compiler
60 * @returns {void}
61 */
62 apply(compiler: Compiler): void;
63}
64declare namespace JsonMinimizerPlugin {
65 export {
66 Schema,
67 Compiler,
68 Compilation,
69 Asset,
70 WebpackError,
71 Rule,
72 Rules,
73 JSONOptions,
74 BasePluginOptions,
75 MinimizedResult,
76 InternalOptions,
77 InternalPluginOptions,
78 };
79}
80type Schema = import("schema-utils/declarations/validate").Schema;
81type Compiler = import("webpack").Compiler;
82type Compilation = import("webpack").Compilation;
83type Asset = import("webpack").Asset;
84type WebpackError = import("webpack").WebpackError;
85type Rule = RegExp | string;
86type Rules = Rule[] | Rule;
87type JSONOptions = {
88 replacer?:
89 | ((this: any, key: string, value: any) => any | (number | string)[] | null)
90 | undefined;
91 space?: string | number | undefined;
92};
93type BasePluginOptions = {
94 test?: Rule | undefined;
95 include?: Rule | undefined;
96 exclude?: Rule | undefined;
97 minimizerOptions?: JSONOptions | undefined;
98};
99type MinimizedResult = {
100 code: string;
101};
102type InternalOptions = {
103 input: string;
104 minimizerOptions?: JSONOptions | undefined;
105};
106type InternalPluginOptions = BasePluginOptions;
107
\No newline at end of file