sass-embedded 1.85.1-aarch64-linux-musl → 1.86.0-aarch64-linux-musl

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: b7c140295eecf96bb150240d86fb79418b7ac30e25d009c376edd7ab68f28e82
4
- data.tar.gz: bcb887a1a13c9a6817c96777f8315fa8acea80062378916126c74b7271824cf9
3
+ metadata.gz: b2f03b4b6f4ab490c5917d944dd5224803ee67a48644fc8e599004898a2ae196
4
+ data.tar.gz: 4142704da2aedfadab403385112bda2db3f3e87f58eab7f45865cbc77e5ca49e
5
5
  SHA512:
6
- metadata.gz: bc3fb666e06f1c51a55f452d3f2642a01e69d727de2e54ca2569c49731fa1510b42441a753dccc1e15d6beff1e695735e03d68b509507a7283a56d5d28fad7cb
7
- data.tar.gz: ad73509efbff510822d024262cf0b4707df665adedaf50a8353a0176c849ccfb70e531b7aac9f090b69c8b96d2904859080d759a269665ae25738a764bc2d494
6
+ metadata.gz: 444b015ac60db1c1c7170944684ce1a2a6fb1baacab389b119cafa04a6d369b99956134183ac604566198bae8054e4f513507db0bd5e5b63d8ed5c3e9f15afb1
7
+ data.tar.gz: c0272ed7c067ff15b23cfc3a8e6748eae2ac8b78b94d3034be1de76a22a50731dd4980cf8ff09bffdaaabdbab2e72a0d552595d862c8d00b08a4f32d50589c26
@@ -87,39 +87,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
87
87
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
88
88
 
89
89
 
90
- --------------------------------------------------------------------------------
91
-
92
- _macros and macros license:
93
-
94
- Copyright 2024, the Dart project authors.
95
-
96
- Redistribution and use in source and binary forms, with or without
97
- modification, are permitted provided that the following conditions are
98
- met:
99
-
100
- * Redistributions of source code must retain the above copyright
101
- notice, this list of conditions and the following disclaimer.
102
- * Redistributions in binary form must reproduce the above
103
- copyright notice, this list of conditions and the following
104
- disclaimer in the documentation and/or other materials provided
105
- with the distribution.
106
- * Neither the name of Google LLC nor the names of its
107
- contributors may be used to endorse or promote products derived
108
- from this software without specific prior written permission.
109
-
110
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
111
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
112
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
113
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
114
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
115
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
116
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
117
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
118
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
119
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
120
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
121
-
122
-
123
90
  --------------------------------------------------------------------------------
124
91
 
125
92
  analyzer, protobuf and protoc_plugin license:
Binary file
Binary file
@@ -6,9 +6,11 @@ module Sass
6
6
  #
7
7
  # It manages the lifecycle of {Dispatcher}.
8
8
  class Channel
9
- def initialize(dispatcher_class)
10
- @dispatcher_class = dispatcher_class
11
- @dispatcher = @dispatcher_class.new
9
+ def initialize(*args, **kwargs, &block)
10
+ @args = args
11
+ @kwargs = kwargs
12
+ @block = block
13
+ @dispatcher = Dispatcher.new(*@args, **@kwargs, &@block)
12
14
  @mutex = Mutex.new
13
15
  end
14
16
 
@@ -33,7 +35,7 @@ module Sass
33
35
 
34
36
  Stream.new(@dispatcher, host)
35
37
  rescue Errno::EBUSY
36
- @dispatcher = @dispatcher_class.new
38
+ @dispatcher = Dispatcher.new(*@args, **@kwargs, &@block)
37
39
  Stream.new(@dispatcher, host)
38
40
  end
39
41
  end
@@ -6,13 +6,33 @@ module Sass
6
6
  #
7
7
  # It dispatches messages between multiple instances of {Host} and a single {Connection} to the compiler.
8
8
  class Dispatcher
9
- def initialize
9
+ def initialize(idle_timeout: 0)
10
10
  @id = 1
11
11
  @observers = {}.compare_by_identity
12
12
  @mutex = Mutex.new
13
13
  @connection = Connection.new
14
14
  @connection.listen(self)
