oriole 0.1.0.alpha.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.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +56 -0
  3. data/.rubocop.yml +32 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +1 -0
  6. data/Gemfile +20 -0
  7. data/Gemfile.lock +121 -0
  8. data/LICENSE +21 -0
  9. data/README.md +84 -0
  10. data/Rakefile +12 -0
  11. data/bench/bench.rb +35 -0
  12. data/bench/execute.rb +66 -0
  13. data/bench/schemas/bluejay.rb +149 -0
  14. data/bench/schemas/models.rb +216 -0
  15. data/bench/schemas/oriole.rb +144 -0
  16. data/bin/console +15 -0
  17. data/bin/setup +8 -0
  18. data/bin/style +2 -0
  19. data/bin/tapioca +27 -0
  20. data/bin/typecheck +2 -0
  21. data/lib/oriole/builtin_scalar_definition.rb +53 -0
  22. data/lib/oriole/definition/abstract/definition.rb +21 -0
  23. data/lib/oriole/definition/abstract/field_definition.rb +22 -0
  24. data/lib/oriole/definition/abstract/object_type_definition.rb +21 -0
  25. data/lib/oriole/definition/abstract/schema_definition.rb +18 -0
  26. data/lib/oriole/definition/abstract/visibility.rb +18 -0
  27. data/lib/oriole/definition/base_output_type.rb +13 -0
  28. data/lib/oriole/definition/field_definition.rb +27 -0
  29. data/lib/oriole/definition/object_type.rb +40 -0
  30. data/lib/oriole/definition/output_type.rb +79 -0
  31. data/lib/oriole/definition/schema.rb +45 -0
  32. data/lib/oriole/definition/visibility_scoped/object_type_definition.rb +62 -0
  33. data/lib/oriole/definition/visibility_scoped/schema_definition.rb +26 -0
  34. data/lib/oriole/execution/coerce_result.rb +16 -0
  35. data/lib/oriole/execution/engine.rb +207 -0
  36. data/lib/oriole/version.rb +6 -0
  37. data/lib/oriole.rb +14 -0
  38. data/oriole.gemspec +38 -0
  39. data/rakelib/bench.rake +69 -0
  40. data/sorbet/config +5 -0
  41. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  42. data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
  43. data/sorbet/rbi/gems/base64@0.1.1.rbi +172 -0
  44. data/sorbet/rbi/gems/bluejay@0.1.0.alpha.2-a45c1b3b47aa4524f94bbe03db5ff1ae792afd09.rbi +1206 -0
  45. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1083 -0
  46. data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
  47. data/sorbet/rbi/gems/json@2.6.3.rbi +1533 -0
  48. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
  49. data/sorbet/rbi/gems/minitest@5.19.0.rbi +1491 -0
  50. data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
  51. data/sorbet/rbi/gems/parallel@1.23.0.rbi +273 -0
  52. data/sorbet/rbi/gems/parser@3.2.2.3.rbi +7253 -0
  53. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
  54. data/sorbet/rbi/gems/racc@1.7.1.rbi +161 -0
  55. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +402 -0
  56. data/sorbet/rbi/gems/rake@13.0.6.rbi +3024 -0
  57. data/sorbet/rbi/gems/rbi@0.0.17.rbi +2972 -0
  58. data/sorbet/rbi/gems/regexp_parser@2.8.1.rbi +3749 -0
  59. data/sorbet/rbi/gems/rexml@3.2.6.rbi +4781 -0
  60. data/sorbet/rbi/gems/rubocop-ast@1.29.0.rbi +7006 -0
  61. data/sorbet/rbi/gems/rubocop-minitest@0.27.0.rbi +2371 -0
  62. data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +328 -0
  63. data/sorbet/rbi/gems/rubocop-shopify@2.14.0.rbi +8 -0
  64. data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +975 -0
  65. data/sorbet/rbi/gems/rubocop@1.56.1.rbi +56525 -0
  66. data/sorbet/rbi/gems/ruby-lsp@0.4.5.rbi +11 -0
  67. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1317 -0
  68. data/sorbet/rbi/gems/spoom@1.2.3.rbi +3203 -0
  69. data/sorbet/rbi/gems/syntax_tree@6.1.1.rbi +22855 -0
  70. data/sorbet/rbi/gems/tapioca@0.11.8.rbi +3349 -0
  71. data/sorbet/rbi/gems/thor@1.2.2.rbi +3965 -0
  72. data/sorbet/rbi/gems/tinygql@0.1.4.rbi +2363 -0
  73. data/sorbet/rbi/gems/unicode-display_width@2.4.2.rbi +65 -0
  74. data/sorbet/rbi/gems/unparser@0.6.8.rbi +4525 -0
  75. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +428 -0
  76. data/sorbet/rbi/gems/yard@0.9.34.rbi +18219 -0
  77. data/sorbet/rbi/gems/zeitwerk@2.6.11.rbi +999 -0
  78. data/sorbet/tapioca/config.yml +13 -0
  79. data/sorbet/tapioca/require.rb +5 -0
  80. metadata +208 -0
@@ -0,0 +1,999 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `zeitwerk` gem.
5
+ # Please instead update this file by running `bin/tapioca gem zeitwerk`.
6
+
7
+ # source://zeitwerk//lib/zeitwerk/kernel.rb#3
8
+ module Kernel
9
+ private
10
+
11
+ # source://zeitwerk//lib/zeitwerk/kernel.rb#27
12
+ def require(path); end
13
+
14
+ class << self
15
+ # source://zeitwerk//lib/zeitwerk/kernel.rb#27
16
+ def require(path); end
17
+ end
18
+ end
19
+
20
+ # source://zeitwerk//lib/zeitwerk.rb#3
21
+ module Zeitwerk
22
+ class << self
23
+ # This is a dangerous method.
24
+ #
25
+ # source://zeitwerk//lib/zeitwerk.rb#20
26
+ def with_loader; end
27
+ end
28
+ end
29
+
30
+ # source://zeitwerk//lib/zeitwerk/error.rb#4
31
+ class Zeitwerk::Error < ::StandardError; end
32
+
33
+ # Centralizes the logic for the trace point used to detect the creation of
34
+ # explicit namespaces, needed to descend into matching subdirectories right
35
+ # after the constant has been defined.
36
+ #
37
+ # The implementation assumes an explicit namespace is managed by one loader.
38
+ # Loaders that reopen namespaces owned by other projects are responsible for
39
+ # loading their constant before setup. This is documented.
40
+ #
41
+ # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#11
42
+ module Zeitwerk::ExplicitNamespace
43
+ extend ::Zeitwerk::RealModName
44
+
45
+ class << self
46
+ # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#35
47
+ def __register(cpath, loader); end
48
+
49
+ # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#53
50
+ def __registered?(cpath); end
51
+
52
+ # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#45
53
+ def __unregister_loader(loader); end
54
+
55
+ private
56
+
57
+ # Maps constant paths that correspond to explicit namespaces according to
58
+ # the file system, to the loader responsible for them.
59
+ #
60
+ # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#20
61
+ def cpaths; end
62
+
63
+ # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#58
64
+ def disable_tracer_if_unneeded; end
65
+
66
+ # Returns the value of attribute mutex.
67
+ #
68
+ # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#24
69
+ def mutex; end
70
+
71
+ # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#35
72
+ def register(cpath, loader); end
73
+
74
+ # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#53
75
+ def registered?(cpath); end
76
+
77
+ # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#65
78
+ def tracepoint_class_callback(event); end
79
+
80
+ # Returns the value of attribute tracer.
81
+ #
82
+ # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#28
83
+ def tracer; end
84
+
85
+ # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#45
86
+ def unregister_loader(loader); end
87
+ end
88
+ end
89
+
90
+ # source://zeitwerk//lib/zeitwerk/gem_inflector.rb#4
91
+ class Zeitwerk::GemInflector < ::Zeitwerk::Inflector
92
+ # @return [GemInflector] a new instance of GemInflector
93
+ #
94
+ # source://zeitwerk//lib/zeitwerk/gem_inflector.rb#6
95
+ def initialize(root_file); end
96
+
97
+ # source://zeitwerk//lib/zeitwerk/gem_inflector.rb#13
98
+ def camelize(basename, abspath); end
99
+ end
100
+
101
+ # @private
102
+ #
103
+ # source://zeitwerk//lib/zeitwerk/gem_loader.rb#5
104
+ class Zeitwerk::GemLoader < ::Zeitwerk::Loader
105
+ # @return [GemLoader] a new instance of GemLoader
106
+ #
107
+ # source://zeitwerk//lib/zeitwerk/gem_loader.rb#19
108
+ def initialize(root_file, namespace:, warn_on_extra_files:); end
109
+
110
+ # source://zeitwerk//lib/zeitwerk/gem_loader.rb#34
111
+ def setup; end
112
+
113
+ private
114
+
115
+ # source://zeitwerk//lib/zeitwerk/gem_loader.rb#42
116
+ def warn_on_extra_files; end
117
+
118
+ class << self
119
+ # @private
120
+ #
121
+ # source://zeitwerk//lib/zeitwerk/gem_loader.rb#14
122
+ def __new(root_file, namespace:, warn_on_extra_files:); end
123
+
124
+ private
125
+
126
+ def new(*_arg0); end
127
+ end
128
+ end
129
+
130
+ # source://zeitwerk//lib/zeitwerk/inflector.rb#4
131
+ class Zeitwerk::Inflector
132
+ # Very basic snake case -> camel case conversion.
133
+ #
134
+ # inflector = Zeitwerk::Inflector.new
135
+ # inflector.camelize("post", ...) # => "Post"
136
+ # inflector.camelize("users_controller", ...) # => "UsersController"
137
+ # inflector.camelize("api", ...) # => "Api"
138
+ #
139
+ # Takes into account hard-coded mappings configured with `inflect`.
140
+ #
141
+ # source://zeitwerk//lib/zeitwerk/inflector.rb#15
142
+ def camelize(basename, _abspath); end
143
+
144
+ # Configures hard-coded inflections:
145
+ #
146
+ # inflector = Zeitwerk::Inflector.new
147
+ # inflector.inflect(
148
+ # "html_parser" => "HTMLParser",
149
+ # "mysql_adapter" => "MySQLAdapter"
150
+ # )
151
+ #
152
+ # inflector.camelize("html_parser", abspath) # => "HTMLParser"
153
+ # inflector.camelize("mysql_adapter", abspath) # => "MySQLAdapter"
154
+ # inflector.camelize("users_controller", abspath) # => "UsersController"
155
+ #
156
+ # source://zeitwerk//lib/zeitwerk/inflector.rb#32
157
+ def inflect(inflections); end
158
+
159
+ private
160
+
161
+ # Hard-coded basename to constant name user maps that override the default
162
+ # inflection logic.
163
+ #
164
+ # source://zeitwerk//lib/zeitwerk/inflector.rb#42
165
+ def overrides; end
166
+ end
167
+
168
+ # This is a private module.
169
+ #
170
+ # source://zeitwerk//lib/zeitwerk/internal.rb#4
171
+ module Zeitwerk::Internal
172
+ # source://zeitwerk//lib/zeitwerk/internal.rb#5
173
+ def internal(method_name); end
174
+ end
175
+
176
+ # source://zeitwerk//lib/zeitwerk/loader.rb#7
177
+ class Zeitwerk::Loader
178
+ include ::Zeitwerk::RealModName
179
+ include ::Zeitwerk::Loader::Callbacks
180
+ include ::Zeitwerk::Loader::Helpers
181
+ include ::Zeitwerk::Loader::Config
182
+ include ::Zeitwerk::Loader::EagerLoad
183
+ extend ::Zeitwerk::Internal
184
+ extend ::Zeitwerk::RealModName
185
+
186
+ # @return [Loader] a new instance of Loader
187
+ #
188
+ # source://zeitwerk//lib/zeitwerk/loader.rb#99
189
+ def initialize; end
190
+
191
+ # source://zeitwerk//lib/zeitwerk/loader.rb#43
192
+ def __autoloaded_dirs; end
193
+
194
+ # source://zeitwerk//lib/zeitwerk/loader.rb#33
195
+ def __autoloads; end
196
+
197
+ # source://zeitwerk//lib/zeitwerk/loader.rb#77
198
+ def __namespace_dirs; end
199
+
200
+ # source://zeitwerk//lib/zeitwerk/loader.rb#310
201
+ def __shadowed_file?(file); end
202
+
203
+ # source://zeitwerk//lib/zeitwerk/loader.rb#88
204
+ def __shadowed_files; end
205
+
206
+ # source://zeitwerk//lib/zeitwerk/loader.rb#59
207
+ def __to_unload; end
208
+
209
+ # @raise [Zeitwerk::Error]
210
+ #
211
+ # source://zeitwerk//lib/zeitwerk/loader.rb#234
212
+ def cpath_expected_at(path); end
213
+
214
+ # Unloads all loaded code, and calls setup again so that the loader is able
215
+ # to pick any changes in the file system.
216
+ #
217
+ # This method is not thread-safe, please see how this can be achieved by
218
+ # client code in the README of the project.
219
+ #
220
+ # @raise [Zeitwerk::Error]
221
+ #
222
+ # source://zeitwerk//lib/zeitwerk/loader.rb#223
223
+ def reload; end
224
+
225
+ # Sets autoloads in the root namespaces.
226
+ #
227
+ # source://zeitwerk//lib/zeitwerk/loader.rb#119
228
+ def setup; end
229
+
230
+ # Removes loaded constants and configured autoloads.
231
+ #
232
+ # The objects the constants stored are no longer reachable through them. In
233
+ # addition, since said objects are normally not referenced from anywhere
234
+ # else, they are eligible for garbage collection, which would effectively
235
+ # unload them.
236
+ #
237
+ # This method is public but undocumented. Main interface is `reload`, which
238
+ # means `unload` + `setup`. This one is available to be used together with
239
+ # `unregister`, which is undocumented too.
240
+ #
241
+ # source://zeitwerk//lib/zeitwerk/loader.rb#145
242
+ def unload; end
243
+
244
+ # Says if the given constant path would be unloaded on reload. This
245
+ # predicate returns `false` if reloading is disabled.
246
+ #
247
+ # @return [Boolean]
248
+ #
249
+ # source://zeitwerk//lib/zeitwerk/loader.rb#285
250
+ def unloadable_cpath?(cpath); end
251
+
252
+ # Returns an array with the constant paths that would be unloaded on reload.
253
+ # This predicate returns an empty array if reloading is disabled.
254
+ #
255
+ # source://zeitwerk//lib/zeitwerk/loader.rb#293
256
+ def unloadable_cpaths; end
257
+
258
+ # This is a dangerous method.
259
+ #
260
+ # source://zeitwerk//lib/zeitwerk/loader.rb#301
261
+ def unregister; end
262
+
263
+ private
264
+
265
+ # source://zeitwerk//lib/zeitwerk/loader.rb#456
266
+ def autoload_file(parent, cname, file); end
267
+
268
+ # @return [Boolean]
269
+ #
270
+ # source://zeitwerk//lib/zeitwerk/loader.rb#514
271
+ def autoload_path_set_by_me_for?(parent, cname); end
272
+
273
+ # source://zeitwerk//lib/zeitwerk/loader.rb#426
274
+ def autoload_subdir(parent, cname, subdir); end
275
+
276
+ # We keep track of autoloaded directories to remove them from the registry
277
+ # at the end of eager loading.
278
+ #
279
+ # Files are removed as they are autoloaded, but directories need to wait due
280
+ # to concurrency (see why in Zeitwerk::Loader::Callbacks#on_dir_autoloaded).
281
+ #
282
+ # source://zeitwerk//lib/zeitwerk/loader.rb#43
283
+ def autoloaded_dirs; end
284
+
285
+ # Maps absolute paths for which an autoload has been set ---and not
286
+ # executed--- to their corresponding parent class or module and constant
287
+ # name.
288
+ #
289
+ # "/Users/fxn/blog/app/models/user.rb" => [Object, :User],
290
+ # "/Users/fxn/blog/app/models/hotel/pricing.rb" => [Hotel, :Pricing]
291
+ # ...
292
+ #
293
+ # source://zeitwerk//lib/zeitwerk/loader.rb#33
294
+ def autoloads; end
295
+
296
+ # Returns the value of attribute dirs_autoload_monitor.
297
+ #
298
+ # source://zeitwerk//lib/zeitwerk/loader.rb#96
299
+ def dirs_autoload_monitor; end
300
+
301
+ # Returns the value of attribute mutex.
302
+ #
303
+ # source://zeitwerk//lib/zeitwerk/loader.rb#92
304
+ def mutex; end
305
+
306
+ # Maps namespace constant paths to their respective directories.
307
+ #
308
+ # For example, given this mapping:
309
+ #
310
+ # "Admin" => [
311
+ # "/Users/fxn/blog/app/controllers/admin",
312
+ # "/Users/fxn/blog/app/models/admin",
313
+ # ...
314
+ # ]
315
+ #
316
+ # when `Admin` gets defined we know that it plays the role of a namespace
317
+ # and that its children are spread over those directories. We'll visit them
318
+ # to set up the corresponding autoloads.
319
+ #
320
+ # source://zeitwerk//lib/zeitwerk/loader.rb#77
321
+ def namespace_dirs; end
322
+
323
+ # `dir` is the directory that would have autovivified a namespace. `file` is
324
+ # the file where we've found the namespace is explicitly defined.
325
+ #
326
+ # source://zeitwerk//lib/zeitwerk/loader.rb#482
327
+ def promote_namespace_from_implicit_to_explicit(dir:, file:, parent:, cname:); end
328
+
329
+ # source://zeitwerk//lib/zeitwerk/loader.rb#528
330
+ def raise_if_conflicting_directory(dir); end
331
+
332
+ # source://zeitwerk//lib/zeitwerk/loader.rb#523
333
+ def register_explicit_namespace(cpath); end
334
+
335
+ # source://zeitwerk//lib/zeitwerk/loader.rb#552
336
+ def run_on_unload_callbacks(cpath, value, abspath); end
337
+
338
+ # source://zeitwerk//lib/zeitwerk/loader.rb#493
339
+ def set_autoload(parent, cname, abspath); end
340
+
341
+ # source://zeitwerk//lib/zeitwerk/loader.rb#410
342
+ def set_autoloads_in_dir(dir, parent); end
343
+
344
+ # source://zeitwerk//lib/zeitwerk/loader.rb#310
345
+ def shadowed_file?(file); end
346
+
347
+ # A shadowed file is a file managed by this loader that is ignored when
348
+ # setting autoloads because its matching constant is already taken.
349
+ #
350
+ # This private set is populated as we descend. For example, if the loader
351
+ # has only scanned the top-level, `shadowed_files` does not have shadowed
352
+ # files that may exist deep in the project tree yet.
353
+ #
354
+ # source://zeitwerk//lib/zeitwerk/loader.rb#88
355
+ def shadowed_files; end
356
+
357
+ # Stores metadata needed for unloading. Its entries look like this:
358
+ #
359
+ # "Admin::Role" => [".../admin/role.rb", [Admin, :Role]]
360
+ #
361
+ # The cpath as key helps implementing unloadable_cpath? The file name is
362
+ # stored in order to be able to delete it from $LOADED_FEATURES, and the
363
+ # pair [Module, Symbol] is used to remove_const the constant from the class
364
+ # or module object.
365
+ #
366
+ # If reloading is enabled, this hash is filled as constants are autoloaded
367
+ # or eager loaded. Otherwise, the collection remains empty.
368
+ #
369
+ # source://zeitwerk//lib/zeitwerk/loader.rb#59
370
+ def to_unload; end
371
+
372
+ # source://zeitwerk//lib/zeitwerk/loader.rb#559
373
+ def unload_autoload(parent, cname); end
374
+
375
+ # source://zeitwerk//lib/zeitwerk/loader.rb#565
376
+ def unload_cref(parent, cname); end
377
+
378
+ class << self
379
+ # Returns an array with the absolute paths of the root directories of all
380
+ # registered loaders. This is a read-only collection.
381
+ #
382
+ # source://zeitwerk//lib/zeitwerk/loader.rb#404
383
+ def all_dirs; end
384
+
385
+ # Returns the value of attribute default_logger.
386
+ #
387
+ # source://zeitwerk//lib/zeitwerk/loader.rb#320
388
+ def default_logger; end
389
+
390
+ # Sets the attribute default_logger
391
+ #
392
+ # @param value the value to set the attribute default_logger to.
393
+ #
394
+ # source://zeitwerk//lib/zeitwerk/loader.rb#320
395
+ def default_logger=(_arg0); end
396
+
397
+ # Broadcasts `eager_load` to all loaders. Those that have not been setup
398
+ # are skipped.
399
+ #
400
+ # source://zeitwerk//lib/zeitwerk/loader.rb#376
401
+ def eager_load_all; end
402
+
403
+ # Broadcasts `eager_load_namespace` to all loaders. Those that have not
404
+ # been setup are skipped.
405
+ #
406
+ # source://zeitwerk//lib/zeitwerk/loader.rb#390
407
+ def eager_load_namespace(mod); end
408
+
409
+ # This is a shortcut for
410
+ #
411
+ # require "zeitwerk"
412
+ #
413
+ # loader = Zeitwerk::Loader.new
414
+ # loader.tag = File.basename(__FILE__, ".rb")
415
+ # loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
416
+ # loader.push_dir(__dir__)
417
+ #
418
+ # except that this method returns the same object in subsequent calls from
419
+ # the same file, in the unlikely case the gem wants to be able to reload.
420
+ #
421
+ # This method returns a subclass of Zeitwerk::Loader, but the exact type
422
+ # is private, client code can only rely on the interface.
423
+ #
424
+ # source://zeitwerk//lib/zeitwerk/loader.rb#338
425
+ def for_gem(warn_on_extra_files: T.unsafe(nil)); end
426
+
427
+ # This is a shortcut for
428
+ #
429
+ # require "zeitwerk"
430
+ #
431
+ # loader = Zeitwerk::Loader.new
432
+ # loader.tag = namespace.name + "-" + File.basename(__FILE__, ".rb")
433
+ # loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
434
+ # loader.push_dir(__dir__, namespace: namespace)
435
+ #
436
+ # except that this method returns the same object in subsequent calls from
437
+ # the same file, in the unlikely case the gem wants to be able to reload.
438
+ #
439
+ # This method returns a subclass of Zeitwerk::Loader, but the exact type
440
+ # is private, client code can only rely on the interface.
441
+ #
442
+ # source://zeitwerk//lib/zeitwerk/loader.rb#359
443
+ def for_gem_extension(namespace); end
444
+ end
445
+ end
446
+
447
+ # source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#3
448
+ module Zeitwerk::Loader::Callbacks
449
+ include ::Zeitwerk::RealModName
450
+
451
+ # Invoked from our decorated Kernel#require when a managed directory is
452
+ # autoloaded.
453
+ #
454
+ # @private
455
+ #
456
+ # source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#34
457
+ def on_dir_autoloaded(dir); end
458
+
459
+ # Invoked from our decorated Kernel#require when a managed file is autoloaded.
460
+ #
461
+ # @private
462
+ #
463
+ # source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#10
464
+ def on_file_autoloaded(file); end
465
+
466
+ # Invoked when a class or module is created or reopened, either from the
467
+ # tracer or from module autovivification. If the namespace has matching
468
+ # subdirectories, we descend into them now.
469
+ #
470
+ # @private
471
+ #
472
+ # source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#74
473
+ def on_namespace_loaded(namespace); end
474
+
475
+ private
476
+
477
+ # source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#85
478
+ def run_on_load_callbacks(cpath, value, abspath); end
479
+ end
480
+
481
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#6
482
+ module Zeitwerk::Loader::Config
483
+ include ::Zeitwerk::RealModName
484
+ extend ::Zeitwerk::Internal
485
+
486
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#86
487
+ def initialize; end
488
+
489
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#296
490
+ def __ignores?(abspath); end
491
+
492
+ def __roots; end
493
+
494
+ # Configure directories or glob patterns to be collapsed.
495
+ #
496
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#216
497
+ def collapse(*glob_patterns); end
498
+
499
+ # If `namespaces` is falsey (default), returns an array with the absolute
500
+ # paths of the root directories as strings. If truthy, returns a hash table
501
+ # instead. Keys are the absolute paths of the root directories as strings,
502
+ # values are their corresponding namespaces, class or module objects.
503
+ #
504
+ # If `ignored` is falsey (default), ignored root directories are filtered out.
505
+ #
506
+ # These are read-only collections, please add to them with `push_dir`.
507
+ #
508
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#156
509
+ def dirs(namespaces: T.unsafe(nil), ignored: T.unsafe(nil)); end
510
+
511
+ # Let eager load ignore the given files or directories. The constants defined
512
+ # in those files are still autoloadable.
513
+ #
514
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#198
515
+ def do_not_eager_load(*paths); end
516
+
517
+ # You need to call this method before setup in order to be able to reload.
518
+ # There is no way to undo this, either you want to reload or you don't.
519
+ #
520
+ # @raise [Zeitwerk::Error]
521
+ #
522
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#177
523
+ def enable_reloading; end
524
+
525
+ # Configure files, directories, or glob patterns to be totally ignored.
526
+ #
527
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#205
528
+ def ignore(*glob_patterns); end
529
+
530
+ # Returns the value of attribute inflector.
531
+ #
532
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#11
533
+ def inflector; end
534
+
535
+ # Sets the attribute inflector
536
+ #
537
+ # @param value the value to set the attribute inflector to.
538
+ #
539
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#11
540
+ def inflector=(_arg0); end
541
+
542
+ # Logs to `$stdout`, handy shortcut for debugging.
543
+ #
544
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#288
545
+ def log!; end
546
+
547
+ # Returns the value of attribute logger.
548
+ #
549
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#14
550
+ def logger; end
551
+
552
+ # Sets the attribute logger
553
+ #
554
+ # @param value the value to set the attribute logger to.
555
+ #
556
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#14
557
+ def logger=(_arg0); end
558
+
559
+ # Configure a block to be invoked once a certain constant path is loaded.
560
+ # Supports multiple callbacks, and if there are many, they are executed in
561
+ # the order in which they were defined.
562
+ #
563
+ # loader.on_load("SomeApiClient") do |klass, _abspath|
564
+ # klass.endpoint = "https://api.dev"
565
+ # end
566
+ #
567
+ # Can also be configured for any constant loaded:
568
+ #
569
+ # loader.on_load do |cpath, value, abspath|
570
+ # # ...
571
+ # end
572
+ #
573
+ # @raise [TypeError]
574
+ #
575
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#252
576
+ def on_load(cpath = T.unsafe(nil), &block); end
577
+
578
+ # Configure a block to be called after setup and on each reload.
579
+ # If setup was already done, the block runs immediately.
580
+ #
581
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#228
582
+ def on_setup(&block); end
583
+
584
+ # Configure a block to be invoked right before a certain constant is removed.
585
+ # Supports multiple callbacks, and if there are many, they are executed in the
586
+ # order in which they were defined.
587
+ #
588
+ # loader.on_unload("Country") do |klass, _abspath|
589
+ # klass.clear_cache
590
+ # end
591
+ #
592
+ # Can also be configured for any removed constant:
593
+ #
594
+ # loader.on_unload do |cpath, value, abspath|
595
+ # # ...
596
+ # end
597
+ #
598
+ # @raise [TypeError]
599
+ #
600
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#277
601
+ def on_unload(cpath = T.unsafe(nil), &block); end
602
+
603
+ # Pushes `path` to the list of root directories.
604
+ #
605
+ # Raises `Zeitwerk::Error` if `path` does not exist, or if another loader in
606
+ # the same process already manages that directory or one of its ascendants or
607
+ # descendants.
608
+ #
609
+ # @raise [Zeitwerk::Error]
610
+ #
611
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#111
612
+ def push_dir(path, namespace: T.unsafe(nil)); end
613
+
614
+ # @return [Boolean]
615
+ #
616
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#190
617
+ def reloading_enabled?; end
618
+
619
+ # Returns the loader's tag.
620
+ #
621
+ # Implemented as a method instead of via attr_reader for symmetry with the
622
+ # writer below.
623
+ #
624
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#135
625
+ def tag; end
626
+
627
+ # Sets a tag for the loader, useful for logging.
628
+ #
629
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#142
630
+ def tag=(tag); end
631
+
632
+ private
633
+
634
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#314
635
+ def actual_roots; end
636
+
637
+ # @return [Boolean]
638
+ #
639
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#339
640
+ def collapse?(dir); end
641
+
642
+ # The actual collection of absolute directory names at the time the collapse
643
+ # glob patterns were expanded. Computed on setup, and recomputed on reload.
644
+ #
645
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#57
646
+ def collapse_dirs; end
647
+
648
+ # Absolute paths of directories or glob patterns to be collapsed.
649
+ #
650
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#50
651
+ def collapse_glob_patterns; end
652
+
653
+ # Absolute paths of files or directories not to be eager loaded.
654
+ #
655
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#63
656
+ def eager_load_exclusions; end
657
+
658
+ # @return [Boolean]
659
+ #
660
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#326
661
+ def excluded_from_eager_load?(abspath); end
662
+
663
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#349
664
+ def expand_glob_patterns(glob_patterns); end
665
+
666
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#344
667
+ def expand_paths(paths); end
668
+
669
+ # Absolute paths of files, directories, or glob patterns to be totally
670
+ # ignored.
671
+ #
672
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#36
673
+ def ignored_glob_patterns; end
674
+
675
+ # @return [Boolean]
676
+ #
677
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#309
678
+ def ignored_path?(abspath); end
679
+
680
+ # The actual collection of absolute file and directory names at the time the
681
+ # ignored glob patterns were expanded. Computed on setup, and recomputed on
682
+ # reload.
683
+ #
684
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#44
685
+ def ignored_paths; end
686
+
687
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#296
688
+ def ignores?(abspath); end
689
+
690
+ # User-oriented callbacks to be fired when a constant is loaded.
691
+ #
692
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#76
693
+ def on_load_callbacks; end
694
+
695
+ # User-oriented callbacks to be fired on setup and on reload.
696
+ #
697
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#69
698
+ def on_setup_callbacks; end
699
+
700
+ # User-oriented callbacks to be fired before constants are removed.
701
+ #
702
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#83
703
+ def on_unload_callbacks; end
704
+
705
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#361
706
+ def recompute_collapse_dirs; end
707
+
708
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#356
709
+ def recompute_ignored_paths; end
710
+
711
+ # @return [Boolean]
712
+ #
713
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#321
714
+ def root_dir?(dir); end
715
+
716
+ # Absolute paths of the root directories, mapped to their respective root namespaces:
717
+ #
718
+ # "/Users/fxn/blog/app/channels" => Object,
719
+ # "/Users/fxn/blog/app/adapters" => ActiveJob::QueueAdapters,
720
+ # ...
721
+ #
722
+ # Stored in a hash to preserve order, easily handle duplicates, and have a
723
+ # fast lookup by directory.
724
+ #
725
+ # This is a private collection maintained by the loader. The public
726
+ # interface for it is `push_dir` and `dirs`.
727
+ #
728
+ # source://zeitwerk//lib/zeitwerk/loader/config.rb#29
729
+ def roots; end
730
+ end
731
+
732
+ # source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#1
733
+ module Zeitwerk::Loader::EagerLoad
734
+ # Eager loads all files in the root directories, recursively. Files do not
735
+ # need to be in `$LOAD_PATH`, absolute file names are used. Ignored and
736
+ # shadowed files are not eager loaded. You can opt-out specifically in
737
+ # specific files and directories with `do_not_eager_load`, and that can be
738
+ # overridden passing `force: true`.
739
+ #
740
+ # source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#9
741
+ def eager_load(force: T.unsafe(nil)); end
742
+
743
+ # @raise [Zeitwerk::SetupRequired]
744
+ #
745
+ # source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#32
746
+ def eager_load_dir(path); end
747
+
748
+ # @raise [Zeitwerk::SetupRequired]
749
+ #
750
+ # source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#74
751
+ def eager_load_namespace(mod); end
752
+
753
+ # Loads the given Ruby file.
754
+ #
755
+ # Raises if the argument is ignored, shadowed, or not managed by the receiver.
756
+ #
757
+ # The method is implemented as `constantize` for files, in a sense, to be able
758
+ # to descend orderly and make sure the file is loadable.
759
+ #
760
+ # @raise [Zeitwerk::Error]
761
+ #
762
+ # source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#116
763
+ def load_file(path); end
764
+
765
+ private
766
+
767
+ # The caller is responsible for making sure `namespace` is the namespace that
768
+ # corresponds to `dir`.
769
+ #
770
+ # source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#160
771
+ def actual_eager_load_dir(dir, namespace, force: T.unsafe(nil)); end
772
+
773
+ # In order to invoke this method, the caller has to ensure `child` is a
774
+ # strict namespace descendant of `root_namespace`.
775
+ #
776
+ # source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#195
777
+ def eager_load_child_namespace(child, child_name, root_dir, root_namespace); end
778
+ end
779
+
780
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#3
781
+ module Zeitwerk::Loader::Helpers
782
+ private
783
+
784
+ # @return [Boolean]
785
+ #
786
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#128
787
+ def cdef?(parent, cname); end
788
+
789
+ # @raise [NameError]
790
+ #
791
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#134
792
+ def cget(parent, cname); end
793
+
794
+ # @raise [Zeitwerk::NameError]
795
+ #
796
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#149
797
+ def cname_for(basename, abspath); end
798
+
799
+ # Symbol#name was introduced in Ruby 3.0. It returns always the same
800
+ # frozen object, so we may save a few string allocations.
801
+ #
802
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#118
803
+ def cpath(parent, cname); end
804
+
805
+ # @raise [NameError]
806
+ #
807
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#140
808
+ def crem(parent, cname); end
809
+
810
+ # @return [Boolean]
811
+ #
812
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#67
813
+ def dir?(path); end
814
+
815
+ # @return [Boolean]
816
+ #
817
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#45
818
+ def has_at_least_one_ruby_file?(dir); end
819
+
820
+ # @return [Boolean]
821
+ #
822
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#72
823
+ def hidden?(basename); end
824
+
825
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#7
826
+ def log(message); end
827
+
828
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#15
829
+ def ls(dir); end
830
+
831
+ # @return [Boolean]
832
+ #
833
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#62
834
+ def ruby?(path); end
835
+
836
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#109
837
+ def strict_autoload_path(parent, cname); end
838
+
839
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#77
840
+ def walk_up(abspath); end
841
+ end
842
+
843
+ # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#144
844
+ module Zeitwerk::Loader::Helpers::CNAME_VALIDATOR; end
845
+
846
+ # source://zeitwerk//lib/zeitwerk/loader.rb#21
847
+ Zeitwerk::Loader::MUTEX = T.let(T.unsafe(nil), Thread::Mutex)
848
+
849
+ # source://zeitwerk//lib/zeitwerk/error.rb#13
850
+ class Zeitwerk::NameError < ::NameError; end
851
+
852
+ # source://zeitwerk//lib/zeitwerk/real_mod_name.rb#3
853
+ module Zeitwerk::RealModName
854
+ # source://zeitwerk//lib/zeitwerk/real_mod_name.rb#14
855
+ def real_mod_name(mod); end
856
+ end
857
+
858
+ # source://zeitwerk//lib/zeitwerk/real_mod_name.rb#4
859
+ Zeitwerk::RealModName::UNBOUND_METHOD_MODULE_NAME = T.let(T.unsafe(nil), UnboundMethod)
860
+
861
+ # source://zeitwerk//lib/zeitwerk/registry.rb#4
862
+ module Zeitwerk::Registry
863
+ class << self
864
+ # Maps absolute paths to the loaders responsible for them.
865
+ #
866
+ # This information is used by our decorated `Kernel#require` to be able to
867
+ # invoke callbacks and autovivify modules.
868
+ #
869
+ # @private
870
+ #
871
+ # source://zeitwerk//lib/zeitwerk/registry.rb#26
872
+ def autoloads; end
873
+
874
+ # Registers gem loaders to let `for_gem` be idempotent in case of reload.
875
+ #
876
+ # @private
877
+ #
878
+ # source://zeitwerk//lib/zeitwerk/registry.rb#17
879
+ def gem_loaders_by_root_file; end
880
+
881
+ # @private
882
+ # @return [Boolean]
883
+ #
884
+ # source://zeitwerk//lib/zeitwerk/registry.rb#113
885
+ def inception?(cpath); end
886
+
887
+ # This hash table addresses an edge case in which an autoload is ignored.
888
+ #
889
+ # For example, let's suppose we want to autoload in a gem like this:
890
+ #
891
+ # # lib/my_gem.rb
892
+ # loader = Zeitwerk::Loader.new
893
+ # loader.push_dir(__dir__)
894
+ # loader.setup
895
+ #
896
+ # module MyGem
897
+ # end
898
+ #
899
+ # if you require "my_gem", as Bundler would do, this happens while setting
900
+ # up autoloads:
901
+ #
902
+ # 1. Object.autoload?(:MyGem) returns `nil` because the autoload for
903
+ # the constant is issued by Zeitwerk while the same file is being
904
+ # required.
905
+ # 2. The constant `MyGem` is undefined while setup runs.
906
+ #
907
+ # Therefore, a directory `lib/my_gem` would autovivify a module according to
908
+ # the existing information. But that would be wrong.
909
+ #
910
+ # To overcome this fundamental limitation, we keep track of the constant
911
+ # paths that are in this situation ---in the example above, "MyGem"--- and
912
+ # take this collection into account for the autovivification logic.
913
+ #
914
+ # Note that you cannot generally address this by moving the setup code
915
+ # below the constant definition, because we want libraries to be able to
916
+ # use managed constants in the module body:
917
+ #
918
+ # module MyGem
919
+ # include MyConcern
920
+ # end
921
+ #
922
+ # @private
923
+ #
924
+ # source://zeitwerk//lib/zeitwerk/registry.rb#65
925
+ def inceptions; end
926
+
927
+ # @private
928
+ #
929
+ # source://zeitwerk//lib/zeitwerk/registry.rb#121
930
+ def loader_for(path); end
931
+
932
+ # This method returns always a loader, the same instance for the same root
933
+ # file. That is how Zeitwerk::Loader.for_gem is idempotent.
934
+ #
935
+ # @private
936
+ #
937
+ # source://zeitwerk//lib/zeitwerk/registry.rb#89
938
+ def loader_for_gem(root_file, namespace:, warn_on_extra_files:); end
939
+
940
+ # Keeps track of all loaders. Useful to broadcast messages and to prevent
941
+ # them from being garbage collected.
942
+ #
943
+ # @private
944
+ #
945
+ # source://zeitwerk//lib/zeitwerk/registry.rb#11
946
+ def loaders; end
947
+
948
+ # @private
949
+ #
950
+ # source://zeitwerk//lib/zeitwerk/registry.rb#127
951
+ def on_unload(loader); end
952
+
953
+ # @private
954
+ #
955
+ # source://zeitwerk//lib/zeitwerk/registry.rb#95
956
+ def register_autoload(loader, abspath); end
957
+
958
+ # @private
959
+ #
960
+ # source://zeitwerk//lib/zeitwerk/registry.rb#107
961
+ def register_inception(cpath, abspath, loader); end
962
+
963
+ # Registers a loader.
964
+ #
965
+ # @private
966
+ #
967
+ # source://zeitwerk//lib/zeitwerk/registry.rb#71
968
+ def register_loader(loader); end
969
+
970
+ # @private
971
+ #
972
+ # source://zeitwerk//lib/zeitwerk/registry.rb#101
973
+ def unregister_autoload(abspath); end
974
+
975
+ # @private
976
+ #
977
+ # source://zeitwerk//lib/zeitwerk/registry.rb#77
978
+ def unregister_loader(loader); end
979
+ end
980
+ end
981
+
982
+ # source://zeitwerk//lib/zeitwerk/error.rb#7
983
+ class Zeitwerk::ReloadingDisabledError < ::Zeitwerk::Error
984
+ # @return [ReloadingDisabledError] a new instance of ReloadingDisabledError
985
+ #
986
+ # source://zeitwerk//lib/zeitwerk/error.rb#8
987
+ def initialize; end
988
+ end
989
+
990
+ # source://zeitwerk//lib/zeitwerk/error.rb#16
991
+ class Zeitwerk::SetupRequired < ::Zeitwerk::Error
992
+ # @return [SetupRequired] a new instance of SetupRequired
993
+ #
994
+ # source://zeitwerk//lib/zeitwerk/error.rb#17
995
+ def initialize; end
996
+ end
997
+
998
+ # source://zeitwerk//lib/zeitwerk/version.rb#4
999
+ Zeitwerk::VERSION = T.let(T.unsafe(nil), String)