sprockets 3.7.2 → 3.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/sprockets/directive_processor.rb +2 -0
- data/lib/sprockets/erb_processor.rb +13 -1
- data/lib/sprockets/legacy.rb +4 -12
- data/lib/sprockets/mime.rb +26 -6
- data/lib/sprockets/resolve.rb +1 -1
- data/lib/sprockets/server.rb +2 -2
- data/lib/sprockets/uri_utils.rb +9 -4
- data/lib/sprockets/utils.rb +1 -0
- data/lib/sprockets/version.rb +1 -1
- data/lib/sprockets.rb +1 -1
- metadata +24 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1247cdff923f74bc8e25b4941797f3137e9d1765306bb79543543e17e4f1bc50
|
4
|
+
data.tar.gz: 4e05e0a201f4cb7713392c5ba7187d43663c1c23d0e44d1b0b2343ba7138f378
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fae3ef101561cdcde39a89c15d9953d9492317d1072bbf339dd94f4bc9fa4fbffd81c258d302dde38fef3e3225b4029fa63328312a19cd808ea05fb6c2b6cd81
|
7
|
+
data.tar.gz: be67fc1164cf0a748c9c437d29f70502f6df06a09a3ab2a4b306eecdf1d7fcdee8492479a6290601dac261e285def2dce56dc3e2f44b71b56820bb843bfac4e6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
**3.7.4** (March 28, 2024)
|
2
|
+
|
3
|
+
* Fix deprecated calls to the `uri` gem.
|
4
|
+
|
5
|
+
**3.7.3** (March 28, 2024)
|
6
|
+
|
7
|
+
* Various compatibility fixes for newer Ruby versions.
|
8
|
+
|
1
9
|
**3.7.2** (June 19, 2018)
|
2
10
|
|
3
11
|
* Security release for [CVE-2018-3760](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-3760).
|
@@ -18,7 +18,12 @@ module Sprockets
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def call(input)
|
21
|
-
|
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
|
data/lib/sprockets/legacy.rb
CHANGED
@@ -154,18 +154,10 @@ module Sprockets
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
str = URI::DEFAULT_PARSER.unescape(str)
|
162
|
-
str.force_encoding(Encoding.default_internal) if Encoding.default_internal
|
163
|
-
str
|
164
|
-
end
|
165
|
-
else
|
166
|
-
def unescape(str)
|
167
|
-
URI.unescape(str)
|
168
|
-
end
|
157
|
+
def unescape(str)
|
158
|
+
URIUtils::URI_PARSER.unescape(str)
|
159
|
+
str.force_encoding(Encoding.default_internal) if Encoding.default_internal
|
160
|
+
str
|
169
161
|
end
|
170
162
|
end
|
171
163
|
|
data/lib/sprockets/mime.rb
CHANGED
@@ -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}"
|
116
|
-
|
117
|
-
|
118
|
-
|
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
|
-
|
121
|
-
|
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
|
data/lib/sprockets/resolve.rb
CHANGED
data/lib/sprockets/server.rb
CHANGED
@@ -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"]
|
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"]
|
258
|
+
headers["Cache-Control"] += ", must-revalidate"
|
259
259
|
headers["Vary"] = "Accept-Encoding"
|
260
260
|
end
|
261
261
|
|
data/lib/sprockets/uri_utils.rb
CHANGED
@@ -20,6 +20,8 @@ module Sprockets
|
|
20
20
|
module URIUtils
|
21
21
|
extend self
|
22
22
|
|
23
|
+
URI_PARSER = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::RFC2396_Parser.new
|
24
|
+
|
23
25
|
# Internal: Parse URI into component parts.
|
24
26
|
#
|
25
27
|
# uri - String uri
|
@@ -44,12 +46,15 @@ module Sprockets
|
|
44
46
|
def split_file_uri(uri)
|
45
47
|
scheme, _, host, _, _, path, _, query, _ = URI.split(uri)
|
46
48
|
|
47
|
-
path =
|
49
|
+
path = URI_PARSER.unescape(path)
|
48
50
|
path.force_encoding(Encoding::UTF_8)
|
49
51
|
|
50
52
|
# Hack for parsing Windows "file:///C:/Users/IEUser" paths
|
51
53
|
path.gsub!(/^\/([a-zA-Z]:)/, '\1'.freeze)
|
52
54
|
|
55
|
+
host = nil if host && host.empty?
|
56
|
+
query = nil if query && query.empty?
|
57
|
+
|
53
58
|
[scheme, host, path, query]
|
54
59
|
end
|
55
60
|
|
@@ -60,7 +65,7 @@ module Sprockets
|
|
60
65
|
str = "#{scheme}://"
|
61
66
|
str << host if host
|
62
67
|
path = "/#{path}" unless path.start_with?("/")
|
63
|
-
str <<
|
68
|
+
str << URI_PARSER.escape(path)
|
64
69
|
str << "?#{query}" if query
|
65
70
|
str
|
66
71
|
end
|
@@ -159,7 +164,7 @@ module Sprockets
|
|
159
164
|
when Integer
|
160
165
|
query << "#{key}=#{value}"
|
161
166
|
when String, Symbol
|
162
|
-
query << "#{key}=#{
|
167
|
+
query << "#{key}=#{URI_PARSER.escape(value.to_s)}"
|
163
168
|
when TrueClass
|
164
169
|
query << "#{key}"
|
165
170
|
when FalseClass, NilClass
|
@@ -179,7 +184,7 @@ module Sprockets
|
|
179
184
|
def parse_uri_query_params(query)
|
180
185
|
query.to_s.split('&').reduce({}) do |h, p|
|
181
186
|
k, v = p.split('=', 2)
|
182
|
-
v =
|
187
|
+
v = URI_PARSER.unescape(v) if v
|
183
188
|
h[k.to_sym] = v || true
|
184
189
|
h
|
185
190
|
end
|
data/lib/sprockets/utils.rb
CHANGED
data/lib/sprockets/version.rb
CHANGED
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 { "" },
|
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.
|
4
|
+
version: 3.7.4
|
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:
|
12
|
+
date: 2024-09-09 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: '
|
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: '
|
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
|
-
|
336
|
-
|
337
|
-
signing_key:
|
349
|
+
rubygems_version: 3.5.11
|
350
|
+
signing_key:
|
338
351
|
specification_version: 4
|
339
352
|
summary: Rack-based asset packaging system
|
340
353
|
test_files: []
|