sass-embedded 1.77.5 → 1.86.3

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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/exe/sass +1 -9
  3. data/ext/sass/Rakefile +407 -89
  4. data/ext/sass/embedded_sass_pb.rb +2 -4
  5. data/ext/sass/package.json +1 -1
  6. data/lib/sass/compiler/channel.rb +6 -4
  7. data/lib/sass/compiler/connection.rb +15 -20
  8. data/lib/sass/compiler/dispatcher.rb +27 -1
  9. data/lib/sass/compiler/host/function_registry.rb +6 -6
  10. data/lib/sass/compiler/host/importer_registry.rb +17 -11
  11. data/lib/sass/compiler/host/logger_registry.rb +17 -20
  12. data/lib/sass/compiler/host/protofier.rb +59 -73
  13. data/lib/sass/compiler/host/struct.rb +36 -0
  14. data/lib/sass/compiler/host.rb +2 -2
  15. data/lib/sass/compiler.rb +3 -3
  16. data/lib/sass/elf.rb +283 -170
  17. data/lib/sass/embedded/version.rb +1 -1
  18. data/lib/sass/embedded.rb +2 -41
  19. data/lib/sass/exception.rb +7 -2
  20. data/lib/sass/serializer.rb +5 -11
  21. data/lib/sass/value/argument_list.rb +0 -8
  22. data/lib/sass/value/color/channel.rb +79 -0
  23. data/lib/sass/value/color/conversions.rb +473 -0
  24. data/lib/sass/value/color/gamut_map_method/clip.rb +45 -0
  25. data/lib/sass/value/color/gamut_map_method/local_minde.rb +94 -0
  26. data/lib/sass/value/color/gamut_map_method.rb +45 -0
  27. data/lib/sass/value/color/interpolation_method.rb +51 -0
  28. data/lib/sass/value/color/space/a98_rgb.rb +57 -0
  29. data/lib/sass/value/color/space/display_p3.rb +57 -0
  30. data/lib/sass/value/color/space/hsl.rb +65 -0
  31. data/lib/sass/value/color/space/hwb.rb +70 -0
  32. data/lib/sass/value/color/space/lab.rb +77 -0
  33. data/lib/sass/value/color/space/lch.rb +53 -0
  34. data/lib/sass/value/color/space/lms.rb +129 -0
  35. data/lib/sass/value/color/space/oklab.rb +66 -0
  36. data/lib/sass/value/color/space/oklch.rb +54 -0
  37. data/lib/sass/value/color/space/prophoto_rgb.rb +59 -0
  38. data/lib/sass/value/color/space/rec2020.rb +69 -0
  39. data/lib/sass/value/color/space/rgb.rb +52 -0
  40. data/lib/sass/value/color/space/srgb.rb +140 -0
  41. data/lib/sass/value/color/space/srgb_linear.rb +72 -0
  42. data/lib/sass/value/color/space/utils.rb +86 -0
  43. data/lib/sass/value/color/space/xyz_d50.rb +100 -0
  44. data/lib/sass/value/color/space/xyz_d65.rb +57 -0
  45. data/lib/sass/value/color/space.rb +198 -0
  46. data/lib/sass/value/color.rb +537 -162
  47. data/lib/sass/value/function.rb +9 -6
  48. data/lib/sass/value/fuzzy_math.rb +23 -19
  49. data/lib/sass/value/mixin.rb +5 -2
  50. data/lib/sass/value/number/unit.rb +5 -4
  51. data/lib/sass/value/number.rb +8 -10
  52. data/lib/sass/value/string.rb +1 -1
  53. metadata +34 -19
  54. data/lib/sass/compiler/host/structifier.rb +0 -37
@@ -5,7 +5,7 @@
5
5
  require 'google/protobuf'
6
6
 
7
7
 
