importmap-rails 1.0.3 → 1.1.2

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: 53d756788e46fd583d5f4dc1b813f11b8479237e766a556fbcbabebf4285ffdd
4
- data.tar.gz: 640b9d1cce345d5193e12f17400c772532ddbc4fd97488567e9988eb3ac81fd7
3
+ metadata.gz: a6d6634568f8236e1d8e8fc6bf947d92b4eee6233267dbe723c8df0e1f68bdd8
4
+ data.tar.gz: 3d57806bb7b55155b60cb6186f2e79ec996b6921040893fede902d46d08cadc1
5
5
  SHA512:
6
- metadata.gz: 77a669609b58956d33610ebf3053e0ebe73bdfc1d79d1580df70f1f4d60f96ff92fec0dd0484bac01fe9ed678aac48a07da45402d0209c8a1869a3aece8db85a
7
- data.tar.gz: 35e0355d199c75f066f6ce2bea61ceceec0d25e15b6cf10b5d1a052b583580413ab99c104a8a11435d72841b1675815d7535d3c44c976e51a2f3bf6e7910677e
6
+ metadata.gz: 45dd26a34baa9aadc3566ef10f3185befab185fc63f7d1cd0ca1ba248f430ae6348aa60c6dbdddaa64177adae20aed255cd30b5175978ac42768226e0897f251
7
+ data.tar.gz: 0a1276536993c5c7bd897ab17e0379a5aa71ee68f14996fbba9b4c6b7e595eabf15dab99e447e497642ff4d791012f4fc3d7167ab2d484f6326f35c9986fcbba
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2021 Basecamp
1
+ Copyright (c) 2022 Basecamp
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [Import maps](https://github.com/WICG/import-maps) let you import JavaScript modules using logical names that map to versioned/digested files – directly from the browser. So you can [build modern JavaScript applications using JavaScript libraries made for ES modules (ESM) without the need for transpiling or bundling](https://world.hey.com/dhh/modern-web-apps-without-javascript-bundling-or-transpiling-a20f2755). This frees you from needing Webpack, Yarn, npm, or any other part of the JavaScript toolchain. All you need is the asset pipeline that's already included in Rails.
4
4
 
5
- With this approach you'll ship many small JavaScript files instead of one big JavaScript file. Thanks to HTTP/2 that no longer carries a material performance penalty during the initial transport, and in fact offers substantial benefits over the long run due to better caching dynamics. Whereas before any change to any JavaScript file included in your big bundle would invalidate the cache for the the whole bundle, now only the cache for that single file is invalidated.
5
+ With this approach you'll ship many small JavaScript files instead of one big JavaScript file. Thanks to HTTP/2 that no longer carries a material performance penalty during the initial transport, and in fact offers substantial benefits over the long run due to better caching dynamics. Whereas before any change to any JavaScript file included in your big bundle would invalidate the cache for the whole bundle, now only the cache for that single file is invalidated.
6
6
 
7
7
  There's [native support for import maps in Chrome/Edge 89+](https://caniuse.com/?search=importmap), and [a shim available](https://github.com/guybedford/es-module-shims) for any browser with basic ESM support. So your app will be able to work with all the evergreen browsers.
8
8
 
@@ -11,9 +11,8 @@ There's [native support for import maps in Chrome/Edge 89+](https://caniuse.com/
11
11
 
12
12
  Importmap for Rails is automatically included in Rails 7+ for new applications, but you can also install it manually in existing applications:
13
13
 
14
- 1. Add `importmap-rails` to your Gemfile with `gem 'importmap-rails'`
15
- 2. Run `./bin/bundle install`
16
- 3. Run `./bin/rails importmap:install`
14
+ 1. Run `./bin/bundle add importmap-rails`
15
+ 2. Run `./bin/rails importmap:install`
17
16
 
18
17
  Note: In order to use JavaScript from Rails frameworks like Action Cable, Action Text, and Active Storage, you must be running Rails 7.0+. This was the first version that shipped with ESM compatible builds of these libraries.
19
18
 
@@ -251,7 +250,7 @@ Import your module on the specific page. Note: you'll likely want to use a `cont
251
250
  <% end %>
252
251
  ```
253
252
 
254
- **Important**: The `javacript_import_module_tag` should come after your `javascript_importmap_tags`
253
+ **Important**: The `javascript_import_module_tag` should come after your `javascript_importmap_tags`
255
254
 
256
255
  ```erb
257
256
  <%= javascript_importmap_tags %>
@@ -300,6 +299,12 @@ In Firefox. when opening the browser console, the asm.js module lexer build will
300
299
 
301
300
  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.
302
301
 
302
+ ## Checking for outdated or vulnerable packages
303
+
304
+ Importmap for Rails provides two commands to check your pinned packages:
305
+ - `./bin/importmap outdated` checks the NPM registry for new versions
306
+ - `./bin/importmap audit` checks the NPM registry for known security issues
307
+
303
308
  ## License
304
309
 
305
310
  Importmap for Rails is released under the [MIT License](https://opensource.org/licenses/MIT).