sass-embedded 1.69.6-arm64-darwin → 1.69.7-arm64-darwin

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: 468d6f04478756935b72746120088050ef5a27e1e7d5ac40dd68dd10627893e1
4
- data.tar.gz: 7b0796a0639c32192be05312c8ae4f170b6271fd7edf24621ad836877c69f73d
3
+ metadata.gz: ce8136be62d71bb7b4de88d25492ff4378a9fe1a5a0c6803d0d662bc434024df
4
+ data.tar.gz: 98b661689a1c1de347b3b3f0154f461ad7ffe1998c8b5c30b736e793185ae5c9
5
5
  SHA512:
6
- metadata.gz: a0c701e68cb63c7855e3b18b5f30d3951684d37635914acb3e9ddd8009d56ef53bbe10b9f6dd01e01fe68c5545e09fc6baa914330f9417c724e9ecf77929e277
7
- data.tar.gz: 38f5dce8f66dfcf0351e1e7b89110af637677b8fbfa9eec36a2cdae461895561421e5c9bb80452ef201593c3e392a7ad71cbff6fb06deca78fe165f248153d82
6
+ metadata.gz: 4905e861154a798cd1b3c5ac7bfe0ba1fd8eb49dd571375d4f81632e5e178fa66ca26a5967c740fae19215bf36823bf47eda9541e240e0c13402b90ec4743846
7
+ data.tar.gz: 2bb8864046425cd17a3a5f03c2d1aaac3d2ee2d05aa9257ea8cc142b1f0c659ddf6bae2d2ae2fa98328463144389947c40f7805ff81f80601ccceb66bdd6e10b
data/ext/sass/cli.rb CHANGED
@@ -3,8 +3,8 @@
3
3
  module Sass
4
4
  class CLI
5
5
  COMMAND = [
6
- File.absolute_path('dart-sass/src/dart', __dir__),
7
- File.absolute_path('dart-sass/src/sass.snapshot', __dir__)
6
+ File.absolute_path('dart-sass/src/dart', __dir__).freeze,
7
+ File.absolute_path('dart-sass/src/sass.snapshot', __dir__).freeze
8
8
  ].freeze
9
9
  end
10
10
 
Binary file
@@ -18,12 +18,9 @@ module Sass
18
18
  def initialize(operator, left, right)
19
19
  raise Sass::ScriptError, "Invalid operator: #{operator}" unless OPERATORS.include?(operator)
20
20
 
21
- left.assert_calculation_value
22
- right.assert_calculation_value
23
-
24
21
  @operator = operator.freeze
25
- @left = left.freeze
26
- @right = right.freeze
22
+ @left = assert_calculation_value(left, 'left')
23
+ @right = assert_calculation_value(right, 'right')
27
24
  end
28
25
 
29
26
  # @return [::String]
@@ -5,10 +5,16 @@ module Sass
5
5
  #
6
6
  # @see https://sass-lang.com/documentation/js-api/types/calculationvalue/
7
7
  module CalculationValue
8
- # @return [CalculationValue]
9
- # @raise [ScriptError]
10
- def assert_calculation_value(_name = nil)
11
- self
8
+ private
9
+
10
+ def assert_calculation_value(value, name = nil)
11
+ if !value.is_a?(Sass::CalculationValue) || (value.is_a?(Sass::Value::String) && value.quoted?)
12
+ raise Sass::ScriptError.new(
13
+ "#{value} must be one of SassNumber, unquoted SassString, SassCalculation, CalculationOperation", name
14
+ )
15
+ end
16
+
17
+ value
12
18
  end
13
19
  end
14
20
  end
@@ -123,7 +123,7 @@ module Sass
123
123
  end
124
124
 
125
125
  def disconnect
126
- @dispatcher.unsubscribe(id)
126
+ @dispatcher.unsubscribe(@id)
127
127
  end
128
128
 
129
129
  def error(...)
@@ -2,32 +2,35 @@
2
2
 
3
3
  module Sass
4
4
  class Compiler
