@plumeria/webpack-plugin 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 +10 -13
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -197,11 +197,10 @@ function loader(source) {
197
197
  if (styleInfo && !styleInfo.hasDynamicAccess) {
198
198
  const atomMap = styleInfo.hashMap[node.property.value];
199
199
  if (atomMap) {
200
- const combinedHash = Object.values(atomMap).join(' ');
201
200
  replacements.push({
202
201
  start: node.span.start - ast.span.start,
203
202
  end: node.span.end - ast.span.start,
204
- content: JSON.stringify(combinedHash),
203
+ content: JSON.stringify(atomMap),
205
204
  });
206
205
  }
207
206
  }
@@ -253,29 +252,27 @@ function loader(source) {
253
252
  return false;
254
253
  };
255
254
  const allStatic = args.every((arg) => checkStatic(arg.expression));
256
- if (allStatic) {
257
- const merged = {};
258
- args.forEach((arg) => {
255
+ if (allStatic && args.length > 0) {
256
+ const merged = args.reduce((acc, arg) => {
259
257
  const expr = arg.expression;
260
258
  if (utils_1.t.isObjectExpression(expr)) {
261
259
  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);
260
+ return obj ? (0, utils_1.deepMerge)(acc, obj) : acc;
263
261
  }
264
262
  else if (utils_1.t.isMemberExpression(expr) &&
265
263
  utils_1.t.isIdentifier(expr.object) &&
266
264
  utils_1.t.isIdentifier(expr.property)) {
267
265
  const styleInfo = localCreateStyles[expr.object.value];
268
- if (styleInfo) {
269
- Object.assign(merged, styleInfo.obj[expr.property.value]);
270
- }
266
+ return styleInfo
267
+ ? (0, utils_1.deepMerge)(acc, styleInfo.obj[expr.property.value])
268
+ : acc;
271
269
  }
272
270
  else if (utils_1.t.isIdentifier(expr)) {
273
271
  const styleInfo = localCreateStyles[expr.value];
274
- if (styleInfo) {
275
- Object.assign(merged, styleInfo.obj);
276
- }
272
+ return styleInfo ? (0, utils_1.deepMerge)(acc, styleInfo.obj) : acc;
277
273
  }
278
- });
274
+ return acc;
275
+ }, {});
279
276
  if (Object.keys(merged).length > 0) {
280
277
  (0, utils_1.extractOndemandStyles)(merged, extractedSheets);
281
278
  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.1",
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.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@swc/core": "1.15.8",