sassc-embedded 1.5.5 → 1.5.6
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 +4 -4
- data/lib/sassc/embedded/version.rb +1 -1
- data/lib/sassc/embedded.rb +45 -39
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 464d4f9326ea315b791701d5ff9ca9a06201b9bbdccc920aba591ea5764f9cba
|
4
|
+
data.tar.gz: c149398af2d50cad3659f680d1f10a053e7290457340e02758fa4235a2f7ba34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b9e55b5db011df6ee7befabb77a6e74934ed7addf4bedcc8ebcf831ca38a7cdeff2b2d2f34ce7326f83cd97f52d8f19f79f1229882f8a436dd533243ad207db
|
7
|
+
data.tar.gz: 506cf7f45c08fc2e7f82e1d6675fb2d9cf9b36a66d098ae5fc43e6ea0c997b2fe4f442caa4cbdb1b442132768c32c35e83e2457da40ff2a8baff29cb9e05a60c
|
data/lib/sassc/embedded.rb
CHANGED
@@ -36,7 +36,7 @@ module SassC
|
|
36
36
|
)
|
37
37
|
|
38
38
|
@dependencies = result.loaded_urls
|
39
|
-
.filter { |url| url.start_with?(
|
39
|
+
.filter { |url| url.start_with?(Protocol::FILE) && url != file_url }
|
40
40
|
.map { |url| URL.file_url_to_path(url) }
|
41
41
|
@source_map = post_process_source_map(result.source_map)
|
42
42
|
|
@@ -45,10 +45,10 @@ module SassC
|
|
45
45
|
line = e.span&.start&.line
|
46
46
|
line += 1 unless line.nil?
|
47
47
|
url = e.span&.url
|
48
|
-
path = if url&.start_with?(
|
48
|
+
path = if url&.start_with?(Protocol::FILE)
|
49
49
|
URL.parse(url).route_from(URL.path_to_file_url("#{File.absolute_path('')}/"))
|
50
50
|
end
|
51
|
-
raise SyntaxError.new(e.
|
51
|
+
raise SyntaxError.new(e.full_message, filename: path, line: line)
|
52
52
|
end
|
53
53
|
|
54
54
|
private
|
@@ -109,7 +109,7 @@ module SassC
|
|
109
109
|
data = JSON.parse(source_map)
|
110
110
|
data['file'] = URL.parse(output_url).route_from(url).to_s if output_url
|
111
111
|
data['sources'].map! do |source|
|
112
|
-
if source.start_with?(
|
112
|
+
if source.start_with?(Protocol::FILE)
|
113
113
|
URL.parse(source).route_from(url).to_s
|
114
114
|
else
|
115
115
|
source
|
@@ -283,28 +283,20 @@ module SassC
|
|
283
283
|
private_constant :FileImporter
|
284
284
|
|
285
285
|
class Importer
|
286
|
-
module Protocol
|
287
|
-
FILE = 'file:'
|
288
|
-
IMPORT = 'sassc-embedded-import:'
|
289
|
-
LOAD = 'sassc-embedded-load:'
|
290
|
-
LOADED = 'sassc-embedded-loaded:'
|
291
|
-
end
|
292
|
-
|
293
|
-
private_constant :Protocol
|
294
|
-
|
295
286
|
def initialize(importer)
|
296
287
|
@importer = importer
|
288
|
+
|
289
|
+
@canonical_urls = {}
|
290
|
+
@id = 0
|
297
291
|
@importer_results = {}
|
298
|
-
@load_id = 0
|
299
|
-
@load_urls = {}
|
300
292
|
@parent_urls = [URL.path_to_file_url(File.absolute_path(@importer.options[:filename] || 'stdin'))]
|
301
293
|
end
|
302
294
|
|
303
295
|
def canonicalize(url, from_import:)
|
304
|
-
return url if url.start_with?(Protocol::
|
296
|
+
return url if url.start_with?(Protocol::LOADED)
|
305
297
|
|
306
|
-
if url.start_with?(Protocol::
|
307
|
-
url = @
|
298
|
+
if url.start_with?(Protocol::IMPORT)
|
299
|
+
url = @canonical_urls.delete(url.delete_prefix(Protocol::IMPORT))
|
308
300
|
return url if @importer_results.key?(url)
|
309
301
|
|
310
302
|
path = URL.parse(url).route_from(@parent_urls.last).to_s
|
@@ -326,8 +318,9 @@ module SassC
|
|
326
318
|
import.path = File.absolute_path(import.path, File.dirname(parent_path))
|
327
319
|
end
|
328
320
|
|
329
|
-
|
330
|
-
canonical_url = "#{Protocol::IMPORT}#{
|
321
|
+
id = next_id
|
322
|
+
canonical_url = "#{Protocol::IMPORT}#{id}"
|
323
|
+
@canonical_urls[id] = canonical_url
|
331
324
|
@importer_results[canonical_url] = imports_to_native(imports)
|
332
325
|
canonical_url
|
333
326
|
end
|
@@ -384,33 +377,38 @@ module SassC
|
|
384
377
|
def imports_to_native(imports)
|
385
378
|
{
|
386
379
|
contents: imports.flat_map do |import|
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
@load_urls[load_id.to_s] = load_url
|
380
|
+
id = next_id
|
381
|
+
canonical_url = URL.path_to_file_url(import.path)
|
382
|
+
@canonical_urls[id] = canonical_url
|
391
383
|
if import.source
|
392
|
-
@importer_results[
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
384
|
+
@importer_results[canonical_url] = if import.source.is_a?(Hash)
|
385
|
+
{
|
386
|
+
contents: import.source[:contents],
|
387
|
+
syntax: import.source[:syntax],
|
388
|
+
source_map_url: canonical_url
|
389
|
+
}
|
390
|
+
else
|
391
|
+
{
|
392
|
+
contents: import.source,
|
393
|
+
syntax: syntax(import.path),
|
394
|
+
source_map_url: canonical_url
|
395
|
+
}
|
396
|
+
end
|
405
397
|
end
|
406
398
|
[
|
407
|
-
"@import \"#{Protocol::
|
408
|
-
"@import \"#{Protocol::LOADED}#{
|
399
|
+
"@import \"#{Protocol::IMPORT}#{id}\";",
|
400
|
+
"@import \"#{Protocol::LOADED}#{id}\";"
|
409
401
|
]
|
410
402
|
end.join("\n"),
|
411
403
|
syntax: :scss
|
412
404
|
}
|
413
405
|
end
|
406
|
+
|
407
|
+
def next_id
|
408
|
+
id = @id
|
409
|
+
@id = id.next
|
410
|
+
id.to_s
|
411
|
+
end
|
414
412
|
end
|
415
413
|
|
416
414
|
private_constant :Importer
|
@@ -542,6 +540,14 @@ module SassC
|
|
542
540
|
end
|
543
541
|
end
|
544
542
|
|
543
|
+
module Protocol
|
544
|
+
FILE = 'file:'
|
545
|
+
IMPORT = 'sassc-embedded-import:'
|
546
|
+
LOADED = 'sassc-embedded-loaded:'
|
547
|
+
end
|
548
|
+
|
549
|
+
private_constant :Protocol
|
550
|
+
|
545
551
|
module URL
|
546
552
|
PARSER = URI::Parser.new({ RESERVED: ';/?:@&=+$,' })
|
547
553
|
|
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.
|
4
|
+
version: 1.5.6
|
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.
|
142
|
-
source_code_uri: https://github.com/ntkme/sassc-embedded-polyfill-ruby/tree/v1.5.
|
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
|
143
143
|
funding_uri: https://github.com/sponsors/ntkme
|
144
144
|
post_install_message:
|
145
145
|
rdoc_options: []
|