sass-embedded 1.69.5-x64-mingw-ucrt → 1.69.7-x64-mingw-ucrt
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/cli.rb +2 -2
- data/ext/sass/dart-sass/src/LICENSE +32 -0
- data/ext/sass/dart-sass/src/dart.exe +0 -0
- data/ext/sass/dart-sass/src/sass.snapshot +0 -0
- data/ext/sass/embedded_sass_pb.rb +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 -22
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b8c1c737a9861eeb61b9fd44c74b73bc663e8dc3164b48624661e505610f224
|
4
|
+
data.tar.gz: 194ad076f70334df60ed1d385a4c4aa9371b47d96b22f8cb9086ae5c578b7d09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3976ecec5cae49bdb698045914925fe1d51c062aa16b7803e223e3c96cbe57c8b7ffb30d0f250d4e9e9462e862ce56be6d093495f46a547de194a1fad7ef9aeb
|
7
|
+
data.tar.gz: b0706218c9b8d6163afa7f158f4725ffc83e9bf1d7a1dfa27984e762e918134e54a441c6380b03f1185b7b3014a95c4dbc8aab497650cd039854ecc793f4c118
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Embedded Sass Host for Ruby
|
2
2
|
|
3
|
-
[](https://github.com/sass-contrib/sass-embedded-host-ruby/actions/workflows/build.yml)
|
4
4
|
[](https://rubygems.org/gems/sass-embedded)
|
5
5
|
|
6
6
|
This is a Ruby library that implements the host side of the [Embedded Sass protocol](https://github.com/sass/sass/blob/HEAD/spec/embedded-protocol.md).
|
data/exe/sass
CHANGED
@@ -7,13 +7,13 @@ module Sass
|
|
7
7
|
# The `sass` command line interface
|
8
8
|
class CLI
|
9
9
|
begin
|
10
|
-
exec(*COMMAND, *ARGV)
|
10
|
+
Kernel.exec(*COMMAND, *ARGV)
|
11
11
|
rescue Errno::ENOENT
|
12
12
|
require_relative '../lib/sass/elf'
|
13
13
|
|
14
14
|
raise if ELF::INTERPRETER.nil?
|
15
15
|
|
16
|
-
exec(ELF::INTERPRETER, *COMMAND, *ARGV)
|
16
|
+
Kernel.exec(ELF::INTERPRETER, *COMMAND, *ARGV)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
data/ext/sass/cli.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
module Sass
|
4
4
|
class CLI
|
5
5
|
COMMAND = [
|
6
|
-
File.absolute_path('dart-sass/src/dart.exe', __dir__),
|
7
|
-
File.absolute_path('dart-sass/src/sass.snapshot', __dir__)
|
6
|
+
File.absolute_path('dart-sass/src/dart.exe', __dir__).freeze,
|
7
|
+
File.absolute_path('dart-sass/src/sass.snapshot', __dir__).freeze
|
8
8
|
].freeze
|
9
9
|
end
|
10
10
|
|
@@ -1570,6 +1570,38 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
1570
1570
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1571
1571
|
|
1572
1572
|
|
1573
|
+
--------------------------------------------------------------------------------
|
1574
|
+
|
1575
|
+
web license:
|
1576
|
+
|
1577
|
+
Copyright 2023, the Dart project authors.
|
1578
|
+
|
1579
|
+
Redistribution and use in source and binary forms, with or without
|
1580
|
+
modification, are permitted provided that the following conditions are
|
1581
|
+
met:
|
1582
|
+
* Redistributions of source code must retain the above copyright
|
1583
|
+
notice, this list of conditions and the following disclaimer.
|
1584
|
+
* Redistributions in binary form must reproduce the above
|
1585
|
+
copyright notice, this list of conditions and the following
|
1586
|
+
disclaimer in the documentation and/or other materials provided
|
1587
|
+
with the distribution.
|
1588
|
+
* Neither the name of Google LLC nor the names of its
|
1589
|
+
contributors may be used to endorse or promote products derived
|
1590
|
+
from this software without specific prior written permission.
|
1591
|
+
|
1592
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
1593
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
1594
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
1595
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
1596
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
1597
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
1598
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
1599
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
1600
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
1601
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
1602
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1603
|
+
|
1604
|
+
|
1573
1605
|
--------------------------------------------------------------------------------
|
1574
1606
|
|
1575
1607
|
yaml license:
|
Binary file
|
Binary file
|
@@ -11,7 +11,7 @@ pool = Google::Protobuf::DescriptorPool.generated_pool
|
|
11
11
|
|
12
12
|
begin
|
13
13
|
pool.add_serialized_file(descriptor_data)
|
14
|
-
rescue TypeError
|
14
|
+
rescue TypeError
|
15
15
|
# Compatibility code: will be removed in the next major version.
|
16
16
|
require 'google/protobuf/descriptor_pb'
|
17
17
|
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
@@ -18,12 +18,9 @@ module Sass
|
|
18
18
|
def initialize(operator, left, right)
|
19
19
|
raise Sass::ScriptError, "Invalid operator: #{operator}" unless OPERATORS.include?(operator)
|
20
20
|
|
21
|
-
left.assert_calculation_value
|
22
|
-
right.assert_calculation_value
|
23
|
-
|
24
21
|
@operator = operator.freeze
|
25
|
-
@left = left
|
26
|
-
@right = right
|
22
|
+
@left = assert_calculation_value(left, 'left')
|
23
|
+
@right = assert_calculation_value(right, 'right')
|
27
24
|
end
|
28
25
|
|
29
26
|
# @return [::String]
|
@@ -5,10 +5,16 @@ module Sass
|
|
5
5
|
#
|
6
6
|
# @see https://sass-lang.com/documentation/js-api/types/calculationvalue/
|
7
7
|
module CalculationValue
|
8
|
-
|
9
|
-
|
10
|
-
def assert_calculation_value(
|
11
|
-
|
8
|
+
private
|
9
|
+
|
10
|
+
def assert_calculation_value(value, name = nil)
|
11
|
+
if !value.is_a?(Sass::CalculationValue) || (value.is_a?(Sass::Value::String) && value.quoted?)
|
12
|
+
raise Sass::ScriptError.new(
|
13
|
+
"#{value} must be one of SassNumber, unquoted SassString, SassCalculation, CalculationOperation", name
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
value
|
12
18
|
end
|
13
19
|
end
|
14
20
|
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'open3'
|
4
|
+
|
5
|
+
require_relative '../../../ext/sass/cli'
|
6
|
+
|
7
|
+
module Sass
|
8
|
+
class Compiler
|
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
|
+
|
25
|
+
@stdin.binmode
|
26
|
+
|
27
|
+
Thread.new do
|
28
|
+
Thread.current.name = "sass-embedded-process-stdout-poller-#{@wait_thread.pid}"
|
29
|
+
|
30
|
+
# # https://dart.dev/tools/dart-devtools
|
31
|
+
# if 'dart' == File.basename(CLI::COMMAND.first, '.exe') && CLI::COMMAND.include?('--observe')
|
32
|
+
# Kernel.warn(@stdout.readline, uplevel: 0)
|
33
|
+
# Kernel.warn(@stdout.readline, uplevel: 0)
|
34
|
+
# end
|
35
|
+
|
36
|
+
@stdout.binmode
|
37
|
+
|
38
|
+
loop do
|
39
|
+
length = Varint.read(@stdout)
|
40
|
+
id = Varint.read(@stdout)
|
41
|
+
proto = @stdout.read(length - Varint.length(id))
|
42
|
+
dispatcher.receive_proto(id, proto)
|
43
|
+
end
|
44
|
+
rescue IOError, Errno::EBADF, Errno::EPROTO => e
|
45
|
+
dispatcher.error(e)
|
46
|
+
@mutex.synchronize do
|
47
|
+
@stdout.close
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
Thread.new do
|
52
|
+
Thread.current.name = "sass-embedded-process-stderr-poller-#{@wait_thread.pid}"
|
53
|
+
loop do
|
54
|
+
Kernel.warn(@stderr.readline, uplevel: 0)
|
55
|
+
end
|
56
|
+
rescue IOError, Errno::EBADF
|
57
|
+
@mutex.synchronize do
|
58
|
+
@stderr.close
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
@wait_thread.name = "sass-embedded-process-waiter-#{@wait_thread.pid}"
|
63
|
+
end
|
64
|
+
|
65
|
+
def close
|
66
|
+
@mutex.synchronize do
|
67
|
+
@stdin.close
|
68
|
+
@wait_thread.join
|
69
|
+
@stdout.close
|
70
|
+
@stderr.close
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def closed?
|
75
|
+
@mutex.synchronize do
|
76
|
+
@stdin.closed? && !@wait_thread.alive?
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def write(id, proto)
|
81
|
+
buffer = []
|
82
|
+
Varint.write(buffer, Varint.length(id) + proto.length)
|
83
|
+
Varint.write(buffer, id)
|
84
|
+
@mutex.synchronize do
|
85
|
+
@stdin.write(buffer.pack('C*'), proto)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
private_constant :Connection
|
91
|
+
end
|
92
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Sass
|
4
|
-
class
|
4
|
+
class Compiler
|
5
5
|
# The {Dispatcher} class.
|
6
6
|
#
|
7
7
|
# It dispatches messages between mutliple instances of {Host} and a single {Connection} to the compiler.
|
@@ -11,11 +11,12 @@ module Sass
|
|
11
11
|
@observers = {}
|
12
12
|
@mutex = Mutex.new
|
13
13
|
@connection = Connection.new(self)
|
14
|
+
ForkTracker.add(self)
|
14
15
|
end
|
15
16
|
|
16
17
|
def subscribe(observer)
|
17
18
|
@mutex.synchronize do
|
18
|
-
raise Errno::EBUSY if
|
19
|
+
raise Errno::EBUSY if _closed?
|
19
20
|
|
20
21
|
id = @id
|
21
22
|
@id = id.next
|
@@ -30,12 +31,12 @@ module Sass
|
|
30
31
|
|
31
32
|
return unless @observers.empty?
|
32
33
|
|
33
|
-
if
|
34
|
+
if _closed?
|
34
35
|
Thread.new do
|
35
36
|
close
|
36
37
|
end
|
37
38
|
else
|
38
|
-
|
39
|
+
_idle
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|
@@ -45,7 +46,11 @@ module Sass
|
|
45
46
|
end
|
46
47
|
|
47
48
|
def close
|
49
|
+
@mutex.synchronize do
|
50
|
+
_close
|
51
|
+
end
|
48
52
|
@connection.close
|
53
|
+
ForkTracker.delete(self)
|
49
54
|
end
|
50
55
|
|
51
56
|
def closed?
|
@@ -54,7 +59,7 @@ module Sass
|
|
54
59
|
|
55
60
|
def error(error)
|
56
61
|
observers = @mutex.synchronize do
|
57
|
-
|
62
|
+
_close
|
58
63
|
@observers.values
|
59
64
|
end
|
60
65
|
|
@@ -70,12 +75,12 @@ module Sass
|
|
70
75
|
def receive_proto(id, proto)
|
71
76
|
case id
|
72
77
|
when 1...0xffffffff
|
73
|
-
@mutex.synchronize { @observers[id] }
|
78
|
+
@mutex.synchronize { @observers[id] }&.receive_proto(proto)
|
74
79
|
when 0
|
75
80
|
outbound_message = EmbeddedProtocol::OutboundMessage.decode(proto)
|
76
81
|
oneof = outbound_message.message
|
77
82
|
message = outbound_message.public_send(oneof)
|
78
|
-
@mutex.synchronize { @observers[message.id] }
|
83
|
+
@mutex.synchronize { @observers[message.id] }&.public_send(oneof, message)
|
79
84
|
when 0xffffffff
|
80
85
|
outbound_message = EmbeddedProtocol::OutboundMessage.decode(proto)
|
81
86
|
oneof = outbound_message.message
|
@@ -90,6 +95,24 @@ module Sass
|
|
90
95
|
@connection.write(...)
|
91
96
|
end
|
92
97
|
|
98
|
+
private
|
99
|
+
|
100
|
+
def _close
|
101
|
+
@id = 0xffffffff
|
102
|
+
end
|
103
|
+
|
104
|
+
def _closed?
|
105
|
+
@id == 0xffffffff
|
106
|
+
end
|
107
|
+
|
108
|
+
def _idle
|
109
|
+
@id = 1
|
110
|
+
end
|
111
|
+
|
112
|
+
def _idle?
|
113
|
+
@id == 1
|
114
|
+
end
|
115
|
+
|
93
116
|
# The {Channel} between {Dispatcher} and {Host}.
|
94
117
|
class Channel
|
95
118
|
attr_reader :id
|
@@ -100,13 +123,11 @@ module Sass
|
|
100
123
|
end
|
101
124
|
|
102
125
|
def disconnect
|
103
|
-
@dispatcher.unsubscribe(id)
|
126
|
+
@dispatcher.unsubscribe(@id)
|
104
127
|
end
|
105
128
|
|
106
129
|
def error(...)
|
107
|
-
|
108
|
-
@dispatcher.error(...)
|
109
|
-
end
|
130
|
+
@dispatcher.error(...)
|
110
131
|
end
|
111
132
|
|
112
133
|
def send_proto(...)
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sass
|
4
|
+
class Compiler
|
5
|
+
# The {DispatcherManager} class.
|
6
|
+
#
|
7
|
+
# It manages the lifecycle of {Dispatcher}.
|
8
|
+
class DispatcherManager
|
9
|
+
def initialize(dispatcher_class)
|
10
|
+
@dispatcher_class = dispatcher_class
|
11
|
+
@dispatcher = @dispatcher_class.new
|
12
|
+
@mutex = Mutex.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def close
|
16
|
+
@mutex.synchronize do
|
17
|
+
unless @dispatcher.nil?
|
18
|
+
@dispatcher.close
|
19
|
+
@dispatcher = nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def closed?
|
25
|
+
@mutex.synchronize do
|
26
|
+
@dispatcher.nil?
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def connect(...)
|
31
|
+
@mutex.synchronize do
|
32
|
+
raise IOError, 'closed compiler' if @dispatcher.nil?
|
33
|
+
|
34
|
+
@dispatcher.connect(...)
|
35
|
+
rescue Errno::EBUSY
|
36
|
+
@dispatcher = @dispatcher_class.new
|
37
|
+
@dispatcher.connect(...)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private_constant :DispatcherManager
|
43
|
+
end
|
44
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Sass
|
4
|
-
class
|
4
|
+
class Compiler
|
5
5
|
class Host
|
6
6
|
# The {FunctionRegistry} class.
|
7
7
|
#
|
@@ -55,8 +55,8 @@ module Sass
|
|
55
55
|
|
56
56
|
EmbeddedProtocol::InboundMessage::FunctionCallResponse.new(
|
57
57
|
id: function_call_request.id,
|
58
|
-
success
|
59
|
-
accessed_argument_lists:
|
58
|
+
success:,
|
59
|
+
accessed_argument_lists:
|
60
60
|
)
|
61
61
|
rescue StandardError => e
|
62
62
|
EmbeddedProtocol::InboundMessage::FunctionCallResponse.new(
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Sass
|
4
|
-
class
|
4
|
+
class Compiler
|
5
5
|
class Host
|
6
6
|
# The {ImporterRegistry} class.
|
7
7
|
#
|
@@ -65,7 +65,7 @@ module Sass
|
|
65
65
|
|
66
66
|
EmbeddedProtocol::InboundMessage::CanonicalizeResponse.new(
|
67
67
|
id: canonicalize_request.id,
|
68
|
-
url:
|
68
|
+
url:
|
69
69
|
)
|
70
70
|
rescue StandardError => e
|
71
71
|
EmbeddedProtocol::InboundMessage::CanonicalizeResponse.new(
|
@@ -81,7 +81,7 @@ module Sass
|
|
81
81
|
EmbeddedProtocol::InboundMessage::ImportResponse.new(
|
82
82
|
id: import_request.id,
|
83
83
|
success: EmbeddedProtocol::InboundMessage::ImportResponse::ImportSuccess.new(
|
84
|
-
contents: importer_result.contents,
|
84
|
+
contents: importer_result.contents.to_str,
|
85
85
|
syntax: Protofier.to_proto_syntax(importer_result.syntax),
|
86
86
|
source_map_url: (importer_result.source_map_url&.to_s if importer_result.respond_to?(:source_map_url))
|
87
87
|
)
|
@@ -100,7 +100,7 @@ module Sass
|
|
100
100
|
|
101
101
|
EmbeddedProtocol::InboundMessage::FileImportResponse.new(
|
102
102
|
id: file_import_request.id,
|
103
|
-
file_url:
|
103
|
+
file_url:
|
104
104
|
)
|
105
105
|
rescue StandardError => e
|
106
106
|
EmbeddedProtocol::InboundMessage::FileImportResponse.new(
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Sass
|
4
|
-
class
|
4
|
+
class Compiler
|
5
5
|
class Host
|
6
6
|
# The {ValueProtofier} class.
|
7
7
|
#
|
@@ -16,7 +16,7 @@ module Sass
|
|
16
16
|
when Sass::Value::String
|
17
17
|
EmbeddedProtocol::Value.new(
|
18
18
|
string: EmbeddedProtocol::Value::String.new(
|
19
|
-
text: obj.text,
|
19
|
+
text: obj.text.to_str,
|
20
20
|
quoted: obj.quoted?
|
21
21
|
)
|
22
22
|
)
|
@@ -179,7 +179,7 @@ module Sass
|
|
179
179
|
end
|
180
180
|
)
|
181
181
|
when :compiler_function
|
182
|
-
Sass::Value::Function.new(nil
|
182
|
+
Sass::Value::Function.new(nil).instance_eval do
|
183
183
|
@id = obj.id
|
184
184
|
self
|
185
185
|
end
|
@@ -8,7 +8,7 @@ require_relative 'host/structifier'
|
|
8
8
|
require_relative 'host/value_protofier'
|
9
9
|
|
10
10
|
module Sass
|
11
|
-
class
|
11
|
+
class Compiler
|
12
12
|
# The {Host} class.
|
13
13
|
#
|
14
14
|
# It communicates with {Dispatcher} and handles the host logic.
|
@@ -35,16 +35,16 @@ module Sass
|
|
35
35
|
quiet_deps:,
|
36
36
|
verbose:)
|
37
37
|
compile_response = await do
|
38
|
-
alert_color =
|
38
|
+
alert_color = Exception.respond_to?(:to_tty?) && Exception.to_tty? if alert_color.nil?
|
39
39
|
|
40
|
-
@function_registry = FunctionRegistry.new(functions, alert_color:
|
41
|
-
@importer_registry = ImporterRegistry.new(importers, load_paths, alert_color:
|
40
|
+
@function_registry = FunctionRegistry.new(functions, alert_color:)
|
41
|
+
@importer_registry = ImporterRegistry.new(importers, load_paths, alert_color:)
|
42
42
|
@logger_registry = LoggerRegistry.new(logger)
|
43
43
|
|
44
44
|
send_message(compile_request: EmbeddedProtocol::InboundMessage::CompileRequest.new(
|
45
45
|
string: unless source.nil?
|
46
46
|
EmbeddedProtocol::InboundMessage::CompileRequest::StringInput.new(
|
47
|
-
source: source,
|
47
|
+
source: source.to_str,
|
48
48
|
url: url&.to_s,
|
49
49
|
syntax: Protofier.to_proto_syntax(syntax),
|
50
50
|
importer: (@importer_registry.register(importer) unless importer.nil?)
|
@@ -52,15 +52,15 @@ module Sass
|
|
52
52
|
end,
|
53
53
|
path: (File.absolute_path(path) unless path.nil?),
|
54
54
|
style: Protofier.to_proto_output_style(style),
|
55
|
-
charset
|
56
|
-
source_map
|
57
|
-
source_map_include_sources
|
55
|
+
charset:,
|
56
|
+
source_map:,
|
57
|
+
source_map_include_sources:,
|
58
58
|
importers: @importer_registry.importers,
|
59
59
|
global_functions: @function_registry.global_functions,
|
60
|
-
alert_ascii
|
61
|
-
alert_color
|
62
|
-
quiet_deps
|
63
|
-
verbose:
|
60
|
+
alert_ascii:,
|
61
|
+
alert_color:,
|
62
|
+
quiet_deps:,
|
63
|
+
verbose:
|
64
64
|
))
|
65
65
|
end
|
66
66
|
|
@@ -70,11 +70,18 @@ module Sass
|
|
70
70
|
def version_request
|
71
71
|
version_response = await0 do
|
72
72
|
send_message0(version_request: EmbeddedProtocol::InboundMessage::VersionRequest.new(
|
73
|
-
id:
|
73
|
+
id:
|
74
74
|
))
|
75
75
|
end
|
76
76
|
|
77
|
-
|
77
|
+
lang = case version_response.implementation_name
|
78
|
+
when /\bdart\b/i
|
79
|
+
'[Dart]'
|
80
|
+
else
|
81
|
+
'[?]'
|
82
|
+
end
|
83
|
+
|
84
|
+
"#{version_response.implementation_name}\t#{version_response.implementation_version}\t(Sass Compiler)\t#{lang}"
|
78
85
|
end
|
79
86
|
|
80
87
|
def compile_response(message)
|
@@ -100,6 +107,8 @@ module Sass
|
|
100
107
|
|
101
108
|
def log_event(message)
|
102
109
|
@logger_registry.log(message)
|
110
|
+
rescue StandardError => e
|
111
|
+
@channel.error(e)
|
103
112
|
end
|
104
113
|
|
105
114
|
def canonicalize_request(message)
|