sprockets-rails 3.3.0 → 3.4.0

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: 7e6cad3e417e1aa7ebb1d631d729eece508df7a9e7532d345402c4f5ea74b232
4
- data.tar.gz: aff71fbf71de696753d98af6268b3f3325614dab7a9a3bcbc703a97c42f3843d
3
+ metadata.gz: c96f2a174f4f2e80b8c853df88db8687d2aa25e3884dbfeb56509cee537b4c74
4
+ data.tar.gz: f6147fa621580ff55996a9c53dab30d26b0f5197b085779342271a801119ff8b
5
5
  SHA512:
6
- metadata.gz: 779b26e279a0ae753c72f3b96281e3693a98701890064c23d769759cff66f4ad4b5500b8e271e8b1152cda74bafb5757c6c446b62f4d72f4bb7b41bd227136b0
7
- data.tar.gz: bb5310789f00b8656f13e16473277efbb575aeedd81c10d4b9410e78af0372ce14ab71860c826bca6bfd6e5e8cb5bf9325fc98646d432b36890f25053b6c7eff
6
+ metadata.gz: c475cd351bc6ca97196cf0d98ef86db40f493f75eff770e6d6643bc3df85b01e304dcaa119d30400564186611ee52753fa73c3517b8a14f2152ed2c556329585
7
+ data.tar.gz: a3cb4867a60e31c591b3342d33602653b6b7c893698c3e754d33524b4f85e5c0dd98f5dcad4a8788fca40d94fcc28289dfac006439781277c20ecb6979e5d1e4
@@ -0,0 +1,22 @@
1
+ module Sprockets
2
+ module Rails
3
+ # Rewrites source mapping urls with the digested paths and protect against semicolon appending with a dummy comment line
4
+ class SourcemappingUrlProcessor
5
+ REGEX = /\/\/# sourceMappingURL=(.*\.map)/
6
+
7
+ def self.call(input)
8
+ env = input[:environment]
9
+ context = env.context_class.new(input)
10
+ data = input[:data].gsub(REGEX) do |_match|
11
+ ensure_file_is_present = context.resolve($1)
12
+ "//# sourceMappingURL=#{context.asset_path($1)}\n//!\n"
13
+ rescue Sprockets::FileNotFound
14
+ env.logger.warn "Removed sourceMappingURL comment for missing asset '#{$1}' from #{input[:filename]}"
15
+ nil
16
+ end
17
+
18
+ { data: data }
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  module Sprockets
2
2
  module Rails
3
- VERSION = "3.3.0"
3
+ VERSION = "3.4.0"
4
4
  end
5
5
  end
@@ -6,6 +6,7 @@ require 'active_support/core_ext/numeric/bytes'
6
6
  require 'sprockets'
7
7
 
8
8
  require 'sprockets/rails/asset_url_processor'
9
+ require 'sprockets/rails/sourcemapping_url_processor'
9
10
  require 'sprockets/rails/context'
10
11
  require 'sprockets/rails/helper'
11
12
  require 'sprockets/rails/quiet_assets'
@@ -122,6 +123,10 @@ module Sprockets
122
123
  Sprockets.register_postprocessor "text/css", ::Sprockets::Rails::AssetUrlProcessor
123
124
  end
124
125
 
126
+ initializer :asset_sourcemap_url_processor do |app|
127
+ Sprockets.register_postprocessor "application/javascript", ::Sprockets::Rails::SourcemappingUrlProcessor
128
+ end
129
+
125
130
  config.assets.version = ""
126
131
  config.assets.debug = false
127
132
  config.assets.compile = true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Peek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-11 00:00:00.000000000 Z
11
+ date: 2021-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets
@@ -122,6 +122,7 @@ files:
122
122
  - lib/sprockets/rails/helper.rb
123
123
  - lib/sprockets/rails/quiet_assets.rb
124
124
  - lib/sprockets/rails/route_wrapper.rb
125
+ - lib/sprockets/rails/sourcemapping_url_processor.rb
125
126
  - lib/sprockets/rails/task.rb
126
127
  - lib/sprockets/rails/utils.rb
127
128
  - lib/sprockets/rails/version.rb