Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rubygem-sprockets-rails for openSUSE:Factory checked in at 2021-12-25 20:16:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-sprockets-rails (Old) and /work/SRC/openSUSE:Factory/.rubygem-sprockets-rails.new.2520 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-sprockets-rails" Sat Dec 25 20:16:45 2021 rev:20 rq:942434 version:3.4.2 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-sprockets-rails/rubygem-sprockets-rails.changes 2020-09-14 12:32:20.161251991 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-sprockets-rails.new.2520/rubygem-sprockets-rails.changes 2021-12-25 20:17:12.209276846 +0100 @@ -1,0 +2,15 @@ +Tue Dec 21 23:55:13 UTC 2021 - Manuel Schnitzer <mschnit...@suse.com> + +- updated to version 3.4.2 + + # What's Changed + + * Fix protocol relative URLs amended accidentally by @PikachuEXE in #485 + * Add assets.resolve_assets_in_css_urls configuration option to allow disabling AssetUrlProcessor by @rmacklin in #489 + + # New Contributors + + * @PikachuEXE made their first contribution in #485 + * @rmacklin made their first contribution in #489 + +------------------------------------------------------------------- Old: ---- sprockets-rails-3.2.2.gem New: ---- sprockets-rails-3.4.2.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-sprockets-rails.spec ++++++ --- /var/tmp/diff_new_pack.hVqtjx/_old 2021-12-25 20:17:12.661277213 +0100 +++ /var/tmp/diff_new_pack.hVqtjx/_new 2021-12-25 20:17:12.665277217 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-sprockets-rails # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,12 +24,12 @@ # Name: rubygem-sprockets-rails -Version: 3.2.2 +Version: 3.4.2 Release: 0 %define mod_name sprockets-rails %define mod_full_name %{mod_name}-%{version} BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: %{ruby >= 1.9.3} +BuildRequires: %{ruby >= 2.5} BuildRequires: %{rubygem gem2rpm} BuildRequires: ruby-macros >= 5 URL: https://github.com/rails/sprockets-rails ++++++ sprockets-rails-3.2.2.gem -> sprockets-rails-3.4.2.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2020-09-12 09:37:40.000000000 +0200 +++ new/README.md 2021-12-11 08:30:47.000000000 +0100 @@ -86,7 +86,7 @@ **`config.assets.debug`** -Enable expanded asset debugging mode. Individual files will be served to make referencing filenames in the web console easier. This feature will eventually be deprecated and replaced by Source Maps in Sprockets 3.x. +Enable asset debugging mode. A source map will be included with each asset when this is true. **`config.assets.compile`** @@ -108,6 +108,10 @@ end ``` +**`config.assets.resolve_assets_in_css_urls`** + +When this option is enabled, sprockets-rails will register a CSS postprocessor to resolve assets referenced in [`url()`](https://developer.mozilla.org/en-US/docs/Web/CSS/url()) function calls and replace them with the digested paths. Defaults to `true`. + **`config.assets.resolve_with`** A list of `:environment` and `:manifest` symbols that defines the order that @@ -196,5 +200,4 @@ ## Code Status -* [](http://travis-ci.org/rails/sprockets-rails) * [](http://badge.fury.io/rb/sprockets-rails) Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/sprockets/rails/asset_url_processor.rb new/lib/sprockets/rails/asset_url_processor.rb --- old/lib/sprockets/rails/asset_url_processor.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/sprockets/rails/asset_url_processor.rb 2021-12-11 08:30:47.000000000 +0100 @@ -0,0 +1,17 @@ +module Sprockets + module Rails + # Resolve assets referenced in CSS `url()` calls and replace them with the digested paths + class AssetUrlProcessor + REGEX = /url\(\s*["']?(?!(?:\#|data|http))(?<relativeToCurrentDir>\.\/)?(?<path>[^"'\s)]+)\s*["']?\)/ + def self.call(input) + context = input[:environment].context_class.new(input) + data = input[:data].gsub(REGEX) do |_match| + path = Regexp.last_match[:path] + "url(#{context.asset_path(path)})" + end + + context.metadata.merge(data: data) + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/sprockets/rails/helper.rb new/lib/sprockets/rails/helper.rb --- old/lib/sprockets/rails/helper.rb 2020-09-12 09:37:40.000000000 +0200 +++ new/lib/sprockets/rails/helper.rb 2021-12-11 08:30:47.000000000 +0100 @@ -369,7 +369,7 @@ end def raise_unless_precompiled_asset(path) - raise Helper::AssetNotPrecompiled.new(path) if @check_precompiled_asset && !precompiled?(path) + raise Helper::AssetNotPrecompiledError.new(path) if @check_precompiled_asset && !precompiled?(path) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/sprockets/rails/sourcemapping_url_processor.rb new/lib/sprockets/rails/sourcemapping_url_processor.rb --- old/lib/sprockets/rails/sourcemapping_url_processor.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/sprockets/rails/sourcemapping_url_processor.rb 2021-12-11 08:30:47.000000000 +0100 @@ -0,0 +1,54 @@ +module Sprockets + module Rails + # Rewrites source mapping urls with the digested paths and protect against semicolon appending with a dummy comment line + class SourcemappingUrlProcessor + REGEX = /\/\/# sourceMappingURL=(.*\.map)/ + + class << self + def call(input) + env = input[:environment] + context = env.context_class.new(input) + data = input[:data].gsub(REGEX) do |_match| + sourcemap_logical_path = combine_sourcemap_logical_path(sourcefile: input[:name], sourcemap: $1) + + begin + resolved_sourcemap_comment(sourcemap_logical_path, context: context) + rescue Sprockets::FileNotFound + removed_sourcemap_comment(sourcemap_logical_path, filename: input[:filename], env: env) + end + end + + { data: data } + end + + private + def combine_sourcemap_logical_path(sourcefile:, sourcemap:) + if (parts = sourcefile.split("/")).many? + parts[0..-2].append(sourcemap).join("/") + else + sourcemap + end + end + + def resolved_sourcemap_comment(sourcemap_logical_path, context:) + "//# sourceMappingURL=#{sourcemap_asset_path(sourcemap_logical_path, context: context)}\n//!\n" + end + + def sourcemap_asset_path(sourcemap_logical_path, context:) + # FIXME: Work-around for bug where if the sourcemap is nested two levels deep, it'll resolve as the source file + # that's being mapped, rather than the map itself. So context.resolve("a/b/c.js.map") will return "c.js?" + if context.resolve(sourcemap_logical_path) =~ /\.map/ + context.asset_path(sourcemap_logical_path) + else + raise Sprockets::FileNotFound, "Failed to resolve source map asset due to nesting depth" + end + end + + def removed_sourcemap_comment(sourcemap_logical_path, filename:, env:) + env.logger.warn "Removed sourceMappingURL comment for missing asset '#{sourcemap_logical_path}' from #{filename}" + nil + end + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/sprockets/rails/version.rb new/lib/sprockets/rails/version.rb --- old/lib/sprockets/rails/version.rb 2020-09-12 09:37:40.000000000 +0200 +++ new/lib/sprockets/rails/version.rb 2021-12-11 08:30:47.000000000 +0100 @@ -1,5 +1,5 @@ module Sprockets module Rails - VERSION = "3.2.2" + VERSION = "3.4.2" end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/sprockets/railtie.rb new/lib/sprockets/railtie.rb --- old/lib/sprockets/railtie.rb 2020-09-12 09:37:40.000000000 +0200 +++ new/lib/sprockets/railtie.rb 2021-12-11 08:30:47.000000000 +0100 @@ -4,6 +4,9 @@ require 'active_support/core_ext/module/remove_method' require 'active_support/core_ext/numeric/bytes' require 'sprockets' + +require 'sprockets/rails/asset_url_processor' +require 'sprockets/rails/sourcemapping_url_processor' require 'sprockets/rails/context' require 'sprockets/rails/helper' require 'sprockets/rails/quiet_assets' @@ -94,12 +97,13 @@ end config.assets = OrderedOptions.new - config.assets._blocks = [] - config.assets.paths = [] - config.assets.precompile = [] - config.assets.prefix = "/assets" - config.assets.manifest = nil - config.assets.quiet = false + config.assets._blocks = [] + config.assets.paths = [] + config.assets.precompile = [] + config.assets.prefix = "/assets" + config.assets.manifest = nil + config.assets.quiet = false + config.assets.resolve_assets_in_css_urls = true initializer :set_default_precompile do |app| if using_sprockets4? @@ -116,6 +120,16 @@ end end + initializer :asset_url_processor do |app| + if app.config.assets.resolve_assets_in_css_urls + Sprockets.register_postprocessor "text/css", ::Sprockets::Rails::AssetUrlProcessor + end + end + + initializer :asset_sourcemap_url_processor do |app| + Sprockets.register_postprocessor "application/javascript", ::Sprockets::Rails::SourcemappingUrlProcessor + end + config.assets.version = "" config.assets.debug = false config.assets.compile = true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2020-09-12 09:37:40.000000000 +0200 +++ new/metadata 2021-12-11 08:30:47.000000000 +0100 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: sprockets-rails version: !ruby/object:Gem::Version - version: 3.2.2 + version: 3.4.2 platform: ruby authors: - Joshua Peek autorequire: bindir: bin cert_chain: [] -date: 2020-09-12 00:00:00.000000000 Z +date: 2021-12-11 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: sprockets @@ -30,42 +30,42 @@ requirements: - - ">=" - !ruby/object:Gem::Version - version: '4.0' + version: '5.2' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: '4.0' + version: '5.2' - !ruby/object:Gem::Dependency name: activesupport requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: '4.0' + version: '5.2' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: '4.0' + version: '5.2' - !ruby/object:Gem::Dependency name: railties requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: '4.0' + version: '5.2' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: '4.0' + version: '5.2' - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement @@ -117,10 +117,12 @@ - MIT-LICENSE - README.md - lib/sprockets/rails.rb +- lib/sprockets/rails/asset_url_processor.rb - lib/sprockets/rails/context.rb - lib/sprockets/rails/helper.rb - lib/sprockets/rails/quiet_assets.rb - lib/sprockets/rails/route_wrapper.rb +- lib/sprockets/rails/sourcemapping_url_processor.rb - lib/sprockets/rails/task.rb - lib/sprockets/rails/utils.rb - lib/sprockets/rails/version.rb @@ -137,14 +139,14 @@ requirements: - - ">=" - !ruby/object:Gem::Version - version: 1.9.3 + version: '2.5' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] -rubygems_version: 3.1.2 +rubygems_version: 3.2.32 signing_key: specification_version: 4 summary: Sprockets Rails integration