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

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.5 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("./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 /**
44 * Create an instance deprecated option warning
45 * @param {string} option the target option
46 * @param {string | number} value the deprecated option value
47 * @param {string} suggestion the suggestion replacement
48 */
49 constructor(option, value, suggestion) {
50 super();
51
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.