15
15
  ForkTracker.add(self)
16
+
17
+ return unless idle_timeout.positive?
18
+
19
+ @last_accessed_time = current_time
20
+ Thread.new do
21
+ Thread.current.name = "sass-embedded-connection-reaper-#{@connection.id}"
22
+ duration = idle_timeout
23
+ loop do
24
+ sleep(duration.negative? ? idle_timeout : duration)
25
+ break if @mutex.synchronize do
26
+ raise Errno::EBUSY if _closed?
27
+
28
+ duration = idle_timeout - (current_time - @last_accessed_time)
29
+ duration.negative? && _idle? && _close
30
+ end
31
+ end
32
+ close
33
+ rescue Errno::EBUSY
34
+ # do nothing
35
+ end
16
36
  end
17
37
 
18
38
  def subscribe(observer)
@@ -94,6 +114,10 @@ module Sass
94
114
 
95
115
  private
96
116
 
117
+ def current_time
118
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
119
+ end
120
+
97
121
  def _close
98
122
  @id = 0xffffffff
99
123
  end
@@ -103,6 +127,8 @@ module Sass
103
127
  end
104
128
 
105
129
  def _idle
130
+ @last_accessed_time = current_time if defined?(@last_accessed_time)
131
+
106
132
  @id = 1
107
133
  end
108
134
 
@@ -7,13 +7,13 @@ module Sass
7
7
  #
8
8
  # It stores sass custom functions and handles function calls.
9
9
  class FunctionRegistry
10
- attr_reader :global_functions
10
+ attr_reader :compile_context, :global_functions
11
11
 
12
12
  def initialize(functions, alert_color:)
13
- functions = functions.transform_keys(&:to_s)
14
-
15
- @global_functions = functions.keys
13
+ @compile_context = Object.new
14
+ @global_functions = functions.keys.map!(&:to_s)
16
15
  @functions_by_name = functions.transform_keys do |signature|
16
+ signature = signature.to_s
17
17
  index = signature.index('(')
18
18
  if index
19
19
  signature.slice(0, index)
@@ -57,8 +57,8 @@ module Sass
57
57
 
58
58
  success = protofier.to_proto(function.call(arguments))
59
59
  accessed_argument_lists = arguments.filter_map do |argument|
60
- if argument.is_a?(Sass::Value::ArgumentList) && argument.instance_eval { @keywords_accessed }
61
- argument.instance_eval { @id }
60
+ if argument.is_a?(Sass::Value::ArgumentList) && argument.instance_variable_get(:@keywords_accessed)
61
+ argument.instance_variable_get(:@id)
62
62
  end
63
63
  end
64
64
 
@@ -25,15 +25,21 @@ module Sass
25
25
  @highlight = alert_color
26
26
  end
27
27
 
28
+ IMPORTER_ATTRS = %i[non_canonical_scheme].freeze
29
+
30
+ IMPORTER_METHODS = %i[canonicalize load find_file_url].freeze
31
+
32
+ private_constant :IMPORTER_ATTRS, :IMPORTER_METHODS
33
+
28
34
  def register(importer)
29
35
  if importer.is_a?(Sass::NodePackageImporter)
30
36
  EmbeddedProtocol::InboundMessage::CompileRequest::Importer.new(
31
37
  node_package_importer: EmbeddedProtocol::NodePackageImporter.new(
32
- entry_point_directory: importer.instance_eval { @entry_point_directory }
38
+ entry_point_directory: importer.instance_variable_get(:@entry_point_directory)
33
39
  )
34
40
  )
35
41
  else
36
- importer = Structifier.to_struct(importer, :canonicalize, :load, :non_canonical_scheme, :find_file_url)
42
+ importer = Struct.new(importer, attrs: IMPORTER_ATTRS, methods: IMPORTER_METHODS) if importer.is_a?(::Hash)
37
43
 
38
44
  is_importer = importer.respond_to?(:canonicalize) && importer.respond_to?(:load)
39
45
  is_file_importer = importer.respond_to?(:find_file_url)
