sass-embedded 1.57.1 → 1.58.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/sass/Rakefile +30 -6
- data/ext/sass/package.json +1 -1
- data/lib/sass/embedded/compiler.rb +1 -1
- data/lib/sass/embedded/dispatcher.rb +9 -2
- data/lib/sass/embedded/host.rb +6 -2
- data/lib/sass/embedded/varint.rb +1 -1
- data/lib/sass/embedded/version.rb +1 -1
- data/lib/sass/embedded.rb +50 -44
- data/lib/sass/value/argument_list.rb +7 -0
- data/lib/sass/value/color.rb +6 -6
- data/lib/sass/value/number/unit.rb +2 -2
- data/lib/sass/value/number.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c922302bd463c0eade0a9a6c0dec35ac4d2e8af5535045983417fe029eec80e6
|
4
|
+
data.tar.gz: 964e801badaf2a191468a9778c77f3f5a2d1489e823b34903deba9a7f6f96040
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c14cf67e6ffd6f7079df0d01ba178bf2c5e9717040dedf5d18f3872afa0e03c2063b5c3eaf63403efc6b1e2e2d1fca63e34fb6feb6c05734537e6a136dc16159
|
7
|
+
data.tar.gz: d7f99f709188d47359cbe02b6af3d319740b6e4c68272eadfcd59688ec7b4bea405fbebf6a75af69187ba6a92b6c032157e7ec6afc8ded83b18ec1ca325e7e96
|
data/ext/sass/Rakefile
CHANGED
@@ -21,13 +21,34 @@ file 'sass_embedded' do |t|
|
|
21
21
|
archive = fetch(ENV.fetch(t.name.upcase) { Configuration.default_sass_embedded })
|
22
22
|
unarchive archive
|
23
23
|
rm archive
|
24
|
+
|
25
|
+
if ENV.key?('NIX_BINTOOLS')
|
26
|
+
sh 'patchelf',
|
27
|
+
'--set-interpreter', File.read("#{ENV.fetch('NIX_BINTOOLS')}/nix-support/dynamic-linker").chomp,
|
28
|
+
(['sass_embedded/src/dart', 'sass_embedded/dart-sass-embedded'].find { |exe| File.exist?(exe) })
|
29
|
+
end
|
24
30
|
end
|
25
31
|
|
26
32
|
file 'embedded.rb' => %w[sass_embedded] do |t|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
raise "#{
|
33
|
+
exe = 'sass_embedded/dart-sass-embedded'
|
34
|
+
exe = "#{exe}#{['', '.bat', '.exe'].find { |ext| File.exist?("#{exe}#{ext}") }}"
|
35
|
+
|
36
|
+
raise "#{exe} not found" unless File.exist?(exe)
|
37
|
+
|
38
|
+
runtime = 'sass_embedded/src/dart'
|
39
|
+
runtime = "#{runtime}#{['', '.exe'].find { |ext| File.exist?("#{runtime}#{ext}") }}"
|
40
|
+
snapshot = 'sass_embedded/src/dart-sass-embedded.snapshot'
|
41
|
+
|
42
|
+
command = if File.exist?(runtime) && File.exist?(snapshot)
|
43
|
+
"
|
44
|
+
File.absolute_path('#{runtime}', __dir__),
|
45
|
+
File.absolute_path('#{snapshot}', __dir__)
|
46
|
+
"
|
47
|
+
else
|
48
|
+
"
|
49
|
+
File.absolute_path('#{exe}', __dir__)
|
50
|
+
"
|
51
|
+
end
|
31
52
|
|
32
53
|
File.write(t.name, <<~EMBEDDED_RB)
|
33
54
|
# frozen_string_literal: true
|
@@ -35,7 +56,7 @@ file 'embedded.rb' => %w[sass_embedded] do |t|
|
|
35
56
|
module Sass
|
36
57
|
class Embedded
|
37
58
|
class Compiler
|
38
|
-
|
59
|
+
COMMAND = [#{command}].freeze
|
39
60
|
end
|
40
61
|
end
|
41
62
|
end
|
@@ -220,6 +241,9 @@ module Configuration
|
|
220
241
|
'macos'
|
221
242
|
when 'linux'
|
222
243
|
'linux'
|
244
|
+
when 'linux-musl'
|
245
|
+
repo = 'https://github.com/dart-musl/dart-sass-embedded'
|
246
|
+
'linux'
|
223
247
|
when 'windows'
|
224
248
|
'windows'
|
225
249
|
else
|
@@ -285,7 +309,7 @@ module Configuration
|
|
285
309
|
require 'open3'
|
286
310
|
require_relative 'embedded'
|
287
311
|
|
288
|
-
stdout, stderr, status = Open3.capture3(Sass::Embedded::Compiler::
|
312
|
+
stdout, stderr, status = Open3.capture3(*Sass::Embedded::Compiler::COMMAND, '--version')
|
289
313
|
|
290
314
|
raise stderr unless status.success?
|
291
315
|
|
data/ext/sass/package.json
CHANGED
@@ -9,7 +9,7 @@ module Sass
|
|
9
9
|
# It runs the `dart-sass-embedded` process.
|
10
10
|
class Compiler
|
11
11
|
def initialize
|
12
|
-
@stdin, @stdout, @stderr, @wait_thread = Open3.popen3(
|
12
|
+
@stdin, @stdout, @stderr, @wait_thread = Open3.popen3(*COMMAND, chdir: __dir__)
|
13
13
|
@stdin.binmode
|
14
14
|
@stdout.binmode
|
15
15
|
@stdin_mutex = Mutex.new
|
@@ -44,7 +44,13 @@ module Sass
|
|
44
44
|
@mutex.synchronize do
|
45
45
|
@observers.delete(id)
|
46
46
|
|
47
|
-
|
47
|
+
return unless @observers.empty?
|
48
|
+
|
49
|
+
if @id == PROTOCOL_ERROR_ID
|
50
|
+
close
|
51
|
+
else
|
52
|
+
@id = 0
|
53
|
+
end
|
48
54
|
end
|
49
55
|
end
|
50
56
|
|
@@ -57,7 +63,8 @@ module Sass
|
|
57
63
|
end
|
58
64
|
|
59
65
|
def send_message(**kwargs)
|
60
|
-
|
66
|
+
inbound_message = EmbeddedProtocol::InboundMessage.new(**kwargs)
|
67
|
+
@compiler.write(inbound_message.to_proto)
|
61
68
|
end
|
62
69
|
|
63
70
|
private
|
data/lib/sass/embedded/host.rb
CHANGED
@@ -32,7 +32,7 @@ module Sass
|
|
32
32
|
logger:,
|
33
33
|
quiet_deps:,
|
34
34
|
verbose:)
|
35
|
-
await do
|
35
|
+
compile_response = await do
|
36
36
|
alert_color = $stderr.tty? if alert_color.nil?
|
37
37
|
|
38
38
|
@function_registry = FunctionRegistry.new(functions, alert_color: alert_color)
|
@@ -62,14 +62,18 @@ module Sass
|
|
62
62
|
verbose: verbose
|
63
63
|
))
|
64
64
|
end
|
65
|
+
|
66
|
+
Protofier.from_proto_compile_response(compile_response)
|
65
67
|
end
|
66
68
|
|
67
69
|
def version_request
|
68
|
-
await do
|
70
|
+
version_response = await do
|
69
71
|
send_message(version_request: EmbeddedProtocol::InboundMessage::VersionRequest.new(
|
70
72
|
id: id
|
71
73
|
))
|
72
74
|
end
|
75
|
+
|
76
|
+
"sass-embedded\t#{version_response.implementation_version}"
|
73
77
|
end
|
74
78
|
|
75
79
|
def log_event(message)
|
data/lib/sass/embedded/varint.rb
CHANGED
data/lib/sass/embedded.rb
CHANGED
@@ -28,8 +28,13 @@ require_relative 'value'
|
|
28
28
|
# @example
|
29
29
|
# Sass.compile_string('h1 { font-size: 40px; }')
|
30
30
|
module Sass
|
31
|
+
@instance = nil
|
32
|
+
@mutex = Mutex.new
|
33
|
+
|
34
|
+
# rubocop:disable Layout/LineLength
|
31
35
|
class << self
|
32
36
|
# Compiles the Sass file at +path+ to CSS.
|
37
|
+
# @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, logger: nil, quiet_deps: false, verbose: false)
|
33
38
|
# @param (see Embedded#compile)
|
34
39
|
# @return (see Embedded#compile)
|
35
40
|
# @raise (see Embedded#compile)
|
@@ -39,6 +44,7 @@ module Sass
|
|
39
44
|
end
|
40
45
|
|
41
46
|
# Compiles a stylesheet whose contents is +source+ to CSS.
|
47
|
+
# @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, logger: nil, quiet_deps: false, verbose: false)
|
42
48
|
# @param (see Embedded#compile_string)
|
43
49
|
# @return (see Embedded#compile_string)
|
44
50
|
# @raise (see Embedded#compile_string)
|
@@ -58,17 +64,21 @@ module Sass
|
|
58
64
|
private
|
59
65
|
|
60
66
|
def instance
|
61
|
-
if
|
62
|
-
|
63
|
-
|
67
|
+
return @instance if @instance
|
68
|
+
|
69
|
+
@mutex.synchronize do
|
70
|
+
return @instance if @instance
|
71
|
+
|
64
72
|
@instance = Embedded.new
|
65
73
|
at_exit do
|
66
74
|
@instance.close
|
67
75
|
end
|
68
76
|
end
|
77
|
+
|
69
78
|
@instance
|
70
79
|
end
|
71
80
|
end
|
81
|
+
# rubocop:enable Layout/LineLength
|
72
82
|
|
73
83
|
# The {Embedded} host for using dart-sass-embedded. Each instance creates
|
74
84
|
# its own communication {Channel} with a dedicated compiler process.
|
@@ -129,26 +139,24 @@ module Sass
|
|
129
139
|
verbose: false)
|
130
140
|
raise ArgumentError, 'path must be set' if path.nil?
|
131
141
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
verbose: verbose
|
151
|
-
)
|
142
|
+
Host.new(@channel).compile_request(
|
143
|
+
path: path,
|
144
|
+
source: nil,
|
145
|
+
importer: nil,
|
146
|
+
load_paths: load_paths,
|
147
|
+
syntax: nil,
|
148
|
+
url: nil,
|
149
|
+
charset: charset,
|
150
|
+
source_map: source_map,
|
151
|
+
source_map_include_sources: source_map_include_sources,
|
152
|
+
style: style,
|
153
|
+
functions: functions,
|
154
|
+
importers: importers,
|
155
|
+
alert_color: alert_color,
|
156
|
+
alert_ascii: alert_ascii,
|
157
|
+
logger: logger,
|
158
|
+
quiet_deps: quiet_deps,
|
159
|
+
verbose: verbose
|
152
160
|
)
|
153
161
|
end
|
154
162
|
|
@@ -205,33 +213,31 @@ module Sass
|
|
205
213
|
verbose: false)
|
206
214
|
raise ArgumentError, 'source must be set' if source.nil?
|
207
215
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
verbose: verbose
|
227
|
-
)
|
216
|
+
Host.new(@channel).compile_request(
|
217
|
+
path: nil,
|
218
|
+
source: source,
|
219
|
+
importer: importer,
|
220
|
+
load_paths: load_paths,
|
221
|
+
syntax: syntax,
|
222
|
+
url: url,
|
223
|
+
charset: charset,
|
224
|
+
source_map: source_map,
|
225
|
+
source_map_include_sources: source_map_include_sources,
|
226
|
+
style: style,
|
227
|
+
functions: functions,
|
228
|
+
importers: importers,
|
229
|
+
alert_color: alert_color,
|
230
|
+
alert_ascii: alert_ascii,
|
231
|
+
logger: logger,
|
232
|
+
quiet_deps: quiet_deps,
|
233
|
+
verbose: verbose
|
228
234
|
)
|
229
235
|
end
|
230
236
|
|
231
237
|
# @return [String] Information about the Sass implementation.
|
232
238
|
# @see https://sass-lang.com/documentation/js-api/modules#info
|
233
239
|
def info
|
234
|
-
@info ||=
|
240
|
+
@info ||= Host.new(@channel).version_request
|
235
241
|
end
|
236
242
|
|
237
243
|
def close
|
data/lib/sass/value/color.rb
CHANGED
@@ -178,21 +178,21 @@ module Sass
|
|
178
178
|
if max == min
|
179
179
|
@hue = 0
|
180
180
|
elsif max == scaled_red
|
181
|
-
@hue = (
|
181
|
+
@hue = ((scaled_green - scaled_blue) * 60 / delta) % 360
|
182
182
|
elsif max == scaled_green
|
183
|
-
@hue = (
|
183
|
+
@hue = (((scaled_blue - scaled_red) * 60 / delta) + 120) % 360
|
184
184
|
elsif max == scaled_blue
|
185
|
-
@hue = (
|
185
|
+
@hue = (((scaled_red - scaled_green) * 60 / delta) + 240) % 360
|
186
186
|
end
|
187
187
|
|
188
|
-
lightness = @lightness =
|
188
|
+
lightness = @lightness = (max + min) * 50
|
189
189
|
|
190
190
|
@saturation = if max == min
|
191
191
|
0
|
192
192
|
elsif lightness < 50
|
193
|
-
|
193
|
+
delta * 100 / (max + min)
|
194
194
|
else
|
195
|
-
|
195
|
+
delta * 100 / (2 - max - min)
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
@@ -88,12 +88,12 @@ module Sass
|
|
88
88
|
'deg' => Rational(Math::PI, 180),
|
89
89
|
'grad' => Rational(Math::PI, 200),
|
90
90
|
'rad' => Rational(1),
|
91
|
-
'turn' => Rational(
|
91
|
+
'turn' => Rational(Math::PI * 2)
|
92
92
|
},
|
93
93
|
'turn' => {
|
94
94
|
'deg' => Rational(1, 360),
|
95
95
|
'grad' => Rational(1, 400),
|
96
|
-
'rad' => Rational(1,
|
96
|
+
'rad' => Rational(1, Math::PI * 2),
|
97
97
|
'turn' => Rational(1)
|
98
98
|
},
|
99
99
|
|
data/lib/sass/value/number.rb
CHANGED
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.
|
4
|
+
version: 1.58.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- なつき
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.44.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.44.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop-performance
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 2.
|
103
|
+
version: 2.18.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 2.
|
110
|
+
version: 2.18.0
|
111
111
|
description: A Ruby library that will communicate with Embedded Dart Sass using the
|
112
112
|
Embedded Sass protocol.
|
113
113
|
email:
|
@@ -160,8 +160,8 @@ homepage: https://github.com/ntkme/sass-embedded-host-ruby
|
|
160
160
|
licenses:
|
161
161
|
- MIT
|
162
162
|
metadata:
|
163
|
-
documentation_uri: https://rubydoc.info/gems/sass-embedded/1.
|
164
|
-
source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v1.
|
163
|
+
documentation_uri: https://rubydoc.info/gems/sass-embedded/1.58.0
|
164
|
+
source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v1.58.0
|
165
165
|
funding_uri: https://github.com/sponsors/ntkme
|
166
166
|
post_install_message:
|
167
167
|
rdoc_options: []
|
@@ -178,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
178
|
- !ruby/object:Gem::Version
|
179
179
|
version: '0'
|
180
180
|
requirements: []
|
181
|
-
rubygems_version: 3.
|
181
|
+
rubygems_version: 3.4.6
|
182
182
|
signing_key:
|
183
183
|
specification_version: 4
|
184
184
|
summary: Use dart-sass with Ruby!
|