@plumeria/vite-plugin 4.0.4 → 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.
- package/dist/index.js +10 -15
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createFilter } from 'vite';
|
|
|
2
2
|
import { parseSync } from '@swc/core';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { genBase36Hash } from 'zss-engine';
|
|
5
|
-
import { tables, traverse, getStyleRecords, collectLocalConsts, objectExpressionToObject, scanForCreateStatic, scanForCreateTheme, scanForKeyframes, scanForViewTransition, t, extractOndemandStyles, } from '@plumeria/utils';
|
|
5
|
+
import { tables, traverse, getStyleRecords, collectLocalConsts, objectExpressionToObject, scanForCreateStatic, scanForCreateTheme, scanForKeyframes, scanForViewTransition, t, extractOndemandStyles, deepMerge, } from '@plumeria/utils';
|
|
6
6
|
const TARGET_EXTENSIONS = ['ts', 'tsx', 'js', 'jsx'];
|
|
7
7
|
const EXTENSION_PATTERN = /\.(ts|tsx|js|jsx)$/;
|
|
8
8
|
export function plumeria(options = {}) {
|
|
@@ -299,32 +299,27 @@ export function plumeria(options = {}) {
|
|
|
299
299
|
return false;
|
|
300
300
|
};
|
|
301
301
|
const allStatic = args.every((arg) => checkStatic(arg.expression));
|
|
302
|
-
if (allStatic) {
|
|
303
|
-
const merged = {
|
|
304
|
-
args.forEach((arg) => {
|
|
302
|
+
if (allStatic && args.length > 0) {
|
|
303
|
+
const merged = args.reduce((acc, arg) => {
|
|
305
304
|
const expr = arg.expression;
|
|
306
305
|
if (t.isObjectExpression(expr)) {
|
|
307
|
-
excludedSpans.add(expr.span.start);
|
|
308
306
|
const obj = objectExpressionToObject(expr, tables.staticTable, tables.keyframesHashTable, tables.viewTransitionHashTable, tables.themeTable);
|
|
309
|
-
obj
|
|
307
|
+
return obj ? deepMerge(acc, obj) : acc;
|
|
310
308
|
}
|
|
311
309
|
else if (t.isMemberExpression(expr) &&
|
|
312
310
|
t.isIdentifier(expr.object) &&
|
|
313
311
|
t.isIdentifier(expr.property)) {
|
|
314
|
-
excludedSpans.add(expr.span.start);
|
|
315
312
|
const styleInfo = localCreateStyles[expr.object.value];
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
313
|
+
return styleInfo
|
|
314
|
+
? deepMerge(acc, styleInfo.obj[expr.property.value])
|
|
315
|
+
: acc;
|
|
319
316
|
}
|
|
320
317
|
else if (t.isIdentifier(expr)) {
|
|
321
|
-
excludedSpans.add(expr.span.start);
|
|
322
318
|
const styleInfo = localCreateStyles[expr.value];
|
|
323
|
-
|
|
324
|
-
Object.assign(merged, styleInfo.obj);
|
|
325
|
-
}
|
|
319
|
+
return styleInfo ? deepMerge(acc, styleInfo.obj) : acc;
|
|
326
320
|
}
|
|
327
|
-
|
|
321
|
+
return acc;
|
|
322
|
+
}, {});
|
|
328
323
|
if (Object.keys(merged).length > 0) {
|
|
329
324
|
extractOndemandStyles(merged, extractedSheets);
|
|
330
325
|
const hash = genBase36Hash(merged, 1, 8);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/vite-plugin",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Plumeria Vite plugin",
|
|
6
6
|
"author": "Refirst 11",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"dist/"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@plumeria/utils": "^4.0
|
|
25
|
+
"@plumeria/utils": "^4.1.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@swc/core": "1.15.
|
|
28
|
+
"@swc/core": "1.15.8",
|
|
29
29
|
"vite": "^7.1.1",
|
|
30
30
|
"zss-engine": "2.1.2"
|
|
31
31
|
},
|