rails_vite 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91b0886dc15d735ad8fa231e9f5acca53a5bd868022edb35c3d973e7246215d7
4
- data.tar.gz: f8c760fc635818a7c3c82e9c88728235098df743c4ae125cf9e6bc52bbab5999
3
+ metadata.gz: 65246e1c68cbefab2638785dcb3f9b28290922e2826ba1af7c2f48b00d4edc8e
4
+ data.tar.gz: 2fba5e05a532396f04fda7e64cf20e5d07e85776309b09a170d3ec8925f8a95f
5
5
  SHA512:
6
- metadata.gz: 61497d27c8e96429068b4417eb5252f89c8410026dc2ff60d14d427a777c808481359b168c7df1c6a3988cde93b8de77b3ec25c9270da2769da648095c372e17
7
- data.tar.gz: 8dd1e105346412b8a8008fbfb1383fb5fd4b7bacdaab66f6c6af10238987560aa21f09ae09e6ebdfc70bcbfab5f50da2e4063e9f300a9557f9c44521c1434930
6
+ metadata.gz: 532d10ec22f6e0e4a0fefaed1216ad04efc618b3979365a47b9278be4c03d5ae24488b5fdb5bdce93ecbe963ed0a214483c22d673daa76bc1bb1af355b20850a
7
+ data.tar.gz: 16f20d8f3ee96046f57b12f81671d094fef7d057cc0f8b8d4ae82fb2ab848a44db2d8fcbdc8bed01246a8351433d2874c63f7f041ab8471e0db8f4c8907f40dc
data/CHANGELOG.md CHANGED
@@ -5,7 +5,39 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog],
6
6
  and this project adheres to [Semantic Versioning].
7
7
 
8
- ## [0.2.0] - 2026-03-11
8
+ ## rails_vite@0.2.2 / rails-vite-plugin@0.2.4 - 2026-04-09
9
+
10
+ ### Added
11
+
12
+ - Expose SSR output directory configuration ([@skryukov])
13
+
14
+ ## rails-vite-plugin@0.2.3 - 2026-03-27
15
+
16
+ ### Fixed
17
+
18
+ - Fix double `assets/` prefix in SSR `?url` imports in jsbundling mode ([@skryukov])
19
+ - Support glob patterns in input entries ([@skryukov])
20
+
21
+ ## rails-vite-plugin@0.2.2 - 2026-03-17
22
+
23
+ ### Fixed
24
+
25
+ - Fix ES module identity split when using Propshaft/Sprockets ([@skryukov])
26
+
27
+ ## rails_vite@0.2.1 / rails-vite-plugin@0.2.1 - 2026-03-17
28
+
29
+ ### Added
30
+
31
+ - Vite 8 (Rolldown) compatibility — support `rolldownOptions` alongside `rollupOptions` ([@skryukov])
32
+ - Test mode isolation — build to `public/vite-test/` in test mode so test builds don't clobber dev/prod assets ([@skryukov])
33
+ - Define `assets:precompile` and `assets:clobber` rake tasks when no asset pipeline is present ([@skryukov])
34
+
35
+ ### Fixed
36
+
37
+ - Fix `?url` imports and asset references pointing to Rails server instead of Vite dev server ([@skryukov])
38
+ - Fix embedded Vite instances (Storybook) overwriting dev stubs in jsbundling mode ([@skryukov])
39
+
40
+ ## rails_vite@0.2.0 / rails-vite-plugin@0.2.0 - 2026-03-11
9
41
 
10
42
  ### Added
11
43
 
@@ -15,13 +47,13 @@ and this project adheres to [Semantic Versioning].
15
47
 
16
48
  - `vite_asset_path` now works in development ([@skryukov])
17
49
 
18
- ## [0.1.2] - 2026-03-08
50
+ ## rails_vite@0.1.2 / rails-vite-plugin@0.1.2 - 2026-03-08
19
51
 
20
52
  ### Fixed
21
53
 
