sass-embedded 1.62.1-x86-mingw32 → 1.63.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/exe/sass +21 -0
- data/ext/sass/cli.rb +12 -0
- data/ext/sass/dart-sass/sass.bat +7 -0
- data/ext/sass/{sass_embedded → dart-sass}/src/LICENSE +157 -34
- data/ext/sass/{sass_embedded → dart-sass}/src/dart.exe +0 -0
- data/ext/sass/{sass_embedded/src/dart-sass-embedded.snapshot → dart-sass/src/sass.snapshot} +0 -0
- data/ext/sass/embedded_sass_pb.rb +24 -291
- data/lib/sass/compile_error.rb +12 -10
- data/lib/sass/compile_result.rb +1 -1
- data/lib/sass/elf.rb +276 -0
- data/lib/sass/embedded/channel.rb +3 -3
- data/lib/sass/embedded/compiler.rb +11 -8
- data/lib/sass/embedded/dispatcher.rb +26 -30
- data/lib/sass/embedded/host/logger_registry.rb +27 -24
- data/lib/sass/embedded/host.rb +50 -20
- data/lib/sass/embedded/protofier.rb +8 -7
- data/lib/sass/embedded/varint.rb +6 -0
- data/lib/sass/embedded/version.rb +1 -1
- data/lib/sass/embedded.rb +3 -4
- data/lib/sass/logger/source_span.rb +2 -2
- metadata +17 -100
- data/ext/sass/embedded.rb +0 -12
- data/ext/sass/sass_embedded/dart-sass-embedded.bat +0 -7
- data/lib/sass/embedded/async.rb +0 -58
- data/lib/sass/embedded/elf.rb +0 -275
@@ -1,301 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
3
|
# source: embedded_sass.proto
|
3
4
|
|
4
5
|
require 'google/protobuf'
|
5
6
|
|
6
|
-
|
7
|
-
add_file("embedded_sass.proto", :syntax => :proto3) do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
optional :alert_color, :bool, 8
|
28
|
-
optional :alert_ascii, :bool, 9
|
29
|
-
optional :verbose, :bool, 10
|
30
|
-
optional :quiet_deps, :bool, 11
|
31
|
-
optional :source_map_include_sources, :bool, 12
|
32
|
-
optional :charset, :bool, 13
|
33
|
-
oneof :input do
|
34
|
-
optional :string, :message, 2, "sass.embedded_protocol.InboundMessage.CompileRequest.StringInput"
|
35
|
-
optional :path, :string, 3
|
36
|
-
end
|
37
|
-
end
|
38
|
-
add_message "sass.embedded_protocol.InboundMessage.CompileRequest.StringInput" do
|
39
|
-
optional :source, :string, 1
|
40
|
-
optional :url, :string, 2
|
41
|
-
optional :syntax, :enum, 3, "sass.embedded_protocol.Syntax"
|
42
|
-
optional :importer, :message, 4, "sass.embedded_protocol.InboundMessage.CompileRequest.Importer"
|
43
|
-
end
|
44
|
-
add_message "sass.embedded_protocol.InboundMessage.CompileRequest.Importer" do
|
45
|
-
oneof :importer do
|
46
|
-
optional :path, :string, 1
|
47
|
-
optional :importer_id, :uint32, 2
|
48
|
-
optional :file_importer_id, :uint32, 3
|
49
|
-
end
|
50
|
-
end
|
51
|
-
add_message "sass.embedded_protocol.InboundMessage.CanonicalizeResponse" do
|
52
|
-
optional :id, :uint32, 1
|
53
|
-
oneof :result do
|
54
|
-
optional :url, :string, 2
|
55
|
-
optional :error, :string, 3
|
56
|
-
end
|
57
|
-
end
|
58
|
-
add_message "sass.embedded_protocol.InboundMessage.ImportResponse" do
|
59
|
-
optional :id, :uint32, 1
|
60
|
-
oneof :result do
|
61
|
-
optional :success, :message, 2, "sass.embedded_protocol.InboundMessage.ImportResponse.ImportSuccess"
|
62
|
-
optional :error, :string, 3
|
63
|
-
end
|
64
|
-
end
|
65
|
-
add_message "sass.embedded_protocol.InboundMessage.ImportResponse.ImportSuccess" do
|
66
|
-
optional :contents, :string, 1
|
67
|
-
optional :syntax, :enum, 2, "sass.embedded_protocol.Syntax"
|
68
|
-
optional :source_map_url, :string, 3
|
69
|
-
end
|
70
|
-
add_message "sass.embedded_protocol.InboundMessage.FileImportResponse" do
|
71
|
-
optional :id, :uint32, 1
|
72
|
-
oneof :result do
|
73
|
-
optional :file_url, :string, 2
|
74
|
-
optional :error, :string, 3
|
75
|
-
end
|
76
|
-
end
|
77
|
-
add_message "sass.embedded_protocol.InboundMessage.FunctionCallResponse" do
|
78
|
-
optional :id, :uint32, 1
|
79
|
-
repeated :accessed_argument_lists, :uint32, 4
|
80
|
-
oneof :result do
|
81
|
-
optional :success, :message, 2, "sass.embedded_protocol.Value"
|
82
|
-
optional :error, :string, 3
|
83
|
-
end
|
84
|
-
end
|
85
|
-
add_message "sass.embedded_protocol.OutboundMessage" do
|
86
|
-
oneof :message do
|
87
|
-
optional :error, :message, 1, "sass.embedded_protocol.ProtocolError"
|
88
|
-
optional :compile_response, :message, 2, "sass.embedded_protocol.OutboundMessage.CompileResponse"
|
89
|
-
optional :log_event, :message, 3, "sass.embedded_protocol.OutboundMessage.LogEvent"
|
90
|
-
optional :canonicalize_request, :message, 4, "sass.embedded_protocol.OutboundMessage.CanonicalizeRequest"
|
91
|
-
optional :import_request, :message, 5, "sass.embedded_protocol.OutboundMessage.ImportRequest"
|
92
|
-
optional :file_import_request, :message, 6, "sass.embedded_protocol.OutboundMessage.FileImportRequest"
|
93
|
-
optional :function_call_request, :message, 7, "sass.embedded_protocol.OutboundMessage.FunctionCallRequest"
|
94
|
-
optional :version_response, :message, 8, "sass.embedded_protocol.OutboundMessage.VersionResponse"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
add_message "sass.embedded_protocol.OutboundMessage.VersionResponse" do
|
98
|
-
optional :id, :uint32, 5
|
99
|
-
optional :protocol_version, :string, 1
|
100
|
-
optional :compiler_version, :string, 2
|
101
|
-
optional :implementation_version, :string, 3
|
102
|
-
optional :implementation_name, :string, 4
|
103
|
-
end
|
104
|
-
add_message "sass.embedded_protocol.OutboundMessage.CompileResponse" do
|
105
|
-
optional :id, :uint32, 1
|
106
|
-
oneof :result do
|
107
|
-
optional :success, :message, 2, "sass.embedded_protocol.OutboundMessage.CompileResponse.CompileSuccess"
|
108
|
-
optional :failure, :message, 3, "sass.embedded_protocol.OutboundMessage.CompileResponse.CompileFailure"
|
109
|
-
end
|
110
|
-
end
|
111
|
-
add_message "sass.embedded_protocol.OutboundMessage.CompileResponse.CompileSuccess" do
|
112
|
-
optional :css, :string, 1
|
113
|
-
optional :source_map, :string, 2
|
114
|
-
repeated :loaded_urls, :string, 3
|
115
|
-
end
|
116
|
-
add_message "sass.embedded_protocol.OutboundMessage.CompileResponse.CompileFailure" do
|
117
|
-
optional :message, :string, 1
|
118
|
-
optional :span, :message, 2, "sass.embedded_protocol.SourceSpan"
|
119
|
-
optional :stack_trace, :string, 3
|
120
|
-
optional :formatted, :string, 4
|
121
|
-
end
|
122
|
-
add_message "sass.embedded_protocol.OutboundMessage.LogEvent" do
|
123
|
-
optional :compilation_id, :uint32, 1
|
124
|
-
optional :type, :enum, 2, "sass.embedded_protocol.LogEventType"
|
125
|
-
optional :message, :string, 3
|
126
|
-
optional :span, :message, 4, "sass.embedded_protocol.SourceSpan"
|
127
|
-
optional :stack_trace, :string, 5
|
128
|
-
optional :formatted, :string, 6
|
129
|
-
end
|
130
|
-
add_message "sass.embedded_protocol.OutboundMessage.CanonicalizeRequest" do
|
131
|
-
optional :id, :uint32, 1
|
132
|
-
optional :compilation_id, :uint32, 2
|
133
|
-
optional :importer_id, :uint32, 3
|
134
|
-
optional :url, :string, 4
|
135
|
-
optional :from_import, :bool, 5
|
136
|
-
end
|
137
|
-
add_message "sass.embedded_protocol.OutboundMessage.ImportRequest" do
|
138
|
-
optional :id, :uint32, 1
|
139
|
-
optional :compilation_id, :uint32, 2
|
140
|
-
optional :importer_id, :uint32, 3
|
141
|
-
optional :url, :string, 4
|
142
|
-
end
|
143
|
-
add_message "sass.embedded_protocol.OutboundMessage.FileImportRequest" do
|
144
|
-
optional :id, :uint32, 1
|
145
|
-
optional :compilation_id, :uint32, 2
|
146
|
-
optional :importer_id, :uint32, 3
|
147
|
-
optional :url, :string, 4
|
148
|
-
optional :from_import, :bool, 5
|
149
|
-
end
|
150
|
-
add_message "sass.embedded_protocol.OutboundMessage.FunctionCallRequest" do
|
151
|
-
optional :id, :uint32, 1
|
152
|
-
optional :compilation_id, :uint32, 2
|
153
|
-
repeated :arguments, :message, 5, "sass.embedded_protocol.Value"
|
154
|
-
oneof :identifier do
|
155
|
-
optional :name, :string, 3
|
156
|
-
optional :function_id, :uint32, 4
|
157
|
-
end
|
158
|
-
end
|
159
|
-
add_message "sass.embedded_protocol.ProtocolError" do
|
160
|
-
optional :type, :enum, 1, "sass.embedded_protocol.ProtocolErrorType"
|
161
|
-
optional :id, :uint32, 2
|
162
|
-
optional :message, :string, 3
|
163
|
-
end
|
164
|
-
add_message "sass.embedded_protocol.SourceSpan" do
|
165
|
-
optional :text, :string, 1
|
166
|
-
optional :start, :message, 2, "sass.embedded_protocol.SourceSpan.SourceLocation"
|
167
|
-
optional :end, :message, 3, "sass.embedded_protocol.SourceSpan.SourceLocation"
|
168
|
-
optional :url, :string, 4
|
169
|
-
optional :context, :string, 5
|
170
|
-
end
|
171
|
-
add_message "sass.embedded_protocol.SourceSpan.SourceLocation" do
|
172
|
-
optional :offset, :uint32, 1
|
173
|
-
optional :line, :uint32, 2
|
174
|
-
optional :column, :uint32, 3
|
175
|
-
end
|
176
|
-
add_message "sass.embedded_protocol.Value" do
|
177
|
-
oneof :value do
|
178
|
-
optional :string, :message, 1, "sass.embedded_protocol.Value.String"
|
179
|
-
optional :number, :message, 2, "sass.embedded_protocol.Value.Number"
|
180
|
-
optional :rgb_color, :message, 3, "sass.embedded_protocol.Value.RgbColor"
|
181
|
-
optional :hsl_color, :message, 4, "sass.embedded_protocol.Value.HslColor"
|
182
|
-
optional :list, :message, 5, "sass.embedded_protocol.Value.List"
|
183
|
-
optional :map, :message, 6, "sass.embedded_protocol.Value.Map"
|
184
|
-
optional :singleton, :enum, 7, "sass.embedded_protocol.SingletonValue"
|
185
|
-
optional :compiler_function, :message, 8, "sass.embedded_protocol.Value.CompilerFunction"
|
186
|
-
optional :host_function, :message, 9, "sass.embedded_protocol.Value.HostFunction"
|
187
|
-
optional :argument_list, :message, 10, "sass.embedded_protocol.Value.ArgumentList"
|
188
|
-
optional :hwb_color, :message, 11, "sass.embedded_protocol.Value.HwbColor"
|
189
|
-
optional :calculation, :message, 12, "sass.embedded_protocol.Value.Calculation"
|
190
|
-
end
|
191
|
-
end
|
192
|
-
add_message "sass.embedded_protocol.Value.String" do
|
193
|
-
optional :text, :string, 1
|
194
|
-
optional :quoted, :bool, 2
|
195
|
-
end
|
196
|
-
add_message "sass.embedded_protocol.Value.Number" do
|
197
|
-
optional :value, :double, 1
|
198
|
-
repeated :numerators, :string, 2
|
199
|
-
repeated :denominators, :string, 3
|
200
|
-
end
|
201
|
-
add_message "sass.embedded_protocol.Value.RgbColor" do
|
202
|
-
optional :red, :uint32, 1
|
203
|
-
optional :green, :uint32, 2
|
204
|
-
optional :blue, :uint32, 3
|
205
|
-
optional :alpha, :double, 4
|
206
|
-
end
|
207
|
-
add_message "sass.embedded_protocol.Value.HslColor" do
|
208
|
-
optional :hue, :double, 1
|
209
|
-
optional :saturation, :double, 2
|
210
|
-
optional :lightness, :double, 3
|
211
|
-
optional :alpha, :double, 4
|
212
|
-
end
|
213
|
-
add_message "sass.embedded_protocol.Value.HwbColor" do
|
214
|
-
optional :hue, :double, 1
|
215
|
-
optional :whiteness, :double, 2
|
216
|
-
optional :blackness, :double, 3
|
217
|
-
optional :alpha, :double, 4
|
218
|
-
end
|
219
|
-
add_message "sass.embedded_protocol.Value.List" do
|
220
|
-
optional :separator, :enum, 1, "sass.embedded_protocol.ListSeparator"
|
221
|
-
optional :has_brackets, :bool, 2
|
222
|
-
repeated :contents, :message, 3, "sass.embedded_protocol.Value"
|
223
|
-
end
|
224
|
-
add_message "sass.embedded_protocol.Value.Map" do
|
225
|
-
repeated :entries, :message, 1, "sass.embedded_protocol.Value.Map.Entry"
|
226
|
-
end
|
227
|
-
add_message "sass.embedded_protocol.Value.Map.Entry" do
|
228
|
-
optional :key, :message, 1, "sass.embedded_protocol.Value"
|
229
|
-
optional :value, :message, 2, "sass.embedded_protocol.Value"
|
230
|
-
end
|
231
|
-
add_message "sass.embedded_protocol.Value.CompilerFunction" do
|
232
|
-
optional :id, :uint32, 1
|
233
|
-
end
|
234
|
-
add_message "sass.embedded_protocol.Value.HostFunction" do
|
235
|
-
optional :id, :uint32, 1
|
236
|
-
optional :signature, :string, 2
|
237
|
-
end
|
238
|
-
add_message "sass.embedded_protocol.Value.ArgumentList" do
|
239
|
-
optional :id, :uint32, 1
|
240
|
-
optional :separator, :enum, 2, "sass.embedded_protocol.ListSeparator"
|
241
|
-
repeated :contents, :message, 3, "sass.embedded_protocol.Value"
|
242
|
-
map :keywords, :string, :message, 4, "sass.embedded_protocol.Value"
|
243
|
-
end
|
244
|
-
add_message "sass.embedded_protocol.Value.Calculation" do
|
245
|
-
optional :name, :string, 1
|
246
|
-
repeated :arguments, :message, 2, "sass.embedded_protocol.Value.Calculation.CalculationValue"
|
247
|
-
end
|
248
|
-
add_message "sass.embedded_protocol.Value.Calculation.CalculationValue" do
|
249
|
-
oneof :value do
|
250
|
-
optional :number, :message, 1, "sass.embedded_protocol.Value.Number"
|
251
|
-
optional :string, :string, 2
|
252
|
-
optional :interpolation, :string, 3
|
253
|
-
optional :operation, :message, 4, "sass.embedded_protocol.Value.Calculation.CalculationOperation"
|
254
|
-
optional :calculation, :message, 5, "sass.embedded_protocol.Value.Calculation"
|
255
|
-
end
|
256
|
-
end
|
257
|
-
add_message "sass.embedded_protocol.Value.Calculation.CalculationOperation" do
|
258
|
-
optional :operator, :enum, 1, "sass.embedded_protocol.CalculationOperator"
|
259
|
-
optional :left, :message, 2, "sass.embedded_protocol.Value.Calculation.CalculationValue"
|
260
|
-
optional :right, :message, 3, "sass.embedded_protocol.Value.Calculation.CalculationValue"
|
261
|
-
end
|
262
|
-
add_enum "sass.embedded_protocol.OutputStyle" do
|
263
|
-
value :EXPANDED, 0
|
264
|
-
value :COMPRESSED, 1
|
265
|
-
end
|
266
|
-
add_enum "sass.embedded_protocol.Syntax" do
|
267
|
-
value :SCSS, 0
|
268
|
-
value :INDENTED, 1
|
269
|
-
value :CSS, 2
|
270
|
-
end
|
271
|
-
add_enum "sass.embedded_protocol.LogEventType" do
|
272
|
-
value :WARNING, 0
|
273
|
-
value :DEPRECATION_WARNING, 1
|
274
|
-
value :DEBUG, 2
|
275
|
-
end
|
276
|
-
add_enum "sass.embedded_protocol.ProtocolErrorType" do
|
277
|
-
value :PARSE, 0
|
278
|
-
value :PARAMS, 1
|
279
|
-
value :INTERNAL, 2
|
280
|
-
end
|
281
|
-
add_enum "sass.embedded_protocol.ListSeparator" do
|
282
|
-
value :COMMA, 0
|
283
|
-
value :SPACE, 1
|
284
|
-
value :SLASH, 2
|
285
|
-
value :UNDECIDED, 3
|
286
|
-
end
|
287
|
-
add_enum "sass.embedded_protocol.SingletonValue" do
|
288
|
-
value :TRUE, 0
|
289
|
-
value :FALSE, 1
|
290
|
-
value :NULL, 2
|
291
|
-
end
|
292
|
-
add_enum "sass.embedded_protocol.CalculationOperator" do
|
293
|
-
value :PLUS, 0
|
294
|
-
value :MINUS, 1
|
295
|
-
value :TIMES, 2
|
296
|
-
value :DIVIDE, 3
|
7
|
+
|
8
|
+
descriptor_data = "\n\x13\x65mbedded_sass.proto\x12\x16sass.embedded_protocol\"\xd9\x0e\n\x0eInboundMessage\x12P\n\x0f\x63ompile_request\x18\x02 \x01(\x0b\x32\x35.sass.embedded_protocol.InboundMessage.CompileRequestH\x00\x12\\\n\x15\x63\x61nonicalize_response\x18\x03 \x01(\x0b\x32;.sass.embedded_protocol.InboundMessage.CanonicalizeResponseH\x00\x12P\n\x0fimport_response\x18\x04 \x01(\x0b\x32\x35.sass.embedded_protocol.InboundMessage.ImportResponseH\x00\x12Y\n\x14\x66ile_import_response\x18\x05 \x01(\x0b\x32\x39.sass.embedded_protocol.InboundMessage.FileImportResponseH\x00\x12]\n\x16\x66unction_call_response\x18\x06 \x01(\x0b\x32;.sass.embedded_protocol.InboundMessage.FunctionCallResponseH\x00\x12P\n\x0fversion_request\x18\x07 \x01(\x0b\x32\x35.sass.embedded_protocol.InboundMessage.VersionRequestH\x00\x1a\x1c\n\x0eVersionRequest\x12\n\n\x02id\x18\x01 \x01(\r\x1a\xc7\x05\n\x0e\x43ompileRequest\x12S\n\x06string\x18\x02 \x01(\x0b\x32\x41.sass.embedded_protocol.InboundMessage.CompileRequest.StringInputH\x00\x12\x0e\n\x04path\x18\x03 \x01(\tH\x00\x12\x32\n\x05style\x18\x04 \x01(\x0e\x32#.sass.embedded_protocol.OutputStyle\x12\x12\n\nsource_map\x18\x05 \x01(\x08\x12Q\n\timporters\x18\x06 \x03(\x0b\x32>.sass.embedded_protocol.InboundMessage.CompileRequest.Importer\x12\x18\n\x10global_functions\x18\x07 \x03(\t\x12\x13\n\x0b\x61lert_color\x18\x08 \x01(\x08\x12\x13\n\x0b\x61lert_ascii\x18\t \x01(\x08\x12\x0f\n\x07verbose\x18\n \x01(\x08\x12\x12\n\nquiet_deps\x18\x0b \x01(\x08\x12\"\n\x1asource_map_include_sources\x18\x0c \x01(\x08\x12\x0f\n\x07\x63harset\x18\r \x01(\x08\x1a\xac\x01\n\x0bStringInput\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\x12.\n\x06syntax\x18\x03 \x01(\x0e\x32\x1e.sass.embedded_protocol.Syntax\x12P\n\x08importer\x18\x04 \x01(\x0b\x32>.sass.embedded_protocol.InboundMessage.CompileRequest.Importer\x1aY\n\x08Importer\x12\x0e\n\x04path\x18\x01 \x01(\tH\x00\x12\x15\n\x0bimporter_id\x18\x02 \x01(\rH\x00\x12\x1a\n\x10\x66ile_importer_id\x18\x03 \x01(\rH\x00\x42\n\n\x08importerB\x07\n\x05inputJ\x04\x08\x01\x10\x02\x1aL\n\x14\x43\x61nonicalizeResponse\x12\n\n\x02id\x18\x01 \x01(\r\x12\r\n\x03url\x18\x02 \x01(\tH\x00\x12\x0f\n\x05\x65rror\x18\x03 \x01(\tH\x00\x42\x08\n\x06result\x1a\x93\x02\n\x0eImportResponse\x12\n\n\x02id\x18\x01 \x01(\r\x12V\n\x07success\x18\x02 \x01(\x0b\x32\x43.sass.embedded_protocol.InboundMessage.ImportResponse.ImportSuccessH\x00\x12\x0f\n\x05\x65rror\x18\x03 \x01(\tH\x00\x1a\x81\x01\n\rImportSuccess\x12\x10\n\x08\x63ontents\x18\x01 \x01(\t\x12.\n\x06syntax\x18\x02 \x01(\x0e\x32\x1e.sass.embedded_protocol.Syntax\x12\x1b\n\x0esource_map_url\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\x11\n\x0f_source_map_urlB\x08\n\x06result\x1aO\n\x12\x46ileImportResponse\x12\n\n\x02id\x18\x01 \x01(\r\x12\x12\n\x08\x66ile_url\x18\x02 \x01(\tH\x00\x12\x0f\n\x05\x65rror\x18\x03 \x01(\tH\x00\x42\x08\n\x06result\x1a\x90\x01\n\x14\x46unctionCallResponse\x12\n\n\x02id\x18\x01 \x01(\r\x12\x30\n\x07success\x18\x02 \x01(\x0b\x32\x1d.sass.embedded_protocol.ValueH\x00\x12\x0f\n\x05\x65rror\x18\x03 \x01(\tH\x00\x12\x1f\n\x17\x61\x63\x63\x65ssed_argument_lists\x18\x04 \x03(\rB\x08\n\x06resultB\t\n\x07message\"\xb5\x0e\n\x0fOutboundMessage\x12\x36\n\x05\x65rror\x18\x01 \x01(\x0b\x32%.sass.embedded_protocol.ProtocolErrorH\x00\x12S\n\x10\x63ompile_response\x18\x02 \x01(\x0b\x32\x37.sass.embedded_protocol.OutboundMessage.CompileResponseH\x00\x12\x45\n\tlog_event\x18\x03 \x01(\x0b\x32\x30.sass.embedded_protocol.OutboundMessage.LogEventH\x00\x12[\n\x14\x63\x61nonicalize_request\x18\x04 \x01(\x0b\x32;.sass.embedded_protocol.OutboundMessage.CanonicalizeRequestH\x00\x12O\n\x0eimport_request\x18\x05 \x01(\x0b\x32\x35.sass.embedded_protocol.OutboundMessage.ImportRequestH\x00\x12X\n\x13\x66ile_import_request\x18\x06 \x01(\x0b\x32\x39.sass.embedded_protocol.OutboundMessage.FileImportRequestH\x00\x12\\\n\x15\x66unction_call_request\x18\x07 \x01(\x0b\x32;.sass.embedded_protocol.OutboundMessage.FunctionCallRequestH\x00\x12S\n\x10version_response\x18\x08 \x01(\x0b\x32\x37.sass.embedded_protocol.OutboundMessage.VersionResponseH\x00\x1a\x8e\x01\n\x0fVersionResponse\x12\n\n\x02id\x18\x05 \x01(\r\x12\x18\n\x10protocol_version\x18\x01 \x01(\t\x12\x18\n\x10\x63ompiler_version\x18\x02 \x01(\t\x12\x1e\n\x16implementation_version\x18\x03 \x01(\t\x12\x1b\n\x13implementation_name\x18\x04 \x01(\t\x1a\xa2\x03\n\x0f\x43ompileResponse\x12Y\n\x07success\x18\x02 \x01(\x0b\x32\x46.sass.embedded_protocol.OutboundMessage.CompileResponse.CompileSuccessH\x00\x12Y\n\x07\x66\x61ilure\x18\x03 \x01(\x0b\x32\x46.sass.embedded_protocol.OutboundMessage.CompileResponse.CompileFailureH\x00\x12\x13\n\x0bloaded_urls\x18\x04 \x03(\t\x1a\x37\n\x0e\x43ompileSuccess\x12\x0b\n\x03\x63ss\x18\x01 \x01(\t\x12\x12\n\nsource_map\x18\x02 \x01(\tJ\x04\x08\x03\x10\x04\x1a{\n\x0e\x43ompileFailure\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\x30\n\x04span\x18\x02 \x01(\x0b\x32\".sass.embedded_protocol.SourceSpan\x12\x13\n\x0bstack_trace\x18\x03 \x01(\t\x12\x11\n\tformatted\x18\x04 \x01(\tB\x08\n\x06resultJ\x04\x08\x01\x10\x02\x1a\xbd\x01\n\x08LogEvent\x12\x32\n\x04type\x18\x02 \x01(\x0e\x32$.sass.embedded_protocol.LogEventType\x12\x0f\n\x07message\x18\x03 \x01(\t\x12\x35\n\x04span\x18\x04 \x01(\x0b\x32\".sass.embedded_protocol.SourceSpanH\x00\x88\x01\x01\x12\x13\n\x0bstack_trace\x18\x05 \x01(\t\x12\x11\n\tformatted\x18\x06 \x01(\tB\x07\n\x05_spanJ\x04\x08\x01\x10\x02\x1a^\n\x13\x43\x61nonicalizeRequest\x12\n\n\x02id\x18\x01 \x01(\r\x12\x13\n\x0bimporter_id\x18\x03 \x01(\r\x12\x0b\n\x03url\x18\x04 \x01(\t\x12\x13\n\x0b\x66rom_import\x18\x05 \x01(\x08J\x04\x08\x02\x10\x03\x1a\x43\n\rImportRequest\x12\n\n\x02id\x18\x01 \x01(\r\x12\x13\n\x0bimporter_id\x18\x03 \x01(\r\x12\x0b\n\x03url\x18\x04 \x01(\tJ\x04\x08\x02\x10\x03\x1a\\\n\x11\x46ileImportRequest\x12\n\n\x02id\x18\x01 \x01(\r\x12\x13\n\x0bimporter_id\x18\x03 \x01(\r\x12\x0b\n\x03url\x18\x04 \x01(\t\x12\x13\n\x0b\x66rom_import\x18\x05 \x01(\x08J\x04\x08\x02\x10\x03\x1a\x8e\x01\n\x13\x46unctionCallRequest\x12\n\n\x02id\x18\x01 \x01(\r\x12\x0e\n\x04name\x18\x03 \x01(\tH\x00\x12\x15\n\x0b\x66unction_id\x18\x04 \x01(\rH\x00\x12\x30\n\targuments\x18\x05 \x03(\x0b\x32\x1d.sass.embedded_protocol.ValueB\x0c\n\nidentifierJ\x04\x08\x02\x10\x03\x42\t\n\x07message\"e\n\rProtocolError\x12\x37\n\x04type\x18\x01 \x01(\x0e\x32).sass.embedded_protocol.ProtocolErrorType\x12\n\n\x02id\x18\x02 \x01(\r\x12\x0f\n\x07message\x18\x03 \x01(\t\"\x87\x02\n\nSourceSpan\x12\x0c\n\x04text\x18\x01 \x01(\t\x12@\n\x05start\x18\x02 \x01(\x0b\x32\x31.sass.embedded_protocol.SourceSpan.SourceLocation\x12\x43\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x31.sass.embedded_protocol.SourceSpan.SourceLocationH\x00\x88\x01\x01\x12\x0b\n\x03url\x18\x04 \x01(\t\x12\x0f\n\x07\x63ontext\x18\x05 \x01(\t\x1a>\n\x0eSourceLocation\x12\x0e\n\x06offset\x18\x01 \x01(\r\x12\x0c\n\x04line\x18\x02 \x01(\r\x12\x0e\n\x06\x63olumn\x18\x03 \x01(\rB\x06\n\x04_end\"\xd4\x12\n\x05Value\x12\x36\n\x06string\x18\x01 \x01(\x0b\x32$.sass.embedded_protocol.Value.StringH\x00\x12\x36\n\x06number\x18\x02 \x01(\x0b\x32$.sass.embedded_protocol.Value.NumberH\x00\x12;\n\trgb_color\x18\x03 \x01(\x0b\x32&.sass.embedded_protocol.Value.RgbColorH\x00\x12;\n\thsl_color\x18\x04 \x01(\x0b\x32&.sass.embedded_protocol.Value.HslColorH\x00\x12\x32\n\x04list\x18\x05 \x01(\x0b\x32\".sass.embedded_protocol.Value.ListH\x00\x12\x30\n\x03map\x18\x06 \x01(\x0b\x32!.sass.embedded_protocol.Value.MapH\x00\x12;\n\tsingleton\x18\x07 \x01(\x0e\x32&.sass.embedded_protocol.SingletonValueH\x00\x12K\n\x11\x63ompiler_function\x18\x08 \x01(\x0b\x32..sass.embedded_protocol.Value.CompilerFunctionH\x00\x12\x43\n\rhost_function\x18\t \x01(\x0b\x32*.sass.embedded_protocol.Value.HostFunctionH\x00\x12\x43\n\rargument_list\x18\n \x01(\x0b\x32*.sass.embedded_protocol.Value.ArgumentListH\x00\x12;\n\thwb_color\x18\x0b \x01(\x0b\x32&.sass.embedded_protocol.Value.HwbColorH\x00\x12@\n\x0b\x63\x61lculation\x18\x0c \x01(\x0b\x32).sass.embedded_protocol.Value.CalculationH\x00\x1a&\n\x06String\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x0e\n\x06quoted\x18\x02 \x01(\x08\x1a\x41\n\x06Number\x12\r\n\x05value\x18\x01 \x01(\x01\x12\x12\n\nnumerators\x18\x02 \x03(\t\x12\x14\n\x0c\x64\x65nominators\x18\x03 \x03(\t\x1a\x43\n\x08RgbColor\x12\x0b\n\x03red\x18\x01 \x01(\r\x12\r\n\x05green\x18\x02 \x01(\r\x12\x0c\n\x04\x62lue\x18\x03 \x01(\r\x12\r\n\x05\x61lpha\x18\x04 \x01(\x01\x1aM\n\x08HslColor\x12\x0b\n\x03hue\x18\x01 \x01(\x01\x12\x12\n\nsaturation\x18\x02 \x01(\x01\x12\x11\n\tlightness\x18\x03 \x01(\x01\x12\r\n\x05\x61lpha\x18\x04 \x01(\x01\x1aL\n\x08HwbColor\x12\x0b\n\x03hue\x18\x01 \x01(\x01\x12\x11\n\twhiteness\x18\x02 \x01(\x01\x12\x11\n\tblackness\x18\x03 \x01(\x01\x12\r\n\x05\x61lpha\x18\x04 \x01(\x01\x1a\x87\x01\n\x04List\x12\x38\n\tseparator\x18\x01 \x01(\x0e\x32%.sass.embedded_protocol.ListSeparator\x12\x14\n\x0chas_brackets\x18\x02 \x01(\x08\x12/\n\x08\x63ontents\x18\x03 \x03(\x0b\x32\x1d.sass.embedded_protocol.Value\x1a\xa2\x01\n\x03Map\x12\x38\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\'.sass.embedded_protocol.Value.Map.Entry\x1a\x61\n\x05\x45ntry\x12*\n\x03key\x18\x01 \x01(\x0b\x32\x1d.sass.embedded_protocol.Value\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.sass.embedded_protocol.Value\x1a\x1e\n\x10\x43ompilerFunction\x12\n\n\x02id\x18\x01 \x01(\r\x1a-\n\x0cHostFunction\x12\n\n\x02id\x18\x01 \x01(\r\x12\x11\n\tsignature\x18\x02 \x01(\t\x1a\xa1\x02\n\x0c\x41rgumentList\x12\n\n\x02id\x18\x01 \x01(\r\x12\x38\n\tseparator\x18\x02 \x01(\x0e\x32%.sass.embedded_protocol.ListSeparator\x12/\n\x08\x63ontents\x18\x03 \x03(\x0b\x32\x1d.sass.embedded_protocol.Value\x12J\n\x08keywords\x18\x04 \x03(\x0b\x32\x38.sass.embedded_protocol.Value.ArgumentList.KeywordsEntry\x1aN\n\rKeywordsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.sass.embedded_protocol.Value:\x02\x38\x01\x1a\xef\x04\n\x0b\x43\x61lculation\x12\x0c\n\x04name\x18\x01 \x01(\t\x12M\n\targuments\x18\x02 \x03(\x0b\x32:.sass.embedded_protocol.Value.Calculation.CalculationValue\x1a\x95\x02\n\x10\x43\x61lculationValue\x12\x36\n\x06number\x18\x01 \x01(\x0b\x32$.sass.embedded_protocol.Value.NumberH\x00\x12\x10\n\x06string\x18\x02 \x01(\tH\x00\x12\x17\n\rinterpolation\x18\x03 \x01(\tH\x00\x12S\n\toperation\x18\x04 \x01(\x0b\x32>.sass.embedded_protocol.Value.Calculation.CalculationOperationH\x00\x12@\n\x0b\x63\x61lculation\x18\x05 \x01(\x0b\x32).sass.embedded_protocol.Value.CalculationH\x00\x42\x07\n\x05value\x1a\xea\x01\n\x14\x43\x61lculationOperation\x12=\n\x08operator\x18\x01 \x01(\x0e\x32+.sass.embedded_protocol.CalculationOperator\x12H\n\x04left\x18\x02 \x01(\x0b\x32:.sass.embedded_protocol.Value.Calculation.CalculationValue\x12I\n\x05right\x18\x03 \x01(\x0b\x32:.sass.embedded_protocol.Value.Calculation.CalculationValueB\x07\n\x05value*+\n\x0bOutputStyle\x12\x0c\n\x08\x45XPANDED\x10\x00\x12\x0e\n\nCOMPRESSED\x10\x01*)\n\x06Syntax\x12\x08\n\x04SCSS\x10\x00\x12\x0c\n\x08INDENTED\x10\x01\x12\x07\n\x03\x43SS\x10\x02*?\n\x0cLogEventType\x12\x0b\n\x07WARNING\x10\x00\x12\x17\n\x13\x44\x45PRECATION_WARNING\x10\x01\x12\t\n\x05\x44\x45\x42UG\x10\x02*8\n\x11ProtocolErrorType\x12\t\n\x05PARSE\x10\x00\x12\n\n\x06PARAMS\x10\x01\x12\x0c\n\x08INTERNAL\x10\x02*?\n\rListSeparator\x12\t\n\x05\x43OMMA\x10\x00\x12\t\n\x05SPACE\x10\x01\x12\t\n\x05SLASH\x10\x02\x12\r\n\tUNDECIDED\x10\x03*/\n\x0eSingletonValue\x12\x08\n\x04TRUE\x10\x00\x12\t\n\x05\x46\x41LSE\x10\x01\x12\x08\n\x04NULL\x10\x02*A\n\x13\x43\x61lculationOperator\x12\x08\n\x04PLUS\x10\x00\x12\t\n\x05MINUS\x10\x01\x12\t\n\x05TIMES\x10\x02\x12\n\n\x06\x44IVIDE\x10\x03\x62\x06proto3"
|
9
|
+
|
10
|
+
pool = Google::Protobuf::DescriptorPool.generated_pool
|
11
|
+
|
12
|
+
begin
|
13
|
+
pool.add_serialized_file(descriptor_data)
|
14
|
+
rescue TypeError => e
|
15
|
+
# Compatibility code: will be removed in the next major version.
|
16
|
+
require 'google/protobuf/descriptor_pb'
|
17
|
+
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
18
|
+
parsed.clear_dependency
|
19
|
+
serialized = parsed.class.encode(parsed)
|
20
|
+
file = pool.add_serialized_file(serialized)
|
21
|
+
warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
|
22
|
+
imports = [
|
23
|
+
]
|
24
|
+
imports.each do |type_name, expected_filename|
|
25
|
+
import_file = pool.lookup(type_name).file_descriptor
|
26
|
+
if import_file.name != expected_filename
|
27
|
+
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
297
28
|
end
|
298
29
|
end
|
30
|
+
warn "Each proto file must use a consistent fully-qualified name."
|
31
|
+
warn "This will become an error in the next major version."
|
299
32
|
end
|
300
33
|
|
301
34
|
module Sass
|
data/lib/sass/compile_error.rb
CHANGED
@@ -4,25 +4,27 @@ module Sass
|
|
4
4
|
# An exception thrown because a Sass compilation failed.
|
5
5
|
class CompileError < StandardError
|
6
6
|
# @return [String, nil]
|
7
|
-
|
7
|
+
attr_reader :sass_stack
|
8
8
|
|
9
9
|
# @return [Logger::SourceSpan, nil]
|
10
|
-
|
10
|
+
attr_reader :span
|
11
11
|
|
12
|
-
|
12
|
+
# @return [Array<String>]
|
13
|
+
attr_reader :loaded_urls
|
14
|
+
|
15
|
+
def initialize(message, full_message, sass_stack, span, loaded_urls)
|
13
16
|
super(message)
|
14
|
-
@full_message = full_message
|
15
|
-
@sass_stack = sass_stack
|
17
|
+
@full_message = full_message
|
18
|
+
@sass_stack = sass_stack
|
16
19
|
@span = span
|
20
|
+
@loaded_urls = loaded_urls
|
17
21
|
end
|
18
22
|
|
19
23
|
# @return [String]
|
20
24
|
def full_message(...)
|
21
|
-
if @full_message.nil?
|
22
|
-
|
23
|
-
|
24
|
-
@full_message
|
25
|
-
end
|
25
|
+
return super(...) if @full_message.nil?
|
26
|
+
|
27
|
+
@full_message = +@full_message
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
data/lib/sass/compile_result.rb
CHANGED
data/lib/sass/elf.rb
ADDED
@@ -0,0 +1,276 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sass
|
4
|
+
# The {ELF} class.
|
5
|
+
#
|
6
|
+
# It parses ELF header to extract interpreter.
|
7
|
+
# @see https://github.com/torvalds/linux/blob/HEAD/include/uapi/linux/elf.h
|
8
|
+
# @see https://github.com/torvalds/linux/blob/HEAD/kernel/kexec_elf.c
|
9
|
+
class ELF
|
10
|
+
# rubocop:disable Naming/ConstantName
|
11
|
+
|
12
|
+
# 32-bit ELF base types.
|
13
|
+
Elf32_Addr = :__u32
|
14
|
+
Elf32_Half = :__u16
|
15
|
+
Elf32_Off = :__u32
|
16
|
+
Elf32_Sword = :__s32
|
17
|
+
Elf32_Word = :__u32
|
18
|
+
|
19
|
+
# 64-bit ELF base types.
|
20
|
+
Elf64_Addr = :__u64
|
21
|
+
Elf64_Half = :__u16
|
22
|
+
Elf64_SHalf = :__s16
|
23
|
+
Elf64_Off = :__u64
|
24
|
+
Elf64_Sword = :__s32
|
25
|
+
Elf64_Word = :__u32
|
26
|
+
Elf64_Xword = :__u64
|
27
|
+
Elf64_Sxword = :__s64
|
28
|
+
|
29
|
+
# rubocop:enable Naming/ConstantName
|
30
|
+
|
31
|
+
# These constants are for the segment types stored in the image headers
|
32
|
+
PT_NULL = 0
|
33
|
+
PT_LOAD = 1
|
34
|
+
PT_DYNAMIC = 2
|
35
|
+
PT_INTERP = 3
|
36
|
+
PT_NOTE = 4
|
37
|
+
PT_SHLIB = 5
|
38
|
+
PT_PHDR = 6
|
39
|
+
PT_TLS = 7
|
40
|
+
PT_LOOS = 0x60000000
|
41
|
+
PT_HIOS = 0x6fffffff
|
42
|
+
PT_LOPROC = 0x70000000
|
43
|
+
PT_HIPROC = 0x7fffffff
|
44
|
+
PT_GNU_EH_FRAME = (PT_LOOS + 0x474e550)
|
45
|
+
PT_GNU_STACK = (PT_LOOS + 0x474e551)
|
46
|
+
PT_GNU_RELRO = (PT_LOOS + 0x474e552)
|
47
|
+
PT_GNU_PROPERTY = (PT_LOOS + 0x474e553)
|
48
|
+
|
49
|
+
# These constants define the different elf file types
|
50
|
+
ET_NONE = 0
|
51
|
+
ET_REL = 1
|
52
|
+
ET_EXEC = 2
|
53
|
+
ET_DYN = 3
|
54
|
+
ET_CORE = 4
|
55
|
+
ET_LOPROC = 0xff00
|
56
|
+
ET_HIPROC = 0xffff
|
57
|
+
|
58
|
+
EI_NIDENT = 16
|
59
|
+
|
60
|
+
# rubocop:disable Naming/ConstantName
|
61
|
+
|
62
|
+
Elf32_Ehdr = [
|
63
|
+
[:unsigned_char, :e_ident, EI_NIDENT],
|
64
|
+
[Elf32_Half, :e_type],
|
65
|
+
[Elf32_Half, :e_machine],
|
66
|
+
[Elf32_Word, :e_version],
|
67
|
+
[Elf32_Addr, :e_entry],
|
68
|
+
[Elf32_Off, :e_phoff],
|
69
|
+
[Elf32_Off, :e_shoff],
|
70
|
+
[Elf32_Word, :e_flags],
|
71
|
+
[Elf32_Half, :e_ehsize],
|
72
|
+
[Elf32_Half, :e_phentsize],
|
73
|
+
[Elf32_Half, :e_phnum],
|
74
|
+
[Elf32_Half, :e_shentsize],
|
75
|
+
[Elf32_Half, :e_shnum],
|
76
|
+
[Elf32_Half, :e_shstrndx]
|
77
|
+
].freeze
|
78
|
+
|
79
|
+
Elf64_Ehdr = [
|
80
|
+
[:unsigned_char, :e_ident, EI_NIDENT],
|
81
|
+
[Elf64_Half, :e_type],
|
82
|
+
[Elf64_Half, :e_machine],
|
83
|
+
[Elf64_Word, :e_version],
|
84
|
+
[Elf64_Addr, :e_entry],
|
85
|
+
[Elf64_Off, :e_phoff],
|
86
|
+
[Elf64_Off, :e_shoff],
|
87
|
+
[Elf64_Word, :e_flags],
|
88
|
+
[Elf64_Half, :e_ehsize],
|
89
|
+
[Elf64_Half, :e_phentsize],
|
90
|
+
[Elf64_Half, :e_phnum],
|
91
|
+
[Elf64_Half, :e_shentsize],
|
92
|
+
[Elf64_Half, :e_shnum],
|
93
|
+
[Elf64_Half, :e_shstrndx]
|
94
|
+
].freeze
|
95
|
+
|
96
|
+
Elf32_Phdr = [
|
97
|
+
[Elf32_Word, :p_type],
|
98
|
+
[Elf32_Off, :p_offset],
|
99
|
+
[Elf32_Addr, :p_vaddr],
|
100
|
+
[Elf32_Addr, :p_paddr],
|
101
|
+
[Elf32_Word, :p_filesz],
|
102
|
+
[Elf32_Word, :p_memsz],
|
103
|
+
[Elf32_Word, :p_flags],
|
104
|
+
[Elf32_Word, :p_align]
|
105
|
+
].freeze
|
106
|
+
|
107
|
+
Elf64_Phdr = [
|
108
|
+
[Elf64_Word, :p_type],
|
109
|
+
[Elf64_Word, :p_flags],
|
110
|
+
[Elf64_Off, :p_offset],
|
111
|
+
[Elf64_Addr, :p_vaddr],
|
112
|
+
[Elf64_Addr, :p_paddr],
|
113
|
+
[Elf64_Xword, :p_filesz],
|
114
|
+
[Elf64_Xword, :p_memsz],
|
115
|
+
[Elf64_Xword, :p_align]
|
116
|
+
].freeze
|
117
|
+
|
118
|
+
# rubocop:enable Naming/ConstantName
|
119
|
+
|
120
|
+
# e_ident[] indexes
|
121
|
+
EI_MAG0 = 0
|
122
|
+
EI_MAG1 = 1
|
123
|
+
EI_MAG2 = 2
|
124
|
+
EI_MAG3 = 3
|
125
|
+
EI_CLASS = 4
|
126
|
+
EI_DATA = 5
|
127
|
+
EI_VERSION = 6
|
128
|
+
EI_OSABI = 7
|
129
|
+
EI_PAD = 8
|
130
|
+
|
131
|
+
# EI_MAG
|
132
|
+
ELFMAG0 = 0x7f
|
133
|
+
ELFMAG1 = 'E'.ord
|
134
|
+
ELFMAG2 = 'L'.ord
|
135
|
+
ELFMAG3 = 'F'.ord
|
136
|
+
ELFMAG = [ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3].pack('C*')
|
137
|
+
SELFMAG = 4
|
138
|
+
|
139
|
+
# e_ident[EI_CLASS]
|
140
|
+
ELFCLASSNONE = 0
|
141
|
+
ELFCLASS32 = 1
|
142
|
+
ELFCLASS64 = 2
|
143
|
+
ELFCLASSNUM = 3
|
144
|
+
|
145
|
+
# e_ident[EI_DATA]
|
146
|
+
ELFDATANONE = 0
|
147
|
+
ELFDATA2LSB = 1
|
148
|
+
ELFDATA2MSB = 2
|
149
|
+
|
150
|
+
def initialize(buffer)
|
151
|
+
@buffer = buffer
|
152
|
+
@ehdr = read_ehdr
|
153
|
+
@buffer.seek(@ehdr[:e_phoff], :SET)
|
154
|
+
@proghdrs = Array.new(@ehdr[:e_phnum]) do
|
155
|
+
read_phdr
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def relocatable?
|
160
|
+
@ehdr[:e_type] == ET_REL
|
161
|
+
end
|
162
|
+
|
163
|
+
def executable?
|
164
|
+
@ehdr[:e_type] == ET_EXEC
|
165
|
+
end
|
166
|
+
|
167
|
+
def shared_object?
|
168
|
+
@ehdr[:e_type] == ET_DYN
|
169
|
+
end
|
170
|
+
|
171
|
+
def core?
|
172
|
+
@ehdr[:e_type] == ET_CORE
|
173
|
+
end
|
174
|
+
|
175
|
+
def interpreter
|
176
|
+
phdr = @proghdrs.find { |p| p[:p_type] == PT_INTERP }
|
177
|
+
return if phdr.nil?
|
178
|
+
|
179
|
+
@buffer.seek(phdr[:p_offset], :SET)
|
180
|
+
interpreter = @buffer.read(phdr[:p_filesz])
|
181
|
+
raise ArgumentError unless interpreter.end_with?("\0")
|
182
|
+
|
183
|
+
interpreter.chomp!("\0")
|
184
|
+
end
|
185
|
+
|
186
|
+
private
|
187
|
+
|
188
|
+
def file_class
|
189
|
+
@ehdr[:e_ident][EI_CLASS]
|
190
|
+
end
|
191
|
+
|
192
|
+
def data_encoding
|
193
|
+
@ehdr[:e_ident][EI_DATA]
|
194
|
+
end
|
195
|
+
|
196
|
+
def read_ehdr
|
197
|
+
@ehdr = { e_ident: @buffer.read(EI_NIDENT).unpack('C*') }
|
198
|
+
raise ArgumentError unless @ehdr[:e_ident].slice(EI_MAG0, SELFMAG).pack('C*') == ELFMAG
|
199
|
+
|
200
|
+
case file_class
|
201
|
+
when ELFCLASS32
|
202
|
+
Elf32_Ehdr
|
203
|
+
when ELFCLASS64
|
204
|
+
Elf64_Ehdr
|
205
|
+
else
|
206
|
+
raise ArgumentError
|
207
|
+
end.drop(1).to_h do |field|
|
208
|
+
[field[1], read1(field[0])]
|
209
|
+
end.merge!(@ehdr)
|
210
|
+
end
|
211
|
+
|
212
|
+
def read_phdr
|
213
|
+
case file_class
|
214
|
+
when ELFCLASS32
|
215
|
+
Elf32_Phdr
|
216
|
+
when ELFCLASS64
|
217
|
+
Elf64_Phdr
|
218
|
+
else
|
219
|
+
raise ArgumentError
|
220
|
+
end.to_h do |field|
|
221
|
+
[field[1], read1(field[0])]
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
def explicit_endian
|
226
|
+
case data_encoding
|
227
|
+
when ELFDATA2LSB
|
228
|
+
'<'
|
229
|
+
when ELFDATA2MSB
|
230
|
+
'>'
|
231
|
+
else
|
232
|
+
raise ArgumentError
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
def read1(type)
|
237
|
+
case type
|
238
|
+
when :__u8
|
239
|
+
@buffer.read(1).unpack1('C')
|
240
|
+
when :__u16
|
241
|
+
@buffer.read(2).unpack1("S#{explicit_endian}")
|
242
|
+
when :__u32
|
243
|
+
@buffer.read(4).unpack1("L#{explicit_endian}")
|
244
|
+
when :__u64
|
245
|
+
@buffer.read(8).unpack1("Q#{explicit_endian}")
|
246
|
+
when :__s8
|
247
|
+
@buffer.read(1).unpack1('c')
|
248
|
+
when :__s16
|
249
|
+
@buffer.read(2).unpack1("s#{explicit_endian}")
|
250
|
+
when :__s32
|
251
|
+
@buffer.read(4).unpack1("l#{explicit_endian}")
|
252
|
+
when :__s64
|
253
|
+
@buffer.read(8).unpack1("q#{explicit_endian}")
|
254
|
+
else
|
255
|
+
raise ArgumentError
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
INTERPRETER = begin
|
260
|
+
proc_self_exe = '/proc/self/exe'
|
261
|
+
if File.exist?(proc_self_exe)
|
262
|
+
File.open(proc_self_exe, 'rb') do |file|
|
263
|
+
elf = ELF.new(file)
|
264
|
+
interpreter = elf.interpreter
|
265
|
+
if interpreter.nil? && elf.shared_object?
|
266
|
+
File.readlink(proc_self_exe)
|
267
|
+
else
|
268
|
+
interpreter
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
private_constant :ELF
|
276
|
+
end
|
@@ -27,7 +27,7 @@ module Sass
|
|
27
27
|
@mutex.synchronize do
|
28
28
|
begin
|
29
29
|
id = @dispatcher.subscribe(observer)
|
30
|
-
rescue
|
30
|
+
rescue Errno::EBUSY
|
31
31
|
@dispatcher = Dispatcher.new
|
32
32
|
id = @dispatcher.subscribe(observer)
|
33
33
|
end
|
@@ -48,8 +48,8 @@ module Sass
|
|
48
48
|
@dispatcher.unsubscribe(id)
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
52
|
-
@dispatcher.
|
51
|
+
def send_proto(...)
|
52
|
+
@dispatcher.send_proto(...)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|