1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | "use strict";
|
7 |
|
8 | const Dependency = require("../Dependency");
|
9 | const makeSerializable = require("../util/makeSerializable");
|
10 | const CssLocalIdentifierDependency = require("./CssLocalIdentifierDependency");
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | class CssSelfLocalIdentifierDependency extends CssLocalIdentifierDependency {
|
20 | |
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | constructor(name, range, prefix = "", declaredSet = undefined) {
|
27 | super(name, range, prefix);
|
28 | this.declaredSet = declaredSet;
|
29 | }
|
30 |
|
31 | get type() {
|
32 | return "css self local identifier";
|
33 | }
|
34 |
|
35 | get category() {
|
36 | return "self";
|
37 | }
|
38 |
|
39 | |
40 |
|
41 |
|
42 | getResourceIdentifier() {
|
43 | return `self`;
|
44 | }
|
45 | |
46 |
|
47 |
|
48 |
|
49 |
|
50 | getExports(moduleGraph) {
|
51 | if (this.declaredSet && !this.declaredSet.has(this.name)) return;
|
52 | return super.getExports(moduleGraph);
|
53 | }
|
54 |
|
55 | |
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | getReferencedExports(moduleGraph, runtime) {
|
62 | if (this.declaredSet && !this.declaredSet.has(this.name))
|
63 | return Dependency.NO_EXPORTS_REFERENCED;
|
64 | return [[this.name]];
|
65 | }
|
66 |
|
67 | serialize(context) {
|
68 | const { write } = context;
|
69 | write(this.declaredSet);
|
70 | super.serialize(context);
|
71 | }
|
72 |
|
73 | deserialize(context) {
|
74 | const { read } = context;
|
75 | this.declaredSet = read();
|
76 | super.deserialize(context);
|
77 | }
|
78 | }
|
79 |
|
80 | CssSelfLocalIdentifierDependency.Template = class CssSelfLocalIdentifierDependencyTemplate extends (
|
81 | CssLocalIdentifierDependency.Template
|
82 | ) {
|
83 | |
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 | apply(dependency, source, templateContext) {
|
90 | const dep = (dependency);
|
91 | if (dep.declaredSet && !dep.declaredSet.has(dep.name)) return;
|
92 | super.apply(dependency, source, templateContext);
|
93 | }
|
94 | };
|
95 |
|
96 | makeSerializable(
|
97 | CssSelfLocalIdentifierDependency,
|
98 | "webpack/lib/dependencies/CssSelfLocalIdentifierDependency"
|
99 | );
|
100 |
|
101 | module.exports = CssSelfLocalIdentifierDependency;
|