source: trip-planner-front/node_modules/webpack/lib/dependencies/ContextElementDependency.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[6a3a178]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");
10const ModuleDependency = require("./ModuleDependency");
11
12/** @typedef {import("../Dependency").ReferencedExport} ReferencedExport */
13/** @typedef {import("../ModuleGraph")} ModuleGraph */
14/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
15
16class ContextElementDependency extends ModuleDependency {
17 constructor(request, userRequest, typePrefix, category, referencedExports) {
18 super(request);
19 this.referencedExports = referencedExports;
20 this._typePrefix = typePrefix;
21 this._category = category;
22
23 if (userRequest) {
24 this.userRequest = userRequest;
25 }
26 }
27
28 get type() {
29 if (this._typePrefix) {
30 return `${this._typePrefix} context element`;
31 }
32
33 return "context element";
34 }
35
36 get category() {
37 return this._category;
38 }
39
40 /**
41 * Returns list of exports referenced by this dependency
42 * @param {ModuleGraph} moduleGraph module graph
43 * @param {RuntimeSpec} runtime the runtime for which the module is analysed
44 * @returns {(string[] | ReferencedExport)[]} referenced exports
45 */
46 getReferencedExports(moduleGraph, runtime) {
47 return this.referencedExports
48 ? this.referencedExports.map(e => ({
49 name: e,
50 canMangle: false
51 }))
52 : Dependency.EXPORTS_OBJECT_REFERENCED;
53 }
54
55 serialize(context) {
56 context.write(this.referencedExports);
57 super.serialize(context);
58 }
59
60 deserialize(context) {
61 this.referencedExports = context.read();
62 super.deserialize(context);
63 }
64}
65
66makeSerializable(
67 ContextElementDependency,
68 "webpack/lib/dependencies/ContextElementDependency"
69);
70
71module.exports = ContextElementDependency;
Note: See TracBrowser for help on using the repository browser.