sass-embedded 1.77.5 → 1.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +18 -17
- data/README.md +1 -1
- data/exe/sass +2 -10
- data/ext/sass/Rakefile +162 -385
- data/ext/sass/file_utils.rb +75 -0
- data/ext/sass/package.json +1 -1
- data/ext/sass/platform.rb +44 -0
- data/ext/sass/sass-1.100.0.tgz +0 -0
- data/ext/sass/sass_config.rb +183 -0
- data/ext/sass/utils.rb +39 -0
- data/lib/sass/compiler/channel.rb +6 -4
- data/lib/sass/compiler/connection.rb +17 -21
- data/lib/sass/compiler/dispatcher.rb +27 -1
- data/lib/sass/compiler/host/function_registry.rb +6 -6
- data/lib/sass/compiler/host/importer_registry.rb +17 -11
- data/lib/sass/compiler/host/logger_registry.rb +17 -20
- data/lib/sass/compiler/host/protofier.rb +59 -73
- data/lib/sass/compiler/host/struct.rb +36 -0
- data/lib/sass/compiler/host.rb +2 -2
- data/lib/sass/compiler.rb +4 -3
- data/lib/sass/elf.rb +282 -172
- data/lib/sass/embedded/version.rb +1 -1
- data/lib/sass/embedded.rb +2 -41
- data/lib/sass/embedded_protocol.rb +1 -1
- data/{ext → lib}/sass/embedded_sass_pb.rb +3 -5
- data/lib/sass/exception.rb +7 -2
- data/lib/sass/fork_tracker.rb +36 -28
- data/lib/sass/gem_package_importer.rb +19 -0
- data/lib/sass/serializer.rb +5 -11
- data/lib/sass/value/argument_list.rb +0 -8
- data/lib/sass/value/color/channel.rb +79 -0
- data/lib/sass/value/color/conversions.rb +473 -0
- data/lib/sass/value/color/gamut_map_method/clip.rb +45 -0
- data/lib/sass/value/color/gamut_map_method/local_minde.rb +94 -0
- data/lib/sass/value/color/gamut_map_method.rb +45 -0
- data/lib/sass/value/color/interpolation_method.rb +51 -0
- data/lib/sass/value/color/space/a98_rgb.rb +57 -0
- data/lib/sass/value/color/space/display_p3.rb +72 -0
- data/lib/sass/value/color/space/display_p3_linear.rb +72 -0
- data/lib/sass/value/color/space/hsl.rb +65 -0
- data/lib/sass/value/color/space/hwb.rb +70 -0
- data/lib/sass/value/color/space/lab.rb +77 -0
- data/lib/sass/value/color/space/lch.rb +53 -0
- data/lib/sass/value/color/space/lms.rb +129 -0
- data/lib/sass/value/color/space/oklab.rb +66 -0
- data/lib/sass/value/color/space/oklch.rb +54 -0
- data/lib/sass/value/color/space/prophoto_rgb.rb +59 -0
- data/lib/sass/value/color/space/rec2020.rb +69 -0
- data/lib/sass/value/color/space/rgb.rb +52 -0
- data/lib/sass/value/color/space/srgb.rb +140 -0
- data/lib/sass/value/color/space/srgb_linear.rb +72 -0
- data/lib/sass/value/color/space/utils.rb +86 -0
- data/lib/sass/value/color/space/xyz_d50.rb +100 -0
- data/lib/sass/value/color/space/xyz_d65.rb +57 -0
- data/lib/sass/value/color/space.rb +201 -0
- data/lib/sass/value/color.rb +539 -162
- data/lib/sass/value/function.rb +9 -6
- data/lib/sass/value/fuzzy_math.rb +34 -30
- data/lib/sass/value/mixin.rb +5 -2
- data/lib/sass/value/null.rb +1 -1
- data/lib/sass/value/number/unit.rb +5 -4
- data/lib/sass/value/number.rb +15 -17
- data/lib/sass/value/string.rb +1 -1
- data/lib/sass/value.rb +1 -1
- metadata +42 -21
- data/ext/sass/expand-archive.ps1 +0 -1
- data/lib/sass/compiler/host/structifier.rb +0 -37
data/lib/sass/elf.rb
CHANGED
|
@@ -7,26 +7,33 @@ module Sass
|
|
|
7
7
|
# @see https://github.com/torvalds/linux/blob/HEAD/include/uapi/linux/elf.h
|
|
8
8
|
# @see https://github.com/torvalds/linux/blob/HEAD/kernel/kexec_elf.c
|
|
9
9
|
class ELF
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
# The {PackInfo} class.
|
|
11
|
+
class PackInfo
|
|
12
|
+
def initialize(format:, sizeof:, struct:)
|
|
13
|
+
@format_le = format.freeze
|
|
14
|
+
@format_be = format.tr('<', '>').freeze
|
|
15
|
+
@sizeof = sizeof.freeze
|
|
16
|
+
@struct = struct.freeze
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
attr_reader :sizeof
|
|
20
|
+
|
|
21
|
+
def pack(io, data, little_endian)
|
|
22
|
+
raise ArgumentError if io.write(data.values_at(*@struct).pack(format(little_endian))) != @sizeof
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def unpack(io, little_endian)
|
|
26
|
+
@struct.zip(io.read(@sizeof).unpack(format(little_endian))).to_h
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def format(little_endian)
|
|
32
|
+
little_endian ? @format_le : @format_be
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private_constant :PackInfo
|
|
30
37
|
|
|
31
38
|
# These constants are for the segment types stored in the image headers
|
|
32
39
|
PT_NULL = 0
|
|
@@ -41,10 +48,8 @@ module Sass
|
|
|
41
48
|
PT_HIOS = 0x6fffffff
|
|
42
49
|
PT_LOPROC = 0x70000000
|
|
43
50
|
PT_HIPROC = 0x7fffffff
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
PT_GNU_RELRO = (PT_LOOS + 0x474e552)
|
|
47
|
-
PT_GNU_PROPERTY = (PT_LOOS + 0x474e553)
|
|
51
|
+
|
|
52
|
+
PN_XNUM = 0xffff
|
|
48
53
|
|
|
49
54
|
# These constants define the different elf file types
|
|
50
55
|
ET_NONE = 0
|
|
@@ -57,65 +62,153 @@ module Sass
|
|
|
57
62
|
|
|
58
63
|
EI_NIDENT = 16
|
|
59
64
|
|
|
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
|
-
|
|
65
|
+
Elf32_Ehdr = PackInfo.new(
|
|
66
|
+
format: "a#{EI_NIDENT}S<2L<5S<6",
|
|
67
|
+
sizeof: 52,
|
|
68
|
+
struct: %i[
|
|
69
|
+
e_ident
|
|
70
|
+
e_type
|
|
71
|
+
e_machine
|
|
72
|
+
e_version
|
|
73
|
+
e_entry
|
|
74
|
+
e_phoff
|
|
75
|
+
e_shoff
|
|
76
|
+
e_flags
|
|
77
|
+
e_ehsize
|
|
78
|
+
e_phentsize
|
|
79
|
+
e_phnum
|
|
80
|
+
e_shentsize
|
|
81
|
+
e_shnum
|
|
82
|
+
e_shstrndx
|
|
83
|
+
]
|
|
84
|
+
).freeze
|
|
85
|
+
|
|
86
|
+
Elf64_Ehdr = PackInfo.new(
|
|
87
|
+
format: "a#{EI_NIDENT}S<2L<Q<3L<S<6",
|
|
88
|
+
sizeof: 64,
|
|
89
|
+
struct: %i[
|
|
90
|
+
e_ident
|
|
91
|
+
e_type
|
|
92
|
+
e_machine
|
|
93
|
+
e_version
|
|
94
|
+
e_entry
|
|
95
|
+
e_phoff
|
|
96
|
+
e_shoff
|
|
97
|
+
e_flags
|
|
98
|
+
e_ehsize
|
|
99
|
+
e_phentsize
|
|
100
|
+
e_phnum
|
|
101
|
+
e_shentsize
|
|
102
|
+
e_shnum
|
|
103
|
+
e_shstrndx
|
|
104
|
+
]
|
|
105
|
+
).freeze
|
|
106
|
+
|
|
107
|
+
# These constants define the permissions on sections in the program header, p_flags.
|
|
108
|
+
PF_R = 0x4
|
|
109
|
+
PF_W = 0x2
|
|
110
|
+
PF_X = 0x1
|
|
111
|
+
|
|
112
|
+
Elf32_Phdr = PackInfo.new(
|
|
113
|
+
format: 'L<8',
|
|
114
|
+
sizeof: 32,
|
|
115
|
+
struct: %i[
|
|
116
|
+
p_type
|
|
117
|
+
p_offset
|
|
118
|
+
p_vaddr
|
|
119
|
+
p_paddr
|
|
120
|
+
p_filesz
|
|
121
|
+
p_memsz
|
|
122
|
+
p_flags
|
|
123
|
+
p_align
|
|
124
|
+
]
|
|
125
|
+
).freeze
|
|
126
|
+
|
|
127
|
+
Elf64_Phdr = PackInfo.new(
|
|
128
|
+
format: 'L<2Q<6',
|
|
129
|
+
sizeof: 56,
|
|
130
|
+
struct: %i[
|
|
131
|
+
p_type
|
|
132
|
+
p_flags
|
|
133
|
+
p_offset
|
|
134
|
+
p_vaddr
|
|
135
|
+
p_paddr
|
|
136
|
+
p_filesz
|
|
137
|
+
p_memsz
|
|
138
|
+
p_align
|
|
139
|
+
]
|
|
140
|
+
).freeze
|
|
141
|
+
|
|
142
|
+
# sh_type
|
|
143
|
+
SHT_NULL = 0
|
|
144
|
+
SHT_PROGBITS = 1
|
|
145
|
+
SHT_SYMTAB = 2
|
|
146
|
+
SHT_STRTAB = 3
|
|
147
|
+
SHT_RELA = 4
|
|
148
|
+
SHT_HASH = 5
|
|
149
|
+
SHT_DYNAMIC = 6
|
|
150
|
+
SHT_NOTE = 7
|
|
151
|
+
SHT_NOBITS = 8
|
|
152
|
+
SHT_REL = 9
|
|
153
|
+
SHT_SHLIB = 10
|
|
154
|
+
SHT_DYNSYM = 11
|
|
155
|
+
SHT_NUM = 12
|
|
156
|
+
SHT_LOPROC = 0x70000000
|
|
157
|
+
SHT_HIPROC = 0x7fffffff
|
|
158
|
+
SHT_LOUSER = 0x80000000
|
|
159
|
+
SHT_HIUSER = 0xffffffff
|
|
160
|
+
|
|
161
|
+
# sh_flags
|
|
162
|
+
SHF_WRITE = 0x1
|
|
163
|
+
SHF_ALLOC = 0x2
|
|
164
|
+
SHF_EXECINSTR = 0x4
|
|
165
|
+
SHF_RELA_LIVEPATCH = 0x00100000
|
|
166
|
+
SHF_RO_AFTER_INIT = 0x00200000
|
|
167
|
+
SHF_MASKPROC = 0xf0000000
|
|
168
|
+
|
|
169
|
+
# special section indexes
|
|
170
|
+
SHN_UNDEF = 0
|
|
171
|
+
SHN_LORESERVE = 0xff00
|
|
172
|
+
SHN_LOPROC = 0xff00
|
|
173
|
+
SHN_HIPROC = 0xff1f
|
|
174
|
+
SHN_LIVEPATCH = 0xff20
|
|
175
|
+
SHN_ABS = 0xfff1
|
|
176
|
+
SHN_COMMON = 0xfff2
|
|
177
|
+
SHN_HIRESERVE = 0xffff
|
|
178
|
+
|
|
179
|
+
Elf32_Shdr = PackInfo.new(
|
|
180
|
+
format: 'L<10',
|
|
181
|
+
sizeof: 40,
|
|
182
|
+
struct: %i[
|
|
183
|
+
sh_name
|
|
184
|
+
sh_type
|
|
185
|
+
sh_flags
|
|
186
|
+
sh_addr
|
|
187
|
+
sh_offset
|
|
188
|
+
sh_size
|
|
189
|
+
sh_link
|
|
190
|
+
sh_info
|
|
191
|
+
sh_addralign
|
|
192
|
+
sh_entsize
|
|
193
|
+
]
|
|
194
|
+
).freeze
|
|
195
|
+
|
|
196
|
+
Elf64_Shdr = PackInfo.new(
|
|
197
|
+
format: 'L<2Q<4L<2Q<2',
|
|
198
|
+
sizeof: 64,
|
|
199
|
+
struct: %i[
|
|
200
|
+
sh_name
|
|
201
|
+
sh_type
|
|
202
|
+
sh_flags
|
|
203
|
+
sh_addr
|
|
204
|
+
sh_offset
|
|
205
|
+
sh_size
|
|
206
|
+
sh_link
|
|
207
|
+
sh_info
|
|
208
|
+
sh_addralign
|
|
209
|
+
sh_entsize
|
|
210
|
+
]
|
|
211
|
+
).freeze
|
|
119
212
|
|
|
120
213
|
# e_ident[] indexes
|
|
121
214
|
EI_MAG0 = 0
|
|
@@ -130,9 +223,9 @@ module Sass
|
|
|
130
223
|
|
|
131
224
|
# EI_MAG
|
|
132
225
|
ELFMAG0 = 0x7f
|
|
133
|
-
ELFMAG1 =
|
|
134
|
-
ELFMAG2 =
|
|
135
|
-
ELFMAG3 =
|
|
226
|
+
ELFMAG1 = 0x45
|
|
227
|
+
ELFMAG2 = 0x4c
|
|
228
|
+
ELFMAG3 = 0x46
|
|
136
229
|
ELFMAG = [ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3].pack('C*')
|
|
137
230
|
SELFMAG = 4
|
|
138
231
|
|
|
@@ -147,13 +240,106 @@ module Sass
|
|
|
147
240
|
ELFDATA2LSB = 1
|
|
148
241
|
ELFDATA2MSB = 2
|
|
149
242
|
|
|
150
|
-
def initialize(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
243
|
+
def initialize(io, program_headers: true, section_headers: false)
|
|
244
|
+
io.rewind
|
|
245
|
+
e_ident = io.read(EI_NIDENT).unpack('C*')
|
|
246
|
+
raise ArgumentError unless e_ident.slice(EI_MAG0, SELFMAG).pack('C*') == ELFMAG
|
|
247
|
+
|
|
248
|
+
case e_ident[EI_CLASS]
|
|
249
|
+
when ELFCLASS32
|
|
250
|
+
elf_ehdr = Elf32_Ehdr
|
|
251
|
+
elf_phdr = Elf32_Phdr
|
|
252
|
+
elf_shdr = Elf32_Shdr
|
|
253
|
+
when ELFCLASS64
|
|
254
|
+
elf_ehdr = Elf64_Ehdr
|
|
255
|
+
elf_phdr = Elf64_Phdr
|
|
256
|
+
elf_shdr = Elf64_Shdr
|
|
257
|
+
else
|
|
258
|
+
raise EncodingError
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
case e_ident[EI_DATA]
|
|
262
|
+
when ELFDATA2LSB
|
|
263
|
+
little_endian = true
|
|
264
|
+
when ELFDATA2MSB
|
|
265
|
+
little_endian = false
|
|
266
|
+
else
|
|
267
|
+
raise EncodingError
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
io.rewind
|
|
271
|
+
ehdr = elf_ehdr.unpack(io, little_endian)
|
|
272
|
+
ehdr[:e_ident] = e_ident
|
|
273
|
+
|
|
274
|
+
phdrs = if program_headers && ehdr[:e_phnum].positive?
|
|
275
|
+
io.seek(ehdr[:e_phoff], IO::SEEK_SET)
|
|
276
|
+
Array.new(ehdr[:e_phnum]) do
|
|
277
|
+
elf_phdr.unpack(io, little_endian)
|
|
278
|
+
end
|
|
279
|
+
else
|
|
280
|
+
[]
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
shdrs = if section_headers && ehdr[:e_shnum].positive?
|
|
284
|
+
io.seek(ehdr[:e_shoff], IO::SEEK_SET)
|
|
285
|
+
Array.new(ehdr[:e_shnum]) do
|
|
286
|
+
elf_shdr.unpack(io, little_endian)
|
|
287
|
+
end
|
|
288
|
+
else
|
|
289
|
+
[]
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
@io = io
|
|
293
|
+
@ehdr = ehdr
|
|
294
|
+
@phdrs = phdrs
|
|
295
|
+
@shdrs = shdrs
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
def dump(io)
|
|
299
|
+
e_ident = @ehdr[:e_ident]
|
|
300
|
+
raise ArgumentError unless e_ident.slice(EI_MAG0, SELFMAG).pack('C*') == ELFMAG
|
|
301
|
+
|
|
302
|
+
ehdr = @ehdr.dup
|
|
303
|
+
ehdr[:e_ident] = e_ident.pack('C*')
|
|
304
|
+
phdrs = @phdrs
|
|
305
|
+
shdrs = @shdrs
|
|
306
|
+
|
|
307
|
+
case e_ident[EI_CLASS]
|
|
308
|
+
when ELFCLASS32
|
|
309
|
+
elf_ehdr = Elf32_Ehdr
|
|
310
|
+
elf_phdr = Elf32_Phdr
|
|
311
|
+
elf_shdr = Elf32_Shdr
|
|
312
|
+
when ELFCLASS64
|
|
313
|
+
elf_ehdr = Elf64_Ehdr
|
|
314
|
+
elf_phdr = Elf64_Phdr
|
|
315
|
+
elf_shdr = Elf64_Shdr
|
|
316
|
+
else
|
|
317
|
+
raise EncodingError
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
case e_ident[EI_DATA]
|
|
321
|
+
when ELFDATA2LSB
|
|
322
|
+
little_endian = true
|
|
323
|
+
when ELFDATA2MSB
|
|
324
|
+
little_endian = false
|
|
325
|
+
else
|
|
326
|
+
raise EncodingError
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
io.rewind
|
|
330
|
+
elf_ehdr.pack(io, ehdr, little_endian)
|
|
331
|
+
|
|
332
|
+
io.seek(ehdr[:e_phoff], IO::SEEK_SET) if ehdr[:e_phnum].positive?
|
|
333
|
+
phdrs.each do |phdr|
|
|
334
|
+
elf_phdr.pack(io, phdr, little_endian)
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
io.seek(ehdr[:e_shoff], IO::SEEK_SET) if ehdr[:e_shnum].positive?
|
|
338
|
+
shdrs.each do |shdr|
|
|
339
|
+
elf_shdr.pack(io, shdr, little_endian)
|
|
156
340
|
end
|
|
341
|
+
|
|
342
|
+
io.flush
|
|
157
343
|
end
|
|
158
344
|
|
|
159
345
|
def relocatable?
|
|
@@ -173,87 +359,11 @@ module Sass
|
|
|
173
359
|
end
|
|
174
360
|
|
|
175
361
|
def interpreter
|
|
176
|
-
phdr = @
|
|
362
|
+
phdr = @phdrs.find { |p| p[:p_type] == PT_INTERP }
|
|
177
363
|
return if phdr.nil?
|
|
178
364
|
|
|
179
|
-
@
|
|
180
|
-
|
|
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
|
|
365
|
+
@io.seek(phdr[:p_offset], IO::SEEK_SET)
|
|
366
|
+
@io.read(phdr[:p_filesz]).unpack1('Z*')
|
|
257
367
|
end
|
|
258
368
|
|
|
259
369
|
INTERPRETER = begin
|
|
@@ -269,7 +379,7 @@ module Sass
|
|
|
269
379
|
end
|
|
270
380
|
end
|
|
271
381
|
end
|
|
272
|
-
end
|
|
382
|
+
end.freeze
|
|
273
383
|
end
|
|
274
384
|
|
|
275
385
|
private_constant :ELF
|
data/lib/sass/embedded.rb
CHANGED
|
@@ -53,47 +53,8 @@ module Sass
|
|
|
53
53
|
@mutex.synchronize do
|
|
54
54
|
return @compiler if @compiler
|
|
55
55
|
|
|
56
|
-
compiler =
|
|
57
|
-
|
|
58
|
-
@channel = Compiler.const_get(:Channel).new(Class.new(Compiler.const_get(:Dispatcher)) do
|
|
59
|
-
def initialize
|
|
60
|
-
super
|
|
61
|
-
|
|
62
|
-
idle_timeout = 10
|
|
63
|
-
@last_accessed_time = current_time
|
|
64
|
-
|
|
65
|
-
Thread.new do
|
|
66
|
-
Thread.current.name = 'sass-embedded-process-reaper'
|
|
67
|
-
duration = idle_timeout
|
|
68
|
-
loop do
|
|
69
|
-
sleep(duration.negative? ? idle_timeout : duration)
|
|
70
|
-
break if @mutex.synchronize do
|
|
71
|
-
raise Errno::EBUSY if _closed?
|
|
72
|
-
|
|
73
|
-
duration = idle_timeout - (current_time - @last_accessed_time)
|
|
74
|
-
duration.negative? && _idle? && _close
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
close
|
|
78
|
-
rescue Errno::EBUSY
|
|
79
|
-
# do nothing
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
private
|
|
84
|
-
|
|
85
|
-
def _idle
|
|
86
|
-
super
|
|
87
|
-
|
|
88
|
-
@last_accessed_time = current_time
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def current_time
|
|
92
|
-
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
93
|
-
end
|
|
94
|
-
end)
|
|
95
|
-
end
|
|
96
|
-
end.new
|
|
56
|
+
compiler = Compiler.allocate
|
|
57
|
+
compiler.instance_variable_set(:@channel, Compiler.const_get(:Channel).new(idle_timeout: 10))
|
|
97
58
|
|
|
98
59
|
at_exit do
|
|
99
60
|
compiler.close
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
require 'google/protobuf'
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
descriptor_data = "\n\x13\x65mbedded_sass.proto\x12\x16sass.embedded_protocol\"\xe8\x10\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\x98\x07\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\x12\x0e\n\x06silent\x18\x0e \x01(\x08\x12\x19\n\x11\x66\x61tal_deprecation\x18\x0f \x03(\t\x12\x1b\n\x13silence_deprecation\x18\x10 \x03(\t\x12\x1a\n\x12\x66uture_deprecation\x18\x11 \x03(\t\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\x1a\xc5\x01\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\x12L\n\x15node_package_importer\x18\x05 \x01(\x0b\x32+.sass.embedded_protocol.NodePackageImporterH\x00\x12\x1c\n\x14non_canonical_scheme\x18\x04 \x03(\tB\n\n\x08importerB\x07\n\x05inputJ\x04\x08\x01\x10\x02\x1ak\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\x12\x1d\n\x15\x63ontaining_url_unused\x18\x04 \x01(\x08\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\x1an\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\x12\x1d\n\x15\x63ontaining_url_unused\x18\x04 \x01(\x08\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\"\xcb\x0f\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\xf1\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(\t\x12\x1d\n\x10\x64\x65precation_type\x18\x07 \x01(\tH\x01\x88\x01\x01\x42\x07\n\x05_spanB\x13\n\x11_deprecation_typeJ\x04\x08\x01\x10\x02\x1a\x8e\x01\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(\x08\x12\x1b\n\x0e\x63ontaining_url\x18\x06 \x01(\tH\x00\x88\x01\x01\x42\x11\n\x0f_containing_urlJ\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\x8c\x01\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(\x08\x12\x1b\n\x0e\x63ontaining_url\x18\x06 \x01(\tH\x00\x88\x01\x01\x42\x11\n\x0f_containing_urlJ\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\"\xb8\x13\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\x12\x45\n\x0e\x63ompiler_mixin\x18\r \x01(\x0b\x32+.sass.embedded_protocol.Value.CompilerMixinH\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\x1b\n\rCompilerMixin\x12\n\n\x02id\x18\x01 \x01(\r\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\"4\n\x13NodePackageImporter\x12\x1d\n\x15\x65ntry_point_directory\x18\x01 \x01(\t*+\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\x42#\n\x1f\x63om.sass_lang.embedded_protocolP\x01\x62\x06proto3"
|
|
8
|
+
descriptor_data = "\n\x13\x65mbedded_sass.proto\x12\x16sass.embedded_protocol\"\xe8\x10\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\x98\x07\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\x12\x0e\n\x06silent\x18\x0e \x01(\x08\x12\x19\n\x11\x66\x61tal_deprecation\x18\x0f \x03(\t\x12\x1b\n\x13silence_deprecation\x18\x10 \x03(\t\x12\x1a\n\x12\x66uture_deprecation\x18\x11 \x03(\t\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\x1a\xc5\x01\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\x12L\n\x15node_package_importer\x18\x05 \x01(\x0b\x32+.sass.embedded_protocol.NodePackageImporterH\x00\x12\x1c\n\x14non_canonical_scheme\x18\x04 \x03(\tB\n\n\x08importerB\x07\n\x05inputJ\x04\x08\x01\x10\x02\x1ak\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\x12\x1d\n\x15\x63ontaining_url_unused\x18\x04 \x01(\x08\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\x1an\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\x12\x1d\n\x15\x63ontaining_url_unused\x18\x04 \x01(\x08\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\"\xcb\x0f\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\xf1\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(\t\x12\x1d\n\x10\x64\x65precation_type\x18\x07 \x01(\tH\x01\x88\x01\x01\x42\x07\n\x05_spanB\x13\n\x11_deprecation_typeJ\x04\x08\x01\x10\x02\x1a\x8e\x01\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(\x08\x12\x1b\n\x0e\x63ontaining_url\x18\x06 \x01(\tH\x00\x88\x01\x01\x42\x11\n\x0f_containing_urlJ\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\x8c\x01\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(\x08\x12\x1b\n\x0e\x63ontaining_url\x18\x06 \x01(\tH\x00\x88\x01\x01\x42\x11\n\x0f_containing_urlJ\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\"\xf8\x11\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\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\x0b\x63\x61lculation\x18\x0c \x01(\x0b\x32).sass.embedded_protocol.Value.CalculationH\x00\x12\x45\n\x0e\x63ompiler_mixin\x18\r \x01(\x0b\x32+.sass.embedded_protocol.Value.CompilerMixinH\x00\x12\x34\n\x05\x63olor\x18\x0e \x01(\x0b\x32#.sass.embedded_protocol.Value.ColorH\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\xa0\x01\n\x05\x43olor\x12\r\n\x05space\x18\x01 \x01(\t\x12\x15\n\x08\x63hannel1\x18\x02 \x01(\x01H\x00\x88\x01\x01\x12\x15\n\x08\x63hannel2\x18\x03 \x01(\x01H\x01\x88\x01\x01\x12\x15\n\x08\x63hannel3\x18\x04 \x01(\x01H\x02\x88\x01\x01\x12\x12\n\x05\x61lpha\x18\x05 \x01(\x01H\x03\x88\x01\x01\x42\x0b\n\t_channel1B\x0b\n\t_channel2B\x0b\n\t_channel3B\x08\n\x06_alpha\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\x1b\n\rCompilerMixin\x12\n\n\x02id\x18\x01 \x01(\r\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\"4\n\x13NodePackageImporter\x12\x1d\n\x15\x65ntry_point_directory\x18\x01 \x01(\t*+\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\x42#\n\x1f\x63om.sass_lang.embedded_protocolP\x01\x62\x06proto3"
|
|
9
9
|
|
|
10
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
|
12
12
|
|
|
13
13
|
module Sass
|
|
@@ -38,9 +38,7 @@ module Sass
|
|
|
38
38
|
Value = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value").msgclass
|
|
39
39
|
Value::String = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.String").msgclass
|
|
40
40
|
Value::Number = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Number").msgclass
|
|
41
|
-
Value::
|
|
42
|
-
Value::HslColor = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.HslColor").msgclass
|
|
43
|
-
Value::HwbColor = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.HwbColor").msgclass
|
|
41
|
+
Value::Color = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Color").msgclass
|
|
44
42
|
Value::List = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.List").msgclass
|
|
45
43
|
Value::Map = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Map").msgclass
|
|
46
44
|
Value::Map::Entry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Map.Entry").msgclass
|
data/lib/sass/exception.rb
CHANGED
|
@@ -51,8 +51,12 @@ module Sass
|
|
|
51
51
|
font-family: monospace, monospace;
|
|
52
52
|
white-space: pre;
|
|
53
53
|
content: #{Serializer.serialize_quoted_string(content).gsub(/[^[:ascii:]][\h\t ]?/) do |match|
|
|
54
|
-
|
|
55
|
-
replacement
|
|
54
|
+
ordinal = match.ord
|
|
55
|
+
replacement = "\\#{ordinal.to_s(16)}"
|
|
56
|
+
if match.length > 1
|
|
57
|
+
replacement << ' ' if ordinal < 0x100000
|
|
58
|
+
replacement << match[1]
|
|
59
|
+
end
|
|
56
60
|
replacement
|
|
57
61
|
end};
|
|
58
62
|
}
|
|
@@ -62,6 +66,7 @@ module Sass
|
|
|
62
66
|
|
|
63
67
|
# An exception thrown by Sass Script.
|
|
64
68
|
class ScriptError < StandardError
|
|
69
|
+
# @!visibility private
|
|
65
70
|
def initialize(message, name = nil)
|
|
66
71
|
super(name.nil? ? message : "$#{name}: #{message}")
|
|
67
72
|
end
|