@hypergood/css-core 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugin.cjs +23 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +23 -1
- package/dist/plugin.js.map +1 -1
- package/package.json +1 -1
- package/src/evaluate.ts +27 -0
package/dist/plugin.cjs
CHANGED
|
@@ -67084,7 +67084,6 @@ var atomizers = {
|
|
|
67084
67084
|
const ast = csstree.parse(value2, { context: "value" });
|
|
67085
67085
|
const matchResult = csstree.lexer.matchProperty("animation", ast);
|
|
67086
67086
|
const match = matchResult.matched?.match;
|
|
67087
|
-
console.log({ match: JSON.stringify(match) });
|
|
67088
67087
|
if (!match) return void 0;
|
|
67089
67088
|
const animationNames = [];
|
|
67090
67089
|
const animationDurations = [];
|
|
@@ -67375,6 +67374,8 @@ function evaluateBabelExpression(node, knownConstants) {
|
|
|
67375
67374
|
return evaluateObjectExpression(node, knownConstants);
|
|
67376
67375
|
case "StringLiteral":
|
|
67377
67376
|
return evaluateStringLiteral(node);
|
|
67377
|
+
case "TemplateLiteral":
|
|
67378
|
+
return evaluateTemplateLiteral(node, knownConstants);
|
|
67378
67379
|
default:
|
|
67379
67380
|
return UNKNOWN;
|
|
67380
67381
|
}
|
|
@@ -67388,6 +67389,8 @@ function evaluateBinaryExpression(node, knownConstants) {
|
|
|
67388
67389
|
return known(left.value * right.value);
|
|
67389
67390
|
case "+":
|
|
67390
67391
|
return known(left.value + right.value);
|
|
67392
|
+
case "-":
|
|
67393
|
+
return known(left.value - right.value);
|
|
67391
67394
|
default:
|
|
67392
67395
|
return UNKNOWN;
|
|
67393
67396
|
}
|
|
@@ -67450,6 +67453,25 @@ function evaluateObjectExpression(node, knownConstants) {
|
|
|
67450
67453
|
function evaluateStringLiteral(node) {
|
|
67451
67454
|
return known(node.value);
|
|
67452
67455
|
}
|
|
67456
|
+
function evaluateTemplateLiteral(node, knownConstants) {
|
|
67457
|
+
const quasisAsStrings = node.quasis.map((q) => q.value.cooked ?? q.value.raw);
|
|
67458
|
+
const expressions = node.expressions.map(
|
|
67459
|
+
(e) => evaluateBabelExpression(e, knownConstants)
|
|
67460
|
+
);
|
|
67461
|
+
if (expressions.some((e) => !e.confident)) {
|
|
67462
|
+
return UNKNOWN;
|
|
67463
|
+
}
|
|
67464
|
+
const expressionValues = expressions.map((e) => e.value);
|
|
67465
|
+
let result = "";
|
|
67466
|
+
for (let i = 0; i < quasisAsStrings.length; i++) {
|
|
67467
|
+
result += quasisAsStrings[i];
|
|
67468
|
+
if (i < expressionValues.length) {
|
|
67469
|
+
let value2 = expressionValues[i];
|
|
67470
|
+
result += value2;
|
|
67471
|
+
}
|
|
67472
|
+
}
|
|
67473
|
+
return known(result);
|
|
67474
|
+
}
|
|
67453
67475
|
|
|
67454
67476
|
// src/runtime.ts
|
|
67455
67477
|
function mergeClassNames(classNames) {
|