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.2 KB
|
Rev | Line | |
---|
[79a0317] | 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 | * @param {string} name name
|
---|
| 16 | * @param {number} idx index
|
---|
| 17 | */
|
---|
| 18 | constructor(name, idx) {
|
---|
| 19 | this.name = name;
|
---|
| 20 | this.idx = idx;
|
---|
| 21 | this.used = false;
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | flagUsed() {
|
---|
| 25 | this.used = true;
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * @returns {string} variable name
|
---|
| 30 | */
|
---|
| 31 | variableName() {
|
---|
| 32 | return `__WEBPACK_LOCAL_MODULE_${this.idx}__`;
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | /**
|
---|
| 36 | * @param {ObjectSerializerContext} context context
|
---|
| 37 | */
|
---|
| 38 | serialize(context) {
|
---|
| 39 | const { write } = context;
|
---|
| 40 |
|
---|
| 41 | write(this.name);
|
---|
| 42 | write(this.idx);
|
---|
| 43 | write(this.used);
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | /**
|
---|
| 47 | * @param {ObjectDeserializerContext} context context
|
---|
| 48 | */
|
---|
| 49 | deserialize(context) {
|
---|
| 50 | const { read } = context;
|
---|
| 51 |
|
---|
| 52 | this.name = read();
|
---|
| 53 | this.idx = read();
|
---|
| 54 | this.used = read();
|
---|
| 55 | }
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | makeSerializable(LocalModule, "webpack/lib/dependencies/LocalModule");
|
---|
| 59 |
|
---|
| 60 | module.exports = LocalModule;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.