Skip to content

Commit 13439a0

Browse files
committed
refactor(processor-atomic.ts): updated Set has been changed to Map
1 parent 10871d1 commit 13439a0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/utils/processor-atomic.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ Object.entries(SHORTHAND_PROPERTIES).forEach(([shorthand, longhands]) => {
2525
});
2626
});
2727

28-
function processAtomicProps(flatProps: CSSProperties, atomicHashes: Set<string>, allStyleSheets: Set<string>, parentAtRule?: string) {
28+
function processAtomicProps(flatProps: CSSProperties, atomicMap: Map<string, string>, parentAtRule?: string) {
2929
const resultQueue: Array<[string, string | number]> = [];
3030
for (const [property, value] of Object.entries(flatProps)) {
3131
if (property.startsWith('@media') || property.startsWith('@container')) {
32-
processAtomicProps(value as CreateStyle, atomicHashes, allStyleSheets, property);
32+
processAtomicProps(value as CreateStyle, atomicMap, property);
3333
continue;
3434
}
3535

@@ -43,14 +43,13 @@ function processAtomicProps(flatProps: CSSProperties, atomicHashes: Set<string>,
4343
const styleObj = parentAtRule ? { [parentAtRule]: singlePropObj } : singlePropObj;
4444
const atomicHash = genBase36Hash(styleObj, 1, 8);
4545

46-
if (atomicHashes.has(atomicHash)) continue;
47-
atomicHashes.add(atomicHash);
46+
if (atomicMap.has(atomicHash)) continue;
4847

4948
let styleSheet = transpileAtomic(property, value, atomicHash);
5049
if (parentAtRule) {
5150
styleSheet = `${parentAtRule} { ${styleSheet} }`;
5251
}
53-
allStyleSheets.add(styleSheet + '\n');
52+
atomicMap.set(atomicHash, styleSheet + '\n');
5453
}
5554
}
5655

0 commit comments

Comments
 (0)