123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- "use strict";
- const Dependency = require("../Dependency");
- const makeSerializable = require("../util/makeSerializable");
- const CssLocalIdentifierDependency = require("./CssLocalIdentifierDependency");
- class CssSelfLocalIdentifierDependency extends CssLocalIdentifierDependency {
-
- constructor(name, range, prefix = "", declaredSet = undefined) {
- super(name, range, prefix);
- this.declaredSet = declaredSet;
- }
- get type() {
- return "css self local identifier";
- }
- get category() {
- return "self";
- }
-
- getResourceIdentifier() {
- return `self`;
- }
-
- getExports(moduleGraph) {
- if (this.declaredSet && !this.declaredSet.has(this.name)) return;
- return super.getExports(moduleGraph);
- }
-
- getReferencedExports(moduleGraph, runtime) {
- if (this.declaredSet && !this.declaredSet.has(this.name))
- return Dependency.NO_EXPORTS_REFERENCED;
- return [[this.name]];
- }
-
- serialize(context) {
- const { write } = context;
- write(this.declaredSet);
- super.serialize(context);
- }
-
- deserialize(context) {
- const { read } = context;
- this.declaredSet = read();
- super.deserialize(context);
- }
- }
- CssSelfLocalIdentifierDependency.Template = class CssSelfLocalIdentifierDependencyTemplate extends (
- CssLocalIdentifierDependency.Template
- ) {
-
- apply(dependency, source, templateContext) {
- const dep = (dependency);
- if (dep.declaredSet && !dep.declaredSet.has(dep.name)) return;
- super.apply(dependency, source, templateContext);
- }
- };
- makeSerializable(
- CssSelfLocalIdentifierDependency,
- "webpack/lib/dependencies/CssSelfLocalIdentifierDependency"
- );
- module.exports = CssSelfLocalIdentifierDependency;
|