sassc-embedded 1.54.0 → 1.63.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f635b683afc8ea3aad06831d7ed96835faf439aa1c160caafc5d69d836e2636e
4
- data.tar.gz: f017a21e204e8e25bda8d0f0defca07849ca54f4419fb4f6e0313b87e826a8d4
3
+ metadata.gz: 9d7ed4c41b59c9da71323d18edaf73506cf634a2e9039fc050077a46acc0bb04
4
+ data.tar.gz: 63a8b3809af3bb71724361f1bb1123486fd4f30b4e503d0c2ded02c9d05016e1
5
5
  SHA512:
6
- metadata.gz: ed92f07f2009eff05bcd0da3871d3ce371a70154634ffa0ec391014fce9e2e713086c29dea7048323ccf593b20cb14bde4c998079d83d1cd201d48e6beaace41
7
- data.tar.gz: 03f5c6092db465530a1e4c1a20d6c55705690909351d821d3b2273599b014e913b29181d5ff5b7fb139f5c68466d6d27e94b5f270dd2acaf01ca18520956a0b9
6
+ metadata.gz: 1d1b9e29fb88ed4b1fa114ec9ff657b9b62f913da04a7201ceebd13e5d6c66d9228cae4076beb8319f7344372a592f78063ee9311e0c22fd47b02e8d9f61bba2
7
+ data.tar.gz: f28204b7ca9218f562a7fae9984dbece8afaacd36f26ee9726eac40d7e90c4076f231a4e1138e0a0be9e229581920953b60f3e74542131dc74acbac10529fb95
data/README.md CHANGED
@@ -35,6 +35,12 @@ Or install it yourself as:
35
35
  gem install sassc-embedded
