sassc-embedded 1.77.5 → 1.77.7

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: 3f893a88e7993e70cec58055829a076f43869ac843f4b30741ac0377b7a358ab
4
- data.tar.gz: 5a431b6429c3d6e0d1f2d010efc517d926bfebfb2d9ed454087c312b661f028d
3
+ metadata.gz: 4a5084e30e04703dd21157b4dd3bf32abee7f789e939056a033bc4ddb4c2b1a2
4
+ data.tar.gz: eb1f8e6e1ce7ea90364fccbd4241fb5ccb677ae29a11ed385ec8c1bec068ae85
5
5
  SHA512:
6
- metadata.gz: 0e49489a1079584157456035a5c1bcf932c53a320e371fdb78c3b2cfc3eb74f7369330df925504943237ccf734cd5e4d8801b1ad37179a1a414595e3b32e5565
7
- data.tar.gz: 1107e84ae76c86f032feb15d9162aef04423daef1726e381e6e515e982e02b69178900fd6e07ce1e82efc95d7fa5859caa07bb60d754e15f6cd335ba69a85647
6
+ metadata.gz: 0a1bc6dc872c8cb0ebec80c1cc4d7550b62445515a3e6eca3d510094aadc0c48ce8d213ad5b31934501150b3f771efcdc931560befb87b8c827f74a0cb80fe4e
7
+ data.tar.gz: d9012320b9955c2aea7012bd11d0874dbf3b68ff807e6b7b5f395b22e7b8e4bbc75f48c38c9618fd2da669fd093193c61c257afd0eebc1507cba5a2ab792a0a4
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SassC
4
4
  module Embedded
5
- VERSION = '1.77.5'
5
+ VERSION = '1.77.7'
6
6
  end
7
7
  end
@@ -231,7 +231,7 @@ module SassC
231
231
 
232
232
  private_constant :FileImporter
233
233
 
234
- class FileSystemImporter
234
+ module FileSystemImporter
235
235
  class << self
236
236
  def resolve_path(path, from_import)
237
237
  ext = File.extname(path)
@@ -308,6 +308,7 @@ module SassC
308
308
  def initialize(importer)
309
309
  @importer = importer
310
310
  @importer_results = {}
311
+ @importer_result = nil
311
312
  @file_url = nil
312
313
  end
313
314
 
@@ -322,28 +323,29 @@ module SassC
322
323
 
323
324
  if containing_url.include?('?')
324
325
  canonical_url = Uri.path_to_file_url(File.absolute_path(path, parent_dir))
325
- if @importer_results.key?(canonical_url)
326
- canonical_url
327
- else
326
+ unless @importer_results.key?(canonical_url)
328
327
  @file_url = resolve_file_url(path, parent_dir, context.from_import)
329
- nil
328
+ return
330
329
  end
331
330
  else
332
331
  imports = @importer.imports(path, parent_path)
333
332
  imports = [SassC::Importer::Import.new(path)] if imports.nil?
334
333
  imports = [imports] unless imports.is_a?(Array)
335
334
  canonical_url = imports_to_native(imports, parent_dir, context.from_import, url, containing_url)
336
- if @importer_results.key?(canonical_url)
337
- canonical_url
338
- else
335
+ unless @importer_results.key?(canonical_url)
339
336
  @file_url = canonical_url
340
- nil
337
+ return
341
338
  end
342
339
  end
340
+
341
+ @importer_result = @importer_results.delete(canonical_url)
342
+ canonical_url
343
343
  end
344
344
 
345
- def load(canonical_url)
346
- @importer_results.delete(canonical_url)
345
+ def load(_canonical_url)
346
+ importer_result = @importer_result
347
+ @importer_result = nil
348
+ importer_result
347
349
  end
348
350
 
349
351
  def find_file_url(_url, context)
@@ -588,40 +590,51 @@ module SassC
588
590
  ::URI::RFC3986_PARSER.parse(...)
589
591
  end
590
592
 
