source: frontend/node_modules/webpack/lib/dependencies/URLContextDependency.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • 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 Haijie Xie @hai-x
4*/
5
6"use strict";
7
8const makeSerializable = require("../util/makeSerializable");
9const ContextDependency = require("./ContextDependency");
10const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall");
11
12/** @typedef {import("../ContextModule").ContextOptions} ContextOptions */
13/** @typedef {import("../javascript/JavascriptParser").Range} Range */
14/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
15/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
16
17/** @typedef {ContextOptions & { request: string }} ContextDependencyOptions */
18
19class URLContextDependency extends ContextDependency {
20 /**
21 * Creates an instance of URLContextDependency.
22 * @param {ContextDependencyOptions} options options
23 * @param {Range} range range
24 * @param {Range} valueRange value range
25 */
26 constructor(options, range, valueRange) {
27 super(options);
28 this.range = range;
29 this.valueRange = valueRange;
30 }
31
32 get type() {
33 return "new URL() context";
34 }
35
36 get category() {
37 return "url";
38 }
39
40 /**
41 * Serializes this instance into the provided serializer context.
42 * @param {ObjectSerializerContext} context context
43 */
44 serialize(context) {
45 const { write } = context;
46 write(this.valueRange);
47 super.serialize(context);
48 }
49
50 /**
51 * Restores this instance from the provided deserializer context.
52 * @param {ObjectDeserializerContext} context context
53 */
54 deserialize(context) {
55 const { read } = context;
56 this.valueRange = read();
57 super.deserialize(context);
58 }
59}
60
61makeSerializable(
62 URLContextDependency,
63 "webpack/lib/dependencies/URLContextDependency"
64);
65
66URLContextDependency.Template = ContextDependencyTemplateAsRequireCall;
67
68module.exports = URLContextDependency;
Note: See TracBrowser for help on using the repository browser.