sassc-embedded 1.77.0 → 1.77.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sassc/embedded/version.rb +1 -1
- data/lib/sassc/embedded.rb +21 -25
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4b63d6cb7265fce189ee1c9dd5a5e6c06a2ae5d0d0ccf2fe88bf9ea15a0b4f2
|
4
|
+
data.tar.gz: 9742024209ffbcd80ec482028500370fb12343af829e814b3e4daf9d15e3a7f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d332ab05fee496aa0bcd14aad0d623a4309ef9244cf30125f191fc5542bc79c7cf2effe8e0ec2069a59384c621467097977b70c030e465c798f5b46860159ecb
|
7
|
+
data.tar.gz: e14c9ffb2dc052809527cc30619fa28224457523780237fd44004f953de09e867fb0ea2b1933a23cece2cb6cb3c8cb8ce2264096848c8cb86acd8876d55cec7a
|
data/lib/sassc/embedded.rb
CHANGED
@@ -46,11 +46,11 @@ module SassC
|
|
46
46
|
css = result.css
|
47
47
|
css += "\n" unless css.empty?
|
48
48
|
unless @source_map.nil? || omit_source_map_url?
|
49
|
-
url =
|
49
|
+
url = Uri.parse(output_url || file_url)
|
50
50
|
source_mapping_url = if source_map_embed?
|
51
51
|
"data:application/json;base64,#{[@source_map].pack('m0')}"
|
52
52
|
else
|
53
|
-
|
53
|
+
Uri.file_urls_to_relative_url(source_map_file_url, url)
|
54
54
|
end
|
55
55
|
css += "\n/*# sourceMappingURL=#{source_mapping_url} */"
|
56
56
|
end
|
@@ -61,7 +61,7 @@ module SassC
|
|
61
61
|
line = e.span&.start&.line
|
62
62
|
line += 1 unless line.nil?
|
63
63
|
url = e.span&.url
|
64
|
-
path = (
|
64
|
+
path = (Uri.file_urls_to_relative_path(url, Uri.path_to_file_url("#{Dir.pwd}/")) if url&.start_with?('file:'))
|
65
65
|
raise SyntaxError.new(e.full_message, filename: path, line:)
|
66
66
|
end
|
67
67
|
|
@@ -69,19 +69,19 @@ module SassC
|
|
69
69
|
raise NotRenderedError unless @loaded_urls
|
70
70
|
|
71
71
|
Dependency.from_filenames(@loaded_urls.filter_map do |url|
|
72
|
-
|
72
|
+
Uri.file_url_to_path(url) if url.start_with?('file:') && !url.include?('?') && url != file_url
|
73
73
|
end)
|
74
74
|
end
|
75
75
|
|
76
76
|
def source_map
|
77
77
|
raise NotRenderedError unless @source_map
|
78
78
|
|
79
|
-
url =
|
79
|
+
url = Uri.parse(source_map_file_url || file_url)
|
80
80
|
data = JSON.parse(@source_map)
|
81
|
-
data['file'] =
|
81
|
+
data['file'] = Uri.file_urls_to_relative_url(output_url, url) if output_url
|
82
82
|
data['sources'].map! do |source|
|
83
83
|
if source.start_with?('file:')
|
84
|
-
|
84
|
+
Uri.file_urls_to_relative_url(source, url)
|
85
85
|
else
|
86
86
|
source
|
87
87
|
end
|
@@ -93,7 +93,7 @@ module SassC
|
|
93
93
|
private
|
94
94
|
|
95
95
|
def file_url
|
96
|
-
@file_url ||=
|
96
|
+
@file_url ||= Uri.path_to_file_url(File.absolute_path(filename || 'stdin'))
|
97
97
|
end
|
98
98
|
|
99
99
|
def output_path
|
@@ -103,7 +103,7 @@ module SassC
|
|
103
103
|
end
|
104
104
|
|
105
105
|
def output_url
|
106
|
-
@output_url ||= (
|
106
|
+
@output_url ||= (Uri.path_to_file_url(File.absolute_path(output_path)) if output_path)
|
107
107
|
end
|
108
108
|
|
109
109
|
def source_map_file_url
|
@@ -112,7 +112,7 @@ module SassC
|
|
112
112
|
# SassC does not encode path as uri for sourceMappingURL, which is technically wrong.
|
113
113
|
# However, this behavior has been abused to append query string to sourceMappingURL.
|
114
114
|
components = source_map_file.split('?', 2)
|
115
|
-
components[0] =
|
115
|
+
components[0] = Uri.path_to_file_url(File.absolute_path(components[0]))
|
116
116
|
components.join('?')
|
117
117
|
end
|
118
118
|
end
|
@@ -317,12 +317,12 @@ module SassC
|
|
317
317
|
|
318
318
|
containing_url = context.containing_url
|
319
319
|
|
320
|
-
path =
|
321
|
-
parent_path =
|
320
|
+
path = Uri.decode_uri_component(url)
|
321
|
+
parent_path = Uri.file_url_to_path(containing_url)
|
322
322
|
parent_dir = File.dirname(parent_path)
|
323
323
|
|
324
324
|
if containing_url.include?('?')
|
325
|
-
canonical_url =
|
325
|
+
canonical_url = Uri.path_to_file_url(File.absolute_path(path, parent_dir))
|
326
326
|
if @importer_results.key?(canonical_url)
|
327
327
|
canonical_url
|
328
328
|
else
|
@@ -359,7 +359,7 @@ module SassC
|
|
359
359
|
|
360
360
|
def resolve_file_url(path, parent_dir, from_import)
|
361
361
|
resolved = FileSystemImporter.resolve_path(File.absolute_path(path, parent_dir), from_import)
|
362
|
-
|
362
|
+
Uri.path_to_file_url(resolved) unless resolved.nil?
|
363
363
|
end
|
364
364
|
|
365
365
|
def syntax(path)
|
@@ -375,7 +375,7 @@ module SassC
|
|
375
375
|
|
376
376
|
def import_to_native(import, parent_dir, from_import, canonicalize)
|
377
377
|
if import.source
|
378
|
-
canonical_url =
|
378
|
+
canonical_url = Uri.path_to_file_url(File.absolute_path(import.path, parent_dir))
|
379
379
|
@importer_results[canonical_url] = if import.source.is_a?(Hash)
|
380
380
|
{
|
381
381
|
contents: import.source[:contents],
|
@@ -394,13 +394,13 @@ module SassC
|
|
394
394
|
return resolve_file_url(import.path, parent_dir, from_import)
|
395
395
|
end
|
396
396
|
|
397
|
-
|
397
|
+
Uri.encode_uri_path_component(import.path)
|
398
398
|
end
|
399
399
|
|
400
400
|
def imports_to_native(imports, parent_dir, from_import, url, containing_url)
|
401
401
|
return import_to_native(imports.first, parent_dir, from_import, true) if imports.one?
|
402
402
|
|
403
|
-
canonical_url = "#{containing_url}?url=#{
|
403
|
+
canonical_url = "#{containing_url}?url=#{Uri.encode_uri_query_component(url)}&from_import=#{from_import}"
|
404
404
|
@importer_results[canonical_url] = {
|
405
405
|
contents: imports.flat_map do |import|
|
406
406
|
at_rule = from_import ? '@import' : '@forward'
|
@@ -564,15 +564,11 @@ module SassC
|
|
564
564
|
end
|
565
565
|
end
|
566
566
|
|
567
|
-
module
|
567
|
+
module Uri
|
568
568
|
module_function
|
569
569
|
|
570
|
-
def
|
571
|
-
::URI.
|
572
|
-
end
|
573
|
-
|
574
|
-
def parse(str)
|
575
|
-
::URI.parse(str)
|
570
|
+
def parse(...)
|
571
|
+
::URI.parse(...)
|
576
572
|
end
|
577
573
|
|
578
574
|
def encode_uri_path_component(str)
|
@@ -623,5 +619,5 @@ module SassC
|
|
623
619
|
end
|
624
620
|
end
|
625
621
|
|
626
|
-
private_constant :
|
622
|
+
private_constant :Uri
|
627
623
|
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.77.
|
4
|
+
version: 1.77.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- なつき
|
@@ -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.
|
82
|
+
source_code_uri: https://github.com/sass-contrib/sassc-embedded-shim-ruby/tree/v1.77.1
|
83
83
|
funding_uri: https://github.com/sponsors/ntkme
|
84
84
|
rubygems_mfa_required: 'true'
|
85
85
|
post_install_message:
|