sassc-embedded 1.0.6 → 1.1.0

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: 549a3c63651d41009f28d92d0d2790365bebb84bccf6032f678a291326dd9e01
4
- data.tar.gz: 76f918e39226e2c6beb2ec29cd4416a678bdeb2dee2e3bb19a7a21bcc06c5d75
3
+ metadata.gz: 70c90e46b79aadd3b3ba316365eb9d45a854e75be4634a008f4e7e54cec17dd0
4
+ data.tar.gz: 1991dc737c3739f2c9b497e904b5dda5dd734cdb55fdba6dd3e65fcacc81086e
5
5
  SHA512:
6
- metadata.gz: ef7775f76b00473a8c576d9dea876f3fb8ed4af76ad619f9bfd4b4a75f4250683b29df315e07aec38262d7c7702d2fd1fffbb83e887a1a2f253a36cf4e49c3e3
7
- data.tar.gz: b210c166f0cdc23a984ef5bdf6d40f35d52e2dd7eebdd3fbb742d69c5f27b16f5acca8ea0fd8c0aaab420e826c1d93946f14f880643ae691cab31f818ae24fdd
6
+ metadata.gz: '09c1017da2a0fd5b1bbb35e9b60514b2f687de9a745f5540317582336c34c7b8a43e201cf5f2efe8a1fdb2e18f0123537690902db504576923a5df96b898ff7f'
7
+ data.tar.gz: cb1e8fef114385a5e8cc622e88e1e42ea3763c3a378108067b341865de63f8add6103a7e0b7874ddd6b2981e78dc53ada984df1809056cc65621382ac8865957
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SassC
4
4
  module Embedded
5
- VERSION = '1.0.6'
5
+ VERSION = '1.1.0'
6
6
  end
7
7
  end
@@ -38,14 +38,14 @@ module SassC
38
38
 
39
39
  @dependencies = result.loaded_urls
40
40
  .filter { |url| url.start_with?('file:') && url != file_url }
41
- .map { |url| Util.file_url_to_path(url) }
41
+ .map { |url| URL.file_url_to_path(url) }
42
42
  @source_map = post_process_source_map(result.source_map)
43
43
 
44
44
  return post_process_css(result.css) unless quiet?
45
45
  rescue ::Sass::CompileError => e
46
46
  line = e.span&.start&.line
47
47
  line += 1 unless line.nil?
48
- path = Util.file_url_to_path(e.span&.url)
48
+ path = URL.file_url_to_path(e.span&.url)
49
49
  path = relative_path(Dir.pwd, path) unless path.nil?
50
50
  raise SyntaxError.new(e.message, filename: path, line: line)
51
51
  end
@@ -60,7 +60,7 @@ module SassC
60
60
  end
61
61
 
62
62
  def file_url
63
- @file_url ||= Util.path_to_file_url(filename || 'stdin')
63
+ @file_url ||= URL.path_to_file_url(filename || 'stdin')
64
64
  end
65
65
 
66
66
  def syntax
@@ -98,11 +98,11 @@ module SassC
98
98
 
99
99
  source_map_dir = File.dirname(source_map_file || '')
100
100
 
101
- data['file'] = Util::URI_PARSER.escape(relative_path(source_map_dir, output_path)) if output_path
101
+ data['file'] = URL.escape(relative_path(source_map_dir, output_path)) if output_path
102
102
 
103
103
  data['sources'].map! do |source|
104
104
  if source.start_with?('file:')
105
- relative_path(source_map_dir, Util.file_url_to_path(source))
105
+ relative_path(source_map_dir, URL.file_url_to_path(source))
106
106
  else
107
107
  source
108
108
  end
@@ -117,7 +117,7 @@ module SassC
117
117
  url = if source_map_embed?
118
118
  "data:application/json;base64,#{Base64.strict_encode64(@source_map)}"
119
119
  else
