source: trip-planner-front/node_modules/webpack/lib/WarnDeprecatedOptionPlugin.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[6a3a178]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("./WebpackError");
9
10/** @typedef {import("./Compiler")} Compiler */
11
12class WarnDeprecatedOptionPlugin {
13 /**
14 * Create an instance of the plugin
15 * @param {string} option the target option
16 * @param {string | number} value the deprecated option value
17 * @param {string} suggestion the suggestion replacement
18 */
19 constructor(option, value, suggestion) {
20 this.option = option;
21 this.value = value;
22 this.suggestion = suggestion;
23 }
24
25 /**
26 * Apply the plugin
27 * @param {Compiler} compiler the compiler instance
28 * @returns {void}
29 */
30 apply(compiler) {
31 compiler.hooks.thisCompilation.tap(
32 "WarnDeprecatedOptionPlugin",
33 compilation => {
34 compilation.warnings.push(
35 new DeprecatedOptionWarning(this.option, this.value, this.suggestion)
36 );
37 }
38 );
39 }
40}
41
42class DeprecatedOptionWarning extends WebpackError {
43 constructor(option, value, suggestion) {
44 super();
45
46 this.name = "DeprecatedOptionWarning";
47 this.message =
48 "configuration\n" +
49 `The value '${value}' for option '${option}' is deprecated. ` +
50 `Use '${suggestion}' instead.`;
51 }
52}
53
54module.exports = WarnDeprecatedOptionPlugin;
Note: See TracBrowser for help on using the repository browser.