source: imaps-frontend/node_modules/webpack/lib/ModuleWarning.js@ 79a0317

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

F4 Finalna Verzija

  • 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 Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const { cleanUp } = require("./ErrorHelpers");
9const WebpackError = require("./WebpackError");
10const makeSerializable = require("./util/makeSerializable");
11
12/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
13/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
14
15class ModuleWarning extends WebpackError {
16 /**
17 * @param {Error} warning error thrown
18 * @param {{from?: string|null}} info additional info
19 */
20 constructor(warning, { from = null } = {}) {
21 let message = "Module Warning";
22
23 message += from ? ` (from ${from}):\n` : ": ";
24
25 if (warning && typeof warning === "object" && warning.message) {
26 message += warning.message;
27 } else if (warning) {
28 message += String(warning);
29 }
30
31 super(message);
32
33 this.name = "ModuleWarning";
34 this.warning = warning;
35 this.details =
36 warning && typeof warning === "object" && warning.stack
37 ? cleanUp(warning.stack, this.message)
38 : undefined;
39 }
40
41 /**
42 * @param {ObjectSerializerContext} context context
43 */
44 serialize(context) {
45 const { write } = context;
46
47 write(this.warning);
48
49 super.serialize(context);
50 }
51
52 /**
53 * @param {ObjectDeserializerContext} context context
54 */
55 deserialize(context) {
56 const { read } = context;
57
58 this.warning = read();
59
60 super.deserialize(context);
61 }
62}
63
64makeSerializable(ModuleWarning, "webpack/lib/ModuleWarning");
65
66module.exports = ModuleWarning;
Note: See TracBrowser for help on using the repository browser.