sass-embedded 0.7.1 → 0.7.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 +4 -4
- data/lib/sass.rb +2 -1
- data/lib/sass/embedded.rb +17 -17
- data/lib/sass/info.rb +1 -1
- data/lib/sass/observer.rb +1 -1
- data/lib/sass/render.rb +4 -4
- data/lib/sass/transport.rb +25 -26
- data/lib/sass/util.rb +10 -19
- data/lib/sass/version.rb +1 -1
- metadata +7 -34
- data/.github/workflows/build.yml +0 -44
- data/.gitignore +0 -45
- data/.rubocop.yml +0 -11
- data/Gemfile +0 -4
- data/Rakefile +0 -23
- data/ext/.gitignore +0 -3
- data/sass-embedded.gemspec +0 -38
- data/test/concurrency_test.rb +0 -34
- data/test/functions_test.rb +0 -387
- data/test/importer_test.rb +0 -155
- data/test/include_paths_test.rb +0 -81
- data/test/indented_syntax_test.rb +0 -61
- data/test/input_test.rb +0 -56
- data/test/output_test.rb +0 -136
- data/test/render_error_test.rb +0 -44
- data/test/render_test.rb +0 -19
- data/test/source_maps_test.rb +0 -182
- data/test/test_helper.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d934996f500e6897ada46afc22c92ec529e66df4f6cb6ced17f0067fe438fd3b
|
4
|
+
data.tar.gz: 4983a6a25aec431857fc6642d06b8296937d351cd6d941783fcd49e6adfa23c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b7062bfaf917380d740d69eedad18e1b6d66b5eca52dfa7c268138fe2921320bfea350af67aad4ed0c22623cacb06ec242c4e8e3ae17dba9f7d63718657a19a
|
7
|
+
data.tar.gz: 2eaf5b41c9c1e4efeb46ac544964da082beafe23d4ba6c6bd4103bbb3f9d94aead77506bb4648acab7b2adf15fbea236c3cff3a3db5d2210e6a9380b3c65056a
|
data/lib/sass.rb
CHANGED
@@ -60,6 +60,7 @@ module Sass
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
require_relative 'sass/version'
|
63
64
|
require_relative 'sass/platform'
|
64
65
|
require_relative 'sass/util'
|
65
66
|
require_relative 'sass/struct'
|
@@ -67,6 +68,6 @@ require_relative 'sass/result'
|
|
67
68
|
require_relative 'sass/error'
|
68
69
|
require_relative 'sass/transport'
|
69
70
|
require_relative 'sass/observer'
|
70
|
-
require_relative 'sass/
|
71
|
+
require_relative 'sass/info'
|
71
72
|
require_relative 'sass/render'
|
72
73
|
require_relative 'sass/embedded'
|
data/lib/sass/embedded.rb
CHANGED
@@ -23,7 +23,7 @@ module Sass
|
|
23
23
|
#
|
24
24
|
# @raise [ProtocolError]
|
25
25
|
def info
|
26
|
-
@info ||=
|
26
|
+
@info ||= VersionContext.new(@transport, next_id).receive_message
|
27
27
|
end
|
28
28
|
|
29
29
|
# The {Embedded#render} method.
|
@@ -55,16 +55,16 @@ module Sass
|
|
55
55
|
indent_width = parse_indent_width(indent_width)
|
56
56
|
linefeed = parse_linefeed(linefeed)
|
57
57
|
|
58
|
-
message =
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
58
|
+
message = RenderContext.new(@transport, next_id,
|
59
|
+
data: data,
|
60
|
+
file: file,
|
61
|
+
indented_syntax: indented_syntax,
|
62
|
+
include_paths: include_paths,
|
63
|
+
output_style: output_style,
|
64
|
+
source_map: source_map,
|
65
|
+
out_file: out_file,
|
66
|
+
functions: functions,
|
67
|
+
importer: importer).receive_message
|
68
68
|
|
69
69
|
if message.failure
|
70
70
|
raise RenderError.new(
|
@@ -75,7 +75,7 @@ module Sass
|
|
75
75
|
elsif message.failure.span.url == ''
|
76
76
|
'stdin'
|
77
77
|
else
|
78
|
-
Util.
|
78
|
+
Util.path_from_file_uri(message.failure.span.url)
|
79
79
|
end,
|
80
80
|
message.failure.span ? message.failure.span.start.line + 1 : nil,
|
81
81
|
message.failure.span ? message.failure.span.start.column + 1 : nil,
|
@@ -138,7 +138,7 @@ module Sass
|
|
138
138
|
source_map_dir = File.dirname(source_map_path)
|
139
139
|
|
140
140
|
if out_file
|
141
|
-
map_data['file'] = Util.
|
141
|
+
map_data['file'] = Util.relative_path(source_map_dir, out_file)
|
142
142
|
elsif file
|
143
143
|
ext = File.extname(file)
|
144
144
|
map_data['file'] = "#{file[0..(ext.empty? ? -1 : -ext.length - 1)]}.css"
|
@@ -149,10 +149,10 @@ module Sass
|
|
149
149
|
map_data['sourcesContent'] = [] if source_map_contents
|
150
150
|
|
151
151
|
map_data['sources'].map! do |source|
|
152
|
-
if source.start_with?
|
153
|
-
path = Util.
|
152
|
+
if source.start_with? 'file://'
|
153
|
+
path = Util.path_from_file_uri(source)
|
154
154
|
map_data['sourcesContent'].push(File.read(path)) if source_map_contents
|
155
|
-
Util.
|
155
|
+
Util.relative_path(source_map_dir, path)
|
156
156
|
else
|
157
157
|
map_data['sourcesContent'].push(nil) if source_map_contents
|
158
158
|
source
|
@@ -184,7 +184,7 @@ module Sass
|
|
184
184
|
url = if source_map_embed
|
185
185
|
"data:application/json;base64,#{Base64.strict_encode64(map)}"
|
186
186
|
elsif out_file
|
187
|
-
Util.
|
187
|
+
Util.relative_path(File.dirname(out_file), source_map)
|
188
188
|
else
|
189
189
|
source_map
|
190
190
|
end
|
data/lib/sass/info.rb
CHANGED
data/lib/sass/observer.rb
CHANGED
data/lib/sass/render.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Sass
|
4
4
|
# The {Observer} for {Embedded#render}.
|
5
|
-
class
|
5
|
+
class RenderContext
|
6
6
|
include Observer
|
7
7
|
|
8
8
|
def initialize(transport, id,
|
@@ -97,7 +97,7 @@ module Sass
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def canonicalize_response(canonicalize_request)
|
100
|
-
url = Util.
|
100
|
+
url = Util.file_uri_from_path(File.absolute_path(canonicalize_request.url, (@file.nil? ? 'stdin' : @file)))
|
101
101
|
|
102
102
|
begin
|
103
103
|
result = @importer[canonicalize_request.importer_id].call canonicalize_request.url, @file
|
@@ -123,7 +123,7 @@ module Sass
|
|
123
123
|
url: url
|
124
124
|
)
|
125
125
|
elsif result&.key? :file
|
126
|
-
canonicalized_url = Util.
|
126
|
+
canonicalized_url = Util.file_uri_from_path(result[:file])
|
127
127
|
|
128
128
|
# TODO: FileImportRequest is not supported yet.
|
129
129
|
# Workaround by reading contents and return it when server asks
|
@@ -185,7 +185,7 @@ module Sass
|
|
185
185
|
def url
|
186
186
|
return if @file.nil?
|
187
187
|
|
188
|
-
Util.
|
188
|
+
Util.file_uri_from_path @file
|
189
189
|
end
|
190
190
|
|
191
191
|
def string
|
data/lib/sass/transport.rb
CHANGED
@@ -24,12 +24,18 @@ module Sass
|
|
24
24
|
[field_descriptor.subtype, field_descriptor.name]
|
25
25
|
end.to_h
|
26
26
|
|
27
|
+
private_constant :ONEOF_MESSAGE
|
28
|
+
|
27
29
|
def initialize
|
28
30
|
@observerable_mutex = Mutex.new
|
29
31
|
@stdin_mutex = Mutex.new
|
30
32
|
@stdin, @stdout, @stderr, @wait_thread = Open3.popen3(DART_SASS_EMBEDDED)
|
31
|
-
|
32
|
-
|
33
|
+
poll do
|
34
|
+
$stderr.write @stderr.readline
|
35
|
+
end
|
36
|
+
poll do
|
37
|
+
receive_proto read
|
38
|
+
end
|
33
39
|
end
|
34
40
|
|
35
41
|
def add_observer(*args)
|
@@ -58,44 +64,37 @@ module Sass
|
|
58
64
|
|
59
65
|
private
|
60
66
|
|
61
|
-
def
|
62
|
-
@observerable_mutex.synchronize do
|
63
|
-
changed
|
64
|
-
notify_observers error, message
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def pipe(readable, writeable)
|
67
|
+
def poll
|
69
68
|
Thread.new do
|
70
69
|
loop do
|
71
|
-
|
70
|
+
yield
|
72
71
|
rescue Interrupt
|
73
72
|
break
|
74
73
|
rescue IOError => e
|
75
|
-
|
74
|
+
notify_observers(e, nil)
|
76
75
|
close
|
77
76
|
break
|
78
77
|
end
|
79
78
|
end
|
80
79
|
end
|
81
80
|
|
82
|
-
def
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
payload = readable.read(length)
|
87
|
-
message = EmbeddedProtocol::OutboundMessage.decode payload
|
88
|
-
receive_message(nil, message[message.message.to_s])
|
89
|
-
rescue Interrupt
|
90
|
-
break
|
91
|
-
rescue IOError => e
|
92
|
-
receive_message(e, nil)
|
93
|
-
close
|
94
|
-
break
|
95
|
-
end
|
81
|
+
def notify_observers(*args)
|
82
|
+
@observerable_mutex.synchronize do
|
83
|
+
changed
|
84
|
+
super(*args)
|
96
85
|
end
|
97
86
|
end
|
98
87
|
|
88
|
+
def receive_proto(proto)
|
89
|
+
message = EmbeddedProtocol::OutboundMessage.decode(proto)
|
90
|
+
notify_observers(nil, message[message.message.to_s])
|
91
|
+
end
|
92
|
+
|
93
|
+
def read
|
94
|
+
length = read_varint(@stdout)
|
95
|
+
@stdout.read(length)
|
96
|
+
end
|
97
|
+
|
99
98
|
def write(payload)
|
100
99
|
@stdin_mutex.synchronize do
|
101
100
|
write_varint(@stdin, payload.length)
|
data/lib/sass/util.rb
CHANGED
@@ -1,39 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'pathname'
|
4
|
+
require 'uri'
|
4
5
|
|
5
6
|
module Sass
|
6
7
|
# The {Util} module.
|
7
8
|
module Util
|
8
9
|
module_function
|
9
10
|
|
10
|
-
|
11
|
+
URI_PARSER = URI::Parser.new({ RESERVED: ';/?:@&=+$,' })
|
11
12
|
|
12
|
-
|
13
|
+
private_constant :URI_PARSER
|
14
|
+
|
15
|
+
def file_uri_from_path(path)
|
13
16
|
absolute_path = File.absolute_path(path)
|
14
17
|
|
15
|
-
unless absolute_path.start_with? File::SEPARATOR
|
16
|
-
components = absolute_path.split File::SEPARATOR
|
17
|
-
components[0] = components[0][0].downcase
|
18
|
-
absolute_path = components.join File::SEPARATOR
|
19
|
-
end
|
18
|
+
absolute_path = File::SEPARATOR + absolute_path unless absolute_path.start_with? File::SEPARATOR
|
20
19
|
|
21
|
-
"
|
20
|
+
URI_PARSER.escape("file://#{absolute_path}")
|
22
21
|
end
|
23
22
|
|
24
|
-
def
|
25
|
-
|
26
|
-
|
27
|
-
unless absolute_path.start_with? File::SEPARATOR
|
28
|
-
components = absolute_path.split File::SEPARATOR
|
29
|
-
components[0] = "#{components[0].upcase}:"
|
30
|
-
absolute_path = components.join File::SEPARATOR
|
31
|
-
end
|
32
|
-
|
33
|
-
absolute_path
|
23
|
+
def path_from_file_uri(file_uri)
|
24
|
+
URI_PARSER.unescape(file_uri)[7..]
|
34
25
|
end
|
35
26
|
|
36
|
-
def
|
27
|
+
def relative_path(from, to)
|
37
28
|
Pathname.new(File.absolute_path(to)).relative_path_from(Pathname.new(File.absolute_path(from))).to_s
|
38
29
|
end
|
39
30
|
|
data/lib/sass/version.rb
CHANGED
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: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- なつき
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -136,7 +136,8 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
description:
|
139
|
+
description: A Ruby library that will communicate with Embedded Dart Sass using the
|
140
|
+
Embedded Sass protocol.
|
140
141
|
email:
|
141
142
|
- i@ntk.me
|
142
143
|
executables: []
|
@@ -144,14 +145,8 @@ extensions:
|
|
144
145
|
- ext/extconf.rb
|
145
146
|
extra_rdoc_files: []
|
146
147
|
files:
|
147
|
-
- ".github/workflows/build.yml"
|
148
|
-
- ".gitignore"
|
149
|
-
- ".rubocop.yml"
|
150
|
-
- Gemfile
|
151
148
|
- LICENSE
|
152
149
|
- README.md
|
153
|
-
- Rakefile
|
154
|
-
- ext/.gitignore
|
155
150
|
- ext/Makefile
|
156
151
|
- ext/extconf.rb
|
157
152
|
- lib/sass.rb
|
@@ -166,22 +161,11 @@ files:
|
|
166
161
|
- lib/sass/transport.rb
|
167
162
|
- lib/sass/util.rb
|
168
163
|
- lib/sass/version.rb
|
169
|
-
- sass-embedded.gemspec
|
170
|
-
- test/concurrency_test.rb
|
171
|
-
- test/functions_test.rb
|
172
|
-
- test/importer_test.rb
|
173
|
-
- test/include_paths_test.rb
|
174
|
-
- test/indented_syntax_test.rb
|
175
|
-
- test/input_test.rb
|
176
|
-
- test/output_test.rb
|
177
|
-
- test/render_error_test.rb
|
178
|
-
- test/render_test.rb
|
179
|
-
- test/source_maps_test.rb
|
180
|
-
- test/test_helper.rb
|
181
164
|
homepage: https://github.com/ntkme/sass-embedded-host-ruby
|
182
165
|
licenses:
|
183
166
|
- MIT
|
184
|
-
metadata:
|
167
|
+
metadata:
|
168
|
+
source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v0.7.6
|
185
169
|
post_install_message:
|
186
170
|
rdoc_options: []
|
187
171
|
require_paths:
|
@@ -201,15 +185,4 @@ rubygems_version: 3.2.15
|
|
201
185
|
signing_key:
|
202
186
|
specification_version: 4
|
203
187
|
summary: Use dart-sass with Ruby!
|
204
|
-
test_files:
|
205
|
-
- test/concurrency_test.rb
|
206
|
-
- test/functions_test.rb
|
207
|
-
- test/importer_test.rb
|
208
|
-
- test/include_paths_test.rb
|
209
|
-
- test/indented_syntax_test.rb
|
210
|
-
- test/input_test.rb
|
211
|
-
- test/output_test.rb
|
212
|
-
- test/render_error_test.rb
|
213
|
-
- test/render_test.rb
|
214
|
-
- test/source_maps_test.rb
|
215
|
-
- test/test_helper.rb
|
188
|
+
test_files: []
|
data/.github/workflows/build.yml
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
name: build
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ main ]
|
6
|
-
pull_request:
|
7
|
-
branches: [ main ]
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
build:
|
11
|
-
|
12
|
-
runs-on: ${{ matrix.os }}
|
13
|
-
|
14
|
-
strategy:
|
15
|
-
matrix:
|
16
|
-
os: [macos-latest, ubuntu-latest, windows-latest]
|
17
|
-
ruby-version: ['2.6', '2.7', '3.0']
|
18
|
-
|
19
|
-
steps:
|
20
|
-
- name: Checkout
|
21
|
-
uses: actions/checkout@v2
|
22
|
-
|
23
|
-
- name: Set up Ruby
|
24
|
-
uses: ruby/setup-ruby@v1
|
25
|
-
with:
|
26
|
-
ruby-version: ${{ matrix.ruby-version }}
|
27
|
-
bundler-cache: true
|
28
|
-
|
29
|
-
- name: Download dart-sass-embedded
|
30
|
-
run: bundle exec rake extconf
|
31
|
-
env:
|
32
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
33
|
-
|
34
|
-
- name: Test
|
35
|
-
run: bundle exec rake
|
36
|
-
|
37
|
-
- name: Install Gem
|
38
|
-
run: rake install
|
39
|
-
env:
|
40
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
41
|
-
|
42
|
-
- name: Test Gem
|
43
|
-
run: |-
|
44
|
-
ruby -r sass -e "puts Sass.render(data: 'h1 { color: black; }')[:css]"
|
data/.gitignore
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
/.config
|
4
|
-
/coverage/
|
5
|
-
/InstalledFiles
|
6
|
-
/pkg/
|
7
|
-
/spec/reports/
|
8
|
-
/spec/examples.txt
|
9
|
-
/test/tmp/
|
10
|
-
/test/version_tmp/
|
11
|
-
/tmp/
|
12
|
-
|
13
|
-
# Used by dotenv library to load environment variables.
|
14
|
-
# .env
|
15
|
-
|
16
|
-
# Ignore Byebug command history file.
|
17
|
-
.byebug_history
|
18
|
-
|
19
|
-
## Specific to RubyMotion:
|
20
|
-
.dat*
|
21
|
-
.repl_history
|
22
|
-
build/
|
23
|
-
*.bridgesupport
|
24
|
-
build-iPhoneOS/
|
25
|
-
build-iPhoneSimulator/
|
26
|
-
|
27
|
-
## Documentation cache and generated files:
|
28
|
-
/.yardoc/
|
29
|
-
/_yardoc/
|
30
|
-
/doc/
|
31
|
-
/rdoc/
|
32
|
-
|
33
|
-
## Environment normalization:
|
34
|
-
/.bundle/
|
35
|
-
/vendor/bundle
|
36
|
-
/lib/bundler/man/
|
37
|
-
|
38
|
-
# for a library or gem, you might want to ignore these files since the code is
|
39
|
-
# intended to run in multiple environments; otherwise, check them in:
|
40
|
-
/Gemfile.lock
|
41
|
-
/.ruby-version
|
42
|
-
/.ruby-gemset
|
43
|
-
|
44
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
45
|
-
.rvmrc
|