vite_roda 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a3b4d474c4abe71d8f97e07ff2e5734b74413743c59222f9f8834f2db64cc505
4
+ data.tar.gz: bda32962a6b7e2b6bb422a8244ca439de4a27685e8ebacc336df64c6eea7ac9c
5
+ SHA512:
6
+ metadata.gz: 6d21b3e2f88636ef8ea0bdff15fcb32a54a64c3f941aebc754ec0aa6e5d857d8077a9e011bf2b576fdfa08107f3dc01e7a985eac61b86ee9f773ae77f4da2cad
7
+ data.tar.gz: 7fa4f27292a93f2d34eedb1aefd81f87ee61da1830488a9ccfd0332659625534288f90e678b604e0dc0aa36f31a31744bd37afa19718fc7f66dd33c95050a31a
data/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2025-01-25
9
+
10
+ ### Added
11
+
12
+ - Initial release
13
+ - Roda plugin with `plugin :vite` registration
14
+ - Tag helpers: `vite_client_tag`, `vite_javascript_tag`, `vite_stylesheet_tag`, `vite_asset_path`
15
+ - Automatic dev server proxy in development mode
16
+ - Strict mode by default (raises on missing entrypoints)
17
+ - Example apps for React, Svelte, and Tailwind
18
+
19
+ [0.1.0]: https://github.com/holamendi/vite_roda/releases/tag/v0.1.0
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pablo Orellana
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # vite_roda
2
+
3
+ Vite integration for Roda, built on top of [vite_ruby](https://github.com/ElMassimo/vite_ruby).
4
+
5
+ ## Installation
6
+
7
+ Add to your Gemfile:
8
+
9
+ ```ruby
10
+ gem "vite_roda"
11
+ ```
12
+
13
+ Run:
14
+
15
+ ```bash
16
+ bundle install
17
+ bundle exec vite install
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```ruby
23
+ require "roda"
24
+ require "vite_roda"
25
+
26
+ class App < Roda
27
+ plugin :vite
28
+
29
+ route do |r|
30
+ r.public # Serve static files (including built vite assets)
31
+
32
+ r.root do
33
+ <<~HTML
34
+ <!DOCTYPE html>
35
+ <html>
36
+ <head>
37
+ #{vite_client_tag}
38
+ #{vite_javascript_tag "entrypoints/application.js"}
39
+ </head>
40
+ <body>
41
+ <h1>Hello, Vite!</h1>
42
+ </body>
43
+ </html>
44
+ HTML
45
+ end
46
+ end
47
+ end
48
+ ```
49
+
50
+ ## View Helpers
51
+
52
+ - `vite_client_tag` - HMR client script (development only)
53
+ - `vite_javascript_tag(*names)` - Script tags with automatic CSS imports
54
+ - `vite_stylesheet_tag(*names)` - Stylesheet link tags
55
+ - `vite_asset_path(name)` - Raw asset path
56
+
57
+ ## Configuration
58
+
59
+ Configuration is handled by vite_ruby via `config/vite.json`. See the [vite_ruby documentation](https://vite-ruby.netlify.app/config/).
60
+
61
+ ## Development
62
+
63
+ ```bash
64
+ bundle install
65
+ bundle exec rake # Run linter and tests
66
+ bundle exec rake test # Run tests only
67
+ bundle exec rake standard:fix # Auto-fix linter issues
68
+ ```
69
+
70
+ ## License
71
+
72
+ MIT License. See LICENSE.txt.
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "tag_helpers"
4
+
5
+ module ViteRoda
6
+ module Plugin
7
+ def self.load_dependencies(app, opts = {})
8
+ app.plugin :public
9
+ end
10
+
11
+ def self.configure(app, opts = {})
12
+ ViteRuby.bootstrap
13
+ return unless ViteRuby.run_proxy?
14
+
15
+ app.use ViteRuby::DevServerProxy, ssl_verify_none: true
16
+ end
17
+
18
+ module InstanceMethods
19
+ include ViteRoda::TagHelpers
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ViteRoda
4
+ module TagHelpers
5
+ def vite_client_tag
6
+ return "" unless ViteRuby.instance.dev_server_running?
7
+
8
+ src = ViteRuby.instance.manifest.vite_client_src
9
+ %(<script type="module" src="#{src}"></script>)
10
+ end
11
+
12
+ def vite_javascript_tag(*names, **options)
13
+ entries = ViteRuby.instance.manifest.resolve_entries(*names, type: :javascript)
14
+ tags = []
15
+
16
+ entries[:stylesheets].each do |src|
17
+ tags << stylesheet_tag(src, **options)
18
+ end
19
+
20
+ entries[:scripts].each do |src|
21
+ tags << script_tag(src, **options)
22
+ end
23
+
24
+ tags.join("\n")
25
+ end
26
+
27
+ def vite_stylesheet_tag(*names, **options)
28
+ names.map do |name|
29
+ src = vite_asset_path(name, type: :stylesheet)
30
+ stylesheet_tag(src, **options)
31
+ end.join("\n")
32
+ end
33
+
34
+ def vite_asset_path(name, **options)
35
+ ViteRuby.instance.manifest.path_for(name, **options)
36
+ end
37
+
38
+ private
39
+
40
+ def script_tag(src, **opts)
41
+ %(<script type="module" src="#{src}" crossorigin="anonymous"></script>)
42
+ end
43
+
44
+ def stylesheet_tag(src, **opts)
45
+ %(<link rel="stylesheet" href="#{src}" crossorigin="anonymous">)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ViteRoda
4
+ VERSION = "0.1.0"
5
+ end
data/lib/vite_roda.rb ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "vite_ruby"
4
+ require "roda"
5
+
6
+ require_relative "vite_roda/version"
7
+ require_relative "vite_roda/tag_helpers"
8
+ require_relative "vite_roda/plugin"
9
+
10
+ ViteRuby::COMPANION_LIBRARIES["vite_roda"] = "roda"
11
+
12
+ Roda::RodaPlugins.register_plugin(:vite, ViteRoda::Plugin)
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vite_roda
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Pablo Orellana
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: roda
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '3.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '3.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: vite_ruby
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: minitest
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '5.0'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '5.0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: rack-test
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '2.0'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '2.0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: rake
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '13.0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '13.0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: standard
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.3'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '1.3'
96
+ description: Use Vite in Roda with a lean plugin that provides view helpers and dev
97
+ server proxy.
98
+ email:
99
+ - hola@mendi.cl
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - CHANGELOG.md
105
+ - LICENSE.txt
106
+ - README.md
107
+ - lib/vite_roda.rb
108
+ - lib/vite_roda/plugin.rb
109
+ - lib/vite_roda/tag_helpers.rb
110
+ - lib/vite_roda/version.rb
111
+ homepage: https://github.com/holamendi/vite_roda
112
+ licenses:
113
+ - MIT
114
+ metadata:
115
+ homepage_uri: https://github.com/holamendi/vite_roda
116
+ source_code_uri: https://github.com/holamendi/vite_roda
117
+ changelog_uri: https://github.com/holamendi/vite_roda/blob/main/CHANGELOG.md
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '3.0'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ requirements: []
132
+ rubygems_version: 3.6.7
133
+ specification_version: 4
134
+ summary: Vite integration for Roda
135
+ test_files: []