sassc-embedded 1.80.8 → 1.80.9
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/sassc/embedded/version.rb +1 -1
- data/lib/sassc/embedded.rb +55 -74
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce2b5df08cbde379c1890a5b9407116c219ff7193e5556e05cab8dd5bf952cc0
|
|
4
|
+
data.tar.gz: 2d121c14fde27d64de95827bccec1230b4eebb4b2f438583db7f9014fbcd8f5c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 656f84a31fe4df337792da0f387b86a2bf6eb3e5c9b4387990ec08a73709a093035afe60cb774644fe997847995eaef0c92ea28862c53fe8f6f38733a7af4766
|
|
7
|
+
data.tar.gz: 164477d5d55ecf7e207c6365ef5c4226fbe89f330691361defea69371b0b1ead70e7713b4b68d22743a4eaacbde476c4e036452c45ceb82228e7359ba1e5cac9
|
data/lib/sassc/embedded.rb
CHANGED
|
@@ -47,7 +47,7 @@ module SassC
|
|
|
47
47
|
source_mapping_url = if source_map_embed?
|
|
48
48
|
"data:application/json;base64,#{[@source_map].pack('m0')}"
|
|
49
49
|
else
|
|
50
|
-
Uri.
|
|
50
|
+
Uri.decode_uri_component(Uri.relative(source_map_file_url, file_url))
|
|
51
51
|
end
|
|
52
52
|
css << "\n/*# sourceMappingURL=#{source_mapping_url} */"
|
|
53
53
|
end
|
|
@@ -58,8 +58,8 @@ module SassC
|
|
|
58
58
|
line = e.span&.start&.line
|
|
59
59
|
line += 1 unless line.nil?
|
|
60
60
|
url = e.span&.url
|
|
61
|
-
|
|
62
|
-
raise SyntaxError.new(e.
|
|
61
|
+
filename = (Uri.decode_uri_component(Uri.relative(url, Uri.pwd)) if url&.start_with?('file:'))
|
|
62
|
+
raise SyntaxError.new(e.message, filename:, line:)
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
remove_method(:dependencies) if public_method_defined?(:dependencies, false)
|
|
@@ -68,7 +68,7 @@ module SassC
|
|
|
68
68
|
raise NotRenderedError unless @loaded_urls
|
|
69
69
|
|
|
70
70
|
Dependency.from_filenames(@loaded_urls.filter_map do |url|
|
|
71
|
-
Uri.
|
|
71
|
+
Uri.file_uri_to_path(url) if url.start_with?('file:') && !url.include?('?') && url != file_url
|
|
72
72
|
end)
|
|
73
73
|
end
|
|
74
74
|
|
|
@@ -77,11 +77,11 @@ module SassC
|
|
|
77
77
|
def source_map
|
|
78
78
|
raise NotRenderedError unless @source_map
|
|
79
79
|
|
|
80
|
-
url =
|
|
80
|
+
url = source_map_file_url || file_url
|
|
81
81
|
data = JSON.parse(@source_map)
|
|
82
82
|
data['sources'].map! do |source|
|
|
83
83
|
if source.start_with?('file:')
|
|
84
|
-
Uri.
|
|
84
|
+
Uri.relative(source, url)
|
|
85
85
|
else
|
|
86
86
|
source
|
|
87
87
|
end
|
|
@@ -93,12 +93,12 @@ module SassC
|
|
|
93
93
|
private
|
|
94
94
|
|
|
95
95
|
def file_url
|
|
96
|
-
@file_url ||= Uri.
|
|
96
|
+
@file_url ||= Uri.path_to_file_uri(File.absolute_path(filename || 'stdin'))
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
def source_map_file_url
|
|
100
100
|
@source_map_file_url ||= if source_map_file
|
|
101
|
-
Uri.
|
|
101
|
+
Uri.path_to_file_uri(File.absolute_path(source_map_file))
|
|
102
102
|
.gsub('%3F', '?') # https://github.com/sass-contrib/sassc-embedded-shim-ruby/pull/69
|
|
103
103
|
end
|
|
104
104
|
end
|
|
@@ -143,15 +143,11 @@ module SassC
|
|
|
143
143
|
Script.custom_functions(functions:).each_with_object({}) do |custom_function, callbacks|
|
|
144
144
|
callback = lambda do |native_argument_list|
|
|
145
145
|
function_arguments = arguments_from_native_list(native_argument_list)
|
|
146
|
-
|
|
147
|
-
result = functions_wrapper.send(custom_function, *function_arguments)
|
|
148
|
-
rescue StandardError
|
|
149
|
-
raise ::Sass::ScriptError, "Error: error in C function #{custom_function}"
|
|
150
|
-
end
|
|
146
|
+
result = functions_wrapper.send(custom_function, *function_arguments)
|
|
151
147
|
to_native_value(result)
|
|
152
148
|
rescue StandardError => e
|
|
153
|
-
|
|
154
|
-
raise
|
|
149
|
+
error(e.message)
|
|
150
|
+
raise
|
|
155
151
|
end
|
|
156
152
|
|
|
157
153
|
callbacks[Script.formatted_function_name(custom_function, functions:)] = callback
|
|
@@ -173,6 +169,12 @@ module SassC
|
|
|
173
169
|
def to_native_value(sass_value)
|
|
174
170
|
Script::ValueConversion.to_native(sass_value)
|
|
175
171
|
end
|
|
172
|
+
|
|
173
|
+
remove_method(:error) if private_method_defined?(:error, false)
|
|
174
|
+
|
|
175
|
+
def error(message)
|
|
176
|
+
warn "[SassC::FunctionsHandler] #{message}"
|
|
177
|
+
end
|
|
176
178
|
end
|
|
177
179
|
|
|
178
180
|
module NoopImporter
|
|
@@ -304,11 +306,11 @@ module SassC
|
|
|
304
306
|
containing_url = context.containing_url
|
|
305
307
|
|
|
306
308
|
path = Uri.decode_uri_component(url)
|
|
307
|
-
parent_path = Uri.
|
|
309
|
+
parent_path = Uri.file_uri_to_path(containing_url)
|
|
308
310
|
parent_dir = File.dirname(parent_path)
|
|
309
311
|
|
|
310
312
|
if containing_url.include?('?')
|
|
311
|
-
canonical_url = Uri.
|
|
313
|
+
canonical_url = Uri.path_to_file_uri(File.absolute_path(path, parent_dir))
|
|
312
314
|
unless @importer_results.key?(canonical_url)
|
|
313
315
|
@file_url = resolve_file_url(path, parent_dir, context.from_import)
|
|
314
316
|
return
|
|
@@ -344,7 +346,7 @@ module SassC
|
|
|
344
346
|
|
|
345
347
|
def resolve_file_url(path, parent_dir, from_import)
|
|
346
348
|
resolved = FileSystemImporter.resolve_path(File.absolute_path(path, parent_dir), from_import)
|
|
347
|
-
Uri.
|
|
349
|
+
Uri.path_to_file_uri(resolved) unless resolved.nil?
|
|
348
350
|
end
|
|
349
351
|
|
|
350
352
|
def syntax(path)
|
|
@@ -360,7 +362,7 @@ module SassC
|
|
|
360
362
|
|
|
361
363
|
def import_to_native(import, parent_dir, from_import, canonicalize)
|
|
362
364
|
if import.source
|
|
363
|
-
canonical_url = Uri.
|
|
365
|
+
canonical_url = Uri.path_to_file_uri(File.absolute_path(import.path, parent_dir))
|
|
364
366
|
@importer_results[canonical_url] = if import.source.is_a?(Hash)
|
|
365
367
|
{
|
|
366
368
|
contents: import.source[:contents],
|
|
@@ -572,71 +574,41 @@ module SassC
|
|
|
572
574
|
end
|
|
573
575
|
end
|
|
574
576
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
+
class SyntaxError
|
|
578
|
+
def detailed_message(...)
|
|
579
|
+
return super unless cause.is_a?(::Sass::CompileError)
|
|
577
580
|
|
|
578
|
-
|
|
579
|
-
::URI::RFC3986_PARSER.parse(...)
|
|
581
|
+
cause.detailed_message(...).gsub(cause.class.name, self.class.name)
|
|
580
582
|
end
|
|
581
583
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
h = c.unpack1('H')
|
|
587
|
-
l = c.unpack1('h')
|
|
588
|
-
pdd = -"%#{h}#{l}"
|
|
589
|
-
pdu = -"%#{h}#{l.upcase}"
|
|
590
|
-
pud = -"%#{h.upcase}#{l}"
|
|
591
|
-
puu = -pdd.upcase
|
|
592
|
-
encode_uri_hash[c] = puu
|
|
593
|
-
decode_uri_hash[pdd] = c
|
|
594
|
-
decode_uri_hash[pdu] = c
|
|
595
|
-
decode_uri_hash[pud] = c
|
|
596
|
-
decode_uri_hash[puu] = c
|
|
584
|
+
def full_message(...)
|
|
585
|
+
return super unless cause.is_a?(::Sass::CompileError)
|
|
586
|
+
|
|
587
|
+
cause.full_message(...).gsub(cause.class.name, self.class.name)
|
|
597
588
|
end
|
|
598
|
-
|
|
599
|
-
decode_uri_hash.freeze
|
|
600
|
-
|
|
601
|
-
{
|
|
602
|
-
uri_path_component: "!$&'()*+,;=:/@",
|
|
603
|
-
uri_query_component: "!$&'()*+,;=:/?@",
|
|
604
|
-
uri_component: nil,
|
|
605
|
-
uri: "!$&'()*+,;=:/?#[]@"
|
|
606
|
-
}
|
|
607
|
-
.each do |symbol, unescaped|
|
|
608
|
-
encode_regexp = Regexp.new("[^0-9A-Za-z#{Regexp.escape("-._~#{unescaped}")}]", Regexp::NOENCODING)
|
|
609
|
-
|
|
610
|
-
define_method(:"encode_#{symbol}") do |str|
|
|
611
|
-
str.b.gsub(encode_regexp, encode_uri_hash).force_encoding(str.encoding)
|
|
612
|
-
end
|
|
589
|
+
end
|
|
613
590
|
|
|
614
|
-
|
|
591
|
+
module Uri
|
|
592
|
+
module_function
|
|
615
593
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
else
|
|
620
|
-
decode_uri_hash.each_with_object({}) do |(key, value), hash|
|
|
621
|
-
hash[key] = unescaped.include?(value) ? key : value
|
|
622
|
-
end.freeze
|
|
623
|
-
end
|
|
594
|
+
def decode_uri_component(str)
|
|
595
|
+
str.b.gsub(/%\h\h/, ::URI::TBLDECWWWCOMP_).force_encoding(str.encoding)
|
|
596
|
+
end
|
|
624
597
|
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
end
|
|
598
|
+
def encode_uri_component(str)
|
|
599
|
+
str.b.gsub(/[^0-9A-Za-z\-._~]/n, ::URI::TBLENCURICOMP_).force_encoding(str.encoding)
|
|
600
|
+
end
|
|
629
601
|
|
|
630
|
-
def
|
|
631
|
-
|
|
602
|
+
def encode_uri_path_component(str)
|
|
603
|
+
str.b.gsub(%r{[^0-9A-Za-z\-._~!$&'()*+,;=:@/]}n, ::URI::TBLENCURICOMP_).force_encoding(str.encoding)
|
|
632
604
|
end
|
|
633
605
|
|
|
634
|
-
def
|
|
635
|
-
|
|
606
|
+
def encode_uri_query_component(str)
|
|
607
|
+
str.b.gsub(%r{[^0-9A-Za-z\-._~!$&'()*+,;=:@/?]}n, ::URI::TBLENCURICOMP_).force_encoding(str.encoding)
|
|
636
608
|
end
|
|
637
609
|
|
|
638
|
-
def
|
|
639
|
-
path = decode_uri_component(parse(
|
|
610
|
+
def file_uri_to_path(uri)
|
|
611
|
+
path = decode_uri_component(::URI::RFC3986_PARSER.parse(uri).path)
|
|
640
612
|
if path.start_with?('/')
|
|
641
613
|
windows_path = path[1..]
|
|
642
614
|
path = windows_path if File.absolute_path?(windows_path)
|
|
@@ -644,11 +616,20 @@ module SassC
|
|
|
644
616
|
path
|
|
645
617
|
end
|
|
646
618
|
|
|
647
|
-
def
|
|
619
|
+
def path_to_file_uri(path)
|
|
648
620
|
path = "/#{path}" unless path.start_with?('/')
|
|
649
|
-
|
|
650
621
|
"file://#{encode_uri_path_component(path)}"
|
|
651
622
|
end
|
|
623
|
+
|
|
624
|
+
def pwd
|
|
625
|
+
pwd = Dir.pwd
|
|
626
|
+
pwd += '/' unless pwd.end_with?('/')
|
|
627
|
+
path_to_file_uri(pwd)
|
|
628
|
+
end
|
|
629
|
+
|
|
630
|
+
def relative(to, from)
|
|
631
|
+
::URI::RFC3986_PARSER.parse(to).route_from(from).to_s
|
|
632
|
+
end
|
|
652
633
|
end
|
|
653
634
|
|
|
654
635
|
private_constant :Uri
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sassc-embedded
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.80.
|
|
4
|
+
version: 1.80.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- なつき
|
|
@@ -78,7 +78,7 @@ licenses:
|
|
|
78
78
|
metadata:
|
|
79
79
|
bug_tracker_uri: https://github.com/sass-contrib/sassc-embedded-shim-ruby/issues
|
|
80
80
|
documentation_uri: https://rubydoc.info/gems/sassc
|
|
81
|
-
source_code_uri: https://github.com/sass-contrib/sassc-embedded-shim-ruby/tree/v1.80.
|
|
81
|
+
source_code_uri: https://github.com/sass-contrib/sassc-embedded-shim-ruby/tree/v1.80.9
|
|
82
82
|
funding_uri: https://github.com/sponsors/ntkme
|
|
83
83
|
rubygems_mfa_required: 'true'
|
|
84
84
|
rdoc_options: []
|
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
97
|
version: '0'
|
|
98
98
|
requirements: []
|
|
99
|
-
rubygems_version: 4.0.
|
|
99
|
+
rubygems_version: 4.0.14
|
|
100
100
|
specification_version: 4
|
|
101
101
|
summary: Use dart-sass with SassC!
|
|
102
102
|
test_files: []
|