5
- # The {ResilientDispatcher} class.
5
+ # The {DispatcherManager} class.
6
6
  #
7
- # It recovers from failures and continues to function.
8
- class ResilientDispatcher
7
+ # It manages the lifecycle of {Dispatcher}.
8
+ class DispatcherManager
9
9
  def initialize(dispatcher_class)
10
10
  @dispatcher_class = dispatcher_class
11
11
  @dispatcher = @dispatcher_class.new
12
12
  @mutex = Mutex.new
13
13
  end
14
14
 
15
- def close(...)
15
+ def close
16
16
  @mutex.synchronize do
17
- @dispatcher.close(...)
17
+ unless @dispatcher.nil?
18
+ @dispatcher.close
19
+ @dispatcher = nil
20
+ end
18
21
  end
19
22
  end
20
23
 
21
- def closed?(...)
24
+ def closed?
22
25
  @mutex.synchronize do
23
- @dispatcher.closed?(...)
26
+ @dispatcher.nil?
24
27
  end
25
28
  end
26
29
 
27
30
  def connect(...)
28
- @dispatcher.connect(...)
29
- rescue Errno::EBUSY
30
31
  @mutex.synchronize do
32
+ raise IOError, 'closed compiler' if @dispatcher.nil?
33
+
31
34
  @dispatcher.connect(...)
32
35
  rescue Errno::EBUSY
33
36
  @dispatcher = @dispatcher_class.new
@@ -36,6 +39,6 @@ module Sass
36
39
  end
37
40
  end
38
41
 
39
- private_constant :ResilientDispatcher
42
+ private_constant :DispatcherManager
40
43
  end
41
44
  end
@@ -81,7 +81,7 @@ module Sass
81
81
  EmbeddedProtocol::InboundMessage::ImportResponse.new(
82
82
  id: import_request.id,
83
83
  success: EmbeddedProtocol::InboundMessage::ImportResponse::ImportSuccess.new(
84
- contents: importer_result.contents,
84
+ contents: importer_result.contents.to_str,
85
85
  syntax: Protofier.to_proto_syntax(importer_result.syntax),
86
86
  source_map_url: (importer_result.source_map_url&.to_s if importer_result.respond_to?(:source_map_url))
87
87
  )
@@ -16,7 +16,7 @@ module Sass
16
16
  when Sass::Value::String
17
17
  EmbeddedProtocol::Value.new(
18
18
  string: EmbeddedProtocol::Value::String.new(
19
- text: obj.text,
19
+ text: obj.text.to_str,
20
20
  quoted: obj.quoted?
21
21
  )
22
22
  )
@@ -179,7 +179,7 @@ module Sass
179
179
  end
180
180
  )
181
181
  when :compiler_function
182
- Sass::Value::Function.new(nil, nil).instance_eval do
182
+ Sass::Value::Function.new(nil).instance_eval do
183
183
  @id = obj.id
184
184
  self
185
185
  end
