sassc-embedded 1.77.1 → 1.77.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4b63d6cb7265fce189ee1c9dd5a5e6c06a2ae5d0d0ccf2fe88bf9ea15a0b4f2
4
- data.tar.gz: 9742024209ffbcd80ec482028500370fb12343af829e814b3e4daf9d15e3a7f0
3
+ metadata.gz: dd81bac6ef9d2f86bf538c0143e19267e892a907d8a3b7d3547ce900b6fb8e08
4
+ data.tar.gz: 6c9592d7f4f8be038427f7ed893b6bb235f598a7d8a9cf34091b453c325b8551
5
5
  SHA512:
6
- metadata.gz: d332ab05fee496aa0bcd14aad0d623a4309ef9244cf30125f191fc5542bc79c7cf2effe8e0ec2069a59384c621467097977b70c030e465c798f5b46860159ecb
7
- data.tar.gz: e14c9ffb2dc052809527cc30619fa28224457523780237fd44004f953de09e867fb0ea2b1933a23cece2cb6cb3c8cb8ce2264096848c8cb86acd8876d55cec7a
6
+ metadata.gz: 4e03d2ba0d17fab117b33f49a03b89ac90f75b49afb0c42db58c5e8a9d42f62737f7c6f81db5eef3a8da77e045b7a686ca036e5475f906a30758388e5624b5b7
7
+ data.tar.gz: 12ff6dc22c74b77adef326df8a4f0c102bc34114e9b815e6be65a53307ec9271a040400d3965baad93c0387a7f909c31c3c2e1e1549956d22cb680fc3caf3106
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SassC
4
4
  module Embedded
5
- VERSION = '1.77.1'
5
+ VERSION = '1.77.4'
6
6
  end
7
7
  end
@@ -46,11 +46,10 @@ module SassC
46
46
  css = result.css
47
47
  css += "\n" unless css.empty?
48
48
  unless @source_map.nil? || omit_source_map_url?
49
- url = Uri.parse(output_url || file_url)
50
49
  source_mapping_url = if source_map_embed?
51
50
  "data:application/json;base64,#{[@source_map].pack('m0')}"
52
51
  else
53
- Uri.file_urls_to_relative_url(source_map_file_url, url)
52
+ Uri.file_urls_to_relative_url(source_map_file_url, file_url)
54
53
  end
55
54
  css += "\n/*# sourceMappingURL=#{source_mapping_url} */"
56
55
  end
@@ -78,7 +77,6 @@ module SassC
78
77
 
79
78
  url = Uri.parse(source_map_file_url || file_url)
80
79
  data = JSON.parse(@source_map)
81
- data['file'] = Uri.file_urls_to_relative_url(output_url, url) if output_url
82
80
  data['sources'].map! do |source|
83
81
  if source.start_with?('file:')
84
82
  Uri.file_urls_to_relative_url(source, url)
@@ -96,24 +94,10 @@ module SassC
96
94
  @file_url ||= Uri.path_to_file_url(File.absolute_path(filename || 'stdin'))
97
95
  end
98
96
 
99
- def output_path
100
- @output_path ||= @options.fetch(:output_path) do
101
- "#{filename.delete_suffix(File.extname(filename))}.css" if filename
102
- end
103
- end
104
-
105
- def output_url
106
- @output_url ||= (Uri.path_to_file_url(File.absolute_path(output_path)) if output_path)
107
- end
108
-
109
97
  def source_map_file_url
110
98
  @source_map_file_url ||= if source_map_file
111
- # https://github.com/sass-contrib/sassc-embedded-shim-ruby/pull/69
112
- # SassC does not encode path as uri for sourceMappingURL, which is technically wrong.
113
- # However, this behavior has been abused to append query string to sourceMappingURL.
114
- components = source_map_file.split('?', 2)
115
- components[0] = Uri.path_to_file_url(File.absolute_path(components[0]))
116
- components.join('?')
99
+ Uri.path_to_file_url(File.absolute_path(source_map_file))
100
+ .gsub('%3F', '?') # https://github.com/sass-contrib/sassc-embedded-shim-ruby/pull/69
117
101
  end
