opal-zeitwerk 0.2.1 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 442be5d3ab3a89bae6c21827e78328cd2316e845faa4698a8809a2c3459917b7
4
- data.tar.gz: 6fb3f3cf024e532166fa036661e27c3530d1d2ffee05374712b72201b9c95c47
3
+ metadata.gz: 0c60f3d2f11dd2c3f548c2ac662697ff4abdd0d9b799734ed25d2980c3120e5a
4
+ data.tar.gz: 463576e4b820b4a890efd7781fbd975fc22064fb472e9c675625c989e46b706c
5
5
  SHA512:
6
- metadata.gz: 1572699fc25caada499633697b21249a55daa84c3b6eaac31f4cffa08bd63d5ca7f51f9182459b97263a554a896adf4f5e7a696da3161fabc205e3b6e35b54ba
7
- data.tar.gz: 903d6dbc709ce551d4fec5f2ec740815c02c532b8f27ddf8da39afcf1f61000793c67511d4bda229870847474c21534e3a38251f8112090b46dc9ce8fa5d9076
6
+ metadata.gz: 4a8c04d54fe4b20158655b74a3519b045b8d70094bc202966e38b36efac3828ebe30bd355b3a2a1ffae497c061e5e9a6719627b22dc6d48539d9dcdaa6542b4d
7
+ data.tar.gz: dba385ef05564c260831b53c5fba94be547429af3679031827f34495358fa14cbc01c7d38126d63eacfaa2a3b9e4ae7f5f5586d4463604dcb6e8bd9fe99bc3cc
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,14 +167,10 @@ 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
177
- gem 'opal-zeitwerk', '~> 0.0.1'
172
+ gem 'opal', '~> 1.4.0'
173
+ gem 'opal-zeitwerk', '~> 0.3.0'
178
174
  ```
179
175
 
180
176
  And to your loader of opal code:
@@ -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.4.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.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
6
6
  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|
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-zeitwerk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-10 00:00:00.000000000 Z
11
+ date: 2021-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.0
19
+ version: 1.4.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.2.0
26
+ version: 1.4.0
27
27
  description: |2
28
28
  A port of the Zeitwerk autoloader to Opal.
29
29
  Zeitwerk implements constant autoloading with Ruby semantics. Each gem
@@ -52,10 +52,7 @@ licenses:
52
52
  - MIT
53
53
  metadata:
54
54
  github_repo: ssh://github.com/isomorfeus/gems
55
- post_install_message: "\nopal-zeitwerk 0.2.1:\n \n opal-zeitwerk currently requires
56
- the es6_modules_1_2 branch of opal, for the Gemfile:\n\n gem 'opal', github: 'janbiedermann/opal',
57
- branch: 'es6_modules_1_2'\n\n Commit 04c59bcb6ec124d021d464d12a45e7dae892456f from
58
- 7.1.2020 or later.\n\n"
55
+ post_install_message:
59
56
  rdoc_options: []
60
57
  require_paths:
61
58
  - lib
@@ -70,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
67
  - !ruby/object:Gem::Version
71
68
  version: '0'
72
69
  requirements: []
73
- rubygems_version: 3.2.15
70
+ rubygems_version: 3.2.32
74
71
  signing_key:
75
72
  specification_version: 4
76
73
  summary: Opal constant autoloader using Zeitwerk