sprockets 3.0.0 → 3.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +296 -0
- data/README.md +49 -183
- data/bin/sprockets +1 -0
- data/lib/sprockets/asset.rb +3 -2
- data/lib/sprockets/base.rb +13 -2
- data/lib/sprockets/bundle.rb +5 -1
- data/lib/sprockets/cache/file_store.rb +7 -4
- data/lib/sprockets/cache.rb +6 -4
- data/lib/sprockets/closure_compressor.rb +5 -11
- data/lib/sprockets/coffee_script_processor.rb +2 -2
- data/lib/sprockets/coffee_script_template.rb +12 -1
- data/lib/sprockets/compressing.rb +20 -0
- data/lib/sprockets/context.rb +3 -1
- data/lib/sprockets/dependencies.rb +8 -8
- data/lib/sprockets/deprecation.rb +90 -0
- data/lib/sprockets/digest_utils.rb +81 -57
- data/lib/sprockets/eco_processor.rb +2 -2
- data/lib/sprockets/eco_template.rb +12 -1
- data/lib/sprockets/ejs_processor.rb +2 -2
- data/lib/sprockets/ejs_template.rb +12 -1
- data/lib/sprockets/encoding_utils.rb +7 -4
- data/lib/sprockets/engines.rb +11 -0
- data/lib/sprockets/erb_template.rb +6 -1
- data/lib/sprockets/errors.rb +0 -1
- data/lib/sprockets/http_utils.rb +3 -1
- data/lib/sprockets/legacy.rb +16 -0
- data/lib/sprockets/legacy_proc_processor.rb +1 -1
- data/lib/sprockets/legacy_tilt_processor.rb +2 -2
- data/lib/sprockets/loader.rb +208 -59
- data/lib/sprockets/manifest.rb +57 -6
- data/lib/sprockets/path_utils.rb +20 -15
- data/lib/sprockets/processing.rb +10 -0
- data/lib/sprockets/processor_utils.rb +77 -0
- data/lib/sprockets/resolve.rb +9 -6
- data/lib/sprockets/sass_cache_store.rb +6 -1
- data/lib/sprockets/sass_compressor.rb +9 -17
- data/lib/sprockets/sass_processor.rb +16 -9
- data/lib/sprockets/sass_template.rb +14 -2
- data/lib/sprockets/server.rb +32 -12
- data/lib/sprockets/uglifier_compressor.rb +6 -13
- data/lib/sprockets/unloaded_asset.rb +137 -0
- data/lib/sprockets/uri_tar.rb +98 -0
- data/lib/sprockets/uri_utils.rb +5 -7
- data/lib/sprockets/utils/gzip.rb +67 -0
- data/lib/sprockets/utils.rb +35 -18
- data/lib/sprockets/version.rb +1 -1
- data/lib/sprockets/yui_compressor.rb +4 -14
- data/lib/sprockets.rb +21 -11
- metadata +28 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 46e0f0a150aa8333d2a1d2663167b6f20c1e77db067cea7b545f75927f770807
|
4
|
+
data.tar.gz: 5acd5cb5c64e240dd8180e91f34620195fa1433e625ee48a132fdae58be71ba5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97a06eb2e0767903da7bcda387211d881f3b98d57269a8abed5045e277db5f133f381c4f8fd23fcccf45a4032c85309841abba13b9218a52b21121a5a9bfc02a
|
7
|
+
data.tar.gz: 1d9c8d75bab64c366473226cc61806cd64c1951a67d90cc1220c1474e6a02cc5003b2dffb1b6324abefb7e7c8b292145635ac0bed6ae947a35393d67acd3c40e
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,296 @@
|
|
1
|
+
**3.7.2** (June 19, 2018)
|
2
|
+
|
3
|
+
* Security release for [CVE-2018-3760](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-3760).
|
4
|
+
|
5
|
+
**3.7.1** (December 19, 2016)
|
6
|
+
|
7
|
+
* Ruby 2.4 support for Sprockets 3.
|
8
|
+
|
9
|
+
**3.7.0** (July 21, 2016)
|
10
|
+
|
11
|
+
* Deprecated interfaces now emit deprecation warnings #345
|
12
|
+
|
13
|
+
**3.6.3** (July 1, 2016)
|
14
|
+
|
15
|
+
* Faster asset lookup in large directories #336
|
16
|
+
* Faster PathUtils.match_path_extname https://github.com/rails/sprockets/commit/697269cf81e5261fdd7072e32bd489403027fd7e
|
17
|
+
* Fixed uglifier comment stripping #326
|
18
|
+
* Error messages now show load path info #313
|
19
|
+
|
20
|
+
**3.6.2** (June 21, 2016)
|
21
|
+
|
22
|
+
* More performance improvements.
|
23
|
+
|
24
|
+
**3.6.1** (June 17, 2016)
|
25
|
+
|
26
|
+
* Some performance improvements.
|
27
|
+
|
28
|
+
**3.6.0** (April 6, 2016)
|
29
|
+
|
30
|
+
* Add `Manifest#find_sources` to return the source of the compiled assets.
|
31
|
+
* Fix the list of compressable mime types.
|
32
|
+
* Improve performance of the `FileStore` cache.
|
33
|
+
|
34
|
+
**3.5.2** (December 8, 2015)
|
35
|
+
|
36
|
+
* Fix JRuby bug with concurrent-ruby.
|
37
|
+
* Fix disabling gzip generation in cached environments.
|
38
|
+
|
39
|
+
**3.5.1** (December 5, 2015)
|
40
|
+
|
41
|
+
* Fix gzip asset generation for assets already on disk.
|
42
|
+
|
43
|
+
**3.5.0** (December 3, 2015)
|
44
|
+
|
45
|
+
* Reintroduce Gzip file generation for non-binary assets.
|
46
|
+
|
47
|
+
**3.4.1** (November 25, 2015)
|
48
|
+
|
49
|
+
* PathUtils::Entries will no longer error on an empty directory.
|
50
|
+
|
51
|
+
**3.4.0** (October 5, 2015)
|
52
|
+
|
53
|
+
* Expose method to override the sass cache in the SassProcessor.
|
54
|
+
|
55
|
+
**3.3.5** (September 25, 2015)
|
56
|
+
|
57
|
+
* Fix bug related to absolute path being reintroduced into history cache #141.
|
58
|
+
|
59
|
+
**3.3.4** (September 1, 2015)
|
60
|
+
|
61
|
+
* Relative cache contents now work with windows.
|
62
|
+
|
63
|
+
**3.3.3** (August 21, 2015)
|
64
|
+
|
65
|
+
* Remove more absolute paths from cache contents.
|
66
|
+
|
67
|
+
**3.3.2** (August 19, 2015)
|
68
|
+
|
69
|
+
* Fix cache contents to use relative paths instead of absolute paths.
|
70
|
+
|
71
|
+
**3.3.1** (August 15, 2015)
|
72
|
+
|
73
|
+
* Fix legacy Tilt integration when locals is required argument.
|
74
|
+
|
75
|
+
**3.3.0** (August 12, 2015)
|
76
|
+
|
77
|
+
* Change internal cache key to use relative asset paths instead of absolute paths.
|
78
|
+
|
79
|
+
**3.2.0** (June 2, 2015)
|
80
|
+
|
81
|
+
* Updated SRI integrity to align with spec changes
|
82
|
+
* Deprecated Manifest integrity attribute
|
83
|
+
* Cleanup concatenating JS sources with newlines
|
84
|
+
|
85
|
+
**3.1.0** (May 10, 2015)
|
86
|
+
|
87
|
+
* Removed "index" logical path normalization. Asset#logical_path is always the
|
88
|
+
full logical path to the index file.
|
89
|
+
* Fixed static asset mtimes
|
90
|
+
* Fix manifest cleanup by age
|
91
|
+
* Removed redundant minifier level cache
|
92
|
+
* Updated SRI format according to spec changes
|
93
|
+
|
94
|
+
**3.0.3** (April 27, 2015)
|
95
|
+
|
96
|
+
* Fix static asset mtime fallback
|
97
|
+
* Only warn when specified asset version can not be loaded.
|
98
|
+
|
99
|
+
**3.0.2** (April 22, 2015)
|
100
|
+
|
101
|
+
* Ensure legacy Tilt handlers return String class data. Fixes issues with Haml
|
102
|
+
Tilt handler.
|
103
|
+
* Type check and improve error messages raised on bad processor returned results.
|
104
|
+
* Improve error message for relative paths not under load path.
|
105
|
+
* Changed HTML encoding fallback from ISO-8859-1 to default external.
|
106
|
+
* Avoid falling back to 0 mtimes which may cause warnings with tar
|
107
|
+
|
108
|
+
**3.0.1** (April 14, 2015)
|
109
|
+
|
110
|
+
* Fixed `Context#depend_on` with paths outside the load path
|
111
|
+
|
112
|
+
**3.0.0** (April 12, 2015)
|
113
|
+
|
114
|
+
[Guide to upgrading from Sprockets 2.x to 3.x](https://github.com/rails/sprockets/blob/3.x/UPGRADING.md)
|
115
|
+
|
116
|
+
* New processor API. Tilt interface is deprecated.
|
117
|
+
* Improved file store caching backend.
|
118
|
+
* MIME Types now accept charset custom charset detecters. Improves support for UTF-16/32 files.
|
119
|
+
* Environment#version no longer affects asset digests. Only used for busting the asset cache.
|
120
|
+
* Removed builtin support for LESS.
|
121
|
+
* Removed `//= include` directive support.
|
122
|
+
* Deprecated `BundledAsset#to_a`. Use `BundledAsset#included` to access debugging subcomponents.
|
123
|
+
* Support circular dependencies. For parity with ES6 modules.
|
124
|
+
* Manifest compilation will no longer generate .gz files by default. [Mixing
|
125
|
+
Content-Encoding and ETags is just a bad
|
126
|
+
idea](https://issues.apache.org/bugzilla/show_bug.cgi?id=39727)
|
127
|
+
* Added linked or referenced assets. When an asset is compiled, any of its links will be compiled as well.
|
128
|
+
* Introduce some limitations around enumerating all logical paths. 4.x will deprecate it and favor linked manifests for compliation.
|
129
|
+
* Add Asset integrity attribute for Subresource Integrity
|
130
|
+
* Default digest changed to SHA256. Configuring `digest_class` is deprecated.
|
131
|
+
* Rename `Asset#digest` to `Asset#hexdigest`. `Asset#digest` is deprecated and will
|
132
|
+
return a raw byte String in 4.x.
|
133
|
+
* Added transitional compatibility flag to `Environment#resolve(path, compat: true)`. 2.x mode operates with `compat: true` and 4.x with `compat: false`
|
134
|
+
* `manifest-abc123.json` renamed to `.sprockets-abc123.json`
|
135
|
+
|
136
|
+
**2.12.3** (October 28, 2014)
|
137
|
+
|
138
|
+
* Security: Fix directory traversal bug in development mode server.
|
139
|
+
|
140
|
+
**2.12.2** (September 5, 2014)
|
141
|
+
|
142
|
+
* Ensure internal asset lookups calls are still restricted to load paths within
|
143
|
+
asset compiles. Though, you should not depend on internal asset resolves to be
|
144
|
+
completely restricted for security reasons. Assets themselves should be
|
145
|
+
considered full scripting environments with filesystem access.
|
146
|
+
|
147
|
+
**2.12.1** (April 17, 2014)
|
148
|
+
|
149
|
+
* Fix making manifest target directory when its different than the output directory.
|
150
|
+
|
151
|
+
**2.12.0** (March 13, 2014)
|
152
|
+
|
153
|
+
* Avoid context reference in SassImporter hack so its Marshallable. Fixes
|
154
|
+
issues with Sass 3.3.x.
|
155
|
+
|
156
|
+
**2.11.0** (February 19, 2014)
|
157
|
+
|
158
|
+
* Cache store must now be an LRU implementation.
|
159
|
+
* Default digest changed to SHA1. To continue using MD5.
|
160
|
+
`env.digest_class = Digest::MD5`.
|
161
|
+
|
162
|
+
**2.10.0** (May 24, 2013)
|
163
|
+
|
164
|
+
* Support for `bower.json`
|
165
|
+
|
166
|
+
**2.9.3** (April 20, 2013)
|
167
|
+
|
168
|
+
* Fixed sass caching bug
|
169
|
+
|
170
|
+
**2.9.2** (April 8, 2013)
|
171
|
+
|
172
|
+
* Improve file freshness check performance
|
173
|
+
* Directive processor encoding fixes
|
174
|
+
|
175
|
+
**2.9.1** (April 6, 2013)
|
176
|
+
|
177
|
+
* Support for Uglifier 2.x
|
178
|
+
|
179
|
+
**2.9.0** (February 25, 2013)
|
180
|
+
|
181
|
+
* Write out gzipped variants of bundled assets.
|
182
|
+
|
183
|
+
**2.8.2** (December 10, 2012)
|
184
|
+
|
185
|
+
* Fixed top level Sass constant references
|
186
|
+
* Fixed manifest logger when environment is disabled
|
187
|
+
|
188
|
+
**2.8.1** (October 31, 2012)
|
189
|
+
|
190
|
+
* Fixed Sass importer bug
|
191
|
+
|
192
|
+
**2.8.0** (October 16, 2012)
|
193
|
+
|
194
|
+
* Allow manifest location to be separated from output directory
|
195
|
+
* Pass logical path and absolute path to each_logical_path iterator
|
196
|
+
|
197
|
+
**2.7.0** (October 10, 2012)
|
198
|
+
|
199
|
+
* Added --css-compressor and --js-compressor command line flags
|
200
|
+
* Added css/js compressor shorthand
|
201
|
+
* Change default manifest.json filename to be a randomized manifest-16HEXBYTES.json
|
202
|
+
* Allow nil environment to be passed to manifest
|
203
|
+
* Allow manifest instance to be set on rake task
|
204
|
+
|
205
|
+
**2.6.0** (September 19, 2012)
|
206
|
+
|
207
|
+
* Added bower component.json require support
|
208
|
+
|
209
|
+
**2.5.0** (September 4, 2012)
|
210
|
+
|
211
|
+
* Fixed Ruby 2.0 RegExp warning
|
212
|
+
* Provide stubbed implementation of context *_path helpers
|
213
|
+
* Add SassCompressor
|
214
|
+
|
215
|
+
**2.4.5** (July 10, 2012)
|
216
|
+
|
217
|
+
* Tweaked some logger levels
|
218
|
+
|
219
|
+
**2.4.4** (July 2, 2012)
|
220
|
+
|
221
|
+
* Canonicalize logical path extensions
|
222
|
+
* Check absolute paths passed to depend_on
|
223
|
+
|
224
|
+
**2.4.3** (May 16, 2012)
|
225
|
+
|
226
|
+
* Exposed :sprockets in sass options
|
227
|
+
* Include dependency paths in asset mtime
|
228
|
+
|
229
|
+
**2.4.2** (May 7, 2012)
|
230
|
+
|
231
|
+
* Fixed MultiJson feature detect
|
232
|
+
|
233
|
+
**2.4.1** (April 26, 2012)
|
234
|
+
|
235
|
+
* Fixed MultiJson API change
|
236
|
+
* Fixed gzip mtime
|
237
|
+
|
238
|
+
**2.4.0** (March 27, 2012)
|
239
|
+
|
240
|
+
* Added global path registry
|
241
|
+
* Added global processor registry
|
242
|
+
|
243
|
+
**2.3.2** (March 26, 2012)
|
244
|
+
|
245
|
+
* Fix Context#logical_path with dots
|
246
|
+
|
247
|
+
**2.3.1** (February 11, 2012)
|
248
|
+
|
249
|
+
* Added bytesize to manifest
|
250
|
+
* Added Asset#bytesize alias
|
251
|
+
* Security: Check path for forbidden access after unescaping
|
252
|
+
|
253
|
+
**2.3.0** (January 16, 2012)
|
254
|
+
|
255
|
+
* Added special Sass importer that automatically tracks any `@import`ed files.
|
256
|
+
|
257
|
+
**2.2.0** (January 10, 2012)
|
258
|
+
|
259
|
+
* Added `sprockets` command line utility.
|
260
|
+
* Added rake/sprocketstask.
|
261
|
+
* Added json manifest log of compiled assets.
|
262
|
+
* Added `stub` directive that allows you to exclude files from the bundle.
|
263
|
+
* Added per environment external encoding (Environment#default_external_encoding). Defaults to UTF-8. Fixes issues where LANG is not set correctly and Rubys default external is set to ASCII.
|
264
|
+
|
265
|
+
**2.1.2** (November 20, 2011)
|
266
|
+
|
267
|
+
* Disabled If-Modified-Since server checks. Fixes some browser caching issues when serving the asset body only. If-None-Match caching is sufficient.
|
268
|
+
|
269
|
+
**2.1.1** (November 18, 2011)
|
270
|
+
|
271
|
+
* Fix windows absolute path check bug.
|
272
|
+
|
273
|
+
**2.1.0** (November 11, 2011)
|
274
|
+
|
275
|
+
* Directive comment lines are now turned into empty lines instead of removed. This way line numbers in
|
276
|
+
CoffeeScript syntax errors are correct.
|
277
|
+
* Performance and caching bug fixes.
|
278
|
+
|
279
|
+
**2.0.3** (October 17, 2011)
|
280
|
+
|
281
|
+
* Detect format extensions from right to left.
|
282
|
+
* Make JST namespace configurable.
|
283
|
+
|
284
|
+
**2.0.2** (October 4, 2011)
|
285
|
+
|
286
|
+
* Fixed loading stale cache from bundler gems.
|
287
|
+
|
288
|
+
**2.0.1** (September 30, 2011)
|
289
|
+
|
290
|
+
* Fixed bug with fingerprinting file names with multiple dots.
|
291
|
+
* Decode URIs as default internal.
|
292
|
+
* Fix symlinked asset directories.
|
293
|
+
|
294
|
+
**2.0.0** (August 29, 2011)
|
295
|
+
|
296
|
+
* Initial public release.
|
data/README.md
CHANGED
@@ -20,6 +20,54 @@ Or include it in your project's `Gemfile` with Bundler:
|
|
20
20
|
gem 'sprockets', '~> 3.0'
|
21
21
|
```
|
22
22
|
|
23
|
+
## Using sprockets
|
24
|
+
|
25
|
+
For most people interested in using sprockets you will want to see [End User Asset Generation](guides/end_user_asset_generation.md) guide. This contains information about sprocket's directive syntax, and default processing behavior.
|
26
|
+
|
27
|
+
If you are a framework developer that is using sprockets, see [Building an Asset Processing Framework](guides/building_an_asset_processing_framework.md).
|
28
|
+
|
29
|
+
If you are a library developer who is extending the functionality of sprockets, see [Extending Sprockets](guides/extending_sprockets.md).
|
30
|
+
|
31
|
+
Below is a disjointed mix of documentation for all three of these roles. Eventually they will be moved to an appropriate guide, for now the recommended way to consume documentation is to view the appropriate guide first and then supplement with docs from the README.
|
32
|
+
|
33
|
+
## Behavior
|
34
|
+
|
35
|
+
### Index files are proxies for folders
|
36
|
+
|
37
|
+
In sprockets index files such as `index.js` or `index.css` files inside of a folder will generate a file with the folder's name. So if you have a `foo/index.js` file it will compile down to `foo.js`. This is similar to NPM's behavior of using [folders as modules](https://nodejs.org/api/modules.html#modules_folders_as_modules). It is also somewhat similar to the way that a file in `public/my_folder/index.html` can be reached by a request to `/my_folder`. This means that you cannot directly use an index file. For example this would not work:
|
38
|
+
|
39
|
+
```
|
40
|
+
<%= asset_path("foo/index.js") %>
|
41
|
+
```
|
42
|
+
|
43
|
+
Instead you would need to use:
|
44
|
+
|
45
|
+
```
|
46
|
+
<%= asset_path("foo.js") %>
|
47
|
+
```
|
48
|
+
|
49
|
+
Why would you want to use this behavior? It is common behavior where you might want to include an entire directory of files in a top level javascript. You can do this in sprockets using `require_tree .`
|
50
|
+
|
51
|
+
```
|
52
|
+
//= require_tree .
|
53
|
+
```
|
54
|
+
|
55
|
+
This has the problem that files are required alphabetically. If your directory has `jquery-ui.js` and `jquery.min.js` then sprockets will require `jquery-ui.js` before `jquery` is required which won't work (because jquery-ui depends on jquery). Previously the only way to get the correct ordering would be to rename your files, something like `0-jquery-ui.js`. Instead of doing that you can use an index file.
|
56
|
+
|
57
|
+
For example, if you have an `application.js` and want all the files in the `foo/` folder you could do this:
|
58
|
+
|
59
|
+
```
|
60
|
+
//= require foo.js
|
61
|
+
```
|
62
|
+
|
63
|
+
Then create a file `foo/index.js` that requires all the files in that folder in any order you want:
|
64
|
+
|
65
|
+
```
|
66
|
+
//= require foo.min.js
|
67
|
+
//= require foo-ui.js
|
68
|
+
```
|
69
|
+
|
70
|
+
Now in your `application.js` will correctly load the `foo.min.js` before `foo-ui.js`. If you used `require_tree` it would not work correctly.
|
23
71
|
|
24
72
|
## Understanding the Sprockets Environment
|
25
73
|
|
@@ -449,189 +497,7 @@ submit a pull request.
|
|
449
497
|
|
450
498
|
### Version History
|
451
499
|
|
452
|
-
|
453
|
-
|
454
|
-
* New processor API. Tilt interface is deprecated.
|
455
|
-
* Improved file store caching backend.
|
456
|
-
* MIME Types now accept charset custom charset detecters. Improves support for UTF-16/32 files.
|
457
|
-
* Environment#version no longer affects asset digests. Only used for busting the asset cache.
|
458
|
-
* Removed builtin support for LESS.
|
459
|
-
* Removed `//= include` directive support.
|
460
|
-
* Deprecated `BundledAsset#to_a`. Use `BundledAsset#included` to access debugging subcomponents.
|
461
|
-
* Support circular dependencies. For parity with ES6 modules.
|
462
|
-
* Manifest compilation will no longer generate .gz files by default. [Mixing
|
463
|
-
Content-Encoding and ETags is just a bad
|
464
|
-
idea](https://issues.apache.org/bugzilla/show_bug.cgi?id=39727)
|
465
|
-
* Added linked or referenced assets. When an asset is compiled, any of its links will be compiled as well.
|
466
|
-
* Introduce some limitations around enumerating all logical paths. 4.x will deprecate it and favor linked manifests for compliation.
|
467
|
-
* Add Asset integrity attribute for Subresource Integrity
|
468
|
-
* Default digest changed to SHA256. Configuring `digest_class` is deprecated.
|
469
|
-
* Rename `Asset#digest` to `Asset#hexdigest`. `Asset#digest` is deprecated and will
|
470
|
-
return a raw byte String in 4.x.
|
471
|
-
* Added transitional compatibility flag to `Environment#resolve(path, compat: true)`. 2.x mode operates with `compat: true` and 4.x with `compat: false`
|
472
|
-
* `manifest-abc123.json` renamed to `.sprockets-abc123.json`
|
473
|
-
|
474
|
-
**2.12.3** (October 28, 2014)
|
475
|
-
|
476
|
-
* Security: Fix directory traversal bug in development mode server.
|
477
|
-
|
478
|
-
**2.12.2** (September 5, 2014)
|
479
|
-
|
480
|
-
* Ensure internal asset lookups calls are still restricted to load paths within
|
481
|
-
asset compiles. Though, you should not depend on internal asset resolves to be
|
482
|
-
completely restricted for security reasons. Assets themselves should be
|
483
|
-
considered full scripting environments with filesystem access.
|
484
|
-
|
485
|
-
**2.12.1** (April 17, 2014)
|
486
|
-
|
487
|
-
* Fix making manifest target directory when its different than the output directory.
|
488
|
-
|
489
|
-
**2.12.0** (March 13, 2014)
|
490
|
-
|
491
|
-
* Avoid context reference in SassImporter hack so its Marshallable. Fixes
|
492
|
-
issues with Sass 3.3.x.
|
493
|
-
|
494
|
-
**2.11.0** (February 19, 2014)
|
495
|
-
|
496
|
-
* Cache store must now be an LRU implementation.
|
497
|
-
* Default digest changed to SHA1. To continue using MD5.
|
498
|
-
`env.digest_class = Digest::MD5`.
|
499
|
-
|
500
|
-
**2.10.0** (May 24, 2013)
|
501
|
-
|
502
|
-
* Support for `bower.json`
|
503
|
-
|
504
|
-
**2.9.3** (April 20, 2013)
|
505
|
-
|
506
|
-
* Fixed sass caching bug
|
507
|
-
|
508
|
-
**2.9.2** (April 8, 2013)
|
509
|
-
|
510
|
-
* Improve file freshness check performance
|
511
|
-
* Directive processor encoding fixes
|
512
|
-
|
513
|
-
**2.9.1** (April 6, 2013)
|
514
|
-
|
515
|
-
* Support for Uglifier 2.x
|
516
|
-
|
517
|
-
**2.9.0** (February 25, 2013)
|
518
|
-
|
519
|
-
* Write out gzipped variants of bundled assets.
|
520
|
-
|
521
|
-
**2.8.2** (December 10, 2012)
|
522
|
-
|
523
|
-
* Fixed top level Sass constant references
|
524
|
-
* Fixed manifest logger when environment is disabled
|
525
|
-
|
526
|
-
**2.8.1** (October 31, 2012)
|
527
|
-
|
528
|
-
* Fixed Sass importer bug
|
529
|
-
|
530
|
-
**2.8.0** (October 16, 2012)
|
531
|
-
|
532
|
-
* Allow manifest location to be separated from output directory
|
533
|
-
* Pass logical path and absolute path to each_logical_path iterator
|
534
|
-
|
535
|
-
**2.7.0** (October 10, 2012)
|
536
|
-
|
537
|
-
* Added --css-compressor and --js-compressor command line flags
|
538
|
-
* Added css/js compressor shorthand
|
539
|
-
* Change default manifest.json filename to be a randomized manifest-16HEXBYTES.json
|
540
|
-
* Allow nil environment to be passed to manifest
|
541
|
-
* Allow manifest instance to be set on rake task
|
542
|
-
|
543
|
-
**2.6.0** (September 19, 2012)
|
544
|
-
|
545
|
-
* Added bower component.json require support
|
546
|
-
|
547
|
-
**2.5.0** (September 4, 2012)
|
548
|
-
|
549
|
-
* Fixed Ruby 2.0 RegExp warning
|
550
|
-
* Provide stubbed implementation of context *_path helpers
|
551
|
-
* Add SassCompressor
|
552
|
-
|
553
|
-
**2.4.5** (July 10, 2012)
|
554
|
-
|
555
|
-
* Tweaked some logger levels
|
556
|
-
|
557
|
-
**2.4.4** (July 2, 2012)
|
558
|
-
|
559
|
-
* Canonicalize logical path extensions
|
560
|
-
* Check absolute paths passed to depend_on
|
561
|
-
|
562
|
-
**2.4.3** (May 16, 2012)
|
563
|
-
|
564
|
-
* Exposed :sprockets in sass options
|
565
|
-
* Include dependency paths in asset mtime
|
566
|
-
|
567
|
-
**2.4.2** (May 7, 2012)
|
568
|
-
|
569
|
-
* Fixed MultiJson feature detect
|
570
|
-
|
571
|
-
**2.4.1** (April 26, 2012)
|
572
|
-
|
573
|
-
* Fixed MultiJson API change
|
574
|
-
* Fixed gzip mtime
|
575
|
-
|
576
|
-
**2.4.0** (March 27, 2012)
|
577
|
-
|
578
|
-
* Added global path registry
|
579
|
-
* Added global processor registry
|
580
|
-
|
581
|
-
**2.3.2** (March 26, 2012)
|
582
|
-
|
583
|
-
* Fix Context#logical_path with dots
|
584
|
-
|
585
|
-
**2.3.1** (February 11, 2012)
|
586
|
-
|
587
|
-
* Added bytesize to manifest
|
588
|
-
* Added Asset#bytesize alias
|
589
|
-
* Security: Check path for forbidden access after unescaping
|
590
|
-
|
591
|
-
**2.3.0** (January 16, 2012)
|
592
|
-
|
593
|
-
* Added special Sass importer that automatically tracks any `@import`ed files.
|
594
|
-
|
595
|
-
**2.2.0** (January 10, 2012)
|
596
|
-
|
597
|
-
* Added `sprockets` command line utility.
|
598
|
-
* Added rake/sprocketstask.
|
599
|
-
* Added json manifest log of compiled assets.
|
600
|
-
* Added `stub` directive that allows you to exclude files from the bundle.
|
601
|
-
* Added per environment external encoding (Environment#default_external_encoding). Defaults to UTF-8. Fixes issues where LANG is not set correctly and Rubys default external is set to ASCII.
|
602
|
-
|
603
|
-
**2.1.2** (November 20, 2011)
|
604
|
-
|
605
|
-
* Disabled If-Modified-Since server checks. Fixes some browser caching issues when serving the asset body only. If-None-Match caching is sufficient.
|
606
|
-
|
607
|
-
**2.1.1** (November 18, 2011)
|
608
|
-
|
609
|
-
* Fix windows absolute path check bug.
|
610
|
-
|
611
|
-
**2.1.0** (November 11, 2011)
|
612
|
-
|
613
|
-
* Directive comment lines are now turned into empty lines instead of removed. This way line numbers in
|
614
|
-
CoffeeScript syntax errors are correct.
|
615
|
-
* Performance and caching bug fixes.
|
616
|
-
|
617
|
-
**2.0.3** (October 17, 2011)
|
618
|
-
|
619
|
-
* Detect format extensions from right to left.
|
620
|
-
* Make JST namespace configurable.
|
621
|
-
|
622
|
-
**2.0.2** (October 4, 2011)
|
623
|
-
|
624
|
-
* Fixed loading stale cache from bundler gems.
|
625
|
-
|
626
|
-
**2.0.1** (September 30, 2011)
|
627
|
-
|
628
|
-
* Fixed bug with fingerprinting file names with multiple dots.
|
629
|
-
* Decode URIs as default internal.
|
630
|
-
* Fix symlinked asset directories.
|
631
|
-
|
632
|
-
**2.0.0** (August 29, 2011)
|
633
|
-
|
634
|
-
* Initial public release.
|
500
|
+
Please see the [CHANGELOG](https://github.com/rails/sprockets/tree/master/CHANGELOG.md)
|
635
501
|
|
636
502
|
## License
|
637
503
|
|
data/bin/sprockets
CHANGED
data/lib/sprockets/asset.rb
CHANGED
@@ -19,7 +19,6 @@ module Sprockets
|
|
19
19
|
@content_type = attributes[:content_type]
|
20
20
|
@filename = attributes[:filename]
|
21
21
|
@id = attributes[:id]
|
22
|
-
@integrity = attributes[:integrity]
|
23
22
|
@load_path = attributes[:load_path]
|
24
23
|
@logical_path = attributes[:logical_path]
|
25
24
|
@metadata = attributes[:metadata]
|
@@ -140,7 +139,9 @@ module Sprockets
|
|
140
139
|
end
|
141
140
|
|
142
141
|
# Public: A "named information" URL for subresource integrity.
|
143
|
-
|
142
|
+
def integrity
|
143
|
+
DigestUtils.integrity_uri(metadata[:digest])
|
144
|
+
end
|
144
145
|
|
145
146
|
# Public: Add enumerator to allow `Asset` instances to be used as Rack
|
146
147
|
# compatible body objects.
|
data/lib/sprockets/base.rb
CHANGED
@@ -10,6 +10,8 @@ require 'sprockets/path_dependency_utils'
|
|
10
10
|
require 'sprockets/path_utils'
|
11
11
|
require 'sprockets/resolve'
|
12
12
|
require 'sprockets/server'
|
13
|
+
require 'sprockets/loader'
|
14
|
+
require 'sprockets/uri_tar'
|
13
15
|
|
14
16
|
module Sprockets
|
15
17
|
# `Base` class for `Environment` and `Cached`.
|
@@ -48,9 +50,10 @@ module Sprockets
|
|
48
50
|
# Caveat: Digests are cached by the path's current mtime. Its possible
|
49
51
|
# for a files contents to have changed and its mtime to have been
|
50
52
|
# negligently reset thus appearing as if the file hasn't changed on
|
51
|
-
# disk. Also, the mtime is only read to the nearest second.
|
53
|
+
# disk. Also, the mtime is only read to the nearest second. It's
|
52
54
|
# also possible the file was updated more than once in a given second.
|
53
|
-
|
55
|
+
key = UnloadedAsset.new(path, self).file_digest_key(stat.mtime.to_i)
|
56
|
+
cache.fetch(key) do
|
54
57
|
self.stat_digest(path, stat)
|
55
58
|
end
|
56
59
|
end
|
@@ -95,5 +98,13 @@ module Sprockets
|
|
95
98
|
"root=#{root.to_s.inspect}, " +
|
96
99
|
"paths=#{paths.inspect}>"
|
97
100
|
end
|
101
|
+
|
102
|
+
def compress_from_root(uri)
|
103
|
+
URITar.new(uri, self).compress
|
104
|
+
end
|
105
|
+
|
106
|
+
def expand_from_root(uri)
|
107
|
+
URITar.new(uri, self).expand
|
108
|
+
end
|
98
109
|
end
|
99
110
|
end
|
data/lib/sprockets/bundle.rb
CHANGED
@@ -44,7 +44,11 @@ module Sprockets
|
|
44
44
|
def self.process_bundle_reducers(assets, reducers)
|
45
45
|
initial = {}
|
46
46
|
reducers.each do |k, (v, _)|
|
47
|
-
|
47
|
+
if v.respond_to?(:call)
|
48
|
+
initial[k] = v.call
|
49
|
+
elsif !v.nil?
|
50
|
+
initial[k] = v
|
51
|
+
end
|
48
52
|
end
|
49
53
|
|
50
54
|
assets.reduce(initial) do |h, asset|
|
@@ -36,7 +36,6 @@ module Sprockets
|
|
36
36
|
# (default: 1000).
|
37
37
|
def initialize(root, max_size = DEFAULT_MAX_SIZE, logger = self.class.default_logger)
|
38
38
|
@root = root
|
39
|
-
@size = find_caches.inject(0) { |n, (_, stat)| n + stat.size }
|
40
39
|
@max_size = max_size
|
41
40
|
@gc_size = max_size * 0.75
|
42
41
|
@logger = logger
|
@@ -107,11 +106,11 @@ module Sprockets
|
|
107
106
|
# Write data
|
108
107
|
PathUtils.atomic_write(path) do |f|
|
109
108
|
f.write(raw)
|
110
|
-
@size
|
109
|
+
@size = size + f.size unless exists
|
111
110
|
end
|
112
111
|
|
113
112
|
# GC if necessary
|
114
|
-
gc! if
|
113
|
+
gc! if size > @max_size
|
115
114
|
|
116
115
|
value
|
117
116
|
end
|
@@ -120,7 +119,7 @@ module Sprockets
|
|
120
119
|
#
|
121
120
|
# Returns String.
|
122
121
|
def inspect
|
123
|
-
"#<#{self.class} size=#{
|
122
|
+
"#<#{self.class} size=#{size}/#{@max_size}>"
|
124
123
|
end
|
125
124
|
|
126
125
|
private
|
@@ -138,6 +137,10 @@ module Sprockets
|
|
138
137
|
}.sort_by { |_, stat| stat.mtime.to_i }
|
139
138
|
end
|
140
139
|
|
140
|
+
def size
|
141
|
+
@size ||= compute_size(find_caches)
|
142
|
+
end
|
143
|
+
|
141
144
|
def compute_size(caches)
|
142
145
|
caches.inject(0) { |sum, (_, stat)| sum + stat.size }
|
143
146
|
end
|