8
- descriptor_data = "\n\x13\x65mbedded_sass.proto\x12\x16sass.embedded_protocol\"\xe8\x10\n\x0eInboundMessage\x12P\n\x0f\x63ompile_request\x18\x02 \x01(\x0b\x32\x35.sass.embedded_protocol.InboundMessage.CompileRequestH\x00\x12\\\n\x15\x63\x61nonicalize_response\x18\x03 \x01(\x0b\x32;.sass.embedded_protocol.InboundMessage.CanonicalizeResponseH\x00\x12P\n\x0fimport_response\x18\x04 \x01(\x0b\x32\x35.sass.embedded_protocol.InboundMessage.ImportResponseH\x00\x12Y\n\x14\x66ile_import_response\x18\x05 \x01(\x0b\x32\x39.sass.embedded_protocol.InboundMessage.FileImportResponseH\x00\x12]\n\x16\x66unction_call_response\x18\x06 \x01(\x0b\x32;.sass.embedded_protocol.InboundMessage.FunctionCallResponseH\x00\x12P\n\x0fversion_request\x18\x07 \x01(\x0b\x32\x35.sass.embedded_protocol.InboundMessage.VersionRequestH\x00\x1a\x1c\n\x0eVersionRequest\x12\n\n\x02id\x18\x01 \x01(\r\x1a\x98\x07\n\x0e\x43ompileRequest\x12S\n\x06string\x18\x02 \x01(\x0b\x32\x41.sass.embedded_protocol.InboundMessage.CompileRequest.StringInputH\x00\x12\x0e\n\x04path\x18\x03 \x01(\tH\x00\x12\x32\n\x05style\x18\x04 \x01(\x0e\x32#.sass.embedded_protocol.OutputStyle\x12\x12\n\nsource_map\x18\x05 \x01(\x08\x12Q\n\timporters\x18\x06 \x03(\x0b\x32>.sass.embedded_protocol.InboundMessage.CompileRequest.Importer\x12\x18\n\x10global_functions\x18\x07 \x03(\t\x12\x13\n\x0b\x61lert_color\x18\x08 \x01(\x08\x12\x13\n\x0b\x61lert_ascii\x18\t \x01(\x08\x12\x0f\n\x07verbose\x18\n \x01(\x08\x12\x12\n\nquiet_deps\x18\x0b \x01(\x08\x12\"\n\x1asource_map_include_sources\x18\x0c \x01(\x08\x12\x0f\n\x07\x63harset\x18\r \x01(\x08\x12\x0e\n\x06silent\x18\x0e \x01(\x08\x12\x19\n\x11\x66\x61tal_deprecation\x18\x0f \x03(\t\x12\x1b\n\x13silence_deprecation\x18\x10 \x03(\t\x12\x1a\n\x12\x66uture_deprecation\x18\x11 \x03(\t\x1a\xac\x01\n\x0bStringInput\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\x12.\n\x06syntax\x18\x03 \x01(\x0e\x32\x1e.sass.embedded_protocol.Syntax\x12P\n\x08importer\x18\x04 \x01(\x0b\x32>.sass.embedded_protocol.InboundMessage.CompileRequest.Importer\x1a\xc5\x01\n\x08Importer\x12\x0e\n\x04path\x18\x01 \x01(\tH\x00\x12\x15\n\x0bimporter_id\x18\x02 \x01(\rH\x00\x12\x1a\n\x10\x66ile_importer_id\x18\x03 \x01(\rH\x00\x12L\n\x15node_package_importer\x18\x05 \x01(\x0b\x32+.sass.embedded_protocol.NodePackageImporterH\x00\x12\x1c\n\x14non_canonical_scheme\x18\x04 \x03(\tB\n\n\x08importerB\x07\n\x05inputJ\x04\x08\x01\x10\x02\x1ak\n\x14\x43\x61nonicalizeResponse\x12\n\n\x02id\x18\x01 \x01(\r\x12\r\n\x03url\x18\x02 \x01(\tH\x00\x12\x0f\n\x05\x65rror\x18\x03 \x01(\tH\x00\x12\x1d\n\x15\x63ontaining_url_unused\x18\x04 \x01(\x08\x42\x08\n\x06result\x1a\x93\x02\n\x0eImportResponse\x12\n\n\x02id\x18\x01 \x01(\r\x12V\n\x07success\x18\x02 \x01(\x0b\x32\x43.sass.embedded_protocol.InboundMessage.ImportResponse.ImportSuccessH\x00\x12\x0f\n\x05\x65rror\x18\x03 \x01(\tH\x00\x1a\x81\x01\n\rImportSuccess\x12\x10\n\x08\x63ontents\x18\x01 \x01(\t\x12.\n\x06syntax\x18\x02 \x01(\x0e\x32\x1e.sass.embedded_protocol.Syntax\x12\x1b\n\x0esource_map_url\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\x11\n\x0f_source_map_urlB\x08\n\x06result\x1an\n\x12\x46ileImportResponse\x12\n\n\x02id\x18\x01 \x01(\r\x12\x12\n\x08\x66ile_url\x18\x02 \x01(\tH\x00\x12\x0f\n\x05\x65rror\x18\x03 \x01(\tH\x00\x12\x1d\n\x15\x63ontaining_url_unused\x18\x04 \x01(\x08\x42\x08\n\x06result\x1a\x90\x01\n\x14\x46unctionCallResponse\x12\n\n\x02id\x18\x01 \x01(\r\x12\x30\n\x07success\x18\x02 \x01(\x0b\x32\x1d.sass.embedded_protocol.ValueH\x00\x12\x0f\n\x05\x65rror\x18\x03 \x01(\tH\x00\x12\x1f\n\x17\x61\x63\x63\x65ssed_argument_lists\x18\x04 \x03(\rB\x08\n\x06resultB\t\n\x07message\"\xcb\x0f\n\x0fOutboundMessage\x12\x36\n\x05\x65rror\x18\x01 \x01(\x0b\x32%.sass.embedded_protocol.ProtocolErrorH\x00\x12S\n\x10\x63ompile_response\x18\x02 \x01(\x0b\x32\x37.sass.embedded_protocol.OutboundMessage.CompileResponseH\x00\x12\x45\n\tlog_event\x18\x03 \x01(\x0b\x32\x30.sass.embedded_protocol.OutboundMessage.LogEventH\x00\x12[\n\x14\x63\x61nonicalize_request\x18\x04 \x01(\x0b\x32;.sass.embedded_protocol.OutboundMessage.CanonicalizeRequestH\x00\x12O\n\x0eimport_request\x18\x05 \x01(\x0b\x32\x35.sass.embedded_protocol.OutboundMessage.ImportRequestH\x00\x12X\n\x13\x66ile_import_request\x18\x06 \x01(\x0b\x32\x39.sass.embedded_protocol.OutboundMessage.FileImportRequestH\x00\x12\\\n\x15\x66unction_call_request\x18\x07 \x01(\x0b\x32;.sass.embedded_protocol.OutboundMessage.FunctionCallRequestH\x00\x12S\n\x10version_response\x18\x08 \x01(\x0b\x32\x37.sass.embedded_protocol.OutboundMessage.VersionResponseH\x00\x1a\x8e\x01\n\x0fVersionResponse\x12\n\n\x02id\x18\x05 \x01(\r\x12\x18\n\x10protocol_version\x18\x01 \x01(\t\x12\x18\n\x10\x63ompiler_version\x18\x02 \x01(\t\x12\x1e\n\x16implementation_version\x18\x03 \x01(\t\x12\x1b\n\x13implementation_name\x18\x04 \x01(\t\x1a\xa2\x03\n\x0f\x43ompileResponse\x12Y\n\x07success\x18\x02 \x01(\x0b\x32\x46.sass.embedded_protocol.OutboundMessage.CompileResponse.CompileSuccessH\x00\x12Y\n\x07\x66\x61ilure\x18\x03 \x01(\x0b\x32\x46.sass.embedded_protocol.OutboundMessage.CompileResponse.CompileFailureH\x00\x12\x13\n\x0bloaded_urls\x18\x04 \x03(\t\x1a\x37\n\x0e\x43ompileSuccess\x12\x0b\n\x03\x63ss\x18\x01 \x01(\t\x12\x12\n\nsource_map\x18\x02 \x01(\tJ\x04\x08\x03\x10\x04\x1a{\n\x0e\x43ompileFailure\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\x30\n\x04span\x18\x02 \x01(\x0b\x32\".sass.embedded_protocol.SourceSpan\x12\x13\n\x0bstack_trace\x18\x03 \x01(\t\x12\x11\n\tformatted\x18\x04 \x01(\tB\x08\n\x06resultJ\x04\x08\x01\x10\x02\x1a\xf1\x01\n\x08LogEvent\x12\x32\n\x04type\x18\x02 \x01(\x0e\x32$.sass.embedded_protocol.LogEventType\x12\x0f\n\x07message\x18\x03 \x01(\t\x12\x35\n\x04span\x18\x04 \x01(\x0b\x32\".sass.embedded_protocol.SourceSpanH\x00\x88\x01\x01\x12\x13\n\x0bstack_trace\x18\x05 \x01(\t\x12\x11\n\tformatted\x18\x06 \x01(\t\x12\x1d\n\x10\x64\x65precation_type\x18\x07 \x01(\tH\x01\x88\x01\x01\x42\x07\n\x05_spanB\x13\n\x11_deprecation_typeJ\x04\x08\x01\x10\x02\x1a\x8e\x01\n\x13\x43\x61nonicalizeRequest\x12\n\n\x02id\x18\x01 \x01(\r\x12\x13\n\x0bimporter_id\x18\x03 \x01(\r\x12\x0b\n\x03url\x18\x04 \x01(\t\x12\x13\n\x0b\x66rom_import\x18\x05 \x01(\x08\x12\x1b\n\x0e\x63ontaining_url\x18\x06 \x01(\tH\x00\x88\x01\x01\x42\x11\n\x0f_containing_urlJ\x04\x08\x02\x10\x03\x1a\x43\n\rImportRequest\x12\n\n\x02id\x18\x01 \x01(\r\x12\x13\n\x0bimporter_id\x18\x03 \x01(\r\x12\x0b\n\x03url\x18\x04 \x01(\tJ\x04\x08\x02\x10\x03\x1a\x8c\x01\n\x11\x46ileImportRequest\x12\n\n\x02id\x18\x01 \x01(\r\x12\x13\n\x0bimporter_id\x18\x03 \x01(\r\x12\x0b\n\x03url\x18\x04 \x01(\t\x12\x13\n\x0b\x66rom_import\x18\x05 \x01(\x08\x12\x1b\n\x0e\x63ontaining_url\x18\x06 \x01(\tH\x00\x88\x01\x01\x42\x11\n\x0f_containing_urlJ\x04\x08\x02\x10\x03\x1a\x8e\x01\n\x13\x46unctionCallRequest\x12\n\n\x02id\x18\x01 \x01(\r\x12\x0e\n\x04name\x18\x03 \x01(\tH\x00\x12\x15\n\x0b\x66unction_id\x18\x04 \x01(\rH\x00\x12\x30\n\targuments\x18\x05 \x03(\x0b\x32\x1d.sass.embedded_protocol.ValueB\x0c\n\nidentifierJ\x04\x08\x02\x10\x03\x42\t\n\x07message\"e\n\rProtocolError\x12\x37\n\x04type\x18\x01 \x01(\x0e\x32).sass.embedded_protocol.ProtocolErrorType\x12\n\n\x02id\x18\x02 \x01(\r\x12\x0f\n\x07message\x18\x03 \x01(\t\"\x87\x02\n\nSourceSpan\x12\x0c\n\x04text\x18\x01 \x01(\t\x12@\n\x05start\x18\x02 \x01(\x0b\x32\x31.sass.embedded_protocol.SourceSpan.SourceLocation\x12\x43\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x31.sass.embedded_protocol.SourceSpan.SourceLocationH\x00\x88\x01\x01\x12\x0b\n\x03url\x18\x04 \x01(\t\x12\x0f\n\x07\x63ontext\x18\x05 \x01(\t\x1a>\n\x0eSourceLocation\x12\x0e\n\x06offset\x18\x01 \x01(\r\x12\x0c\n\x04line\x18\x02 \x01(\r\x12\x0e\n\x06\x63olumn\x18\x03 \x01(\rB\x06\n\x04_end\"\xb8\x13\n\x05Value\x12\x36\n\x06string\x18\x01 \x01(\x0b\x32$.sass.embedded_protocol.Value.StringH\x00\x12\x36\n\x06number\x18\x02 \x01(\x0b\x32$.sass.embedded_protocol.Value.NumberH\x00\x12;\n\trgb_color\x18\x03 \x01(\x0b\x32&.sass.embedded_protocol.Value.RgbColorH\x00\x12;\n\thsl_color\x18\x04 \x01(\x0b\x32&.sass.embedded_protocol.Value.HslColorH\x00\x12\x32\n\x04list\x18\x05 \x01(\x0b\x32\".sass.embedded_protocol.Value.ListH\x00\x12\x30\n\x03map\x18\x06 \x01(\x0b\x32!.sass.embedded_protocol.Value.MapH\x00\x12;\n\tsingleton\x18\x07 \x01(\x0e\x32&.sass.embedded_protocol.SingletonValueH\x00\x12K\n\x11\x63ompiler_function\x18\x08 \x01(\x0b\x32..sass.embedded_protocol.Value.CompilerFunctionH\x00\x12\x43\n\rhost_function\x18\t \x01(\x0b\x32*.sass.embedded_protocol.Value.HostFunctionH\x00\x12\x43\n\rargument_list\x18\n \x01(\x0b\x32*.sass.embedded_protocol.Value.ArgumentListH\x00\x12;\n\thwb_color\x18\x0b \x01(\x0b\x32&.sass.embedded_protocol.Value.HwbColorH\x00\x12@\n\x0b\x63\x61lculation\x18\x0c \x01(\x0b\x32).sass.embedded_protocol.Value.CalculationH\x00\x12\x45\n\x0e\x63ompiler_mixin\x18\r \x01(\x0b\x32+.sass.embedded_protocol.Value.CompilerMixinH\x00\x1a&\n\x06String\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x0e\n\x06quoted\x18\x02 \x01(\x08\x1a\x41\n\x06Number\x12\r\n\x05value\x18\x01 \x01(\x01\x12\x12\n\nnumerators\x18\x02 \x03(\t\x12\x14\n\x0c\x64\x65nominators\x18\x03 \x03(\t\x1a\x43\n\x08RgbColor\x12\x0b\n\x03red\x18\x01 \x01(\r\x12\r\n\x05green\x18\x02 \x01(\r\x12\x0c\n\x04\x62lue\x18\x03 \x01(\r\x12\r\n\x05\x61lpha\x18\x04 \x01(\x01\x1aM\n\x08HslColor\x12\x0b\n\x03hue\x18\x01 \x01(\x01\x12\x12\n\nsaturation\x18\x02 \x01(\x01\x12\x11\n\tlightness\x18\x03 \x01(\x01\x12\r\n\x05\x61lpha\x18\x04 \x01(\x01\x1aL\n\x08HwbColor\x12\x0b\n\x03hue\x18\x01 \x01(\x01\x12\x11\n\twhiteness\x18\x02 \x01(\x01\x12\x11\n\tblackness\x18\x03 \x01(\x01\x12\r\n\x05\x61lpha\x18\x04 \x01(\x01\x1a\x87\x01\n\x04List\x12\x38\n\tseparator\x18\x01 \x01(\x0e\x32%.sass.embedded_protocol.ListSeparator\x12\x14\n\x0chas_brackets\x18\x02 \x01(\x08\x12/\n\x08\x63ontents\x18\x03 \x03(\x0b\x32\x1d.sass.embedded_protocol.Value\x1a\xa2\x01\n\x03Map\x12\x38\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\'.sass.embedded_protocol.Value.Map.Entry\x1a\x61\n\x05\x45ntry\x12*\n\x03key\x18\x01 \x01(\x0b\x32\x1d.sass.embedded_protocol.Value\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.sass.embedded_protocol.Value\x1a\x1e\n\x10\x43ompilerFunction\x12\n\n\x02id\x18\x01 \x01(\r\x1a-\n\x0cHostFunction\x12\n\n\x02id\x18\x01 \x01(\r\x12\x11\n\tsignature\x18\x02 \x01(\t\x1a\x1b\n\rCompilerMixin\x12\n\n\x02id\x18\x01 \x01(\r\x1a\xa1\x02\n\x0c\x41rgumentList\x12\n\n\x02id\x18\x01 \x01(\r\x12\x38\n\tseparator\x18\x02 \x01(\x0e\x32%.sass.embedded_protocol.ListSeparator\x12/\n\x08\x63ontents\x18\x03 \x03(\x0b\x32\x1d.sass.embedded_protocol.Value\x12J\n\x08keywords\x18\x04 \x03(\x0b\x32\x38.sass.embedded_protocol.Value.ArgumentList.KeywordsEntry\x1aN\n\rKeywordsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.sass.embedded_protocol.Value:\x02\x38\x01\x1a\xef\x04\n\x0b\x43\x61lculation\x12\x0c\n\x04name\x18\x01 \x01(\t\x12M\n\targuments\x18\x02 \x03(\x0b\x32:.sass.embedded_protocol.Value.Calculation.CalculationValue\x1a\x95\x02\n\x10\x43\x61lculationValue\x12\x36\n\x06number\x18\x01 \x01(\x0b\x32$.sass.embedded_protocol.Value.NumberH\x00\x12\x10\n\x06string\x18\x02 \x01(\tH\x00\x12\x17\n\rinterpolation\x18\x03 \x01(\tH\x00\x12S\n\toperation\x18\x04 \x01(\x0b\x32>.sass.embedded_protocol.Value.Calculation.CalculationOperationH\x00\x12@\n\x0b\x63\x61lculation\x18\x05 \x01(\x0b\x32).sass.embedded_protocol.Value.CalculationH\x00\x42\x07\n\x05value\x1a\xea\x01\n\x14\x43\x61lculationOperation\x12=\n\x08operator\x18\x01 \x01(\x0e\x32+.sass.embedded_protocol.CalculationOperator\x12H\n\x04left\x18\x02 \x01(\x0b\x32:.sass.embedded_protocol.Value.Calculation.CalculationValue\x12I\n\x05right\x18\x03 \x01(\x0b\x32:.sass.embedded_protocol.Value.Calculation.CalculationValueB\x07\n\x05value\"4\n\x13NodePackageImporter\x12\x1d\n\x15\x65ntry_point_directory\x18\x01 \x01(\t*+\n\x0bOutputStyle\x12\x0c\n\x08\x45XPANDED\x10\x00\x12\x0e\n\nCOMPRESSED\x10\x01*)\n\x06Syntax\x12\x08\n\x04SCSS\x10\x00\x12\x0c\n\x08INDENTED\x10\x01\x12\x07\n\x03\x43SS\x10\x02*?\n\x0cLogEventType\x12\x0b\n\x07WARNING\x10\x00\x12\x17\n\x13\x44\x45PRECATION_WARNING\x10\x01\x12\t\n\x05\x44\x45\x42UG\x10\x02*8\n\x11ProtocolErrorType\x12\t\n\x05PARSE\x10\x00\x12\n\n\x06PARAMS\x10\x01\x12\x0c\n\x08INTERNAL\x10\x02*?\n\rListSeparator\x12\t\n\x05\x43OMMA\x10\x00\x12\t\n\x05SPACE\x10\x01\x12\t\n\x05SLASH\x10\x02\x12\r\n\tUNDECIDED\x10\x03*/\n\x0eSingletonValue\x12\x08\n\x04TRUE\x10\x00\x12\t\n\x05\x46\x41LSE\x10\x01\x12\x08\n\x04NULL\x10\x02*A\n\x13\x43\x61lculationOperator\x12\x08\n\x04PLUS\x10\x00\x12\t\n\x05MINUS\x10\x01\x12\t\n\x05TIMES\x10\x02\x12\n\n\x06\x44IVIDE\x10\x03\x42#\n\x1f\x63om.sass_lang.embedded_protocolP\x01\x62\x06proto3"
8
+ descriptor_data = "\n\x13\x65mbedded_sass.proto\x12\x16sass.embedded_protocol\"\xe8\x10\n\x0eInboundMessage\x12P\n\x0f\x63ompile_request\x18\x02 \x01(\x0b\x32\x35.sass.embedded_protocol.InboundMessage.CompileRequestH\x00\x12\\\n\x15\x63\x61nonicalize_response\x18\x03 \x01(\x0b\x32;.sass.embedded_protocol.InboundMessage.CanonicalizeResponseH\x00\x12P\n\x0fimport_response\x18\x04 \x01(\x0b\x32\x35.sass.embedded_protocol.InboundMessage.ImportResponseH\x00\x12Y\n\x14\x66ile_import_response\x18\x05 \x01(\x0b\x32\x39.sass.embedded_protocol.InboundMessage.FileImportResponseH\x00\x12]\n\x16\x66unction_call_response\x18\x06 \x01(\x0b\x32;.sass.embedded_protocol.InboundMessage.FunctionCallResponseH\x00\x12P\n\x0fversion_request\x18\x07 \x01(\x0b\x32\x35.sass.embedded_protocol.InboundMessage.VersionRequestH\x00\x1a\x1c\n\x0eVersionRequest\x12\n\n\x02id\x18\x01 \x01(\r\x1a\x98\x07\n\x0e\x43ompileRequest\x12S\n\x06string\x18\x02 \x01(\x0b\x32\x41.sass.embedded_protocol.InboundMessage.CompileRequest.StringInputH\x00\x12\x0e\n\x04path\x18\x03 \x01(\tH\x00\x12\x32\n\x05style\x18\x04 \x01(\x0e\x32#.sass.embedded_protocol.OutputStyle\x12\x12\n\nsource_map\x18\x05 \x01(\x08\x12Q\n\timporters\x18\x06 \x03(\x0b\x32>.sass.embedded_protocol.InboundMessage.CompileRequest.Importer\x12\x18\n\x10global_functions\x18\x07 \x03(\t\x12\x13\n\x0b\x61lert_color\x18\x08 \x01(\x08\x12\x13\n\x0b\x61lert_ascii\x18\t \x01(\x08\x12\x0f\n\x07verbose\x18\n \x01(\x08\x12\x12\n\nquiet_deps\x18\x0b \x01(\x08\x12\"\n\x1asource_map_include_sources\x18\x0c \x01(\x08\x12\x0f\n\x07\x63harset\x18\r \x01(\x08\x12\x0e\n\x06silent\x18\x0e \x01(\x08\x12\x19\n\x11\x66\x61tal_deprecation\x18\x0f \x03(\t\x12\x1b\n\x13silence_deprecation\x18\x10 \x03(\t\x12\x1a\n\x12\x66uture_deprecation\x18\x11 \x03(\t\x1a\xac\x01\n\x0bStringInput\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\x12.\n\x06syntax\x18\x03 \x01(\x0e\x32\x1e.sass.embedded_protocol.Syntax\x12P\n\x08importer\x18\x04 \x01(\x0b\x32>.sass.embedded_protocol.InboundMessage.CompileRequest.Importer\x1a\xc5\x01\n\x08Importer\x12\x0e\n\x04path\x18\x01 \x01(\tH\x00\x12\x15\n\x0bimporter_id\x18\x02 \x01(\rH\x00\x12\x1a\n\x10\x66ile_importer_id\x18\x03 \x01(\rH\x00\x12L\n\x15node_package_importer\x18\x05 \x01(\x0b\x32+.sass.embedded_protocol.NodePackageImporterH\x00\x12\x1c\n\x14non_canonical_scheme\x18\x04 \x03(\tB\n\n\x08importerB\x07\n\x05inputJ\x04\x08\x01\x10\x02\x1ak\n\x14\x43\x61nonicalizeResponse\x12\n\n\x02id\x18\x01 \x01(\r\x12\r\n\x03url\x18\x02 \x01(\tH\x00\x12\x0f\n\x05\x65rror\x18\x03 \x01(\tH\x00\x12\x1d\n\x15\x63ontaining_url_unused\x18\x04 \x01(\x08\x42\x08\n\x06result\x1a\x93\x02\n\x0eImportResponse\x12\n\n\x02id\x18\x01 \x01(\r\x12V\n\x07success\x18\x02 \x01(\x0b\x32\x43.sass.embedded_protocol.InboundMessage.ImportResponse.ImportSuccessH\x00\x12\x0f\n\x05\x65rror\x18\x03 \x01(\tH\x00\x1a\x81\x01\n\rImportSuccess\x12\x10\n\x08\x63ontents\x18\x01 \x01(\t\x12.\n\x06syntax\x18\x02 \x01(\x0e\x32\x1e.sass.embedded_protocol.Syntax\x12\x1b\n\x0esource_map_url\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\x11\n\x0f_source_map_urlB\x08\n\x06result\x1an\n\x12\x46ileImportResponse\x12\n\n\x02id\x18\x01 \x01(\r\x12\x12\n\x08\x66ile_url\x18\x02 \x01(\tH\x00\x12\x0f\n\x05\x65rror\x18\x03 \x01(\tH\x00\x12\x1d\n\x15\x63ontaining_url_unused\x18\x04 \x01(\x08\x42\x08\n\x06result\x1a\x90\x01\n\x14\x46unctionCallResponse\x12\n\n\x02id\x18\x01 \x01(\r\x12\x30\n\x07success\x18\x02 \x01(\x0b\x32\x1d.sass.embedded_protocol.ValueH\x00\x12\x0f\n\x05\x65rror\x18\x03 \x01(\tH\x00\x12\x1f\n\x17\x61\x63\x63\x65ssed_argument_lists\x18\x04 \x03(\rB\x08\n\x06resultB\t\n\x07message\"\xcb\x0f\n\x0fOutboundMessage\x12\x36\n\x05\x65rror\x18\x01 \x01(\x0b\x32%.sass.embedded_protocol.ProtocolErrorH\x00\x12S\n\x10\x63ompile_response\x18\x02 \x01(\x0b\x32\x37.sass.embedded_protocol.OutboundMessage.CompileResponseH\x00\x12\x45\n\tlog_event\x18\x03 \x01(\x0b\x32\x30.sass.embedded_protocol.OutboundMessage.LogEventH\x00\x12[\n\x14\x63\x61nonicalize_request\x18\x04 \x01(\x0b\x32;.sass.embedded_protocol.OutboundMessage.CanonicalizeRequestH\x00\x12O\n\x0eimport_request\x18\x05 \x01(\x0b\x32\x35.sass.embedded_protocol.OutboundMessage.ImportRequestH\x00\x12X\n\x13\x66ile_import_request\x18\x06 \x01(\x0b\x32\x39.sass.embedded_protocol.OutboundMessage.FileImportRequestH\x00\x12\\\n\x15\x66unction_call_request\x18\x07 \x01(\x0b\x32;.sass.embedded_protocol.OutboundMessage.FunctionCallRequestH\x00\x12S\n\x10version_response\x18\x08 \x01(\x0b\x32\x37.sass.embedded_protocol.OutboundMessage.VersionResponseH\x00\x1a\x8e\x01\n\x0fVersionResponse\x12\n\n\x02id\x18\x05 \x01(\r\x12\x18\n\x10protocol_version\x18\x01 \x01(\t\x12\x18\n\x10\x63ompiler_version\x18\x02 \x01(\t\x12\x1e\n\x16implementation_version\x18\x03 \x01(\t\x12\x1b\n\x13implementation_name\x18\x04 \x01(\t\x1a\xa2\x03\n\x0f\x43ompileResponse\x12Y\n\x07success\x18\x02 \x01(\x0b\x32\x46.sass.embedded_protocol.OutboundMessage.CompileResponse.CompileSuccessH\x00\x12Y\n\x07\x66\x61ilure\x18\x03 \x01(\x0b\x32\x46.sass.embedded_protocol.OutboundMessage.CompileResponse.CompileFailureH\x00\x12\x13\n\x0bloaded_urls\x18\x04 \x03(\t\x1a\x37\n\x0e\x43ompileSuccess\x12\x0b\n\x03\x63ss\x18\x01 \x01(\t\x12\x12\n\nsource_map\x18\x02 \x01(\tJ\x04\x08\x03\x10\x04\x1a{\n\x0e\x43ompileFailure\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\x30\n\x04span\x18\x02 \x01(\x0b\x32\".sass.embedded_protocol.SourceSpan\x12\x13\n\x0bstack_trace\x18\x03 \x01(\t\x12\x11\n\tformatted\x18\x04 \x01(\tB\x08\n\x06resultJ\x04\x08\x01\x10\x02\x1a\xf1\x01\n\x08LogEvent\x12\x32\n\x04type\x18\x02 \x01(\x0e\x32$.sass.embedded_protocol.LogEventType\x12\x0f\n\x07message\x18\x03 \x01(\t\x12\x35\n\x04span\x18\x04 \x01(\x0b\x32\".sass.embedded_protocol.SourceSpanH\x00\x88\x01\x01\x12\x13\n\x0bstack_trace\x18\x05 \x01(\t\x12\x11\n\tformatted\x18\x06 \x01(\t\x12\x1d\n\x10\x64\x65precation_type\x18\x07 \x01(\tH\x01\x88\x01\x01\x42\x07\n\x05_spanB\x13\n\x11_deprecation_typeJ\x04\x08\x01\x10\x02\x1a\x8e\x01\n\x13\x43\x61nonicalizeRequest\x12\n\n\x02id\x18\x01 \x01(\r\x12\x13\n\x0bimporter_id\x18\x03 \x01(\r\x12\x0b\n\x03url\x18\x04 \x01(\t\x12\x13\n\x0b\x66rom_import\x18\x05 \x01(\x08\x12\x1b\n\x0e\x63ontaining_url\x18\x06 \x01(\tH\x00\x88\x01\x01\x42\x11\n\x0f_containing_urlJ\x04\x08\x02\x10\x03\x1a\x43\n\rImportRequest\x12\n\n\x02id\x18\x01 \x01(\r\x12\x13\n\x0bimporter_id\x18\x03 \x01(\r\x12\x0b\n\x03url\x18\x04 \x01(\tJ\x04\x08\x02\x10\x03\x1a\x8c\x01\n\x11\x46ileImportRequest\x12\n\n\x02id\x18\x01 \x01(\r\x12\x13\n\x0bimporter_id\x18\x03 \x01(\r\x12\x0b\n\x03url\x18\x04 \x01(\t\x12\x13\n\x0b\x66rom_import\x18\x05 \x01(\x08\x12\x1b\n\x0e\x63ontaining_url\x18\x06 \x01(\tH\x00\x88\x01\x01\x42\x11\n\x0f_containing_urlJ\x04\x08\x02\x10\x03\x1a\x8e\x01\n\x13\x46unctionCallRequest\x12\n\n\x02id\x18\x01 \x01(\r\x12\x0e\n\x04name\x18\x03 \x01(\tH\x00\x12\x15\n\x0b\x66unction_id\x18\x04 \x01(\rH\x00\x12\x30\n\targuments\x18\x05 \x03(\x0b\x32\x1d.sass.embedded_protocol.ValueB\x0c\n\nidentifierJ\x04\x08\x02\x10\x03\x42\t\n\x07message\"e\n\rProtocolError\x12\x37\n\x04type\x18\x01 \x01(\x0e\x32).sass.embedded_protocol.ProtocolErrorType\x12\n\n\x02id\x18\x02 \x01(\r\x12\x0f\n\x07message\x18\x03 \x01(\t\"\x87\x02\n\nSourceSpan\x12\x0c\n\x04text\x18\x01 \x01(\t\x12@\n\x05start\x18\x02 \x01(\x0b\x32\x31.sass.embedded_protocol.SourceSpan.SourceLocation\x12\x43\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x31.sass.embedded_protocol.SourceSpan.SourceLocationH\x00\x88\x01\x01\x12\x0b\n\x03url\x18\x04 \x01(\t\x12\x0f\n\x07\x63ontext\x18\x05 \x01(\t\x1a>\n\x0eSourceLocation\x12\x0e\n\x06offset\x18\x01 \x01(\r\x12\x0c\n\x04line\x18\x02 \x01(\r\x12\x0e\n\x06\x63olumn\x18\x03 \x01(\rB\x06\n\x04_end\"\xf8\x11\n\x05Value\x12\x36\n\x06string\x18\x01 \x01(\x0b\x32$.sass.embedded_protocol.Value.StringH\x00\x12\x36\n\x06number\x18\x02 \x01(\x0b\x32$.sass.embedded_protocol.Value.NumberH\x00\x12\x32\n\x04list\x18\x05 \x01(\x0b\x32\".sass.embedded_protocol.Value.ListH\x00\x12\x30\n\x03map\x18\x06 \x01(\x0b\x32!.sass.embedded_protocol.Value.MapH\x00\x12;\n\tsingleton\x18\x07 \x01(\x0e\x32&.sass.embedded_protocol.SingletonValueH\x00\x12K\n\x11\x63ompiler_function\x18\x08 \x01(\x0b\x32..sass.embedded_protocol.Value.CompilerFunctionH\x00\x12\x43\n\rhost_function\x18\t \x01(\x0b\x32*.sass.embedded_protocol.Value.HostFunctionH\x00\x12\x43\n\rargument_list\x18\n \x01(\x0b\x32*.sass.embedded_protocol.Value.ArgumentListH\x00\x12@\n\x0b\x63\x61lculation\x18\x0c \x01(\x0b\x32).sass.embedded_protocol.Value.CalculationH\x00\x12\x45\n\x0e\x63ompiler_mixin\x18\r \x01(\x0b\x32+.sass.embedded_protocol.Value.CompilerMixinH\x00\x12\x34\n\x05\x63olor\x18\x0e \x01(\x0b\x32#.sass.embedded_protocol.Value.ColorH\x00\x1a&\n\x06String\x12\x0c\n\x04text\x18\x01 \x01(\t\x12\x0e\n\x06quoted\x18\x02 \x01(\x08\x1a\x41\n\x06Number\x12\r\n\x05value\x18\x01 \x01(\x01\x12\x12\n\nnumerators\x18\x02 \x03(\t\x12\x14\n\x0c\x64\x65nominators\x18\x03 \x03(\t\x1a\xa0\x01\n\x05\x43olor\x12\r\n\x05space\x18\x01 \x01(\t\x12\x15\n\x08\x63hannel1\x18\x02 \x01(\x01H\x00\x88\x01\x01\x12\x15\n\x08\x63hannel2\x18\x03 \x01(\x01H\x01\x88\x01\x01\x12\x15\n\x08\x63hannel3\x18\x04 \x01(\x01H\x02\x88\x01\x01\x12\x12\n\x05\x61lpha\x18\x05 \x01(\x01H\x03\x88\x01\x01\x42\x0b\n\t_channel1B\x0b\n\t_channel2B\x0b\n\t_channel3B\x08\n\x06_alpha\x1a\x87\x01\n\x04List\x12\x38\n\tseparator\x18\x01 \x01(\x0e\x32%.sass.embedded_protocol.ListSeparator\x12\x14\n\x0chas_brackets\x18\x02 \x01(\x08\x12/\n\x08\x63ontents\x18\x03 \x03(\x0b\x32\x1d.sass.embedded_protocol.Value\x1a\xa2\x01\n\x03Map\x12\x38\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\'.sass.embedded_protocol.Value.Map.Entry\x1a\x61\n\x05\x45ntry\x12*\n\x03key\x18\x01 \x01(\x0b\x32\x1d.sass.embedded_protocol.Value\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.sass.embedded_protocol.Value\x1a\x1e\n\x10\x43ompilerFunction\x12\n\n\x02id\x18\x01 \x01(\r\x1a-\n\x0cHostFunction\x12\n\n\x02id\x18\x01 \x01(\r\x12\x11\n\tsignature\x18\x02 \x01(\t\x1a\x1b\n\rCompilerMixin\x12\n\n\x02id\x18\x01 \x01(\r\x1a\xa1\x02\n\x0c\x41rgumentList\x12\n\n\x02id\x18\x01 \x01(\r\x12\x38\n\tseparator\x18\x02 \x01(\x0e\x32%.sass.embedded_protocol.ListSeparator\x12/\n\x08\x63ontents\x18\x03 \x03(\x0b\x32\x1d.sass.embedded_protocol.Value\x12J\n\x08keywords\x18\x04 \x03(\x0b\x32\x38.sass.embedded_protocol.Value.ArgumentList.KeywordsEntry\x1aN\n\rKeywordsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x1d.sass.embedded_protocol.Value:\x02\x38\x01\x1a\xef\x04\n\x0b\x43\x61lculation\x12\x0c\n\x04name\x18\x01 \x01(\t\x12M\n\targuments\x18\x02 \x03(\x0b\x32:.sass.embedded_protocol.Value.Calculation.CalculationValue\x1a\x95\x02\n\x10\x43\x61lculationValue\x12\x36\n\x06number\x18\x01 \x01(\x0b\x32$.sass.embedded_protocol.Value.NumberH\x00\x12\x10\n\x06string\x18\x02 \x01(\tH\x00\x12\x17\n\rinterpolation\x18\x03 \x01(\tH\x00\x12S\n\toperation\x18\x04 \x01(\x0b\x32>.sass.embedded_protocol.Value.Calculation.CalculationOperationH\x00\x12@\n\x0b\x63\x61lculation\x18\x05 \x01(\x0b\x32).sass.embedded_protocol.Value.CalculationH\x00\x42\x07\n\x05value\x1a\xea\x01\n\x14\x43\x61lculationOperation\x12=\n\x08operator\x18\x01 \x01(\x0e\x32+.sass.embedded_protocol.CalculationOperator\x12H\n\x04left\x18\x02 \x01(\x0b\x32:.sass.embedded_protocol.Value.Calculation.CalculationValue\x12I\n\x05right\x18\x03 \x01(\x0b\x32:.sass.embedded_protocol.Value.Calculation.CalculationValueB\x07\n\x05value\"4\n\x13NodePackageImporter\x12\x1d\n\x15\x65ntry_point_directory\x18\x01 \x01(\t*+\n\x0bOutputStyle\x12\x0c\n\x08\x45XPANDED\x10\x00\x12\x0e\n\nCOMPRESSED\x10\x01*)\n\x06Syntax\x12\x08\n\x04SCSS\x10\x00\x12\x0c\n\x08INDENTED\x10\x01\x12\x07\n\x03\x43SS\x10\x02*?\n\x0cLogEventType\x12\x0b\n\x07WARNING\x10\x00\x12\x17\n\x13\x44\x45PRECATION_WARNING\x10\x01\x12\t\n\x05\x44\x45\x42UG\x10\x02*8\n\x11ProtocolErrorType\x12\t\n\x05PARSE\x10\x00\x12\n\n\x06PARAMS\x10\x01\x12\x0c\n\x08INTERNAL\x10\x02*?\n\rListSeparator\x12\t\n\x05\x43OMMA\x10\x00\x12\t\n\x05SPACE\x10\x01\x12\t\n\x05SLASH\x10\x02\x12\r\n\tUNDECIDED\x10\x03*/\n\x0eSingletonValue\x12\x08\n\x04TRUE\x10\x00\x12\t\n\x05\x46\x41LSE\x10\x01\x12\x08\n\x04NULL\x10\x02*A\n\x13\x43\x61lculationOperator\x12\x08\n\x04PLUS\x10\x00\x12\t\n\x05MINUS\x10\x01\x12\t\n\x05TIMES\x10\x02\x12\n\n\x06\x44IVIDE\x10\x03\x42#\n\x1f\x63om.sass_lang.embedded_protocolP\x01\x62\x06proto3"
9
9
 
