source: imaps-frontend/node_modules/webpack/lib/EnvironmentNotSupportAsyncWarning.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.8 KB
RevLine 
[79a0317]1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Gengkun He @ahabhgk
4*/
5
6"use strict";
7
8const WebpackError = require("./WebpackError");
9const makeSerializable = require("./util/makeSerializable");
10
11/** @typedef {import("./Module")} Module */
12/** @typedef {import("./Compilation")} Compilation */
13/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
14/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
15/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
16/** @typedef {"asyncWebAssembly" | "topLevelAwait" | "external promise" | "external script" | "external import" | "external module"} Feature */
17
18class EnvironmentNotSupportAsyncWarning extends WebpackError {
19 /**
20 * Creates an instance of EnvironmentNotSupportAsyncWarning.
21 * @param {Module} module module
22 * @param {Feature} feature feature
23 */
24 constructor(module, feature) {
25 const message = `The generated code contains 'async/await' because this module is using "${feature}".
26However, your target environment does not appear to support 'async/await'.
27As a result, the code may not run as expected or may cause runtime errors.`;
28 super(message);
29
30 this.name = "EnvironmentNotSupportAsyncWarning";
31 this.module = module;
32 }
33
34 /**
35 * Creates an instance of EnvironmentNotSupportAsyncWarning.
36 * @param {Module} module module
37 * @param {RuntimeTemplate} runtimeTemplate compilation
38 * @param {Feature} feature feature
39 */
40 static check(module, runtimeTemplate, feature) {
41 if (!runtimeTemplate.supportsAsyncFunction()) {
42 module.addWarning(new EnvironmentNotSupportAsyncWarning(module, feature));
43 }
44 }
45}
46
47makeSerializable(
48 EnvironmentNotSupportAsyncWarning,
49 "webpack/lib/EnvironmentNotSupportAsyncWarning"
50);
51
52module.exports = EnvironmentNotSupportAsyncWarning;
Note: See TracBrowser for help on using the repository browser.