source: frontend/node_modules/webpack/lib/WarnDeprecatedOptionPlugin.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Florent Cailhol @ooflorent
4*/
5
6"use strict";
7
8const WebpackError = require("./errors/WebpackError");
9
10/** @typedef {import("./Compiler")} Compiler */
11
12const PLUGIN_NAME = "WarnDeprecatedOptionPlugin";
13
14class WarnDeprecatedOptionPlugin {
15 /**
16 * Create an instance of the plugin
17 * @param {string} option the target option
18 * @param {string | number} value the deprecated option value
19 * @param {string} suggestion the suggestion replacement
20 */
21 constructor(option, value, suggestion) {
22 this.option = option;
23 this.value = value;
24 this.suggestion = suggestion;
25 }
26
27 /**
28 * Applies the plugin by registering its hooks on the compiler.
29 * @param {Compiler} compiler the compiler instance
30 * @returns {void}
31 */
32 apply(compiler) {
33 compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
34 compilation.warnings.push(
35 new DeprecatedOptionWarning(this.option, this.value, this.suggestion)
36 );
37 });
38 }
39}
40
41class DeprecatedOptionWarning extends WebpackError {
42 /**
43 * Create an instance deprecated option warning
44 * @param {string} option the target option
45 * @param {string | number} value the deprecated option value
46 * @param {string} suggestion the suggestion replacement
47 */
48 constructor(option, value, suggestion) {
49 super();
50
51 /** @type {string} */
52 this.name = "DeprecatedOptionWarning";
53 this.message =
54 "configuration\n" +
55 `The value '${value}' for option '${option}' is deprecated. ` +
56 `Use '${suggestion}' instead.`;
57 }
58}
59
60module.exports = WarnDeprecatedOptionPlugin;
Note: See TracBrowser for help on using the repository browser.