sassc-embedded 1.0.5 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/sassc/embedded/version.rb +1 -1
- data/lib/sassc/embedded.rb +36 -22
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94ea23724cbde018da55c68a8fa49ad4ea401b03e3b0e8ffe18ecddbc358845d
|
4
|
+
data.tar.gz: b6242dfa84029675f4484704227a881a31f0c6be6f8146c944b0a6100b420b9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2d72e3155a69dafeb1967969a1d44aa971f1fda65c00cc221283ed4c6637ebd8e5ec5854622ca01df96bdf2a6e72b901ae664de967e53cf73ffa55e3586cf87
|
7
|
+
data.tar.gz: 8c710e8dd44938506fef282b5266af5cfaafd2c8a06f750b2296538102c0e88cf7dfc7dae4a08f01c230a9e638a6a546413adf306ddc2f21360ee241da8c84f9
|
data/README.md
CHANGED
@@ -51,6 +51,6 @@ See [rubydoc.info/gems/sassc](https://rubydoc.info/gems/sassc) for full API docu
|
|
51
51
|
|
52
52
|
4. Option `:line_comments` is ignored.
|
53
53
|
|
54
|
-
5.
|
54
|
+
5. Argument `parent_path` in `Importer#imports(path, parent_path)` is set to value of option `:filename`.
|
55
55
|
|
56
56
|
See [the dart-sass documentation](https://github.com/sass/dart-sass#behavioral-differences-from-ruby-sass) for other differences.
|
data/lib/sassc/embedded.rb
CHANGED
@@ -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|
|
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 =
|
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 ||=
|
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'] =
|
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
|
-
if source.start_with?
|
105
|
-
relative_path(source_map_dir,
|
104
|
+
if source.start_with?('file:')
|
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
|
-
|
120
|
+
URL.escape(relative_path(File.dirname(output_path || ''), source_map_file))
|
121
121
|
end
|
122
122
|
css += "\n/*# sourceMappingURL=#{url} */"
|
123
123
|
end
|
@@ -163,8 +163,8 @@ module SassC
|
|
163
163
|
private
|
164
164
|
|
165
165
|
def arguments_from_native_list(native_argument_list)
|
166
|
-
native_argument_list.map do |
|
167
|
-
Script::ValueConversion.from_native
|
166
|
+
native_argument_list.map do |native_value|
|
167
|
+
Script::ValueConversion.from_native(native_value, @options)
|
168
168
|
end.compact
|
169
169
|
end
|
170
170
|
|
@@ -175,7 +175,7 @@ module SassC
|
|
175
175
|
raise ::Sass::ScriptError
|
176
176
|
end
|
177
177
|
rescue StandardError => e
|
178
|
-
unless e.full_message.include?
|
178
|
+
unless e.full_message.include?(e.cause.full_message)
|
179
179
|
::Sass::ScriptError.class_eval do
|
180
180
|
def full_message(*args, **kwargs)
|
181
181
|
full_message = super(*args, **kwargs)
|
@@ -200,7 +200,7 @@ module SassC
|
|
200
200
|
end
|
201
201
|
|
202
202
|
class FileImporter
|
203
|
-
def find_file_url(url, **
|
203
|
+
def find_file_url(url, **)
|
204
204
|
return url if url.start_with?('file:')
|
205
205
|
end
|
206
206
|
end
|
@@ -214,8 +214,12 @@ module SassC
|
|
214
214
|
end
|
215
215
|
|
216
216
|
def canonicalize(url, **)
|
217
|
-
path =
|
218
|
-
|
217
|
+
path = if url.start_with?('file:')
|
218
|
+
URL.file_url_to_path(url)
|
219
|
+
else
|
220
|
+
URL.unescape(url)
|
221
|
+
end
|
222
|
+
canonical_url = URL.path_to_file_url(File.absolute_path(path))
|
219
223
|
|
220
224
|
if @importer_results.key?(canonical_url)
|
221
225
|
return if @importer_results[canonical_url].nil?
|
@@ -225,8 +229,8 @@ module SassC
|
|
225
229
|
|
226
230
|
canonical_url = "sassc-embedded:#{canonical_url}"
|
227
231
|
|
228
|
-
imports = @importer.imports
|
229
|
-
unless imports.is_a?
|
232
|
+
imports = @importer.imports(path, @importer.options[:filename])
|
233
|
+
unless imports.is_a?(Array)
|
230
234
|
return if imports.path == path
|
231
235
|
|
232
236
|
imports = [imports]
|
@@ -234,7 +238,7 @@ module SassC
|
|
234
238
|
|
235
239
|
dirname = File.dirname(@importer.options.fetch(:filename, 'stdin'))
|
236
240
|
contents = imports.map do |import|
|
237
|
-
import_url =
|
241
|
+
import_url = URL.path_to_file_url(File.absolute_path(import.path, dirname))
|
238
242
|
@importer_results[import_url] = if import.source
|
239
243
|
{
|
240
244
|
contents: import.source,
|
@@ -247,7 +251,7 @@ module SassC
|
|
247
251
|
:scss
|
248
252
|
end,
|
249
253
|
source_map_url: if import.source_map_path
|
250
|
-
|
254
|
+
URL.path_to_file_url(
|
251
255
|
File.absolute_path(
|
252
256
|
import.source_map_path, dirname
|
253
257
|
)
|
@@ -391,15 +395,25 @@ module SassC
|
|
391
395
|
end
|
392
396
|
end
|
393
397
|
|
394
|
-
module
|
398
|
+
module URL
|
399
|
+
PARSER = URI::Parser.new({ RESERVED: ';/?:@&=+$,' })
|
400
|
+
|
401
|
+
private_constant :PARSER
|
402
|
+
|
395
403
|
module_function
|
396
404
|
|
397
|
-
|
405
|
+
def escape(str)
|
406
|
+
PARSER.escape(str)
|
407
|
+
end
|
408
|
+
|
409
|
+
def unescape(str)
|
410
|
+
PARSER.unescape(str)
|
411
|
+
end
|
398
412
|
|
399
413
|
def file_url_to_path(url)
|
400
414
|
return if url.nil?
|
401
415
|
|
402
|
-
path =
|
416
|
+
path = unescape(URI.parse(url).path)
|
403
417
|
path = path[1..] if Gem.win_platform? && path[0].chr == '/' && path[1].chr =~ /[a-z]/i && path[2].chr == ':'
|
404
418
|
path
|
405
419
|
end
|
@@ -408,8 +422,8 @@ module SassC
|
|
408
422
|
return if path.nil?
|
409
423
|
|
410
424
|
path = File.absolute_path(path)
|
411
|
-
path = "/#{path}" unless path.start_with?
|
412
|
-
URI::File.build([nil,
|
425
|
+
path = "/#{path}" unless path.start_with?('/')
|
426
|
+
URI::File.build([nil, escape(path)]).to_s
|
413
427
|
end
|
414
428
|
end
|
415
429
|
end
|
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.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- なつき
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sassc
|
@@ -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.
|
142
|
-
source_code_uri: https://github.com/ntkme/sassc-embedded-polyfill-ruby/tree/v1.
|
141
|
+
documentation_uri: https://rubydoc.info/gems/sassc-embedded/1.1.1
|
142
|
+
source_code_uri: https://github.com/ntkme/sassc-embedded-polyfill-ruby/tree/v1.1.1
|
143
143
|
funding_uri: https://github.com/sponsors/ntkme
|
144
144
|
post_install_message:
|
145
145
|
rdoc_options: []
|