10
10
  pool = Google::Protobuf::DescriptorPool.generated_pool
11
11
  pool.add_serialized_file(descriptor_data)
@@ -38,9 +38,7 @@ module Sass
38
38
  Value = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value").msgclass
39
39
  Value::String = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.String").msgclass
40
40
  Value::Number = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Number").msgclass
41
- Value::RgbColor = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.RgbColor").msgclass
42
- Value::HslColor = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.HslColor").msgclass
43
- Value::HwbColor = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.HwbColor").msgclass
41
+ Value::Color = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Color").msgclass
44
42
  Value::List = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.List").msgclass
45
43
  Value::Map = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Map").msgclass
46
44
  Value::Map::Entry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("sass.embedded_protocol.Value.Map.Entry").msgclass
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "dependencies": {
3
- "sass": "1.77.5"
3
+ "sass": "1.86.3"
4
4
  }
5
5
  }
@@ -6,9 +6,11 @@ module Sass
6
6
  #
7
7
  # It manages the lifecycle of {Dispatcher}.
8
8
  class Channel
9
- def initialize(dispatcher_class)
10
- @dispatcher_class = dispatcher_class
11
- @dispatcher = @dispatcher_class.new
9
+ def initialize(*args, **kwargs, &block)
10
+ @args = args
11
+ @kwargs = kwargs
12
+ @block = block
13
+ @dispatcher = Dispatcher.new(*@args, **@kwargs, &@block)
12
14
  @mutex = Mutex.new
