Sha256: d870c6b4889c6828f9cd9178431ae67b98ba79d8888953e9e6a7708bacd4d5b4

Contents?: true

Size: 873 Bytes

Versions: 20

Compression:

Stored size: 873 Bytes

Contents

# frozen_string_literal: true

module Proscenium
  class Middleware
    class Esbuild < Base
      class CompileError < Base::CompileError
        def initialize(args)
          detail = args[:detail]
          detail = ActiveSupport::HashWithIndifferentAccess.new(Oj.load(detail, mode: :strict))

          args[:detail] = if detail[:location]
                            "#{detail[:text]} in #{detail[:location][:file]}:" +
                              detail[:location][:line].to_s
                          else
                            detail[:text]
                          end

          super
        end
      end

      def attempt
        render_response Builder.build_to_string(path_to_build)
      rescue Builder::CompileError => e
        raise self.class::CompileError, { file: @request.fullpath, detail: e.message }, caller
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
proscenium-0.19.0.beta4-x86_64-linux lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta4-aarch64-linux lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta4-arm64-darwin lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta4-x86_64-darwin lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta4 lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta3-x86_64-linux lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta3-aarch64-linux lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta3-arm64-darwin lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta3-x86_64-darwin lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta3 lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta2-x86_64-linux lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta2-aarch64-linux lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta2-arm64-darwin lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta2-x86_64-darwin lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta2 lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta1-x86_64-linux lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta1-aarch64-linux lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta1-arm64-darwin lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta1-x86_64-darwin lib/proscenium/middleware/esbuild.rb
proscenium-0.19.0.beta1 lib/proscenium/middleware/esbuild.rb