Last change
on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 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 |
|
---|
8 | const makeSerializable = require("../util/makeSerializable");
|
---|
9 | const ContextDependency = require("./ContextDependency");
|
---|
10 | const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall");
|
---|
11 |
|
---|
12 | class ImportContextDependency extends ContextDependency {
|
---|
13 | constructor(options, range, valueRange) {
|
---|
14 | super(options);
|
---|
15 |
|
---|
16 | this.range = range;
|
---|
17 | this.valueRange = valueRange;
|
---|
18 | }
|
---|
19 |
|
---|
20 | get type() {
|
---|
21 | return `import() context ${this.options.mode}`;
|
---|
22 | }
|
---|
23 |
|
---|
24 | get category() {
|
---|
25 | return "esm";
|
---|
26 | }
|
---|
27 |
|
---|
28 | serialize(context) {
|
---|
29 | const { write } = context;
|
---|
30 |
|
---|
31 | write(this.range);
|
---|
32 | write(this.valueRange);
|
---|
33 |
|
---|
34 | super.serialize(context);
|
---|
35 | }
|
---|
36 |
|
---|
37 | deserialize(context) {
|
---|
38 | const { read } = context;
|
---|
39 |
|
---|
40 | this.range = read();
|
---|
41 | this.valueRange = read();
|
---|
42 |
|
---|
43 | super.deserialize(context);
|
---|
44 | }
|
---|
45 | }
|
---|
46 |
|
---|
47 | makeSerializable(
|
---|
48 | ImportContextDependency,
|
---|
49 | "webpack/lib/dependencies/ImportContextDependency"
|
---|
50 | );
|
---|
51 |
|
---|
52 | ImportContextDependency.Template = ContextDependencyTemplateAsRequireCall;
|
---|
53 |
|
---|
54 | module.exports = ImportContextDependency;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.