sass-embedded 0.16.0 → 0.18.0
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/ext/sass/extconf.rb +4 -49
- data/ext/sass/package.json +5 -0
- data/lib/sass/compile_error.rb +11 -3
- data/lib/sass/embedded/compile_context/function_registry.rb +12 -7
- data/lib/sass/embedded/compile_context/importer_registry.rb +9 -5
- data/lib/sass/embedded/compile_context/logger_registry.rb +45 -0
- data/lib/sass/embedded/compile_context/value_protofier.rb +237 -0
- data/lib/sass/embedded/compile_context.rb +25 -77
- data/lib/sass/embedded/compiler.rb +7 -24
- data/lib/sass/embedded/protofier.rb +55 -293
- data/lib/sass/embedded/structifier.rb +34 -0
- data/lib/sass/embedded/varint.rb +33 -0
- data/lib/sass/embedded/version.rb +1 -1
- data/lib/sass/value.rb +1 -1
- data/lib/sass.rb +4 -1
- metadata +9 -6
- data/lib/sass/embedded/compiler/path.rb +0 -11
- data/lib/sass/embedded/compiler/requirements.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d3305290374a056f10b9d2cb5df79a8bf3d262e8dd7e2528e8ded8b53658bc6
|
4
|
+
data.tar.gz: 2a5826eefe6eef8aadc3a4beba40c85a573b9fe3f8f4ac36e0d923a02b6264c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74777ec7d2869d83a1cf27dbc5b6751126f73ff4ed01c0af16b85162fd3456f46b73ba8ad64dd758c36b2819d2ccf3a958a951b4615e2dfa73db758a39fff21e
|
7
|
+
data.tar.gz: a648b472413cbb7063dd6cf9a988034bd0da668ab4c06c16f02c395a26d09d064dd46f57c6f99487ed4998bc0de35806f2f5f49a83487436efb8ff6ab459d2a9
|
data/ext/sass/extconf.rb
CHANGED
@@ -5,8 +5,7 @@ require 'fileutils'
|
|
5
5
|
require 'json'
|
6
6
|
require 'mkmf'
|
7
7
|
require 'open-uri'
|
8
|
-
require_relative '../../lib/sass/embedded/compiler
|
9
|
-
require_relative '../../lib/sass/embedded/compiler/requirements'
|
8
|
+
require_relative '../../lib/sass/embedded/compiler'
|
10
9
|
|
11
10
|
module Sass
|
12
11
|
class Embedded
|
@@ -123,56 +122,12 @@ module Sass
|
|
123
122
|
raise
|
124
123
|
end
|
125
124
|
|
126
|
-
def resolve_tag_name(repo, *requirements, gh_release: true)
|
127
|
-
requirements = Gem::Requirement.create(*requirements)
|
128
|
-
|
129
|
-
satisfied = lambda { |version|
|
130
|
-
Gem::Version.correct?(version) && requirements.satisfied_by?(Gem::Version.new(version))
|
131
|
-
}
|
132
|
-
|
133
|
-
headers = {}
|
134
|
-
headers['Authorization'] = "token #{ENV['GITHUB_TOKEN']}" if ENV['GITHUB_TOKEN']
|
135
|
-
|
136
|
-
begin
|
137
|
-
if gh_release
|
138
|
-
releases_uri = "https://github.com/#{repo}/releases"
|
139
|
-
uri = "#{releases_uri}/latest"
|
140
|
-
tag_name = URI.parse(uri).open do |file|
|
141
|
-
return nil if file.base_uri == releases_uri
|
142
|
-
|
143
|
-
latest = File.basename file.base_uri.to_s
|
144
|
-
latest if satisfied.call latest
|
145
|
-
end
|
146
|
-
|
147
|
-
return tag_name unless tag_name.nil?
|
148
|
-
|
149
|
-
uri = "https://api.github.com/repos/#{repo}/releases?per_page=100"
|
150
|
-
tag_name = URI.parse(uri).open(headers) do |file|
|
151
|
-
JSON.parse(file.read).map { |release| release['tag_name'] }
|
152
|
-
end
|
153
|
-
.find(satisfied)&.peek
|
154
|
-
else
|
155
|
-
uri = "https://api.github.com/repos/#{repo}/tags?per_page=100"
|
156
|
-
tag_name = URI.parse(uri).open(headers) do |file|
|
157
|
-
JSON.parse(file.read).map { |tag| tag['name'] }
|
158
|
-
end
|
159
|
-
.find(satisfied)&.peek
|
160
|
-
end
|
161
|
-
|
162
|
-
return tag_name unless tag_name.nil?
|
163
|
-
rescue OpenURI::HTTPError => e
|
164
|
-
warn "WARNING: Error fetching #{uri}: #{e}"
|
165
|
-
end
|
166
|
-
|
167
|
-
requirements.requirements
|
168
|
-
.map { |requirement| requirement.last.to_s.gsub('.pre.', '-') }
|
169
|
-
.find(satisfied)&.peek
|
170
|
-
end
|
171
|
-
|
172
125
|
def default_sass_embedded
|
173
126
|
repo = 'sass/dart-sass-embedded'
|
174
127
|
|
175
|
-
|
128
|
+
spec = JSON.parse(File.read(File.absolute_path('package.json', __dir__)))
|
129
|
+
|
130
|
+
tag_name = spec['dependencies']['sass-embedded']
|
176
131
|
|
177
132
|
os = case Platform::OS
|
178
133
|
when 'darwin'
|
data/lib/sass/compile_error.rb
CHANGED
@@ -3,13 +3,21 @@
|
|
3
3
|
module Sass
|
4
4
|
# An exception thrown because a Sass compilation failed.
|
5
5
|
class CompileError < StandardError
|
6
|
-
attr_accessor :
|
6
|
+
attr_accessor :sass_stack, :span
|
7
7
|
|
8
|
-
def initialize(message,
|
8
|
+
def initialize(message, full_message, sass_stack, span)
|
9
9
|
super(message)
|
10
|
-
@
|
10
|
+
@full_message = full_message
|
11
11
|
@sass_stack = sass_stack
|
12
12
|
@span = span
|
13
13
|
end
|
14
|
+
|
15
|
+
def full_message(**kwargs)
|
16
|
+
if @full_message.nil?
|
17
|
+
super.full_message(**kwargs)
|
18
|
+
else
|
19
|
+
@full_message
|
20
|
+
end
|
21
|
+
end
|
14
22
|
end
|
15
23
|
end
|
@@ -7,7 +7,9 @@ module Sass
|
|
7
7
|
class FunctionRegistry
|
8
8
|
attr_reader :global_functions
|
9
9
|
|
10
|
-
def initialize(functions)
|
10
|
+
def initialize(functions, highlight:)
|
11
|
+
functions = functions.transform_keys(&:to_s)
|
12
|
+
|
11
13
|
@global_functions = functions.keys
|
12
14
|
@functions_by_name = functions.transform_keys do |signature|
|
13
15
|
signature = signature.chomp
|
@@ -18,9 +20,12 @@ module Sass
|
|
18
20
|
signature
|
19
21
|
end
|
20
22
|
end
|
23
|
+
|
24
|
+
@id = 0
|
21
25
|
@functions_by_id = {}
|
22
26
|
@ids_by_function = {}
|
23
|
-
|
27
|
+
|
28
|
+
@highlight = highlight
|
24
29
|
end
|
25
30
|
|
26
31
|
def register(function)
|
@@ -37,10 +42,10 @@ module Sass
|
|
37
42
|
|
38
43
|
def function_call(function_call_request)
|
39
44
|
arguments = function_call_request.arguments.map do |argument|
|
40
|
-
|
45
|
+
value_protofier.from_proto(argument)
|
41
46
|
end
|
42
47
|
|
43
|
-
success =
|
48
|
+
success = value_protofier.to_proto(get(function_call_request).call(arguments))
|
44
49
|
accessed_argument_lists = arguments
|
45
50
|
.filter do |argument|
|
46
51
|
argument.is_a?(Sass::Value::ArgumentList) && argument.instance_eval do
|
@@ -57,7 +62,7 @@ module Sass
|
|
57
62
|
rescue StandardError => e
|
58
63
|
EmbeddedProtocol::InboundMessage::FunctionCallResponse.new(
|
59
64
|
id: function_call_request.id,
|
60
|
-
error: e.
|
65
|
+
error: e.full_message(highlight: @highlight, order: :top)
|
61
66
|
)
|
62
67
|
end
|
63
68
|
|
@@ -72,8 +77,8 @@ module Sass
|
|
72
77
|
end
|
73
78
|
end
|
74
79
|
|
75
|
-
def
|
76
|
-
@
|
80
|
+
def value_protofier
|
81
|
+
@value_protofier ||= ValueProtofier.new(self)
|
77
82
|
end
|
78
83
|
end
|
79
84
|
|
@@ -7,7 +7,7 @@ module Sass
|
|
7
7
|
class ImporterRegistry
|
8
8
|
attr_reader :importers
|
9
9
|
|
10
|
-
def initialize(importers, load_paths)
|
10
|
+
def initialize(importers, load_paths, highlight:)
|
11
11
|
@id = 0
|
12
12
|
@importers_by_id = {}
|
13
13
|
@importers = importers
|
@@ -17,9 +17,13 @@ module Sass
|
|
17
17
|
path: File.absolute_path(load_path)
|
18
18
|
)
|
19
19
|
end)
|
20
|
+
|
21
|
+
@highlight = highlight
|
20
22
|
end
|
21
23
|
|
22
24
|
def register(importer)
|
25
|
+
importer = Structifier.to_struct(importer)
|
26
|
+
|
23
27
|
is_importer = importer.respond_to?(:canonicalize) && importer.respond_to?(:load)
|
24
28
|
is_file_importer = importer.respond_to?(:find_file_url)
|
25
29
|
|
@@ -50,13 +54,13 @@ module Sass
|
|
50
54
|
rescue StandardError => e
|
51
55
|
EmbeddedProtocol::InboundMessage::CanonicalizeResponse.new(
|
52
56
|
id: canonicalize_request.id,
|
53
|
-
error: e.
|
57
|
+
error: e.full_message(highlight: @highlight, order: :top)
|
54
58
|
)
|
55
59
|
end
|
56
60
|
|
57
61
|
def import(import_request)
|
58
62
|
importer = @importers_by_id[import_request.importer_id]
|
59
|
-
importer_result =
|
63
|
+
importer_result = Structifier.to_struct importer.load(import_request.url)
|
60
64
|
|
61
65
|
EmbeddedProtocol::InboundMessage::ImportResponse.new(
|
62
66
|
id: import_request.id,
|
@@ -69,7 +73,7 @@ module Sass
|
|
69
73
|
rescue StandardError => e
|
70
74
|
EmbeddedProtocol::InboundMessage::ImportResponse.new(
|
71
75
|
id: import_request.id,
|
72
|
-
error: e.
|
76
|
+
error: e.full_message(highlight: @highlight, order: :top)
|
73
77
|
)
|
74
78
|
end
|
75
79
|
|
@@ -86,7 +90,7 @@ module Sass
|
|
86
90
|
rescue StandardError => e
|
87
91
|
EmbeddedProtocol::InboundMessage::FileImportResponse.new(
|
88
92
|
id: file_import_request.id,
|
89
|
-
error: e.
|
93
|
+
error: e.full_message(highlight: @highlight, order: :top)
|
90
94
|
)
|
91
95
|
end
|
92
96
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sass
|
4
|
+
class Embedded
|
5
|
+
class CompileContext
|
6
|
+
# The {LoggerRegistry} for {CompileContext}.
|
7
|
+
class LoggerRegistry
|
8
|
+
attr_reader :logger
|
9
|
+
|
10
|
+
def initialize(logger)
|
11
|
+
@logger = Structifier.to_struct(logger)
|
12
|
+
end
|
13
|
+
|
14
|
+
def log(event)
|
15
|
+
case event.type
|
16
|
+
when :DEBUG
|
17
|
+
if logger.respond_to? :debug
|
18
|
+
logger.debug(event.message, span: Protofier.from_proto_source_span(event.span))
|
19
|
+
else
|
20
|
+
warn(event.formatted)
|
21
|
+
end
|
22
|
+
when :DEPRECATION_WARNING
|
23
|
+
if logger.respond_to? :warn
|
24
|
+
logger.warn(event.message, deprecation: true,
|
25
|
+
span: Protofier.from_proto_source_span(event.span),
|
26
|
+
stack: event.stack_trace)
|
27
|
+
else
|
28
|
+
warn(event.formatted)
|
29
|
+
end
|
30
|
+
when :WARNING
|
31
|
+
if logger.respond_to? :warn
|
32
|
+
logger.warn(event.message, deprecation: false,
|
33
|
+
span: Protofier.from_proto_source_span(event.span),
|
34
|
+
stack: event.stack_trace)
|
35
|
+
else
|
36
|
+
warn(event.formatted)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private_constant :LoggerRegistry
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,237 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sass
|
4
|
+
class Embedded
|
5
|
+
class CompileContext
|
6
|
+
# The {ValueProtofier} between Pure Ruby types and Protobuf Ruby types.
|
7
|
+
class ValueProtofier
|
8
|
+
def initialize(function_registry)
|
9
|
+
@function_registry = function_registry
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_proto(obj)
|
13
|
+
case obj
|
14
|
+
when Sass::Value::String
|
15
|
+
Sass::EmbeddedProtocol::Value.new(
|
16
|
+
string: Sass::EmbeddedProtocol::Value::String.new(
|
17
|
+
text: obj.text,
|
18
|
+
quoted: obj.quoted?
|
19
|
+
)
|
20
|
+
)
|
21
|
+
when Sass::Value::Number
|
22
|
+
Sass::EmbeddedProtocol::Value.new(
|
23
|
+
number: Sass::EmbeddedProtocol::Value::Number.new(
|
24
|
+
value: obj.value.to_f,
|
25
|
+
numerators: obj.numerator_units,
|
26
|
+
denominators: obj.denominator_units
|
27
|
+
)
|
28
|
+
)
|
29
|
+
when Sass::Value::Color
|
30
|
+
if obj.instance_eval { @hue.nil? }
|
31
|
+
Sass::EmbeddedProtocol::Value.new(
|
32
|
+
rgb_color: Sass::EmbeddedProtocol::Value::RgbColor.new(
|
33
|
+
red: obj.red,
|
34
|
+
green: obj.green,
|
35
|
+
blue: obj.blue,
|
36
|
+
alpha: obj.alpha.to_f
|
37
|
+
)
|
38
|
+
)
|
39
|
+
elsif obj.instance_eval { @saturation.nil? }
|
40
|
+
Sass::EmbeddedProtocol::Value.new(
|
41
|
+
hwb_color: Sass::EmbeddedProtocol::Value::HwbColor.new(
|
42
|
+
hue: obj.hue.to_f,
|
43
|
+
whiteness: obj.whiteness.to_f,
|
44
|
+
blackness: obj.blackness.to_f,
|
45
|
+
alpha: obj.alpha.to_f
|
46
|
+
)
|
47
|
+
)
|
48
|
+
else
|
49
|
+
Sass::EmbeddedProtocol::Value.new(
|
50
|
+
hsl_color: Sass::EmbeddedProtocol::Value::HslColor.new(
|
51
|
+
hue: obj.hue.to_f,
|
52
|
+
saturation: obj.saturation.to_f,
|
53
|
+
lightness: obj.lightness.to_f,
|
54
|
+
alpha: obj.alpha.to_f
|
55
|
+
)
|
56
|
+
)
|
57
|
+
end
|
58
|
+
when Sass::Value::ArgumentList
|
59
|
+
Sass::EmbeddedProtocol::Value.new(
|
60
|
+
argument_list: Sass::EmbeddedProtocol::Value::ArgumentList.new(
|
61
|
+
id: obj.instance_eval { @id },
|
62
|
+
contents: obj.contents.map { |element| to_proto(element) },
|
63
|
+
keywords: obj.keywords.transform_values { |value| to_proto(value) },
|
64
|
+
separator: ListSeparator.to_proto(obj.separator)
|
65
|
+
)
|
66
|
+
)
|
67
|
+
when Sass::Value::List
|
68
|
+
Sass::EmbeddedProtocol::Value.new(
|
69
|
+
list: Sass::EmbeddedProtocol::Value::List.new(
|
70
|
+
contents: obj.contents.map { |element| to_proto(element) },
|
71
|
+
separator: ListSeparator.to_proto(obj.separator),
|
72
|
+
has_brackets: obj.bracketed?
|
73
|
+
)
|
74
|
+
)
|
75
|
+
when Sass::Value::Map
|
76
|
+
Sass::EmbeddedProtocol::Value.new(
|
77
|
+
map: Sass::EmbeddedProtocol::Value::Map.new(
|
78
|
+
entries: obj.contents.map do |key, value|
|
79
|
+
Sass::EmbeddedProtocol::Value::Map::Entry.new(
|
80
|
+
key: to_proto(key),
|
81
|
+
value: to_proto(value)
|
82
|
+
)
|
83
|
+
end
|
84
|
+
)
|
85
|
+
)
|
86
|
+
when Sass::Value::Function
|
87
|
+
if obj.id
|
88
|
+
Sass::EmbeddedProtocol::Value.new(
|
89
|
+
compiler_function: Sass::EmbeddedProtocol::Value::CompilerFunction.new(
|
90
|
+
id: obj.id
|
91
|
+
)
|
92
|
+
)
|
93
|
+
else
|
94
|
+
Sass::EmbeddedProtocol::Value.new(
|
95
|
+
host_function: Sass::EmbeddedProtocol::Value::HostFunction.new(
|
96
|
+
id: @function_registry.register(obj.callback),
|
97
|
+
signature: obj.signature
|
98
|
+
)
|
99
|
+
)
|
100
|
+
end
|
101
|
+
when Sass::Value::Boolean
|
102
|
+
Sass::EmbeddedProtocol::Value.new(
|
103
|
+
singleton: obj.value ? :TRUE : :FALSE
|
104
|
+
)
|
105
|
+
when Sass::Value::Null
|
106
|
+
Sass::EmbeddedProtocol::Value.new(
|
107
|
+
singleton: :NULL
|
108
|
+
)
|
109
|
+
else
|
110
|
+
raise Sass::ScriptError, "Unknown Sass::Value #{obj}"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def from_proto(proto)
|
115
|
+
obj = proto.method(proto.value).call
|
116
|
+
case proto.value
|
117
|
+
when :string
|
118
|
+
Sass::Value::String.new(
|
119
|
+
obj.text,
|
120
|
+
quoted: obj.quoted
|
121
|
+
)
|
122
|
+
when :number
|
123
|
+
Sass::Value::Number.new(
|
124
|
+
obj.value,
|
125
|
+
obj.numerators,
|
126
|
+
obj.denominators
|
127
|
+
)
|
128
|
+
when :rgb_color
|
129
|
+
Sass::Value::Color.new(
|
130
|
+
red: obj.red,
|
131
|
+
green: obj.green,
|
132
|
+
blue: obj.blue,
|
133
|
+
alpha: obj.alpha
|
134
|
+
)
|
135
|
+
when :hsl_color
|
136
|
+
Sass::Value::Color.new(
|
137
|
+
hue: obj.hue,
|
138
|
+
saturation: obj.saturation,
|
139
|
+
lightness: obj.lightness,
|
140
|
+
alpha: obj.alpha
|
141
|
+
)
|
142
|
+
when :hwb_color
|
143
|
+
Sass::Value::Color.new(
|
144
|
+
hue: obj.hue,
|
145
|
+
whiteness: obj.whiteness,
|
146
|
+
blackness: obj.blackness,
|
147
|
+
alpha: obj.alpha
|
148
|
+
)
|
149
|
+
when :argument_list
|
150
|
+
Sass::Value::ArgumentList.new(
|
151
|
+
obj.contents.map do |element|
|
152
|
+
from_proto(element)
|
153
|
+
end,
|
154
|
+
obj.keywords.entries.to_h do |entry|
|
155
|
+
[entry.first, from_proto(entry.last)]
|
156
|
+
end,
|
157
|
+
ListSeparator.from_proto(obj.separator)
|
158
|
+
).instance_eval do
|
159
|
+
@id = obj.id
|
160
|
+
self
|
161
|
+
end
|
162
|
+
when :list
|
163
|
+
Sass::Value::List.new(
|
164
|
+
obj.contents.map do |element|
|
165
|
+
from_proto(element)
|
166
|
+
end,
|
167
|
+
separator: ListSeparator.from_proto(obj.separator),
|
168
|
+
bracketed: obj.has_brackets
|
169
|
+
)
|
170
|
+
when :map
|
171
|
+
Sass::Value::Map.new(
|
172
|
+
obj.entries.to_h do |entry|
|
173
|
+
[from_proto(entry.key), from_proto(entry.value)]
|
174
|
+
end
|
175
|
+
)
|
176
|
+
when :compiler_function
|
177
|
+
Sass::Value::Function.new(obj.id)
|
178
|
+
when :host_function
|
179
|
+
raise ProtocolError, 'The compiler may not send Value.host_function to host'
|
180
|
+
when :singleton
|
181
|
+
case obj
|
182
|
+
when :TRUE
|
183
|
+
Sass::Value::Boolean::TRUE
|
184
|
+
when :FALSE
|
185
|
+
Sass::Value::Boolean::FALSE
|
186
|
+
when :NULL
|
187
|
+
Sass::Value::Null::NULL
|
188
|
+
else
|
189
|
+
raise Sass::ScriptError, "Unknown Value.singleton #{obj}"
|
190
|
+
end
|
191
|
+
else
|
192
|
+
raise Sass::ScriptError, "Unknown Value.value #{obj}"
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
# The {ListSeparator} Protofier.
|
197
|
+
module ListSeparator
|
198
|
+
module_function
|
199
|
+
|
200
|
+
def to_proto(separator)
|
201
|
+
case separator
|
202
|
+
when ','
|
203
|
+
:COMMA
|
204
|
+
when ' '
|
205
|
+
:SPACE
|
206
|
+
when '/'
|
207
|
+
:SLASH
|
208
|
+
when nil
|
209
|
+
:UNDECIDED
|
210
|
+
else
|
211
|
+
raise Sass::ScriptError, "Unknown ListSeparator #{separator}"
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
def from_proto(separator)
|
216
|
+
case separator
|
217
|
+
when :COMMA
|
218
|
+
','
|
219
|
+
when :SPACE
|
220
|
+
' '
|
221
|
+
when :SLASH
|
222
|
+
'/'
|
223
|
+
when :UNDECIDED
|
224
|
+
nil
|
225
|
+
else
|
226
|
+
raise Sass::ScriptError, "Unknown ListSeparator #{separator}"
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
private_constant :ListSeparator
|
232
|
+
end
|
233
|
+
|
234
|
+
private_constant :ValueProtofier
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
@@ -27,34 +27,33 @@ module Sass
|
|
27
27
|
logger:,
|
28
28
|
quiet_deps:,
|
29
29
|
verbose:)
|
30
|
-
@
|
31
|
-
@
|
32
|
-
|
33
|
-
@load_paths = load_paths
|
34
|
-
@syntax = syntax
|
35
|
-
@url = url
|
36
|
-
|
37
|
-
@source_map = source_map
|
38
|
-
@source_map_include_sources = source_map_include_sources
|
39
|
-
@style = style
|
40
|
-
|
41
|
-
@function_registery = FunctionRegistry.new(functions.transform_keys(&:to_s))
|
42
|
-
@importer_registery = ImporterRegistry.new(importers.map do |obj|
|
43
|
-
Protofier.to_struct(obj)
|
44
|
-
end, load_paths)
|
45
|
-
@importer = importer.nil? ? nil : @importer_registery.register(Protofier.to_struct(importer))
|
46
|
-
|
47
|
-
@alert_ascii = alert_ascii
|
48
|
-
@alert_color = alert_color
|
49
|
-
|
50
|
-
@logger = Protofier.to_struct(logger)
|
51
|
-
|
52
|
-
@quiet_deps = quiet_deps
|
53
|
-
@verbose = verbose
|
30
|
+
@function_registery = FunctionRegistry.new(functions, highlight: alert_color)
|
31
|
+
@importer_registery = ImporterRegistry.new(importers, load_paths, highlight: alert_color)
|
32
|
+
@logger_registery = LoggerRegistry.new(logger)
|
54
33
|
|
55
34
|
super(channel)
|
56
35
|
|
57
|
-
send_message
|
36
|
+
send_message EmbeddedProtocol::InboundMessage::CompileRequest.new(
|
37
|
+
id: id,
|
38
|
+
string: unless source.nil?
|
39
|
+
EmbeddedProtocol::InboundMessage::CompileRequest::StringInput.new(
|
40
|
+
source: source,
|
41
|
+
url: url&.to_s,
|
42
|
+
syntax: Protofier.to_proto_syntax(syntax),
|
43
|
+
importer: importer.nil? ? nil : @importer_registery.register(importer)
|
44
|
+
)
|
45
|
+
end,
|
46
|
+
path: path,
|
47
|
+
style: Protofier.to_proto_output_style(style),
|
48
|
+
source_map: source_map,
|
49
|
+
source_map_include_sources: source_map_include_sources,
|
50
|
+
importers: @importer_registery.importers,
|
51
|
+
global_functions: @function_registery.global_functions,
|
52
|
+
alert_ascii: alert_ascii,
|
53
|
+
alert_color: alert_color,
|
54
|
+
quiet_deps: quiet_deps,
|
55
|
+
verbose: verbose
|
56
|
+
)
|
58
57
|
end
|
59
58
|
|
60
59
|
def update(error, message)
|
@@ -70,7 +69,7 @@ module Sass
|
|
70
69
|
when EmbeddedProtocol::OutboundMessage::LogEvent
|
71
70
|
return unless message.compilation_id == id
|
72
71
|
|
73
|
-
log message
|
72
|
+
@logger_registery.log message
|
74
73
|
when EmbeddedProtocol::OutboundMessage::CanonicalizeRequest
|
75
74
|
return unless message.compilation_id == id
|
76
75
|
|
@@ -101,57 +100,6 @@ module Sass
|
|
101
100
|
super(e, nil)
|
102
101
|
end
|
103
102
|
end
|
104
|
-
|
105
|
-
private
|
106
|
-
|
107
|
-
def log(event)
|
108
|
-
case event.type
|
109
|
-
when :DEBUG
|
110
|
-
if @logger.respond_to? :debug
|
111
|
-
@logger.debug(event.message, span: Protofier.from_proto_source_span(event.span))
|
112
|
-
else
|
113
|
-
Kernel.warn(event.formatted)
|
114
|
-
end
|
115
|
-
when :DEPRECATION_WARNING
|
116
|
-
if @logger.respond_to? :warn
|
117
|
-
@logger.warn(event.message, deprecation: true,
|
118
|
-
span: Protofier.from_proto_source_span(event.span),
|
119
|
-
stack: event.stack_trace)
|
120
|
-
else
|
121
|
-
Kernel.warn(event.formatted)
|
122
|
-
end
|
123
|
-
when :WARNING
|
124
|
-
if @logger.respond_to? :warn
|
125
|
-
@logger.warn(event.message, deprecation: false,
|
126
|
-
span: Protofier.from_proto_source_span(event.span),
|
127
|
-
stack: event.stack_trace)
|
128
|
-
else
|
129
|
-
Kernel.warn(event.formatted)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
def compile_request
|
135
|
-
EmbeddedProtocol::InboundMessage::CompileRequest.new(
|
136
|
-
id: id,
|
137
|
-
string: unless @source.nil?
|
138
|
-
EmbeddedProtocol::InboundMessage::CompileRequest::StringInput.new(
|
139
|
-
source: @source,
|
140
|
-
url: @url&.to_s,
|
141
|
-
syntax: Protofier.to_proto_syntax(@syntax),
|
142
|
-
importer: @importer
|
143
|
-
)
|
144
|
-
end,
|
145
|
-
path: @path,
|
146
|
-
style: Protofier.to_proto_output_style(@style),
|
147
|
-
source_map: @source_map,
|
148
|
-
source_map_include_sources: @source_map_include_sources,
|
149
|
-
importers: @importer_registery.importers,
|
150
|
-
global_functions: @function_registery.global_functions,
|
151
|
-
alert_ascii: @alert_ascii,
|
152
|
-
alert_color: @alert_color
|
153
|
-
)
|
154
|
-
end
|
155
103
|
end
|
156
104
|
|
157
105
|
private_constant :CompileContext
|
@@ -11,6 +11,10 @@ module Sass
|
|
11
11
|
class Compiler
|
12
12
|
include Observable
|
13
13
|
|
14
|
+
PATH = File.absolute_path(
|
15
|
+
"../../../ext/sass/sass_embedded/dart-sass-embedded#{Gem.win_platform? ? '.bat' : ''}", __dir__
|
16
|
+
)
|
17
|
+
|
14
18
|
PROTOCOL_ERROR_ID = 4_294_967_295
|
15
19
|
|
16
20
|
def initialize
|
@@ -106,36 +110,15 @@ module Sass
|
|
106
110
|
end
|
107
111
|
|
108
112
|
def read
|
109
|
-
length =
|
113
|
+
length = Varint.read(@stdout)
|
110
114
|
@stdout.read(length)
|
111
115
|
end
|
112
116
|
|
113
117
|
def write(payload)
|
114
118
|
@stdin_mutex.synchronize do
|
115
|
-
|
116
|
-
@stdin.write
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
def read_varint(readable)
|
121
|
-
value = bits = 0
|
122
|
-
loop do
|
123
|
-
byte = readable.readbyte
|
124
|
-
value |= (byte & 0x7f) << bits
|
125
|
-
bits += 7
|
126
|
-
break if byte < 0x80
|
127
|
-
end
|
128
|
-
value
|
129
|
-
end
|
130
|
-
|
131
|
-
def write_varint(writeable, value)
|
132
|
-
bytes = []
|
133
|
-
until value < 0x80
|
134
|
-
bytes << (0x80 | (value & 0x7f))
|
135
|
-
value >>= 7
|
119
|
+
Varint.write(@stdin, payload.length)
|
120
|
+
@stdin.write(payload)
|
136
121
|
end
|
137
|
-
bytes << value
|
138
|
-
writeable.write bytes.pack('C*')
|
139
122
|
end
|
140
123
|
end
|
141
124
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Sass
|
4
4
|
class Embedded
|
5
5
|
# The {Protofier} between Pure Ruby types and Protobuf Ruby types.
|
6
|
-
|
6
|
+
module Protofier
|
7
7
|
ONEOF_MESSAGE = EmbeddedProtocol::InboundMessage
|
8
8
|
.descriptor
|
9
9
|
.lookup_oneof('message')
|
@@ -13,313 +13,75 @@ module Sass
|
|
13
13
|
|
14
14
|
private_constant :ONEOF_MESSAGE
|
15
15
|
|
16
|
-
|
17
|
-
@function_registry = function_registry
|
18
|
-
end
|
16
|
+
module_function
|
19
17
|
|
20
|
-
def
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
)
|
28
|
-
)
|
29
|
-
when Sass::Value::Number
|
30
|
-
Sass::EmbeddedProtocol::Value.new(
|
31
|
-
number: Sass::EmbeddedProtocol::Value::Number.new(
|
32
|
-
value: obj.value.to_f,
|
33
|
-
numerators: obj.numerator_units,
|
34
|
-
denominators: obj.denominator_units
|
35
|
-
)
|
36
|
-
)
|
37
|
-
when Sass::Value::Color
|
38
|
-
if obj.instance_eval { @hue.nil? }
|
39
|
-
Sass::EmbeddedProtocol::Value.new(
|
40
|
-
rgb_color: Sass::EmbeddedProtocol::Value::RgbColor.new(
|
41
|
-
red: obj.red,
|
42
|
-
green: obj.green,
|
43
|
-
blue: obj.blue,
|
44
|
-
alpha: obj.alpha.to_f
|
45
|
-
)
|
46
|
-
)
|
47
|
-
elsif obj.instance_eval { @saturation.nil? }
|
48
|
-
Sass::EmbeddedProtocol::Value.new(
|
49
|
-
hwb_color: Sass::EmbeddedProtocol::Value::HwbColor.new(
|
50
|
-
hue: obj.hue.to_f,
|
51
|
-
whiteness: obj.whiteness.to_f,
|
52
|
-
blackness: obj.blackness.to_f,
|
53
|
-
alpha: obj.alpha.to_f
|
54
|
-
)
|
55
|
-
)
|
56
|
-
else
|
57
|
-
Sass::EmbeddedProtocol::Value.new(
|
58
|
-
hsl_color: Sass::EmbeddedProtocol::Value::HslColor.new(
|
59
|
-
hue: obj.hue.to_f,
|
60
|
-
saturation: obj.saturation.to_f,
|
61
|
-
lightness: obj.lightness.to_f,
|
62
|
-
alpha: obj.alpha.to_f
|
63
|
-
)
|
64
|
-
)
|
65
|
-
end
|
66
|
-
when Sass::Value::ArgumentList
|
67
|
-
Sass::EmbeddedProtocol::Value.new(
|
68
|
-
argument_list: Sass::EmbeddedProtocol::Value::ArgumentList.new(
|
69
|
-
id: obj.instance_eval { @id },
|
70
|
-
contents: obj.contents.map { |element| to_proto_value(element) },
|
71
|
-
keywords: obj.keywords.transform_values { |value| to_proto_value(value) },
|
72
|
-
separator: to_proto_separator(obj.separator)
|
73
|
-
)
|
74
|
-
)
|
75
|
-
when Sass::Value::List
|
76
|
-
Sass::EmbeddedProtocol::Value.new(
|
77
|
-
list: Sass::EmbeddedProtocol::Value::List.new(
|
78
|
-
contents: obj.contents.map { |element| to_proto_value(element) },
|
79
|
-
separator: to_proto_separator(obj.separator),
|
80
|
-
has_brackets: obj.bracketed?
|
81
|
-
)
|
82
|
-
)
|
83
|
-
when Sass::Value::Map
|
84
|
-
Sass::EmbeddedProtocol::Value.new(
|
85
|
-
map: Sass::EmbeddedProtocol::Value::Map.new(
|
86
|
-
entries: obj.contents.map do |key, value|
|
87
|
-
Sass::EmbeddedProtocol::Value::Map::Entry.new(
|
88
|
-
key: to_proto_value(key),
|
89
|
-
value: to_proto_value(value)
|
90
|
-
)
|
91
|
-
end
|
92
|
-
)
|
93
|
-
)
|
94
|
-
when Sass::Value::Function
|
95
|
-
if obj.id
|
96
|
-
Sass::EmbeddedProtocol::Value.new(
|
97
|
-
compiler_function: Sass::EmbeddedProtocol::Value::CompilerFunction.new(
|
98
|
-
id: obj.id
|
99
|
-
)
|
100
|
-
)
|
101
|
-
else
|
102
|
-
Sass::EmbeddedProtocol::Value.new(
|
103
|
-
host_function: Sass::EmbeddedProtocol::Value::HostFunction.new(
|
104
|
-
id: @function_registry.register(obj.callback),
|
105
|
-
signature: obj.signature
|
106
|
-
)
|
107
|
-
)
|
108
|
-
end
|
109
|
-
when Sass::Value::Boolean
|
110
|
-
Sass::EmbeddedProtocol::Value.new(
|
111
|
-
singleton: obj.value ? :TRUE : :FALSE
|
18
|
+
def from_proto_compile_response(compile_response)
|
19
|
+
if compile_response.result == :failure
|
20
|
+
raise CompileError.new(
|
21
|
+
compile_response.failure.message,
|
22
|
+
compile_response.failure.formatted,
|
23
|
+
compile_response.failure.stack_trace,
|
24
|
+
from_proto_source_span(compile_response.failure.span)
|
112
25
|
)
|
113
|
-
when Sass::Value::Null
|
114
|
-
Sass::EmbeddedProtocol::Value.new(
|
115
|
-
singleton: :NULL
|
116
|
-
)
|
117
|
-
else
|
118
|
-
raise Sass::ScriptError, "Unknown Sass::Value #{obj}"
|
119
26
|
end
|
120
|
-
end
|
121
27
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
value.text,
|
128
|
-
quoted: value.quoted
|
129
|
-
)
|
130
|
-
when :number
|
131
|
-
Sass::Value::Number.new(
|
132
|
-
value.value,
|
133
|
-
value.numerators,
|
134
|
-
value.denominators
|
135
|
-
)
|
136
|
-
when :rgb_color
|
137
|
-
Sass::Value::Color.new(
|
138
|
-
red: value.red,
|
139
|
-
green: value.green,
|
140
|
-
blue: value.blue,
|
141
|
-
alpha: value.alpha
|
142
|
-
)
|
143
|
-
when :hsl_color
|
144
|
-
Sass::Value::Color.new(
|
145
|
-
hue: value.hue,
|
146
|
-
saturation: value.saturation,
|
147
|
-
lightness: value.lightness,
|
148
|
-
alpha: value.alpha
|
149
|
-
)
|
150
|
-
when :hwb_color
|
151
|
-
Sass::Value::Color.new(
|
152
|
-
hue: value.hue,
|
153
|
-
whiteness: value.whiteness,
|
154
|
-
blackness: value.blackness,
|
155
|
-
alpha: value.alpha
|
156
|
-
)
|
157
|
-
when :argument_list
|
158
|
-
Sass::Value::ArgumentList.new(
|
159
|
-
value.contents.map do |i|
|
160
|
-
from_proto_value(i)
|
161
|
-
end,
|
162
|
-
value.keywords.entries.to_h do |entry|
|
163
|
-
[entry.first, from_proto_value(entry.last)]
|
164
|
-
end,
|
165
|
-
from_proto_separator(value.separator)
|
166
|
-
).instance_eval do
|
167
|
-
@id = value.id
|
168
|
-
self
|
169
|
-
end
|
170
|
-
when :list
|
171
|
-
Sass::Value::List.new(
|
172
|
-
value.contents.map do |element|
|
173
|
-
from_proto_value(element)
|
174
|
-
end,
|
175
|
-
separator: from_proto_separator(value.separator),
|
176
|
-
bracketed: value.has_brackets
|
177
|
-
)
|
178
|
-
when :map
|
179
|
-
Sass::Value::Map.new(
|
180
|
-
value.entries.to_h do |entry|
|
181
|
-
[from_proto_value(entry.key), from_proto_value(entry.value)]
|
182
|
-
end
|
183
|
-
)
|
184
|
-
when :compiler_function
|
185
|
-
Sass::Value::Function.new(value.id)
|
186
|
-
when :host_function
|
187
|
-
raise ProtocolError, 'The compiler may not send Value.host_function to host'
|
188
|
-
when :singleton
|
189
|
-
case value
|
190
|
-
when :TRUE
|
191
|
-
Sass::Value::Boolean::TRUE
|
192
|
-
when :FALSE
|
193
|
-
Sass::Value::Boolean::FALSE
|
194
|
-
when :NULL
|
195
|
-
Sass::Value::Null::NULL
|
196
|
-
else
|
197
|
-
raise Sass::ScriptError "Unknown Value.singleton #{value}"
|
198
|
-
end
|
199
|
-
else
|
200
|
-
raise Sass::ScriptError, "Unknown Value.value #{value}"
|
201
|
-
end
|
28
|
+
CompileResult.new(
|
29
|
+
compile_response.success.css,
|
30
|
+
compile_response.success.source_map,
|
31
|
+
compile_response.success.loaded_urls
|
32
|
+
)
|
202
33
|
end
|
203
34
|
|
204
|
-
|
35
|
+
def from_proto_source_span(source_span)
|
36
|
+
return nil if source_span.nil?
|
205
37
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
:SPACE
|
212
|
-
when '/'
|
213
|
-
:SLASH
|
214
|
-
when nil
|
215
|
-
:UNDECIDED
|
216
|
-
else
|
217
|
-
raise Sass::ScriptError, "Unknown ListSeparator #{separator}"
|
218
|
-
end
|
38
|
+
Logger::SourceSpan.new(from_proto_source_location(source_span.start),
|
39
|
+
from_proto_source_location(source_span.end),
|
40
|
+
source_span.text,
|
41
|
+
source_span.url,
|
42
|
+
source_span.context)
|
219
43
|
end
|
220
44
|
|
221
|
-
def
|
222
|
-
|
223
|
-
when :COMMA
|
224
|
-
','
|
225
|
-
when :SPACE
|
226
|
-
' '
|
227
|
-
when :SLASH
|
228
|
-
'/'
|
229
|
-
when :UNDECIDED
|
230
|
-
nil
|
231
|
-
else
|
232
|
-
raise Sass::ScriptError, "Unknown ListSeparator #{separator}"
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
class << self
|
237
|
-
def from_proto_compile_response(compile_response)
|
238
|
-
if compile_response.result == :failure
|
239
|
-
raise CompileError.new(
|
240
|
-
compile_response.failure.formatted || compile_response.failure.message,
|
241
|
-
compile_response.failure.message,
|
242
|
-
compile_response.failure.stack_trace,
|
243
|
-
from_proto_source_span(compile_response.failure.span)
|
244
|
-
)
|
245
|
-
end
|
246
|
-
|
247
|
-
CompileResult.new(
|
248
|
-
compile_response.success.css,
|
249
|
-
compile_response.success.source_map,
|
250
|
-
compile_response.success.loaded_urls
|
251
|
-
)
|
252
|
-
end
|
253
|
-
|
254
|
-
def from_proto_source_span(source_span)
|
255
|
-
return nil if source_span.nil?
|
256
|
-
|
257
|
-
Logger::SourceSpan.new(from_proto_source_location(source_span.start),
|
258
|
-
from_proto_source_location(source_span.end),
|
259
|
-
source_span.text,
|
260
|
-
source_span.url,
|
261
|
-
source_span.context)
|
262
|
-
end
|
263
|
-
|
264
|
-
def from_proto_source_location(source_location)
|
265
|
-
return nil if source_location.nil?
|
266
|
-
|
267
|
-
Logger::SourceLocation.new(source_location.offset,
|
268
|
-
source_location.line,
|
269
|
-
source_location.column)
|
270
|
-
end
|
45
|
+
def from_proto_source_location(source_location)
|
46
|
+
return nil if source_location.nil?
|
271
47
|
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
48
|
+
Logger::SourceLocation.new(source_location.offset,
|
49
|
+
source_location.line,
|
50
|
+
source_location.column)
|
51
|
+
end
|
276
52
|
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
end
|
53
|
+
def from_proto_message(proto)
|
54
|
+
message = EmbeddedProtocol::OutboundMessage.decode(proto)
|
55
|
+
message.method(message.message).call
|
56
|
+
end
|
282
57
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
EmbeddedProtocol::Syntax::INDENTED
|
289
|
-
when :css
|
290
|
-
EmbeddedProtocol::Syntax::CSS
|
291
|
-
else
|
292
|
-
raise ArgumentError, 'syntax must be one of :scss, :indented, :css'
|
293
|
-
end
|
294
|
-
end
|
58
|
+
def to_proto_message(message)
|
59
|
+
EmbeddedProtocol::InboundMessage.new(
|
60
|
+
ONEOF_MESSAGE[message.class.descriptor] => message
|
61
|
+
).to_proto
|
62
|
+
end
|
295
63
|
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
64
|
+
def to_proto_syntax(syntax)
|
65
|
+
case syntax&.to_sym
|
66
|
+
when :scss
|
67
|
+
EmbeddedProtocol::Syntax::SCSS
|
68
|
+
when :indented
|
69
|
+
EmbeddedProtocol::Syntax::INDENTED
|
70
|
+
when :css
|
71
|
+
EmbeddedProtocol::Syntax::CSS
|
72
|
+
else
|
73
|
+
raise ArgumentError, 'syntax must be one of :scss, :indented, :css'
|
305
74
|
end
|
75
|
+
end
|
306
76
|
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
end
|
316
|
-
else
|
317
|
-
struct.define_singleton_method key.to_sym do
|
318
|
-
value
|
319
|
-
end
|
320
|
-
end
|
321
|
-
end
|
322
|
-
struct
|
77
|
+
def to_proto_output_style(style)
|
78
|
+
case style&.to_sym
|
79
|
+
when :expanded
|
80
|
+
EmbeddedProtocol::OutputStyle::EXPANDED
|
81
|
+
when :compressed
|
82
|
+
EmbeddedProtocol::OutputStyle::COMPRESSED
|
83
|
+
else
|
84
|
+
raise ArgumentError, 'style must be one of :expanded, :compressed'
|
323
85
|
end
|
324
86
|
end
|
325
87
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sass
|
4
|
+
class Embedded
|
5
|
+
# The {Structifier} that convert {::Hash} to {Struct}-like object.
|
6
|
+
module Structifier
|
7
|
+
module_function
|
8
|
+
|
9
|
+
def to_struct(obj)
|
10
|
+
return obj unless obj.is_a? Hash
|
11
|
+
|
12
|
+
struct = Object.new
|
13
|
+
obj.each do |key, value|
|
14
|
+
if value.respond_to? :call
|
15
|
+
struct.define_singleton_method key.to_sym do |*args, **kwargs|
|
16
|
+
if kwargs.empty?
|
17
|
+
value.call(*args)
|
18
|
+
else
|
19
|
+
value.call(*args, **kwargs)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
else
|
23
|
+
struct.define_singleton_method key.to_sym do
|
24
|
+
value
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
struct
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private_constant :Structifier
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sass
|
4
|
+
class Embedded
|
5
|
+
# Read and write {Varint} from {::IO}.
|
6
|
+
module Varint
|
7
|
+
module_function
|
8
|
+
|
9
|
+
def read(readable)
|
10
|
+
value = bits = 0
|
11
|
+
loop do
|
12
|
+
byte = readable.readbyte
|
13
|
+
value |= (byte & 0x7f) << bits
|
14
|
+
bits += 7
|
15
|
+
break if byte < 0x80
|
16
|
+
end
|
17
|
+
value
|
18
|
+
end
|
19
|
+
|
20
|
+
def write(writeable, value)
|
21
|
+
bytes = []
|
22
|
+
until value < 0x80
|
23
|
+
bytes << (0x80 | (value & 0x7f))
|
24
|
+
value >>= 7
|
25
|
+
end
|
26
|
+
bytes << value
|
27
|
+
writeable.write bytes.pack('C*')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private_constant :Varint
|
32
|
+
end
|
33
|
+
end
|
data/lib/sass/value.rb
CHANGED
@@ -27,7 +27,7 @@ module Sass
|
|
27
27
|
false
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
30
|
+
def sass_index_to_array_index(sass_index, name = nil)
|
31
31
|
index = sass_index.assert_number(name).assert_integer(name)
|
32
32
|
raise error('List index may not be 0', name) if index.zero?
|
33
33
|
|
data/lib/sass.rb
CHANGED
@@ -8,12 +8,15 @@ require_relative 'sass/embedded/observer'
|
|
8
8
|
require_relative 'sass/embedded/compile_context'
|
9
9
|
require_relative 'sass/embedded/compile_context/function_registry'
|
10
10
|
require_relative 'sass/embedded/compile_context/importer_registry'
|
11
|
+
require_relative 'sass/embedded/compile_context/logger_registry'
|
12
|
+
require_relative 'sass/embedded/compile_context/value_protofier'
|
11
13
|
require_relative 'sass/embedded/compiler'
|
12
|
-
require_relative 'sass/embedded/compiler/path'
|
13
14
|
require_relative 'sass/embedded_protocol'
|
14
15
|
require_relative 'sass/embedded/legacy'
|
15
16
|
require_relative 'sass/embedded/protocol_error'
|
16
17
|
require_relative 'sass/embedded/protofier'
|
18
|
+
require_relative 'sass/embedded/structifier'
|
19
|
+
require_relative 'sass/embedded/varint'
|
17
20
|
require_relative 'sass/embedded/version'
|
18
21
|
require_relative 'sass/embedded/version_context'
|
19
22
|
require_relative 'sass/logger'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass-embedded
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- なつき
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- README.md
|
122
122
|
- ext/sass/Makefile
|
123
123
|
- ext/sass/extconf.rb
|
124
|
+
- ext/sass/package.json
|
124
125
|
- ext/sass/unzip.vbs
|
125
126
|
- lib/sass-embedded.rb
|
126
127
|
- lib/sass.rb
|
@@ -131,13 +132,15 @@ files:
|
|
131
132
|
- lib/sass/embedded/compile_context.rb
|
132
133
|
- lib/sass/embedded/compile_context/function_registry.rb
|
133
134
|
- lib/sass/embedded/compile_context/importer_registry.rb
|
135
|
+
- lib/sass/embedded/compile_context/logger_registry.rb
|
136
|
+
- lib/sass/embedded/compile_context/value_protofier.rb
|
134
137
|
- lib/sass/embedded/compiler.rb
|
135
|
-
- lib/sass/embedded/compiler/path.rb
|
136
|
-
- lib/sass/embedded/compiler/requirements.rb
|
137
138
|
- lib/sass/embedded/legacy.rb
|
138
139
|
- lib/sass/embedded/observer.rb
|
139
140
|
- lib/sass/embedded/protocol_error.rb
|
140
141
|
- lib/sass/embedded/protofier.rb
|
142
|
+
- lib/sass/embedded/structifier.rb
|
143
|
+
- lib/sass/embedded/varint.rb
|
141
144
|
- lib/sass/embedded/version.rb
|
142
145
|
- lib/sass/embedded/version_context.rb
|
143
146
|
- lib/sass/embedded_protocol.rb
|
@@ -161,8 +164,8 @@ homepage: https://github.com/ntkme/sass-embedded-host-ruby
|
|
161
164
|
licenses:
|
162
165
|
- MIT
|
163
166
|
metadata:
|
164
|
-
documentation_uri: https://www.rubydoc.info/gems/sass-embedded/0.
|
165
|
-
source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v0.
|
167
|
+
documentation_uri: https://www.rubydoc.info/gems/sass-embedded/0.18.0
|
168
|
+
source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v0.18.0
|
166
169
|
funding_uri: https://github.com/sponsors/ntkme
|
167
170
|
post_install_message:
|
168
171
|
rdoc_options: []
|
@@ -172,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
175
|
requirements:
|
173
176
|
- - ">="
|
174
177
|
- !ruby/object:Gem::Version
|
175
|
-
version: 2.
|
178
|
+
version: 2.6.0
|
176
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
180
|
requirements:
|
178
181
|
- - ">="
|