13
15
  end
14
16
 
@@ -33,7 +35,7 @@ module Sass
33
35
 
34
36
  Stream.new(@dispatcher, host)
35
37
  rescue Errno::EBUSY
36
- @dispatcher = @dispatcher_class.new
38
+ @dispatcher = Dispatcher.new(*@args, **@kwargs, &@block)
37
39
  Stream.new(@dispatcher, host)
38
40
  end
39
41
  end
@@ -12,33 +12,28 @@ module Sass
12
12
  class Connection
13
13
  def initialize
14
14
  @mutex = Mutex.new
15
- @stdin, @stdout, @stderr, @wait_thread = begin
16
- Open3.popen3(*CLI::COMMAND, '--embedded', chdir: __dir__)
17
- rescue Errno::ENOENT
18
- require_relative '../elf'
15
+ @stdin, @stdout, @stderr, @wait_thread = Open3.popen3(*CLI::COMMAND, '--embedded', chdir: __dir__)
19
16
 
20
- raise if ELF::INTERPRETER.nil?
17
+ @stdin.binmode
21
18
 
22
- Open3.popen3(ELF::INTERPRETER, *CLI::COMMAND, '--embedded', chdir: __dir__)
23
- end
19
+ # # https://dart.dev/tools/dart-devtools
20
+ # if 'dart' == File.basename(CLI::COMMAND.first, '.exe') && CLI::COMMAND.include?('--observe')
21
+ # Kernel.warn(@stdout.readline, uplevel: 0)
22
+ # Kernel.warn(@stdout.readline, uplevel: 0)
23
+ # end
24
24
 
