sassc-embedded 1.59.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: 23342013f10e27ce1e45eb7617216fdbe715e13a9e2154d1f7d91119a8665498
4
- data.tar.gz: c24f3258ac5a728c78bd79e99978ac37cd5e5eec37755d0b56c79c44cf167889
3
+ metadata.gz: 9d7ed4c41b59c9da71323d18edaf73506cf634a2e9039fc050077a46acc0bb04
4
+ data.tar.gz: 63a8b3809af3bb71724361f1bb1123486fd4f30b4e503d0c2ded02c9d05016e1
5
5
  SHA512:
6
- metadata.gz: de7d1ffa2fdadb1ccd39c81b7004ae95a137ae1c34d01e215459198bc031de862092ebb05aa69cc2bf117c40b0120d3c9334048ed334d98633e1169a032cf4e7
7
- data.tar.gz: 50a7bda87697771c638c8d3325c89a71e3f6d9ff96be1763a75f5565560259358468149f827a448f6fb308e1fcbe160dcc1ba9bd9e902d04a3df0d62bb99f52d
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.59.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
@@ -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.59.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: 2023-03-11 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,112 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.59'
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.59'
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.18.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.18.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: rake
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: 10.0.0
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: 10.0.0
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 1.48.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 1.48.0
97
- - !ruby/object:Gem::Dependency
98
- name: rubocop-minitest
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 0.29.0
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 0.29.0
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop-performance
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 1.16.0
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 1.16.0
125
- - !ruby/object:Gem::Dependency
126
- name: rubocop-rake
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: 0.6.0
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: 0.6.0
40
+ version: '1.63'
139
41
  description: An embedded sass shim for SassC.
140
42
  email:
141
43
  - i@ntk.me
@@ -152,8 +54,8 @@ homepage: https://github.com/ntkme/sassc-embedded-shim-ruby
152
54
  licenses:
153
55
  - MIT
154
56
  metadata:
155
- documentation_uri: https://rubydoc.info/gems/sassc-embedded/1.59.0
156
- source_code_uri: https://github.com/ntkme/sassc-embedded-shim-ruby/tree/v1.59.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
157
59
  funding_uri: https://github.com/sponsors/ntkme
158
60
  post_install_message:
159
61
  rdoc_options: []
@@ -170,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
72
  - !ruby/object:Gem::Version
171
73
  version: '0'
172
74
  requirements: []
173
- rubygems_version: 3.4.6
75
+ rubygems_version: 3.4.10
174
76
  signing_key:
175
77
  specification_version: 4
176
78
  summary: Use dart-sass with SassC!