Skip to content
This repository was archived by the owner on Sep 25, 2024. It is now read-only.

Commit 2277a42

Browse files
committed
feat: Replace genObjectFromRaw with genObjectFromValues
This commit replaces the `genObjectFromRaw` function with `genObjectFromValues` in the `cssModules` function. This change improves the generation of css module exports. Additionally, unnecessary console.log has been removed.
1 parent 765623e commit 2277a42

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import MagicString from 'magic-string';
22
import type { PreprocessorGroup } from 'svelte/compiler';
33
import { findStaticImports } from 'mlly';
4-
import { genObjectFromRaw } from 'knitwork';
4+
import { genObjectFromValues } from 'knitwork';
55
import { loadAliases } from './utils/alias';
66
import type { CssModule } from './utils/css-module';
77
import { getCssModule, getCssModuleImports } from './utils/css-module';
@@ -35,16 +35,14 @@ export function cssModules(): PreprocessorGroup {
3535
cssModules.push(cssModule);
3636

3737
/* generate css module exports */
38-
const obj = genObjectFromRaw(cssModule.exports);
39-
const gen = `const ${cmi.defaultImport} = ${obj};`;
38+
const obj = genObjectFromValues(cssModule.exports);
39+
const gen = `const ${cmi.defaultImport} = ${obj};\n`;
4040
s.overwrite(cmi.imp.start, cmi.imp.end, gen);
4141
}
4242
if (filename != null) {
4343
cssModuleCache.set(filename, cssModules);
4444
}
4545

46-
console.log(cssModules);
47-
4846
return {
4947
code: s.toString(),
5048
map: s.generateMap({

0 commit comments

Comments
 (0)