source: trip-planner-front/node_modules/webpack/lib/rules/BasicEffectRulePlugin.js@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 876 bytes
RevLine 
[6a3a178]1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8/** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */
9
10class BasicEffectRulePlugin {
11 constructor(ruleProperty, effectType) {
12 this.ruleProperty = ruleProperty;
13 this.effectType = effectType || ruleProperty;
14 }
15
16 /**
17 * @param {RuleSetCompiler} ruleSetCompiler the rule set compiler
18 * @returns {void}
19 */
20 apply(ruleSetCompiler) {
21 ruleSetCompiler.hooks.rule.tap(
22 "BasicEffectRulePlugin",
23 (path, rule, unhandledProperties, result, references) => {
24 if (unhandledProperties.has(this.ruleProperty)) {
25 unhandledProperties.delete(this.ruleProperty);
26
27 const value = rule[this.ruleProperty];
28
29 result.effects.push({
30 type: this.effectType,
31 value
32 });
33 }
34 }
35 );
36 }
37}
38
39module.exports = BasicEffectRulePlugin;
Note: See TracBrowser for help on using the repository browser.