25
- @stdin.binmode
25
+ @stdout.binmode
26
+
27
+ @wait_thread.name = "sass-embedded-process-waiter-#{id}"
28
+ end
26
29
 
27
- @wait_thread.name = "sass-embedded-process-waiter-#{@wait_thread.pid}"
30
+ def id
31
+ @wait_thread.pid
28
32
  end
29
33
 
30
34
  def listen(dispatcher)
31
35
  Thread.new do
32
- Thread.current.name = "sass-embedded-process-stdout-poller-#{@wait_thread.pid}"
33
-
34
- # # https://dart.dev/tools/dart-devtools
35
- # if 'dart' == File.basename(CLI::COMMAND.first, '.exe') && CLI::COMMAND.include?('--observe')
36
- # Kernel.warn(@stdout.readline, uplevel: 0)
37
- # Kernel.warn(@stdout.readline, uplevel: 0)
38
- # end
39
-
40
- @stdout.binmode
41
-
36
+ Thread.current.name = "sass-embedded-process-stdout-poller-#{id}"
42
37
  loop do
43
38
  length = Varint.read(@stdout)
44
39
  id = Varint.read(@stdout)
@@ -53,7 +48,7 @@ module Sass
53
48
  end
54
49
 
55
50
  Thread.new do
56
- Thread.current.name = "sass-embedded-process-stderr-poller-#{@wait_thread.pid}"
51
+ Thread.current.name = "sass-embedded-process-stderr-poller-#{id}"
57
52
  loop do
