importmap-rails 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/lib/importmap/commands.rb +1 -0
- data/lib/importmap/version.rb +1 -1
- data/lib/tasks/importmap_tasks.rake +0 -6
- 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: 38c3083184e97d6df1566c84b82011280e8ebc5b68d59daeac2eff60b8264bf6
|
4
|
+
data.tar.gz: 705e1989000dbae9d04e18555de12ad968f3fa557a65de7ca5eb87f6adbdf335
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a7181a347eb789eb72d3f14d76a11004d1683c5e9dc7e8ddb9810a37445ad66f392105874c4a663ac939df55052f9184e33200d7ec27b458bf176de3ad225e5
|
7
|
+
data.tar.gz: 994fefc659e8b26a50ac3382f16c14436f2aa7343d4d9c6a7679b0044dafa5a3dac082a2818a4c9ee41ed6922b52a4d9e4668771d605763e34f92d8b6e687230
|
data/README.md
CHANGED
@@ -48,7 +48,7 @@ Pinning "scheduler" to https://ga.jspm.io/npm:scheduler@0.20.2/index.js
|
|
48
48
|
|
49
49
|
{
|
50
50
|
"imports": {
|
51
|
-
"application": "/application.js",
|
51
|
+
"application": "/assets/application-37f365cbecf1fa2810a8303f4b6571676fa1f9c56c248528bc14ddb857531b95.js",
|
52
52
|
"react": "https://ga.jspm.io/npm:react@17.0.2/index.js",
|
53
53
|
"react-dom": "https://ga.jspm.io/npm:react-dom@17.0.2/index.js",
|
54
54
|
"object-assign": "https://ga.jspm.io/npm:object-assign@4.1.1/index.js",
|
@@ -169,9 +169,9 @@ pin_all_from File.expand_path("../app/assets/javascripts", __dir__)
|
|
169
169
|
```
|
170
170
|
|
171
171
|
|
172
|
-
## Include a digest of the import map in your
|
172
|
+
## Include a digest of the import map in your ETag
|
173
173
|
|
174
|
-
If you're using
|
174
|
+
If you're using [ETags](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) generated by Rails helpers like `stale?` or `fresh_when`, you need to include the digest of the import map into this calculation. Otherwise your application will return 302 cache responses even when your JavaScript assets have changed. You can avoid this with something like:
|
175
175
|
|
176
176
|
```ruby
|
177
177
|
class ApplicationController < ActionController::Base
|
@@ -182,7 +182,7 @@ end
|
|
182
182
|
|
183
183
|
## Sweeping the cache in development and test
|
184
184
|
|
185
|
-
Generating the import map json and modulepreloads may require resolving hundreds of assets. This can take a while, so these operations are cached, but in development and test, we watch for changes to both `config/importmap.rb` and files in `app/javascript` to clear this cache. This feature can be controlled in an environment configuration file via the boolean `config.importmap.sweep_cache`. If you're pinning local files from outside of `app/javascript`, you'll need to restart your development server upon changes.
|
185
|
+
Generating the import map json and modulepreloads may require resolving hundreds of assets. This can take a while, so these operations are cached, but in development and test, we watch for changes to both `config/importmap.rb` and files in `app/javascript` to clear this cache. This feature can be controlled in an environment configuration file via the boolean `config.importmap.sweep_cache`. If you're pinning local files from outside of `app/javascript`, you'll need to restart your development server upon changes to those external files.
|
186
186
|
|
187
187
|
|
188
188
|
## Expected errors from using the es-module-shim
|
@@ -192,12 +192,12 @@ While import maps are native in Chrome and Edge, they need a shim in other brows
|
|
192
192
|
|
193
193
|
## Turning off the shim
|
194
194
|
|
195
|
-
Under certain circumstances, like running system tests using chromedriver under CI (which may be resource constrained and trigger errors in certain cases), you may want to explicitly turn off including the shim.
|
195
|
+
Under certain circumstances, like running system tests using chromedriver under CI (which may be resource constrained and trigger errors in certain cases), you may want to explicitly turn off including the shim. You can do this by calling the bulk tag helper with `javascript_importmap_tags("application", shim: false)`. Thus you can pass in something like `shim: !ENV["CI"]`. If you want, and are sure you're not doing any full-page caching, you can also connect this directive to a user agent check (using a gem like `useragent`) to check whether the browser is chrome/edge 89+. But you really shouldn't have to, as the shim is designed to gracefully work with natively compatible drivers.
|
196
196
|
|
197
197
|
|
198
198
|
## A note about browser extensions
|
199
199
|
|
200
|
-
Certain extensions that also load
|
200
|
+
Certain extensions that also load JavaScript modules may block import maps from being loaded (for instance, the Apollo Client Devtools extension). If you see a console message like `An import map is added after module script load was triggered`, browser extensions are likely the culprit.
|
201
201
|
|
202
202
|
|
203
203
|
## License
|
data/lib/importmap/commands.rb
CHANGED
data/lib/importmap/version.rb
CHANGED
@@ -3,10 +3,4 @@ namespace :importmap do
|
|
3
3
|
task :install do
|
4
4
|
system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../install/install.rb", __dir__)}"
|
5
5
|
end
|
6
|
-
|
7
|
-
desc "Show the importmap"
|
8
|
-
task :pins do
|
9
|
-
require Rails.root.join("config/environment")
|
10
|
-
puts Rails.application.importmap.to_json(resolver: ActionController::Base.helpers)
|
11
|
-
end
|
12
6
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: importmap-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|