118
102
  end
119
103
 
@@ -568,32 +552,45 @@ module SassC
568
552
  module_function
569
553
 
570
554
  def parse(...)
571
- ::URI.parse(...)
572
- end
573
-
574
- def encode_uri_path_component(str)
575
- str.b.gsub(%r{[^0-9A-Za-z\-._~!$&'()*+,;=:@/]}n) do |match|
576
- format('%%%02X', match.unpack1('C'))
577
- end.force_encoding(str.encoding)
578
- end
579
-
580
- def encode_uri_query_component(str)
581
- str.b.gsub(%r{[^0-9A-Za-z\-._~!$&'()*+,;=:@/?]}n) do |match|
582
- format('%%%02X', match.unpack1('C'))
583
- end.force_encoding(str.encoding)
555
+ ::URI::RFC3986_PARSER.parse(...)
584
556
  end
585
557
 
586
- def encode_uri_component(str)
587
- str.b.gsub(/[^0-9A-Za-z\-._~]/n) do |match|
588
- format('%%%02X', match.unpack1('C'))
589
- end.force_encoding(str.encoding)
590
- end
558
+ {
559
+ encode_uri_path_component: "!$&'()*+,;=:/@",
560
+ encode_uri_query_component: "!$&'()*+,;=:/?@",
561
+ encode_uri_component: nil,
562
+ encode_uri: "!$&'()*+,;=:/?#[]@"
563
+ }
564
+ .each do |symbol, extra_unescaped|
565
+ regexp = Regexp.new("[^0-9A-Za-z#{Regexp.escape("-._~#{extra_unescaped}")}]", Regexp::NOENCODING)
566
+ define_method(symbol) do |str|
567
+ str.b.gsub(regexp) do |match|
568
+ "%#{match.unpack1('H2').upcase}"
569
+ end.force_encoding(str.encoding)
570
+ end
571
+ end
591
572
 
592
- def decode_uri_component(str)
593
- str.gsub(/%[0-9A-Fa-f]{2}/) do |match|
594
- [match[1, 2]].pack('H2')
573
+ {
574
+ decode_uri_component: nil,
575
+ decode_uri: "!$&'()*+,;=:/?#[]@"
576
+ }
577
+ .each do |symbol, preserve_escaped|
578
+ regexp = /%[0-9A-Fa-f]{2}/o
579
+ if preserve_escaped.nil? || preserve_escaped.empty?
580
+ define_method(symbol) do |str|
581
+ str.gsub(regexp) do |match|
582
+ [match.reverse!].pack('h2')
583
+ end.force_encoding(str.encoding)
584
+ end
585
+ else
586
+ define_method(symbol) do |str|
587
+ str.gsub(regexp) do |match|
588
+ decoded = [match.reverse].pack('h2')
589
+ preserve_escaped.include?(decoded) ? match : decoded
590
+ end.force_encoding(str.encoding)
591
+ end
592
+ end
595
593
  end
596
- end
597
594
 
598
595
  def file_urls_to_relative_url(url, from_url)
599
596
  parse(url).route_from(from_url).to_s
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sassc-embedded
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.77.1
4
+ version: 1.77.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-29 00:00:00.000000000 Z
11
+ date: 2024-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass-embedded
@@ -79,7 +79,7 @@ licenses:
79
79
  metadata:
80
80
  bug_tracker_uri: https://github.com/sass-contrib/sassc-embedded-shim-ruby/issues
81
81
  documentation_uri: https://rubydoc.info/gems/sassc
82
- source_code_uri: https://github.com/sass-contrib/sassc-embedded-shim-ruby/tree/v1.77.1
82
+ source_code_uri: https://github.com/sass-contrib/sassc-embedded-shim-ruby/tree/v1.77.4
83
83
  funding_uri: https://github.com/sponsors/ntkme
84
84
  rubygems_mfa_required: 'true'
85
85
  post_install_message: