Module: Bundlebun::Integrations::ViteRuby::RunnerExtensions

Defined in:
lib/bundlebun/integrations/vite_ruby.rb

Overview

A monkey-patch for ViteRuby.

Instance Method Summary collapse

Instance Method Details

#bun_binstub_pathObject

Use our binstub if it is installed in the project, otherwise just use the binary included with the gem.



52
53
54
# File 'lib/bundlebun/integrations/vite_ruby.rb', line 52

def bun_binstub_path
  Bundlebun::Runner.binstub_or_binary_path
end

#vite_executable(*exec_args) ⇒ Object

Internal: Resolves to an executable for Vite.

We're overloading this to use with bundlebun.



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/bundlebun/integrations/vite_ruby.rb', line 38

def vite_executable(*exec_args)
  # Should still allow a custom bin path/binstub
  bin_path = config.vite_bin_path
  return [bin_path] if bin_path && File.exist?(bin_path)

  # Would be cleaner is to check `if config.package_manager == 'bun'`,
  # but seems redundant since we're already bundling Bun,
  # and putting `bun` as a package manager in their vite.json is just
  # another step for the developer to do.
  [bun_binstub_path, 'x --bun', *exec_args, 'vite']
end