vite_ruby 3.7.0 → 3.8.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 +4 -4
- data/CHANGELOG.md +14 -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/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: 0c3311945fbd58ebcc238980b0a10715e2a17603ecefd02f4d4aebea7cec7f24
|
4
|
+
data.tar.gz: e2f3336bc55528d31633cc679d70a28370d9eb88f914a940f46b80bd8d99c6db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8ab449ee34c34192ea1cca6c8cdc013b6d1d241371e8f2e92578e8cb040aca9f7cb7b2e1209094efc74d18f7bc2387afd960242230604a0a9210e8e37b5445e
|
7
|
+
data.tar.gz: 4ca76ee1e0288ce280e589668a3104e16c4e15a7efb0579301e5164465c18770ae93f68da9b9c3d6566a8b7a683ecffcd71f677241293d9052ef223209b97688
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
# [3.8.0](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.7.0...vite_ruby@3.8.0) (2024-08-12)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* 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)
|
7
|
+
|
8
|
+
|
9
|
+
### Features
|
10
|
+
|
11
|
+
* remove `ostruct` dependency (closes [#489](https://github.com/ElMassimo/vite_ruby/issues/489)) ([1dfec47](https://github.com/ElMassimo/vite_ruby/commit/1dfec4759bf2c107433c5f1618d97439f6d5bd01))
|
12
|
+
|
13
|
+
|
14
|
+
|
1
15
|
# [3.7.0](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@3.6.2...vite_ruby@3.7.0) (2024-07-17)
|
2
16
|
|
3
17
|
|
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/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.0
|
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-08-12 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.0/vite_ruby
|
212
|
+
changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@3.8.0/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: []
|