sprockets 4.2.0 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/sprockets/asset.rb +1 -1
- data/lib/sprockets/encoding_utils.rb +1 -2
- data/lib/sprockets/loader.rb +3 -1
- data/lib/sprockets/server.rb +29 -19
- data/lib/sprockets/uri_utils.rb +7 -4
- data/lib/sprockets/version.rb +1 -1
- data/lib/sprockets.rb +1 -1
- metadata +19 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6be8e97ff1bd7395fc078716cac0b775bacd30e1aad43153113df1b05b292164
|
4
|
+
data.tar.gz: e63069b6630898f92fe1853e51e7259714e126a44bd7b52442b9308533bee1d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37b62ffb61ca730485fcdf0526085a3eaabf21ebcc61f27f98510d4c013e7f64a0d5910879677a4d364bec5506b3d58a044ec4708e076a8791b3bf462699fdcd
|
7
|
+
data.tar.gz: 8d1178cbe5d033538d85a8ee9fb106bacc3ee7194d40332d42212f86298b458c3c45945a3be52320795f4fc1c3295d8ba27a4a05b2acefae24a191ee04a38c0f
|
data/CHANGELOG.md
CHANGED
@@ -2,12 +2,29 @@
|
|
2
2
|
|
3
3
|
Get upgrade notes from Sprockets 3.x to 4.x at https://github.com/rails/sprockets/blob/master/UPGRADING.md
|
4
4
|
|
5
|
+
## 4.2.2
|
6
|
+
|
7
|
+
- Added missing dependency on `logger`. [#813](https://github.com/rails/sprockets/pull/813)
|
8
|
+
- Fix `URI::RFC3986_PARSER` warnings. [#812](https://github.com/rails/sprockets/pull/812)
|
9
|
+
- Removed dependency on `base64`. [#810](https://github.com/rails/sprockets/pull/810)
|
10
|
+
|
11
|
+
## 4.2.1
|
12
|
+
|
13
|
+
- Fix for precompile issues when multiple extensions map to the same MIME type (eg. `.jpeg` / `.jpg`). [#781](https://github.com/rails/sprockets/pull/781)
|
14
|
+
- Fix `application/css-sourcemap+json` charset [#764](https://github.com/rails/sprockets/pull/764)
|
15
|
+
- Fix compatibility with Rack 2 applications. [#790](https://github.com/rails/sprockets/pull/790)
|
16
|
+
|
5
17
|
## 4.2.0
|
6
18
|
|
7
19
|
- Rack 3 compatibility. [#758](https://github.com/rails/sprockets/pull/758)
|
8
20
|
- Fix thread safety of `Sprockets::CachedEnvironment` and `Sprockets::Cache::MemoryStore`. [#771](https://github.com/rails/sprockets/pull/771)
|
9
21
|
- Add support for Rack 3.0. Headers set by sprockets will now be lower case. [#758](https://github.com/rails/sprockets/pull/758)
|
10
22
|
- Make `Sprockets::Utils.module_include` thread safe on JRuby. [#759](https://github.com/rails/sprockets/pull/759)
|
23
|
+
- Fix typo in `asset.rb` file. [#768](https://github.com/rails/sprockets/pull/768)
|
24
|
+
|
25
|
+
## 4.1.1
|
26
|
+
|
27
|
+
- Fix `Sprockets::Server` to return response headers to be compatible with Rack::Lint 2.0.
|
11
28
|
|
12
29
|
## 4.1.0
|
13
30
|
|
data/lib/sprockets/asset.rb
CHANGED
data/lib/sprockets/loader.rb
CHANGED
@@ -165,7 +165,9 @@ module Sprockets
|
|
165
165
|
end
|
166
166
|
|
167
167
|
if type = unloaded.params[:type]
|
168
|
-
|
168
|
+
extensions = config[:mime_types][type][:extensions]
|
169
|
+
extension = extensions.include?(extname) ? extname : extensions.first
|
170
|
+
logical_path += extension
|
169
171
|
end
|
170
172
|
|
171
173
|
if type != file_type && !config[:transformers][file_type][type]
|
data/lib/sprockets/server.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'set'
|
3
3
|
require 'time'
|
4
|
-
require 'rack
|
4
|
+
require 'rack'
|
5
5
|
|
6
6
|
module Sprockets
|
7
7
|
# `Server` is a concern mixed into `Environment` and
|
@@ -11,6 +11,16 @@ module Sprockets
|
|
11
11
|
# Supported HTTP request methods.
|
12
12
|
ALLOWED_REQUEST_METHODS = ['GET', 'HEAD'].to_set.freeze
|
13
13
|
|
14
|
+
# :stopdoc:
|
15
|
+
if Gem::Version.new(Rack::RELEASE) < Gem::Version.new("3")
|
16
|
+
X_CASCADE = "X-Cascade"
|
17
|
+
VARY = "Vary"
|
18
|
+
else
|
19
|
+
X_CASCADE = "x-cascade"
|
20
|
+
VARY = "vary"
|
21
|
+
end
|
22
|
+
# :startdoc:
|
23
|
+
|
14
24
|
# `call` implements the Rack 1.x specification which accepts an
|
15
25
|
# `env` Hash and returns a three item tuple with the status code,
|
16
26
|
# headers, and body.
|
@@ -148,39 +158,39 @@ module Sprockets
|
|
148
158
|
# Returns a 400 Forbidden response tuple
|
149
159
|
def bad_request_response(env)
|
150
160
|
if head_request?(env)
|
151
|
-
[ 400, {
|
161
|
+
[ 400, { Rack::CONTENT_TYPE => "text/plain", Rack::CONTENT_LENGTH => "0" }, [] ]
|
152
162
|
else
|
153
|
-
[ 400, {
|
163
|
+
[ 400, { Rack::CONTENT_TYPE => "text/plain", Rack::CONTENT_LENGTH => "11" }, [ "Bad Request" ] ]
|
154
164
|
end
|
155
165
|
end
|
156
166
|
|
157
167
|
# Returns a 403 Forbidden response tuple
|
158
168
|
def forbidden_response(env)
|
159
169
|
if head_request?(env)
|
160
|
-
[ 403, {
|
170
|
+
[ 403, { Rack::CONTENT_TYPE => "text/plain", Rack::CONTENT_LENGTH => "0" }, [] ]
|
161
171
|
else
|
162
|
-
[ 403, {
|
172
|
+
[ 403, { Rack::CONTENT_TYPE => "text/plain", Rack::CONTENT_LENGTH => "9" }, [ "Forbidden" ] ]
|
163
173
|
end
|
164
174
|
end
|
165
175
|
|
166
176
|
# Returns a 404 Not Found response tuple
|
167
177
|
def not_found_response(env)
|
168
178
|
if head_request?(env)
|
169
|
-
[ 404, {
|
179
|
+
[ 404, { Rack::CONTENT_TYPE => "text/plain", Rack::CONTENT_LENGTH => "0", X_CASCADE => "pass" }, [] ]
|
170
180
|
else
|
171
|
-
[ 404, {
|
181
|
+
[ 404, { Rack::CONTENT_TYPE => "text/plain", Rack::CONTENT_LENGTH => "9", X_CASCADE => "pass" }, [ "Not found" ] ]
|
172
182
|
end
|
173
183
|
end
|
174
184
|
|
175
185
|
def method_not_allowed_response
|
176
|
-
[ 405, {
|
186
|
+
[ 405, { Rack::CONTENT_TYPE => "text/plain", Rack::CONTENT_LENGTH => "18" }, [ "Method Not Allowed" ] ]
|
177
187
|
end
|
178
188
|
|
179
189
|
def precondition_failed_response(env)
|
180
190
|
if head_request?(env)
|
181
|
-
[ 412, {
|
191
|
+
[ 412, { Rack::CONTENT_TYPE => "text/plain", Rack::CONTENT_LENGTH => "0", X_CASCADE => "pass" }, [] ]
|
182
192
|
else
|
183
|
-
[ 412, {
|
193
|
+
[ 412, { Rack::CONTENT_TYPE => "text/plain", Rack::CONTENT_LENGTH => "19", X_CASCADE => "pass" }, [ "Precondition Failed" ] ]
|
184
194
|
end
|
185
195
|
end
|
186
196
|
|
@@ -189,7 +199,7 @@ module Sprockets
|
|
189
199
|
def javascript_exception_response(exception)
|
190
200
|
err = "#{exception.class.name}: #{exception.message}\n (in #{exception.backtrace[0]})"
|
191
201
|
body = "throw Error(#{err.inspect})"
|
192
|
-
[ 200, {
|
202
|
+
[ 200, { Rack::CONTENT_TYPE => "application/javascript", Rack::CONTENT_LENGTH => body.bytesize.to_s }, [ body ] ]
|
193
203
|
end
|
194
204
|
|
195
205
|
# Returns a CSS response that hides all elements on the page and
|
@@ -242,7 +252,7 @@ module Sprockets
|
|
242
252
|
}
|
243
253
|
CSS
|
244
254
|
|
245
|
-
[ 200, {
|
255
|
+
[ 200, { Rack::CONTENT_TYPE => "text/css; charset=utf-8", Rack::CONTENT_LENGTH => body.bytesize.to_s }, [ body ] ]
|
246
256
|
end
|
247
257
|
|
248
258
|
# Escape special characters for use inside a CSS content("...") string
|
@@ -258,18 +268,18 @@ module Sprockets
|
|
258
268
|
headers = {}
|
259
269
|
|
260
270
|
# Set caching headers
|
261
|
-
headers[
|
262
|
-
headers[
|
271
|
+
headers[Rack::CACHE_CONTROL] = +"public"
|
272
|
+
headers[Rack::ETAG] = %("#{etag}")
|
263
273
|
|
264
274
|
# If the request url contains a fingerprint, set a long
|
265
275
|
# expires on the response
|
266
276
|
if path_fingerprint(env["PATH_INFO"])
|
267
|
-
headers[
|
277
|
+
headers[Rack::CACHE_CONTROL] << ", max-age=31536000, immutable"
|
268
278
|
|
269
279
|
# Otherwise set `must-revalidate` since the asset could be modified.
|
270
280
|
else
|
271
|
-
headers[
|
272
|
-
headers[
|
281
|
+
headers[Rack::CACHE_CONTROL] << ", must-revalidate"
|
282
|
+
headers[VARY] = "Accept-Encoding"
|
273
283
|
end
|
274
284
|
|
275
285
|
headers
|
@@ -279,7 +289,7 @@ module Sprockets
|
|
279
289
|
headers = {}
|
280
290
|
|
281
291
|
# Set content length header
|
282
|
-
headers[
|
292
|
+
headers[Rack::CONTENT_LENGTH] = length.to_s
|
283
293
|
|
284
294
|
# Set content type header
|
285
295
|
if type = asset.content_type
|
@@ -287,7 +297,7 @@ module Sprockets
|
|
287
297
|
if type.start_with?("text/") && asset.charset
|
288
298
|
type += "; charset=#{asset.charset}"
|
289
299
|
end
|
290
|
-
headers[
|
300
|
+
headers[Rack::CONTENT_TYPE] = type
|
291
301
|
end
|
292
302
|
|
293
303
|
headers.merge(cache_headers(env, asset.etag))
|
data/lib/sprockets/uri_utils.rb
CHANGED
@@ -21,6 +21,9 @@ module Sprockets
|
|
21
21
|
module URIUtils
|
22
22
|
extend self
|
23
23
|
|
24
|
+
URI_PARSER = defined?(URI::RFC2396_PARSER) ? URI::RFC2396_PARSER : URI::Generic::DEFAULT_PARSER
|
25
|
+
private_constant :URI_PARSER
|
26
|
+
|
24
27
|
# Internal: Parse URI into component parts.
|
25
28
|
#
|
26
29
|
# uri - String uri
|
@@ -45,7 +48,7 @@ module Sprockets
|
|
45
48
|
def split_file_uri(uri)
|
46
49
|
scheme, _, host, _, _, path, _, query, _ = URI.split(uri)
|
47
50
|
|
48
|
-
path =
|
51
|
+
path = URI_PARSER.unescape(path)
|
49
52
|
path.force_encoding(Encoding::UTF_8)
|
50
53
|
|
51
54
|
# Hack for parsing Windows "/C:/Users/IEUser" paths
|
@@ -63,7 +66,7 @@ module Sprockets
|
|
63
66
|
str = +"#{scheme}://"
|
64
67
|
str << host if host
|
65
68
|
path = "/#{path}" unless path.start_with?("/".freeze)
|
66
|
-
str <<
|
69
|
+
str << URI_PARSER.escape(path)
|
67
70
|
str << "?#{query}" if query
|
68
71
|
str
|
69
72
|
end
|
@@ -162,7 +165,7 @@ module Sprockets
|
|
162
165
|
when Integer
|
163
166
|
query << "#{key}=#{value}"
|
164
167
|
when String, Symbol
|
165
|
-
query << "#{key}=#{
|
168
|
+
query << "#{key}=#{URI_PARSER.escape(value.to_s)}"
|
166
169
|
when TrueClass
|
167
170
|
query << "#{key}"
|
168
171
|
when FalseClass, NilClass
|
@@ -182,7 +185,7 @@ module Sprockets
|
|
182
185
|
def parse_uri_query_params(query)
|
183
186
|
query.to_s.split('&'.freeze).reduce({}) do |h, p|
|
184
187
|
k, v = p.split('='.freeze, 2)
|
185
|
-
v =
|
188
|
+
v = URI_PARSER.unescape(v) if v
|
186
189
|
h[k.to_sym] = v || true
|
187
190
|
h
|
188
191
|
end
|
data/lib/sprockets/version.rb
CHANGED
data/lib/sprockets.rb
CHANGED
@@ -91,7 +91,7 @@ module Sprockets
|
|
91
91
|
|
92
92
|
require 'sprockets/source_map_processor'
|
93
93
|
register_mime_type 'application/js-sourcemap+json', extensions: ['.js.map'], charset: :unicode
|
94
|
-
register_mime_type 'application/css-sourcemap+json', extensions: ['.css.map']
|
94
|
+
register_mime_type 'application/css-sourcemap+json', extensions: ['.css.map'], charset: :unicode
|
95
95
|
register_transformer 'application/javascript', 'application/js-sourcemap+json', SourceMapProcessor
|
96
96
|
register_transformer 'text/css', 'application/css-sourcemap+json', SourceMapProcessor
|
97
97
|
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprockets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Stephenson
|
8
8
|
- Joshua Peek
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-04-19 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rack
|
@@ -45,6 +44,20 @@ dependencies:
|
|
45
44
|
- - "~>"
|
46
45
|
- !ruby/object:Gem::Version
|
47
46
|
version: '1.0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: logger
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
48
61
|
- !ruby/object:Gem::Dependency
|
49
62
|
name: m
|
50
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -233,14 +246,14 @@ dependencies:
|
|
233
246
|
requirements:
|
234
247
|
- - "~>"
|
235
248
|
- !ruby/object:Gem::Version
|
236
|
-
version: '
|
249
|
+
version: '13.2'
|
237
250
|
type: :development
|
238
251
|
prerelease: false
|
239
252
|
version_requirements: !ruby/object:Gem::Requirement
|
240
253
|
requirements:
|
241
254
|
- - "~>"
|
242
255
|
- !ruby/object:Gem::Version
|
243
|
-
version: '
|
256
|
+
version: '13.2'
|
244
257
|
- !ruby/object:Gem::Dependency
|
245
258
|
name: sass
|
246
259
|
requirement: !ruby/object:Gem::Requirement
|
@@ -423,7 +436,6 @@ homepage: https://github.com/rails/sprockets
|
|
423
436
|
licenses:
|
424
437
|
- MIT
|
425
438
|
metadata: {}
|
426
|
-
post_install_message:
|
427
439
|
rdoc_options: []
|
428
440
|
require_paths:
|
429
441
|
- lib
|
@@ -438,8 +450,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
438
450
|
- !ruby/object:Gem::Version
|
439
451
|
version: '0'
|
440
452
|
requirements: []
|
441
|
-
rubygems_version: 3.
|
442
|
-
signing_key:
|
453
|
+
rubygems_version: 3.6.2
|
443
454
|
specification_version: 4
|
444
455
|
summary: Rack-based asset packaging system
|
445
456
|
test_files: []
|