sassc-embedded 1.5.6 → 1.5.7

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: 464d4f9326ea315b791701d5ff9ca9a06201b9bbdccc920aba591ea5764f9cba
4
- data.tar.gz: c149398af2d50cad3659f680d1f10a053e7290457340e02758fa4235a2f7ba34
3
+ metadata.gz: 0bfb6d5d03f82fe0caed0330d377a072a9943695119839dedd7927b9353ae234
4
+ data.tar.gz: a3ab1f40872818454a6dc4df354c053022efc44fe0f8e9f8138eab21645e212c
5
5
  SHA512:
6
- metadata.gz: 7b9e55b5db011df6ee7befabb77a6e74934ed7addf4bedcc8ebcf831ca38a7cdeff2b2d2f34ce7326f83cd97f52d8f19f79f1229882f8a436dd533243ad207db
7
- data.tar.gz: 506cf7f45c08fc2e7f82e1d6675fb2d9cf9b36a66d098ae5fc43e6ea0c997b2fe4f442caa4cbdb1b442132768c32c35e83e2457da40ff2a8baff29cb9e05a60c
6
+ metadata.gz: e85eb1e5be70cdbca5d2561945c9ff8cc291f8721ebc3d1c53e7e58d7dec47953b131ec70c8d8c2d497f1f9a25c16ee84e3e23e465cf18fa62412fd1b99c4974
7
+ data.tar.gz: af772e37b302bfc34f3db138f79ed86a2628185a6f95699687e0f4d19ff5588c68a01ac50b66e9ddd63a8fa9e518ceaae8d74ff12637056d24c7c1474129ceeb
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SassC
4
4
  module Embedded
5
- VERSION = '1.5.6'
5
+ VERSION = '1.5.7'
6
6
  end
7
7
  end
@@ -293,55 +293,49 @@ module SassC
293
293
  end
294
294
 
295
295
  def canonicalize(url, from_import:)
296
- return url if url.start_with?(Protocol::LOADED)
297
-
298
296
  if url.start_with?(Protocol::IMPORT)
299
- url = @canonical_urls.delete(url.delete_prefix(Protocol::IMPORT))
300
- return url if @importer_results.key?(url)
297
+ canonical_url = @canonical_urls.delete(url.delete_prefix(Protocol::IMPORT))
298
+ return canonical_url if canonical_url.start_with?(Protocol::IMPORT)
301
299
 
300
+ unless @importer_results.key?(canonical_url)
301
+ canonical_url = resolve_file_url(canonical_url, @parent_urls.last, from_import)
302
+ end
303
+ @parent_urls.push(canonical_url)
304
+ canonical_url
305
+ elsif url.start_with?(Protocol::FILE)
302
306
  path = URL.parse(url).route_from(@parent_urls.last).to_s
303
- resolved = resolve_path(path, URL.file_url_to_path(@parent_urls.last), from_import)
304
- return URL.path_to_file_url(resolved) unless resolved.nil?
307
+ parent_path = URL.file_url_to_path(@parent_urls.last)
305
308
 
306
- return
307
- end
308
-
309
- return unless url.start_with?(Protocol::FILE)
310
-
311
- path = URL.parse(url).route_from(@parent_urls.last).to_s
312
- parent_path = URL.file_url_to_path(@parent_urls.last)
309
+ imports = @importer.imports(path, parent_path)
310
+ imports = [SassC::Importer::Import.new(path)] if imports.nil?
311
+ imports = [imports] unless imports.is_a?(Array)
312
+ imports.each do |import|
313
+ import.path = File.absolute_path(import.path, File.dirname(parent_path))
314
+ end
313
315
 
314
- imports = @importer.imports(path, parent_path)
315
- imports = [SassC::Importer::Import.new(path)] if imports.nil?
316
- imports = [imports] unless imports.is_a?(Array)
317
- imports.each do |import|
318
- import.path = File.absolute_path(import.path, File.dirname(parent_path))
316
+ id = next_id
317
+ canonical_url = "#{Protocol::IMPORT}#{id}"
318
+ @canonical_urls[id] = canonical_url
319
+ @importer_results[canonical_url] = imports_to_native(imports)
320
+ canonical_url
321
+ elsif url.start_with?(Protocol::LOADED)
322
+ canonical_url = Protocol::LOADED
323
+ @parent_urls.pop
324
+ canonical_url
319
325
  end
320
-
321
- id = next_id
322
- canonical_url = "#{Protocol::IMPORT}#{id}"
323
- @canonical_urls[id] = canonical_url
324
- @importer_results[canonical_url] = imports_to_native(imports)
325
- canonical_url
326
326
  end
327
327
 
328
328
  def load(canonical_url)
329
- if canonical_url.start_with?(Protocol::IMPORT)
329
+ if @importer_results.key?(canonical_url)
330
330
  @importer_results.delete(canonical_url)
331
331
  elsif canonical_url.start_with?(Protocol::FILE)
332
- @parent_urls.push(canonical_url)
333
- if @importer_results.key?(canonical_url)
334
- @importer_results.delete(canonical_url)
335
- else
336
- path = URL.file_url_to_path(canonical_url)
337
- {
338
- contents: File.read(path),
339
- syntax: syntax(path),
340
- source_map_url: canonical_url
341
- }
342
- end
332
+ path = URL.file_url_to_path(canonical_url)
333
+ {
334
+ contents: File.read(path),
335
+ syntax: syntax(path),
336
+ source_map_url: canonical_url
337
+ }
343
338
  elsif canonical_url.start_with?(Protocol::LOADED)
344
- @parent_urls.pop
345
339
  {
346
340
  contents: '',
347
341
  syntax: :scss
@@ -355,10 +349,12 @@ module SassC
355
349
  @load_paths ||= (@importer.options[:load_paths] || []) + SassC.load_paths
356
350
  end
357
351
 
358
- def resolve_path(path, parent_path, from_import)
352
+ def resolve_file_url(url, parent_url, from_import)
353
+ path = URL.parse(url).route_from(parent_url).to_s
354
+ parent_path = URL.file_url_to_path(parent_url)
359
355
  [File.dirname(parent_path)].concat(load_paths).each do |load_path|
360
356
  resolved = FileImporter.resolve_path(File.absolute_path(path, load_path), from_import)
361
- return resolved unless resolved.nil?
357
+ return URL.path_to_file_url(resolved) unless resolved.nil?
362
358
  end
363
359
  nil
364
360
  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.5.6
4
+ version: 1.5.7
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.5.6
142
- source_code_uri: https://github.com/ntkme/sassc-embedded-polyfill-ruby/tree/v1.5.6
141
+ documentation_uri: https://rubydoc.info/gems/sassc-embedded/1.5.7
142
+ source_code_uri: https://github.com/ntkme/sassc-embedded-polyfill-ruby/tree/v1.5.7
143
143
  funding_uri: https://github.com/sponsors/ntkme
144
144
  post_install_message:
145
145
  rdoc_options: []