120
- Util::URI_PARSER.escape(relative_path(File.dirname(output_path || ''), source_map_file))
120
+ URL.escape(relative_path(File.dirname(output_path || ''), source_map_file))
121
121
  end
122
122
  css += "\n/*# sourceMappingURL=#{url} */"
123
123
  end
@@ -215,11 +215,11 @@ module SassC
215
215
 
216
216
  def canonicalize(url, **)
217
217
  path = if url.start_with?('file:')
218
- Util.file_url_to_path(url)
218
+ URL.file_url_to_path(url)
219
219
  else
220
- Util::URI_PARSER.unescape(url)
220
+ URL.unescape(url)
221
221
  end
222
- canonical_url = Util.path_to_file_url(File.absolute_path(path))
222
+ canonical_url = URL.path_to_file_url(File.absolute_path(path))
223
223
 
224
224
  if @importer_results.key?(canonical_url)
225
225
  return if @importer_results[canonical_url].nil?
@@ -238,7 +238,7 @@ module SassC
238
238
 
239
239
  dirname = File.dirname(@importer.options.fetch(:filename, 'stdin'))
240
240
  contents = imports.map do |import|
241
- import_url = Util.path_to_file_url(File.absolute_path(import.path, dirname))
241
+ import_url = URL.path_to_file_url(File.absolute_path(import.path, dirname))
242
242
  @importer_results[import_url] = if import.source
243
243
  {
244
244
  contents: import.source,
@@ -251,7 +251,7 @@ module SassC
251
251
  :scss
252
252
  end,
253
253
  source_map_url: if import.source_map_path
254
- Util.path_to_file_url(
254
+ URL.path_to_file_url(
255
255
  File.absolute_path(
256
256
  import.source_map_path, dirname
257
257
  )
@@ -395,15 +395,25 @@ module SassC
395
395
  end
396
396
  end
397
397
 
398
- module Util
398
+ module URL
399
+ PARSER = URI::Parser.new({ RESERVED: ';/?:@&=+$,' })
400
+
401
+ private_constant :PARSER
402
+
399
403
  module_function
400
404
 
401
- URI_PARSER = URI::Parser.new({ RESERVED: ';/?:@&=+$,' })
405
+ def escape(str)
406
+ PARSER.escape(str)
407
+ end
408
+
409
+ def unescape(str)
410
+ PARSER.unescape(str)
411
+ end
402
412
 
403
413
  def file_url_to_path(url)
404
414
  return if url.nil?
405
415
 
406
- path = URI_PARSER.unescape(URI.parse(url).path)
416
+ path = unescape(URI.parse(url).path)
407
417
  path = path[1..] if Gem.win_platform? && path[0].chr == '/' && path[1].chr =~ /[a-z]/i && path[2].chr == ':'
408
418
  path
409
419
  end
@@ -413,7 +423,7 @@ module SassC
413
423
 
414
424
  path = File.absolute_path(path)
415
425
  path = "/#{path}" unless path.start_with? '/'
416
- URI::File.build([nil, URI_PARSER.escape(path)]).to_s
426
+ URI::File.build([nil, escape(path)]).to_s
417
427
  end
418
428
  end
419
429
  end
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.0.6
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
@@ -138,8 +138,8 @@ homepage: https://github.com/ntkme/sassc-embedded-polyfill-ruby
138
138
  licenses:
139
139
  - MIT
140
140
  metadata:
141
- documentation_uri: https://rubydoc.info/gems/sassc-embedded/1.0.6
142
- source_code_uri: https://github.com/ntkme/sassc-embedded-polyfill-ruby/tree/v1.0.6
141
+ documentation_uri: https://rubydoc.info/gems/sassc-embedded/1.1.0
142
+ source_code_uri: https://github.com/ntkme/sassc-embedded-polyfill-ruby/tree/v1.1.0
143
143
  funding_uri: https://github.com/sponsors/ntkme
144
144
  post_install_message:
145
145
  rdoc_options: []