sassc-embedded 1.5.2 → 1.5.5

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: 34c4811b38299f8c49a35d9b8b87d23d610406fd94ce7f8075ac03313db70a23
4
- data.tar.gz: 390d007373427c76c86c3bf4a9c7e8610dc99da6524bfc3546138b6f63b4fc83
3
+ metadata.gz: 695381cf5ae96903ffaf015c6e406eab12c38312008ee5dce88e2f1658d6da35
4
+ data.tar.gz: c5c981214af6123d9c17ff3dc4b6099bc78864419df9c29848ce146ebbfeca2d
5
5
  SHA512:
6
- metadata.gz: cc3c3f6ee78f82364b1ea56e44ae8e0006b9def7cf27492b7eb4a8e40fc47d7df99b2e10c125a285d19627964d7bb6f0f195049772351885df187725ed1fd14b
7
- data.tar.gz: bbf300fce0ae4ea93219a10e321038fa22126f337303b02e2837dc808d2fc06a0ead8c733f2ee2591ee51c198037a9ef4d476772d1c723d58188f04e20b26f15
6
+ metadata.gz: 9a346cd91ea29ae9618460eee15592b1316948637bae1054a343521f9a0194b290c972d37481fd91b068d47bf83d38a033efb2f9e20f3713fcbc7ad339110cbb
7
+ data.tar.gz: 36d53934e2f475d3c62a42a5f7530c32668d42d4ba3a09a84eed6177bb9256d4dc7383adf64d80b6863590bffbfc676c6cec6b792b24523cbce7b516d887ff5d
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SassC
4
4
  module Embedded
5
- VERSION = '1.5.2'
5
+ VERSION = '1.5.5'
6
6
  end
7
7
  end
@@ -204,7 +204,7 @@ module SassC
204
204
  class << self
205
205
  def resolve_path(path, from_import)
206
206
  ext = File.extname(path)
207
- unless ext.empty?
207
+ if ['.sass', '.scss', '.css'].include?(ext)
208
208
  if from_import
209
209
  result = exactly_one(try_path("#{without_ext(path)}.import#{ext}"))
210
210
  return result unless result.nil?
@@ -212,6 +212,15 @@ module SassC
212
212
  return exactly_one(try_path(path))
213
213
  end
214
214
 
215
+ unless ext.empty?
216
+ if from_import
217
+ result = exactly_one(try_path("#{without_ext(path)}.import#{ext}"))
218
+ return result unless result.nil?
219
+ end
220
+ result = exactly_one(try_path(path))
221
+ return result unless result.nil?
222
+ end
223
+
215
224
  if from_import
216
225
  result = exactly_one(try_path_with_ext("#{path}.import"))
217
226
  return result unless result.nil?
@@ -286,6 +295,8 @@ module SassC
286
295
  def initialize(importer)
287
296
  @importer = importer
288
297
  @importer_results = {}
298
+ @load_id = 0
299
+ @load_urls = {}
289
300
  @parent_urls = [URL.path_to_file_url(File.absolute_path(@importer.options[:filename] || 'stdin'))]
290
301
  end
291
302
 
@@ -293,12 +304,14 @@ module SassC
293
304
  return url if url.start_with?(Protocol::IMPORT, Protocol::LOADED)
294
305
 
295
306
  if url.start_with?(Protocol::LOAD)
296
- url = url.delete_prefix(Protocol::LOAD)
307
+ url = @load_urls.delete(url.delete_prefix(Protocol::LOAD))
297
308
  return url if @importer_results.key?(url)
298
309
 
299
310
  path = URL.parse(url).route_from(@parent_urls.last).to_s
300
311
  resolved = resolve_path(path, URL.file_url_to_path(@parent_urls.last), from_import)
301
- return resolved.nil? ? nil : URL.path_to_file_url(resolved)
312
+ return URL.path_to_file_url(resolved) unless resolved.nil?
313
+
314
+ return
302
315
  end
303
316
 
304
317
  return unless url.start_with?(Protocol::FILE)
@@ -371,25 +384,28 @@ module SassC
371
384
  def imports_to_native(imports)
372
385
  {
373
386
  contents: imports.flat_map do |import|
374
- file_url = URL.path_to_file_url(import.path)
387
+ load_id = @load_id
388
+ @load_id = load_id.next
389
+ load_url = URL.path_to_file_url(import.path)
390
+ @load_urls[load_id.to_s] = load_url
375
391
  if import.source
376
- @importer_results[file_url] = if import.source.is_a?(Hash)
392
+ @importer_results[load_url] = if import.source.is_a?(Hash)
377
393
  {
378
394
  contents: import.source[:contents],
379
395
  syntax: import.source[:syntax],
380
- source_map_url: file_url
396
+ source_map_url: load_url
381
397
  }
382
398
  else
383
399
  {
384
400
  contents: import.source,
385
401
  syntax: syntax(import.path),
386
- source_map_url: file_url
402
+ source_map_url: load_url
387
403
  }
388
404
  end
389
405
  end
390
406
  [
391
- "@import #{"#{Protocol::LOAD}#{file_url}".inspect};",
392
- "@import #{"#{Protocol::LOADED}#{file_url}".inspect};"
407
+ "@import \"#{Protocol::LOAD}#{load_id}\";",
408
+ "@import \"#{Protocol::LOADED}#{load_id}\";"
393
409
  ]
394
410
  end.join("\n"),
395
411
  syntax: :scss
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.5.2
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-04 00:00:00.000000000 Z
11
+ date: 2022-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sassc
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.18.0
89
+ version: 0.19.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.18.0
96
+ version: 0.19.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rubocop-performance
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -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.2
142
- source_code_uri: https://github.com/ntkme/sassc-embedded-polyfill-ruby/tree/v1.5.2
141
+ documentation_uri: https://rubydoc.info/gems/sassc-embedded/1.5.5
142
+ source_code_uri: https://github.com/ntkme/sassc-embedded-polyfill-ruby/tree/v1.5.5
143
143
  funding_uri: https://github.com/sponsors/ntkme
144
144
  post_install_message:
145
145
  rdoc_options: []