source: imaps-frontend/node_modules/webpack/lib/dependencies/CommonJsRequireContextDependency.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • 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 ContextDependency = require("./ContextDependency");
10const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall");
11
12/** @typedef {import("../javascript/JavascriptParser").Range} Range */
13/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
14/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
15
16class CommonJsRequireContextDependency extends ContextDependency {
17 /**
18 * @param {TODO} options options for the context module
19 * @param {Range} range location in source code
20 * @param {Range | undefined} valueRange location of the require call
21 * @param {boolean | string } inShorthand true or name
22 * @param {string} context context
23 */
24 constructor(options, range, valueRange, inShorthand, context) {
25 super(options, context);
26
27 this.range = range;
28 this.valueRange = valueRange;
29 // inShorthand must be serialized by subclasses that use it
30 this.inShorthand = inShorthand;
31 }
32
33 get type() {
34 return "cjs require context";
35 }
36
37 /**
38 * @param {ObjectSerializerContext} context context
39 */
40 serialize(context) {
41 const { write } = context;
42
43 write(this.range);
44 write(this.valueRange);
45 write(this.inShorthand);
46
47 super.serialize(context);
48 }
49
50 /**
51 * @param {ObjectDeserializerContext} context context
52 */
53 deserialize(context) {
54 const { read } = context;
55
56 this.range = read();
57 this.valueRange = read();
58 this.inShorthand = read();
59
60 super.deserialize(context);
61 }
62}
63
64makeSerializable(
65 CommonJsRequireContextDependency,
66 "webpack/lib/dependencies/CommonJsRequireContextDependency"
67);
68
69CommonJsRequireContextDependency.Template =
70 ContextDependencyTemplateAsRequireCall;
71
72module.exports = CommonJsRequireContextDependency;
Note: See TracBrowser for help on using the repository browser.