sprockets 3.7.2 → 3.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/sprockets/directive_processor.rb +2 -0
- data/lib/sprockets/erb_processor.rb +13 -1
- 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 +3 -0
- 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: d8d2739c5e14edf6aa95989aef8057d65eeb1525b4fccda72ba6099a8fe94bd3
|
4
|
+
data.tar.gz: 42fea69a2cf60adff7848fea3c8cd7fff222703611feda467aa8c5236aed9d84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 753ee6f089d3e281ba3eb81fe4fbd133d50065337f84c02891895de4544d2204bc884c1599781d632f290b1d407d684f473e101e5ba535f12afebc82a979cdd8
|
7
|
+
data.tar.gz: 9c57173eb38957dc992617903bd15b922caf20468c5952c158ffa00472c52ce6e0029011495f8b2fcd9a9148cd7b4ce3525b1749b3c9b1a982038ca9afe0e737
|
data/CHANGELOG.md
CHANGED
@@ -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/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
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.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:
|
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: '
|
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.3
|
350
|
+
signing_key:
|
338
351
|
specification_version: 4
|
339
352
|
summary: Rack-based asset packaging system
|
340
353
|
test_files: []
|