Skip to content

Commit

Permalink
Remove Protofier
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Jan 18, 2024
1 parent e843f16 commit 7b08480
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 32 deletions.
3 changes: 1 addition & 2 deletions lib/sass/compiler/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require_relative 'host/function_registry'
require_relative 'host/importer_registry'
require_relative 'host/logger_registry'
require_relative 'host/protofier'
require_relative 'host/structifier'
require_relative 'host/value_protofier'

Expand Down Expand Up @@ -46,7 +45,7 @@ def compile_request(path:,
EmbeddedProtocol::InboundMessage::CompileRequest::StringInput.new(
source: source.to_str,
url: url&.to_s,
syntax: Protofier.to_proto_syntax(syntax),
syntax: @importer_registry.syntax_to_proto(syntax),
importer: (@importer_registry.register(importer) unless importer.nil?)
)
end,
Expand Down
15 changes: 14 additions & 1 deletion lib/sass/compiler/host/importer_registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def import(import_request)
id: import_request.id,
success: EmbeddedProtocol::InboundMessage::ImportResponse::ImportSuccess.new(
contents: importer_result.contents.to_str,
syntax: Protofier.to_proto_syntax(importer_result.syntax),
syntax: syntax_to_proto(importer_result.syntax),
source_map_url: (importer_result.source_map_url&.to_s if importer_result.respond_to?(:source_map_url))
)
)
Expand All @@ -108,6 +108,19 @@ def file_import(file_import_request)
error: e.full_message(highlight: @highlight, order: :top)
)
end

def syntax_to_proto(syntax)
case syntax&.to_sym
when :scss
EmbeddedProtocol::Syntax::SCSS
when :indented
EmbeddedProtocol::Syntax::INDENTED
when :css
EmbeddedProtocol::Syntax::CSS
else
raise ArgumentError, 'syntax must be one of :scss, :indented, :css'
end
end
end

private_constant :ImporterRegistry
Expand Down
29 changes: 0 additions & 29 deletions lib/sass/compiler/host/protofier.rb

This file was deleted.

0 comments on commit 7b08480

Please sign in to comment.