importmap-rails 1.1.3 → 1.1.4
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/app/helpers/importmap/importmap_tags_helper.rb +5 -5
- data/lib/importmap/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: 0ee4ce0d38b4658aee999e41906ae7b054eb0a1318ecd9d5375d3a0bc57daf6a
|
4
|
+
data.tar.gz: c0c376603d1f7ef38b708565d4fb18a17cde71fff33c9e57421061e130e8431d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|
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:
|
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:
|
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:
|
51
|
+
tag.link rel: "modulepreload", href: path, nonce: request&.content_security_policy
|
52
52
|
}, "\n")
|
53
53
|
end
|
54
54
|
end
|
data/lib/importmap/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2022-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|