@plumeria/webpack-plugin 4.0.5 → 4.1.0

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 +9 -11
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -253,29 +253,27 @@ function loader(source) {
253
253
  return false;
254
254
  };
255
255
  const allStatic = args.every((arg) => checkStatic(arg.expression));
256
- if (allStatic) {
257
- const merged = {};
258
- args.forEach((arg) => {
256
+ if (allStatic && args.length > 0) {
257
+ const merged = args.reduce((acc, arg) => {
259
258
  const expr = arg.expression;
260
259
  if (utils_1.t.isObjectExpression(expr)) {
261
260
  const obj = (0, utils_1.objectExpressionToObject)(expr, utils_1.tables.staticTable, utils_1.tables.keyframesHashTable, utils_1.tables.viewTransitionHashTable, utils_1.tables.themeTable);
262
- obj && Object.assign(merged, obj);
261
+ return obj ? (0, utils_1.deepMerge)(acc, obj) : acc;
263
262
  }
264
263
  else if (utils_1.t.isMemberExpression(expr) &&
265
264
  utils_1.t.isIdentifier(expr.object) &&
266
265
  utils_1.t.isIdentifier(expr.property)) {
267
266
  const styleInfo = localCreateStyles[expr.object.value];
268
- if (styleInfo) {
269
- Object.assign(merged, styleInfo.obj[expr.property.value]);
270
- }
267
+ return styleInfo
268
+ ? (0, utils_1.deepMerge)(acc, styleInfo.obj[expr.property.value])
269
+ : acc;
271
270
  }
272
271
  else if (utils_1.t.isIdentifier(expr)) {
273
272
  const styleInfo = localCreateStyles[expr.value];
274
- if (styleInfo) {
275
- Object.assign(merged, styleInfo.obj);
276
- }
273
+ return styleInfo ? (0, utils_1.deepMerge)(acc, styleInfo.obj) : acc;
277
274
  }
278
- });
275
+ return acc;
276
+ }, {});
279
277
  if (Object.keys(merged).length > 0) {
280
278
  (0, utils_1.extractOndemandStyles)(merged, extractedSheets);
281
279
  const hash = (0, zss_engine_1.genBase36Hash)(merged, 1, 8);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/webpack-plugin",
3
- "version": "4.0.5",
3
+ "version": "4.1.0",
4
4
  "description": "Plumeria Webpack plugin",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -22,7 +22,7 @@
22
22
  "zero-virtual.css"
23
23
  ],
24
24
  "dependencies": {
25
- "@plumeria/utils": "^4.0.5"
25
+ "@plumeria/utils": "^4.1.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@swc/core": "1.15.8",