@@ -27,7 +27,7 @@ const wrapContextInterface = (cwrap: cwrapSignature) => ({
27
27
//void sass_delete_compiler (struct Sass_Compiler* compiler);
28
28
delete_compiler : null ,
29
29
//void sass_delete_options(struct Sass_Options* options);
30
- delete_options : null ,
30
+ delete_options : cwrap < ( sassOptionsPtr : number ) => void > ( `sass_delete_options` , null , [ 'number' ] ) ,
31
31
32
32
//void sass_delete_file_context (struct Sass_File_Context* ctx);
33
33
delete_file_context : null ,
@@ -99,6 +99,22 @@ const wrapContextInterface = (cwrap: cwrapSignature) => ({
99
99
context_take_source_map_string : null
100
100
} ) ;
101
101
102
+ const buildOptionInterface = ( _asmModule : SassAsmModule , wrapped : ReturnType < typeof wrapContextInterface > ) => {
103
+ const { make_options, delete_options } = wrapped ;
104
+
105
+ const create = ( ) => {
106
+ const optionsPtr = make_options ( ) ;
107
+
108
+ return {
109
+ dispose : ( ) => delete_options ( optionsPtr )
110
+ } ;
111
+ } ;
112
+
113
+ return {
114
+ create
115
+ } ;
116
+ } ;
117
+
102
118
/**
103
119
* Create interop interface around context.
104
120
* (https://github.com/sass/libsass/blob/master/docs/api-context.md)
@@ -107,8 +123,14 @@ const wrapContextInterface = (cwrap: cwrapSignature) => ({
107
123
*/
108
124
const buildContext = ( asmModule : SassAsmModule ) => {
109
125
const { cwrap } = asmModule ;
110
- wrapContextInterface ( cwrap ) ;
126
+ const wrapped = wrapContextInterface ( cwrap ) ;
111
127
//noop
128
+
129
+ const options = buildOptionInterface ( asmModule , wrapped ) ;
130
+
131
+ return {
132
+ options
133
+ } ;
112
134
} ;
113
135
114
136
export { buildContext } ;
0 commit comments