@@ -44,7 +44,7 @@ module Sass
44
44
  send_message(compile_request: EmbeddedProtocol::InboundMessage::CompileRequest.new(
45
45
  string: unless source.nil?
46
46
  EmbeddedProtocol::InboundMessage::CompileRequest::StringInput.new(
47
- source:,
47
+ source: source.to_str,
48
48
  url: url&.to_s,
49
49
  syntax: Protofier.to_proto_syntax(syntax),
50
50
  importer: (@importer_registry.register(importer) unless importer.nil?)
@@ -74,7 +74,14 @@ module Sass
74
74
  ))
75
75
  end
76
76
 
77
- "sass-embedded\t#{version_response.implementation_version}"
77
+ lang = case version_response.implementation_name
78
+ when /\bdart\b/i
79
+ '[Dart]'
80
+ else
81
+ '[?]'
82
+ end
83
+
84
+ "#{version_response.implementation_name}\t#{version_response.implementation_version}\t(Sass Compiler)\t#{lang}"
78
85
  end
79
86
 
80
87
  def compile_response(message)
data/lib/sass/compiler.rb CHANGED
@@ -4,8 +4,8 @@ require_relative 'canonicalize_context'
4
4
  require_relative 'compile_result'
5
5
  require_relative 'compiler/connection'
6
6
  require_relative 'compiler/dispatcher'
7
+ require_relative 'compiler/dispatcher_manager'
7
8
  require_relative 'compiler/host'
8
- require_relative 'compiler/resilient_dispatcher'
9
9
  require_relative 'compiler/varint'
10
10
  require_relative 'embedded_protocol'
11
11
  require_relative 'exception'
@@ -27,7 +27,7 @@ module Sass
27
27
  # sass.close
28
28
  class Compiler
29
29
  def initialize
30
- @dispatcher = ResilientDispatcher.new(Dispatcher)
30
+ @dispatcher = DispatcherManager.new(Dispatcher)
31
31
  end
32
32
 
33
33
  # Compiles the Sass file at +path+ to CSS.
@@ -174,7 +174,10 @@ module Sass
174
174
  # @return [String] Information about the Sass implementation.
175
175
  # @see https://sass-lang.com/documentation/js-api/variables/info/
176
176
  def info
177
- @info ||= Host.new(@dispatcher).version_request
177
+ @info ||= <<~INFO.freeze
178
+ sass-embedded\t#{Embedded::VERSION}\t(Embedded Host)\t[Ruby]
179
+ #{Host.new(@dispatcher).version_request}
180
+ INFO
178
181
  end
179
182
 
180
183
  def close
data/lib/sass/elf.rb CHANGED
@@ -150,7 +150,7 @@ module Sass
150
150
  def initialize(buffer)
151
151
  @buffer = buffer
152
152
  @ehdr = read_ehdr
153
- @buffer.seek(@ehdr[:e_phoff], :SET)
153
+ @buffer.seek(@ehdr[:e_phoff], IO::SEEK_SET)
154
154
  @proghdrs = Array.new(@ehdr[:e_phnum]) do
155
155
  read_phdr
156
156
  end
@@ -176,7 +176,7 @@ module Sass
176
176
  phdr = @proghdrs.find { |p| p[:p_type] == PT_INTERP }
177
177
  return if phdr.nil?
178
178
 
179
- @buffer.seek(phdr[:p_offset], :SET)
179
+ @buffer.seek(phdr[:p_offset], IO::SEEK_SET)
180
180
  interpreter = @buffer.read(phdr[:p_filesz])
181
181
  raise ArgumentError unless interpreter.end_with?("\0")
182
182
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sass
4
4
  module Embedded
5
- VERSION = '1.69.6'
5
+ VERSION = '1.69.7'
6
6
  end
7
7
  end
data/lib/sass/embedded.rb CHANGED
@@ -56,7 +56,7 @@ module Sass
56
56
 
57
57
  compiler = Class.new(Compiler) do
58
58
  def initialize
59
- @dispatcher = Compiler.const_get(:ResilientDispatcher).new(Class.new(Compiler.const_get(:Dispatcher)) do
59
+ @dispatcher = Compiler.const_get(:DispatcherManager).new(Class.new(Compiler.const_get(:Dispatcher)) do
60
60
  def initialize
61
61
  super
62
62
 
@@ -50,7 +50,7 @@ module Sass
50
50
  border-bottom-style: solid;
51
51
  font-family: monospace, monospace;
52
52
  white-space: pre;
53
- content: #{Serializer.dump_quoted_string(content)};
53
+ content: #{Serializer.serialize_quoted_string(content, ascii_only: true)};
54
54
  }
55
55
  CSS
56
56
  end
@@ -44,7 +44,7 @@ module Sass
44
44
 
45
45
  private_constant :CoreExt
46
46
 
47
- Process.singleton_class.prepend(CoreExt)
47
+ Process.singleton_class.prepend(CoreExt) if Process.respond_to?(:_fork)
48
48
  end
49
49
 
50
50
  private_constant :ForkTracker
@@ -5,67 +5,35 @@ module Sass
5
5
  module Serializer
6
6
  module_function
7
7
 
8
- def dump_quoted_string(string)
9
- include_double_quote = false
10
- include_single_quote = false
11
- buffer = [34]
8
+ def serialize_quoted_string(string, ascii_only: false)
9
+ buffer = [0x22]
12
10
  string.each_codepoint do |codepoint|
13
- case codepoint
14
- when 34
15
- return dump_double_quoted_string(string) if include_single_quote
16
-
17
- include_double_quote = true
18
- buffer << 34
19
- when 39
20
- return dump_double_quoted_string(string) if include_double_quote
21
-
22
- include_single_quote = true
23
- buffer << 39
24
- when 92
25
- buffer << 92 << 92
26
- when 9
27
- buffer << 9
11
+ if codepoint.zero?
12
+ # If the character is NULL (U+0000), then the REPLACEMENT CHARACTER (U+FFFD).
13
+ buffer << 0xFFFD
14
+ elsif codepoint == 0x22
15
+ # If the character is '"' (U+0022) or "\" (U+005C), then the escaped character.
16
+ buffer << 0x5C << 0x22
17
+ elsif codepoint == 0x5C
18
+ # If the character is '"' (U+0022) or "\" (U+005C), then the escaped character.
19
+ buffer << 0x5C << 0x5C
20
+ elsif codepoint < 0x20 || (ascii_only ? codepoint >= 0x7F : codepoint == 0x7F)
21
+ # If the character is in the range [\1-\1f] (U+0001 to U+001F) or is U+007F,
22
+ # then the character escaped as code point.
23
+ buffer << 0x5C
24
+ buffer.concat(codepoint.to_s(16).codepoints)
25
+ buffer << 0x20
28
26
  else
29
- if codepoint < 32 || codepoint > 126
30
- buffer << 92
31
- buffer.concat(codepoint.to_s(16).codepoints)
32
- buffer << 32
33
- else
34
- buffer << codepoint
35
- end
27
+ # Otherwise, the character itself.
28
+ buffer << codepoint
36
29
  end
37
30
  end
38
- if include_double_quote
39
- buffer[0] = 39
40
- buffer << 39
41
- else
42
- buffer << 34
43
- end
31
+ buffer << 0x22
44
32
  buffer.pack('U*')
45
33
  end
46
34
 
47
- def dump_double_quoted_string(string)
48
- buffer = [34]
49
- string.each_codepoint do |codepoint|
50
- case codepoint
51
- when 34
52
- buffer << 92 << 34
53
- when 92
54
- buffer << 92 << 92
55
- when 9
56
- buffer << 9
57
- else
58
- if codepoint < 32 || codepoint > 126
59
- buffer << 92
60
- buffer.concat(codepoint.to_s(16).codepoints)
61
- buffer << 32
62
- else
63
- buffer << codepoint
64
- end
65
- end
66
- end
67
- buffer << 34
68
- buffer.pack('U*')
35
+ def serialize_unquoted_string(string)
36
+ string.tr("\0", "\uFFFD").gsub(/\n */, ' ')
69
37
  end
70
38
  end
71
39
 
@@ -8,7 +8,7 @@ module Sass
8
8
  # map as well as the positional arguments.
9
9
  #
10
10
  # @see https://sass-lang.com/documentation/js-api/classes/sassargumentlist/
11
- class ArgumentList < Value::List
11
+ class ArgumentList < List
12
12
  # @param contents [Array<Value>]
13
13
  # @param keywords [Hash<::String, Value>]
14
14
  # @param separator [::String]
@@ -53,7 +53,9 @@ module Sass
53
53
  private
54
54
 
55
55
  def initialize(name, arguments)
56
- arguments.each(&:assert_calculation_value)
56
+ arguments.each do |value|
57
+ assert_calculation_value(value)
58
+ end
57
59
 
58
60
  @name = name.freeze
59
61
  @arguments = arguments.freeze
@@ -10,9 +10,11 @@ module Sass
10
10
 
11
11
  # @param signature [::String]
12
12
  # @param callback [Proc]
13
- def initialize(signature, callback)
14
- @signature = signature
15
- @callback = callback
13
+ def initialize(signature, &callback)
14
+ raise Sass::ScriptError, 'no block given' unless signature.nil? || callback
15
+
16
+ @signature = signature.freeze
17
+ @callback = callback.freeze
16
18
  end
17
19
 
18
20
  # @return [Integer, nil]
@@ -39,14 +39,6 @@ module Sass
39
39
  self
40
40
  end
41
41
 
42
- # @return [CalculationValue]
43
- # @raise [ScriptError]
44
- def assert_calculation_value(name = nil)
45
- raise Sass::ScriptError.new("Expected #{self} to be an unquoted string.", name) if quoted?
46
-
47
- self
48
- end
49
-
50
42
  # @param sass_index [Number]
51
43
  # @return [Integer]
52
44
  def sass_index_to_string_index(sass_index, name = nil)
@@ -59,6 +51,11 @@ module Sass
59
51
 
60
52
  index.negative? ? text.length + index : index - 1
61
53
  end
54
+
55
+ # @return [String]
56
+ def to_s
57
+ @quoted ? Serializer.serialize_quoted_string(@text) : Serializer.serialize_unquoted_string(@text)
58
+ end
62
59
  end
63
60
  end
64
61
  end
data/lib/sass/value.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'calculation_value'
4
-
5
3
  module Sass
6
4
  # The abstract base class of Sass's value types.
7
5
  #
@@ -66,12 +64,6 @@ module Sass
66
64
  raise Sass::ScriptError.new("#{self} is not a calculation", name)
67
65
  end
68
66
 
69
- # @return [CalculationValue]
70
- # @raise [ScriptError]
71
- def assert_calculation_value(name = nil)
72
- raise Sass::ScriptError.new("#{self} is not a calculation value", name)
73
- end
74
-
75
67
  # @return [Color]
76
68
  # @raise [ScriptError]
77
69
  def assert_color(name = nil)
@@ -129,6 +121,7 @@ module Sass
129
121
  end
130
122
  end
131
123
 
124
+ require_relative 'calculation_value'
132
125
  require_relative 'value/list'
133
126
  require_relative 'value/argument_list'
134
127
  require_relative 'value/boolean'
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.69.6
4
+ version: 1.69.7
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - なつき
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-29 00:00:00.000000000 Z
11
+ date: 2024-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -50,6 +50,7 @@ files:
50
50
  - lib/sass/compiler.rb
51
51
  - lib/sass/compiler/connection.rb
52
52
  - lib/sass/compiler/dispatcher.rb
53
+ - lib/sass/compiler/dispatcher_manager.rb
53
54
  - lib/sass/compiler/host.rb
54
55
  - lib/sass/compiler/host/function_registry.rb
55
56
  - lib/sass/compiler/host/importer_registry.rb
@@ -57,7 +58,6 @@ files:
57
58
  - lib/sass/compiler/host/protofier.rb
58
59
  - lib/sass/compiler/host/structifier.rb
59
60
  - lib/sass/compiler/host/value_protofier.rb
60
- - lib/sass/compiler/resilient_dispatcher.rb
61
61
  - lib/sass/compiler/varint.rb
62
62
  - lib/sass/elf.rb
63
63
  - lib/sass/embedded.rb
@@ -87,9 +87,10 @@ homepage: https://github.com/sass-contrib/sass-embedded-host-ruby
87
87
  licenses:
88
88
  - MIT
89
89
  metadata:
90
- documentation_uri: https://rubydoc.info/gems/sass-embedded/1.69.6
91
- source_code_uri: https://github.com/sass-contrib/sass-embedded-host-ruby/tree/v1.69.6
90
+ documentation_uri: https://rubydoc.info/gems/sass-embedded/1.69.7
91
+ source_code_uri: https://github.com/sass-contrib/sass-embedded-host-ruby/tree/v1.69.7
92
92
  funding_uri: https://github.com/sponsors/ntkme
93
+ rubygems_mfa_required: 'true'
93
94
  post_install_message:
94
95
  rdoc_options: []
95
96
  require_paths: