|
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.4 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 |
|
|---|
| 8 | const makeSerializable = require("../util/makeSerializable");
|
|---|
| 9 |
|
|---|
| 10 | /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|---|
| 11 | /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|---|
| 12 |
|
|---|
| 13 | class LocalModule {
|
|---|
| 14 | /**
|
|---|
| 15 | * Creates an instance of LocalModule.
|
|---|
| 16 | * @param {string} name name
|
|---|
| 17 | * @param {number} idx index
|
|---|
| 18 | */
|
|---|
| 19 | constructor(name, idx) {
|
|---|
| 20 | this.name = name;
|
|---|
| 21 | this.idx = idx;
|
|---|
| 22 | this.used = false;
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | flagUsed() {
|
|---|
| 26 | this.used = true;
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | /**
|
|---|
| 30 | * Returns variable name.
|
|---|
| 31 | * @returns {string} variable name
|
|---|
| 32 | */
|
|---|
| 33 | variableName() {
|
|---|
| 34 | return `__WEBPACK_LOCAL_MODULE_${this.idx}__`;
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | /**
|
|---|
| 38 | * Serializes this instance into the provided serializer context.
|
|---|
| 39 | * @param {ObjectSerializerContext} context context
|
|---|
| 40 | */
|
|---|
| 41 | serialize(context) {
|
|---|
| 42 | const { write } = context;
|
|---|
| 43 |
|
|---|
| 44 | write(this.name);
|
|---|
| 45 | write(this.idx);
|
|---|
| 46 | write(this.used);
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | /**
|
|---|
| 50 | * Restores this instance from the provided deserializer context.
|
|---|
| 51 | * @param {ObjectDeserializerContext} context context
|
|---|
| 52 | */
|
|---|
| 53 | deserialize(context) {
|
|---|
| 54 | const { read } = context;
|
|---|
| 55 |
|
|---|
| 56 | this.name = read();
|
|---|
| 57 | this.idx = read();
|
|---|
| 58 | this.used = read();
|
|---|
| 59 | }
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | makeSerializable(LocalModule, "webpack/lib/dependencies/LocalModule");
|
|---|
| 63 |
|
|---|
| 64 | module.exports = LocalModule;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.