sass-embedded 1.69.5 → 1.69.7
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/README.md +1 -1
- data/exe/sass +2 -2
- data/ext/sass/Rakefile +8 -24
- data/ext/sass/embedded_sass_pb.rb +1 -1
- data/ext/sass/package.json +1 -1
- data/lib/sass/calculation_value/calculation_operation.rb +2 -5
- data/lib/sass/calculation_value.rb +10 -4
- data/lib/sass/compiler/connection.rb +92 -0
- data/lib/sass/{embedded → compiler}/dispatcher.rb +32 -11
- data/lib/sass/compiler/dispatcher_manager.rb +44 -0
- data/lib/sass/{embedded → compiler}/host/function_registry.rb +3 -3
- data/lib/sass/{embedded → compiler}/host/importer_registry.rb +4 -4
- data/lib/sass/{embedded → compiler}/host/logger_registry.rb +1 -1
- data/lib/sass/{embedded → compiler}/host/protofier.rb +1 -1
- data/lib/sass/{embedded → compiler}/host/structifier.rb +1 -1
- data/lib/sass/{embedded → compiler}/host/value_protofier.rb +3 -3
- data/lib/sass/{embedded → compiler}/host.rb +23 -14
- data/lib/sass/{embedded → compiler}/varint.rb +1 -1
- data/lib/sass/compiler.rb +191 -0
- data/lib/sass/elf.rb +2 -2
- data/lib/sass/embedded/version.rb +2 -2
- data/lib/sass/embedded.rb +65 -204
- data/lib/sass/exception.rb +65 -0
- data/lib/sass/fork_tracker.rb +51 -0
- data/lib/sass/serializer.rb +41 -0
- data/lib/sass/value/argument_list.rb +2 -2
- data/lib/sass/value/calculation.rb +3 -1
- data/lib/sass/value/function.rb +5 -3
- data/lib/sass/value/number.rb +8 -8
- data/lib/sass/value/string.rb +5 -8
- data/lib/sass/value.rb +1 -9
- metadata +25 -23
- data/ext/sass/win32_api.rb +0 -133
- data/lib/sass/compile_error.rb +0 -31
- data/lib/sass/embedded/connection.rb +0 -71
- data/lib/sass/embedded/resilient_dispatcher.rb +0 -40
- data/lib/sass/script_error.rb +0 -10
@@ -8,12 +8,12 @@ module Sass
|
|
8
8
|
# map as well as the positional arguments.
|
9
9
|
#
|
10
10
|
# @see https://sass-lang.com/documentation/js-api/classes/sassargumentlist/
|
11
|
-
class ArgumentList <
|
11
|
+
class ArgumentList < List
|
12
12
|
# @param contents [Array<Value>]
|
13
13
|
# @param keywords [Hash<::String, Value>]
|
14
14
|
# @param separator [::String]
|
15
15
|
def initialize(contents = [], keywords = {}, separator = ',')
|
16
|
-
super(contents, separator:
|
16
|
+
super(contents, separator:)
|
17
17
|
|
18
18
|
@id = 0
|
19
19
|
@keywords_accessed = false
|
data/lib/sass/value/function.rb
CHANGED
@@ -10,9 +10,11 @@ module Sass
|
|
10
10
|
|
11
11
|
# @param signature [::String]
|
12
12
|
# @param callback [Proc]
|
13
|
-
def initialize(signature, callback)
|
14
|
-
|
15
|
-
|
13
|
+
def initialize(signature, &callback)
|
14
|
+
raise Sass::ScriptError, 'no block given' unless signature.nil? || callback
|
15
|
+
|
16
|
+
@signature = signature.freeze
|
17
|
+
@callback = callback.freeze
|
16
18
|
end
|
17
19
|
|
18
20
|
# @return [Integer, nil]
|
data/lib/sass/value/number.rb
CHANGED
@@ -183,7 +183,7 @@ module Sass
|
|
183
183
|
def convert_value(new_numerator_units, new_denominator_units, name = nil)
|
184
184
|
coerce_or_convert_value(new_numerator_units, new_denominator_units,
|
185
185
|
coerce_unitless: false,
|
186
|
-
name:
|
186
|
+
name:)
|
187
187
|
end
|
188
188
|
|
189
189
|
# @param other [Number]
|
@@ -200,9 +200,9 @@ module Sass
|
|
200
200
|
def convert_value_to_match(other, name = nil, other_name = nil)
|
201
201
|
coerce_or_convert_value(other.numerator_units, other.denominator_units,
|
202
202
|
coerce_unitless: false,
|
203
|
-
name
|
204
|
-
other
|
205
|
-
other_name:
|
203
|
+
name:,
|
204
|
+
other:,
|
205
|
+
other_name:)
|
206
206
|
end
|
207
207
|
|
208
208
|
# @param new_numerator_units [Array<::String>]
|
@@ -221,7 +221,7 @@ module Sass
|
|
221
221
|
def coerce_value(new_numerator_units, new_denominator_units, name = nil)
|
222
222
|
coerce_or_convert_value(new_numerator_units, new_denominator_units,
|
223
223
|
coerce_unitless: true,
|
224
|
-
name:
|
224
|
+
name:)
|
225
225
|
end
|
226
226
|
|
227
227
|
# @param unit [::String]
|
@@ -244,9 +244,9 @@ module Sass
|
|
244
244
|
def coerce_value_to_match(other, name = nil, other_name = nil)
|
245
245
|
coerce_or_convert_value(other.numerator_units, other.denominator_units,
|
246
246
|
coerce_unitless: true,
|
247
|
-
name
|
248
|
-
other
|
249
|
-
other_name:
|
247
|
+
name:,
|
248
|
+
other:,
|
249
|
+
other_name:)
|
250
250
|
end
|
251
251
|
|
252
252
|
# @return [Number]
|
data/lib/sass/value/string.rb
CHANGED
@@ -39,14 +39,6 @@ module Sass
|
|
39
39
|
self
|
40
40
|
end
|
41
41
|
|
42
|
-
# @return [CalculationValue]
|
43
|
-
# @raise [ScriptError]
|
44
|
-
def assert_calculation_value(name = nil)
|
45
|
-
raise Sass::ScriptError.new("Expected #{self} to be an unquoted string.", name) if quoted?
|
46
|
-
|
47
|
-
self
|
48
|
-
end
|
49
|
-
|
50
42
|
# @param sass_index [Number]
|
51
43
|
# @return [Integer]
|
52
44
|
def sass_index_to_string_index(sass_index, name = nil)
|
@@ -59,6 +51,11 @@ module Sass
|
|
59
51
|
|
60
52
|
index.negative? ? text.length + index : index - 1
|
61
53
|
end
|
54
|
+
|
55
|
+
# @return [String]
|
56
|
+
def to_s
|
57
|
+
@quoted ? Serializer.serialize_quoted_string(@text) : Serializer.serialize_unquoted_string(@text)
|
58
|
+
end
|
62
59
|
end
|
63
60
|
end
|
64
61
|
end
|
data/lib/sass/value.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative 'calculation_value'
|
4
|
-
require_relative 'script_error'
|
5
|
-
|
6
3
|
module Sass
|
7
4
|
# The abstract base class of Sass's value types.
|
8
5
|
#
|
@@ -67,12 +64,6 @@ module Sass
|
|
67
64
|
raise Sass::ScriptError.new("#{self} is not a calculation", name)
|
68
65
|
end
|
69
66
|
|
70
|
-
# @return [CalculationValue]
|
71
|
-
# @raise [ScriptError]
|
72
|
-
def assert_calculation_value(name = nil)
|
73
|
-
raise Sass::ScriptError.new("#{self} is not a calculation value", name)
|
74
|
-
end
|
75
|
-
|
76
67
|
# @return [Color]
|
77
68
|
# @raise [ScriptError]
|
78
69
|
def assert_color(name = nil)
|
@@ -130,6 +121,7 @@ module Sass
|
|
130
121
|
end
|
131
122
|
end
|
132
123
|
|
124
|
+
require_relative 'calculation_value'
|
133
125
|
require_relative 'value/list'
|
134
126
|
require_relative 'value/argument_list'
|
135
127
|
require_relative 'value/boolean'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass-embedded
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.69.
|
4
|
+
version: 1.69.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- なつき
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.25'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '3.
|
26
|
+
version: '3.25'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -55,32 +55,33 @@ files:
|
|
55
55
|
- ext/sass/embedded_sass_pb.rb
|
56
56
|
- ext/sass/expand-archive.ps1
|
57
57
|
- ext/sass/package.json
|
58
|
-
- ext/sass/win32_api.rb
|
59
58
|
- lib/sass-embedded.rb
|
60
59
|
- lib/sass/calculation_value.rb
|
61
60
|
- lib/sass/calculation_value/calculation_operation.rb
|
62
61
|
- lib/sass/canonicalize_context.rb
|
63
|
-
- lib/sass/compile_error.rb
|
64
62
|
- lib/sass/compile_result.rb
|
63
|
+
- lib/sass/compiler.rb
|
64
|
+
- lib/sass/compiler/connection.rb
|
65
|
+
- lib/sass/compiler/dispatcher.rb
|
66
|
+
- lib/sass/compiler/dispatcher_manager.rb
|
67
|
+
- lib/sass/compiler/host.rb
|
68
|
+
- lib/sass/compiler/host/function_registry.rb
|
69
|
+
- lib/sass/compiler/host/importer_registry.rb
|
70
|
+
- lib/sass/compiler/host/logger_registry.rb
|
71
|
+
- lib/sass/compiler/host/protofier.rb
|
72
|
+
- lib/sass/compiler/host/structifier.rb
|
73
|
+
- lib/sass/compiler/host/value_protofier.rb
|
74
|
+
- lib/sass/compiler/varint.rb
|
65
75
|
- lib/sass/elf.rb
|
66
76
|
- lib/sass/embedded.rb
|
67
|
-
- lib/sass/embedded/connection.rb
|
68
|
-
- lib/sass/embedded/dispatcher.rb
|
69
|
-
- lib/sass/embedded/host.rb
|
70
|
-
- lib/sass/embedded/host/function_registry.rb
|
71
|
-
- lib/sass/embedded/host/importer_registry.rb
|
72
|
-
- lib/sass/embedded/host/logger_registry.rb
|
73
|
-
- lib/sass/embedded/host/protofier.rb
|
74
|
-
- lib/sass/embedded/host/structifier.rb
|
75
|
-
- lib/sass/embedded/host/value_protofier.rb
|
76
|
-
- lib/sass/embedded/resilient_dispatcher.rb
|
77
|
-
- lib/sass/embedded/varint.rb
|
78
77
|
- lib/sass/embedded/version.rb
|
79
78
|
- lib/sass/embedded_protocol.rb
|
79
|
+
- lib/sass/exception.rb
|
80
|
+
- lib/sass/fork_tracker.rb
|
80
81
|
- lib/sass/logger/silent.rb
|
81
82
|
- lib/sass/logger/source_location.rb
|
82
83
|
- lib/sass/logger/source_span.rb
|
83
|
-
- lib/sass/
|
84
|
+
- lib/sass/serializer.rb
|
84
85
|
- lib/sass/value.rb
|
85
86
|
- lib/sass/value/argument_list.rb
|
86
87
|
- lib/sass/value/boolean.rb
|
@@ -95,13 +96,14 @@ files:
|
|
95
96
|
- lib/sass/value/number.rb
|
96
97
|
- lib/sass/value/number/unit.rb
|
97
98
|
- lib/sass/value/string.rb
|
98
|
-
homepage: https://github.com/
|
99
|
+
homepage: https://github.com/sass-contrib/sass-embedded-host-ruby
|
99
100
|
licenses:
|
100
101
|
- MIT
|
101
102
|
metadata:
|
102
|
-
documentation_uri: https://rubydoc.info/gems/sass-embedded/1.69.
|
103
|
-
source_code_uri: https://github.com/
|
103
|
+
documentation_uri: https://rubydoc.info/gems/sass-embedded/1.69.7
|
104
|
+
source_code_uri: https://github.com/sass-contrib/sass-embedded-host-ruby/tree/v1.69.7
|
104
105
|
funding_uri: https://github.com/sponsors/ntkme
|
106
|
+
rubygems_mfa_required: 'true'
|
105
107
|
post_install_message:
|
106
108
|
rdoc_options: []
|
107
109
|
require_paths:
|
@@ -110,14 +112,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
112
|
requirements:
|
111
113
|
- - ">="
|
112
114
|
- !ruby/object:Gem::Version
|
113
|
-
version: 3.
|
115
|
+
version: 3.1.3
|
114
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
117
|
requirements:
|
116
118
|
- - ">="
|
117
119
|
- !ruby/object:Gem::Version
|
118
120
|
version: '0'
|
119
121
|
requirements: []
|
120
|
-
rubygems_version: 3.
|
122
|
+
rubygems_version: 3.5.3
|
121
123
|
signing_key:
|
122
124
|
specification_version: 4
|
123
125
|
summary: Use dart-sass with Ruby!
|
data/ext/sass/win32_api.rb
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'fiddle'
|
4
|
-
|
5
|
-
# @!visibility private
|
6
|
-
module SassConfig
|
7
|
-
# @see https://learn.microsoft.com/en-us/windows/win32/api/
|
8
|
-
module Win32API
|
9
|
-
Kernel32 = Fiddle.dlopen('Kernel32.dll')
|
10
|
-
|
11
|
-
# @see https://learn.microsoft.com/en-us/windows/win32/sysinfo/image-file-machine-constants
|
12
|
-
module ImageFileMachineConstants
|
13
|
-
IMAGE_FILE_MACHINE_I386 = 0x014c
|
14
|
-
IMAGE_FILE_MACHINE_ARMNT = 0x01c4
|
15
|
-
IMAGE_FILE_MACHINE_AMD64 = 0x8664
|
16
|
-
IMAGE_FILE_MACHINE_ARM64 = 0xaa64
|
17
|
-
end
|
18
|
-
|
19
|
-
private_constant :ImageFileMachineConstants
|
20
|
-
|
21
|
-
# @see https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/ne-processthreadsapi-machine_attributes
|
22
|
-
module MachineAttributes
|
23
|
-
USER_ENABLED = 0x00000001
|
24
|
-
KERNEL_ENABLED = 0x00000002
|
25
|
-
WOW64_CONTAINER = 0x00000004
|
26
|
-
end
|
27
|
-
|
28
|
-
private_constant :MachineAttributes
|
29
|
-
|
30
|
-
# Specifies the ways in which an architecture of code can run on a host operating system.
|
31
|
-
class MachineTypeAttributes
|
32
|
-
def initialize(machine_type_attributes)
|
33
|
-
@machine_type_attributes = machine_type_attributes
|
34
|
-
end
|
35
|
-
|
36
|
-
# The specified architecture of code can run in user mode.
|
37
|
-
def user_enabled?
|
38
|
-
@machine_type_attributes & MachineAttributes::USER_ENABLED == MachineAttributes::USER_ENABLED
|
39
|
-
end
|
40
|
-
|
41
|
-
# The specified architecture of code can run in kernel mode.
|
42
|
-
def kernel_enabled?
|
43
|
-
@machine_type_attributes & MachineAttributes::KERNEL_ENABLED == MachineAttributes::KERNEL_ENABLED
|
44
|
-
end
|
45
|
-
|
46
|
-
# The specified architecture of code runs on WOW64.
|
47
|
-
def wow64_container?
|
48
|
-
@machine_type_attributes & MachineAttributes::WOW64_CONTAINER == MachineAttributes::WOW64_CONTAINER
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
private_constant :MachineTypeAttributes
|
53
|
-
|
54
|
-
class << self
|
55
|
-
def x86?
|
56
|
-
get_machine_type_attributes(ImageFileMachineConstants::IMAGE_FILE_MACHINE_I386).user_enabled?
|
57
|
-
end
|
58
|
-
|
59
|
-
def arm?
|
60
|
-
get_machine_type_attributes(ImageFileMachineConstants::IMAGE_FILE_MACHINE_ARMNT).user_enabled?
|
61
|
-
end
|
62
|
-
|
63
|
-
def x64?
|
64
|
-
get_machine_type_attributes(ImageFileMachineConstants::IMAGE_FILE_MACHINE_AMD64).user_enabled?
|
65
|
-
end
|
66
|
-
|
67
|
-
def arm64?
|
68
|
-
get_machine_type_attributes(ImageFileMachineConstants::IMAGE_FILE_MACHINE_ARM64).user_enabled?
|
69
|
-
end
|
70
|
-
|
71
|
-
private
|
72
|
-
|
73
|
-
begin
|
74
|
-
# @see https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getmachinetypeattributes
|
75
|
-
GetMachineTypeAttributes = Fiddle::Function.new(
|
76
|
-
Kernel32['GetMachineTypeAttributes'],
|
77
|
-
[-Fiddle::TYPE_SHORT, Fiddle::TYPE_VOIDP],
|
78
|
-
Fiddle::TYPE_LONG
|
79
|
-
)
|
80
|
-
|
81
|
-
def get_machine_type_attributes(machine)
|
82
|
-
p_machine_type_attributes = Fiddle::Pointer.malloc(Fiddle::SIZEOF_INT, Fiddle::RUBY_FREE)
|
83
|
-
raise Fiddle.win32_last_error unless GetMachineTypeAttributes.call(machine, p_machine_type_attributes).zero?
|
84
|
-
|
85
|
-
MachineTypeAttributes.new(p_machine_type_attributes.to_str.unpack1('i'))
|
86
|
-
end
|
87
|
-
rescue Fiddle::DLError
|
88
|
-
# @see https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentprocess
|
89
|
-
GetCurrentProcess = Fiddle::Function.new(
|
90
|
-
Kernel32['GetCurrentProcess'],
|
91
|
-
[],
|
92
|
-
Fiddle::TYPE_VOIDP
|
93
|
-
)
|
94
|
-
|
95
|
-
# @see https://learn.microsoft.com/en-us/windows/win32/api/wow64apiset/nf-wow64apiset-iswow64process2
|
96
|
-
IsWow64Process2 = Fiddle::Function.new(
|
97
|
-
Kernel32['IsWow64Process2'],
|
98
|
-
[Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP],
|
99
|
-
Fiddle::TYPE_CHAR
|
100
|
-
)
|
101
|
-
|
102
|
-
# @see https://learn.microsoft.com/en-us/windows/win32/api/wow64apiset/nf-wow64apiset-iswow64guestmachinesupported
|
103
|
-
IsWow64GuestMachineSupported = Fiddle::Function.new(
|
104
|
-
Kernel32['IsWow64GuestMachineSupported'],
|
105
|
-
[-Fiddle::TYPE_SHORT, Fiddle::TYPE_VOIDP],
|
106
|
-
Fiddle::TYPE_LONG
|
107
|
-
)
|
108
|
-
|
109
|
-
def get_machine_type_attributes(machine)
|
110
|
-
h_process = GetCurrentProcess.call
|
111
|
-
p_process_machine = Fiddle::Pointer.malloc(Fiddle::SIZEOF_SHORT, Fiddle::RUBY_FREE)
|
112
|
-
p_native_machine = Fiddle::Pointer.malloc(Fiddle::SIZEOF_SHORT, Fiddle::RUBY_FREE)
|
113
|
-
raise Fiddle.win32_last_error if IsWow64Process2.call(h_process, p_process_machine, p_native_machine).zero?
|
114
|
-
|
115
|
-
if p_native_machine.to_str.unpack1('S!') == machine
|
116
|
-
return MachineTypeAttributes.new(MachineAttributes::USER_ENABLED | MachineAttributes::KERNEL_ENABLED)
|
117
|
-
end
|
118
|
-
|
119
|
-
p_machine_is_supported = Fiddle::Pointer.malloc(Fiddle::SIZEOF_CHAR, Fiddle::RUBY_FREE)
|
120
|
-
raise Fiddle.win32_last_error unless IsWow64GuestMachineSupported.call(machine, p_machine_is_supported).zero?
|
121
|
-
|
122
|
-
if p_machine_is_supported.to_str.unpack1('c').zero?
|
123
|
-
MachineTypeAttributes.new(0)
|
124
|
-
else
|
125
|
-
MachineTypeAttributes.new(MachineAttributes::USER_ENABLED | MachineAttributes::WOW64_CONTAINER)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
private_constant :Win32API
|
133
|
-
end
|
data/lib/sass/compile_error.rb
DELETED
@@ -1,31 +0,0 @@
|
|
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, full_message, sass_stack, span, loaded_urls)
|
17
|
-
super(message)
|
18
|
-
@full_message = full_message
|
19
|
-
@sass_stack = sass_stack
|
20
|
-
@span = span
|
21
|
-
@loaded_urls = loaded_urls
|
22
|
-
end
|
23
|
-
|
24
|
-
# @return [String]
|
25
|
-
def full_message(...)
|
26
|
-
return super(...) if @full_message.nil?
|
27
|
-
|
28
|
-
@full_message = +@full_message
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'open3'
|
4
|
-
|
5
|
-
require_relative '../../../ext/sass/cli'
|
6
|
-
|
7
|
-
module Sass
|
8
|
-
class Embedded
|
9
|
-
# The stdio based {Connection} between the {Dispatcher} and the compiler.
|
10
|
-
#
|
11
|
-
# It runs the `sass --embedded` command.
|
12
|
-
class Connection
|
13
|
-
def initialize(dispatcher)
|
14
|
-
@mutex = Mutex.new
|
15
|
-
@stdin, stdout, stderr, @wait_thread = begin
|
16
|
-
Open3.popen3(*CLI::COMMAND, '--embedded', chdir: __dir__)
|
17
|
-
rescue Errno::ENOENT
|
18
|
-
require_relative '../elf'
|
19
|
-
|
20
|
-
raise if ELF::INTERPRETER.nil?
|
21
|
-
|
22
|
-
Open3.popen3(ELF::INTERPRETER, *CLI::COMMAND, '--embedded', chdir: __dir__)
|
23
|
-
end
|
24
|
-
@stdin.binmode
|
25
|
-
|
26
|
-
Thread.new do
|
27
|
-
stdout.binmode
|
28
|
-
loop do
|
29
|
-
length = Varint.read(stdout)
|
30
|
-
id = Varint.read(stdout)
|
31
|
-
proto = stdout.read(length - Varint.length(id))
|
32
|
-
dispatcher.receive_proto(id, proto)
|
33
|
-
rescue IOError, Errno::EBADF, Errno::EPROTO => e
|
34
|
-
dispatcher.error(e)
|
35
|
-
break
|
36
|
-
end
|
37
|
-
stdout.close
|
38
|
-
end
|
39
|
-
|
40
|
-
Thread.new do
|
41
|
-
loop do
|
42
|
-
warn(stderr.readline, uplevel: 1)
|
43
|
-
rescue IOError, Errno::EBADF
|
44
|
-
break
|
45
|
-
end
|
46
|
-
stderr.close
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def close
|
51
|
-
@stdin.close
|
52
|
-
@wait_thread.join
|
53
|
-
end
|
54
|
-
|
55
|
-
def closed?
|
56
|
-
@stdin.closed? && !@wait_thread.alive?
|
57
|
-
end
|
58
|
-
|
59
|
-
def write(id, proto)
|
60
|
-
buffer = []
|
61
|
-
Varint.write(buffer, Varint.length(id) + proto.length)
|
62
|
-
Varint.write(buffer, id)
|
63
|
-
@mutex.synchronize do
|
64
|
-
@stdin.write(buffer.pack('C*'), proto)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
private_constant :Connection
|
70
|
-
end
|
71
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Sass
|
4
|
-
class Embedded
|
5
|
-
# The {ResilientDispatcher} class.
|
6
|
-
#
|
7
|
-
# It recovers from failures and continues to function.
|
8
|
-
class ResilientDispatcher
|
9
|
-
def initialize
|
10
|
-
@dispatcher = Dispatcher.new
|
11
|
-
@mutex = Mutex.new
|
12
|
-
end
|
13
|
-
|
14
|
-
def close(...)
|
15
|
-
@mutex.synchronize do
|
16
|
-
@dispatcher.close(...)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def closed?(...)
|
21
|
-
@mutex.synchronize do
|
22
|
-
@dispatcher.closed?(...)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def connect(...)
|
27
|
-
@dispatcher.connect(...)
|
28
|
-
rescue Errno::EBUSY
|
29
|
-
@mutex.synchronize do
|
30
|
-
@dispatcher.connect(...)
|
31
|
-
rescue Errno::EBUSY
|
32
|
-
@dispatcher = Dispatcher.new
|
33
|
-
@dispatcher.connect(...)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
private_constant :ResilientDispatcher
|
39
|
-
end
|
40
|
-
end
|
data/lib/sass/script_error.rb
DELETED