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

Commit 5310653

Browse files
committed
feat(getversion): export getversion interface
1 parent 8f1d595 commit 5310653

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/interop/miscellaneous.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { SassAsmModule } from '../SassAsmModule';
2+
3+
/**
4+
* Creates function to read versions of library.
5+
* @param asmModule
6+
*/
7+
const getVersion = (asmModule: SassAsmModule) => async () => {
8+
const { stackSave, stackRestore, Pointer_stringify } = asmModule;
9+
//version functions doesn't need param type conversion, call directly without cwrap
10+
const { _libsass_version, _libsass_language_version, _sass2scss_version } = asmModule;
11+
12+
const { version } = await import('../../package.json');
13+
const stack = stackSave();
14+
const ret = {
15+
libsassAsm: version,
16+
libsass: Pointer_stringify(_libsass_version()),
17+
sassLang: Pointer_stringify(_libsass_language_version()),
18+
sass2scss: Pointer_stringify(_sass2scss_version())
19+
};
20+
stackRestore(stack);
21+
return ret;
22+
};
23+
24+
export { getVersion };

0 commit comments

Comments
 (0)