22
54
  - Short entry names now resolve correctly when using `entrypoints/` directory ([@skryukov])
23
55
 
24
- ## [0.1.1] - 2026-03-08
56
+ ## rails_vite@0.1.1 / rails-vite-plugin@0.1.1 - 2026-03-08
25
57
 
26
58
  ### Added
27
59
 
@@ -35,7 +67,7 @@ and this project adheres to [Semantic Versioning].
35
67
 
36
68
  - `refresh: false` option now correctly disables file watching ([@skryukov])
37
69
 
38
- ## [0.1.0] - 2026-03-07
70
+ ## rails_vite@0.1.0 / rails-vite-plugin@0.1.0 - 2026-03-07
39
71
 
40
72
  ### Added
41
73
 
@@ -43,11 +75,5 @@ and this project adheres to [Semantic Versioning].
43
75
 
44
76
  [@skryukov]: https://github.com/skryukov
45
77
 
46
- [Unreleased]: https://github.com/skryukov/rails_vite/compare/v0.2.0...HEAD
47
- [0.2.0]: https://github.com/skryukov/rails_vite/compare/v0.1.2...v0.2.0
48
- [0.1.2]: https://github.com/skryukov/rails_vite/compare/v0.1.1...v0.1.2
49
- [0.1.1]: https://github.com/skryukov/rails_vite/compare/v0.1.0...v0.1.1
50
- [0.1.0]: https://github.com/skryukov/rails_vite/commits/v0.1.0
51
-
52
78
  [Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
53
79
  [Semantic Versioning]: https://semver.org/spec/v2.0.0.html
data/README.md CHANGED
@@ -142,7 +142,7 @@ Use `import.meta.glob` in your entry point to include assets in the Vite manifes
142
142
 
143
143
  ```js
144
144
  // app/javascript/application.js
145
- import.meta.glob(['../assets/images/**']);
145
+ import.meta.glob(['../assets/images/**'], { eager: true });
146
146
  ```
147
147
 
148
148
  Then reference them in views:
@@ -173,10 +173,10 @@ export default defineConfig({
173
173
  | `input` | auto-detected | Entry point(s). If `sourceDir/entrypoints/` exists, all files in it are used. Otherwise, detects `application.{js,ts,jsx,tsx}` in `sourceDir` |
174
174
  | `sourceDir` | `'app/javascript'` | Source directory. Short names are prefixed with this. Also sets the `@` import alias |
175
175
  | `ssr` | — | SSR entry point |
176
- | `ssrOutputDirectory` | `'ssr'` | SSR output directory |
176
+ | `ssrOutDir` | `'ssr'` | SSR output directory |
177
177
  | `devMetaFile` | `'tmp/rails-vite.json'` | Dev metadata file path |
178
- | `buildDirectory` | `'vite'` | Build output subdirectory inside `public/` |
179
- | `publicDirectory` | `'public'` | Public directory |
178
+ | `buildDir` | `'vite'` | Build output subdirectory inside `public/` |
179
+ | `publicDir` | `'public'` | Public directory |
180
180
  | `refresh` | `true` | Paths to watch for full-page reload. `true` watches `app/views/**` and `app/helpers/**` |
181
181
 
182
182
  ### Multiple Entry Points
@@ -252,7 +252,7 @@ export default defineConfig({
252
252
 
253
253
  ## SSR
254
254
 
255
- Set `ssr` to the entry point used for server-side rendering. When you run `npx vite build --ssr`, the plugin uses this as the input and outputs to the `ssrOutputDirectory` (default: `ssr/`).
255
+ Set `ssr` to the entry point used for server-side rendering. When you run `npx vite build --ssr`, the plugin uses this as the input and outputs to the `ssrOutDir` (default: `ssr/`).
256
256
 
257
257
  ```typescript
258
258
  rails({
@@ -405,7 +405,7 @@ In development, jsbundling mode writes `tmp/rails-vite.json` — the same file t
405
405
  ```json
406
406
  // package.json — replace vite-plugin-ruby with rails-vite-plugin
407
407
  - "vite-plugin-ruby": "^5.1.1"
408
- + "rails-vite-plugin": "^0.1.0"
408
+ + "rails-vite-plugin": "^0.2.0"
409
409
  ```
410
410
 
411
411
  ### 2. Replace `vite.config.ts`
@@ -2,18 +2,22 @@ module RailsVite
2
2
  class Config
3
3
  META_FILENAME = "rails-vite.json"
4
4
 
5
- attr_writer :dev_meta_path, :manifest_path, :asset_prefix, :auto_build
5
+ attr_writer :dev_meta_path, :manifest_path, :asset_prefix, :auto_build, :build_dir
6
6
 
7
7
  def dev_meta_path
8
8
  @dev_meta_path || Rails.root.join("tmp", META_FILENAME)
9
9
  end
10
10
 
11
+ def build_dir
12
+ @build_dir || (Rails.env.test? ? "vite-test" : "vite")
13
+ end
14
+
11
15
  def manifest_path
12
- @manifest_path || Rails.root.join("public/vite/manifest.json")
16
+ @manifest_path || Rails.root.join("public", build_dir, "manifest.json")
13
17
  end
14
18
 
15
19
  def asset_prefix
16
- @asset_prefix || "/vite"
20
+ @asset_prefix || "/#{build_dir}"
17
21
  end
18
22
 
19
23
  def source_dir
@@ -30,6 +34,7 @@ module RailsVite
30
34
  end
31
35
 
32
36
  def dev_server_running?
37
+ return false if Rails.env.test?
33
38
  !!dev_server_url
34
39
  end
35
40
 
@@ -37,6 +42,10 @@ module RailsVite
37
42
  plugin_meta["url"]
38
43
  end
39
44
 
45
+ def ssr_output_dir
46
+ plugin_meta["ssrOutputDir"]
47
+ end
48
+
40
49
  def react_refresh?
41
50
  plugin_meta["reactRefresh"] == true
42
51
  end
@@ -31,7 +31,9 @@ module RailsVite
31
31
  end
32
32
 
33
33
  def build_command
34
- command_for(:build)
34
+ cmd = command_for(:build)
35
+ cmd += " --mode test" if Rails.env.test?
36
+ cmd
35
37
  end
36
38
 
37
39
  def tool
@@ -1,3 +1,3 @@
1
1
  module RailsVite
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -20,10 +20,24 @@ namespace :vite do
20
20
  end
21
21
 
22
22
  unless ENV["SKIP_VITE_BUILD"]
23
- %w[assets:precompile test:prepare spec:prepare db:test:prepare].each do |t|
24
- Rake::Task[t].enhance(["vite:build"]) if Rake::Task.task_defined?(t)
25
- break if %w[test:prepare spec:prepare].include?(t) && Rake::Task.task_defined?(t)
23
+ if Rake::Task.task_defined?("assets:precompile")
24
+ Rake::Task["assets:precompile"].enhance(["vite:build"])
25
+ else
26
+ desc "Compile assets"
27
+ Rake::Task.define_task("assets:precompile" => "vite:build")
26
28
  end
27
29
 
28
- Rake::Task["assets:clobber"].enhance(["vite:clobber"]) if Rake::Task.task_defined?("assets:clobber")
30
+ if Rake::Task.task_defined?("assets:clobber")
31
+ Rake::Task["assets:clobber"].enhance(["vite:clobber"])
32
+ else
33
+ desc "Remove compiled assets"
34
+ Rake::Task.define_task("assets:clobber" => "vite:clobber")
35
+ end
36
+
37
+ %w[test:prepare spec:prepare db:test:prepare].each do |t|
38
+ if Rake::Task.task_defined?(t)
39
+ Rake::Task[t].enhance(["vite:build"])
40
+ break
41
+ end
42
+ end
29
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_vite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svyatoslav Kryukov