@plumeria/webpack-plugin 0.7.1 → 0.9.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/create-css.js +40 -9
- package/package.json +4 -4
package/dist/create-css.js
CHANGED
|
@@ -6,28 +6,59 @@ const zss_engine_1 = require("zss-engine");
|
|
|
6
6
|
function compileToSingleCSS(object) {
|
|
7
7
|
const baseSheets = [];
|
|
8
8
|
const querySheets = [];
|
|
9
|
-
const
|
|
9
|
+
const processedHashes = new Set();
|
|
10
10
|
Object.entries(object).forEach(([key, styleObj]) => {
|
|
11
11
|
const flat = {};
|
|
12
12
|
const nonFlat = {};
|
|
13
13
|
(0, zss_engine_1.splitAtomicAndNested)(styleObj, flat, nonFlat);
|
|
14
|
-
|
|
14
|
+
const records = [];
|
|
15
|
+
Object.entries(flat).forEach(([prop, value]) => {
|
|
16
|
+
const hashes = new Set();
|
|
15
17
|
const sheets = new Set();
|
|
16
|
-
(0, zss_engine_1.processAtomicProps)(
|
|
18
|
+
(0, zss_engine_1.processAtomicProps)({ [prop]: value }, hashes, sheets);
|
|
19
|
+
const propBaseSheets = [];
|
|
20
|
+
const propQuerySheets = [];
|
|
17
21
|
for (const sheet of sheets) {
|
|
18
22
|
if (sheet.includes('@media') || sheet.includes('@container')) {
|
|
19
|
-
|
|
23
|
+
propQuerySheets.push(sheet);
|
|
20
24
|
}
|
|
21
25
|
else {
|
|
22
|
-
|
|
26
|
+
propBaseSheets.push(sheet);
|
|
23
27
|
}
|
|
24
28
|
}
|
|
25
|
-
|
|
29
|
+
const hash = [...hashes].join(' ');
|
|
30
|
+
const sheet = [...propBaseSheets, ...propQuerySheets].join('');
|
|
31
|
+
records.push({
|
|
32
|
+
key: prop,
|
|
33
|
+
hash,
|
|
34
|
+
sheet,
|
|
35
|
+
});
|
|
36
|
+
});
|
|
26
37
|
if (Object.keys(nonFlat).length > 0) {
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
38
|
+
const nonFlatObj = { [key]: nonFlat };
|
|
39
|
+
const nonFlatHash = (0, zss_engine_1.genBase36Hash)(nonFlatObj, 1, 7);
|
|
40
|
+
const { styleSheet } = (0, zss_engine_1.transpile)(nonFlatObj, nonFlatHash);
|
|
41
|
+
Object.entries(nonFlat).forEach(([atRule, nestedObj]) => {
|
|
42
|
+
Object.entries(nestedObj).forEach(([prop]) => {
|
|
43
|
+
records.push({
|
|
44
|
+
key: atRule + prop,
|
|
45
|
+
hash: nonFlatHash,
|
|
46
|
+
sheet: styleSheet,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
30
50
|
}
|
|
51
|
+
records.forEach(({ hash, sheet }) => {
|
|
52
|
+
if (!processedHashes.has(hash)) {
|
|
53
|
+
processedHashes.add(hash);
|
|
54
|
+
if (sheet.includes('@media') || sheet.includes('@container')) {
|
|
55
|
+
querySheets.push(sheet);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
baseSheets.push(sheet);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
31
62
|
});
|
|
32
63
|
return [...baseSheets, ...querySheets].join('\n');
|
|
33
64
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/webpack-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Plumeria Webpack plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/core": "^7.28.0",
|
|
23
|
-
"@babel/types": "^7.28.2",
|
|
24
23
|
"@babel/preset-react": "^7.27.1",
|
|
25
24
|
"@babel/preset-typescript": "^7.27.1",
|
|
25
|
+
"@babel/types": "^7.28.2",
|
|
26
26
|
"loader-utils": "^3.3.1",
|
|
27
27
|
"webpack-virtual-modules": "^0.6.2"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
+
"@rust-gear/glob": "^0.2.2",
|
|
30
31
|
"@types/babel__core": "^7.20.5",
|
|
31
32
|
"@types/loader-utils": "^2.0.6",
|
|
32
|
-
"@rust-gear/glob": "^0.2.2",
|
|
33
33
|
"webpack": "^5.101.0",
|
|
34
|
-
"zss-engine": "^0.2.
|
|
34
|
+
"zss-engine": "^0.2.75"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|