sassc-embedded 1.80.8 → 1.80.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b00967b3088cd97f97b51d7d0385a51bebc438d481808722bd8019eaa06fafb
4
- data.tar.gz: ca1c07140d6393273f646e7df8acc7bc7dc40b136ad23702d73e0db37ed58c63
3
+ metadata.gz: 106649cd9d319cb9feb40815710b31cc1263a69eac98de0ba12e1a0795d03e48
4
+ data.tar.gz: 6b2ef4cb3064dc65e43d9746ee3aea5df958dcbfbdc47246087596a0cb814ef0
5
5
  SHA512:
6
- metadata.gz: 5464cf8007928398c6af6be568232c4e481c0403b89e4ff8a19f4284a17ba8bd8a246597b02b5ca417695730ca7bd7f131e5b63bcf6d8fdff58925968749e348
7
- data.tar.gz: 32ba5bc913e46860e3e68786e476772f1f86ed7f591182f0029e1d5d7acb97222b027b93b2f441a214032979578ac1f000eb4f8622579fcaae8e55bded5f389b
6
+ metadata.gz: cadf965730f0c4be16cfa5fe83400904e508086d98c78904550b2fb5d181091f194b169750e8483dde427942637b4d4c5a6447ab99649e03caee9a54e17ce811
7
+ data.tar.gz: 6d1f31fae3ab308e3fe3ccbd2bea3f46f45473455c54df46d71015211ba94b3b2e46c6897ea78db035114aeb2ee22c7fc4e1a550250c27cf6d328cd04a0e8b28
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SassC
4
4
  module Embedded
5
- VERSION = '1.80.8'
5
+ VERSION = '1.80.10'
6
6
  end
7
7
  end
@@ -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.file_urls_to_relative_url(source_map_file_url, file_url)
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
- path = (Uri.file_urls_to_relative_path(url, Uri.path_to_file_url("#{Dir.pwd}/")) if url&.start_with?('file:'))
62
- raise SyntaxError.new(e.full_message, filename: path, line:)
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.file_url_to_path(url) if url.start_with?('file:') && !url.include?('?') && url != file_url
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 = Uri.parse(source_map_file_url || file_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.file_urls_to_relative_url(source, url)
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.path_to_file_url(File.absolute_path(filename || 'stdin'))
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.path_to_file_url(File.absolute_path(source_map_file))
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
- begin
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
- warn "[SassC::FunctionsHandler] #{e.cause.message}"
154
- raise e
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.file_url_to_path(containing_url)
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.path_to_file_url(File.absolute_path(path, parent_dir))
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.path_to_file_url(resolved) unless resolved.nil?
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.path_to_file_url(File.absolute_path(import.path, parent_dir))
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],
@@ -417,6 +419,12 @@ module SassC
417
419
 
418
420
  module Script
419
421
  class Value
422
+ class Color
423
+ def hsla?
424
+ @mode == :hsla
425
+ end
426
+ end
427
+
420
428
  class String
421
429
  class << self
422
430
  remove_method(:quote) if public_method_defined?(:quote, false)
@@ -525,7 +533,7 @@ module SassC
525
533
  alpha: value.alpha,
526
534
  space: 'rgb'
527
535
  )
528
- elsif value.hlsa?
536
+ elsif value.hsla?
529
537
  ::Sass::Value::Color.new(
530
538
  hue: value.hue,
531
539
  saturation: value.saturation,
@@ -572,71 +580,41 @@ module SassC
572
580
  end
573
581
  end
574
582
 
575
- module Uri
576
- module_function
583
+ class SyntaxError
584
+ def detailed_message(...)
585
+ return super unless cause.is_a?(::Sass::CompileError)
577
586
 
578
- def parse(...)
579
- ::URI::RFC3986_PARSER.parse(...)
587
+ cause.detailed_message(...).gsub(cause.class.name, self.class.name)
580
588
  end
581
589
 
582
- encode_uri_hash = {}
583
- decode_uri_hash = {}
584
- 256.times do |i|
585
- c = -[i].pack('C')
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
590
+ def full_message(...)
591
+ return super unless cause.is_a?(::Sass::CompileError)
592
+
593
+ cause.full_message(...).gsub(cause.class.name, self.class.name)
597
594
  end
598
- encode_uri_hash.freeze
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
595
+ end
613
596
 
614
- next if symbol.match?(/_.+_/o)
597
+ module Uri
598
+ module_function
615
599
 
616
- decode_regexp = /%[0-9A-Fa-f]{2}/o
617
- decode_uri_hash_with_preserve_escaped = if unescaped.nil? || unescaped.empty?
618
- decode_uri_hash
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
600
+ def decode_uri_component(str)
601
+ str.b.gsub(/%\h\h/, ::URI::TBLDECWWWCOMP_).force_encoding(str.encoding)
602
+ end
624
603
 
625
- define_method(:"decode_#{symbol}") do |str|
626
- str.gsub(decode_regexp, decode_uri_hash_with_preserve_escaped).force_encoding(str.encoding)
627
- end
628
- end
604
+ def encode_uri_component(str)
605
+ str.b.gsub(/[^0-9A-Za-z\-._~]/n, ::URI::TBLENCURICOMP_).force_encoding(str.encoding)
606
+ end
629
607
 
630
- def file_urls_to_relative_url(url, from_url)
631
- parse(url).route_from(from_url).to_s
608
+ def encode_uri_path_component(str)
609
+ str.b.gsub(%r{[^0-9A-Za-z\-._~!$&'()*+,;=:@/]}n, ::URI::TBLENCURICOMP_).force_encoding(str.encoding)
632
610
  end
633
611
 
634
- def file_urls_to_relative_path(url, from_url)
635
- decode_uri_component(file_urls_to_relative_url(url, from_url))
612
+ def encode_uri_query_component(str)
613
+ str.b.gsub(%r{[^0-9A-Za-z\-._~!$&'()*+,;=:@/?]}n, ::URI::TBLENCURICOMP_).force_encoding(str.encoding)
636
614
  end
637
615
 
638
- def file_url_to_path(url)
639
- path = decode_uri_component(parse(url).path)
616
+ def file_uri_to_path(uri)
617
+ path = decode_uri_component(::URI::RFC3986_PARSER.parse(uri).path)
640
618
  if path.start_with?('/')
641
619
  windows_path = path[1..]
642
620
  path = windows_path if File.absolute_path?(windows_path)
@@ -644,11 +622,20 @@ module SassC
644
622
  path
645
623
  end
646
624
 
647
- def path_to_file_url(path)
625
+ def path_to_file_uri(path)
648
626
  path = "/#{path}" unless path.start_with?('/')
649
-
650
627
  "file://#{encode_uri_path_component(path)}"
651
628
  end
629
+
630
+ def pwd
631
+ pwd = Dir.pwd
632
+ pwd += '/' unless pwd.end_with?('/')
633
+ path_to_file_uri(pwd)
634
+ end
635
+
636
+ def relative(to, from)
637
+ ::URI::RFC3986_PARSER.parse(to).route_from(from).to_s
638
+ end
652
639
  end
653
640
 
654
641
  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.8
4
+ version: 1.80.10
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.8
81
+ source_code_uri: https://github.com/sass-contrib/sassc-embedded-shim-ruby/tree/v1.80.10
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.1
99
+ rubygems_version: 4.0.21
100
100
  specification_version: 4
101
101
  summary: Use dart-sass with SassC!
102
102
  test_files: []