sass-embedded 0.17.0 → 0.18.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: 6c35a262d552f107bf4a13ed024c5c3bfb46da786ff08f4dd116a73211bc9bba
4
- data.tar.gz: a0eb5eb4389b4212a66d265eb762511e616d2c5f51c393d2dc7191853501839f
3
+ metadata.gz: 3d3305290374a056f10b9d2cb5df79a8bf3d262e8dd7e2528e8ded8b53658bc6
4
+ data.tar.gz: 2a5826eefe6eef8aadc3a4beba40c85a573b9fe3f8f4ac36e0d923a02b6264c6
5
5
  SHA512:
6
- metadata.gz: 2a2b5b0aaa9065d64cf12947c96e129cff83d07e628c61e362f0aa4cf7bbdf02ca479508a3f717eaaac4d1466c45a15efffa18882144e5b951ec0242f286d71f
7
- data.tar.gz: b4b2b8991b1640f7c5661aede8b13688cea6feb66d2016b96f9ba19d2bc59fdbd13404d317fa0e86819233c58a2ee22c70a25a60d6982be877b787c8cd27baec
6
+ metadata.gz: 74777ec7d2869d83a1cf27dbc5b6751126f73ff4ed01c0af16b85162fd3456f46b73ba8ad64dd758c36b2819d2ccf3a958a951b4615e2dfa73db758a39fff21e
7
+ data.tar.gz: a648b472413cbb7063dd6cf9a988034bd0da668ab4c06c16f02c395a26d09d064dd46f57c6f99487ed4998bc0de35806f2f5f49a83487436efb8ff6ab459d2a9
data/ext/sass/extconf.rb CHANGED
@@ -5,7 +5,7 @@ require 'fileutils'
5
5
  require 'json'
6
6
  require 'mkmf'
7
7
  require 'open-uri'
8
- require_relative '../../lib/sass/embedded/compiler/path'
8
+ require_relative '../../lib/sass/embedded/compiler'
9
9
 
10
10
  module Sass
11
11
  class Embedded
@@ -3,13 +3,21 @@
3
3
  module Sass
4
4
  # An exception thrown because a Sass compilation failed.
5
5
  class CompileError < StandardError
6
- attr_accessor :sass_message, :sass_stack, :span
6
+ attr_accessor :sass_stack, :span
7
7
 
8
- def initialize(message, sass_message, sass_stack, span)
8
+ def initialize(message, full_message, sass_stack, span)
9
9
  super(message)
10
- @sass_message = sass_message
10
+ @full_message = full_message
11
11
  @sass_stack = sass_stack
12
12
  @span = span
13
13
  end
14
+
15
+ def full_message(**kwargs)
16
+ if @full_message.nil?
17
+ super.full_message(**kwargs)
18
+ else
19
+ @full_message
20
+ end
21
+ end
14
22
  end
15
23
  end
@@ -7,7 +7,7 @@ module Sass
7
7
  class FunctionRegistry
8
8
  attr_reader :global_functions
9
9
 
10
- def initialize(functions)
10
+ def initialize(functions, highlight:)
11
11
  functions = functions.transform_keys(&:to_s)
12
12
 
13
13
  @global_functions = functions.keys
@@ -20,9 +20,12 @@ module Sass
20
20
  signature
21
21
  end
22
22
  end
23
+
24
+ @id = 0
23
25
  @functions_by_id = {}
24
26
  @ids_by_function = {}
25
- @id = 0
27
+
28
+ @highlight = highlight
26
29
  end
27
30
 
28
31
  def register(function)
@@ -59,7 +62,7 @@ module Sass
59
62
  rescue StandardError => e
60
63
  EmbeddedProtocol::InboundMessage::FunctionCallResponse.new(
61
64
  id: function_call_request.id,
62
- error: e.message
65
+ error: e.full_message(highlight: @highlight, order: :top)
63
66
  )
64
67
  end
65
68
 
@@ -7,7 +7,7 @@ module Sass
7
7
  class ImporterRegistry
8
8
  attr_reader :importers
9
9
 
10
- def initialize(importers, load_paths)
10
+ def initialize(importers, load_paths, highlight:)
11
11
  @id = 0
12
12
  @importers_by_id = {}
13
13
  @importers = importers
@@ -17,6 +17,8 @@ module Sass
17
17
  path: File.absolute_path(load_path)
18
18
  )
19
19
  end)
20
+
21
+ @highlight = highlight
20
22
  end
21
23
 
22
24
  def register(importer)
@@ -52,7 +54,7 @@ module Sass
52
54
  rescue StandardError => e
53
55
  EmbeddedProtocol::InboundMessage::CanonicalizeResponse.new(
54
56
  id: canonicalize_request.id,
55
- error: e.message
57
+ error: e.full_message(highlight: @highlight, order: :top)
56
58
  )
57
59
  end
58
60
 
@@ -71,7 +73,7 @@ module Sass
71
73
  rescue StandardError => e
72
74
  EmbeddedProtocol::InboundMessage::ImportResponse.new(
73
75
  id: import_request.id,
74
- error: e.message
76
+ error: e.full_message(highlight: @highlight, order: :top)
75
77
  )
76
78
  end
77
79
 
@@ -88,7 +90,7 @@ module Sass
88
90
  rescue StandardError => e
89
91
  EmbeddedProtocol::InboundMessage::FileImportResponse.new(
90
92
  id: file_import_request.id,
91
- error: e.message
93
+ error: e.full_message(highlight: @highlight, order: :top)
92
94
  )
93
95
  end
94
96
  end
@@ -27,8 +27,8 @@ module Sass
27
27
  logger:,
28
28
  quiet_deps:,
29
29
  verbose:)
30
- @function_registery = FunctionRegistry.new(functions)
31
- @importer_registery = ImporterRegistry.new(importers, load_paths)
30
+ @function_registery = FunctionRegistry.new(functions, highlight: alert_color)
31
+ @importer_registery = ImporterRegistry.new(importers, load_paths, highlight: alert_color)
32
32
  @logger_registery = LoggerRegistry.new(logger)
33
33
 
34
34
  super(channel)
@@ -11,6 +11,10 @@ module Sass
11
11
  class Compiler
12
12
  include Observable
13
13
 
14
+ PATH = File.absolute_path(
15
+ "../../../ext/sass/sass_embedded/dart-sass-embedded#{Gem.win_platform? ? '.bat' : ''}", __dir__
16
+ )
17
+
14
18
  PROTOCOL_ERROR_ID = 4_294_967_295
15
19
 
16
20
  def initialize
@@ -18,8 +18,8 @@ module Sass
18
18
  def from_proto_compile_response(compile_response)
19
19
  if compile_response.result == :failure
20
20
  raise CompileError.new(
21
- compile_response.failure.formatted || compile_response.failure.message,
22
21
  compile_response.failure.message,
22
+ compile_response.failure.formatted,
23
23
  compile_response.failure.stack_trace,
24
24
  from_proto_source_span(compile_response.failure.span)
25
25
  )
@@ -13,7 +13,11 @@ module Sass
13
13
  obj.each do |key, value|
14
14
  if value.respond_to? :call
15
15
  struct.define_singleton_method key.to_sym do |*args, **kwargs|
16
- value.call(*args, **kwargs)
16
+ if kwargs.empty?
17
+ value.call(*args)
18
+ else
19
+ value.call(*args, **kwargs)
20
+ end
17
21
  end
18
22
  else
19
23
  struct.define_singleton_method key.to_sym do
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sass
4
4
  class Embedded
5
- VERSION = '0.17.0'
5
+ VERSION = '0.18.0'
6
6
  end
7
7
  end
data/lib/sass.rb CHANGED
@@ -11,7 +11,6 @@ require_relative 'sass/embedded/compile_context/importer_registry'
11
11
  require_relative 'sass/embedded/compile_context/logger_registry'
12
12
  require_relative 'sass/embedded/compile_context/value_protofier'
13
13
  require_relative 'sass/embedded/compiler'
14
- require_relative 'sass/embedded/compiler/path'
15
14
  require_relative 'sass/embedded_protocol'
16
15
  require_relative 'sass/embedded/legacy'
17
16
  require_relative 'sass/embedded/protocol_error'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass-embedded
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
@@ -135,7 +135,6 @@ files:
135
135
  - lib/sass/embedded/compile_context/logger_registry.rb
136
136
  - lib/sass/embedded/compile_context/value_protofier.rb
137
137
  - lib/sass/embedded/compiler.rb
138
- - lib/sass/embedded/compiler/path.rb
139
138
  - lib/sass/embedded/legacy.rb
140
139
  - lib/sass/embedded/observer.rb
141
140
  - lib/sass/embedded/protocol_error.rb
@@ -165,8 +164,8 @@ homepage: https://github.com/ntkme/sass-embedded-host-ruby
165
164
  licenses:
166
165
  - MIT
167
166
  metadata:
168
- documentation_uri: https://www.rubydoc.info/gems/sass-embedded/0.17.0
169
- source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v0.17.0
167
+ documentation_uri: https://www.rubydoc.info/gems/sass-embedded/0.18.0
168
+ source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v0.18.0
170
169
  funding_uri: https://github.com/sponsors/ntkme
171
170
  post_install_message:
172
171
  rdoc_options: []
@@ -176,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
175
  requirements:
177
176
  - - ">="
178
177
  - !ruby/object:Gem::Version
179
- version: 2.7.0
178
+ version: 2.6.0
180
179
  required_rubygems_version: !ruby/object:Gem::Requirement
181
180
  requirements:
182
181
  - - ">="
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Sass
4
- class Embedded
5
- class Compiler
6
- PATH = File.absolute_path(
7
- "../../../../ext/sass/sass_embedded/dart-sass-embedded#{Gem.win_platform? ? '.bat' : ''}", __dir__
8
- )
9
- end
10
- end
11
- end