sass-embedded 1.100.0-aarch64-linux-musl → 1.101.0-aarch64-linux-musl
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/lib/sass/compiler/channel.rb +6 -6
- data/lib/sass/compiler/dispatcher.rb +1 -1
- data/lib/sass/compiler/{host → session}/function_registry.rb +9 -4
- data/lib/sass/compiler/{host → session}/importer_registry.rb +21 -6
- data/lib/sass/compiler/{host → session}/logger_registry.rb +3 -3
- data/lib/sass/compiler/session/path.rb +34 -0
- data/lib/sass/compiler/{host → session}/protofier.rb +1 -1
- data/lib/sass/compiler/session/stack_trace.rb +46 -0
- data/lib/sass/compiler/{host → session}/struct.rb +1 -1
- data/lib/sass/compiler/{host.rb → session.rb} +19 -12
- data/lib/sass/compiler.rb +5 -4
- data/lib/sass/dart-sass/src/dart +0 -0
- data/lib/sass/dart-sass/src/sass.snapshot +0 -0
- data/lib/sass/embedded/version.rb +1 -1
- data/lib/sass/exception.rb +69 -17
- data/lib/sass/gem_package_importer.rb +14 -5
- data/lib/sass/uri.rb +56 -0
- data/lib/sass/value/color/space/utils.rb +2 -2
- metadata +13 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1086b337a006b2380d4fc38c39c920be47df72cc426ae85031d33c5df24ead16
|
|
4
|
+
data.tar.gz: af3266858ab29cf689e4cd96ee89507624467b47c058f29f779d1b072b1dd65a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ec803caf8ba37f8e21cc92ad4c6b8805a87af555c6b78b52cc5d49cf4afd6720d294256cb419bee6875b54e5cd469cbba1be301d78af4d82b973fc0f8c614e80
|
|
7
|
+
data.tar.gz: a2d694e797e2735063d014341022cccd06d70cacc4d88ebde82a0826e5bc31222ab1401598281afa2b7de03f1eaff907c3a6bfeabbcce03cc515ad825dc4975e
|
|
@@ -29,24 +29,24 @@ module Sass
|
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
def stream(
|
|
32
|
+
def stream(session)
|
|
33
33
|
@mutex.synchronize do
|
|
34
34
|
raise IOError, 'closed compiler' if @dispatcher.nil?
|
|
35
35
|
|
|
36
|
-
Stream.new(@dispatcher,
|
|
36
|
+
Stream.new(@dispatcher, session)
|
|
37
37
|
rescue Errno::EBUSY
|
|
38
38
|
@dispatcher = Dispatcher.new(*@args, **@kwargs, &@block)
|
|
39
|
-
Stream.new(@dispatcher,
|
|
39
|
+
Stream.new(@dispatcher, session)
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
# The {Stream} between {Dispatcher} and {
|
|
43
|
+
# The {Stream} between {Dispatcher} and {Session}.
|
|
44
44
|
class Stream
|
|
45
45
|
attr_reader :id
|
|
46
46
|
|
|
47
|
-
def initialize(dispatcher,
|
|
47
|
+
def initialize(dispatcher, session)
|
|
48
48
|
@dispatcher = dispatcher
|
|
49
|
-
@id = @dispatcher.subscribe(
|
|
49
|
+
@id = @dispatcher.subscribe(session)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def close
|
|
@@ -4,7 +4,7 @@ module Sass
|
|
|
4
4
|
class Compiler
|
|
5
5
|
# The {Dispatcher} class.
|
|
6
6
|
#
|
|
7
|
-
# It dispatches messages between multiple instances of {
|
|
7
|
+
# It dispatches messages between multiple instances of {Session} and a single {Connection} to the compiler.
|
|
8
8
|
class Dispatcher
|
|
9
9
|
def initialize(idle_timeout: 0)
|
|
10
10
|
@id = 1
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
module Sass
|
|
4
4
|
class Compiler
|
|
5
|
-
class
|
|
5
|
+
class Session
|
|
6
6
|
# The {FunctionRegistry} class.
|
|
7
7
|
#
|
|
8
8
|
# It stores sass custom functions and handles function calls.
|
|
9
9
|
class FunctionRegistry
|
|
10
10
|
attr_reader :compile_context, :global_functions
|
|
11
11
|
|
|
12
|
-
def initialize(functions,
|
|
12
|
+
def initialize(functions, session:)
|
|
13
13
|
@compile_context = Object.new
|
|
14
14
|
@global_functions = functions.keys.map!(&:to_s)
|
|
15
15
|
@functions_by_name = functions.transform_keys do |signature|
|
|
@@ -26,7 +26,7 @@ module Sass
|
|
|
26
26
|
@functions_by_id = {}.compare_by_identity
|
|
27
27
|
@ids_by_function = {}.compare_by_identity
|
|
28
28
|
|
|
29
|
-
@
|
|
29
|
+
@session = session
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def register(function)
|
|
@@ -68,9 +68,14 @@ module Sass
|
|
|
68
68
|
accessed_argument_lists:
|
|
69
69
|
)
|
|
70
70
|
rescue StandardError => e
|
|
71
|
+
@session.backtrace = e.backtrace
|
|
71
72
|
EmbeddedProtocol::InboundMessage::FunctionCallResponse.new(
|
|
72
73
|
id: function_call_request.id,
|
|
73
|
-
error: e.
|
|
74
|
+
error: if e.respond_to?(:detailed_message)
|
|
75
|
+
e.detailed_message(highlight: false)
|
|
76
|
+
else # TODO: remove once ruby 3.1 support is dropped
|
|
77
|
+
"#{e.message} (#{e.class.name})"
|
|
78
|
+
end
|
|
74
79
|
)
|
|
75
80
|
end
|
|
76
81
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
module Sass
|
|
4
4
|
class Compiler
|
|
5
|
-
class
|
|
5
|
+
class Session
|
|
6
6
|
# The {ImporterRegistry} class.
|
|
7
7
|
#
|
|
8
8
|
# It stores importers and handles import requests.
|
|
9
9
|
class ImporterRegistry
|
|
10
10
|
attr_reader :importers
|
|
11
11
|
|
|
12
|
-
def initialize(importers, load_paths,
|
|
12
|
+
def initialize(importers, load_paths, session:)
|
|
13
13
|
@id = 0
|
|
14
14
|
@importers_by_id = {}.compare_by_identity
|
|
15
15
|
@importers = importers
|
|
@@ -22,7 +22,7 @@ module Sass
|
|
|
22
22
|
end
|
|
23
23
|
)
|
|
24
24
|
|
|
25
|
-
@
|
|
25
|
+
@session = session
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
IMPORTER_ATTRS = %i[non_canonical_scheme].freeze
|
|
@@ -79,9 +79,14 @@ module Sass
|
|
|
79
79
|
containing_url_unused: canonicalize_context.instance_variable_get(:@containing_url_unused)
|
|
80
80
|
)
|
|
81
81
|
rescue StandardError => e
|
|
82
|
+
@session.backtrace = e.backtrace
|
|
82
83
|
EmbeddedProtocol::InboundMessage::CanonicalizeResponse.new(
|
|
83
84
|
id: canonicalize_request.id,
|
|
84
|
-
error: e.
|
|
85
|
+
error: if e.respond_to?(:detailed_message)
|
|
86
|
+
e.detailed_message(highlight: false)
|
|
87
|
+
else # TODO: remove once ruby 3.1 support is dropped
|
|
88
|
+
"#{e.message} (#{e.class.name})"
|
|
89
|
+
end
|
|
85
90
|
)
|
|
86
91
|
end
|
|
87
92
|
|
|
@@ -103,9 +108,14 @@ module Sass
|
|
|
103
108
|
)
|
|
104
109
|
)
|
|
105
110
|
rescue StandardError => e
|
|
111
|
+
@session.backtrace = e.backtrace
|
|
106
112
|
EmbeddedProtocol::InboundMessage::ImportResponse.new(
|
|
107
113
|
id: import_request.id,
|
|
108
|
-
error: e.
|
|
114
|
+
error: if e.respond_to?(:detailed_message)
|
|
115
|
+
e.detailed_message(highlight: false)
|
|
116
|
+
else # TODO: remove once ruby 3.1 support is dropped
|
|
117
|
+
"#{e.message} (#{e.class.name})"
|
|
118
|
+
end
|
|
109
119
|
)
|
|
110
120
|
end
|
|
111
121
|
|
|
@@ -121,9 +131,14 @@ module Sass
|
|
|
121
131
|
containing_url_unused: canonicalize_context.instance_variable_get(:@containing_url_unused)
|
|
122
132
|
)
|
|
123
133
|
rescue StandardError => e
|
|
134
|
+
@session.backtrace = e.backtrace
|
|
124
135
|
EmbeddedProtocol::InboundMessage::FileImportResponse.new(
|
|
125
136
|
id: file_import_request.id,
|
|
126
|
-
error: e.
|
|
137
|
+
error: if e.respond_to?(:detailed_message)
|
|
138
|
+
e.detailed_message(highlight: false)
|
|
139
|
+
else # TODO: remove once ruby 3.1 support is dropped
|
|
140
|
+
"#{e.message} (#{e.class.name})"
|
|
141
|
+
end
|
|
127
142
|
)
|
|
128
143
|
end
|
|
129
144
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Sass
|
|
4
4
|
class Compiler
|
|
5
|
-
class
|
|
5
|
+
class Session
|
|
6
6
|
# The {LoggerRegistry} class.
|
|
7
7
|
#
|
|
8
8
|
# It stores logger and handles log events.
|
|
@@ -24,13 +24,13 @@ module Sass
|
|
|
24
24
|
if @logger_respond_to_debug
|
|
25
25
|
@logger.debug(event.message, DebugContext.new(event))
|
|
26
26
|
else
|
|
27
|
-
Kernel.warn(event.formatted)
|
|
27
|
+
Kernel.warn(Path.pretty_formatted!(+event.formatted, event.span.url))
|
|
28
28
|
end
|
|
29
29
|
when :DEPRECATION_WARNING, :WARNING
|
|
30
30
|
if @logger_respond_to_warn
|
|
31
31
|
@logger.warn(event.message, WarnContext.new(event))
|
|
32
32
|
else
|
|
33
|
-
Kernel.warn(event.formatted)
|
|
33
|
+
Kernel.warn(StackTrace.pretty_formatted!(+event.formatted, event.stack_trace))
|
|
34
34
|
end
|
|
35
35
|
else
|
|
36
36
|
raise ArgumentError, "Unknown LogEvent.type #{event.type}"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sass
|
|
4
|
+
class Compiler
|
|
5
|
+
class Session
|
|
6
|
+
# @see https://pub.dev/documentation/path/latest/path/
|
|
7
|
+
module Path
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
# @see https://pub.dev/documentation/path/latest/path/Context/prettyUri.html
|
|
11
|
+
def pretty_uri(uri)
|
|
12
|
+
return uri unless uri&.start_with?('file:')
|
|
13
|
+
|
|
14
|
+
absolute_path = Uri.file_uri_to_path(uri)
|
|
15
|
+
relative_path = Uri.decode_uri_component(Uri.relative(uri, Uri.pwd))
|
|
16
|
+
relative_path.count('/') > absolute_path.count('/') ? absolute_path : relative_path
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def pretty_formatted!(formatted, uri)
|
|
20
|
+
index = formatted.index(uri)
|
|
21
|
+
return formatted unless index
|
|
22
|
+
|
|
23
|
+
replacement = pretty_uri(uri)
|
|
24
|
+
return formatted if uri == replacement
|
|
25
|
+
|
|
26
|
+
formatted[index, uri.length] = replacement
|
|
27
|
+
formatted
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private_constant :Path
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sass
|
|
4
|
+
class Compiler
|
|
5
|
+
class Session
|
|
6
|
+
# @see https://pub.dev/documentation/stack_trace/latest/stack_trace/
|
|
7
|
+
module StackTrace
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
# @see https://pub.dev/documentation/stack_trace/latest/stack_trace/Trace/toString.html
|
|
11
|
+
def pretty_formatted!(formatted, stack_trace)
|
|
12
|
+
longest = 0
|
|
13
|
+
|
|
14
|
+
frames = stack_trace.lines("\n", chomp: true).map do |frame|
|
|
15
|
+
location, member = frame.split(/ +/, 2)
|
|
16
|
+
uri, line_column = location.split(' ', 2)
|
|
17
|
+
|
|
18
|
+
uri = Path.pretty_uri(uri)
|
|
19
|
+
location = line_column.nil? ? uri : "#{uri} #{line_column}"
|
|
20
|
+
|
|
21
|
+
longest = location.length if location.length > longest
|
|
22
|
+
[frame, location, member]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
offset = formatted.length
|
|
26
|
+
|
|
27
|
+
frames.reverse_each do |frame, location, member|
|
|
28
|
+
index = formatted.rindex(frame, offset)
|
|
29
|
+
next unless index
|
|
30
|
+
|
|
31
|
+
offset = index
|
|
32
|
+
|
|
33
|
+
replacement = "#{location.ljust(longest)} #{member}"
|
|
34
|
+
next if frame == replacement
|
|
35
|
+
|
|
36
|
+
formatted[index, frame.length] = replacement
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
formatted
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private_constant :StackTrace
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative '
|
|
4
|
-
require_relative '
|
|
5
|
-
require_relative '
|
|
6
|
-
require_relative '
|
|
7
|
-
require_relative '
|
|
3
|
+
require_relative 'session/function_registry'
|
|
4
|
+
require_relative 'session/importer_registry'
|
|
5
|
+
require_relative 'session/logger_registry'
|
|
6
|
+
require_relative 'session/path'
|
|
7
|
+
require_relative 'session/protofier'
|
|
8
|
+
require_relative 'session/stack_trace'
|
|
9
|
+
require_relative 'session/struct'
|
|
8
10
|
|
|
9
11
|
module Sass
|
|
10
12
|
class Compiler
|
|
11
|
-
# The {
|
|
13
|
+
# The {Session} class.
|
|
12
14
|
#
|
|
13
15
|
# It communicates with {Dispatcher} and handles the host logic.
|
|
14
|
-
class
|
|
16
|
+
class Session
|
|
17
|
+
attr_writer :backtrace
|
|
18
|
+
|
|
15
19
|
def initialize(channel)
|
|
16
20
|
@channel = channel
|
|
21
|
+
@backtrace = nil
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
def compile_request(path:,
|
|
@@ -38,8 +43,8 @@ module Sass
|
|
|
38
43
|
verbose:)
|
|
39
44
|
alert_color = Exception.to_tty? if alert_color.nil?
|
|
40
45
|
|
|
41
|
-
@function_registry = FunctionRegistry.new(functions,
|
|
42
|
-
@importer_registry = ImporterRegistry.new(importers, load_paths,
|
|
46
|
+
@function_registry = FunctionRegistry.new(functions, session: self)
|
|
47
|
+
@importer_registry = ImporterRegistry.new(importers, load_paths, session: self)
|
|
43
48
|
@logger_registry = LoggerRegistry.new(logger)
|
|
44
49
|
|
|
45
50
|
compile_request = EmbeddedProtocol::InboundMessage::CompileRequest.new(
|
|
@@ -83,13 +88,15 @@ module Sass
|
|
|
83
88
|
result = compile_response.public_send(oneof)
|
|
84
89
|
case oneof
|
|
85
90
|
when :failure
|
|
86
|
-
|
|
91
|
+
compile_error = CompileError.new(
|
|
87
92
|
result.message,
|
|
88
|
-
result.formatted == '' ? nil : result.formatted,
|
|
93
|
+
result.formatted == '' ? nil : StackTrace.pretty_formatted!(+result.formatted, result.stack_trace),
|
|
89
94
|
result.stack_trace == '' ? nil : result.stack_trace,
|
|
90
95
|
result.span.nil? ? nil : Logger::SourceSpan.new(result.span),
|
|
91
96
|
compile_response.loaded_urls.to_a
|
|
92
97
|
)
|
|
98
|
+
compile_error.set_backtrace(@backtrace) unless @backtrace.nil?
|
|
99
|
+
raise compile_error
|
|
93
100
|
when :success
|
|
94
101
|
CompileResult.new(
|
|
95
102
|
result.css,
|
|
@@ -221,6 +228,6 @@ module Sass
|
|
|
221
228
|
end
|
|
222
229
|
end
|
|
223
230
|
|
|
224
|
-
private_constant :
|
|
231
|
+
private_constant :Session
|
|
225
232
|
end
|
|
226
233
|
end
|
data/lib/sass/compiler.rb
CHANGED
|
@@ -5,7 +5,7 @@ require_relative 'compile_result'
|
|
|
5
5
|
require_relative 'compiler/channel'
|
|
6
6
|
require_relative 'compiler/connection'
|
|
7
7
|
require_relative 'compiler/dispatcher'
|
|
8
|
-
require_relative 'compiler/
|
|
8
|
+
require_relative 'compiler/session'
|
|
9
9
|
require_relative 'compiler/varint'
|
|
10
10
|
require_relative 'embedded/version'
|
|
11
11
|
require_relative 'embedded_protocol'
|
|
@@ -17,6 +17,7 @@ require_relative 'logger/source_location'
|
|
|
17
17
|
require_relative 'logger/source_span'
|
|
18
18
|
require_relative 'node_package_importer'
|
|
19
19
|
require_relative 'serializer'
|
|
20
|
+
require_relative 'uri'
|
|
20
21
|
require_relative 'value'
|
|
21
22
|
|
|
22
23
|
module Sass
|
|
@@ -86,7 +87,7 @@ module Sass
|
|
|
86
87
|
verbose: false)
|
|
87
88
|
raise ArgumentError, 'path must be set' if path.nil?
|
|
88
89
|
|
|
89
|
-
|
|
90
|
+
Session.new(@channel).compile_request(
|
|
90
91
|
path:,
|
|
91
92
|
source: nil,
|
|
92
93
|
importer: nil,
|
|
@@ -169,7 +170,7 @@ module Sass
|
|
|
169
170
|
verbose: false)
|
|
170
171
|
raise ArgumentError, 'source must be set' if source.nil?
|
|
171
172
|
|
|
172
|
-
|
|
173
|
+
Session.new(@channel).compile_request(
|
|
173
174
|
path: nil,
|
|
174
175
|
source:,
|
|
175
176
|
importer:,
|
|
@@ -198,7 +199,7 @@ module Sass
|
|
|
198
199
|
def info
|
|
199
200
|
@info ||= [
|
|
200
201
|
['sass-embedded', Embedded::VERSION, '(Embedded Host)', '[Ruby]'].join("\t"),
|
|
201
|
-
|
|
202
|
+
Session.new(@channel).version_request.join("\t")
|
|
202
203
|
].join("\n").freeze
|
|
203
204
|
end
|
|
204
205
|
|
data/lib/sass/dart-sass/src/dart
CHANGED
|
Binary file
|
|
Binary file
|
data/lib/sass/exception.rb
CHANGED
|
@@ -12,25 +12,77 @@ module Sass
|
|
|
12
12
|
# @return [Array<String>]
|
|
13
13
|
attr_reader :loaded_urls
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
if Exception.public_method_defined?(:detailed_message, false)
|
|
16
|
+
# @!visibility private
|
|
17
|
+
def initialize(message, detailed_message, sass_stack, span, loaded_urls)
|
|
18
|
+
super(message)
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
@detailed_message = detailed_message
|
|
21
|
+
@sass_stack = sass_stack
|
|
22
|
+
@span = span
|
|
23
|
+
@loaded_urls = loaded_urls
|
|
24
|
+
end
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
@
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
# @!visibility private
|
|
27
|
+
def detailed_message(highlight: nil, **)
|
|
28
|
+
return super if @detailed_message.nil?
|
|
29
|
+
|
|
30
|
+
highlight = Exception.to_tty? if highlight.nil?
|
|
31
|
+
|
|
32
|
+
detailed_message = @detailed_message.sub(message, super)
|
|
33
|
+
detailed_message.gsub!(/\e\[[0-9;]*m/, '') unless highlight
|
|
34
|
+
detailed_message
|
|
35
|
+
end
|
|
36
|
+
else # TODO: remove once ruby 3.1 support is dropped
|
|
37
|
+
# @!visibility private
|
|
38
|
+
def initialize(message, detailed_message, sass_stack, span, loaded_urls)
|
|
39
|
+
super(detailed_message.nil? ? message : detailed_message)
|
|
40
|
+
|
|
41
|
+
@message = message
|
|
42
|
+
@detailed_message = detailed_message
|
|
43
|
+
@sass_stack = sass_stack
|
|
44
|
+
@span = span
|
|
45
|
+
@loaded_urls = loaded_urls
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# @!visibility private
|
|
49
|
+
def message
|
|
50
|
+
return @message if @detailed_message.nil? || @full_message.nil?
|
|
51
|
+
|
|
52
|
+
@detailed_message
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# @!visibility private
|
|
56
|
+
def detailed_message(highlight: nil, **)
|
|
57
|
+
highlight = Exception.to_tty? if highlight.nil?
|
|
58
|
+
|
|
59
|
+
super_ = if highlight
|
|
60
|
+
lines = message.split("\n")
|
|
61
|
+
lines[0] += " (\e[1;4m#{self.class.name}\e[m\e[1m)" unless lines.empty?
|
|
62
|
+
lines.map { |line| "\e[1m#{line}\e[m" }.join("\n")
|
|
63
|
+
else
|
|
64
|
+
lines = message.split("\n", 2)
|
|
65
|
+
lines[0] += " (#{self.class.name})" unless lines.empty?
|
|
66
|
+
lines.join("\n")
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
return super_ if @detailed_message.nil?
|
|
70
|
+
|
|
71
|
+
detailed_message = @detailed_message.sub(message, super_)
|
|
72
|
+
detailed_message.gsub!(/\e\[[0-9;]*m/, '') unless highlight
|
|
73
|
+
detailed_message
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# @!visibility private
|
|
77
|
+
def full_message(highlight: nil, order: :top, **)
|
|
78
|
+
highlight = Exception.to_tty? if highlight.nil?
|
|
79
|
+
|
|
80
|
+
@full_message = true
|
|
81
|
+
full_message = super.force_encoding(message.encoding)
|
|
82
|
+
full_message.gsub!(/\e\[[0-9;]*m/, '') unless highlight
|
|
83
|
+
full_message
|
|
84
|
+
ensure
|
|
85
|
+
@full_message = nil
|
|
34
86
|
end
|
|
35
87
|
end
|
|
36
88
|
|
|
@@ -2,16 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
module Sass
|
|
4
4
|
# The built-in RubyGems package importer. This loads pkg: URLs from gems.
|
|
5
|
+
#
|
|
6
|
+
# @example
|
|
7
|
+
# require 'bundler/inline'
|
|
8
|
+
#
|
|
9
|
+
# gemfile do
|
|
10
|
+
# source 'https://rubygems.org'
|
|
11
|
+
# gem 'bootstrap', require: false
|
|
12
|
+
# gem 'sass-embedded'
|
|
13
|
+
# end
|
|
14
|
+
#
|
|
15
|
+
# puts Sass.compile_string('@use "pkg:bootstrap/assets/stylesheets/bootstrap";', importers: [Sass::GemPackageImporter.new]).css
|
|
5
16
|
class GemPackageImporter
|
|
6
17
|
# @!visibility private
|
|
7
18
|
def find_file_url(url, _canonicalize_context)
|
|
8
19
|
return unless url.start_with?('pkg:')
|
|
9
20
|
|
|
10
|
-
library, _, path = url[4..].partition(
|
|
11
|
-
gem_dir = Gem::Dependency.new(library).to_spec.gem_dir
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"file://#{gem_dir.gsub(/[#%?\\]/, { '#' => '%23', '%' => '%25', '?' => '%3F', '\\' => '%5C' })}/#{path}"
|
|
21
|
+
library, _, path = url[4..].partition('/')
|
|
22
|
+
gem_dir = Gem::Dependency.new(Uri.decode_uri_component(library)).to_spec.gem_dir
|
|
23
|
+
"#{Uri.path_to_file_uri(gem_dir)}/#{path}"
|
|
15
24
|
rescue Gem::MissingSpecError
|
|
16
25
|
nil
|
|
17
26
|
end
|
data/lib/sass/uri.rb
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'uri'
|
|
4
|
+
|
|
5
|
+
module Sass
|
|
6
|
+
# The {Uri} class.
|
|
7
|
+
#
|
|
8
|
+
# It follows RFC3986 to match the behavior of Uri class from Dart.
|
|
9
|
+
#
|
|
10
|
+
# @see https://www.rfc-editor.org/info/rfc3986/
|
|
11
|
+
module Uri
|
|
12
|
+
module_function
|
|
13
|
+
|
|
14
|
+
def decode_uri_component(str)
|
|
15
|
+
str.b.gsub(/%\h\h/, ::URI::TBLDECWWWCOMP_).force_encoding(str.encoding)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def encode_uri_component(str)
|
|
19
|
+
str.b.gsub(/[^0-9A-Za-z\-._~]/n, ::URI::TBLENCURICOMP_).force_encoding(str.encoding)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def encode_uri_path_component(str)
|
|
23
|
+
str.b.gsub(%r{[^0-9A-Za-z\-._~!$&'()*+,;=:@/]}n, ::URI::TBLENCURICOMP_).force_encoding(str.encoding)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def encode_uri_query_component(str)
|
|
27
|
+
str.b.gsub(%r{[^0-9A-Za-z\-._~!$&'()*+,;=:@/?]}n, ::URI::TBLENCURICOMP_).force_encoding(str.encoding)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def file_uri_to_path(uri)
|
|
31
|
+
path = decode_uri_component(::URI::RFC3986_PARSER.parse(uri).path)
|
|
32
|
+
if path.start_with?('/')
|
|
33
|
+
windows_path = path[1..]
|
|
34
|
+
path = windows_path if File.absolute_path?(windows_path)
|
|
35
|
+
end
|
|
36
|
+
path
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def path_to_file_uri(path)
|
|
40
|
+
path = "/#{path}" unless path.start_with?('/')
|
|
41
|
+
"file://#{encode_uri_path_component(path)}"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def pwd
|
|
45
|
+
pwd = Dir.pwd
|
|
46
|
+
pwd += '/' unless pwd.end_with?('/')
|
|
47
|
+
path_to_file_uri(pwd)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def relative(to, from)
|
|
51
|
+
::URI::RFC3986_PARSER.parse(to).route_from(from).to_s
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
private_constant :Uri
|
|
56
|
+
end
|
|
@@ -33,7 +33,7 @@ module Sass
|
|
|
33
33
|
|
|
34
34
|
# The algorithm for converting a single `srgb` or `display-p3` channel to
|
|
35
35
|
# linear-light form.
|
|
36
|
-
# @param [Numeric]
|
|
36
|
+
# @param channel [Numeric]
|
|
37
37
|
# @return [Numeric]
|
|
38
38
|
def srgb_and_display_p3_to_linear(channel)
|
|
39
39
|
abs = channel.abs
|
|
@@ -42,7 +42,7 @@ module Sass
|
|
|
42
42
|
|
|
43
43
|
# The algorithm for converting a single `srgb` or `display-p3` channel to
|
|
44
44
|
# gamma-corrected form.
|
|
45
|
-
# @param [Numeric]
|
|
45
|
+
# @param channel [Numeric]
|
|
46
46
|
# @return [Numeric]
|
|
47
47
|
def srgb_and_display_p3_from_linear(channel)
|
|
48
48
|
abs = channel.abs
|
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: 1.
|
|
4
|
+
version: 1.101.0
|
|
5
5
|
platform: aarch64-linux-musl
|
|
6
6
|
authors:
|
|
7
7
|
- なつき
|
|
@@ -45,12 +45,14 @@ files:
|
|
|
45
45
|
- lib/sass/compiler/channel.rb
|
|
46
46
|
- lib/sass/compiler/connection.rb
|
|
47
47
|
- lib/sass/compiler/dispatcher.rb
|
|
48
|
-
- lib/sass/compiler/
|
|
49
|
-
- lib/sass/compiler/
|
|
50
|
-
- lib/sass/compiler/
|
|
51
|
-
- lib/sass/compiler/
|
|
52
|
-
- lib/sass/compiler/
|
|
53
|
-
- lib/sass/compiler/
|
|
48
|
+
- lib/sass/compiler/session.rb
|
|
49
|
+
- lib/sass/compiler/session/function_registry.rb
|
|
50
|
+
- lib/sass/compiler/session/importer_registry.rb
|
|
51
|
+
- lib/sass/compiler/session/logger_registry.rb
|
|
52
|
+
- lib/sass/compiler/session/path.rb
|
|
53
|
+
- lib/sass/compiler/session/protofier.rb
|
|
54
|
+
- lib/sass/compiler/session/stack_trace.rb
|
|
55
|
+
- lib/sass/compiler/session/struct.rb
|
|
54
56
|
- lib/sass/compiler/varint.rb
|
|
55
57
|
- lib/sass/dart-sass/sass
|
|
56
58
|
- lib/sass/dart-sass/src/LICENSE
|
|
@@ -69,6 +71,7 @@ files:
|
|
|
69
71
|
- lib/sass/logger/source_span.rb
|
|
70
72
|
- lib/sass/node_package_importer.rb
|
|
71
73
|
- lib/sass/serializer.rb
|
|
74
|
+
- lib/sass/uri.rb
|
|
72
75
|
- lib/sass/value.rb
|
|
73
76
|
- lib/sass/value/argument_list.rb
|
|
74
77
|
- lib/sass/value/boolean.rb
|
|
@@ -113,8 +116,8 @@ licenses:
|
|
|
113
116
|
- MIT
|
|
114
117
|
metadata:
|
|
115
118
|
bug_tracker_uri: https://github.com/sass-contrib/sass-embedded-host-ruby/issues
|
|
116
|
-
documentation_uri: https://rubydoc.info/gems/sass-embedded/1.
|
|
117
|
-
source_code_uri: https://github.com/sass-contrib/sass-embedded-host-ruby/tree/v1.
|
|
119
|
+
documentation_uri: https://rubydoc.info/gems/sass-embedded/1.101.0
|
|
120
|
+
source_code_uri: https://github.com/sass-contrib/sass-embedded-host-ruby/tree/v1.101.0
|
|
118
121
|
funding_uri: https://github.com/sponsors/ntkme
|
|
119
122
|
rubygems_mfa_required: 'true'
|
|
120
123
|
rdoc_options: []
|
|
@@ -131,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
131
134
|
- !ruby/object:Gem::Version
|
|
132
135
|
version: '0'
|
|
133
136
|
requirements: []
|
|
134
|
-
rubygems_version: 4.0.
|
|
137
|
+
rubygems_version: 4.0.14
|
|
135
138
|
specification_version: 4
|
|
136
139
|
summary: Use dart-sass with Ruby!
|
|
137
140
|
test_files: []
|