sprockets 3.7.1 → 3.7.3

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
- SHA1:
3
- metadata.gz: d7893a1473428786e2b49eaf7554496d153a57b1
4
- data.tar.gz: 805a200abef6ae553c05d71b343dc367c8da0ba1
2
+ SHA256:
3
+ metadata.gz: d8d2739c5e14edf6aa95989aef8057d65eeb1525b4fccda72ba6099a8fe94bd3
4
+ data.tar.gz: 42fea69a2cf60adff7848fea3c8cd7fff222703611feda467aa8c5236aed9d84
5
5
  SHA512:
6
- metadata.gz: 14207c7eb061d38e9a848e4c1632764939718352ea48adb3fec86f6bfd4799eae3a36767a7a1669ca890ae2810d9a63b9da12c88c69f99c6276a945be92dc7c3
7
- data.tar.gz: 2015339e22e7268c3f817aa6e16a308b1c0d22de40e55e9795d1450a54bf41a1b0605328b8bdd5d15cfd055ec2165c6af751f5a93d46f26802eb97509bcd15bd
6
+ metadata.gz: 753ee6f089d3e281ba3eb81fe4fbd133d50065337f84c02891895de4544d2204bc884c1599781d632f290b1d407d684f473e101e5ba535f12afebc82a979cdd8
7
+ data.tar.gz: 9c57173eb38957dc992617903bd15b922caf20468c5952c158ffa00472c52ce6e0029011495f8b2fcd9a9148cd7b4ce3525b1749b3c9b1a982038ca9afe0e737
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ **3.7.3** (March 28, 2024)
2
+
3
+ * Various compatibility fixes for newer Ruby versions.
4
+
5
+ **3.7.2** (June 19, 2018)
6
+
7
+ * Security release for [CVE-2018-3760](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-3760).
8
+
1
9
  **3.7.1** (December 19, 2016)
2
10
 
3
11
  * Ruby 2.4 support for Sprockets 3.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: false
2
+
1
3
  require 'set'
2
4
  require 'shellwords'
3
5
 
@@ -18,7 +18,12 @@ module Sprockets
18
18
  end
19
19
 
20
20
  def call(input)
21
- engine = ::ERB.new(input[:data], nil, '<>')
21
+ if keyword_constructor? # Ruby 2.6+
22
+ engine = ::ERB.new(input[:data], trim_mode: '<>')
23
+ else
24
+ engine = ::ERB.new(input[:data], nil, '<>')
25
+ end
26
+
22
27
  context = input[:environment].context_class.new(input)
23
28
  klass = (class << context; self; end)
24
29
  klass.class_eval(&@block) if @block
@@ -26,5 +31,12 @@ module Sprockets
26
31
  data = context._evaluate_template
27
32
  context.metadata.merge(data: data)
28
33
  end
34
+
35
+ private
36
+
37
+ def keyword_constructor?
38
+ return @keyword_constructor if defined? @keyword_constructor
39
+ @keyword_constructor = ::ERB.instance_method(:initialize).parameters.include?([:key, :trim_mode])
40
+ end
29
41
  end
30
42
  end
@@ -161,7 +161,8 @@ module Sprockets
161
161
  end
162
162
  else
163
163
  args.each do |path|
164
- yield File.binread(File.join(dir, assets[path]))
164
+ asset = assets[path]
165
+ yield File.binread(File.join(dir, asset)) if asset
165
166
  end
166
167
  end
167
168
  end
@@ -111,17 +111,37 @@ module Sprockets
111
111
  def compute_extname_map
112
112
  graph = {}
113
113
 
114
+ engine_extname_permutation = []
115
+
116
+ 4.times do |n|
117
+ config[:engines].keys.permutation(n).each do |engine_extnames|
118
+ engine_extname_permutation << engine_extnames
119
+ end
120
+ end
121
+
122
+ mime_exts_grouped_by_mime_type = {}
123
+ config[:mime_exts].each do |format_extname,format_type|
124
+ mime_exts_grouped_by_mime_type[format_type] ||= []
125
+ mime_exts_grouped_by_mime_type[format_type] << format_extname
126
+ end
127
+
114
128
  ([nil] + pipelines.keys.map(&:to_s)).each do |pipeline|
115
- pipeline_extname = ".#{pipeline}" if pipeline
116
- ([[nil, nil]] + config[:mime_exts].to_a).each do |format_extname, format_type|
117
- 4.times do |n|
118
- config[:engines].keys.permutation(n).each do |engine_extnames|
129
+ pipeline_extname = pipeline ? ".#{pipeline}" : ''.freeze
130
+ engine_extname_permutation.each do |engine_extnames|
131
+ mime_exts_grouped_by_mime_type.each do |format_type, format_extnames|
132
+ type = format_type
133
+ value = [type, engine_extnames, pipeline]
134
+ format_extnames.each do |format_extname|
119
135
  key = "#{pipeline_extname}#{format_extname}#{engine_extnames.join}"
120
- type = format_type || config[:engine_mime_types][engine_extnames.first]
121
- graph[key] = {type: type, engines: engine_extnames, pipeline: pipeline}
136
+ graph[key] = value
137
+ end
138
+ if format_type == config[:engine_mime_types][engine_extnames.first]
139
+ key = "#{pipeline_extname}#{engine_extnames.join}"
140
+ graph[key] = value
122
141
  end
