@hypergood/css-core 0.0.3 → 0.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypergood/css-core",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/evaluate.ts CHANGED
@@ -192,8 +192,21 @@ function evaluateObjectExpression(
192
192
  switch (property.type) {
193
193
  case "ObjectMethod":
194
194
  return UNKNOWN(property);
195
- case "SpreadElement":
196
- return UNKNOWN(property);
195
+ case "SpreadElement": {
196
+ const values = evaluateBabelExpression(
197
+ property.argument,
198
+ knownConstants,
199
+ );
200
+ if (values.confident) {
201
+ result = {
202
+ ...result,
203
+ ...values.value,
204
+ };
205
+ continue;
206
+ } else {
207
+ return UNKNOWN(property);
208
+ }
209
+ }
197
210
  case "ObjectProperty": {
198
211
  const keyNode = property.key;
199
212
  let key: EvaluationResult;
@@ -49,6 +49,9 @@ describe("evaluateBabelExpression", () => {
49
49
  it("handles ObjectExpression", () => {
50
50
  expect(evaluateString("{a:1}")).toStrictEqual(KNOWN({ a: 1 }));
51
51
  expect(evaluateString('{["a"]:1}')).toStrictEqual(KNOWN({ a: 1 }));
52
+ expect(evaluateString("{a:1, ...({a:2,b:2}) }")).toStrictEqual(
53
+ KNOWN({ a: 2, b: 2 }),
54
+ );
52
55
  });
53
56
  it("handles TemplateLiteral", () => {
54
57
  expect(evaluateString("`Something`")).toStrictEqual(KNOWN("Something"));