sass_context_wrapper.h 1.2 KB

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