123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- "use strict";
- const makeSerializable = require("../util/makeSerializable");
- const NullDependency = require("./NullDependency");
- class CssIcssSymbolDependency extends NullDependency {
-
- constructor(name, value, range) {
- super();
- this.name = name;
- this.value = value;
- this.range = range;
- this._hashUpdate = undefined;
- }
- get type() {
- return "css @value identifier";
- }
- get category() {
- return "self";
- }
-
- updateHash(hash, context) {
- if (this._hashUpdate === undefined) {
- this._hashUpdate = `${this.range}${this.name}${this.value}`;
- }
- hash.update(this._hashUpdate);
- }
-
- getExports(moduleGraph) {
- return {
- exports: [
- {
- name: this.name,
- canMangle: true
- }
- ],
- dependencies: undefined
- };
- }
-
- getReferencedExports(moduleGraph, runtime) {
- return [[this.name]];
- }
-
- serialize(context) {
- const { write } = context;
- write(this.name);
- write(this.value);
- write(this.range);
- super.serialize(context);
- }
-
- deserialize(context) {
- const { read } = context;
- this.name = read();
- this.value = read();
- this.range = read();
- super.deserialize(context);
- }
- }
- CssIcssSymbolDependency.Template = class CssValueAtRuleDependencyTemplate extends (
- NullDependency.Template
- ) {
-
- apply(dependency, source, { cssData }) {
- const dep = (dependency);
- source.replace(dep.range[0], dep.range[1] - 1, dep.value);
- cssData.exports.set(dep.name, dep.value);
- }
- };
- makeSerializable(
- CssIcssSymbolDependency,
- "webpack/lib/dependencies/CssIcssSymbolDependency"
- );
- module.exports = CssIcssSymbolDependency;
|