@plumeria/vite-plugin 4.1.2 → 4.2.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 +4 -17
- package/package.json +2 -2
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,
|
|
5
|
+
import { tables, traverse, getStyleRecords, collectLocalConsts, objectExpressionToObject, t, extractOndemandStyles, deepMerge, scanAll, } 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 = {}) {
|
|
@@ -69,22 +69,13 @@ export function plumeria(options = {}) {
|
|
|
69
69
|
dependencies.push(depPath);
|
|
70
70
|
this.addWatchFile(depPath);
|
|
71
71
|
};
|
|
72
|
-
|
|
73
|
-
const { keyframesHashTableLocal, keyframesObjectTableLocal } = scanForKeyframes(addDependency);
|
|
74
|
-
tables.keyframesHashTable = keyframesHashTableLocal;
|
|
75
|
-
tables.keyframesObjectTable = keyframesObjectTableLocal;
|
|
76
|
-
const { viewTransitionHashTableLocal, viewTransitionObjectTableLocal } = scanForViewTransition(addDependency);
|
|
77
|
-
tables.viewTransitionHashTable = viewTransitionHashTableLocal;
|
|
78
|
-
tables.viewTransitionObjectTable = viewTransitionObjectTableLocal;
|
|
79
|
-
const { themeTableLocal, createThemeObjectTableLocal } = scanForCreateTheme(addDependency);
|
|
80
|
-
tables.themeTable = themeTableLocal;
|
|
81
|
-
tables.createThemeObjectTable = createThemeObjectTableLocal;
|
|
72
|
+
scanAll(addDependency);
|
|
82
73
|
const ast = parseSync(source, {
|
|
83
74
|
syntax: 'typescript',
|
|
84
75
|
tsx: true,
|
|
85
76
|
target: 'es2022',
|
|
86
77
|
});
|
|
87
|
-
const localConsts = collectLocalConsts(ast);
|
|
78
|
+
const localConsts = collectLocalConsts(ast, id);
|
|
88
79
|
Object.assign(tables.staticTable, localConsts);
|
|
89
80
|
const localCreateStyles = {};
|
|
90
81
|
const replacements = [];
|
|
@@ -259,14 +250,10 @@ export function plumeria(options = {}) {
|
|
|
259
250
|
return;
|
|
260
251
|
const styleInfo = localCreateStyles[node.value];
|
|
261
252
|
if (styleInfo && !styleInfo.hasDynamicAccess) {
|
|
262
|
-
const fullHashMap = {};
|
|
263
|
-
Object.entries(styleInfo.hashMap).forEach(([key, atomMap]) => {
|
|
264
|
-
fullHashMap[key] = Object.values(atomMap).join(' ');
|
|
265
|
-
});
|
|
266
253
|
replacements.push({
|
|
267
254
|
start: node.span.start - ast.span.start,
|
|
268
255
|
end: node.span.end - ast.span.start,
|
|
269
|
-
content: JSON.stringify(
|
|
256
|
+
content: JSON.stringify(styleInfo.hashMap),
|
|
270
257
|
});
|
|
271
258
|
}
|
|
272
259
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/vite-plugin",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Plumeria Vite plugin",
|
|
6
6
|
"author": "Refirst 11",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dist/"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@plumeria/utils": "^4.
|
|
25
|
+
"@plumeria/utils": "^4.2.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@swc/core": "1.15.8",
|