@@ -48,12 +54,7 @@ module Sass
48
54
  EmbeddedProtocol::InboundMessage::CompileRequest::Importer.new(
49
55
  importer_id: id,
50
56
  non_canonical_scheme: if importer.respond_to?(:non_canonical_scheme)
51
- non_canonical_scheme = importer.non_canonical_scheme
52
- if non_canonical_scheme.is_a?(String)
53
- [non_canonical_scheme]
54
- else
55
- non_canonical_scheme || []
56
- end
57
+ Array(importer.non_canonical_scheme)
57
58
  else
58
59
  []
59
60
  end
@@ -75,7 +76,7 @@ module Sass
75
76
  EmbeddedProtocol::InboundMessage::CanonicalizeResponse.new(
76
77
  id: canonicalize_request.id,
77
78
  url:,
78
- containing_url_unused: canonicalize_context.instance_eval { @containing_url_unused }
79
+ containing_url_unused: canonicalize_context.instance_variable_get(:@containing_url_unused)
79
80
  )
80
81
  rescue StandardError => e
81
82
  EmbeddedProtocol::InboundMessage::CanonicalizeResponse.new(
@@ -84,9 +85,14 @@ module Sass
84
85
  )
85
86
  end
86
87
 
88
+ IMPORTER_RESULT_ATTRS = %i[contents syntax source_map_url].freeze
89
+
90
+ private_constant :IMPORTER_RESULT_ATTRS
91
+
87
92
  def import(import_request)
88
93
  importer = @importers_by_id[import_request.importer_id]
89
- importer_result = Structifier.to_struct importer.load(import_request.url), :contents, :syntax, :source_map_url
94
+ importer_result = importer.load(import_request.url)
95
+ importer_result = Struct.new(importer_result, attrs: IMPORTER_RESULT_ATTRS) if importer_result.is_a?(::Hash)
90
96
 
91
97
  EmbeddedProtocol::InboundMessage::ImportResponse.new(
92
98
  id: import_request.id,
@@ -112,7 +118,7 @@ module Sass
112
118
  EmbeddedProtocol::InboundMessage::FileImportResponse.new(
113
119
  id: file_import_request.id,
114
120
  file_url:,
115
- containing_url_unused: canonicalize_context.instance_eval { @containing_url_unused }
121
+ containing_url_unused: canonicalize_context.instance_variable_get(:@containing_url_unused)
116
122
  )
117
123
  rescue StandardError => e
118
124
  EmbeddedProtocol::InboundMessage::FileImportResponse.new(
@@ -7,39 +7,36 @@ module Sass
7
7
  #
8
8
  # It stores logger and handles log events.
9
9
  class LoggerRegistry
10
- def initialize(logger)
11
- logger = Structifier.to_struct(logger, :debug, :warn)
10
+ LOGGER_METHODS = %i[debug warn].freeze
12
11
 
13
- { debug: DebugContext, warn: WarnContext }.each do |symbol, context_class|
14
- next unless logger.respond_to?(symbol)
12
+ private_constant :LOGGER_METHODS
15
13
 
16
- define_singleton_method(symbol) do |event|
17
- logger.public_send(symbol, event.message, context_class.new(event))
18
- end
19
- end
14
+ def initialize(logger)
15
+ logger = Struct.new(logger, methods: LOGGER_METHODS) if logger.is_a?(::Hash)
16
+ @logger = logger
17
+ @logger_respond_to_debug = logger.respond_to?(:debug)
18
+ @logger_respond_to_warn = logger.respond_to?(:warn)
20
19
  end
21
20
 
22
21
  def log(event)
23
22
  case event.type
24
23
  when :DEBUG
25
- debug(event)
24
+ if @logger_respond_to_debug
25
+ @logger.debug(event.message, DebugContext.new(event))
26
+ else
27
+ Kernel.warn(event.formatted)
28
+ end
26
29
  when :DEPRECATION_WARNING, :WARNING
27
- warn(event)
30
+ if @logger_respond_to_warn
31
+ @logger.warn(event.message, WarnContext.new(event))
32
+ else
33
+ Kernel.warn(event.formatted)
34
+ end
28
35
  else
29
36
  raise ArgumentError, "Unknown LogEvent.type #{event.type}"
30
37
  end
31
38
  end
32
39
 
33
- private
34
-
35
- def debug(event)
36
- Kernel.warn(event.formatted)
37
- end
38
-
39
- def warn(event)
40
- Kernel.warn(event.formatted)
41
- end
42
-
43
40
  # Contextual information passed to `debug`.
44
41
  class DebugContext
45
42
  # @return [Logger::SourceSpan, nil]
@@ -35,14 +35,21 @@ module Sass
35
35
  )
36
36
  )
37
37
  when Sass::Value::ArgumentList
38
- EmbeddedProtocol::Value.new(
39
- argument_list: EmbeddedProtocol::Value::ArgumentList.new(
40
- id: obj.instance_eval { @id },
41
- contents: obj.to_a.map { |element| to_proto(element) },
42
- keywords: obj.keywords.each_with_object({}) { |(key, value), hash| hash[key.to_s] = to_proto(value) },
43
- separator: ListSeparator.to_proto(obj.separator)
38
+ if obj.instance_variable_get(:@compile_context) == @function_registry.compile_context
39
+ EmbeddedProtocol::Value.new(
40
+ argument_list: EmbeddedProtocol::Value::ArgumentList.new(
41
+ id: obj.instance_variable_get(:@id)
42
+ )
44
43
  )
45
- )
44
+ else
45
+ EmbeddedProtocol::Value.new(
46
+ argument_list: EmbeddedProtocol::Value::ArgumentList.new(
47
+ contents: obj.to_a.map { |element| to_proto(element) },
48
+ keywords: obj.keywords.each_with_object({}) { |(key, value), hash| hash[key.to_s] = to_proto(value) },
49
+ separator: ListSeparator.to_proto(obj.separator)
50
+ )
51
+ )
52
+ end
46
53
  when Sass::Value::List
47
54
  EmbeddedProtocol::Value.new(
48
55
  list: EmbeddedProtocol::Value::List.new(
@@ -63,10 +70,10 @@ module Sass
63
70
  )
64
71
  )
65
72
  when Sass::Value::Function
66
- if obj.instance_eval { @id }
73
+ if obj.instance_variable_defined?(:@id)
67
74
  EmbeddedProtocol::Value.new(
68
75
  compiler_function: EmbeddedProtocol::Value::CompilerFunction.new(
69
- id: obj.instance_eval { @id }
76
+ id: assert_compiler_value(obj).instance_variable_get(:@id)
70
77
  )
71
78
  )
72
79
  else
@@ -80,7 +87,7 @@ module Sass
80
87
  when Sass::Value::Mixin
81
88
  EmbeddedProtocol::Value.new(
82
89
  compiler_mixin: EmbeddedProtocol::Value::CompilerMixin.new(
83
- id: obj.instance_eval { @id }
90
+ id: assert_compiler_value(obj).instance_variable_get(:@id)
84
91
  )
85
92
  )
86
93
  when Sass::Value::Calculation
@@ -112,7 +119,6 @@ module Sass
112
119
  when :number
113
120
  Number.from_proto(obj)
114
121
  when :color
115
- obj.to_s if RUBY_ENGINE == 'jruby' # TODO: https://github.com/protocolbuffers/protobuf/issues/18807
116
122
  Sass::Value::Color.send(
117
123
  :for_space,
118
124
  obj.space,
@@ -122,18 +128,18 @@ module Sass
122
128
  obj.has_alpha? ? obj.alpha : nil
123
129
  )
124
130
  when :argument_list
125
- Sass::Value::ArgumentList.new(
126
- obj.contents.map do |element|
127
- from_proto(element)
128
- end,
129
- obj.keywords.to_enum.with_object({}) do |(key, value), hash|
130
- hash[key.to_sym] = from_proto(value)
131
- end,
132
- ListSeparator.from_proto(obj.separator)
133
- ).instance_eval do
134
- @id = obj.id
135
- self
136
- end
131
+ compiler_value(
132
+ Sass::Value::ArgumentList.new(
133
+ obj.contents.map do |element|
134
+ from_proto(element)
135
+ end,
136
+ obj.keywords.to_enum.with_object({}) do |(key, value), hash|
137
+ hash[key.to_sym] = from_proto(value)
138
+ end,
139
+ ListSeparator.from_proto(obj.separator)
140
+ ),
141
+ obj.id
142
+ )
137
143
  when :list
138
144
  Sass::Value::List.new(
139
145
  obj.contents.map do |element|
@@ -149,17 +155,11 @@ module Sass
149
155
  end
150
156
  )
151
157
  when :compiler_function
152
- Sass::Value::Function.new(nil).instance_eval do
153
- @id = obj.id
154
- self
155
- end
158
+ compiler_value(Sass::Value::Function.allocate, obj.id)
156
159
  when :host_function
157
160
  raise Sass::ScriptError, 'The compiler may not send Value.host_function to host'
158
161
  when :compiler_mixin
159
- Sass::Value::Mixin.send(:new).instance_eval do
160
- @id = obj.id
161
- self
162
- end
162
+ compiler_value(Sass::Value::Mixin.allocate, obj.id)
163
163
  when :calculation
164
164
  Calculation.from_proto(obj)
165
165
  when :singleton
@@ -178,6 +178,22 @@ module Sass
178
178
  end
179
179
  end
180
180
 
181
+ private
182
+
183
+ def assert_compiler_value(value)
184
+ unless value.instance_variable_get(:@compile_context) == @function_registry.compile_context
185
+ raise Sass::ScriptError, "Value #{value} does not belong to this compilation"
186
+ end
187
+
188
+ value
189
+ end
190
+
191
+ def compiler_value(value, id)
192
+ value.instance_variable_set(:@compile_context, @function_registry.compile_context)
193
+ value.instance_variable_set(:@id, id)
194
+ value
195
+ end
196
+
181
197
  # The {Number} Protofier.
182
198
  module Number
183
199
  module_function
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sass
4
+ class Compiler
5
+ class Host
6
+ # The {Struct} class.
7
+ #
8
+ # It creates {::Struct}-like objects from {::Hash}.
9
+ class Struct
10
+ def initialize(hash, attrs: nil, methods: nil)
11
+ @hash = hash
12
+ @attrs = attrs
13
+ @methods = methods
14
+ end
15
+
16
+ def method_missing(symbol, ...)
17
+ return super unless @hash.key?(symbol)
18
+
19
+ if @attrs&.include?(symbol)
20
+ @hash.send(:[], symbol, ...)
21
+ elsif @methods&.include?(symbol)
22
+ @hash[symbol].call(...)
23
+ else
24
+ super
25
+ end
26
+ end
27
+
28
+ def respond_to_missing?(symbol, _include_all)
29
+ @hash.key?(symbol) && (@attrs&.include?(symbol) || @methods&.include?(symbol))
30
+ end
31
+ end
32
+
33
+ private_constant :Struct
34
+ end
35
+ end
36
+ end
@@ -4,7 +4,7 @@ require_relative 'host/function_registry'
4
4
  require_relative 'host/importer_registry'
5
5
  require_relative 'host/logger_registry'
6
6
  require_relative 'host/protofier'
7
- require_relative 'host/structifier'
7
+ require_relative 'host/struct'
8
8
 
9
9
  module Sass
10
10
  class Compiler
data/lib/sass/compiler.rb CHANGED
@@ -30,7 +30,7 @@ module Sass
30
30
  # @see https://sass-lang.com/documentation/js-api/classes/compiler/
31
31
  class Compiler
32
32
  def initialize
33
- @channel = Channel.new(Dispatcher)
33
+ @channel = Channel.new
34
34
  end
35
35
 
36
36
  # Compiles the Sass file at +path+ to CSS.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sass
4
4
  module Embedded
5
- VERSION = '1.85.1'
5
+ VERSION = '1.86.0'
6
6
  end
7
7
  end
data/lib/sass/embedded.rb CHANGED
@@ -53,47 +53,8 @@ module Sass
53
53
  @mutex.synchronize do
54
54
  return @compiler if @compiler
55
55
 
56
- compiler = Class.new(Compiler) do
57
- def initialize
58
- @channel = Compiler.const_get(:Channel).new(Class.new(Compiler.const_get(:Dispatcher)) do
59
- def initialize
60
- super
61
-
62
- idle_timeout = 10
63
- @last_accessed_time = current_time
64
-
65
- Thread.new do
66
- Thread.current.name = "sass-embedded-connection-reaper-#{@connection.id}"
67
- duration = idle_timeout
68
- loop do
69
- sleep(duration.negative? ? idle_timeout : duration)
70
- break if @mutex.synchronize do
71
- raise Errno::EBUSY if _closed?
72
-
73
- duration = idle_timeout - (current_time - @last_accessed_time)
74
- duration.negative? && _idle? && _close
75
- end
76
- end
77
- close
78
- rescue Errno::EBUSY
79
- # do nothing
80
- end
81
- end
82
-
83
- private
84
-
85
- def _idle
86
- super
87
-
88
- @last_accessed_time = current_time
89
- end
90
-
91
- def current_time
92
- Process.clock_gettime(Process::CLOCK_MONOTONIC)
93
- end
94
- end)
95
- end
96
- end.new
56
+ compiler = Compiler.allocate
57
+ compiler.instance_variable_set(:@channel, Compiler.const_get(:Channel).new(idle_timeout: 10))
97
58
 
98
59
  at_exit do
99
60
  compiler.close
@@ -15,7 +15,6 @@ module Sass
15
15
  def initialize(contents = [], keywords = {}, separator = ',')
16
16
  super(contents, separator:)
17
17
 
18
- @id = 0
19
18
  @keywords_accessed = false
20
19
  @keywords = keywords.freeze
21
20
  end
@@ -25,13 +24,6 @@ module Sass
25
24
  @keywords_accessed = true
26
25
  @keywords
27
26
  end
28
-
29
- private
30
-
31
- def initialize_dup(orig)
32
- @id = 0
33
- super
34
- end
35
27
  end
36
28
  end
37
29
  end
@@ -11,12 +11,13 @@ module Sass
11
11
  # @param signature [::String]
12
12
  # @param callback [Proc]
13
13
  def initialize(signature, &callback)
14
- raise Sass::ScriptError, 'no block given' unless signature.nil? || callback
15
-
16
14
  @signature = signature.freeze
17
15
  @callback = callback.freeze
18
16
  end
19
17
 
18
+ # @return [Object, nil]
19
+ protected attr_reader :compile_context
20
+
20
21
  # @return [Integer, nil]
21
22
  protected attr_reader :id
22
23
 
@@ -28,16 +29,18 @@ module Sass
28
29
 
29
30
  # @return [::Boolean]
30
31
  def ==(other)
31
- if id.nil?
32
- other.equal?(self)
32
+ return false unless other.is_a?(Sass::Value::Function)
33
+
34
+ if defined?(@id)
35
+ other.compile_context == compile_context && other.id == id
33
36
  else
34
- other.is_a?(Sass::Value::Function) && other.id == id
37
+ other.signature == signature && other.callback == callback
35
38
  end
36
39
  end
37
40
 
38
41
  # @return [Integer]
39
42
  def hash
40
- @hash ||= id.nil? ? signature.hash : id.hash
43
+ @hash ||= defined?(@id) ? [compile_context, id].hash : [signature, callback].hash
41
44
  end
42
45
 
43
46
  # @return [Function]
@@ -12,17 +12,20 @@ module Sass
12
12
  private :new
13
13
  end
14
14
 
15
+ # @return [Object]
16
+ protected attr_reader :compile_context
17
+
15
18
  # @return [Integer]
16
19
  protected attr_reader :id
17
20
 
18
21
  # @return [::Boolean]
19
22
  def ==(other)
20
- other.is_a?(Sass::Value::Mixin) && other.id == id
23
+ other.is_a?(Sass::Value::Mixin) && other.compile_context == compile_context && other.id == id
21
24
  end
22
25
 
23
26
  # @return [Integer]
24
27
  def hash
25
- @hash ||= id.hash
28
+ @hash ||= [compile_context, id].hash
26
29
  end
27
30
 
28
31
  # @return [Mixin]
@@ -25,12 +25,12 @@ module Sass
25
25
  denominator_units = []
26
26
  when ::Hash
27
27
  numerator_units = unit.fetch(:numerator_units, [])
28
- unless numerator_units.is_a?(Array)
28
+ unless numerator_units.is_a?(::Array)
29
29
  raise Sass::ScriptError, "invalid numerator_units #{numerator_units.inspect}"
30
30
  end
31
31
 
32
32
  denominator_units = unit.fetch(:denominator_units, [])
33
- unless denominator_units.is_a?(Array)
33
+ unless denominator_units.is_a?(::Array)
34
34
  raise Sass::ScriptError, "invalid denominator_units #{denominator_units.inspect}"
35
35
  end
36
36
  else
@@ -276,8 +276,8 @@ module Sass
276
276
  other: nil,
277
277
  other_name: nil)
278
278
  if other && (other.numerator_units != new_denominator_units && other.denominator_units != new_denominator_units)
279
- raise Sass::ScriptError, "Expect #{other} to have units #{unit_string(new_numerator_units,
280
- new_denominator_units).inspect}"
279
+ raise Sass::ScriptError, "Expected #{other} to have units #{unit_string(new_numerator_units,
280
+ new_denominator_units).inspect}"
281
281
  end