58
53
  Kernel.warn(@stderr.readline, uplevel: 0)
59
54
  end
@@ -6,13 +6,33 @@ module Sass
6
6
  #
7
7
  # It dispatches messages between multiple instances of {Host} and a single {Connection} to the compiler.
8
8
  class Dispatcher
9
- def initialize
9
+ def initialize(idle_timeout: 0)
10
10
  @id = 1
11
11
  @observers = {}.compare_by_identity
12
12
  @mutex = Mutex.new
13
13
  @connection = Connection.new
14
14
  @connection.listen(self)
15
15
  ForkTracker.add(self)
16
+
17
+ return unless idle_timeout.positive?
18
+
19
+ @last_accessed_time = current_time
20
+ Thread.new do
21
+ Thread.current.name = "sass-embedded-connection-reaper-#{@connection.id}"
22
+ duration = idle_timeout
23
+ loop do
24
+ sleep(duration.negative? ? idle_timeout : duration)
25
+ break if @mutex.synchronize do
26
+ raise Errno::EBUSY if _closed?
27
+
28
+ duration = idle_timeout - (current_time - @last_accessed_time)
29
+ duration.negative? && _idle? && _close
30
+ end
31
+ end
32
+ close
33
+ rescue Errno::EBUSY
34
+ # do nothing
35
+ end
16
36
  end
17
37
 
18
38
  def subscribe(observer)
@@ -94,6 +114,10 @@ module Sass
94
114
 
95
115
  private
96
116
 
117
+ def current_time
118
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
119
+ end
120
+
97
121
  def _close
98
122
  @id = 0xffffffff
99
123
  end
@@ -103,6 +127,8 @@ module Sass
103
127
  end
104
128
 
105
129
  def _idle
130
+ @last_accessed_time = current_time if defined?(@last_accessed_time)
131
+
106
132
  @id = 1
107
133
  end
108
134
 
@@ -7,13 +7,13 @@ module Sass
7
7
  #
8
8
  # It stores sass custom functions and handles function calls.
9
9
  class FunctionRegistry
10
- attr_reader :global_functions
10
+ attr_reader :compile_context, :global_functions
11
11
 
12
12
  def initialize(functions, alert_color:)
13
- functions = functions.transform_keys(&:to_s)
14
-
15
- @global_functions = functions.keys
13
+ @compile_context = Object.new
14
+ @global_functions = functions.keys.map!(&:to_s)
16
15
  @functions_by_name = functions.transform_keys do |signature|
16
+ signature = signature.to_s
17
17
  index = signature.index('(')
18
18
  if index
19
19
  signature.slice(0, index)
@@ -57,8 +57,8 @@ module Sass
57
57
 
58
58
  success = protofier.to_proto(function.call(arguments))
59
59
  accessed_argument_lists = arguments.filter_map do |argument|
