vite_ruby 3.5.0 → 4.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ViteRuby::CLI::SSR < ViteRuby::CLI::Vite
4
- DEFAULT_ENV = CURRENT_ENV || 'production'
5
- JS_EXTENSIONS = %w[js mjs cjs]
6
-
7
- desc 'Run the resulting app from building in SSR mode.'
8
- executable_options
9
-
10
- def call(mode:, inspect: false, trace_deprecation: false)
11
- ViteRuby.env['VITE_RUBY_MODE'] = mode
12
-
13
- ssr_entrypoint = JS_EXTENSIONS
14
- .map { |ext| ViteRuby.config.ssr_output_dir.join("ssr.#{ ext }") }
15
- .find(&:exist?)
16
-
17
- raise ArgumentError, "No ssr entrypoint found `#{ ViteRuby.config.ssr_output_dir.relative_path_from(ViteRuby.config.root) }/ssr.{#{ JS_EXTENSIONS.join(',') }}`. Have you run bin/vite build --ssr?" unless ssr_entrypoint
18
-
19
- cmd = [
20
- 'node',
21
- ('--inspect-brk' if inspect),
22
- ('--trace-deprecation' if trace_deprecation),
23
- ssr_entrypoint,
24
- ]
25
- Kernel.exec(*cmd.compact.map(&:to_s))
26
- end
27
- end