1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | "use strict";
|
7 |
|
8 | const makeSerializable = require("../util/makeSerializable");
|
9 | const NullDependency = require("./NullDependency");
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | class CssExportDependency extends NullDependency {
|
18 | |
19 |
|
20 |
|
21 |
|
22 | constructor(name, value) {
|
23 | super();
|
24 | this.name = name;
|
25 | this.value = value;
|
26 | }
|
27 |
|
28 | get type() {
|
29 | return "css :export";
|
30 | }
|
31 |
|
32 | |
33 |
|
34 |
|
35 |
|
36 |
|
37 | getExports(moduleGraph) {
|
38 | const name = this.name;
|
39 | return {
|
40 | exports: [
|
41 | {
|
42 | name,
|
43 | canMangle: true
|
44 | }
|
45 | ],
|
46 | dependencies: undefined
|
47 | };
|
48 | }
|
49 |
|
50 | serialize(context) {
|
51 | const { write } = context;
|
52 | write(this.name);
|
53 | write(this.value);
|
54 | super.serialize(context);
|
55 | }
|
56 |
|
57 | deserialize(context) {
|
58 | const { read } = context;
|
59 | this.name = read();
|
60 | this.value = read();
|
61 | super.deserialize(context);
|
62 | }
|
63 | }
|
64 |
|
65 | CssExportDependency.Template = class CssExportDependencyTemplate extends (
|
66 | NullDependency.Template
|
67 | ) {
|
68 | |
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 | apply(dependency, source, { cssExports }) {
|
75 | const dep = (dependency);
|
76 | cssExports.set(dep.name, dep.value);
|
77 | }
|
78 | };
|
79 |
|
80 | makeSerializable(
|
81 | CssExportDependency,
|
82 | "webpack/lib/dependencies/CssExportDependency"
|
83 | );
|
84 |
|
85 | module.exports = CssExportDependency;
|