t-ruby 0.0.35 → 0.0.37
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/README.md +7 -6
- data/lib/t_ruby/benchmark.rb +16 -16
- data/lib/t_ruby/bundler_integration.rb +33 -35
- data/lib/t_ruby/cache.rb +46 -43
- data/lib/t_ruby/cli.rb +29 -5
- data/lib/t_ruby/compiler.rb +106 -52
- data/lib/t_ruby/config.rb +15 -18
- data/lib/t_ruby/constraint_checker.rb +14 -8
- data/lib/t_ruby/declaration_generator.rb +25 -8
- data/lib/t_ruby/doc_generator.rb +33 -33
- data/lib/t_ruby/docs_badge_generator.rb +8 -8
- data/lib/t_ruby/docs_example_verifier.rb +5 -6
- data/lib/t_ruby/error_handler.rb +21 -22
- data/lib/t_ruby/generic_type_parser.rb +3 -3
- data/lib/t_ruby/intersection_type_parser.rb +2 -2
- data/lib/t_ruby/ir.rb +21 -24
- data/lib/t_ruby/lsp_server.rb +128 -138
- data/lib/t_ruby/package_manager.rb +16 -18
- data/lib/t_ruby/parser.rb +7 -7
- data/lib/t_ruby/parser_combinator.rb +22 -22
- data/lib/t_ruby/rbs_generator.rb +2 -4
- data/lib/t_ruby/runtime_validator.rb +41 -37
- data/lib/t_ruby/smt_solver.rb +31 -29
- data/lib/t_ruby/type_alias_registry.rb +1 -0
- data/lib/t_ruby/type_checker.rb +64 -63
- data/lib/t_ruby/type_erasure.rb +2 -4
- data/lib/t_ruby/type_inferencer.rb +22 -26
- data/lib/t_ruby/union_type_parser.rb +3 -3
- data/lib/t_ruby/version.rb +1 -1
- data/lib/t_ruby/version_checker.rb +50 -0
- data/lib/t_ruby/watcher.rb +18 -14
- data/lib/t_ruby.rb +1 -0
- metadata +5 -3
data/lib/t_ruby/watcher.rb
CHANGED
|
@@ -14,7 +14,7 @@ module TRuby
|
|
|
14
14
|
yellow: "\e[33m",
|
|
15
15
|
blue: "\e[34m",
|
|
16
16
|
cyan: "\e[36m",
|
|
17
|
-
gray: "\e[90m"
|
|
17
|
+
gray: "\e[90m",
|
|
18
18
|
}.freeze
|
|
19
19
|
|
|
20
20
|
attr_reader :incremental_compiler, :stats
|
|
@@ -47,7 +47,7 @@ module TRuby
|
|
|
47
47
|
@stats = {
|
|
48
48
|
total_compilations: 0,
|
|
49
49
|
incremental_hits: 0,
|
|
50
|
-
total_time: 0.0
|
|
50
|
+
total_time: 0.0,
|
|
51
51
|
}
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -92,8 +92,8 @@ module TRuby
|
|
|
92
92
|
|
|
93
93
|
def handle_changes(modified, added, removed)
|
|
94
94
|
changed_files = (modified + added)
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
.select { |f| f.end_with?(".trb") || f.end_with?(".rb") }
|
|
96
|
+
.reject { |f| @config.excluded?(f) }
|
|
97
97
|
return if changed_files.empty? && removed.empty?
|
|
98
98
|
|
|
99
99
|
puts
|
|
@@ -279,7 +279,7 @@ module TRuby
|
|
|
279
279
|
file: file,
|
|
280
280
|
line: line,
|
|
281
281
|
col: col,
|
|
282
|
-
message: message
|
|
282
|
+
message: message,
|
|
283
283
|
}
|
|
284
284
|
end
|
|
285
285
|
|
|
@@ -287,7 +287,10 @@ module TRuby
|
|
|
287
287
|
errors.each do |error|
|
|
288
288
|
puts
|
|
289
289
|
# TypeScript-style error format: file:line:col - error TSXXXX: message
|
|
290
|
-
location = "#{colorize(:cyan,
|
|
290
|
+
location = "#{colorize(:cyan,
|
|
291
|
+
relative_path(error[:file]))}:#{colorize(:yellow,
|
|
292
|
+
error[:line])}:#{colorize(:yellow,
|
|
293
|
+
error[:col])}"
|
|
291
294
|
puts "#{location} - #{colorize(:red, "error")} #{colorize(:gray, "TRB0001")}: #{error[:message]}"
|
|
292
295
|
end
|
|
293
296
|
end
|
|
@@ -298,7 +301,8 @@ module TRuby
|
|
|
298
301
|
end
|
|
299
302
|
|
|
300
303
|
def print_file_change_message
|
|
301
|
-
puts "#{colorize(:gray,
|
|
304
|
+
puts "#{colorize(:gray,
|
|
305
|
+
timestamp)} #{colorize(:bold, "File change detected. Starting incremental compilation...")}"
|
|
302
306
|
puts
|
|
303
307
|
end
|
|
304
308
|
|
|
@@ -306,12 +310,11 @@ module TRuby
|
|
|
306
310
|
puts
|
|
307
311
|
if @error_count.zero?
|
|
308
312
|
msg = "Found #{colorize(:green, "0 errors")}. Watching for file changes."
|
|
309
|
-
puts "#{colorize(:gray, timestamp)} #{msg}"
|
|
310
313
|
else
|
|
311
314
|
error_word = @error_count == 1 ? "error" : "errors"
|
|
312
315
|
msg = "Found #{colorize(:red, "#{@error_count} #{error_word}")}. Watching for file changes."
|
|
313
|
-
puts "#{colorize(:gray, timestamp)} #{msg}"
|
|
314
316
|
end
|
|
317
|
+
puts "#{colorize(:gray, timestamp)} #{msg}"
|
|
315
318
|
end
|
|
316
319
|
|
|
317
320
|
def print_watching_message
|
|
@@ -323,11 +326,12 @@ module TRuby
|
|
|
323
326
|
puts "#{colorize(:gray, timestamp)} #{colorize(:bold, "Watch Mode Statistics:")}"
|
|
324
327
|
puts " Total compilations: #{@stats[:total_compilations]}"
|
|
325
328
|
puts " Incremental cache hits: #{@stats[:incremental_hits]}"
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
329
|
+
total = @stats[:total_compilations] + @stats[:incremental_hits]
|
|
330
|
+
hit_rate = if total.positive?
|
|
331
|
+
(@stats[:incremental_hits].to_f / total * 100).round(1)
|
|
332
|
+
else
|
|
333
|
+
0
|
|
334
|
+
end
|
|
331
335
|
puts " Cache hit rate: #{hit_rate}%"
|
|
332
336
|
puts " Total compile time: #{@stats[:total_time].round(2)}s"
|
|
333
337
|
end
|
data/lib/t_ruby.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: t-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.37
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Y. Fred Kim
|
|
@@ -65,11 +65,13 @@ files:
|
|
|
65
65
|
- lib/t_ruby/type_inferencer.rb
|
|
66
66
|
- lib/t_ruby/union_type_parser.rb
|
|
67
67
|
- lib/t_ruby/version.rb
|
|
68
|
+
- lib/t_ruby/version_checker.rb
|
|
68
69
|
- lib/t_ruby/watcher.rb
|
|
69
70
|
homepage: https://type-ruby.github.io
|
|
70
71
|
licenses:
|
|
71
72
|
- MIT
|
|
72
|
-
metadata:
|
|
73
|
+
metadata:
|
|
74
|
+
rubygems_mfa_required: 'true'
|
|
73
75
|
rdoc_options: []
|
|
74
76
|
require_paths:
|
|
75
77
|
- lib
|
|
@@ -77,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
77
79
|
requirements:
|
|
78
80
|
- - ">="
|
|
79
81
|
- !ruby/object:Gem::Version
|
|
80
|
-
version: 3.
|
|
82
|
+
version: 3.1.0
|
|
81
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
84
|
requirements:
|
|
83
85
|
- - ">="
|