36
36
  ```
37
37
 
38
+ ---
39
+
40
+ The fork of `sassc` at https://github.com/sass/sassc-ruby/pull/233 removes the libsass extension and loads the shim when `require 'sassc'` is invoked.
41
+
42
+ Alternatively, the original `sassc` gem can be used, but you must explictly call `require 'sassc-embedded'` to load the shim.
43
+
38
44
  ## Usage
39
45
 
40
46
  This shim utilizes `sass-embedded` to allow you to compile SCSS or SASS syntax to CSS. To compile, use a `SassC::Engine`, e.g.:
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SassC
4
4
  module Embedded
5
- VERSION = '1.54.0'
5
+ VERSION = '1.63.0'
6
6
  end
7
7
  end
@@ -36,13 +36,26 @@ module SassC
36
36
  verbose: @options.fetch(:verbose, false)
37
37
  )
38
38
 
39
- @dependencies = result.loaded_urls
40
- .filter { |url| url.start_with?(Protocol::FILE) && url != file_url }
41
- .map { |url| URL.file_url_to_path(url) }
42
- @source_map = post_process_source_map(result.source_map)
39
+ @loaded_urls = result.loaded_urls
40
+ @source_map = result.source_map
43
41
 
44
- return post_process_css(result.css) unless quiet?
42
+ return if quiet?
43
+
44
+ css = result.css
45
+ css += "\n" unless css.empty?
46
+ unless @source_map.nil? || omit_source_map_url?
47
+ url = URL.parse(output_url || file_url)
48
+ source_mapping_url = if source_map_embed?
49
+ "data:application/json;base64,#{Base64.strict_encode64(@source_map)}"
50
+ else
51
+ URL.parse(source_map_file_url).route_from(url).to_s
52
+ end
53
+ css += "\n/*# sourceMappingURL=#{source_mapping_url} */"
54
+ end
55
+ css
45
56
  rescue ::Sass::CompileError => e
57
+ @loaded_urls = e.loaded_urls
58
+
46
59
  line = e.span&.start&.line
47
60
  line += 1 unless line.nil?
48
61
  url = e.span&.url
@@ -50,6 +63,31 @@ module SassC
50
63
  raise SyntaxError.new(e.full_message, filename: path, line: line)
51
64
  end
52
65
 
66
+ def dependencies
67
+ raise NotRenderedError unless @loaded_urls
68
+
69
+ Dependency.from_filenames(@loaded_urls
70
+ .filter { |url| url.start_with?(Protocol::FILE) && url != file_url }
71
+ .map { |url| URL.file_url_to_path(url) })
72
+ end
73
+
74
+ def source_map
75
+ raise NotRenderedError unless @source_map
76
+
77
+ url = URL.parse(source_map_file_url || file_url)
78
+ data = JSON.parse(@source_map)
79
+ data['file'] = URL.parse(output_url).route_from(url).to_s if output_url
80
+ data['sources'].map! do |source|
81
+ if source.start_with?(Protocol::FILE)
82
+ URL.parse(source).route_from(url).to_s
83
+ else
84
+ source
85
+ end
86
+ end
87
+
88
+ JSON.generate(data)
89
+ end
90
+
53
91
  private
54
92
 
55
93
  def file_url
@@ -57,10 +95,9 @@ module SassC
57
95
  end
58
96
 
59
97
  def output_path
60
- @output_path ||= @options.fetch(
61
- :output_path,
62
- ("#{filename.delete_suffix(File.extname(filename))}.css" if filename)
63
- )
98
+ @output_path ||= @options.fetch(:output_path) do
99
+ "#{filename.delete_suffix(File.extname(filename))}.css" if filename
100
+ end
64
101
  end
65
102
 
66
103
  def output_url
@@ -74,7 +111,7 @@ module SassC
74
111
  def output_style
75
112
  @output_style ||= begin
76
113
  style = @options.fetch(:style, :sass_style_nested).to_s
77
- style = "sass_style_#{style}" unless style.include?('sass_style_')
114
+ style = "sass_style_#{style}" unless style.start_with?('sass_style_')
78
115
  raise InvalidStyleError unless OUTPUT_STYLES.include?(style.to_sym)
79
116
 
80
117
  style = style.delete_prefix('sass_style_').to_sym
@@ -100,37 +137,6 @@ module SassC
100
137
  []
101
138
  end
102
139
  end
103
-
104
- def post_process_source_map(source_map)
105
- return unless source_map
106
-
107
- url = URL.parse(source_map_file_url || file_url)
108
- data = JSON.parse(source_map)
109
- data['file'] = URL.parse(output_url).route_from(url).to_s if output_url
110
- data['sources'].map! do |source|
111
- if source.start_with?(Protocol::FILE)
112
- URL.parse(source).route_from(url).to_s
113
- else
114
- source
115
- end
116
- end
117
-
118
- JSON.generate(data)
119
- end
120
-
121
- def post_process_css(css)
122
- css += "\n" unless css.empty?
123
- unless @source_map.nil? || omit_source_map_url?
124
- url = URL.parse(output_url || file_url)
125
- source_mapping_url = if source_map_embed?
126
- "data:application/json;base64,#{Base64.strict_encode64(@source_map)}"
127
- else
128
- URL.parse(source_map_file_url).route_from(url).to_s
129
- end
130
- css += "\n/*# sourceMappingURL=#{source_mapping_url} */"
131
- end
132
- css
133
- end
134
140
  end
135
141
 
136
142
  class FunctionsHandler
@@ -167,9 +173,9 @@ module SassC
167
173
  private
168
174
 
169
175
  def arguments_from_native_list(native_argument_list)
170
- native_argument_list.map do |native_value|
176
+ native_argument_list.filter_map do |native_value|
171
177
  Script::ValueConversion.from_native(native_value, @options)
172
- end.compact
178
+ end
173
179
  end
174
180
 
175
181
  begin
@@ -181,10 +187,10 @@ module SassC
181
187
  rescue StandardError => e
182
188
  unless e.full_message.include?(e.cause.full_message)
183
189
  ::Sass::ScriptError.class_eval do
184
- def full_message(*args, **kwargs)
185
- full_message = super(*args, **kwargs)
190
+ def full_message(...)
191
+ full_message = super(...)
186
192
  if cause
187
- "#{full_message}\n#{cause.full_message(*args, **kwargs)}"
193
+ "#{full_message}\n#{cause.full_message(...)}"
188
194
  else
189
195
  full_message
190
196
  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.54.0
4
+ version: 1.63.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-04 00:00:00.000000000 Z
11
+ date: 2023-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sassc
@@ -30,98 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.54'
33
+ version: '1.63'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.54'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 5.16.0
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 5.16.0
55
- - !ruby/object:Gem::Dependency
56
- name: minitest-around
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 0.5.0
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.5.0
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 1.32.0
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 1.32.0
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop-minitest
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 0.21.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 0.21.0
97
- - !ruby/object:Gem::Dependency
98
- name: rubocop-performance
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 1.14.0
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 1.14.0
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop-rake
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 0.6.0
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 0.6.0
40
+ version: '1.63'
125
41
  description: An embedded sass shim for SassC.
126
42
  email:
127
43
  - i@ntk.me
@@ -138,8 +54,8 @@ homepage: https://github.com/ntkme/sassc-embedded-shim-ruby
138
54
  licenses:
139
55
  - MIT
140
56
  metadata:
141
- documentation_uri: https://rubydoc.info/gems/sassc-embedded/1.54.0
142
- source_code_uri: https://github.com/ntkme/sassc-embedded-shim-ruby/tree/v1.54.0
57
+ documentation_uri: https://rubydoc.info/gems/sassc-embedded/1.63.0
58
+ source_code_uri: https://github.com/ntkme/sassc-embedded-shim-ruby/tree/v1.63.0
143
59
  funding_uri: https://github.com/sponsors/ntkme
144
60
  post_install_message:
145
61
  rdoc_options: []
@@ -149,14 +65,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
65
  requirements:
150
66
  - - ">="
151
67
  - !ruby/object:Gem::Version
152
- version: 2.6.0
68
+ version: 2.7.0
153
69
  required_rubygems_version: !ruby/object:Gem::Requirement
154
70
  requirements:
155
71
  - - ">="
156
72
  - !ruby/object:Gem::Version
157
73
  version: '0'
158
74
  requirements: []
159
- rubygems_version: 3.3.7
75
+ rubygems_version: 3.4.10
160
76
  signing_key:
161
77
  specification_version: 4
162
78
  summary: Use dart-sass with SassC!