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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ce5ca88f369995c2b29b27b38e5f3539101b8c314237825cf5dc4bc1a653e32
4
- data.tar.gz: a88e63335529c55217e121f9fabbff574da4010bbeecf948a7ec3f4d3ec505ce
3
+ metadata.gz: 38c3083184e97d6df1566c84b82011280e8ebc5b68d59daeac2eff60b8264bf6
4
+ data.tar.gz: 705e1989000dbae9d04e18555de12ad968f3fa557a65de7ca5eb87f6adbdf335
5
5
  SHA512:
6
- metadata.gz: 64ce4de1dd05d813987bbb663b60ef6023624eaf092d8578a87691998ceef32fb5d39fca5fd86cd8fd33a87d197bc28e345901d4e9cacbef235d953e5ea6aa70
7
- data.tar.gz: b047cc3f19efc2d462fdc456b9c5dc95581e2bc79e53196575a096771a51a83e7334568f3eceda567775acd254d49437d34156b4432f08b942651052c059352b
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 etag
172
+ ## Include a digest of the import map in your ETag
173
173
 
174
- If you're using etags 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:
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. If 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.
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 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.
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
@@ -43,6 +43,7 @@ class Importmap::Commands < Thor
43
43
 
44
44
  desc "json", "Show the full importmap in json"
45
45
  def json
46
+ require Rails.root.join("config/environment")
46
47
  puts Rails.application.importmap.to_json(resolver: ActionController::Base.helpers)
47
48
  end
48
49
 
@@ -1,3 +1,3 @@
1
1
  module Importmap
2
- VERSION = "0.7.4"
2
+ VERSION = "0.7.5"
3
3
  end
@@ -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
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-24 00:00:00.000000000 Z
11
+ date: 2021-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails