lib/vite_rails.rb in vite_rails-1.0.10 vs lib/vite_rails.rb in vite_rails-1.0.11
- old
+ new
@@ -12,11 +12,11 @@
class ViteRails
# Internal: Prefix used for environment variables that modify the configuration.
ENV_PREFIX = 'VITE_RUBY'
class << self
- delegate :config, :builder, :manifest, :commands, :dev_server, :dev_server_running?, to: :instance
+ delegate :config, :builder, :manifest, :commands, :dev_server, :dev_server_running?, :run_proxy?, to: :instance
delegate :mode, to: :config
delegate :bootstrap, :clean, :clean_from_rake, :clobber, :build, :build_from_rake, to: :commands
attr_writer :instance
@@ -27,18 +27,10 @@
def run(args)
$stdout.sync = true
ViteRails::Runner.new(args).run
end
- # Public: The proxy for assets should only run in development mode.
- def run_proxy?
- config.mode == 'development'
- rescue StandardError => error
- logger.error("Failed to check mode for Vite: #{ error.message }")
- false
- end
-
# Internal: Allows to obtain any env variables for configuration options.
def load_env_variables
ENV.select { |key, _| key.start_with?(ENV_PREFIX) }
end
end
@@ -51,10 +43,18 @@
cattr_accessor(:logger) { ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT)) }
# Public: Returns true if the Vite development server is running.
def dev_server_running?
- ViteRails.run_proxy? && dev_server.running?
+ run_proxy? && dev_server.running?
+ end
+
+ # Public: The proxy for assets should only run in development mode.
+ def run_proxy?
+ config.mode == 'development'
+ rescue StandardError => error
+ ViteRails.logger.error("Failed to check mode for Vite: #{ error.message }")
+ false
end
# Public: Current instance configuration for Vite.
def config
@config ||= ViteRails::Config.resolve_config