source: trip-planner-front/node_modules/webpack/lib/ModuleWarning.js@ fa375fe

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

initial commit

  • Property mode set to 100644
File size: 1.2 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
12class ModuleWarning extends WebpackError {
13 /**
14 * @param {Error} warning error thrown
15 * @param {{from?: string|null}} info additional info
16 */
17 constructor(warning, { from = null } = {}) {
18 let message = "Module Warning";
19
20 if (from) {
21 message += ` (from ${from}):\n`;
22 } else {
23 message += ": ";
24 }
25
26 if (warning && typeof warning === "object" && warning.message) {
27 message += warning.message;
28 } else if (warning) {
29 message += String(warning);
30 }
31
32 super(message);
33
34 this.name = "ModuleWarning";
35 this.warning = warning;
36 this.details =
37 warning && typeof warning === "object" && warning.stack
38 ? cleanUp(warning.stack, this.message)
39 : undefined;
40 }
41
42 serialize(context) {
43 const { write } = context;
44
45 write(this.warning);
46
47 super.serialize(context);
48 }
49
50 deserialize(context) {
51 const { read } = context;
52
53 this.warning = read();
54
55 super.deserialize(context);
56 }
57}
58
59makeSerializable(ModuleWarning, "webpack/lib/ModuleWarning");
60
61module.exports = ModuleWarning;
Note: See TracBrowser for help on using the repository browser.