sass-embedded 1.2.3 → 1.2.6

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: 3195026a16f9bd04832907250e362bcbfc05959275acfe8a28d432ec97eb4c9e
4
- data.tar.gz: c2521f1aa1ba8c1b593ab6e3b8c268ccfca2c9e6e5ea4f62b6cbf8ce9f268911
3
+ metadata.gz: cf67d1d4e17eeb4d3968b3072b326a671e71854a8e4f676a21dab017318bcba8
4
+ data.tar.gz: 42cdfb746375c84ecb4010d10c92e44db8e745f094c342830aae868bf0256055
5
5
  SHA512:
6
- metadata.gz: 7076f36abadb77d58ebf939aa966a711899ab0973b5991081934bdd67cfa527f735b70c5c84bc9a1d40338e779399a693580052e0cf32a482d6c4a1a19d7740c
7
- data.tar.gz: 414d12d0fef0c9a054691170c889bddd0a0efb090090d85d6ef4beebd0127c15681a6039b1c10f45ffb1eb8a572d971464c67fbfa7171d915d6cbb67b1221f55
6
+ metadata.gz: 1c0c4c9ef537d355dc59dbd690f16c7b6db8668ca34f13eefdfeda9dcd0f508e8357c526dbeb541a65c4d20bb62894dc163d338469747a991ceb480dcb5a5f8f
7
+ data.tar.gz: 242adf57d77229bef1e0881116d849f00de46e0b9d64227792cb69f5de27ba467f90e6e2c7267f0f4095ffb0f119f8e332946e7a076b0262d65b4138db3d02c6
data/ext/sass/Rakefile CHANGED
@@ -23,7 +23,7 @@ end
23
23
 
24
24
  file 'embedded.rb' => %w[sass_embedded] do |t|
25
25
  path = 'sass_embedded/dart-sass-embedded'
26
- path = "#{path}#{(Gem.win_platform? ? ['.exe', '.bat'] : ['', '.sh']).find { |ext| File.exist? "#{path}#{ext}" }}"
26
+ path = "#{path}#{['.exe', '.bat'].find { |ext| File.exist? "#{path}#{ext}" }}" if Gem.win_platform?
27
27
 
28
28
  raise "#{path} not found" unless File.exist? path
29
29
 
@@ -11,15 +11,19 @@ module Sass
11
11
  def initialize
12
12
  @compiler = Compiler.new
13
13
  @observers = {}
14
- @id = 0
14
+ # TODO: Revert to `@id = 0` when upstream bug is fixed
15
+ # https://github.com/sass/dart-sass-embedded/pull/80
16
+ @id = 0xfffffffe
15
17
  @mutex = Mutex.new
16
18
 
17
19
  Thread.new do
18
20
  loop do
19
21
  receive_message EmbeddedProtocol::OutboundMessage.decode @compiler.read
20
22
  rescue IOError, Errno::EBADF => e
21
- half_close
22
- @observers.each_value do |observer|
23
+ @mutex.synchronize do
24
+ @id = PROTOCOL_ERROR_ID
25
+ @observers.values
26
+ end.each do |observer|
23
27
  observer.error e
24
28
  end
25
29
  break
@@ -29,7 +33,7 @@ module Sass
29
33
 
30
34
  def subscribe(observer)
31
35
  @mutex.synchronize do
32
- raise EOFError if half_closed?
36
+ raise EOFError if @id == PROTOCOL_ERROR_ID
33
37
 
34
38
  id = @id
35
39
  @id = id.next
@@ -42,7 +46,7 @@ module Sass
42
46
  @mutex.synchronize do
43
47
  @observers.delete(id)
44
48
 
45
- close if half_closed? && @observers.empty?
49
+ close if @id == PROTOCOL_ERROR_ID && @observers.empty?
46
50
  end
47
51
  end
48
52
 
@@ -60,33 +64,21 @@ module Sass
60
64
 
61
65
  private
62
66
 
63
- def half_close
64
- @mutex.synchronize do
65
- @id = PROTOCOL_ERROR_ID
66
- end
67
- end
68
-
69
- def half_closed?
70
- @id == PROTOCOL_ERROR_ID
71
- end
72
-
73
67
  def receive_message(outbound_message)
74
68
  oneof = outbound_message.message
75
69
  message = outbound_message.public_send(oneof)
76
70
  case oneof
77
71
  when :error
78
- half_close
79
- if message.id == PROTOCOL_ERROR_ID
80
- @observers.each_value do |observer|
81
- observer.public_send(oneof, message)
82
- end
83
- else
84
- @observers[message.id].public_send(oneof, message)
72
+ @mutex.synchronize do
73
+ @id = PROTOCOL_ERROR_ID
74
+ message.id == PROTOCOL_ERROR_ID ? @observers.values : [@observers[message.id]]
75
+ end.each do |observer|
76
+ observer.public_send(oneof, message)
85
77
  end
86
78
  when :compile_response, :version_response
87
- @observers[message.id].public_send(oneof, message)
79
+ @mutex.synchronize { @observers[message.id] }.public_send(oneof, message)
88
80
  when :log_event, :canonicalize_request, :import_request, :file_import_request, :function_call_request
89
- Thread.new(@observers[message.compilation_id]) do |observer|
81
+ Thread.new(@mutex.synchronize { @observers[message.compilation_id] }) do |observer|
90
82
  observer.public_send(oneof, message)
91
83
  end
92
84
  else
@@ -13,7 +13,6 @@ module Sass
13
13
  class Host
14
14
  def initialize(channel)
15
15
  @channel = channel
16
- @mutex = Mutex.new
17
16
  end
18
17
 
19
18
  def id
@@ -126,16 +125,14 @@ module Sass
126
125
  private
127
126
 
128
127
  def await
129
- @mutex.synchronize do
130
- raise EOFError if defined? @async
131
-
132
- @connection = @channel.connect(self)
133
- @async = Async.new
134
- yield
135
- @async.await
136
- ensure
137
- @connection.disconnect
138
- end
128
+ raise EOFError if defined? @async
129
+
130
+ @connection = @channel.connect(self)
131
+ @async = Async.new
132
+ yield
133
+ @async.await
134
+ ensure
135
+ @connection.disconnect
139
136
  end
140
137
  end
141
138
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sass
4
4
  class Embedded
5
- VERSION = '1.2.3'
5
+ VERSION = '1.2.6'
6
6
  end
7
7
  end
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.2.3
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-24 00:00:00.000000000 Z
11
+ date: 2022-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -159,8 +159,8 @@ homepage: https://github.com/ntkme/sass-embedded-host-ruby
159
159
  licenses:
160
160
  - MIT
161
161
  metadata:
162
- documentation_uri: https://rubydoc.info/gems/sass-embedded/1.2.3
163
- source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v1.2.3
162
+ documentation_uri: https://rubydoc.info/gems/sass-embedded/1.2.6
163
+ source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v1.2.6
164
164
  funding_uri: https://github.com/sponsors/ntkme
165
165
  post_install_message:
166
166
  rdoc_options: []