source: frontend/node_modules/webpack/lib/dependencies/StaticExportsDependency.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.9 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 makeSerializable = require("../util/makeSerializable");
9const NullDependency = require("./NullDependency");
10
11/** @typedef {import("../Dependency").ExportsSpec} ExportsSpec */
12/** @typedef {import("../ModuleGraph")} ModuleGraph */
13/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
14/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
15
16/** @typedef {string[] | true} Exports */
17
18class StaticExportsDependency extends NullDependency {
19 /**
20 * Creates an instance of StaticExportsDependency.
21 * @param {Exports} exports export names
22 * @param {boolean} canMangle true, if mangling exports names is allowed
23 */
24 constructor(exports, canMangle) {
25 super();
26 this.exports = exports;
27 this.canMangle = canMangle;
28 }
29
30 get type() {
31 return "static exports";
32 }
33
34 /**
35 * Returns the exported names
36 * @param {ModuleGraph} moduleGraph module graph
37 * @returns {ExportsSpec | undefined} export names
38 */
39 getExports(moduleGraph) {
40 return {
41 exports: this.exports,
42 canMangle: this.canMangle,
43 dependencies: undefined
44 };
45 }
46
47 /**
48 * Serializes this instance into the provided serializer context.
49 * @param {ObjectSerializerContext} context context
50 */
51 serialize(context) {
52 const { write } = context;
53 write(this.exports);
54 write(this.canMangle);
55 super.serialize(context);
56 }
57
58 /**
59 * Restores this instance from the provided deserializer context.
60 * @param {ObjectDeserializerContext} context context
61 */
62 deserialize(context) {
63 const { read } = context;
64 this.exports = read();
65 this.canMangle = read();
66 super.deserialize(context);
67 }
68}
69
70makeSerializable(
71 StaticExportsDependency,
72 "webpack/lib/dependencies/StaticExportsDependency"
73);
74
75module.exports = StaticExportsDependency;
Note: See TracBrowser for help on using the repository browser.