Skip to content

Commit

Permalink
feat: remove ostruct dependency (closes #489)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElMassimo committed Aug 12, 2024
1 parent 824b4ef commit 1dfec47
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ GEM
builder (3.3.0)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.3.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
crass (1.0.6)
date (3.3.3)
Expand Down Expand Up @@ -153,7 +153,7 @@ GEM
net-smtp (0.4.0)
net-protocol
nio4r (2.5.9)
nokogiri (1.16.6)
nokogiri (1.16.7)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
parallel (1.23.0)
Expand All @@ -168,7 +168,7 @@ GEM
pry (>= 0.13, < 0.15)
psych (5.1.2)
stringio
racc (1.8.0)
racc (1.8.1)
rack (3.1.7)
rack-proxy (0.7.7)
rack
Expand Down Expand Up @@ -249,7 +249,7 @@ GEM
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.6.16)
zeitwerk (2.6.17)

PLATFORMS
ruby
Expand Down
1 change: 0 additions & 1 deletion gemfiles/Gemfile-rails-edge
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'rails', github: 'rails/rails', branch: 'main'

gem 'mutex_m'
gem 'ostruct'

gemspec path: '../vite_ruby'
gemspec path: '../vite_rails'
Expand Down
4 changes: 1 addition & 3 deletions vite_ruby/lib/vite_ruby/manifest.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require 'ostruct'

# Public: Registry for accessing resources managed by Vite, using a generated
# manifest file which maps entrypoint names to file paths.
#
Expand Down Expand Up @@ -214,7 +212,7 @@ def extension_for_type(entry_type)

# Internal: Raises a detailed message when an entry is missing in the manifest.
def missing_entry_error(name, **options)
raise ViteRuby::MissingEntrypointError, OpenStruct.new(
raise ViteRuby::MissingEntrypointError.new(
file_name: resolve_entry_name(name, **options),
last_build: builder.last_build_metadata,
manifest: @manifest,
Expand Down
7 changes: 3 additions & 4 deletions vite_ruby/lib/vite_ruby/missing_entrypoint_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
# NOTE: The complexity here is justified by the improved usability of providing
# a more specific error message depending on the situation.
class ViteRuby::MissingEntrypointError < ViteRuby::Error
extend Forwardable
def_delegators :@info, :file_name, :last_build, :manifest, :config
attr_reader :file_name, :last_build, :manifest, :config

def initialize(info)
@info = info
def initialize(file_name:, last_build:, manifest:, config:)
@file_name, @last_build, @manifest, @config = file_name, last_build, manifest, config
super <<~MSG
Vite Ruby can't find #{ file_name } in the manifests.
Expand Down

0 comments on commit 1dfec47

Please sign in to comment.