sassc 2.2.1-x64-mingw32 → 2.3.0-x64-mingw32
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/.travis.yml +1 -0
- data/CHANGELOG.md +13 -0
- data/Rakefile +1 -3
- data/lib/sassc/engine.rb +5 -3
- data/lib/sassc/functions_handler.rb +8 -8
- data/lib/sassc/native.rb +1 -1
- data/lib/sassc/script.rb +4 -4
- data/lib/sassc/version.rb +1 -1
- data/test/functions_test.rb +18 -1
- data/test/native_test.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6bc1ff62c2fab790b9ad7fb95bd254fcb68240d77550d2b8f15d458a6159284
|
4
|
+
data.tar.gz: d2e0f83641bda9242b3e470ebf915f177429fd1223b64ccf0287fe734513c389
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b3f194e898c456a7bcf8e6be76ed0dc848bbd1d7e370f9aac689e4ccb3c5c93c43644ac61dfb81c660c83dda3b75a39d94668f9743d00900534234f999c51d9
|
7
|
+
data.tar.gz: 06ada6adeb32fddc828e45347b53172bc4dbe3ed7abf6d4b9c6725447c1baa8f93b09fe8f9c8bb289e9a4b3ca02b2e871848887ad09b5ebc7d24c6bad8009a07
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
- **2.3.0**
|
2
|
+
- [Fix rake gem:native task](https://github.com/sass/sassc-ruby/pull/196)
|
3
|
+
- [disable lto flag for darwin + nix](https://github.com/sass/sassc-ruby/pull/166)
|
4
|
+
- [Sort input file list](https://github.com/sass/sassc-ruby/pull/178)
|
5
|
+
- [Set appropriate encoding for source_map](https://github.com/sass/sassc-ruby/pull/152)
|
6
|
+
- [allow passing functions directly](https://github.com/sass/sassc-ruby/pull/162)
|
7
|
+
- [always dispose data context](https://github.com/sass/sassc-ruby/pull/161)
|
8
|
+
- [Update libsass to 3.6.3](https://github.com/sass/sassc-ruby/pull/164)
|
9
|
+
- [Restore strip symbols](https://github.com/sass/sassc-ruby/pull/184)
|
10
|
+
- [Default --march-tune-native to false](https://github.com/sass/sassc-ruby/pull/158)
|
11
|
+
- [Fix compile issue on Mac OS X](https://github.com/sass/sassc-ruby/pull/174)
|
12
|
+
- [Test on TruffleRuby in TravisCI](https://github.com/sass/sassc-ruby/pull/171)
|
13
|
+
- [Use RbConfig::MAKEFILE_CONFIG['DLEXT'] instead of hardcoding extensions](https://github.com/sass/sassc-ruby/pull/173)
|
1
14
|
- **2.2.1**
|
2
15
|
- [Fix LoadError on some non-rvm environments](https://github.com/sass/sassc-ruby/pull/156)
|
3
16
|
- **2.2.0**
|
data/Rakefile
CHANGED
@@ -36,9 +36,7 @@ task 'gem:native' do
|
|
36
36
|
|
37
37
|
# The RUBY_CC_VERSION here doesn't matter for the final package.
|
38
38
|
# Only one version should be specified, as the shared library is Ruby-agnostic.
|
39
|
-
|
40
|
-
# g++-multilib is installed for 64->32-bit cross-compilation.
|
41
|
-
RakeCompilerDock.sh "sudo apt-get install -y g++-multilib && gem i rake bundler --no-document && bundle && "\
|
39
|
+
RakeCompilerDock.sh "gem i rake bundler --no-document && bundle && "\
|
42
40
|
"rake clean && rake cross native gem MAKE='nice make -j`nproc`' "\
|
43
41
|
"RUBY_CC_VERSION=2.6.0 CLEAN=1"
|
44
42
|
end
|
data/lib/sassc/engine.rb
CHANGED
@@ -16,6 +16,7 @@ module SassC
|
|
16
16
|
def initialize(template, options = {})
|
17
17
|
@template = template
|
18
18
|
@options = options
|
19
|
+
@functions = options.fetch(:functions, Script::Functions)
|
19
20
|
end
|
20
21
|
|
21
22
|
def render
|
@@ -37,7 +38,7 @@ module SassC
|
|
37
38
|
Native.option_set_omit_source_map_url(native_options, true) if omit_source_map_url?
|
38
39
|
|
39
40
|
import_handler.setup(native_options)
|
40
|
-
functions_handler.setup(native_options)
|
41
|
+
functions_handler.setup(native_options, functions: @functions)
|
41
42
|
|
42
43
|
status = Native.compile_data_context(data_context)
|
43
44
|
|
@@ -54,11 +55,12 @@ module SassC
|
|
54
55
|
@dependencies = Native.context_get_included_files(context)
|
55
56
|
@source_map = Native.context_get_source_map_string(context)
|
56
57
|
|
57
|
-
Native.delete_data_context(data_context)
|
58
|
-
|
59
58
|
css.force_encoding(@template.encoding)
|
59
|
+
@source_map.force_encoding(@template.encoding) if @source_map.is_a?(String)
|
60
60
|
|
61
61
|
return css unless quiet?
|
62
|
+
ensure
|
63
|
+
Native.delete_data_context(data_context) if data_context
|
62
64
|
end
|
63
65
|
|
64
66
|
def dependencies
|
@@ -6,24 +6,24 @@ module SassC
|
|
6
6
|
@options = options
|
7
7
|
end
|
8
8
|
|
9
|
-
def setup(native_options)
|
9
|
+
def setup(native_options, functions: Script::Functions)
|
10
10
|
@callbacks = {}
|
11
11
|
@function_names = {}
|
12
12
|
|
13
|
-
list = Native.make_function_list(Script.custom_functions.count)
|
13
|
+
list = Native.make_function_list(Script.custom_functions(functions: functions).count)
|
14
14
|
|
15
15
|
# use an anonymous class wrapper to avoid mutations in a threaded environment
|
16
|
-
|
16
|
+
functions_wrapper = Class.new do
|
17
17
|
attr_accessor :options
|
18
|
-
include
|
18
|
+
include functions
|
19
19
|
end.new
|
20
|
-
|
20
|
+
functions_wrapper.options = @options
|
21
21
|
|
22
|
-
Script.custom_functions.each_with_index do |custom_function, i|
|
22
|
+
Script.custom_functions(functions: functions).each_with_index do |custom_function, i|
|
23
23
|
@callbacks[custom_function] = FFI::Function.new(:pointer, [:pointer, :pointer]) do |native_argument_list, cookie|
|
24
24
|
begin
|
25
25
|
function_arguments = arguments_from_native_list(native_argument_list)
|
26
|
-
result =
|
26
|
+
result = functions_wrapper.send(custom_function, *function_arguments)
|
27
27
|
to_native_value(result)
|
28
28
|
rescue StandardError => exception
|
29
29
|
# This rescues any exceptions that occur either in value conversion
|
@@ -32,7 +32,7 @@ module SassC
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
@function_names[custom_function] = Script.formatted_function_name(custom_function)
|
35
|
+
@function_names[custom_function] = Script.formatted_function_name(custom_function, functions: functions)
|
36
36
|
|
37
37
|
callback = Native.make_function(
|
38
38
|
@function_names[custom_function],
|
data/lib/sassc/native.rb
CHANGED
@@ -6,7 +6,7 @@ module SassC
|
|
6
6
|
module Native
|
7
7
|
extend FFI::Library
|
8
8
|
|
9
|
-
dl_ext =
|
9
|
+
dl_ext = RbConfig::MAKEFILE_CONFIG['DLEXT']
|
10
10
|
begin
|
11
11
|
ffi_lib File.expand_path("libsass.#{dl_ext}", __dir__)
|
12
12
|
rescue LoadError # Some non-rvm environments don't copy a shared object over to lib/sassc
|
data/lib/sassc/script.rb
CHANGED
@@ -3,12 +3,12 @@
|
|
3
3
|
module SassC
|
4
4
|
module Script
|
5
5
|
|
6
|
-
def self.custom_functions
|
7
|
-
|
6
|
+
def self.custom_functions(functions: Functions)
|
7
|
+
functions.public_instance_methods
|
8
8
|
end
|
9
9
|
|
10
|
-
def self.formatted_function_name(function_name)
|
11
|
-
params =
|
10
|
+
def self.formatted_function_name(function_name, functions: Functions)
|
11
|
+
params = functions.instance_method(function_name).parameters
|
12
12
|
params = params.map { |param_type, name| "$#{name}#{': null' if param_type == :opt}" }.join(", ")
|
13
13
|
return "#{function_name}(#{params})"
|
14
14
|
end
|
data/lib/sassc/version.rb
CHANGED
data/test/functions_test.rb
CHANGED
@@ -140,7 +140,7 @@ module SassC
|
|
140
140
|
|
141
141
|
assert_match /Error: error in C function function_that_raises_errors/, exception.message
|
142
142
|
assert_match /Intentional wrong thing happened somewhere inside the custom function/, exception.message
|
143
|
-
|
143
|
+
assert_match /\[SassC::FunctionsHandler\] Intentional wrong thing happened somewhere inside the custom function/, stderr_output
|
144
144
|
end
|
145
145
|
|
146
146
|
def test_function_that_returns_a_sass_value
|
@@ -201,6 +201,17 @@ module SassC
|
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
|
+
def test_pass_custom_functions_as_a_parameter
|
205
|
+
out = Engine.new("div { url: test-function(); }", {functions: ExternalFunctions}).render
|
206
|
+
assert_match /custom_function/, out
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_pass_incompatible_type_to_custom_functions
|
210
|
+
assert_raises(TypeError) do
|
211
|
+
Engine.new("div { url: test-function(); }", {functions: Class.new}).render
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
204
215
|
private
|
205
216
|
|
206
217
|
def assert_sass(sass, expected_css)
|
@@ -319,5 +330,11 @@ module SassC
|
|
319
330
|
|
320
331
|
end
|
321
332
|
|
333
|
+
module ExternalFunctions
|
334
|
+
def test_function
|
335
|
+
SassC::Script::Value::String.new("custom_function", :string)
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
322
339
|
end
|
323
340
|
end
|
data/test/native_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sassc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: x64-mingw32
|
6
6
|
authors:
|
7
7
|
- Ryan Boland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -219,8 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
219
|
- !ruby/object:Gem::Version
|
220
220
|
version: '0'
|
221
221
|
requirements: []
|
222
|
-
|
223
|
-
rubygems_version: 2.7.9
|
222
|
+
rubygems_version: 3.1.2
|
224
223
|
signing_key:
|
225
224
|
specification_version: 4
|
226
225
|
summary: Use libsass with Ruby!
|