vite_ruby 3.7.0 → 3.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/lib/tasks/vite.rake +0 -13
- data/lib/vite_ruby/commands.rb +0 -57
- data/lib/vite_ruby/manifest.rb +1 -3
- data/lib/vite_ruby/missing_entrypoint_error.rb +3 -4
- data/lib/vite_ruby/runner.rb +1 -1
- data/lib/vite_ruby/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4848b147785c3f6658e41480a992724484b8c9a5abb16cefa8efb76c18198f9a
|
4
|
+
data.tar.gz: 35db6bd3efd883645d6b9b567983abda2604d3df5057468002df00a3890d4d39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1172171e284089b8d0a321e04511147e89215e45aa4f6bcc4f4e4309106344a2c9300877c2098306d53012df5fbc8f3ca9f829e73922f4af727eee8ce98567ae
|
7
|
+
data.tar.gz: a111859dab2ab13318d555c6d002447938fdc61f00514e49ef4227077da572e09cab4d478899cdd752c173bb20e6a4dd5854726b4439d753537da648fa02d684
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
## [3.8.1](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.8.0...vite_ruby@3.8.1) (2024-09-04)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* actually run vite inside bun ([#492](https://github.com/ElMassimo/vite_ruby/issues/492)) ([36d3e96](https://github.com/ElMassimo/vite_ruby/commit/36d3e96a6ea9bd9f45881cecb5be78510d6ff017))
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
# [3.8.0](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.7.0...vite_ruby@3.8.0) (2024-08-12)
|
11
|
+
|
12
|
+
|
13
|
+
### Bug Fixes
|
14
|
+
|
15
|
+
* remove `vite:clean` rake task as it can potentially break apps ([824b4ef](https://github.com/ElMassimo/vite_ruby/commit/824b4ef8397828423d2ddda117bf27e365954961)), closes [#438](https://github.com/ElMassimo/vite_ruby/issues/438) [#490](https://github.com/ElMassimo/vite_ruby/issues/490) [#404](https://github.com/ElMassimo/vite_ruby/issues/404)
|
16
|
+
|
17
|
+
|
18
|
+
### Features
|
19
|
+
|
20
|
+
* remove `ostruct` dependency (closes [#489](https://github.com/ElMassimo/vite_ruby/issues/489)) ([1dfec47](https://github.com/ElMassimo/vite_ruby/commit/1dfec4759bf2c107433c5f1618d97439f6d5bd01))
|
21
|
+
|
22
|
+
|
23
|
+
|
1
24
|
# [3.7.0](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.6.2...vite_ruby@3.7.0) (2024-07-17)
|
2
25
|
|
3
26
|
|
data/lib/tasks/vite.rake
CHANGED
@@ -25,11 +25,6 @@ namespace :vite do
|
|
25
25
|
ViteRuby.commands.build_from_task('--ssr') if ViteRuby.config.ssr_build_enabled
|
26
26
|
end
|
27
27
|
|
28
|
-
desc 'Remove old bundles created by ViteRuby'
|
29
|
-
task :clean, [:keep, :age] => :'vite:verify_install' do |_, args|
|
30
|
-
ViteRuby.commands.clean_from_task(args)
|
31
|
-
end
|
32
|
-
|
33
28
|
desc 'Remove the build output directory for ViteRuby'
|
34
29
|
task clobber: :'vite:verify_install' do
|
35
30
|
ViteRuby.commands.clobber
|
@@ -76,14 +71,6 @@ unless ENV['VITE_RUBY_SKIP_ASSETS_PRECOMPILE_EXTENSION'] == 'true'
|
|
76
71
|
end
|
77
72
|
end
|
78
73
|
|
79
|
-
unless Rake::Task.task_defined?('assets:clean')
|
80
|
-
desc 'Remove old compiled assets'
|
81
|
-
Rake::Task.define_task('assets:clean', [:keep, :age])
|
82
|
-
end
|
83
|
-
Rake::Task['assets:clean'].enhance do |_, args|
|
84
|
-
Rake::Task['vite:clean'].invoke(*args.to_h.values)
|
85
|
-
end
|
86
|
-
|
87
74
|
if Rake::Task.task_defined?('assets:clobber')
|
88
75
|
Rake::Task['assets:clobber'].enhance do
|
89
76
|
Rake::Task['vite:clobber'].invoke
|
data/lib/vite_ruby/commands.rb
CHANGED
@@ -28,38 +28,6 @@ class ViteRuby::Commands
|
|
28
28
|
$stdout.puts "Removed vite cache and output dirs:\n\t#{ dirs.join("\n\t") }"
|
29
29
|
end
|
30
30
|
|
31
|
-
# Public: Receives arguments from a rake task.
|
32
|
-
def clean_from_task(args)
|
33
|
-
ensure_log_goes_to_stdout {
|
34
|
-
clean(keep_up_to: Integer(args.keep || 2), age_in_seconds: Integer(args.age || 3600))
|
35
|
-
}
|
36
|
-
end
|
37
|
-
|
38
|
-
# Public: Cleanup old assets in the output directory.
|
39
|
-
#
|
40
|
-
# keep_up_to - Max amount of backups to preserve.
|
41
|
-
# age_in_seconds - Amount of time to look back in order to preserve them.
|
42
|
-
#
|
43
|
-
# NOTE: By default keeps the last version, or 2 if created in the past hour.
|
44
|
-
#
|
45
|
-
# Examples:
|
46
|
-
# To force only 1 backup to be kept: clean(1, 0)
|
47
|
-
# To only keep files created within the last 10 minutes: clean(0, 600)
|
48
|
-
def clean(keep_up_to: 2, age_in_seconds: 3600)
|
49
|
-
return false unless may_clean?
|
50
|
-
|
51
|
-
versions
|
52
|
-
.each_with_index
|
53
|
-
.drop_while { |(mtime, _files), index|
|
54
|
-
max_age = [0, Time.now - Time.at(mtime)].max
|
55
|
-
max_age < age_in_seconds || index < keep_up_to
|
56
|
-
}
|
57
|
-
.each do |(_, files), _|
|
58
|
-
clean_files(files)
|
59
|
-
end
|
60
|
-
true
|
61
|
-
end
|
62
|
-
|
63
31
|
# Internal: Installs the binstub for the CLI in the appropriate path.
|
64
32
|
def install_binstubs
|
65
33
|
`bundle binstub vite_ruby --path #{ config.root.join('bin') }`
|
@@ -130,31 +98,6 @@ private
|
|
130
98
|
|
131
99
|
def_delegators :@vite_ruby, :config, :builder, :manifest, :logger, :logger=
|
132
100
|
|
133
|
-
def may_clean?
|
134
|
-
config.build_output_dir.exist? && config.manifest_paths.any?
|
135
|
-
end
|
136
|
-
|
137
|
-
def clean_files(files)
|
138
|
-
files.select { |file| File.file?(file) }.each do |file|
|
139
|
-
File.delete(file)
|
140
|
-
logger.info("Removed #{ file }")
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
def versions
|
145
|
-
all_files = Dir.glob("#{ config.build_output_dir }/**/*")
|
146
|
-
entries = all_files - config.manifest_paths - files_referenced_in_manifests
|
147
|
-
entries.reject { |file| File.directory?(file) }
|
148
|
-
.group_by { |file| File.mtime(file).utc.to_i }
|
149
|
-
.sort.reverse
|
150
|
-
end
|
151
|
-
|
152
|
-
def files_referenced_in_manifests
|
153
|
-
config.manifest_paths.flat_map { |path|
|
154
|
-
JSON.parse(path.read).map { |_, entry| entry['file'] }
|
155
|
-
}.compact.uniq.map { |path| config.build_output_dir.join(path).to_s }
|
156
|
-
end
|
157
|
-
|
158
101
|
def with_node_env(env)
|
159
102
|
original = ENV['NODE_ENV']
|
160
103
|
ENV['NODE_ENV'] = env
|
data/lib/vite_ruby/manifest.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'ostruct'
|
4
|
-
|
5
3
|
# Public: Registry for accessing resources managed by Vite, using a generated
|
6
4
|
# manifest file which maps entrypoint names to file paths.
|
7
5
|
#
|
@@ -214,7 +212,7 @@ private
|
|
214
212
|
|
215
213
|
# Internal: Raises a detailed message when an entry is missing in the manifest.
|
216
214
|
def missing_entry_error(name, **options)
|
217
|
-
raise ViteRuby::MissingEntrypointError
|
215
|
+
raise ViteRuby::MissingEntrypointError.new(
|
218
216
|
file_name: resolve_entry_name(name, **options),
|
219
217
|
last_build: builder.last_build_metadata,
|
220
218
|
manifest: @manifest,
|
@@ -5,11 +5,10 @@
|
|
5
5
|
# NOTE: The complexity here is justified by the improved usability of providing
|
6
6
|
# a more specific error message depending on the situation.
|
7
7
|
class ViteRuby::MissingEntrypointError < ViteRuby::Error
|
8
|
-
|
9
|
-
def_delegators :@info, :file_name, :last_build, :manifest, :config
|
8
|
+
attr_reader :file_name, :last_build, :manifest, :config
|
10
9
|
|
11
|
-
def initialize(
|
12
|
-
@
|
10
|
+
def initialize(file_name:, last_build:, manifest:, config:)
|
11
|
+
@file_name, @last_build, @manifest, @config = file_name, last_build, manifest, config
|
13
12
|
super <<~MSG
|
14
13
|
Vite Ruby can't find #{ file_name } in the manifests.
|
15
14
|
|
data/lib/vite_ruby/runner.rb
CHANGED
@@ -43,7 +43,7 @@ private
|
|
43
43
|
x = case config.package_manager
|
44
44
|
when 'npm' then %w[npx]
|
45
45
|
when 'pnpm' then %w[pnpm exec]
|
46
|
-
when 'bun' then %w[bun x]
|
46
|
+
when 'bun' then %w[bun x --bun]
|
47
47
|
when 'yarn' then %w[yarn]
|
48
48
|
else raise ArgumentError, "Unknown package manager #{ config.package_manager.inspect }"
|
49
49
|
end
|
data/lib/vite_ruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vite_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Máximo Mussini
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|
@@ -208,8 +208,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
|
|
208
208
|
licenses:
|
209
209
|
- MIT
|
210
210
|
metadata:
|
211
|
-
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.
|
212
|
-
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.
|
211
|
+
source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@3.8.1/vite_ruby
|
212
|
+
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.8.1/vite_ruby/CHANGELOG.md
|
213
213
|
post_install_message: "Thanks for installing Vite Ruby!\n\nIf you upgraded the gem
|
214
214
|
manually, please run:\n\tbundle exec vite upgrade"
|
215
215
|
rdoc_options: []
|