593
+ encode_uri_hash = {}
594
+ decode_uri_hash = {}
595
+ 256.times do |i|
596
+ c = -[i].pack('C')
597
+ h = c.unpack1('H')
598
+ l = c.unpack1('h')
599
+ pdd = -"%#{h}#{l}"
600
+ pdu = -"%#{h}#{l.upcase}"
601
+ pud = -"%#{h.upcase}#{l}"
602
+ puu = -pdd.upcase
603
+ encode_uri_hash[c] = puu
604
+ decode_uri_hash[pdd] = c
605
+ decode_uri_hash[pdu] = c
606
+ decode_uri_hash[pud] = c
607
+ decode_uri_hash[puu] = c
608
+ end.freeze
609
+ encode_uri_hash.freeze
610
+ decode_uri_hash.freeze
611
+
591
612
  {
592
- encode_uri_path_component: "!$&'()*+,;=:/@",
593
- encode_uri_query_component: "!$&'()*+,;=:/?@",
594
- encode_uri_component: nil,
595
- encode_uri: "!$&'()*+,;=:/?#[]@"
613
+ uri_path_component: "!$&'()*+,;=:/@",
614
+ uri_query_component: "!$&'()*+,;=:/?@",
615
+ uri_component: nil,
616
+ uri: "!$&'()*+,;=:/?#[]@"
596
617
  }
597
- .each do |symbol, extra_unescaped|
598
- regexp = Regexp.new("[^0-9A-Za-z#{Regexp.escape("-._~#{extra_unescaped}")}]", Regexp::NOENCODING)
599
- define_method(symbol) do |str|
600
- str.b.gsub(regexp) do |match|
601
- "%#{match.unpack1('H2').upcase}"
602
- end.force_encoding(str.encoding)
618
+ .each do |symbol, unescaped|
619
+ encode_regexp = Regexp.new("[^0-9A-Za-z#{Regexp.escape("-._~#{unescaped}")}]", Regexp::NOENCODING)
620
+
621
+ define_method(:"encode_#{symbol}") do |str|
622
+ str.b.gsub(encode_regexp, encode_uri_hash).force_encoding(str.encoding)
603
623
  end
604
- end
605
624
 
606
- {
607
- decode_uri_component: nil,
608
- decode_uri: "!$&'()*+,;=:/?#[]@"
609
- }
610
- .each do |symbol, preserve_escaped|
611
- regexp = /%[0-9A-Fa-f]{2}/o
612
- if preserve_escaped.nil? || preserve_escaped.empty?
613
- define_method(symbol) do |str|
614
- str.gsub(regexp) do |match|
615
- [match.reverse!].pack('h2')
616
- end.force_encoding(str.encoding)
617
- end
618
- else
619
- define_method(symbol) do |str|
620
- str.gsub(regexp) do |match|
621
- decoded = [match.reverse].pack('h2')
622
- preserve_escaped.include?(decoded) ? match : decoded
623
- end.force_encoding(str.encoding)
624
- end
625
+ next if symbol.match?(/_.+_/o)
626
+
627
+ decode_regexp = /%[0-9A-Fa-f]{2}/o
628
+ decode_uri_hash_with_preserve_escaped = if unescaped.nil? || unescaped.empty?
629
+ decode_uri_hash
630
+ else
631
+ decode_uri_hash.to_h do |key, value|
632
+ [key, unescaped.include?(value) ? key : value]
633
+ end.freeze
634
+ end
635
+
636
+ define_method(:"decode_#{symbol}") do |str|
637
+ str.gsub(decode_regexp, decode_uri_hash_with_preserve_escaped).force_encoding(str.encoding)
625
638
  end
626
639
  end
627
640
 
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.5
4
+ version: 1.77.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-05 00:00:00.000000000 Z
11
+ date: 2024-07-07 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.5
82
+ source_code_uri: https://github.com/sass-contrib/sassc-embedded-shim-ruby/tree/v1.77.7
83
83
  funding_uri: https://github.com/sponsors/ntkme
84
84
  rubygems_mfa_required: 'true'
85
85
  post_install_message: