sass-embedded 1.69.7 → 1.71.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.
data/lib/sass/embedded.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'compiler'
4
- require_relative 'embedded/version'
5
4
 
6
5
  # The Sass module.
7
6
  #
@@ -56,7 +55,7 @@ module Sass
56
55
 
57
56
  compiler = Class.new(Compiler) do
58
57
  def initialize
59
- @dispatcher = Compiler.const_get(:DispatcherManager).new(Class.new(Compiler.const_get(:Dispatcher)) do
58
+ @channel = Compiler.const_get(:Channel).new(Class.new(Compiler.const_get(:Dispatcher)) do
60
59
  def initialize
61
60
  super
62
61
 
@@ -28,7 +28,7 @@ module Sass
28
28
 
29
29
  highlight = Exception.respond_to?(:to_tty?) && Exception.to_tty? if highlight.nil?
30
30
  if highlight
31
- +@full_message
31
+ @full_message.dup
32
32
  else
33
33
  @full_message.gsub(/\e\[[0-9;]*m/, '')
34
34
  end
@@ -38,7 +38,7 @@ module Sass
38
38
  def to_css
39
39
  content = full_message(highlight: false, order: :top)
40
40
 
41
- <<~CSS
41
+ <<~CSS.freeze
42
42
  /* #{content.gsub('*/', "*\u2060/").gsub("\r\n", "\n").split("\n").join("\n * ")} */
43
43
 
44
44
  body::before {
@@ -50,7 +50,11 @@ module Sass
50
50
  border-bottom-style: solid;
51
51
  font-family: monospace, monospace;
52
52
  white-space: pre;
53
- content: #{Serializer.serialize_quoted_string(content, ascii_only: true)};
53
+ content: #{Serializer.serialize_quoted_string(content).gsub(/[^[:ascii:]][\h\t ]?/) do |match|
54
+ replacement = "\\#{match.ord.to_s(16)}"
55
+ replacement << " #{match[1]}" if match.length > 1
56
+ replacement
57
+ end};
54
58
  }
55
59
  CSS
56
60
  end
@@ -12,10 +12,10 @@ module Sass
12
12
  attr_reader :offset, :line, :column
13
13
 
14
14
  # @!visibility private
15
- def initialize(offset, line, column)
16
- @offset = offset
17
- @line = line
18
- @column = column
15
+ def initialize(source_location)
16
+ @offset = source_location.offset
17
+ @line = source_location.line
18
+ @column = source_location.column
19
19
  end
20
20
  end
21
21
  end
@@ -16,12 +16,12 @@ module Sass
16
16
  attr_reader :url, :context
17
17
 
18
18
  # @!visibility private
19
- def initialize(start, end_, text, url, context)
20
- @start = start
21
- @end = end_
22
- @text = text
23
- @url = url
24
- @context = context
19
+ def initialize(source_span)
20
+ @start = source_span.start.nil? ? nil : Logger::SourceLocation.new(source_span.start)
21
+ @end = source_span.end.nil? ? nil : Logger::SourceLocation.new(source_span.end)
22
+ @text = source_span.text
23
+ @url = source_span.url == '' ? nil : source_span.url
24
+ @context = source_span.context == '' ? nil : source_span.context
25
25
  end
26
26
  end
27
27
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sass
4
+ # The built-in Node.js package importer. This loads pkg: URLs from node_modules
5
+ # according to the standard Node.js resolution algorithm.
6
+ #
7
+ # @see https://sass-lang.com/documentation/js-api/classes/nodepackageimporter/
8
+ class NodePackageImporter
9
+ def initialize(entry_point_directory)
10
+ raise ArgumentError, 'entry_point_directory must be set' if entry_point_directory.nil?
11
+
12
+ @entry_point_directory = File.absolute_path(entry_point_directory)
13
+ end
14
+ end
15
+ end
@@ -5,31 +5,26 @@ module Sass
5
5
  module Serializer
6
6
  module_function
7
7
 
8
- def serialize_quoted_string(string, ascii_only: false)
9
- buffer = [0x22]
10
- string.each_codepoint do |codepoint|
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
26
- else
27
- # Otherwise, the character itself.
28
- buffer << codepoint
29
- end
8
+ CSS_ESCAPE = {
9
+ "\0" => "\uFFFD",
10
+ '\\' => '\\\\',
11
+ '"' => '\\"',
12
+ "'" => "\\'",
13
+ **[*"\x01".."\x08", *"\x0A".."\x1F", "\x7F"].product(
14
+ [*'0'..'9', *'a'..'f', *'A'..'F', "\t", ' ', nil]
15
+ ).to_h do |c, x|
16
+ ["#{c}#{x}".freeze, "\\#{c.ord.to_s(16)}#{" #{x}" if x}".freeze]
17
+ end
18
+ }.freeze
19
+
20
+ private_constant :CSS_ESCAPE
21
+
22
+ def serialize_quoted_string(string)
23
+ if !string.include?('"') || string.include?("'")
24
+ %("#{string.gsub(/[\0\\"]|[\x01-\x08\x0A-\x1F\x7F][\h\t ]?/, CSS_ESCAPE)}")
25
+ else
26
+ %('#{string.gsub(/[\0\\']|[\x01-\x08\x0A-\x1F\x7F][\h\t ]?/, CSS_ESCAPE)}')
30
27
  end
31
- buffer << 0x22
32
- buffer.pack('U*')
33
28
  end
34
29
 
35
30
  def serialize_unquoted_string(string)
@@ -10,17 +10,17 @@ module Sass
10
10
  # @see https://sass-lang.com/documentation/js-api/classes/sassargumentlist/
11
11
  class ArgumentList < List
