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

Commit

Permalink
feat(getversion): export getversion interface
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Jul 10, 2018
1 parent 8f1d595 commit 5310653
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/interop/miscellaneous.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { SassAsmModule } from '../SassAsmModule';

/**
* Creates function to read versions of library.
* @param asmModule
*/
const getVersion = (asmModule: SassAsmModule) => async () => {
const { stackSave, stackRestore, Pointer_stringify } = asmModule;
//version functions doesn't need param type conversion, call directly without cwrap
const { _libsass_version, _libsass_language_version, _sass2scss_version } = asmModule;

const { version } = await import('../../package.json');
const stack = stackSave();
const ret = {
libsassAsm: version,
libsass: Pointer_stringify(_libsass_version()),
sassLang: Pointer_stringify(_libsass_language_version()),
sass2scss: Pointer_stringify(_sass2scss_version())
};
stackRestore(stack);
return ret;
};

export { getVersion };

0 comments on commit 5310653

Please sign in to comment.