Blame view

node_modules/node-sass/src/libsass/docs/api-context-internal.md 3.43 KB
aaac7fed   liuqimichale   add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
  ```C
  // Input behaviours
  enum Sass_Input_Style {
    SASS_CONTEXT_NULL,
    SASS_CONTEXT_FILE,
    SASS_CONTEXT_DATA,
    SASS_CONTEXT_FOLDER
  };
  
  // sass config options structure
  struct Sass_Inspect_Options {
  
    // Output style for the generated css code
    // A value from above SASS_STYLE_* constants
    enum Sass_Output_Style output_style;
  
    // Precision for fractional numbers
    int precision;
  
  };
  
  // sass config options structure
  struct Sass_Output_Options : Sass_Inspect_Options {
  
    // String to be used for indentation
    const char* indent;
    // String to be used to for line feeds
    const char* linefeed;
  
    // Emit comments in the generated CSS indicating
    // the corresponding source line.
    bool source_comments;
  
  };
  
  // sass config options structure
  struct Sass_Options : Sass_Output_Options {
  
    // embed sourceMappingUrl as data uri
    bool source_map_embed;
  
    // embed include contents in maps
    bool source_map_contents;
  
    // create file urls for sources
    bool source_map_file_urls;
  
    // Disable sourceMappingUrl in css output
    bool omit_source_map_url;
  
    // Treat source_string as sass (as opposed to scss)
    bool is_indented_syntax_src;
  
    // The input path is used for source map
    // generation. It can be used to define
    // something with string compilation or to
    // overload the input file path. It is
    // set to "stdin" for data contexts and
    // to the input file on file contexts.
    char* input_path;
  
    // The output path is used for source map
    // generation. LibSass will not write to
    // this file, it is just used to create
    // information in source-maps etc.
    char* output_path;
  
    // Colon-separated list of paths
    // Semicolon-separated on Windows
    // Maybe use array interface instead?
    char* include_path;
    char* plugin_path;
  
    // Include paths (linked string list)
    struct string_list* include_paths;
    // Plugin paths (linked string list)
    struct string_list* plugin_paths;
  
    // Path to source map file
    // Enables source map generation
    // Used to create sourceMappingUrl
    char* source_map_file;
  
    // Directly inserted in source maps
    char* source_map_root;
  
    // Custom functions that can be called from sccs code
    Sass_Function_List c_functions;
  
    // Callback to overload imports
    Sass_Importer_List c_importers;
  
    // List of custom headers
    Sass_Importer_List c_headers;
  
  };
  
  // base for all contexts
  struct Sass_Context : Sass_Options
  {
  
    // store context type info
    enum Sass_Input_Style type;
  
    // generated output data
    char* output_string;
  
    // generated source map json
    char* source_map_string;
  
    // error status
    int error_status;
    char* error_json;
    char* error_text;
    char* error_message;
    // error position
    char* error_file;
    size_t error_line;
    size_t error_column;
    const char* error_src;
  
    // report imported files
    char** included_files;
  
  };
  
  // struct for file compilation
  struct Sass_File_Context : Sass_Context {
  
    // no additional fields required
    // input_path is already on options
  
  };
  
  // struct for data compilation
  struct Sass_Data_Context : Sass_Context {
  
    // provided source string
    char* source_string;
    char* srcmap_string;
  
  };
  
  // Compiler states
  enum Sass_Compiler_State {
    SASS_COMPILER_CREATED,
    SASS_COMPILER_PARSED,
    SASS_COMPILER_EXECUTED
  };
  
  // link c and cpp context
  struct Sass_Compiler {
    // progress status
    Sass_Compiler_State state;
    // original c context
    Sass_Context* c_ctx;
    // Sass::Context
    Sass::Context* cpp_ctx;
    // Sass::Block
    Sass::Block_Obj root;
  };
  ```