sassc4 2.4.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.
Files changed (216) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.gitmodules +3 -0
  4. data/.travis.yml +16 -0
  5. data/CHANGELOG.md +97 -0
  6. data/CODE_OF_CONDUCT.md +10 -0
  7. data/Gemfile +2 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +80 -0
  10. data/Rakefile +51 -0
  11. data/ext/depend +4 -0
  12. data/ext/extconf.rb +92 -0
  13. data/ext/libsass/VERSION +1 -0
  14. data/ext/libsass/contrib/plugin.cpp +60 -0
  15. data/ext/libsass/include/sass/base.h +97 -0
  16. data/ext/libsass/include/sass/context.h +174 -0
  17. data/ext/libsass/include/sass/functions.h +139 -0
  18. data/ext/libsass/include/sass/values.h +145 -0
  19. data/ext/libsass/include/sass/version.h +12 -0
  20. data/ext/libsass/include/sass.h +15 -0
  21. data/ext/libsass/include/sass2scss.h +120 -0
  22. data/ext/libsass/src/MurmurHash2.hpp +91 -0
  23. data/ext/libsass/src/ast.cpp +953 -0
  24. data/ext/libsass/src/ast.hpp +1064 -0
  25. data/ext/libsass/src/ast2c.cpp +80 -0
  26. data/ext/libsass/src/ast2c.hpp +39 -0
  27. data/ext/libsass/src/ast_def_macros.hpp +140 -0
  28. data/ext/libsass/src/ast_fwd_decl.cpp +31 -0
  29. data/ext/libsass/src/ast_fwd_decl.hpp +274 -0
  30. data/ext/libsass/src/ast_helpers.hpp +316 -0
  31. data/ext/libsass/src/ast_sel_cmp.cpp +396 -0
  32. data/ext/libsass/src/ast_sel_super.cpp +539 -0
  33. data/ext/libsass/src/ast_sel_unify.cpp +275 -0
  34. data/ext/libsass/src/ast_sel_weave.cpp +616 -0
  35. data/ext/libsass/src/ast_selectors.cpp +1070 -0
  36. data/ext/libsass/src/ast_selectors.hpp +523 -0
  37. data/ext/libsass/src/ast_supports.cpp +114 -0
  38. data/ext/libsass/src/ast_supports.hpp +121 -0
  39. data/ext/libsass/src/ast_values.cpp +1154 -0
  40. data/ext/libsass/src/ast_values.hpp +498 -0
  41. data/ext/libsass/src/b64/cencode.h +32 -0
  42. data/ext/libsass/src/b64/encode.h +79 -0
  43. data/ext/libsass/src/backtrace.cpp +50 -0
  44. data/ext/libsass/src/backtrace.hpp +29 -0
  45. data/ext/libsass/src/base64vlq.cpp +47 -0
  46. data/ext/libsass/src/base64vlq.hpp +30 -0
  47. data/ext/libsass/src/bind.cpp +312 -0
  48. data/ext/libsass/src/bind.hpp +15 -0
  49. data/ext/libsass/src/c2ast.cpp +64 -0
  50. data/ext/libsass/src/c2ast.hpp +14 -0
  51. data/ext/libsass/src/c99func.c +54 -0
  52. data/ext/libsass/src/cencode.c +106 -0
  53. data/ext/libsass/src/check_nesting.cpp +393 -0
  54. data/ext/libsass/src/check_nesting.hpp +70 -0
  55. data/ext/libsass/src/color_maps.cpp +652 -0
  56. data/ext/libsass/src/color_maps.hpp +323 -0
  57. data/ext/libsass/src/color_spaces.cpp +241 -0
  58. data/ext/libsass/src/color_spaces.hpp +227 -0
  59. data/ext/libsass/src/constants.cpp +199 -0
  60. data/ext/libsass/src/constants.hpp +200 -0
  61. data/ext/libsass/src/context.cpp +870 -0
  62. data/ext/libsass/src/context.hpp +140 -0
  63. data/ext/libsass/src/cssize.cpp +521 -0
  64. data/ext/libsass/src/cssize.hpp +71 -0
  65. data/ext/libsass/src/dart_helpers.hpp +199 -0
  66. data/ext/libsass/src/debug.hpp +43 -0
  67. data/ext/libsass/src/debugger.hpp +964 -0
  68. data/ext/libsass/src/emitter.cpp +297 -0
  69. data/ext/libsass/src/emitter.hpp +101 -0
  70. data/ext/libsass/src/environment.cpp +260 -0
  71. data/ext/libsass/src/environment.hpp +124 -0
  72. data/ext/libsass/src/error_handling.cpp +239 -0
  73. data/ext/libsass/src/error_handling.hpp +248 -0
  74. data/ext/libsass/src/eval.cpp +1543 -0
  75. data/ext/libsass/src/eval.hpp +110 -0
  76. data/ext/libsass/src/eval_selectors.cpp +75 -0
  77. data/ext/libsass/src/expand.cpp +875 -0
  78. data/ext/libsass/src/expand.hpp +98 -0
  79. data/ext/libsass/src/extender.cpp +1226 -0
  80. data/ext/libsass/src/extender.hpp +399 -0
  81. data/ext/libsass/src/extension.cpp +43 -0
  82. data/ext/libsass/src/extension.hpp +89 -0
  83. data/ext/libsass/src/file.cpp +531 -0
  84. data/ext/libsass/src/file.hpp +124 -0
  85. data/ext/libsass/src/fn_colors.cpp +836 -0
  86. data/ext/libsass/src/fn_colors.hpp +99 -0
  87. data/ext/libsass/src/fn_lists.cpp +285 -0
  88. data/ext/libsass/src/fn_lists.hpp +34 -0
  89. data/ext/libsass/src/fn_maps.cpp +94 -0
  90. data/ext/libsass/src/fn_maps.hpp +30 -0
  91. data/ext/libsass/src/fn_miscs.cpp +248 -0
  92. data/ext/libsass/src/fn_miscs.hpp +40 -0
  93. data/ext/libsass/src/fn_numbers.cpp +246 -0
  94. data/ext/libsass/src/fn_numbers.hpp +45 -0
  95. data/ext/libsass/src/fn_selectors.cpp +205 -0
  96. data/ext/libsass/src/fn_selectors.hpp +35 -0
  97. data/ext/libsass/src/fn_strings.cpp +268 -0
  98. data/ext/libsass/src/fn_strings.hpp +34 -0
  99. data/ext/libsass/src/fn_utils.cpp +159 -0
  100. data/ext/libsass/src/fn_utils.hpp +62 -0
  101. data/ext/libsass/src/inspect.cpp +1126 -0
  102. data/ext/libsass/src/inspect.hpp +101 -0
  103. data/ext/libsass/src/json.cpp +1436 -0
  104. data/ext/libsass/src/json.hpp +117 -0
  105. data/ext/libsass/src/kwd_arg_macros.hpp +28 -0
  106. data/ext/libsass/src/lexer.cpp +122 -0
  107. data/ext/libsass/src/lexer.hpp +304 -0
  108. data/ext/libsass/src/listize.cpp +70 -0
  109. data/ext/libsass/src/listize.hpp +37 -0
  110. data/ext/libsass/src/mapping.hpp +19 -0
  111. data/ext/libsass/src/memory/allocator.cpp +48 -0
  112. data/ext/libsass/src/memory/allocator.hpp +138 -0
  113. data/ext/libsass/src/memory/config.hpp +20 -0
  114. data/ext/libsass/src/memory/memory_pool.hpp +186 -0
  115. data/ext/libsass/src/memory/shared_ptr.cpp +33 -0
  116. data/ext/libsass/src/memory/shared_ptr.hpp +332 -0
  117. data/ext/libsass/src/memory.hpp +12 -0
  118. data/ext/libsass/src/operation.hpp +223 -0
  119. data/ext/libsass/src/operators.cpp +267 -0
  120. data/ext/libsass/src/operators.hpp +30 -0
  121. data/ext/libsass/src/ordered_map.hpp +112 -0
  122. data/ext/libsass/src/output.cpp +320 -0
  123. data/ext/libsass/src/output.hpp +47 -0
  124. data/ext/libsass/src/parser.cpp +3059 -0
  125. data/ext/libsass/src/parser.hpp +395 -0
  126. data/ext/libsass/src/parser_selectors.cpp +189 -0
  127. data/ext/libsass/src/permutate.hpp +164 -0
  128. data/ext/libsass/src/plugins.cpp +188 -0
  129. data/ext/libsass/src/plugins.hpp +57 -0
  130. data/ext/libsass/src/position.cpp +163 -0
  131. data/ext/libsass/src/position.hpp +147 -0
  132. data/ext/libsass/src/prelexer.cpp +1780 -0
  133. data/ext/libsass/src/prelexer.hpp +484 -0
  134. data/ext/libsass/src/remove_placeholders.cpp +86 -0
  135. data/ext/libsass/src/remove_placeholders.hpp +37 -0
  136. data/ext/libsass/src/sass.cpp +156 -0
  137. data/ext/libsass/src/sass.hpp +147 -0
  138. data/ext/libsass/src/sass2scss.cpp +895 -0
  139. data/ext/libsass/src/sass_context.cpp +742 -0
  140. data/ext/libsass/src/sass_context.hpp +129 -0
  141. data/ext/libsass/src/sass_functions.cpp +210 -0
  142. data/ext/libsass/src/sass_functions.hpp +50 -0
  143. data/ext/libsass/src/sass_values.cpp +362 -0
  144. data/ext/libsass/src/sass_values.hpp +82 -0
  145. data/ext/libsass/src/settings.hpp +19 -0
  146. data/ext/libsass/src/source.cpp +69 -0
  147. data/ext/libsass/src/source.hpp +95 -0
  148. data/ext/libsass/src/source_data.hpp +32 -0
  149. data/ext/libsass/src/source_map.cpp +202 -0
  150. data/ext/libsass/src/source_map.hpp +65 -0
  151. data/ext/libsass/src/stylesheet.cpp +22 -0
  152. data/ext/libsass/src/stylesheet.hpp +57 -0
  153. data/ext/libsass/src/to_value.cpp +114 -0
  154. data/ext/libsass/src/to_value.hpp +46 -0
  155. data/ext/libsass/src/units.cpp +507 -0
  156. data/ext/libsass/src/units.hpp +110 -0
  157. data/ext/libsass/src/utf8/checked.h +336 -0
  158. data/ext/libsass/src/utf8/core.h +332 -0
  159. data/ext/libsass/src/utf8/unchecked.h +235 -0
  160. data/ext/libsass/src/utf8.h +34 -0
  161. data/ext/libsass/src/utf8_string.cpp +104 -0
  162. data/ext/libsass/src/utf8_string.hpp +38 -0
  163. data/ext/libsass/src/util.cpp +723 -0
  164. data/ext/libsass/src/util.hpp +105 -0
  165. data/ext/libsass/src/util_string.cpp +125 -0
  166. data/ext/libsass/src/util_string.hpp +73 -0
  167. data/ext/libsass/src/values.cpp +140 -0
  168. data/ext/libsass/src/values.hpp +12 -0
  169. data/lib/sassc/dependency.rb +17 -0
  170. data/lib/sassc/engine.rb +141 -0
  171. data/lib/sassc/error.rb +37 -0
  172. data/lib/sassc/functions_handler.rb +73 -0
  173. data/lib/sassc/import_handler.rb +50 -0
  174. data/lib/sassc/importer.rb +31 -0
  175. data/lib/sassc/native/native_context_api.rb +147 -0
  176. data/lib/sassc/native/native_functions_api.rb +159 -0
  177. data/lib/sassc/native/sass2scss_api.rb +10 -0
  178. data/lib/sassc/native/sass_input_style.rb +13 -0
  179. data/lib/sassc/native/sass_output_style.rb +12 -0
  180. data/lib/sassc/native/sass_value.rb +97 -0
  181. data/lib/sassc/native/string_list.rb +10 -0
  182. data/lib/sassc/native.rb +64 -0
  183. data/lib/sassc/sass_2_scss.rb +9 -0
  184. data/lib/sassc/script/functions.rb +8 -0
  185. data/lib/sassc/script/value/bool.rb +32 -0
  186. data/lib/sassc/script/value/color.rb +95 -0
  187. data/lib/sassc/script/value/list.rb +136 -0
  188. data/lib/sassc/script/value/map.rb +69 -0
  189. data/lib/sassc/script/value/number.rb +389 -0
  190. data/lib/sassc/script/value/string.rb +96 -0
  191. data/lib/sassc/script/value.rb +137 -0
  192. data/lib/sassc/script/value_conversion/base.rb +13 -0
  193. data/lib/sassc/script/value_conversion/bool.rb +13 -0
  194. data/lib/sassc/script/value_conversion/color.rb +18 -0
  195. data/lib/sassc/script/value_conversion/list.rb +25 -0
  196. data/lib/sassc/script/value_conversion/map.rb +21 -0
  197. data/lib/sassc/script/value_conversion/number.rb +13 -0
  198. data/lib/sassc/script/value_conversion/string.rb +17 -0
  199. data/lib/sassc/script/value_conversion.rb +69 -0
  200. data/lib/sassc/script.rb +17 -0
  201. data/lib/sassc/util/normalized_map.rb +117 -0
  202. data/lib/sassc/util.rb +231 -0
  203. data/lib/sassc/version.rb +5 -0
  204. data/lib/sassc.rb +57 -0
  205. data/sassc.gemspec +69 -0
  206. data/test/css_color_level4_test.rb +168 -0
  207. data/test/custom_importer_test.rb +127 -0
  208. data/test/engine_test.rb +314 -0
  209. data/test/error_test.rb +29 -0
  210. data/test/fixtures/paths.scss +10 -0
  211. data/test/functions_test.rb +340 -0
  212. data/test/native_test.rb +213 -0
  213. data/test/output_style_test.rb +107 -0
  214. data/test/sass_2_scss_test.rb +14 -0
  215. data/test/test_helper.rb +45 -0
  216. metadata +396 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2a455f81f07c892972d2629d8dd1772beb98bcd5c4380309f891f512d49f4e6f