12
12
  # @param contents [Array<Value>]
13
- # @param keywords [Hash<::String, Value>]
13
+ # @param keywords [Hash<Symbol, Value>]
14
14
  # @param separator [::String]
15
15
  def initialize(contents = [], keywords = {}, separator = ',')
16
16
  super(contents, separator:)
17
17
 
18
18
  @id = 0
19
19
  @keywords_accessed = false
20
- @keywords = keywords.transform_keys(&:to_s).freeze
20
+ @keywords = keywords.freeze
21
21
  end
22
22
 
23
- # @return [Hash<::String, Value>]
23
+ # @return [Hash<Symbol, Value>]
24
24
  def keywords
25
25
  @keywords_accessed = true
26
26
  @keywords
@@ -21,9 +21,6 @@ module Sass
21
21
  @bracketed = bracketed.freeze
22
22
  end
23
23
 
24
- # @return [Array<Value>]
25
- attr_reader :contents
26
-
27
24
  # @return [::String, nil]
28
25
  attr_reader :separator
29
26
 
@@ -35,7 +32,7 @@ module Sass
35
32
  # @return [::Boolean]
36
33
  def ==(other)
37
34
  (other.is_a?(Sass::Value::List) &&
38
- other.contents == contents &&
35
+ other.to_a == to_a &&
39
36
  other.separator == separator &&
40
37
  other.bracketed? == bracketed?) ||
41
38
  (to_a.empty? && other.is_a?(Sass::Value::Map) && other.to_a.empty?)
@@ -56,7 +53,10 @@ module Sass
56
53
  @hash ||= contents.hash
57
54
  end
58
55
 
59
- alias to_a contents
56
+ # @return [Array<Value>]
57
+ def to_a
58
+ @contents
59
+ end
60
60
 
61
61
  # @return [Map, nil]
62
62
  def to_map
@@ -63,8 +63,8 @@ module Sass
63
63
  end
64
64
 
65
65
  @value = value.freeze
66
- @numerator_units = numerator_units.freeze
67
- @denominator_units = denominator_units.freeze
66
+ @numerator_units = numerator_units.each(&:freeze).freeze
67
+ @denominator_units = denominator_units.each(&:freeze).freeze
68
68
  end
69
69
 
70
70
  # @return [Numeric]
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass-embedded
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.69.7
4
+ version: 1.71.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-02 00:00:00.000000000 Z
11
+ date: 2024-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: google-protobuf
14
+ name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.25'
19
+ version: 13.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.25'
26
+ version: 13.0.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: google-protobuf
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 13.0.0
33
+ version: '3.25'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 13.0.0
40
+ version: '3.25'
41
41
  description: A Ruby library that will communicate with Embedded Dart Sass using the
42
42
  Embedded Sass protocol.
43
43
  email:
@@ -61,16 +61,15 @@ files:
61
61
  - lib/sass/canonicalize_context.rb
62
62
  - lib/sass/compile_result.rb
63
63
  - lib/sass/compiler.rb
64
+ - lib/sass/compiler/channel.rb
64
65
  - lib/sass/compiler/connection.rb
65
66
  - lib/sass/compiler/dispatcher.rb
66
- - lib/sass/compiler/dispatcher_manager.rb
67
67
  - lib/sass/compiler/host.rb
68
68
  - lib/sass/compiler/host/function_registry.rb
69
69
  - lib/sass/compiler/host/importer_registry.rb
70
70
  - lib/sass/compiler/host/logger_registry.rb
71
71
  - lib/sass/compiler/host/protofier.rb
72
72
  - lib/sass/compiler/host/structifier.rb
73
- - lib/sass/compiler/host/value_protofier.rb
74
73
  - lib/sass/compiler/varint.rb
75
74
  - lib/sass/elf.rb
76
75
  - lib/sass/embedded.rb
@@ -81,6 +80,7 @@ files:
81
80
  - lib/sass/logger/silent.rb
82
81
  - lib/sass/logger/source_location.rb
83
82
  - lib/sass/logger/source_span.rb
83
+ - lib/sass/node_package_importer.rb
84
84
  - lib/sass/serializer.rb
85
85
  - lib/sass/value.rb
86
86
  - lib/sass/value/argument_list.rb
@@ -100,8 +100,9 @@ homepage: https://github.com/sass-contrib/sass-embedded-host-ruby
100
100
  licenses:
101
101
  - MIT
102
102
  metadata:
103
- documentation_uri: https://rubydoc.info/gems/sass-embedded/1.69.7
104
- source_code_uri: https://github.com/sass-contrib/sass-embedded-host-ruby/tree/v1.69.7
103
+ bug_tracker_uri: https://github.com/sass-contrib/sass-embedded-host-ruby/issues
104
+ documentation_uri: https://rubydoc.info/gems/sass-embedded/1.71.0
105
+ source_code_uri: https://github.com/sass-contrib/sass-embedded-host-ruby/tree/v1.71.0
105
106
  funding_uri: https://github.com/sponsors/ntkme
106
107
  rubygems_mfa_required: 'true'
107
108
  post_install_message:
@@ -112,14 +113,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
113
  requirements:
113
114
  - - ">="
114
115
  - !ruby/object:Gem::Version
115
- version: 3.1.3
116
+ version: 3.1.0
116
117
  required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  requirements:
118
119
  - - ">="
119
120
  - !ruby/object:Gem::Version
120
121
  version: '0'
121
122
  requirements: []
122
- rubygems_version: 3.5.3
123
+ rubygems_version: 3.5.6
123
124
  signing_key:
124
125
  specification_version: 4
125
126
  summary: Use dart-sass with Ruby!