opal-zeitwerk 0.1.0 → 0.2.3

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: 926d4439591306fd785d55b4f69b3b60212c3db911255d9cfad96286f22c373b
4
- data.tar.gz: f541fcfaac3eb639f070c11a8909835a5401669ce69e41c723b9a583c312e3ab
3
+ metadata.gz: bd3da62e0904361d965aef2356a01a9986bfc9327fde097a63d853f36d5caf01
4
+ data.tar.gz: 03b183ba318d3282788f1fdc485fa64c5696c396185eb4be0bdb417265a1058c
5
5
  SHA512:
6
- metadata.gz: ccac14d70164bbfd729f56c3ef9eaf1cb50716d83b218845da396e83db85b9866f5520290e5b8d6bda32c2463c27d05e67ba11748630b1f817f4cbc6c5cf7224
7
- data.tar.gz: df5c01643cd645039b5b7b51206dda6461b9c7e6312310c1538b86d5c7ed841b9738cb29d710a75abcd7f7151173459683a30b21ca8b9da8cd32d56be277d6d4
6
+ metadata.gz: '085142a58c566dd064bec23da78bfd124810c07213c51d0522649e05135b8cd6978a39625dd2674e123b87bce274d2826b7d53f56f66a51c041d6293eee6ca9a'
7
+ data.tar.gz: '031668ece73eb6ba6e043047f24b36efcdb8a50e9f06b0a28937b127876bf2d154296db4ef66103a41c12cf99c65132b3d95ccf26914dd801824e6fbfec6451d'
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.1.0"
4
+ VERSION = "0.2.3"
5
5
  end
6
6
  end
@@ -51,12 +51,12 @@ module Zeitwerk
51
51
  # If the class is a singleton class, we won't do anything with it so we
52
52
  # can bail out immediately. This is several orders of magnitude faster
53
53
  # than accessing its name.
54
- return if event.singleton_class?
54
+ return if event.self.singleton_class?
55
55
 
56
56
  # Note that it makes sense to compute the hash code unconditionally,
57
57
  # because the trace point is disabled if cpaths is empty.
58
- if loader = cpaths.delete(real_mod_name(event))
59
- loader.on_namespace_loaded(event)
58
+ if loader = cpaths.delete(real_mod_name(event.self))
59
+ loader.on_namespace_loaded(event.self)
60
60
  disable_tracer_if_unneeded
61
61
  end
62
62
  end
@@ -9,6 +9,7 @@ module Kernel
9
9
  # @param path [String]
10
10
  # @return [Boolean]
11
11
  def require(path)
12
+ path = `Opal.normalize(#{path})`
12
13
  if loader = Zeitwerk::Registry.loader_for(path)
13
14
  if `Opal.modules.hasOwnProperty(path)`
14
15
  zeitwerk_original_require(path).tap do |required|