importmap-rails 1.1.3 → 1.1.4

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: 4dc0c94662b8f4a679264377b8f316d14bc294ac5ce38bfec87f29a5131dbac1
4
- data.tar.gz: caee1d333059336a6dd553abfe34983d91ffd2f3c1a2d747ef7556a3e2c238b9
3
+ metadata.gz: 0ee4ce0d38b4658aee999e41906ae7b054eb0a1318ecd9d5375d3a0bc57daf6a
4
+ data.tar.gz: c0c376603d1f7ef38b708565d4fb18a17cde71fff33c9e57421061e130e8431d
5
5
  SHA512:
6
- metadata.gz: 8e1c4d59c190fab3f665c9c702e9424ad04bd8cd1de16fcbe37e5e23c66d5faecdd1a28ea5997ee2cea150f618ed31ae46ce9f693eab009824bd8c713a7f9221
7
- data.tar.gz: e6b41d402c259c699bf603d54f5c62d0eb3eb32f6e911f440e70d20315fee24c86486d8b7771805b96d6057086cc57be692c89b2d21846a182998d2d22816caa
6
+ metadata.gz: c5749cad7cf026fe485560d3bfbdc568395bea36ad5b3020a50c55331ec052946f67ac9eaf80e70270139bdf366460e62494d397f434f8f7afaaa856864bdd54
7
+ data.tar.gz: 1f4cdd4bdeb93fe0ad0811375f0f750a26b22baaf8c15f9921f87c586e15b01f2847c100bf5ea72727f90b183704b357a7b074b76051fc5e85416f66beb2dce2
@@ -14,12 +14,12 @@ module Importmap::ImportmapTagsHelper
14
14
  # By default, `Rails.application.importmap.to_json(resolver: self)` is used.
15
15
  def javascript_inline_importmap_tag(importmap_json = Rails.application.importmap.to_json(resolver: self))
16
16
  tag.script importmap_json.html_safe,
17
- type: "importmap", "data-turbo-track": "reload", nonce: content_security_policy_nonce
17
+ type: "importmap", "data-turbo-track": "reload", nonce: request&.content_security_policy
18
18
  end
19
19
 
20
20
  # Configure es-modules-shim with nonce support if the application is using a content security policy.
21
21
  def javascript_importmap_shim_nonce_configuration_tag
22
- if content_security_policy?
22
+ if request&.content_security_policy
23
23
  tag.script({ nonce: content_security_policy_nonce }.to_json.html_safe,
24
24
  type: "esms-options", nonce: content_security_policy_nonce)
25
25
  end
@@ -28,14 +28,14 @@ module Importmap::ImportmapTagsHelper
28
28
  # Include the es-modules-shim needed to make importmaps work in browsers without native support (like Firefox + Safari).
29
29
  def javascript_importmap_shim_tag(minimized: true)
30
30
  javascript_include_tag minimized ? "es-module-shims.min.js" : "es-module-shims.js",
31
- async: true, "data-turbo-track": "reload", nonce: content_security_policy_nonce
31
+ async: true, "data-turbo-track": "reload", nonce: request&.content_security_policy
32
32
  end
33
33
 
34
34
  # Import a named JavaScript module(s) using a script-module tag.
35
35
  def javascript_import_module_tag(*module_names)
36
36
  imports = Array(module_names).collect { |m| %(import "#{m}") }.join("\n")
37
37
  tag.script imports.html_safe,
38
- type: "module", nonce: content_security_policy_nonce
38
+ type: "module", nonce: request&.content_security_policy
39
39
  end
40
40
 
41
41
  # Link tags for preloading all modules marked as preload: true in the `importmap`
@@ -48,7 +48,7 @@ module Importmap::ImportmapTagsHelper
48
48
  # Link tag(s) for preloading the JavaScript module residing in `*paths`. Will return one link tag per path element.
49
49
  def javascript_module_preload_tag(*paths)
50
50
  safe_join(Array(paths).collect { |path|
51
- tag.link rel: "modulepreload", href: path, nonce: content_security_policy_nonce
51
+ tag.link rel: "modulepreload", href: path, nonce: request&.content_security_policy
52
52
  }, "\n")
53
53
  end
54
54
  end
@@ -1,3 +1,3 @@
1
1
  module Importmap
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.4"
3
3
  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: 1.1.3
4
+ version: 1.1.4
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: 2022-07-13 00:00:00.000000000 Z
11
+ date: 2022-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties