sass-embedded 1.4.2 → 1.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94910bd7bdd79a73e57bc9037bf1596bb55b2b2b737eab669bc81f1ec36b66dc
4
- data.tar.gz: 3b5182a86f642f29a9632db0c9ca92ae9365281e5afac5878248aa37594ab70f
3
+ metadata.gz: effcfcc4466c427051f3684ecec0d2f005dbed7570f49e428bda1cee8a84ff75
4
+ data.tar.gz: 3ca625475d64361a4269e87ad4f600eebe32a5ddba00f4d1987ce709590fbdfa
5
5
  SHA512:
6
- metadata.gz: 7f6946abef84bf4be5252dd91f73e5d94130306f3a324566480837ef2f4427d896448f8bc0f4291caf8937c8eb9c1f511d7ec56a0b1c4a3aa0f1442c8b74bc57
7
- data.tar.gz: 3715abf201c428507274f1f0a07bc5e2637b9d7ff507dc25c2011fbbb539a06428662f4603ffdd1ed63746bfdfcf7b4bc28cede37797b4ecf67454315330b2b7
6
+ metadata.gz: 2e0d1c4238f2c2ccc4c6da3f01d451419932fd2a5b6f2e39e6e6fa880ae84a6ef78d5b27e3dcee7cf0207d23464d73122d8e51d47d7b4c990d30ce36c942cd0f
7
+ data.tar.gz: 791d24f2097f84884d3e2f2be87f32e479625ea6db9d03dfe9c0a70e0c0d6bf73fa3e1d929f95e76b0423ece077d78b75db28939bf5a6c426eb1780025831c25
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "dependencies": {
3
- "sass-embedded": "1.50.0"
3
+ "sass-embedded": "1.51.0"
4
4
  }
5
5
  }
@@ -71,7 +71,7 @@ module Sass
71
71
  success: EmbeddedProtocol::InboundMessage::ImportResponse::ImportSuccess.new(
72
72
  contents: importer_result.contents,
73
73
  syntax: Protofier.to_proto_syntax(importer_result.syntax),
74
- source_map_url: importer_result.respond_to?(:source_map_url) ? importer_result.source_map_url&.to_s : nil
74
+ source_map_url: (importer_result.source_map_url&.to_s if importer_result.respond_to?(:source_map_url))
75
75
  )
76
76
  )
77
77
  rescue StandardError => e
@@ -3,7 +3,6 @@
3
3
  require_relative 'host/function_registry'
4
4
  require_relative 'host/importer_registry'
5
5
  require_relative 'host/logger_registry'
6
- require_relative 'host/no_op_importer'
7
6
  require_relative 'host/value_protofier'
8
7
 
9
8
  module Sass
@@ -55,18 +54,10 @@ module Sass
55
54
  source: source,
56
55
  url: url&.to_s,
57
56
  syntax: Protofier.to_proto_syntax(syntax),
58
- importer: if importer
59
- @importer_registry.register(importer)
60
- elsif url&.to_s&.start_with?('file:')
61
- EmbeddedProtocol::InboundMessage::CompileRequest::Importer.new(
62
- path: File.absolute_path('.')
63
- )
64
- else
65
- @importer_registry.register(NoOpImporter)
66
- end
57
+ importer: (@importer_registry.register(importer) unless importer.nil?)
67
58
  )
68
59
  end,
69
- path: path.nil? ? nil : File.absolute_path(path),
60
+ path: (File.absolute_path(path) unless path.nil?),
70
61
  style: Protofier.to_proto_output_style(style),
71
62
  source_map: source_map,
72
63
  source_map_include_sources: source_map_include_sources,
@@ -31,7 +31,7 @@ module Sass
31
31
  end
32
32
 
33
33
  def from_proto_source_span(source_span)
34
- return nil if source_span.nil?
34
+ return if source_span.nil?
35
35
 
36
36
  Logger::SourceSpan.new(from_proto_source_location(source_span.start),
37
37
  from_proto_source_location(source_span.end),
@@ -41,7 +41,7 @@ module Sass
41
41
  end
42
42
 
43
43
  def from_proto_source_location(source_location)
44
- return nil if source_location.nil?
44
+ return if source_location.nil?
45
45
 
46
46
  Logger::SourceLocation.new(source_location.offset,
47
47
  source_location.line,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sass
4
4
  class Embedded
5
- VERSION = '1.4.2'
5
+ VERSION = '1.5.0'
6
6
  end
7
7
  end
@@ -156,7 +156,7 @@ module Sass
156
156
 
157
157
  # @return [Integer]
158
158
  def hash
159
- @hash ||= red.hash ^ green.hash ^ blue.hash ^ alpha.hash
159
+ @hash ||= [red, green, blue, alpha].hash
160
160
  end
161
161
 
162
162
  # @return [Color]
@@ -94,17 +94,7 @@ module Sass
94
94
 
95
95
  # @return [Integer]
96
96
  def hash
97
- @hash ||= if unitless?
98
- FuzzyMath.hash(value)
99
- elsif single_unit?
100
- FuzzyMath.hash(
101
- value * Unit.canonical_multiplier_for_unit(numerator_units.first)
102
- )
103
- else
104
- FuzzyMath.hash(
105
- value * Unit.canonical_multiplier(numerator_units) / Unit.canonical_multiplier(denominator_units)
106
- )
107
- end
97
+ @hash ||= FuzzyMath.hash(canonical_units_value)
108
98
  end
109
99
 
110
100
  # @return [::Boolean]
@@ -265,6 +255,16 @@ module Sass
265
255
  numerator_units.length == 1 && denominator_units.empty?
266
256
  end
267
257
 
258
+ def canonical_units_value
259
+ if unitless?
260
+ value
261
+ elsif single_unit?
262
+ value * Unit.canonical_multiplier_for_unit(numerator_units.first)
263
+ else
264
+ value * Unit.canonical_multiplier(numerator_units) / Unit.canonical_multiplier(denominator_units)
265
+ end
266
+ end
267
+
268
268
  def coerce_or_convert_value(new_numerator_units, new_denominator_units,
269
269
  coerce_unitless:,
270
270
  name: nil,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass-embedded
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-10 00:00:00.000000000 Z
11
+ date: 2022-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.27.0
61
+ version: 1.28.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.27.0
68
+ version: 1.28.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop-performance
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 2.9.0
103
+ version: 2.10.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 2.9.0
110
+ version: 2.10.0
111
111
  description: A Ruby library that will communicate with Embedded Dart Sass using the
112
112
  Embedded Sass protocol.
113
113
  email:
@@ -134,7 +134,6 @@ files:
134
134
  - lib/sass/embedded/host/function_registry.rb
135
135
  - lib/sass/embedded/host/importer_registry.rb
136
136
  - lib/sass/embedded/host/logger_registry.rb
137
- - lib/sass/embedded/host/no_op_importer.rb
138
137
  - lib/sass/embedded/host/value_protofier.rb
139
138
  - lib/sass/embedded/protofier.rb
140
139
  - lib/sass/embedded/structifier.rb
@@ -160,8 +159,8 @@ homepage: https://github.com/ntkme/sass-embedded-host-ruby
160
159
  licenses:
161
160
  - MIT
162
161
  metadata:
163
- documentation_uri: https://rubydoc.info/gems/sass-embedded/1.4.2
164
- source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v1.4.2
162
+ documentation_uri: https://rubydoc.info/gems/sass-embedded/1.5.0
163
+ source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v1.5.0
165
164
  funding_uri: https://github.com/sponsors/ntkme
166
165
  post_install_message:
167
166
  rdoc_options: []
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Sass
4
- class Embedded
5
- class Host
6
- # An importer that never imports any stylesheets.
7
- module NoOpImporter
8
- module_function
9
-
10
- def canonicalize(*); end
11
- def load(*); end
12
- end
13
-
14
- private_constant :NoOpImporter
15
- end
16
- end
17
- end