@plumeria/compiler 4.0.5 → 4.1.1

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -128,11 +128,23 @@ function compileCSS(options) {
128
128
  records.forEach((r) => extractedSheets.push(r.sheet));
129
129
  };
130
130
  if (callee.property.value === 'props') {
131
+ const staticStyles = [];
132
+ let isAllStatic = true;
131
133
  args.forEach((arg) => {
132
134
  const expr = arg.expression;
133
135
  const styles = extractStylesFromExpression(expr);
134
- styles.forEach((s) => processStyle(s));
136
+ if (styles.length === 0) {
137
+ isAllStatic = false;
138
+ }
139
+ staticStyles.push(...styles);
135
140
  });
141
+ if (isAllStatic && staticStyles.length > 0) {
142
+ const merged = staticStyles.reduce((acc, style) => (0, utils_1.deepMerge)(acc, style), {});
143
+ processStyle(merged);
144
+ }
145
+ else {
146
+ staticStyles.forEach((s) => processStyle(s));
147
+ }
136
148
  }
137
149
  else if (callee.property.value === 'keyframes' &&
138
150
  args.length > 0 &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/compiler",
3
- "version": "4.0.5",
3
+ "version": "4.1.1",
4
4
  "description": "Plumeria swc based compiler for statically extracting css",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -21,7 +21,7 @@
21
21
  "dist/"
22
22
  ],
23
23
  "dependencies": {
24
- "@plumeria/utils": "^4.0.5"
24
+ "@plumeria/utils": "^4.1.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@swc/core": "1.15.8",