sass-embedded 1.77.5 → 1.86.3

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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/exe/sass +1 -9
  3. data/ext/sass/Rakefile +407 -89
  4. data/ext/sass/embedded_sass_pb.rb +2 -4
  5. data/ext/sass/package.json +1 -1
  6. data/lib/sass/compiler/channel.rb +6 -4
  7. data/lib/sass/compiler/connection.rb +15 -20
  8. data/lib/sass/compiler/dispatcher.rb +27 -1
  9. data/lib/sass/compiler/host/function_registry.rb +6 -6
  10. data/lib/sass/compiler/host/importer_registry.rb +17 -11
  11. data/lib/sass/compiler/host/logger_registry.rb +17 -20
  12. data/lib/sass/compiler/host/protofier.rb +59 -73
  13. data/lib/sass/compiler/host/struct.rb +36 -0
  14. data/lib/sass/compiler/host.rb +2 -2
  15. data/lib/sass/compiler.rb +3 -3
  16. data/lib/sass/elf.rb +283 -170
  17. data/lib/sass/embedded/version.rb +1 -1
  18. data/lib/sass/embedded.rb +2 -41
  19. data/lib/sass/exception.rb +7 -2
  20. data/lib/sass/serializer.rb +5 -11
  21. data/lib/sass/value/argument_list.rb +0 -8
  22. data/lib/sass/value/color/channel.rb +79 -0
  23. data/lib/sass/value/color/conversions.rb +473 -0
  24. data/lib/sass/value/color/gamut_map_method/clip.rb +45 -0
  25. data/lib/sass/value/color/gamut_map_method/local_minde.rb +94 -0
  26. data/lib/sass/value/color/gamut_map_method.rb +45 -0
  27. data/lib/sass/value/color/interpolation_method.rb +51 -0
  28. data/lib/sass/value/color/space/a98_rgb.rb +57 -0
  29. data/lib/sass/value/color/space/display_p3.rb +57 -0
  30. data/lib/sass/value/color/space/hsl.rb +65 -0
  31. data/lib/sass/value/color/space/hwb.rb +70 -0
  32. data/lib/sass/value/color/space/lab.rb +77 -0
  33. data/lib/sass/value/color/space/lch.rb +53 -0
  34. data/lib/sass/value/color/space/lms.rb +129 -0
  35. data/lib/sass/value/color/space/oklab.rb +66 -0
  36. data/lib/sass/value/color/space/oklch.rb +54 -0
  37. data/lib/sass/value/color/space/prophoto_rgb.rb +59 -0
  38. data/lib/sass/value/color/space/rec2020.rb +69 -0
  39. data/lib/sass/value/color/space/rgb.rb +52 -0
  40. data/lib/sass/value/color/space/srgb.rb +140 -0
  41. data/lib/sass/value/color/space/srgb_linear.rb +72 -0
  42. data/lib/sass/value/color/space/utils.rb +86 -0
  43. data/lib/sass/value/color/space/xyz_d50.rb +100 -0
  44. data/lib/sass/value/color/space/xyz_d65.rb +57 -0
  45. data/lib/sass/value/color/space.rb +198 -0
  46. data/lib/sass/value/color.rb +537 -162
  47. data/lib/sass/value/function.rb +9 -6
  48. data/lib/sass/value/fuzzy_math.rb +23 -19
  49. data/lib/sass/value/mixin.rb +5 -2
  50. data/lib/sass/value/number/unit.rb +5 -4
  51. data/lib/sass/value/number.rb +8 -10
  52. data/lib/sass/value/string.rb +1 -1
  53. metadata +34 -19
  54. 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
- # 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
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
- 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)
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
- # 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
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 = 'E'.ord
134
- ELFMAG2 = 'L'.ord
135
- ELFMAG3 = 'F'.ord
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(buffer)
151
- @buffer = buffer
152
- @ehdr = read_ehdr
153
- @buffer.seek(@ehdr[:e_phoff], IO::SEEK_SET)
154
- @proghdrs = Array.new(@ehdr[:e_phnum]) do
155
- read_phdr
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
156
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
157
343
  end
158
344
 
159
345
  def relocatable?
@@ -173,89 +359,16 @@ module Sass
173
359
  end
174
360
 
175
361
  def interpreter
176
- phdr = @proghdrs.find { |p| p[:p_type] == PT_INTERP }
362
+ phdr = @phdrs.find { |p| p[:p_type] == PT_INTERP }
177
363
  return if phdr.nil?
178
364
 
179
- @buffer.seek(phdr[:p_offset], IO::SEEK_SET)
180
- interpreter = @buffer.read(phdr[:p_filesz])
181
- raise ArgumentError unless interpreter.end_with?("\0")
365
+ @io.seek(phdr[:p_offset], IO::SEEK_SET)
366
+ interpreter = @io.read(phdr[:p_filesz])
367
+ raise EncodingError unless interpreter.end_with?("\0")
182
368
 
183
369
  interpreter.chomp!("\0")
184
370
  end
185
371
 
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
372
  INTERPRETER = begin
260
373
  proc_self_exe = '/proc/self/exe'
261
374
  if File.exist?(proc_self_exe)
@@ -269,7 +382,7 @@ module Sass
269
382
  end
270
383
  end
271
384
  end
272
- end
385
+ end.freeze
273
386
  end
274
387
 
275
388
  private_constant :ELF
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sass
4
4
  module Embedded
5
- VERSION = '1.77.5'
5
+ VERSION = '1.86.3'
6
6
  end
7
7
  end
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 = Class.new(Compiler) do
57
- def initialize
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
@@ -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
- replacement = "\\#{match.ord.to_s(16)}"
55
- replacement << " #{match[1]}" if match.length > 1
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
@@ -5,17 +5,11 @@ module Sass
5
5
  module Serializer
6
6
  module_function
7
7
 
8
- CSS_ESCAPE = {
9
- "\0" => "\uFFFD",
10
- '\\' => '\\\\',
11
- '"' => '\\"',
12
- "'" => "\\'",
13
- **[*"\x01".."\x08", *"\x0A".."\x1F", "\x7F"].product(
14
- [*'0'..'9', *'a'..'f', *'A'..'F', "\t", ' ', nil]
15
- ).to_h do |c, x|
16
- ["#{c}#{x}".freeze, "\\#{c.ord.to_s(16)}#{" #{x}" if x}".freeze]
17
- end
18
- }.freeze
8
+ CSS_ESCAPE = [*"\x01".."\x08", *"\x0A".."\x1F", "\x7F"]
9
+ .product([*'0'..'9', *'a'..'f', *'A'..'F', "\t", ' ', nil])
10
+ .each_with_object({ "\0" => "\uFFFD", '\\' => '\\\\', '"' => '\\"', "'" => "\\'" }) do |(c, x), h|
11
+ h["#{c}#{x}".freeze] = "\\#{c.ord.to_s(16)}#{" #{x}" if x}".freeze
12
+ end.freeze
19
13
 
20
14
  private_constant :CSS_ESCAPE
21
15
 
@@ -15,7 +15,6 @@ module Sass
15
15
  def initialize(contents = [], keywords = {}, separator = ',')
16
16
  super(contents, separator:)
17
17
 
18
- @id = 0
19
18
  @keywords_accessed = false
20
19
  @keywords = keywords.freeze
21
20
  end
@@ -25,13 +24,6 @@ module Sass
25
24
  @keywords_accessed = true
26
25
  @keywords
27
26
  end
28
-
29
- private
30
-
31
- def initialize_dup(orig)
32
- @id = 0
33
- super
34
- end
35
27
  end
36
28
  end
37
29
  end