4
+ data.tar.gz: cc986690a8cd688316bc46525d856f0a158dac259706276d4a697d2229358077
5
+ SHA512:
6
+ metadata.gz: fa4e4a16e5ff9227f133dc99ab61303eab1ed63e2acf2d88324d2c22416df3350c447787406a2cd74b4901944f015a3d7e629289b73937f354b34a4d11bd5b95
7
+ data.tar.gz: 251ce370592156f87ab3d4962e3a5984b82b3c9f35df94d1770d84544ab8b25b5e3d7e1d2d8ab421c0fbb0865c87f3003f3fc92c6acebc7120c0153bfb47a3c5
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /.rvmrc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ *.bundle
12
+ *.so
13
+ *.o
14
+ *.a
15
+ *.gem
16
+ mkmf.log
17
+ vendor/bundle
18
+ /ext/Makefile
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "ext/libsass"]
2
+ path = ext/libsass
3
+ url = https://github.com/VladimirIvanin/libsass.git
data/.travis.yml ADDED
@@ -0,0 +1,16 @@
1
+ language: ruby
2
+
3
+ bundler_args: "--binstubs --standalone --without documentation --path ../bundle"
4
+ script: "bundle exec rake test"
5
+ rvm:
6
+ - 2.0.0
7
+ - 2.1.10
8
+ - 2.2.10
9
+ - 2.3.8
10
+ - 2.4.6
11
+ - 2.5.5
12
+ - 2.6.3
13
+ - 2.7.0
14
+ - truffleruby
15
+ notifications:
16
+ email: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,97 @@
1
+ - **2.4.0**
2
+ - [Update libsass to 3.6.4](https://github.com/sass/sassc-ruby/pull/199)
3
+ - [Use FFI::MemoryPointer instead of libc's malloc()](https://github.com/sass/sassc-ruby/pull/205)
4
+ - [Test against Ruby 2.7.0](https://github.com/sass/sassc-ruby/pull/193)
5
+
6
+ - **2.3.0**
7
+ - [Fix rake gem:native task](https://github.com/sass/sassc-ruby/pull/196)
8
+ - [disable lto flag for darwin + nix](https://github.com/sass/sassc-ruby/pull/166)
9
+ - [Sort input file list](https://github.com/sass/sassc-ruby/pull/178)
10
+ - [Set appropriate encoding for source_map](https://github.com/sass/sassc-ruby/pull/152)
11
+ - [allow passing functions directly](https://github.com/sass/sassc-ruby/pull/162)
12
+ - [always dispose data context](https://github.com/sass/sassc-ruby/pull/161)
13
+ - [Update libsass to 3.6.3](https://github.com/sass/sassc-ruby/pull/164)
14
+ - [Restore strip symbols](https://github.com/sass/sassc-ruby/pull/184)
15
+ - [Default --march-tune-native to false](https://github.com/sass/sassc-ruby/pull/158)
16
+ - [Fix compile issue on Mac OS X](https://github.com/sass/sassc-ruby/pull/174)
17
+ - [Test on TruffleRuby in TravisCI](https://github.com/sass/sassc-ruby/pull/171)
18
+ - [Use RbConfig::MAKEFILE_CONFIG['DLEXT'] instead of hardcoding extensions](https://github.com/sass/sassc-ruby/pull/173)
19
+ - **2.2.1**
20
+ - [Fix LoadError on some non-rvm environments](https://github.com/sass/sassc-ruby/pull/156)
21
+ - **2.2.0**
22
+ - [Do not build precompiled gems for Linux](https://github.com/sass/sassc-ruby/pull/145)
23
+ - **2.1.0**
24
+ - Equivalent to 2.1.0.pre3
25
+ - **2.1.0.pre3**
26
+ - [extconf.rb: Always write VERSION if we have .git](https://github.com/sass/sassc-ruby/pull/131)
27
+ - [Update libsass to 3.6.1](https://github.com/sass/sassc-ruby/pull/130)
28
+ - **2.1.0.pre2**
29
+ - [Reduce Ruby warnings](https://github.com/sass/sassc-ruby/pull/124)
30
+ - [prefer equal? to determine object identity](https://github.com/sass/sassc-ruby/pull/122)
31
+ - [Link C/C++ stdlib statically for binary gems](https://github.com/sass/sassc-ruby/pull/127)
32
+ - **2.1.0.pre1**
33
+ - [Update Libsass to 3.6.0](https://github.com/sass/sassc-ruby/pull/96/files)
34
+ - [Support old Ruby versions](https://github.com/sass/sassc-ruby/pull/117/files)
35
+ - **2.0.1**
36
+ - [Relax FFI dependency](https://github.com/sass/sassc-ruby/pull/102)
37
+ - **2.0.0**
38
+ - [Remove dependency on Ruby Sass](https://github.com/sass/sassc-ruby/pull/85)
39
+ - [frozen_string_literal all files](https://github.com/sass/sassc-ruby/pull/85)
40
+ - **1.12.1**
41
+ - [Downgrade to libsass 3.5.2 to fix css imports](https://github.com/sass/sassc-ruby/pull/81)
42
+ - **1.12.0**
43
+ - [Update Libsass to 3.5.4](https://github.com/sass/sassc-ruby/pull/78)
44
+ - [bundler is a development dependency](https://github.com/sass/sassc-ruby/pull/51)
45
+ - **1.11.4**
46
+ - Fix `Value::List` related issue with sass 3.5.0
47
+ - **1.11.3**
48
+ - [Require Sass::Deprecation module](https://github.com/sass/sassc-ruby/pull/68)
49
+ - **1.11.2**
50
+ - [Update to libsass 3.4.3](https://github.com/sass/sassc-ruby/pull/65)
51
+ - **1.11.1**
52
+ - [Update to libsass 3.4.1](https://github.com/sass/sassc-ruby/pull/61)
53
+ - **1.11.0**
54
+ - [Add support for lists in functions](https://github.com/sass/sassc-ruby/pull/55)
55
+ - [Update to libsass 3.4.0](https://github.com/sass/sassc-ruby/pull/57)
56
+ - **1.10.1**
57
+ - [Add sourcemap getter](https://github.com/sass/sassc-ruby/pull/48)
58
+ - **1.10.0**
59
+ - [Improved error messages](https://github.com/sass/sassc-ruby/pull/34)
60
+ - Update to Libsass 3.3.6
61
+ - **1.9.0**
62
+ - Support boolean script support
63
+ - **1.8.5**
64
+ - Update to Libsass 3.3.4
65
+ - **1.8.4**
66
+ - Update to Libsass 3.3.3
67
+ - **1.8.3**
68
+ - [Passing empty string into engine does not raise error](https://github.com/sass/sassc-ruby/pull/31)
69
+ - **1.8.2**
70
+ - Update to Libsass 3.3.2
71
+ - **1.8.1**
72
+ - Update to Libsass 3.3.1
73
+ - **1.8.0**
74
+ - Update to Libsass 3.3.0
75
+ - **1.8.0.pre2**
76
+ - Fix bug with looking up gem_path
77
+ - **1.8.0.pre1**
78
+ - [Update to Libsass 3.3.0-beta3](https://github.com/sass/sassc-ruby/pull/20)
79
+ - **1.7.1**
80
+ - Some updates to `Engine` API.
81
+ - **1.7.0**
82
+ - [Support Precision](https://github.com/sass/sassc-ruby/pull/19)
83
+ - **1.6.0**
84
+ - [Support Sass Color types](https://github.com/bolandrm/sassc-ruby/pull/14)
85
+ - [Support quoted strings](https://github.com/bolandrm/sassc-ruby/pull/13)
86
+ - [Improve custom function error handling](https://github.com/bolandrm/sassc-ruby/pull/15)
87
+ - **1.5.1**
88
+ - 2nd attempt at fixing compilation bug (issue [#12](https://github.com/bolandrm/sassc-ruby/issues/12))
89
+ - **1.5.0**
90
+ - Add support for inline source maps
91
+ - Fix compilation bug (issue [#12](https://github.com/bolandrm/sassc-ruby/issues/12))
92
+ - **1.4.0**
93
+ - Add support for line number comments
94
+ - **1.3.0**
95
+ - Support Sass color custom function arguments
96
+ - Adds error handling for exceptions in custom functions
97
+ - Custom functions may have optional/default arguments
@@ -0,0 +1,10 @@
1
+ Sass is more than a technology; Sass is driven by the community of individuals
2
+ that power its development and use every day. As a community, we want to embrace
3
+ the very differences that have made our collaboration so powerful, and work
4
+ together to provide the best environment for learning, growing, and sharing of
5
+ ideas. It is imperative that we keep Sass a fun, welcoming, challenging, and
6
+ fair place to play.
7
+
8
+ [The full community guidelines can be found on the Sass website.][link]
9
+
10
+ [link]: https://sass-lang.com/community-guidelines
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) Ryan Boland & Contributors
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,80 @@
1
+ ## SassC Has Reached End-of-Life
2
+
3
+ The `sassc` gem should no longer be used, and will no longer be receiving any updates.
4
+
5
+ The [`sass-embedded`](https://rubygems.org/gems/sass-embedded) gem is the recommended way to move away from `sassc`. It bundles the [Dart Sass](https://sass-lang.com/dart-sass/) command-line executable, and uses the [Embedded Sass Protocol](https://github.com/sass/sass/blob/HEAD/spec/embedded-protocol.md) to provide a [Modern Ruby API](https://rubydoc.info/gems/sass-embedded/Sass) for compiling Sass and defining custom importers and functions.
6
+
7
+ If you find it difficult migrating to the Modern Ruby API, the [`sassc-embedded`](https://rubygems.org/gems/sassc-embedded) gem is a drop-in replacement for the `sassc` gem. It provides the same [Legacy Ruby API](https://github.com/sass-contrib/sassc-embedded-shim-ruby/blob/HEAD/README.md#usage), but internally runs `sass-embedded` instead of `libsass`.
8
+
9
+ You can also use the [`dartsass-rails`](https://rubygems.org/gems/dartsass-rails) gem, a basic command-line integration with the Dart Sass executable from the `sass-embedded` gem; or [`dartsass-sprockets`](https://rubygems.org/gems/dartsass-sprockets) gem, an advanced sprockets integration with the Legacy Ruby API from the `sassc-embedded` gem, to plug smoothly into Ruby on Rails.
10
+
11
+ Alternately, you can explore using a JS build system with Dart Sass as a [JavaScript library](https://sass-lang.com/dart-sass/#java-script-library).
12
+
13
+ # SassC [![Build Status](https://travis-ci.org/sass/sassc-ruby.svg?branch=master)](https://travis-ci.org/sass/sassc-ruby) [![Gem Version](https://badge.fury.io/rb/sassc.svg)](http://badge.fury.io/rb/sassc)
14
+
15
+ Use `libsass` with Ruby!
16
+
17
+ This gem combines the speed of `libsass`, the [Sass C implementation](https://github.com/sass/libsass), with the ease of use of the original [Ruby Sass](https://github.com/sass/ruby-sass) library.
18
+
19
+ ### libsass Version
20
+
21
+ [3.6.1](https://github.com/sass/libsass/releases/3.6.1)
22
+
23
+ ## Installation
24
+
25
+ Add this line to your application's Gemfile:
26
+
27
+ ```ruby
28
+ gem 'sassc'
29
+ ```
30
+
31
+ And then execute:
32
+
33
+ ```bash
34
+ bundle
35
+ ```
36
+
37
+ Or install it yourself as:
38
+
39
+ ```bash
40
+ gem install sassc
41
+ ```
42
+
43
+ ## Usage
44
+
45
+ This library utilizes `libsass` to allow you to compile SCSS or SASS syntax
46
+ to CSS. To compile, use a `SassC::Engine`, e.g.:
47
+
48
+ ```ruby
49
+ SassC::Engine.new(sass, style: :compressed).render
50
+ ```
51
+
52
+ **Note**: If you want to use this library with Rails/Sprockets, check out
53
+ [sassc-rails](https://github.com/bolandrm/sassc-rails).
54
+
55
+ Additionally, you can use `SassC::Sass2Scss` to convert Sass syntax to Scss syntax.
56
+
57
+ ## Credits
58
+
59
+ This gem is maintained by [Ryan Boland](https://ryanboland.com)
60
+ and [awesome contributors](https://github.com/bolandrm/sassc-ruby/graphs/contributors).
61
+
62
+ ## Changelog
63
+
64
+ See [CHANGELOG.md](CHANGELOG.md).
65
+
66
+ ## Contributing
67
+
68
+ ### Project Setup
69
+
70
+ 1. Clone repo
71
+ 1. Install dependencies - `bundle install`
72
+ 1. Run the tests - `bundle exec rake test`
73
+
74
+ ### Code Changes
75
+
76
+ 1. Fork it ( https://github.com/sass/sassc-ruby/fork )
77
+ 1. Create your feature branch (`git checkout -b my-new-feature`)
78
+ 1. Commit your changes (`git commit -am 'Add some feature'`) - try to include tests
79
+ 1. Push to the branch (`git push origin my-new-feature`)
80
+ 1. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,51 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ task default: :test
4
+
5
+ require 'rake/extensiontask'
6
+ gem_spec = Gem::Specification.load("sassc.gemspec")
7
+
8
+ # HACK: Prevent rake-compiler from overriding required_ruby_version,
9
+ # because the shared library here is Ruby-agnostic.
10
+ # See https://github.com/rake-compiler/rake-compiler/issues/153
11
+ module FixRequiredRubyVersion
12
+ def required_ruby_version=(*); end
13
+ end
14
+ Gem::Specification.send(:prepend, FixRequiredRubyVersion)
15
+
16
+ Rake::ExtensionTask.new('libsass', gem_spec) do |ext|
17
+ ext.name = 'libsass'
18
+ ext.ext_dir = 'ext'
19
+ ext.lib_dir = 'lib/sassc'
20
+ ext.cross_compile = true
21
+ ext.cross_platform = %w[x86-mingw32 x64-mingw32]
22
+
23
+ # Link C++ stdlib statically when building binary gems.
24
+ ext.cross_config_options << '--enable-static-stdlib'
25
+
26
+ ext.cross_config_options << '--disable-march-tune-native'
27
+
28
+ ext.cross_compiling do |spec|
29
+ spec.files.reject! { |path| File.fnmatch?('ext/*', path) }
30
+ end
31
+ end
32
+
33
+ desc 'Compile all native gems via rake-compiler-dock (Docker)'
34
+ task 'gem:native' do
35
+ require 'rake_compiler_dock'
36
+
37
+ # The RUBY_CC_VERSION here doesn't matter for the final package.
38
+ # Only one version should be specified, as the shared library is Ruby-agnostic.
39
+ RakeCompilerDock.sh "gem i rake bundler --no-document && bundle && "\
40
+ "rake clean && rake cross native gem MAKE='nice make -j`nproc`' "\
41
+ "RUBY_CC_VERSION=2.6.0 CLEAN=1"
42
+ end
43
+
44
+ CLEAN.include 'tmp', 'pkg', 'lib/sassc/libsass.{so,bundle}', 'ext/libsass/VERSION',
45
+ 'ext/*.{o,so,bundle}', 'ext/Makefile'
46
+
47
+ desc "Run all tests"
48
+ task test: 'compile:libsass' do
49
+ $LOAD_PATH.unshift('lib', 'test')
50
+ Dir.glob('./test/**/*_test.rb') { |f| require f }
51
+ end
data/ext/depend ADDED
@@ -0,0 +1,4 @@
1
+ # Replaces default mkmf dependencies. Default mkmf dependencies include all libruby headers.
2
+ # We don't need libruby and some of these headers are missing on JRuby (breaking compilation there).
3
+ $(OBJS): $(HDRS)
4
+
data/ext/extconf.rb ADDED
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+
3
+ gem_root = File.expand_path('..', __dir__)
4
+ libsass_dir = File.join(gem_root, 'ext', 'libsass')
5
+
6
+ if !File.directory?(libsass_dir) ||
7
+ # '.', '..', and possibly '.git' from a failed checkout:
8
+ Dir.entries(libsass_dir).size <= 3
9
+ Dir.chdir(gem_root) { system('git submodule update --init') } or
10
+ fail 'Could not fetch libsass'
11
+ end
12
+
13
+ require 'mkmf'
14
+
15
+ $CXXFLAGS << ' -std=c++11'
16
+
17
+ # Set to true when building binary gems
18
+ if enable_config('static-stdlib', false)
19
+ $LDFLAGS << ' -static-libgcc -static-libstdc++'
20
+ end
21
+
22
+ if enable_config('march-tune-native', false)
23
+ $CFLAGS << ' -march=native -mtune=native'
24
+ $CXXFLAGS << ' -march=native -mtune=native'
25
+ end
26
+
27
+ # darwin nix clang doesn't support lto
28
+ # disable -lto flag for darwin + nix
29
+ # see: https://github.com/sass/sassc-ruby/issues/148
30
+ enable_lto_by_default = (Gem::Platform.local.os == "darwin" && ENV['NIX_CC'].nil?)
31
+
32
+ if enable_config('lto', enable_lto_by_default)
33
+ $CFLAGS << ' -flto'
34
+ $CXXFLAGS << ' -flto'
35
+ $LDFLAGS << ' -flto'
36
+ end
37
+
38
+ # Disable noisy compilation warnings.
39
+ $warnflags = ''
40
+ $CFLAGS.gsub!(/[\s+](-ansi|-std=[^\s]+)/, '')
41
+
42
+ dir_config 'libsass'
43
+
44
+ libsass_version = Dir.chdir(libsass_dir) do
45
+ if File.exist?('.git')
46
+ ver = %x[git describe --abbrev=4 --dirty --always --tags].chomp
47
+ File.write('VERSION', ver)
48
+ ver
49
+ end
50
+ File.read('VERSION').chomp if File.exist?('VERSION')
51
+ end
52
+
53
+ if libsass_version
54
+ libsass_version_def = %Q{ -DLIBSASS_VERSION='"#{libsass_version}"'}
55
+ $CFLAGS << libsass_version_def
56
+ $CXXFLAGS << libsass_version_def
57
+ end
58
+
59
+ $INCFLAGS << " -I$(srcdir)/libsass/include"
60
+ $VPATH << "$(srcdir)/libsass/src"
61
+ Dir.chdir(__dir__) do
62
+ $VPATH += Dir['libsass/src/*/'].map { |p| "$(srcdir)/#{p}" }
63
+ $srcs = Dir['libsass/src/**/*.{c,cpp}'].sort
64
+ end
65
+
66
+ # libsass.bundle malformed object (unknown load command 7) on Mac OS X
67
+ # See https://github.com/sass/sassc-ruby/pull/174
68
+ if enable_config('strip', RbConfig::CONFIG['host_os'].downcase !~ /darwin/)
69
+ MakeMakefile::LINK_SO << "\nstrip -x $@"
70
+ end
71
+
72
+ # Don't link libruby.
73
+ $LIBRUBYARG = nil
74
+
75
+ # Disable .def file generation for mingw, as it defines an
76
+ # `Init_libsass` export which we don't have.
77
+ MakeMakefile.send(:remove_const, :EXPORT_PREFIX)
78
+ MakeMakefile::EXPORT_PREFIX = nil
79
+
80
+ if RUBY_ENGINE == 'jruby' &&
81
+ Gem::Version.new(RUBY_ENGINE_VERSION) < Gem::Version.new('9.2.8.0')
82
+ # COUTFLAG is not set correctly on jruby<9.2.8.0
83
+ # See https://github.com/jruby/jruby/issues/5749
84
+ MakeMakefile.send(:remove_const, :COUTFLAG)
85
+ MakeMakefile::COUTFLAG = '-o $(empty)'
86
+
87
+ # CCDLFLAGS is not set correctly on jruby<9.2.8.0
88
+ # See https://github.com/jruby/jruby/issues/5751
89
+ $CXXFLAGS << ' -fPIC'
90
+ end
91
+
92
+ create_makefile 'sassc/libsass'
@@ -0,0 +1 @@
1
+ 4.0.1
@@ -0,0 +1,60 @@
1
+ #include <cstring>
2
+ #include <iostream>
3
+ #include <stdint.h>
4
+ #include <sass.h>
5
+
6
+ // gcc: g++ -shared plugin.cpp -o plugin.so -fPIC -Llib -lsass
7
+ // mingw: g++ -shared plugin.cpp -o plugin.dll -Llib -lsass
8
+
9
+ extern "C" const char* ADDCALL libsass_get_version() {
10
+ return libsass_version();
11
+ }
12
+
13
+ union Sass_Value* custom_function(const union Sass_Value* s_args, Sass_Function_Entry cb, struct Sass_Compiler* comp)
14
+ {
15
+ // get context/option struct associated with this compiler
16
+ struct Sass_Context* ctx = sass_compiler_get_context(comp);
17
+ struct Sass_Options* opts = sass_compiler_get_options(comp);
18
+ // get the cookie from function descriptor
19
+ void* cookie = sass_function_get_cookie(cb);
20
+ // we actually abuse the void* to store an "int"
21
+ return sass_make_number((intptr_t)cookie, "px");
22
+ }
23
+
24
+ extern "C" Sass_Function_List ADDCALL libsass_load_functions()
25
+ {
26
+ // allocate a custom function caller
27
+ Sass_Function_Entry c_func =
28
+ sass_make_function("foo()", custom_function, (void*)42);
29
+ // create list of all custom functions
30
+ Sass_Function_List fn_list = sass_make_function_list(1);
31
+ // put the only function in this plugin to the list
32
+ sass_function_set_list_entry(fn_list, 0, c_func);
33
+ // return the list
34
+ return fn_list;
35
+ }
36
+
37
+ Sass_Import_List custom_importer(const char* cur_path, Sass_Importer_Entry cb, struct Sass_Compiler* comp)
38
+ {
39
+ // get the cookie from importer descriptor
40
+ void* cookie = sass_importer_get_cookie(cb);
41
+ // create a list to hold our import entries
42
+ Sass_Import_List incs = sass_make_import_list(1);
43
+ // create our only import entry (route path back)
44
+ incs[0] = sass_make_import_entry(cur_path, 0, 0);
45
+ // return imports
46
+ return incs;
47
+ }
48
+
49
+ extern "C" Sass_Importer_List ADDCALL libsass_load_importers()
50
+ {
51
+ // allocate a custom function caller
52
+ Sass_Importer_Entry c_imp =
53
+ sass_make_importer(custom_importer, - 99, (void*)42);
54
+ // create list of all custom functions
55
+ Sass_Importer_List imp_list = sass_make_importer_list(1);
56
+ // put the only function in this plugin to the list
57
+ sass_importer_set_list_entry(imp_list, 0, c_imp);
58
+ // return the list
59
+ return imp_list;
60
+ }
@@ -0,0 +1,97 @@
1
+ #ifndef SASS_BASE_H
2
+ #define SASS_BASE_H
3
+
4
+ // #define DEBUG
5
+ // #define DEBUG_SHARED_PTR
6
+
7
+ #ifdef _MSC_VER
8
+ #pragma warning(disable : 4503)
9
+ #ifndef _SCL_SECURE_NO_WARNINGS
10
+ #define _SCL_SECURE_NO_WARNINGS
11
+ #endif
12
+ #ifndef _CRT_SECURE_NO_WARNINGS
13
+ #define _CRT_SECURE_NO_WARNINGS
14
+ #endif
15
+ #ifndef _CRT_NONSTDC_NO_DEPRECATE
16
+ #define _CRT_NONSTDC_NO_DEPRECATE
17
+ #endif
18
+ #endif
19
+
20
+ // Work around lack of `noexcept` keyword support in VS2013
21
+ #if defined(_MSC_VER) && (_MSC_VER <= 1800) && !defined(_ALLOW_KEYWORD_MACROS)
22
+ #define _ALLOW_KEYWORD_MACROS 1
23
+ #define noexcept throw( )
24
+ #endif
25
+
26
+ #include <stddef.h>
27
+ #include <stdbool.h>
28
+
29
+ #ifdef __GNUC__
30
+ #define DEPRECATED(func) func __attribute__ ((deprecated))
31
+ #elif defined(_MSC_VER)
32
+ #define DEPRECATED(func) __declspec(deprecated) func
33
+ #else
34
+ #pragma message("WARNING: You need to implement DEPRECATED for this compiler")
35
+ #define DEPRECATED(func) func
36
+ #endif
37
+
38
+ #ifdef _WIN32
39
+
40
+ /* You should define ADD_EXPORTS *only* when building the DLL. */
41
+ #ifdef ADD_EXPORTS
42
+ #define ADDAPI __declspec(dllexport)
43
+ #define ADDCALL __cdecl
44
+ #else
45
+ #define ADDAPI
46
+ #define ADDCALL
47
+ #endif
48
+
49
+ #else /* _WIN32 not defined. */
50
+
51
+ /* Define with no value on non-Windows OSes. */
52
+ #define ADDAPI
53
+ #define ADDCALL
54
+
55
+ #endif
56
+
57
+ /* Make sure functions are exported with C linkage under C++ compilers. */
58
+ #ifdef __cplusplus
59
+ extern "C" {
60
+ #endif
61
+
62
+
63
+ // Different render styles
64
+ enum Sass_Output_Style {
65
+ SASS_STYLE_NESTED,
66
+ SASS_STYLE_EXPANDED,
67
+ SASS_STYLE_COMPACT,
68
+ SASS_STYLE_COMPRESSED,
69
+ // only used internaly
70
+ SASS_STYLE_INSPECT,
71
+ SASS_STYLE_TO_SASS,
72
+ SASS_STYLE_TO_CSS
73
+ };
74
+
75
+ // to allocate buffer to be filled
76
+ ADDAPI void* ADDCALL sass_alloc_memory(size_t size);
77
+ // to allocate a buffer from existing string
78
+ ADDAPI char* ADDCALL sass_copy_c_string(const char* str);
79
+ // to free overtaken memory when done
80
+ ADDAPI void ADDCALL sass_free_memory(void* ptr);
81
+
82
+ // Some convenient string helper function
83
+ ADDAPI char* ADDCALL sass_string_quote (const char* str, const char quote_mark);
84
+ ADDAPI char* ADDCALL sass_string_unquote (const char* str);
85
+
86
+ // Implemented sass language version
87
+ // Hardcoded version 3.4 for time being
88
+ ADDAPI const char* ADDCALL libsass_version(void);
89
+
90
+ // Get compiled libsass language
91
+ ADDAPI const char* ADDCALL libsass_language_version(void);
92
+
93
+ #ifdef __cplusplus
94
+ } // __cplusplus defined.
95
+ #endif
96
+
97
+ #endif