282
282
 
283
283
  return value if numerator_units == new_numerator_units && denominator_units == new_denominator_units
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass-embedded
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.85.1
4
+ version: 1.86.0
5
5
  platform: aarch64-linux-musl
6
6
  authors:
7
7
  - なつき
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-25 00:00:00.000000000 Z
10
+ date: 2025-03-17 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: google-protobuf
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '4.29'
18
+ version: '4.30'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: '4.29'
25
+ version: '4.30'
26
26
  description: A Ruby library that will communicate with Embedded Dart Sass using the
27
27
  Embedded Sass protocol.
28
28
  email:
@@ -55,7 +55,7 @@ files:
55
55
  - lib/sass/compiler/host/importer_registry.rb
56
56
  - lib/sass/compiler/host/logger_registry.rb
57
57
  - lib/sass/compiler/host/protofier.rb
58
- - lib/sass/compiler/host/structifier.rb
58
+ - lib/sass/compiler/host/struct.rb
59
59
  - lib/sass/compiler/varint.rb
60
60
  - lib/sass/elf.rb
61
61
  - lib/sass/embedded.rb
@@ -111,8 +111,8 @@ licenses:
111
111
  - MIT
112
112
  metadata:
113
113
  bug_tracker_uri: https://github.com/sass-contrib/sass-embedded-host-ruby/issues
