sass-embedded 1.0.20 → 1.1.1
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 +2 -0
- data/ext/sass/Rakefile +85 -72
- data/lib/sass/embedded/host/value_protofier.rb +4 -3
- data/lib/sass/embedded/host.rb +5 -0
- data/lib/sass/embedded/version.rb +1 -1
- data/lib/sass/embedded.rb +0 -18
- data/lib/sass/logger.rb +3 -0
- data/lib/sass/script_error.rb +1 -0
- data/lib/sass/value/function.rb +5 -2
- data/lib/sass/value/number.rb +38 -11
- data/lib/sass/value/string.rb +1 -1
- data/lib/sass/value.rb +13 -0
- data/lib/sass.rb +11 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e63fe59310ae93bfce4710d847ee1a3d57a3678ea42754eebeb239c0510c933
|
4
|
+
data.tar.gz: d0f0e73bdd5952dfb1471ca23807584be64468e605f9e7c325e471b63d2a6f75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 416f46659daf522785ec25b98a1b40df6e07216cffa7783004706404b49da57626cfca7c4e4f52a2da7d4981aca89a85cb926f1a49686390b9f3ff963eb288cf
|
7
|
+
data.tar.gz: 7e5ffe58da7e814fab55ea43d17b16b7b53382b915cde3874e215b58919055c73e1120df8a5f934fe6aa71c70126cbe21965cf381ef45f024c982536e852ef7a
|
data/README.md
CHANGED
@@ -35,6 +35,8 @@ result = Sass.compile_string('h1 { font-size: 40px; }')
|
|
35
35
|
puts result.css
|
36
36
|
```
|
37
37
|
|
38
|
+
See [rubydoc.info/gems/sass-embedded](https://rubydoc.info/gems/sass-embedded) for full API documentation.
|
39
|
+
|
38
40
|
---
|
39
41
|
|
40
42
|
Disclaimer: this is not an official Google product.
|
data/ext/sass/Rakefile
CHANGED
@@ -63,45 +63,54 @@ module FileUtils
|
|
63
63
|
sh 'unzip', '-od', dest, archive
|
64
64
|
end
|
65
65
|
else
|
66
|
-
raise "Unknown archive format #{archive}"
|
66
|
+
raise ArgumentError, "Unknown archive format #{archive}"
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
def fetch(
|
71
|
-
require '
|
70
|
+
def fetch(source_uri, dest_path = nil)
|
71
|
+
require 'rubygems/remote_fetcher'
|
72
72
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
raise unless File.file?(path)
|
73
|
+
unless source_uri.is_a?(URI::Generic)
|
74
|
+
begin
|
75
|
+
source_uri = URI.parse(source_uri)
|
76
|
+
rescue StandardError
|
77
|
+
source_uri = URI.parse(URI::DEFAULT_PARSER.escape(source_uri.to_s))
|
79
78
|
end
|
80
|
-
|
81
|
-
|
79
|
+
end
|
80
|
+
|
81
|
+
scheme = source_uri.scheme
|
82
|
+
source_path = URI::DEFAULT_PARSER.unescape(source_uri.path)
|
82
83
|
|
83
|
-
|
84
|
-
|
84
|
+
if Gem.win_platform? && scheme =~ /^[a-z]$/i && !source_path.include?(':')
|
85
|
+
source_path = "#{scheme}:#{source_path}"
|
86
|
+
scheme = nil
|
85
87
|
end
|
86
88
|
|
87
|
-
|
89
|
+
dest_path = File.basename(source_path) if dest_path.nil?
|
88
90
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
unless Rake::FileUtilsExt.nowrite_flag
|
94
|
-
uri.open do |stream|
|
95
|
-
File.binwrite(dest, stream.read)
|
96
|
-
end
|
91
|
+
case scheme
|
92
|
+
when nil, 'file'
|
93
|
+
if Gem.win_platform? && source_path[0].chr == '/' && source_path[1].chr =~ /[a-z]/i && source_path[2].chr == ':'
|
94
|
+
source_path = source_path[1..]
|
97
95
|
end
|
96
|
+
cp source_path, dest_path
|
98
97
|
else
|
99
|
-
|
98
|
+
fetcher = Gem::RemoteFetcher.fetcher
|
99
|
+
symbol = "fetch_#{scheme}".to_sym
|
100
|
+
raise ArgumentError, "Unsupported URI scheme #{scheme}" unless fetcher.respond_to?(symbol)
|
101
|
+
|
102
|
+
if Rake::FileUtilsExt.verbose_flag
|
103
|
+
redacted_uri = Gem::RemoteFetcher::FetchError.new('', source_uri).uri
|
104
|
+
Rake.rake_output_message "fetch #{redacted_uri}"
|
105
|
+
end
|
106
|
+
|
107
|
+
unless Rake::FileUtilsExt.nowrite_flag
|
108
|
+
data = fetcher.public_send(symbol, source_uri)
|
109
|
+
Gem.write_binary(dest_path, data)
|
110
|
+
end
|
100
111
|
end
|
101
112
|
|
102
|
-
|
103
|
-
rescue StandardError
|
104
|
-
raise IOError, "Failed to fetch #{uri_or_path}"
|
113
|
+
dest_path
|
105
114
|
end
|
106
115
|
end
|
107
116
|
|
@@ -111,6 +120,8 @@ module Configuration
|
|
111
120
|
OS = case RbConfig::CONFIG['host_os'].downcase
|
112
121
|
when /darwin/
|
113
122
|
'darwin'
|
123
|
+
when /linux-musl/
|
124
|
+
'linux-musl'
|
114
125
|
when /linux/
|
115
126
|
'linux'
|
116
127
|
when *Gem::WIN_PATTERNS
|
@@ -119,23 +130,25 @@ module Configuration
|
|
119
130
|
RbConfig::CONFIG['host_os'].downcase
|
120
131
|
end
|
121
132
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
133
|
+
CPU = case RbConfig::CONFIG['host_cpu'].downcase
|
134
|
+
when /amd64|x86_64|x64/
|
135
|
+
'x86_64'
|
136
|
+
when /i\d86|x86|i86pc/
|
137
|
+
'i386'
|
138
|
+
when /arm64|aarch64/
|
139
|
+
'aarch64'
|
140
|
+
when /arm/
|
141
|
+
# Ruby before 3.0 reports "arm" instead of "arm64" as host_cpu on darwin
|
142
|
+
OS == 'darwin' ? 'aarch64' : 'arm'
|
143
|
+
when /ppc64le|powerpc64le/
|
144
|
+
'powerpc64le'
|
145
|
+
when /s390x/
|
146
|
+
's390x'
|
147
|
+
else
|
148
|
+
RbConfig::CONFIG['host_cpu']
|
149
|
+
end
|
150
|
+
|
151
|
+
ARCH = "#{CPU}-#{OS}"
|
139
152
|
end
|
140
153
|
|
141
154
|
private_constant :Platform
|
@@ -151,7 +164,7 @@ module Configuration
|
|
151
164
|
|
152
165
|
tag_name = spec['dependencies']['sass-embedded']
|
153
166
|
|
154
|
-
message = "sass_embedded for #{Platform::
|
167
|
+
message = "sass_embedded for #{Platform::ARCH} not available at #{repo}/releases/tag/#{tag_name}"
|
155
168
|
|
156
169
|
os = case Platform::OS
|
157
170
|
when 'darwin'
|
@@ -164,20 +177,20 @@ module Configuration
|
|
164
177
|
raise NotImplementedError, message
|
165
178
|
end
|
166
179
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
180
|
+
cpu = case Platform::CPU
|
181
|
+
when 'i386'
|
182
|
+
'ia32'
|
183
|
+
when 'x86_64'
|
184
|
+
'x64'
|
185
|
+
when 'aarch64'
|
186
|
+
Platform::OS == 'darwin' ? 'x64' : 'arm64'
|
187
|
+
else
|
188
|
+
raise NotImplementedError, message
|
189
|
+
end
|
177
190
|
|
178
191
|
ext = Gem.win_platform? ? 'zip' : 'tar.gz'
|
179
192
|
|
180
|
-
"#{repo}/releases/download/#{tag_name}/sass_embedded-#{tag_name}-#{os}-#{
|
193
|
+
"#{repo}/releases/download/#{tag_name}/sass_embedded-#{tag_name}-#{os}-#{cpu}.#{ext}"
|
181
194
|
end
|
182
195
|
|
183
196
|
def default_protoc
|
@@ -185,7 +198,7 @@ module Configuration
|
|
185
198
|
|
186
199
|
version = Gem::Dependency.new('google-protobuf').to_spec.version
|
187
200
|
|
188
|
-
message = "protoc for #{Platform::
|
201
|
+
message = "protoc for #{Platform::ARCH} not available at #{repo}/#{version}"
|
189
202
|
|
190
203
|
os = case Platform::OS
|
191
204
|
when 'darwin'
|
@@ -198,22 +211,22 @@ module Configuration
|
|
198
211
|
raise NotImplementedError, message
|
199
212
|
end
|
200
213
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
"#{repo}/#{version}/protoc-#{version}-#{os}-#{
|
214
|
+
cpu = case Platform::CPU
|
215
|
+
when 'i386'
|
216
|
+
'x86_32'
|
217
|
+
when 'x86_64'
|
218
|
+
'x86_64'
|
219
|
+
when 'aarch64'
|
220
|
+
'aarch_64'
|
221
|
+
when 'powerpc64le'
|
222
|
+
'ppcle_64'
|
223
|
+
when 's390x'
|
224
|
+
's390_64'
|
225
|
+
else
|
226
|
+
raise NotImplementedError, message
|
227
|
+
end
|
228
|
+
|
229
|
+
"#{repo}/#{version}/protoc-#{version}-#{os}-#{cpu}.exe"
|
217
230
|
end
|
218
231
|
|
219
232
|
def default_sass_embedded_protocol
|
@@ -124,9 +124,10 @@ module Sass
|
|
124
124
|
)
|
125
125
|
when :number
|
126
126
|
Sass::Value::Number.new(
|
127
|
-
obj.value,
|
128
|
-
|
129
|
-
|
127
|
+
obj.value, {
|
128
|
+
numerator_units: obj.numerators.to_a,
|
129
|
+
denominator_units: obj.denominators.to_a
|
130
|
+
}
|
130
131
|
)
|
131
132
|
when :rgb_color
|
132
133
|
Sass::Value::Color.new(
|
data/lib/sass/embedded/host.rb
CHANGED
data/lib/sass/embedded.rb
CHANGED
@@ -9,30 +9,12 @@ require_relative 'embedded/channel'
|
|
9
9
|
require_relative 'embedded/compiler'
|
10
10
|
require_relative 'embedded/dispatcher'
|
11
11
|
require_relative 'embedded/host'
|
12
|
-
require_relative 'embedded/host/function_registry'
|
13
|
-
require_relative 'embedded/host/importer_registry'
|
14
|
-
require_relative 'embedded/host/logger_registry'
|
15
|
-
require_relative 'embedded/host/value_protofier'
|
16
12
|
require_relative 'embedded/protofier'
|
17
13
|
require_relative 'embedded/structifier'
|
18
14
|
require_relative 'embedded/varint'
|
19
15
|
require_relative 'embedded/version'
|
20
16
|
require_relative 'logger'
|
21
|
-
require_relative 'logger/source_location'
|
22
|
-
require_relative 'logger/source_span'
|
23
|
-
require_relative 'script_error'
|
24
17
|
require_relative 'value'
|
25
|
-
require_relative 'value/list'
|
26
|
-
require_relative 'value/argument_list'
|
27
|
-
require_relative 'value/boolean'
|
28
|
-
require_relative 'value/color'
|
29
|
-
require_relative 'value/function'
|
30
|
-
require_relative 'value/fuzzy_math'
|
31
|
-
require_relative 'value/map'
|
32
|
-
require_relative 'value/null'
|
33
|
-
require_relative 'value/number'
|
34
|
-
require_relative 'value/number/unit'
|
35
|
-
require_relative 'value/string'
|
36
18
|
|
37
19
|
module Sass
|
38
20
|
# The {Embedded} host for using dart-sass-embedded. Each instance creates
|
data/lib/sass/logger.rb
CHANGED
data/lib/sass/script_error.rb
CHANGED
data/lib/sass/value/function.rb
CHANGED
@@ -8,8 +8,11 @@ module Sass
|
|
8
8
|
class Function
|
9
9
|
include Value
|
10
10
|
|
11
|
-
# @
|
12
|
-
#
|
11
|
+
# @overload initialize(id)
|
12
|
+
# @param id [Numeric]
|
13
|
+
# @overload initialize(signature, callback)
|
14
|
+
# @param signature [::String]
|
15
|
+
# @param callback [Proc]
|
13
16
|
def initialize(id_or_signature, callback = nil)
|
14
17
|
if id_or_signature.is_a? Numeric
|
15
18
|
@id = id_or_signature
|
data/lib/sass/value/number.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'number/unit'
|
4
|
+
|
3
5
|
module Sass
|
4
6
|
module Value
|
5
7
|
# Sass's number type.
|
@@ -9,11 +11,26 @@ module Sass
|
|
9
11
|
include Value
|
10
12
|
|
11
13
|
# @param value [Numeric]
|
12
|
-
# @param
|
13
|
-
# @
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
# @param unit [::String, Hash]
|
15
|
+
# @option unit [Array<::String>] :numerator_units
|
16
|
+
# @option unit [Array<::String>] :denominator_units
|
17
|
+
def initialize(value, unit = nil)
|
18
|
+
case unit
|
19
|
+
when nil
|
20
|
+
numerator_units = []
|
21
|
+
denominator_units = []
|
22
|
+
when ::String
|
23
|
+
numerator_units = [unit]
|
24
|
+
denominator_units = []
|
25
|
+
when ::Hash
|
26
|
+
numerator_units = unit.fetch(:numerator_units, [])
|
27
|
+
raise error "invalid numerator_units #{numerator_units.inspect}" unless numerator_units.is_a? Array
|
28
|
+
|
29
|
+
denominator_units = unit.fetch(:denominator_units, [])
|
30
|
+
raise error "invalid denominator_units #{denominator_units.inspect}" unless denominator_units.is_a? Array
|
31
|
+
else
|
32
|
+
raise error "invalid unit #{unit.inspect}"
|
33
|
+
end
|
17
34
|
|
18
35
|
unless denominator_units.empty? && numerator_units.empty?
|
19
36
|
value = value.dup
|
@@ -159,8 +176,10 @@ module Sass
|
|
159
176
|
# @param new_denominator_units [Array<::String>]
|
160
177
|
# @return [Number]
|
161
178
|
def convert(new_numerator_units, new_denominator_units, name = nil)
|
162
|
-
Number.new(convert_value(new_numerator_units, new_denominator_units, name),
|
163
|
-
|
179
|
+
Number.new(convert_value(new_numerator_units, new_denominator_units, name), {
|
180
|
+
numerator_units: new_numerator_units,
|
181
|
+
denominator_units: new_denominator_units
|
182
|
+
})
|
164
183
|
end
|
165
184
|
|
166
185
|
# @param new_numerator_units [Array<::String>]
|
@@ -175,7 +194,10 @@ module Sass
|
|
175
194
|
# @param other [Number]
|
176
195
|
# @return [Number]
|
177
196
|
def convert_to_match(other, name = nil, other_name = nil)
|
178
|
-
Number.new(convert_value_to_match(other, name, other_name),
|
197
|
+
Number.new(convert_value_to_match(other, name, other_name), {
|
198
|
+
numerator_units: other.numerator_units,
|
199
|
+
denominator_units: other.denominator_units
|
200
|
+
})
|
179
201
|
end
|
180
202
|
|
181
203
|
# @param other [Number]
|
@@ -192,8 +214,10 @@ module Sass
|
|
192
214
|
# @param new_denominator_units [Array<::String>]
|
193
215
|
# @return [Number]
|
194
216
|
def coerce(new_numerator_units, new_denominator_units, name = nil)
|
195
|
-
Number.new(coerce_value(new_numerator_units, new_denominator_units, name),
|
196
|
-
|
217
|
+
Number.new(coerce_value(new_numerator_units, new_denominator_units, name), {
|
218
|
+
numerator_units: new_numerator_units,
|
219
|
+
denominator_units: new_denominator_units
|
220
|
+
})
|
197
221
|
end
|
198
222
|
|
199
223
|
# @param new_numerator_units [Array<::String>]
|
@@ -214,7 +238,10 @@ module Sass
|
|
214
238
|
# @param other [Number]
|
215
239
|
# @return [Number]
|
216
240
|
def coerce_to_match(other, name = nil, other_name = nil)
|
217
|
-
Number.new(coerce_value_to_match(other, name, other_name),
|
241
|
+
Number.new(coerce_value_to_match(other, name, other_name), {
|
242
|
+
numerator_units: other.numerator_units,
|
243
|
+
denominator_units: other.denominator_units
|
244
|
+
})
|
218
245
|
end
|
219
246
|
|
220
247
|
# @param other [Number]
|
data/lib/sass/value/string.rb
CHANGED
data/lib/sass/value.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'script_error'
|
4
|
+
|
3
5
|
module Sass
|
4
6
|
# The abstract base class of Sass's value types.
|
5
7
|
#
|
@@ -117,3 +119,14 @@ module Sass
|
|
117
119
|
end
|
118
120
|
end
|
119
121
|
end
|
122
|
+
|
123
|
+
require_relative 'value/list'
|
124
|
+
require_relative 'value/argument_list'
|
125
|
+
require_relative 'value/boolean'
|
126
|
+
require_relative 'value/color'
|
127
|
+
require_relative 'value/function'
|
128
|
+
require_relative 'value/fuzzy_math'
|
129
|
+
require_relative 'value/map'
|
130
|
+
require_relative 'value/null'
|
131
|
+
require_relative 'value/number'
|
132
|
+
require_relative 'value/string'
|
data/lib/sass.rb
CHANGED
@@ -13,21 +13,27 @@ require_relative 'sass/embedded'
|
|
13
13
|
# Sass.compile_string('h1 { font-size: 40px; }')
|
14
14
|
module Sass
|
15
15
|
class << self
|
16
|
-
#
|
17
|
-
# @
|
16
|
+
# Compiles the Sass file at +path+ to CSS.
|
17
|
+
# @param (see Embedded#compile)
|
18
|
+
# @return (see Embedded#compile)
|
19
|
+
# @raise (see Embedded#compile)
|
18
20
|
# @see Embedded#compile
|
19
21
|
def compile(path, **kwargs)
|
20
22
|
instance.compile(path, **kwargs)
|
21
23
|
end
|
22
24
|
|
23
|
-
#
|
24
|
-
# @
|
25
|
+
# Compiles a stylesheet whose contents is +source+ to CSS.
|
26
|
+
# @param (see Embedded#compile_string)
|
27
|
+
# @return (see Embedded#compile_string)
|
28
|
+
# @raise (see Embedded#compile_string)
|
25
29
|
# @see Embedded#compile_string
|
26
30
|
def compile_string(source, **kwargs)
|
27
31
|
instance.compile_string(source, **kwargs)
|
28
32
|
end
|
29
33
|
|
30
|
-
# @
|
34
|
+
# @param (see Embedded#info)
|
35
|
+
# @return (see Embedded#info)
|
36
|
+
# @raise (see Embedded#info)
|
31
37
|
# @see Embedded#info
|
32
38
|
def info
|
33
39
|
instance.info
|
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.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- なつき
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -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://
|
164
|
-
source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v1.
|
163
|
+
documentation_uri: https://rubydoc.info/gems/sass-embedded/1.1.1
|
164
|
+
source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v1.1.1
|
165
165
|
funding_uri: https://github.com/sponsors/ntkme
|
166
166
|
post_install_message:
|
167
167
|
rdoc_options: []
|