jspm-rails 0.3.0 → 0.4.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/CHANGELOG.md +10 -2
- data/README.md +9 -2
- data/lib/jspm/helper.rb +7 -1
- data/lib/jspm/local_modules.rb +1 -1
- data/lib/jspm/tags.rb +4 -3
- data/lib/jspm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ab55116d3501ecad41e352757989ff10f02573ca74d15653ea7a5be84b23cc56
|
|
4
|
+
data.tar.gz: 8dc520f68c9c7aaf479ad2957133dfa987046c185104e592d2713beed0ba9bbc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5eea76892af66e3824c16bfff24ef67dbb59d91320cac4169bbbb4dac0182c1d4fdb3cff4a18e6762738938e1911870c7229c7cd3829df454f36286c9fe819f9
|
|
7
|
+
data.tar.gz: 6e728a8c9f064f649e3f420bcc93ce78a2a8b7372f53e9d4d8ee361d4c3b1e08be560a69758113ddfedb4347669363730b237b7087509166c2f4ea5ded0e8be1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.4.0 (unreleased)
|
|
4
|
+
|
|
5
|
+
- `javascript_jspm_entry_tags('admin')` loads another module in `app/javascript` as the entry.
|
|
6
|
+
|
|
7
|
+
## 0.3.1 (2026-11-13)
|
|
8
|
+
|
|
9
|
+
- Fixes a `KeyError` when jspm scopes dependencies at the filesystem root.
|
|
10
|
+
|
|
11
|
+
## 0.3.0 (2026-11-13)
|
|
4
12
|
|
|
5
13
|
- Names every module in `app/javascript` in the import map, so stimulus-rails's `eagerLoadControllersFrom` finds controllers.
|
|
6
14
|
|
|
7
|
-
## 0.2.0 (
|
|
15
|
+
## 0.2.0 (2026-11-13)
|
|
8
16
|
|
|
9
17
|
- Reads Yarn 1's `yarn.lock` as well as `package-lock.json`.
|
|
10
18
|
- No longer copies npm packages' stylesheets, fonts and images. Put the directories you use on Propshaft's load path instead.
|
data/README.md
CHANGED
|
@@ -68,11 +68,18 @@ bin/rails jspm:install
|
|
|
68
68
|
git add config/importmap.json vendor/jspm
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
+
To have GitHub collapse those generated files in pull requests, mark them in `.gitattributes`:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
config/importmap.json linguist-generated
|
|
75
|
+
vendor/jspm/** linguist-generated
|
|
76
|
+
```
|
|
77
|
+
|
|
71
78
|
Reload the page.
|
|
72
79
|
|
|
73
80
|
## Writing your JavaScript
|
|
74
81
|
|
|
75
|
-
**The entry point is `app/javascript/application.js`.** `javascript_jspm_tags` loads it as a module, and the install traces everything it imports.
|
|
82
|
+
**The entry point is `app/javascript/application.js`.** `javascript_jspm_tags` loads it as a module, and the install traces everything it imports. For a layout that needs a different entry, see the [FAQ](#faq).
|
|
76
83
|
|
|
77
84
|
**Import packages by name,** as their documentation shows:
|
|
78
85
|
|
|
@@ -216,7 +223,7 @@ Not with jspm-rails, which doesn't transpile. Use jsbundling-rails.
|
|
|
216
223
|
Safari doesn't support CSS module scripts yet, so link stylesheets with `stylesheet_link_tag`.
|
|
217
224
|
|
|
218
225
|
**Can I have more than one entry point?**
|
|
219
|
-
|
|
226
|
+
Yes. A layout whose pages need different code loads `app/javascript/admin.js` with `javascript_jspm_entry_tags('admin')`. The install traces every module in `app/javascript`, so any of them can be an entry.
|
|
220
227
|
|
|
221
228
|
**Can I use it alongside importmap-rails?**
|
|
222
229
|
Use one or the other. Both render the page's import map.
|
data/lib/jspm/helper.rb
CHANGED
|
@@ -4,7 +4,13 @@ module Jspm
|
|
|
4
4
|
# View helpers for apps whose JavaScript jspm-rails installs.
|
|
5
5
|
module Helper
|
|
6
6
|
def javascript_jspm_tags
|
|
7
|
-
|
|
7
|
+
javascript_jspm_entry_tags('application')
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Loads app/javascript/<entry>.js instead of application.js, for a layout
|
|
11
|
+
# whose pages need different code.
|
|
12
|
+
def javascript_jspm_entry_tags(entry)
|
|
13
|
+
Tags.call(entry:, view: self)
|
|
8
14
|
end
|
|
9
15
|
end
|
|
10
16
|
end
|
data/lib/jspm/local_modules.rb
CHANGED
data/lib/jspm/tags.rb
CHANGED
|
@@ -12,11 +12,12 @@ module Jspm
|
|
|
12
12
|
MODULE_EXTENSIONS = %w[.js .mjs].freeze
|
|
13
13
|
private_constant :MODULE_EXTENSIONS
|
|
14
14
|
|
|
15
|
-
def self.call(view:)
|
|
15
|
+
def self.call(entry:, view:)
|
|
16
16
|
import_map = JSON.parse(Rails.root.join(Paths::IMPORT_MAP).read)
|
|
17
17
|
load_path = Rails.application.assets.load_path
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
entry_path = "#{entry}.js"
|
|
19
|
+
entry_url = view.asset_path(entry_path)
|
|
20
|
+
digested_entry = load_path.find(entry_path).digested_path.to_s
|
|
20
21
|
prefix = entry_url.delete_suffix(digested_entry)
|
|
21
22
|
new(entry_url:, import_map:, load_path:, prefix:, view:).call
|
|
22
23
|
end
|
data/lib/jspm/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jspm-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Clay Shentrup
|
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
83
83
|
- !ruby/object:Gem::Version
|
|
84
84
|
version: '0'
|
|
85
85
|
requirements: []
|
|
86
|
-
rubygems_version: 4.0.
|
|
86
|
+
rubygems_version: 4.0.20
|
|
87
87
|
specification_version: 4
|
|
88
88
|
summary: Import maps for Rails, built by jspm
|
|
89
89
|
test_files: []
|