sass-embedded 1.107.0-aarch64-mswin64
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 +7 -0
- data/LICENSE +21 -0
- data/README.md +48 -0
- data/exe/sass +13 -0
- data/lib/sass/calculation_value/calculation_operation.rb +49 -0
- data/lib/sass/calculation_value.rb +22 -0
- data/lib/sass/canonicalize_context.rb +25 -0
- data/lib/sass/cli.rb +12 -0
- data/lib/sass/compile_result.rb +24 -0
- data/lib/sass/compiler/channel.rb +70 -0
- data/lib/sass/compiler/connection.rb +109 -0
- data/lib/sass/compiler/dispatcher.rb +142 -0
- data/lib/sass/compiler/session/function_registry.rb +88 -0
- data/lib/sass/compiler/session/importer_registry.rb +190 -0
- data/lib/sass/compiler/session/logger_registry.rb +99 -0
- data/lib/sass/compiler/session/path.rb +23 -0
- data/lib/sass/compiler/session/protofier.rb +384 -0
- data/lib/sass/compiler/session/stack_trace.rb +46 -0
- data/lib/sass/compiler/session.rb +242 -0
- data/lib/sass/compiler/varint.rb +39 -0
- data/lib/sass/compiler.rb +214 -0
- data/lib/sass/dart-sass/sass.bat +7 -0
- data/lib/sass/dart-sass/src/LICENSE +1659 -0
- data/lib/sass/dart-sass/src/dart.exe +0 -0
- data/lib/sass/dart-sass/src/sass.snapshot +0 -0
- data/lib/sass/elf.rb +386 -0
- data/lib/sass/embedded/version.rb +7 -0
- data/lib/sass/embedded.rb +67 -0
- data/lib/sass/embedded_protocol.rb +10 -0
- data/lib/sass/embedded_sass_pb.rb +62 -0
- data/lib/sass/exception.rb +73 -0
- data/lib/sass/fork_tracker.rb +56 -0
- data/lib/sass/gem_package_importer.rb +28 -0
- data/lib/sass/logger/silent.rb +28 -0
- data/lib/sass/logger/source_location.rb +22 -0
- data/lib/sass/logger/source_span.rb +28 -0
- data/lib/sass/node_package_importer.rb +17 -0
- data/lib/sass/serializer.rb +30 -0
- data/lib/sass/uri.rb +56 -0
- data/lib/sass/value/argument_list.rb +29 -0
- data/lib/sass/value/boolean.rb +59 -0
- data/lib/sass/value/calculation.rb +90 -0
- 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 +94 -0
- data/lib/sass/value/color/space/lab.rb +85 -0
- data/lib/sass/value/color/space/lch.rb +53 -0
- data/lib/sass/value/color/space/lms.rb +146 -0
- data/lib/sass/value/color/space/oklab.rb +71 -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 +57 -0
- data/lib/sass/value/color/space/rgb.rb +52 -0
- data/lib/sass/value/color/space/srgb.rb +145 -0
- data/lib/sass/value/color/space/srgb_linear.rb +72 -0
- data/lib/sass/value/color/space/utils.rb +89 -0
- data/lib/sass/value/color/space/xyz_d50.rb +113 -0
- data/lib/sass/value/color/space/xyz_d65.rb +57 -0
- data/lib/sass/value/color/space.rb +218 -0
- data/lib/sass/value/color.rb +631 -0
- data/lib/sass/value/function.rb +66 -0
- data/lib/sass/value/fuzzy_math.rb +84 -0
- data/lib/sass/value/list.rb +89 -0
- data/lib/sass/value/map.rb +77 -0
- data/lib/sass/value/mixin.rb +47 -0
- data/lib/sass/value/module.rb +47 -0
- data/lib/sass/value/null.rb +58 -0
- data/lib/sass/value/number/unit.rb +187 -0
- data/lib/sass/value/number.rb +364 -0
- data/lib/sass/value/string.rb +78 -0
- data/lib/sass/value.rb +174 -0
- data/lib/sass-embedded.rb +4 -0
- metadata +140 -0
|
Binary file
|
|
Binary file
|
data/lib/sass/elf.rb
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
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
|
+
# 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
|
|
37
|
+
|
|
38
|
+
# These constants are for the segment types stored in the image headers
|
|
39
|
+
PT_NULL = 0
|
|
40
|
+
PT_LOAD = 1
|
|
41
|
+
PT_DYNAMIC = 2
|
|
42
|
+
PT_INTERP = 3
|
|
43
|
+
PT_NOTE = 4
|
|
44
|
+
PT_SHLIB = 5
|
|
45
|
+
PT_PHDR = 6
|
|
46
|
+
PT_TLS = 7
|
|
47
|
+
PT_LOOS = 0x60000000
|
|
48
|
+
PT_HIOS = 0x6fffffff
|
|
49
|
+
PT_LOPROC = 0x70000000
|
|
50
|
+
PT_HIPROC = 0x7fffffff
|
|
51
|
+
|
|
52
|
+
PN_XNUM = 0xffff
|
|
53
|
+
|
|
54
|
+
# These constants define the different elf file types
|
|
55
|
+
ET_NONE = 0
|
|
56
|
+
ET_REL = 1
|
|
57
|
+
ET_EXEC = 2
|
|
58
|
+
ET_DYN = 3
|
|
59
|
+
ET_CORE = 4
|
|
60
|
+
ET_LOPROC = 0xff00
|
|
61
|
+
ET_HIPROC = 0xffff
|
|
62
|
+
|
|
63
|
+
EI_NIDENT = 16
|
|
64
|
+
|
|
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
|
|
212
|
+
|
|
213
|
+
# e_ident[] indexes
|
|
214
|
+
EI_MAG0 = 0
|
|
215
|
+
EI_MAG1 = 1
|
|
216
|
+
EI_MAG2 = 2
|
|
217
|
+
EI_MAG3 = 3
|
|
218
|
+
EI_CLASS = 4
|
|
219
|
+
EI_DATA = 5
|
|
220
|
+
EI_VERSION = 6
|
|
221
|
+
EI_OSABI = 7
|
|
222
|
+
EI_PAD = 8
|
|
223
|
+
|
|
224
|
+
# EI_MAG
|
|
225
|
+
ELFMAG0 = 0x7f
|
|
226
|
+
ELFMAG1 = 0x45
|
|
227
|
+
ELFMAG2 = 0x4c
|
|
228
|
+
ELFMAG3 = 0x46
|
|
229
|
+
ELFMAG = [ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3].pack('C*')
|
|
230
|
+
SELFMAG = 4
|
|
231
|
+
|
|
232
|
+
# e_ident[EI_CLASS]
|
|
233
|
+
ELFCLASSNONE = 0
|
|
234
|
+
ELFCLASS32 = 1
|
|
235
|
+
ELFCLASS64 = 2
|
|
236
|
+
ELFCLASSNUM = 3
|
|
237
|
+
|
|
238
|
+
# e_ident[EI_DATA]
|
|
239
|
+
ELFDATANONE = 0
|
|
240
|
+
ELFDATA2LSB = 1
|
|
241
|
+
ELFDATA2MSB = 2
|
|
242
|
+
|
|
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)
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
io.flush
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
def relocatable?
|
|
346
|
+
@ehdr[:e_type] == ET_REL
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
def executable?
|
|
350
|
+
@ehdr[:e_type] == ET_EXEC
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
def shared_object?
|
|
354
|
+
@ehdr[:e_type] == ET_DYN
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
def core?
|
|
358
|
+
@ehdr[:e_type] == ET_CORE
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
def interpreter
|
|
362
|
+
phdr = @phdrs.find { |p| p[:p_type] == PT_INTERP }
|
|
363
|
+
return if phdr.nil?
|
|
364
|
+
|
|
365
|
+
@io.seek(phdr[:p_offset], IO::SEEK_SET)
|
|
366
|
+
@io.read(phdr[:p_filesz]).unpack1('Z*')
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
INTERPRETER = begin
|
|
370
|
+
proc_self_exe = '/proc/self/exe'
|
|
371
|
+
if File.exist?(proc_self_exe)
|
|
372
|
+
File.open(proc_self_exe, 'rb') do |file|
|
|
373
|
+
elf = ELF.new(file)
|
|
374
|
+
interpreter = elf.interpreter
|
|
375
|
+
if interpreter.nil? && elf.shared_object?
|
|
376
|
+
File.readlink(proc_self_exe)
|
|
377
|
+
else
|
|
378
|
+
interpreter
|
|
379
|
+
end
|
|
380
|
+
end
|
|
381
|
+
end
|
|
382
|
+
end.freeze
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
private_constant :ELF
|
|
386
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'compiler'
|
|
4
|
+
|
|
5
|
+
# The Sass module.
|
|
6
|
+
#
|
|
7
|
+
# This communicates with Embedded Dart Sass using the Embedded Sass protocol.
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# Sass.compile('style.scss')
|
|
11
|
+
#
|
|
12
|
+
# @example
|
|
13
|
+
# Sass.compile_string('h1 { font-size: 40px; }')
|
|
14
|
+
module Sass
|
|
15
|
+
@compiler = nil
|
|
16
|
+
@mutex = Mutex.new
|
|
17
|
+
|
|
18
|
+
# rubocop:disable-next Layout/LineLength
|
|
19
|
+
class << self
|
|
20
|
+
# Compiles the Sass file at +path+ to CSS.
|
|
21
|
+
# @overload compile(path, load_paths: [], charset: true, source_map: false, source_map_include_sources: false, style: :expanded, functions: {}, importers: [], alert_ascii: false, alert_color: nil, fatal_deprecations: [], future_deprecations: [], logger: nil, quiet_deps: false, silence_deprecations: [], verbose: false)
|
|
22
|
+
# @param (see Compiler#compile)
|
|
23
|
+
# @return (see Compiler#compile)
|
|
24
|
+
# @raise (see Compiler#compile)
|
|
25
|
+
# @see Compiler#compile
|
|
26
|
+
def compile(...)
|
|
27
|
+
compiler.compile(...)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Compiles a stylesheet whose contents is +source+ to CSS.
|
|
31
|
+
# @overload compile_string(source, importer: nil, load_paths: [], syntax: :scss, url: nil, charset: true, source_map: false, source_map_include_sources: false, style: :expanded, functions: {}, importers: [], alert_ascii: false, alert_color: nil, fatal_deprecations: [], future_deprecations: [], logger: nil, quiet_deps: false, silence_deprecations: [], verbose: false)
|
|
32
|
+
# @param (see Compiler#compile_string)
|
|
33
|
+
# @return (see Compiler#compile_string)
|
|
34
|
+
# @raise (see Compiler#compile_string)
|
|
35
|
+
# @see Compiler#compile_string
|
|
36
|
+
def compile_string(...)
|
|
37
|
+
compiler.compile_string(...)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# @param (see Compiler#info)
|
|
41
|
+
# @return (see Compiler#info)
|
|
42
|
+
# @raise (see Compiler#info)
|
|
43
|
+
# @see Compiler#info
|
|
44
|
+
def info
|
|
45
|
+
compiler.info
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
def compiler
|
|
51
|
+
return @compiler if @compiler
|
|
52
|
+
|
|
53
|
+
@mutex.synchronize do
|
|
54
|
+
return @compiler if @compiler
|
|
55
|
+
|
|
56
|
+
compiler = Compiler.allocate
|
|
57
|
+
compiler.instance_variable_set(:@channel, Compiler.const_get(:Channel).new(idle_timeout: 10))
|
|
58
|
+
|
|
59
|
+
at_exit do
|
|
60
|
+
compiler.close
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
@compiler = compiler
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: embedded_sass.proto
|
|
4
|
+
|
|
5
|
+
require 'google/protobuf'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
descriptor_data = "\n\x13\x65mbedded_sass.proto\x12\x16sass.embedded_protocol\"\x8a\x11\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\xba\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\x12 \n\x18\x66\x61tal_deprecation_except\x18\x12 \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\"\xdf\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\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\x12G\n\x0f\x63ompiler_module\x18\x0f \x01(\x0b\x32,.sass.embedded_protocol.Value.CompilerModuleH\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\x1c\n\x0e\x43ompilerModule\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
|
+
|
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
11
|
+
pool.add_serialized_file(descriptor_data)
|
|
12
|
+
|
|
13
|
+
module Sass
|
|
14
|
+
module EmbeddedProtocol
|
|
15
|
+
InboundMessage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.InboundMessage").msgclass
|
|
16
|
+
InboundMessage::VersionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.InboundMessage.VersionRequest").msgclass
|
|
17
|
+
InboundMessage::CompileRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.InboundMessage.CompileRequest").msgclass
|
|
18
|
+
InboundMessage::CompileRequest::StringInput = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.InboundMessage.CompileRequest.StringInput").msgclass
|
|
19
|
+
InboundMessage::CompileRequest::Importer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.InboundMessage.CompileRequest.Importer").msgclass
|
|
20
|
+
InboundMessage::CanonicalizeResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.InboundMessage.CanonicalizeResponse").msgclass
|
|
21
|
+
InboundMessage::ImportResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.InboundMessage.ImportResponse").msgclass
|
|
22
|
+
InboundMessage::ImportResponse::ImportSuccess = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.InboundMessage.ImportResponse.ImportSuccess").msgclass
|
|
23
|
+
InboundMessage::FileImportResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.InboundMessage.FileImportResponse").msgclass
|
|
24
|
+
InboundMessage::FunctionCallResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.InboundMessage.FunctionCallResponse").msgclass
|
|
25
|
+
OutboundMessage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.OutboundMessage").msgclass
|
|
26
|
+
OutboundMessage::VersionResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.OutboundMessage.VersionResponse").msgclass
|
|
27
|
+
OutboundMessage::CompileResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.OutboundMessage.CompileResponse").msgclass
|
|
28
|
+
OutboundMessage::CompileResponse::CompileSuccess = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.OutboundMessage.CompileResponse.CompileSuccess").msgclass
|
|
29
|
+
OutboundMessage::CompileResponse::CompileFailure = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.OutboundMessage.CompileResponse.CompileFailure").msgclass
|
|
30
|
+
OutboundMessage::LogEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.OutboundMessage.LogEvent").msgclass
|
|
31
|
+
OutboundMessage::CanonicalizeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.OutboundMessage.CanonicalizeRequest").msgclass
|
|
32
|
+
OutboundMessage::ImportRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.OutboundMessage.ImportRequest").msgclass
|
|
33
|
+
OutboundMessage::FileImportRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.OutboundMessage.FileImportRequest").msgclass
|
|
34
|
+
OutboundMessage::FunctionCallRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.OutboundMessage.FunctionCallRequest").msgclass
|
|
35
|
+
ProtocolError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.ProtocolError").msgclass
|
|
36
|
+
SourceSpan = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.SourceSpan").msgclass
|
|
37
|
+
SourceSpan::SourceLocation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.SourceSpan.SourceLocation").msgclass
|
|
38
|
+
Value = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value").msgclass
|
|
39
|
+
Value::String = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.String").msgclass
|
|
40
|
+
Value::Number = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Number").msgclass
|
|
41
|
+
Value::Color = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Color").msgclass
|
|
42
|
+
Value::List = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.List").msgclass
|
|
43
|
+
Value::Map = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Map").msgclass
|
|
44
|
+
Value::Map::Entry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Map.Entry").msgclass
|
|
45
|
+
Value::CompilerFunction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.CompilerFunction").msgclass
|
|
46
|
+
Value::HostFunction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.HostFunction").msgclass
|
|
47
|
+
Value::CompilerMixin = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.CompilerMixin").msgclass
|
|
48
|
+
Value::CompilerModule = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.CompilerModule").msgclass
|
|
49
|
+
Value::ArgumentList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.ArgumentList").msgclass
|
|
50
|
+
Value::Calculation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Calculation").msgclass
|
|
51
|
+
Value::Calculation::CalculationValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Calculation.CalculationValue").msgclass
|
|
52
|
+
Value::Calculation::CalculationOperation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Calculation.CalculationOperation").msgclass
|
|
53
|
+
NodePackageImporter = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.NodePackageImporter").msgclass
|
|
54
|
+
OutputStyle = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.OutputStyle").enummodule
|
|
55
|
+
Syntax = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Syntax").enummodule
|
|
56
|
+
LogEventType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.LogEventType").enummodule
|
|
57
|
+
ProtocolErrorType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.ProtocolErrorType").enummodule
|
|
58
|
+
ListSeparator = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.ListSeparator").enummodule
|
|
59
|
+
SingletonValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.SingletonValue").enummodule
|
|
60
|
+
CalculationOperator = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.CalculationOperator").enummodule
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sass
|
|
4
|
+
# An exception thrown because a Sass compilation failed.
|
|
5
|
+
class CompileError < StandardError
|
|
6
|
+
# @return [String, nil]
|
|
7
|
+
attr_reader :sass_stack
|
|
8
|
+
|
|
9
|
+
# @return [Logger::SourceSpan, nil]
|
|
10
|
+
attr_reader :span
|
|
11
|
+
|
|
12
|
+
# @return [Array<String>]
|
|
13
|
+
attr_reader :loaded_urls
|
|
14
|
+
|
|
15
|
+
# @!visibility private
|
|
16
|
+
def initialize(message, detailed_message, sass_stack, span, loaded_urls)
|
|
17
|
+
super(message)
|
|
18
|
+
|
|
19
|
+
@detailed_message = detailed_message
|
|
20
|
+
@sass_stack = sass_stack
|
|
21
|
+
@span = span
|
|
22
|
+
@loaded_urls = loaded_urls
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# @!visibility private
|
|
26
|
+
def detailed_message(highlight: nil, **)
|
|
27
|
+
return super if @detailed_message.nil?
|
|
28
|
+
|
|
29
|
+
highlight = Exception.to_tty? if highlight.nil?
|
|
30
|
+
|
|
31
|
+
detailed_message = @detailed_message.sub(message, super)
|
|
32
|
+
detailed_message.gsub!(/\e\[[0-9;]*m/, '') unless highlight
|
|
33
|
+
detailed_message
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# @return [String]
|
|
37
|
+
def to_css
|
|
38
|
+
content = full_message(highlight: false, order: :top)
|
|
39
|
+
|
|
40
|
+
<<~CSS.freeze
|
|
41
|
+
/* #{content.gsub('*/', "*\u2060/").gsub("\r\n", "\n").split("\n").join("\n * ")} */
|
|
42
|
+
|
|
43
|
+
body::before {
|
|
44
|
+
position: static;
|
|
45
|
+
display: block;
|
|
46
|
+
padding: 1em;
|
|
47
|
+
margin: 0 0 1em;
|
|
48
|
+
border-width: 0 0 2px;
|
|
49
|
+
border-bottom-style: solid;
|
|
50
|
+
font-family: monospace, monospace;
|
|
51
|
+
white-space: pre;
|
|
52
|
+
content: #{Serializer.serialize_quoted_string(content).gsub(/[^[:ascii:]][\h\t ]?/) do |match|
|
|
53
|
+
ordinal = match.ord
|
|
54
|
+
replacement = "\\#{ordinal.to_s(16)}"
|
|
55
|
+
if match.length > 1
|
|
56
|
+
replacement << ' ' if ordinal < 0x100000
|
|
57
|
+
replacement << match[1]
|
|
58
|
+
end
|
|
59
|
+
replacement
|
|
60
|
+
end};
|
|
61
|
+
}
|
|
62
|
+
CSS
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# An exception thrown by Sass Script.
|
|
67
|
+
class ScriptError < StandardError
|
|
68
|
+
# @!visibility private
|
|
69
|
+
def initialize(message, name = nil)
|
|
70
|
+
super(name.nil? ? message : "$#{name}: #{message}")
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sass
|
|
4
|
+
# The {ForkTracker} module.
|
|
5
|
+
#
|
|
6
|
+
# It tracks objects that need to be closed after `Process.fork`.
|
|
7
|
+
module ForkTracker
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
if Process.respond_to?(:_fork)
|
|
11
|
+
SET = Set.new.compare_by_identity
|
|
12
|
+
|
|
13
|
+
MUTEX = Mutex.new
|
|
14
|
+
|
|
15
|
+
private_constant :SET, :MUTEX
|
|
16
|
+
|
|
17
|
+
def add(object)
|
|
18
|
+
MUTEX.synchronize do
|
|
19
|
+
SET.add(object)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def delete(object)
|
|
24
|
+
MUTEX.synchronize do
|
|
25
|
+
SET.delete(object)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def each(&)
|
|
30
|
+
MUTEX.synchronize do
|
|
31
|
+
SET.to_a
|
|
32
|
+
end.each(&)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# The {CoreExt} module.
|
|
36
|
+
#
|
|
37
|
+
# It closes objects after `Process.fork`.
|
|
38
|
+
module CoreExt
|
|
39
|
+
def _fork
|
|
40
|
+
pid = super
|
|
41
|
+
ForkTracker.each(&:close) if pid.zero?
|
|
42
|
+
pid
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private_constant :CoreExt
|
|
47
|
+
|
|
48
|
+
Process.singleton_class.prepend(CoreExt)
|
|
49
|
+
else
|
|
50
|
+
def add(object); end
|
|
51
|
+
def delete(object); end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
private_constant :ForkTracker
|
|
56
|
+
end
|