114
- documentation_uri: https://rubydoc.info/gems/sass-embedded/1.85.1
115
- source_code_uri: https://github.com/sass-contrib/sass-embedded-host-ruby/tree/v1.85.1
114
+ documentation_uri: https://rubydoc.info/gems/sass-embedded/1.86.0
115
+ source_code_uri: https://github.com/sass-contrib/sass-embedded-host-ruby/tree/v1.86.0
116
116
  funding_uri: https://github.com/sponsors/ntkme
117
117
  rubygems_mfa_required: 'true'
118
118
  rdoc_options: []
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  requirements: []
132
- rubygems_version: 3.6.5
132
+ rubygems_version: 3.6.6
133
133
  specification_version: 4
134
134
  summary: Use dart-sass with Ruby!
135
135
  test_files: []
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Sass
4
- class Compiler
5
- class Host
6
- # The {Structifier} module.
7
- #
8
- # It converts {::Hash} to {Struct}-like objects.
9
- module Structifier
10
- module_function
11
-
12
- def to_struct(obj, *symbols)
13
- return obj unless obj.is_a?(Hash)
14
-
15
- struct = Object.new
16
- symbols.each do |key|
17
- next unless obj.key?(key)
18
-
19
- value = obj[key]
20
- if value.respond_to?(:call)
21
- struct.define_singleton_method key do |*args, **kwargs|
22
- value.call(*args, **kwargs)
23
- end
24
- else
25
- struct.define_singleton_method key do
26
- value
27
- end
28
- end
29
- end
30
- struct
31
- end
32
- end
33
-
34
- private_constant :Structifier
35
- end
36
- end
37
- end