@plumeria/utils 10.0.0 → 10.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/parser.js +9 -13
- package/dist/types.d.ts +1 -2
- package/package.json +1 -1
package/dist/parser.js
CHANGED
|
@@ -184,7 +184,9 @@ function objectExpressionToObject(node, staticTable, keyframesHashTable, viewTra
|
|
|
184
184
|
}
|
|
185
185
|
else if (exports.t.isMemberExpression(val)) {
|
|
186
186
|
const resolved = resolveStaticTableMemberExpression(val, staticTable);
|
|
187
|
-
|
|
187
|
+
if (resolved !== undefined) {
|
|
188
|
+
obj[key] = resolved;
|
|
189
|
+
}
|
|
188
190
|
}
|
|
189
191
|
else if (exports.t.isIdentifier(val)) {
|
|
190
192
|
if (resolveVariable) {
|
|
@@ -197,12 +199,6 @@ function objectExpressionToObject(node, staticTable, keyframesHashTable, viewTra
|
|
|
197
199
|
if (staticTable[val.value] !== undefined) {
|
|
198
200
|
obj[key] = staticTable[val.value];
|
|
199
201
|
}
|
|
200
|
-
else {
|
|
201
|
-
obj[key] = '[unresolved identifier]';
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
obj[key] = '[unsupported value type]';
|
|
206
202
|
}
|
|
207
203
|
});
|
|
208
204
|
return obj;
|
|
@@ -313,7 +309,7 @@ function evaluateBinaryExpression(node, staticTable, keyframesHashTable, viewTra
|
|
|
313
309
|
if (node.operator === '+') {
|
|
314
310
|
return String(left) + String(right);
|
|
315
311
|
}
|
|
316
|
-
throw new Error(`Unsupported binary operator: ${node.operator}`);
|
|
312
|
+
throw new Error(`[plumeria] Unsupported binary operator: ${node.operator}`);
|
|
317
313
|
}
|
|
318
314
|
function evaluateCallExpression(node, staticTable) {
|
|
319
315
|
const callee = node.callee;
|
|
@@ -380,7 +376,7 @@ function evaluateExpression(node, staticTable, keyframesHashTable, viewTransitio
|
|
|
380
376
|
if (viewTransitionHashTable[node.value] !== undefined) {
|
|
381
377
|
return viewTransitionHashTable[node.value];
|
|
382
378
|
}
|
|
383
|
-
return
|
|
379
|
+
return '';
|
|
384
380
|
}
|
|
385
381
|
if (exports.t.isMemberExpression(node)) {
|
|
386
382
|
const resolved = resolveStaticTableMemberExpression(node, staticTable);
|
|
@@ -395,7 +391,7 @@ function evaluateExpression(node, staticTable, keyframesHashTable, viewTransitio
|
|
|
395
391
|
if (resolvedStatic !== undefined) {
|
|
396
392
|
return resolvedStatic;
|
|
397
393
|
}
|
|
398
|
-
return
|
|
394
|
+
return '';
|
|
399
395
|
}
|
|
400
396
|
if (exports.t.isBinaryExpression(node)) {
|
|
401
397
|
return evaluateBinaryExpression(node, staticTable, keyframesHashTable, viewTransitionHashTable, createThemeHashTable, createThemeObjectTable, createStaticHashTable, createStaticObjectTable);
|
|
@@ -406,7 +402,7 @@ function evaluateExpression(node, staticTable, keyframesHashTable, viewTransitio
|
|
|
406
402
|
if (exports.t.isUnaryExpression(node)) {
|
|
407
403
|
return evaluateUnaryExpression(node);
|
|
408
404
|
}
|
|
409
|
-
throw new Error(`Unsupported expression type: ${node.type}`);
|
|
405
|
+
throw new Error(`[plumeria] Unsupported expression type: ${node.type}`);
|
|
410
406
|
}
|
|
411
407
|
function evaluateUnaryExpression(node) {
|
|
412
408
|
const arg = node.argument;
|
|
@@ -420,9 +416,9 @@ function evaluateUnaryExpression(node) {
|
|
|
420
416
|
return +arg.value;
|
|
421
417
|
break;
|
|
422
418
|
default:
|
|
423
|
-
throw new Error(`Unsupported unary operator: ${node.operator}`);
|
|
419
|
+
throw new Error(`[plumeria] Unsupported unary operator: ${node.operator}`);
|
|
424
420
|
}
|
|
425
|
-
throw new Error(`Unsupported UnaryExpression argument type: ${arg.type}`);
|
|
421
|
+
throw new Error(`[plumeria] Unsupported UnaryExpression argument type: ${arg.type}`);
|
|
426
422
|
}
|
|
427
423
|
function resolveKeyframesTableMemberExpression(node, keyframesHashTable) {
|
|
428
424
|
if (exports.t.isIdentifier(node)) {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
type CSSPrimitive = string | number | boolean | null;
|
|
2
|
-
type
|
|
3
|
-
export type CSSValue = CSSPrimitive | CSSObject | ParseErrorString;
|
|
2
|
+
export type CSSValue = CSSPrimitive | CSSObject;
|
|
4
3
|
export type CSSObject = {
|
|
5
4
|
[key: string]: CSSValue;
|
|
6
5
|
};
|