60
- if argument.is_a?(Sass::Value::ArgumentList) && argument.instance_eval { @keywords_accessed }
61
- argument.instance_eval { @id }
60
+ if argument.is_a?(Sass::Value::ArgumentList) && argument.instance_variable_get(:@keywords_accessed)
61
+ argument.instance_variable_get(:@id)
62
62
  end
63
63
  end
64
64
 
@@ -25,15 +25,21 @@ module Sass
25
25
  @highlight = alert_color
26
26
  end
27
27
 
28
+ IMPORTER_ATTRS = %i[non_canonical_scheme].freeze
29
+
30
+ IMPORTER_METHODS = %i[canonicalize load find_file_url].freeze
31
+
32
+ private_constant :IMPORTER_ATTRS, :IMPORTER_METHODS
33
+
28
34
  def register(importer)
29
35
  if importer.is_a?(Sass::NodePackageImporter)
30
36
  EmbeddedProtocol::InboundMessage::CompileRequest::Importer.new(
31
37
  node_package_importer: EmbeddedProtocol::NodePackageImporter.new(
32
- entry_point_directory: importer.instance_eval { @entry_point_directory }
38
+ entry_point_directory: importer.instance_variable_get(:@entry_point_directory)
33
39
  )
34
40
  )
35
41
  else
36
- importer = Structifier.to_struct(importer, :canonicalize, :load, :non_canonical_scheme, :find_file_url)
42
+ importer = Struct.new(importer, attrs: IMPORTER_ATTRS, methods: IMPORTER_METHODS) if importer.is_a?(::Hash)
37
43
 
38
44
  is_importer = importer.respond_to?(:canonicalize) && importer.respond_to?(:load)
39
45
  is_file_importer = importer.respond_to?(:find_file_url)
