tapioca 0.17.10 → 0.19.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/README.md +3 -2
- data/lib/tapioca/bundler_ext/auto_require_hook.rb +0 -3
- data/lib/tapioca/cli.rb +1 -3
- data/lib/tapioca/commands/annotations.rb +0 -2
- data/lib/tapioca/commands/check_shims.rb +0 -1
- data/lib/tapioca/commands/command.rb +0 -1
- data/lib/tapioca/dsl/compiler.rb +7 -6
- data/lib/tapioca/dsl/compilers/aasm.rb +4 -5
- data/lib/tapioca/dsl/compilers/action_controller_helpers.rb +0 -4
- data/lib/tapioca/dsl/compilers/action_mailer.rb +0 -4
- data/lib/tapioca/dsl/compilers/action_text.rb +0 -4
- data/lib/tapioca/dsl/compilers/active_job.rb +0 -4
- data/lib/tapioca/dsl/compilers/active_model_attributes.rb +0 -4
- data/lib/tapioca/dsl/compilers/active_model_secure_password.rb +0 -4
- data/lib/tapioca/dsl/compilers/active_model_validations_confirmation.rb +0 -2
- data/lib/tapioca/dsl/compilers/active_record_associations.rb +0 -5
- data/lib/tapioca/dsl/compilers/active_record_columns.rb +0 -3
- data/lib/tapioca/dsl/compilers/active_record_delegated_types.rb +0 -3
- data/lib/tapioca/dsl/compilers/active_record_enum.rb +0 -4
- data/lib/tapioca/dsl/compilers/active_record_fixtures.rb +0 -4
- data/lib/tapioca/dsl/compilers/active_record_relations.rb +33 -6
- data/lib/tapioca/dsl/compilers/active_record_scope.rb +0 -1
- data/lib/tapioca/dsl/compilers/active_record_secure_token.rb +0 -3
- data/lib/tapioca/dsl/compilers/active_record_store.rb +0 -3
- data/lib/tapioca/dsl/compilers/active_record_typed_store.rb +0 -4
- data/lib/tapioca/dsl/compilers/active_resource.rb +0 -4
- data/lib/tapioca/dsl/compilers/active_storage.rb +0 -4
- data/lib/tapioca/dsl/compilers/active_support_concern.rb +0 -4
- data/lib/tapioca/dsl/compilers/active_support_current_attributes.rb +3 -18
- data/lib/tapioca/dsl/compilers/active_support_environment_inquirer.rb +60 -0
- data/lib/tapioca/dsl/compilers/active_support_time_ext.rb +0 -4
- data/lib/tapioca/dsl/compilers/config.rb +0 -4
- data/lib/tapioca/dsl/compilers/frozen_record.rb +0 -4
- data/lib/tapioca/dsl/compilers/graphql_input_object.rb +0 -4
- data/lib/tapioca/dsl/compilers/graphql_mutation.rb +0 -4
- data/lib/tapioca/dsl/compilers/identity_cache.rb +0 -4
- data/lib/tapioca/dsl/compilers/json_api_client_resource.rb +3 -17
- data/lib/tapioca/dsl/compilers/kredis.rb +0 -4
- data/lib/tapioca/dsl/compilers/mixed_in_class_attributes.rb +0 -4
- data/lib/tapioca/dsl/compilers/protobuf.rb +0 -4
- data/lib/tapioca/dsl/compilers/rails_generators.rb +0 -4
- data/lib/tapioca/dsl/compilers/sidekiq_worker.rb +0 -4
- data/lib/tapioca/dsl/compilers/smart_properties.rb +0 -4
- data/lib/tapioca/dsl/compilers/state_machines.rb +0 -4
- data/lib/tapioca/dsl/compilers/url_helpers.rb +0 -3
- data/lib/tapioca/dsl/helpers/active_model_type_helper.rb +0 -2
- data/lib/tapioca/dsl/helpers/active_record_column_type_helper.rb +0 -5
- data/lib/tapioca/dsl/helpers/active_record_constants_helper.rb +0 -2
- data/lib/tapioca/dsl/helpers/graphql_type_helper.rb +0 -2
- data/lib/tapioca/dsl/pipeline.rb +0 -2
- data/lib/tapioca/executor.rb +0 -2
- data/lib/tapioca/gem/events.rb +0 -15
- data/lib/tapioca/gem/listeners/base.rb +0 -1
- data/lib/tapioca/gem/listeners/documentation.rb +94 -0
- data/lib/tapioca/gem/listeners/dynamic_mixins.rb +0 -2
- data/lib/tapioca/gem/listeners/foreign_constants.rb +0 -2
- data/lib/tapioca/gem/listeners/methods.rb +0 -2
- data/lib/tapioca/gem/listeners/mixins.rb +0 -2
- data/lib/tapioca/gem/listeners/remove_empty_payload_scopes.rb +0 -2
- data/lib/tapioca/gem/listeners/sorbet_enums.rb +0 -2
- data/lib/tapioca/gem/listeners/sorbet_helpers.rb +0 -2
- data/lib/tapioca/gem/listeners/sorbet_props.rb +0 -1
- data/lib/tapioca/gem/listeners/sorbet_required_ancestors.rb +0 -2
- data/lib/tapioca/gem/listeners/sorbet_signatures.rb +1 -7
- data/lib/tapioca/gem/listeners/sorbet_type_variables.rb +0 -2
- data/lib/tapioca/gem/listeners/source_location.rb +6 -7
- data/lib/tapioca/gem/listeners/subconstants.rb +0 -2
- data/lib/tapioca/gem/listeners.rb +1 -1
- data/lib/tapioca/gem/pipeline.rb +2 -4
- data/lib/tapioca/gemfile.rb +0 -18
- data/lib/tapioca/helpers/cli_helper.rb +0 -1
- data/lib/tapioca/helpers/config_helper.rb +0 -1
- data/lib/tapioca/helpers/env_helper.rb +0 -1
- data/lib/tapioca/helpers/gem_helper.rb +0 -2
- data/lib/tapioca/helpers/git_attributes.rb +0 -2
- data/lib/tapioca/helpers/package_url.rb +416 -0
- data/lib/tapioca/helpers/rbi_files_helper.rb +0 -1
- data/lib/tapioca/helpers/rbi_helper.rb +7 -3
- data/lib/tapioca/helpers/sorbet_helper.rb +0 -2
- data/lib/tapioca/helpers/test/content.rb +0 -1
- data/lib/tapioca/helpers/test/dsl_compiler.rb +0 -3
- data/lib/tapioca/helpers/test/isolation.rb +0 -6
- data/lib/tapioca/helpers/test/template.rb +1 -9
- data/lib/tapioca/internal.rb +2 -2
- data/lib/tapioca/loaders/dsl.rb +0 -4
- data/lib/tapioca/loaders/gem.rb +0 -4
- data/lib/tapioca/loaders/loader.rb +0 -1
- data/lib/tapioca/rbi_ext/model.rb +4 -5
- data/lib/tapioca/rbi_formatter.rb +0 -2
- data/lib/tapioca/repo_index.rb +0 -3
- data/lib/tapioca/runtime/dynamic_mixin_compiler.rb +0 -3
- data/lib/tapioca/runtime/generic_type_registry.rb +0 -4
- data/lib/tapioca/runtime/reflection.rb +14 -13
- data/lib/tapioca/runtime/trackers/autoload.rb +0 -3
- data/lib/tapioca/runtime/trackers/constant_definition.rb +27 -5
- data/lib/tapioca/runtime/trackers/method_definition.rb +0 -1
- data/lib/tapioca/runtime/trackers/mixin.rb +0 -3
- data/lib/tapioca/runtime/trackers/required_ancestor.rb +0 -2
- data/lib/tapioca/runtime/trackers/tracker.rb +0 -3
- data/lib/tapioca/runtime/trackers.rb +0 -4
- data/lib/tapioca/sorbet_ext/generic_name_patch.rb +0 -2
- data/lib/tapioca/static/requires_compiler.rb +0 -2
- data/lib/tapioca/static/symbol_loader.rb +13 -6
- data/lib/tapioca/static/symbol_table_parser.rb +0 -4
- data/lib/tapioca/version.rb +1 -1
- data/lib/tapioca.rb +0 -2
- metadata +28 -15
- data/lib/tapioca/gem/listeners/yard_doc.rb +0 -112
- data/lib/tapioca/helpers/source_uri.rb +0 -84
- data/lib/tapioca/runtime/attached_class_of_32.rb +0 -20
- data/lib/tapioca/runtime/attached_class_of_legacy.rb +0 -24
|
@@ -12,7 +12,6 @@ module Tapioca
|
|
|
12
12
|
module Test
|
|
13
13
|
# @requires_ancestor: Kernel
|
|
14
14
|
module DslCompiler
|
|
15
|
-
extend T::Sig
|
|
16
15
|
include Isolation
|
|
17
16
|
include Content
|
|
18
17
|
include Template
|
|
@@ -50,8 +49,6 @@ module Tapioca
|
|
|
50
49
|
end
|
|
51
50
|
|
|
52
51
|
class CompilerContext
|
|
53
|
-
extend T::Sig
|
|
54
|
-
|
|
55
52
|
include SorbetHelper
|
|
56
53
|
|
|
57
54
|
#: singleton(Tapioca::Dsl::Compiler)
|
|
@@ -7,12 +7,9 @@ module Tapioca
|
|
|
7
7
|
# Copied from ActiveSupport::Testing::Isolation since we cannot require
|
|
8
8
|
# constants from ActiveSupport without polluting the global namespace.
|
|
9
9
|
module Isolation
|
|
10
|
-
extend T::Sig
|
|
11
10
|
require "thread"
|
|
12
11
|
|
|
13
12
|
class << self
|
|
14
|
-
extend T::Sig
|
|
15
|
-
|
|
16
13
|
#: -> bool
|
|
17
14
|
def forking_env?
|
|
18
15
|
!ENV["NO_FORK"] && Process.respond_to?(:fork)
|
|
@@ -30,7 +27,6 @@ module Tapioca
|
|
|
30
27
|
|
|
31
28
|
# @requires_ancestor: Kernel
|
|
32
29
|
module Forking
|
|
33
|
-
extend T::Sig
|
|
34
30
|
#: ?{ (?) -> untyped } -> String
|
|
35
31
|
def run_in_isolation(&_blk)
|
|
36
32
|
read, write = IO.pipe
|
|
@@ -72,8 +68,6 @@ module Tapioca
|
|
|
72
68
|
|
|
73
69
|
# @requires_ancestor: Kernel
|
|
74
70
|
module Subprocess
|
|
75
|
-
extend T::Sig
|
|
76
|
-
|
|
77
71
|
ORIG_ARGV = ARGV.dup #: Array[String]
|
|
78
72
|
|
|
79
73
|
# Crazy H4X to get this working in windows / jruby with
|
|
@@ -6,9 +6,6 @@ module Tapioca
|
|
|
6
6
|
module Test
|
|
7
7
|
# @requires_ancestor: Kernel
|
|
8
8
|
module Template
|
|
9
|
-
extend T::Sig
|
|
10
|
-
ERB_SUPPORTS_KVARGS = ::ERB.instance_method(:initialize).parameters.assoc(:key) #: [Symbol, Symbol]?
|
|
11
|
-
|
|
12
9
|
#: (String selector) -> bool
|
|
13
10
|
def ruby_version(selector)
|
|
14
11
|
::Gem::Requirement.new(selector).satisfied_by?(::Gem::Version.new(RUBY_VERSION))
|
|
@@ -21,12 +18,7 @@ module Tapioca
|
|
|
21
18
|
|
|
22
19
|
#: (String src, ?trim_mode: String) -> String
|
|
23
20
|
def template(src, trim_mode: ">")
|
|
24
|
-
erb =
|
|
25
|
-
::ERB.new(src, trim_mode: trim_mode)
|
|
26
|
-
else
|
|
27
|
-
::ERB.new(src, nil, trim_mode)
|
|
28
|
-
end
|
|
29
|
-
|
|
21
|
+
erb = ::ERB.new(src, trim_mode: trim_mode)
|
|
30
22
|
erb.result(binding)
|
|
31
23
|
end
|
|
32
24
|
|
data/lib/tapioca/internal.rb
CHANGED
|
@@ -41,7 +41,7 @@ require "shellwords"
|
|
|
41
41
|
require "tempfile"
|
|
42
42
|
require "thor"
|
|
43
43
|
require "yaml"
|
|
44
|
-
require "
|
|
44
|
+
require "rubydex"
|
|
45
45
|
require "prism"
|
|
46
46
|
|
|
47
47
|
require "tapioca/helpers/gem_helper"
|
|
@@ -49,7 +49,7 @@ require "tapioca/helpers/git_attributes"
|
|
|
49
49
|
require "tapioca/helpers/sorbet_helper"
|
|
50
50
|
require "tapioca/helpers/rbi_helper"
|
|
51
51
|
|
|
52
|
-
require "tapioca/helpers/
|
|
52
|
+
require "tapioca/helpers/package_url"
|
|
53
53
|
require "tapioca/helpers/cli_helper"
|
|
54
54
|
require "tapioca/helpers/config_helper"
|
|
55
55
|
require "tapioca/helpers/rbi_files_helper"
|
data/lib/tapioca/loaders/dsl.rb
CHANGED
data/lib/tapioca/loaders/gem.rb
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
module RBI
|
|
5
5
|
class Tree
|
|
6
|
-
extend T::Sig
|
|
7
|
-
|
|
8
6
|
#: (T::Module[top] constant) ?{ (Scope scope) -> void } -> Scope
|
|
9
7
|
def create_path(constant, &block)
|
|
10
8
|
constant_name = Tapioca::Runtime::Reflection.name_of(constant)
|
|
@@ -67,10 +65,11 @@ module RBI
|
|
|
67
65
|
#| ?return_type: String?,
|
|
68
66
|
#| ?class_method: bool,
|
|
69
67
|
#| ?visibility: RBI::Visibility,
|
|
70
|
-
#| ?comments: Array[RBI::Comment]
|
|
68
|
+
#| ?comments: Array[RBI::Comment],
|
|
69
|
+
#| ?type_params: Array[String]
|
|
71
70
|
#| ) ?{ (RBI::Method node) -> void } -> void
|
|
72
71
|
def create_method(name, parameters: [], return_type: nil, class_method: false, visibility: RBI::Public.new,
|
|
73
|
-
comments: [], &block)
|
|
72
|
+
comments: [], type_params: [], &block)
|
|
74
73
|
return unless Tapioca::RBIHelper.valid_method_name?(name)
|
|
75
74
|
|
|
76
75
|
sigs = []
|
|
@@ -79,7 +78,7 @@ module RBI
|
|
|
79
78
|
# If there is no block, and the params and return type have not been supplied, then
|
|
80
79
|
# we create a single signature with the given parameters and return type
|
|
81
80
|
params = parameters.map { |param| RBI::SigParam.new(param.param.name.to_s, param.type) }
|
|
82
|
-
sigs << RBI::Sig.new(params: params, return_type: return_type || "T.untyped")
|
|
81
|
+
sigs << RBI::Sig.new(params: params, return_type: return_type || "T.untyped", type_params: type_params)
|
|
83
82
|
end
|
|
84
83
|
|
|
85
84
|
method = RBI::Method.new(
|
data/lib/tapioca/repo_index.rb
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
module Tapioca
|
|
5
5
|
module Runtime
|
|
6
6
|
class DynamicMixinCompiler
|
|
7
|
-
extend T::Sig
|
|
8
7
|
include Runtime::Reflection
|
|
9
8
|
|
|
10
9
|
#: Array[T::Module[top]]
|
|
@@ -95,8 +94,6 @@ module Tapioca
|
|
|
95
94
|
end
|
|
96
95
|
|
|
97
96
|
class << self
|
|
98
|
-
extend T::Sig
|
|
99
|
-
|
|
100
97
|
T::Sig::WithoutRuntime.sig { params(symbol: Symbol, args: T.untyped).returns(T.untyped) }
|
|
101
98
|
def method_missing(symbol, *args)
|
|
102
99
|
# Similarly, we need this here so that we can handle any
|
|
@@ -26,8 +26,6 @@ module Tapioca
|
|
|
26
26
|
@type_variables = {}.compare_by_identity #: Hash[T::Module[top], Array[TypeVariableModule]]
|
|
27
27
|
|
|
28
28
|
class GenericType < T::Types::Simple
|
|
29
|
-
extend T::Sig
|
|
30
|
-
|
|
31
29
|
#: (T::Module[top] raw_type, T::Module[top] underlying_type) -> void
|
|
32
30
|
def initialize(raw_type, underlying_type)
|
|
33
31
|
super(raw_type)
|
|
@@ -43,8 +41,6 @@ module Tapioca
|
|
|
43
41
|
end
|
|
44
42
|
|
|
45
43
|
class << self
|
|
46
|
-
extend T::Sig
|
|
47
|
-
|
|
48
44
|
# This method is responsible for building the name of the instantiated concrete type
|
|
49
45
|
# and cloning the given constant so that we can return a type that is the same
|
|
50
46
|
# as the current type but is a different instance and has a different name method.
|
|
@@ -3,21 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
require "tapioca/runtime/source_location"
|
|
5
5
|
|
|
6
|
-
# On Ruby 3.2 or newer, Class defines an attached_object method that returns the
|
|
7
|
-
# attached class of a singleton class without iterating ObjectSpace. On older
|
|
8
|
-
# versions of Ruby, we fall back to iterating ObjectSpace.
|
|
9
|
-
if Class.method_defined?(:attached_object)
|
|
10
|
-
require "tapioca/runtime/attached_class_of_32"
|
|
11
|
-
else
|
|
12
|
-
require "tapioca/runtime/attached_class_of_legacy"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
6
|
module Tapioca
|
|
16
7
|
module Runtime
|
|
17
8
|
module Reflection
|
|
18
|
-
include AttachedClassOf
|
|
19
|
-
|
|
20
|
-
extend T::Sig
|
|
21
9
|
extend self
|
|
22
10
|
|
|
23
11
|
CLASS_METHOD = Kernel.instance_method(:class) #: UnboundMethod
|
|
@@ -81,6 +69,12 @@ module Tapioca
|
|
|
81
69
|
SUPERCLASS_METHOD.bind_call(constant)
|
|
82
70
|
end
|
|
83
71
|
|
|
72
|
+
#: (Class[top] singleton_class) -> T::Module[top]?
|
|
73
|
+
def attached_class_of(singleton_class)
|
|
74
|
+
result = singleton_class.attached_object
|
|
75
|
+
Module === result ? result : nil
|
|
76
|
+
end
|
|
77
|
+
|
|
84
78
|
#: (BasicObject object) -> Integer
|
|
85
79
|
def object_id_of(object)
|
|
86
80
|
OBJECT_ID_METHOD.bind_call(object)
|
|
@@ -219,9 +213,16 @@ module Tapioca
|
|
|
219
213
|
|
|
220
214
|
#: (T::Module[top] constant) -> Set[String]
|
|
221
215
|
def file_candidates_for(constant)
|
|
222
|
-
|
|
216
|
+
# Grab all source files for (relevant) methods defined on the constant
|
|
217
|
+
candidates = relevant_methods_for(constant).filter_map do |method|
|
|
223
218
|
method.source_location&.first
|
|
224
219
|
end.to_set
|
|
220
|
+
|
|
221
|
+
# Add the source file for the constant definition itself, if available.
|
|
222
|
+
source_location_candidate = const_source_location(name_of(constant).to_s)&.file
|
|
223
|
+
candidates.add(source_location_candidate) if source_location_candidate
|
|
224
|
+
|
|
225
|
+
candidates
|
|
225
226
|
end
|
|
226
227
|
|
|
227
228
|
#: (T::Module[top] constant) -> untyped
|
|
@@ -6,13 +6,10 @@ module Tapioca
|
|
|
6
6
|
module Trackers
|
|
7
7
|
module Autoload
|
|
8
8
|
extend Tracker
|
|
9
|
-
extend T::Sig
|
|
10
9
|
|
|
11
10
|
@constant_names_registered_for_autoload = [] #: Array[String]
|
|
12
11
|
|
|
13
12
|
class << self
|
|
14
|
-
extend T::Sig
|
|
15
|
-
|
|
16
13
|
#: -> void
|
|
17
14
|
def eager_load_all!
|
|
18
15
|
Runtime.with_disabled_exits do
|
|
@@ -11,7 +11,6 @@ module Tapioca
|
|
|
11
11
|
module ConstantDefinition
|
|
12
12
|
extend Tracker
|
|
13
13
|
extend Reflection
|
|
14
|
-
extend T::Sig
|
|
15
14
|
|
|
16
15
|
@class_files = {}.compare_by_identity #: Hash[T::Module[top], Set[SourceLocation]]
|
|
17
16
|
|
|
@@ -36,7 +35,7 @@ module Tapioca
|
|
|
36
35
|
])
|
|
37
36
|
end
|
|
38
37
|
|
|
39
|
-
(
|
|
38
|
+
ConstantDefinition.register(key, loc)
|
|
40
39
|
end
|
|
41
40
|
|
|
42
41
|
@creturn_tracepoint = TracePoint.trace(:c_return) do |tp|
|
|
@@ -46,12 +45,10 @@ module Tapioca
|
|
|
46
45
|
next unless Module === key
|
|
47
46
|
|
|
48
47
|
loc = build_source_location(tp, caller_locations)
|
|
49
|
-
(
|
|
48
|
+
ConstantDefinition.register(key, loc)
|
|
50
49
|
end
|
|
51
50
|
|
|
52
51
|
class << self
|
|
53
|
-
extend T::Sig
|
|
54
|
-
|
|
55
52
|
def disable!
|
|
56
53
|
@class_tracepoint.disable
|
|
57
54
|
@creturn_tracepoint.disable
|
|
@@ -67,6 +64,22 @@ module Tapioca
|
|
|
67
64
|
SourceLocation.from_loc([file || "", lineno])
|
|
68
65
|
end
|
|
69
66
|
|
|
67
|
+
def register(constant, loc)
|
|
68
|
+
return unless loc
|
|
69
|
+
|
|
70
|
+
(@class_files[constant] ||= Set.new) << loc
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def register_cname(cname, namespace, locations)
|
|
74
|
+
return if namespace.autoload?(cname)
|
|
75
|
+
|
|
76
|
+
key = Reflection.constantize(cname, namespace: namespace, inherit: true)
|
|
77
|
+
return unless Module === key
|
|
78
|
+
|
|
79
|
+
loc = Reflection.resolve_loc(locations)
|
|
80
|
+
ConstantDefinition.register(key, loc)
|
|
81
|
+
end
|
|
82
|
+
|
|
70
83
|
# Returns the files in which this class or module was opened. Doesn't know
|
|
71
84
|
# about situations where the class was opened prior to +require+ing,
|
|
72
85
|
# or where metaprogramming was used via +eval+, etc.
|
|
@@ -84,3 +97,12 @@ module Tapioca
|
|
|
84
97
|
end
|
|
85
98
|
end
|
|
86
99
|
end
|
|
100
|
+
|
|
101
|
+
class Module
|
|
102
|
+
prepend(::Module.new do
|
|
103
|
+
def const_added(cname)
|
|
104
|
+
::Tapioca::Runtime::Trackers::ConstantDefinition.register_cname(cname, self, Kernel.caller_locations)
|
|
105
|
+
super(cname)
|
|
106
|
+
end
|
|
107
|
+
end)
|
|
108
|
+
end
|
|
@@ -6,7 +6,6 @@ module Tapioca
|
|
|
6
6
|
module Trackers
|
|
7
7
|
module Mixin
|
|
8
8
|
extend Tracker
|
|
9
|
-
extend T::Sig
|
|
10
9
|
|
|
11
10
|
@constants_to_mixin_locations = {}.compare_by_identity
|
|
12
11
|
@mixins_to_constants = {}.compare_by_identity
|
|
@@ -20,8 +19,6 @@ module Tapioca
|
|
|
20
19
|
end
|
|
21
20
|
|
|
22
21
|
class << self
|
|
23
|
-
extend T::Sig
|
|
24
|
-
|
|
25
22
|
#: [Result] { -> Result } -> Result
|
|
26
23
|
def with_disabled_registration(&block)
|
|
27
24
|
with_disabled_tracker(&block)
|
|
@@ -6,13 +6,9 @@ require "tapioca/runtime/trackers/tracker"
|
|
|
6
6
|
module Tapioca
|
|
7
7
|
module Runtime
|
|
8
8
|
module Trackers
|
|
9
|
-
extend T::Sig
|
|
10
|
-
|
|
11
9
|
@trackers = [] #: Array[Tracker]
|
|
12
10
|
|
|
13
11
|
class << self
|
|
14
|
-
extend T::Sig
|
|
15
|
-
|
|
16
12
|
#: [Return] { -> Return } -> Return
|
|
17
13
|
def with_trackers_enabled(&blk)
|
|
18
14
|
# Currently this is a dirty hack to ensure disabling trackers
|
|
@@ -120,8 +120,6 @@ module Tapioca
|
|
|
120
120
|
# need to do any matching of constants to type variables to bind their names, Ruby will
|
|
121
121
|
# do that automatically for us and we get the `name` method for free from `Module`.
|
|
122
122
|
class TypeVariableModule < Module
|
|
123
|
-
extend T::Sig
|
|
124
|
-
|
|
125
123
|
class Type < T::Enum
|
|
126
124
|
enums do
|
|
127
125
|
Member = new("type_member")
|
|
@@ -5,7 +5,6 @@ module Tapioca
|
|
|
5
5
|
module Static
|
|
6
6
|
module SymbolLoader
|
|
7
7
|
class << self
|
|
8
|
-
extend T::Sig
|
|
9
8
|
include SorbetHelper
|
|
10
9
|
include Runtime::Reflection
|
|
11
10
|
|
|
@@ -19,6 +18,19 @@ module Tapioca
|
|
|
19
18
|
T.must(@payload_symbols)
|
|
20
19
|
end
|
|
21
20
|
|
|
21
|
+
#: (Array[Pathname] paths) -> Rubydex::Graph
|
|
22
|
+
def graph_from_paths(paths)
|
|
23
|
+
graph = Rubydex::Graph.new
|
|
24
|
+
graph.index_all(paths.map(&:to_s))
|
|
25
|
+
graph.resolve
|
|
26
|
+
graph
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
#: (Gemfile::GemSpec gem) -> Set[String]
|
|
30
|
+
def gem_symbols(gem)
|
|
31
|
+
symbols_from_paths(gem.files)
|
|
32
|
+
end
|
|
33
|
+
|
|
22
34
|
#: (Gemfile::GemSpec gem) -> Set[String]
|
|
23
35
|
def engine_symbols(gem)
|
|
24
36
|
gem_engine = engines.find do |engine|
|
|
@@ -44,11 +56,6 @@ module Tapioca
|
|
|
44
56
|
Set.new
|
|
45
57
|
end
|
|
46
58
|
|
|
47
|
-
#: (Gemfile::GemSpec gem) -> Set[String]
|
|
48
|
-
def gem_symbols(gem)
|
|
49
|
-
symbols_from_paths(gem.files)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
59
|
#: (Array[Pathname] paths) -> Set[String]
|
|
53
60
|
def symbols_from_paths(paths)
|
|
54
61
|
return Set.new if paths.empty?
|
|
@@ -4,13 +4,9 @@
|
|
|
4
4
|
module Tapioca
|
|
5
5
|
module Static
|
|
6
6
|
class SymbolTableParser
|
|
7
|
-
extend T::Sig
|
|
8
|
-
|
|
9
7
|
SKIP_PARSE_KINDS = ["CLASS_OR_MODULE", "STATIC_FIELD"].freeze #: Array[String]
|
|
10
8
|
|
|
11
9
|
class << self
|
|
12
|
-
extend T::Sig
|
|
13
|
-
|
|
14
10
|
#: (String json_string) -> Set[String]
|
|
15
11
|
def parse_json(json_string)
|
|
16
12
|
obj = JSON.parse(json_string)
|
data/lib/tapioca/version.rb
CHANGED
data/lib/tapioca.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tapioca
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.19.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ufuk Kayserilioglu
|
|
@@ -83,47 +83,47 @@ dependencies:
|
|
|
83
83
|
- !ruby/object:Gem::Version
|
|
84
84
|
version: 0.2.2
|
|
85
85
|
- !ruby/object:Gem::Dependency
|
|
86
|
-
name:
|
|
86
|
+
name: rubydex
|
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
|
88
88
|
requirements:
|
|
89
89
|
- - ">="
|
|
90
90
|
- !ruby/object:Gem::Version
|
|
91
|
-
version: 0.
|
|
91
|
+
version: 0.1.0.beta10
|
|
92
92
|
type: :runtime
|
|
93
93
|
prerelease: false
|
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
|
95
95
|
requirements:
|
|
96
96
|
- - ">="
|
|
97
97
|
- !ruby/object:Gem::Version
|
|
98
|
-
version: 0.
|
|
98
|
+
version: 0.1.0.beta10
|
|
99
99
|
- !ruby/object:Gem::Dependency
|
|
100
|
-
name:
|
|
100
|
+
name: sorbet-static-and-runtime
|
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
|
102
102
|
requirements:
|
|
103
103
|
- - ">="
|
|
104
104
|
- !ruby/object:Gem::Version
|
|
105
|
-
version:
|
|
105
|
+
version: 0.5.11087
|
|
106
106
|
type: :runtime
|
|
107
107
|
prerelease: false
|
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
|
109
109
|
requirements:
|
|
110
110
|
- - ">="
|
|
111
111
|
- !ruby/object:Gem::Version
|
|
112
|
-
version:
|
|
112
|
+
version: 0.5.11087
|
|
113
113
|
- !ruby/object:Gem::Dependency
|
|
114
|
-
name:
|
|
114
|
+
name: thor
|
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
|
116
116
|
requirements:
|
|
117
117
|
- - ">="
|
|
118
118
|
- !ruby/object:Gem::Version
|
|
119
|
-
version:
|
|
119
|
+
version: 1.2.0
|
|
120
120
|
type: :runtime
|
|
121
121
|
prerelease: false
|
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
|
123
123
|
requirements:
|
|
124
124
|
- - ">="
|
|
125
125
|
- !ruby/object:Gem::Version
|
|
126
|
-
version:
|
|
126
|
+
version: 1.2.0
|
|
127
127
|
- !ruby/object:Gem::Dependency
|
|
128
128
|
name: rbi
|
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -152,6 +152,20 @@ dependencies:
|
|
|
152
152
|
- - ">="
|
|
153
153
|
- !ruby/object:Gem::Version
|
|
154
154
|
version: 1.7.9
|
|
155
|
+
- !ruby/object:Gem::Dependency
|
|
156
|
+
name: tsort
|
|
157
|
+
requirement: !ruby/object:Gem::Requirement
|
|
158
|
+
requirements:
|
|
159
|
+
- - ">="
|
|
160
|
+
- !ruby/object:Gem::Version
|
|
161
|
+
version: '0'
|
|
162
|
+
type: :runtime
|
|
163
|
+
prerelease: false
|
|
164
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
165
|
+
requirements:
|
|
166
|
+
- - ">="
|
|
167
|
+
- !ruby/object:Gem::Version
|
|
168
|
+
version: '0'
|
|
155
169
|
email:
|
|
156
170
|
- ruby@shopify.com
|
|
157
171
|
executables:
|
|
@@ -210,6 +224,7 @@ files:
|
|
|
210
224
|
- lib/tapioca/dsl/compilers/active_storage.rb
|
|
211
225
|
- lib/tapioca/dsl/compilers/active_support_concern.rb
|
|
212
226
|
- lib/tapioca/dsl/compilers/active_support_current_attributes.rb
|
|
227
|
+
- lib/tapioca/dsl/compilers/active_support_environment_inquirer.rb
|
|
213
228
|
- lib/tapioca/dsl/compilers/active_support_time_ext.rb
|
|
214
229
|
- lib/tapioca/dsl/compilers/config.rb
|
|
215
230
|
- lib/tapioca/dsl/compilers/frozen_record.rb
|
|
@@ -238,6 +253,7 @@ files:
|
|
|
238
253
|
- lib/tapioca/gem/events.rb
|
|
239
254
|
- lib/tapioca/gem/listeners.rb
|
|
240
255
|
- lib/tapioca/gem/listeners/base.rb
|
|
256
|
+
- lib/tapioca/gem/listeners/documentation.rb
|
|
241
257
|
- lib/tapioca/gem/listeners/dynamic_mixins.rb
|
|
242
258
|
- lib/tapioca/gem/listeners/foreign_constants.rb
|
|
243
259
|
- lib/tapioca/gem/listeners/methods.rb
|
|
@@ -251,7 +267,6 @@ files:
|
|
|
251
267
|
- lib/tapioca/gem/listeners/sorbet_type_variables.rb
|
|
252
268
|
- lib/tapioca/gem/listeners/source_location.rb
|
|
253
269
|
- lib/tapioca/gem/listeners/subconstants.rb
|
|
254
|
-
- lib/tapioca/gem/listeners/yard_doc.rb
|
|
255
270
|
- lib/tapioca/gem/pipeline.rb
|
|
256
271
|
- lib/tapioca/gem_info.rb
|
|
257
272
|
- lib/tapioca/gemfile.rb
|
|
@@ -260,10 +275,10 @@ files:
|
|
|
260
275
|
- lib/tapioca/helpers/env_helper.rb
|
|
261
276
|
- lib/tapioca/helpers/gem_helper.rb
|
|
262
277
|
- lib/tapioca/helpers/git_attributes.rb
|
|
278
|
+
- lib/tapioca/helpers/package_url.rb
|
|
263
279
|
- lib/tapioca/helpers/rbi_files_helper.rb
|
|
264
280
|
- lib/tapioca/helpers/rbi_helper.rb
|
|
265
281
|
- lib/tapioca/helpers/sorbet_helper.rb
|
|
266
|
-
- lib/tapioca/helpers/source_uri.rb
|
|
267
282
|
- lib/tapioca/helpers/test/content.rb
|
|
268
283
|
- lib/tapioca/helpers/test/dsl_compiler.rb
|
|
269
284
|
- lib/tapioca/helpers/test/isolation.rb
|
|
@@ -276,8 +291,6 @@ files:
|
|
|
276
291
|
- lib/tapioca/rbi_formatter.rb
|
|
277
292
|
- lib/tapioca/rbs/rewriter.rb
|
|
278
293
|
- lib/tapioca/repo_index.rb
|
|
279
|
-
- lib/tapioca/runtime/attached_class_of_32.rb
|
|
280
|
-
- lib/tapioca/runtime/attached_class_of_legacy.rb
|
|
281
294
|
- lib/tapioca/runtime/dynamic_mixin_compiler.rb
|
|
282
295
|
- lib/tapioca/runtime/generic_type_registry.rb
|
|
283
296
|
- lib/tapioca/runtime/helpers.rb
|
|
@@ -317,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
317
330
|
- !ruby/object:Gem::Version
|
|
318
331
|
version: '0'
|
|
319
332
|
requirements: []
|
|
320
|
-
rubygems_version:
|
|
333
|
+
rubygems_version: 4.0.3
|
|
321
334
|
specification_version: 4
|
|
322
335
|
summary: A Ruby Interface file generator for gems, core types and the Ruby standard
|
|
323
336
|
library
|