UNPKG

1.27 kBtext/x-cView Raw
1#ifndef SASS_CONTEXT_WRAPPER
2#define SASS_CONTEXT_WRAPPER
3
4#include <vector>
5#include <memory>
6#include <nan.h>
7#include <stdlib.h>
8#include <sass/context.h>
9#include "custom_function_bridge.h"
10#include "custom_importer_bridge.h"
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16 void compile_data(struct Sass_Data_Context* dctx);
17 void compile_file(struct Sass_File_Context* fctx);
18 void compile_it(uv_work_t* req);
19
20 struct sass_context_wrapper {
21 // binding related
22 bool is_sync;
23 void* cookie;
24 char* file;
25 char* include_path;
26 char* out_file;
27 char* source_map;
28 char* source_map_root;
29 char* linefeed;
30 char* indent;
31
32 // libsass related
33 Sass_Data_Context* dctx;
34 Sass_File_Context* fctx;
35
36 // libuv related
37 uv_async_t async;
38 uv_work_t request;
39
40 // v8 and nan related
41 Nan::Persistent<v8::Object> result;
42 Nan::AsyncResource* async_resource;
43 Nan::Callback* error_callback;
44 Nan::Callback* success_callback;
45
46 std::vector<CustomFunctionBridge *> function_bridges;
47 std::vector<CustomImporterBridge *> importer_bridges;
48 };
49
50 struct sass_context_wrapper* sass_make_context_wrapper(void);
51 void sass_free_context_wrapper(struct sass_context_wrapper*);
52
53#ifdef __cplusplus
54}
55#endif
56
57#endif