@@ -48,12 +54,7 @@ module Sass
48
54
  EmbeddedProtocol::InboundMessage::CompileRequest::Importer.new(
49
55
  importer_id: id,
50
56
  non_canonical_scheme: if importer.respond_to?(:non_canonical_scheme)
51
- non_canonical_scheme = importer.non_canonical_scheme
52
- if non_canonical_scheme.is_a?(String)
53
- [non_canonical_scheme]
54
- else
55
- non_canonical_scheme || []
56
- end
57
+ Array(importer.non_canonical_scheme)
57
58
  else
58
59
  []
59
60
  end
@@ -75,7 +76,7 @@ module Sass
75
76
  EmbeddedProtocol::InboundMessage::CanonicalizeResponse.new(
76
77
  id: canonicalize_request.id,
77
78
  url:,
78
- containing_url_unused: canonicalize_context.instance_eval { @containing_url_unused }
79
+ containing_url_unused: canonicalize_context.instance_variable_get(:@containing_url_unused)
79
80
  )
80
81
  rescue StandardError => e
81
82
  EmbeddedProtocol::InboundMessage::CanonicalizeResponse.new(
@@ -84,9 +85,14 @@ module Sass
84
85
  )
85
86
  end
86
87
 
88
+ IMPORTER_RESULT_ATTRS = %i[contents syntax source_map_url].freeze
89
+
90
+ private_constant :IMPORTER_RESULT_ATTRS
91
+
87
92
  def import(import_request)
88
93
  importer = @importers_by_id[import_request.importer_id]
89
- importer_result = Structifier.to_struct importer.load(import_request.url), :contents, :syntax, :source_map_url
94
+ importer_result = importer.load(import_request.url)
95
+ importer_result = Struct.new(importer_result, attrs: IMPORTER_RESULT_ATTRS) if importer_result.is_a?(::Hash)
90
96
 
91
97
  EmbeddedProtocol::InboundMessage::ImportResponse.new(
92
98
  id: import_request.id,
@@ -112,7 +118,7 @@ module Sass
112
118
  EmbeddedProtocol::InboundMessage::FileImportResponse.new(
113
119
  id: file_import_request.id,
114
120
  file_url:,
115
- containing_url_unused: canonicalize_context.instance_eval { @containing_url_unused }
121
+ containing_url_unused: canonicalize_context.instance_variable_get(:@containing_url_unused)
116
122
  )
117
123
  rescue StandardError => e
118
124
  EmbeddedProtocol::InboundMessage::FileImportResponse.new(
@@ -7,39 +7,36 @@ module Sass
7
7
  #
8
8
  # It stores logger and handles log events.
9
9
  class LoggerRegistry
10
- def initialize(logger)
11
- logger = Structifier.to_struct(logger, :debug, :warn)
10
+ LOGGER_METHODS = %i[debug warn].freeze
12
11
 
13
- { debug: DebugContext, warn: WarnContext }.each do |symbol, context_class|
14
- next unless logger.respond_to?(symbol)
12
+ private_constant :LOGGER_METHODS
15
13
 
16
- define_singleton_method(symbol) do |event|
17
- logger.public_send(symbol, event.message, context_class.new(event))
18
- end
19
- end
14
+ def initialize(logger)
15
+ logger = Struct.new(logger, methods: LOGGER_METHODS) if logger.is_a?(::Hash)
16
+ @logger = logger
17
+ @logger_respond_to_debug = logger.respond_to?(:debug)
18
+ @logger_respond_to_warn = logger.respond_to?(:warn)
20
19
  end
21
20
 
22
21
  def log(event)
23
22
  case event.type
24
23
  when :DEBUG
25
- debug(event)
24
+ if @logger_respond_to_debug
25
+ @logger.debug(event.message, DebugContext.new(event))
26
+ else
27
+ Kernel.warn(event.formatted)
28
+ end
26
29
  when :DEPRECATION_WARNING, :WARNING
27
- warn(event)
30
+ if @logger_respond_to_warn
31
+ @logger.warn(event.message, WarnContext.new(event))
32
+ else
33
+ Kernel.warn(event.formatted)
34
+ end
28
35
  else
29
36
  raise ArgumentError, "Unknown LogEvent.type #{event.type}"
30
37
  end
31
38
  end
32
39
 
33
- private
34
-
35
- def debug(event)
36
- Kernel.warn(event.formatted)
37
- end
38
-
39
- def warn(event)
40
- Kernel.warn(event.formatted)
41
- end
42
-
43
40
  # Contextual information passed to `debug`.
44
41
  class DebugContext
45
42
  # @return [Logger::SourceSpan, nil]
@@ -25,43 +25,31 @@ module Sass
25
25
  number: Number.to_proto(obj)
26
26
  )
27
27
  when Sass::Value::Color
28
- if obj.instance_eval { !defined?(@hue) }
29
- EmbeddedProtocol::Value.new(
30
- rgb_color: EmbeddedProtocol::Value::RgbColor.new(
31
- red: obj.red,
32
- green: obj.green,
33
- blue: obj.blue,
34
- alpha: obj.alpha.to_f
35
- )
28
+ EmbeddedProtocol::Value.new(
29
+ color: EmbeddedProtocol::Value::Color.new(
30
+ channel1: obj.send(:channel0_or_nil),
31
+ channel2: obj.send(:channel1_or_nil),
32
+ channel3: obj.send(:channel2_or_nil),
33
+ alpha: obj.send(:alpha_or_nil),
34
+ space: obj.space
36
35
  )
37
- elsif obj.instance_eval { !defined?(@saturation) }
36
+ )
37
+ when Sass::Value::ArgumentList
38
+ if obj.instance_variable_get(:@compile_context) == @function_registry.compile_context
38
39
  EmbeddedProtocol::Value.new(
39
- hwb_color: EmbeddedProtocol::Value::HwbColor.new(
40
- hue: obj.hue.to_f,
41
- whiteness: obj.whiteness.to_f,
42
- blackness: obj.blackness.to_f,
43
- alpha: obj.alpha.to_f
40
+ argument_list: EmbeddedProtocol::Value::ArgumentList.new(
41
+ id: obj.instance_variable_get(:@id)
44
42
  )
45
43
  )
46
44
  else
47
45
  EmbeddedProtocol::Value.new(
48
- hsl_color: EmbeddedProtocol::Value::HslColor.new(
49
- hue: obj.hue.to_f,
50
- saturation: obj.saturation.to_f,
51
- lightness: obj.lightness.to_f,
52
- alpha: obj.alpha.to_f
46
+ argument_list: EmbeddedProtocol::Value::ArgumentList.new(
47
+ contents: obj.to_a.map { |element| to_proto(element) },
48
+ keywords: obj.keywords.each_with_object({}) { |(key, value), hash| hash[key.to_s] = to_proto(value) },
49
+ separator: ListSeparator.to_proto(obj.separator)
53
50
  )
54
51
  )
55
52
  end
56
- when Sass::Value::ArgumentList
57
- EmbeddedProtocol::Value.new(
58
- argument_list: EmbeddedProtocol::Value::ArgumentList.new(
59
- id: obj.instance_eval { @id },
60
- contents: obj.to_a.map { |element| to_proto(element) },
61
- keywords: obj.keywords.to_h { |key, value| [key.to_s, to_proto(value)] },
62
- separator: ListSeparator.to_proto(obj.separator)
63
- )
64
- )
65
53
  when Sass::Value::List
66
54
  EmbeddedProtocol::Value.new(
67
55
  list: EmbeddedProtocol::Value::List.new(
@@ -82,10 +70,10 @@ module Sass
82
70
  )
83
71
  )
84
72
  when Sass::Value::Function
85
- if obj.instance_eval { @id }
73
+ if obj.instance_variable_defined?(:@id)
86
74
  EmbeddedProtocol::Value.new(
87
75
  compiler_function: EmbeddedProtocol::Value::CompilerFunction.new(
88
- id: obj.instance_eval { @id }
76
+ id: assert_compiler_value(obj).instance_variable_get(:@id)
89
77
  )
90
78
  )
91
79
  else
@@ -99,7 +87,7 @@ module Sass
99
87
  when Sass::Value::Mixin
100
88
  EmbeddedProtocol::Value.new(
101
89
  compiler_mixin: EmbeddedProtocol::Value::CompilerMixin.new(
102
- id: obj.instance_eval { @id }
90
+ id: assert_compiler_value(obj).instance_variable_get(:@id)
103
91
  )
104
92
  )
105
93
  when Sass::Value::Calculation
@@ -130,40 +118,28 @@ module Sass
130
118
  )
131
119
  when :number
132
120
  Number.from_proto(obj)
133
- when :rgb_color
134
- Sass::Value::Color.new(
135
- red: obj.red,
136
- green: obj.green,
137
- blue: obj.blue,
138
- alpha: obj.alpha
139
- )
140
- when :hsl_color
141
- Sass::Value::Color.new(
142
- hue: obj.hue,
143
- saturation: obj.saturation,
144
- lightness: obj.lightness,
145
- alpha: obj.alpha
146
- )
147
- when :hwb_color
148
- Sass::Value::Color.new(
149
- hue: obj.hue,
150
- whiteness: obj.whiteness,
151
- blackness: obj.blackness,
152
- alpha: obj.alpha
121
+ when :color
122
+ Sass::Value::Color.send(
123
+ :for_space,
124
+ obj.space,
125
+ obj.has_channel1? ? obj.channel1 : nil,
126
+ obj.has_channel2? ? obj.channel2 : nil,
127
+ obj.has_channel3? ? obj.channel3 : nil,
128
+ obj.has_alpha? ? obj.alpha : nil
153
129
  )
154
130
  when :argument_list
155
- Sass::Value::ArgumentList.new(
156
- obj.contents.map do |element|
157
- from_proto(element)
158
- end,
159
- obj.keywords.entries.to_h do |key, value|
160
- [key.to_sym, from_proto(value)]
161
- end,
162
- ListSeparator.from_proto(obj.separator)
163
- ).instance_eval do
164
- @id = obj.id
165
- self
166
- end
131
+ compiler_value(
132
+ Sass::Value::ArgumentList.new(
133
+ obj.contents.map do |element|
134
+ from_proto(element)
135
+ end,
136
+ obj.keywords.to_enum.with_object({}) do |(key, value), hash|
137
+ hash[key.to_sym] = from_proto(value)
138
+ end,
139
+ ListSeparator.from_proto(obj.separator)
140
+ ),
141
+ obj.id
142
+ )
167
143
  when :list
168
144
  Sass::Value::List.new(
169
145
  obj.contents.map do |element|
@@ -174,22 +150,16 @@ module Sass
174
150
  )
175
151
  when :map
176
152
  Sass::Value::Map.new(
177
- obj.entries.to_h do |entry|
178
- [from_proto(entry.key), from_proto(entry.value)]
153
+ obj.entries.to_enum.with_object({}) do |entry, hash|
154
+ hash[from_proto(entry.key)] = from_proto(entry.value)
179
155
  end
180
156
  )
181
157
  when :compiler_function
182
- Sass::Value::Function.new(nil).instance_eval do
183
- @id = obj.id
184
- self
185
- end
158
+ compiler_value(Sass::Value::Function.allocate, obj.id)
186
159
  when :host_function
187
160
  raise Sass::ScriptError, 'The compiler may not send Value.host_function to host'
188
161
  when :compiler_mixin
189
- Sass::Value::Mixin.send(:new).instance_eval do
190
- @id = obj.id
191
- self
192
- end
162
+ compiler_value(Sass::Value::Mixin.allocate, obj.id)
193
163
  when :calculation
194
164
  Calculation.from_proto(obj)
195
165
  when :singleton
@@ -208,6 +178,22 @@ module Sass
208
178
  end
209
179
  end
210
180
 
181
+ private
182
+
183
+ def assert_compiler_value(value)
184
+ unless value.instance_variable_get(:@compile_context) == @function_registry.compile_context
185
+ raise Sass::ScriptError, "Value #{value} does not belong to this compilation"
186
+ end
187
+
188
+ value
189
+ end
190
+
191
+ def compiler_value(value, id)
192
+ value.instance_variable_set(:@compile_context, @function_registry.compile_context)
193
+ value.instance_variable_set(:@id, id)
194
+ value
195
+ end
196
+
211
197
  # The {Number} Protofier.
212
198
  module Number
213
199
  module_function
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sass
4
+ class Compiler
5
+ class Host
6
+ # The {Struct} class.
7
+ #
8
+ # It creates {::Struct}-like objects from {::Hash}.
9
+ class Struct
10
+ def initialize(hash, attrs: nil, methods: nil)
11
+ @hash = hash
12
+ @attrs = attrs
13
+ @methods = methods
14
+ end
15
+
16
+ def method_missing(symbol, ...)
17
+ return super unless @hash.key?(symbol)
18
+
19
+ if @attrs&.include?(symbol)
20
+ @hash.send(:[], symbol, ...)
21
+ elsif @methods&.include?(symbol)
22
+ @hash[symbol].call(...)
23
+ else
24
+ super
25
+ end
26
+ end
27
+
28
+ def respond_to_missing?(symbol, _include_all)
29
+ @hash.key?(symbol) && (@attrs&.include?(symbol) || @methods&.include?(symbol))
30
+ end
31
+ end
32
+
33
+ private_constant :Struct
34
+ end
35
+ end
36
+ end
@@ -4,7 +4,7 @@ require_relative 'host/function_registry'
4
4
  require_relative 'host/importer_registry'
5
5
  require_relative 'host/logger_registry'
6
6
  require_relative 'host/protofier'
7
- require_relative 'host/structifier'
7
+ require_relative 'host/struct'
8
8
 
9
9
  module Sass
10
10
  class Compiler
@@ -116,7 +116,7 @@ module Sass
116
116
 
117
117
  case version_response.implementation_name
118
118
  when 'dart-sass'
119
- info << '[Dart]'
119
+ info << (CLI::COMMAND.first == 'node' ? '[JavaScript]' : '[Dart]')
120
120
  end
121
121
 
122
122
  info
data/lib/sass/compiler.rb CHANGED
@@ -30,7 +30,7 @@ module Sass
30
30
  # @see https://sass-lang.com/documentation/js-api/classes/compiler/
31
31
  class Compiler
32
32
  def initialize
33
- @channel = Channel.new(Dispatcher)
33
+ @channel = Channel.new
34
34
  end
35
35
 
36
36
  # Compiles the Sass file at +path+ to CSS.
@@ -62,7 +62,7 @@ module Sass
62
62
  # compilation to avoid deluging users in console noise. If you set verbose to +true+, it will instead print every
63
63
  # deprecation warning it encounters.
64
64
  # @return [CompileResult]
65
- # @raise [ArgumentError, CompileError]
65
+ # @raise [ArgumentError, CompileError, IOError]
66
66
  # @see https://sass-lang.com/documentation/js-api/functions/compile/
67
67
  def compile(path,
68
68
  load_paths: [],
@@ -142,7 +142,7 @@ module Sass
142
142
  # compilation to avoid deluging users in console noise. If you set verbose to +true+, it will instead print every
143
143
  # deprecation warning it encounters.
144
144
  # @return [CompileResult]
145
- # @raise [ArgumentError, CompileError]
145
+ # @raise [ArgumentError, CompileError, IOError]
146
146
  # @see https://sass-lang.com/documentation/js-api/functions/compilestring/
147
147
  def compile_string(source,
148
148
  importer: nil,