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

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

Overview

:nodoc:

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.



43
44
45
# File 'lib/bundlebun/integrations/vite_ruby.rb', line 43

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.



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/bundlebun/integrations/vite_ruby.rb', line 29

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