123
142
  end
124
143
  end
144
+ graph[pipeline_extname] = [nil, [], pipeline]
125
145
  end
126
146
 
127
147
  graph
@@ -232,7 +232,7 @@ module Sprockets
232
232
  end
233
233
 
234
234
  def deprecate_legacy_processor_interface(interface)
235
- msg = "You are using the a deprecated processor interface #{ interface.inspect }.\n" +
235
+ msg = "You are using a deprecated processor interface #{ interface.inspect }.\n" +
236
236
  "Please update your processor interface:\n" +
237
237
  "https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors\n"
238
238
 
@@ -202,7 +202,7 @@ module Sprockets
202
202
 
203
203
  if extname
204
204
  path = path.chomp(extname)
205
- type, engines, pipeline = value.values_at(:type, :engines, :pipeline)
205
+ type, engines, pipeline = value
206
206
  end
207
207
 
208
208
  return path, type, engines, pipeline
@@ -115,7 +115,7 @@ module Sprockets
115
115
  #
116
116
  # http://example.org/assets/../../../etc/passwd
117
117
  #
118
- path.include?("..") || absolute_path?(path)
118
+ path.include?("..") || absolute_path?(path) || path.include?("://")
119
119
  end
120
120
 
121
121
  def head_request?(env)
@@ -251,11 +251,11 @@ module Sprockets
251
251
  # If the request url contains a fingerprint, set a long
252
252
  # expires on the response
253
253
  if path_fingerprint(env["PATH_INFO"])
254
- headers["Cache-Control"] << ", max-age=31536000"
254
+ headers["Cache-Control"] += ", max-age=31536000"
255
255
 
256
256
  # Otherwise set `must-revalidate` since the asset could be modified.
257
257
  else
258
- headers["Cache-Control"] << ", must-revalidate"
258
+ headers["Cache-Control"] += ", must-revalidate"
259
259
  headers["Vary"] = "Accept-Encoding"
260
260
  end
261
261
 
@@ -50,6 +50,9 @@ module Sprockets
50
50
  # Hack for parsing Windows "file:///C:/Users/IEUser" paths
51
51
  path.gsub!(/^\/([a-zA-Z]:)/, '\1'.freeze)
52
52
 
53
+ host = nil if host && host.empty?
54
+ query = nil if query && query.empty?
55
+
53
56
  [scheme, host, path, query]
54
57
  end
55
58
 
@@ -102,6 +102,7 @@ module Sprockets
102
102
  #
103
103
  # Returns buf String.
104
104
  def concat_javascript_sources(buf, source)
105
+ buf = +buf
105
106
  if source.bytesize > 0
106
107
  buf << source
107
108
 
@@ -1,3 +1,3 @@
1
1
  module Sprockets
2
- VERSION = "3.7.1"
2
+ VERSION = "3.7.3"
3
3
  end
data/lib/sprockets.rb CHANGED
@@ -105,7 +105,7 @@ module Sprockets
105
105
  register_bundle_processor 'application/javascript', Bundle
106
106
  register_bundle_processor 'text/css', Bundle
107
107
 
108
- register_bundle_metadata_reducer '*/*', :data, proc { "" }, :concat
108
+ register_bundle_metadata_reducer '*/*', :data, proc { "" }, :+
109
109
  register_bundle_metadata_reducer 'application/javascript', :data, proc { "" }, Utils.method(:concat_javascript_sources)
110
110
  register_bundle_metadata_reducer '*/*', :links, :+
111
111
 
metadata CHANGED
@@ -1,16 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.1
4
+ version: 3.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stephenson
8
8
  - Joshua Peek
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-12-20 00:00:00.000000000 Z
12
+ date: 2024-03-28 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: base64
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
14
28
  - !ruby/object:Gem::Dependency
15
29
  name: rack
16
30
  requirement: !ruby/object:Gem::Requirement
@@ -175,16 +189,16 @@ dependencies:
175
189
  name: rake
176
190
  requirement: !ruby/object:Gem::Requirement
177
191
  requirements:
178
- - - "~>"
192
+ - - ">="
179
193
  - !ruby/object:Gem::Version
180
- version: '10.0'
194
+ version: '0'
181
195
  type: :development
182
196
  prerelease: false
183
197
  version_requirements: !ruby/object:Gem::Requirement
184
198
  requirements:
185
- - - "~>"
199
+ - - ">="
186
200
  - !ruby/object:Gem::Version
187
- version: '10.0'
201
+ version: '0'
188
202
  - !ruby/object:Gem::Dependency
189
203
  name: sass
190
204
  requirement: !ruby/object:Gem::Requirement
@@ -317,7 +331,7 @@ homepage: https://github.com/rails/sprockets
317
331
  licenses:
318
332
  - MIT
319
333
  metadata: {}
320
- post_install_message:
334
+ post_install_message:
321
335
  rdoc_options: []
322
336
  require_paths:
323
337
  - lib
@@ -332,9 +346,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
332
346
  - !ruby/object:Gem::Version
333
347
  version: '0'
334
348
  requirements: []
335
- rubyforge_project: sprockets
336
- rubygems_version: 2.5.2
337
- signing_key:
349
+ rubygems_version: 3.5.3
350
+ signing_key:
338
351
  specification_version: 4
339
352
  summary: Rack-based asset packaging system
340
353
  test_files: []