summaryrefslogtreecommitdiff
path: root/node_modules/clean-css/lib/optimizer/level-2/properties/populate-components.js
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2026-05-18 23:10:59 +0800
committerlittleblack111 <littleblack11111@gmail.com>2026-05-18 23:41:44 +0800
commitfc87c009806dcc98867f6b58efe29b042aa01dee (patch)
tree8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/clean-css/lib/optimizer/level-2/properties/populate-components.js
parent3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff)
node: updatemain
Diffstat (limited to 'node_modules/clean-css/lib/optimizer/level-2/properties/populate-components.js')
-rw-r--r--node_modules/clean-css/lib/optimizer/level-2/properties/populate-components.js61
1 files changed, 0 insertions, 61 deletions
diff --git a/node_modules/clean-css/lib/optimizer/level-2/properties/populate-components.js b/node_modules/clean-css/lib/optimizer/level-2/properties/populate-components.js
deleted file mode 100644
index e5367465..00000000
--- a/node_modules/clean-css/lib/optimizer/level-2/properties/populate-components.js
+++ /dev/null
@@ -1,61 +0,0 @@
-var configuration = require('../../configuration');
-var InvalidPropertyError = require('../../invalid-property-error');
-
-function populateComponents(properties, validator, warnings) {
- var component;
- var j, m;
-
- for (var i = properties.length - 1; i >= 0; i--) {
- var property = properties[i];
- var descriptor = configuration[property.name];
-
- if (!property.dynamic && descriptor && descriptor.shorthand) {
- if (onlyValueIsVariable(property, validator) || moreThanOneValueIsVariable(property, validator)) {
- property.optimizable = false;
- continue;
- }
-
- property.shorthand = true;
- property.dirty = true;
-
- try {
- property.components = descriptor.breakUp(property, configuration, validator);
-
- if (descriptor.shorthandComponents) {
- for (j = 0, m = property.components.length; j < m; j++) {
- component = property.components[j];
- component.components = configuration[component.name].breakUp(component, configuration, validator);
- }
- }
- } catch (e) {
- if (e instanceof InvalidPropertyError) {
- property.components = []; // this will set property.unused to true below
- warnings.push(e.message);
- } else {
- throw e;
- }
- }
-
- if (property.components.length > 0) {
- property.multiplex = property.components[0].multiplex;
- } else {
- property.unused = true;
- }
- }
- }
-}
-
-function onlyValueIsVariable(property, validator) {
- return property.value.length == 1 && validator.isVariable(property.value[0][1]);
-}
-
-function moreThanOneValueIsVariable(property, validator) {
- return property.value.length > 1
- && property.value.filter(
- function(value) {
- return validator.isVariable(value[1]);
- }
- ).length > 1;
-}
-
-module.exports = populateComponents;