source: frontend/node_modules/webpack/lib/sharing/ProvideSharedDependency.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: 2.2 KB
RevLine 
[9af201e]1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const Dependency = require("../Dependency");
9const makeSerializable = require("../util/makeSerializable");
10
11/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
12/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
13
14class ProvideSharedDependency extends Dependency {
15 /**
16 * Creates an instance of ProvideSharedDependency.
17 * @param {string} shareScope share scope
18 * @param {string} name module name
19 * @param {string | false} version version
20 * @param {string} request request
21 * @param {boolean} eager true, if this is an eager dependency
22 */
23 constructor(shareScope, name, version, request, eager) {
24 super();
25 this.shareScope = shareScope;
26 this.name = name;
27 this.version = version;
28 this.request = request;
29 this.eager = eager;
30 }
31
32 get type() {
33 return "provide shared module";
34 }
35
36 /**
37 * Returns an identifier to merge equal requests.
38 * @returns {string | null} an identifier to merge equal requests
39 */
40 getResourceIdentifier() {
41 return `provide module (${this.shareScope}) ${this.request} as ${
42 this.name
43 } @ ${this.version}${this.eager ? " (eager)" : ""}`;
44 }
45
46 /**
47 * Serializes this instance into the provided serializer context.
48 * @param {ObjectSerializerContext} context context
49 */
50 serialize(context) {
51 context.write(this.shareScope);
52 context.write(this.name);
53 context.write(this.request);
54 context.write(this.version);
55 context.write(this.eager);
56 super.serialize(context);
57 }
58
59 /**
60 * Restores this instance from the provided deserializer context.
61 * @param {ObjectDeserializerContext} context context
62 * @returns {ProvideSharedDependency} deserialize fallback dependency
63 */
64 static deserialize(context) {
65 const { read } = context;
66 const obj = new ProvideSharedDependency(
67 read(),
68 read(),
69 read(),
70 read(),
71 read()
72 );
73 this.shareScope = context.read();
74 obj.deserialize(context);
75 return obj;
76 }
77}
78
79makeSerializable(
80 ProvideSharedDependency,
81 "webpack/lib/sharing/ProvideSharedDependency"
82);
83
84module.exports = ProvideSharedDependency;
Note: See TracBrowser for help on using the repository browser.