Skip to content

Commit

Permalink
Re-enable support for Ruby 2.7
Browse files Browse the repository at this point in the history
We should make one release which claims to support Ruby 2.7 and also
actually supports Ruby 2.7 so that Gemfiles on older Rubies can pick up
a working version.

After release I will revert this commit so that we can move forward on
3.1+.
  • Loading branch information
jhawthorn committed Oct 10, 2024
1 parent 022433e commit 32d9911
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/helpers/importmap/importmap_tags_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Importmap::ImportmapTagsHelper
def javascript_importmap_tags(entry_point = "application", importmap: Rails.application.importmap)
safe_join [
javascript_inline_importmap_tag(importmap.to_json(resolver: self)),
javascript_importmap_module_preload_tags(importmap, entry_point:),
javascript_importmap_module_preload_tags(importmap, entry_point: entry_point),
javascript_import_module_tag(entry_point)
], "\n"
end
Expand All @@ -25,7 +25,7 @@ def javascript_import_module_tag(*module_names)
# (defaults to Rails.application.importmap), such that they'll be fetched
# in advance by browsers supporting this link type (https://caniuse.com/?search=modulepreload).
def javascript_importmap_module_preload_tags(importmap = Rails.application.importmap, entry_point: "application")
javascript_module_preload_tag(*importmap.preloaded_module_paths(resolver: self, entry_point:, cache_key: entry_point))
javascript_module_preload_tag(*importmap.preloaded_module_paths(resolver: self, entry_point: entry_point, cache_key: entry_point))
end

# Link tag(s) for preloading the JavaScript module residing in `*paths`. Will return one link tag per path element.
Expand Down
2 changes: 1 addition & 1 deletion importmap-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |spec|

spec.files = Dir["{app,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]

spec.required_ruby_version = ">= 3.1.0"
spec.required_ruby_version = ">= 2.7.0"
spec.add_dependency "railties", ">= 6.0.0"
spec.add_dependency "activesupport", ">= 6.0.0"
spec.add_dependency "actionpack", ">= 6.0.0"
Expand Down
2 changes: 1 addition & 1 deletion lib/importmap/map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def pin_all_from(dir, under: nil, to: nil, preload: true)
# the different cases.
def preloaded_module_paths(resolver:, entry_point: "application", cache_key: :preloaded_module_paths)
cache_as(cache_key) do
resolve_asset_paths(expanded_preloading_packages_and_directories(entry_point:), resolver:).values
resolve_asset_paths(expanded_preloading_packages_and_directories(entry_point: entry_point), resolver: resolver).values
end
end

Expand Down

0 comments on commit 32d9911

Please sign in to comment.