opal-zeitwerk 0.0.4 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c08d0237fce54d7885badfdda17e4c5b287627af98e41acb14f867ecc7b77631
4
- data.tar.gz: 365a26b762cc3db8c2577bf093c87010a60315358f69572169a855f054bf7e71
3
+ metadata.gz: 846c4f821cd60dbcab5f85092d5fa8a74e1d507fa8c85e910931b2e26ac3b83c
4
+ data.tar.gz: 420eb1f0e0c4159c1631d606ddc190113d8b4ff5607605d67d554a824ecd2c12
5
5
  SHA512:
6
- metadata.gz: c1cddfe4dfbfed3c28f8081e44d71cf3c4e6682d7d09ed3ca2f456251eb89b60c490fdaf192d9346c3c263655a1f2821a90791e42987c6693faebe151d503130
7
- data.tar.gz: e89409525a50a0693ee2f8578020b618c44e2b33fe9561c02b1925c54b1c6c8e61505f80e03209b1244f5bd20c36b6049f514817139eaaa94f9238c5851aef99
6
+ metadata.gz: 974cea26a9f845c66cd540d57e06383e41c37d855ca07530f700d2d66ffd22297859bbe3a99a1fead00b2e8cb095048d62901d0b5ff8c406b50993b5cd3bfc38
7
+ data.tar.gz: e5c2140d6f15598c066368856da3e6d9b9e7cabea19d16fcfd3caef2fea6a9a88e4188dafa70b11484e0b5d4df790d6245c0c30d464be8c56fa1de5f79c2bc5a
data/README.md CHANGED
@@ -51,7 +51,7 @@ Differences to Ruby Zeitwerk:
51
51
  - no logging (to keep asset size small and performance high)
52
52
  - no gem specific support: GemInflector, for_gem, etc.
53
53
 
54
- These don't make so much sense, as Opal Zeitwerk works on the global Opal.modules registry in the Browser, not the filesystem.
54
+ These don't make so much sense, as Opal Zeitwerk works on the global Opal.modules registry in the Browser, not the filesystem.
55
55
  - Zeitwerk::Loader.set_autoloads_in_dir is public, so it can be called from lazy loaded code, after updating Opal.modules.
56
56
  - There are no threads in javascript so thread support has been removed.
57
57
  - Tests don't run yet.
@@ -167,13 +167,9 @@ should define `Geolocatable`, not `Concerns::Geolocatable`.
167
167
  <a id="markdown-usage" name="usage"></a>
168
168
  ## Usage
169
169
 
170
- Currently autoloading requires the es6_modules_1_1 branch along with the Opal es6_modules compiler options enabled.
171
- This option is enabled by default with using [opal-webpack-loader](https://github.com/isomorfeus/opal-webpack-loader) to bundle opal code.
172
-
173
170
  Add to the Gemfile:
174
171
  ```
175
- gem 'opal', github: 'janbiedermann/opal', branch: 'es6_modules_1_1' # required
176
- gem 'opal-webpack-loader', '~> 0.9.7' # required
172
+ gem 'opal', '>= 1.3.0'
177
173
  gem 'opal-zeitwerk', '~> 0.0.1'
178
174
  ```
179
175
 
@@ -186,7 +182,7 @@ require 'zeitwerk'
186
182
  ### Setup
187
183
  Files must be included in the compiled asset by:
188
184
  ```
189
- require_tree 'some_dir', :autoload
185
+ require_tree 'some_dir', autoload: true
190
186
  ```
191
187
  And added to the loader by:
192
188
  ```
@@ -451,10 +447,9 @@ As a workaround, you can eager load. Zeitwerk tries hard to succeed or fail cons
451
447
  <a id="markdown-supported-opal-versions" name="supported-opal-versions"></a>
452
448
  ## Supported Opal versions
453
449
 
454
- Opal Zeitwerk currently works only with the [Opal es6_modules_1_1 PR#1976](https://github.com/opal/opal/pull/1976) of Opal.
455
- For the Gemfile:
450
+ Opal Zeitwerk currently works with Opal releases >= 1.3.0. For the Gemfile:
456
451
  ```
457
- gem 'opal', github: 'janbiedermann/opal', branch: 'es6_modules_1_1'
452
+ gem 'opal', '>= 1.3.0'
458
453
  ```
459
454
 
460
455
  <a id="markdown-motivation" name="motivation"></a>
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Opal
3
3
  module Zeitwerk
4
- VERSION = "0.0.4"
4
+ VERSION = "0.2.2"
5
5
  end
6
6
  end
@@ -13,7 +13,7 @@ module Zeitwerk::Loader::Callbacks
13
13
 
14
14
  # "constant #{cpath(*cref)} loaded from file #{file}" if cdef?(*cref)
15
15
  if !cdef?(*cref)
16
- raise Zeitwerk::NameError, "expected file #{file} to define constant #{cpath(*cref)}, but didn't"
16
+ raise Zeitwerk::NameError.new("expected file #{file} to define constant #{cpath(*cref)}, but didn't", cref.last)
17
17
  end
18
18
  end
19
19
 
@@ -25,11 +25,8 @@ module Zeitwerk::Loader::Callbacks
25
25
  # @return [void]
26
26
  def on_dir_autoloaded(dir)
27
27
  if cref = autoloads.delete(dir)
28
- autovivified_module = if vivify_mod_dir && dir.start_with?(vivify_mod_dir)
29
- cref[0].const_set(cref[1], vivify_mod_class.new)
30
- else
31
- cref[0].const_set(cref[1], Module.new)
32
- end
28
+ autovivified_module = cref[0].const_set(cref[1], Module.new)
29
+
33
30
  # "module #{autovivified_module.name} autovivified from directory #{dir}"
34
31
 
35
32
  to_unload[autovivified_module.name] = [dir, cref] if reloading_enabled?